1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00

also copy files cache verbatim

it seems the file cache does *not* have the ATTIC magic header (nor
does it have one in borg), so we don't need to edit the file - we just
copy it like a regular file.

while i'm here, simplify the cache conversion loop: it's no use
splitting the copy and the edition since the latter is so fast, just
do everything in one loop, which makes it much easier to read.
This commit is contained in:
Antoine Beaupré 2015-10-03 12:56:03 -04:00
parent fded2219a8
commit 5409cbaa67

View file

@ -184,20 +184,17 @@ def copy_cache_file(path):
if not os.path.exists(borg_cache_dir): if not os.path.exists(borg_cache_dir):
os.makedirs(borg_cache_dir) os.makedirs(borg_cache_dir)
# non-binary file that we don't need to convert, just copy # file that we don't have a header to convert, just copy
copy_cache_file('config') for cache in ['config', 'files']:
copy_cache_file(cache)
# we need to convert the headers of those files, copy first # we need to convert the headers of those files, copy first
for cache in ['files', 'chunks']: for cache in ['chunks']:
copied = copy_cache_file(cache) copied = copy_cache_file(cache)
if copied: if copied:
caches.append(copied) print("converting cache %s" % cache)
if not dryrun:
# actually convert the headers of the detected files AtticRepositoryUpgrader.header_replace(cache, b'ATTICIDX', b'BORG_IDX')
for cache in caches:
print("converting cache %s" % cache)
if not dryrun:
AtticRepositoryUpgrader.header_replace(cache, b'ATTICIDX', b'BORG_IDX')
class AtticKeyfileKey(KeyfileKey): class AtticKeyfileKey(KeyfileKey):