~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:31:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051017113105-76c3855778da1baa
gpg sign commits if the policy says we need to

Show diffs side-by-side

added added

removed removed

Lines of Context:
1497
1497
        b = Branch.open_containing('.')
1498
1498
        gpg_strategy = gpg.GPGStrategy(config.BranchConfig(b))
1499
1499
        if revision_id is not None:
1500
 
            self.sign_one(gpg_strategy, b, revision_id)
 
1500
            b.sign_revision(revision_id, gpg_strategy)
1501
1501
        elif revision is not None:
1502
1502
            for rev in revision:
1503
1503
                if rev is None:
1504
1504
                    raise BzrCommandError('You cannot specify a NULL revision.')
1505
1505
                revno, rev_id = rev.in_history(b)
1506
 
                self.sign_one(gpg_strategy, b, rev_id)
1507
 
 
1508
 
    def sign_one(self, gpg_strategy, b, revision_id):
1509
 
        import bzrlib.testament as testament
1510
 
        from cStringIO import StringIO
1511
 
        plaintext = testament.Testament.from_revision(b, revision_id).as_short_text()
1512
 
        b.revision_store.add(StringIO(gpg_strategy.sign(plaintext)), revision_id, "sig")
1513
 
    
 
1506
                b.sign_revision(rev_id, gpg_strategy)
1514
1507
 
1515
1508
 
1516
1509
# these get imported and then picked up by the scan for cmd_*