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

Extend ObjectIterator a bit.

Changeset 28980f1f1cc9

Parent 09a6d515a7ed

by Jelmer Vernooij

Changes to one file · Browse files at 28980f1f1cc9 Showing diff from parent 09a6d515a7ed Diff from another changeset...

 
197
198
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
201
 
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
@@ -197,5 +197,19 @@
  def __iter__(self):   return ((self.store.get_object(sha), path) for sha, path in self.shas)   + def iterobjects(self): + for o, path in self: + yield o + + def __contains__(self, needle): + # FIXME: This could be more efficient + for sha, path in self.shas: + if sha == needle: + return True + return False + + def __getitem__(self, key): + return self.store[key] +   def __len__(self):   return len(self.shas)