changeset 27529:940cedaee988 stable

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.
author Sean Farley <sean@farley.io>
date Tue, 15 Dec 2015 15:56:10 -0800
parents 7cc654610204
children ba30ef5bba95
files mercurial/crecord.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Wed Dec 16 10:33:19 2015 -0800
+++ b/mercurial/crecord.py	Tue Dec 15 15:56:10 2015 -0800
@@ -53,6 +53,14 @@
         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):