changeset 28512:b0b98e0a12f8

with: use context manager in rename
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 2b3a21052be9
children 7575c048482d
files mercurial/commands.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5818,11 +5818,8 @@
 
     Returns 0 on success, 1 if errors are encountered.
     """
-    wlock = repo.wlock(False)
-    try:
+    with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts, rename=True)
-    finally:
-        wlock.release()
 
 @command('resolve',
     [('a', 'all', None, _('select all unresolved files')),