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

Make fetch_objects a bit easier to access.

Changeset 09a6d515a7ed

Parent a6b45a39af11

by Jelmer Vernooij

Changes to 2 files · Browse files at 09a6d515a7ed Showing diff from parent a6b45a39af11 Diff from another changeset...

 
39
40
41
 
 
 
42
43
44
 
171
172
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
40
41
42
43
44
45
46
47
 
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@@ -39,6 +39,9 @@
  self.path = path   self._packs = None   + def iter_shas(self, shas): + return ObjectIterator(self, shas) +   def pack_dir(self):   return os.path.join(self.path, PACKDIR)   @@ -171,3 +174,28 @@
  f, commit = self.add_pack()   write_pack_data(f, objects, len(objects))   commit() + + +class ObjectImporter(object): + + def __init__(self, count): + self.count = count + + def add_object(self, object): + raise NotImplementedError(self.add_object) + + def finish(self, object): + raise NotImplementedError(self.finish) + + +class ObjectIterator(object): + + def __init__(self, store, shas): + self.store = store + self.shas = shas + + def __iter__(self): + return ((self.store.get_object(sha), path) for sha, path in self.shas) + + def __len__(self): + return len(self.shas)
Change 1 of 2 Show Entire File dulwich/​repo.py Stacked
 
144
145
146
147
148
 
 
149
150
151
 
313
314
315
316
317
 
144
145
146
 
 
147
148
149
150
151
 
313
314
315
 
 
@@ -144,8 +144,8 @@
  updated progress strings.   :return: tuple with number of objects, iterator over objects   """ - shas = self.find_missing_objects(determine_wants, graph_walker, progress) - return (len(shas), ((self.get_object(sha), path) for sha, path in shas)) + return self.object_store.iter_shas( + self.find_missing_objects(determine_wants, graph_walker, progress))     def object_dir(self):   return os.path.join(self.controldir(), OBJECTDIR) @@ -313,5 +313,3 @@
    create = init_bare   - -