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

Laurent Charignon lcharignon at fb.com
Thu May 28 23:32:39 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 b912d229f4cdd20c0c8e4044b9b90cc9bc05c52c
# 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 command can use the curses recording interface.
+        To have curses a UI needs to be interactive and have the flag
+        ui.curses 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