[PATCH 2 of 3] histedit: backout changeset 6f0b7475cf9a

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Mar 26 10:16:08 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1490535969 -7200
#      Sun Mar 26 15:46:09 2017 +0200
# Node ID 37931386562505e783e9c0b7f78287fabb71a7c2
# Parent  35acda0fd5f30f45a068320759b7eb3922c3ff19
# 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 379313865625
histedit: backout changeset 6f0b7475cf9a

Before 6f0b7475cf9a, histedit (like rebase) was only creating markers on final
success from the old-rewritten node to the newly created nodes (as of before
6f0b7475cf9a). In case of abort the aborted attempt were stripped to restore the
repository in its state prior to the attempt.

This use of strip was on purpose. Using markers in this case introduces various
issues. The main one is that keeping the partial result of histedit as obsolete
prevents us to recreates the same nodes in a second attempt. The same operation
will lead to an identical results, using an identical node that already exists
in the repository as obsolete.

To conclude, we cannot and should not switch to obsolescence markers creation on
histedit --abort and we backout 6f0b7475cf9a. A test to catch this class of
issue will be introduced in the next changeset.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1209,8 +1209,8 @@ def _aborthistedit(ui, repo, state):
         if repo.unfiltered().revs('parents() and (%n  or %ln::)',
                                 state.parentctxnode, leafs | tmpnodes):
             hg.clean(repo, state.topmost, show_stats=True, quietempty=True)
-        safecleanupnode(ui, repo, 'created', tmpnodes)
-        safecleanupnode(ui, repo, 'temp', leafs)
+        cleanupnode(ui, repo, 'created', tmpnodes)
+        cleanupnode(ui, repo, 'temp', leafs)
     except Exception:
         if state.inprogress():
             ui.warn(_('warning: encountered an exception during histedit '
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
@@ -503,49 +503,3 @@ Note that there is a few reordering in t
   abort: cannot edit history that contains merges
   [255]
   $ cd ..
-
-Abort
--------------------------------------------
-
-  $ cp -R base abort
-  $ cd abort
-  $ hg histedit -r 'b449568bf7fc' --commands - << EOF
-  > pick b449568bf7fc 13 f
-  > pick 7395e1ff83bd 15 h
-  > pick 6b70183d2492 14 g
-  > pick b605fb7503f2 16 i
-  > pick 3a6c53ee7f3d 17 j
-  > edit ee118ab9fa44 18 k
-  > EOF
-  Editing (ee118ab9fa44), you may commit or record as needed now.
-  (hg histedit --continue to resume)
-  [1]
-
-  $ hg histedit --abort
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-
-  $ hg log -G --hidden -r '::. + .:'
-  x  22:44ca09d59ae4 (secret) j
-  |
-  x  21:31747692a644 (secret) i
-  |
-  x  20:9985cd4f21fa (draft) g
-  |
-  x  19:4dc06258baa6 (draft) h
-  |
-  | @  18:ee118ab9fa44 (secret) k
-  | |
-  | o  17:3a6c53ee7f3d (secret) j
-  | |
-  | o  16:b605fb7503f2 (secret) i
-  | |
-  | o  15:7395e1ff83bd (draft) h
-  | |
-  | o  14:6b70183d2492 (draft) g
-  |/
-  o  13:b449568bf7fc (draft) f
-  |
-  o  12:40db8afa467b (public) c
-  |
-  o  0:cb9a9f314b8b (public) a
-  


More information about the Mercurial-devel mailing list