comparison mercurial/localrepo.py @ 29883:0c8c388c7d62

lock: show more detail for new-style locks in lock waiting message (issue4752) Improve the lock waiting warning message by explicitly saying that a host and process are holding the lock. This nudges confused new users in the direction of investigating the other process instead of removing the lock.
author Mark Ignacio <mignacio@fb.com>
date Tue, 30 Aug 2016 09:25:00 -0700
parents 93b44aa17691
children d9c49138ab93
comparison
equal deleted inserted replaced
29882:307b20e5e505 29883:0c8c388c7d62
1288 inheritchecker=inheritchecker, 1288 inheritchecker=inheritchecker,
1289 parentlock=parentlock) 1289 parentlock=parentlock)
1290 except error.LockHeld as inst: 1290 except error.LockHeld as inst:
1291 if not wait: 1291 if not wait:
1292 raise 1292 raise
1293 self.ui.warn(_("waiting for lock on %s held by %r\n") % 1293 # show more details for new-style locks
1294 (desc, inst.locker)) 1294 if ':' in inst.locker:
1295 host, pid = inst.locker.split(":", 1)
1296 self.ui.warn(
1297 _("waiting for lock on %s held by process %r "
1298 "on host %r\n") % (desc, pid, host))
1299 else:
1300 self.ui.warn(_("waiting for lock on %s held by %r\n") %
1301 (desc, inst.locker))
1295 # default to 600 seconds timeout 1302 # default to 600 seconds timeout
1296 l = lockmod.lock(vfs, lockname, 1303 l = lockmod.lock(vfs, lockname,
1297 int(self.ui.config("ui", "timeout", "600")), 1304 int(self.ui.config("ui", "timeout", "600")),
1298 releasefn=releasefn, acquirefn=acquirefn, 1305 releasefn=releasefn, acquirefn=acquirefn,
1299 desc=desc) 1306 desc=desc)