Patchwork [1,of,3] histedit: backout changeset 2b599f5468a4

login
register
mail settings
Submitter Pierre-Yves David
Date March 26, 2017, 2:16 p.m.
Message ID <35acda0fd5f30f45a068.1490537767@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19687/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Pierre-Yves David - March 26, 2017, 2:16 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1490535279 -7200
#      Sun Mar 26 15:34:39 2017 +0200
# Node ID 35acda0fd5f30f45a068320759b7eb3922c3ff19
# Parent  91ddb33deea5b4813d4897f6860b00078afd3f19
# EXP-Topic backout-histedit
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 35acda0fd5f3
histedit: backout changeset 2b599f5468a4

Its parent is about to be backedout so this one needs to be removed too.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1580,6 +1580,28 @@  def movebookmarks(ui, repo, mapping, old
         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 @@  def safecleanupnode(ui, repo, name, node
         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):