]> arthur.barton.de Git - bup.git/commitdiff
cmd/save: always print a progress() message after a log() message.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 8 Sep 2010 08:23:53 +0000 (01:23 -0700)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 8 Sep 2010 08:26:31 +0000 (01:26 -0700)
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 <apenwarr@gmail.com>
cmd/save-cmd.py

index 23bcabce9892f2bc95b545bf00402b85d72b00d7..b1376b9a4f59981037899f7a267f07159fc02d46 100755 (executable)
@@ -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: