Advanced CVS commands used by BaBar
1 Mar 2001
Tagging a package in CVS can be tricky if the versions to be tagged are not all at HEAD. The following is an example:
cvs co <pkg> [or addpkg <pkg>]
cvs co -r <tag> <pkg> [or addpkg <pkg> <tag>]
cd <pkg> [go to folder]
cvs update -r <ver> <file1 ..> [adjust numeric version levels, e.g. 1.23]
cvs update -r <tag2> <file1 ..> [or adjust levels with symbolic tag, e.g. V00-00-01]
cvs tag <tag> [tag this level]
If you make changes to local checkout folder (edit, add, etc), besure to commit the changes back to CVS before making the tag.
If you need to make an extension to an old tag, do not jump to the CVS branch. Most of
the situation can be solved by simply adjusting the version level. The
easiest case is when the patch is based on HEAD, see the previous section
"How to tag a CVS package at level other than HEAD" for this.
If you need to make change to an older version and make a tag that includes this version, but do not want to leave this patch at the HEAD, it is a bit trickier:
cvs co -r <tag> <pkg> [get a specific tag level]
cd <pkg> [go to folder]
cvs update -A <file> [bring file to the HEAD level]
cvs update -jHEAD -j<tag> <file> [put old <tag> back temporarily]
edit <file> [edit this old version]
cvs commit <file> [commit this extension to HEAD]
keep the version number from the "previous revision: <ver>" in the commit message somewhere.
cvs tag <tag>-NN [tag with extension. e.g. V11-22-33-01]
cvs update -jHEAD -j<ver> <file> [put previous HEAD <ver> back]
cvs commit <file> [and commit it to HEAD]
If a file has been removed with 'cvs rm' command and thus was moved to Attic, the
best way to get it back is using the 'add' command:
more $CVSROOT/pkg/<file>,v [find latest numeric version <ver>]
cvs co -d /tmp/<pkg> -r <ver> <pkg>/<file> [get latest version of removed file from Attic]
cvs co <pkg> [check out package]
cd <pkg> [cd to the check-out folder]
ls <file> [make sure it does not exist]
cp /tmp/<pkg>/<file> . [copy the latest copy from /tmp]
cvs add <file> [add file back to HEAD]
cvs ci [commit this request]
cvs update -jV2 -jV1 [removed changes between two versions]
This will remove changes between version V1 and version V2. Note that version
V1 is a earlier version while version V2 is a later version. This command can
revert a file back to earlier version.
[Note]: it's best to specify the files:
cvs update -jV2 -jV1 files..
Otherwise new files created between these two versions by third-party can be deleted.
Maintained by Terry Hung. Send suggestions and additions to
terryh@slac.stanford.edu, 650-926-3618