bookmarks: use context managers for lock and transaction in update()
Differential Revision: https://phab.mercurial-scm.org/D1839
--- 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):