[PATCH 1 of 3] dispatch: store args and command run on ui

Phil Cohen phillco at fb.com
Mon Mar 20 07:49:05 UTC 2017


# HG changeset patch
# User Phil Cohen <phillco at fb.com>
# Date 1489995201 25200
#      Mon Mar 20 00:33:21 2017 -0700
# Node ID 2c1d5a02ec533055f182b0cc1280107fbfb76206
# Parent  291951ad070b3fa39dd1d83503aa1011a20d9a21
dispatch: store args and command run on ui

This could also be used to simplify cases where we wrap `dispatch.runcommand` in
extensions to get this information (e.g. in resolve.py and keyword.py)

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -830,6 +830,8 @@
             ui.warn(_("warning: --repository ignored\n"))
 
         msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
+        ui.args = fullargs
+        ui.commandname = cmd
         ui.log("command", '%s\n', msg)
         strcmdopt = pycompat.strkwargs(cmdoptions)
         d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -160,6 +160,8 @@
         self._colormode = None
         self._terminfoparams = {}
         self._styles = {}
+        self.commandname = None
+        self.args = None
 
         if src:
             self.fout = src.fout


More information about the Mercurial-devel mailing list