Working with CVS branches

Working with CVS branches


Changelog:

  • 2015-03-17: Don't move update tags; use new tags for each update.

Introduction

These instructions cover current best practice on how to maintain CVS branches.

The following tag conventions are used:

Tag Purpose

branch-base

Branch point off head

branch-baseITERATION

ITERATION update from HEAD since branch-base. Different conventions exist for ITERATION, including incrementing serial number, or using a YYYYMMDD date.

The following shell variables are used:

Variable Purpose
${branch}
Branch name
${module}
CVS module
${old}
Old (previous) update/merge tag
${new}
New (current) update/merge tag

To create a branch

  1. Tag the set of sources you want to branch with a command like:

    cvs rtag -r HEAD ${branch}-base ${module}

    This tag represents the original branch point and will not be moved during the lifetime of the branch.

  2. Branch them with the command:

    cvs rtag -b -r ${branch}-base ${branch} ${module}

Update the branch to reflect changes in HEAD

  1. Update your working source tree to be on the branch:

    cvs update -P -r ${branch}

    (in your working source tree)

  2. Determine appropriate values for the variables containing the tag names used for syncing the branch. The existing tags for the branch can be determined with:

    cvs status -v somefile | grep ${branch}

    If this is the first update, use:

    ${old}
    ${branch}-base
    ${new}
    ${branch}-base1

    If this is a subsequent update, use:

    ${old}
    ${branch}-baseCURRENT
    ${new}
    ${branch}-baseNEXT

  3. Make a tag which represents the new base you're moving to:

    cvs rtag -F -r HEAD ${new} ${module}
  4. Merge changes between the old and new base of your branch:

    cvs update -j ${old} -j ${new}

    (in your working source tree)

  5. Merge conflicts, etc.

  6. Check in your changes (to the branch).