~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Robert Collins
  • Date: 2009-06-16 00:37:55 UTC
  • mto: This revision was merged to the branch mainline in revision 4593.
  • Revision ID: robertc@robertcollins.net-20090616003755-pmlsfdnx8e5obnwm
Start checking file texts in a single pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        self.missing_parent_links = {}
72
72
        self.missing_inventory_sha_cnt = 0
73
73
        self.missing_revision_cnt = 0
74
 
        # maps (file-id, version) -> sha1; used by InventoryFile._check
75
 
        self.checked_texts = {}
76
74
        self.checked_weaves = set()
77
75
        self.unreferenced_versions = set()
78
76
        self.inconsistent_parents = []
300
298
            storebar.finished()
301
299
 
302
300
    def _check_weaves(self, storebar):
303
 
        storebar.update('inventory', 0, 4)
304
 
        # do not put in init, as it should be done with progess,
305
 
        # and inside the lock.
306
 
        inventory_weave = self.repository.inventories
307
 
        inventory_weave.check(progress_bar=storebar)
308
 
        storebar.update('text-deltas', 1)
309
 
        self.repository.texts.check(progress_bar=storebar)
310
 
        storebar.update('text-index', 2)
 
301
        storebar.update('text-index', 0, 2)
311
302
        weave_checker = self.repository._get_versioned_file_checker(
312
 
            text_key_references=self.text_key_references,
313
303
            ancestors=self.ancestors)
314
 
        storebar.update('file-graph', 3)
315
 
        result = weave_checker.check_file_version_parents(
316
 
            self.repository.texts)
 
304
        storebar.update('file-graph', 1)
 
305
        if self.repository._format.fast_deltas:
 
306
            # We haven't considered every fileid instance so far.
 
307
            result = weave_checker.check_file_version_parents(
 
308
                self.repository.texts)
 
309
        else:
 
310
            result = weave_checker.check_file_version_parents(
 
311
                text_key_references=self.text_key_references,
 
312
                self.repository.texts)
317
313
        self.checked_weaves = weave_checker.file_ids
318
314
        bad_parents, unused_versions = result
319
315
        bad_parents = bad_parents.items()
328
324
        self.unreferenced_versions.update(unused_versions)
329
325
 
330
326
    def _add_entry_to_text_key_references(self, inv, entry):
331
 
        if not self.rich_roots and entry == inv.root:
 
327
        if not self.rich_roots and entry.name == '':
332
328
            return
333
329
        key = (entry.file_id, entry.revision)
334
330
        self.text_key_references.setdefault(key, False)