Mercurial > hg-stable
changeset 24345:01b39149ebb3
record: minor refactoring of dorecord
It prepares the way for introducing the flag to reverse hunk selection
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 12 Mar 2015 17:50:23 -0700 |
parents | 6b43baac6dfb |
children | 31edcea517c1 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Mar 12 14:42:55 2015 -0700 +++ b/mercurial/cmdutil.py Thu Mar 12 17:50:23 2015 -0700 @@ -39,6 +39,9 @@ def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts): import merge as mergemod + hunkclasses = (crecordmod.uihunk, patch.recordhunk) + ishunk = lambda x: isinstance(x, hunkclasses) + if not ui.interactive(): raise util.Abort(_('running non-interactively, use %s instead') % cmdsuggest) @@ -96,10 +99,8 @@ newandmodifiedfiles = set() for h in chunks: - iscrecordhunk = isinstance(h, crecordmod.uihunk) - ishunk = isinstance(h, patch.recordhunk) isnew = h.filename() in status.added - if (ishunk or iscrecordhunk) and isnew and not h in originalchunks: + if ishunk(h) and isnew and not h in originalchunks: newandmodifiedfiles.add(h.filename()) modified = set(status.modified)