/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/lockdir.py

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
but helps protect against colliding host names.
99
99
"""
100
100
 
 
101
from __future__ import absolute_import
 
102
 
101
103
 
102
104
# TODO: We sometimes have the problem that our attempt to rename '1234' to
103
105
# 'held' fails because the transport server moves into an existing directory,
137
139
    )
138
140
from .i18n import gettext
139
141
from .osutils import format_delta, rand_chars, get_host_name
 
142
from .sixish import (
 
143
    PY3,
 
144
    text_type,
 
145
    )
140
146
from .trace import mutter, note
141
147
 
142
148
 
296
302
                    ui.ui_factory.show_user_warning(
297
303
                        'locks_steal_dead',
298
304
                        lock_url=urlutils.join(self.transport.base, self.path),
299
 
                        other_holder_info=str(other_holder))
 
305
                        other_holder_info=text_type(other_holder))
300
306
                    self.force_break(other_holder)
301
307
                    self._trace("stole lock from dead holder")
302
308
                    return
400
406
            if ui.ui_factory.confirm_action(
401
407
                u"Break %(lock_info)s",
402
408
                'breezy.lockdir.break',
403
 
                    dict(lock_info=str(holder_info))):
 
409
                    dict(lock_info=text_type(holder_info))):
404
410
                result = self.force_break(holder_info)
405
411
                ui.ui_factory.show_message(
406
412
                    "Broke lock %s" % result.lock_url)
724
730
        """Return a debugging representation of this object."""
725
731
        return "%s(%r)" % (self.__class__.__name__, self.info_dict)
726
732
 
727
 
    def __str__(self):
 
733
    def __unicode__(self):
728
734
        """Return a user-oriented description of this object."""
729
735
        d = self.to_readable_dict()
730
736
        return (gettext(
731
737
            u'held by %(user)s on %(hostname)s (process #%(pid)s), '
732
738
            u'acquired %(time_ago)s') % d)
733
739
 
 
740
    if PY3:
 
741
        __str__ = __unicode__
 
742
 
734
743
    def to_readable_dict(self):
735
744
        """Turn the holder info into a dict of human-readable attributes.
736
745