# HG changeset patch # User Sean Farley # Date 1450223770 28800 # Node ID 940cedaee9886036d9335cf7fe2c9d33bfda5db8 # Parent 7cc654610204bc495d8082e8d52180e87b0097ae 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 -r 7cc654610204 -r 940cedaee988 mercurial/crecord.py --- 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):