Synchronize with git-remote-hg

This tries to synchronize the code-base between git-remote-hg and gitifyhg so it's easier to compare both, and run each other's test-suites.

In addition, a bunch of bugs are fixed.