comparison mercurial/dispatch.py @ 40651:1243295fcc3a

logtoprocess: update commandfinish options arguments d2c997b8001f changed the logtoprocess API with the effect of not exposing the positional arguments to the logtoprocess scripts anymore. We have some scripts that use the duration and return code of the "commandfinish" event to monitor hg calls. Update the logging of the "commandfinish" to expose those values as options argument, which will be accessible as `OPT_RETURN_CODE` and `OPT_DURATION` in logtoprocess arguments. The code has been formatted with Black. Differential Revision: https://phab.mercurial-scm.org/D5282
author Boris Feld <boris.feld@octobus.net>
date Fri, 16 Nov 2018 14:21:47 +0100
parents 5542bc9125c9
children c93d046d4300
comparison
equal deleted inserted replaced
40650:ea84c2b286a2 40651:1243295fcc3a
248 req.ui.flush() 248 req.ui.flush()
249 if req.ui.logblockedtimes: 249 if req.ui.logblockedtimes:
250 req.ui._blockedtimes['command_duration'] = duration * 1000 250 req.ui._blockedtimes['command_duration'] = duration * 1000
251 req.ui.log('uiblocked', 'ui blocked ms', 251 req.ui.log('uiblocked', 'ui blocked ms',
252 **pycompat.strkwargs(req.ui._blockedtimes)) 252 **pycompat.strkwargs(req.ui._blockedtimes))
253 req.ui.log("commandfinish", "%s exited %d after %0.2f seconds\n", 253 return_code = ret & 255
254 msg, ret & 255, duration, 254 req.ui.log(
255 canonical_command=req.canonical_command) 255 "commandfinish",
256 "%s exited %d after %0.2f seconds\n",
257 msg,
258 return_code,
259 duration,
260 return_code=return_code,
261 duration=duration,
262 canonical_command=req.canonical_command,
263 )
256 try: 264 try:
257 req._runexithandlers() 265 req._runexithandlers()
258 except: # exiting, so no re-raises 266 except: # exiting, so no re-raises
259 ret = ret or -1 267 ret = ret or -1
260 return ret 268 return ret