diff hgext/histedit.py @ 28224:8ec5478aa0d6

histedit: also handle locally missing nodes when reading obsolescence The previous version of the code was interpreting markers to a missing node as a prune in all cases. The expected way to handle such situation is to keep reading markers, only turning successors into "prune" if they are at the end of a chain. We update the code and add a test for this.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 24 Feb 2016 16:58:07 +0100
parents eed7d8c07c20
children 89e04a33e958
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Feb 24 18:42:59 2016 +0000
+++ b/hgext/histedit.py	Wed Feb 24 16:58:07 2016 +0100
@@ -1397,6 +1397,8 @@
         return oldreplacements
 
     unfi = repo.unfiltered()
+    nm = unfi.changelog.nodemap
+    obsstore = repo.obsstore
     newreplacements = list(oldreplacements)
     oldsuccs = [r[1] for r in oldreplacements]
     # successors that have already been added to succstocheck once
@@ -1404,15 +1406,13 @@
     succstocheck = list(seensuccs)
     while succstocheck:
         n = succstocheck.pop()
-        try:
-            ctx = unfi[n]
-        except error.RepoError:
-            # XXX node unknown locally, we should properly follow marker
+        missing = nm.get(n) is None
+        markers = obsstore.successors.get(n, ())
+        if missing and not markers:
+            # dead end, mark it as such
             newreplacements.append((n, ()))
-            continue
-
-        for marker in obsolete.successormarkers(ctx):
-            nsuccs = marker.succnodes()
+        for marker in markers:
+            nsuccs = marker[1]
             newreplacements.append((n, nsuccs))
             for nsucc in nsuccs:
                 if nsucc not in seensuccs: