Selaa lähdekoodia

Merge pull request #6613 from ThomasWaldmann/fix-pre12-meta-1.2

pre12-meta cache: do not use the cache if want_unique is True, fixes #6612
TW 3 vuotta sitten
vanhempi
sitoutus
9dec811077
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      src/borg/archive.py

+ 6 - 0
src/borg/archive.py

@@ -658,6 +658,12 @@ Utilization of max. archive size: {csize_max:.0%}
         # caching wrapper around _calc_stats which is rather slow for archives made with borg < 1.2
         have_borg12_meta = self.metadata.get('nfiles') is not None
         try:
+            if want_unique:
+                # usize is neither contained in the borg 1.2 archive metadata nor in the
+                # pre12_meta cache entry representing the same information for 1.1 archives.
+                # usize is not a static property of an archive, but must get dynamically calculated,
+                # thus we must trigger a call to self._calc_stats() to get it.
+                raise KeyError
             stats = Statistics.from_raw_dict(**cache.pre12_meta[self.fpr])
         except KeyError:  # not in pre12_meta cache
             stats = self._calc_stats(cache, want_unique=want_unique)