Quick one-liner to set up a new SVN project with a trunk, branches and tags

When creating a new project in SVN one┬árecognised┬ástandard is to set up a trunk, branches, and tags directory structure. Where I’m working at the moment, we also have a release directory placed under tags and branches. Which I’ve also started to do on some of my other projects out side of work as well (those that are under SVN anyway)

I posted about brace expansion and svn early last year, and I’ve since found a quick one-liner to set up a new project in SVN using it. The command looks a litte like this:

bash$ svn mkdir [project path]{/trunk,{,{/branches,/tags}{,/releases}}}

This is the same as running the command:

bash$ svn mkdir [project path] [project path]/trunk [project path]/branches [project path]/branches/releases [project path]/tags [project path]/tags/releases

Both do the same thing and after executing will load up your chosen svn editor, which in my case is vim, but that was easy to guess if you’ve read at the rest of my blog.

If you’ve done it correctly then the editor should look something like this, pre commit:

New project setup with one-liner command...

--This line, and those below, will be ignored--

A svn://subversion-server/project-name
A svn://subversion-server/project-name/branches
A svn://subversion-server/project-name/branches/releases
A svn://subversion-server/project-name/tags
A svn://subversion-server/project-name/tags/releases
A svn://subversion-server/project-name/trunk

Leave a Reply

Your email address will not be published. Required fields are marked *