~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/versionedfile.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:
913
913
        raise NotImplementedError(self.annotate)
914
914
 
915
915
    def check(self, progress_bar=None):
916
 
        """Check this object for integrity."""
 
916
        """Check this object for integrity.
 
917
        
 
918
        :param progress_bar: A progress bar to output as the check progresses.
 
919
        :param keys: Specific keys within the VersionedFiles to check. When
 
920
            this parameter is not None, check() becomes a generator as per
 
921
            get_record_stream. The difference to get_record_stream is that
 
922
            more or deeper checks will be performed.
 
923
        :return: None, or if keys was supplied a generator as per
 
924
            get_record_stream.
 
925
        """
917
926
        raise NotImplementedError(self.check)
918
927
 
919
928
    @staticmethod
1132
1141
    def get_annotator(self):
1133
1142
        return annotate.Annotator(self)
1134
1143
 
1135
 
    def check(self, progress_bar=None):
 
1144
    def check(self, progress_bar=None, keys=None):
1136
1145
        """See VersionedFiles.check()."""
 
1146
        # XXX: This is over-enthusiastic but as we only thunk for Weaves today
 
1147
        # this is tolerable. Ideally we'd pass keys down to check() and 
 
1148
        # have the older VersiondFile interface updated too.
1137
1149
        for prefix, vf in self._iter_all_components():
1138
1150
            vf.check()
 
1151
        if keys is not None:
 
1152
            return self.get_record_stream(keys, 'unordered', True)
1139
1153
 
1140
1154
    def get_parent_map(self, keys):
1141
1155
        """Get a map of the parents of keys.