1

I worked in projects using svn (by using Tortoise) that never had a "trunk" directory before, and then moved onto using git, and now two companies I worked for use svn... and the word trunk came up sometimes.

From the answers in What do "branch", "tag" and "trunk" mean in Subversion repositories? , it seems like trunk is actually just like the "main branch" as in git? Do all SVN repo always have the trunk and branches directory, while for a working directory, they are optional? Such as, if we do

svn checkout some_svn_path/trunk .

then our working directory has no trunk directory whatsoever? (without the ., then the trunk directory will be there, but with the ., the trunk directory won't be there). But what if later on, somebody suggests using a "try-new-feature" branch, then what happens? I saw in the O'Reilly SVN book that they would have a calc project, and then the working directory has a trunk sub-directory as well as a branches sub-directory.

Community
  • 1
  • 1
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
  • I guess the O'Reilly SVN book example was broken (or an unintended example how *not* to checkout using SVN). When you correctly check out the trunk (=main branch), you don't have a trunk dir as working directory. Your main question was already answered at the link you provided by yourself, look at the second best answer. – Doc Brown Mar 27 '13 at 10:56
  • 1
    possible duplicate of [What do "branch", "tag" and "trunk" mean in Subversion repositories?](http://stackoverflow.com/questions/16142/what-do-branch-tag-and-trunk-mean-in-subversion-repositories) – Doc Brown Mar 27 '13 at 11:01
  • http://svnbook.red-bean.com/en/1.7/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout and http://svnbook.red-bean.com/en/1.7/svn.branchmerge.maint.html#svn.branchmerge.maint.layout – bahrep Mar 27 '13 at 13:07

1 Answers1

4

From URLs of @bahrep you have already know, what Subversion (contrary to Mercurial/Git with their pre-existing branches for mainline) have not any predefined layout, but may have any conventional layout which is result of agreement between developers only.

  • In case of pure linear development (none diverged history, none merges) repository may have flat space (root of repo and nothing more)
  • Trunk may be named not as "trunk", but using any another name

Your svn co really "checkout some subtree of repository into some local folder" - local folder may be any, repository subtree also can be any. Source of checkout have only one meaning - later operations can't happens for any repository-objects not under "checkouted root"

But what if later on, somebody suggests using a "try-new-feature" branch, then what happens?

Nothing. You have to switch your WC for the new root (root of this branch) instead of current of create|checkout new WC for this branch

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110