Comments
Patch
@@ -156,7 +156,8 @@ def callcatch(ui, func):
reason = _('lock held by %r') % inst.locker
ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
if not inst.locker:
- ui.warn(_("(lock might be very busy)\n"))
+ ui.warn(_("(lock might be very busy, or corrupted;"
+ " use 'hg debuglocks' to check corruption)\n"))
except error.LockUnavailable as inst:
ui.warn(_("abort: could not lock %s: %s\n") %
(inst.desc or inst.filename, inst.strerror))
@@ -64,6 +64,12 @@ Test handling lock corruption
lock: free
wlock: free
+ $ cat >> .hg/hgrc <<EOF
+ > [ui]
+ > # for immediate timeout
+ > timeout = 0
+ > EOF
+
(emulate lock corruption by empty file)
$ printf '' > .hg/wlock
@@ -72,3 +78,33 @@ Test handling lock corruption
lock: free
wlock: user *, but lock might be corrupted (*s) (glob)
[1]
+
+ $ echo foo > foo
+ $ hg add foo
+ waiting for lock on working directory of $TESTTMP/t2 held by '' (glob)
+ abort: working directory of $TESTTMP/t2: timed out waiting for lock held by '' (glob)
+ (lock might be very busy, or corrupted; use 'hg debuglocks' to check corruption)
+ [255]
+
+(check still corrupted)
+
+ $ hg debuglocks
+ lock: free
+ wlock: user *, but lock might be corrupted (*s) (glob)
+ [1]
+
+(check normal waiting/timedout messages for safety, too)
+
+ $ printf '1234' > .hg/wlock
+
+ $ hg add foo
+ waiting for lock on working directory of $TESTTMP/t2 held by '1234' (glob)
+ abort: working directory of $TESTTMP/t2: timed out waiting for lock held by '1234' (glob)
+ [255]
+
+ $ printf 'foobar:1234' > .hg/wlock
+
+ $ hg add foo
+ waiting for lock on working directory of $TESTTMP/t2 held by process '1234' on host 'foobar' (glob)
+ abort: working directory of $TESTTMP/t2: timed out waiting for lock held by 'foobar:1234' (glob)
+ [255]