~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: Mark Hammond
  • Date: 2008-08-16 04:00:54 UTC
  • mto: This revision was merged to the branch mainline in revision 3686.
  • Revision ID: mhammond@skippinet.com.au-20080816040054-7ptlmd3zbmxf9yig
Add osutils.get_host_name() to return a unicode hostname to prevent
non-ascii host names from causing Unicode error.  Fixes bzr/+bug/256550

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        )
129
129
from bzrlib.trace import mutter, note
130
130
from bzrlib.transport import Transport
131
 
from bzrlib.osutils import rand_chars, format_delta
 
131
from bzrlib.osutils import rand_chars, format_delta, get_host_name
132
132
from bzrlib.rio import read_stanza, Stanza
133
133
import bzrlib.ui
134
134
 
422
422
    def _prepare_info(self):
423
423
        """Write information about a pending lock to a temporary file.
424
424
        """
425
 
        import socket
426
425
        # XXX: is creating this here inefficient?
427
426
        config = bzrlib.config.GlobalConfig()
428
427
        try:
429
428
            user = config.user_email()
430
429
        except errors.NoEmailInUsername:
431
430
            user = config.username()
432
 
        s = Stanza(hostname=socket.gethostname(),
 
431
        s = Stanza(hostname=get_host_name(),
433
432
                   pid=str(os.getpid()),
434
433
                   start_time=str(int(time.time())),
435
434
                   nonce=self.nonce,