Use of CVS Branches in GLAST Offline Software

Why Branch?

Branches provide an easy mechanism to apply software patches to a released version of a package, while allowing development to continue along the main trunk of that same package.  That way, users can obtain necessary patches, without also requiring they pick up other, potentially untested, updates.  

Potential Pitfalls

Changes along a branch are not applied to the main line of development.  This means, changes can be "lost" if they only exist on a branch.  Developers must be sure to merge changes from the branch back into the main trunk.  We will cover merging changes from a branch later on this page.

Branch Naming

CVS allows users to specify a  name for the branches they create.  GLAST Offline will name branches according to the tag of GlastRelease they are associated with, for example:

GlastRelease-v4r5

Note the use of the dash between the name of GlastRelease and the tag.

Creating a new Branch

Easy way without any working copy of the package:

cvs rtag -b -r v4r3 GlastRelease-v4r4 TkrRecon

That -b tells CVS to create the branch
We are branching off of the v4r3 tag of TkrRecon
and we create a branch name of GlastRelease-v4r4

One can also branch using a specific date or time.

Accessing the branch

The important thing to remember is that if you want to develop along the branch - you must first checkout the code from the branch.  Developers will desire to access the HEAD of a branch in order to make code update to the branch.  This can be via MRvcmt using the name of the branch as the tag:

Or using CVS directly, where again we use the branch name as the tag:

cvs co -r GlastRelease-v4r5 TkrRecon

An easy way to double-check that the branch was accessed successfully is to view the contents of the CVS directories in your package.  There would typically be a Tag file in there that should contain the name of the branch you think you have retrieved from CVS.

Branch Tag Naming Convention

The changes that occur along a branch must usually be tagged so that they can be used.  Tag names along a branch will take the following form:
[package tag]gr#  or [package tag]em#

For example, if a developer branched off of the v3r2 tag of TkrRecon, creating a branch named GlastRelease-v4r5.  Now we desire to apply the first tag along this branch, we would name it:
v3r2gr0
Where this means we have applied fixes based on the v3r2 tag of TkrRecon,  these changes are meant for GlastRelease and this is the first tag.  The next tag applied to this same branch would be named:
v3r2gr1
and so on..

Similarly if a branch tag is meant for EngineeringModel, we would tag it as:
v3r2em0

Release Manager and Tagging

This is what is currently implemented: the RM will skip tags for LATEST that do not follow the form of:
vN(rN)(pN)

In the near future, we do want RM to utilize tags applied along branches that are meant for GlastRelease.  It is requested that when performing a GlastRelease LATEST build, RM also check for tags of the form:
vIrJpKgr#

How to Tag on a Branch?

Using CVS directly:

cvs rtag -r GlastRelease-v4r5 v4r3gr0 TkrRecon

where GlastRelease-v4r5 is the name of the branch to apply the tag to.  This command will tag the head of the GlastRelase-v4r5 branch

OR

While working on a local copy of your package that is on a branch, you may use the CVS tag command by entering the package directory, such as:
cd TkrRecon/v4r3
cvs tag v4r3gr0

Merging a Branch back into the Main Trunk

Typically, patches that are applied along a branch will ultimately be merged into the main trunk of the package.  This is an easy thing to overlook and developers should make sure to keep track of the branches on their packages.  When developers are ready to merge their changes into the main trunk, they do the following:

References

Note from Traudl:
http://www-glast.stanford.edu/protected/mail/soft/2003/0160.html

https://www.cvshome.org/docs/manual/cvs-1.11.17/cvs_5.html#SEC54