Discussion:
[PATCH] git-svn: merge: fix rooturl/branchurl match check
Tommaso Colombo
2014-10-15 12:39:01 UTC
Permalink
When populating svn:mergeinfo, git-svn merge checks if the merge parent
of the merged branch is under the same root as the git-svn repository.
This was implemented comparing $gs->repos_root with the return value of
of cmt_metadata for the merge parent. However, the first may contain a
username, whereas the second does not. In this case the comparison
fails.

Remove the username from $gs->repos_root before performing the
comparison.
---
git-svn.perl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index b6e2186..0a5a5ff 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -707,7 +707,8 @@ sub populate_merge_info {
my $all_parents_ok = 1;
my $aggregate_mergeinfo = '';
my $rooturl = $gs->repos_root;
- my ($target_branch) = $gs->full_pushurl =~ /^\Q$rooturl\E(.*)/;
+ Git::SVN::remove_username($rooturl);
+ my $target_branch = $gs->path;

if (defined($rewritten_parent)) {
# Replace first parent with newly-rewritten version
@@ -729,7 +730,7 @@ sub populate_merge_info {
}
my $branchpath = $1;

- my $ra = Git::SVN::Ra->new($branchurl);
+ my $ra = Git::SVN::Ra->new(add_path_to_url($gs->repos_root, $branchpath));
my (undef, undef, $props) =
$ra->get_dir(canonicalize_path("."), $svnrev);
my $par_mergeinfo = $props->{'svn:mergeinfo'};
@@ -921,6 +922,7 @@ sub cmd_dcommit {
# information from different SVN repos, and paths
# which are not underneath this repository root.
my $rooturl = $gs->repos_root;
+ Git::SVN::remove_username($rooturl);
foreach my $d (@$linear_refs) {
my %parentshash;
read_commit_parents(\%parentshash, $d);
--
2.1.2.443.g670a3c1.dirty
Eric Wong
2014-10-20 06:24:13 UTC
Permalink
Post by Tommaso Colombo
When populating svn:mergeinfo, git-svn merge checks if the merge parent
of the merged branch is under the same root as the git-svn repository.
This was implemented comparing $gs->repos_root with the return value of
of cmt_metadata for the merge parent. However, the first may contain a
username, whereas the second does not. In this case the comparison
fails.
Remove the username from $gs->repos_root before performing the
comparison.
Thanks. Commit makes sense, but one of the test cases fails for me,
can you check it out?
$ make && make t9161-git-svn-mergeinfo-push.sh -C t GIT_TEST_OPTS='-i -v'
<snip successes>
ok 11 - reintegration merge

expecting success:
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4)
test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
/branches/svnb2:3,8,16-17
/branches/svnb3:4,9
/branches/svnb5:6,11"

not ok 12 - check reintegration mergeinfo
#
# mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4)
# test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
# /branches/svnb2:3,8,16-17
# /branches/svnb3:4,9
# /branches/svnb5:6,11"
#
make: *** [t9161-git-svn-mergeinfo-push.sh] Error 1
make: Leaving directory `/home/ew/git-core/t'


You'll also need to sign-off (see Documentation/SubmittingPatches)
It is required (project policy, not mine)
Post by Tommaso Colombo
@@ -729,7 +730,7 @@ sub populate_merge_info {
}
my $branchpath = $1;
- my $ra = Git::SVN::Ra->new($branchurl);
+ my $ra = Git::SVN::Ra->new(add_path_to_url($gs->repos_root, $branchpath));
Also, please keep long lines wrapped to <= 80 columns.
Thanks again.

Loading...