Using wdir() in a dag range revset can crash Mercurial. For example:
hg status --rev '.^::wdir()
revlog.c reports an IndexError in this instance, but it isn't caught
by the calling code. This change adds IndexError to the set of exception
types the calling code catches. When an IndexError is caught, the code
falls back to calling the pure Python implementation of reachableroots,
which fails gracefully.