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.
--- 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):