D4512: extensions: trace the total time of running all reposetup callbacks

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Mon Sep 10 14:39:07 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd3390a2789d8: extensions: trace the total time of running all reposetup callbacks (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4512?vs=10846&id=10865

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

AFFECTED FILES
  mercurial/hg.py
  tests/test-extension-timing.t

CHANGE DETAILS

diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -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 ..
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -171,13 +171,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)



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list