]> arthur.barton.de Git - bup.git/commitdiff
Fix updating of bloom with additional files
authorBrandon Low <lostlogic@lostlogicx.com>
Mon, 7 Feb 2011 16:19:04 +0000 (08:19 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 8 Feb 2011 01:27:17 +0000 (17:27 -0800)
Make bloom add additional .idx files when it's run on a repo with an
existing bloom filter file rather than just regenerating all the time.

Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
cmd/bloom-cmd.py

index eb962a7c6fe843590b40d5d11979031ec03d2888..92cdf8b6652430f925577ceadecdac9e900af499 100755 (executable)
@@ -20,6 +20,7 @@ def do_bloom(path, outfilename):
     if os.path.exists(outfilename):
         b = git.ShaBloom(outfilename, readwrite=True)
         if not b.valid():
+            debug1("bloom: Existing invalid bloom found, regenerating.\n")
             b = None
 
     add = []
@@ -60,7 +61,7 @@ def do_bloom(path, outfilename):
     msg = b is None and 'creating from' or 'adding'
     log('bloom: %s %d files (%d objects).\n' % (msg, len(add), add_count))
 
-    tempname = None
+    tfname = None
     if b is None:
         tfname = os.path.join(path, 'bup.tmp.bloom')
         tf = open(tfname, 'w+')
@@ -73,8 +74,8 @@ def do_bloom(path, outfilename):
         count += 1
     log('Writing bloom: %d/%d, done.\n' % (count, len(add)))
 
-    if tempname:
-        os.rename(tempname, outfilename)
+    if tfname:
+        os.rename(tfname, outfilename)
 
 
 handle_ctrl_c()