~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/urlutils.py

(gz) Avoid using URL specific join and split when seperating segment
 parameters (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
441
441
    :param url: A relative or absolute URL
442
442
    :return: (url, subsegments)
443
443
    """
444
 
    (parent_url, child_dir) = split(url)
445
 
    subsegments = child_dir.split(",")
446
 
    if len(subsegments) == 1:
 
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:
447
451
        return (url, [])
448
 
    return (join(parent_url, subsegments[0]), subsegments[1:])
 
452
    return (lurl[:segment_start], lurl[segment_start+1:].split(","))
449
453
 
450
454
 
451
455
def split_segment_parameters(url):