]> arthur.barton.de Git - bup.git/blobdiff - cmd/bloom-cmd.py
do_bloom(): remove unused "count" variable
[bup.git] / cmd / bloom-cmd.py
index 51e594bdf11784c24c63ac60714b7f9b85d0017b..d74cce2704567597fc1fce934032dfd025041e55 100755 (executable)
@@ -109,18 +109,20 @@ def do_bloom(path, outfilename):
     tfname = None
     if b is None:
         tfname = os.path.join(path, 'bup.tmp.bloom')
-        tf = open(tfname, 'w+')
-        b = bloom.create(tfname, f=tf, expected=add_count, k=opt.k)
-    count = 0
+        b = bloom.create(tfname, expected=add_count, k=opt.k)
+
     icount = 0
     for name in add:
         ix = git.open_idx(name)
         qprogress('bloom: writing %.2f%% (%d/%d objects)\r' 
                   % (icount*100.0/add_count, icount, add_count))
         b.add_idx(ix)
-        count += 1
         icount += len(ix)
 
+    # Currently, there's an open file object for tfname inside b.
+    # Make sure it's closed before rename.
+    b.close()
+
     if tfname:
         os.rename(tfname, outfilename)