[PATCH 2 of 5 stable] crecord: add helper function to determine if we should use curses
Sean Farley
sean at farley.io
Tue Dec 15 18:06:13 CST 2015
# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1450223770 28800
# Tue Dec 15 15:56:10 2015 -0800
# Branch stable
# Node ID eb3ae2a5d034e0b4598bdb824e8584c983998820
# Parent 7ceba88969e51bb825748f69b45e4677e0a02815
crecord: add helper function to determine if we should use curses
To fix issue5008 properly, we need a helper function to determine if curses is
imported and also if the user has enabled the experimental flag.
diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -47,10 +47,18 @@ try:
except NameError:
if os.name != 'nt': # Temporary hack to get running on Windows again
raise error.Abort(
_('the python curses/wcurses module is not available/installed'))
+def checkcurses(ui):
+ """Return True if the user wants to use curses
+
+ This method returns True if curses is found (and that python is built with
+ it) and that the user has the correct flag for the ui.
+ """
+ return curses and ui.configbool('experimental', 'crecord', False)
+
_origstdout = sys.__stdout__ # used by gethw()
class patchnode(object):
"""abstract class for patch graph nodes
(i.e. patchroot, header, hunk, hunkline)
More information about the Mercurial-devel
mailing list