changeset 27817:476e402e57c3

with: use context manager for wlock in kw_amend
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 98391f38ceb8
children 484895cc0f60
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
@@ -653,8 +653,7 @@
 
     def kw_amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
         '''Wraps cmdutil.amend expanding keywords after amend.'''
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             kwt.postcommit = True
             newid = orig(ui, repo, commitfunc, old, extra, pats, opts)
             if newid != old.node():
@@ -663,8 +662,6 @@
                 kwt.overwrite(ctx, ctx.files(), False, True)
                 kwt.restrict = False
             return newid
-        finally:
-            wlock.release()
 
     def kw_copy(orig, ui, repo, pats, opts, rename=False):
         '''Wraps cmdutil.copy so that copy/rename destinations do not