~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-06 02:23:37 UTC
  • mfrom: (4332.3.36 check)
  • Revision ID: pqm@pqm.ubuntu.com-20090806022337-7c2oni07fsjq6gun
(robertc) Partial overhaul of check to do less duplicate work.
        (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
        self._control_files.break_lock()
282
282
        self.branch.break_lock()
283
283
 
 
284
    def _get_check_refs(self):
 
285
        """Return the references needed to perform a check of this tree.
 
286
        
 
287
        The default implementation returns no refs, and is only suitable for
 
288
        trees that have no local caching and can commit on ghosts at any time.
 
289
 
 
290
        :seealso: bzrlib.check for details about check_refs.
 
291
        """
 
292
        return []
 
293
 
284
294
    def requires_rich_root(self):
285
295
        return self._format.requires_rich_root
286
296
 
2536
2546
        return un_resolved, resolved
2537
2547
 
2538
2548
    @needs_read_lock
2539
 
    def _check(self):
 
2549
    def _check(self, references):
 
2550
        """Check the tree for consistency.
 
2551
 
 
2552
        :param references: A dict with keys matching the items returned by
 
2553
            self._get_check_refs(), and values from looking those keys up in
 
2554
            the repository.
 
2555
        """
2540
2556
        tree_basis = self.basis_tree()
2541
2557
        tree_basis.lock_read()
2542
2558
        try:
2543
 
            repo_basis = self.branch.repository.revision_tree(
2544
 
                self.last_revision())
 
2559
            repo_basis = references[('trees', self.last_revision())]
2545
2560
            if len(list(repo_basis.iter_changes(tree_basis))) > 0:
2546
2561
                raise errors.BzrCheckError(
2547
2562
                    "Mismatched basis inventory content.")
2593
2608
        if self._inventory is None:
2594
2609
            self.read_working_inventory()
2595
2610
 
 
2611
    def _get_check_refs(self):
 
2612
        """Return the references needed to perform a check of this tree."""
 
2613
        return [('trees', self.last_revision())]
 
2614
 
2596
2615
    def lock_tree_write(self):
2597
2616
        """See WorkingTree.lock_tree_write().
2598
2617
 
2655
2674
                mode=self.bzrdir._get_file_mode())
2656
2675
            return True
2657
2676
 
 
2677
    def _get_check_refs(self):
 
2678
        """Return the references needed to perform a check of this tree."""
 
2679
        return [('trees', self.last_revision())]
 
2680
 
2658
2681
    @needs_tree_write_lock
2659
2682
    def set_conflicts(self, conflicts):
2660
2683
        self._put_rio('conflicts', conflicts.to_stanzas(),