with: use a context manager for transaction in strip

This commit is contained in:
Bryan O'Sullivan 2016-01-15 13:14:50 -08:00
parent da377129a6
commit 49db6467b8

View File

@ -64,19 +64,14 @@ def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
repomarks = repo._bookmarks
if bookmarks:
tr = None
try:
tr = repo.transaction('strip')
with repo.transaction('strip') as tr:
if repo._activebookmark in bookmarks:
bookmarksmod.deactivate(repo)
for bookmark in bookmarks:
del repomarks[bookmark]
repomarks.recordchange(tr)
tr.close()
for bookmark in sorted(bookmarks):
ui.write(_("bookmark '%s' deleted\n") % bookmark)
finally:
release(tr)
finally:
release(lock, wlock)