diff mercurial/obsutil.py @ 33930:e278d6d2d7d2

template: add minimal obsfate template function The goal of this series is to have templates capable of displaying the evolution of a changeset in a clean and human-readable way. Add the succsandmarkers template return successors and markers so it can be used separately like this: > {succsandmarkers % "{get(succsandmarkers, "markers")|json};"} The following patches will add template functions that takes successors and markers as inputs and compute various obsfate fields from them.
author Boris Feld <boris.feld@octobus.net>
date Thu, 17 Aug 2017 18:26:11 +0200
parents 34e10e09afa5
children c0bbaefc2c5a
line wrap: on
line diff
--- a/mercurial/obsutil.py	Mon Jul 03 03:27:58 2017 +0200
+++ b/mercurial/obsutil.py	Thu Aug 17 18:26:11 2017 +0200
@@ -567,3 +567,18 @@
                 final.reverse() # put small successors set first
                 cache[current] = final
     return cache[initialnode]
+
+def successorsandmarkers(repo, ctx):
+    """compute the raw data needed for computing obsfate
+    Returns a list of dict, one dict per successors set
+    """
+    if not ctx.obsolete():
+        return None
+
+    ssets = successorssets(repo, ctx.node(), closest=True)
+
+    values = []
+    for sset in ssets:
+        values.append({'successors': sset, 'markers': sset.markers})
+
+    return values