changeset 27799:24b4dbb16c60

with: use context manager for wlock in _writerepo
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:45 -0800
parents 8953e963ce8c
children 1c5f2c2c046b
files mercurial/bookmarks.py
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/mercurial/bookmarks.py	Fri Jan 15 13:14:45 2016 -0800
@@ -149,9 +149,7 @@
             rbm.active = None
             rbm._writeactive()
 
-        wlock = repo.wlock()
-        try:
-
+        with repo.wlock():
             file_ = repo.vfs('bookmarks', 'w', atomictemp=True)
             try:
                 self._write(file_)
@@ -161,9 +159,6 @@
             finally:
                 file_.close()
 
-        finally:
-            wlock.release()
-
     def _writeactive(self):
         if self._aclean:
             return