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

Add ObjectStore.close.

Changeset 46f6d4667f7f

Parent 9e63bab0fe9f

by Jelmer Vernooij

Changes to 3 files · Browse files at 46f6d4667f7f Showing diff from parent 9e63bab0fe9f Diff from another changeset...

Change 1 of 1 Show Entire File NEWS Stacked
 
33
34
35
 
 
36
37
38
 
33
34
35
36
37
38
39
40
@@ -33,6 +33,8 @@
    * Support running 'dulwich.server' and 'dulwich.web' using 'python -m'.   (Jelmer Vernooij) + + * Add ObjectStore.close(). (Jelmer Vernooij)     API CHANGES  
 
247
248
249
 
 
 
 
250
251
252
 
292
293
294
 
 
 
 
 
 
 
295
296
297
 
247
248
249
250
251
252
253
254
255
256
 
296
297
298
299
300
301
302
303
304
305
306
307
308
@@ -247,6 +247,10 @@
  queue.extend(cmt.parents)   return (commits, bases)   + def close(self): + """Close any files opened by this object store.""" + # Default implementation is a NO-OP +    class PackBasedObjectStore(BaseObjectStore):   @@ -292,6 +296,13 @@
  """   if self._pack_cache is not None:   self._pack_cache.append(pack) + + def close(self): + pack_cache = self._pack_cache + self._pack_cache = None + while pack_cache: + pack = pack_cache.pop() + pack.close()     @property   def packs(self):
 
187
188
189
 
 
 
 
 
190
191
192
 
187
188
189
190
191
192
193
194
195
196
197
@@ -187,6 +187,11 @@
  self.store.add_object(testobject)   self.assertEqual((Blob.type_num, 'yummy data'),   self.store.get_raw(testobject.id)) + + def test_close(self): + # For now, just check that close doesn't barf. + self.store.add_object(testobject) + self.store.close()      class MemoryObjectStoreTests(ObjectStoreTests, TestCase):