# HG changeset patch # User liscju # Date 1447328655 -3600 # Node ID cda2e980281ef282163f51236e7b46d07338f150 # Parent 18f50b8cbf1ea6e42d6f78237a6bb3ec64e99682 histedit: extracts _isdirtywc function Checking if working copy is dirty was done in few places, this patch extracts it in _isdirtywc procedure. diff -r 18f50b8cbf1e -r cda2e980281e hgext/histedit.py --- 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()