{"thread":{"id":"28043","subject":"Using git-svn fetch after a directory change with rewrite-root","startedAt":"2011-08-08T03:26:31Z","lastAt":"2011-09-01T20:54:04Z","messageCount":5,"participants":["H Krishnan","Michael Schubert","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"173113","messageId":"CANWsHyfHtr0EaJtNsDK9UTcmb_AbLg-1jUA-0uWJ-nEeNosb7w@mail.gmail.com","threadId":"28043","inReplyTo":null,"subject":"Using git-svn fetch after a directory change with rewrite-root","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2011-08-08T03:26:31Z","receivedAt":"2011-08-08T03:26:31Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"Hi,\nWe use git-svn to sync with SVN. We set the \"rewrite-root\" attribute\nto a dummy URL as different people use different SVN mirrors to update\ntheir git repository. Recently, the trunk directory in SVN was\nrenamed. After this, with git version 1.7.3 or later, we are not able\nto fetch. We get an SVN error (\"RA layer request failed: ...: 200\nOK\"). git version 1.7.0 seemed to work OK. On debugging further, I\nfound that in the following lines, $url has the rewrite-root prefix\nwhereas $gs->full_url has the actual url prefix and thus the \"last if\"\nfails.\n\nwhile (1) {\n\t# It is possible to tag two different subdirectories at\n\t# the same revision.  If the url for an existing ref\n\t# does not match, we must either find a ref with a\n\t# matching url or create a new ref by growing a tail.\n\t$gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1);\n\tmy (undef, $max_commit) = $gs->rev_map_max(1);\n\tlast if (!$max_commit);\n\tmy ($url) = ::cmt_metadata($max_commit);\n\tlast if ($url eq $gs->full_url);\n\t$ref_id .= '-';\n}\nprint STDERR \"Initializing parent: $ref_id\\n\" unless $::_q > 1;\n\nI wonder if commit 3235b7053c45a734c1cdf9b117bda68b7ced29c9 handles\nrewrite-root correctly. Should the comparison be made with\n$gs->metadata_url instead of $gs->full_url?\n\nH. Krishnan\n"},{"id":"173240","messageId":"loom.20110810T152000-152@post.gmane.org","threadId":"28043","inReplyTo":"CANWsHyfHtr0EaJtNsDK9UTcmb_AbLg-1jUA-0uWJ-nEeNosb7w@mail.gmail.com","subject":"Re: Using git-svn fetch after a directory change with rewrite-root","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2011-08-10T13:22:23Z","receivedAt":"2011-08-10T13:22:23Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"Hi,\n\nWhat is the procedure for getting this change into git? Should I contact the \nperson who submitted the original patch?\n\nKrishnan\n"},{"id":"173598","messageId":"4E4A53F3.6000200@elegosoft.com","threadId":"28043","inReplyTo":"loom.20110810T152000-152@post.gmane.org","subject":"Re: Using git-svn fetch after a directory change with rewrite-root","fromName":"Michael Schubert","fromEmail":"mschub@elegosoft.com","sentAt":"2011-08-16T11:26:43Z","receivedAt":"2011-08-16T11:26:43Z","isPatch":false,"sender":{"key":"mschub@elegosoft.com","avatar":null},"body":"On 08/10/2011 03:22 PM, H Krishnan wrote: \n> What is the procedure for getting this change into git? Should I contact the \n> person who submitted the original patch?\n\nSee Documentation/SubmittingPatches in the Git source tree.\n\nYou should CC the people involved.\n\nCheers.\n"},{"id":"173937","messageId":"20110820191837.GA30509@dcvr.yhbt.net","threadId":"28043","inReplyTo":"CANWsHyfHtr0EaJtNsDK9UTcmb_AbLg-1jUA-0uWJ-nEeNosb7w@mail.gmail.com","subject":"Re: Using git-svn fetch after a directory change with rewrite-root","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-08-20T19:18:37Z","receivedAt":"2011-08-20T19:18:37Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"(Apologies for the late response, I don't pay attention to\n git svn much anymore.  Feel free to Cc: me when posting to\n the mailing list and remind me in a week if I forgot respond.)\n\nH Krishnan <hetchkay@gmail.com> wrote:\n> while (1) {\n> \t# It is possible to tag two different subdirectories at\n> \t# the same revision.  If the url for an existing ref\n> \t# does not match, we must either find a ref with a\n> \t# matching url or create a new ref by growing a tail.\n> \t$gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1);\n> \tmy (undef, $max_commit) = $gs->rev_map_max(1);\n> \tlast if (!$max_commit);\n> \tmy ($url) = ::cmt_metadata($max_commit);\n> \tlast if ($url eq $gs->full_url);\n> \t$ref_id .= '-';\n> }\n> print STDERR \"Initializing parent: $ref_id\\n\" unless $::_q > 1;\n> \n> I wonder if commit 3235b7053c45a734c1cdf9b117bda68b7ced29c9 handles\n> rewrite-root correctly. Should the comparison be made with\n> $gs->metadata_url instead of $gs->full_url?\n\nI think you're right, can you submit a test case?  Current\ntests all pass with  $gs->metadata_url  so I can probably\npush it out in a bit regardless.\n\n-- \nEric Wong\n"},{"id":"174706","messageId":"20110901205404.GA16835@dcvr.yhbt.net","threadId":"28043","inReplyTo":"20110820191837.GA30509@dcvr.yhbt.net","subject":"Re: Using git-svn fetch after a directory change with rewrite-root","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-09-01T20:54:04Z","receivedAt":"2011-09-01T20:54:04Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eric Wong <normalperson@yhbt.net> wrote:\n> H Krishnan <hetchkay@gmail.com> wrote:\n> > I wonder if commit 3235b7053c45a734c1cdf9b117bda68b7ced29c9 handles\n> > rewrite-root correctly. Should the comparison be made with\n> > $gs->metadata_url instead of $gs->full_url?\n> \n> I think you're right, can you submit a test case?  Current\n> tests all pass with  $gs->metadata_url  so I can probably\n> push it out in a bit regardless.\n\nI've pushed the following out to git://bogomips.org/git-svn.git\n\n>From 85f022e9c124ffeda31a50cab878e1418d694d87 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Mon, 29 Aug 2011 00:45:44 +0000\nSubject: [PATCH] git-svn: fix fetch with moved path when using rewriteRoot\n\nThe matching step in commit 3235b7053c45a734c1cdf9b117bda68b7ced29c9\ndid not properly account for users of the \"rewriteRoot\"\nconfiguration parameter.\n\nref: <CANWsHyfHtr0EaJtNsDK9UTcmb_AbLg-1jUA-0uWJ-nEeNosb7w@mail.gmail.com>\n\nSuggested-by: H Krishnan <hetchkay@gmail.com>\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 96f373f..32792d3 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3022,7 +3022,7 @@ sub other_gs {\n \t\t\tmy (undef, $max_commit) = $gs->rev_map_max(1);\n \t\t\tlast if (!$max_commit);\n \t\t\tmy ($url) = ::cmt_metadata($max_commit);\n-\t\t\tlast if ($url eq $gs->full_url);\n+\t\t\tlast if ($url eq $gs->metadata_url);\n \t\t\t$ref_id .= '-';\n \t\t}\n \t\tprint STDERR \"Initializing parent: $ref_id\\n\" unless $::_q > 1;\n-- \nEric Wong\n"}]}