##// END OF EJS Templates
blackbox: properly replace ui class...
timeless -
r28248:851c41a2 default
parent child Browse files
Show More
@@ -1,220 +1,243 b''
1 # blackbox.py - log repository events to a file for post-mortem debugging
1 # blackbox.py - log repository events to a file for post-mortem debugging
2 #
2 #
3 # Copyright 2010 Nicolas Dumazet
3 # Copyright 2010 Nicolas Dumazet
4 # Copyright 2013 Facebook, Inc.
4 # Copyright 2013 Facebook, Inc.
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
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 config key.
12 The events that get logged can be configured via the blackbox.track config key.
13
13
14 If you want to record whether the repository is dirty (a `+` sign, as you'd
14 If you want to record whether the repository is dirty (a `+` sign, as you'd
15 get when using :hg:`id`), you can set the blackbox.dirty config key.
15 get when using :hg:`id`), you can set the blackbox.dirty config key.
16
16
17 Examples::
17 Examples::
18
18
19 [blackbox]
19 [blackbox]
20 track = *
20 track = *
21 dirty = True
21 dirty = True
22
22
23 [blackbox]
23 [blackbox]
24 track = command, commandfinish, commandexception, exthook, pythonhook
24 track = command, commandfinish, commandexception, exthook, pythonhook
25
25
26 [blackbox]
26 [blackbox]
27 track = incoming
27 track = incoming
28
28
29 [blackbox]
29 [blackbox]
30 # limit the size of a log file
30 # limit the size of a log file
31 maxsize = 1.5 MB
31 maxsize = 1.5 MB
32 # rotate up to N log files when the current one gets too big
32 # rotate up to N log files when the current one gets too big
33 maxfiles = 3
33 maxfiles = 3
34
34
35 """
35 """
36
36
37 from __future__ import absolute_import
37 from __future__ import absolute_import
38
38
39 import errno
39 import errno
40 import re
40 import re
41
41
42 from mercurial.i18n import _
42 from mercurial.i18n import _
43 from mercurial.node import hex
43 from mercurial.node import hex
44
44
45 from mercurial import (
45 from mercurial import (
46 cmdutil,
46 cmdutil,
47 ui as uimod,
47 util,
48 util,
48 )
49 )
49
50
50 cmdtable = {}
51 cmdtable = {}
51 command = cmdutil.command(cmdtable)
52 command = cmdutil.command(cmdtable)
52 # Note for extension authors: ONLY specify testedwith = 'internal' for
53 # Note for extension authors: ONLY specify testedwith = 'internal' for
53 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
54 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
54 # be specifying the version(s) of Mercurial they are tested with, or
55 # be specifying the version(s) of Mercurial they are tested with, or
55 # leave the attribute unspecified.
56 # leave the attribute unspecified.
56 testedwith = 'internal'
57 testedwith = 'internal'
57 lastui = None
58 lastui = None
58
59
59 filehandles = {}
60 filehandles = {}
60
61
61 def _openlog(vfs):
62 def _openlog(vfs):
62 path = vfs.join('blackbox.log')
63 path = vfs.join('blackbox.log')
63 if path in filehandles:
64 if path in filehandles:
64 return filehandles[path]
65 return filehandles[path]
65 filehandles[path] = fp = vfs('blackbox.log', 'a')
66 filehandles[path] = fp = vfs('blackbox.log', 'a')
66 return fp
67 return fp
67
68
68 def _closelog(vfs):
69 def _closelog(vfs):
69 path = vfs.join('blackbox.log')
70 path = vfs.join('blackbox.log')
70 fp = filehandles[path]
71 fp = filehandles[path]
71 del filehandles[path]
72 del filehandles[path]
72 fp.close()
73 fp.close()
73
74
74 def hexfn(node):
75 def hexfn(node):
75 if node is None:
76 if node is None:
76 return None
77 return None
77 else:
78 else:
78 return hex(node)
79 return hex(node)
79
80
80 def wrapui(ui):
81 def wrapui(ui):
81 class blackboxui(ui.__class__):
82 class blackboxui(ui.__class__):
83 def __init__(self, src=None):
84 super(blackboxui, self).__init__(src)
85 if src is None:
86 self._partialinit()
87 else:
88 self._bbfp = src._bbfp
89 self._bbrepo = src._bbrepo
90 self._bbvfs = src._bbvfs
91
92 def _partialinit(self):
93 if util.safehasattr(self, '_bbvfs'):
94 return
95 self._bbfp = None
96 self._bbrepo = None
97 self._bbvfs = None
98
99 def copy(self):
100 self._partialinit()
101 return self.__class__(self)
102
82 @util.propertycache
103 @util.propertycache
83 def track(self):
104 def track(self):
84 return self.configlist('blackbox', 'track', ['*'])
105 return self.configlist('blackbox', 'track', ['*'])
85
106
86 def _openlogfile(self):
107 def _openlogfile(self):
87 def rotate(oldpath, newpath):
108 def rotate(oldpath, newpath):
88 try:
109 try:
89 self._bbvfs.unlink(newpath)
110 self._bbvfs.unlink(newpath)
90 except OSError as err:
111 except OSError as err:
91 if err.errno != errno.ENOENT:
112 if err.errno != errno.ENOENT:
92 self.debug("warning: cannot remove '%s': %s\n" %
113 self.debug("warning: cannot remove '%s': %s\n" %
93 (newpath, err.strerror))
114 (newpath, err.strerror))
94 try:
115 try:
95 if newpath:
116 if newpath:
96 self._bbvfs.rename(oldpath, newpath)
117 self._bbvfs.rename(oldpath, newpath)
97 except OSError as err:
118 except OSError as err:
98 if err.errno != errno.ENOENT:
119 if err.errno != errno.ENOENT:
99 self.debug("warning: cannot rename '%s' to '%s': %s\n" %
120 self.debug("warning: cannot rename '%s' to '%s': %s\n" %
100 (newpath, oldpath, err.strerror))
121 (newpath, oldpath, err.strerror))
101
122
102 fp = _openlog(self._bbvfs)
123 fp = _openlog(self._bbvfs)
103 maxsize = self.configbytes('blackbox', 'maxsize', 1048576)
124 maxsize = self.configbytes('blackbox', 'maxsize', 1048576)
104 if maxsize > 0:
125 if maxsize > 0:
105 st = self._bbvfs.fstat(fp)
126 st = self._bbvfs.fstat(fp)
106 if st.st_size >= maxsize:
127 if st.st_size >= maxsize:
107 path = fp.name
128 path = fp.name
108 _closelog(self._bbvfs)
129 _closelog(self._bbvfs)
109 maxfiles = self.configint('blackbox', 'maxfiles', 7)
130 maxfiles = self.configint('blackbox', 'maxfiles', 7)
110 for i in xrange(maxfiles - 1, 1, -1):
131 for i in xrange(maxfiles - 1, 1, -1):
111 rotate(oldpath='%s.%d' % (path, i - 1),
132 rotate(oldpath='%s.%d' % (path, i - 1),
112 newpath='%s.%d' % (path, i))
133 newpath='%s.%d' % (path, i))
113 rotate(oldpath=path,
134 rotate(oldpath=path,
114 newpath=maxfiles > 0 and path + '.1')
135 newpath=maxfiles > 0 and path + '.1')
115 fp = _openlog(self._bbvfs)
136 fp = _openlog(self._bbvfs)
116 return fp
137 return fp
117
138
118 def _bbwrite(self, fmt, *args):
139 def _bbwrite(self, fmt, *args):
119 self._bbfp.write(fmt % args)
140 self._bbfp.write(fmt % args)
120 self._bbfp.flush()
141 self._bbfp.flush()
121
142
122 def log(self, event, *msg, **opts):
143 def log(self, event, *msg, **opts):
123 global lastui
144 global lastui
124 super(blackboxui, self).log(event, *msg, **opts)
145 super(blackboxui, self).log(event, *msg, **opts)
146 self._partialinit()
125
147
126 if not '*' in self.track and not event in self.track:
148 if not '*' in self.track and not event in self.track:
127 return
149 return
128
150
129 if util.safehasattr(self, '_bbfp'):
151 if self._bbfp:
130 ui = self
152 ui = self
131 elif util.safehasattr(self, '_bbvfs'):
153 elif self._bbvfs:
132 try:
154 try:
133 self._bbfp = self._openlogfile()
155 self._bbfp = self._openlogfile()
134 except (IOError, OSError) as err:
156 except (IOError, OSError) as err:
135 self.debug('warning: cannot write to blackbox.log: %s\n' %
157 self.debug('warning: cannot write to blackbox.log: %s\n' %
136 err.strerror)
158 err.strerror)
137 del self._bbvfs
159 del self._bbvfs
138 self._bbfp = None
160 self._bbfp = None
139 ui = self
161 ui = self
140 else:
162 else:
141 # certain ui instances exist outside the context of
163 # certain ui instances exist outside the context of
142 # a repo, so just default to the last blackbox that
164 # a repo, so just default to the last blackbox that
143 # was seen.
165 # was seen.
144 ui = lastui
166 ui = lastui
145
167
146 if (util.safehasattr(ui, '_bbfp') and
168 if ui and ui._bbfp:
147 ui._bbfp is not None):
148 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
169 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
149 user = util.getuser()
170 user = util.getuser()
150 pid = str(util.getpid())
171 pid = str(util.getpid())
151 formattedmsg = msg[0] % msg[1:]
172 formattedmsg = msg[0] % msg[1:]
152 rev = '(unknown)'
173 rev = '(unknown)'
153 changed = ''
174 changed = ''
154 if util.safehasattr(ui, '_bbrepo'):
175 if ui._bbrepo:
155 ctx = ui._bbrepo[None]
176 ctx = ui._bbrepo[None]
156 if ctx.rev() is not None:
177 if ctx.rev() is not None:
157 rev = hexfn(ctx.node())
178 rev = hexfn(ctx.node())
158 else:
179 else:
159 parents = ctx.parents()
180 parents = ctx.parents()
160 rev = ('+'.join([hexfn(p.node()) for p in parents]))
181 rev = ('+'.join([hexfn(p.node()) for p in parents]))
161 if (ui.configbool('blackbox', 'dirty', False) and (
182 if (ui.configbool('blackbox', 'dirty', False) and (
162 any(ui._bbrepo.status()) or
183 any(ui._bbrepo.status()) or
163 any(ctx.sub(s).dirty() for s in ctx.substate)
184 any(ctx.sub(s).dirty() for s in ctx.substate)
164 )):
185 )):
165 changed = '+'
186 changed = '+'
166 try:
187 try:
167 ui._bbwrite('%s %s @%s%s (%s)> %s',
188 ui._bbwrite('%s %s @%s%s (%s)> %s',
168 date, user, rev, changed, pid, formattedmsg)
189 date, user, rev, changed, pid, formattedmsg)
169 except IOError as err:
190 except IOError as err:
170 self.debug('warning: cannot write to blackbox.log: %s\n' %
191 self.debug('warning: cannot write to blackbox.log: %s\n' %
171 err.strerror)
192 err.strerror)
172 if not lastui or util.safehasattr(ui, '_bbrepo'):
193 if not lastui or ui._bbrepo:
173 lastui = ui
194 lastui = ui
174
195
175 def setrepo(self, repo):
196 def setrepo(self, repo):
197 self._bbfp = None
198 self._bbrepo = repo
176 self._bbvfs = repo.vfs
199 self._bbvfs = repo.vfs
177 self._bbrepo = repo
178
200
179 ui.__class__ = blackboxui
201 ui.__class__ = blackboxui
202 uimod.ui = blackboxui
180
203
181 def uisetup(ui):
204 def uisetup(ui):
182 wrapui(ui)
205 wrapui(ui)
183
206
184 def reposetup(ui, repo):
207 def reposetup(ui, repo):
185 # During 'hg pull' a httppeer repo is created to represent the remote repo.
208 # During 'hg pull' a httppeer repo is created to represent the remote repo.
186 # It doesn't have a .hg directory to put a blackbox in, so we don't do
209 # It doesn't have a .hg directory to put a blackbox in, so we don't do
187 # the blackbox setup for it.
210 # the blackbox setup for it.
188 if not repo.local():
211 if not repo.local():
189 return
212 return
190
213
191 if util.safehasattr(ui, 'setrepo'):
214 if util.safehasattr(ui, 'setrepo'):
192 ui.setrepo(repo)
215 ui.setrepo(repo)
193
216
194 @command('^blackbox',
217 @command('^blackbox',
195 [('l', 'limit', 10, _('the number of events to show')),
218 [('l', 'limit', 10, _('the number of events to show')),
196 ],
219 ],
197 _('hg blackbox [OPTION]...'))
220 _('hg blackbox [OPTION]...'))
198 def blackbox(ui, repo, *revs, **opts):
221 def blackbox(ui, repo, *revs, **opts):
199 '''view the recent repository events
222 '''view the recent repository events
200 '''
223 '''
201
224
202 if not repo.vfs.exists('blackbox.log'):
225 if not repo.vfs.exists('blackbox.log'):
203 return
226 return
204
227
205 limit = opts.get('limit')
228 limit = opts.get('limit')
206 fp = repo.vfs('blackbox.log', 'r')
229 fp = repo.vfs('blackbox.log', 'r')
207 lines = fp.read().split('\n')
230 lines = fp.read().split('\n')
208
231
209 count = 0
232 count = 0
210 output = []
233 output = []
211 for line in reversed(lines):
234 for line in reversed(lines):
212 if count >= limit:
235 if count >= limit:
213 break
236 break
214
237
215 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
238 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
216 if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
239 if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
217 count += 1
240 count += 1
218 output.append(line)
241 output.append(line)
219
242
220 ui.status('\n'.join(reversed(output)))
243 ui.status('\n'.join(reversed(output)))
@@ -1,186 +1,193 b''
1 setup
1 setup
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [extensions]
3 > [extensions]
4 > blackbox=
4 > blackbox=
5 > mock=$TESTDIR/mockblackbox.py
5 > mock=$TESTDIR/mockblackbox.py
6 > mq=
6 > mq=
7 > EOF
7 > EOF
8 $ hg init blackboxtest
8 $ hg init blackboxtest
9 $ cd blackboxtest
9 $ cd blackboxtest
10
10
11 command, exit codes, and duration
11 command, exit codes, and duration
12
12
13 $ echo a > a
13 $ echo a > a
14 $ hg add a
14 $ hg add a
15 $ hg blackbox --config blackbox.dirty=True
15 $ hg blackbox --config blackbox.dirty=True
16 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
16 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
17 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
17 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
19
19
20 incoming change tracking
20 incoming change tracking
21
21
22 create two heads to verify that we only see one change in the log later
22 create two heads to verify that we only see one change in the log later
23 $ hg commit -ma
23 $ hg commit -ma
24 $ hg up null
24 $ hg up null
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 $ echo b > b
26 $ echo b > b
27 $ hg commit -Amb
27 $ hg commit -Amb
28 adding b
28 adding b
29 created new head
29 created new head
30
30
31 clone, commit, pull
31 clone, commit, pull
32 $ hg clone . ../blackboxtest2
32 $ hg clone . ../blackboxtest2
33 updating to branch default
33 updating to branch default
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 $ echo c > c
35 $ echo c > c
36 $ hg commit -Amc
36 $ hg commit -Amc
37 adding c
37 adding c
38 $ cd ../blackboxtest2
38 $ cd ../blackboxtest2
39 $ hg pull
39 $ hg pull
40 pulling from $TESTTMP/blackboxtest (glob)
40 pulling from $TESTTMP/blackboxtest (glob)
41 searching for changes
41 searching for changes
42 adding changesets
42 adding changesets
43 adding manifests
43 adding manifests
44 adding file changes
44 adding file changes
45 added 1 changesets with 1 changes to 1 files
45 added 1 changesets with 1 changes to 1 files
46 (run 'hg update' to get a working copy)
46 (run 'hg update' to get a working copy)
47 $ hg blackbox -l 6
47 $ hg blackbox -l 6
48 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
48 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
49 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
49 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
50 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
50 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
51 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
51 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
52 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
52 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
53 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
53 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
54
54
55 we must not cause a failure if we cannot write to the log
55 we must not cause a failure if we cannot write to the log
56
56
57 $ hg rollback
57 $ hg rollback
58 repository tip rolled back to revision 1 (undo pull)
58 repository tip rolled back to revision 1 (undo pull)
59
59
60 $ mv .hg/blackbox.log .hg/blackbox.log-
60 $ mv .hg/blackbox.log .hg/blackbox.log-
61 $ mkdir .hg/blackbox.log
61 $ mkdir .hg/blackbox.log
62 $ hg --debug incoming
62 $ hg --debug incoming
63 warning: cannot write to blackbox.log: * (glob)
63 warning: cannot write to blackbox.log: * (glob)
64 comparing with $TESTTMP/blackboxtest (glob)
64 comparing with $TESTTMP/blackboxtest (glob)
65 query 1; heads
65 query 1; heads
66 searching for changes
66 searching for changes
67 all local heads known remotely
67 all local heads known remotely
68 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
68 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
69 tag: tip
69 tag: tip
70 phase: draft
70 phase: draft
71 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
71 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
72 parent: -1:0000000000000000000000000000000000000000
72 parent: -1:0000000000000000000000000000000000000000
73 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
73 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
74 user: test
74 user: test
75 date: Thu Jan 01 00:00:00 1970 +0000
75 date: Thu Jan 01 00:00:00 1970 +0000
76 files+: c
76 files+: c
77 extra: branch=default
77 extra: branch=default
78 description:
78 description:
79 c
79 c
80
80
81
81
82 $ hg pull
82 $ hg pull
83 pulling from $TESTTMP/blackboxtest (glob)
83 pulling from $TESTTMP/blackboxtest (glob)
84 searching for changes
84 searching for changes
85 adding changesets
85 adding changesets
86 adding manifests
86 adding manifests
87 adding file changes
87 adding file changes
88 added 1 changesets with 1 changes to 1 files
88 added 1 changesets with 1 changes to 1 files
89 (run 'hg update' to get a working copy)
89 (run 'hg update' to get a working copy)
90
90
91 a failure reading from the log is fatal
91 a failure reading from the log is fatal
92
92
93 $ hg blackbox -l 3
93 $ hg blackbox -l 3
94 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
94 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
95 [255]
95 [255]
96
96
97 $ rmdir .hg/blackbox.log
97 $ rmdir .hg/blackbox.log
98 $ mv .hg/blackbox.log- .hg/blackbox.log
98 $ mv .hg/blackbox.log- .hg/blackbox.log
99
99
100 backup bundles get logged
100 backup bundles get logged
101
101
102 $ touch d
102 $ touch d
103 $ hg commit -Amd
103 $ hg commit -Amd
104 adding d
104 adding d
105 created new head
105 created new head
106 $ hg strip tip
106 $ hg strip tip
107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
108 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
108 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
109 $ hg blackbox -l 6
109 $ hg blackbox -l 6
110 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
110 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
111 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
111 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
112 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
112 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
113 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
113 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
114 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
114 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
115 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
115 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
116
116
117 extension and python hooks - use the eol extension for a pythonhook
117 extension and python hooks - use the eol extension for a pythonhook
118
118
119 $ echo '[extensions]' >> .hg/hgrc
119 $ echo '[extensions]' >> .hg/hgrc
120 $ echo 'eol=' >> .hg/hgrc
120 $ echo 'eol=' >> .hg/hgrc
121 $ echo '[hooks]' >> .hg/hgrc
121 $ echo '[hooks]' >> .hg/hgrc
122 $ echo 'update = echo hooked' >> .hg/hgrc
122 $ echo 'update = echo hooked' >> .hg/hgrc
123 $ hg update
123 $ hg update
124 hooked
124 hooked
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 1 other heads for branch "default"
126 1 other heads for branch "default"
127 $ hg blackbox -l 6
127 $ hg blackbox -l 6
128 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update
128 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update
129 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
129 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
130 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
130 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
131 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
131 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
132 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob)
132 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob)
133 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
133 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
134
134
135 log rotation
135 log rotation
136
136
137 $ echo '[blackbox]' >> .hg/hgrc
137 $ echo '[blackbox]' >> .hg/hgrc
138 $ echo 'maxsize = 20 b' >> .hg/hgrc
138 $ echo 'maxsize = 20 b' >> .hg/hgrc
139 $ echo 'maxfiles = 3' >> .hg/hgrc
139 $ echo 'maxfiles = 3' >> .hg/hgrc
140 $ hg status
140 $ hg status
141 $ hg status
141 $ hg status
142 $ hg status
142 $ hg status
143 $ hg tip -q
143 $ hg tip -q
144 2:d02f48003e62
144 2:d02f48003e62
145 $ ls .hg/blackbox.log*
145 $ ls .hg/blackbox.log*
146 .hg/blackbox.log
146 .hg/blackbox.log
147 .hg/blackbox.log.1
147 .hg/blackbox.log.1
148 .hg/blackbox.log.2
148 .hg/blackbox.log.2
149 $ cd ..
149 $ cd ..
150
150
151 $ hg init blackboxtest3
151 $ hg init blackboxtest3
152 $ cd blackboxtest3
152 $ cd blackboxtest3
153 $ hg blackbox
153 $ hg blackbox
154 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
154 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
155 $ mv .hg/blackbox.log .hg/blackbox.log-
155 $ mv .hg/blackbox.log .hg/blackbox.log-
156 $ mkdir .hg/blackbox.log
156 $ mkdir .hg/blackbox.log
157 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
157 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
158 $ python ../test-dispatch.py
158 $ python ../test-dispatch.py
159 running: add foo
159 running: add foo
160 result: 0
160 result: 0
161 running: commit -m commit1 -d 2000-01-01 foo
161 running: commit -m commit1 -d 2000-01-01 foo
162 result: None
162 result: None
163 running: commit -m commit2 -d 2000-01-02 foo
163 running: commit -m commit2 -d 2000-01-02 foo
164 result: None
164 result: None
165 running: log -r 0
165 running: log -r 0
166 changeset: 0:0e4634943879
166 changeset: 0:0e4634943879
167 user: test
167 user: test
168 date: Sat Jan 01 00:00:00 2000 +0000
168 date: Sat Jan 01 00:00:00 2000 +0000
169 summary: commit1
169 summary: commit1
170
170
171 result: None
171 result: None
172 running: log -r tip
172 running: log -r tip
173 changeset: 1:45589e459b2e
173 changeset: 1:45589e459b2e
174 tag: tip
174 tag: tip
175 user: test
175 user: test
176 date: Sun Jan 02 00:00:00 2000 +0000
176 date: Sun Jan 02 00:00:00 2000 +0000
177 summary: commit2
177 summary: commit2
178
178
179 result: None
179 result: None
180 $ hg blackbox
180 $ hg blackbox
181 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
181 1970/01/01 00:00:00 bob @0e46349438790c460c5c9f7546bfcd39b267bbd2 (5000)> commit -m commit2 -d 2000-01-02 foo
182 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox exited 0 after * seconds (glob)
182 1970/01/01 00:00:00 bob @0e46349438790c460c5c9f7546bfcd39b267bbd2 (5000)> updated served branch cache in * seconds (glob)
183 1970/01/01 00:00:00 bob @0e46349438790c460c5c9f7546bfcd39b267bbd2 (5000)> wrote served branch cache with 1 labels and 1 nodes
184 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> commit -m commit2 -d 2000-01-02 foo exited 0 after * seconds (glob)
185 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0
186 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags
187 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0 exited 0 after * seconds (glob)
188 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip
189 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip exited 0 after * seconds (glob)
183 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
190 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
184
191
185 cleanup
192 cleanup
186 $ cd ..
193 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now