{"thread":{"id":"14665","subject":"Stitching together two split segments from svn","startedAt":"2008-07-24T23:33:09Z","lastAt":"2008-07-25T07:21:28Z","messageCount":4,"participants":["Liam Healy","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"84807","messageId":"654935030807241633g763e622br4feb8b4e23ee64e2@mail.gmail.com","threadId":"14665","inReplyTo":null,"subject":"Stitching together two split segments from svn","fromName":"Liam Healy","fromEmail":"lnp@healy.washington.dc.us","sentAt":"2008-07-24T23:33:09Z","receivedAt":"2008-07-24T23:33:09Z","isPatch":false,"sender":{"key":"lnp@healy.washington.dc.us","avatar":null},"body":"Hi,\n\nI have a project whose history is stored in two separate svn\nrepositories.  The first repository I kept privately during initial\ndevelopment, the second started when I posted it publicly and does not\nhave the history of the first.  I am trying to reunite them under git.\n The development of the first was linear, so after using git svn, the\nhistory looks like:\n\n a - b - ... - c - d = HEAD (old repository)\n\nand the second has one branch \"ffa\":\n\n(new repository)\n T - d - e - ... - f - g - h - ... - j   master\n                      \\\n                       k - l - .... - m  ffa\n\nNote that T is the \"trunk\" initial commit on the svn repo that has no\nfiles.  The second commit d is identical to the HEAD of old, as\nverified by git diff.\nHowever, when I remote add these two into a single repository, they\nshow up as two detached chains, with no connection between them.  I\nthought git rebase would reconnect them.  However, when I do that on\neach branch (master and ffa), I get the following:\n\n a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n                      \\\n                       e - ... -f - g - k - l - .... - m  ffa\n\ninstead of what I would like\n\n a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n                                     \\\n                                      k - l - .... - m  ffa\n\nThat is to say, those commits from the new repository that have a\ncommon history for the two branches are duplicated.  The commits are\nlisted separately and have different SHA IDs, but they are clearly the\nsame commits (same comments, same svn version number).  Is there any\nway to do what I want?  Really, all I want to do is change the parent\nof \"e\" to be the HEAD of the old repository.\n\nThank you.\n\nLiam\n"},{"id":"84809","messageId":"m3ljzqvo6i.fsf@localhost.localdomain","threadId":"14665","inReplyTo":"654935030807241633g763e622br4feb8b4e23ee64e2@mail.gmail.com","subject":"Re: Stitching together two split segments from svn","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-07-24T23:48:40Z","receivedAt":"2008-07-24T23:48:40Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Liam Healy\" <lnp@healy.washington.dc.us> writes:\n\n> I have a project whose history is stored in two separate svn\n> repositories.  The first repository I kept privately during initial\n> development, the second started when I posted it publicly and does not\n> have the history of the first.  I am trying to reunite them under git.\n>  The development of the first was linear, so after using git svn, the\n> history looks like:\n> \n>  a - b - ... - c - d = HEAD (old repository)\n> \n> and the second has one branch \"ffa\":\n> \n> (new repository)\n>  T - d - e - ... - f - g - h - ... - j   master\n>                       \\\n>                        k - l - .... - m  ffa\n> \n> Note that T is the \"trunk\" initial commit on the svn repo that has no\n> files.  The second commit d is identical to the HEAD of old, as\n> verified by git diff.\n> However, when I remote add these two into a single repository, they\n> show up as two detached chains, with no connection between them.  I\n> thought git rebase would reconnect them.  However, when I do that on\n> each branch (master and ffa), I get the following:\n> \n>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n>                       \\\n>                        e - ... -f - g - k - l - .... - m  ffa\n> \n> instead of what I would like\n> \n>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n>                                      \\\n>                                       k - l - .... - m  ffa\n> \n> That is to say, those commits from the new repository that have a\n> common history for the two branches are duplicated.  The commits are\n> listed separately and have different SHA IDs, but they are clearly the\n> same commits (same comments, same svn version number).  Is there any\n> way to do what I want?  Really, all I want to do is change the parent\n> of \"e\" to be the HEAD of the old repository.\n\nIf this is initial import, and not published anywhere, the simplest (I\nthink) solution would be to use grafts file (.git/info/grafts) to\nchange parent of 'k' from 'g' in ffa to 'g' in master, by adding the\nline with:\n\n  <sha1 of 'k'> <sha1 of 'g' on master>\n\nto .git/info/grafts.  Then examine history if everything is now all\nright (for example using gitk), and if everything is O.K. run\ngit-filter-branch.\n\nSee documentation for details.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"84828","messageId":"654935030807241941p620201a2q21bb4513cd21225d@mail.gmail.com","threadId":"14665","inReplyTo":"m3ljzqvo6i.fsf@localhost.localdomain","subject":"Re: Stitching together two split segments from svn","fromName":"Liam Healy","fromEmail":"lnp@healy.washington.dc.us","sentAt":"2008-07-25T02:41:14Z","receivedAt":"2008-07-25T02:41:14Z","isPatch":false,"sender":{"key":"lnp@healy.washington.dc.us","avatar":null},"body":"Jakub,\n\nThanks for the advice -- this did exactly what I wanted.\n\nFor anyone else wanting to do this: one thing that threw me for a\nwhile was that .git/info/grafts does not accept an abbreviated SHA,\nthe full 40 hex digits is needed.  I would see \"bad graft data\" from\ngitk with no other explanation.  There is very little documentation\nthat I could find on the grafts file; the best I could find was in the\nman page for git-filter branch,\nhttp://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html.\n\nLiam\n\nOn Thu, Jul 24, 2008 at 7:48 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> \"Liam Healy\" <lnp@healy.washington.dc.us> writes:\n>\n>> I have a project whose history is stored in two separate svn\n>> repositories.  The first repository I kept privately during initial\n>> development, the second started when I posted it publicly and does not\n>> have the history of the first.  I am trying to reunite them under git.\n>>  The development of the first was linear, so after using git svn, the\n>> history looks like:\n>>\n>>  a - b - ... - c - d = HEAD (old repository)\n>>\n>> and the second has one branch \"ffa\":\n>>\n>> (new repository)\n>>  T - d - e - ... - f - g - h - ... - j   master\n>>                       \\\n>>                        k - l - .... - m  ffa\n>>\n>> Note that T is the \"trunk\" initial commit on the svn repo that has no\n>> files.  The second commit d is identical to the HEAD of old, as\n>> verified by git diff.\n>> However, when I remote add these two into a single repository, they\n>> show up as two detached chains, with no connection between them.  I\n>> thought git rebase would reconnect them.  However, when I do that on\n>> each branch (master and ffa), I get the following:\n>>\n>>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n>>                       \\\n>>                        e - ... -f - g - k - l - .... - m  ffa\n>>\n>> instead of what I would like\n>>\n>>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master\n>>                                      \\\n>>                                       k - l - .... - m  ffa\n>>\n>> That is to say, those commits from the new repository that have a\n>> common history for the two branches are duplicated.  The commits are\n>> listed separately and have different SHA IDs, but they are clearly the\n>> same commits (same comments, same svn version number).  Is there any\n>> way to do what I want?  Really, all I want to do is change the parent\n>> of \"e\" to be the HEAD of the old repository.\n>\n> If this is initial import, and not published anywhere, the simplest (I\n> think) solution would be to use grafts file (.git/info/grafts) to\n> change parent of 'k' from 'g' in ffa to 'g' in master, by adding the\n> line with:\n>\n>  <sha1 of 'k'> <sha1 of 'g' on master>\n>\n> to .git/info/grafts.  Then examine history if everything is now all\n> right (for example using gitk), and if everything is O.K. run\n> git-filter-branch.\n>\n> See documentation for details.\n>\n> --\n> Jakub Narebski\n> Poland\n> ShadeHawk on #git\n>\n"},{"id":"84839","messageId":"200807250921.35412.jnareb@gmail.com","threadId":"14665","inReplyTo":"654935030807241941p620201a2q21bb4513cd21225d@mail.gmail.com","subject":"Re: Stitching together two split segments from svn","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-07-25T07:21:28Z","receivedAt":"2008-07-25T07:21:28Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 25 Jul 2008, Liam Healy wrote:\n> \n> Thanks for the advice -- this did exactly what I wanted.\n> \n> For anyone else wanting to do this: one thing that threw me for a\n> while was that .git/info/grafts does not accept an abbreviated SHA,\n> the full 40 hex digits is needed.  I would see \"bad graft data\" from\n> gitk with no other explanation.  There is very little documentation\n> that I could find on the grafts file; the best I could find was in the\n> man page for git-filter branch:\n>\n>   http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html.\n\nYou can find definition of grafts in `gitglossary', and where you can\nfind them together with description of grafts file format in\n`gitrepository-layout'\n-- \nJakub Narebski\nPoland\n"}]}