mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-28 04:03:21 -04:00
Location: fix bad naming: rename .orig -> .processed
- .raw is the unprocessed location (as given by user / env). - .processed is the processed location (after placeholder replacement).
This commit is contained in:
parent
ccc41b394e
commit
0eb33389d3
6 changed files with 17 additions and 17 deletions
|
|
@ -581,7 +581,7 @@ class Archiver:
|
||||||
dry_run = args.dry_run
|
dry_run = args.dry_run
|
||||||
t0 = datetime.utcnow()
|
t0 = datetime.utcnow()
|
||||||
t0_monotonic = time.monotonic()
|
t0_monotonic = time.monotonic()
|
||||||
logger.info('Creating archive at "%s"' % args.location.orig)
|
logger.info('Creating archive at "%s"' % args.location.processed)
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
with Cache(repository, key, manifest, do_files=args.cache_files, progress=args.progress,
|
with Cache(repository, key, manifest, do_files=args.cache_files, progress=args.progress,
|
||||||
lock_wait=self.lock_wait, permit_adhoc_cache=args.no_cache_sync,
|
lock_wait=self.lock_wait, permit_adhoc_cache=args.no_cache_sync,
|
||||||
|
|
|
||||||
|
|
@ -1136,11 +1136,11 @@ class Location:
|
||||||
|
|
||||||
def __init__(self, text='', overrides={}):
|
def __init__(self, text='', overrides={}):
|
||||||
if not self.parse(text, overrides):
|
if not self.parse(text, overrides):
|
||||||
raise ValueError('Invalid location format: "%s"' % self.orig)
|
raise ValueError('Invalid location format: "%s"' % self.processed)
|
||||||
|
|
||||||
def parse(self, text, overrides={}):
|
def parse(self, text, overrides={}):
|
||||||
self.raw = text # as given by user, might contain placeholders
|
self.raw = text # as given by user, might contain placeholders
|
||||||
self.orig = text = replace_placeholders(text, overrides) # after placeholder replacement
|
self.processed = text = replace_placeholders(text, overrides) # after placeholder replacement
|
||||||
valid = self._parse(text)
|
valid = self._parse(text)
|
||||||
if valid:
|
if valid:
|
||||||
return True
|
return True
|
||||||
|
|
@ -1154,7 +1154,7 @@ class Location:
|
||||||
valid = self._parse(repo)
|
valid = self._parse(repo)
|
||||||
self.archive = m.group('archive')
|
self.archive = m.group('archive')
|
||||||
self.raw = repo_raw if not self.archive else repo_raw + self.raw
|
self.raw = repo_raw if not self.archive else repo_raw + self.raw
|
||||||
self.orig = repo if not self.archive else '%s::%s' % (repo, self.archive)
|
self.processed = repo if not self.archive else '%s::%s' % (repo, self.archive)
|
||||||
return valid
|
return valid
|
||||||
|
|
||||||
def _parse(self, text):
|
def _parse(self, text):
|
||||||
|
|
@ -1245,7 +1245,7 @@ class Location:
|
||||||
loc = Location(self.raw)
|
loc = Location(self.raw)
|
||||||
loc.archive = None
|
loc.archive = None
|
||||||
loc.raw = loc.raw.split("::")[0]
|
loc.raw = loc.raw.split("::")[0]
|
||||||
loc.orig = loc.orig.split("::")[0]
|
loc.processed = loc.processed.split("::")[0]
|
||||||
return loc
|
return loc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -728,11 +728,11 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+.
|
||||||
args = unpacked.get(b'exception_args')
|
args = unpacked.get(b'exception_args')
|
||||||
|
|
||||||
if error == 'DoesNotExist':
|
if error == 'DoesNotExist':
|
||||||
raise Repository.DoesNotExist(self.location.orig)
|
raise Repository.DoesNotExist(self.location.processed)
|
||||||
elif error == 'AlreadyExists':
|
elif error == 'AlreadyExists':
|
||||||
raise Repository.AlreadyExists(self.location.orig)
|
raise Repository.AlreadyExists(self.location.processed)
|
||||||
elif error == 'CheckNeeded':
|
elif error == 'CheckNeeded':
|
||||||
raise Repository.CheckNeeded(self.location.orig)
|
raise Repository.CheckNeeded(self.location.processed)
|
||||||
elif error == 'IntegrityError':
|
elif error == 'IntegrityError':
|
||||||
if old_server:
|
if old_server:
|
||||||
raise IntegrityError('(not available)')
|
raise IntegrityError('(not available)')
|
||||||
|
|
@ -752,9 +752,9 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+.
|
||||||
raise Repository.ParentPathDoesNotExist(args[0].decode())
|
raise Repository.ParentPathDoesNotExist(args[0].decode())
|
||||||
elif error == 'ObjectNotFound':
|
elif error == 'ObjectNotFound':
|
||||||
if old_server:
|
if old_server:
|
||||||
raise Repository.ObjectNotFound('(not available)', self.location.orig)
|
raise Repository.ObjectNotFound('(not available)', self.location.processed)
|
||||||
else:
|
else:
|
||||||
raise Repository.ObjectNotFound(args[0].decode(), self.location.orig)
|
raise Repository.ObjectNotFound(args[0].decode(), self.location.processed)
|
||||||
elif error == 'InvalidRPCMethod':
|
elif error == 'InvalidRPCMethod':
|
||||||
if old_server:
|
if old_server:
|
||||||
raise InvalidRPCMethod('(not available)')
|
raise InvalidRPCMethod('(not available)')
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ class TestLocationWithoutEnv:
|
||||||
loc_without_archive = loc.omit_archive()
|
loc_without_archive = loc.omit_archive()
|
||||||
assert loc_without_archive.archive is None
|
assert loc_without_archive.archive is None
|
||||||
assert loc_without_archive.raw == "ssh://user@host:1234/repos/{hostname}"
|
assert loc_without_archive.raw == "ssh://user@host:1234/repos/{hostname}"
|
||||||
assert loc_without_archive.orig == "ssh://user@host:1234/repos/%s" % hostname
|
assert loc_without_archive.processed == "ssh://user@host:1234/repos/%s" % hostname
|
||||||
|
|
||||||
|
|
||||||
class TestLocationWithEnv:
|
class TestLocationWithEnv:
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,10 @@ class TestKey:
|
||||||
|
|
||||||
class MockRepository:
|
class MockRepository:
|
||||||
class _Location:
|
class _Location:
|
||||||
orig = '/some/place'
|
raw = processed = '/some/place'
|
||||||
|
|
||||||
def canonical_path(self):
|
def canonical_path(self):
|
||||||
return self.orig
|
return self.processed
|
||||||
|
|
||||||
_location = _Location()
|
_location = _Location()
|
||||||
id = bytes(32)
|
id = bytes(32)
|
||||||
|
|
|
||||||
|
|
@ -864,19 +864,19 @@ class RemoteRepositoryTestCase(RepositoryTestCase):
|
||||||
self.repository.call('inject_exception', {'kind': 'DoesNotExist'})
|
self.repository.call('inject_exception', {'kind': 'DoesNotExist'})
|
||||||
except Repository.DoesNotExist as e:
|
except Repository.DoesNotExist as e:
|
||||||
assert len(e.args) == 1
|
assert len(e.args) == 1
|
||||||
assert e.args[0] == self.repository.location.orig
|
assert e.args[0] == self.repository.location.processed
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'AlreadyExists'})
|
self.repository.call('inject_exception', {'kind': 'AlreadyExists'})
|
||||||
except Repository.AlreadyExists as e:
|
except Repository.AlreadyExists as e:
|
||||||
assert len(e.args) == 1
|
assert len(e.args) == 1
|
||||||
assert e.args[0] == self.repository.location.orig
|
assert e.args[0] == self.repository.location.processed
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'CheckNeeded'})
|
self.repository.call('inject_exception', {'kind': 'CheckNeeded'})
|
||||||
except Repository.CheckNeeded as e:
|
except Repository.CheckNeeded as e:
|
||||||
assert len(e.args) == 1
|
assert len(e.args) == 1
|
||||||
assert e.args[0] == self.repository.location.orig
|
assert e.args[0] == self.repository.location.processed
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'IntegrityError'})
|
self.repository.call('inject_exception', {'kind': 'IntegrityError'})
|
||||||
|
|
@ -895,7 +895,7 @@ class RemoteRepositoryTestCase(RepositoryTestCase):
|
||||||
except Repository.ObjectNotFound as e:
|
except Repository.ObjectNotFound as e:
|
||||||
assert len(e.args) == 2
|
assert len(e.args) == 2
|
||||||
assert e.args[0] == s1
|
assert e.args[0] == s1
|
||||||
assert e.args[1] == self.repository.location.orig
|
assert e.args[1] == self.repository.location.processed
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'InvalidRPCMethod'})
|
self.repository.call('inject_exception', {'kind': 'InvalidRPCMethod'})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue