More Advice on CVS Branches

Addendum to Branch Management Advice

Stefan Monnier, 04/21/2000

It is pretty common to use

        foobar-branch-tag and foobar-banch-tag-root
instead of
        foobar-devel-tag and foobar-main-tag
there have been proposals on the CVS list to provide an automatic way to get the "root" with something like foobar-branch-tag.0 or foobar-branch-tag.ROOT or somesuch. Of course, nothing came of these, since CVS development is close enough to moribund.

The problem Matthias mentions when merging changes from the trunk to the branch can be solved in the following way [Note: I assume that the user has put `update -dP' in his ~/.cvsrc file.]:

  1. Update the trunk and tag the "new root":
            cd ~/ML/MainTrunk/smlnj
            cvs update
            cvs tag joe-tmp
    
  2. Merge changes between old root and new root:
            cd ~/ML/smlnj
            cvs update -j joe_main_v110p27p4_2 -j joe-tmp
    
  3. Move the root:
            cvs rtag -d joe_main_v110p27p4_2
            cvs tag -r joe-tmp joe_main_v110p27p4_2
            cvs tag -d joe-tmp
    
Note that instead of using `cvs rtag -d' and `cvs tag' I could just use `cvs tag -F', except that it would not remove the tag on files that were removed between the two points.

The advantage of moving the root tag like this instead of creating a new branch is that it requires fewer steps and that it doesn't pollute RCS files nearly as much (do a `cvs log' on a few files in the current directory and you'll see the impressive number of tags compared to the fairly short age of the repository). Also it saves you from coming up with yet-another-name.

Funnily enough, this technique relies on an explicit "root tag": an automatic foobar-branch-tag.ROOT would not cut the mustard.


Earlier Advice on Branches

CVS has many quirks which lead to several "Commandments" to help you avoid them. Among those are the following two: