1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-12 15:20:20 +00:00

diff: fix for non-unique archive names

For Archive(), always use the archive id, not the archive name!

Also: remove with_archive decorator usage to get more consistent code.
This commit is contained in:
Thomas Waldmann 2024-09-19 00:38:10 +02:00
parent 6b68b5a4a7
commit 4bce862d95
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -4,7 +4,7 @@ import json
import sys
import os
from ._common import with_repository, with_archive, build_matcher, Highlander
from ._common import with_repository, build_matcher, Highlander
from ..archive import Archive
from ..constants import * # NOQA
from ..helpers import BaseFormatter, DiffFormatter, archivename_validator, PathSpec, BorgJsonEncoder
@ -16,8 +16,7 @@ logger = create_logger()
class DiffMixIn:
@with_repository(compatibility=(Manifest.Operation.READ,))
@with_archive
def do_diff(self, args, repository, manifest, archive):
def do_diff(self, args, repository, manifest):
"""Diff contents of two archives"""
if args.format is not None:
format = args.format
@ -26,8 +25,10 @@ class DiffMixIn:
else:
format = os.environ.get("BORG_DIFF_FORMAT", "{change} {path}{NL}")
archive1 = archive
archive2 = Archive(manifest, args.other_name)
archive1_info = manifest.archives.get_one(args.name)
archive2_info = manifest.archives.get_one(args.other_name)
archive1 = Archive(manifest, archive1_info.id)
archive2 = Archive(manifest, archive2_info.id)
can_compare_chunk_ids = (
archive1.metadata.get("chunker_params", False) == archive2.metadata.get("chunker_params", True)