mercurial/commands.py
changeset 27857 b0b98e0a12f8
parent 27856 2b3a21052be9
child 27858 7575c048482d
--- a/mercurial/commands.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/commands.py	Fri Jan 15 13:14:49 2016 -0800
@@ -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')),