git_handler: don't compute tags for each tag imported

Previously we'd recompute the repo tags each time we'd consider importing a Git
tag. This is O(n^2) in the number of tags and produced noticeable slowdowns in
repos with large numbers of tags.

To fix this, compute the tags just once. This is correct because the only case
where we'd have issues is if multiple new Git tags with the same name were
introduced, which can't happen because Git tags cannot share names.

For a repository with over 200 tags, this causes a no-op hg pull to be sped up
by around 0.5 seconds.
git_handler: fix call to self.ui.progress in flush

Since we now directly use progress on self.ui, we shouldn't pass in self.ui as
the first argument. Oops.
overlayrevlog: handle rev = 0 correctly

Previously we'd just test if gitrev was falsy, which it is if the rev returned
is 0, even though it shouldn't be. With this patch, test against None
explicitly.

This unmasks another bug: see next patch for a fix and a test.
overlayrevlog: handle root commits correctly

Previously, we'd try to access commit.parents[0] and fail. Now, check for
commit.parents being empty and return what Mercurial thinks is a repository
root in that case.