--- 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()