~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2006-06-13 02:51:47 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20060613025147-9aa190f7d67fd0d7
Use get_utf8 and put_utf8 instead of controlfilename

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    return not delta.has_changed(), non_source
69
69
 
70
70
def set_push_data(tree, location):
71
 
    push_file = file (tree.branch.control_files.controlfilename("x-push-data"), "wb")
72
 
    push_file.write("%s\n" % location)
 
71
    tree.branch.control_files.put_utf8("x-push-data", "%s\n" % location)
73
72
 
74
73
def get_push_data(tree):
75
74
    """
78
77
    True
79
78
    >>> set_push_data(tree, 'http://somewhere')
80
79
    >>> get_push_data(tree)
81
 
    'http://somewhere'
 
80
    u'http://somewhere'
82
81
    >>> rm_tree(tree)
83
82
    """
84
 
    filename = tree.branch.control_files.controlfilename("x-push-data")
85
 
    if not os.path.exists(filename):
 
83
    try:
 
84
        location = tree.branch.control_files.get_utf8('x-push-data').read()
 
85
    except NoSuchFile:
86
86
        return None
87
 
    push_file = file (filename, "rb")
88
 
    (location,) = [f.rstrip('\n') for f in push_file]
89
 
    return location
 
87
    return location.rstrip('\n')
90
88
 
91
89
"""
92
90
>>> shell_escape('hello')