logging: log pythonhook blocked time

Summary:
Note: MergeDriver is a special kind of Python hooks. Therefore the MergeDriver
enum was removed.

Reviewed By: markbt

Differential Revision: D15755282

fbshipit-source-id: a00c75a5c3b013eda189d50f6dae42653c0ed18b
This commit is contained in:
Jun Wu 2019-07-06 02:41:45 -07:00 committed by Facebook Github Bot
parent 853938a1b9
commit 66c2b83c09
3 changed files with 9 additions and 7 deletions

View File

@ -10,7 +10,7 @@ from __future__ import absolute_import
import os
import sys
from . import demandimport, encoding, error, extensions, pycompat, util
from . import blackbox, demandimport, encoding, error, extensions, pycompat, util
from .i18n import _
@ -101,6 +101,7 @@ def _pythonhook(ui, repo, htype, hname, funcname, args, throw):
return True, True
finally:
duration = util.timer() - starttime
blackbox.logblocked("pythonhook", duration, name=hname)
ui.log(
"pythonhook",
"pythonhook-%s: %s finished in %0.2f seconds\n",

View File

@ -382,6 +382,7 @@ pub enum BlockedOp {
#[serde(rename = "H", alias = "exthook")]
ExtHook,
// Note: MergeDriver belongs to PythonHook.
#[serde(rename = "h", alias = "pythonhook")]
PythonHook,
@ -397,9 +398,9 @@ pub enum BlockedOp {
#[serde(rename = "PR", alias = "prompt")]
Prompt,
#[serde(rename = "M", alias = "mergedriver")]
MergeDriver,
// Do not reuse "M" or "mergedriver".
// #[serde(rename = "M", alias = "mergedriver")]
// MergeDriver,
#[serde(rename = "m", alias = "mergetool")]
MergeTool,
}

View File

@ -130,9 +130,9 @@ extension and python hooks - use the eol extension for a pythonhook
> # (in addition, keeping it requires extra care for fsmonitor)
> eol=!
> EOF
$ hg blackbox --pattern '{"legacy_log":{"service":["or","pythonhook","exthook"]}}'
[legacy][pythonhook] pythonhook-preupdate: edenscm.hgext.eol.preupdate finished in 0.00 seconds
[legacy][exthook] exthook-update: echo hooked finished in 0.00 seconds
$ hg blackbox --pattern '{"blocked":{"op":["or","pythonhook","exthook"]}}'
[blocked] PythonHook (preupdate.eol) blocked for 0 ms
[blocked] ExtHook blocked for 0 ms
log rotation (tested in the Rust land)