changeset 30006:b19c2679289c

dispatch: make hg --profile wrap reposetup Move profiling.maybeprofile() from _runcommand to _dispatch() so that profiler output will include reposetup.
author Arun Kulshreshtha <kulshrax@fb.com>
date Thu, 22 Sep 2016 12:36:30 -0700
parents dfd97e60044c
children aca0954d3739
files mercurial/dispatch.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Thu Sep 22 12:19:48 2016 -0700
+++ b/mercurial/dispatch.py	Thu Sep 22 12:36:30 2016 -0700
@@ -774,7 +774,8 @@
     # Check abbreviation/ambiguity of shell alias.
     shellaliasfn = _checkshellalias(lui, ui, args)
     if shellaliasfn:
-        return shellaliasfn()
+        with profiling.maybeprofile(lui):
+            return shellaliasfn()
 
     # check for fallback encoding
     fallback = lui.config('ui', 'fallbackencoding')
@@ -844,7 +845,7 @@
     elif not cmd:
         return commands.help_(ui, 'shortlist')
 
-    if True:
+    with profiling.maybeprofile(lui):
         repo = None
         cmdpats = args[:]
         if not _cmdattr(ui, cmd, func, 'norepo'):
@@ -904,11 +905,10 @@
 
 def _runcommand(ui, options, cmd, cmdfunc):
     """Run a command function, possibly with profiling enabled."""
-    with profiling.maybeprofile(ui):
-        try:
-            return cmdfunc()
-        except error.SignatureError:
-            raise error.CommandError(cmd, _('invalid arguments'))
+    try:
+        return cmdfunc()
+    except error.SignatureError:
+        raise error.CommandError(cmd, _('invalid arguments'))
 
 def _exceptionwarning(ui):
     """Produce a warning message for the current active exception"""