Patchwork [3,of,4] histedit: use safecleanupnode in _aborthistedit (issue5500)

login
register
mail settings
Submitter Jun Wu
Date March 14, 2017, 5:36 a.m.
Message ID <0993e7596542d0e29532.1489469778@localhost.localdomain>
Download mbox | patch
Permalink /patch/19328/
State Superseded
Headers show

Comments

Jun Wu - March 14, 2017, 5:36 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1489468938 25200
#      Mon Mar 13 22:22:18 2017 -0700
# Node ID 0993e7596542d0e29532f949bc4a59a3075c123b
# Parent  990c1dcccd1aad7e8a7c3ecdedcc79c6d98ff169
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 0993e7596542
histedit: use safecleanupnode in _aborthistedit (issue5500)

Now nobody in histedit calls the unsafe cleanupnode directly.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1173,6 +1173,6 @@  def _aborthistedit(ui, repo, state):
                                 state.parentctxnode, leafs | tmpnodes):
             hg.clean(repo, state.topmost, show_stats=True, quietempty=True)
-        cleanupnode(ui, repo, 'created', tmpnodes)
-        cleanupnode(ui, repo, 'temp', leafs)
+        safecleanupnode(ui, repo, 'created', tmpnodes)
+        safecleanupnode(ui, repo, 'temp', leafs)
     except Exception:
         if state.inprogress():
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
@@ -504,2 +504,48 @@  Note that there is a few reordering in t
   [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
+