~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
        # incorrect.  It's possible some other servers or filesystems will
243
243
        # have a similar bug allowing someone to think they got the lock
244
244
        # when it's already held.
 
245
        #
 
246
        # See <https://bugs.edge.launchpad.net/bzr/+bug/498378> for one case.
 
247
        #
 
248
        # Strictly the check is unnecessary and a waste of time for most
 
249
        # people, but probably worth trapping if something is wrong.
245
250
        info = self.peek()
246
251
        self._trace("after locking, info=%r", info)
 
252
        if info is None:
 
253
            raise LockFailed(self, "lock was renamed into place, but "
 
254
                "now is missing!")
247
255
        if info['nonce'] != self.nonce:
248
256
            self._trace("rename succeeded, "
249
257
                "but lock is still held by someone else")
526
534
                    deadline_str = time.strftime('%H:%M:%S',
527
535
                                                 time.localtime(deadline))
528
536
                lock_url = self.transport.abspath(self.path)
 
537
                # See <https://bugs.edge.launchpad.net/bzr/+bug/250451>
 
538
                # the URL here is sometimes not one that is useful to the
 
539
                # user, perhaps being wrapped in a lp-%d or chroot decorator,
 
540
                # especially if this error is issued from the server.
529
541
                self._report_function('%s %s\n'
530
 
                                      '%s\n' # held by
531
 
                                      '%s\n' # locked ... ago
532
 
                                      'Will continue to try until %s, unless '
533
 
                                      'you press Ctrl-C\n'
534
 
                                      'If you\'re sure that it\'s not being '
535
 
                                      'modified, use bzr break-lock %s',
536
 
                                      start,
537
 
                                      formatted_info[0],
538
 
                                      formatted_info[1],
539
 
                                      formatted_info[2],
540
 
                                      deadline_str,
541
 
                                      lock_url)
 
542
                    '%s\n' # held by
 
543
                    '%s\n' # locked ... ago
 
544
                    'Will continue to try until %s, unless '
 
545
                    'you press Ctrl-C.\n'
 
546
                    'See "bzr help break-lock" for more.',
 
547
                    start,
 
548
                    formatted_info[0],
 
549
                    formatted_info[1],
 
550
                    formatted_info[2],
 
551
                    deadline_str,
 
552
                    )
542
553
 
543
554
            if (max_attempts is not None) and (attempt_count >= max_attempts):
544
555
                self._trace("exceeded %d attempts")