changeset 27801:7be6371c732e

with: use context manager for wlock in recordinwlock
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:45 -0800
parents 1c5f2c2c046b
children ed44a66fd7ae
files mercurial/cmdutil.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)