Mercurial > hg
diff hgext/keyword.py @ 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 | a7b453b47726 |
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