/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

Use dictionary with verifiers rather than requiring testament3-sha1 everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    :ivar revision_id: Revision id, as string
27
27
    :ivar properties: Revision properties, as dictionary
28
28
    :ivar explicit_parent_ids: Parent ids (needed if there are ghosts)
29
 
    :ivar testament3_sha1: SHA1 of the testament.
 
29
    :ivar verifiers: Verifier information
30
30
    """
31
31
 
32
32
    revision_id = None
33
33
 
34
34
    explicit_parent_ids = None
35
35
 
36
 
    testament3_sha1 = None
 
36
    verifiers = {}
37
37
 
38
38
    def __init__(self):
39
39
        self.properties = {}
53
53
        elif key == "parent-ids":
54
54
            ret.explicit_parent_ids = tuple(value.strip().split(" "))
55
55
        elif key == "testament3-sha1":
56
 
            ret.testament3_sha1 = value.strip()
 
56
            ret.verifiers["testament3-sha1"] = value.strip()
57
57
        elif key.startswith("property-"):
58
58
            ret.properties[key[len("property-"):]] = value[1:].rstrip("\n")
59
59
        else:
74
74
        lines.append("parent-ids: %s\n" % " ".join(metadata.explicit_parent_ids))
75
75
    for key in sorted(metadata.properties.keys()):
76
76
        lines.append("property-%s: %s\n" % (key.encode(encoding), metadata.properties[key].encode(encoding)))
77
 
    if metadata.testament3_sha1:
78
 
        lines.append("testament3-sha1: %s\n" % metadata.testament3_sha1)
 
77
    if "testament3-sha1" in metadata.verifiers:
 
78
        lines.append("testament3-sha1: %s\n" %
 
79
                     metadata.verifiers["testament3-sha1"])
79
80
    return "".join(lines)
80
81
 
81
82