Преглед изворни кода

Don't 'want' refs we already have.

Jelmer Vernooij пре 16 година
родитељ
комит
30f2f62d80
2 измењених фајлова са 10 додато и 2 уклоњено
  1. 2 2
      bin/dul-fetch-pack
  2. 8 0
      dulwich/repo.py

+ 2 - 2
bin/dul-fetch-pack

@@ -38,9 +38,9 @@ if not ":" in args[0]:
 client = TCPGitClient(host)
 
 if "--all" in opts:
-    determine_wants = lambda x: x.values()
+    determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
 else:
-    determine_wants = lambda x: args
+    determine_wants = lambda x: [y for y in args if not y in r.object_store]
 
 r = Repo(".")
 

+ 8 - 0
dulwich/repo.py

@@ -209,6 +209,14 @@ class ObjectStore(object):
     def pack_dir(self):
         return os.path.join(self.path, PACKDIR)
 
+    def __contains__(self, sha):
+        # TODO: This can be more efficient
+        try:
+            self[sha]
+            return True
+        except KeyError:
+            return False
+
     @property
     def packs(self):
         if self._packs is None: