Patchwork [4,of,5,stable] cmdutil: use crecordmod.checkcurses

login
register
mail settings
Submitter Sean Farley
Date Dec. 16, 2015, 12:06 a.m.
Message ID <23202dc041db998d6e25.1450224375@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/12064/
State Superseded
Commit 84d686cb62c45077e862f28b51f87d5dc29c2b34
Delegated to: Laurent Charignon
Headers show

Comments

Sean Farley - Dec. 16, 2015, 12:06 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1450224105 28800
#      Tue Dec 15 16:01:45 2015 -0800
# Branch stable
# Node ID 23202dc041db998d6e2529b80dd4e7e4d4b4b040
# Parent  bd8254a6cc25a040fc70d10a7e1d06935865280f
cmdutil: use crecordmod.checkcurses

Instead of blindly trusting the user's experimental.crecord, we use checkcurses
to abstract that logic so that we can handle the case where python was not
built with curses.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -64,11 +64,11 @@  def recordfilter(ui, originalhunks, oper
     selected hunks.
     *operation* is used for ui purposes to indicate the user
     what kind of filtering they are doing: reverting, committing, shelving, etc.
     *operation* has to be a translated string.
     """
-    usecurses =  ui.configbool('experimental', 'crecord', False)
+    usecurses = crecordmod.checkcurses(ui)
     testfile = ui.config('experimental', 'crecordtest', None)
     oldwrite = setupwrapcolorwrite(ui)
     try:
         newchunks = filterchunks(ui, originalhunks, usecurses, testfile,
                                  operation)