views:

502

answers:

2

I am attempting to create a svn branch using git-svn. The repository was created with --stdlayout. Unfortunately it generates an error stating the "Source and dest appear not to be in the same repository". The error appears to be the result of it not including the username in the source url.

$ git svn branch foo-as-bar -m "Attempt to make Foo into Bar."

Copying svn+ssh://my.foo.company/r/sandbox/foo/trunk at r1173 to svn+ssh://[email protected]/r/sandbox/foo/branches/foo-as-bar...

Trying to use an unsupported feature: Source and dest appear not to be in the same repository (src: 'svn+ssh://my.foo.company/r/sandbox/foo/trunk'; dst: 'svn+ssh://[email protected]/r/sandbox/foo/branches/foo-as-bar') at /home/me/.install/git/libexec/git-core/git-svn line 610

I intially thought this was simply a configuration issue, examination of .git/config doesn't suggest anything incorrect.

 [svn-remote "svn"]
     url = svn+ssh://[email protected]/r
     fetch = sandbox/foo/trunk:refs/remotes/trunk
     branches = sandbox/foo/branches/*:refs/remotes/*
     tags = sandbox/foo/tags/*:refs/remotes/tags/*

I am using git version 1.6.3.3.

Can anyone shed any light on why this might be occuring, and how best to address it?

+4  A: 

I think this is a bug in git-svn, if you observe the source repository in the error it is missing the svnuser@ portion of the url. This is because git-svn uses the svn repo from the commit messsage? Im not sure. I was able to make it work by modifying git-svn perl script to include the hardcoded url on line 609. In your case line 609 would look something like this...

$src = "svn+ssh://[email protected]/r/sandbox/foo/trunk";

Note this may be different if your git-svn is newer/older then mine. After i successfully branched I removed the line ( since i only needed to branch twice. ) Im going ot file a bug report.

Also note if you are using non svn+ssh type repo's.. such as file:////home/r/sandbox/foo/trunk this isnt an issue.

Yeah, this is exactly what I did. I just hacked the perl file to forcibly add the "user@" part to the svn url. Very ghetto obviously.
Danny
Thanks, this helped me out. @slacker: have you filed a bug report? Can you link to it?
Mike Mazur
thnx! the correct line for me (with escaping of the @) is:$src = "svn+ssh://svnuser\@my.foo.company/r/sandbox/foo/trunk";
return1.at
+1  A: 

An actual fix for this is in this patch, obtained from the mailing list thread:

diff --git a/git-svn.perl b/git-svn.perl
index dba0d12..650c9e5 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -663,7 +663,8 @@ sub cmd_branch {
        }
        $head ||= 'HEAD';

-   my ($src, $rev, undef, $gs) = working_head_info($head);
+   my (undef, $rev, undef, $gs) = working_head_info($head);
+   my $src = $gs->full_url;

        my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
        my $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };

Note that for the same revision that Danny's using, 1.6.3.3, I found this specific line at 588. In Ubuntu Karmic 9.10, this script is /usr/lib/git-core/git-svn.

gotgenes