{"thread":{"id":"17991","subject":"git-svn starting with an empty svn repository","startedAt":"2009-02-24T13:43:25Z","lastAt":"2009-02-24T15:36:35Z","messageCount":4,"participants":["Penny Leach","Pascal Obry"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106050","messageId":"20090224134325.GA10719@mjollnir.org","threadId":"17991","inReplyTo":null,"subject":"git-svn starting with an empty svn repository","fromName":"Penny Leach","fromEmail":"penny@mjollnir.org","sentAt":"2009-02-24T13:43:25Z","receivedAt":"2009-02-24T13:43:25Z","isPatch":false,"sender":{"key":"penny@mjollnir.org","avatar":null},"body":"Dear list,\n\nThis is maybe an abuse of what git-svn is designed to do, but nevertheless\nI need to do it.\n\nI'm working with a project (Moodle) that still uses CVS for its upstream\nVCS.  The friendly folk at Catalyst in NZ run a git import of this, that a\nlot of the community uses as their (read only) upstream instead of CVS.\n\nSo far so good.\n\nHowever, now for various political reasons, I must (at least) publish\nchanges to SVN.  I'm going to be patch trading a lot between my work\nbranches, and Moodle's CVS directly and I don't want to lose the power that\ngit gives me while doing that.  So I want to keep git as the tool I use for\ndevelopment, that acts as a go-between for me between CVS and SVN.\n\nSo what I'd really like to do is something like this:\n\n- clone from Catalyst's git mirror\n- push that to SVN using git-svn\n- keep working, committing patches to Moodle CVS, and pulling from Catalyst\n  regularly, while pushing both my local changes and new pulled upstream\n  patches, to SVN, using git-svn\n\nThe problem seems to be that I'm starting out with an *empty* SVN\nrepository.  Almost all of the documentation I've found on this topic is\nfor going from an existing SVN repository to git.\n\nTheoretically at least, the opposite direction should also be possible, but\nI'm having a hard time figuring it out.  I followed the steps outlined in\nthe comments here:\nhttp://quirkygba.blogspot.com/2007/10/using-git-with-google-code-hosting.html\n\nBut I didn't have much luck, it seems as though the rebased trunk branch\ndoesn't share any ancestry with the original Catalyst sources, so regularly\nupdating is going to be hard (unless I create graft entries for each time I\ndo it I guess?).\n\nNot to mention the fact that it's 8 years of history that takes a while to\nimport and after about 5 tries I didn't even manage to get git svn to\ndcommit it and got impatient and cross and stopped trying.\n\nSo really I want to know is - is this even possible? Is using the above\nsteps along with the graft approach the best|only way to do it?  How\nbrittle is this to maintain, if I even manage to get it imported?\n\nAny ideas or advice?\n\nFor reference, the CVS/Git import can be cloned here:\nhttp://git.catalyst.net.nz/git/moodle-r2.git but will take a long time to\ncome down.\n\nCheers for any help.\n\nPenny\n\n\n-- \n/* ---------------------------------------------------\nPenny Leach | http://mjollnir.org | http://she.geek.nz\nGPG: 8347 00FC B5BF 6CC0 0FC9 AB90 1875 120A A30E C22B\n--------------------------------------------------- */\n"},{"id":"106052","messageId":"a2633edd0902240619v633eacq4ff7ffd20f66da04@mail.gmail.com","threadId":"17991","inReplyTo":"20090224134325.GA10719@mjollnir.org","subject":"Re: git-svn starting with an empty svn repository","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-02-24T14:19:13Z","receivedAt":"2009-02-24T14:19:13Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Penny,\n\nI've been trying to do the exact same things. I'm using Git to import\nfrom CVS and export into a Subversion repository.\n\nWhat I have done:\n\n- I have used cvsimport for the CVS repository (no problem)\n\n- I have created an empty repository using svnadmin\n\n- I have imported the svn trunk into Git\n\n- I'm cherry-picking any new commits from my cvs-imported branch\n(master) into the git-svn one (named svn-trunk)\n\nFor this last point, I'm using this code sniped:\n\n<<\nfor i in $(git cherry svn-trunk master | sed -n 's/^+ //p'); do\n   echo Applying $i;\n   (git cherry-pick --no-commit $i &&\n    git log --pretty=format:\"Author: %an <%ae>%nDate  :\n%ad%n%n%s%n%b\" -1 $i > /tmp/cm &&\n    git commit --file=/tmp/cm) || (echo Cannot commit $i; exit 1)\ndone\n>>\n\nI'm editing the log to properly record original author and date.\n\nThere is maybe better solutions...\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"106057","messageId":"20090224150358.GA18138@mjollnir.org","threadId":"17991","inReplyTo":"a2633edd0902240619v633eacq4ff7ffd20f66da04@mail.gmail.com","subject":"Re: git-svn starting with an empty svn repository","fromName":"Penny Leach","fromEmail":"penny@mjollnir.org","sentAt":"2009-02-24T15:03:58Z","receivedAt":"2009-02-24T15:03:58Z","isPatch":false,"sender":{"key":"penny@mjollnir.org","avatar":null},"body":"Thanks for the reply!  I'm glad I'm not the only person crazy enough to\nattempt this :)\n\nOn Tue, Feb 24, 2009 at 03:19:13PM +0100, Pascal Obry wrote:\n> - I have created an empty repository using svnadmin\n> - I have imported the svn trunk into Git\n> - I'm cherry-picking any new commits from my cvs-imported branch\n> (master) into the git-svn one (named svn-trunk)\n\nRight - and you used this method to import the original history into the\nsvn-trunk branch, as well as any new patches? Or did you do a once off\nimport of the history using a different method?\n\nOut of interest - how long is the history you're importing?  Mine is about\n32,000 commits and it takes forever to import into SVN (only to get to a\nbroken point and have to start again...)\n\n\nPenny\n\n-- \n/* ---------------------------------------------------\nPenny Leach | http://mjollnir.org | http://she.geek.nz\nGPG: 8347 00FC B5BF 6CC0 0FC9 AB90 1875 120A A30E C22B\n--------------------------------------------------- */\n"},{"id":"106059","messageId":"a2633edd0902240736m6b87fd13l22d0420931064f56@mail.gmail.com","threadId":"17991","inReplyTo":"20090224150358.GA18138@mjollnir.org","subject":"Re: git-svn starting with an empty svn repository","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-02-24T15:36:35Z","receivedAt":"2009-02-24T15:36:35Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Penny,\n\n> Right - and you used this method to import the original history into the\n> svn-trunk branch, as well as any new patches?\n\nYes.\n\n> Out of interest - how long is the history you're importing?  Mine is about\n> 32,000 commits and it takes forever to import into SVN (only to get to a\n> broken point and have to start again...)\n\nThe repository is having today 28347 commits exactly, so it is close in\nsize to yours. I have migrated something like 27800 commits initialy,\nAFAIR it tooks something like 28 hours to complete.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"}]}