{"thread":{"id":"14126","subject":"git svn clone a non-standard repository","startedAt":"2008-06-24T18:32:37Z","lastAt":"2008-06-27T01:06:16Z","messageCount":5,"participants":["John Locke","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"80941","messageId":"48613DC5.2000506@freelock.com","threadId":"14126","inReplyTo":null,"subject":"git svn clone a non-standard repository","fromName":"John Locke","fromEmail":"mail@freelock.com","sentAt":"2008-06-24T18:32:37Z","receivedAt":"2008-06-24T18:32:37Z","isPatch":false,"sender":{"key":"mail@freelock.com","avatar":null},"body":"Hi,\n\nI'm trying to create a git repo of the Dojo Toolkit, which has a quite \nnon-standard layout. There are 4 modules to the current Dojo project \nthat I care about (and some others in the repo that I'm not interested \nin). The problem is, the trunk code is split out into \n<modulename>/trunk, while tags are in tags/<tagname>/<modulename> and \nbranches are in branches/<branchname>/<modulename>. e.g:\n\nmoduleA/trunk <- contains trunk development of moduleA\nmoduleA/tags   <- empty\nmoduleA/branches <- empty\nmoduleB/trunk\nmoduleB/tags\nmoduleB/branches\nmoduleC/trunk\nmoduleC/tags\nmoduleC/branches\nmoduleD/trunk\nmoduleD/tags\nmoduleD/branches\nmoduleE/trunk <- I don't care about this one...\ntrunk/   <- contains ancient version, not actual trunk\ntags/1.0.0/moduleA <- contains tagged version of moduleA\ntags/1.0.0/moduleB <- contains tagged version of moduleB\ntags/1.0.0/moduleC <- contains tagged version of moduleC\ntags/1.0.0/moduleD <- contains tagged version of moduleD\ntags/1.0.1/moduleA\ntags/1.0.1/moduleB\n...\n\nSo I'd like to set up a git repo that tracks this SVN repository, and \nallows me to see:\nmoduleA/\nmoduleB/\nmoduleC/\nmoduleD/\n... in my checkout, whether I'm on trunk or a tag.\n\nWhat's the best way to set this up?\n\nI've started with \"git svn clone http://path/to/svn -T moduleA/trunk -t \ntags -b branches\", and it's been sucking down branches for a couple days \nnow, still not done. Can I set up moduleB/moduleC/moduleD as additional \nremotes in this same repository, and end up with the desired result? Was \nthinking I would add additional svn sections to .git/config, and then \ngit svn fetch -- will this work, or is there a better way?\n\n\nThanks,\n\n-- \nJohn Locke\n\"Open Source Solutions for Small Business Problems\"\npublished by Charles River Media, June 2004\nhttp://www.freelock.com\n"},{"id":"81128","messageId":"g3to0t$35n$1@ger.gmane.org","threadId":"14126","inReplyTo":"48613DC5.2000506@freelock.com","subject":"Re: git svn clone a non-standard repository","fromName":"Michael J Gruber","fromEmail":"michaeljgruber+gmane@fastmail.fm","sentAt":"2008-06-25T15:25:15Z","receivedAt":"2008-06-25T15:25:15Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"John Locke venit, vidit, dixit 24.06.2008 20:32:\n> Hi,\n> \n> I'm trying to create a git repo of the Dojo Toolkit, which has a quite \n> non-standard layout. There are 4 modules to the current Dojo project \n> that I care about (and some others in the repo that I'm not interested \n> in). The problem is, the trunk code is split out into \n> <modulename>/trunk, while tags are in tags/<tagname>/<modulename> and \n> branches are in branches/<branchname>/<modulename>. e.g:\n> \n> moduleA/trunk <- contains trunk development of moduleA\n> moduleA/tags   <- empty\n> moduleA/branches <- empty\n> moduleB/trunk\n> moduleB/tags\n> moduleB/branches\n> moduleC/trunk\n> moduleC/tags\n> moduleC/branches\n> moduleD/trunk\n> moduleD/tags\n> moduleD/branches\n\nAll of those module?/{tags,branches} are empty, right? I assume branches \nfollow the pattern below for tags.\n\n> moduleE/trunk <- I don't care about this one...\n> trunk/   <- contains ancient version, not actual trunk\n> tags/1.0.0/moduleA <- contains tagged version of moduleA\n> tags/1.0.0/moduleB <- contains tagged version of moduleB\n> tags/1.0.0/moduleC <- contains tagged version of moduleC\n> tags/1.0.0/moduleD <- contains tagged version of moduleD\n> tags/1.0.1/moduleA\n> tags/1.0.1/moduleB\n> ...\n> \n> So I'd like to set up a git repo that tracks this SVN repository, and \n> allows me to see:\n> moduleA/\n> moduleB/\n> moduleC/\n> moduleD/\n> ... in my checkout, whether I'm on trunk or a tag.\n\nSo you want one git repo, reflecting the modules simply by different \nsubdirs? I'm afraid that raises similar problems like those I asked \nabout in my (yet unanswered) post\n\nhttp://permalink.gmane.org/gmane.comp.version-control.git/85861\n\n> I've started with \"git svn clone http://path/to/svn -T moduleA/trunk -t \n> tags -b branches\", and it's been sucking down branches for a couple days \n\nThis should give you all \"modules\" (as subsdirs) for all branches and \ntags already. svn branch \"branchname\" becomes git remote branch \n\"branchname\", svn tag \"tagname\" becomes git remote branch \"tags/tagname\".\nNote that your new git branch trunk will contain the contents of \n\"moduleA\" only.\n\n> now, still not done. Can I set up moduleB/moduleC/moduleD as additional \n> remotes in this same repository, and end up with the desired result? Was \n> thinking I would add additional svn sections to .git/config, and then \n> git svn fetch -- will this work, or is there a better way?\n\nIf I understand your layout (and \"desires\") correctly then trunk will be \nyour only problem: you want to map \"module?/trunk\" to subdir \"module?\" \nof branch \"trunk\". This is more or less the problem I'm facing. Regular \nexpressions (other than the ones for branches and tags) in git svn \nconfig would solve this.\n\nMichael\n"},{"id":"81307","messageId":"4863E01E.9050108@freelock.com","threadId":"14126","inReplyTo":"g3to0t$35n$1@ger.gmane.org","subject":"Re: git svn clone a non-standard repository","fromName":"John Locke","fromEmail":"mail@freelock.com","sentAt":"2008-06-26T18:29:50Z","receivedAt":"2008-06-26T18:29:50Z","isPatch":false,"sender":{"key":"mail@freelock.com","avatar":null},"body":"Hi, Michael,\n\nMichael J Gruber wrote:\n>>\n>> moduleA/trunk <- contains trunk development of moduleA\n>> moduleA/tags   <- empty\n>> moduleA/branches <- empty\n>> moduleB/trunk\n>> moduleB/tags\n>> moduleB/branches\n>> moduleC/trunk\n>> moduleC/tags\n>> moduleC/branches\n>> moduleD/trunk\n>> moduleD/tags\n>> moduleD/branches\n>\n> All of those module?/{tags,branches} are empty, right? I assume \n> branches follow the pattern below for tags.\nYup.\n\n>\n>> moduleE/trunk <- I don't care about this one...\n>> trunk/   <- contains ancient version, not actual trunk\n>> tags/1.0.0/moduleA <- contains tagged version of moduleA\n>> tags/1.0.0/moduleB <- contains tagged version of moduleB\n>> tags/1.0.0/moduleC <- contains tagged version of moduleC\n>> tags/1.0.0/moduleD <- contains tagged version of moduleD\n>> tags/1.0.1/moduleA\n>> tags/1.0.1/moduleB\n>> ...\n>>\n>> So I'd like to set up a git repo that tracks this SVN repository, and \n>> allows me to see:\n>> moduleA/\n>> moduleB/\n>> moduleC/\n>> moduleD/\n>> ... in my checkout, whether I'm on trunk or a tag.\n>\n> So you want one git repo, reflecting the modules simply by different \n> subdirs? I'm afraid that raises similar problems like those I asked \n> about in my (yet unanswered) post\n>\n> http://permalink.gmane.org/gmane.comp.version-control.git/85861\n\nI saw your post, and flagged it to see if anybody answered it, yes it \ndoes seem similar.\n>\n>> I've started with \"git svn clone http://path/to/svn -T moduleA/trunk \n>> -t tags -b branches\", and it's been sucking down branches for a \n>> couple days \n>\n> This should give you all \"modules\" (as subsdirs) for all branches and \n> tags already. svn branch \"branchname\" becomes git remote branch \n> \"branchname\", svn tag \"tagname\" becomes git remote branch \"tags/tagname\".\n> Note that your new git branch trunk will contain the contents of \n> \"moduleA\" only.\n\nThat's exactly what happened.\n>\n>> now, still not done. Can I set up moduleB/moduleC/moduleD as \n>> additional remotes in this same repository, and end up with the \n>> desired result? Was thinking I would add additional svn sections to \n>> .git/config, and then git svn fetch -- will this work, or is there a \n>> better way?\n>\n> If I understand your layout (and \"desires\") correctly then trunk will \n> be your only problem: you want to map \"module?/trunk\" to subdir \n> \"module?\" of branch \"trunk\". This is more or less the problem I'm \n> facing. Regular expressions (other than the ones for branches and \n> tags) in git svn config would solve this.\n>\n\nI found in the docs a section on subtrees, and with a bit of trickery, I \nthink I'm getting what I want, though it's not simple to update. What \nI've done so far is change .git/config to:\n\n[core]\n    repositoryformatversion = 0\n    filemode = true\n    bare = false\n    logallrefupdates = true\n[svn-remote \"svn\"]\n    url = http://svn.dojotoolkit.org/src\n    branches = branches/*:refs/remotes/*\n    tags = tags/*:refs/remotes/tags/*\n[svn-remote \"dojo\"]\n    url = http://svn.dojotoolkit.org/src\n    fetch = dojo/trunk:refs/remotes/dojo-trunk\n[svn-remote \"dijit\"]\n    url = http://svn.dojotoolkit.org/src\n    fetch = dijit/trunk:refs/remotes/dijit-trunk\n[svn-remote \"dojox\"]\n    url = http://svn.dojotoolkit.org/src\n    fetch = dojox/trunk:refs/remotes/dojox-trunk\n[svn-remote \"util\"]\n    url = http://svn.dojotoolkit.org/src\n    fetch = util/trunk:refs/remotes/util-trunk\n\n\n... dojo, dijit, dojox, and util correspond to moduleA-D in my previous \nexample. So I have \"svn\" for the branches, and separate SVN sections for \nthe trunk of each module. Then I used git svn fetch \n[dojo|dijit|dojox|util] to suck down those as individual branches.\n\nNow the tricky part: I checked out a new \"work\" branch, and deleted \neverything in the working copy. Then, 4 steps out of the howto, adjusted \nto pull the particular branch from the current repository (instead of an \noutside one):\n\ngit remote add -t dojo -f dojo ./\ngit merge -s ours --no-commit dojo-trunk\ngit read-tree --prefix=dojo/ -u dojo-trunk\ngit commit -m \"merge dojo into subdirectory\"\n\n... repeat for the other modules, and I ended up with my \"work\" branch \ncontaining the full trunk for all 4 modules.\n\nNow for tracking the original project. According to the howto, you use \nthis syntax to pull down changes:\n\n git pull -s subtree Bproject master\n... when I try git pull -s subtree ./ dojo, I get \"Already up to date\", \neven though I know there are new changes. Still need to mess around with \ngit svn rebase, I guess, to get the updates working correctly.\n\nCheers,\n\n-- \nJohn Locke\n\"Open Source Solutions for Small Business Problems\"\npublished by Charles River Media, June 2004\nhttp://www.freelock.com\n"},{"id":"81309","messageId":"4863E261.8040508@freelock.com","threadId":"14126","inReplyTo":"4863E01E.9050108@freelock.com","subject":"Re: git svn clone a non-standard repository","fromName":"John Locke","fromEmail":"mail@freelock.com","sentAt":"2008-06-26T18:39:29Z","receivedAt":"2008-06-26T18:39:29Z","isPatch":false,"sender":{"key":"mail@freelock.com","avatar":null},"body":"Sorry to respond to my own post, but this section looks wrong:\n\nJohn Locke wrote:\n>\n>\n> Now the tricky part: I checked out a new \"work\" branch, and deleted \n> everything in the working copy. Then, 4 steps out of the howto, \n> adjusted to pull the particular branch from the current repository \n> (instead of an outside one):\n>\n> git remote add -t dojo -f dojo ./\n> git merge -s ours --no-commit dojo-trunk\n> git read-tree --prefix=dojo/ -u dojo-trunk\n> git commit -m \"merge dojo into subdirectory\"\n\n... since I added the remotes as svn-remote sections directly in \ngit-config, I skipped that first line.\n\nI'm going to write this all up on my blog when I get it working correctly...\n\nCheers,\n\n-- \nJohn Locke\n\"Open Source Solutions for Small Business Problems\"\npublished by Charles River Media, June 2004\nhttp://www.freelock.com\n"},{"id":"81350","messageId":"48643D08.1030904@freelock.com","threadId":"14126","inReplyTo":"4863E261.8040508@freelock.com","subject":"Re: git svn clone a non-standard repository","fromName":"John Locke","fromEmail":"mail@freelock.com","sentAt":"2008-06-27T01:06:16Z","receivedAt":"2008-06-27T01:06:16Z","isPatch":false,"sender":{"key":"mail@freelock.com","avatar":null},"body":"Okay. I think I've closed the loop, and have this updating successfully, \nif not necessarily easily.\n\nJohn Locke wrote:\n> Sorry to respond to my own post, but this section looks wrong:\n>\n> John Locke wrote:\n>>\n>>\n>> Now the tricky part: I checked out a new \"work\" branch, and deleted \n>> everything in the working copy. Then, 4 steps out of the howto, \n>> adjusted to pull the particular branch from the current repository \n>> (instead of an outside one):\n>>\n>> git remote add -t dojo -f dojo ./\n>> git merge -s ours --no-commit dojo-trunk\n>> git read-tree --prefix=dojo/ -u dojo-trunk\n>> git commit -m \"merge dojo into subdirectory\"\n>\n> ... since I added the remotes as svn-remote sections directly in \n> git-config, I skipped that first line.\n>\n>\nTo update, we need a local branch for each submodule:\n\ngit checkout -b dojo dojo-trunk <- create local branch and switch to it \n(only create it the first time through)\n\ngit svn rebase dojo-trunk  <- do this to update each local branch from \nthe remote svn repository version--must have corresponding branch \nchecked out.\n\n... now that we've merged the remote changes to a local branch, we can \nupdate our work branch from each module's branch:\n\ngit checkout work\ngit pull -s subtree ./ dojo\ngit pull -s subtree ./ dijit\n....\n\n\n\n\n-- \nJohn Locke\n\"Open Source Solutions for Small Business Problems\"\npublished by Charles River Media, June 2004\nhttp://www.freelock.com\n"}]}