views:

627

answers:

4

I've seen repositories in SVN that did not at least create a local trunk, branches, and tags folder on the client. So is are the default folders required for use with SVN (I'm using tortoise) or what? I don't see why some people have the folders but some do not in some implementations of repositories.

+4  A: 

Since the only way to tag or branch in Subversion is to make a copy in some other tree, omitting the standard trunk/tags/branches directories prevents you from ever creating a copy of your repository in a location that is "outside" your project directory. If you ever want to tag or branch without having the default directories, you'll just end up creating them and moving your project around anyway.

Greg Hewgill
but a branch is not a copy of an entire directory, usually it's not at least.
CoffeeAddict
+6  A: 

Absolutely not required. Many companies consider it best practices, and having trunk/branch directories works well for many software environments, and seems more familiar to those coming from cvs, etc.

An example where it's suboptimal is storing a website in Subversion. Several companies I've worked at have a Devel and Live directories. Work is done in the Devel directory, and merged into the Live directory when the green light goes on.

As Greg said, though, you definitely want SOME directory under the root, but there's no requirement for a particular structure.

dj_segfault
what do you mean by "some directory", can you put this into context then if I do not have those folders initially? I am not a build guy so I do not know.
CoffeeAddict
As Greg (Love the hair!) said 04/21, if you put all your stuff in the root of the repository, it's very difficult to change your mind later by creating a directory and moving all the existing stuff into it. However, if you have everything in a directory, you can always create parallel directories and subdirectories, etc.
dj_segfault
+6  A: 

As others have said, it is not required to have the trunk/branches/tags. These folders have no special meaning to subversion, it's just a best practice that you may use if it fits your needs.

But since you mentioned TortoiseSVN, there is one small detail: Tortoise will warn you when you try to commit to a sub-folder of /tags. It enforces that a tag is not modified once it is created (another best-practice).


Update (in response of your comment):

The best practices say that you should have "trunk", "branches" and "tags" folders in your repository. One way (probably the most common one) to use these folders is this:

  • trunk is where the main development takes place.
  • tags contains snapshots (copies) of important revisions/version of your source code (e.g. releases such as 1.0, 1.1, 2.0).
  • branches are used for maintenance of older versions, e.g. your product is on version 2, then you have the need to fix a bug in version 1.0 (you can then copy your 1.0 tag to a new branch and make modifications there).

Now to subversion, all folders (trunk, tags, branches) are "normal" folders. They have now special meaning and subversion does not treat them any different (which means you could modify what you have in "/tags/1.0" for example).

TortoiseSVN tries to enforce best-practices by warning you when you try to commit to a tag (since usually you want to keep tags as they were to be able to rebuild an older version of your product at any time).

M4N
what do you mean by tags
CoffeeAddict
Updated my answer. Hope this helps. See also this page of the tortoiseSVN documentation: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository.html#tsvn-repository-layout
M4N
I am pretty sure we had those folders on the server-side but not client-side. When we as developers checked out code for the first time from a repository, we only saw the .svn folder and nothing more
CoffeeAddict
No. You should not checkout those folders on the client, they should be used to help you choose which branch you're working on. Checkout ".../trunk/" to work on the trunk. Then "switch" to ".../branches/new-feature/" to work on the new feature.
Vincent Robert
And keep in mind that using the recommended trunk/branches/tags folders will greatly help any migration to another version control software in the future.
Vincent Robert
A: 

This doesn't answer your question, (the others have already) but if you only want the trunk, just specify that when you do the initial get/checkout.

Tim