redo-log: sometimes print a (resumed) line after ending a level of recursion.
If A calls B, and B produces stderr output, and then A wants to produce output, the resulting log would be confusing: we'd see 'redo A' and then 'redo B' and then B's output, but no indicator that B has ended and we're back in A. Now we show 'redo A (resumed)' before A's output. If B didn't produce any output, or A doesn't produce any output, we don't bother with the (resumed) line. This seems nice, as it doesn't clutter the log when there is no ambiguity anyway.
This commit is contained in:
parent
b196315222
commit
cead02bd21
2 changed files with 23 additions and 3 deletions
|
|
@ -66,8 +66,10 @@ def catlog(t):
|
||||||
Note: this function's behaviour depends on global command-line options.
|
Note: this function's behaviour depends on global command-line options.
|
||||||
"""
|
"""
|
||||||
global total_lines, status
|
global total_lines, status
|
||||||
|
lines_written = 0
|
||||||
|
interrupted = 0
|
||||||
if t in already:
|
if t in already:
|
||||||
return
|
return 0
|
||||||
if t != '-':
|
if t != '-':
|
||||||
depth.append(t)
|
depth.append(t)
|
||||||
_fix_depth()
|
_fix_depth()
|
||||||
|
|
@ -178,7 +180,9 @@ def catlog(t):
|
||||||
if opt.recursive:
|
if opt.recursive:
|
||||||
if loglock:
|
if loglock:
|
||||||
loglock.unlock()
|
loglock.unlock()
|
||||||
catlog(os.path.join(mydir, text))
|
got = catlog(os.path.join(mydir, text))
|
||||||
|
interrupted += got
|
||||||
|
lines_written += got
|
||||||
if loglock:
|
if loglock:
|
||||||
loglock.waitlock(shared=True)
|
loglock.waitlock(shared=True)
|
||||||
already.add(fixname)
|
already.add(fixname)
|
||||||
|
|
@ -186,24 +190,37 @@ def catlog(t):
|
||||||
if opt.debug_locks:
|
if opt.debug_locks:
|
||||||
logs.meta(kind, relname, pid=pid)
|
logs.meta(kind, relname, pid=pid)
|
||||||
logs.write(line.rstrip())
|
logs.write(line.rstrip())
|
||||||
|
lines_written += 1
|
||||||
elif fixname not in already:
|
elif fixname not in already:
|
||||||
logs.meta('do', relname, pid=pid)
|
logs.meta('do', relname, pid=pid)
|
||||||
|
lines_written += 1
|
||||||
if opt.recursive:
|
if opt.recursive:
|
||||||
assert text
|
assert text
|
||||||
if loglock:
|
if loglock:
|
||||||
loglock.unlock()
|
loglock.unlock()
|
||||||
catlog(os.path.join(mydir, text))
|
got = catlog(os.path.join(mydir, text))
|
||||||
|
interrupted += got
|
||||||
|
lines_written += got
|
||||||
if loglock:
|
if loglock:
|
||||||
loglock.waitlock(shared=True)
|
loglock.waitlock(shared=True)
|
||||||
already.add(fixname)
|
already.add(fixname)
|
||||||
elif kind == 'done':
|
elif kind == 'done':
|
||||||
rv, name = text.split(' ', 1)
|
rv, name = text.split(' ', 1)
|
||||||
logs.meta(kind, rv + ' ' + _rel(topdir, mydir, name))
|
logs.meta(kind, rv + ' ' + _rel(topdir, mydir, name))
|
||||||
|
lines_written += 1
|
||||||
else:
|
else:
|
||||||
logs.write(line.rstrip())
|
logs.write(line.rstrip())
|
||||||
|
lines_written += 1
|
||||||
else:
|
else:
|
||||||
if opt.details:
|
if opt.details:
|
||||||
|
if interrupted:
|
||||||
|
d = env.v.DEPTH
|
||||||
|
env.v.DEPTH = env.v.DEPTH[:-2]
|
||||||
|
logs.meta('resumed', t)
|
||||||
|
env.v.DEPTH = d
|
||||||
|
interrupted = 0
|
||||||
logs.write(line.rstrip())
|
logs.write(line.rstrip())
|
||||||
|
lines_written += 1
|
||||||
if loglock:
|
if loglock:
|
||||||
loglock.unlock()
|
loglock.unlock()
|
||||||
if status:
|
if status:
|
||||||
|
|
@ -217,6 +234,7 @@ def catlog(t):
|
||||||
assert depth[-1] == t
|
assert depth[-1] == t
|
||||||
depth.pop(-1)
|
depth.pop(-1)
|
||||||
_fix_depth()
|
_fix_depth()
|
||||||
|
return lines_written
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ class PrettyLog(object):
|
||||||
elif env.v.VERBOSE or env.v.XTRACE or env.v.DEBUG:
|
elif env.v.VERBOSE or env.v.XTRACE or env.v.DEBUG:
|
||||||
self._pretty(pid, GREEN, '%s (done)' % name)
|
self._pretty(pid, GREEN, '%s (done)' % name)
|
||||||
self.file.write('\n')
|
self.file.write('\n')
|
||||||
|
elif kind == 'resumed':
|
||||||
|
self._pretty(pid, GREEN, '%s (resumed)' % text)
|
||||||
elif kind == 'locked':
|
elif kind == 'locked':
|
||||||
if env.v.DEBUG_LOCKS:
|
if env.v.DEBUG_LOCKS:
|
||||||
self._pretty(pid, GREEN, '%s (locked...)' % text)
|
self._pretty(pid, GREEN, '%s (locked...)' % text)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue