{"thread":{"id":"16042","subject":"git export to svn","startedAt":"2008-10-25T18:40:25Z","lastAt":"2008-10-29T03:40:21Z","messageCount":9,"participants":["Warren Harris","J.H.","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"93934","messageId":"FC51BBF1-B2CA-4A00-9312-2333FDA537C2@gmail.com","threadId":"16042","inReplyTo":null,"subject":"git export to svn","fromName":"Warren Harris","fromEmail":"warrensomebody@gmail.com","sentAt":"2008-10-25T18:40:25Z","receivedAt":"2008-10-25T18:40:25Z","isPatch":false,"sender":{"key":"warrensomebody@gmail.com","avatar":"https://gravatar.com/avatar/7d2eceaae8e9889932b5061446dc6bd2d5ecfbbf2d718c6068c18af881f28e95?d=mp&s=160"},"body":"Is there a way to export a git repository along with its history to  \nsvn? (git svn init seems to want to go in the other direction.) I know  \nthis is in some sense \"going backwards\" but I need to commit my work  \nto a client. Thanks,\n\nWarren\n"},{"id":"93937","messageId":"1224960205.2874.11.camel@localhost.localdomain","threadId":"16042","inReplyTo":"FC51BBF1-B2CA-4A00-9312-2333FDA537C2@gmail.com","subject":"Re: git export to svn","fromName":"J.H.","fromEmail":"warthog19@eaglescrag.net","sentAt":"2008-10-25T18:43:25Z","receivedAt":"2008-10-25T18:43:25Z","isPatch":false,"sender":{"key":"warthog19@eaglescrag.net","avatar":null},"body":"The basic way you would want to do it, it attach your git tree to SVN\nand then git svn dcommit - which will replay the uncommitted changes\nback into SVN - git svn init will do the attachment - assuming that your\ngit / svn repositories are at least based from the same place.\n\n- John 'Warthog9' Hawley\n\nOn Sat, 2008-10-25 at 11:40 -0700, Warren Harris wrote:\n> Is there a way to export a git repository along with its history to  \n> svn? (git svn init seems to want to go in the other direction.) I know  \n> this is in some sense \"going backwards\" but I need to commit my work  \n> to a client. Thanks,\n> \n> Warren\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"},{"id":"93935","messageId":"77DFC428-35AE-4F66-9D9F-3D4E0005727D@gmail.com","threadId":"16042","inReplyTo":"1224960205.2874.11.camel@localhost.localdomain","subject":"Re: git export to svn","fromName":"Warren Harris","fromEmail":"warrensomebody@gmail.com","sentAt":"2008-10-25T19:11:16Z","receivedAt":"2008-10-25T19:11:16Z","isPatch":false,"sender":{"key":"warrensomebody@gmail.com","avatar":"https://gravatar.com/avatar/7d2eceaae8e9889932b5061446dc6bd2d5ecfbbf2d718c6068c18af881f28e95?d=mp&s=160"},"body":"John,\n\nThanks for your quick reply. I tried that, but got the following error:\n\n\n$ git clone ../test2/\nInitialized empty Git repository in /Users/warren/projects/tmp/test2- \ngit-clone/test2/.git/\n# ...svn test2 dir already created with subdirs trunk, tags and  \nbranches...\n$ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t tags - \nb branches\nUsing higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n\nI then tried the hints from here: http://www.basementcoders.com/2008/9/30/git-svn-gotcha \n, but still no luck:\n\n$ git merge --no-ff master\nAlready up-to-date.\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n\n\nWarren\n\n\nOn Oct 25, 2008, at 11:43 AM, J.H. wrote:\n\n> The basic way you would want to do it, it attach your git tree to SVN\n> and then git svn dcommit - which will replay the uncommitted changes\n> back into SVN - git svn init will do the attachment - assuming that  \n> your\n> git / svn repositories are at least based from the same place.\n>\n> - John 'Warthog9' Hawley\n>\n> On Sat, 2008-10-25 at 11:40 -0700, Warren Harris wrote:\n>> Is there a way to export a git repository along with its history to\n>> svn? (git svn init seems to want to go in the other direction.) I  \n>> know\n>> this is in some sense \"going backwards\" but I need to commit my work\n>> to a client. Thanks,\n>>\n>> Warren\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":"93940","messageId":"1224965564.2874.49.camel@localhost.localdomain","threadId":"16042","inReplyTo":"77DFC428-35AE-4F66-9D9F-3D4E0005727D@gmail.com","subject":"Re: git export to svn","fromName":"J.H.","fromEmail":"warthog19@eaglescrag.net","sentAt":"2008-10-25T20:12:44Z","receivedAt":"2008-10-25T20:12:44Z","isPatch":false,"sender":{"key":"warthog19@eaglescrag.net","avatar":null},"body":"Even with init - your going to need to do a fetch so that you have a\ncopy of the svn in your tree - if the git tree you've already got has\nthe svn references (take a look at git-log if it seems to have an svn\nline in the log then at some point someone pulled in the svn tree into\ngit) if not your going to effectively be pulling the entire svn tree\ninto your git tree.\n\nThe only other real way to get your changes / patches into svn is to\ndump them out as patches and them individually apply / commit them to\nyour svn tree.\n\n- John 'Warthog9' Hawley\n\n\nOn Sat, 2008-10-25 at 12:11 -0700, Warren Harris wrote:\n> John,\n> \n> Thanks for your quick reply. I tried that, but got the following error:\n> \n> \n> $ git clone ../test2/\n> Initialized empty Git repository in /Users/warren/projects/tmp/test2- \n> git-clone/test2/.git/\n> # ...svn test2 dir already created with subdirs trunk, tags and  \n> branches...\n> $ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t tags - \n> b branches\n> Using higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn\n> $ git svn dcommit\n> Can't call method \"full_url\" on an undefined value at /opt/local/ \n> libexec/git-core/git-svn line 425.\n> \n> I then tried the hints from here: http://www.basementcoders.com/2008/9/30/git-svn-gotcha \n> , but still no luck:\n> \n> $ git merge --no-ff master\n> Already up-to-date.\n> $ git svn dcommit\n> Can't call method \"full_url\" on an undefined value at /opt/local/ \n> libexec/git-core/git-svn line 425.\n> \n> \n> Warren\n> \n> \n> On Oct 25, 2008, at 11:43 AM, J.H. wrote:\n> \n> > The basic way you would want to do it, it attach your git tree to SVN\n> > and then git svn dcommit - which will replay the uncommitted changes\n> > back into SVN - git svn init will do the attachment - assuming that  \n> > your\n> > git / svn repositories are at least based from the same place.\n> >\n> > - John 'Warthog9' Hawley\n> >\n> > On Sat, 2008-10-25 at 11:40 -0700, Warren Harris wrote:\n> >> Is there a way to export a git repository along with its history to\n> >> svn? (git svn init seems to want to go in the other direction.) I  \n> >> know\n> >> this is in some sense \"going backwards\" but I need to commit my work\n> >> to a client. Thanks,\n> >>\n> >> Warren\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> \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"},{"id":"93942","messageId":"2F1954CC-E013-4861-87F8-F89CF37CE53C@gmail.com","threadId":"16042","inReplyTo":"1224965564.2874.49.camel@localhost.localdomain","subject":"Re: git export to svn","fromName":"Warren Harris","fromEmail":"warrensomebody@gmail.com","sentAt":"2008-10-25T20:29:50Z","receivedAt":"2008-10-25T20:29:50Z","isPatch":false,"sender":{"key":"warrensomebody@gmail.com","avatar":"https://gravatar.com/avatar/7d2eceaae8e9889932b5061446dc6bd2d5ecfbbf2d718c6068c18af881f28e95?d=mp&s=160"},"body":"I tried a fetch, but still no luck:\n\n$ git svn fetch\nW: Ignoring error from SVN, path probably does not exist: (175002): RA  \nlayer request failed: REPORT of '/svn/!svn/bc/100': Could not read  \nchunk size: Secure connection truncated (https://svn)\nW: Do not be alarmed at the above message git-svn is just searching  \naggressively for old history.\nThis may take a while on large repositories\nr58084 = c01dadf89b552077da132273485e7569d8694518 (trunk)\n\tA\t...\nr58088 = 7916f3a02ad6c759985bd9fb886423c373a72125 (trunk)\n\n$ git svn rebase\nUnable to determine upstream SVN information from working tree history\n\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n\n\nLooks like the only option is applying individual patches to preserve  \nmy history...\n\nWarren\n\n\nOn Oct 25, 2008, at 1:12 PM, J.H. wrote:\n\n> Even with init - your going to need to do a fetch so that you have a\n> copy of the svn in your tree - if the git tree you've already got has\n> the svn references (take a look at git-log if it seems to have an svn\n> line in the log then at some point someone pulled in the svn tree into\n> git) if not your going to effectively be pulling the entire svn tree\n> into your git tree.\n>\n> The only other real way to get your changes / patches into svn is to\n> dump them out as patches and them individually apply / commit them to\n> your svn tree.\n>\n> - John 'Warthog9' Hawley\n>\n>\n> On Sat, 2008-10-25 at 12:11 -0700, Warren Harris wrote:\n>> John,\n>>\n>> Thanks for your quick reply. I tried that, but got the following  \n>> error:\n>>\n>>\n>> $ git clone ../test2/\n>> Initialized empty Git repository in /Users/warren/projects/tmp/test2-\n>> git-clone/test2/.git/\n>> # ...svn test2 dir already created with subdirs trunk, tags and\n>> branches...\n>> $ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t  \n>> tags -\n>> b branches\n>> Using higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn\n>> $ git svn dcommit\n>> Can't call method \"full_url\" on an undefined value at /opt/local/\n>> libexec/git-core/git-svn line 425.\n>>\n>> I then tried the hints from here: http://www.basementcoders.com/2008/9/30/git-svn-gotcha\n>> , but still no luck:\n>>\n>> $ git merge --no-ff master\n>> Already up-to-date.\n>> $ git svn dcommit\n>> Can't call method \"full_url\" on an undefined value at /opt/local/\n>> libexec/git-core/git-svn line 425.\n>>\n>>\n>> Warren\n>>\n>>\n>> On Oct 25, 2008, at 11:43 AM, J.H. wrote:\n>>\n>>> The basic way you would want to do it, it attach your git tree to  \n>>> SVN\n>>> and then git svn dcommit - which will replay the uncommitted changes\n>>> back into SVN - git svn init will do the attachment - assuming that\n>>> your\n>>> git / svn repositories are at least based from the same place.\n>>>\n>>> - John 'Warthog9' Hawley\n>>>\n>>> On Sat, 2008-10-25 at 11:40 -0700, Warren Harris wrote:\n>>>> Is there a way to export a git repository along with its history to\n>>>> svn? (git svn init seems to want to go in the other direction.) I\n>>>> know\n>>>> this is in some sense \"going backwards\" but I need to commit my  \n>>>> work\n>>>> to a client. Thanks,\n>>>>\n>>>> Warren\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>>\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":"93970","messageId":"20081026091554.GC3612@atjola.homenet","threadId":"16042","inReplyTo":"2F1954CC-E013-4861-87F8-F89CF37CE53C@gmail.com","subject":"Re: git export to svn","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-10-26T09:15:54Z","receivedAt":"2008-10-26T09:15:54Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.10.25 13:29:50 -0700, Warren Harris wrote:\n> I tried a fetch, but still no luck:\n>\n> $ git svn fetch\n> W: Ignoring error from SVN, path probably does not exist: (175002): RA  \n> layer request failed: REPORT of '/svn/!svn/bc/100': Could not read chunk \n> size: Secure connection truncated (https://svn)\n> W: Do not be alarmed at the above message git-svn is just searching  \n> aggressively for old history.\n> This may take a while on large repositories\n> r58084 = c01dadf89b552077da132273485e7569d8694518 (trunk)\n> \tA\t...\n> r58088 = 7916f3a02ad6c759985bd9fb886423c373a72125 (trunk)\n>\n> $ git svn rebase\n> Unable to determine upstream SVN information from working tree history\n\nMeans that your current branch is not based on what git-svn has fetched,\nwhich is expected when you use \"svn init\" + \"svn fetch\" after you\nalready started working.\n\nWhat's the actual relationship between your local history and the\nhistory you fetched from svn?\n\nIf your local stuff started from revision X, which you manually imported\nfrom svn, you can just rebase it:\n\ngit rebase --onto <svn-revision-X> <your-revision-X>\n\n\nIf you have a bunch of merges in your local history, you might want to\nmerge your stuff into the svn-based branch instead. When you dcommit,\nthe svn repo will only see one big \"do it all\" commit though.\n\nFor that, you would create a graft, so that your first \"real\" local\ncommit gets the svn revision X commit as its parent. That is, from:\n\nS---S---SX---S---S---S (svn)\n\nLX--------L---L---L---L (local)\n\nYou want to go to:\n\nS---S---SX---S---S---S (svn)\n         \\\nLX        L---L---L---L (local)\n\n\nWhere 'S' means that the commit came from SVN, and L means that it is a\n\"local\" commit. SX and LX are the commits that have the same tree\nattached (same directories/files), but have a different hash due to how\nthey were created. The graft overrides the parent-child relation for the\nfirst \"L\" commit, so that it actually appears as being branched off of SX.\n\nAnd then, you'd merge local into svn, so you get:\n\nS---S---SX---S---S---S--M (svn)\n         \\             /\nLX        L---L---L---L (local)\n\n\n\nIf possible, go with the rebase though. That at least gives a somewhat\nreasonable history in the svn repo as well. Also note that when you go\nwith the merge way, make sure that the svn branch is totally uptodate\nbefore you merge and that the merge commit is the only one to be\ndcommitted. Otherwise, funny stuff might happen, and rebase might kick\nin anyway, I don't exactly remember what git-svn does, but it wasn't\npleasant :-)\n\nBjörn\n"},{"id":"93988","messageId":"8ED0030A-E55E-4082-87C9-53B11F763E1B@gmail.com","threadId":"16042","inReplyTo":"20081026091554.GC3612@atjola.homenet","subject":"Re: git export to svn","fromName":"Warren Harris","fromEmail":"warrensomebody@gmail.com","sentAt":"2008-10-26T16:24:07Z","receivedAt":"2008-10-26T16:24:07Z","isPatch":false,"sender":{"key":"warrensomebody@gmail.com","avatar":"https://gravatar.com/avatar/7d2eceaae8e9889932b5061446dc6bd2d5ecfbbf2d718c6068c18af881f28e95?d=mp&s=160"},"body":"\nOn Oct 26, 2008, at 2:15 AM, Björn Steinbrink wrote:\n\n> On 2008.10.25 13:29:50 -0700, Warren Harris wrote:\n>> I tried a fetch, but still no luck:\n>>\n>> $ git svn fetch\n>> W: Ignoring error from SVN, path probably does not exist: (175002):  \n>> RA\n>> layer request failed: REPORT of '/svn/!svn/bc/100': Could not read  \n>> chunk\n>> size: Secure connection truncated (https://svn)\n>> W: Do not be alarmed at the above message git-svn is just searching\n>> aggressively for old history.\n>> This may take a while on large repositories\n>> r58084 = c01dadf89b552077da132273485e7569d8694518 (trunk)\n>> \tA\t...\n>> r58088 = 7916f3a02ad6c759985bd9fb886423c373a72125 (trunk)\n>>\n>> $ git svn rebase\n>> Unable to determine upstream SVN information from working tree  \n>> history\n>\n> Means that your current branch is not based on what git-svn has  \n> fetched,\n> which is expected when you use \"svn init\" + \"svn fetch\" after you\n> already started working.\n>\n> What's the actual relationship between your local history and the\n> history you fetched from svn?\n\nSince I'm trying to export my git repo to svn, the svn repo is  \ncompletely empty.\n\n>\n>\n> If your local stuff started from revision X, which you manually  \n> imported\n> from svn, you can just rebase it:\n>\n> git rebase --onto <svn-revision-X> <your-revision-X>\n\nWhen I try this, I keep getting:\n\nfatal: Needed a single revision\ninvalid upstream\n\n>\n>\n>\n> If you have a bunch of merges in your local history, you might want to\n> merge your stuff into the svn-based branch instead. When you dcommit,\n> the svn repo will only see one big \"do it all\" commit though.\n>\n> For that, you would create a graft, so that your first \"real\" local\n> commit gets the svn revision X commit as its parent. That is, from:\n>\n> S---S---SX---S---S---S (svn)\n>\n> LX--------L---L---L---L (local)\n>\n> You want to go to:\n>\n> S---S---SX---S---S---S (svn)\n>         \\\n> LX        L---L---L---L (local)\n>\n>\n> Where 'S' means that the commit came from SVN, and L means that it  \n> is a\n> \"local\" commit. SX and LX are the commits that have the same tree\n> attached (same directories/files), but have a different hash due to  \n> how\n> they were created. The graft overrides the parent-child relation for  \n> the\n> first \"L\" commit, so that it actually appears as being branched off  \n> of SX.\n>\n> And then, you'd merge local into svn, so you get:\n>\n> S---S---SX---S---S---S--M (svn)\n>         \\             /\n> LX        L---L---L---L (local)\n>\n>\n>\n> If possible, go with the rebase though. That at least gives a somewhat\n> reasonable history in the svn repo as well. Also note that when you go\n> with the merge way, make sure that the svn branch is totally uptodate\n> before you merge and that the merge commit is the only one to be\n> dcommitted. Otherwise, funny stuff might happen, and rebase might kick\n> in anyway, I don't exactly remember what git-svn does, but it wasn't\n> pleasant :-)\n\n\nI may not have been clear about what I'm trying to do: I have a git  \nrepository, and I'd like to put it (either the head of the master, or  \nthe entire revision history if possible) into svn. From then on, I  \nwould like to be able to use 'git svn' commands to manage the two  \nrepos. (Initially I don't expect anyone else to be committing to svn  \n-- it's just an archive and something for others to pull from.)\n\nHere's a complete transcript of how I tried to do this, which seems to  \nbe missing some crucial step:\n\n$ mkdir test2-git-clone\n$ git clone ../test2/   # clone my working repo which is unrelated to  \nsvn at this point\n$ cd test2-git-clone/test2\n$ svn mkdir https://svn/svn/SANDBOX/warren/test2 -m \"test2\"\n$ svn mkdir https://svn/svn/SANDBOX/warren/test2/trunk -m \"test2\"\n$ svn mkdir https://svn/svn/SANDBOX/warren/test2/branches -m \"test2\"\n$ svn mkdir https://svn/svn/SANDBOX/warren/test2/tags -m \"test2\"\n$ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t tags - \nb branches\nInitialized empty Git repository in /Users/warren/projects/tmp/test2- \ngit-clone/test2/.git/\nUsing higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n$ git merge --no-ff master\nAlready up-to-date.\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n$ git svn fetch\n$ git svn dcommit\nCan't call method \"full_url\" on an undefined value at /opt/local/ \nlibexec/git-core/git-svn line 425.\n\n\nThanks for your help,\n\nWarren"},{"id":"93990","messageId":"20081026171519.GD3612@atjola.homenet","threadId":"16042","inReplyTo":"8ED0030A-E55E-4082-87C9-53B11F763E1B@gmail.com","subject":"Re: git export to svn","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-10-26T17:15:19Z","receivedAt":"2008-10-26T17:15:19Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.10.26 09:24:07 -0700, Warren Harris wrote:\n>\n> On Oct 26, 2008, at 2:15 AM, Björn Steinbrink wrote:\n>\n>> On 2008.10.25 13:29:50 -0700, Warren Harris wrote:\n>>> I tried a fetch, but still no luck:\n>>>\n>>> $ git svn fetch\n>>> W: Ignoring error from SVN, path probably does not exist: (175002):  \n>>> RA\n>>> layer request failed: REPORT of '/svn/!svn/bc/100': Could not read  \n>>> chunk\n>>> size: Secure connection truncated (https://svn)\n>>> W: Do not be alarmed at the above message git-svn is just searching\n>>> aggressively for old history.\n>>> This may take a while on large repositories\n>>> r58084 = c01dadf89b552077da132273485e7569d8694518 (trunk)\n>>> \tA\t...\n>>> r58088 = 7916f3a02ad6c759985bd9fb886423c373a72125 (trunk)\n>>>\n>>> $ git svn rebase\n>>> Unable to determine upstream SVN information from working tree  \n>>> history\n>>\n>> Means that your current branch is not based on what git-svn has  \n>> fetched,\n>> which is expected when you use \"svn init\" + \"svn fetch\" after you\n>> already started working.\n>>\n>> What's the actual relationship between your local history and the\n>> history you fetched from svn?\n>\n> Since I'm trying to export my git repo to svn, the svn repo is  \n> completely empty.\n\nOK, the \"r58084\" made me think that your code is based on something that\nis already in the SVN repo. But apperently, that's just a shared svn\nrepo, right?\n\n> I may not have been clear about what I'm trying to do: I have a git  \n> repository, and I'd like to put it (either the head of the master, or  \n> the entire revision history if possible) into svn. From then on, I would \n> like to be able to use 'git svn' commands to manage the two repos. \n> (Initially I don't expect anyone else to be committing to svn -- it's \n> just an archive and something for others to pull from.)\n>\n> Here's a complete transcript of how I tried to do this, which seems to  \n> be missing some crucial step:\n>\n> $ mkdir test2-git-clone\n> $ git clone ../test2/   # clone my working repo which is unrelated to  \n> svn at this point\n> $ cd test2-git-clone/test2\n> $ svn mkdir https://svn/svn/SANDBOX/warren/test2 -m \"test2\"\n> $ svn mkdir https://svn/svn/SANDBOX/warren/test2/trunk -m \"test2\"\n> $ svn mkdir https://svn/svn/SANDBOX/warren/test2/branches -m \"test2\"\n> $ svn mkdir https://svn/svn/SANDBOX/warren/test2/tags -m \"test2\"\n> $ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t tags -b \n> branches\n> Initialized empty Git repository in /Users/warren/projects/tmp/test2- \n> git-clone/test2/.git/\n> Using higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn\n> $ git svn dcommit\n> Can't call method \"full_url\" on an undefined value at /opt/local/ \n> libexec/git-core/git-svn line 425.\n\nCan't work yet, your local stuff is not yet connected to the svn commit\n(which you didn't even fetch yet). Same for the other dcommit calls you\ndid.\n\n> $ git merge --no-ff master\n> Already up-to-date.\n\nThat tries to merge master into itself ;-) The blog entry assumed that\nyou have a svn-based branch checked out, and applies to quite a\ndifferent situation.\n\n\n\nThis should do and uses a graft to simplify the process a bit:\n\nInitialize git-svn:\ngit svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2\n\nThe --prefix gives you remote tracking branches like \"svn/trunk\" which\nis nice because you don't get ambiguous names if you call your local\nbranch just \"trunk\" then. And -s is a shortcut for the standard\ntrunk/tags/branches layout.\n\n\nFetch the initial stuff from svn:\ngit svn fetch\n\nNow look up the hash of your root commit (should show a single commit):\ngit rev-list --parents master | grep '^.\\{40\\}$'\n\nThen get the hash of the empty trunk commit:\ngit rev-parse svn/trunk\n\nCreate the graft:\necho <root-commit-hash> <svn-trunk-commit-hash> >> .git/info/grafts\n\nNow, \"gitk\" should show svn/trunk as the first commit on which your\nmaster branch is based.\n\nMake the graft permanent:\ngit filter-branch -- ^svn/trunk --all\n\nDrop the graft:\nrm .git/info/grafts\n\ngitk should still show svn/trunk in the ancestry of master\n\nLinearize your history on top of trunk:\ngit svn rebase\n\nAnd now \"git svn dcommit -n\" should tell you that it is going to commit\nto trunk.\n\n\nAlternatively, if rebase gives just too many conflicts, you can do:\n\ngit svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2\ngit svn fetch\ngit checkout -b trunk svn/trunk\ngit merge master\ngit svn dcommit\n\nThat will just create a single huge commit in svn. But the history will\nbe retained in git. You can then work on the new \"trunk\" branch or move\nyour master branch, so it points to the same commit as trunk and then\ndrop the \"trunk\" branch or whatever. It just matters that your new work\nis based upon the dcommited merge commit, so \"svn/trunk\" is in your\nbranch's history.\n\nHTH\nBjörn\n"},{"id":"94163","messageId":"9CE5F946-B783-4D0F-993B-C0187E2E2DAF@gmail.com","threadId":"16042","inReplyTo":"20081026171519.GD3612@atjola.homenet","subject":"Re: git export to svn","fromName":"Warren Harris","fromEmail":"warrensomebody@gmail.com","sentAt":"2008-10-29T03:40:21Z","receivedAt":"2008-10-29T03:40:21Z","isPatch":false,"sender":{"key":"warrensomebody@gmail.com","avatar":"https://gravatar.com/avatar/7d2eceaae8e9889932b5061446dc6bd2d5ecfbbf2d718c6068c18af881f28e95?d=mp&s=160"},"body":"Björn - Thanks again for your help...\n\nOn Oct 26, 2008, at 10:15 AM, Björn Steinbrink wrote:\n\n>>\n>> Since I'm trying to export my git repo to svn, the svn repo is\n>> completely empty.\n>\n> OK, the \"r58084\" made me think that your code is based on something  \n> that\n> is already in the SVN repo. But apperently, that's just a shared svn\n> repo, right?\n\nRight\n\n>\n> This should do and uses a graft to simplify the process a bit:\n>\n> Initialize git-svn:\n> git svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2\n>\n> The --prefix gives you remote tracking branches like \"svn/trunk\" which\n> is nice because you don't get ambiguous names if you call your local\n> branch just \"trunk\" then. And -s is a shortcut for the standard\n> trunk/tags/branches layout.\n>\n>\n> Fetch the initial stuff from svn:\n> git svn fetch\n>\n> Now look up the hash of your root commit (should show a single  \n> commit):\n> git rev-list --parents master | grep '^.\\{40\\}$'\n>\n> Then get the hash of the empty trunk commit:\n> git rev-parse svn/trunk\n>\n> Create the graft:\n> echo <root-commit-hash> <svn-trunk-commit-hash> >> .git/info/grafts\n>\n> Now, \"gitk\" should show svn/trunk as the first commit on which your\n> master branch is based.\n>\n> Make the graft permanent:\n> git filter-branch -- ^svn/trunk --all\n>\n> Drop the graft:\n> rm .git/info/grafts\n>\n> gitk should still show svn/trunk in the ancestry of master\n>\n> Linearize your history on top of trunk:\n> git svn rebase\n>\n> And now \"git svn dcommit -n\" should tell you that it is going to  \n> commit\n> to trunk.\n\nThis worked. The only downside was that all of our svn users  \nsubscribed to the checkins mailing list got a flood of messages from  \nme, but otherwise it worked like a charm. (I see that the original git  \ncommit dates were not preserved in svn, but that doesn't matter too  \nmuch...)\n\n>\n>\n>\n> Alternatively, if rebase gives just too many conflicts, you can do:\n>\n> git svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2\n> git svn fetch\n> git checkout -b trunk svn/trunk\n> git merge master\n> git svn dcommit\n>\n> That will just create a single huge commit in svn. But the history  \n> will\n> be retained in git. You can then work on the new \"trunk\" branch or  \n> move\n> your master branch, so it points to the same commit as trunk and then\n> drop the \"trunk\" branch or whatever. It just matters that your new  \n> work\n> is based upon the dcommited merge commit, so \"svn/trunk\" is in your\n> branch's history.\n\nThis didn't work for me. (I had tried the first procedure on a test  \ntree, then this one on a different test tree, and ultimately went back  \nto the first procedure for my real git repo.) I ended up with an empty  \nsvn tree. For the record, here's what happened:\n\n$ git svn fetch\nW: Ignoring error from SVN, path probably does not exist: (175002): RA  \nlayer request failed: REPORT of '/svn/!svn/bc/100': Could not read  \nchunk size: Secure connection truncated (https://svn)\nW: Do not be alarmed at the above message git-svn is just searching  \naggressively for old history.\nThis may take a while on large repositories\nr58382 = 9b9d5f01e4a3aca714eb5f61a9f05ab657cc7bc5 (svn/trunk)\nChecked out HEAD:\n   https://svn/svn/test3/trunk r58382\n\n$ git checkout -b trunk svn/trunk\nSwitched to a new branch \"trunk\"\n\n$ git merge master\nAlready up-to-date.\n\n$ git svn dcommit\nCommitting to https://svn/svn/test3/trunk ...\n\n$ cd tmp/svn-test3/\n\n$ svn co https://svn/svn/test3/trunk\nChecked out revision 58385.\n\n$ ls -al trunk/\ntotal 88\ndrwxr-xr-x  11 warren  staff    374 Oct 28 18:15 .\ndrwxr-xr-x   3 warren  staff    102 Oct 28 18:15 ..\ndrwxr-xr-x   9 warren  staff    306 Oct 28 18:15 .svn\n\n\nNow one thing that might be different than what you prescribed is that  \nour svn repo uses different conventions for branches and tags, so I  \ndidn't use 'git svn init -s', although I doubt that matters.\n\nAnyway, I'm up and running in svn with your first procedure, so my  \nproblem is solved. Thanks.\n\nWarren"}]}