539
539
if deadline_str is None:
540
540
deadline_str = time.strftime('%H:%M:%S',
541
541
time.localtime(deadline))
542
# See <https://bugs.launchpad.net/bzr/+bug/250451>
543
# the URL here is sometimes not one that is useful to the
544
# user, perhaps being wrapped in a lp-%d or chroot decorator,
545
# especially if this error is issued from the server.
546
lock_url, user, hostname, pid, time_ago = formatted_info
547
self._report_function(
548
'%s lock held by ' # start
551
'[process #%s], ' # pid
552
'acquired %s.\n' # time ago
553
'Will continue to try until %s, unless '
554
'you press Ctrl-C.\n'
555
'See "bzr help break-lock" for more.',
542
user, hostname, pid, time_ago = formatted_info
543
msg = ('%s lock held by ' # start
546
'[process #%s], ' # pid
547
'acquired %s.') # time ago
548
msg_args = [start, user, hostname, pid, time_ago]
550
msg += ('\nWill continue to try until %s, unless '
552
msg_args.append(deadline_str)
553
msg += '\nSee "bzr help break-lock" for more.'
554
self._report_function(msg, *msg_args)
564
555
if (max_attempts is not None) and (attempt_count >= max_attempts):
565
556
self._trace("exceeded %d attempts")
566
557
raise LockContention(self)
621
612
def _format_lock_info(self, info):
622
613
"""Turn the contents of peek() into something for the user"""
623
lock_url = self.transport.abspath(self.path)
624
614
start_time = info.get('start_time')
625
615
if start_time is None:
626
616
time_ago = '(unknown)'