mercurial/context.py
changeset 27813 ff20fe74e5c6
parent 27812 28d0c0ef327b
child 27906 c183f7b79541
--- a/mercurial/context.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/mercurial/context.py	Fri Jan 15 13:14:46 2016 -0800
@@ -1548,17 +1548,15 @@
                 # 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