This demonstrates the stack interface that I'd like to see upstream. Most of the things here should be good to merge, but it's not clear what actually gets accepted into core hg yet, so this is WIP.
Not everything is decided, currently there is this:
cache revs and indexedrevs both or none
if we decide to cache revs, they need to be frozen so that nothing can re-.sort() them
And then there's:
decide about foo#stack[base] syntax (start from 1? use 0 or
basefor base? what should stack[:] include?)