tags:

views:

364

answers:

5

I'm trying to figure out the best way to structure our Subversion Repositories initially.

So is it best practice to create an initial repository then sub repositories for each project underneath?

And which repositories should have a trunk, branch, etc. created?

Also, I hear it's best practice not to create a trunk, branch, and tags folders on the root level repository?

I know when I was on another team, we pulled lets say ProjectA but it did not pull down a trunk, branch folders which was nice but I do not know how this was structured on the server to make that happen like this.

+2  A: 

To save yourself future maintenance headaches, unless you have HUGE amounts of code, or envision wanting to completely delete a project with a large amount of code, keep everything in one repository. Then make directories for each project. Then, if you'd like to follow Subversions recommendation, put the "trunk", "branches", and "tags" folders under each project's folder.

Renesis
so when I create a sub-folder for a project, then I copy the URL, go to that folder locally and then how do I wire up that to the trunk folder I created on the server underneath my project folder?
CoffeeAddict
When setting up a new repository this is what I do. I create the global repository, with a URL like "http://example.com/svn/". I check that out into a new local folder, I.E. "example-svn" (whatever you want). Now, "example-svn" is a Working Copy of the whole repository. If you want to set up trunk/branches/tags folders, then create a new folder inside "example-svn" for "project1", and inside that folder create "trunk", "branches", and "tags". Then, paste all the files for project1 into "trunk", right click "project1" and select "Add". Commit and you're good to go.
Renesis
In the example above, if you want to check out the whole repository (all projects), you'd use "http://example.com/svn/". If you wanted to check out just project1, use "http://example.com/svn/project1"
Renesis
what pains do you run into when you don't do it this way? You stated some pains.
CoffeeAddict
Jim T
Great answer from Jim about the maintenance headaches. I would add that the one thing I was alluding to that might be a little better with multiple repositories, is if you envision wanting to completely get rid of whole projects - if it's in it's own repository, you can just delete the whole thing. If it's in a combined repository, it will be in your history forever, taking up some space. But as Jim said, there are so many good reasons to use one repository, I don't think it's worth the cost.
Renesis
+6  A: 

if you want to keep several project in the repository I would go for this structure

/project1
    /trunk
    /branches
    /tags
/project2
    /trunk
    /branches
    /tags 
...

If you want to keep only one project this will do:

/trunk
/branches
/tags
RaYell
Thank you. And so if I were to check in project1 for the first time, I'd just get the URL from Project1\trunk folder and use that then right?
CoffeeAddict
if you want to work on project1 you will just use something like `svn://path.to.your.repo/project1/trunk` for your checkout
RaYell
exactly, thanks!
CoffeeAddict
I agree with this, this is how my team currently does it.
mizipzor
I'm using the model above for a few years now in some of my project and I'm happy with it too.
RaYell
+1  A: 

Subversion book to the rescue.

Matthew Vines
yea, and it's pack full of information to confuse you even more. I've gone through that and it doesn't give best practices like this.
CoffeeAddict
I found that it cleared a lot fo things up for me. RaYell's answer is almost straight out of the books recommendations.
Matthew Vines
A: 

Keeping separate repositories allows you to customize backup schedules and storage locations on a per repository basis. Also, if you occasionally have to dig into the repository and perform some maintenance or cleanup actions (say, you want to delete a commit from the repo entirely... rare but possible) keeping separate repositories will allow you to do so with minimum interference to other users and other repos.

That being said - for small projects, these things are typically not a big concern. I give another hearty recommendation to the trunk/branches/tags setup.

dls
A: 

I prefer fine-grained, very organized, self contained, structured repositories. There is a diagram illustrating general (ideal) approach of repository maintenance process. For example, my initial structure of repository (every project repository should have) is:

/project
    /trunk
    /tags
        /builds
            /PA
            /A
            /B
        /releases
            /AR
            /BR
            /RC
            /ST
    /branches
        /experimental
        /maintenance
            /versions
            /platforms
        /releases
altern