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

login
register
mail settings
Submitter Sean Farley
Date Dec. 16, 2015, 6:46 p.m.
Message ID <dc4c30b212b79a63a439.1450291586@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/12078/
State Accepted
Headers show

Comments

Sean Farley - Dec. 16, 2015, 6:46 p.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 dc4c30b212b79a63a43930ef6547e4165fb810e3
# Parent  11971d769204eb9b53bc37c75b569444bc5cd016
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)