{"thread":{"id":"12582","subject":"[PATCH] Fix dcommit, rebase when rewriteRoot is in use","startedAt":"2008-03-08T22:04:05Z","lastAt":"2008-03-08T22:22:23Z","messageCount":2,"participants":["John Goerzen","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71448","messageId":"1205013845-22286-1-git-send-email-jgoerzen@complete.org","threadId":"12582","inReplyTo":null,"subject":"[PATCH] Fix dcommit, rebase when rewriteRoot is in use","fromName":"John Goerzen","fromEmail":"jgoerzen@complete.org","sentAt":"2008-03-08T22:04:05Z","receivedAt":"2008-03-08T22:04:05Z","isPatch":true,"sender":{"key":"jgoerzen@complete.org","avatar":null},"body":"When the rewriteRoot setting is used with git-svn, it causes the svn\nIDs added to commit messages to bear a different URL than is actually\nused to retrieve Subversion data.\n\nIt is common for Subversion repositories to be available multiple\nways: for instance, HTTP to the public, and svn+ssh to people with\ncommit access.  The need to switch URLs for access is fairly common as\nwell -- perhaps someone was just given commit access.  To switch URLs\nwithout having to rewrite history, one can use the old url as a\nrewriteRoot, and use the new one in the svn-remote url setting.\n\nThis works well for svn fetching and general git commands.\n\nHowever, git-svn dcommit, rebase, and perhaps other commands do not\nwork in this scenario.  They scan the svn ID lines in commit messages\nand attempt to match them up with url lines in [svn-remote] sections\nin the git config.\n\nThis patch allows them to match rewriteRoot options, if such options\nare present.\n\nSigned-off-by: John Goerzen <jgoerzen@complete.org>\n---\n git-svn.perl |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 9e2faf9..1195569 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1540,9 +1540,14 @@ sub find_by_url { # repos_root and, path are optional\n \t\t\t                    $remotes->{$repo_id}->{$_});\n \t\t}\n \t\tmy $p = $path;\n+\t\tmy $rwr = rewrite_root({repo_id => $repo_id});\n \t\tunless (defined $p) {\n \t\t\t$p = $full_url;\n-\t\t\t$p =~ s#^\\Q$u\\E(?:/|$)## or next;\n+\t\t\tmy $z = $u;\n+\t\t\tif ($rwr) {\n+\t\t\t\t$z = $rwr;\n+\t\t\t}\n+\t\t\t$p =~ s#^\\Q$z\\E(?:/|$)## or next;\n \t\t}\n \t\tforeach my $f (keys %$fetch) {\n \t\t\tnext if $f ne $p;\n-- \n1.5.4.2\n\n"},{"id":"71450","messageId":"20080308222223.GA1950@hand.yhbt.net","threadId":"12582","inReplyTo":"1205013845-22286-1-git-send-email-jgoerzen@complete.org","subject":"Re: [PATCH] Fix dcommit, rebase when rewriteRoot is in use","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-03-08T22:22:23Z","receivedAt":"2008-03-08T22:22:23Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"John Goerzen <jgoerzen@complete.org> wrote:\n> When the rewriteRoot setting is used with git-svn, it causes the svn\n> IDs added to commit messages to bear a different URL than is actually\n> used to retrieve Subversion data.\n> \n> It is common for Subversion repositories to be available multiple\n> ways: for instance, HTTP to the public, and svn+ssh to people with\n> commit access.  The need to switch URLs for access is fairly common as\n> well -- perhaps someone was just given commit access.  To switch URLs\n> without having to rewrite history, one can use the old url as a\n> rewriteRoot, and use the new one in the svn-remote url setting.\n> \n> This works well for svn fetching and general git commands.\n> \n> However, git-svn dcommit, rebase, and perhaps other commands do not\n> work in this scenario.  They scan the svn ID lines in commit messages\n> and attempt to match them up with url lines in [svn-remote] sections\n> in the git config.\n> \n> This patch allows them to match rewriteRoot options, if such options\n> are present.\n> \n> Signed-off-by: John Goerzen <jgoerzen@complete.org>\n\nThanks again, patch + commit message\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n>  git-svn.perl |    7 ++++++-\n>  1 files changed, 6 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 9e2faf9..1195569 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -1540,9 +1540,14 @@ sub find_by_url { # repos_root and, path are optional\n>  \t\t\t                    $remotes->{$repo_id}->{$_});\n>  \t\t}\n>  \t\tmy $p = $path;\n> +\t\tmy $rwr = rewrite_root({repo_id => $repo_id});\n>  \t\tunless (defined $p) {\n>  \t\t\t$p = $full_url;\n> -\t\t\t$p =~ s#^\\Q$u\\E(?:/|$)## or next;\n> +\t\t\tmy $z = $u;\n> +\t\t\tif ($rwr) {\n> +\t\t\t\t$z = $rwr;\n> +\t\t\t}\n> +\t\t\t$p =~ s#^\\Q$z\\E(?:/|$)## or next;\n>  \t\t}\n>  \t\tforeach my $f (keys %$fetch) {\n>  \t\t\tnext if $f ne $p;\n> -- \n> 1.5.4.2\n> \n\n-- \nEric Wong\n"}]}