Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 24386:d6ac30f4edef
devel: move the lock-checking code into core
If the developer warnings are enabled, bad locking order will be
reported without the need for the contrib extension.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 16 Jan 2015 02:51:10 -0800 |
parents | 521cecb4a3f1 |
children | 026f8af88e49 |
comparison
equal
deleted
inserted
replaced
24385:885a573fa619 | 24386:d6ac30f4edef |
---|---|
1187 | 1187 |
1188 def wlock(self, wait=True): | 1188 def wlock(self, wait=True): |
1189 '''Lock the non-store parts of the repository (everything under | 1189 '''Lock the non-store parts of the repository (everything under |
1190 .hg except .hg/store) and return a weak reference to the lock. | 1190 .hg except .hg/store) and return a weak reference to the lock. |
1191 Use this before modifying files in .hg.''' | 1191 Use this before modifying files in .hg.''' |
1192 if (self.ui.configbool('devel', 'all') | |
1193 or self.ui.configbool('devel', 'check-locks')): | |
1194 l = self._lockref and self._lockref() | |
1195 if l is not None and l.held: | |
1196 msg = '"lock" taken before "wlock"\n' | |
1197 if self.ui.tracebackflag: | |
1198 util.debugstacktrace(msg, 1) | |
1199 else: | |
1200 self.ui.write_err(msg) | |
1192 l = self._wlockref and self._wlockref() | 1201 l = self._wlockref and self._wlockref() |
1193 if l is not None and l.held: | 1202 if l is not None and l.held: |
1194 l.lock() | 1203 l.lock() |
1195 return l | 1204 return l |
1196 | 1205 |