comparison mercurial/context.py @ 27813:ff20fe74e5c6

with: use context manager for wlock in checklookup
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 28d0c0ef327b
children c183f7b79541
comparison
equal deleted inserted replaced
27812:28d0c0ef327b 27813:ff20fe74e5c6
1546 try: 1546 try:
1547 # updating the dirstate is optional 1547 # updating the dirstate is optional
1548 # so we don't wait on the lock 1548 # so we don't wait on the lock
1549 # wlock can invalidate the dirstate, so cache normal _after_ 1549 # wlock can invalidate the dirstate, so cache normal _after_
1550 # taking the lock 1550 # taking the lock
1551 wlock = self._repo.wlock(False) 1551 with self._repo.wlock(False):
1552 normal = self._repo.dirstate.normal 1552 normal = self._repo.dirstate.normal
1553 try:
1554 for f in fixup: 1553 for f in fixup:
1555 normal(f) 1554 normal(f)
1556 # write changes out explicitly, because nesting 1555 # write changes out explicitly, because nesting
1557 # wlock at runtime may prevent 'wlock.release()' 1556 # wlock at runtime may prevent 'wlock.release()'
1558 # below from doing so for subsequent changing files 1557 # after this block from doing so for subsequent
1558 # changing files
1559 self._repo.dirstate.write(self._repo.currenttransaction()) 1559 self._repo.dirstate.write(self._repo.currenttransaction())
1560 finally:
1561 wlock.release()
1562 except error.LockError: 1560 except error.LockError:
1563 pass 1561 pass
1564 return modified, fixup 1562 return modified, fixup
1565 1563
1566 def _manifestmatches(self, match, s): 1564 def _manifestmatches(self, match, s):