MIT Information Systems

Macintosh Development

[Home] [About Us] [People] [Information Systems]
[Kerberos for Macintosh] [Applications] [Miscellaneous Documentation]


More Working With CVS

A guide to advanced CVS commands

by Miro Jurisic

Symbolic tags and branches

Confusingly, CVS uses the tag command for version tags and branch tags, although their behavior is significantly different. This is mostly convinient, but sometimes confusing, and may take some getting used to.


Tag

The tag command manipulates version tags and branch tags. You can use the command to create new tags and delete old tags, but you should be absolutely certain that you know what you are doing before you delete a tag. Deleting a tag removes information that is extremely diffucult, if not impossible, to recover later.

Tag options

-l
Do not recurse into subdirectories
-b
Make the tag a branch tag
-c
Check that all files are unmodified before tagging them
-d
Delete a tag

Tag examples

It is a good idea to always use the -c option with tag, to make sure that you don't accidentally tag a wrong version of a file.

Tag with tag SillyBalls_1_0a1:

cvs tag -c SillyBalls_1_0a1

Start a new branch with tag SillyBalls_1_1_Exp:

cvs tag -c -b SillyBalls_1_1_Exp
cvs update -r SillyBalls_1_1_Exp

It is important that you run update when you are starting a new branch, because otherwise files that you add after creating the branch will be added on the trunk, not on your branch.

Examples for merging changes between branches are among update examples.


Import

The import command is to import sources into the repository, for creating new projects or tracking third-party sources.

Import options

-m message
Log message
-I files
Files to be ignored. This option can be repeated.
-W wrappers
Additional wrappers to be used when importing files. See examples below for an explanation of this option. This option can be repeated.

Import examples

You can use the -I option to ignore some files. By default, CVS will ignore all files specified in CVSROOT/cvsignore. When using import, you probably don't want to ignore any files, so you should use -I ! to specify no files should be ignored:

cvs import -m "Import from sources" -I ! "mit/appl/MacMoira" meeroh start

If there are files you want to ignore, you can specify their filenames with the -I option. To ignore no files except for IgnoreMe.c:

cvs import -m "Import from sources" -I ! -I IgnoreMe.c "mit/appl/MacMoira" meeroh start

In -I filename specifications, ? matches any signle character and * matches any (possibly empty) character string.

The -W option is most commonly used in import to specify that some files should be treated as binary. By default, files specified in CVSROOT/cvswrappers with -k 'b' option will be treated as binary. If you want to specify additional binary files, you need to use -W inside import. For example, to treat all .o and .gif files as binary:

cvs import -m "Import from sources" -I ! -W "*.o -k 'b'" -W "*.gif -k 'b'" mit/appl/MacMoira meeroh start

In this example, -I ! is used because CVS defaults to ignoring .o files. Like with -I, ? and * match any single character and any string, respectively.

Tracking third-party sources

When tracking third party sources, you must use always use the same vendor tag and a different release tag for a particular set of sources. Importing Internet Config 1.1 sources to "third/Internet Config" with Internet_Config vendor tag and Internet_Config_1_1 release tag would be done like this:

cvs import -m "Imported from 1.1 sources" "third/Internet Config" Internet_Config Internet_Config_1_1

Later, you might want to import Internet Config 2.0 sources:

cvs import -m "Imported from 2.0 sources" "third/Internet COnfig" Internet_Config Internet_Config_2_0

If import reports any conflicts, modifications have been made to sources since the previous import, and you will have to merge those changes into the newly imported sources:

cvs update -j Internet_Config_2_0

It's important to notice that the import commands should be run on the new sources, but the update command should be run on your working files. After you resolve the possible conflicts, you can commit the merged sources.

Using import to start a project

Import can be used to start a new project. In this case, the vendor and release tags are not important. It's common to use "start" as the release tag and your username as the vendor tag. For example, importing MacMoira sources into mit/applt/MacMoira:

cvs import -m "Importing from CodeWarrior Pro 1 sources" mit/appl/MacMoira meeroh start


Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/18 21:58:42 $
Last modified by $Author: smcguire $