mercurial/dispatch.py
changeset 18670 ddc7268da176
parent 18548 e71c2ff93167
child 18691 4f485bd68f1d
--- a/mercurial/dispatch.py	Tue Feb 12 14:08:33 2013 -0800
+++ b/mercurial/dispatch.py	Sat Feb 09 09:04:14 2013 -0800
@@ -247,6 +247,7 @@
                     (_("** Mercurial Distributed SCM (version %s)\n") % myver) +
                     (_("** Extensions loaded: %s\n") %
                      ", ".join([x[0] for x in extensions.extensions()])))
+        ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
         ui.warn(warning)
         raise
 
@@ -738,10 +739,16 @@
     msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
     ui.log("command", msg + "\n")
     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
+    starttime = time.time()
+    ret = None
     try:
-        return runcommand(lui, repo, cmd, fullargs, ui, options, d,
-                          cmdpats, cmdoptions)
+        ret = runcommand(lui, repo, cmd, fullargs, ui, options, d,
+                         cmdpats, cmdoptions)
+        return ret
     finally:
+        duration = time.time() - starttime
+        ui.log("commandfinish", _("%s exited %s after %0.2f seconds\n"),
+               cmd, ret, duration)
         if repo and repo != req.repo:
             repo.close()