diff: more precise warning msgs for different chunker params

if we know both archives' chunker params, use "are different" not "might be".
also do not recommend to enforce it using --same-chunker-params in this case.
This commit is contained in:
Thomas Waldmann 2022-10-11 19:44:11 +02:00
parent 651bef450d
commit 3200190cdb

View file

@ -1127,9 +1127,16 @@ class Archiver:
cp1 = archive1.metadata.get('chunker_params')
cp2 = archive2.metadata.get('chunker_params')
can_compare_chunk_ids = (args.same_chunker_params or
cp1 is not None and cp2 is not None and normalize_chunker_params(cp1) == normalize_chunker_params(cp2))
if not can_compare_chunk_ids:
if args.same_chunker_params:
can_compare_chunk_ids = True # enforce it
elif cp1 is not None and cp2 is not None:
# we know chunker params of both archives
can_compare_chunk_ids = normalize_chunker_params(cp1) == normalize_chunker_params(cp2)
if not can_compare_chunk_ids:
self.print_warning('--chunker-params are different between archives, diff will be slow.')
else:
# we do not know chunker params of at least one of the archives
can_compare_chunk_ids = False
self.print_warning('--chunker-params might be different between archives, diff will be slow.\n'
'If you know for certain that they are the same, pass --same-chunker-params '
'to override this check.')