{"id":532,"date":"2013-09-19T07:49:53","date_gmt":"2013-09-19T14:49:53","guid":{"rendered":"http:\/\/blog.mozilla.org\/axel\/?p=532"},"modified":"2013-09-19T07:49:53","modified_gmt":"2013-09-19T14:49:53","slug":"a-tale-of-convert-and-convert","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/axel\/2013\/09\/19\/a-tale-of-convert-and-convert\/","title":{"rendered":"A tale of convert and convert"},"content":{"rendered":"<p>Or, how I made converting gaia to gaia-l10n suck less.<\/p>\n<p>Background: For Firefox OS, we&#8217;re exposing a modified repository to localizers, so that it&#8217;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 <\/p>\n<pre>apps\/browser\/<span style=\"color:red\">locales\/<\/span>browser.<span style=\"color:red\">en-US.<\/span>properties<\/pre>\n<p>should become<\/p>\n<pre>apps\/browser\/browser.properties<\/pre>\n<p>and the localizable sections in <code>manifest.webapp<\/code>,<\/p>\n<pre>{\r\n&hellip;\r\n  \"locales\": {\r\n    \"en-US\": {\r\n      \"name\": \"Browser\",\r\n      \"description\": \"Gaia Web Browser\"\r\n    }\r\n&hellip;\r\n}<\/pre>\n<p>are exposed in <code>manifest.properties<\/code> as<\/p>\n<pre>name: Browser\r\ndescription: Gaia Web Browser<\/pre>\n<p>We&#8217;re also not supporting git on the l10n dashboard yet, so we need hg repositories.<\/p>\n<p>I haven&#8217;t come across a competitor to <code>hg convert<\/code> on the git side yet, so I looked on the mercurial side of life. I started by glancing of the code in <code>hgext\/convert<\/code> in the upstream mercurial code. That does a host of things to get parents and graphs right, and I didn&#8217;t feel like replicating that. It doesn&#8217;t offer hooks for dynamic file maps, though, let alone content rewriting. But it&#8217;s python, and it&#8217;s open-source. <a href=\"https:\/\/bitbucket.org\/pike\/gaiaconv\">So I forked it<\/a>.<\/p>\n<p>With <code>hg convert<\/code>. Isn&#8217;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 <a href=\"https:\/\/bitbucket.org\/pike\/gaiaconv\/commits\/652bd22b3bfc3fbed896ce2780ddafc871f593b2?at=default\">removed all the stuff<\/a> I don&#8217;t need like bzr support etc. Then I made the mercurial code <a href=\"https:\/\/bitbucket.org\/pike\/gaiaconv\/commits\/a63c2f730e475f84d3704934477f97f74a3b8afd?at=default\">do what I need<\/a> for gaia. I had to disable some checks that try to avoid commits that don&#8217;t actually change the contents, because I don&#8217;t mind that happening. And last but not least I added <a href=\"https:\/\/bitbucket.org\/pike\/gaiaconv\/commits\/376ab1ff30641a921557aa28308c1fc9b74106e6?at=default\">the filemap and the shamap of the initial conversion<\/a> of <code>hgext\/convert<\/code>, so that future updates don&#8217;t depend on my local disk.<\/p>\n<p>Now I could just run <code>hg gaiaconv<\/code> 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&#8217;t mind, I hacked that.<\/p>\n<p>I did run the regular <code>hg gaiaconv<\/code> up to the revision 21000 of the <code>integration\/gaia-central<\/code> repository. That ended up with the <a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_2\/en-US\/graph\/4af36780fb5d\">graph for revision 4af36780fb5d<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.03-PM.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.03-PM.png\" alt=\"gaia-central conversion\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-545\" srcset=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.03-PM.png 600w, https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.03-PM-300x100.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>I pulled the old conversion for v1-train, which is the <a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_2\/en-US\/graph\/ad14a618e815\">graph for revision ad14a618e815<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.33-PM.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.33-PM.png\" alt=\"old en-US for v1-train\" width=\"630\" height=\"200\" class=\"aligncenter size-full wp-image-546\" srcset=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.33-PM.png 630w, https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.34.33-PM-300x95.png 300w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Then I did a no-op merge of the <a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_2\/en-US\/graph\/cfb28f851111\">old graph into the new one<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.35.06-PM.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.35.06-PM.png\" alt=\"merge\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-547\" srcset=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.35.06-PM.png 600w, https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.35.06-PM-300x100.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>That&#8217;s all good, but now future conversions via <code>gaiaconv<\/code> would still pick up the non-merged revision. Well, unless one just edits the generated shamap, and <a href=\"http:\/\/hg.mozilla.org\/users\/axel_mozilla.com\/gaia-shamaps\/rev\/2e3342d517e8\">replaces all references to 4af36780fb5d with cfb28f851111<\/a>. And yes, <a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_2\/en-US\/graph\/58f649f61c59\">that actually works<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.36.13-PM.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.36.13-PM.png\" alt=\"more conversions post-merge\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-548\" srcset=\"https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.36.13-PM.png 600w, https:\/\/blog.mozilla.org\/axel\/files\/2013\/09\/Screen-Shot-2013-09-19-at-4.36.13-PM-300x100.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Tadaaa, a fully automated conversion process, and only forward merges.<\/p>\n<p>Repositories involved in this post:<\/p>\n<ul>\n<li><a href=\"http:\/\/selenic.com\/hg\" title=\"Mercurial\">Mercurial<\/a><\/li>\n<li><a href=\"https:\/\/bitbucket.org\/pike\/gaiaconv\/\" title=\"gaiaconv extension\">gaiaconv extension<\/a><\/li>\n<li><a href=\"https:\/\/hg.mozilla.org\/integration\/gaia-1_2\/\" title=\"gaia-1_2\">hg repository for 1.2 branch<\/a><\/li>\n<li><a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_1\/en-US\/\" title=\"v1-train en-US\">en-US repo for v1-train<\/a><\/li>\n<li><a href=\"http:\/\/hg.mozilla.org\/releases\/gaia-l10n\/v1_2\/en-US\/\" title=\"1.2 en-US\">en-US repo for 1.2<\/a><\/li>\n<li><a href=\"http:\/\/hg.mozilla.org\/users\/axel_mozilla.com\/gaia-shamaps\/\" title=\"shamaps created by gaiaconv\">shamaps for en-US by gaiaconv<\/a>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Or, how I made converting gaia to gaia-l10n suck less. Background: For Firefox OS, we&#8217;re exposing a modified repository to localizers, so that it&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,5],"tags":[23779,289,23778],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts\/532"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/comments?post=532"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts\/532\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/media?parent=532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/categories?post=532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/tags?post=532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}