mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-12 07:08:47 +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:
parent
6b68b5a4a7
commit
4bce862d95
1 changed files with 6 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue