~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: Robert Collins
  • Date: 2007-07-12 14:44:10 UTC
  • mto: (2592.5.3 pack-repository)
  • mto: This revision was merged to the branch mainline in revision 2624.
  • Revision ID: robertc@robertcollins.net-20070712144410-0ucqo377rxnoc7wu
Empty files should validate ok.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
            yield None
80
80
        raise errors.MissingKey(self, keys[0])
81
81
 
 
82
    def _signature(self):
 
83
        """The file signature for this index type."""
 
84
        return _SIGNATURE
 
85
 
82
86
    def validate(self):
83
87
        """Validate that everything in the index can be accessed."""
84
 
        raise errors.BadIndexFormatSignature(self._name, GraphIndex)
 
88
        stream = self._transport.get(self._name)
 
89
        signature = stream.read(len(self._signature()))
 
90
        if not signature == self._signature():
 
91
            raise errors.BadIndexFormatSignature(self._name, GraphIndex)