changeset 27546:c00924c54607

histedit: limit cleanup of histedit-last-edit.txt to success
author timeless <timeless@mozdev.org>
date Wed, 23 Dec 2015 23:23:28 +0000
parents a67d2e059a51
children 1cbfeb1dc5aa
files hgext/histedit.py tests/test-histedit-commute.t
diffstat 2 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sun Dec 27 03:33:09 2015 +0000
+++ b/hgext/histedit.py	Wed Dec 23 23:23:28 2015 +0000
@@ -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
--- a/tests/test-histedit-commute.t	Sun Dec 27 03:33:09 2015 +0000
+++ b/tests/test-histedit-commute.t	Wed Dec 23 23:23:28 2015 +0000
@@ -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