~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-23 19:08:05 UTC
  • mfrom: (6437.3.20 2.5)
  • mto: This revision was merged to the branch mainline in revision 6450.
  • Revision ID: jelmer@samba.org-20120123190805-hlcuihkt2dep44cw
merge bzr 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
# The newly committed revision is going to have a shape corresponding
19
20
# to that of the working tree.  Files that are not in the
165
166
    """
166
167
    def __init__(self,
167
168
                 reporter=None,
168
 
                 config=None):
 
169
                 config_stack=None):
169
170
        """Create a Commit object.
170
171
 
171
172
        :param reporter: the default reporter to use or None to decide later
172
173
        """
173
174
        self.reporter = reporter
174
 
        self.config = config
 
175
        self.config_stack = config_stack
175
176
 
176
177
    @staticmethod
177
178
    def update_revprops(revprops, branch, authors=None, author=None,
268
269
        operation = OperationWithCleanups(self._commit)
269
270
        self.revprops = revprops or {}
270
271
        # XXX: Can be set on __init__ or passed in - this is a bit ugly.
271
 
        self.config = config or self.config
 
272
        self.config_stack = config or self.config_stack
272
273
        return operation.run(
273
274
               message=message,
274
275
               timestamp=timestamp,
370
371
            self.reporter = reporter
371
372
        elif self.reporter is None:
372
373
            self.reporter = self._select_reporter()
373
 
        if self.config is None:
374
 
            self.config = self.branch.get_config()
 
374
        if self.config_stack is None:
 
375
            self.config_stack = self.branch.get_config_stack()
375
376
 
376
377
        self._set_specific_file_ids()
377
378
 
405
406
        self._set_progress_stage("Collecting changes", counter=True)
406
407
        self._lossy = lossy
407
408
        self.builder = self.branch.get_commit_builder(self.parents,
408
 
            self.config, timestamp, timezone, committer, self.revprops,
 
409
            self.config_stack, timestamp, timezone, committer, self.revprops,
409
410
            rev_id, lossy=lossy)
410
411
        if not self.builder.supports_record_entry_contents and self.exclude:
411
412
            self.builder.abort()
604
605
        # Process the post commit hooks, if any
605
606
        self._set_progress_stage("Running post_commit hooks")
606
607
        # old style commit hooks - should be deprecated ? (obsoleted in
607
 
        # 0.15)
608
 
        if self.config.post_commit() is not None:
609
 
            hooks = self.config.post_commit().split(' ')
 
608
        # 0.15^H^H^H^H 2.5.0)
 
609
        post_commit = self.config_stack.get('post_commit')
 
610
        if post_commit is not None:
 
611
            hooks = post_commit.split(' ')
610
612
            # this would be nicer with twisted.python.reflect.namedAny
611
613
            for hook in hooks:
612
614
                result = eval(hook + '(branch, rev_id)',