changeset 25256:5a8398b085ed

record: extract ishunk to a function We extract this code as we want to reuse it in revert -i.
author Laurent Charignon <lcharignon@fb.com>
date Thu, 21 May 2015 14:28:02 -0700
parents ad1d2c952889
children 07326d76f19d
files mercurial/cmdutil.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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') %