-def do_bloom(path, outfilename):
- if not outfilename:
- assert(path)
- outfilename = os.path.join(path, 'bup.bloom')
+def check_bloom(path, bloomfilename, idx):
+ if not os.path.exists(bloomfilename):
+ log("bloom: %s not found to check\n" % bloomfilename)
+ return
+ b = git.ShaBloom(bloomfilename)
+ if not b.valid():
+ log("bloom: %s could not be opened to check\n" % bloomfilename)
+ return
+ base = os.path.basename(idx)
+ if base not in b.idxnames:
+ log("bloom: filter does not contain %s, nothing to check\n" % idx)
+ return
+ if base == idx:
+ idx = os.path.join(path, idx)
+ log("bloom: checking %s" % idx)
+ for objsha in git.open_idx(idx):
+ if not b.exists(objsha):
+ add_error("bloom: ERROR: %s missing from bloom"
+ % str(objsha).encode('hex'))
+