]> arthur.barton.de Git - bup.git/commitdiff
cmd-margin: work correctly in python 2.4 when a midx is present.
authorAvery Pennarun <apenwarr@gmail.com>
Sat, 6 Feb 2010 20:55:13 +0000 (15:55 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sat, 6 Feb 2010 20:55:13 +0000 (15:55 -0500)
And add a test so this doesn't happen again.

cmd-midx.py
git.py
t/test.sh

index d8b08ec829de37b28dfd174315ed6d5f9aa2ea37..b421e0ec419f88205759914eaa9beff85315a72e 100755 (executable)
@@ -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 71ca32d2de75e4091e59d1f47cb4c4306655e355..d85d7e2c336a56f2afd40b736806372900d18617 100644 (file)
--- 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
index 893f63aaf43ed413fcf53663c6cbe9dcc1958f94..24b77c29cb235b4a466bc4e10664108546adc344 100755 (executable)
--- 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 <t/testfile1 >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