Git Svn - 找到可能的分支点

时间:2013-03-13 14:15:43

标签: git git-svn

我正在尝试使用git svn将SVN repo克隆到Git中。

我运行以下命令:

  

C:\ Projects> git svn clone -T trunk -b branches -t tags --no-metadata https://svn.mycompany.com/Projects/MyProject MyProject

我收到以下错误:

  

找到可能的分支点:   https://svn.mycompany.com/Projects/MyProject/trunk =>   https://svn.mycompany.com/Projects/MyProject/tags/11.1.9.33334,33334

     

在替换时使用未初始化的值(s ///)   /usr/lib/perl5/site_perl/Git/SVN.pm 106行。

     

在连接(。)或字符串中使用未初始化的值   /usr/lib/perl5/site_perl/Git/SVN.pm line   106.refs / remotes / MyProject-10.2:'{/ p>中找不到'https://svn.mycompany.com/Projects'

git的版本是:

1.8.1.msysgit.1

3 个答案:

答案 0 :(得分:65)

我的问题是由于如此庞大的SVN(文件和日志),它在某些点上一直崩溃,当我重新启动时,它在我的.git / config文件中创建了多行分支和标签。

branches = branches/*:refs/remotes/svn/branches/*
tags = tags/*:refs/remotes/svn/tags/*

我只是删除了这些的重复条目,并使用我的命令

重新启动
git svn fetch

答案 1 :(得分:1)

我遇到了同样的错误,并通过升级到git version 2.6.2.windows.1

解决了这个问题

答案 2 :(得分:0)

同样的错误。我正在将我的SVN存储库转换为Git。

git version 2.8.2.windows.1
Windows 8.1 Pro 64bits, running Git For Windows 32bits.

v1,trunk地址错误,错误设置为与repository root相同:

C:\Windows\system32>git svn clone https://mycompany.svn.beanstalkapp.com/myproject 
        --no-metadata -A c:\temp\svn_to_git_users.txt 
        --trunk=https://mycompany.svn.beanstalkapp.com/myproject 
        --tags=https://mycompany.svn.beanstalkapp.com/myproject/tags 
        --branches=https://mycompany.svn.beanstalkapp.com/myproject/branches
        c:\code\Git_myproject

[...]
W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/MS WCSF Contrib/src/Services
W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/RealWorldControls/References
r530 = c276e3b039d8e38759c6fb17443349732552d7a2 (refs/remotes/origin/trunk)
Found possible branch point: https://mycompany.svn.beanstalkapp.com/myproject/trunk => https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY, 529
Use of uninitialized value $u in substitution (s///) at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.
Use of uninitialized value $u in concatenation (.) or string at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.
refs/remotes/origin/trunk: 'https://mycompany.svn.beanstalkapp.com/myproject' not found in ''

C:\Windows\system32>

v2有效:纠正路径(并使用相对而不是绝对来缩短线路)

C:\Windows\system32>git svn clone https://mycompany.svn.beanstalkapp.com/myproject 
        --no-metadata -A c:\temp\svn_to_git_users.txt --trunk=trunk 
        --tags=tags --branches=branches c:\code\Git_myproject
[...]
r529 = 40442d32486f4ca6f713e659b3785a446bd19de6 (refs/remotes/origin/trunk)
Found possible branch point: https://mycompany.svn.beanstalkapp.com/myproject/trunk => https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY, 529
Found branch parent: (refs/remotes/origin/20080918_DBDEPLOY) 40442d32486f4ca6f713e659b3785a446bd19de6
Following parent with do_switch
Successfully followed parent
r530 = 9fefc1b3a892555e315d55c2024cdf3d3a05010f (refs/remotes/origin/20080918_DBDEPLOY)
        A       src/database/sds.dbd
[...]

正如其他人所建议的,我打开了配置文件(C:\ code \ Git_myproject.git \ config),第一个版本(已损坏)如下所示。与v2相比,fetch可能是错误的(分支和标签也是重复的,有人说这可能也会导致问题)。

[svn-remote "svn"]
noMetadata = 1
url = https://mycompany.svn.beanstalkapp.com/myproject
fetch = :refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*

和第二个版本(工作)是:

[svn-remote "svn"]
noMetadata = 1
url = https://mycompany.svn.beanstalkapp.com/myproject
fetch = trunk:refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*

看着svn.pm,我可以看到我们在find_parent_branch()输出消息"Found possible branch point"。然后它打电话 other_gs($new_url, $url, $branch_from, $r, $self->{ref_id}); 本身称之为: Git::SVN->find_by_url($new_url, $url, $branch_from); 哪个叫: resolve_local_globs($u, $fetch, $globspec); 并且resolve_local_globs是第100/101行引发错误的地方:

my $u = (::cmt_metadata("$refname"))[0];
$u =~ s!^\Q$url\E(/|$)!! or die

我确实在命令行中犯了一个错误,修复我的主干路径删除了错误。我从未删除配置文件中的重复行,重新运行命令时会自动调整它们。