templatekw: make {latesttag} a hybrid list
This maintains the previous behavior of expanding {latesttag} to a string
containing all of the tags, joined by ':'. But now it also allows list type
operations.
I'm unsure if the plural handling is correct (i.e. it seems like it is usually
"{foos % '{foo}'}"), but I guess we are stuck with this because the singular
form previously existed.
--- a/mercurial/templatekw.py Mon Jul 06 23:12:24 2015 -0400
+++ b/mercurial/templatekw.py Mon Jul 06 23:23:22 2015 -0400
@@ -325,11 +325,15 @@
"""
return showlist('file', args['ctx'].files(), **args)
-def showlatesttag(repo, ctx, templ, cache, **args):
- """:latesttag: String. Most recent global tag in the ancestors of this
- changeset.
+def showlatesttag(**args):
+ """:latesttag: List of strings. The global tags on the most recent globally
+ tagged ancestor of this changeset.
"""
- return ':'.join(getlatesttags(repo, ctx, cache)[2])
+ repo, ctx = args['repo'], args['ctx']
+ cache = args['cache']
+ latesttags = getlatesttags(repo, ctx, cache)[2]
+
+ return showlist('latesttag', latesttags, separator=':', **args)
def showlatesttagdistance(repo, ctx, templ, cache, **args):
""":latesttagdistance: Integer. Longest path to the latest tag."""
--- a/tests/test-tag.t Mon Jul 06 23:12:24 2015 -0400
+++ b/tests/test-tag.t Mon Jul 06 23:23:22 2015 -0400
@@ -458,6 +458,9 @@
$ echo c4 > f4
$ hg log -r '.' -T "{changessincelatesttag} changes since {latesttag}\n"
2 changes since t4:t6
+ $ hg log -r '.' -T "{latesttag % '{latesttag}\n'}"
+ t4
+ t6
$ hg ci -A -m4
adding f4
$ hg log -r 'wdir()' -T "{changessincelatesttag} changes since {latesttag}\n"