~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-21 06:01:39 UTC
  • mfrom: (3787.1.2 knits)
  • Revision ID: pqm@pqm.ubuntu.com-20081021060139-fpwr4fxr2oww2x5o
(robertc) Allow recovery of the text when sha1 checks fail. (Robert
        Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
    KnitHeaderError,
96
96
    RevisionNotPresent,
97
97
    RevisionAlreadyPresent,
 
98
    SHA1KnitCorrupt,
98
99
    )
99
100
from bzrlib.osutils import (
100
101
    contains_whitespace,
1054
1055
            text = content.text()
1055
1056
            actual_sha = sha_strings(text)
1056
1057
            if actual_sha != digest:
1057
 
                raise KnitCorrupt(self,
1058
 
                    '\n  sha-1 %s'
1059
 
                    '\n  of reconstructed text does not match'
1060
 
                    '\n  expected %s'
1061
 
                    '\n  for version %s' %
1062
 
                    (actual_sha, digest, key))
 
1058
                raise SHA1KnitCorrupt(self, actual_sha, digest, key, text)
1063
1059
            text_map[key] = text
1064
1060
        return text_map, final_content
1065
1061
 
1671
1667
        return result
1672
1668
 
1673
1669
 
1674
 
 
1675
1670
class _KndxIndex(object):
1676
1671
    """Manages knit index files
1677
1672