changeset 5262:0329246c70f3

obslog: support --filternonlocal with --no-graph
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 29 Mar 2020 17:21:56 +0700
parents 66a913cc53af
children 9923c6d6f0a8
files hgext3rd/evolve/obshistory.py tests/test-evolve-obshistory-amend.t tests/test-evolve-obshistory-split.t
diffstat 3 files changed, 35 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Wed Mar 18 19:20:17 2020 +0700
+++ b/hgext3rd/evolve/obshistory.py	Sun Mar 29 17:21:56 2020 +0700
@@ -446,27 +446,23 @@
     """
     fm = ui.formatter(b'debugobshistory', pycompat.byteskwargs(opts))
     predecessors = repo.obsstore.predecessors
-    successors = repo.obsstore.successors
     nodec = repo.changelog.node
     unfi = repo.unfiltered()
     nodes = [nodec(r) for r in revs]
+    seen = set(nodes)
+    toshow = []
 
-    seen = set(nodes)
+    filternonlocal = opts and opts.get('filternonlocal')
+    includediff = opts and opts.get('patch')
 
     while nodes:
         ctxnode = nodes.pop()
 
-        displaynode(fm, unfi, ctxnode)
-
-        succs = successors.get(ctxnode, ())
-
-        markerfm = fm.nested(b"markers")
-        for successor in sorted(succs):
-            includediff = opts and opts.get("patch")
-            displaymarkers(ui, markerfm, successor[1], [successor], ctxnode,
-                           unfi, includediff)
-        markerfm.end()
-        fm.plain(b'\n')
+        if ctxnode in unfi:
+            toshow.append(unfi[ctxnode])
+        else:
+            if filternonlocal is False:
+                toshow.append(missingchangectx(unfi, ctxnode))
 
         preds = predecessors.get(ctxnode, ())
         for p in sorted(preds):
@@ -474,6 +470,21 @@
             if p[0] not in seen:
                 seen.add(p[0])
                 nodes.append(p[0])
+
+    for ctx in toshow:
+        displaynode(fm, unfi, ctx.node())
+
+        markerfm = fm.nested(b"markers")
+
+        data = _nodesandmarkers(repo, ctx, filternonlocal)
+        for nodes_, markers in data:
+            displaymarkers(ui, markerfm, nodes_, markers, ctx.node(), unfi,
+                           includediff)
+
+        markerfm.end()
+
+        fm.plain(b'\n')
+
     fm.end()
 
 def displaynode(fm, repo, node):
--- a/tests/test-evolve-obshistory-amend.t	Wed Mar 18 19:20:17 2020 +0700
+++ b/tests/test-evolve-obshistory-amend.t	Sun Mar 29 17:21:56 2020 +0700
@@ -263,10 +263,6 @@
   $ hg obslog -R $TESTTMP/server --no-graph -f --patch 4ae3a4151de9
   4ae3a4151de9 (1) A1
   
-  471f378eab4c
-    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-      (No patch available, context is not local)
-  
 
 Amend two more times
 ====================
@@ -482,15 +478,16 @@
   $ hg obslog -R $TESTTMP/server --no-graph -f --patch 92210308515b
   92210308515b (2) A3
   
-  4f1685185907
-    reworded(description) as 92210308515b using amend by test (Thu Jan 01 00:00:01 1970 +0000)
-      (No patch available, context is not local)
+  4ae3a4151de9 (1) A1
+    reworded(description) as 92210308515b using amend by test (between Thu Jan 01 00:00:00 1970 +0000 and Thu Jan 01 00:00:01 1970 +0000)
+      diff -r 4ae3a4151de9 -r 92210308515b changeset-description
+      --- a/changeset-description
+      +++ b/changeset-description
+      @@ -1,3 +1,3 @@
+      -A1
+      +A3
+   
+      -Better commit message
+      +Better better better commit message
   
-  4ae3a4151de9 (1) A1
-    reworded(description) as 4f1685185907 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-      (No patch available, successor is unknown locally)
   
-  471f378eab4c
-    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-      (No patch available, context is not local)
-  
--- a/tests/test-evolve-obshistory-split.t	Wed Mar 18 19:20:17 2020 +0700
+++ b/tests/test-evolve-obshistory-split.t	Sun Mar 29 17:21:56 2020 +0700
@@ -258,12 +258,6 @@
       note: testing split
       (No patch available, context is not local)
   
-
   $ hg obslog -R $TESTTMP/server --no-graph -f --all --patch tip
   f257fde29c7a (2) A0
   
-  471597cad322
-    split(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-      note: testing split
-      (No patch available, context is not local)
-