1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

os.link signature is the same as shutil.copy, use it directly

This commit is contained in:
Antoine Beaupré 2015-10-15 18:14:44 -04:00
parent aaf72e3861
commit 4be9c29d0d

View file

@ -32,7 +32,7 @@ def upgrade(self, dryrun=True, inplace=False):
backup = '{}.upgrade-{:%Y-%m-%d-%H:%M:%S}'.format(self.path, datetime.datetime.now()) backup = '{}.upgrade-{:%Y-%m-%d-%H:%M:%S}'.format(self.path, datetime.datetime.now())
logger.info('making a hardlink copy in %s', backup) logger.info('making a hardlink copy in %s', backup)
if not dryrun: if not dryrun:
shutil.copytree(self.path, backup, copy_function=lambda src, dst: os.link(src, dst)) shutil.copytree(self.path, backup, copy_function=os.link)
logger.info("opening attic repository with borg and converting") logger.info("opening attic repository with borg and converting")
# we need to open the repo to load configuration, keyfiles and segments # we need to open the repo to load configuration, keyfiles and segments
self.open(self.path, exclusive=False) self.open(self.path, exclusive=False)