Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master, master-1, and master-0

Fix fetching of thin packs.

Changeset c41666f185d5

Parent ab0903623143

by Jelmer Vernooij

Changes to 2 files · Browse files at c41666f185d5 Showing diff from parent ab0903623143 Diff from another changeset...

 
146
147
148
149
 
 
 
 
 
 
 
 
 
150
151
152
 
 
153
154
155
 
146
147
148
 
149
150
151
152
153
154
155
156
157
158
159
 
160
161
162
163
164
@@ -146,10 +146,19 @@
    :param path: Path to the pack file.   """ - p = PackData(path) + data = PackData(path) + + # Write index for the thin pack (do we really need this?) + temppath = os.path.join(self.pack_dir, + sha_to_hex(urllib2.randombytes(20))+".tempidx") + data.create_index_v2(temppath, self.get_raw) + p = Pack.from_objects(data, load_pack_index(temppath)) + + # Write a full pack version   temppath = os.path.join(self.pack_dir,   sha_to_hex(urllib2.randombytes(20))+".temppack") - write_pack(temppath, p.iterobjects(self.get_raw), len(p)) + write_pack(temppath, ((o, None) for o in p.iterobjects(self.get_raw)), + len(p))   pack_sha = load_pack_index(temppath+".idx").objects_sha1()   newbasename = os.path.join(self.pack_dir, "pack-%s" % pack_sha)   os.rename(temppath+".pack", newbasename+".pack")
Change 1 of 2 Show Entire File dulwich/​pack.py Stacked
 
523
524
525
526
 
527
528
529
 
883
884
885
 
 
 
 
 
 
 
886
887
888
 
523
524
525
 
526
527
528
529
 
883
884
885
886
887
888
889
890
891
892
893
894
895
@@ -523,7 +523,7 @@
  pass   raise Postpone, (sha, )   extra = [] - todo = chain(self.iterobjects(progress), extra) + todo = chain(self.iterobjects(progress=progress), extra)   for (offset, type, obj, crc32) in todo:   assert isinstance(offset, int)   assert isinstance(type, int) @@ -883,6 +883,13 @@
  self._data = None   self._idx = None   + @classmethod + def from_objects(self, data, idx): + ret = Pack("") + ret._data = data + ret._idx = idx + return ret +   def name(self):   """The SHA over the SHAs of the objects in this pack."""   return self.idx.objects_sha1()