discovery: prefer loop to double-for list comprehension in changegroupsubset

The double-for form of list comprehensions gets particularly unreadable
when you throw in an 'if' condition. This expands the only remaining
instance of the double-for syntax in our codebase into a loop.

--HG--
extra : rebase_source : 40ef143ef1d9749ebf42d3c71170cf2f10f20235
extra : amend_source : 471cee157824614e804c3edceb4bfaa9814659fa
revlog: move file writing to a separate function

Moves the code that actually writes to a file to a separate function in
revlog.py. This allows extensions to intercept and use the data being written to
disk. For example, an extension might want to replicate these writes elsewhere.

When cloning the Mercurial repo on /dev/shm with --pull, I see about a 0.3% perf change.
It goes from 28.2 to 28.3 seconds.

--HG--
extra : rebase_source : 16072211abf7aaa03b85722ebe8db26c14a14128
templatekw: allow tagtypes other than global in getlatesttags

hg-git uses tagtype 'git', for example, so it's better
to check for tagtype != 'local', not strictly for 'global'

--HG--
extra : rebase_source : 1aac6675e41eee75bb2ccb1bdbc90d1edc85e99d
run-tests: better check for python version

Compare version by using pythons tuple comparison. So we do not match on python
3.0 or newer.

--HG--
extra : rebase_source : 68262b11f7339f58767bf88148cdda796b7f8f1b