mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 18:28:42 +00:00
only write magic num if necessary
this could allow speeding up conversions resumed after interruption
This commit is contained in:
parent
180dfcb18f
commit
35b219597f
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,8 @@
|
|||
from .repository import Repository, MAGIC
|
||||
from .key import KeyfileKey, KeyfileNotFoundError
|
||||
|
||||
ATTIC_MAGIC = b'ATTICSEG'
|
||||
|
||||
class AtticRepositoryConverter(Repository):
|
||||
def convert(self, dryrun=True):
|
||||
"""convert an attic repository to a borg repository
|
||||
|
@ -54,7 +56,10 @@ def convert_segments(segments, dryrun):
|
|||
else:
|
||||
with open(filename, 'r+b') as segment:
|
||||
segment.seek(0)
|
||||
segment.write(MAGIC)
|
||||
# only write if necessary
|
||||
if (segment.read(len(ATTIC_MAGIC)) == ATTIC_MAGIC):
|
||||
segment.seek(0)
|
||||
segment.write(MAGIC)
|
||||
print()
|
||||
|
||||
def find_attic_keyfile(self):
|
||||
|
|
Loading…
Reference in a new issue