changeset 5302:883df7f06f2e

obshistory: create _fatemarkers() similar to _originmarkers()
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 29 Apr 2020 21:57:59 +0800
parents e8660b28bfee
children 34c8aa32bc56
files hgext3rd/evolve/obshistory.py
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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