Browse Source

alternates: remove contains_alternate() and move the code inside __contains__

Dmitriy 12 năm trước cách đây
mục cha
commit
3e7382857f
1 tập tin đã thay đổi với 6 bổ sung8 xóa
  1. 6 8
      dulwich/object_store.py

+ 6 - 8
dulwich/object_store.py

@@ -237,19 +237,17 @@ class PackBasedObjectStore(BaseObjectStore):
                 return True
         return False
 
-    def contains_alternate(self, sha):
-        """Check if a particular object is present by SHA1 in the alternate storage."""
-        for alternate in self.alternates:
-            if alternate.contains_loose(sha) or alternate.contains_packed(sha):
-                return True
-        return False
-
     def __contains__(self, sha):
         """Check if a particular object is present by SHA1 in the main or alternate stores.
 
         This method makes no distinction between loose and packed objects.
         """
-        return self.contains_packed(sha) or self.contains_loose(sha) or self.contains_alternate(sha)
+        if self.contains_packed(sha) or self.contains_loose(sha):
+            return True
+        for alternate in self.alternates:
+            if alternate.contains_packed(sha) or alternate.contains_loose(sha):
+                return True
+        return False
 
     def _load_packs(self):
         raise NotImplementedError(self._load_packs)