# HG changeset patch # User Idan Kamara # Date 2011-07-30 18:04:14 # Node ID 188936b334b1f16325da857895982a147b8a7a2c # Parent 4f39610996fade2926152974916f2715f973447c dispatch: make sure global options on the command line take precedence So if a user has verbose=True somewhere in his .hgrc files, giving -q on the command line will override that. This basically reverts 1b8c70c9f47c. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -608,11 +608,15 @@ def _dispatch(req): for cfg in cfgs: req.repo.ui.setconfig(*cfg) - for opt in ('verbose', 'debug', 'quiet', 'traceback'): - val = bool(options[opt]) - if val: + if options['verbose'] or options['debug'] or options['quiet']: + for opt in ('verbose', 'debug', 'quiet'): + val = str(bool(options[opt])) for ui_ in uis: - ui_.setconfig('ui', opt, str(val)) + ui_.setconfig('ui', opt, val) + + if options['traceback']: + for ui_ in uis: + ui_.setconfig('ui', 'traceback', 'on') if options['noninteractive']: for ui_ in uis: diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t --- a/tests/test-hgrc.t +++ b/tests/test-hgrc.t @@ -54,12 +54,20 @@ issue1829: wrong indentation warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ unset FAKEPATH -make sure unspecified global ui options don't override old values +make sure global options given on the cmdline take precedence $ hg showconfig --config ui.verbose=True --quiet - ui.verbose=True + ui.verbose=False + ui.debug=False ui.quiet=True + $ touch foobar/untracked + $ cat >> foobar/.hg/hgrc < [ui] + > verbose=True + > EOF + $ hg -R foobar st -q + username expansion $ olduser=$HGUSER @@ -140,7 +148,9 @@ plain hgrc $ 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 @@ -156,18 +166,24 @@ plain mode with exceptions 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