]> arthur.barton.de Git - bup.git/commitdiff
bup midx: fix --output when used with --auto or --force
authorBen Kelly <bk@ancilla.ca>
Thu, 4 Jun 2015 16:47:27 +0000 (12:47 -0400)
committerRob Browning <rlb@defaultvalue.org>
Sun, 7 Jun 2015 16:13:50 +0000 (11:13 -0500)
This fixes an issue where --output is properly respected only when
neither of these options are used.

Signed-off-by: Ben Kelly <btk@google.com>
[rlb@defaultvalue.org: rebased onto e25363fc58cd906337ecee28d715af8f355fd921]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/midx-cmd.py

index 5a7a6e34a10b555afd3cb1f2d1c671d3b8b682a9..68767513c2c4f571b02456efd8527ce428418b37 100755 (executable)
@@ -157,7 +157,7 @@ def do_midx(outdir, outfilename, infilenames, prefixstr):
         print rv[1]
 
 
-def do_midx_dir(path):
+def do_midx_dir(path, outfilename):
     already = {}
     sizes = {}
     if opt.force and not opt.auto:
@@ -206,7 +206,7 @@ def do_midx_dir(path):
         all.sort()
         part1 = [name for sz,name in all[:len(all)-DESIRED_LWM+1]]
         part2 = all[len(all)-DESIRED_LWM+1:]
-        all = list(do_midx_group(path, part1)) + part2
+        all = list(do_midx_group(path, outfilename, part1)) + part2
         if len(all) > DESIRED_HWM:
             debug1('\nStill too many indexes (%d > %d).  Merging again.\n'
                    % (len(all), DESIRED_HWM))
@@ -217,13 +217,13 @@ def do_midx_dir(path):
                 print name
 
 
-def do_midx_group(outdir, infiles):
+def do_midx_group(outdir, outfilename, infiles):
     groups = list(_group(infiles, opt.max_files))
     gprefix = ''
     for n,sublist in enumerate(groups):
         if len(groups) != 1:
             gprefix = 'Group %d: ' % (n+1)
-        rv = _do_midx(outdir, None, sublist, gprefix)
+        rv = _do_midx(outdir, outfilename, sublist, gprefix)
         if rv:
             yield rv
 
@@ -265,7 +265,7 @@ else:
         paths = opt.dir and [opt.dir] or git.all_packdirs()
         for path in paths:
             debug1('midx: scanning %s\n' % path)
-            do_midx_dir(path)
+            do_midx_dir(path, opt.output)
     else:
         o.fatal("you must use -f or -a or provide input filenames")