Changeset 46f6d4667f7f…
Parent 9e63bab0fe9f…
by
Changes to 3 files · Browse files at 46f6d4667f7f Showing diff from parent 9e63bab0fe9f Diff from another changeset...
@@ -33,6 +33,8 @@
* Support running 'dulwich.server' and 'dulwich.web' using 'python -m'.
(Jelmer Vernooij)
+
+ * Add ObjectStore.close(). (Jelmer Vernooij)
API CHANGES
|
@@ -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,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):
|
Loading...