hg2git: implement a method to initialize _dirs from a Git commit

Upcoming patches will start incrementally exporting from a particular commit
instead of from null. This function will be used for that..
git_handler: return early when no commits need to be exported

This will make our life easier in an upcoming patch.
hg2git: start incremental conversion from a known commit

Previously, we'd spin up the Mercurial incremental exporter from the null
commit and build up state from there. This meant that for the first exported
commit, we'd have to read all the files in that commit and compute Git blobs
and trees based on that.

The current Mercurial to Git conversion scheme makes most sense with
Mercurial's current default storage format, where manifests are diffed against
the numerically previous revision. At some point in the future, the default
will switch to generaldelta, where manifests would be diffed against one of
their parents. In that world it might make more sense to have a stateless
exporter that diffed each commit against its generaldelta parent and calculated
dirty trees based on that instead. However, more experiments need to be done to
see what export scheme is best.

For a repo with around 50,000 files, this brings down an incremental 'hg
gexport' of one commit from 18 seconds with a hot file cache (and tens of
minutes with a cold one) to around 2 seconds with a hot file cache.
hg2git: in _init_dirs, store keys without leading '/' (issue103)

Previously, whenever a tree that wasn't the root ('') was stored, we'd prepend
a '/' to it. Then, when we'd try retrieving the entry, we'd do so without the
leading '/'. This caused data loss because existing tree entries were dropped
on the floor. Fix that by only adding '/' if we're adding to a non-empty
initial path.

This wasn't detected in tests because most of them deal only with files in the
root and not ones in subdirectories.
tests: add some extra filters for new output

Tests pass on both my Mac and Linux machine, so I feel moderately confident
that this is portable.
fix bogus commits by merging them away

hg commit 623cb724c3d0 fixed a bug that would cause Git directories with any
touched files to lose any untouched files. This fixes the issue by merging the
bad branch away.