with: use context manager for transaction in rebase
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:48 -0800
changeset 27866 f54bf1f41566
parent 27865 f6979b8f33c1
child 27867 7ced54ebf972
with: use context manager for transaction in rebase
hgext/rebase.py
--- a/hgext/rebase.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/rebase.py	Fri Jan 15 13:14:48 2016 -0800
@@ -547,17 +547,12 @@
                 collapsedas = newnode
             clearrebased(ui, repo, state, skipped, collapsedas)
 
-        tr = None
-        try:
-            tr = repo.transaction('bookmark')
+        with repo.transaction('bookmark') as tr:
             if currentbookmarks:
                 updatebookmarks(repo, targetnode, nstate, currentbookmarks, tr)
                 if activebookmark not in repo._bookmarks:
                     # active bookmark was divergent one and has been deleted
                     activebookmark = None
-            tr.close()
-        finally:
-            release(tr)
         clearstatus(repo)
 
         ui.note(_("rebase completed\n"))