/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 bzrlib/revision.py

  • Committer: Martin Pool
  • Date: 2005-06-17 10:10:09 UTC
  • Revision ID: mbp@sourcefrog.net-20050617101009-a4b0cd00f0db611f
- write out parent list for new revisions
- don't assign to the Revision.precursor property in commit but rather
  store parents

  This is done in a way that should support old clients; the precursor
  property is still present

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    written out.  This is not stored because you cannot write the hash
59
59
    into the file it describes.
60
60
 
61
 
    TODO: Perhaps make precursor be a child element, not an attribute?
 
61
    After bzr 0.0.5 revisions are allowed to have multiple parents.
 
62
    To support old clients this is written out in a slightly redundant
 
63
    form: the first parent as the predecessor.  This will eventually
 
64
    be dropped.
62
65
 
63
66
    parents
64
67
        List of parent revisions; 
92
95
        else:
93
96
            return None    
94
97
 
95
 
    precursor = property(_get_precursor)
96
 
    precursor_sha1 = property(_get_precursor_sha1)
 
98
 
 
99
    def _fail(self):
 
100
        raise Exception("can't assign to precursor anymore")
 
101
 
 
102
 
 
103
    precursor = property(_get_precursor, _fail, _fail)
 
104
    precursor_sha1 = property(_get_precursor_sha1, _fail, _fail)
 
105
 
97
106
 
98
107
 
99
108
    def __repr__(self):
120
129
        msg.text = self.message
121
130
        msg.tail = '\n'
122
131
 
 
132
        if self.parents:
 
133
            pelts = SubElement(root, 'parents')
 
134
            for rr in self.parents:
 
135
                assert isinstance(rr, RevisionReference)
 
136
                p = SubElement(pelts, 'revision_ref')
 
137
                p.set('revision_id', rr.revision_id)
 
138
                if rr.revision_sha1:
 
139
                    p.set('revision_sha1', rr.revision_sha1)
 
140
 
123
141
        return root
124
142
 
125
143
 
155
173
        rev.parents.append(rev_ref)
156
174
    elif pelts:
157
175
        for p in pelts:
158
 
            assert p.tag == 'revisionref', \
 
176
            assert p.tag == 'revision_ref', \
159
177
                   "bad parent node tag %r" % p.tag
160
178
            rev_ref = RevisionReference(p.get('revision_id'),
161
179
                                        p.get('revision_sha1'))