~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Aaron Bentley
  • Date: 2005-10-18 19:47:04 UTC
  • mfrom: (1460)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1474.
  • Revision ID: abentley@panoramicfeedback.com-20051018194704-47d6827cc1d0d11b
Merged more config stuff from Robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
                           HistoryMissing,
78
78
                           ConflictsInTree
79
79
                           )
 
80
import bzrlib.gpg as gpg
80
81
from bzrlib.revision import Revision
81
82
from bzrlib.trace import mutter, note, warning
82
83
from bzrlib.xml5 import serializer_v5
145
146
            working inventory.
146
147
    """
147
148
    def __init__(self,
148
 
                 reporter=None):
 
149
                 reporter=None,
 
150
                 config=None):
149
151
        if reporter is not None:
150
152
            self.reporter = reporter
151
153
        else:
152
154
            self.reporter = NullCommitReporter()
153
 
 
 
155
        if config is not None:
 
156
            self.config = config
 
157
        else:
 
158
            self.config = None
154
159
        
155
160
    def commit(self,
156
161
               branch, message,
194
199
        else:
195
200
            self.timestamp = long(timestamp)
196
201
            
197
 
        config = bzrlib.config.BranchConfig(self.branch)
 
202
        if self.config is None:
 
203
            self.config = bzrlib.config.BranchConfig(self.branch)
 
204
 
198
205
        if rev_id is None:
199
 
            self.rev_id = _gen_revision_id(config, self.timestamp)
 
206
            self.rev_id = _gen_revision_id(self.config, self.timestamp)
200
207
        else:
201
208
            self.rev_id = rev_id
202
209
 
203
210
        if committer is None:
204
 
            self.committer = config.username()
 
211
            self.committer = self.config.username()
205
212
        else:
206
213
            assert isinstance(committer, basestring), type(committer)
207
214
            self.committer = committer
315
322
        serializer_v5.write_revision(self.rev, rev_tmp)
316
323
        rev_tmp.seek(0)
317
324
        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))
318
327
        mutter('new revision_id is {%s}', self.rev_id)
319
328
 
320
329
    def _remove_deleted(self):