3 import hashsplit, git, options
7 bup split [-tcb] [-n name] [--bench] [filenames...]
9 b,blobs output a series of blob ids
10 t,tree output a tree id
11 c,commit output a commit id
12 n,name= name of backup set to update (if any)
13 v,verbose increase log output (can be used more than once)
14 bench print benchmark timings to stderr
16 o = options.Options('bup split', optspec)
17 (opt, flags, extra) = o.parse(sys.argv[1:])
19 if not (opt.blobs or opt.tree or opt.commit or opt.name):
20 log("bup split: use one or more of -b, -t, -c, -n\n")
23 hashsplit.split_verbosely = opt.verbose
25 git.verbose = opt.verbose - 1
28 start_time = time.time()
30 (shalist,tree) = hashsplit.split_to_tree(hashsplit.autofiles(extra))
35 for (mode,name,bin) in shalist:
36 print bin.encode('hex')
38 print tree.encode('hex')
39 if opt.commit or opt.name:
40 msg = 'bup split\n\nGenerated by command:\n%r' % sys.argv
41 ref = opt.name and ('refs/heads/%s' % opt.name) or None
42 commit = git.gen_commit_easy(ref, tree, msg)
44 print commit.encode('hex')
46 secs = time.time() - start_time
47 size = hashsplit.total_split
49 log('\nbup: %.2fkbytes in %.2f secs = %.2f kbytes/sec\n'
50 % (size/1024., secs, size/1024./secs))