~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/urlutils.py

(jelmer) Allow tree implementations to not support kind changes.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        raise ValueError('Length of base (%r) must equal or'
79
79
            ' exceed the platform minimum url length (which is %d)' %
80
80
            (base, MIN_ABS_FILEURL_LENGTH))
81
 
    base = osutils.normpath(local_path_from_url(base))
82
 
    path = osutils.normpath(local_path_from_url(path))
 
81
    base = local_path_from_url(base)
 
82
    path = local_path_from_url(path)
83
83
    return escape(osutils.relpath(base, path))
84
84
 
85
85
 
441
441
    :param url: A relative or absolute URL
442
442
    :return: (url, subsegments)
443
443
    """
444
 
    # GZ 2011-11-18: Dodgy removing the terminal slash like this, function
445
 
    #                operates on urls not url+segments, and Transport classes
446
 
    #                should not be blindly adding slashes in the first place. 
447
 
    lurl = strip_trailing_slash(url)
448
 
    # Segments begin at first comma after last forward slash, if one exists
449
 
    segment_start = lurl.find(",", lurl.rfind("/")+1)
450
 
    if segment_start == -1:
 
444
    (parent_url, child_dir) = split(url)
 
445
    subsegments = child_dir.split(",")
 
446
    if len(subsegments) == 1:
451
447
        return (url, [])
452
 
    return (lurl[:segment_start], lurl[segment_start+1:].split(","))
 
448
    return (join(parent_url, subsegments[0]), subsegments[1:])
453
449
 
454
450
 
455
451
def split_segment_parameters(url):
754
750
        else:
755
751
            self.password = None
756
752
        self.port = port
757
 
        self.quoted_path = _url_hex_escapes_re.sub(_unescape_safe_chars, quoted_path)
 
753
        self.quoted_path = quoted_path
758
754
        self.path = urllib.unquote(self.quoted_path)
759
755
 
760
756
    def __eq__(self, other):
839
835
        """
840
836
        if not isinstance(relpath, str):
841
837
            raise errors.InvalidURL(relpath)
842
 
        relpath = _url_hex_escapes_re.sub(_unescape_safe_chars, relpath)
843
838
        if relpath.startswith('/'):
844
839
            base_parts = []
845
840
        else:
871
866
        if offset is not None:
872
867
            relative = unescape(offset).encode('utf-8')
873
868
            path = self._combine_paths(self.path, relative)
874
 
            path = urllib.quote(path, safe="/~")
 
869
            path = urllib.quote(path)
875
870
        else:
876
871
            path = self.quoted_path
877
872
        return self.__class__(self.scheme, self.quoted_user,