]> arthur.barton.de Git - bup.git/blobdiff - cmd/midx-cmd.py
cmd/midx: fix SHA_PER_PAGE calculation.
[bup.git] / cmd / midx-cmd.py
index 871111196c9ecabba994106da2e76a705c8749e9..bbfd2acc0d2a562b26c755f64636f8debdd0467d 100755 (executable)
@@ -1,10 +1,10 @@
 #!/usr/bin/env python
-import sys, math, struct, glob, sha
+import sys, math, struct, glob
 from bup import options, git
 from bup.helpers import *
 
 PAGE_SIZE=4096
-SHA_PER_PAGE=PAGE_SIZE/200.
+SHA_PER_PAGE=PAGE_SIZE/20.
 
 
 def merge(idxlist, bits, table):
@@ -19,13 +19,13 @@ def merge(idxlist, bits, table):
 def do_midx(outdir, outfilename, infilenames):
     if not outfilename:
         assert(outdir)
-        sum = sha.sha('\0'.join(infilenames)).hexdigest()
+        sum = Sha1('\0'.join(infilenames)).hexdigest()
         outfilename = '%s/midx-%s.midx' % (outdir, sum)
     
     inp = []
     total = 0
     for name in infilenames:
-        ix = git.PackIndex(name)
+        ix = git.PackIdx(name)
         inp.append(ix)
         total += len(ix)
 
@@ -100,7 +100,7 @@ elif opt.auto or opt.force:
         if opt.force:
             do_midx(path, opt.output, glob.glob('%s/*.idx' % path))
         elif opt.auto:
-            m = git.MultiPackIndex(path)
+            m = git.PackIdxList(path)
             needed = {}
             for pack in m.packs:  # only .idx files without a .midx are open
                 if pack.name.endswith('.idx'):