Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 300:56df37d7878e
Keywords HGlatesttags, HGlatesttagdistance, HGlatesttagdate and HGlatesttagjustdate
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Wed, 30 Jan 2019 01:10:33 +0100 |
| parents | bbbb23202d6e |
| children | fa494abb4094 |
| files | extensions/kwarchive.py tests/test-kwarchive.t |
| diffstat | 2 files changed, 65 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/kwarchive.py Wed Jan 30 00:16:27 2019 +0100 +++ b/extensions/kwarchive.py Wed Jan 30 01:10:33 2019 +0100 @@ -88,7 +88,8 @@ from mercurial.i18n import _ from mercurial import (archival, config, cmdutil, error, match, subrepo, - pycompat, scmutil, templatefilters, util, node) + pycompat, scmutil, templatefilters, templatekw, + util, node) try: from mercurial import registrar except ImportError: @@ -705,10 +706,16 @@ elif path_uri.startswith(b'/'): # an absolute POSIX path path_uri = b"file://" + path_uri + tagcache={} + latesttags = templatekw.getlatesttags(ctx.repo(), ctx, tagcache) keywords = { "HGpath": path_uri, # XXX FIXME: Should Archive an alias of this "HGbranch": ctx.branch(), "HGtags": " ".join([tag for tag in ctx.tags() if tag != "tip"]), + "HGlatesttags": " ".join(latesttags[2]), + "HGlatesttagdistance": latesttags[1], + "HGlatesttagdate": templatefilters.isodatesec(util.makedate(latesttags[0])), + "HGlatesttagjustdate": templatefilters.shortdate(util.makedate(latesttags[0])), "HGbookmarks": " ".join([bm if not bm.startswith('*') else bm[1:] for bm in ctx.bookmarks() if bm != "@"]), "State": ctx.phasestr(),
--- a/tests/test-kwarchive.t Wed Jan 30 00:16:27 2019 +0100 +++ b/tests/test-kwarchive.t Wed Jan 30 01:10:33 2019 +0100 @@ -12,6 +12,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: file://$TESTTMP/repo1 $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -19,7 +23,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -36,6 +40,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: file://$TESTTMP/repo1 $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -43,7 +51,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $ $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $ @@ -60,6 +68,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: .../repo1 $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -67,7 +79,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: .../repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second draft $ $HGid: .../repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second draft $ @@ -84,6 +96,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: file://$TESTTMP/repo1 $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -91,7 +107,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second@example.com draft $ $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second@example.com draft $ @@ -108,6 +124,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: hg+https://hg/repo.hg $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -115,7 +135,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: hg+https://hg/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: hg+https://hg/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -133,6 +153,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: https://theuser:thepass@hg.example.com:4443/repo.hg $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -140,7 +164,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -157,6 +181,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: https://theuser:***@hg.example.com:4443/repo.hg $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -164,7 +192,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -181,6 +209,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: https://hg.example.com:4443/repo.hg $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -188,7 +220,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -205,6 +237,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: .../repo.hg $ $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $ $HGshortdate: 1970-01-01 $ @@ -212,7 +248,7 @@ $JustDate: 1970-01-01 $ $Revision: 8c27876b7952 $ $State: draft $ - (?) + ^$ (re) $File: test.file $ $HGheader: .../repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $ $HGid: .../repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $ @@ -353,6 +389,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 5 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: hg+https://hg/repo.hg $ $HGrevision: 5da89dae8d25aa4d9c6973c1269cca7d37822e6e $ $HGshortdate: 1970-01-01 $ @@ -375,6 +415,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 4 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: file:///subrepo1 $ $HGrevision: d1b8815da083673940df64aa6e450308e6b493b0 $ $HGshortdate: 1970-01-01 $ @@ -397,6 +441,10 @@ $Date: 1970-01-01 00:00:00 +0000 $ $HGbookmarks: $ $HGbranch: default $ + $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $ + $HGlatesttagdistance: 3 $ + $HGlatesttagjustdate: 1970-01-01 $ + $HGlatesttags: null $ $HGpath: file:///subrepo2 $ $HGrevision: 0c95c26060e11bb02614a08140e64df4bf9f4db1 $ $HGshortdate: 1970-01-01 $
