From: Avery Pennarun Date: Sat, 6 Feb 2010 20:55:13 +0000 (-0500) Subject: cmd-margin: work correctly in python 2.4 when a midx is present. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=acb68c73b9d13527f3662e363a80165fe7eef3d0;p=packages%2Fb%2Fbup.git cmd-margin: work correctly in python 2.4 when a midx is present. And add a test so this doesn't happen again. --- diff --git a/cmd-midx.py b/cmd-midx.py index d8b08ec..b421e0e 100755 --- a/cmd-midx.py +++ b/cmd-midx.py @@ -30,7 +30,8 @@ def do_midx(outdir, outfilename, infilenames): total += len(ix) log('Merging %d indexes (%d objects).\n' % (len(infilenames), total)) - if total < 1024 and len(infilenames) < 3: + if (not opt.force and (total < 1024 and len(infilenames) < 3)) \ + or (opt.force and not total): log('%s: not enough objects for a .midx to be useful.\n' % outdir) return diff --git a/git.py b/git.py index 71ca32d..d85d7e2 100644 --- a/git.py +++ b/git.py @@ -197,7 +197,7 @@ class PackMidx: yield buffer(self.shalist, i*20, 20) def __len__(self): - return self._fanget(self.entries-1) + return int(self._fanget(self.entries-1)) _mpi_count = 0 diff --git a/t/test.sh b/t/test.sh index 893f63a..24b77c2 100755 --- a/t/test.sh +++ b/t/test.sh @@ -78,7 +78,9 @@ WVPASSEQ "$(cd $D && bup index -s .)" "$(cd $D && bup index -s .)" WVSTART "split" WVPASS bup split --bench -b tags1.tmp WVPASS bup split -vvvv -b t/testfile2 >tags2.tmp -WVPASS bup midx -a +WVPASS bup margin +WVPASS bup midx -f +WVPASS bup margin WVPASS bup split -t t/testfile2 >tags2t.tmp WVPASS bup split -t t/testfile2 --fanout 3 >tags2tf.tmp WVPASS bup split -r "$BUP_DIR" -c t/testfile2 >tags2c.tmp