changeset 26981:cda2e980281e

histedit: extracts _isdirtywc function Checking if working copy is dirty was done in few places, this patch extracts it in _isdirtywc procedure.
author liscju <piotr.listkiewicz@gmail.com>
date Thu, 12 Nov 2015 12:44:15 +0100
parents 18f50b8cbf1e
children fa6685ea7ad8
files hgext/histedit.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Mon Nov 16 11:23:32 2015 -0800
+++ b/hgext/histedit.py	Thu Nov 12 12:44:15 2015 +0100
@@ -502,6 +502,9 @@
                          editor=editor)
     return repo.commitctx(new)
 
+def _isdirtywc(repo):
+    return repo[None].dirty(missing=True)
+
 class pick(histeditaction):
     def run(self):
         rulectx = self.repo[self.node]
@@ -971,11 +974,9 @@
 
         actobj = actiontable[action].fromrule(state, currentnode)
 
-        s = repo.status()
-        if s.modified or s.added or s.removed or s.deleted:
+        if _isdirtywc(repo):
             actobj.continuedirty()
-            s = repo.status()
-            if s.modified or s.added or s.removed or s.deleted:
+            if _isdirtywc(repo):
                 raise error.Abort(_("working copy still dirty"))
 
         parentctx, replacements = actobj.continueclean()