~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2009-03-11 01:19:53 UTC
  • Revision ID: aaron@aaronbentley.com-20090311011953-2xgksl6krrs1yb4d
bzr patch handles URLs with trailing slashes

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    return not delta.has_changed(), non_source
66
66
 
67
67
def set_push_data(tree, location):
68
 
    tree.branch.control_files.put_utf8("x-push-data", "%s\n" % location)
 
68
    tree.branch._transport.put_bytes("x-push-data", "%s\n" % location)
69
69
 
70
70
def get_push_data(tree):
71
71
    """
78
78
    >>> rm_tree(tree)
79
79
    """
80
80
    try:
81
 
        location = tree.branch.control_files.get_utf8('x-push-data').read()
 
81
        location = tree.branch._transport.get('x-push-data').read()
82
82
    except NoSuchFile:
83
83
        return None
 
84
    location = location.decode('utf-8')
84
85
    return location.rstrip('\n')
85
86
 
86
87
"""
201
202
 
202
203
class NotStandalone(BzrError):
203
204
 
204
 
    _format = '%(location) is not a standalone tree.'
 
205
    _fmt = '%(location)s is not a standalone tree.'
205
206
    _internal = False
206
207
 
207
208
    def __init__(self, location):
407
408
def open_from_url(location):
408
409
    location = urlutils.normalize_url(location)
409
410
    dirname, basename = urlutils.split(location)
 
411
    if location.endswith('/') and not basename.endswith('/'):
 
412
        basename += '/'
410
413
    return get_transport(dirname).get(basename)
411
414
 
412
415