~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2007-08-24 12:45:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2905.
  • Revision ID: aaron.bentley@utoronto.ca-20070824124517-cnyqhp8f6luxjnws
Initial checking of knit graphs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1112
1112
                [parents_provider, other_repository._make_parents_provider()])
1113
1113
        return graph.Graph(parents_provider)
1114
1114
 
 
1115
    def check_versionedfile(self, revision_ids, file_id, versionedfile,
 
1116
                            revision_versions):
 
1117
        """Search the versionedfile for discrepancies from the graph"""
 
1118
        def get_text_revision(revision_id):
 
1119
            try:
 
1120
                inv_revisions = revision_versions[revision_id]
 
1121
            except KeyError:
 
1122
                tree = self.revision_tree(revision_id)
 
1123
                inv_revisions = {}
 
1124
                revision_versions[revision_id] = inv_revisions
 
1125
                for path, entry in tree.iter_entries_by_dir():
 
1126
                    inv_revisions[entry.file_id] = entry.revision
 
1127
            return inv_revisions[file_id]
 
1128
 
 
1129
        result = {}
 
1130
 
 
1131
        for revision_id in revision_ids:
 
1132
            text_revision = get_text_revision(revision_id)
 
1133
            parents = self.get_revision(text_revision).parent_ids
 
1134
            revision_parents = set([get_text_revision(p) for p in parents])
 
1135
            knit_parents = set(versionedfile.get_parents(text_revision))
 
1136
            unreferenced = knit_parents.difference(revision_parents)
 
1137
            if len(unreferenced) != 0:
 
1138
                result[(file_id, text_revision)] = unreferenced
 
1139
                
 
1140
        return result
 
1141
 
1115
1142
    @needs_write_lock
1116
1143
    def set_make_working_trees(self, new_value):
1117
1144
        """Set the policy flag for making working trees when creating branches.