Bladeren bron

Fix iterator over objects in server.

Jelmer Vernooij 16 jaren geleden
bovenliggende
commit
eced39b925
3 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. 1 0
      dulwich/object_store.py
  2. 1 1
      dulwich/repo.py
  3. 5 4
      dulwich/server.py

+ 1 - 0
dulwich/object_store.py

@@ -61,6 +61,7 @@ class BaseObjectStore(object):
         """Iterate over the objects for the specified shas.
 
         :param shas: Iterable object with SHAs
+        :return: Object iterator
         """
         return ObjectStoreIterator(self, shas)
 

+ 1 - 1
dulwich/repo.py

@@ -225,7 +225,7 @@ class Repo(object):
             that a revision is present.
         :param progress: Simple progress function that will be called with 
             updated progress strings.
-        :return: tuple with number of objects, iterator over objects
+        :return: iterator over objects, with __len__ implemented
         """
         wants = determine_wants(self.get_refs())
         haves = self.object_store.find_common_revisions(graph_walker)

+ 5 - 4
dulwich/server.py

@@ -161,15 +161,16 @@ class UploadPackHandler(Handler):
                 self.proto.write_pkt_line("NAK\n")
 
         graph_walker = ProtocolGraphWalker(self.proto)
-        num_objects, objects_iter = self.backend.fetch_objects(determine_wants, graph_walker, progress)
+        objects_iter = self.backend.fetch_objects(determine_wants, graph_walker, progress)
 
         # Do they want any objects?
-        if num_objects == 0:
+        if len(objects_iter) == 0:
             return
 
         progress("dul-daemon says what\n")
-        progress("counting objects: %d, done.\n" % num_objects)
-        write_pack_data(ProtocolFile(None, write), objects_iter, num_objects)
+        progress("counting objects: %d, done.\n" % len(objects_iter))
+        write_pack_data(ProtocolFile(None, write), objects_iter, 
+                        len(objects_iter))
         progress("how was that, then?\n")
         # we are done
         self.proto.write("0000")