]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/gc.py
ShaBloom.__del__: replace with context management
[bup.git] / lib / bup / gc.py
index e8425ff0460a203614714c3073f672b44fa9ab4f..06bd3baf609353af1a1d238ebd02b32b1575d4e5 100644 (file)
@@ -236,7 +236,7 @@ def bup_gc(threshold=10, compression=1, verbosity=0):
         except MissingObject as ex:
             log('bup: missing object %r \n' % hexstr(ex.oid))
             sys.exit(1)
-        try:
+        with live_objects:
             # FIXME: just rename midxes and bloom, and restore them at the end if
             # we didn't change any packs?
             packdir = git.repo(b'objects/pack')
@@ -252,5 +252,3 @@ def bup_gc(threshold=10, compression=1, verbosity=0):
             sweep(live_objects, existing_count, cat_pipe,
                   threshold, compression,
                   verbosity)
-        finally:
-            live_objects.close()