# HG changeset patch # User Bryan O'Sullivan # Date 1452892489 28800 # Node ID 4133a306606c82195594c2cdf56d088b5db48274 # Parent 49cfddbf54ba302dace9ce7aa4c379b223f72693 with: use context manager in _markchanges diff -r 49cfddbf54ba -r 4133a306606c mercurial/scmutil.py --- 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