]> arthur.barton.de Git - bup.git/commitdiff
Bail out immediately instead of redownloading .idx
authorBrandon Low <lostlogic@lostlogicx.com>
Thu, 17 Feb 2011 01:46:01 +0000 (17:46 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 17 Feb 2011 02:14:19 +0000 (18:14 -0800)
This should make diagnosing / fixing corrupted bloom filters and midx
files easier, and is generally more sane behavior.

Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
lib/bup/client.py

index 8d2fbb99fef23c4755ac8c32ed5542993f1400fa..e773c66049550af9bfd4791788ab1bf2b709e428 100644 (file)
@@ -182,10 +182,13 @@ class Client:
         #debug1('requesting %r\n' % name)
         self.check_busy()
         mkdirp(self.cachedir)
+        fn = os.path.join(self.cachedir, name)
+        if os.path.exists(fn):
+            msg = "won't request existing .idx, try `bup bloom --check %s`" % fn
+            raise ClientError(msg)
         self.conn.write('send-index %s\n' % name)
         n = struct.unpack('!I', self.conn.read(4))[0]
         assert(n)
-        fn = os.path.join(self.cachedir, name)
         f = open(fn + '.tmp', 'w')
         count = 0
         progress('Receiving index from server: %d/%d\r' % (count, n))