]> arthur.barton.de Git - bup.git/commitdiff
cmd/bloom: by default generate bloom filters in *all* index-cache dirs.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 16 Feb 2011 23:58:14 +0000 (15:58 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 17 Feb 2011 00:00:39 +0000 (16:00 -0800)
This matches with 'bup midx -a' and 'bup midx -f' behaviour.  People might
have been thinking they were regenerating bloom filters without actually
doing them all.

Moved some shared code to do this from cmd/midx to git.py.

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

index 2fa7a68453cb5f304784356b4b193fe53499fb96..59f84eb9b98dc0efef7a5d1bd3b8c5541a82dd37 100755 (executable)
@@ -6,9 +6,9 @@ from bup.helpers import *
 optspec = """
 bup bloom [options...]
 --
-o,output=  output bloom filename (default: auto-generated)
-d,dir=     input directory to look for idx files (default: auto-generated)
-k,hashes=  number of hash functions to use (4 or 5) (default: auto-generated)
+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)
 """
 
 def do_bloom(path, outfilename):
@@ -96,4 +96,6 @@ if opt.k and opt.k not in (4,5):
 
 git.check_repo_or_die()
 
-do_bloom(opt.dir or git.repo('objects/pack'), opt.output)
+paths = opt.dir and [opt.dir] or git.all_packdirs()
+for path in paths:
+    do_bloom(path, opt.output)
index 7718549ac95465d9821530eda82e0f73c4651ae8..b4b37cfb0e49f3969f444908c8f4423167da7ee3 100755 (executable)
@@ -198,14 +198,9 @@ assert(opt.max_files >= 5)
 if extra:
     do_midx(git.repo('objects/pack'), opt.output, extra, '')
 elif opt.auto or opt.force:
-    if opt.dir:
-        paths = [opt.dir]
-    else:
-        paths = [git.repo('objects/pack')]
-        paths += glob.glob(git.repo('index-cache/*/.'))
+    paths = opt.dir and [opt.dir] or git.all_packdirs()
     for path in paths:
         debug1('midx: scanning %s\n' % path)
         do_midx_dir(path)
-        debug1('\n')
 else:
     o.fatal("you must use -f or -a or provide input filenames")
index 59e85a753aaa5359925fda6391f5a35e0f1eec0e..c503e4955988af17122e1f8f5468ad4ddcbee73e 100644 (file)
@@ -125,6 +125,12 @@ def repo(sub = ''):
     return os.path.join(repodir, sub)
 
 
+def all_packdirs():
+    paths = [repo('objects/pack')]
+    paths += glob.glob(repo('index-cache/*/.'))
+    return paths
+
+
 def auto_midx(objdir):
     args = [path.exe(), 'midx', '--auto', '--dir', objdir]
     try: