diff mercurial/hgweb/webutil.py @ 35486:4c7ae95e1c71

hgweb: link to successors of obsoleted changesets _siblings() prepare various useful properties to use in templates. This function usually prepares parents and children of changesets for use in hgweb templates, but it can be used for successors too. It's needed because item['successors'] is a _hybrid object that works well when used in regular templates, but in hgweb templates work slightly differently and can't get hex nodes of the successors, which are required for these links to work.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 22 Dec 2017 21:25:46 +0800
parents 1721ce06100a
children 34e850440271
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Tue Nov 21 17:03:41 2017 +0800
+++ b/mercurial/hgweb/webutil.py	Fri Dec 22 21:25:46 2017 +0800
@@ -353,7 +353,10 @@
     return '%d:%d' % (fromline + 1, toline)
 
 def succsandmarkers(repo, ctx):
-    return templatekw.showsuccsandmarkers(repo, ctx)
+    for item in templatekw.showsuccsandmarkers(repo, ctx):
+        item['successors'] = _siblings(repo[successor]
+                                       for successor in item['successors'])
+        yield item
 
 def commonentry(repo, ctx):
     node = ctx.node()