1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-03 05:35:58 +00:00

recreate: keep timestamps as in original archive, fixes #2384 (#2607)

the timestamps of the recreated archive (in the archive metadata and
also in the manifest) are now as they were for the original archive.

they are important metadata about the archive contents and should
therefore be kept "as is".

note: when using -v --stats, the timestamps shown there for recreate
      are about the recreate start/end/duration.
This commit is contained in:
TW 2017-06-05 09:59:17 +02:00 committed by enkore
parent 692f2c0933
commit 50bcd7843d

View file

@ -1699,11 +1699,14 @@ def iter_chunks(self, archive, target, chunks):
def save(self, archive, target, comment=None, replace_original=True): def save(self, archive, target, comment=None, replace_original=True):
if self.dry_run: if self.dry_run:
return return
timestamp = archive.ts.replace(tzinfo=None)
if comment is None: if comment is None:
comment = archive.metadata.get('comment', '') comment = archive.metadata.get('comment', '')
target.save(timestamp=timestamp, comment=comment, additional_metadata={ target.save(comment=comment, additional_metadata={
# keep some metadata as in original archive:
'time': archive.metadata.time,
'time_end': archive.metadata.time_end,
'cmdline': archive.metadata.cmdline, 'cmdline': archive.metadata.cmdline,
# but also remember recreate metadata:
'recreate_cmdline': sys.argv, 'recreate_cmdline': sys.argv,
}) })
if replace_original: if replace_original: