{"thread":{"id":"37734","subject":"[PATCH] git-svn: merge: fix rooturl/branchurl match check","startedAt":"2014-10-15T12:39:01Z","lastAt":"2014-10-20T06:24:13Z","messageCount":2,"participants":["Tommaso Colombo","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"250674","messageId":"BLU437-SMTP152A16338E427B250EB601FBAA0@phx.gbl","threadId":"37734","inReplyTo":null,"subject":"[PATCH] git-svn: merge: fix rooturl/branchurl match check","fromName":"Tommaso Colombo","fromEmail":"tommaso.colombo@outlook.com","sentAt":"2014-10-15T12:39:01Z","receivedAt":"2014-10-15T12:39:01Z","isPatch":true,"sender":{"key":"tommaso.colombo@outlook.com","avatar":null},"body":"When populating svn:mergeinfo, git-svn merge checks if the merge parent\nof the merged branch is under the same root as the git-svn repository.\nThis was implemented comparing $gs->repos_root with the return value of\nof cmt_metadata for the merge parent. However, the first may contain a\nusername, whereas the second does not. In this case the comparison\nfails.\n\nRemove the username from $gs->repos_root before performing the\ncomparison.\n---\n git-svn.perl | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex b6e2186..0a5a5ff 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -707,7 +707,8 @@ sub populate_merge_info {\n \t\tmy $all_parents_ok = 1;\n \t\tmy $aggregate_mergeinfo = '';\n \t\tmy $rooturl = $gs->repos_root;\n-\t\tmy ($target_branch) = $gs->full_pushurl =~ /^\\Q$rooturl\\E(.*)/;\n+\t\tGit::SVN::remove_username($rooturl);\n+\t\tmy $target_branch = $gs->path;\n \n \t\tif (defined($rewritten_parent)) {\n \t\t\t# Replace first parent with newly-rewritten version\n@@ -729,7 +730,7 @@ sub populate_merge_info {\n \t\t\t}\n \t\t\tmy $branchpath = $1;\n \n-\t\t\tmy $ra = Git::SVN::Ra->new($branchurl);\n+\t\t\tmy $ra = Git::SVN::Ra->new(add_path_to_url($gs->repos_root, $branchpath));\n \t\t\tmy (undef, undef, $props) =\n \t\t\t\t$ra->get_dir(canonicalize_path(\".\"), $svnrev);\n \t\t\tmy $par_mergeinfo = $props->{'svn:mergeinfo'};\n@@ -921,6 +922,7 @@ sub cmd_dcommit {\n \t\t# information from different SVN repos, and paths\n \t\t# which are not underneath this repository root.\n \t\tmy $rooturl = $gs->repos_root;\n+\t\tGit::SVN::remove_username($rooturl);\n \t\tforeach my $d (@$linear_refs) {\n \t\t\tmy %parentshash;\n \t\t\tread_commit_parents(\\%parentshash, $d);\n-- \n2.1.2.443.g670a3c1.dirty\n"},{"id":"250845","messageId":"20141020062413.GB27885@dcvr.yhbt.net","threadId":"37734","inReplyTo":"BLU437-SMTP152A16338E427B250EB601FBAA0@phx.gbl","subject":"Re: [PATCH] git-svn: merge: fix rooturl/branchurl match check","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2014-10-20T06:24:13Z","receivedAt":"2014-10-20T06:24:13Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Tommaso Colombo <tommaso.colombo@outlook.com> wrote:\n> When populating svn:mergeinfo, git-svn merge checks if the merge parent\n> of the merged branch is under the same root as the git-svn repository.\n> This was implemented comparing $gs->repos_root with the return value of\n> of cmt_metadata for the merge parent. However, the first may contain a\n> username, whereas the second does not. In this case the comparison\n> fails.\n> \n> Remove the username from $gs->repos_root before performing the\n> comparison.\n\nThanks.  Commit makes sense, but one of the test cases fails for me,\ncan you check it out?\n$ make && make t9161-git-svn-mergeinfo-push.sh -C t GIT_TEST_OPTS='-i -v'\n<snip successes>\nok 11 - reintegration merge\n\nexpecting success: \n\tmergeinfo=$(svn_cmd propget svn:mergeinfo \"$svnrepo\"/branches/svnb4)\n\ttest \"$mergeinfo\" = \"/branches/svnb1:2-4,7-9,13-18\n/branches/svnb2:3,8,16-17\n/branches/svnb3:4,9\n/branches/svnb5:6,11\"\n\t\nnot ok 12 - check reintegration mergeinfo\n#\t\n#\t\tmergeinfo=$(svn_cmd propget svn:mergeinfo \"$svnrepo\"/branches/svnb4)\n#\t\ttest \"$mergeinfo\" = \"/branches/svnb1:2-4,7-9,13-18\n#\t/branches/svnb2:3,8,16-17\n#\t/branches/svnb3:4,9\n#\t/branches/svnb5:6,11\"\n#\t\t\nmake: *** [t9161-git-svn-mergeinfo-push.sh] Error 1\nmake: Leaving directory `/home/ew/git-core/t'\n\n\nYou'll also need to sign-off (see Documentation/SubmittingPatches)\nIt is required (project policy, not mine)\n\n> @@ -729,7 +730,7 @@ sub populate_merge_info {\n>  \t\t\t}\n>  \t\t\tmy $branchpath = $1;\n>  \n> -\t\t\tmy $ra = Git::SVN::Ra->new($branchurl);\n> +\t\t\tmy $ra = Git::SVN::Ra->new(add_path_to_url($gs->repos_root, $branchpath));\n\nAlso, please keep long lines wrapped to <= 80 columns.\nThanks again.\n"}]}