Patchwork [4,of,4] configitems: register 'ui.interactive'

login
register
mail settings
Submitter Pierre-Yves David
Date June 25, 2017, 4:34 p.m.
Message ID <b5ee725c63e5933afba9.1498408481@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21700/
State Accepted
Headers show

Comments

Pierre-Yves David - June 25, 2017, 4:34 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498231169 -7200
#      Fri Jun 23 17:19:29 2017 +0200
# Node ID b5ee725c63e5933afba92797b997878739fdb1f3
# Parent  4f1a916eadf928fc5e674339b9c43250ee507674
# EXP-Topic config.register
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r b5ee725c63e5
configitems: register 'ui.interactive'

That item default value is a bit special (None) so this adds a second proof
that everything is still working fine.

Patch

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -42,6 +42,9 @@  coreconfigitem('patch', 'fuzz',
 coreconfigitem('ui', 'clonebundleprefers',
     default=[],
 )
+coreconfigitem('ui', 'interactive',
+    default=None,
+)
 coreconfigitem('ui', 'quiet',
     default=False,
 )
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1139,7 +1139,7 @@  class ui(object):
 
         This function refers to input only; for output, see `ui.formatted()'.
         '''
-        i = self.configbool("ui", "interactive", None)
+        i = self.configbool("ui", "interactive")
         if i is None:
             # some environments replace stdin without implementing isatty
             # usually those are non-interactive
diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -211,5 +211,6 @@  Test warning on config option access and
 
   $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig
   devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
+  devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
 
   $ cd ..