{"thread":{"id":"17562","subject":"hot to fix git svn import or just discard 'branches' folder","startedAt":"2009-02-04T17:03:07Z","lastAt":"2009-02-04T20:21:03Z","messageCount":5,"participants":["Marius Seritan","Brian Gernhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"103165","messageId":"7E976223-6794-4E87-94A5-DEA224759700@decodeideas.com","threadId":"17562","inReplyTo":null,"subject":"hot to fix git svn import or just discard 'branches' folder","fromName":"Marius Seritan","fromEmail":"mseritan@decodeideas.com","sentAt":"2009-02-04T17:03:07Z","receivedAt":"2009-02-04T17:03:07Z","isPatch":false,"sender":{"key":"mseritan@decodeideas.com","avatar":null},"body":"I imported over night an svn repository with the command:\n\ngit svn clone --prefix svn/ -r 860  http://svn.some.com/svn/someproject\n\nThe svn repository uses the usual trunk, branches, tag so I (wrongly?)  \nassumed I do not need to pass any command switches regarding the  \nstructure of the repo.\n\nI obviously did something wrong because now I have a git repository  \nwith just one remote branch and it contains the folders trunk,  \nbranches and tag. I do not want to reimport because it is taking lots  \nof time and bandwidth.\n\nHow can I fix this? I do not really need the old branches and tags, I  \nwant to be able to track new branches and I just want to have the  \ntrunk history.\n\n\nThanks for any pointers.\n\nMarius\n"},{"id":"103179","messageId":"D92EB2AE-392D-4F05-8DF3-999BE78C80FF@silverinsanity.com","threadId":"17562","inReplyTo":"7E976223-6794-4E87-94A5-DEA224759700@decodeideas.com","subject":"Re: hot to fix git svn import or just discard 'branches' folder","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2009-02-04T18:39:59Z","receivedAt":"2009-02-04T18:39:59Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Feb 4, 2009, at 12:03 PM, Marius Seritan wrote:\n\n> I imported over night an svn repository with the command:\n>\n> git svn clone --prefix svn/ -r 860  http://svn.some.com/svn/ \n> someproject\n>\n> The svn repository uses the usual trunk, branches, tag so I  \n> (wrongly?) assumed I do not need to pass any command switches  \n> regarding the structure of the repo.\n\n\"git svn clone URL\" attempts to act like \"svn co URL\", but with  \nhistory.  If you only want to download the trunk, then you should add  \n\"/trunk\" to the end of the URL.  If you want to capture all the  \nbranches, tags, etc you should use \"--stdlayout\" (also spelled \"-s\").\n\n> I obviously did something wrong because now I have a git repository  \n> with just one remote branch and it contains the folders trunk,  \n> branches and tag. I do not want to reimport because it is taking  \n> lots of time and bandwidth.\n\nI believe fixing this without reimporting requires using \"git filter- \nbranch\".  I'm unfamiliar with it, so I can't help you with that part.\n\nHowever, I'm curious as to why this took a lot of time because the \"-r  \n860\" on the command line should tell git-svn to only download a single  \nrevision.  Is it a particularly repository?\n\n~~ Brian\n"},{"id":"103183","messageId":"5713EFD1-E6E7-4FD5-BF17-FDA5FF6F7C6B@decodeideas.com","threadId":"17562","inReplyTo":"D92EB2AE-392D-4F05-8DF3-999BE78C80FF@silverinsanity.com","subject":"Re: hot to fix git svn import or just discard 'branches' folder","fromName":"Marius Seritan","fromEmail":"mseritan@decodeideas.com","sentAt":"2009-02-04T19:05:21Z","receivedAt":"2009-02-04T19:05:21Z","isPatch":false,"sender":{"key":"mseritan@decodeideas.com","avatar":null},"body":"Thanks Brian,\n\n\nOn Feb 4, 2009, at 10:39 AM, Brian Gernhardt wrote:\n\n>\n> On Feb 4, 2009, at 12:03 PM, Marius Seritan wrote:\n>\n>> I imported over night an svn repository with the command:\n>>\n>> git svn clone --prefix svn/ -r 860  http://svn.some.com/svn/someproject\n>>\n>> The svn repository uses the usual trunk, branches, tag so I  \n>> (wrongly?) assumed I do not need to pass any command switches  \n>> regarding the structure of the repo.\n>\n> \"git svn clone URL\" attempts to act like \"svn co URL\", but with  \n> history.  If you only want to download the trunk, then you should  \n> add \"/trunk\" to the end of the URL.  If you want to capture all the  \n> branches, tags, etc you should use \"--stdlayout\" (also spelled \"-s\").\n\nI want to capture the current trunk and any new branches. It seems the  \n-s is required if I do a reimport.\n\n\n>\n>\n>> I obviously did something wrong because now I have a git repository  \n>> with just one remote branch and it contains the folders trunk,  \n>> branches and tag. I do not want to reimport because it is taking  \n>> lots of time and bandwidth.\n>\n> I believe fixing this without reimporting requires using \"git filter- \n> branch\".  I'm unfamiliar with it, so I can't help you with that part.\n\nThanks, I will look into it. From the first read this seems to be  \npretty advanced.\n\n>\n>\n> However, I'm curious as to why this took a lot of time because the \"- \n> r 860\" on the command line should tell git-svn to only download a  \n> single revision.  Is it a particularly repository?\n\nAll of the repository was imported including branches in spite of the - \nr. This is private repository for a company's web site, it has your  \nusual assortment of jars and the history has a dozen branches and a  \ncouple of tags.  The size on the disk is about 3GB, I was a bit  \nsurprised by it.\n\nMarius\n\n>\n>\n> ~~ Brian\n"},{"id":"103185","messageId":"06C1D783-D51B-49E9-92A2-C1EA035BE3D6@decodeideas.com","threadId":"17562","inReplyTo":"5713EFD1-E6E7-4FD5-BF17-FDA5FF6F7C6B@decodeideas.com","subject":"Re: hot to fix git svn import or just discard 'branches' folder","fromName":"Marius Seritan","fromEmail":"mseritan@decodeideas.com","sentAt":"2009-02-04T19:24:49Z","receivedAt":"2009-02-04T19:24:49Z","isPatch":false,"sender":{"key":"mseritan@decodeideas.com","avatar":null},"body":"\nOn Feb 4, 2009, at 11:05 AM, Marius Seritan wrote:\n>>\n>> I believe fixing this without reimporting requires using \"git  \n>> filter-branch\".  I'm unfamiliar with it, so I can't help you with  \n>> that part.\n>\n> Thanks, I will look into it. From the first read this seems to be  \n> pretty advanced.\n\nOk, I think I killed it :-/\n\nI did\ngit filter-branch --subdirectory-filter trunk -- --all\n\nThis cleaned up git and I have just the trunk for 218MB, that's much  \nmore acceptable. Unfortunately 'git svn rebase' now returns:\n\nUnable to determine upstream SVN information from working tree history\n\nI went into the .git/config and added a trunk but no luck. I also  \nedited .git/svn/.metadata in the same way.\n\nAs another data point git svn log is still working.\n\n\nMarius\n"},{"id":"103194","messageId":"217FD3AA-39FA-4F81-A4A6-DC7F6F6905B5@decodeideas.com","threadId":"17562","inReplyTo":"06C1D783-D51B-49E9-92A2-C1EA035BE3D6@decodeideas.com","subject":"Re: hot to fix git svn import or just discard 'branches' folder","fromName":"Marius Seritan","fromEmail":"mseritan@decodeideas.com","sentAt":"2009-02-04T20:21:03Z","receivedAt":"2009-02-04T20:21:03Z","isPatch":false,"sender":{"key":"mseritan@decodeideas.com","avatar":null},"body":"\nOn Feb 4, 2009, at 11:24 AM, Marius Seritan wrote:\n\n>\n> On Feb 4, 2009, at 11:05 AM, Marius Seritan wrote:\n>>>\n>>> I believe fixing this without reimporting requires using \"git  \n>>> filter-branch\".  I'm unfamiliar with it, so I can't help you with  \n>>> that part.\n>>\n>> Thanks, I will look into it. From the first read this seems to be  \n>> pretty advanced.\n>\n> Ok, I think I killed it :-/\n>\n> I did\n> git filter-branch --subdirectory-filter trunk -- --all\n>\n> This cleaned up git and I have just the trunk for 218MB, that's much  \n> more acceptable. Unfortunately 'git svn rebase' now returns:\n>\n> Unable to determine upstream SVN information from working tree history\n>\n> I went into the .git/config and added a trunk but no luck. I also  \n> edited .git/svn/.metadata in the same way.\n>\n> As another data point git svn log is still working.\n>\n>\n> Marius\n>\n>\n\n\nLast follow-up on svn git. I ended up re-reading the docs (duh) and  \ndoing the following:\n\ngit svn init -s --prefix=svn/   http://svn.name.com/svn/project\ngit svn fetch -r 800:HEAD\n\nThis brought down the last 2 branches and the trunk. It took a couple  \nof minutes and uses 120MB of disk space. Much better than hours and  \n3GB of disk.\n\nLove it,\n\nMarius\n"}]}