14.1. Conceptual Overview

 < Day Day Up > 

The basic concepts for source code management systems were presented earlier in Chapter 12. As described there, CVS is a distributed source code management system based on the "copy, modify, merge" model. It uses RCS format files for storing data in its repository and is currently the most popular source code management suite for Unix and Unix-like systems.

Table 14-1 is a quick-start guide to using CVS. You would use the commands in the order shown to create and start using a CVS repository. (The basic steps for the Subversion source code management system are shown in more detail in the section "Using Subversion: A Quick Tour" in Chapter 15. Using CVS is similar.)

Table 14-1. CVS commands quick-start guide

Command

Purpose

mkdir /path/to/repos

Make the repository directory.

cvs init /path/to/repos

Initialize the repository.

cvs import ...

Import the initial version of a project into the repository.

cvs checkout ...

Create a sandbox.

cvs diff ...

Compare the sandbox to the repository, or different versions in the repository.

cvs status

Check if files have changed in the sandbox or the repository.

cvs update

Download changes from the repository to the sandbox.

cvs commit

Upload changes from the sandbox to the repository.


14.1.1. CVS Wrappers

When resolving conflicts, the usual method CVS uses is MERGE, which means that CVS puts both versions of the conflicting group of lines into the file, surrounded by special markers. However, this method doesn't work for binary files. Thus the second conflict-resolution method is COPY, which presents both versions of the file to the user for manual resolution.

You can manually specify the conflict resolution method and keyword expansion method when a file is added to a repository, as well as later, after the file is already there. However, doing so manually for lots of files is painful and error-prone. Wrappers allow you to specify the conflict resolution method and keyword expansion method for groups of files, based on filename patterns. You may do this on the command line, or more conveniently, by placing the wrappers into a .cvswrappers file. Each line has the following format:

     wildcard option 'value' [option 'value' ...]

The wildcard is a shell-style wildcard pattern. If option is -m, it indicates the conflict resolution method. In this case, value should be either MERGE or COPY. If option is -k, then value is one of the keyword resolution modes (b, k, o, etc.).

14.1.2. Stickiness

When some aspect of the persistent state of a file in a sandbox is different from that of the file in the repository, that aspect is said to be sticky. For example, when a file is retrieved based on a specific date, tag, or revision, those attributes are sticky. Similarly, when a file in a sandbox belongs to a branch, the branch is said to be sticky, and if the keyword expansion mode is set on a file, that mode is also sticky. Entire directories may be marked as sticky, not just individual files.

These attributes are termed "sticky" because the state of the file becomes persistent. In particular, a cvs update does not update such files to the latest revision in the repository. Similarly, you cannot use cvs commit to make such a file become the head of a branch or the trunk in the repository. Finally, when a file is on a sticky branch, it can only be committed on that branch. cvs status shows the stickiness of various attributes.

This all makes sense: work on a branch should be done only on that branch. When work on the branch is finished, the branch's changes should be merged into the files on the trunk, instead of checking the files into the head of the trunk directly.

Stickiness is created or changed using the -D, -k or -r options to cvs checkout and cvs update. Use cvs update -A to remove stickiness. You must use this command on a sticky directory directly; applying it just to all the contained files in the directory is not enough.

See Chapter 4 in Essential CVS for more details.

     < Day Day Up > 


    Unix in a Nutshell
    Unix in a Nutshell, Fourth Edition
    ISBN: 0596100299
    EAN: 2147483647
    Year: 2005
    Pages: 201

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net