histedit: add abortdirty function
authorMateusz Kwapich <mitrandir@fb.com>
Tue, 17 Nov 2015 17:53:52 -0800
changeset 27084 383f10b67fd6
parent 27083 6d5d7ac41ef4
child 27085 d50ff8f4891f
histedit: add abortdirty function Small helper function for aborting histedit when left with dirty working directory.
hgext/histedit.py
--- a/hgext/histedit.py	Thu Nov 12 16:40:33 2015 -0800
+++ b/hgext/histedit.py	Tue Nov 17 17:53:52 2015 -0800
@@ -524,6 +524,12 @@
 def _isdirtywc(repo):
     return repo[None].dirty(missing=True)
 
+def abortdirty():
+    raise error.Abort(_('working copy has pending changes'),
+        hint=_('amend, commit, or revert them and run histedit '
+            '--continue, or abort with histedit --abort'))
+
+
 class pick(histeditaction):
     def run(self):
         rulectx = self.repo[self.node]
@@ -996,7 +1002,7 @@
         if _isdirtywc(repo):
             actobj.continuedirty()
             if _isdirtywc(repo):
-                raise error.Abort(_("working copy still dirty"))
+                abortdirty()
 
         parentctx, replacements = actobj.continueclean()