~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Robert Collins
  • Date: 2005-10-17 21:57:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1462.
  • Revision ID: robertc@robertcollins.net-20051017215732-08f487800e726748
Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
                           )
80
80
import bzrlib.gpg as gpg
81
81
from bzrlib.revision import Revision
 
82
from bzrlib.testament import Testament
82
83
from bzrlib.trace import mutter, note, warning
83
84
from bzrlib.xml5 import serializer_v5
84
85
from bzrlib.inventory import Inventory, ROOT_ID
321
322
        rev_tmp = StringIO()
322
323
        serializer_v5.write_revision(self.rev, rev_tmp)
323
324
        rev_tmp.seek(0)
 
325
        if self.config.signature_needed():
 
326
            plaintext = Testament(self.rev, self.new_inv).as_short_text()
 
327
            self.branch.store_revision_signature(gpg.GPGStrategy(self.config),
 
328
                                                 plaintext, self.rev_id)
324
329
        self.branch.revision_store.add(rev_tmp, self.rev_id)
325
 
        if self.config.signature_needed():
326
 
            self.branch.sign_revision(self.rev_id, gpg.GPGStrategy(self.config))
327
330
        mutter('new revision_id is {%s}', self.rev_id)
328
331
 
329
332
    def _remove_deleted(self):