/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 roundtrip.py

Avoid invoking git directly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    return ret
57
57
 
58
58
 
59
 
def generate_roundtripping_metadata(metadata):
 
59
def generate_roundtripping_metadata(metadata, encoding):
60
60
    """Serialize the roundtripping metadata.
61
61
 
62
62
    :param metadata: A `BzrGitRevisionMetadata` instance
68
68
    if metadata.explicit_parent_ids:
69
69
        lines.append("parent-ids: %s\n" % " ".join(metadata.explicit_parent_ids))
70
70
    for key in sorted(metadata.properties.keys()):
71
 
        lines.append("property-%s: %s\n" % (key, metadata.properties[key]))
 
71
        lines.append("property-%s: %s\n" % (key.encode(encoding), metadata.properties[key].encode(encoding)))
72
72
    return "".join(lines)
73
73
 
74
74
 
84
84
    return split[0], parse_roundtripping_metadata(split[1])
85
85
 
86
86
 
87
 
def inject_bzr_metadata(message, metadata):
 
87
def inject_bzr_metadata(message, metadata, encoding):
88
88
    if not metadata:
89
89
        return message
90
 
    return message + "\n--BZR--\n" + generate_roundtripping_metadata(metadata)
 
90
    rt_data = generate_roundtripping_metadata(metadata, encoding)
 
91
    assert type(rt_data) == str
 
92
    return message + "\n--BZR--\n" + rt_data
91
93
 
92
94
 
93
95
def serialize_fileid_map(file_ids):