mercurial/bookmarks.py
changeset 35576 b9a0de08110e
parent 35257 3340d46a5c3f
child 35577 ac7ee75ee664
--- a/mercurial/bookmarks.py	Wed Jan 10 10:44:21 2018 -0800
+++ b/mercurial/bookmarks.py	Wed Jan 10 10:47:13 2018 -0800
@@ -392,14 +392,8 @@
         bmchanges.append((bm, None))
 
     if bmchanges:
-        lock = tr = None
-        try:
-            lock = repo.lock()
-            tr = repo.transaction('bookmark')
+        with repo.lock(), repo.transaction('bookmark') as tr:
             marks.applychanges(repo, tr, bmchanges)
-            tr.close()
-        finally:
-            lockmod.release(tr, lock)
     return bool(bmchanges)
 
 def listbinbookmarks(repo):