* [PATCH] git-svn: Make branch use correct svn-remote
@ 2008-12-02 2:43 Deskin Miller
2008-12-02 21:51 ` Eric Wong
0 siblings, 1 reply; 8+ messages in thread
From: Deskin Miller @ 2008-12-02 2:43 UTC (permalink / raw)
To: git; +Cc: gitster, normalperson, Deskin Miller
The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
as 'svn', the default remote name. This meant that branches derived
from other svn-remotes would try to use the branch and tag configuration
for the 'svn' remote, potentially copying would-be branches to the wrong
place in SVN, into the branch namespace for another project.
Fix this by using the remote name extracted from the svn info for the
specified git ref. Add a testcase for this behaviour.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
---
Applies on v1.6.1-rc1. Apologies for not catching this when first
writing testcases for the branch subcommand.
Deskin Miller
git-svn.perl | 2 +-
t/t9128-git-svn-cmd-branch.sh | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 914c707..e64e97b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -558,7 +558,7 @@ sub cmd_branch {
my ($src, $rev, undef, $gs) = working_head_info($head);
- my $remote = Git::SVN::read_all_remotes()->{svn};
+ my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
my $glob = $remote->{ $_tag ? 'tags' : 'branches' };
my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
my $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());
diff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh
index 47c4d4d..e2b6696 100755
--- a/t/t9128-git-svn-cmd-branch.sh
+++ b/t/t9128-git-svn-cmd-branch.sh
@@ -56,4 +56,21 @@ test_expect_success 'git svn branch tests' '
test_must_fail git svn tag tag1
'
+test_expect_success 'branch uses correct svn-remote' '
+ (svn co "$svnrepo" svn &&
+ cd svn &&
+ mkdir mirror &&
+ svn add mirror &&
+ svn copy trunk tags branches mirror/ &&
+ svn ci -m "made mirror" ) &&
+ rm -rf svn &&
+ git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
+ git svn fetch -R mirror &&
+ git checkout mirror/trunk &&
+ base=$(git rev-parse HEAD:) &&
+ git svn branch -m "branch in mirror" d &&
+ test $base = $(git rev-parse remotes/mirror/d:) &&
+ test_must_fail git rev-parse remotes/d
+'
+
test_done
--
1.6.1.rc1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-02 2:43 [PATCH] git-svn: Make branch use correct svn-remote Deskin Miller
@ 2008-12-02 21:51 ` Eric Wong
2008-12-03 3:55 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Eric Wong @ 2008-12-02 21:51 UTC (permalink / raw)
To: Deskin Miller; +Cc: git, gitster
Deskin Miller <deskinm@umich.edu> wrote:
> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
> as 'svn', the default remote name. This meant that branches derived
> from other svn-remotes would try to use the branch and tag configuration
> for the 'svn' remote, potentially copying would-be branches to the wrong
> place in SVN, into the branch namespace for another project.
>
> Fix this by using the remote name extracted from the svn info for the
> specified git ref. Add a testcase for this behaviour.
>
> Signed-off-by: Deskin Miller <deskinm@umich.edu>
Looks alright to me, thanks Deskin.
Acked-by: Eric Wong <normalperson@yhbt.net>
> ---
> Applies on v1.6.1-rc1. Apologies for not catching this when first
> writing testcases for the branch subcommand.
>
> Deskin Miller
>
> git-svn.perl | 2 +-
> t/t9128-git-svn-cmd-branch.sh | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 914c707..e64e97b 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -558,7 +558,7 @@ sub cmd_branch {
>
> my ($src, $rev, undef, $gs) = working_head_info($head);
>
> - my $remote = Git::SVN::read_all_remotes()->{svn};
> + my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
> my $glob = $remote->{ $_tag ? 'tags' : 'branches' };
> my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
> my $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());
> diff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh
> index 47c4d4d..e2b6696 100755
> --- a/t/t9128-git-svn-cmd-branch.sh
> +++ b/t/t9128-git-svn-cmd-branch.sh
> @@ -56,4 +56,21 @@ test_expect_success 'git svn branch tests' '
> test_must_fail git svn tag tag1
> '
>
> +test_expect_success 'branch uses correct svn-remote' '
> + (svn co "$svnrepo" svn &&
> + cd svn &&
> + mkdir mirror &&
> + svn add mirror &&
> + svn copy trunk tags branches mirror/ &&
> + svn ci -m "made mirror" ) &&
> + rm -rf svn &&
> + git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
> + git svn fetch -R mirror &&
> + git checkout mirror/trunk &&
> + base=$(git rev-parse HEAD:) &&
> + git svn branch -m "branch in mirror" d &&
> + test $base = $(git rev-parse remotes/mirror/d:) &&
> + test_must_fail git rev-parse remotes/d
> +'
> +
> test_done
> --
> 1.6.1.rc1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-02 21:51 ` Eric Wong
@ 2008-12-03 3:55 ` Junio C Hamano
2008-12-03 9:30 ` [PATCH] Make t9128-git-svn-cmd-branch pass with svn 1.4 Michael J Gruber
2008-12-03 9:33 ` [PATCH] git-svn: Make branch use correct svn-remote Michael J Gruber
0 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2008-12-03 3:55 UTC (permalink / raw)
To: Eric Wong; +Cc: Deskin Miller, git, gitster
Eric Wong <normalperson@yhbt.net> writes:
> Deskin Miller <deskinm@umich.edu> wrote:
>> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
>> as 'svn', the default remote name. This meant that branches derived
>> from other svn-remotes would try to use the branch and tag configuration
>> for the 'svn' remote, potentially copying would-be branches to the wrong
>> place in SVN, into the branch namespace for another project.
>>
>> Fix this by using the remote name extracted from the svn info for the
>> specified git ref. Add a testcase for this behaviour.
>>
>> Signed-off-by: Deskin Miller <deskinm@umich.edu>
>
> Looks alright to me, thanks Deskin.
>
> Acked-by: Eric Wong <normalperson@yhbt.net>
Does not work for me X-<.
* expecting success:
(svn co "$svnrepo" svn &&
cd svn &&
mkdir mirror &&
svn add mirror &&
svn copy trunk tags branches mirror/ &&
svn ci -m "made mirror" ) &&
rm -rf svn &&
git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
git svn fetch -R mirror &&
git checkout mirror/trunk &&
base=$(git rev-parse HEAD:) &&
git svn branch -m "branch in mirror" d &&
test $base = $(git rev-parse remotes/mirror/d:) &&
test_must_fail git rev-parse remotes/d
A svn/trunk
A svn/trunk/foo
A svn/branches
A svn/branches/a
A svn/branches/a/foo
A svn/branches/b
A svn/branches/b/foo
A svn/tags
A svn/tags/tag4
A svn/tags/tag4/foo
A svn/tags/tag1
A svn/tags/tag1/foo
A svn/tags/tag2
A svn/tags/tag2/foo
A svn/tags/tag3
A svn/tags/tag3/foo
Checked out revision 8.
A mirror
svn: Client error in parsing arguments
* FAIL 4: branch uses correct svn-remote
(svn co "$svnrepo" svn &&
cd svn &&
mkdir mirror &&
svn add mirror &&
svn copy trunk tags branches mirror/ &&
svn ci -m "made mirror" ) &&
rm -rf svn &&
git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
git svn fetch -R mirror &&
git checkout mirror/trunk &&
base=$(git rev-parse HEAD:) &&
git svn branch -m "branch in mirror" d &&
test $base = $(git rev-parse remotes/mirror/d:) &&
test_must_fail git rev-parse remotes/d
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Make t9128-git-svn-cmd-branch pass with svn 1.4
2008-12-03 3:55 ` Junio C Hamano
@ 2008-12-03 9:30 ` Michael J Gruber
2008-12-03 9:33 ` [PATCH] git-svn: Make branch use correct svn-remote Michael J Gruber
1 sibling, 0 replies; 8+ messages in thread
From: Michael J Gruber @ 2008-12-03 9:30 UTC (permalink / raw)
To: git
The copy command in svn 1.4 allows only one source (svn copy A D), whereas
the copy command in svn 1.5 allows multiple sources (svn copy A B C D).
This patch rewrites t9128 to use the backwards compatible form.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
t/t9128-git-svn-cmd-branch.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh
index e2b6696..252daa7 100755
--- a/t/t9128-git-svn-cmd-branch.sh
+++ b/t/t9128-git-svn-cmd-branch.sh
@@ -61,7 +61,9 @@ test_expect_success 'branch uses correct svn-remote' '
cd svn &&
mkdir mirror &&
svn add mirror &&
- svn copy trunk tags branches mirror/ &&
+ svn copy trunk mirror/ &&
+ svn copy tags mirror/ &&
+ svn copy branches mirror/ &&
svn ci -m "made mirror" ) &&
rm -rf svn &&
git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
--
1.6.1.rc1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-03 3:55 ` Junio C Hamano
2008-12-03 9:30 ` [PATCH] Make t9128-git-svn-cmd-branch pass with svn 1.4 Michael J Gruber
@ 2008-12-03 9:33 ` Michael J Gruber
2008-12-03 20:06 ` Junio C Hamano
2008-12-04 19:26 ` Eric Wong
1 sibling, 2 replies; 8+ messages in thread
From: Michael J Gruber @ 2008-12-03 9:33 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano, Eric Wong, Deskin Miller
Junio C Hamano venit, vidit, dixit 03.12.2008 04:55:
> Eric Wong <normalperson@yhbt.net> writes:
>
>> Deskin Miller <deskinm@umich.edu> wrote:
>>> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
>>> as 'svn', the default remote name. This meant that branches derived
>>> from other svn-remotes would try to use the branch and tag configuration
>>> for the 'svn' remote, potentially copying would-be branches to the wrong
>>> place in SVN, into the branch namespace for another project.
>>>
>>> Fix this by using the remote name extracted from the svn info for the
>>> specified git ref. Add a testcase for this behaviour.
>>>
>>> Signed-off-by: Deskin Miller <deskinm@umich.edu>
>> Looks alright to me, thanks Deskin.
>>
>> Acked-by: Eric Wong <normalperson@yhbt.net>
>
> Does not work for me X-<.
>
> * expecting success:
> (svn co "$svnrepo" svn &&
> cd svn &&
> mkdir mirror &&
> svn add mirror &&
> svn copy trunk tags branches mirror/ &&
> svn ci -m "made mirror" ) &&
> rm -rf svn &&
> git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
> git svn fetch -R mirror &&
> git checkout mirror/trunk &&
> base=$(git rev-parse HEAD:) &&
> git svn branch -m "branch in mirror" d &&
> test $base = $(git rev-parse remotes/mirror/d:) &&
> test_must_fail git rev-parse remotes/d
>
> A svn/trunk
> A svn/trunk/foo
> A svn/branches
> A svn/branches/a
> A svn/branches/a/foo
> A svn/branches/b
> A svn/branches/b/foo
> A svn/tags
> A svn/tags/tag4
> A svn/tags/tag4/foo
> A svn/tags/tag1
> A svn/tags/tag1/foo
> A svn/tags/tag2
> A svn/tags/tag2/foo
> A svn/tags/tag3
> A svn/tags/tag3/foo
> Checked out revision 8.
> A mirror
> svn: Client error in parsing arguments
> * FAIL 4: branch uses correct svn-remote
>
> (svn co "$svnrepo" svn &&
> cd svn &&
> mkdir mirror &&
> svn add mirror &&
> svn copy trunk tags branches mirror/ &&
With my svn (1.4.6) it fails already here: "svn copy" allows two
arguments only. That may be different in svn 1.5.
> svn ci -m "made mirror" ) &&
> rm -rf svn &&
> git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
> git svn fetch -R mirror &&
> git checkout mirror/trunk &&
> base=$(git rev-parse HEAD:) &&
> git svn branch -m "branch in mirror" d &&
> test $base = $(git rev-parse remotes/mirror/d:) &&
> test_must_fail git rev-parse remotes/d
If I split the above copy into three lines then the test passes (svn
1.4.6, Deskin's patch applied onto 1.6.1-rc1 with the fix.
Patch coming. (Sorry I always forget the ccs with send-email.)
Michael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-03 9:33 ` [PATCH] git-svn: Make branch use correct svn-remote Michael J Gruber
@ 2008-12-03 20:06 ` Junio C Hamano
2008-12-03 20:42 ` Deskin Miller
2008-12-04 19:26 ` Eric Wong
1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2008-12-03 20:06 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Git Mailing List, Eric Wong, Deskin Miller
Michael J Gruber <git@drmicha.warpmail.net> writes:
> Patch coming. (Sorry I always forget the ccs with send-email.)
Thanks, indeed my environment has svn 1.4.2 installed and Deskin's patch
with your patch squashed in makes everything happy again.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-03 20:06 ` Junio C Hamano
@ 2008-12-03 20:42 ` Deskin Miller
0 siblings, 0 replies; 8+ messages in thread
From: Deskin Miller @ 2008-12-03 20:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Michael J Gruber, Git Mailing List, Eric Wong
On Wed, Dec 03, 2008 at 12:06:05PM -0800, Junio C Hamano wrote:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
> > Patch coming. (Sorry I always forget the ccs with send-email.)
>
> Thanks, indeed my environment has svn 1.4.2 installed and Deskin's patch
> with your patch squashed in makes everything happy again.
Ah, curse my trusting svn to work the same between versions, and not
testing on 1.4. Thanks for the quick fix, Michael.
Deskin Miller
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] git-svn: Make branch use correct svn-remote
2008-12-03 9:33 ` [PATCH] git-svn: Make branch use correct svn-remote Michael J Gruber
2008-12-03 20:06 ` Junio C Hamano
@ 2008-12-04 19:26 ` Eric Wong
1 sibling, 0 replies; 8+ messages in thread
From: Eric Wong @ 2008-12-04 19:26 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Git Mailing List, Junio C Hamano, Deskin Miller
Michael J Gruber <git@drmicha.warpmail.net> wrote:
> Junio C Hamano venit, vidit, dixit 03.12.2008 04:55:
> > Eric Wong <normalperson@yhbt.net> writes:
> >> Deskin Miller <deskinm@umich.edu> wrote:
>
> If I split the above copy into three lines then the test passes (svn
> 1.4.6, Deskin's patch applied onto 1.6.1-rc1 with the fix.
Thank you all for the testing and fixes.
--
Eric Wong
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-12-04 19:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 2:43 [PATCH] git-svn: Make branch use correct svn-remote Deskin Miller
2008-12-02 21:51 ` Eric Wong
2008-12-03 3:55 ` Junio C Hamano
2008-12-03 9:30 ` [PATCH] Make t9128-git-svn-cmd-branch pass with svn 1.4 Michael J Gruber
2008-12-03 9:33 ` [PATCH] git-svn: Make branch use correct svn-remote Michael J Gruber
2008-12-03 20:06 ` Junio C Hamano
2008-12-03 20:42 ` Deskin Miller
2008-12-04 19:26 ` Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).