X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=cmd%2Fsave-cmd.py;h=bf2877ba240a0ff90c79745c5104217c4c1849ea;hb=aeafe13a9330e7deca3dc6b9c0496937d904663a;hp=56351efd66cd84100b41bd969124a9ff6edaaacb;hpb=d852f225cb36755f26f9fa95a790356d1417dc0f;p=bup.git diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 56351ef..bf2877b 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, print_function from errno import EACCES from io import BytesIO import os, sys, stat, time, math @@ -15,7 +16,7 @@ from bup.helpers import (add_error, grafted_path_components, handle_ctrl_c, hostname, istty2, log, parse_date_or_fatal, parse_num, path_components, progress, qprogress, resolve_parent, saved_errors, stripped_path_components, - userfullname, username) + userfullname, username, valid_save_name) optspec = """ @@ -81,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: @@ -452,14 +453,14 @@ tree = _pop(force_tree = None, dir_metadata = metadata.Metadata() if root_collision else None) if opt.tree: - print tree.encode('hex') + print(tree.encode('hex')) if opt.commit or opt.name: msg = 'bup save\n\nGenerated by command:\n%r\n' % sys.argv 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') + print(commit.encode('hex')) msr.close() w.close() # must close before we can update the ref