with: use context manager for wlock in recordinwlock
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:45 -0800
changeset 27801 7be6371c732e
parent 27800 1c5f2c2c046b
child 27802 ed44a66fd7ae
with: use context manager for wlock in recordinwlock
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Fri Jan 15 13:14:45 2016 -0800
+++ b/mercurial/cmdutil.py	Fri Jan 15 13:14:45 2016 -0800
@@ -230,11 +230,8 @@
                 pass
 
     def recordinwlock(ui, repo, message, match, opts):
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             return recordfunc(ui, repo, message, match, opts)
-        finally:
-            wlock.release()
 
     return commit(ui, repo, recordinwlock, pats, opts)