[issue2050] repo.lookup(n) should fail when n == len(repo)
Greg Ward
bugs at mercurial.selenic.com
Wed Feb 17 20:12:05 UTC 2010
New submission from Greg Ward <greg-hg at gerg.ca>:
This is an API feature request, not something visible to the command-line.
I'm debugging something that accesses a repo using localrepository.lookup().
My code had a bug: it was calling repo.lookup(n) where n == len(repo). To
my surprise, repo.lookup() returned node.nullid rather than blowing up. Any
other invalid revision number, e.g. n+1, raises IndexError.
The explanation is obvious: revlog's index list has an extra entry,
presumably so looking up -1 works. This API would be a tad less surprising
if something (localrepository or revlog, I don't much care) checked if n >=
len(repo).
----------
messages: 11798
nosy: gward
priority: feature
status: unread
title: repo.lookup(n) should fail when n == len(repo)
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2050>
____________________________________________________
More information about the Mercurial-devel
mailing list