diff hgext/rebase.py @ 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 2d294dada4f8
children 6bc2299cc12f
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"))