revlog: add a C implementation of `headrevsdiff`
Python implementation of `headrevsdiff` can be very slow in the worst
case compared with the `heads` computation it replaces, since the
latter is done in C.
Even the average case of this Python implementation is still
noticeable in the profiles.
This patch makes the computation much much faster by doing it in C.
# Tests to be disabled when building and testing in the Nix sandbox.
# tests enforcing "/usr/bin/env" shebangs, which are patched for nix
test-run-tests.t
test-check-shbang.t
# doesn't like the extra setlocale warnings emitted by the nix bash wrappers
test-locale.t