[PATCH 1 of 5 V2] ui: add function to query availability of the curses ui

Laurent Charignon lcharignon at fb.com
Fri May 29 17:29:57 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432850427 25200
#      Thu May 28 15:00:27 2015 -0700
# Node ID d3d3b39531589929cf1bcf24ce04a596db1f4a6f
# Parent  6ac860f700b5cfeda232d5305963047696b869ca
ui: add function to query availability of the curses ui

Before this patch, whenever we wanted to check if the curses ui was enabled
we had to check the config flag directly. This patch introduces a method for
checking the flag.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -639,6 +639,15 @@
 
         return i
 
+    def curses(self):
+        '''is curses ui allowed?
+
+        Interactive commands can use the curses recording interface.
+        To have curses a UI needs to be interactive and have the flag
+        experimental.crecord set to True'''
+        i = self.configbool("experimental", "crecord", None)
+        return self.interactive() and i
+
     def termwidth(self):
         '''how wide is the terminal in columns?
         '''


More information about the Mercurial-devel mailing list