record: extract ishunk to a function
We extract this code as we want to reuse it in revert -i.
--- a/mercurial/cmdutil.py Sun Apr 26 22:26:44 2015 +0900
+++ b/mercurial/cmdutil.py Thu May 21 14:28:02 2015 -0700
@@ -17,6 +17,10 @@
import crecord as crecordmod
import lock as lockmod
+def ishunk(x):
+ hunkclasses = (crecordmod.uihunk, patch.recordhunk)
+ return isinstance(x, hunkclasses)
+
def parsealiases(cmd):
return cmd.lstrip("^").split("|")
@@ -59,8 +63,6 @@
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') %