"""
# end of bup preamble
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import os, sys, time
from bup import hashsplit, git, options, client
bup split [-t] [-c] [-n name] OPTIONS [--git-ids | filenames...]
bup split -b OPTIONS [--git-ids | filenames...]
bup split --copy OPTIONS [--git-ids | filenames...]
-bup split --noop [<-b|-t>] OPTIONS [--git-ids | filenames...]
+bup split --noop [-b|-t] OPTIONS [--git-ids | filenames...]
--
Modes:
b,blobs output a series of blob ids. Implies --fanout=0.
bwlimit= maximum bytes/sec to transmit to server
#,compress= set compression level to # (0-9, 9 is highest) [1]
"""
+handle_ctrl_c()
+
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
-handle_ctrl_c()
-git.check_repo_or_die()
if not (opt.blobs or opt.tree or opt.commit or opt.name or
opt.noop or opt.copy):
o.fatal("use one or more of -b, -t, -c, -n, --noop, --copy")
if opt.name and not valid_save_name(opt.name):
o.fatal("'%s' is not a valid branch name." % opt.name)
refname = opt.name and 'refs/heads/%s' % opt.name or None
+
if opt.noop or opt.copy:
cli = pack_writer = oldref = None
elif opt.remote or is_reverse:
+ git.check_repo_or_die()
cli = client.Client(opt.remote)
oldref = refname and cli.read_ref(refname) or None
pack_writer = cli.new_packwriter(compression_level=opt.compress,
max_pack_size=max_pack_size,
max_pack_objects=max_pack_objects)
else:
+ git.check_repo_or_die()
cli = None
oldref = refname and git.read_ref(refname) or None
pack_writer = git.PackWriter(compression_level=opt.compress,
keep_boundaries=opt.keep_boundaries,
progress=prog)
for (sha, size, level) in shalist:
- print sha.encode('hex')
+ print(sha.encode('hex'))
reprogress()
elif opt.tree or opt.commit or opt.name:
if opt.name: # insert dummy_name which may be used as a restore target
if opt.verbose:
log('\n')
if opt.tree:
- print tree.encode('hex')
+ print(tree.encode('hex'))
if opt.commit or opt.name:
msg = 'bup split\n\nGenerated by command:\n%r\n' % sys.argv
ref = opt.name and ('refs/heads/%s' % opt.name) or None
commit = pack_writer.new_commit(tree, oldref, userline, date, None,
userline, date, None, msg)
if opt.commit:
- print commit.encode('hex')
+ print(commit.encode('hex'))
if pack_writer:
pack_writer.close() # must close before we can update the ref