Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 6700:9080f7031f69
make revlog.LookupError inherit from KeyError
This will improve integration with external applications which depend on
KeyError, which is usually raised by __getitem__ calls.
author | Alexander Solovyov <piranha@piranha.org.ua> |
---|---|
date | Wed, 18 Jun 2008 12:48:04 +0200 |
parents | 602f7c1ab954 |
children | bacfee67c1a9 |
comparison
equal
deleted
inserted
replaced
6699:386561a5179a | 6700:9080f7031f69 |
---|---|
30 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS | 30 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS |
31 | 31 |
32 class RevlogError(Exception): | 32 class RevlogError(Exception): |
33 pass | 33 pass |
34 | 34 |
35 class LookupError(RevlogError): | 35 class LookupError(RevlogError, KeyError): |
36 def __init__(self, name, index, message): | 36 def __init__(self, name, index, message): |
37 self.name = name | 37 self.name = name |
38 if isinstance(name, str) and len(name) == 20: | 38 if isinstance(name, str) and len(name) == 20: |
39 name = short(name) | 39 name = short(name) |
40 RevlogError.__init__(self, _('%s@%s: %s') % (index, name, message)) | 40 RevlogError.__init__(self, _('%s@%s: %s') % (index, name, message)) |