changeset 27851:4133a306606c

with: use context manager in _markchanges
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 49cfddbf54ba
children a33c1c9e769c
files mercurial/scmutil.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/scmutil.py	Fri Jan 15 13:14:49 2016 -0800
@@ -983,14 +983,11 @@
     '''Marks the files in unknown as added, the files in deleted as removed,
     and the files in renames as copied.'''
     wctx = repo[None]
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         wctx.forget(deleted)
         wctx.add(unknown)
         for new, old in renames.iteritems():
             wctx.copy(old, new)
-    finally:
-        wlock.release()
 
 def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None):
     """Update the dirstate to reflect the intent of copying src to dst. For