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

Simplify checking of alternates in __contains__.

Changeset 94fe724d9b52

Parent db27fdc3e583

committed by Jelmer Vernooij

authored by Jelmer Vernooij

Changes to one file · Browse files at 94fe724d9b52 Showing diff from parent db27fdc3e583 Diff from another changeset...

 
231
232
233
234
 
 
 
 
235
236
237
238
239
240
241
 
242
243
244
245
246
247
248
 
249
250
251
 
305
306
307
308
 
 
 
 
309
310
311
 
231
232
233
 
234
235
236
237
238
239
240
241
242
243
 
244
245
246
247
248
249
250
 
251
252
253
254
 
308
309
310
 
311
312
313
314
315
316
317
@@ -231,21 +231,24 @@
  return []     def contains_packed(self, sha): - """Check if a particular object is present by SHA1 and is packed.""" + """Check if a particular object is present by SHA1 and is packed. + + This does not check alternates. + """   for pack in self.packs:   if sha in pack:   return True   return False     def __contains__(self, sha): - """Check if a particular object is present by SHA1 in the main or alternate stores. + """Check if a particular object is present by SHA1.     This method makes no distinction between loose and packed objects.   """   if self.contains_packed(sha) or self.contains_loose(sha):   return True   for alternate in self.alternates: - if alternate.contains_packed(sha) or alternate.contains_loose(sha): + if sha in alternate:   return True   return False   @@ -305,7 +308,10 @@
  return itertools.chain(*iterables)     def contains_loose(self, sha): - """Check if a particular object is present by SHA1 and is loose.""" + """Check if a particular object is present by SHA1 and is loose. + + This does not check alternates. + """   return self._get_loose_object(sha) is not None     def get_raw(self, name):