Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 38535:b86664c81833
debug: process --debug flag earlier
This allow the verbosity level to be set correctly during extension
initialization.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 19 Jun 2018 19:18:31 +0100 |
parents | b0144fc8b681 |
children | afc4ad706f9c |
line wrap: on
line diff
--- a/mercurial/dispatch.py Tue Jun 19 19:10:31 2018 +0100 +++ b/mercurial/dispatch.py Tue Jun 19 19:18:31 2018 +0100 @@ -811,6 +811,13 @@ if req.repo: uis.add(req.repo.ui) + if (req.earlyoptions['verbose'] or req.earlyoptions['debug'] + or req.earlyoptions['quiet']): + for opt in ('verbose', 'debug', 'quiet'): + val = pycompat.bytestr(bool(req.earlyoptions[opt])) + for ui_ in uis: + ui_.setconfig('ui', opt, val, '--' + opt) + if req.earlyoptions['profile']: for ui_ in uis: ui_.setconfig('profiling', 'enabled', 'true', '--profile') @@ -876,8 +883,11 @@ if options["profile"]: profiler.start() + # if abbreviated version of this were used, take them in account, now if options['verbose'] or options['debug'] or options['quiet']: for opt in ('verbose', 'debug', 'quiet'): + if options[opt] == req.earlyoptions[opt]: + continue val = pycompat.bytestr(bool(options[opt])) for ui_ in uis: ui_.setconfig('ui', opt, val, '--' + opt)