[PATCH 12 of 12] histedit: ignores hidden revision when checking for orphaned nodes

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Thu Sep 27 07:23:31 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1348747252 -7200
# Node ID 52255053a934a22a9d311f39be0252f6097b1a3e
# Parent  81b00ea33e4cfafafa39af1d09b68e52d2df3bc8
histedit: ignores hidden revision when checking for orphaned nodes

We do not want hidden revision to block histedit. They are already "dead"
and we do not care about dead orphan. see similare changeset 9e2dc0d292cd for
rebase.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -585,11 +585,11 @@ def bootstrapcontinue(ui, repo, parentct
 def between(repo, old, new, keep):
     """select and validate the set of revision to edit
 
     When keep is false, the specified set can't have children."""
     revs = list(repo.set('%n::%n', old, new))
-    if not keep and repo.revs('(%ld::) - %ld', revs, revs):
+    if not keep and repo.revs('(%ld::) - (%ld + hidden())', revs, revs):
         raise util.Abort(_('cannot edit history that would orphan nodes'))
     return [c.node() for c in revs]
 
 
 def writestate(repo, parentnode, rules, keep, topmost, replacements):
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -90,5 +90,34 @@ Enable obsolete
   e860deea161a2f77de56603b340ebbb4536308ae ae467701c5006bf21ffcfdb555b3d6b63280b6b7 0 {'date': '*', 'user': 'test'} (glob)
   652413bf663ef2a641cab26574e46d5f5a64a55a 0efacef7cb481bf574f69075b82d044fdbe5c20f 0 {'date': '*': 'test'} (glob)
   d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {'date': '*', 'user': 'test'} (glob)
   055a42cdd88768532f9cf79daa407fc8d138de9b ae467701c5006bf21ffcfdb555b3d6b63280b6b7 0 {'date': '*': 'test'} (glob)
   177f92b773850b59254aa5e923436f921b55483b d36c0562f908c692f5204d606d4ff3537d41f1bf 0 {'date': '*', 'user': 'test'} (glob)
+
+Ensure hidden revision does not prevent histedit
+-------------------------------------------------
+
+create an hidden revision
+
+  $ cat > commands.txt <<EOF
+  > pick d36c0562f908 6 c
+  > drop ae467701c500 7 d
+  > pick 0efacef7cb48 8 f
+  > EOF
+  $ hg histedit 6 --commands commands.txt
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --graph
+  @  9:7c044e3e33a9 f
+  |
+  o  6:d36c0562f908 c
+  |
+  o  0:cb9a9f314b8b a
+  
+check hidden revision are ignored (6 have hidden children 7 and 8)
+
+  $ cat > commands.txt <<EOF
+  > pick d36c0562f908 6 c
+  > pick 7c044e3e33a9 8 f
+  > EOF
+  $ hg histedit 6 --commands commands.txt
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved


More information about the Mercurial-devel mailing list