VIM The Editor

User Manual
LaTeX Reference

We are ...
Feature Requests
Bug Reports
Mailing List

Package files

GitHub Project
Sourceforge project

Site hosted by:
SourceForge Logo
Created with Vim

Branching Cheat Sheet

Branching Cheat Sheet

This is a pretty basic cheat sheet on how to create branches using CVS, which is what is used in the Latex-Suite project to maintain the code and collaborate between the developers. (I have developed a bad habit of saying "Developers! Developers! Developers!" whenever I want to say developers, wonder why?) This document is compiled from the following sources:

NOTE: Not all these steps are mandatory. They are just a good thing to do.

Branching in CVS is used when some major change is being planned which might destabilize the code. Branching enables you to work on a copy of the files till the code on that "branch" has been suitably stabilized, and then "merge" the changes in the branch back into the main trunk.

Branching essentially consists of four stages. In the first stage, you create the branch itself, i.e, you "tag" the files in some stage as the "root" of the "branch". You then "checkout" a copy of the files in the branch and work on that. After you are confident that you want the changes to be "merged" into the main trunk, you prepare both the branch and the trunk and then finally do the merging itself. These things have been explained in great detail here.

Creating a branch

  1. $ cd /path/to/trunk
    (This is where you have checked out the main trunk. Note, if you want to create branches off branches (not recommended), then you'll want to cd to where you have checked out the branch).
  2. $ cvs update
    (If this shows some errors for non-mergeable files, then you'll need to resolve the conflicts manually).
  3. $ cvs diff
    If this shows some diffs , then
    $ cvs commit
    (If this shows more errors for non-mergeable files, you'll also need to check for conflicts etc).
  4. $ cvs tag -b b-<branchname>
    (This is the branch name chosen)

Checking out a branch

$ cvs co -r b-<branchname> -d /path/to/branch <modulename>
The -d /path/to/branch argument specifies where the files in <modulename> will be checked out to on the local machine. It can be relative to the local directory, in which case use path/to/branch instead of /path/to/branch.

Preparing a branch for merging into trunk

  1. $ cd /path/to/branch
    (This is where you have checked out a copy of the branch).
  2. $ cvs update
    (If this step shows conflicts, then resolve and commit).
  3. $ cvs diff
    If this part shows some diffs, then
    $ cvs commit
    (Again, if this shows conflicts, resolve and commit).
  4. $ cvs tag b-<branchname>-<authorname>-merge-<mergenumber>
    (where <mergenumber> is the number of times you have merged from this branch to the trunk <authorname> is your name, preferably initials).

The final Merging Step

  1. $ cd /path/to/main/trunk
    This is where you have checked out a copy of the main trunk.
  2. $ cvs diff
    If there are locally modified copies of any files,
    $ cvs commit
  3. This step depends on whether or not a merge has been done previously from this branch or not.
    1. If this is the first time a merge is being done from this branch onto the main trunk
      $ cvs update -d -j b-<branchname>
      Here b-<branchname> is the branch name, not a revision name. This is the name with which the branch was created.
    2. If this is not the first merge from branch to main trunk
      $ cvs update -d -j b-<branchname>-<author>-merge-<mergenumber> -j b-<branchname>
      Note: the first tag refers to a revision tag name, whereas the the second revision is the branch tag.
©Vim-latexSuite Team 2002