0

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/

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?

0

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I wish I could change the structure, but then again if I could do that I'd probably just convert the whole repo to git anyway and do away with svn :)
I tried editing the git config file as you mentioned above, but I still get Couldn't find revmap for path/to/Root/Project1/SpecificBranchName1 :P
1

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...

1 Comment

When I tried: git svn clone --tags tags --trunk trunk http://path/to/repo/Root/Project1 I get the same error :P (Couldn't find revmap for path/to/project/Root/Project1/SpecificBranchName1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.