[PATCH 1 of 2] dispatch: move detection of profiling earlier during startup
Jun Wu
quark at fb.com
Sat Feb 18 00:16:40 UTC 2017
This breaks extensions that wraps maybeprofile, namely
fb-hgext/profiling.py which tries to log interactive time.
That said, I think we could just remove profiling.py as Simon's change is a
superior solution.
Excerpts from Bryan O'Sullivan's message of 2017-02-13 20:50:10 -0800:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1487047460 28800
> # Mon Feb 13 20:44:20 2017 -0800
> # Node ID 82467bdb090b2500a97ae92e239bcdf72974f3f7
> # Parent a0e3d808690d57d1c9dff840e0b8ee099526397b
> dispatch: move detection of profiling earlier during startup
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -655,6 +655,15 @@ def _dispatch(req):
> rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
> path, lui = _getlocal(ui, rpath)
>
> + uis = set([ui, lui])
> +
> + if req.repo:
> + uis.add(req.repo.ui)
> +
> + if '--profile' in args:
> + for ui_ in uis:
> + ui_.setconfig('profiling', 'enabled', 'true', '--profile')
> +
> # Configure extensions in phases: uisetup, extsetup, cmdtable, and
> # reposetup. Programs like TortoiseHg will call _dispatch several
> # times so we keep track of configured extensions in _loaded.
> @@ -721,21 +730,12 @@ def _dispatch(req):
> (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
> atexit.register(print_time)
>
> - uis = set([ui, lui])
> -
> - if req.repo:
> - uis.add(req.repo.ui)
> -
> 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, val, '--' + opt)
>
> - if options['profile']:
> - for ui_ in uis:
> - ui_.setconfig('profiling', 'enabled', 'true', '--profile')
> -
> if options['traceback']:
> for ui_ in uis:
> ui_.setconfig('ui', 'traceback', 'on', '--traceback')
More information about the Mercurial-devel
mailing list