Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 8016:baaa832fd253
raise RevlogError when parser can't parse the revlog index
Initial patch and test thanks to Nicolas Dumazet.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 06 Apr 2009 19:48:11 +0200 |
parents | 08cabecfa8a8 |
children | 685ce2f7ee35 |
comparison
equal
deleted
inserted
replaced
7929:47b0a881638f | 8016:baaa832fd253 |
---|---|
448 | 448 |
449 self._io = revlogio() | 449 self._io = revlogio() |
450 if self.version == REVLOGV0: | 450 if self.version == REVLOGV0: |
451 self._io = revlogoldio() | 451 self._io = revlogoldio() |
452 if i: | 452 if i: |
453 d = self._io.parseindex(f, self._inline) | 453 try: |
454 d = self._io.parseindex(f, self._inline) | |
455 except (ValueError, IndexError), e: | |
456 raise RevlogError(_("index %s is corrupted") % (self.indexfile)) | |
454 self.index, self.nodemap, self._chunkcache = d | 457 self.index, self.nodemap, self._chunkcache = d |
455 | 458 |
456 # add the magic null revision at -1 (if it hasn't been done already) | 459 # add the magic null revision at -1 (if it hasn't been done already) |
457 if (self.index == [] or isinstance(self.index, lazyindex) or | 460 if (self.index == [] or isinstance(self.index, lazyindex) or |
458 self.index[-1][7] != nullid) : | 461 self.index[-1][7] != nullid) : |