obsfate: display more data about direct prune markers
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 16 Jun 2017 18:03:32 +0200
changeset 2611 45f5dbb24684
parent 2610 ee37ab3de5f7
child 2612 fd35b428edfc
obsfate: display more data about direct prune markers This does not handle all cases, but this should handle the most common ones.
hgext3rd/evolve/templatekw.py
tests/test-evolve-templates.t
--- a/hgext3rd/evolve/templatekw.py	Fri Jun 16 17:58:17 2017 +0200
+++ b/hgext3rd/evolve/templatekw.py	Fri Jun 16 18:03:32 2017 +0200
@@ -139,9 +139,25 @@
     if successorssets == []:
         successorssets = [[]]
 
-    values = []
+    succsmap = repo.obsstore.successors
+    fullsuccessorsets = [] # successor set + markers
     for sset in successorssets:
-        rawmarkers = obshistory.successorsetallmarkers(sset, pathcache)
+        if sset:
+            markers = obshistory.successorsetallmarkers(sset, pathcache)
+            fullsuccessorsets.append((sset, markers))
+        else:
+            # XXX we do not catch all prune markers (eg rewritten then pruned)
+            # (fix me later)
+            foundany = False
+            for mark in succsmap.get(ctx.node(), ()):
+                if not mark[1]:
+                    foundany = True
+                    fullsuccessorsets.append((sset, [mark]))
+            if not foundany:
+                fullsuccessorsets.append(([], []))
+
+    values = []
+    for sset, rawmarkers in fullsuccessorsets:
         raw = obshistory.preparesuccessorset(sset, rawmarkers)
 
         # As we can't do something like
--- a/tests/test-evolve-templates.t	Fri Jun 16 17:58:17 2017 +0200
+++ b/tests/test-evolve-templates.t	Fri Jun 16 18:03:32 2017 +0200
@@ -167,7 +167,7 @@
   |      Fate: rewritten by test2 as d004c8f274b9
   |
   | x  f137d23bb3e1
-  | |    Fate: pruned
+  | |    Fate: pruned by test1
   | |
   | x  471f378eab4c
   |/     Successors: [a468dc9b3633]
@@ -203,7 +203,7 @@
   |      Fate: rewritten by test2 as d004c8f274b9
   |
   | x  f137d23bb3e1
-  | |    Fate: pruned
+  | |    Fate: pruned by test1
   | |
   | x  471f378eab4c
   |/     Successors: [a468dc9b3633]
@@ -225,7 +225,7 @@
   |/     Obsfate: rewritten by test2 as d004c8f274b9 (at 2001-04-19 04:25 +0000)
   |
   | x  f137d23bb3e1
-  | |    Obsfate: pruned
+  | |    Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000)
   | |
   | x  471f378eab4c
   |/     Obsfate: rewritten by test1 as a468dc9b3633 (at 2009-02-13 23:31 +0000)
@@ -238,7 +238,7 @@
   |
   | x  a468dc9b3633 [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["ef1", "1"], ["user", "test2"]], [987654321.0, 0], null]], "max_date": [987654321.0, 0], "min_date": [987654321.0, 0], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], "users": ["test2"], "verb": "rewritten"}]
   |/
-  | x  f137d23bb3e1 [{"markers": [], "successors": [], "verb": "pruned"}]
+  | x  f137d23bb3e1 [{"markers": [["f137d23bb3e11dc1daeb6264fac9cb2433782e15", [], 0, [["ef1", "0"], ["user", "test1"]], [1234567890.0, 0], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]], "max_date": [1234567890.0, 0], "min_date": [1234567890.0, 0], "successors": [], "users": ["test1"], "verb": "pruned"}]
   | |
   | x  471f378eab4c [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["ef1", "9"], ["user", "test1"]], [1234567890.0, 0], null]], "max_date": [1234567890.0, 0], "min_date": [1234567890.0, 0], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], "users": ["test1"], "verb": "rewritten"}]
   |/
@@ -1127,13 +1127,13 @@
   (use 'hg evolve' to update to its parent successor)
   $ hg tlog
   @  471f378eab4c
-  |    Fate: pruned
+  |    Fate: pruned by test
   |
   o  ea207398892e
   
   $ hg fatelog -v
   @  471f378eab4c
-  |    Obsfate: pruned
+  |    Obsfate: pruned by test (at 1970-01-01 00:00 +0000)
   |
   o  ea207398892e