obshistory: create _fatemarkers() similar to _originmarkers()
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 29 Apr 2020 21:57:59 +0800
changeset 5350 883df7f06f2e
parent 5349 e8660b28bfee
child 5351 34c8aa32bc56
obshistory: create _fatemarkers() similar to _originmarkers()
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Thu May 07 01:29:48 2020 +0200
+++ b/hgext3rd/evolve/obshistory.py	Wed Apr 29 21:57:59 2020 +0800
@@ -213,6 +213,20 @@
         if not marker[1]:
             yield ((), (marker,))
 
+def _fatemarkers(repo, ctx, filternonlocal):
+    successors = repo.obsstore.successors
+    if filternonlocal:
+        r = obsutil.successorsandmarkers(repo, ctx)
+        if r is None:
+            r = []
+        for succset in sorted(r):
+            if succset[b'markers']:
+                yield (succset[b'successors'], succset[b'markers'])
+    else:
+        markers = successors.get(ctx.node(), ())
+        for marker in sorted(markers):
+            yield (marker[1], [marker])
+
 def _nodesandmarkers(repo, ctx, filternonlocal, origin):
     """ Return data for obslog and obsolescence-related template keywords.
 
@@ -227,17 +241,8 @@
         for (nodes, markers) in _originmarkers(repo, ctx, filternonlocal):
             yield (nodes, markers)
     else:
-        if filternonlocal:
-            r = obsutil.successorsandmarkers(repo, ctx)
-            if r is None:
-                r = []
-            for succset in sorted(r):
-                if succset[b'markers']:
-                    yield (succset[b'successors'], succset[b'markers'])
-        else:
-            markers = repo.obsstore.successors.get(ctx.node(), ())
-            for marker in sorted(markers):
-                yield (marker[1], [marker])
+        for (nodes, markers) in _fatemarkers(repo, ctx, filternonlocal):
+            yield (nodes, markers)
 
 class obsmarker_printer(logcmdutil.changesetprinter):
     """show (available) information about a node