From: Avery Pennarun Date: Wed, 8 Sep 2010 08:23:53 +0000 (-0700) Subject: cmd/save: always print a progress() message after a log() message. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0a6105bc937fb2846cebe8d7a9dc9d358237163e;p=packages%2Fb%2Fbup.git cmd/save: always print a progress() message after a log() message. An earlier commit (634df2f8b26a1439f22dc9f6a23d55a006bf0429) made 'bup save' update the progress line much less frequently. Unfortunately, if you used -v or -vv, this would mean that there was *no* progress bar for a short time after every log() message (directory or filename). That made the progress bar flicker annoyingly. To fix it, make sure we reset the progress bar timer after every filename we print with log(). It's subtle, but it makes a very visible difference. Signed-off-by: Avery Pennarun --- diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 23bcabc..b1376b9 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -115,6 +115,12 @@ def progress_report(n): lastprint = now +def vlog(s): + global lastprint + lastprint = 0 + log(s) + + r = index.Reader(git.repo('bupindex')) def already_saved(ent): @@ -162,10 +168,10 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during): else: status = ' ' if opt.verbose >= 2: - log('%s %-70s\n' % (status, ent.name)) + vlog('%s %-70s\n' % (status, ent.name)) elif not stat.S_ISDIR(ent.mode) and lastdir != dir: if not lastdir.startswith(dir): - log('%s %-70s\n' % (status, os.path.join(dir, ''))) + vlog('%s %-70s\n' % (status, os.path.join(dir, ''))) lastdir = dir if opt.progress: