CVS Tags amd Branches, a mini tutorial.

From: Maurik Holtrop (maurik@improv.unh.edu)
Date: Tue Oct 02 2001 - 15:00:51 EDT


Dear Blasters,

Responding to Tim's request for a quick overview of CVS tags, and I am
throwing in "CVS Branches" as a bonus.

Why Tag?

You "tag" a specific "release" of your software so that you can later
retreive the exact copy of the code as it existed when you tagged it.
Tags are more useful than using a specific date, for two reasons: 1. You
presumably tagged a working version, 2. A tag can be moved if a bug in
that version is discovered and fixed.

Why a Branch?

A "branch" in CVS is a separate development stream, usually with the
intention of merging the new code with the "trunk" later. (The "trunk"
is the main line in developing code, and is what you get when you check
out code with "cvs checkout BlastLib".) An example for checking in on a
brach: Tong writes great new software to find segments and stubs,
however the code does not yet compile on all platforms. Tim wants to
help Tong with fixing this problem so he needs a copy that he can modify
and submit back to Tong. Yet, you don't want this on the main trunk,
because then they would break the code for others. By checking in on a
branch they can exchange code through CVS (which means all the revisions
are backed up) and can merge the results into the trunk when it is
ready. Note that a brach is ALWAYS tagged (in this case, say,
"Tong-stubs")

CVS RESOURCES:

CVS MANUAL: http://improv.unh.edu/Maurik/cvs.pdf
                http://improv.unh.edu/Maurik/cvs.ps.gz

CVS Bubbles Info: http://www.loria.fr/~molli/cvs-index.html

How to tag:
============

(See the CVS Manual page 93)

When you have a copy of the code checked out, with the version exactly
the way you want it tagged, cd to that directory and issue the command:

cvs tag V0.1.0

Here "V0.1.0" is the tag name.
That's it! You can now checkout your tagged version with:

cvs checkout -r V0.1.0

Or if you want to update (or downdate) to V0.1.0 you can issue:

cvs update -r V0.1.0

Note that a tag is "sticky", which means that all subsequent CVS
operations assume you still want V0.1.0. When new code is submitted and
you do a "cvs update" on your tagged copy, you WONT get the updates. You
have to ask for the latest version instead with "cvs update -A"

How to create a branch:
========================

See also: http://improv.unh.edu/Maurik/CheckingInOnABranch.shtml
which lists 2 methods for this.

You have your code, you already modified it, it is not working yet, so
you decide to put it on a brach called "Tongs-stubs". You go to the
directory (cd there) and issue:

cvs tag -b Tongs-stubs
cvs update -r Tongs-stubs
cvs commit -m "This code is not working yet"

The part after the -m is a comment, pleas make it meaningful.
You are now working on your branch, and any code that you commit here
from now until the next "cvs update -A" will be put on your brach. To
merge the brach back onto the trunk, read the manual or email me, there
are too many possible complications.

Some things to be careful of: 1) Don't forget the update command!
Otherwise the next commit goes to the trunk. 2) If you added new files
you must add them to the trunk, so execute "cvs add myfile.cxx ..."
BEFORE the tag.

Cheers,

        Maurik



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST