{"thread":{"id":"25769","subject":"Git-Svn-Bridge","startedAt":"2010-11-17T14:56:34Z","lastAt":"2010-11-21T20:24:44Z","messageCount":3,"participants":["Christoph Bartoschek","Thomas Ferris Nicolaisen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"156049","messageId":"227dr7-3nl.ln1@burns.bruehl.pontohonk.de","threadId":"25769","inReplyTo":null,"subject":"Git-Svn-Bridge","fromName":"Christoph Bartoschek","fromEmail":"bartoschek@gmx.de","sentAt":"2010-11-17T14:56:34Z","receivedAt":"2010-11-17T14:56:34Z","isPatch":false,"sender":{"key":"bartoschek@gmx.de","avatar":null},"body":"Hi,\n\nwe would like to use a Git-Svn-Bridge as it is described in Jon Loeliger's \nbook. However there are some open questions:\n\nWe have the bridge repository and the bare repository created. \n\na) Are the developers supposed to work on a branch that follows  master from \nthe bare repository or on a branch that follows svn/trunk on the master? I \nassume they follow the master.\n\nb) How do we get changes from the bare repository to the bridge repository? \nShould there be a new branch for the changes or should one use master from \nthe bridge?\n\nc) How do we get changes from subversion to the bare repository?\n\nd) Are the changes from subversion applied to the bare repository master or \nonly to the svn/* branches?\n\n\nThanks\nChristoph\n"},{"id":"156189","messageId":"AANLkTimH=iv5y5OdBXnVM=EVY2+FvY7dTgnLc4pZSkWP@mail.gmail.com","threadId":"25769","inReplyTo":"227dr7-3nl.ln1@burns.bruehl.pontohonk.de","subject":"Re: Git-Svn-Bridge","fromName":"Thomas Ferris Nicolaisen","fromEmail":"tfnico@gmail.com","sentAt":"2010-11-19T16:30:17Z","receivedAt":"2010-11-19T16:30:17Z","isPatch":false,"sender":{"key":"tfnico@gmail.com","avatar":"https://gravatar.com/avatar/628cf28a25ca4c596c7284562100f70f0ef908bcbfadd4da1eb3d48c23658d01?d=mp&s=160"},"body":"I would like to add a +1 on this topic.\n\nThere are very few \"official\" resources or de-facto recipes on how to\nset up a git-svn bridge.\n\nAccording to the 2010 survey [1], roughly 20% use git-svn in some way.\nA subset of these are probably very interested in a git-svn-bridge\nsetup that works.\n\nI've experimented with my own \"hybrid bridge\" setup [2], but I've yet\nto hear whether it's wrong or can be done better. Someone on #git\nclaimed it was more complicated that it had to be, but as far as I've\nheard, the setup in Loeliger's book is even worse [3] (no offense to\nhis book though, I haven't read it but heard it's great).\n\nI've roamed through this mailing list, StackOverflow, and generally\ngoogled all over, but I haven't found any *really* good setups. It's\nnot mentioned in the GitSVN migration guide [4]. With the amount of\npeople still using git-svn, I would've thought this topic would get\nsome more attention.\n\nSome say that creating a centralized bridge is generally bad idea, and\nit's better for all to just individually use git-svn as an SVN-client\ndirectly. But I'm sure if I had advocated this at my company,\ncheckout/update performance wouldn't impress many, and I would still\nbe the only git-user. Thanks to the git-svn bridge, we are now a\nhandful Git-users, using Git for builds in Hudson, and steadily\ngaining traction.\n\nSo, to shape it in form of a question: What is the optimal git-svn bridge setup?\n\nThanks,\n\n-Thomas\n\n[1] https://git.wiki.kernel.org/index.php/GitSurvey2010\n[2] http://www.tfnico.com/presentations/git-and-subversion\n[3] http://blog.emmanuelbernard.com/2010/05/git-how-my-life-has-improved-since-last-month-when-i-used-svn/comment-page-1/#comment-2248\n[4] https://git.wiki.kernel.org/index.php/SvnMigration\n\n\n2010/11/17 Christoph Bartoschek <bartoschek@gmx.de>:\n> Hi,\n>\n> we would like to use a Git-Svn-Bridge as it is described in Jon Loeliger's\n> book. However there are some open questions:\n>\n> We have the bridge repository and the bare repository created.\n>\n> a) Are the developers supposed to work on a branch that follows  master from\n> the bare repository or on a branch that follows svn/trunk on the master? I\n> assume they follow the master.\n>\n> b) How do we get changes from the bare repository to the bridge repository?\n> Should there be a new branch for the changes or should one use master from\n> the bridge?\n>\n> c) How do we get changes from subversion to the bare repository?\n>\n> d) Are the changes from subversion applied to the bare repository master or\n> only to the svn/* branches?\n>\n>\n> Thanks\n> Christoph\n>\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":"156293","messageId":"dpbor7-rtk.ln1@homer.bruehl.pontohonk.de","threadId":"25769","inReplyTo":"AANLkTimH=iv5y5OdBXnVM=EVY2+FvY7dTgnLc4pZSkWP@mail.gmail.com","subject":"Re: Git-Svn-Bridge","fromName":"Christoph Bartoschek","fromEmail":"bartoschek@gmx.de","sentAt":"2010-11-21T20:24:44Z","receivedAt":"2010-11-21T20:24:44Z","isPatch":false,"sender":{"key":"bartoschek@gmx.de","avatar":null},"body":"Thomas Ferris Nicolaisen wrote:\n\n...\n\n> I've experimented with my own \"hybrid bridge\" setup [2], but I've yet\n> to hear whether it's wrong or can be done better. Someone on #git\n> claimed it was more complicated that it had to be, but as far as I've\n> heard, the setup in Loeliger's book is even worse [3] (no offense to\n> his book though, I haven't read it but heard it's great).\n\n...\n\n> So, to shape it in form of a question: What is the optimal git-svn bridge\n> setup?\n\nI see the following advantages of the Loeliger setup:\n\n- The master branch on the bare repository reflects the whole history. The \nbranches and merges the git users perform are visible in this branch.\n\n- The git users do not need to know about subversion.\n\n\nThis is how I currently understand the setup:\n\nA.1. Clone the subversion repository to a fetching git repository:\n\ngit svn clone -s --prefix=svn/ <SVN-URL> fetch.git\n\nA.2. Fix master to check to the correct commit:\n\ngit reset --hard svn/trunk\n\nA.3. Create a local branch for each subversion branch to follow:\n\ngit branch branch_A svn/branch_A\n\nA.4. Create a bare repository that is used as depot for git:\n\ngit init --bare bare.git\n\nA.5. Push the branches to the depot:\n\ngit push --all ../bare.git\ngit push ../bare.git 'refs/remotes/svn/*:refs/heads/svn/*\n\nNow the setup is done and the git users can start to clone the depot and \ncontinue to work. The convention is that the svn/* branches always only \nreflect the subversion history. One does not directly work on them. Work is \ndone on master and the branches that have been created locally.\n\n\nIf there are no updates to the bare repository but changes to subversion \nthen one can update the bare repository with:\n\nB.1. Go to the fetch repository and get the newest svn data:\n\ngit svn fetch\n\nB.2. Merge the new data to each branch that tracks a svn branch:\n\ngit checkout master\ngit merge svn/trunk\ngit checkout branch_A\ngit merge svn/branch_A\n\nB.3. Push the new data to the bare repository:\n\ngit push -all ../bare.git\ngit push ../bare.git 'refs/remotes/svn/*:refs/heads/svn/*'\n\n\nAre there shortcuts to get the commands in B.2 and B.3 in a single one?\n\n\nNow changes are commited to master on the bare repository and one wants to \npush them to the subversion server. If there are changes on the subversion \nside also fetch them:\n\nC.1: Go to the fetch repository and pull the changes from the bare \nrepository:\n\ngit checkout master\ngit pull ../bare.git master\ngit checkout branch_A\ngit pull ../bare.git branch_A\n\nIs there a shortcut?\n\nC.2: Fetch changes from svn:\n\ngit svn fetch\n\nC.3: Create detached heads from the svn branches one follows, merge the \nchanges from the git branches and dcommit them:\n\ngit checkout svn/trunk\ngit merge --no-ff --log master\ngit svn dcommit\n\nSame for branch_A.\n\nC.4: Merge the newly created subversion commit to the git branches:\n\ngit checkout master\ngit merge svn/trunk\ngit checkout branch_A\ngit merge svn/branch_A\n\nC.5: Push the new commits to the bare repository:\n\ngit push --all ../bare.git\ngit push  ../bare.git 'refs/remotes/svn/*:refs/heads/svn/*'\n\n\nThis is how I understand the setup. Do you see any mistakes or ways to \nimprove it?\n\nThanks\nChristoph\n"}]}