|Version Management with CVS - the CVS manual|
by Per Cederqvist et al.
Paperback (6"x9"), 216 pages, 8 figures
RRP £19.95 ($29.95)
5.3 Accessing branches
You can retrieve a branch in one of two ways: by checking it out fresh from the repository, or by switching an existing working copy over to the branch.
To check out a branch from the repository, invoke ‘checkout’ with the ‘-r’ flag, followed by the tag name of the branch:
$ cvs checkout -r rel-1-0-patches tc
Or, if you already have a working copy, you can switch it to a given branch with ‘update -r’:
$ cvs update -r rel-1-0-patches tc
$ cd tc $ cvs update -r rel-1-0-patches
It does not matter if the working copy was originally on the main trunk or on some other branch--the above command will switch it to the named branch. And similarly to a regular ‘update’ command, ‘update -r’ merges any changes you have made, notifying you of conflicts where they occur.
Once you have a working copy tied to a particular branch, it remains there until you tell it otherwise. This means that changes checked in from the working copy will add new revisions on that branch, while leaving the main trunk and other branches unaffected.
To find out what branch a working copy is on, you can use the ‘status’ command. In its output, look for the field named ‘Sticky tag’ (see section 4.9 Sticky tags) ---that's CVS's way of telling you the branch, if any, of the current working files:
$ cvs status -v driver.c backend.c ========================================================= File: driver.c Status: Up-to-date Version: 1.7 Sat Dec 5 18:25:54 1992 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v Sticky Tag: rel-1-0-patches (branch: 1.7.2) Sticky Date: (none) Sticky Options: (none) Existing Tags: rel-1-0-patches (branch: 1.7.2) rel-1-0 (revision: 1.7) ========================================================= File: backend.c Status: Up-to-date Version: 1.4 Tue Dec 1 14:39:01 1992 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v Sticky Tag: rel-1-0-patches (branch: 1.4.2) Sticky Date: (none) Sticky Options: (none) Existing Tags: rel-1-0-patches (branch: 1.4.2) rel-1-0 (revision: 1.4) rel-0-4 (revision: 1.4)
Don't be confused by the fact that the branch numbers for each file are different (‘1.7.2’ and ‘1.4.2’ respectively). The branch tag is the same, ‘rel-1-0-patches’, and the files are indeed on the same branch. The numbers simply reflect the point in each file's revision history at which the branch was made. In the above example, one can deduce that ‘driver.c’ had been through more changes than ‘backend.c’ before this branch was created.
The next section describes how branch numbers are constructed.
|ISBN 0954161718||Version Management with CVS - the CVS manual||See the print edition|