record: enable curses recording logic with experimental flag
authorLaurent Charignon <lcharignon@fb.com>
Thu, 12 Mar 2015 14:24:48 -0700
changeset 24343 69538481ea9f
parent 24342 be3ab98f11e0
child 24344 6b43baac6dfb
record: enable curses recording logic with experimental flag
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Fri Mar 13 10:51:25 2015 -0700
+++ b/mercurial/cmdutil.py	Thu Mar 12 14:24:48 2015 -0700
@@ -16,12 +16,25 @@
 import encoding
 import crecord as crecordmod
 import lock as lockmod
+import crecord as crecordmod
 
 def parsealiases(cmd):
     return cmd.lstrip("^").split("|")
 
 def recordfilter(ui, originalhunks):
-    return patch.filterpatch(ui, originalhunks)
+    usecurses =  ui.configbool('experimental', 'crecord', False)
+    if usecurses:
+        testfile = ui.config('experimental', 'crecordtest', None)
+        if testfile:
+            recordfn = crecordmod.testdecorator(testfile,
+                                                crecordmod.testchunkselector)
+        else:
+            recordfn = crecordmod.chunkselector
+
+        return crecordmod.filterpatch(ui, originalhunks, recordfn)
+
+    else:
+        return patch.filterpatch(ui, originalhunks)
 
 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
             filterfn, *pats, **opts):