dispatch: make sure unspecified global ui options don't override old values stable
authorIdan Kamara <idankk86@gmail.com>
Fri, 24 Jun 2011 12:16:14 +0300
branchstable
changeset 14748 1b8c70c9f47c
parent 14746 72e4fcb43227
child 14749 e3be7dc9a5e1
dispatch: make sure unspecified global ui options don't override old values
mercurial/dispatch.py
tests/test-hgrc.t
--- a/mercurial/dispatch.py	Sat Jun 25 02:30:24 2011 +0200
+++ b/mercurial/dispatch.py	Fri Jun 24 12:16:14 2011 +0300
@@ -592,14 +592,12 @@
                 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
         atexit.register(print_time)
 
-    if options['verbose'] or options['debug'] or options['quiet']:
-        for ui_ in (ui, lui):
-            ui_.setconfig('ui', 'verbose', str(bool(options['verbose'])))
-            ui_.setconfig('ui', 'debug', str(bool(options['debug'])))
-            ui_.setconfig('ui', 'quiet', str(bool(options['quiet'])))
-    if options['traceback']:
-        for ui_ in (ui, lui):
-            ui_.setconfig('ui', 'traceback', 'on')
+    for opt in ('verbose', 'debug', 'quiet', 'traceback'):
+        val = bool(options[opt])
+        if val:
+            for ui_ in (ui, lui):
+                ui_.setconfig('ui', opt, str(val))
+
     if options['noninteractive']:
         for ui_ in (ui, lui):
             ui_.setconfig('ui', 'interactive', 'off')
--- a/tests/test-hgrc.t	Sat Jun 25 02:30:24 2011 +0200
+++ b/tests/test-hgrc.t	Fri Jun 24 12:16:14 2011 +0300
@@ -54,6 +54,12 @@
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   $ unset FAKEPATH
 
+make sure unspecified global ui options don't override old values
+
+  $ hg showconfig --config ui.verbose=True --quiet
+  ui.verbose=True
+  ui.quiet=True
+
 username expansion
 
   $ olduser=$HGUSER
@@ -134,9 +140,7 @@
   $ hg showconfig --config ui.traceback=True --debug
   read config from: $TESTTMP/hgrc
   none: ui.traceback=True
-  none: ui.verbose=False
   none: ui.debug=True
-  none: ui.quiet=False
 
 plain mode with exceptions
 
@@ -152,24 +156,18 @@
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
-  none: ui.verbose=False
   none: ui.debug=True
-  none: ui.quiet=False
   $ unset HGPLAIN
   $ hg showconfig --config ui.traceback=True --debug
   plain: True
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
-  none: ui.verbose=False
   none: ui.debug=True
-  none: ui.quiet=False
   $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
   $ hg showconfig --config ui.traceback=True --debug
   plain: True
   read config from: $TESTTMP/hgrc
   $TESTTMP/hgrc:15: extensions.plain=./plain.py
   none: ui.traceback=True
-  none: ui.verbose=False
   none: ui.debug=True
-  none: ui.quiet=False