Jeffrey Palermo (.com)

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
My recommended Subversion repository structure

I would recommend one line of versioning per repository for most cases.  Here is a sample trunk set up with a VS.Net solution.

root
- trunk
  - bin
    - nant
    - log4net
  - src
    - project 1
    - project 2
    - mysolution.sln
    - CommonAssemblyInfo.cs (for version number, etc)
  - automatedbuild.build
  - clickToBuild.bat
- tags
  - 1.0.0.1
  - 1.0.0.2
  - 1.0.0.3
  - 1.0.3.1
  - 1.0.3.2
  - 1.0.0.4
  - 1.0.0.5
- branches
  - 1.0.0.3-hotfix


Posted Tue, Sep 18 2007 8:31 AM by Jeffrey Palermo

[Advertisement]

Comments

Joe wrote re: My recommended Subversion repository structure
on Tue, Sep 18 2007 10:27 AM

Would you reccomend this for other version control systems (such as TFS)?

The "official" guidance on Codeplex seems convoluted to me, whereas your approach is similar to almost everything I've ever seen.

Damien Guard wrote re: My recommended Subversion repository structure
on Tue, Sep 18 2007 10:49 AM

This is similar to what we use but we have one level above trunk where we separate the various different actual projects (not necessarily VS projects).

We also have a 'shared' at top level where we put re-usable libraries and routines used by many separate projects.

[)amien

Jeremy D. Miller wrote re: My recommended Subversion repository structure
on Tue, Sep 18 2007 12:07 PM

That looks strangely familiar Jeffrey.  I think Steve would approve.

@Damien,

We did the "Shared" piece by just using a separate repository.  I have no idea if that's better or worse for SVN.  Regardless, I like using SVN externals underneath each project's \bin folder so that you only have to check out from Trunk.

Jeff Brown wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 2:51 AM

Hehe... I use a very similar layout.  I'll often have "libs" or "tools" folders next to the "src" folder for external binary dependencies.

For MbUnit.Gallio, I managed to omit the CommonAssemblyInfo.cs approach to setting assembly versions by injecting custom targets into the projects with the $(CustomBeforeMSBuildTargets) property when building from the command-line.  The common assembly info is generated in a temp folder instead and added to the @(Compile) item group dynamically.

Diego Carrion wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 7:00 AM

How would you know which project tag w.x.y.z is from?

Jeffrey Palermo wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 8:19 AM

@Joe,

I would recommend this for any source control system.  A "tag" in Subversion is a "Label" in some other systems.

Jeffrey Palermo wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 8:22 AM

@Diego,

Each project has a "trunk".  Each trunk has a "tags" and "branches".  The tags for a particular trunk belong to the project in that trunk.

Project2 has a different trunk, different tags, different branches, and most of the time, a different Subversion repository.

Do NOT put more than one project (Solution in VS.Net terminology) in a single trunk.  Even if the system produces several assemblies, they are all the same version since they are part of the same system.  Different system, different trunk.

Michael wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 9:31 AM

We use an almost identical tree with one exception.  The bin folder in our environment is the dumping ground for things built for this product and in most cases what is deployed.  We add a sibling folder "lib" that we use for all external libraries and our own framework.  Then all the projects reference the local lib folder so you don't have to worry about external version issues with other products.

Also, we use a different repository for each product.  Otherwise projects would share the revision number count.

Thomas Freudenberg wrote re: My recommended Subversion repository structure
on Wed, Sep 19 2007 12:00 PM

I use a similar structure with one exception: "bin" is called "tools", because "bin" is my target folder for the build process, i.e. it will contain all deliverables.

13 Links Today (2007-09-20) wrote 13 Links Today (2007-09-20)
on Thu, Sep 20 2007 11:21 AM

Pingback from  13 Links Today (2007-09-20)

Dave wrote re: My recommended Subversion repository structure
on Thu, Sep 20 2007 6:50 PM

We have a "Libraries" project for external dependencies and a "TestLibraries" project that contains nunit, Rhino.Mocks, etc... i.e. all libraries that are not shipped.

Also, on projects that use code generation, I have a CodeGeneration folder that contains all the templates and config files for generating the data access layer base classes... versioning these templates alongside the code that is generated has saved some major headaches.

Sean Chambers wrote re: My recommended Subversion repository structure
on Thu, Sep 20 2007 11:47 PM

Excellent!

Exactly how I have mine setup. I feel warm and fuzzy now =)

Except mine has a dir called libs instead of bin for external dependecies.

I also have a folder in the root called docs or extras for things that shouldn't be branched all over the place like original PSD's (if a web project), documentation etc... Branching the hell out of your PSD's can quickly explode your file size =)

Dario Quintana wrote re: My recommended Subversion repository structure
on Sun, Sep 23 2007 10:22 AM

I like this structure:

-bin

-src

-lib

-default.build

The build at level of bin,src, and lib.

You forgot lib ?

Daily Links - November 9, 2007 | GrantPalin.com wrote Daily Links - November 9, 2007 | GrantPalin.com
on Fri, Nov 9 2007 11:20 AM

Pingback from  Daily Links - November 9, 2007 | GrantPalin.com

Structuring Your Subversion Repository | GrantPalin.com wrote Structuring Your Subversion Repository | GrantPalin.com
on Sun, Dec 9 2007 7:26 PM

Pingback from  Structuring Your Subversion Repository | GrantPalin.com

Tarek Koudsi wrote re: My recommended Subversion repository structure
on Sun, Jan 6 2008 10:13 AM

Thanks Jeff for this input, helpful it is.

This is how I structured SVN in our development department:

- Product Root

 - trunk

     - bin (product deliverables)

     - lib  (external referenced libraries/frameworks)

     - autoBuild.build

 - branches

 - tags

 - docs (Product documentation & issue tracker log)

However, I'm confused in regards to NUnit & NHibernate, what should be within the repository and what level?

Cheers,

Tarek Koudsi wrote re: My recommended Subversion repository structure
on Sun, Jan 6 2008 10:16 AM

I forgot to mention SOURCE folder under the trunk in my previous comment.

schoetbi wrote re: My recommended Subversion repository structure
on Tue, Feb 19 2008 2:27 AM

It can be ok for one project but if you want to handle more than that, or like to reuse things it will be very hard. It is very untypical and mixes several different things together. E.G a trunk is meant to be tagged later (most of the time). Why would I like to tag project 1 and project 2 in one tag? I recomend to read.

svnbook.red-bean.com/.../ch05s04.html

Devlicio.us