{"thread":{"id":"14003","subject":"git-svn equivalent to \"svn switch --relocate\"","startedAt":"2008-06-17T16:06:02Z","lastAt":"2008-06-17T21:42:14Z","messageCount":2,"participants":["Sam Hocevar","Steven Walter"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"80152","messageId":"20080617160602.GB29897@zoy.org","threadId":"14003","inReplyTo":null,"subject":"git-svn equivalent to \"svn switch --relocate\"","fromName":"Sam Hocevar","fromEmail":"sam@zoy.org","sentAt":"2008-06-17T16:06:02Z","receivedAt":"2008-06-17T16:06:02Z","isPatch":false,"sender":{"key":"sam@zoy.org","avatar":"https://gravatar.com/avatar/1fc1e5d8c3a8d737f14572135671adfbc0e61ffba5c3bc1d1b8a6f4aac764470?d=mp&s=160"},"body":"   I know this has been addressed a few times, but since I haven't found\nany reasonable way to relocate a git-svn repository (after a protocol\nchange, or a server name change) I thought I'd share how I did it.\n\n   Step 1 is to edit \".git/config\" and modify the \"url = \" line so\nthat it reflects the new repository address. For instance:\n\n-\turl = http://svn.gnome.org/svn/gimp\n+\turl = svn+ssh://svn.gnome.org/svn/gimp\n\n   From now on, git-svn will basically stop working, because the\n\"git-svn-id:\" lines in the commit logs will no longer match its\nconfiguration. And git-filter-branch is of no use here either, because\nit will change the md5sum of each commit, and git-svn will no longer be\nable to track the commits.\n\n   Step 2 is therefore to temporarily hack git-svn to make it think\nthe commit messages do use the new URL. This is done at the end of the\n\"extract_metadata\" subroutine:\n\n \t\t($rev, $uuid) = ($id =~/^\\s*git-svn-id:\\s(\\d+)\\@([a-f\\d\\-]+)/);\n \t}\n+\t$url =~ s|http://svn.gnome.org/svn/gimp/|svn+ssh://svn.gnome.org/svn/gimp/|;\n \treturn ($url, $rev, $uuid);\n }\n\n   This will usually be needed only until the next SVN commit is merged\nand the git-svn tree is rebased.\n\n   Hope this can help a few. Unfortunately I don't understand the\ngit-svn source code well enough to work on a cleaner way to do that.\n\nCheers,\n-- \nSam.\n"},{"id":"80166","messageId":"e06498070806171442s6c097884j76ed6c98908a3eb1@mail.gmail.com","threadId":"14003","inReplyTo":"20080617160602.GB29897@zoy.org","subject":"Re: git-svn equivalent to \"svn switch --relocate\"","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2008-06-17T21:42:14Z","receivedAt":"2008-06-17T21:42:14Z","isPatch":false,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"On Tue, Jun 17, 2008 at 12:06 PM, Sam Hocevar <sam@zoy.org> wrote:\n>   I know this has been addressed a few times, but since I haven't found\n> any reasonable way to relocate a git-svn repository (after a protocol\n> change, or a server name change) I thought I'd share how I did it.\n>\n>   Step 1 is to edit \".git/config\" and modify the \"url = \" line so\n> that it reflects the new repository address. For instance:\n>\n> -       url = http://svn.gnome.org/svn/gimp\n> +       url = svn+ssh://svn.gnome.org/svn/gimp\n>\n>   From now on, git-svn will basically stop working, because the\n> \"git-svn-id:\" lines in the commit logs will no longer match its\n> configuration. And git-filter-branch is of no use here either, because\n> it will change the md5sum of each commit, and git-svn will no longer be\n> able to track the commits.\n\nIt is not so hard to work around this problem.  After you run\nfilter-branch, make sure the ref used by git-svn in refs/remotes\npoints to the new (altered) hash.  Then, delete the .git/svn/<remote>\ndirectory corresponding to the svn-remote you changed (trunk,\nprobably).  When you next run \"git svn fetch\", git-svn will regenerate\nits revmap using the new hash, and everything should be peachy after\nthat.\n-- \n-Steven Walter <stevenrwalter@gmail.com>\n\"A human being should be able to change a diaper, plan an invasion,\nbutcher a hog, conn a ship, design a building, write a sonnet, balance\naccounts, build a wall, set a bone, comfort the dying, take orders,\ngive orders, cooperate, act alone, solve equations, analyze a new\nproblem, pitch manure, program a computer, cook a tasty meal, fight\nefficiently, die gallantly. Specialization is for insects.\"\n -Robert Heinlein\n"}]}