templatekw: add {changes}, {distance} and {tag} to the {latesttag} keyword
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 24 Aug 2015 23:30:17 -0400
changeset 26486 8a732c322ca7
parent 26485 43bf9471fae9
child 26487 3f234db6fe8d
templatekw: add {changes}, {distance} and {tag} to the {latesttag} keyword
mercurial/templatekw.py
tests/test-command-template.t
--- a/mercurial/templatekw.py	Sun Aug 23 23:44:58 2015 -0400
+++ b/mercurial/templatekw.py	Mon Aug 24 23:30:17 2015 -0400
@@ -344,11 +344,7 @@
     """:latesttag: List of strings. The global tags on the most recent globally
     tagged ancestor of this changeset.
     """
-    repo, ctx = args['repo'], args['ctx']
-    cache = args['cache']
-    latesttags = getlatesttags(repo, ctx, cache)[2]
-
-    return showlist('latesttag', latesttags, separator=':', **args)
+    return showlatesttags(None, **args)
 
 def showlatesttags(pattern, **args):
     """helper method for the latesttag keyword and function"""
--- a/tests/test-command-template.t	Sun Aug 23 23:44:58 2015 -0400
+++ b/tests/test-command-template.t	Mon Aug 24 23:30:17 2015 -0400
@@ -2690,6 +2690,19 @@
   1: t1+0
   0: null+1
 
+  $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+  10: t5+5,5 
+  9: t5+4,4 
+  8: t5+3,3 
+  7: t5+2,2 
+  6: t5+1,1 
+  5: t5+0,0 
+  4: at3+1,1 t3+1,1 
+  3: at3+0,0 t3+0,0 
+  2: t2+0,0 
+  1: t1+0,0 
+  0: null+1,1 
+
   $ hg log --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
   10: t3, C: 8, D: 7
   9: t3, C: 7, D: 6