+ return tree
+
+
+def commit_tree(tree, parent, date, argv, writer):
+ if compat.py_maj > 2:
+ # Strip b prefix from python 3 bytes reprs to preserve previous format
+ msgcmd = b'[%s]' % b', '.join([repr(argv_bytes(x))[1:].encode('ascii')
+ for x in argv])
+ else:
+ msgcmd = repr(argv)
+ msg = b'bup save\n\nGenerated by command:\n%s\n' % msgcmd
+ userline = (b'%s <%s@%s>' % (userfullname(), username(), hostname()))
+ return writer.new_commit(tree, parent, userline, date, None,
+ userline, date, None, msg)
+
+
+def main(argv):
+ handle_ctrl_c()
+ opt = opts_from_cmdline(argv)
+ client.bwlimit = opt.bwlimit
+ git.check_repo_or_die()
+
+ remote_dest = opt.remote or opt.is_reverse
+ if not remote_dest:
+ repo = git
+ cli = nullcontext()
+ else:
+ try:
+ cli = repo = client.Client(opt.remote)
+ except client.ClientError as e:
+ log('error: %s' % e)
+ sys.exit(1)
+
+ # cli creation must be last nontrivial command in each if clause above
+ with cli:
+ if not remote_dest:
+ w = git.PackWriter(compression_level=opt.compress)