2

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

ziggy
  • 15,677
  • 67
  • 194
  • 287

3 Answers3

3

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.

cdeszaq
  • 30,869
  • 25
  • 117
  • 173
  • Does it then automatically recognise the trunc/branches/tags directories as 'special' directories? – ziggy Jan 06 '12 at 16:17
  • 1
    Subversion doesn't really recognize _any_ directories as special (other than `.svn` in most implementations). All "special" directories are nothing more than conventions and their use all depends on what the users do with them. Some clients _may_ do special things with them, but it isn't required. In general, users will just check out the `Trunk` directory of the project(s) they are working on and switch to a specific branch or tag if needed. – cdeszaq Jan 06 '12 at 16:20
1

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"
A4L
  • 17,353
  • 6
  • 49
  • 70
  • This is the same thing as my suggestion, but with the command line and svn auto-adding the directories, right? – cdeszaq Jan 06 '12 at 16:20
  • if i understood your suggestion correctly, to checkout the trunk or any other branch they have to exist first in the server. these diretories are missing in the asker's repository since he just set up his server, and as you said those are not special directorie, its just a convention. also `.svn` is typical for unix hidden files, in windows you might have a normal `svn` dir witch is hidden. – A4L Jan 06 '12 at 16:30
  • doing `svn mkdir /proj ` creates a directory directly on the server ... no need for a later commit. – A4L Jan 06 '12 at 16:31
  • My understanding, based on `The documentation only allows me to create a new repository from a template which produces this layout` is that the OP already has the 2nd structure as a repository. And you are correct about the `.svn` directories, which I mentioned can be different in a comment on my answer. – cdeszaq Jan 06 '12 at 16:32
  • my bad ... i missed this part `which produces this layout` xD ... so your suggetion is correct! – A4L Jan 06 '12 at 16:35
0

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.

Alexandre Martini
  • 389
  • 1
  • 4
  • 14