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
27 start_time = time.time()
29 (shalist,tree) = hashsplit.split_to_tree(hashsplit.autofiles(extra))
34 for (mode,name,bin) in shalist:
35 print bin.encode('hex')
37 print tree.encode('hex')
38 if opt.commit or opt.name:
39 msg = 'bup split\n\nGenerated by command:\n%r' % sys.argv
40 ref = opt.name and ('refs/heads/%s' % opt.name) or None
41 commit = git.gen_commit_easy(ref, tree, msg)
43 print commit.encode('hex')
45 secs = time.time() - start_time
46 size = hashsplit.total_split
48 log('\nbup: %.2fkbytes in %.2f secs = %.2f kbytes/sec\n'
49 % (size/1024., secs, size/1024./secs))