{"thread":{"id":"11531","subject":"Importing merges when converting repos from SVN to Git (fusing grafts in the Git history)","startedAt":"2008-01-08T14:48:47Z","lastAt":"2008-01-21T18:36:07Z","messageCount":3,"participants":["Benoit Sigoure","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64741","messageId":"744EF0AD-4773-4A35-B772-94621E9ADA10@lrde.epita.fr","threadId":"11531","inReplyTo":null,"subject":"Importing merges when converting repos from SVN to Git (fusing grafts in the Git history)","fromName":"Benoit Sigoure","fromEmail":"tsuna@lrde.epita.fr","sentAt":"2008-01-08T14:48:47Z","receivedAt":"2008-01-08T14:48:47Z","isPatch":false,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"Hi list,\nI'm in the processing of converting the SVN repos of my company to  \nGit.  We have been using scripts to handle the merge hell with SVN  \nand these scripts always mentioned what was merged where in the  \ncommit message.  The first line is typically: merge -r FROM:TO  \nhttps://svn.fake-company.com/svn/project/{trunk,branches/branch-name}\nI'm going to import the repositories with `git-svn' and then I'd like  \nto rewrite the entire history to take these merges in account in the  \nGit repo, if possible.  This will probably help us merging the  \n(former) SVN branches in our new Git repo.  I know I can simulate a  \nmerge with a graft and I think it will be fairly easy to write a  \nsmall script that parses the log and generates the corresponding  \ngraft file.  Now the question is: how to make these grafts part of  \nthe *real* history so that we don't have to depend on the graft file  \nanymore?\n\nI know this issue has already been raised on the ML (the \"how to  \ninclude grafts are real merges in the history\" thing) but I couldn't  \nfind the corresponding posts and can't remember the conclusion...\n\nThanks!\n\n-- \nBenoit Sigoure aka Tsuna\nEPITA Research and Development Laboratory\n"},{"id":"64743","messageId":"47839311.2010606@viscovery.net","threadId":"11531","inReplyTo":"744EF0AD-4773-4A35-B772-94621E9ADA10@lrde.epita.fr","subject":"Re: Importing merges when converting repos from SVN to Git (fusing grafts in the Git history)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-01-08T15:13:21Z","receivedAt":"2008-01-08T15:13:21Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Benoit Sigoure schrieb:\n> I'm going to import the repositories with `git-svn' and then I'd like to\n> rewrite the entire history to take these merges in account in the Git\n> repo, if possible.  This will probably help us merging the (former) SVN\n> branches in our new Git repo.  I know I can simulate a merge with a\n> graft and I think it will be fairly easy to write a small script that\n> parses the log and generates the corresponding graft file.  Now the\n> question is: how to make these grafts part of the *real* history so that\n> we don't have to depend on the graft file anymore?\n> \n> I know this issue has already been raised on the ML (the \"how to include\n> grafts are real merges in the history\" thing) but I couldn't find the\n> corresponding posts and can't remember the conclusion...\n\n\tgit-filter-branch --tag-name-filter=cat --all\n\nshould do it. It rewrites nothing but the parenthood, so you will find\nthat the rewritten history shares everything with the original history up\nto the first merge(s).\n\nYou better run this on a \"cp -al\" copy of the original converted\nrepository because it *overwrites* the tags.\n\n-- Hannes\n"},{"id":"66164","messageId":"A35436D5-71EA-4185-BBC1-4ECCE4D63A0E@lrde.epita.fr","threadId":"11531","inReplyTo":"47839311.2010606@viscovery.net","subject":"Re: Importing merges when converting repos from SVN to Git","fromName":"Benoit Sigoure","fromEmail":"tsuna@lrde.epita.fr","sentAt":"2008-01-21T18:36:07Z","receivedAt":"2008-01-21T18:36:07Z","isPatch":false,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"Hi people,\nI wrote a script (svn-merge2git [1]) that helps to convert SVN merges  \nto Git merges.  The script basically detects the merges from their  \ncommit message and re-create them properly on the Git side.  It took  \nme several iterations to get it right but it eventually successfully  \nconverted a SVN repo with ~2500 revisions in a dozen of branches with  \n~100 merges in between them.  The script can be used when one wants  \nto entirely convert a SVN repo to a Git one while preserving the  \nmerges (that is, showing the merges in the Git history).  I guess it  \ncan also be used to inject merges in the history of a git-svn repo to  \nfacilitate merging of SVN branches with Git, although I haven't had  \ntime to experiment this for now.\n\nI hope this will be helpful to others.\n\n[1] Code and explanations at: http://repo.or.cz/w/svn-merge2git.git\n\n-- \nBenoit Sigoure aka Tsuna\nEPITA Research and Development Laboratory\n"}]}