Version Control System for LCGT

This page contains information for using version control system, subversion, for various LCGT tasks.

Introduction, why version control system ?

Version control system (VCS) is a computer tool to manage the history of various files you work on. Usually, files are documents or program codes, but you can use it for managing virtually any type of files. It keeps track of the changes you make to the files and let you roll back to any previous version if you want. The VCS is particularly useful when several people are working on a single set of files, for example, a group of people writing a paper, or several people developing a simulation code together. Subversion (svn) is a popular VCS and used by many projects around the world. There is an svn repository for LCGT. LCGT collaborators are strongly encouraged to use this svn repository for any applicable tasks.

For more detailed reasonings for the use of VCS, see here.

LCGT SVN quick start

See here.

Basic work flow of SVN

In the following, I will illustrate a sample usage of the LCGT SVN assuming you want to work on trunk/isc/IFOmodel/ directory.

Check out

The first thing you have to do is to check out files from the repository. This means copying files (usually the latest revision) in the server to your local computer.

To do so, change directory to any directory you want to create a local copy. Then run the following command,

svn co --username hogehoge https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/trunk/isc/IFOmodel

"hogehoge" is your user name for the LCGT svn. You will be asked to type in your password. Then many files will be copied over from the server to your computer.

You will find a directory named "IFOmodel" is created in the current directory. Go into the directory and look around.

Edit files and commit

You can edit files in the checked-out directory as usual, like using a text editor. Once you finish editing files, you have to commit the changes to the server so that the changes are reflected to the repository. To do so, run the following command in the IFOmodel directory.

svn co -m "Your comment"

"Your comment" is the comment for the commit. You have to explain the changes you made in the comment. If you omit -m option, a text editor will open and you are required to write comments. Never commit changes with a blank comment.

Adding, moving and removing files

It is very important to understand that any file operations, such as renaming/moving and deletion, in the local copy directory has to be done through the svn command. Otherwise, those operations will be ignored by the svn when you commit the changes.

To add a new file to the local copy, first create a file in the local copy directory. At this moment, this file is not managed by the svn. You have to run the following command to make svn recognize it.

svn add your_new_file_name

Don't forget to run the commit command to propagate the new file to the svn server.

To rename/move files, use svn mv. For example, to rename file A to B, do the following.

svn mv A B

To delete a file managed by svn, don't just delete it as you do usually. Make sure to use svn rm command like,

svn rm A