{"thread":{"id":"955","subject":"Converting SVN repository to git","startedAt":"2005-06-15T18:47:20Z","lastAt":"2005-06-18T03:26:48Z","messageCount":3,"participants":["Art Haas","Adam Mercer","Seth W. Klein"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"4979","messageId":"20050615184720.GF31997@artsapartment.org","threadId":"955","inReplyTo":null,"subject":"Converting SVN repository to git","fromName":"Art Haas","fromEmail":"ahaas@airmail.net","sentAt":"2005-06-15T18:47:20Z","receivedAt":"2005-06-15T18:47:20Z","isPatch":false,"sender":{"key":"ahaas@airmail.net","avatar":null},"body":"Hi.\n\nThe utilities for converting CVS repositories to git repos have become\npart of the standard git package, and hopefully they'll be used to\nconvert many CVS based projects to git. I've not seen anything, though,\non switching Subversion repositories to git. Has there been any public\nactivity in writing a tool/script to do this? Perhaps some offline\ndiscussion about doing this?\n\nThanks in advance.\n\nArt Haas\n-- \nMan once surrendering his reason, has no remaining guard against absurdities\nthe most monstrous, and like a ship without rudder, is the sport of every wind.\n\n-Thomas Jefferson to James Smith, 1822\n"},{"id":"4982","messageId":"799406d605061515024f8d1fd6@mail.gmail.com","threadId":"955","inReplyTo":"20050615184720.GF31997@artsapartment.org","subject":"Re: Converting SVN repository to git","fromName":"Adam Mercer","fromEmail":"ramercer@gmail.com","sentAt":"2005-06-15T22:02:15Z","receivedAt":"2005-06-15T22:02:15Z","isPatch":false,"sender":{"key":"ramercer@gmail.com","avatar":"https://gravatar.com/avatar/16dc719817f62b75075d529ce4ea992ee82bb1a08e45a3029797f39223d6ee64?d=mp&s=160"},"body":"On 15/06/05, Art Haas <ahaas@airmail.net> wrote:\n\n> The utilities for converting CVS repositories to git repos have become\n> part of the standard git package, and hopefully they'll be used to\n> convert many CVS based projects to git. I've not seen anything, though,\n> on switching Subversion repositories to git. Has there been any public\n> activity in writing a tool/script to do this? Perhaps some offline\n> discussion about doing this?\n\nYou could use something like svn2cvs (http://svn2cvs.tigris.org) and\nthen use the cvs2git tools.\n\nCheers\n\nAdam\n"},{"id":"5013","messageId":"20050618032648.GA23034@bubook.sethwklein.net","threadId":"955","inReplyTo":"20050615184720.GF31997@artsapartment.org","subject":"Re: Converting SVN repository to git","fromName":"Seth W. Klein","fromEmail":"sk@sethwklein.net","sentAt":"2005-06-18T03:26:48Z","receivedAt":"2005-06-18T03:26:48Z","isPatch":false,"sender":{"key":"sk@sethwklein.net","avatar":null},"body":"On Wed, Jun 15, 2005 at 01:47:20PM -0500, Art Haas wrote:\n> \n> [....] I've not seen anything, though,\n> on switching Subversion repositories to git. Has there been any public\n> activity in writing a tool/script to do this? Perhaps some offline\n> discussion about doing this?\n\nThe following script is what I used to convert a simple svn repository.\nIt doesn't handle branches or tags and contains buggy use of grep and\ninscrutable uncommented use of sed but it should be a starting place for\nsomeone with a more complex repository available for testing.\n\nexport GIT_AUTHOR_EMAIL=sk@sethwklein.net\nexport GIT_COMMITTER_EMAIL=sk@sethwklein.net\nsvn co -r 1 file:///home/sk/rep/oakheart/trunk oakheart\ncd oakheart\ngit-init-db\nfor REV in `seq 2 692`; do\n    echo -n $REV' '\n    svn update -r $REV > .svnupdate\n    sed -nr 's/^A +//p' .svnupdate \\\n    | while read F; do [ -f \"$F\" ] && echo \"$F\"; done \\\n    | xargs -r git-update-cache --add --\n    sed -nr 's/^D +//p' .svnupdate \\ \n    | while read F; do git-ls-files | grep \"^$F\"'\\(/\\|$\\)'; done \\\n    | xargs -r git-update-cache --remove --\n    sed -nr 's/^U +//p' .svnupdate \\\n    | while read F; do [ -f \"$F\" ] && echo \"$F\"; done \\\n    | xargs -r git-update-cache --\n    PARENT=\n    [ -f .git/HEAD ] &&\n        PARENT='-p '`cat .git/HEAD`\n    svn log -r $REV | sed -n '1,3d;$d;H;/^$/!{s/.*//;x;s/\\n//;p}' \\\n    | git-commit-tree `git-write-tree` $PARENT > .git/HEAD\ndone\n\nCheers,\nSeth W. Klein\n-- \nsk@sethwklein.net     AIM: sethwklein     http://www.sethwklein.net/\n"}]}