tags:

views:

95

answers:

2

We currently run a big subversion repository, and I'm trying to move it to GIT. The problem is that it uses trunks and tags below the root directory. For example:

MyDepartment\MyOS\Project1\trunk\              <-- master branch
MyDepartment\MyOS\Project1\branch\v1           <-- other branch
MyDepartment\MyOS\Project1\tags\v1_20100101    <-- release tag

There are different departments, OS's, and many different projects.

So when I clone the SVN repository using --stdlayout:

git svn clone --stdlayout http://svn-repository/

The clone ends up empty. Without the option, I get a clone, but then branches are treated as directories on the master branch.

  1. Is there a way to import this directory structure in one go?
  2. If I write a script to import all the Projects separately, is there a way to combine the per-project GIT imports into one big GIT repository?
A: 

Look into Git submodules. You'll probably have to import each of your subprojects separately, but the result may mirror your current usage a little better.

Brian Clapper
Unfortunately, the book I read ("Version Control with Git") discourages the use of submodules in a rather convincing way
Andomar
+2  A: 

If I understande the question correctly, you want:

git svn clone 
    --trunk=MyDepartment\MyOS\Project1\trunk 
    --tags=MyDepartment\MyOS\Project1\tags 
    --branches=MyDepartment\MyOS\Project1\branch 
    http://svn-repository/

Update: you can include more then one --branches and --tags:

git svn clone 
    --trunk=MyDepartment\MyOS\Project1\trunk 
    --tags=MyDepartment\MyOS\Project1\tags 
    --tags=MyDepartment\MyOS\Project2\tags 
    --tags=OtherDepatment\MyOS\Project1\tags 
    --branches=MyDepartment\MyOS\Project1\branch 
    --branches=MyDepartment\MyOS\Project2\branch 
    --branches=OtherDepartment\MyOS\Project1\branch 
    http://svn-repository/

You cannot have more the one trunk evidently.

Git is really designed to support one project per one repository and not multiple projects in one repo. I suppose you will hit many problems trying to use it like that.

silk
There are many different projects. I can script the import for each project, but how can I combine them into one git repository?
Andomar
Small update about multiple branches and tags parameters. Does this help? Or you want git to automagically guess the complex structure of your repository? I believe it is not possible.
silk
@silk: Is it possible to merge multiple git repositories into one?
Andomar