Patchwork [6,of,6,V2] templatekw: add {changes}, {distance} and {tag} to the {latesttag} keyword

login
register
mail settings
Submitter Matt Harbison
Date Oct. 6, 2015, 1:40 a.m.
Message ID <49fd04f0b07ce5e4d02f.1444095658@Envy>
Download mbox | patch
Permalink /patch/10827/
State Accepted
Commit 8a732c322ca782424bdad45936b48ee65f20ae78
Headers show

Comments

Matt Harbison - Oct. 6, 2015, 1:40 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1440473417 14400
#      Mon Aug 24 23:30:17 2015 -0400
# Node ID 49fd04f0b07ce5e4d02f612812a5767c7573ee08
# Parent  c775434eb6682794dafa4a03df2d5fb764f09648
templatekw: add {changes}, {distance} and {tag} to the {latesttag} keyword
Yuya Nishihara - Oct. 6, 2015, 1:14 p.m.
On Mon, 05 Oct 2015 21:40:58 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1440473417 14400
> #      Mon Aug 24 23:30:17 2015 -0400
> # Node ID 49fd04f0b07ce5e4d02f612812a5767c7573ee08
> # Parent  c775434eb6682794dafa4a03df2d5fb764f09648
> templatekw: add {changes}, {distance} and {tag} to the {latesttag} keyword
> 
> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -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"""
> diff --git a/tests/test-command-template.t b/tests/test-command-template.t
> --- a/tests/test-command-template.t
> +++ b/tests/test-command-template.t
> @@ -2690,6 +2690,19 @@
>    1: t1+0
>    0: null+1
>  
> +  $ hg log --template "{rev}: {latesttag() % '{tag}+{distance},{changes} '}\n"

Fixed this to use the "latesttag" keyword, and pushed them to the clowncopter,
thanks!

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -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"""
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -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