Or, how I made converting gaia to gaia-l10n suck less.
Background: For Firefox OS, we're exposing a modified repository to localizers, so that it's easier to find out what to work on, and to get support from the l10n dashboards. Files in the main gaia repository on github like
apps/browser/locales/browser.en-US.properties
should become
apps/browser/browser.properties
and the localizable sections in manifest.webapp,
{ … "locales": { "en-US": { "name": "Browser", "description": "Gaia Web Browser" } … }
are exposed in manifest.properties as
name: Browser description: Gaia Web Browser
We're also not supporting git on the l10n dashboard yet, so we need hg repositories.
I haven't come across a competitor to hg convert on the git side yet, so I looked on the mercurial side of life. I started by glancing of the code in hgext/convert in the upstream mercurial code. That does a host of things to get parents and graphs right, and I didn't feel like replicating that. It doesn't offer hooks for dynamic file maps, though, let alone content rewriting. But it's python, and it's open-source. So I forked it.
With hg convert. Isn't that meta? That gives me a good path to update the extension with future updates to upstream mercurial. I started out with a conversion of mercurial 2.7.1, then removed all the stuff I don't need like bzr support etc. Then I made the mercurial code do what I need for gaia. I had to disable some checks that try to avoid commits that don't actually change the contents, because I don't mind that happening. And last but not least I added the filemap and the shamap of the initial conversion of hgext/convert, so that future updates don't depend on my local disk.
Now I could just run hg gaiaconv and get what I want. Enter the legacy repositories for en-US. We only want fast-forward merges in hg, and in the conversion to git. No history editing allowed. But as you can probably guess, the new history is completely incompatible with the old, from changeset one. But I don't mind, I hacked that.
I did run the regular hg gaiaconv up to the revision 21000 of the integration/gaia-central repository. That ended up with the graph for revision 4af36780fb5d.
I pulled the old conversion for v1-train, which is the graph for revision ad14a618e815.
Then I did a no-op merge of the old graph into the new one.
That's all good, but now future conversions via gaiaconv would still pick up the non-merged revision. Well, unless one just edits the generated shamap, and replaces all references to 4af36780fb5d with cfb28f851111. And yes, that actually works.
Tadaaa, a fully automated conversion process, and only forward merges.
Repositories involved in this post: