# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID ff20fe74e5c6398301d6dd572390c488359df05f # Parent 28d0c0ef327b28fb8682938a5656a513e99177f9 with: use context manager for wlock in checklookup diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1548,17 +1548,15 @@ class workingctx(committablectx): # so we don't wait on the lock # wlock can invalidate the dirstate, so cache normal _after_ # taking the lock - wlock = self._repo.wlock(False) - normal = self._repo.dirstate.normal - try: + with self._repo.wlock(False): + normal = self._repo.dirstate.normal for f in fixup: normal(f) # write changes out explicitly, because nesting # wlock at runtime may prevent 'wlock.release()' - # below from doing so for subsequent changing files + # after this block from doing so for subsequent + # changing files self._repo.dirstate.write(self._repo.currenttransaction()) - finally: - wlock.release() except error.LockError: pass return modified, fixup