revset: fixed bug where log -f was taking too long to return
templater: shorten pure integers

Originally, the addition of the 'shorten' template function in 9c6b86dd2ed2
would not consider pure integers for shortening. This patch considers two
simple cases: when the integer starts with zero (which is parsed by Mercurial
as a hash first) and when the integer is larger than the tip (obviously not a
rev).