]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
cmd/bloom: add a --force option to forget regenerating the bloom.
authorAvery Pennarun <apenwarr@gmail.com>
Thu, 17 Feb 2011 01:32:51 +0000 (17:32 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 17 Feb 2011 02:21:46 +0000 (18:21 -0800)
This corresponds to midx's --force option.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Documentation/bup-bloom.md
cmd/bloom-cmd.py
cmd/midx-cmd.py

index 01373bff13288a3102e3784825f52aa2a2cd3f2f..b827b68051101cbafbfd01b566595080e90626b0 100644 (file)
@@ -12,15 +12,19 @@ bup daemon [-d dir] [-o outfile] [-k hashes]
 
 # DESCRIPTION
 
-`bup bloom` builds a bloom filter file for a bup repo, if
-one already exists, it checks it and updates or regenerates
-it if needed.
+`bup bloom` builds a bloom filter file for a bup
+repository. If one already exists, it checks the filter and
+updates or regenerates it as needed.
 
 # OPTIONS
 
+-f, --force
+:   don't update the existing bloom file; generate a new
+    one from scratch.
+
 -d, --dir=*directory*
 :   the directory, containing .idx files, to process.
-    defaults to $BUP_DIR/objects/pack
+    Defaults to $BUP_DIR/objects/pack
 
 -o, --outfile=*outfile*
 :   the file to write the bloom filter to.  defaults to
@@ -28,8 +32,8 @@ it if needed.
 
 -k, --hashes=*hashes*
 :   number of hash functions to use only 4 and 5 are valid.
-    defaults to 5 for repositories < 2TiB and 4 otherwise.
-    see comments in git.py for more on this value.
+    defaults to 5 for repositories < 2 TiB, or 4 otherwise.
+    See comments in git.py for more on this value.
 
 # BUP
 
index ed148fce97f7bd8161dd544936129dfd5c407d3d..e4bff4d3e3d1726b3c13139ed669d434d3730f51 100755 (executable)
@@ -6,6 +6,7 @@ from bup.helpers import *
 optspec = """
 bup bloom [options...]
 --
+f,force    ignore existing bloom file and regenerate it from scratch
 o,output=  output bloom filename (default: auto)
 d,dir=     input directory to look for idx files (default: auto)
 k,hashes=  number of hash functions to use (4 or 5) (default: auto)
@@ -19,7 +20,7 @@ def do_bloom(path, outfilename):
         outfilename = os.path.join(path, 'bup.bloom')
 
     b = None
-    if os.path.exists(outfilename):
+    if os.path.exists(outfilename) and not opt.force:
         b = git.ShaBloom(outfilename)
         if not b.valid():
             debug1("bloom: Existing invalid bloom found, regenerating.\n")
index 5885d0574131e97c7be0cebdaed1645c174447ce..b5fb77e3977b48b0945888a5367b1655ba2b6dd8 100755 (executable)
@@ -11,8 +11,8 @@ optspec = """
 bup midx [options...] <idxnames...>
 --
 o,output=  output midx filename (default: auto-generated)
-a,auto     automatically create .midx from any unindexed .idx files
-f,force    automatically create .midx from *all* .idx files
+a,auto     automatically use all existing .midx/.idx files as input
+f,force    merge produce exactly one .midx containing all objects
 p,print    print names of generated midx files
 max-files= maximum number of idx files to open at once [-1]
 dir=       directory containing idx/midx files