diff hgext/histedit.py @ 27171:3028ea0aff46

histedit: mention histedit-last-edit.txt on abort Users may spend a lot of effort writing histedit rules, getting an abort without being told they can recover their work is very frustrating. Avoid that by telling them where to find their work.
author timeless <timeless@mozdev.org>
date Wed, 02 Dec 2015 08:07:36 +0000
parents 4cff4c38c5cc
children 62b9a87a365e
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Dec 02 07:40:42 2015 +0000
+++ b/hgext/histedit.py	Wed Dec 02 08:07:36 2015 +0000
@@ -829,6 +829,11 @@
         state.wlock = repo.wlock()
         state.lock = repo.lock()
         _histedit(ui, repo, state, *freeargs, **opts)
+    except error.Abort:
+        if repo.vfs.exists('histedit-last-edit.txt'):
+            ui.warn(_('warning: histedit rules saved '
+                      'to: .hg/histedit-last-edit.txt\n'))
+        raise
     finally:
         release(state.lock, state.wlock)
 
@@ -957,6 +962,8 @@
         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: