/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 bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-27 14:32:33 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060427143233-f06f529f5421a6eb
cmd_push should use URLs throughout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
    """Escape relpath to be a valid url."""
180
180
    if isinstance(relpath, unicode):
181
181
        relpath = relpath.encode('utf-8')
182
 
    return urllib.quote(relpath)
 
182
    # After quoting and encoding, the path should be perfectly
 
183
    # safe as a plain ASCII string, str() just enforces this
 
184
    return str(urllib.quote(relpath))
183
185
 
184
186
 
185
187
def urlunescape(url):
731
733
def urlrelpath(base, path):
732
734
    """Compute just the relative sub-portion of a url
733
735
    
734
 
    This assumes that both paths are already fully specified URLs.
 
736
    This assumes that both paths are already fully specified file:// URLs.
735
737
    """
736
738
    assert len(base) >= MIN_ABS_URLPATHLENGTH, ('Length of base must be equal or'
737
739
        ' exceed the platform minimum url length (which is %d)' % 
739
741
 
740
742
    base = local_path_from_url(base)
741
743
    path = local_path_from_url(path)
742
 
    return relpath(base, path)
 
744
    return urlescape(relpath(base, path))
743
745
 
744
746
 
745
747
def safe_unicode(unicode_or_utf8_string):