1550
1550
# FIXME: just drop the transient index.
1551
1551
# forget what names there are
1552
1552
if self._new_pack is not None:
1553
operation = cleanup.OperationWithCleanups(self._new_pack.abort)
1554
operation.add_cleanup(setattr, self, '_new_pack', None)
1555
# If we aborted while in the middle of finishing the write
1556
# group, _remove_pack_indices could fail because the indexes are
1557
# already gone. But they're not there we shouldn't fail in this
1558
# case, so we pass ignore_missing=True.
1559
operation.add_cleanup(self._remove_pack_indices, self._new_pack,
1560
ignore_missing=True)
1561
operation.run_simple()
1553
with cleanup.ExitStack() as stack:
1554
stack.callback(setattr, self, '_new_pack', None)
1555
# If we aborted while in the middle of finishing the write
1556
# group, _remove_pack_indices could fail because the indexes are
1557
# already gone. But they're not there we shouldn't fail in this
1558
# case, so we pass ignore_missing=True.
1559
stack.callback(self._remove_pack_indices, self._new_pack,
1560
ignore_missing=True)
1561
self._new_pack.abort()
1562
1562
for resumed_pack in self._resumed_packs:
1563
operation = cleanup.OperationWithCleanups(resumed_pack.abort)
1564
# See comment in previous finally block.
1565
operation.add_cleanup(self._remove_pack_indices, resumed_pack,
1566
ignore_missing=True)
1567
operation.run_simple()
1563
with cleanup.ExitStack() as stack:
1564
# See comment in previous finally block.
1565
stack.callback(self._remove_pack_indices, resumed_pack,
1566
ignore_missing=True)
1567
resumed_pack.abort()
1568
1568
del self._resumed_packs[:]
1570
1570
def _remove_resumed_pack_indices(self):