/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: Aaron Bentley
  • Date: 2009-05-20 17:20:14 UTC
  • mto: This revision was merged to the branch mainline in revision 4374.
  • Revision ID: aaron@aaronbentley.com-20090520172014-c3met75t69n8ilo9
Simplify by using CommitBuilder directly

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
               message_callback=None,
207
207
               recursive='down',
208
208
               exclude=None,
209
 
               possible_master_transports=None,
210
 
               target_branch=None):
 
209
               possible_master_transports=None):
211
210
        """Commit working copy as a new revision.
212
211
 
213
212
        :param message: the commit message (it or message_callback is required)
245
244
            raise BzrError("working_tree must be passed into commit().")
246
245
        else:
247
246
            self.work_tree = working_tree
248
 
            if target_branch is None:
249
 
                self.branch = self.work_tree.branch
250
 
                update_tree = True
251
 
            else:
252
 
                self.branch = target_branch
253
 
                update_tree = False
 
247
            self.branch = self.work_tree.branch
254
248
            if getattr(self.work_tree, 'requires_rich_root', lambda: False)():
255
249
                if not self.branch.repository.supports_rich_root():
256
250
                    raise errors.RootNotRich()
290
284
        self.strict = strict
291
285
        self.verbose = verbose
292
286
 
293
 
        self.branch.lock_write()
294
 
        if update_tree:
295
 
            self.work_tree.lock_write()
296
 
        else:
297
 
            self.work_tree.lock_read()
 
287
        self.work_tree.lock_write()
298
288
        self.parents = self.work_tree.get_parent_ids()
299
289
        # We can use record_iter_changes IFF iter_changes is compatible with
300
290
        # the command line parameters, and the repository has fast delta
370
360
                # report the start of the commit
371
361
                self.reporter.started(new_revno, self.rev_id, master_location)
372
362
 
373
 
                self._update_builder_with_changes(update_tree)
 
363
                self._update_builder_with_changes()
374
364
                self._check_pointless()
375
365
 
376
366
                # TODO: Now the new inventory is known, check for conflicts.
410
400
            self.branch.set_last_revision_info(new_revno, self.rev_id)
411
401
 
412
402
            # Make the working tree up to date with the branch
413
 
            if update_tree:
414
 
                self._set_progress_stage("Updating the working tree")
415
 
                self.work_tree.update_basis_by_delta(self.rev_id,
416
 
                     self.builder.get_basis_delta())
 
403
            self._set_progress_stage("Updating the working tree")
 
404
            self.work_tree.update_basis_by_delta(self.rev_id,
 
405
                 self.builder.get_basis_delta())
417
406
            self.reporter.completed(new_revno, self.rev_id)
418
407
            self._process_post_hooks(old_revno, new_revno)
419
408
        finally:
582
571
        cleanups = [self._cleanup_bound_branch,
583
572
                    self.basis_tree.unlock,
584
573
                    self.work_tree.unlock,
585
 
                    self.branch.unlock,
586
574
                    self.pb.finished]
587
575
        found_exception = None
588
576
        for cleanup in cleanups:
641
629
            else:
642
630
                mutter('commit parent ghost revision {%s}', revision)
643
631
 
644
 
    def _update_builder_with_changes(self, update_tree):
 
632
    def _update_builder_with_changes(self):
645
633
        """Update the commit builder with the data about what has changed.
646
634
        """
647
635
        exclude = self.exclude
651
639
        self._check_strict()
652
640
        if self.use_record_iter_changes:
653
641
            iter_changes = self.work_tree.iter_changes(self.basis_tree)
654
 
            iter_changes = self._filter_iter_changes(iter_changes, update_tree)
 
642
            iter_changes = self._filter_iter_changes(iter_changes)
655
643
            for file_id, path, fs_hash in self.builder.record_iter_changes(
656
644
                self.work_tree, self.basis_revid, iter_changes):
657
 
                if fs_hash[1] is not None:
658
 
                    self.work_tree._observed_sha1(file_id, path, fs_hash)
 
645
                self.work_tree._observed_sha1(file_id, path, fs_hash)
659
646
        else:
660
647
            # Build the new inventory
661
648
            self._populate_from_inventory()
662
649
            self._record_unselected()
663
650
            self._report_and_accumulate_deletes()
664
651
 
665
 
    def _filter_iter_changes(self, iter_changes, update_tree):
 
652
    def _filter_iter_changes(self, iter_changes):
666
653
        """Process iter_changes.
667
654
 
668
655
        This method reports on the changes in iter_changes to the user, and 
710
697
                            reporter.snapshot_change('modified', new_path)
711
698
            self._next_progress_entry()
712
699
        # Unversion IDs that were found to be deleted
713
 
        if update_tree:
714
 
            self.work_tree.unversion(deleted_ids)
 
700
        self.work_tree.unversion(deleted_ids)
715
701
 
716
702
    def _record_unselected(self):
717
703
        # If specific files are selected, then all un-selected files must be