~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.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:
55
55
 
56
56
    import time, tempfile
57
57
 
58
 
    from osutils import local_time_offset, username
59
 
    
60
 
    from branch import gen_file_id
61
 
    from errors import BzrError
62
 
    from revision import Revision
63
 
    from trace import mutter, note
 
58
    from bzrlib.osutils import local_time_offset, username
 
59
    from bzrlib.branch import gen_file_id
 
60
    from bzrlib.errors import BzrError
 
61
    from bzrlib.revision import Revision, RevisionReference
 
62
    from bzrlib.trace import mutter, note
64
63
 
65
64
    branch.lock_write()
66
65
 
119
118
        # ever actually does anything special
120
119
        inv_sha1 = branch.get_inventory_sha1(inv_id)
121
120
 
122
 
        precursor = branch.last_patch()
123
 
        if precursor:
124
 
            precursor_sha1 = branch.get_revision_sha1(precursor)
 
121
        precursor_id = branch.last_patch()
 
122
        if precursor_id:
 
123
            precursor_sha1 = branch.get_revision_sha1(precursor_id)
125
124
        else:
126
125
            precursor_sha1 = None
 
126
        parent = RevisionReference(precursor_id, precursor_sha1)
127
127
 
128
128
        branch._write_inventory(work_inv)
129
129
 
140
140
        rev = Revision(timestamp=timestamp,
141
141
                       timezone=timezone,
142
142
                       committer=committer,
143
 
                       precursor = precursor,
144
 
                       precursor_sha1 = precursor_sha1,
145
143
                       message = message,
146
144
                       inventory_id=inv_id,
147
145
                       inventory_sha1=inv_sha1,
148
146
                       revision_id=rev_id)
 
147
        rev.parents = [parent]
149
148
 
150
149
        rev_tmp = tempfile.TemporaryFile()
151
150
        rev.write_xml(rev_tmp)