{"thread":{"id":"11324","subject":"Question about git-svn import","startedAt":"2007-12-17T17:18:29Z","lastAt":"2007-12-21T13:11:40Z","messageCount":8,"participants":["Pascal Obry","Steven Walter","Jörg Sommer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"63442","messageId":"4766AF65.5060706@obry.net","threadId":"11324","inReplyTo":null,"subject":"Question about git-svn import","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-17T17:18:29Z","receivedAt":"2007-12-17T17:18:29Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nHi,\n\nYou'll find a script into this message that reproduce what I'll describe\nbelow. Basically the Subversion repository add a given structure in the\npast then rearranged to use the \"standard\" structure. The former\nstructure was:\n\n   <root>\n      |\n      | - dir1\n      | - dir2\n\nThe new one is:\n\n   <root>\n      |\n      |- trunk\n      |    | - dir1\n      |    | - dir2\n      |- branches\n      |- tags\n\nNow I want to import this project into Git (using git-svn) as the\nproject won't leave Subversion for the moment. When doing:\n\n   $ git svn clone -s <repo> <git-repo>\n\nIn git-repo we get only the commits done inside <root>/trunk and not the\ncommits done in the former repository.\n\nThe question is what is the best way to deal with such a case with git-svn ?\n\nThanks.\n\n############################ CUT HERE #############################\n#!/bin/sh\n\nREP=file://$(pwd)/repo\n\nrm -fr repo co-repo git-repo\n\nsvnadmin create repo\n\nsvn co $REP co-repo\ncd co-repo\nmkdir dir\necho file1 > dir/file1\nsvn add dir dir/file1\nsvn ci -m \"ci1\" dir dir/file1\n\nsvn mkdir -m \"create trunk\" $REP/trunk\nsvn mkdir -m \"create branches\" $REP/branches\nsvn mkdir -m \"create tags\" $REP/tags\n\nsvn move -m \"move dir under trunk\" $REP/dir $REP/trunk/dir\n\nsvn update\nsleep 2\n\necho file1 >> trunk/dir/file1\nsvn ci -m \"ci2\" trunk/dir/file1\n\nsleep 2\nsvn update\n\ncd ..\n\ngit svn clone -s $REP git-repo\n############################ CUT HERE #############################\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63554","messageId":"20071218034836.GA27080@dervierte","threadId":"11324","inReplyTo":"4766AF65.5060706@obry.net","subject":"Re: Question about git-svn import","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2007-12-18T03:48:36Z","receivedAt":"2007-12-18T03:48:36Z","isPatch":false,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"On Mon, Dec 17, 2007 at 06:18:29PM +0100, Pascal Obry wrote:\n> You'll find a script into this message that reproduce what I'll describe\n> below. Basically the Subversion repository add a given structure in the\n> past then rearranged to use the \"standard\" structure. The former\n> structure was:\n> \n>    <root>\n>       |\n>       | - dir1\n>       | - dir2\n> \n> The new one is:\n> \n>    <root>\n>       |\n>       |- trunk\n>       |    | - dir1\n>       |    | - dir2\n>       |- branches\n>       |- tags\n> \n> Now I want to import this project into Git (using git-svn) as the\n> project won't leave Subversion for the moment. When doing:\n> \n>    $ git svn clone -s <repo> <git-repo>\n> \n> In git-repo we get only the commits done inside <root>/trunk and not the\n> commits done in the former repository.\n> \n> The question is what is the best way to deal with such a case with git-svn ?\n\nNot sure if this is the best way, but I would recommend cloning into two\nrepositories, then combining them.  So you already have the newer\nchanges with the standard layout.  You would now:\n\n    $ git svn init <repo>\n\nAnd only fetch the revisions before the layout change.  You could then\ncombine the two repositories using .git/info/grafts and\ngit-rewrite-branch.\n-- \n-Steven Walter <stevenrwalter@gmail.com>\nFreedom is the freedom to say that 2 + 2 = 4\nB2F1 0ECC E605 7321 E818  7A65 FC81 9777 DC28 9E8F \n"},{"id":"63563","messageId":"4767724A.9040207@obry.net","threadId":"11324","inReplyTo":"20071218034836.GA27080@dervierte","subject":"Re: Question about git-svn import","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T07:10:02Z","receivedAt":"2007-12-18T07:10:02Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Steven Walter a écrit :\n> Not sure if this is the best way, but I would recommend cloning into two\n> repositories, then combining them.  \n\nI feared that :)\n\n> So you already have the newer\n> changes with the standard layout.  You would now:\n> \n>     $ git svn init <repo>\n> \n> And only fetch the revisions before the layout change.  You could then\n> combine the two repositories using .git/info/grafts and\n> git-rewrite-branch.\n\nHum, looks like something not easy to do (at least for a Git beginner\nlike me) ! Any documentation on this ? Would you mind showing this on\nthe example script I sent ?\n\nThanks,\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63688","messageId":"20071218153159.GA12549@alea.gnuu.de","threadId":"11324","inReplyTo":"4767724A.9040207@obry.net","subject":"Re: Question about git-svn import","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2007-12-18T15:31:59Z","receivedAt":"2007-12-18T15:31:59Z","isPatch":false,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Hello Pascal,\n\nPascal Obry schrieb am Tue 18. Dec, 08:10 (+0100):\n> Steven Walter a écrit :\n> > Not sure if this is the best way, but I would recommend cloning into two\n> > repositories, then combining them.  \n> \n> I feared that :)\n\nIt's not as complicated as you might think.\n\n> > So you already have the newer\n> > changes with the standard layout.  You would now:\n> > \n> >     $ git svn init <repo>\n> > \n> > And only fetch the revisions before the layout change.  You could then\n> > combine the two repositories using .git/info/grafts and\n> > git-rewrite-branch.\n> \n> Hum, looks like something not easy to do (at least for a Git beginner\n> like me) ! Any documentation on this ? Would you mind showing this on\n> the example script I sent ?\n\nI had the same problem. We changed the structure of our SVN repository\nfrom /trunk/pkg to /pkg/trunk and git-svn couldn't deal with this.\n\nI used the script posted in\nhttp://lists.alioth.debian.org/pipermail/pkg-jed-devel/2007-December/001719.html\nto do the switch.\n\nSome suggestions:\n1. Import both parts into one git repo into their own branches. (use\n   --prefix)\n\n2. Use gitk to insprect the history to find bad commits, e.g. empty\n   commits or things git-svn imported wrong.\n\n3. Use git-filter-branch with the --parent-filter to join the branches.\n\nHTH, Jörg.\n-- \nDie am Lautesten reden, haben stets am wenigsten zu sagen.\n"},{"id":"63747","messageId":"47690097.6070603@obry.net","threadId":"11324","inReplyTo":"20071218153159.GA12549@alea.gnuu.de","subject":"Re: Question about git-svn import","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2007-12-19T11:29:27Z","receivedAt":"2007-12-19T11:29:27Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Jörg,\n\n> It's not as complicated as you might think.\n\nOk, thanks for the pointers. I'll have a look.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63869","messageId":"476A98BB.8000900@obry.net","threadId":"11324","inReplyTo":"20071218153159.GA12549@alea.gnuu.de","subject":"Re: Question about git-svn import","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2007-12-20T16:30:51Z","receivedAt":"2007-12-20T16:30:51Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Jörg,\n\nI have at least one remaining problem.\n\n# Import old trunk into pre/master\n$ git svn init svn+ssh://myserver --prefix=pre/ --trunk=importfromcvs/trunk\n$ git svn fetch --revision=9458:10242\n\n# Import new trunk into post/master\n$ git config svn-remote.svn.fetch trunk/PROJ:refs/remotes/post/trunk\n$ git svn fetch --revision=11058:11066\n\n# Rewrite post/trunk on top of pre/trunk into merged-master\n$ git checkout post/trunk\n$ git checkout -b merged-master\n$ git-filter-branch --tag-name-filter cat --parent-filter \"sed -e\n's/^$/-p $(git rev-parse pre/trunk)/'\" merged-master\n\nThe problem is that at this point I cannot \"git svn rebase\". Looks like\nthe filter-branch command did break the link between the Subversion\nrepository and the git svn one:\n\n$ git svn rebase\nUnable to determine upstream SVN information from working tree history\n\nIs there a way around that ?\n\nThanks,\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63871","messageId":"20071220165227.GB22683@alea.gnuu.de","threadId":"11324","inReplyTo":"476A98BB.8000900@obry.net","subject":"Re: Question about git-svn import","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2007-12-20T16:52:27Z","receivedAt":"2007-12-20T16:52:27Z","isPatch":false,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Pascal Obry schrieb am Thu 20. Dec, 17:30 (+0100):\n> # Rewrite post/trunk on top of pre/trunk into merged-master\n> $ git checkout post/trunk\n> $ git checkout -b merged-master\n> $ git-filter-branch --tag-name-filter cat --parent-filter \"sed -e\n> 's/^$/-p $(git rev-parse pre/trunk)/'\" merged-master\n> \n> The problem is that at this point I cannot \"git svn rebase\". Looks like\n> the filter-branch command did break the link between the Subversion\n> repository and the git svn one:\n> \n> $ git svn rebase\n> Unable to determine upstream SVN information from working tree history\n> \n> Is there a way around that ?\n\nAccording to http://duncan.mac-vicar.com/blog/archives/282 it should help\nto do something like:\n\ngit update-ref refs/remotes/git-svn master\nfind -name .rev_db* | xargs rm\n\nI didn't had this problem, because I did a one‐time import.\n\nBye, Jörg.\n-- \nDie zehn Gebote Gottes enthalten 172 Wörter, die amerikanische\nUnabhängigkeitserklärung 300 Wörter, die Verordnung der europäischen\nGemeinschaft über den Import von Karamelbonbons exakt 25911 Wörter.\n"},{"id":"63924","messageId":"476BBB8C.3000908@obry.net","threadId":"11324","inReplyTo":"20071220165227.GB22683@alea.gnuu.de","subject":"Re: Question about git-svn import","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2007-12-21T13:11:40Z","receivedAt":"2007-12-21T13:11:40Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Jörg Sommer a écrit :\n> According to http://duncan.mac-vicar.com/blog/archives/282 it should help\n> to do something like:\n> \n> git update-ref refs/remotes/git-svn master\n> find -name .rev_db* | xargs rm\n\nOk, thanks a lot it is working!\n\nGit is a great tool... and the community around it is really helpful.\nThanks to all!\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"}]}