{"id":3405,"date":"2014-12-18T11:56:15","date_gmt":"2014-12-18T10:56:15","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=3405"},"modified":"2015-02-11T08:19:58","modified_gmt":"2015-02-11T07:19:58","slug":"initial-support-for-git-pushes-to-mercurial-early-testers-needed","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=3405","title":{"rendered":"Initial support for git pushes to mercurial, early testers needed"},"content":{"rendered":"<p>This <a href=\"https:\/\/hg.mozilla.org\/try\/rev\/9551b17c2497\">push to try<\/a> was not created by mercurial.<\/p>\n<p>I just <a href=\"https:\/\/github.com\/glandium\/git-remote-hg\/commit\/cc47c80e6e95960c481845a5c9f7109fe9620144\">landed initial support<\/a> for pushing to mercurial from git. Considering the scary fact that it's possible to screw up a repository with bundles with missing content (and, guess what, I figured out the hard way), I have restricted it to local mercurial repositories until I am more confident.<\/p>\n<p>As such, I would need volunteers to use and test it on local mercurial repositories. On top of being limited to local mercurial repositories, it doesn't support pushing merges that would have been created by git, nor does it support pushing a root commit (one with no parent).<\/p>\n<p>Here's how you can use it:<\/p>\n<blockquote>\n<pre>$ git clone <a href=\"https:\/\/github.com\/glandium\/git-remote-hg\">https:\/\/github.com\/glandium\/git-remote-hg<\/a>\r\n$ export PATH=$PATH:$(pwd)\/git-remote-hg\r\n$ git clone hg::\/path\/to\/mercurial-repository\r\n$ # work work, commit, commit\r\n$ git push\r\n<\/pre>\n<\/blockquote>\n<p>[ Note: you can still pull from remote mercurial repositories ]<\/p>\n<p>This will push to your local repository, where it would be useful if you could check the push didn't fuck things up.<\/p>\n<blockquote>\n<pre>$ cd \/path\/to\/mercurial-repository\r\n$ hg verify\r\n<\/pre>\n<\/blockquote>\n<p>That's the long, thorough version. You may just want to simply do this:<\/p>\n<blockquote>\n<pre>$ cd \/path\/to\/mercurial-repository\r\n$ hg log --stat\r\n<\/pre>\n<\/blockquote>\n<p>Hopefully, you won't see messages like:<\/p>\n<blockquote>\n<pre>abort: data\/build\/mozconfig.common.override.i@56d6fdb13666: no match found!<\/pre>\n<\/blockquote>\n<p><b>Update:<\/b> You can also add the following to <code>\/path\/to\/mercurial-repository\/.hg\/hgrc<\/code>, which should prevent corruptions from entering the mercurial repository at all:<\/p>\n<blockquote>\n<pre>[server]\r\nvalidate = True\r\n<\/pre>\n<\/blockquote>\n<p><b>Update 2:<\/b> The above setting is now unnecessary, git-remote-hg will set it itself for its push session.<\/p>\n<p>Then you can push with mercurial.<\/p>\n<blockquote>\n<pre>\r\n$ hg push\r\n<\/pre>\n<\/blockquote>\n<p>Please note that this is integrated in git in such a way that it's possible to pass refspecs to git push and do other fancy stuff. Be aware that there are still rough edges on that part, but that your commits will be pushed, even if the resulting state under <code>refs\/remotes\/<\/code> is not very consistent.<\/p>\n<p>I'm planning a replay of several repositories to fully validate pushes don't send broken bundles, but it's going to take some time before I can set things up. I figured I'd rather crowdsource until then.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This push to try was not created by mercurial. I just landed initial support for pushing to mercurial from git. Considering the scary fact that it&#8217;s possible to screw up a repository with bundles with missing content (and, guess what, I figured out the hard way), I have restricted it to local mercurial repositories until [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,25],"tags":[23],"class_list":["post-3405","post","type-post","status-publish","format-standard","hentry","category-cinnabar","category-planet-mozilla","tag-en"],"_links":{"self":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3405"}],"version-history":[{"count":7,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3405\/revisions"}],"predecessor-version":[{"id":3412,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3405\/revisions\/3412"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}