]> arthur.barton.de Git - bup.git/commitdiff
When receiving an index from the server, print a handy progress message.
authorAvery Pennarun <apenwarr@gmail.com>
Fri, 5 Feb 2010 00:39:38 +0000 (19:39 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 5 Feb 2010 00:39:38 +0000 (19:39 -0500)
This is less boring than seeing a blank screen while we download 5+ megs of
stuff.

client.py

index 9233520033c93859a1ac2864080229cc3bb57087..f99708b75662208f1cbe1a20ae8068d589c958f5 100644 (file)
--- a/client.py
+++ b/client.py
@@ -124,11 +124,15 @@ class Client:
         self.conn.write('send-index %s\n' % name)
         n = struct.unpack('!I', self.conn.read(4))[0]
         assert(n)
-        log('   expect %d bytes\n' % n)
         fn = os.path.join(self.cachedir, name)
         f = open(fn + '.tmp', 'w')
+        count = 0
+        progress('Receiving index: %d/%d\r' % (count, n))
         for b in chunkyreader(self.conn, n):
             f.write(b)
+            count += len(b)
+            progress('Receiving index: %d/%d\r' % (count, n))
+        progress('Receiving index: %d/%d, done.\n' % (count, n))
         self.check_ok()
         f.close()
         os.rename(fn + '.tmp', fn)