14.4. CVS User ReferenceThis section provides details on connecting to a repository, the structure of sandboxes, and using the CVS commands. 14.4.1. Repository LocatorsCVS currently supports five methods for the client to access the repository: local, external, a password server, a GSS-API (Generic Security Services API) server, and a Kerberos 4 server (most Kerberos users will want to use GSS-API). Table 14-12 describes the various repository locator types and their respective access methods. Table 14-12. Repository Access Types and Methods
14.4.2. Configuring CVSCVS's behavior can be influenced by two classes of settings other than the command-line arguments: the environment variables (see Table 14-13) and special files (see Table 14-14). Table 14-13. Environment Variables
Despite the similarity in names, the $CVSROOT environment variable and the CVSROOT directory in a repository are not related to each other. The "RSH" in the name of the $CVS_RSH environment variable doesn't refer to the particular program (rsh), but rather to the program CVS is supposed to use for creating remote shell connections (which could be some program other than rsh, such as ssh). Since there is only one way to specify the remote shell program to use ($CVS_RSH), and since this is a global setting, users that commonly access multiple repositories may need to pay close attention to which repository they are using. If one repository requires one setting of this variable and another requires a different setting, then you will have to change this variable between accesses to repositories requiring different settings. This aspect of the repository access method is not stored in the CVS/Root file in the sandbox (see Section 14.4.4.3, "CVS directories", later in this chapter). For example, if you access some repositories via rsh and some via ssh, then you can create the following two utility aliases (bash syntax): user@localhost$ alias cvs="export CVS_RSH=ssh; cvs" user@localhost$ alias cvr="export CVS_RSH=rsh; cvs" Table 14-14 shows the files used by the CVS command-line client for server connection and client configuration information. These files reside in the user's home directory. Table 14-14. Client Configuration Files
The ~/.cvspass file is really an operational file, not a configuration file. It is used by the cvs client program to store the repository user account password between cvs login and cvs logoff. Some common .cvsrc settings are:
14.4.3. Creating a SandboxIn order to use CVS, you must create a sandbox or have one created for you. This section describes sandbox creation, assuming there is already a module in the repository you want to work with. See Section 14.4.7.11, "import" for information on importing a new module into the repository.
For example: export CVSROOT=/usr/local/cvsroot cd ~/work cvs checkout hello 14.4.4. Sandbox StructureThis section describes the files and directories that may be encountered in sandboxes. 14.4.4.1. .cvsignore filesSandboxes may contain .cvsignore files. These files specify filename patterns for files that may exist in the sandbox but which normally won't be checked into CVS. This is commonly used to cause CVS to bypass derived files. 14.4.4.2. .cvswrappers filesSandboxes may contain .cvswrappers files, which provide directory-specific file handling information like that in the repository configuration file cvswrappers (see Section 14.3.3.6, "The cvswrappers file", earlier in this chapter). 14.4.4.3. CVS directoriesEach directory in a sandbox contains a CVS directory. The files in this directory (see Table 14-15) contain metadata used by CVS to locate the repository and track which file versions have been copied into the sandbox. Table 14-15. Files in the CVS Directories
Since each sandbox directory has one CVS/Root file, a sandbox directory corresponds to exactly one repository. You cannot check out some files from one repository and some from another into a single sandbox directory. 14.4.5. Client Global OptionsTable 14-16 lists the global options that control the operation of the CVS client program. Table 14-16. Client Global Options
14.4.6. Common Client OptionsTable 14-17 and Table 14-18 describe the options that are common to many CVS commands. Table 14-17 lists the common options with a description of their function, while Table 14-18 lists which options can be used with the user commands. In the sections that follow, details will be provided only for options that are not listed here and for those that do not function as described here. Table 14-17. Common Options
Table 14-18 shows which common options are applicable to each user command. Table 14-18. Client Common Option Applicability
14.4.6.1. Date formatsCVS can understand dates in a wide variety of formats, including:
14.4.6.2. Keyword substitutionsTable 14-19 describes the keyword substitution modes that can be selected with the -k option. CVS uses keyword substitutions to insert revision information into files when they are checked out or updated. Table 14-19. Keyword Substitution Modes
Keyword substitution fields are strings of the form $Keyword ...$. The valid keywords are:
14.4.7. User CommandsThe CVS client program provides the user commands defined in Table 14-20. Table 14-20. User Commands
14.4.7.1. addadd [ -k kflag ] [ -m message ] file ... Indicate that files/directories should be added to the repository. They are not actually added until they are committed via cvs commit. This command is also used to resurrect files that have been deleted with cvs remove. The standard meaning of the common client option -k applies. There is only one additional option that can be used with the add command: -m message. This option is used to provide a description of the file (which appears in the output of the log command). 14.4.7.2. annotateannotate [ [ -D date | -r rev ] -f ] [ -l | -R ] file ... CVS prints a report showing each line of the specified file. Each line is prefixed by information about the most recent change to the line, including the revision number, the user, and the date. If no revision is specified, then the head of the trunk is used. The standard meanings of the common client options -D, -f, -l, -r, and -R apply. 14.4.7.3. checkoutcheckout [ -A ] [ -c | -s ] [ -d dir [ -N ] ] [ [ -D date | -r rev ] -f ] [ -j rev1 [ -j rev2 ] ] [ -k kflag ] [ -l | -R ] [ -n ] [ -p ] [ -P ] module ... Copy files from the repository to the sandbox. The standard meanings of the common client options -D, -f, -k, -l, -r, and -R apply. Additional options are listed in Table 14-21. Table 14-21. Checkout Options
14.4.7.4. commitcommit [ -f | [ -l | -R ] ] [ -F file | -m message ] [ -n ] [ -r revision ] [ files ... ] Commit the changes made to files in the sandbox to the repository. The standard meanings of the common client options -l, -n, -r, and -R apply. Additional options are listed in Table 14-22. Table 14-22. commit Options
Use of the -r option causes the revision to be sticky, requiring the use of admin -A to continue to use the sandbox. 14.4.7.5. diffdiff [ -k kflag ] [ -l | -R ] [ format ] [ [ -r rev1 | -D date1 ] [ -r rev2 | -D date2 ] ] [ file ... ] The diff command compares two versions of a file and displays the differences in a format determined by the options. By default, the sandbox version of the file will be compared to the repository version it was originally copied from. The standard meanings of the common client options -D, -k, -l, -r, and -R apply. All options for the diff command in Chapter 3, "Linux Commands" can also be used. 14.4.7.6. editedit [ -a action ] [ -l | -R ] [ file ... ] The edit command is used in conjunction with watch to permit a more coordinated (serialized) development process. It makes the file writable and sends out an advisory to any users who have requested them. A temporary watch is established and will be removed automatically when either the unedit or the commit command is issued. The standard meanings of the common client options -l and -R apply. There is only one additional option that can be used with the edit command: -a actions. This option is used to specify the actions to watch. The legal values for actions are described in the entry for the watch command. 14.4.7.7. editorseditors [ -l | -R ] [ file ... ] Display a list of users working on the files specified. This is determined by checking which users have run the edit command on those files. If the edit command has not been used, no results will be displayed. The standard meanings of the common client options -l and -R apply. See also the later section on watch. 14.4.7.8. exportexport [ -d dir [ -N ] ] [ -D date | -r rev ] [ -f ] [ -k kflag ] [ -l | -R ] [ -n ] [ -P ] module ... Export files from the repository, much like the checkout command, except that the result is not a sandbox (i.e., CVS subdirectories are not created). This can be used to prepare a directory for distribution. For example: user@localhost$ cvs export -r foo-1_0 -d foo-1.0 foo user@localhost$ tar czf foo-1.0.tar.gz foo-1.0 The standard meanings of the common client options -D, -f, -k, -l, -n, -r, and -R apply. Additional options are listed in Table 14-23. Table 14-23. export Options
When checking out a single file located one or more directories down in a module's directory structure, the -N option can be used with -d to prevent the creation of intermediate directories. 14.4.7.10. historyhistory [ -a | -u user ] [ -b string ] [ -c ] [ -D date ] [ -e | -x type ] [ -f file | -m module | -n module | -p repository ]... [ -l ] [ -o ] [ -r rev ] [ -t tag ] [ -T ] [ -w ] [ -z zone ] [ file ... ] Display historical information. To use the history command, you must first set up the history file in the repository. See Section 14.3.3, "Repository Structure" for more information on this file.
The standard meanings of the common client options -D, and -r apply. History is reported for activity subsequent to the date or revision indicated. Additional options are listed in Table 14-24. Table 14-24. history Options
The -p option should limit the history report to entries for the directory or directories (if multiple -p options are specified) given, but as of Version 1.10.8, it doesn't seem to affect the output. For example, to report history for the CVSROOT and hello modules, run the command: cvs history -p CVSROOT -p hello Using -t is faster than using -r because it only needs to search through the history file, not all of the RCS files. The record types shown in Table 14-25 are generated by update commands. Table 14-25. Update-Related history Record Types
The record types shown in Table 14-26 are generated by commit commands: Table 14-26. Commit-Related history Record Types
Each of the record types shown in Table 14-27 is generated by a different command. Table 14-27. Other history Record Types
14.4.7.11. importimport [ -b branch ] [ -d ] [ -I pattern ] [ -k kflag ] [ -m message ] [ -W spec ] module vendor_tag release_tag ... Import an entire directory into the repository as a new module. Used to incorporate code from outside sources or other code that was initially created outside the control of the CVS repository. More than one release_tag may be specified, in which case multiple symbolic tags will be created for the initial revision. The standard meaning of the common client option -k applies. Additional options are listed in Table 14-28. Table 14-28. import Options
The -k setting will apply only to those files imported during this execution of the command. The keyword substitution modes of files already in the repository are not modified. When used with -W, the spec variable is in the same format as entries in the cvswrappers administrative file (see Section 14.3.3.6, "The cvswrappers file"). Table 14-29 describes the status codes displayed by the import command. Table 14-29. import Status Codes
14.4.7.12. loglog [ -b ] [ -d dates ] [ -h ] [ -N ] [ -rrevisions ] [ -R ] [ -s state ] [ -t ] [ -wlogins ] [ file ... ] Print an activity log for the files. The standard meaning of the common client option -l applies. Additional options are listed in Table 14-30. Table 14-30. log Options
For -d, use the date specifications in Table 14-31. Multiple specifications separated by semicolons may be provided. Table 14-31. log Date Range Specifications
For -r, use the revision specifications in Table 14-32. Table 14-32. log Revision Specifications
For rev1:rev2, it is an error if the revisions are not on the same branch. 14.4.7.13. loginlogin This command is used to log in to remote repositories. The password entered will be cached in the ~/.cvspass file, since a connection to the server is not maintained across invocations. 14.4.7.14. logoutlogout This command logs out of a remote repository. The password cached in the ~/.cvspass file will be deleted. 14.4.7.15. rdiffrdiff [ -c | -s | -u ] [ { { -D date1 | -r rev1 } [ -D date2 | -r rev2 ] } | -t ] [ -f ] [ -l | -R ] [-V vn] file ... The rdiff command creates a patch file that can be used to convert a directory containing one release into a different release. The standard meanings of the common client options -D, -f, -l, -r, and -R apply. Additional options are listed in Table 14-33. Table 14-33. rdiff Options
14.4.7.16. releaserelease [ -d ] directory ... Sandboxes can be abandoned or deleted without using cvs release if desired; using the release command will log an entry to the history file (if this mechanism is configured) about the sandbox being destroyed. In addition, it will check the disposition (recursively) of each of the sandbox files before deleting anything. This can help prevent destroying work that has not yet been committed. There is only one option that can be used with the release command, -d. The -d option will delete the sandbox copy if no uncommitted changes are present.
The status codes listed in Table 14-34 are used to describe the disposition of each file encountered in the repository and the sandbox. Table 14-34. release Status Codes.
14.4.7.17. removeremove [ -f ] [ -l | -R ] [ file ... ] Indicate that files should be removed from the repository. The files will not actually be removed until they are committed. Use cvs add to resurrect files that have been removed if you change your mind later. The standard meanings of the common client options -l and -R apply. Only one other option may be used with the remove command, -f. When used, -f will delete the file from the sandbox first. 14.4.7.18. rtagrtag [ -a ] [ -b ] [ -d ] [ -D date | -r rev ] [ -f ] [ -F ] [ -l | - R ] [ -n ] tag file ... Assign a tag to a particular revision of a set of files. If the file already uses the tag for a different revision, cvs rtag will complain unless the -F option is used. This command does not refer to the sandbox file revisions (use cvs tag for that), so it can be run outside of a sandbox, if desired. The standard meanings of the common client options -D, -f, -l, -r, and -R apply. Additional options are listed in Table 14-35. Table 14-35. rtag Options
14.4.7.19. statusstatus [ -l | -R ] [ -v ] [ file ... ] Display the status of the files. The standard meanings of the common client options -l and -R apply. The other option that can be used with the status command, -v, may be used to include tag information. 14.4.7.20. tagtag [ -b ] [ -c ] [ -d ] [ -D date | -r rev ] [ -f ] [ -F ] [ -l | R ] tag [ file ... ] Assign a tag to the sandbox revisions of a set of files. You can use the status -v command to list the existing tags for a file. The tag must start with a letter and must consist entirely of letters, numbers, dashes (-) and underscores (_). Therefore, while you might want to tag your hello project with 1.0 when you release Version 1.0, you'll need to tag it with something like hello-1_0 instead. The standard meanings of the common client options -D, -f, -l, -r, and -R apply. Additional options are listed in Table 14-36. Table 14-36. tag Options
Since the -d option throws away information that might be important, it is recommended that you use it only when absolutely necessary. It is usually better to create a different tag with a similar name. 14.4.7.21. uneditunedit [ -l | -R ] [ file ... ] Abandon file modifications and make the file read-only again. Watchers will be notified. The standard meanings of the common client options -l and -R apply. 14.4.7.22. updateupdate [ -A ] [ -d ] [ -D date | -r rev ] [ -f ] [ -I pattern ] [ -j rev1 [ -j rev2 ] ] [ -k kflag ] [ -l | -R ] [ -p ] [ -P ] [ -W spec ] [ file ... ] Update the sandbox, merging in any changes from the repository. For example: cvs -n -q update -AdP can be used to do a quick status check of the current sandbox versus the head of the trunk of development. The standard meanings of the common client options -D, -f, -k, -l, -r, and -R apply. Additional options are listed in Table 14-37. Table 14-37. update Options
Using -D or -r results in sticky dates or tags, respectively, on the affected files (using -p along with these prevents stickiness). Use -A to reset any sticky tags or dates. If two -j specifications are made, the differences between them are computed and applied to the current file. If only one is given, then the common ancestor of the sandbox revision and the specified revision is used as a basis for computing differences to be merged. For example, suppose a project has an experimental branch, and important changes to the file foo.c were introduced between revisions 1.2.2.1 and 1.2.2.2. Once those changes have proven stable, you want them reflected in the main line of development. From a sandbox with the head revisions checked out, we run: user@localhost$ cvs update -j 1.2.2.1 -j 1.2.2.2 foo.c CVS finds the differences between the two revisions and applies those differences to the file in our sandbox. The spec used with -W is in the same format as entries in the cvswrappers administrative file (see Section 14.3.3.6, "The cvswrappers file"). The status codes listed in Table 14-38 are used to describe the action taken on each file encountered in the repository and the sandbox. Table 14-38. update Status Codes
14.4.7.23. watchwatch { { on | off } | { add | remove } [ -a action ] } [ -l | -R ] file ... The watch command controls CVS's edit-tracking mechanism. By default, CVS operates in its concurrent development mode, allowing any user to edit any file at any time. CVS includes this watch mechanism to support developers who would rather be notified of edits made by others proactively than discover them when doing an update. The CVSROOT/notify file determines how notifications are performed. Table 14-39 shows the watch sub-commands and their uses. Table 14-39. watch Sub-commands
The standard meanings of the common client options -l and -R apply. The only other option that can be used with the watch command is -a action. The -a option is used in conjunction with one of the actions listed in Table 14-40. Table 14-40. watch Actions
See also the descriptions of the edit, editors, unedit, and watchers commands. 14.4.7.24. watcherswatchers [ -l | -R ] [ file ... ] Display a list of users watching the specified files. This is determined by checking which users have run the watch command on a particular file (or set of files). If the watch command has not been used, no results will be displayed. The standard meanings of the common client options -l and -R apply. Copyright © 2001 O'Reilly & Associates. All rights reserved. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|