[PATCH 6 of 7] histedit: limit cleanup of histedit-last-edit.txt to success

timeless timeless at mozdev.org
Mon Dec 28 17:29:17 CST 2015


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1450913008 0
#      Wed Dec 23 23:23:28 2015 +0000
# Node ID 8b8f2d84ebca1f211671edb329ef867203f290bc
# Parent  cf35f618872069d8185e42c786ef2691307c51d5
histedit: limit cleanup of histedit-last-edit.txt to success

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1031,8 +1031,6 @@
         cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
 
-        if repo.vfs.exists('histedit-last-edit.txt'):
-            repo.vfs.unlink('histedit-last-edit.txt')
         topmost, empty = repo.dirstate.parents()
         if outg:
             if freeargs:
@@ -1146,6 +1144,8 @@
     state.clear()
     if os.path.exists(repo.sjoin('undo')):
         os.unlink(repo.sjoin('undo'))
+    if repo.vfs.exists('histedit-last-edit.txt'):
+        repo.vfs.unlink('histedit-last-edit.txt')
 
 def bootstrapcontinue(ui, state, opts):
     repo = state.repo
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -77,6 +77,26 @@
 
   $ EDITED="$TESTTMP/editedhistory"
   $ cat > $EDITED <<EOF
+  > edit 177f92b77385 c
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > pick 055a42cdd887 d
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+
+rules should end up in .hg/histedit-last-edit.txt:
+  $ cat .hg/histedit-last-edit.txt
+  edit 177f92b77385 c
+  pick e860deea161a e
+  pick 652413bf663e f
+  pick 055a42cdd887 d
+
+  $ hg histedit --abort
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat > $EDITED <<EOF
   > pick 177f92b77385 c
   > pick e860deea161a e
   > pick 652413bf663e f
@@ -85,13 +105,6 @@
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
 
-rules should end up in .hg/histedit-last-edit.txt:
-  $ cat .hg/histedit-last-edit.txt
-  pick 177f92b77385 c
-  pick e860deea161a e
-  pick 652413bf663e f
-  pick 055a42cdd887 d
-
 log after edit
   $ hg log --graph
   @  changeset:   5:07114f51870f


More information about the Mercurial-devel mailing list