changeset 27819:e401dfd79ec7

with: use context manager for wlock in kw_dorecord
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 484895cc0f60
children d2e9cc9edc08
files hgext/keyword.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/hgext/keyword.py	Fri Jan 15 13:14:46 2016 -0800
@@ -696,8 +696,7 @@
 
     def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts):
         '''Wraps record.dorecord expanding keywords after recording.'''
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             # record returns 0 even when nothing has changed
             # therefore compare nodes before and after
             kwt.postcommit = True
@@ -712,8 +711,6 @@
                 kwt.overwrite(recctx, added, False, True, True)
                 kwt.restrict = True
             return ret
-        finally:
-            wlock.release()
 
     def kwfilectx_cmp(orig, self, fctx):
         # keyword affects data size, comparing wdir and filelog size does