Using Branch in BaBar:

This page contains information about limited usage of CVS branches by BaBar.

16 Dec 1998

  • Introduction of using branches.
  • Basic steps to create branches.
  • Things to remember regarding branches.
  • The usage of sticky tags.

  •  
    

    Introduction of using branches

    General speaking, BaBar prefers using HEAD (main branch) to avoid complication introduced by secondary branches. Secondary Branch is discouraged with the following exception:

    There are times where we need to apply a subset of patches to a previous release so that previous release can benefit from the fix. As long as one does not intend to merge the patch back to the main branch (HEAD), branch tag is allowed. The main object is avoid merging changes back to the HEAD. The HEAD level should be always maintained in working condition.

     
    

    Basic step to create branches

       The procedure is:
    
            addpkg {pkg} {old}          	[check out package]
            cd {pkg}
        	cvs update -r {old}		[enter sticky tag level]
        	cvs tag -b B{old}           	[start a branch]
            cvs update -r B{old}            [leave sticky tag, enter the branch]
            cvs tag {old}-00            	[mark the start of branch]
            {add patch}			[from HEAD of a branch only]
        	cvs ci                  	[commit to branch]
            cvs tag {old}+1             	[tag version for release]
    
       For example:
    
            addpkg SoftRelTools V00-07-11	[check out old]
            cd SoftRelTools
        	cvs update -r V00-07-11		[enter sticky tag level]    
        	cvs tag -b BV00-07-11		[start a branch]
            cvs update -r BV00-07-11	[leave sticky tag, enter the branch]
            cvs tag V00-07-11-00		[mark the head of branch]
            {add patch}             	[from non-sticky tag level only]
            cvs ci                  	[commit to branch]
            cvs tag V00-07-11-01            [tag version for release]
    
    

     
    

    Things to remember regarding branches

        1. Both main branch (HEAD) and secondary branch (e.g. BV00-00-01)
           are floating tags. They always point to the newest files committed to a branch.
    
        2. To commit changes back, one must first update the folder to a
           branch. 'cvs update -A' updates a folder to main branch (HEAD),
           'cvs update -r<branchtag> updates a folder to a secondary branch.
    
    

     
    
    

    The usage of sticky tags (reference)

        cvs update -r {old}		[enter old tag level, sticky]
        more CVS/Tag            	[T{old}][a sticky tag]
        cvs tag -b B{old}       	[start a branch]
        cvs update -r B{old}	[enter the branch, non-sticky]
        more CVS/Tag                [TB{old}][branch tag, non-sticky]
        cvs tag {old}-00            [mark the head of branch]
        {add patch}          	[add patch to branch]
        cvs ci                	[commit to branch]
        cvs tag {old}+1         	[tag new version for particular purpose]
        more CVS/Tag             	[TB{old}][still in the branch level, non-sticky]
        cvs update -r {old}+1	[use sticky tag for special reason]
        more CVS/Tag                [T{old}+1][sticky tag]
    
    In sticky tag level, one cannot commit changes back. So one must update to HEAD (main branch) or other branch level first before making changes or before commit. There are two main usage of the sticky tag: 1) It is temporary used to start a branch. 2) It is used in a stable environment such as a release.
     
    Maintained by Terry Hung. Send suggestions and additions to 
    
    terryh@slac.stanford.edu, 650-926-3618