{"thread":{"id":"10246","subject":"Split a subversion repo into several git repos","startedAt":"2007-10-11T12:51:00Z","lastAt":"2007-10-12T20:27:24Z","messageCount":11,"participants":["Eivind LM","Patrick Doyle","Jonathan del Strother","Karl Hasselström","Sam Vilain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"55464","messageId":"op.tz09zaizjwclfx@ichi","threadId":"10246","inReplyTo":null,"subject":"Split a subversion repo into several git repos","fromName":"Eivind LM","fromEmail":"eivliste@online.no","sentAt":"2007-10-11T12:51:00Z","receivedAt":"2007-10-11T12:51:00Z","isPatch":false,"sender":{"key":"eivliste@online.no","avatar":null},"body":"Hi,\nI would like to convert a subversion repository to Git. The subversion  \nrepository used to track development of several projects (only slightly  \nrelated), and I would like to divide the repository into several smaller  \ngit repositories.\n\nFor example, I want to convert one subversion repository which contains  \nthe folders:\ntrunk/projectA\ntrunk/projectB\n\ninto two git repositories:\nprojectA.git\nprojectB.git\n\nAs far as I have understood, the way to do this is to\n1) Convert the entire subversion repository to git with git-svn.\n2) Make two copies of the whole new git-repository (projectA.git and  \nprojectB.git).\n3) Use git-rm to remove projectB from projectA.git, and projectA from  \nprojectB.git.\n\nThis works fine, but both git-repositories now carries the history for  \nboth projects. If possible, I would like to \"clean\" the history in the  \nrepositories, so that I don't see history information for projectA when I  \nam browsing logs in projectB.git. Has anyone been in the same situation?  \nDo you have suggestions on how it can be solved?\n\nAny help will be greatly appreciated.\n\nThanks,\nEivind\n"},{"id":"55465","messageId":"e2a1d0aa0710110624x2b50cfafo9bfdc176ba9063ce@mail.gmail.com","threadId":"10246","inReplyTo":"op.tz09zaizjwclfx@ichi","subject":"Re: Split a subversion repo into several git repos","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2007-10-11T13:24:59Z","receivedAt":"2007-10-11T13:24:59Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"If you look through the Subversion FAQ or the book (I forget where\nI've seen it -- but I know I've seen it), you can export/filter out a\ntree from a subversion repository and load it into a new repository.\nThen you can import from that new repository.\n\nThis presumes you have direct access to the subversion repository and\ncan run commands like svnadmin --dump.\n\n--wpd\n\n\nOn 10/11/07, Eivind LM <eivliste@online.no> wrote:\n> Hi,\n> I would like to convert a subversion repository to Git. The subversion\n> repository used to track development of several projects (only slightly\n> related), and I would like to divide the repository into several smaller\n> git repositories.\n>\n> For example, I want to convert one subversion repository which contains\n> the folders:\n> trunk/projectA\n> trunk/projectB\n>\n> into two git repositories:\n> projectA.git\n> projectB.git\n>\n> As far as I have understood, the way to do this is to\n> 1) Convert the entire subversion repository to git with git-svn.\n> 2) Make two copies of the whole new git-repository (projectA.git and\n> projectB.git).\n> 3) Use git-rm to remove projectB from projectA.git, and projectA from\n> projectB.git.\n>\n> This works fine, but both git-repositories now carries the history for\n> both projects. If possible, I would like to \"clean\" the history in the\n> repositories, so that I don't see history information for projectA when I\n> am browsing logs in projectB.git. Has anyone been in the same situation?\n> Do you have suggestions on how it can be solved?\n>\n> Any help will be greatly appreciated.\n>\n> Thanks,\n> Eivind\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"55466","messageId":"27DDC599-C7A0-4660-B5C6-7DFCEB137C14@steelskies.com","threadId":"10246","inReplyTo":"op.tz09zaizjwclfx@ichi","subject":"Re: Split a subversion repo into several git repos","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2007-10-11T13:46:26Z","receivedAt":"2007-10-11T13:46:26Z","isPatch":false,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"\nOn 11 Oct 2007, at 13:51, Eivind LM wrote:\n\n> Hi,\n> I would like to convert a subversion repository to Git. The  \n> subversion repository used to track development of several projects  \n> (only slightly related), and I would like to divide the repository  \n> into several smaller git repositories.\n>\n> For example, I want to convert one subversion repository which  \n> contains the folders:\n> trunk/projectA\n> trunk/projectB\n>\n> into two git repositories:\n> projectA.git\n> projectB.git\n\nI have a slightly different layout to you -\n\nprojectA/trunk\nprojectA/branches\nprojectA/tags\nprojectB/trunk\nprojectB/branches\nprojectB/tags\netc\n\n- but I've been creating separate git repos from that with (for  \nexample) :\n\ngit-svn init -t tags -b branches -T trunk http://svn.host.com/projectA\ngit-svn fetch\n\n\nOr will git-svn not work with your sort of layout?\n"},{"id":"55467","messageId":"e2a1d0aa0710110702o359d6cd9yaa213be6a43924e4@mail.gmail.com","threadId":"10246","inReplyTo":"27DDC599-C7A0-4660-B5C6-7DFCEB137C14@steelskies.com","subject":"Re: Split a subversion repo into several git repos","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2007-10-11T14:02:21Z","receivedAt":"2007-10-11T14:02:21Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"On 10/11/07, Jonathan del Strother <maillist@steelskies.com> wrote:\n> I have a slightly different layout to you -\n>\n> projectA/trunk\n> projectA/branches\n> projectA/tags\n> projectB/trunk\n> projectB/branches\n> projectB/tags\n> etc\n>\n> - but I've been creating separate git repos from that with (for\n> example) :\n>\n> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA\n> git-svn fetch\n>\nJust be aware that, if you follow this approach, the commit logs\ncreated by git-svn will be rewritten (relative to the original SVN\nlogs) with the SVN repository revision and ID information.  I believe\nyou can disable this behavior by passing the --no-metadata option to\n\"git-svn init\", but I haven't tried this yet.\n\nI also believe that this approach will leave your git repository in\nsuch as state as to recognize that there is a remote repository from\nwhich this repository was fetched.  I have no idea what implications\nand long term repercussions (if any) this has.  It just dawned on me\nas I was rereading the git-svn man page to look for the --no-metdata\noption and read that it will \"Set the noMetadata option in the\n[svn-remote] config\".  Most of that is still Greek to me.\n\n--wpd\n"},{"id":"55474","messageId":"20071011145019.GA5315@diana.vm.bytemark.co.uk","threadId":"10246","inReplyTo":"e2a1d0aa0710110702o359d6cd9yaa213be6a43924e4@mail.gmail.com","subject":"Re: Split a subversion repo into several git repos","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-11T14:50:19Z","receivedAt":"2007-10-11T14:50:19Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-11 10:02:21 -0400, Patrick Doyle wrote:\n\n> Just be aware that, if you follow this approach, the commit logs\n> created by git-svn will be rewritten (relative to the original SVN\n> logs) with the SVN repository revision and ID information. I believe\n> you can disable this behavior by passing the --no-metadata option to\n> \"git-svn init\", but I haven't tried this yet.\n\nJust to clarify: this is true for all git-svn use, and has nothing to\ndo with this particular case.\n\n> I also believe that this approach will leave your git repository in\n> such as state as to recognize that there is a remote repository from\n> which this repository was fetched. I have no idea what implications\n> and long term repercussions (if any) this has. It just dawned on me\n> as I was rereading the git-svn man page to look for the --no-metdata\n> option and read that it will \"Set the noMetadata option in the\n> [svn-remote] config\". Most of that is still Greek to me.\n\nApart from the metadata appended to the commit messages (which you can\nturn off with --no-metadata), all the extra data saved by git-svn is\npurely local. Meaning that you can always get rid of it by cloning the\nrepository, if you can't think of a cleverer way to do it.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55512","messageId":"470E9858.5050904@vilain.net","threadId":"10246","inReplyTo":"27DDC599-C7A0-4660-B5C6-7DFCEB137C14@steelskies.com","subject":"Re: Split a subversion repo into several git repos","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-10-11T21:40:40Z","receivedAt":"2007-10-11T21:40:40Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Jonathan del Strother wrote:\n>> For example, I want to convert one subversion repository which  \n>> contains the folders:\n>> trunk/projectA\n>> trunk/projectB\n>>\n>> into two git repositories:\n>> projectA.git\n>> projectB.git\n> \n> I have a slightly different layout to you -\n> \n> projectA/trunk\n> projectA/branches\n> projectA/tags\n> projectB/trunk\n> projectB/branches\n> projectB/tags\n> etc\n> \n> - but I've been creating separate git repos from that with (for  \n> example) :\n> \n> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA\n> git-svn fetch\n> \n> \n> Or will git-svn not work with your sort of layout?\n\nIt does work.  Use:\n\ngit-svn init -t projectA/tags -b projectA/branches \\\n   -T trunk/projectA http://svn.host.com/\ngit fetch\n\nAlso you can expect the import results of each branch to be the same\nregardless of whether you import all at once using a command like the\nabove, or import a single path without passing -t / -b / -T to git svn init.\n\nIf you have a lot of projects to mine from a single repository, use\nsvnsync or SVN::Mirror/svk and then import from the local repository\nwith --use-svm-props.\n\nSam.\n"},{"id":"55560","messageId":"op.tz28hnd2jwclfx@ichi","threadId":"10246","inReplyTo":"470E9858.5050904@vilain.net","subject":"Re: Split a subversion repo into several git repos","fromName":"Eivind LM","fromEmail":"eivliste@online.no","sentAt":"2007-10-12T14:14:01Z","receivedAt":"2007-10-12T14:14:01Z","isPatch":false,"sender":{"key":"eivliste@online.no","avatar":null},"body":"On Thu, 11 Oct 2007 23:40:40 +0200, Sam Vilain <sam@vilain.net> wrote:\n\n> Jonathan del Strother wrote:\n>>> For example, I want to convert one subversion repository which\n>>> contains the folders:\n>>> trunk/projectA\n>>> trunk/projectB\n>>>\n>>> into two git repositories:\n>>> projectA.git\n>>> projectB.git\n>>\n>> I have a slightly different layout to you -\n>>\n>> projectA/trunk\n>> projectA/branches\n>> projectA/tags\n>> projectB/trunk\n>> projectB/branches\n>> projectB/tags\n>> etc\n>>\n>> - but I've been creating separate git repos from that with (for\n>> example) :\n>>\n>> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA\n>> git-svn fetch\n>>\n>>\n>> Or will git-svn not work with your sort of layout?\n>\n> It does work.  Use:\n>\n> git-svn init -t projectA/tags -b projectA/branches \\\n>    -T trunk/projectA http://svn.host.com/\n> git fetch\n\nWith my paths this translates into\n\n   $ git-svn init -b eivindlm/branches \\\n                  -t eivindlm/tags \\\n                  -T eivindlm/trunk/src/probesimulator \\\n                  file:///svn-repo/\n, which prints the happy message:\n   Initialized empty Git repository in .git/\n\nThe next command is unfortunately not as happy:\n   $ git fetch\n   fatal: 'origin': unable to chdir or not a git archive\n   fatal: The remote end hung up unexpectedly\n   Cannot get the repository state from origin\n\nI suppose this is due to my silly svn-repo layout... However, after some  \ntrial and error it seems like the following command gives me what I want  \n(I don't need tags or other branches than main):\n\n   $ git-svn clone file:///svn-repo/ --follow-parent \\\n                   -T eivindlm/trunk/src/probesimulator\n\nIt seems to realize that the probesimulator directory has moved around in  \nmy tree, and gives me history for files that belongs in this directory  \nonly (and not history for other directories). So the problem appears to be  \nsolved for my part, unless you see a reason for why I should not do it in  \nthis way.\n\n> [...]\n\nThanks a lot for the help to everyone who replied!\n\nEivind\n"},{"id":"55559","messageId":"op.tz28kglcjwclfx@ichi","threadId":"10246","inReplyTo":"e2a1d0aa0710110624x2b50cfafo9bfdc176ba9063ce@mail.gmail.com","subject":"Re: Split a subversion repo into several git repos","fromName":"Eivind LM","fromEmail":"eivliste@online.no","sentAt":"2007-10-12T14:15:42Z","receivedAt":"2007-10-12T14:15:42Z","isPatch":false,"sender":{"key":"eivliste@online.no","avatar":null},"body":"Thanks,\nI found svndumpfilter in the svn book, and gave it a try. Unfortunately it  \nseems to be confused about files that have moved around in the repository,  \nI was at least not able to make it dump the entire history for a directory  \nthat over time has changed name, and that contains files that have moved  \nin from other directories.\n\nEivind\n\nOn Thu, 11 Oct 2007 15:24:59 +0200, Patrick Doyle <wpdster@gmail.com>  \nwrote:\n\n> If you look through the Subversion FAQ or the book (I forget where\n> I've seen it -- but I know I've seen it), you can export/filter out a\n> tree from a subversion repository and load it into a new repository.\n> Then you can import from that new repository.\n>\n> This presumes you have direct access to the subversion repository and\n> can run commands like svnadmin --dump.\n>\n> --wpd\n>\n>\n> On 10/11/07, Eivind LM <eivliste@online.no> wrote:\n>> Hi,\n>> I would like to convert a subversion repository to Git. The subversion\n>> repository used to track development of several projects (only slightly\n>> related), and I would like to divide the repository into several smaller\n>> git repositories.\n>>\n>> For example, I want to convert one subversion repository which contains\n>> the folders:\n>> trunk/projectA\n>> trunk/projectB\n>>\n>> into two git repositories:\n>> projectA.git\n>> projectB.git\n>>\n>> As far as I have understood, the way to do this is to\n>> 1) Convert the entire subversion repository to git with git-svn.\n>> 2) Make two copies of the whole new git-repository (projectA.git and\n>> projectB.git).\n>> 3) Use git-rm to remove projectB from projectA.git, and projectA from\n>> projectB.git.\n>>\n>> This works fine, but both git-repositories now carries the history for\n>> both projects. If possible, I would like to \"clean\" the history in the\n>> repositories, so that I don't see history information for projectA when  \n>> I\n>> am browsing logs in projectB.git. Has anyone been in the same situation?\n>> Do you have suggestions on how it can be solved?\n>>\n>> Any help will be greatly appreciated.\n>>\n>> Thanks,\n>> Eivind\n>> -\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n>\n>\n"},{"id":"55561","messageId":"1B9700E6-5DFB-443D-9465-30E0DCAD0619@steelskies.com","threadId":"10246","inReplyTo":"op.tz28hnd2jwclfx@ichi","subject":"Re: Split a subversion repo into several git repos","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2007-10-12T14:23:44Z","receivedAt":"2007-10-12T14:23:44Z","isPatch":false,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On 12 Oct 2007, at 15:14, Eivind LM wrote:\n\n> On Thu, 11 Oct 2007 23:40:40 +0200, Sam Vilain <sam@vilain.net> wrote:\n>\n>> Jonathan del Strother wrote:\n>>>> For example, I want to convert one subversion repository which\n>>>> contains the folders:\n>>>> trunk/projectA\n>>>> trunk/projectB\n>>>>\n>>>> into two git repositories:\n>>>> projectA.git\n>>>> projectB.git\n>>>\n>>> I have a slightly different layout to you -\n>>>\n>>> projectA/trunk\n>>> projectA/branches\n>>> projectA/tags\n>>> projectB/trunk\n>>> projectB/branches\n>>> projectB/tags\n>>> etc\n>>>\n>>> - but I've been creating separate git repos from that with (for\n>>> example) :\n>>>\n>>> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA\n>>> git-svn fetch\n>>>\n>>>\n>>> Or will git-svn not work with your sort of layout?\n>>\n>> It does work.  Use:\n>>\n>> git-svn init -t projectA/tags -b projectA/branches \\\n>>   -T trunk/projectA http://svn.host.com/\n>> git fetch\n>\n> With my paths this translates into\n>\n>  $ git-svn init -b eivindlm/branches \\\n>                 -t eivindlm/tags \\\n>                 -T eivindlm/trunk/src/probesimulator \\\n>                 file:///svn-repo/\n> , which prints the happy message:\n>  Initialized empty Git repository in .git/\n>\n> The next command is unfortunately not as happy:\n>  $ git fetch\n>  fatal: 'origin': unable to chdir or not a git archive\n>  fatal: The remote end hung up unexpectedly\n>  Cannot get the repository state from origin\n\n\nI believe you actually wanted \"git-svn fetch\" here\n"},{"id":"55563","messageId":"op.tz290yyfjwclfx@ichi","threadId":"10246","inReplyTo":"1B9700E6-5DFB-443D-9465-30E0DCAD0619@steelskies.com","subject":"Re: Split a subversion repo into several git repos","fromName":"Eivind LM","fromEmail":"eivliste@online.no","sentAt":"2007-10-12T14:47:12Z","receivedAt":"2007-10-12T14:47:12Z","isPatch":false,"sender":{"key":"eivliste@online.no","avatar":null},"body":"On Fri, 12 Oct 2007 16:23:44 +0200, Jonathan del Strother  \n<maillist@steelskies.com> wrote:\n[...]\n>>\n>>  $ git-svn init -b eivindlm/branches \\\n>>                 -t eivindlm/tags \\\n>>                 -T eivindlm/trunk/src/probesimulator \\\n>>                 file:///svn-repo/\n>> , which prints the happy message:\n>>  Initialized empty Git repository in .git/\n>>\n>> The next command is unfortunately not as happy:\n>>  $ git fetch\n>>  fatal: 'origin': unable to chdir or not a git archive\n>>  fatal: The remote end hung up unexpectedly\n>>  Cannot get the repository state from origin\n>\n>\n> I believe you actually wanted \"git-svn fetch\" here\n\nYou are right, that solved the problem :)\n\nSo both methods work now, apparently giving the same result. Is there a  \ndifference between the fetch- versus the clone-approach? I am doing this  \nas a once-and-for-all import, and would like to forget everything about  \nthe subversion repository afterwards.\n\nThanks,\nEivind\n"},{"id":"55572","messageId":"470FD8AC.5000406@vilain.net","threadId":"10246","inReplyTo":"op.tz28hnd2jwclfx@ichi","subject":"Re: Split a subversion repo into several git repos","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-10-12T20:27:24Z","receivedAt":"2007-10-12T20:27:24Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Eivind LM wrote:\n>>\n>> git-svn init -t projectA/tags -b projectA/branches \\\n>>    -T trunk/projectA http://svn.host.com/\n>> git fetch\n>\n> With my paths this translates into\n>\n>   $ git-svn init -b eivindlm/branches \\\n>                  -t eivindlm/tags \\\n>                  -T eivindlm/trunk/src/probesimulator \\\n>                  file:///svn-repo/\n> , which prints the happy message:\n>   Initialized empty Git repository in .git/\n>\n> The next command is unfortunately not as happy:\n>   $ git fetch\n>   fatal: 'origin': unable to chdir or not a git archive\n>   fatal: The remote end hung up unexpectedly\n>   Cannot get the repository state from origin\n>\n> I suppose this is due to my silly svn-repo layout... However, after\n> some trial and error it seems like the following command gives me what\n> I want (I don't need tags or other branches than main):\n\nWhoops, my mistake.  That should have been \"git svn fetch\".\n\nSam.\n"}]}