This makes the pure code more similar to the native code in that it
first finds a prefix that's unambiguous among nodeids and then adds
hex digits until it no longer looks like a revnum. It will allow us to
even better separate the disambiguation with revnums in a later patch.
With this patch hg log -r 0::50 -T '{shortest(node,1)}' with no
native code goes from 25s to 43s. It wasn't exactly usable to begin
with, so I don't feel too bad about it.