This was broken earlier and apparently didn't have a test; now it does.
runtests-cmdline: all
@echo "Testing \"$@\" in Makefile:"
- ./bup split -b <testfile1 >tags1
+ ./bup split --bench -b <testfile1 >tags1
./bup split -b testfile2 >tags2
diff -u tags1 tags2 || true
wc -c testfile1 testfile2
print commit
secs = time.time() - start_time
+size = hashsplit.total_split
if opt.bench:
log('\nbup: %.2fkbytes in %.2f secs = %.2f kbytes/sec\n'
- % (ofs/1024., secs, ofs/1024./secs))
+ % (size/1024., secs, size/1024./secs))
lv = nv
-def split_to_tree(files):
- shalist = []
+total_split = 0
+def split_to_shalist(files):
+ global total_split
ofs = 0
last_ofs = 0
for (ofs, size, sha) in hashsplit_iter(files):
if cn > last_ofs or ofs == last_ofs: break
bm /= 2
last_ofs = cn
- shalist.append(('100644', 'bup.chunk.%016x' % cn, sha))
+ total_split += size
+ yield ('100644', 'bup.chunk.%016x' % cn, sha)
+
+
+def split_to_tree(files):
+ shalist = list(split_to_shalist(files))
tree = git.gen_tree(shalist)
return (shalist, tree)