~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2006-08-02 03:23:09 UTC
  • mto: This revision was merged to the branch mainline in revision 425.
  • Revision ID: aaron.bentley@utoronto.ca-20060802032309-6ad0139e61304b19
Etienne Goyer: remove unused shebangs, update packaging

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    ([u'foo'], {})
53
53
    >>> is_clean(tree)
54
54
    (False, [])
55
 
    >>> tree.commit("added file")
 
55
    >>> tree.commit("added file", rev_id='commit-id')
 
56
    'commit-id'
56
57
    >>> is_clean(tree)
57
58
    (True, [])
58
59
    >>> rm_tree(tree)
68
69
    return not delta.has_changed(), non_source
69
70
 
70
71
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)
 
72
    tree.branch.control_files.put_utf8("x-push-data", "%s\n" % location)
73
73
 
74
74
def get_push_data(tree):
75
75
    """
78
78
    True
79
79
    >>> set_push_data(tree, 'http://somewhere')
80
80
    >>> get_push_data(tree)
81
 
    'http://somewhere'
 
81
    u'http://somewhere'
82
82
    >>> rm_tree(tree)
83
83
    """
84
 
    filename = tree.branch.control_files.controlfilename("x-push-data")
85
 
    if not os.path.exists(filename):
 
84
    try:
 
85
        location = tree.branch.control_files.get_utf8('x-push-data').read()
 
86
    except NoSuchFile:
86
87
        return None
87
 
    push_file = file (filename, "rb")
88
 
    (location,) = [f.rstrip('\n') for f in push_file]
89
 
    return location
 
88
    return location.rstrip('\n')
90
89
 
91
90
"""
92
91
>>> shell_escape('hello')