~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-05 11:53:56 UTC
  • mfrom: (5753.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20110405115356-5d6k2moisuap7bi6
(jam) Merge 2.3 into bzr.dev, resolving some conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
537
537
            hook(hook_result)
538
538
        return result
539
539
 
 
540
    def lock_url_for_display(self):
 
541
        """Give a nicely-printable representation of the URL of this lock."""
 
542
        # As local lock urls are correct we display them.
 
543
        # We avoid displaying remote lock urls.
 
544
        lock_url = self.transport.abspath(self.path)
 
545
        if lock_url.startswith('file://'):
 
546
            lock_url = lock_url.split('.bzr/')[0]
 
547
        else:
 
548
            lock_url = ''
 
549
        return lock_url
 
550
 
540
551
    def wait_lock(self, timeout=None, poll=None, max_attempts=None):
541
552
        """Wait a certain period for a lock.
542
553
 
566
577
        deadline_str = None
567
578
        last_info = None
568
579
        attempt_count = 0
 
580
        lock_url = self.lock_url_for_display()
569
581
        while True:
570
582
            attempt_count += 1
571
583
            try:
590
602
                if deadline_str is None:
591
603
                    deadline_str = time.strftime('%H:%M:%S',
592
604
                                                 time.localtime(deadline))
593
 
                # As local lock urls are correct we display them.
594
 
                # We avoid displaying remote lock urls.
595
 
                lock_url = self.transport.abspath(self.path)
596
 
                if lock_url.startswith('file://'):
597
 
                    lock_url = lock_url.split('.bzr/')[0]
598
 
                else:
599
 
                    lock_url = ''
600
605
                user, hostname, pid, time_ago = formatted_info
601
606
                msg = ('%s lock %s '        # lock_url
602
607
                    'held by '              # start