/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Robert Collins
  • Date: 2007-03-06 10:29:01 UTC
  • mto: (2321.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070306102901-y25mgksdvocjmib8
Make the nested tree commit smoke test be more rigourous.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
               local=False,
174
174
               reporter=None,
175
175
               config=None,
176
 
               message_callback=None):
 
176
               message_callback=None,
 
177
               recursive='down'):
177
178
        """Commit working copy as a new revision.
178
179
 
179
180
        branch -- the deprecated branch to commit to. New callers should pass in 
200
201
 
201
202
        revprops -- Properties for new revision
202
203
        :param local: Perform a local only commit.
 
204
        :param recursive: If set to 'down', commit in any subtrees that have
 
205
            pending changes of any sort during this commit.
203
206
        """
204
207
        mutter('preparing to commit')
205
208
 
233
236
        self.rev_id = None
234
237
        self.specific_files = specific_files
235
238
        self.allow_pointless = allow_pointless
 
239
        self.recursive = recursive
 
240
        self.revprops = revprops
 
241
        self.message_callback = message_callback
 
242
        self.timestamp = timestamp
 
243
        self.timezone = timezone
 
244
        self.committer = committer
 
245
        self.specific_files = specific_files
 
246
        self.strict = strict
 
247
        self.verbose = verbose
 
248
        self.local = local
236
249
 
237
250
        if reporter is None and self.reporter is None:
238
251
            self.reporter = NullCommitReporter()
282
295
            if specific_files is not None:
283
296
                # Ensure specified files are versioned
284
297
                # (We don't actually need the ids here)
285
 
                tree.find_ids_across_trees(specific_files, 
 
298
                # XXX: Dont we have filter_unversioned to do this more
 
299
                # cheaply?
 
300
                tree.find_ids_across_trees(specific_files,
286
301
                                           [self.basis_tree, self.work_tree])
287
302
            # one to finish, one for rev and inventory, and one for each
288
303
            # inventory entry, and the same for the new inventory.
297
312
                raise NotImplementedError('selected-file commit of merges is not supported yet: files %r',
298
313
                        self.specific_files)
299
314
            
300
 
            self.builder = self.branch.get_commit_builder(self.parents, 
 
315
            self.builder = self.branch.get_commit_builder(self.parents,
301
316
                self.config, timestamp, timezone, committer, revprops, rev_id)
302
317
            
303
318
            self._remove_deleted()
593
608
            file_id = new_ie.file_id
594
609
            try:
595
610
                kind = self.work_tree.kind(file_id)
 
611
                if kind == 'tree-reference' and self.recursive == 'down':
 
612
                    # nested tree: commit in it
 
613
                    sub_tree = WorkingTree.open(self.work_tree.abspath(path))
 
614
                    # FIXME: be more comprehensive here:
 
615
                    # this works when both trees are in --trees repository,
 
616
                    # but when both are bound to a different repository,
 
617
                    # it fails; a better way of approaching this is to 
 
618
                    # finally implement the explicit-caches approach design
 
619
                    # a while back - RBC 20070306.
 
620
                    if (sub_tree.branch.repository.bzrdir.root_transport.base
 
621
                        ==
 
622
                        self.work_tree.branch.repository.bzrdir.root_transport.base):
 
623
                        sub_tree.branch.repository = \
 
624
                            self.work_tree.branch.repository
 
625
                    try:
 
626
                        sub_tree.commit(message=None, revprops=self.revprops,
 
627
                            recursive=self.recursive,
 
628
                            message_callback=self.message_callback,
 
629
                            timestamp=self.timestamp, timezone=self.timezone,
 
630
                            committer=self.committer,
 
631
                            allow_pointless=self.allow_pointless,
 
632
                            strict=self.strict, verbose=self.verbose,
 
633
                            local=self.local, reporter=self.reporter)
 
634
                    except errors.PointlessCommit:
 
635
                        pass
596
636
                if kind != new_ie.kind:
597
637
                    new_ie = inventory.make_entry(kind, new_ie.name,
598
638
                                                  new_ie.parent_id, file_id)