X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fsave-cmd.py;h=91d01ca84912dfa2f0e5ca5a1069f816fc06ede6;hb=c40b3dd5fd74e72024fbaad3daf5a958aefa1c54;hp=4fa6dcae1981532311953c0577386ab5e0a9901a;hpb=7e1f05fe8b8d580d61c6a233ec1440adc248c97c;p=bup.git diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 4fa6dca..91d01ca 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import from errno import EACCES from io import BytesIO import os, sys, stat, time, math @@ -12,9 +13,10 @@ import os, sys, stat, time, math from bup import hashsplit, git, options, index, client, metadata, hlinkdb from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK from bup.helpers import (add_error, grafted_path_components, handle_ctrl_c, - istty2, log, parse_date_or_fatal, parse_num, + hostname, istty2, log, parse_date_or_fatal, parse_num, path_components, progress, qprogress, resolve_parent, - saved_errors, stripped_path_components) + saved_errors, stripped_path_components, + userfullname, username, valid_save_name) optspec = """ @@ -80,7 +82,7 @@ is_reverse = os.environ.get('BUP_SERVER_REVERSE') if is_reverse and opt.remote: o.fatal("don't use -r in reverse mode; it's automatic") -if opt.name and opt.name.startswith('.'): +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.remote or is_reverse: @@ -454,7 +456,9 @@ if opt.tree: print tree.encode('hex') if opt.commit or opt.name: msg = 'bup save\n\nGenerated by command:\n%r\n' % sys.argv - commit = w.new_commit(oldref, tree, date, msg) + userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) + commit = w.new_commit(tree, oldref, userline, date, None, + userline, date, None, msg) if opt.commit: print commit.encode('hex')