[PATCH 3 of 4 V5] histedit: extracts _isdirtywc function

liscju piotr.listkiewicz at gmail.com
Thu Nov 12 07:17:46 CST 2015


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1447328655 -3600
#      Thu Nov 12 12:44:15 2015 +0100
# Node ID 9815a15a8058b59eb86d9797d84857196b04c8e9
# Parent  8b107a3648068503b154eef2bf9f08c4cd13a51b
histedit: extracts _isdirtywc function

Checking if working copy is dirty was done in few places, this
patch extracts it in _isdirtywc procedure.

diff -r 8b107a364806 -r 9815a15a8058 hgext/histedit.py
--- a/hgext/histedit.py	Thu Nov 12 13:38:18 2015 +0100
+++ 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,12 +974,10 @@
 
         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:
-                raise error.Abort(_("working copy still dirty"))
+            if _isdirtywc(repo):
+                raise util.Abort(_("working copy still dirty"))
 
         parentctx, replacements = actobj.continueclean()
 


More information about the Mercurial-devel mailing list