changeset 27803:a8e8950ebd4d

with: use context manager for wlock in revert
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents ed44a66fd7ae
children aa41199a74e2
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:46 2016 -0800
@@ -2868,8 +2868,7 @@
     #   <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
     names = {}
 
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         ## filling of the `names` mapping
         # walk dirstate to fill `names`
 
@@ -3122,8 +3121,6 @@
                 except KeyError:
                     raise error.Abort("subrepository '%s' does not exist in %s!"
                                       % (sub, short(ctx.node())))
-    finally:
-        wlock.release()
 
 def _revertprefetch(repo, ctx, *files):
     """Let extension changing the storage layer prefetch content"""