consider-using-in,
return-in-init,
trailing-whitespace,
+ undefined-variable,
unidiomatic-typecheck,
unused-import,
unused-wildcard-import,
)
from bup.git import get_cat_data, parse_commit, walk_object
from bup.helpers import add_error, debug1, log, saved_errors
-from bup.helpers import hostname, tty_width
+from bup.helpers import hostname, tty_width, parse_num
from bup.io import path_msg
from bup.pwdgrp import userfullname, username
from bup.repo import LocalRepo, RemoteRepo
opt.compress = int(opt.compress)
elif arg == b'--bwlimit':
(opt.bwlimit,), remaining = require_n_args_or_die(1, remaining)
- opt.bwlimit = long(opt.bwlimit)
+ opt.bwlimit = int(opt.bwlimit)
elif arg.startswith(b'-') and len(arg) > 2 and arg[1] != b'-':
# Try to interpret this as -xyz, i.e. "-xyz -> -x -y -z".
# We do this last so that --foo -bar is valid if --foo
return b'/' + result
-def validate_vfs_path(p):
+def validate_vfs_path(p, spec):
if p.startswith(b'/.') \
and not p.startswith(b'/.tag/'):
misuse('unsupported destination path %s in %s'
- % (path_msg(dest.path), spec_msg(spec)))
+ % (path_msg(p), spec_msg(spec)))
return p
misuse('no destination provided for %s', spec_args)
dest = find_vfs_item(spec.dest, dest_repo)
if not dest:
- cp = validate_vfs_path(cleanup_vfs_path(spec.dest))
+ cp = validate_vfs_path(cleanup_vfs_path(spec.dest), spec)
dest = default_loc._replace(path=cp)
else:
if not dest.type == 'branch' and not dest.path.startswith(b'/.tag/'):
misuse('%s impossible; can only overwrite branch or tag'
% spec_args)
else:
- cp = validate_vfs_path(cleanup_vfs_path(spec.dest))
+ cp = validate_vfs_path(cleanup_vfs_path(spec.dest), spec)
dest = default_loc._replace(path=cp)
if not dest.path.startswith(b'/.tag/') \
and not src.type in ('branch', 'save', 'commit'):
from bup import git, bloom, midx, options, _helpers
from bup.compat import range
from bup.io import byte_stream
+from bup.helpers import log
_linux_warned = 0
# This is just for testing (if you enable this, don't clear inp above)
- if 0:
- p = midx.PackMidx(outfilename)
- assert(len(p.idxnames) == len(infilenames))
- log(repr(p.idxnames) + '\n')
- assert(len(p) == total)
- for pe, e in p, git.idxmerge(inp, final_progress=False):
- pin = next(pi)
- assert(i == pin)
- assert(p.exists(i))
+ # if 0:
+ # p = midx.PackMidx(outfilename)
+ # assert(len(p.idxnames) == len(infilenames))
+ # log(repr(p.idxnames) + '\n')
+ # assert(len(p) == total)
+ # for pe, e in p, git.idxmerge(inp, final_progress=False):
+ # pin = next(pi)
+ # assert(i == pin)
+ # assert(p.exists(i))
return total, outfilename
if rv:
msg = 'git rev-list returned error %d' % rv
conn.error(msg)
- raise GitError(msg)
+ raise git.GitError(msg)
conn.ok()
def resolve(conn, args):
from bup.io import byte_stream
-def parse_timestamp_arg(field, value):
+def parse_timestamp_arg(o, field, value):
res = str(value) # Undo autoconversion.
try:
res = parse_timestamp(res)
o = options.Options(optspec)
(opt, flags, remainder) = o.parse_bytes(argv[1:])
- atime_resolution = parse_timestamp_arg('atime', opt.atime_resolution)
- mtime_resolution = parse_timestamp_arg('mtime', opt.mtime_resolution)
- ctime_resolution = parse_timestamp_arg('ctime', opt.ctime_resolution)
+ atime_resolution = parse_timestamp_arg(o, 'atime', opt.atime_resolution)
+ mtime_resolution = parse_timestamp_arg(o, 'mtime', opt.mtime_resolution)
+ ctime_resolution = parse_timestamp_arg(o, 'ctime', opt.ctime_resolution)
treat_include_fields_as_definitive = True
for flag, value in flags:
from os import environb as environ
from os import fsdecode, fsencode
from shlex import quote
+ # pylint: disable=undefined-variable
+ # (for python2 looking here)
ModuleNotFoundError = ModuleNotFoundError
input = input
range = range
# pylint: disable=unused-import
from bup.py2raise import reraise
+ # on py3 this causes errors, obviously
+ # pylint: disable=undefined-variable
input = raw_input
+ # pylint: disable=undefined-variable
range = xrange
+ # pylint: disable=undefined-variable
str_type = basestring
+ # pylint: disable=undefined-variable
int_types = (int, long)
hexstr = hexlify