# HG changeset patch
# User Anton Shestakov <a...@dwimlabs.net>
# Date 1523709254 -28800
#      Sat Apr 14 20:34:14 2018 +0800
# Node ID c7fc8a7ca7f5ca13e7e54a2690872f4252a41796
# Parent  987c05eac1801d0b919c874280d03f9e8cccb411
templates: make divergentnodes in whyunstable keyword be a hybrid list

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -809,8 +809,11 @@ def showwhyunstable(context, mapping):
     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')
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -725,6 +725,8 @@ Use scmutil.cleanupnodes API to create d
   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
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to