RepoError should be importable from mercurial.repo?
Matt Mackall
mpm at selenic.com
Mon Feb 2 10:14:34 CST 2009
On Mon, 2009-02-02 at 14:10 +0100, Christian Boos wrote:
> Hello,
>
> In the 08cabecfa8a8 changeset ("errors: move revlog errors"), together
> with the move of RevLogError and LookupError from mercurial.revlog to
> mercurial.error, there was also a change which took care of backward
> compatibility, in mercurial/revlog.py:
> +RevlogError = error.RevlogError
> +LookupError = error.LookupError
>
> But a few changesets later, in 1d54e2f6c0b7 "error: move repo errors",
> such a backward compatibility change was not done. Was that on purpose
> or simply accidental?
Intentional.
Consider the following construct:
import repo
try:
# some complex operation that may or may not involve repos
except repo.RepoError:
print "Oops!"
We may be importing repo solely to check for errors that may never be
produced by code that is never called.
Our top-level dispatcher was doing precisely this, repeatedly. It was
effectively importing most of hg simply to be able to catch its errors.
Now I could leave backward-compatibility bits for all of these like
revlog does, but I probably shouldn't. Extensions are the most likely to
do things wrong and negatively impact performance.
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list