Make sure the GitLab branches state file is present
The GitLab branches state file was introduced in heptapod#373 (closed). Any push to current Mercurial repos (native ones are still based on hg-git) will create it if needed, but that still leaves the case of projects with no recent pushes.
Some HGitaly RPC methods can only be properly implemented using that state file, so we'd need to be able to rely on its presence.
The bad case would be a Mercurial native project created before introduction of the state file and left to rest since then. Being already native, ensuring the state file presence in a migration task would not be enough for these. Usually these should be testing projects that no one really cares about, but still we don't want to create hard errors that could break more general pages. Also, some project might be accidentally be flagged as Mercurial native because of some bug in a migration task or of human error.
In case the state file is missing, we should initialize it from the auxiliary Git repository, whose state is to be considered good enough.
It's hard to imagine realistic scenarios where the Git repository would become out of sync without a push, but it's possible that the Git repository vanishes entirely (assume hg-git not used any more for native projects, wrongly flag a project as native, backup and restore, assume the backup task has not been written with that in mind).
In the worst case, starting afresh with an empty file will at worst trigger too many GitLab notifications on next push.
- provide a method easy to import from HGitaly
- provide a command that Rails can call (for backup logic in the %HGitaly2: fully native times)