Differences between revisions 9 and 10
Revision 9 as of 2011-01-12 10:08:53
Size: 5371
Editor: YoichiAso
Comment:
Revision 10 as of 2011-01-12 10:21:16
Size: 6652
Editor: YoichiAso
Comment:
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
 * Create a ticket when you want to make a major change. Make sure to put the email addresses of the people who will should be notified of the change in the CC field.  * Create a ticket when you want to make a major change or find a problem. Make sure to put the email addresses of the people who will should be notified of the change or the problem in the CC field of the ticket properties.
Line 61: Line 61:

=== Branching ===
Line 74: Line 76:

=== Tagging ===
Tagging is technically identical to branching in SVN. However, it is useful to distinguish branching and tagging in human mind. Tagging is used when you want to store the current status of the source tree as a snapshot. For example, if you used the current version of IFOmodel to create plots for a presentation at an LCGT f2f meeting. Then you can tag the current revision as

{{{svn copy https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/trunk/isc/IFOmodel https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/tags/isc/IFOmodel-2011-2-f2f}}}

IFOmodel-2011-2-f2f is an exact copy of the current IFOmodel. You can actually use it as a branch of IFOmodel. But as a convention, you don't touch it. Then the status of IFOmodel-2011-2-f2f is preserved. If someone want to reproduce the plots for this f2f meeting later, he/she can check-out IFOmodel-2011-2-f2f and run the codes inside.

Tagging is a way to take snapshots of the code development. Because svn always keeps track of the changes, tagging is in principle not necessary (you can rollback to anytime you want). Nonetheless, it is convenient to give a human readable name to a snapshot, rather than a number, like revision 4821.

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.

LCGT SVN Policies

  • Feel free to use SVN. Don't be afraid of commit. You can always rollback your changes.
  • Always add comments when you commit changes.
  • Create a ticket when you want to make a major change or find a problem. Make sure to put the email addresses of the people who will should be notified of the change or the problem in the CC field of the ticket properties.
  • Create branch if you want to make large changes.

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

Branching and Tagging

Branching

If you want to make large changes to the source tree, it may take sometime. While you are making changes, other people will not want to work on the same source tree because they may interfere with your changes. This is a waste of other people's time. In order to avoid this problem, you can use branching capability of svn.

Branching is a way to make a copy of a source tree in a repository. For example, if you want to make a large modification of trunk/isc/IFOmodel, you can create a copy of trunk/isc/IFOmodel to branches/isc/IFOmodel by the following command.

svn copy https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/trunk/isc/IFOmodel https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/branches/isc/myIFOmodel

Before issuing the above command, you have to make sure that branches/isc/ exist. If not, run the following command first,

svn mkdir --parents https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/branches/isc

After making a copy in the branches directory, you can checkout myIFOmodel and start making changes. Since myIFOmodel is a copy of the original, you can experiment with it as much as you want without interfering with other people working on the original IFOmodel.

Once you are done with your changes with myIFOmodel, you can merge your changes back to the original IFOmodel using svn merge command. Of course merging may not work right away because your changes to myIFOmodel may be incompatible with the current revision of IFOmodel. Here, manual human intervention is necessary to resolve conflicts.

Tagging

Tagging is technically identical to branching in SVN. However, it is useful to distinguish branching and tagging in human mind. Tagging is used when you want to store the current status of the source tree as a snapshot. For example, if you used the current version of IFOmodel to create plots for a presentation at an LCGT f2f meeting. Then you can tag the current revision as

svn copy https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/trunk/isc/IFOmodel https://granite.phys.s.u-tokyo.ac.jp/svn/LCGT/tags/isc/IFOmodel-2011-2-f2f

IFOmodel-2011-2-f2f is an exact copy of the current IFOmodel. You can actually use it as a branch of IFOmodel. But as a convention, you don't touch it. Then the status of IFOmodel-2011-2-f2f is preserved. If someone want to reproduce the plots for this f2f meeting later, he/she can check-out IFOmodel-2011-2-f2f and run the codes inside.

Tagging is a way to take snapshots of the code development. Because svn always keeps track of the changes, tagging is in principle not necessary (you can rollback to anytime you want). Nonetheless, it is convenient to give a human readable name to a snapshot, rather than a number, like revision 4821.

LCGT/SVN (last edited 2021-06-03 12:14:16 by Ken-ichi Oohara)