~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-05 01:12:15 UTC
  • mto: This revision was merged to the branch mainline in revision 5757.
  • Revision ID: jelmer@samba.org-20110405011215-8g6izwf3uz8v4174
Remove some unnecessary imports, clean up lazy imports.

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
 
 
551
540
    def wait_lock(self, timeout=None, poll=None, max_attempts=None):
552
541
        """Wait a certain period for a lock.
553
542
 
577
566
        deadline_str = None
578
567
        last_info = None
579
568
        attempt_count = 0
580
 
        lock_url = self.lock_url_for_display()
581
569
        while True:
582
570
            attempt_count += 1
583
571
            try:
602
590
                if deadline_str is None:
603
591
                    deadline_str = time.strftime('%H:%M:%S',
604
592
                                                 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 = ''
605
600
                user, hostname, pid, time_ago = formatted_info
606
601
                msg = ('%s lock %s '        # lock_url
607
602
                    'held by '              # start