home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

  Previous section   Next section

4.2 Stickiness

Stickiness is an important concept in CVS, especially when talking about tagging and branching. Stickiness is primarily internal to CVS, but it affects what can be done in a sandbox.

When a file in a sandbox has a persistent state that is not the default state in the repository, the persistent state is said to be sticky. A sandbox copy of a file can be set to a specific revision, belong to a branch, or have specific keyword options. Any of these things can cause a file to be sticky.

A file can be set to a specific revision by being retrieved from the repository with a tag, revision number, or date. If the file is retrieved with a date, it is said to have a sticky date. If it is retrieved with a tag, it is said to have a sticky tag, and if it is retrieved with a revision number, it is said to have a sticky revision.

Along the same lines, a sandbox file that belongs to a branch is said to have a sticky branch, and a sandbox file with sandbox-specific keywords has sticky keywords.

A sticky state applies to all commands run on the file. A file with a sticky date, revision, or nonbranch tag will not be updated to a more recent copy; nor can such files be committed. A file with a sticky branch is always committed to or updated from the branch in question.

Sticky states on a file can be viewed with cvs status. For example, use the command cvs status index.htm to see the status for the index.htm file. Example 4-8 shows a cvs status report that lists a sticky branch.

Example 4-8. Viewing a sticky file
bash-2.05a$ cvs status main.c
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
File: main.c                Status: Up-to-date
   
   Working revision:     1.9
   Repository revision:  1.9     /var/lib/cvs/wizzard/src/main.c,v
   Sticky Tag:           beta_0-1_branch (branch: 1.9.2)
   Sticky Date:          (none)
   Sticky Options:       (none)

Sandbox directories can also have sticky states, and a directory with a sticky state applies that state as the default to any file added to that directory. Sticky states in a directory can be seen in the Tag file in the CVS subdirectory of that directory. Example 4-9 shows a Tag file.

Example 4-9. Stickiness in the Tag file
bash-2.05a$ less CVS/Tag
Tbeta_0-1_branch

Stickiness is created or changed using the -k, -D, or -r options to cvs checkout or cvs update. It can be removed with cvs update -A, which retrieves the current HEAD revision from the trunk of the repository, resets the state to the default for the appropriate files, and clears any directory stickiness.

To clear stickiness from a directory, you must use cvs update -A on the directory. Using cvs update -A files, where files refers to a file or files, does not clear directory stickiness or affect other files in the directory.


  Previous section   Next section
Top