hgext/strip.py
changeset 27872 a54afc4475d7
parent 27839 7ec3cb246291
child 28288 e417e4512b0f
--- 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)