changeset 27866:f54bf1f41566

with: use context manager for transaction in rebase
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:48 -0800
parents f6979b8f33c1
children 7ced54ebf972
files hgext/rebase.py
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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"))