SVN - How do i create a subversion repository with a “single repository multiple project layout”?

StackOverflow https://stackoverflow.com/questions/8760806

  •  14-04-2021
  •  | 
  •  

Question

I have just installed Subversion (Collabnet). The documentation explains how to create repositories which i have done but i cant figure out how to create a specific layout. I want to create this layout

c:\repositories
 +- MyProjectRepository
     +- project1
          +--- trunc
          +--- branches
          +--- tags
     +- project2
          +--- trunc
          +--- branches
          +--- tags
     +- project3
          +--- trunc
          +--- branches
          +--- tags

The documentation only allows me to create a new repository from a template which produces this layout:

c:\repositories
 +- MyProjectRepository
     +-- project1
          +--- trunc
          +--- branches
          +--- tags

How can i achieve the first layout? i.e. multiple projects in a single repository.

Edit

Are the 3 directories considered as special directories? For example, if i create the directory structures manually, will subversion recognise these directories? i.e. if i create a tag while in project3, the tag link will be associated to project3/tags.

Thanks

Was it helpful?

Solution

Subversion will accept any directory structure you want. Simply check out the repository you created from the top level of the repository, and then remove the existing structure. You can then set up the directories you like (in any configuration) and then just commit your new structure back to the repository.

Note: This will only work cleanly for a new (empty) repository. A repository with changes already will be a bit messier, but the idea is still the same.

OTHER TIPS

alternativly you can use

svn mkdir <repo>/MyProjectRepository -m "project1 tree created"
svn mkdir <repo>/MyProjectRepository/project1 -m "project1 tree created"
svn mkdir <repo>/MyProjectRepository/project1/trunk -m "project1 tree created"
svn mkdir <repo>/MyProjectRepository/project1/branches -m "project1 tree created"
svn mkdir <repo>/MyProjectRepository/project1/tags -m "project1 tree created"

I know this is an old topic, but I noticed that nobody mentioned using svn import, which is what I always did and seems an easy way to start a new repository or even add a project later on.

First, you create your repository with svnadmin create.

Then, you create a container folder (let's call it structure) and you put the exact structure you want to import to your repository inside this folder.

You'll end up with a folder like this:

\structure
    \project1
        \branches
        \tags
        \trunk
    \project2
        \branches
        \tags
        \trunk
    \project3
        \branches
        \tags
        \trunk

Then, you just have to execute svn import structure http://path-to-your-repository.

Edit: check this page for more details on how to use the svn import command http://svnbook.red-bean.com/en/1.7/svn.tour.importing.html.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top