开发者

Cannot setup Git with Subversion repository using git svn

I am trying to use Git with Subversion via git svn with a Subversion repository that has multiple projects in it. The project structure looks like this:

Root/

*Project1/

trunk/

tags/

SpecificBranchName1/

SpecificBranchName2/

开发者_Go百科

Project2/

trunk/

tags/

SpecificBranchName1/

etc.

I'm able to get Project1 into a git repo by doing git svn clone -s http://path/to/repo/Root/Project1 --no-follow-parent. However the trunk, tags, and SpecificBranchName1 and SpecificBranchName2 are in my tree structure.

If I remove the --no-follow-parent flag, I get an error message saying, "Couldn't find revmap for http://path/to/repo/Root/Project1/SpecificBranchName1". I get the same message if I try: git svn clone -T trunk -t tags -b . http://path/to/repo/Root/Project1

I don't really need the branch in my git repo, so I tried skipping it with: git svn clone -s --ignore-paths="^SpecificBranchName1" http://path/to/repo/Root/Project1, but got the same error.

From what I can tell, this Subversion file structure is odd. Usually branches are under ./branches, but for some reason they are included in the same file path as tags and trunk. Is there anyway to get past this?


Your's is not a standard structure by any means ( of course you have said it yourself as well ) so why are you using -s flag?

I would suggest you create a branches folder in svn and move the moving the branches into that. That will prevent you lots of pain down the line.

If you cannot do that due to various reasons, you can do a git int to the project1 root, edit the .git/config and change the branches part under svn-remote:

branches = {SpecificBranchName1,SpecificBranchName2}:refs/remotes/branches/*

(adjust the above based on how the relative url is )

and then do the fetch.


If you don't need the branches, try:

git svn clone http://path/to/repo/Root/Project1 --trunk=trunk --tags=tags Project1

That is, almost the same as the second command that you use, but without the -b part. git svn won't try to look for branches if it is not requested to.

After that, you could try editing .git/config as manojlds suggests.

EDIT: ok, I run further tests. I recreated an svn repository with your folder structure. I tried to use git svn on it and everything went smoothly. I'm using git 1.7.1.

I then looked for the string "couldn't find revmaps" in Google Code Search, and found this:

sub lookup_svn_merge {
        ...
        my $gs = Git::SVN->find_by_url($url.$source, $url, $path);
        if ( !$gs ) {
                warn "Couldn't find revmap for $url$source\n";
                return;
        }
        ...

I'm certainly not going to read the entire code for git svn, but what I surmise from this is that Git found a merge point in trunk, and the merge comes from a path that Git doesn't know anything about and that for some reason it can't reach.

I tried to reproduce this case but all went successfully again. Possible solutions:

  • upgrade your Git version if it's not the latest
  • figure out if there's indeed a merge from SpecificBranchName1 in trunk, and if so, only use the revisions after that one to initialize your Git repository

I hope this helps...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜