[PATCH 2 of 6 V2] ui: add config knob for progressive mode

mathias.demare at gmail.com mathias.demare at gmail.com
Tue Apr 7 14:00:48 CDT 2015


# HG changeset patch
# User Mathias De Maré <mathias.demare at gmail.com>
# Date 1428348747 -7200
#      Mon Apr 06 21:32:27 2015 +0200
# Node ID 411bfd6b77b418249d42817816b3a2526863b0b0
# Parent  953040f303b16578919e465aa2a46533990a46ae
ui: add config knob for progressive mode

This patch adds the ui.progressive config knob,
to allow enabling a number of progressive settings,
as proposed by Augie Fackler.
Additional settings (none added yet) can be added to progressive mode
by appending to _fixprogressive.

The 'ui.progressive' name might change (bikeshedding during the sprint).

diff -r 953040f303b1 -r 411bfd6b77b4 mercurial/help/config.txt
--- a/mercurial/help/config.txt	Tue Mar 24 21:25:57 2015 +0100
+++ b/mercurial/help/config.txt	Mon Apr 06 21:32:27 2015 +0200
@@ -1411,6 +1411,16 @@
     If set to ``abort``, the command is aborted.
     On Windows, this configuration option is ignored and the command aborted.
 
+``progressive``
+    Enable user-friendly features. True or False. Default is False;
+    If set to True, specific functionality that improves user experience
+    will be enabled, even if there is no complete backwards compatibility.
+    Progressive mode is an intentional moving target, containing a recommended
+    configuration.
+    Changes in this configuration over time can have impact on what the output
+    of different commands looks like.
+    Scripts should use the environment variable ``HGPLAIN`` to avoid impact.
+
 ``quiet``
     Reduce the amount of output printed. True or False. Default is False.
 
diff -r 953040f303b1 -r 411bfd6b77b4 mercurial/ui.py
--- a/mercurial/ui.py	Tue Mar 24 21:25:57 2015 +0100
+++ b/mercurial/ui.py	Mon Apr 06 21:32:27 2015 +0200
@@ -79,6 +79,7 @@
         # _bufferstates: Should the temporary capture includes stderr
         self._bufferstates = []
         self.quiet = self.verbose = self.debugflag = self.tracebackflag = False
+        self._progressive = False
         self._reportuntrusted = True
         self._ocfg = config.config() # overlay
         self._tcfg = config.config() # trusted
@@ -111,6 +112,8 @@
             for f in scmutil.rcpath():
                 self.readconfig(f, trust=True)
 
+        self._fixprogressive()
+
     def copy(self):
         return self.__class__(self)
 
@@ -158,8 +161,8 @@
 
         if self.plain():
             for k in ('debug', 'fallbackencoding', 'quiet', 'slash',
-                      'logtemplate', 'statuscopies', 'style',
-                      'traceback', 'verbose'):
+                      'logtemplate', 'progressive', 'statuscopies',
+                      'style', 'traceback', 'verbose'):
                 if k in cfg['ui']:
                     del cfg['ui'][k]
             for k, v in cfg.items('defaults'):
@@ -207,6 +210,7 @@
             self._reportuntrusted = self.debugflag or self.configbool("ui",
                 "report_untrusted", True)
             self.tracebackflag = self.configbool('ui', 'traceback', False)
+            self._progressive = self.configbool('ui', 'progressive', False)
 
         if section in (None, 'trusted'):
             # update trust information
@@ -467,6 +471,13 @@
             for name, value in self.configitems(section, untrusted):
                 yield section, name, value
 
+    def progressive(self):
+        return self._progressive
+
+    def _fixprogressive(self):
+        if not self.progressive():
+            return
+
     def plain(self, feature=None):
         '''is plain mode active?
 


More information about the Mercurial-devel mailing list