{"id":1225,"date":"2014-08-24T16:44:19","date_gmt":"2014-08-24T14:44:19","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=1225"},"modified":"2017-05-09T15:23:30","modified_gmt":"2017-05-09T13:23:30","slug":"mercurial-survival-guide","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=1225","title":{"rendered":"Mercurial Survival Guide"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#Split_repository_in_sub_repositories\"><span class=\"toc_number toc_depth_1\">1<\/span> Split repository in sub repositories<\/a><\/li><li><a href=\"#Merge_repositories\"><span class=\"toc_number toc_depth_1\">2<\/span> Merge repositories<\/a><\/li><li><a href=\"#Get_guid_latest_revision\"><span class=\"toc_number toc_depth_1\">3<\/span> Get guid latest revision<\/a><\/li><li><a href=\"#Clone_without_loginpassword_prompt\"><span class=\"toc_number toc_depth_1\">4<\/span> Clone without login\/password prompt<\/a><\/li><li><a href=\"#Subversion_to_mercurial\"><span class=\"toc_number toc_depth_1\">5<\/span> Subversion to mercurial<\/a><\/li><li><a href=\"#Remove_working_copy_files\"><span class=\"toc_number toc_depth_1\">6<\/span> Remove working copy files<\/a><\/li><\/ul><\/div>\n<h1><span id=\"Split_repository_in_sub_repositories\">Split repository in sub repositories<\/span><\/h1>\n<p>myrepository has the following repositories:<\/p>\n<ul>\n<li>mysubdir1<\/li>\n<li>mysubdir2<\/li>\n<li>mysubdir3<\/li>\n<\/ul>\n<ol>\n<li>create filemap.txt:\n<pre>\r\n    include mysubdir1\r\n    rename mysubdir1 .\r\n<\/pre>\n<\/li>\n<li>run the following command:\n<pre lang=\"bash\">\r\nhg convert --filemap \/tmp\/myfilemap myrepository myrepository-dest\r\n<\/pre>\n<\/li>\n<li>\nlook at myrepository-dest. It has the content of mysubdir1.\n<\/li>\n<\/ol>\n<h1><span id=\"Merge_repositories\">Merge repositories<\/span><\/h1>\n<p>If you want to merge myrepository1 with myrepository2 :<\/p>\n<pre lang=\"bash\">\r\necho clone myrepository2 to myworkingcopy\r\nhg clone myrepository1 myworkingcopy\r\necho change directory to myworkingcopy\r\ncd myworkingcopy\r\necho pull myrepository2 (with force option)\r\nhg pull -f myrepository2\r\necho merge both repositories\r\nhg merge\r\necho finally, commit\r\nhg commit\r\n<\/pre>\n<h1><span id=\"Get_guid_latest_revision\">Get guid latest revision<\/span><\/h1>\n<pre lang=\"bash\">\r\nhg identify -i http:\/\/srv-scm\/hg\/MYREPOSITORY\r\n<\/pre>\n<h1><span id=\"Clone_without_loginpassword_prompt\">Clone without login\/password prompt<\/span><\/h1>\n<pre lang=\"bash\">\r\nhg clone http:\/\/mylogin:mypasswd@srv-scm\/myrepos\r\n<\/pre>\n<h1><span id=\"Subversion_to_mercurial\">Subversion to mercurial<\/span><\/h1>\n<ol>\n<li> clone hgsubversion\n<pre lang=\"bash\">\r\n  hg clone http:\/\/bitbucket.org\/durin42\/hgsubversion\/ ~\/hgsubversion\r\n  <\/pre>\n<\/li>\n<li>install requires (the extension requires the Python Subversion bindings)\n<pre lang=\"bash\">\r\n  yum install python-subvertpy\r\n<\/pre>\n<\/li>\n<li>Enable extension in mercurial<br \/>\nConfigure your hgrc to enable the extension by adding the following lines:  (vi ~\/.hgrc)<\/p>\n<pre>\r\n[extensions]\r\nhgsubversion = ~\/hgsubversion\/hgsubversion\r\n<\/pre>\n<p>And install it:<\/p>\n<pre lang=\"bash\">\r\ncd ~\/hgsubversion\r\nchmod +x setup.py\r\n.\/setup.py install\r\n<\/pre>\n<\/li>\n<li>Test\n<pre lang=\"bash\">\r\nhg --config clone http:\/\/python-nose.googlecode.com\/svn nose-hg\r\n<\/pre>\n<\/li>\n<\/ol>\n<h1><span id=\"Remove_working_copy_files\">Remove working copy files<\/span><\/h1>\n<p>This will remove all your working copy files, and only keep the .hg folder (at the root place) <\/p>\n<pre lang=\"bash\">\r\nhg update null\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 Split repository in sub repositories2 Merge repositories3 Get guid latest revision4 Clone without login\/password prompt5 Subversion to mercurial6 Remove working copy files Split repository in sub repositories myrepository has the following repositories: mysubdir1 mysubdir2 mysubdir3 create filemap.txt: include mysubdir1 rename mysubdir1 . run the following command: hg convert &#8211;filemap \/tmp\/myfilemap myrepository myrepository-dest look at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1219,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1225","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1225"}],"version-history":[{"count":15,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1225\/revisions"}],"predecessor-version":[{"id":1904,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1225\/revisions\/1904"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1219"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}