mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
with: use a context manager for transaction in strip
This commit is contained in:
parent
da377129a6
commit
49db6467b8
@ -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)
|
||||
for bookmark in sorted(bookmarks):
|
||||
ui.write(_("bookmark '%s' deleted\n") % bookmark)
|
||||
finally:
|
||||
release(lock, wlock)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user