1

I am try to migrate a Subversion repository which was not initially using the standard layout. I cannot figure out how to migrate it.

For Example. In SVN Rev 1. - 700, the layout is

[svn]/projectfile
[svn]/projectfile2

Until the revision 700 then it change to

[svn]/trunk/projectfile
[svn]/tags
[svn]/branches

How can I run the git svn init command?

Right now when I use

git svn init -s <subversion_repository>

it will show everything in the directory like there are no branches. (same like use below command)

svn checkout <subversion_repository_root>/
obmarg
  • 9,369
  • 36
  • 59
scalopus
  • 2,640
  • 3
  • 19
  • 32

2 Answers2

2

As I don't have a subversion repo at hand to try this out with, I can only outline a way of solving this which may or may not work:

  • First, make a directory to hold your Git repo and cd into it
  • Initialize your Git repo: git svn init svn://path/to/svn/repo
  • Inside this repo, run git svn fetch --revision 1:699 (Or whatever the revision range is where you used the non-standard layout)
  • Modify .git/config and modify the [svn-remote] section to add/modify the fetch, branches and tags entries:
  [svn-remote "svn"]
    url = svn://path/to/svn/repo
    fetch = trunk:refs/remotes/trunk
    branches = branches/*:refs/remotes/*
    tags = tags/*:refs/remotes/tags/*
  • Run git svn fetch --revision 700:HEAD to fetch the rest of the repo
  • If everything worked until this point, but you don't have any files in your working directory, run git svn rebase --local to make sure Git creates the files.

In theory, this should get you a Git repository with the complete history and all the branches and tags intact.

As usual, make backups of anything that might be touched by this before doing any of this stuff, and proceed at your own risk, etc.

Markus
  • 526
  • 3
  • 5
0

As the answer provided, I found that there will be the problem when already fetch all revisions to Git. Create new issue like this topic

After I reviewed the repository, I found that if I provide the parameter (-s) to mark my repository as standard repository, it will ignore for all non-standard, in my case, it will ignore Rev.1-700 and will automatic convert from 700 afterward.

So, right now, I still have no solution except use git-svn with the full fetch from the original url and ignore the path that make the problem occurs.

Community
  • 1
  • 1
scalopus
  • 2,640
  • 3
  • 19
  • 32