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

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 03:10:29 UTC
  • mfrom: (7312 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190603031029-b34je03bjulxxdwj
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
unquote = urlparse.unquote
163
163
 
164
164
 
165
 
def escape(relpath):
 
165
def escape(relpath, safe='/~'):
166
166
    """Escape relpath to be a valid url."""
167
167
    if not isinstance(relpath, str) and sys.version_info[0] == 2:
168
168
        relpath = relpath.encode('utf-8')
169
 
    return quote(relpath, safe='/~')
 
169
    return quote(relpath, safe=safe)
170
170
 
171
171
 
172
172
def file_relpath(base, path):
561
561
    (base_url, subsegments) = split_segment_parameters_raw(url)
562
562
    parameters = {}
563
563
    for subsegment in subsegments:
564
 
        (key, value) = subsegment.split("=", 1)
 
564
        try:
 
565
            (key, value) = subsegment.split("=", 1)
 
566
        except ValueError:
 
567
            raise InvalidURL(url, "missing = in subsegment")
565
568
        if not isinstance(key, str):
566
569
            raise TypeError(key)
567
570
        if not isinstance(value, str):