Show More
@@ -9,12 +9,14 b'' | |||||
9 | """log repository events to a blackbox for debugging |
|
9 | """log repository events to a blackbox for debugging | |
10 |
|
10 | |||
11 | Logs event information to .hg/blackbox.log to help debug and diagnose problems. |
|
11 | Logs event information to .hg/blackbox.log to help debug and diagnose problems. | |
12 |
The events that get logged can be configured via the blackbox.track |
|
12 | The events that get logged can be configured via the blackbox.track and | |
|
13 | blackbox.ignore config keys. | |||
13 |
|
14 | |||
14 | Examples:: |
|
15 | Examples:: | |
15 |
|
16 | |||
16 | [blackbox] |
|
17 | [blackbox] | |
17 | track = * |
|
18 | track = * | |
|
19 | ignore = pythonhook | |||
18 | # dirty is *EXPENSIVE* (slow); |
|
20 | # dirty is *EXPENSIVE* (slow); | |
19 | # each log entry indicates `+` if the repository is dirty, like :hg:`id`. |
|
21 | # each log entry indicates `+` if the repository is dirty, like :hg:`id`. | |
20 | dirty = True |
|
22 | dirty = True | |
@@ -84,6 +86,9 b" configitem('blackbox', 'maxfiles'," | |||||
84 | configitem('blackbox', 'track', |
|
86 | configitem('blackbox', 'track', | |
85 | default=lambda: ['*'], |
|
87 | default=lambda: ['*'], | |
86 | ) |
|
88 | ) | |
|
89 | configitem('blackbox', 'ignore', | |||
|
90 | default=lambda: ['chgserver', 'cmdserver', 'extension'], | |||
|
91 | ) | |||
87 | configitem('blackbox', 'date-format', |
|
92 | configitem('blackbox', 'date-format', | |
88 | default='%Y/%m/%d %H:%M:%S', |
|
93 | default='%Y/%m/%d %H:%M:%S', | |
89 | ) |
|
94 | ) | |
@@ -94,12 +99,15 b' class blackboxlogger(object):' | |||||
94 | def __init__(self, ui, repo): |
|
99 | def __init__(self, ui, repo): | |
95 | self._repo = repo |
|
100 | self._repo = repo | |
96 | self._trackedevents = set(ui.configlist('blackbox', 'track')) |
|
101 | self._trackedevents = set(ui.configlist('blackbox', 'track')) | |
|
102 | self._ignoredevents = set(ui.configlist('blackbox', 'ignore')) | |||
97 | self._maxfiles = ui.configint('blackbox', 'maxfiles') |
|
103 | self._maxfiles = ui.configint('blackbox', 'maxfiles') | |
98 | self._maxsize = ui.configbytes('blackbox', 'maxsize') |
|
104 | self._maxsize = ui.configbytes('blackbox', 'maxsize') | |
99 | self._inlog = False |
|
105 | self._inlog = False | |
100 |
|
106 | |||
101 | def tracked(self, event): |
|
107 | def tracked(self, event): | |
102 |
return b'*' in self._trackedevents |
|
108 | return ((b'*' in self._trackedevents | |
|
109 | and event not in self._ignoredevents) | |||
|
110 | or event in self._trackedevents) | |||
103 |
|
111 | |||
104 | def log(self, ui, event, msg, opts): |
|
112 | def log(self, ui, event, msg, opts): | |
105 | # self._log() -> ctx.dirty() may create new subrepo instance, which |
|
113 | # self._log() -> ctx.dirty() may create new subrepo instance, which |
@@ -22,9 +22,6 b' setup' | |||||
22 | > [alias] |
|
22 | > [alias] | |
23 | > confuse = log --limit 3 |
|
23 | > confuse = log --limit 3 | |
24 | > so-confusing = confuse --style compact |
|
24 | > so-confusing = confuse --style compact | |
25 | > [blackbox] |
|
|||
26 | > track = backupbundle, branchcache, command, commandalias, commandexception, |
|
|||
27 | > commandfinish, debug, exthook, incoming, pythonhook, tagscache |
|
|||
28 | > EOF |
|
25 | > EOF | |
29 |
|
26 | |||
30 | $ hg init blackboxtest |
|
27 | $ hg init blackboxtest |
General Comments 0
You need to be logged in to leave comments.
Login now