Patchwork templates: make divergentnodes in whyunstable keyword be a hybrid list

login
register
mail settings
Submitter Anton Shestakov
Date April 14, 2018, 12:39 p.m.
Message ID <c7fc8a7ca7f5ca13e7e5.1523709561@neuro>
Download mbox | patch
Permalink /patch/31020/
State Accepted
Headers show

Comments

Anton Shestakov - April 14, 2018, 12:39 p.m.
# HG changeset patch
# User Anton Shestakov <av6@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
Yuya Nishihara - April 14, 2018, 1:01 p.m.
On Sat, 14 Apr 2018 20:39:21 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@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

Queued, thanks.

Patch

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