This revision was automatically updated to reflect the committed changes. Closed by commit rHG497effb0a04a: util: make timedcm context manager also emit trace events (authored by durin42, committed by ).
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4348?vs=10498&id=10556 REVISION DETAIL https://phab.mercurial-scm.org/D4348 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -36,6 +36,7 @@ import warnings import zlib +from hgdemandimport import tracing from .thirdparty import ( attr, ) @@ -2896,7 +2897,7 @@ __str__ = encoding.strmethod(__bytes__) @contextlib.contextmanager -def timedcm(): +def timedcm(whencefmt='unknown timedcm', *whenceargs): """A context manager that produces timing information for a given context. On entering a timedcmstats instance is produced. @@ -2908,7 +2909,8 @@ timedcm._nested += 1 timing_stats = timedcmstats(level=timedcm._nested) try: - yield timing_stats + with tracing.log(whencefmt, *whenceargs): + yield timing_stats finally: timing_stats.elapsed = timer() - timing_stats.start timedcm._nested -= 1 To: durin42, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel