##// END OF EJS Templates
logtoprocess: sends the canonical command name to the subprocess...
Boris Feld -
r40438:106adc26 default
parent child Browse files
Show More
@@ -66,6 +66,9 b' class request(object):'
66 66 # low-level repo state (for example, changelog) before extensions.
67 67 self.prereposetups = prereposetups or []
68 68
69 # store the parsed and canonical command
70 self.canonical_command = None
71
69 72 def _runexithandlers(self):
70 73 exc = None
71 74 handlers = self.ui._exithandlers
@@ -243,7 +246,8 b' def dispatch(req):'
243 246 req.ui.log('uiblocked', 'ui blocked ms',
244 247 **pycompat.strkwargs(req.ui._blockedtimes))
245 248 req.ui.log("commandfinish", "%s exited %d after %0.2f seconds\n",
246 msg, ret & 255, duration)
249 msg, ret & 255, duration,
250 canonical_command=req.canonical_command)
247 251 try:
248 252 req._runexithandlers()
249 253 except: # exiting, so no re-raises
@@ -853,6 +857,9 b' def _dispatch(req):'
853 857 fullargs = args
854 858 cmd, func, args, options, cmdoptions = _parse(lui, args)
855 859
860 # store the canonical command name in request object for later access
861 req.canonical_command = cmd
862
856 863 if options["config"] != req.earlyoptions["config"]:
857 864 raise error.Abort(_("option --config may not be abbreviated!"))
858 865 if options["cwd"] != req.earlyoptions["cwd"]:
@@ -17,7 +17,7 b' Test if logtoprocess correctly captures '
17 17 > configitem('logtoprocess', 'foo',
18 18 > default=None,
19 19 > )
20 > @command(b'foo', [])
20 > @command(b'foobar', [])
21 21 > def foo(ui, repo):
22 22 > ui.log('foo', 'a message: %s\n', 'spam')
23 23 > EOF
@@ -35,7 +35,8 b' Test if logtoprocess correctly captures '
35 35 > echo "\$EVENT";
36 36 > echo "\$MSG1";
37 37 > echo "\$MSG2";
38 > echo "\$MSG3") > $TESTTMP/commandfinish.log
38 > echo "\$MSG3";
39 > echo "canonical: \$OPT_CANONICAL_COMMAND") > $TESTTMP/commandfinish.log
39 40 > foo=(echo 'logtoprocess foo output:';
40 41 > echo "\$EVENT";
41 42 > echo "\$MSG1";
@@ -46,22 +47,23 b' Running a command triggers both a ui.log'
46 47 ui.log('commandfinish') call. The foo command also uses ui.log.
47 48
48 49 Use sort to avoid ordering issues between the various processes we spawn:
49 $ hg foo
50 $ hg fooba
50 51 $ sleep 1
51 52 $ cat $TESTTMP/command.log | sort
52 53
53 54 command
54 foo
55 foo
55 fooba
56 fooba
56 57 logtoprocess command output:
57 58
58 59 #if no-chg
59 60 $ cat $TESTTMP/commandfinish.log | sort
60 61
61 62 0
63 canonical: foobar
62 64 commandfinish
63 foo
64 foo exited 0 after * seconds (glob)
65 fooba
66 fooba exited 0 after * seconds (glob)
65 67 logtoprocess commandfinish output:
66 68 $ cat $TESTTMP/foo.log | sort
67 69
General Comments 0
You need to be logged in to leave comments. Login now