svn branches are directories?

I find svn branches a bit confusing, because they feel like directories. You specify branches as part of the path to the directory, rather than separately, and it seems that, if a branch doesn’t exist explicitly, some directories don’t show up in trunk (the svn equivalent of SVN’s HEAD). This doesn’t seem useful.
For instance, in maemo, here’s the trunk branch:

But a new directory doesn’t appear there. It’s here instead:

And maemo’s non-trunk branches appear in some strange places, with the branch names in a different part of the path (e.g. haf/gtk+/somebranch/ instead of somebranch/haf/gtk+.):

Is this normal, or is maemo doing something it shouldn’t? When GNOME switches to svn we’ll need a version of GNOME’s great cvs instructions for svn.

8 thoughts on “svn branches are directories?

  1. Your SVN branches are perfectly OK if they contain the right stuff, and you know which stuff is where. Since branches should be fire-and-forget, it doesn’t matter how they’re named. It would help, though, if they resided in a single place, like /project/branches/… Also, if you pollute the project root with all kinds of folders, it’ll be hard to find stuff there using a SVN browser.

    I’m using /trunk, /branches, /people, and /vendor for all projects. /trunk is the trunk (of course) and both /branches and /people contain branches (copies in SVN vocabularity) for shared and personal stuff. /vendor is used for integrating third party software.

  2. svn branches feel like directories because they _are_ directories. Where you put them is completely up to you. There’s nothing special about the name ‘trunk’ or ‘branches’ or ‘tags’. They’re just used by convention to remember how things are organized. When you want to create a new branch, you just copy (svn cp) the current trunk directory to a new directory under ‘branches’ (or however the repository is arranged). So it’s really up to policy to determine how branches are created and used, so GNOME will need to institute some policies like this to prevent any confusion.

    Because ‘trunk’ is only a convention, it’s not exactly equivalent to CVS HEAD. You have to explicitly tell it to create the new directory in the ‘trunk’ heirarchy, otherwise it’ll get created exactly where you put it (i.e. at the same level as trunk).

  3. The usual layout for a SVN repository is along the lines of:


    with branches and tags in



    Granted, there is no real difference between a tag and a branch in SVN, it’s just a matter of organization and how you treat it.

    Just looking at the layout, a reasonable example is here:

  4. In addition to Jonner: you should look at SVN branches as directories-with-a-history.

    The main difference between SVN en CVS is exactly that moving or copying files and directories in SVN doesn’t lose the “history” of that file/directory.

Comments are closed.