changeset 37686:b1b1b0626f59

templates: make divergentnodes in whyunstable keyword be a hybrid list
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 14 Apr 2018 20:34:14 +0800
parents 76cd5816268e
children 8872d46643b6
files mercurial/templatekw.py tests/test-obsolete-divergent.t
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Mon Mar 26 17:00:12 2018 +0800
+++ b/mercurial/templatekw.py	Sat Apr 14 20:34:14 2018 +0800
@@ -809,8 +809,10 @@
     for entry in entries:
         if entry.get('divergentnodes'):
             dnodes = entry['divergentnodes']
-            entry['divergentnodes'] = ''.join(formatnode(dnode)
-                                              for dnode in dnodes)
+            dnhybrid = _hybrid(None, [dnode.hex() for dnode in dnodes],
+                               lambda x: {'ctx': repo[x]},
+                               lambda x: formatnode(repo[x]))
+            entry['divergentnodes'] = dnhybrid
 
     tmpl = '{instability}:{divergentnodes} {reason} {node|short}'
     return templateutil.mappinglist(entries, tmpl=tmpl, sep='\n')
--- a/tests/test-obsolete-divergent.t	Mon Mar 26 17:00:12 2018 +0800
+++ b/tests/test-obsolete-divergent.t	Sat Apr 14 20:34:14 2018 +0800
@@ -725,6 +725,8 @@
   content-divergent: 4:70d5a63ca112 (draft) predecessor a178212c3433
   $ hg log -r 1a2a9b5b0030 --hidden -T '{whyunstable%"{instability}:{divergentnodes} {reason} {node}\n"}'
   content-divergent: 4:70d5a63ca112 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
+  $ hg log -r 1a2a9b5b0030 --hidden -T '{whyunstable%"{instability}:{divergentnodes % " {node} ({phase})"} {reason} {node}\n"}'
+  content-divergent: 70d5a63ca112acb3764bc1d7320ca90ea688d671 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
 
 #if serve