From: Brandon Low Date: Thu, 17 Feb 2011 01:46:01 +0000 (-0800) Subject: Bail out immediately instead of redownloading .idx X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0b6c61634e75a402cd9b82cee306e33bcb5d6fea;p=packages%2Fb%2Fbup.git Bail out immediately instead of redownloading .idx This should make diagnosing / fixing corrupted bloom filters and midx files easier, and is generally more sane behavior. Signed-off-by: Brandon Low --- diff --git a/lib/bup/client.py b/lib/bup/client.py index 8d2fbb9..e773c66 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -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))