histedit: backout changeset 2b599f5468a4
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 26 Mar 2017 15:34:39 +0200
changeset 31637 c4dd1e7c1dab
parent 31636 f3b151278655
child 31638 259e5dc21c1d
histedit: backout changeset 2b599f5468a4 Its parent is about to be backedout so this one needs to be removed too.
hgext/histedit.py
--- a/hgext/histedit.py	Sun Mar 26 16:48:29 2017 -0400
+++ b/hgext/histedit.py	Sun Mar 26 15:34:39 2017 +0200
@@ -1580,6 +1580,28 @@
         finally:
             release(tr, lock)
 
+def cleanupnode(ui, repo, name, nodes):
+    """strip a group of nodes from the repository
+
+    The set of node to strip may contains unknown nodes."""
+    ui.debug('should strip %s nodes %s\n' %
+             (name, ', '.join([node.short(n) for n in nodes])))
+    with repo.lock():
+        # do not let filtering get in the way of the cleanse
+        # we should probably get rid of obsolescence marker created during the
+        # histedit, but we currently do not have such information.
+        repo = repo.unfiltered()
+        # Find all nodes that need to be stripped
+        # (we use %lr instead of %ln to silently ignore unknown items)
+        nm = repo.changelog.nodemap
+        nodes = sorted(n for n in nodes if n in nm)
+        roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
+        for c in roots:
+            # We should process node in reverse order to strip tip most first.
+            # but this trigger a bug in changegroup hook.
+            # This would reduce bundle overhead
+            repair.strip(ui, repo, c)
+
 def safecleanupnode(ui, repo, name, nodes):
     """strip or obsolete nodes
 
@@ -1606,23 +1628,7 @@
         if markers:
             obsolete.createmarkers(repo, markers)
     else:
-        ui.debug('should strip %s nodes %s\n' %
-                 (name, ', '.join([node.short(n) for n in nodes])))
-        with repo.lock():
-            # Do not let filtering get in the way of the cleanse we should
-            # probably get rid of obsolescence marker created during the
-            # histedit, but we currently do not have such information.
-            repo = repo.unfiltered()
-            # Find all nodes that need to be stripped
-            # (we use %lr instead of %ln to silently ignore unknown items)
-            nm = repo.changelog.nodemap
-            nodes = sorted(n for n in nodes if n in nm)
-            roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
-            for c in roots:
-                # We should process node in reverse order to strip tip most
-                # first, but this trigger a bug in changegroup hook. This
-                # would reduce bundle overhead
-                repair.strip(ui, repo, c)
+        return cleanupnode(ui, repo, name, nodes)
 
 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
     if isinstance(nodelist, str):