Mercurial > public > mercurial-scm > hg
diff hgext/strip.py @ 27872:a54afc4475d7
with: use a context manager for transaction in strip
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:50 -0800 |
parents | 7ec3cb246291 |
children | e417e4512b0f |
line wrap: on
line diff
--- a/hgext/strip.py Fri Jan 15 13:14:49 2016 -0800 +++ b/hgext/strip.py Fri Jan 15 13:14:50 2016 -0800 @@ -64,19 +64,14 @@ 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)