[PATCH STABLE] histedit: backout ebb5bb9bc32e

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jul 31 17:16:51 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1438380667 25200
#      Fri Jul 31 15:11:07 2015 -0700
# Branch stable
# Node ID e67b959b84bc08754386fc0592c33d4079241b74
# Parent  79f0cb97d7537a7c2948f8f9b0a89148825a3a1d
histedit: backout ebb5bb9bc32e

The faulty changeset use obsolescence marker to roll the repository back on
--abort. This is a problematic approach because --abort should be as close as an
actually transaction rollback as possible stripping all created data from the
repository (cf `hg rebase --abort` stripping all created changesets). Instead
ebb5bb9bc32e made all content created during the aborted histedit still
available in the repository adding obsolescence marker to make them hidden. This
will cause trouble to evolution user as a re-run of the same histedit (with
success) will likely result in the very same node to be "recreated" while
obsolescence marker would be in place for them. And canceling an obsoletion is
still a fairly complicated process.

This also rollback using obsmarkers instead of strip to clean up temporary node
on successful histedit run because the two change were not split in separated
changeset. Rolling that part back does not have significant consequence a will
have to be resubmitted independently

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -796,17 +796,12 @@ def _histedit(ui, repo, state, *freeargs
             if n in parentnodes:
                 hg.clean(repo, state.topmost)
                 break
         else:
             pass
-        if supportsmarkers:
-            obsolete.createmarkers(repo,
-                                   ((repo[t],()) for t in sorted(tmpnodes)))
-            obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(leafs)))
-        else:
-            cleanupnode(ui, repo, 'created', tmpnodes)
-            cleanupnode(ui, repo, 'temp', leafs)
+        cleanupnode(ui, repo, 'created', tmpnodes)
+        cleanupnode(ui, repo, 'temp', leafs)
         state.clear()
         return
     else:
         cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
@@ -897,14 +892,12 @@ def _histedit(ui, repo, state, *freeargs
                                 tuple(repo[s] for s in succs)))
             if markers:
                 obsolete.createmarkers(repo, markers)
         else:
             cleanupnode(ui, repo, 'replaced', mapping)
-    if supportsmarkers:
-        obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes)))
-    else:
-        cleanupnode(ui, repo, 'temp', tmpnodes)
+
+    cleanupnode(ui, repo, 'temp', tmpnodes)
     state.clear()
     if os.path.exists(repo.sjoin('undo')):
         os.unlink(repo.sjoin('undo'))
 
 def bootstrapcontinue(ui, state, opts):
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
@@ -62,20 +62,16 @@ Enable obsolete
   > drop d2ae7f538514 1 b
   > pick 055a42cdd887 3 d
   > fold e860deea161a 4 e
   > pick 652413bf663e 5 f
   > EOF
-  [1]
+  saved backup bundle to $TESTTMP/base/.hg/strip-backup/96e494a2d553-3c6c5d92-backup.hg (glob)
   $ hg log --graph --hidden
-  @  10:cacdfd884a93 f
+  @  8:cacdfd884a93 f
   |
-  o  9:59d9f330561f d
+  o  7:59d9f330561f d
   |
-  | x  8:b558abc46d09 fold-temp-revision e860deea161a
-  | |
-  | x  7:96e494a2d553 d
-  |/
   o  6:b346ab9a313d c
   |
   | x  5:652413bf663e f
   | |
   | x  4:e860deea161a e
@@ -92,12 +88,10 @@ Enable obsolete
   d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (*) {'user': 'test'} (glob)
   177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (*) {'user': 'test'} (glob)
   055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
   e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
   652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob)
-  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
-  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
 
 
 Ensure hidden revision does not prevent histedit
 -------------------------------------------------
 
@@ -109,11 +103,11 @@ create an hidden revision
   > pick cacdfd884a93 8 f
   > EOF
   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
-  @  11:c13eb81022ca f
+  @  9:c13eb81022ca f
   |
   o  6:b346ab9a313d c
   |
   o  0:cb9a9f314b8b a
   
@@ -131,11 +125,11 @@ Test that rewriting leaving instability 
 ---------------------------------------------------------------------
 
   $ hg up '.^'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg log -r 'children(.)'
-  11:c13eb81022ca f (no-eol)
+  9:c13eb81022ca f (no-eol)
   $ hg histedit -r '.' --commands - <<EOF
   > edit b346ab9a313d 6 c
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   adding c
@@ -145,16 +139,16 @@ Test that rewriting leaving instability 
   $ echo c >> c
   $ hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg log -r 'unstable()'
-  11:c13eb81022ca f (no-eol)
+  9:c13eb81022ca f (no-eol)
 
 stabilise
 
   $ hg rebase  -r 'unstable()' -d .
-  rebasing 11:c13eb81022ca "f"
+  rebasing 9:c13eb81022ca "f"
   $ hg up tip -q
 
 Test dropping of changeset on the top of the stack
 -------------------------------------------------------
 
@@ -170,11 +164,11 @@ dropped changeset to be hidden.
   > pick 40db8afa467b 10 c
   > drop b449568bf7fc 11 f
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg log -G
-  @  12:40db8afa467b c
+  @  10:40db8afa467b c
   |
   o  0:cb9a9f314b8b a
   
 
 With rewritten ancestors
@@ -192,13 +186,13 @@ With rewritten ancestors
   > EOF
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  17:ee6544123ab8 c
+  @  15:ee6544123ab8 c
   |
-  o  16:269e713e9eae g
+  o  14:269e713e9eae g
   |
   o  0:cb9a9f314b8b a
   
   $ cd ../base
 
@@ -216,13 +210,13 @@ Check that histedit respect immutability
   > EOF
 
   $ hg ph -pv '.^'
   phase changed for 2 changesets
   $ hg log -G
-  @  13:b449568bf7fc (draft) f
+  @  11:b449568bf7fc (draft) f
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
   $ hg histedit -r '.~2'
   abort: cannot edit public changeset: cb9a9f314b8b
@@ -238,23 +232,23 @@ Prepare further testing
   >     hg add $x
   >     hg ci -m $x
   > done
   $ hg phase --force --secret .~2
   $ hg log -G
-  @  18:ee118ab9fa44 (secret) k
+  @  16:ee118ab9fa44 (secret) k
   |
-  o  17:3a6c53ee7f3d (secret) j
+  o  15:3a6c53ee7f3d (secret) j
   |
-  o  16:b605fb7503f2 (secret) i
+  o  14:b605fb7503f2 (secret) i
   |
-  o  15:7395e1ff83bd (draft) h
+  o  13:7395e1ff83bd (draft) h
   |
-  o  14:6b70183d2492 (draft) g
+  o  12:6b70183d2492 (draft) g
   |
-  o  13:b449568bf7fc (draft) f
+  o  11:b449568bf7fc (draft) f
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
   $ cd ..
 
@@ -288,23 +282,23 @@ New-commit as draft (default)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  24:12e89af74238 (secret) k
+  @  22:12e89af74238 (secret) k
   |
-  o  23:636a8687b22e (secret) j
+  o  21:636a8687b22e (secret) j
   |
-  o  22:ccaf0a38653f (secret) i
+  o  20:ccaf0a38653f (secret) i
   |
-  o  21:11a89d1c2613 (draft) h
+  o  19:11a89d1c2613 (draft) h
   |
-  o  20:c1dec7ca82ea (draft) g
+  o  18:c1dec7ca82ea (draft) g
   |
-  o  19:087281e68428 (draft) f
+  o  17:087281e68428 (draft) f
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
   $ cd ..
 
@@ -337,23 +331,23 @@ New-commit as draft (default)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  24:12e89af74238 (secret) k
+  @  22:12e89af74238 (secret) k
   |
-  o  23:636a8687b22e (secret) j
+  o  21:636a8687b22e (secret) j
   |
-  o  22:ccaf0a38653f (secret) i
+  o  20:ccaf0a38653f (secret) i
   |
-  o  21:11a89d1c2613 (draft) h
+  o  19:11a89d1c2613 (draft) h
   |
-  o  20:c1dec7ca82ea (draft) g
+  o  18:c1dec7ca82ea (draft) g
   |
-  o  19:087281e68428 (draft) f
+  o  17:087281e68428 (draft) f
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
   $ cd ..
 
@@ -379,23 +373,23 @@ It seems more important to present the s
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  23:558246857888 (secret) k
+  @  21:558246857888 (secret) k
   |
-  o  22:28bd44768535 (secret) h
+  o  20:28bd44768535 (secret) h
   |
-  o  21:d5395202aeb9 (secret) i
+  o  19:d5395202aeb9 (secret) i
   |
-  o  20:21edda8e341b (secret) g
+  o  18:21edda8e341b (secret) g
   |
-  o  19:5ab64f3a4832 (secret) j
+  o  17:5ab64f3a4832 (secret) j
   |
-  o  13:b449568bf7fc (draft) f
+  o  11:b449568bf7fc (draft) f
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
   $ cd ..
 
@@ -432,32 +426,35 @@ Note that there is a few reordering in t
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/58019c66f35f-96092fce-backup.hg (glob)
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-f3469cf8-backup.hg (glob)
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-d89a19d7-backup.hg (glob)
   $ hg log -G
-  @  27:f9daec13fb98 (secret) i
+  @  19:f9daec13fb98 (secret) i
   |
-  o  24:49807617f46a (secret) g
+  o  18:49807617f46a (secret) g
   |
-  o  21:050280826e04 (draft) h
+  o  17:050280826e04 (draft) h
   |
-  o  12:40db8afa467b (public) c
+  o  10:40db8afa467b (public) c
   |
   o  0:cb9a9f314b8b (public) a
   
-  $ hg co 24
+  $ hg co 18
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ echo wat >> wat
   $ hg add wat
   $ hg ci -m 'add wat'
   created new head
-  $ hg merge 27
+  $ hg merge 19
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci -m 'merge'
   $ echo not wat > wat
   $ hg ci -m 'modify wat'
-  $ hg histedit 21
+  $ hg histedit 17
   abort: cannot edit history that contains merges
   [255]
   $ cd ..


More information about the Mercurial-devel mailing list