Previous Section  < Day Day Up >  Next Section

Recipe 18.17. Creating Release Snapshots with Tags

18.17.1 Problem

You need a way to mark a specific set of files as a set. They may be in different directories, or simply a subset of files in a directory. You can't just grab them by revision number, because the files belonging to a particular project can have all kinds of different revision numbers. And you want to be able to retrieve the selected files with a single command, instead of having to hunt them down individually.

18.17.2 Solution

CVS uses tags to collectively label a particular set of files. With a tag, you can easily retrieve all the revisions of all the files that correspond to a specific milestone, such as an official 1.0 release of a project.

All the files are linked by the tags, like pearls on a string, and can be retrieved with a single command. They do not have to be in the same directories; simply list the files you want tagged on the command line, as follows:

$ cvs tag rel_1.0_3dgame file1 file2 file2 file4

The easy way is to have all the files you want tagged sitting in your sandbox; then tag them this way:

$ cvs tag rel_1.0_3dgame

This will recurse directories and tag all of your checked-out files. To retrieve tagged files, yank the whole batch by tag name:

$ cvs checkout -r rel_1.0_3dgame

18.17.3 Discussion

Here's a bit of ASCII art to show how tags work. In this example, the files that belong to your upcoming 1.0 release are stored in several different places. They are marked with asterisks:

file1   file2   file3   file4

   

1.1     1.1     1.1     1.1

1.2     1.2     1.2     1.2

1.3     1.3*    1.3     1.3

1.4     1.4     1.4*    1.4

1.5*    1.5             1.5*

1.6                     1.6

This means you don't have to worry about creating perfect file trees to keep the files belonging to the release organized, which is pretty much impossible in any case.

18.17.4 See Also

    Previous Section  < Day Day Up >  Next Section