upgrader: fix / reformat comments

This commit is contained in:
Thomas Waldmann 2015-10-18 16:43:59 +02:00
parent 3c52f41132
commit 03975016c5

View file

@ -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):