4. Guidelines for committing to the repository

4.1 Add $Id$ to files

Subversion has an ability to substitute keyword into the contents of the file itself. A Keyword is a piece of useful and dynamic information about the file. All the keywords are case sensitive.

Adding a keyword $Id$ to each file will be useful. Its substituted looks like $Id: test.c 148 2005-11-14 21:30:43Z yamada$, which means that test.c was last changed in revision 148 on 2005-11-14 21:30:43 (in UTC) by the user yamada.

Simply adding keyword anchor text to your fill does nothing special. Subversion will never attempt to perform the substitution unless explicitly assigned like below:

  $ svn propset svn:keywords "Id" test.c

When you have made modification on "test.c" and commit to the repository, Subversion will perform the substitution.

4.2 Commit messages

When you perform svn commit to reflect your modifications on the repository, you may asked to type in some comments. It goes without saying that the comment should describe what and why you have modified the file.

Proposed are to commit your modification within a unit of modification. Committing a number of modifications which have no concern each other at one time makes it difficult when investigating how and why the file is modified.

All the modification logs should exist only in commit messages' database provided by Subversion. It is not only superfluous but also harmful to have modification logs in each file header (or footer). Modification logs included in each file will become a mess when the file is merged from a different branch due to its different history of modification.

4.3 Branching

Subversion have an ability to handle parallel lines of development that exist independently of another, yet still shares a common history if you look far enough back in time. The main line of the development is typically called trunk while pronged ones are called branches.

It is strongly recommended to keep the trunk compilable. Creating a branch allows to save half-broken work frequently without interfering with others. You can merge your modifications to the trunk when you have finished with your work.

Shown below are two major way to create a branch in Subversion. The first way is to create a copy of trunk to a new directory, your-name by simply passing two URLs to the svn copy command.

  $ svn copy file:///afs/psi.ch/project/meg/svn/meg/trunk \

Now you can work with your branch by checking out a new working copy to start using it:

  $ svn co file:///afs/psi.ch/project/meg/svn/meg/p_branches/your-name

The other way to create a branch is to switch your working copy. The svn switch command transforms an existing working copy in to a different branch.

  $ svn co file:///afs/psi.ch/project/meg/svn/meg/trunk/meg
  $ cd meg
  $ svn switch file:///afs/psi.ch/project/meg/svn/meg/p_branches/your-name

After switching to the branch, your working copy is no different than what you would get from doing a fresh checkout of the directory. Please refer
The Subversion Book for details about branching and merging.
Working with Subversion
Table of Contents