# HG changeset patch # User Matt Harbison # Date 1436239402 14400 # Node ID b8245386ab4045e3caf705fc15044081442f9efa # Parent b44e483726d30456d71693e757c1f928f577c193 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. diff -r b44e483726d3 -r b8245386ab40 mercurial/templatekw.py --- 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.""" diff -r b44e483726d3 -r b8245386ab40 tests/test-tag.t --- 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"