changeset 39510:340170192874

extensions: trace the total time of running all reposetup callbacks Differential Revision: https://phab.mercurial-scm.org/D4512
author Boris Feld <boris.feld@octobus.net>
date Thu, 06 Sep 2018 16:49:37 -0400
parents 3a86f7eb8b78
children 1ab185c78cc3
files mercurial/hg.py tests/test-extension-timing.t
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Thu Sep 06 16:21:42 2018 -0400
+++ b/mercurial/hg.py	Thu Sep 06 16:49:37 2018 -0400
@@ -170,13 +170,15 @@
     for f in presetupfuncs or []:
         f(ui, obj)
     log('- executing reposetup hooks\n')
-    for name, module in extensions.extensions(ui):
-        log('  - running reposetup for %s\n' % (name,))
-        hook = getattr(module, 'reposetup', None)
-        if hook:
-            with util.timedcm('reposetup %r', name) as stats:
-                hook(ui, obj)
-            log('  > reposetup for %r took %s\n', name, stats)
+    with util.timedcm('all reposetup') as allreposetupstats:
+        for name, module in extensions.extensions(ui):
+            log('  - running reposetup for %s\n' % (name,))
+            hook = getattr(module, 'reposetup', None)
+            if hook:
+                with util.timedcm('reposetup %r', name) as stats:
+                    hook(ui, obj)
+                log('  > reposetup for %r took %s\n', name, stats)
+    log('> all reposetup took %s\n', allreposetupstats)
     if not obj.local():
         for f in wirepeersetupfuncs:
             f(ui, obj)
--- a/tests/test-extension-timing.t	Thu Sep 06 16:21:42 2018 -0400
+++ b/tests/test-extension-timing.t	Thu Sep 06 16:49:37 2018 -0400
@@ -87,6 +87,7 @@
   reposetup called for a
   ui == repo.ui
   debug.extensions:   > reposetup for 'foobar' took * (glob)
+  debug.extensions: > all reposetup took * (glob)
   Foo
 
   $ cd ..