~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Delegate basis inventory calculation during commit to the CommitBuilder object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
283
283
        self.committer = committer
284
284
        self.strict = strict
285
285
        self.verbose = verbose
286
 
        # accumulates an inventory delta to the basis entry, so we can make
287
 
        # just the necessary updates to the workingtree's cached basis.
288
 
        self._basis_delta = []
289
286
 
290
287
        self.work_tree.lock_write()
291
288
        self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
355
352
                self.config, timestamp, timezone, committer, revprops, rev_id)
356
353
            
357
354
            try:
 
355
                self.builder.recording_deletes()
358
356
                # find the location being committed to
359
357
                if self.bound_branch:
360
358
                    master_location = self.master_branch.base
409
407
            # Make the working tree up to date with the branch
410
408
            self._set_progress_stage("Updating the working tree")
411
409
            self.work_tree.update_basis_by_delta(self.rev_id,
412
 
                 self._basis_delta)
 
410
                 self.builder.basis_delta)
413
411
            self.reporter.completed(new_revno, self.rev_id)
414
412
            self._process_post_hooks(old_revno, new_revno)
415
413
        finally:
428
426
        # A merge with no effect on files
429
427
        if len(self.parents) > 1:
430
428
            return
431
 
        # TODO: we could simplify this by using self._basis_delta.
 
429
        # TODO: we could simplify this by using self.builder.basis_delta.
432
430
 
433
431
        # The initial commit adds a root directory, but this in itself is not
434
432
        # a worthwhile commit.
690
688
                # required after that changes.
691
689
                if len(self.parents) > 1:
692
690
                    ie.revision = None
693
 
                delta, version_recorded, _ = self.builder.record_entry_contents(
 
691
                _, version_recorded, _ = self.builder.record_entry_contents(
694
692
                    ie, self.parent_invs, path, self.basis_tree, None)
695
693
                if version_recorded:
696
694
                    self.any_entries_changed = True
697
 
                if delta:
698
 
                    self._basis_delta.append(delta)
699
695
 
700
696
    def _report_and_accumulate_deletes(self):
701
697
        # XXX: Could the list of deleted paths and ids be instead taken from
709
705
            deleted.sort()
710
706
            # XXX: this is not quite directory-order sorting
711
707
            for path, file_id in deleted:
712
 
                self._basis_delta.append((path, None, file_id, None))
 
708
                self.builder.record_delete(path, file_id)
713
709
                self.reporter.deleted(path)
714
710
 
715
711
    def _populate_from_inventory(self):
846
842
            ie.revision = None
847
843
        # For carried over entries we don't care about the fs hash - the repo
848
844
        # isn't generating a sha, so we're not saving computation time.
849
 
        delta, version_recorded, fs_hash = self.builder.record_entry_contents(
 
845
        _, version_recorded, fs_hash = self.builder.record_entry_contents(
850
846
            ie, self.parent_invs, path, self.work_tree, content_summary)
851
 
        if delta:
852
 
            self._basis_delta.append(delta)
853
847
        if version_recorded:
854
848
            self.any_entries_changed = True
855
849
        if report_changes: