diff --git a/borg/upgrader.py b/borg/upgrader.py index ad35ab9d0..2a8a977d0 100644 --- a/borg/upgrader.py +++ b/borg/upgrader.py @@ -87,17 +87,15 @@ class AtticRepositoryUpgrader(Repository): segment.seek(0) segment.write(new_magic) else: - # remove the hardlink and rewrite the file. this - # works because our old file handle is still open - # so even though the file is removed, we can still - # read it until the file is closed. + # rename the hardlink and rewrite the file. this works + # because the file is still open. so even though the file + # is renamed, we can still read it until it is closed. os.rename(filename, filename + '.tmp') with open(filename, 'wb') as new_segment: new_segment.write(new_magic) new_segment.write(segment.read()) # the little dance with the .tmp file is necessary - # because Windows won't allow overwriting an open - # file. + # because Windows won't allow overwriting an open file. os.unlink(filename + '.tmp') def find_attic_keyfile(self):