{"id":350,"date":"2015-03-21T15:10:36","date_gmt":"2015-03-21T15:10:36","guid":{"rendered":"http:\/\/www.kamremake.com\/devblog\/?p=350"},"modified":"2016-08-06T19:34:10","modified_gmt":"2016-08-06T19:34:10","slug":"perils-of-converting-from-svn-to-git","status":"publish","type":"post","link":"https:\/\/www.kamremake.com\/devblog\/perils-of-converting-from-svn-to-git\/","title":{"rendered":"Perils of converting from SVN to Git"},"content":{"rendered":"<p>KaM Remake was started almost 7 years ago now and at that time I had little knowledge of SVN. No wonder that KMR repository was created flawed. It missed &#8220;trunk\/branches\/tags&#8221; folders, which are an industry standard for SVN repositories. We have added them only few years later (in 2011). That did not mattered until now, when we need to migrate from Google Code and that is a good time to switch to Git. Problem is &#8211; Git import tools don&#8217;t like unusual SVN repositories, like ours. \u00c2\u00a0That means we need to go back in time and fix the KaM Remake repository.<\/p>\n<p>Thanks to simple SVN tools that can dump whole repo in editable text format, restoring SVN structure seems to be working well. I&#8217;m splitting the repo into pieces and rearranging them so that now creation of &#8220;trunk&#8221; folder happens in r1 instead of r1641. That shifts all rev numbers by 1, but luckily I was able to find an early pair of revs I can join into one (r25 and r26). And instead of r1640 that created the trunk I&#8217;m inserting a placeholder rev.<\/p>\n<p>Old chain:<br \/>\nr1..r25<br \/>\nr26<br \/>\nr27..r1639<br \/>\nr1640 trunk created<br \/>\nr1641..<\/p>\n<p>New chain<br \/>\nr1 trunk created<br \/>\nr2..r26 known previously as r1..r25, old r26 adjoined with old r25<br \/>\nr27..r1639 as they were<br \/>\nr1640 placeholder rev inserted<br \/>\nr1641.. as they were<\/p>\n<p>That gives us perfectly valid repository meeting required standards.\u00c2\u00a0Spent around 1\u00c2\u00a0day on that.<\/p>\n<p>As part of conversion we need a list of all the authors who commit to KMR repository with their emails. We have 15 different authors registered. Finding their emails took another 2,5 hours.<\/p>\n<p>Upcoming perils are due to conversion process. Git cannot work with latest SVN repositories\u00c2\u00a0directly. Giving error<\/p>\n<blockquote><p>Expected FS format &#8216;2&#8217;; found format &#8216;6&#8217;<\/p><\/blockquote>\n<p>That is solved by starting local svn server pointing to the SVN repository, so now Git has to work not with a file:\/\/\/C:\/PathToRepo\/ path, but a svn:\/\/localhost\/. 2 days of research trial and error.<\/p>\n<p>Now git cloning is rolling in background, happily processing 1 revision in 2-5 seconds. Which gives us 6740 * 3,5sec ~= 6,5 hours of machine time.<\/p>\n<p>Hope that will work out now \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>KaM Remake was started almost 7 years ago now and at that time I had little knowledge of SVN. No wonder that KMR repository was created flawed. It missed &#8220;trunk\/branches\/tags&#8221; folders, which are an industry standard for SVN repositories. We &hellip; <a href=\"https:\/\/www.kamremake.com\/devblog\/perils-of-converting-from-svn-to-git\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/posts\/350"}],"collection":[{"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":2,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":383,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/posts\/350\/revisions\/383"}],"wp:attachment":[{"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kamremake.com\/devblog\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}