changeset 27802:ed44a66fd7ae

with: use context manager for wlock in remove
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:45 -0800
parents 7be6371c732e
children a8e8950ebd4d
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
@@ -2421,16 +2421,13 @@
         if ui.verbose or not m.exact(f):
             ui.status(_('removing %s\n') % m.rel(f))
 
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         if not after:
             for f in list:
                 if f in added:
                     continue # we never unlink added files on remove
                 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
         repo[None].forget(list)
-    finally:
-        wlock.release()
 
     return ret