CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo [MVP]

Software management consultant and CTO, Headspring Systems

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



Comments

Damien Guard said:

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

# September 18, 2007 10:49 AM

Jeremy D. Miller said:

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.

# September 18, 2007 12:07 PM

Jeff Brown said:

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.

# September 19, 2007 2:51 AM

Diego Carrion said:

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

# September 19, 2007 7:00 AM

Jeffrey Palermo said:

@Joe,

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

# September 19, 2007 8:19 AM

Jeffrey Palermo said:

@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.

# September 19, 2007 8:22 AM

Michael said:

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.

# September 19, 2007 9:31 AM

Thomas Freudenberg said:

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.

# September 19, 2007 12:00 PM

13 Links Today (2007-09-20) said:

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

# September 20, 2007 11:21 AM

Dave said:

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.

# September 20, 2007 6:50 PM

Sean Chambers said:

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 =)

# September 20, 2007 11:47 PM

Dario Quintana said:

I like this structure:

-bin

-src

-lib

-default.build

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

You forgot lib ?

# September 23, 2007 10:22 AM

Daily Links - November 9, 2007 | GrantPalin.com said:

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

# November 9, 2007 11:20 AM

Structuring Your Subversion Repository | GrantPalin.com said:

Pingback from  Structuring Your Subversion Repository | GrantPalin.com

# December 9, 2007 7:26 PM

Tarek Koudsi said:

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,

# January 6, 2008 10:13 AM

Tarek Koudsi said:

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

# January 6, 2008 10:16 AM

schoetbi said:

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

# February 19, 2008 2:27 AM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

This Blog

Syndication