git_handler: fix filectxfn compatibility with hg's default branch

Mercurial rev 650b5b6e75ed changed the contract for filectxfn, and rev
d226fe36e362 added a way for us to detect the change.
tests: add test to ensure hg rename and extra metadata roundtrips

We didn't actually have a test for this until now.
git_handler: drop unnecessary add_extras boolean from get_git_message
git_handler: store hg extra data in git deterministically by sorting it

Previously, we'd iterate over the extra elements in arbitrary order. We now
sort the elements and store them in deterministic order.

Without sorting, the included test fails half the time.
Makefile: fix tests-3.1 to actually be tests-3.1 in all-version-tests
test-extra.t: use a templater format that's portable back to hg 2.8.2