2009-07-21 143 views
4

我试图创建一个svn branch using git-svn。该存储库使用--stdlayout创建。不幸的是,它会生成一个错误,指出“源和目标似乎不在同一个存储库中”。该错误似乎是它不包括源URL中的用户名的结果。Git-svn拒绝在svn仓库上创建分支错误:“不在同一个仓库中”

$ 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

我intially认为这是一个简单的配置问题,的.git/config检查不建议任何不正确。我正在使用git version 1.6.3.3

任何人都可以阐明为什么这可能会发生,以及如何最好地解决它?

回答

1

这个实际的解决办法是在这个补丁,从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' }; 

。应注意丹尼的使用,1.6.3.3相同的修订,我发现这个特定的线路在588在Ubuntu中的业报9.10,这个脚本是/usr/lib/git-core/git-svn

4

我认为这是git-svn中的一个错误,如果你在源代码仓库中发现错误,它缺少url的svnuser @部分。这是因为git-svn使用提交消息中的svn repo?我不确定。我可以通过修改git-svn perl脚本来包含609行的硬编码url来工作。在你的案例中,行609看起来像这样...

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

注意这可能是不同的,如果你的git-svn更新/更老,那么我的。在我成功分支后,我删除了该行(因为我只需要分支两次。)我要去提交一个bug报告。

另请注意,如果您使用的是非svn + ssh类型的repo's ..例如file://// home/r/sandbox/foo/trunk这不是问题。

+0

是的,这正是我所做的。我刚刚破解了perl文件,强制将“user @”部分添加到svn url中。显然非常贫民窟。 – Danny 2009-08-14 15:05:27