/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/location.py

  • Committer: Jelmer Vernooij
  • Date: 2020-08-10 15:00:17 UTC
  • mfrom: (7490.40.99 work)
  • mto: This revision was merged to the branch mainline in revision 7521.
  • Revision ID: jelmer@jelmer.uk-20200810150017-vs7xnrd1vat4iktg
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""UI location string handling."""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
import re
23
21
 
24
22
from . import (
25
23
    urlutils,
26
24
    )
27
25
from .hooks import Hooks
28
 
from .sixish import (
29
 
    PY3,
30
 
    string_types,
31
 
    )
32
26
 
33
27
 
34
28
class LocationHooks(Hooks):
122
116
    :raise InvalidURL: If the location is already a URL, but not valid.
123
117
    :return: Byte string with resulting URL
124
118
    """
125
 
    if not isinstance(location, string_types):
 
119
    if not isinstance(location, str):
126
120
        raise AssertionError("location not a byte or unicode string")
127
121
 
128
122
    if location.startswith(':pserver:'):
140
134
                path=location, extra='URLs must be properly escaped')
141
135
        location = urlutils.local_path_to_url(location)
142
136
    else:
143
 
        if PY3:
144
 
            location = location.decode('ascii')
 
137
        location = location.decode('ascii')
145
138
 
146
139
    if location.startswith("file:") and not location.startswith("file://"):
147
140
        return urlutils.join(urlutils.local_path_to_url("."), location[5:])