فهرست منبع

Start working on getting sha, name from API - so we can sort on name when making deltas

John Carr 16 سال پیش
والد
کامیت
6577a7f48e
2فایلهای تغییر یافته به همراه8 افزوده شده و 8 حذف شده
  1. 2 2
      dulwich/pack.py
  2. 6 6
      dulwich/repo.py

+ 2 - 2
dulwich/pack.py

@@ -589,8 +589,8 @@ def write_pack_data(f, objects, num_objects, window=10):
     # Build a list of objects ordered by the magic Linus heuristic
     # This helps us find good objects to diff against us
     magic = []
-    for o in recency:
-        magic.append( (o.type, "filename", 1, -len(o.as_raw_string()[1]), o) )
+    for obj, path in recency:
+        magic.append( (obj.type, path, 1, -len(obj.as_raw_string()[1]), obj) )
     magic.sort()
     # Build a map of objects and their index in magic - so we can find preceeding objects
     # to diff against

+ 6 - 6
dulwich/repo.py

@@ -106,13 +106,13 @@ class Repo(object):
             graph_walker.ack(ref)
         ref = graph_walker.next()
     while commits_to_send:
-        sha = commits_to_send.pop()
+        sha = (commits_to_send.pop(), None)
         if sha in sha_done:
             continue
 
         c = self.commit(sha)
         assert isinstance(c, Commit)
-        sha_done.add(sha)
+        sha_done.add((sha, None))
 
         commits_to_send.update([p for p in c.parents if not p in sha_done])
 
@@ -122,12 +122,12 @@ class Repo(object):
                     continue
                 if mode & stat.S_IFDIR:
                     parse_tree(self.tree(sha), sha_done)
-                sha_done.add(sha)
+                sha_done.add((sha, name))
 
         treesha = c.tree
         if c.tree not in sha_done:
             parse_tree(self.tree(c.tree), sha_done)
-            sha_done.add(c.tree)
+            sha_done.add((c.tree, None))
 
         progress("counting objects: %d\r" % len(sha_done))
     return sha_done
@@ -144,8 +144,8 @@ class Repo(object):
         updated progress strings.
     """
     shas = self.find_missing_objects(determine_wants, graph_walker, progress)
-    for sha in shas:
-        yield self.get_object(sha)
+    for sha, path in shas:
+        yield self.get_object(sha), path
 
   def object_dir(self):
     return os.path.join(self.controldir(), OBJECTDIR)