Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Mar 18 20:59:06 2015 -0700 +++ b/mercurial/localrepo.py Fri Jan 16 02:51:10 2015 -0800 @@ -1189,6 +1189,15 @@ '''Lock the non-store parts of the repository (everything under .hg except .hg/store) and return a weak reference to the lock. Use this before modifying files in .hg.''' + if (self.ui.configbool('devel', 'all') + or self.ui.configbool('devel', 'check-locks')): + l = self._lockref and self._lockref() + if l is not None and l.held: + msg = '"lock" taken before "wlock"\n' + if self.ui.tracebackflag: + util.debugstacktrace(msg, 1) + else: + self.ui.write_err(msg) l = self._wlockref and self._wlockref() if l is not None and l.held: l.lock()