~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

(jelmer) Reduce the number of connections made during "bzr branch
 --stacked". (Jelmer Vernooij)

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