changeset 24358:8d9e9063b040

record: move ui.write wrapping where it should be We have to do that for the coloring to work in interactive revert
author Laurent Charignon <lcharignon@fb.com>
date Mon, 16 Mar 2015 15:37:00 -0700
parents 2da601ab3125
children 521fe8287dd5
files mercurial/cmdutil.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Mar 16 15:35:50 2015 -0700
+++ b/mercurial/cmdutil.py	Mon Mar 16 15:37:00 2015 -0700
@@ -50,7 +50,11 @@
 def recordfilter(ui, originalhunks):
     usecurses =  ui.configbool('experimental', 'crecord', False)
     testfile = ui.config('experimental', 'crecordtest', None)
-    newchunks = filterchunks(ui, originalhunks, usecurses, testfile)
+    oldwrite = setupwrapcolorwrite(ui)
+    try:
+        newchunks = filterchunks(ui, originalhunks, usecurses, testfile)
+    finally:
+        ui.write = oldwrite
     return newchunks
 
 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
@@ -206,12 +210,7 @@
             except OSError:
                 pass
 
-    oldwrite = setupwrapcolorwrite(ui)
-    try:
-        return commit(ui, repo, recordfunc, pats, opts)
-    finally:
-        ui.write = oldwrite
-
+    return commit(ui, repo, recordfunc, pats, opts)
 
 def findpossible(cmd, table, strict=False):
     """