contrib/lock-checker.py
changeset 20244 47d0843647d1
parent 17738 b8424c92ba2b
--- a/contrib/lock-checker.py	Tue Jan 07 22:29:57 2014 +0100
+++ b/contrib/lock-checker.py	Sun Jan 12 23:28:21 2014 +0100
@@ -7,21 +7,12 @@
 This currently only checks store locks, not working copy locks.
 """
 import os
-import traceback
-
-def _warnstack(ui, msg, skip=1):
-    '''issue warning with the message and the current stack, skipping the
-    skip last entries'''
-    ui.warn('%s at:\n' % msg)
-    entries = traceback.extract_stack()[:-skip]
-    fnmax = max(len(entry[0]) for entry in entries)
-    for fn, ln, func, _text in entries:
-        ui.warn(' %*s:%-4s in %s\n' % (fnmax, fn, ln, func))
+from mercurial import util
 
 def _checklock(repo):
     l = repo._lockref and repo._lockref()
     if l is None or not l.held:
-        _warnstack(repo.ui, 'missing lock', skip=2)
+        util.debugstacktrace('missing lock', skip=1)
 
 def reposetup(ui, repo):
     orig = repo.__class__