changeset 2599:df4a1b02308f

template: used hex-node for the precursors underlying data As pointed by yuya on mercurial-dev we should not use binary node here.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 16 Jun 2017 17:11:20 +0200
parents ed977325cd2a
children e987b403d047
files hgext3rd/evolve/templatekw.py tests/test-evolve-templates.t
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/templatekw.py	Fri Jun 16 09:22:39 2017 +0200
+++ b/hgext3rd/evolve/templatekw.py	Fri Jun 16 17:11:20 2017 +0200
@@ -69,14 +69,15 @@
     displayed
     """
     precursors = sorted(closestprecursors(repo, ctx.node()))
+    precursors = [node.hex(p) for p in precursors]
 
     # <= hg-4.1 requires an explicite gen.
     # we can use None once the support is dropped
     #
     # They also requires an iterator instead of an iterable.
-    gen = iter(" ".join(map(node.short, precursors)))
+    gen = iter(" ".join(p[:12] for p in precursors))
     return templatekw._hybrid(gen.__iter__(), precursors, lambda x: {'precursor': x},
-                              lambda d: "%s" % node.short(d['precursor']))
+                              lambda d: d['precursor'][:12])
 
 def closestsuccessors(repo, nodeid):
     """ returns the closest visible successors sets instead.
--- a/tests/test-evolve-templates.t	Fri Jun 16 09:22:39 2017 +0200
+++ b/tests/test-evolve-templates.t	Fri Jun 16 17:11:20 2017 +0200
@@ -117,6 +117,17 @@
   |
   o  ea207398892e
   
+
+(check json)
+
+  $ hg log -GT '{precursors|json}\n'
+  o  ["471f378eab4c5e25f6c77f785b27c936efb22874"]
+  |
+  | @  []
+  |/
+  o  []
+  
+
   $ hg up 'desc(A1)' --hidden
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete! (a468dc9b3633)