Jonas Borgström пре 11 година
родитељ
комит
30daa23e42
2 измењених фајлова са 7 додато и 9 уклоњено
  1. 4 3
      attic/archive.py
  2. 3 6
      attic/repository.py

+ 4 - 3
attic/archive.py

@@ -481,9 +481,9 @@ class ArchiveChecker:
         for id_, (count, size, csize) in self.chunks.iteritems():
             if count == 0:
                 unused.add(id_)
-        unexpected = unused - self.possibly_superseded
-        if unexpected:
-            self.report_progress('{} excessive objects found'.format(len(unexpected)), error=True)
+        orphaned = unused - self.possibly_superseded
+        if orphaned:
+            self.report_progress('{} orphaned objects found'.format(len(orphaned)), error=True)
         if self.repair:
             for id_ in unused:
                 self.repository.delete(id_)
@@ -493,6 +493,7 @@ class ArchiveChecker:
     def rebuild_chunks(self):
         # Exclude the manifest from chunks
         del self.chunks[Manifest.MANIFEST_ID]
+
         def record_unused(id_):
             if self.chunks.get(id_, (0,))[0] == 0:
                 self.possibly_superseded.add(id_)

+ 3 - 6
attic/repository.py

@@ -87,7 +87,7 @@ class Repository(object):
 
     def get_transaction_id(self):
         index_transaction_id = self.get_index_transaction_id()
-        segments_transaction_id = self.io.get_segments_transaction_id(index_transaction_id or 0)
+        segments_transaction_id = self.io.get_segments_transaction_id()
         if index_transaction_id != segments_transaction_id:
             raise self.CheckNeeded(self.path)
         return index_transaction_id
@@ -204,7 +204,7 @@ class Repository(object):
         assert not self._active_txn
         report_progress('Starting repository check...')
         index_transaction_id = self.get_index_transaction_id()
-        segments_transaction_id = self.io.get_segments_transaction_id(index_transaction_id)
+        segments_transaction_id = self.io.get_segments_transaction_id()
         if index_transaction_id is None and segments_transaction_id is None:
             return True
         if segments_transaction_id is not None:
@@ -379,13 +379,10 @@ class LoggedIO(object):
             for filename in filenames:
                 yield int(filename), os.path.join(dirpath, filename)
 
-    def get_segments_transaction_id(self, index_transaction_id=0):
+    def get_segments_transaction_id(self):
         """Verify that the transaction id is consistent with the index transaction id
         """
         for segment, filename in self.segment_iterator(reverse=True):
-#            if index_transaction_id is not None and segment < index_transaction_id:
-#                # The index is newer than any committed transaction found
-#                return -1
             if self.is_committed_segment(filename):
                 return segment
         return None