{"thread":{"id":"18423","subject":"git-svn with multiple branch directories","startedAt":"2009-03-19T23:17:15Z","lastAt":"2009-03-20T10:04:11Z","messageCount":2,"participants":["Guido Ostkamp","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"108615","messageId":"alpine.LSU.2.01.0903200002390.29898@bianca.dialin.t-online.de","threadId":"18423","inReplyTo":null,"subject":"git-svn with multiple branch directories","fromName":"Guido Ostkamp","fromEmail":"git@ostkamp.fastmail.fm","sentAt":"2009-03-19T23:17:15Z","receivedAt":"2009-03-19T23:17:15Z","isPatch":false,"sender":{"key":"git@ostkamp.fastmail.fm","avatar":null},"body":"Hello,\n\nI am trying to create a git repo that tracks an SVN repo with multiple \nbranch directories.\n\nIs there any way to get this done easily?\n\nIt seems the 'git svn' command allows only to specify one 'trunk', \n'branches' and 'tag' directory.\n\nThe example usecase is the OpenOffice.org repo (it's just a private \nexperiment). I got this svn-sync'ed within 4 evening sessions, the SVN \nsize is about ~8 GB with ~270000 commits. Unfortunately their structure is\n\n   branches/\n   contrib/\n   cws/\n   dist/\n   patches/\n   tags/\n   trunk/\n\nwhere 'cws' and 'branches' both hold branches.\n\nI have seen a web-based article telling one should\n\n   git svn clone <URL>/trunk repo.git\n\nfirst, and then hack the repo.git/.git/config file manually to add entries \nlike\n\n   [svn-remote \"b1\"]\n         url = $SVN_REPO_URL/branches/b1\n         fetch = :refs/remotes/b1\n   [svn-remote \"b2\"]\n         url = $SVN_REPO_URL/branches/b2\n         fetch = :refs/remotes/b2\n   [svn-remote \"c1\"]\n         url = $SVN_REPO_URL/cws/c1\n         fetch = :refs/remotes/c1\n   ...\n\nto later use\n\n   git svn fetch <branchname>\n\nfor each branch. But even if that worked, their seems to be no easy way to \ndetect newly created branches etc. Additionally, I get two entries listed \nin 'git branch' for each, one of which with extension '@1' (seems to point \not the branch point). This doesn't seem to be the case for repo's with \nonly one branch directory converted the normal way.\n\nAny ideas?\n\nBest regards\n\nGuido\n"},{"id":"108686","messageId":"20090320100411.GB17287@dcvr.yhbt.net","threadId":"18423","inReplyTo":"alpine.LSU.2.01.0903200002390.29898@bianca.dialin.t-online.de","subject":"Re: git-svn with multiple branch directories","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-03-20T10:04:11Z","receivedAt":"2009-03-20T10:04:11Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Guido Ostkamp <git@ostkamp.fastmail.fm> wrote:\n> Hello,\n>\n> I am trying to create a git repo that tracks an SVN repo with multiple  \n> branch directories.\n>\n> Is there any way to get this done easily?\n>\n> It seems the 'git svn' command allows only to specify one 'trunk',  \n> 'branches' and 'tag' directory.\n>\n> The example usecase is the OpenOffice.org repo (it's just a private  \n> experiment). I got this svn-sync'ed within 4 evening sessions, the SVN  \n> size is about ~8 GB with ~270000 commits. Unfortunately their structure \n> is\n>\n>   branches/\n>   contrib/\n>   cws/\n>   dist/\n>   patches/\n>   tags/\n>   trunk/\n>\n> where 'cws' and 'branches' both hold branches.\n>\n> I have seen a web-based article telling one should\n>\n>   git svn clone <URL>/trunk repo.git\n>\n> first, and then hack the repo.git/.git/config file manually to add \n> entries like\n>\n>   [svn-remote \"b1\"]\n>         url = $SVN_REPO_URL/branches/b1\n>         fetch = :refs/remotes/b1\n>   [svn-remote \"b2\"]\n>         url = $SVN_REPO_URL/branches/b2\n>         fetch = :refs/remotes/b2\n>   [svn-remote \"c1\"]\n>         url = $SVN_REPO_URL/cws/c1\n>         fetch = :refs/remotes/c1\n>   ...\n>\n> to later use\n>\n>   git svn fetch <branchname>\n>\n> for each branch. But even if that worked, their seems to be no easy way \n> to detect newly created branches etc. Additionally, I get two entries \n> listed in 'git branch' for each, one of which with extension '@1' (seems \n> to point ot the branch point). This doesn't seem to be the case for \n> repo's with only one branch directory converted the normal way.\n>\n> Any ideas?\n\n\nYou should be able to do something like this:\n\n[svn-remote \"svn\"]\n\turl = $SVN_REPO_URL\n\tbranches = branches/*:refs/remotes/branches/*\n\ttags = tags/*:refs/remotes/tags/*\n\tfetch = cws/c1:refs/remotes/cws/c1\n\tfetch = cws/c2:refs/remotes/cws/c2\n\tfetch = cws/c3:refs/remotes/cws/c3\n\t...\n\nAs for generating the individual fetch lines, I would just pipe\nsvn ls $SVN_REPO_URL/cws to awk/sed/perl...\n\n-- \nEric Wong (who just realized he programs in ASP :x)\n"}]}