D4346: hg: wrap the highest layer in the `hg` script possible in trace event

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Aug 21 18:47:50 EDT 2018


indygreg added inline comments.

INLINE COMMENTS

> hg:14-21
> +from hgdemandimport import tracing
> +with tracing.log('hg script'):
> +    if os.environ.get('HGUNICODEPEDANTRY', False):
> +        try:
> +            reload(sys)
> +            sys.setdefaultencoding("undefined")
> +        except NameError:

I think we want to defer the import until after `reload(sys)`. Keep in mind that importing the sub-module will import the parent one. And the parent one contains code that is somewhat important.

But we still want to measure time spent here. This may warrant a one-off hack to record a session ID and raw times here and to feed that into the tracer manually after we've done this extremely early setup.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4346

To: durin42, #hg-reviewers
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list