{"thread":{"id":"7931","subject":"git-svn and local only topic branch","startedAt":"2007-05-01T16:40:05Z","lastAt":"2007-05-03T11:24:01Z","messageCount":6,"participants":["Guilhem Bonnefille","Adam Roben","Andy Parkins","Steven Grimm"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"40833","messageId":"8b65902a0705010940pb3bfb16u624d470068351624@mail.gmail.com","threadId":"7931","inReplyTo":null,"subject":"git-svn and local only topic branch","fromName":"Guilhem Bonnefille","fromEmail":"guilhem.bonnefille@gmail.com","sentAt":"2007-05-01T16:40:05Z","receivedAt":"2007-05-01T16:40:05Z","isPatch":false,"sender":{"key":"guilhem.bonnefille@gmail.com","avatar":"https://gravatar.com/avatar/375364bfee1f61197c540e37465abe3619fc24eb3a36b0edcea7f15b124036b0?d=mp&s=160"},"body":"Hi,\n\nI'm using Git as a SVN frontend (via git-svn). Recently, I made a\ntopic branch, I did some job on it and wish to \"upload\" my work (on\nthe SVN). But, I do not want \"pushing\" all commits, I only want to\ncreate a single commit on the SVN, while keeping full commits on my\nGit repo. But I did not find how to do this.\n\nHere my story.\nLet's call \"upstream\" the local branch connected to the SVN, the raw\nSVN mirror branch is remotes/upstream. Now, I create a branch \"topic\"\nfrom \"upstream\" and I do job:\n\no--o--o (upstream, remotes/upstream)\n         \\\n          o--o--o--o (topic)\n\nI want the following result:\n\no--o--o-------------- o (upstream, remotes/upstream)\n         \\             /\n          o--o--o--o (topic)\n\nSo I did \"git-merge \"Merge\" upstream topic\". But, the merge action\ndecided to do a fast-forward. It's not correct because I really don't\nwant to \"pollute\" the SVN with all my commits.\n\nSo I rewinded and I did \"git-merge --squash \"Merge\" upstream topic\".\nThis time, it seems to work as I obtained a single commit on upstream\nbranch. But this commit does not have ancestry link with the topic\nbranch. Here is it:\n\no--o--o--o (upstream, remotes/upstream)\n         \\\n          o--o--o--o (topic)\n\nIs there a way to do what I want?\n\n-- \nGuilhem BONNEFILLE\n-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com\n-=- mailto:guilhem.bonnefille@gmail.com\n-=- http://nathguil.free.fr/\n"},{"id":"40834","messageId":"0E0C5313-0DCA-4DE5-96C5-9AD74758B68A@apple.com","threadId":"7931","inReplyTo":"8b65902a0705010940pb3bfb16u624d470068351624@mail.gmail.com","subject":"Re: git-svn and local only topic branch","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-05-01T16:45:48Z","receivedAt":"2007-05-01T16:45:48Z","isPatch":false,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"On May 1, 2007, at 9:40 AM, Guilhem Bonnefille wrote:\n\n> Hi,\n>\n> I'm using Git as a SVN frontend (via git-svn). Recently, I made a\n> topic branch, I did some job on it and wish to \"upload\" my work (on\n> the SVN). But, I do not want \"pushing\" all commits, I only want to\n> create a single commit on the SVN, while keeping full commits on my\n> Git repo. But I did not find how to do this.\n\n    If you just want to make a commit to Subversion containing all the  \nchanges on your branch, then you should be able to do this:\n\ngit svn commit-diff upstream topic\n\n    That will take the entire diff between upstream and your topic  \nbranch and make one commit to Subversion containing that diff.\n\n-Adam\n"},{"id":"40837","messageId":"8b65902a0705011030l43d693fcoa831f1764cbbfb58@mail.gmail.com","threadId":"7931","inReplyTo":"0E0C5313-0DCA-4DE5-96C5-9AD74758B68A@apple.com","subject":"Re: git-svn and local only topic branch","fromName":"Guilhem Bonnefille","fromEmail":"guilhem.bonnefille@gmail.com","sentAt":"2007-05-01T17:30:01Z","receivedAt":"2007-05-01T17:30:01Z","isPatch":false,"sender":{"key":"guilhem.bonnefille@gmail.com","avatar":"https://gravatar.com/avatar/375364bfee1f61197c540e37465abe3619fc24eb3a36b0edcea7f15b124036b0?d=mp&s=160"},"body":"On 5/1/07, Adam Roben <aroben@apple.com> wrote:\n> On May 1, 2007, at 9:40 AM, Guilhem Bonnefille wrote:\n> > I'm using Git as a SVN frontend (via git-svn). Recently, I made a\n> > topic branch, I did some job on it and wish to \"upload\" my work (on\n> > the SVN). But, I do not want \"pushing\" all commits, I only want to\n> > create a single commit on the SVN, while keeping full commits on my\n> > Git repo. But I did not find how to do this.\n>\n>     If you just want to make a commit to Subversion containing all the\n> changes on your branch, then you should be able to do this:\n>\n> git svn commit-diff upstream topic\n>\n>     That will take the entire diff between upstream and your topic\n> branch and make one commit to Subversion containing that diff.\n\nYes, I want to make a single commit on Subversion containing all the\nchanges of my topic branch. But I also want to keep track of this\n\"merge\" in my local Git repo. So I want that the new commit on my\nupstream branch store an ancestry with both upstream and topic\nbranches.\n\nI fear that \"commit-diff\" will only produce a commit on SVN, that will\nbe stored as a single and normal commit on my (local) upstream branch.\n\n-- \nGuilhem BONNEFILLE\n-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com\n-=- mailto:guilhem.bonnefille@gmail.com\n-=- http://nathguil.free.fr/\n"},{"id":"40843","messageId":"200705011929.57466.andyparkins@gmail.com","threadId":"7931","inReplyTo":"8b65902a0705010940pb3bfb16u624d470068351624@mail.gmail.com","subject":"Re: git-svn and local only topic branch","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-05-01T18:29:51Z","receivedAt":"2007-05-01T18:29:51Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Tuesday 2007, May 01, Guilhem Bonnefille wrote:\n\n> o--o--o--o (upstream, remotes/upstream)\n>          \\\n>           o--o--o--o (topic)\n>\n> Is there a way to do what I want?\n\nNo.  Subversion doesn't do merge tracking.  What you're asking for would \nrequire that.  While git-svn is good, it cannot give subversion \nabilities it doesn't have.\n\nIt's an easy trap to fall into because git makes it so easy that you can \nforget that not everyone else can do it.\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"40920","messageId":"4638E127.4010303@midwinter.com","threadId":"7931","inReplyTo":"8b65902a0705010940pb3bfb16u624d470068351624@mail.gmail.com","subject":"Re: git-svn and local only topic branch","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-05-02T19:06:15Z","receivedAt":"2007-05-02T19:06:15Z","isPatch":false,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Guilhem Bonnefille wrote:\n> I want the following result:\n>\n> o--o--o-------------- o (upstream, remotes/upstream)\n>         \\             /\n>          o--o--o--o (topic)\n\nI did something similar recently:\n\nhttp://www.spinics.net/lists/git/msg29119.html\n\nThe secret is to do a squash merge (git merge --squash) and commit that \nas a single revision onto the branch you commit into svn.\n\n1--2--3------------4 (upstream)\n       \\\n        A--B--C--D   (topic)\n\nAs far as git's history is concerned, at this point you have a topic \nbranch with a bunch of commits ABCD, and an upstream branch with a bunch \nof commits 1234. Revision 4 has the contents of ABCD but is not marked \nas a merge in git's revision history, which means git-svn won't be \nconfused since it doesn't know how to follow merges.\n\nNow you do git svn dcommit to commit revision 4, which shows up as one \ncommit on the svn side. git-svn will delete your revision 4 and create a \nnew one whose comment includes the svn revision ID, so you'll have:\n\n1--2--3------------4' (upstream)\n       \\\n        A--B--C--D    (topic)\n\nSince git-svn will never look earlier than revision 4' to figure out \nwhich svn revision it should use as a basis for future svn commits, you \ncan do whatever you want with the history up to revision 4'. In \nparticular, you can use git's \"grafts\" feature to fake git into thinking \nthat a merge actually took place.\n\nOpen .git/info/grafts in your favorite editor and add a line with three \nSHA-1 hashes:\n\nhash-of-4' hash-of-3 hash-of-D\n\nNow as far as git is concerned you have the history you want:\n\n1--2--3------------4' (upstream)\n       \\          /\n        A--B--C--D    (topic)\n\nSubsequent merges on the git side, whether they're squashed or not, will \nknow about the merge you've just done.\n\nIn his reply to my script, Junio correctly pointed out that all this \nfiddling really ought to be happening in git-svn itself; it ought to \nknow that you've done a merge and should record that fact directly in \nthe metadata for 4' rather than treating it as a single-parent commit. \nIf you do the above a zillion times you'll end up with a huge grafts \nfile which is not so clean. But as a stopgap measure, this does work \nadequately.\n\n-Steve\n"},{"id":"40955","messageId":"8b65902a0705030424o4bd63435h143ba36ca5166902@mail.gmail.com","threadId":"7931","inReplyTo":"4638E127.4010303@midwinter.com","subject":"Re: git-svn and local only topic branch","fromName":"Guilhem Bonnefille","fromEmail":"guilhem.bonnefille@gmail.com","sentAt":"2007-05-03T11:24:01Z","receivedAt":"2007-05-03T11:24:01Z","isPatch":false,"sender":{"key":"guilhem.bonnefille@gmail.com","avatar":"https://gravatar.com/avatar/375364bfee1f61197c540e37465abe3619fc24eb3a36b0edcea7f15b124036b0?d=mp&s=160"},"body":"On 5/2/07, Steven Grimm <koreth@midwinter.com> wrote:\n> In his reply to my script, Junio correctly pointed out that all this\n> fiddling really ought to be happening in git-svn itself; it ought to\n> know that you've done a merge and should record that fact directly in\n> the metadata for 4' rather than treating it as a single-parent commit.\n> If you do the above a zillion times you'll end up with a huge grafts\n> file which is not so clean. But as a stopgap measure, this does work\n> adequately.\n\nYes, it's seems just fine. Thanks for the tips.\n\nI'm not aware with the internal Git's features. As grafts seems to be\na quick hack, is it posible to imagine that, after git-svn rewrited 4\nin 4', an other tool rewrites (completly) the commit to produce a 4\"\nwith 2 parents?\n\n-- \nGuilhem BONNEFILLE\n-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com\n-=- mailto:guilhem.bonnefille@gmail.com\n-=- http://nathguil.free.fr/\n"}]}