mercurial/localrepo.py
changeset 24386 d6ac30f4edef
parent 24383 521cecb4a3f1
child 24388 026f8af88e49
--- 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()