]> CVS—Concurrent Versions System v1.11.22 CVS—Concurrent Versions System v1.11.22 This info manual describes how to use and administer cvs version 1.11.22. Overview Overview This chapter is for people who have never used cvs, and perhaps have never used version control software before. If you are already familiar with cvs and are just trying to learn a particular feature or remember a certain command, you can probably skip everything here. What is CVS? What is CVS? Introduction to CVS CVS, introduction to cvs is a version control system. Using it, you can record the history of your source files. For example, bugs sometimes creep in when software is modified, and you might not detect the bug until a long time after you make the modification. With cvs, you can easily retrieve old versions to see exactly which change caused the bug. This can sometimes be a big help. You could of course save every version of every file you have ever created. This would however waste an enormous amount of disk space. cvs stores all the versions of a file in a single file in a clever way that only stores the differences between versions. cvs also helps you if you are part of a group of people working on the same project. It is all too easy to overwrite each others' changes unless you are extremely careful. Some editors, like gnu Emacs, try to make sure that two people never modify the same file at the same time. Unfortunately, if someone is using another editor, that safeguard will not work. cvs solves this problem by insulating the different developers from each other. Every developer works in his own directory, and cvs merges the work when each developer is done. History of CVS CVS, history of Credits (CVS program) Contributors (CVS program) cvs started out as a bunch of shell scripts written by Dick Grune, posted to the newsgroup comp.sources.unix in the volume 6 release of July, 1986. While no actual code from these shell scripts is present in the current version of cvs much of the cvs conflict resolution algorithms come from them. In April, 1989, Brian Berliner designed and coded cvs. Jeff Polk later helped Brian with the design of the cvs module and vendor branch support. Source, getting CVS source You can get cvs in a variety of ways, including free download from the Internet. For more information on downloading cvs and other cvs topics, see: http://cvs.nongnu.org/ Mailing list List, mailing list Newsgroups There is a mailing list, known as , devoted to cvs. To subscribe or unsubscribe write to . If you prefer a Usenet group, there is a one-way mirror (posts to the email list are usually sent to the news group, but not vice versa) of at news:gnu.cvs.help. The right Usenet group for posts is news:comp.software.config-mgmt which is for cvs discussions (along with other configuration management systems). In the future, it might be possible to create a comp.software.config-mgmt.cvs, but probably only if there is sufficient cvs traffic on news:comp.software.config-mgmt. You can also subscribe to the mailing list, described in more detail in . To subscribe send mail to . There is a two-way Usenet mirror (posts to the Usenet group are usually sent to the email list and vice versa) of named news:gnu.cvs.bug. What is CVS not? What is CVS not? cvs can do a lot of things for you, but it does not try to be everything for everyone. cvs is not a build system. Though the structure of your repository and modulesfile interact with your build system(e.g. Makefiles), they are essentiallyindependent.cvs does not dictate how you build anything. Itmerely stores files for retrieval in a tree structureyou devise.cvs does not dictate how to use disk space in thechecked out working directories. If you write yourMakefiles or scripts in every directory so theyhave to know the relative positions of everything else,you wind up requiring the entire repository to bechecked out.If you modularize your work, and construct a buildsystem that will share files (via links, mounts,VPATH in Makefiles, etc.), you canarrange your disk usage however you like.But you have to remember that any such system isa lot of work to construct and maintain. cvs doesnot address the issues involved.Of course, you should place the tools created tosupport such a build system (scripts, Makefiles,etc) under cvs.Figuring out what files need to be rebuilt whensomething changes is, again, something to be handledoutside the scope of cvs. One traditionalapproach is to use make for building, and usesome automated tool for generating the dependencies whichmake uses.See , for more information on doing buildsin conjunction with cvs. cvs is not a substitute for management. Your managers and project leaders are expected to talkto you frequently enough to make certain you are awareof schedules, merge points, branch names and releasedates. If they don't, cvs can't help.cvs is an instrument for making sources dance toyour tune. But you are the piper and the composer. Noinstrument plays itself or writes its own music. cvs is not a substitute for developer communication. When faced with conflicts within a single file, mostdevelopers manage to resolve them without too mucheffort. But a more general definition of “conflict”includes problems too difficult to solve withoutcommunication between developers.cvs cannot determine when simultaneous changeswithin a single file, or across a whole collection offiles, will logically conflict with one another. Itsconcept of a conflict is purely textual, arisingwhen two changes to the same base file are near enoughto spook the merge (i.e. diff3) command.cvs does not claim to help at all in figuring outnon-textual or distributed conflicts in program logic.For example: Say you change the arguments to functionX defined in file A. At the same time,someone edits file B, adding new calls tofunction X using the old arguments. You areoutside the realm of cvs's competence.Acquire the habit of reading specs and talking to yourpeers. cvs does not have change control Change control refers to a number of things. First ofall it can mean bug-tracking, that is being ableto keep a database of reported bugs and the status ofeach one (is it fixed? in what release? has the bugsubmitter agreed that it is fixed?). For interfacingcvs to an external bug-tracking system, see thercsinfo and verifymsg files(see ).Another aspect of change control is keeping track ofthe fact that changes to several files were in factchanged together as one logical change. If you checkin several files in a single cvs commitoperation, cvs then forgets that those files werechecked in together, and the fact that they have thesame log message is the only thing tying themtogether. Keeping a gnu style ChangeLogcan help somewhat. Another aspect of change control, in some systems, isthe ability to keep track of the status of eachchange. Some changes have been written by a developer,others have been reviewed by a second developer, and soon. Generally, the way to do this with cvs is togenerate a diff (using cvs diff or diff)and email it to someone who can then apply it using thepatch utility. This is very flexible, butdepends on mechanisms outside cvs to make surenothing falls through the cracks. cvs is not an automated testing program It should be possible to enforce mandatory use of atest suite using the commitinfo file. I haven'theard a lot about projects trying to do that or whetherthere are subtle gotchas, however. cvs does not have a built-in process model Some systems provide ways to ensure that changes orreleases go through various steps, with variousapprovals as needed. Generally, one can accomplishthis with cvs but it might be a little more work.In some cases you'll want to use the commitinfo,loginfo, rcsinfo, or verifymsgfiles, to require that certain steps be performedbefore cvs will allow a checkin. Also consider whetherfeatures such as branches and tags can be used toperform tasks such as doing work in a development treeand then merging certain changes over to a stable treeonly once they have been proven. A sample session Example of a work-session Getting started Work-session, example of tc, Trivial Compiler (example) Trivial Compiler (example) As a way of introducing cvs, we'll go through a typical work-session using cvs. The first thing to understand is that cvs stores all files in a centralized repository (see ); this section assumes that a repository is set up. Suppose you are working on a simple compiler. The source consists of a handful of C files and a Makefile. The compiler is called ‘tc’ (Trivial Compiler), and the repository is set up so that there is a module called ‘tc’. Getting the source Getting the source Checking out source Fetching source Source, getting from CVS Checkout, example The first thing you must do is to get your own working copy of the source for ‘tc’. For this, you use the checkout command: $ cvs checkout tc This will create a new directory called tc and populate it with the source files. $ cd tc $ ls CVS Makefile backend.c driver.c frontend.c parser.c The CVS directory is used internally by cvs. Normally, you should not modify or remove any of the files in it. You start your favorite editor, hack away at backend.c, and a couple of hours later you have added an optimization pass to the compiler. A note to rcs and sccs users: There is no need to lock the files that you want to edit. See , for an explanation. Committing your changes Committing changes to files Log message entry When you have checked that the compiler is still compilable you decide to make a new version of backend.c. This will store your new backend.c in the repository and make it available to anyone else who is using that same repository. $ cvs commit backend.c cvs starts an editor, to allow you to enter a log message. You type in “Added an optimization pass.”, save the temporary file, and exit the editor. CVSEDITOR, environment variable EDITOR, environment variable The environment variable $CVSEDITOR determines which editor is started. If $CVSEDITOR is not set, then if the environment variable $EDITOR is set, it will be used. If both $CVSEDITOR and $EDITOR are not set then there is a default which will vary with your operating system, for example vi for unix or notepad for Windows NT/95. VISUAL, environment variable In addition, cvs checks the $VISUAL environment variable. Opinions vary on whether this behavior is desirable and whether future releases of cvs should check $VISUAL or ignore it. You will be OK either way if you make sure that $VISUAL is either unset or set to the same thing as $EDITOR. When cvs starts the editor, it includes a list of files which are modified. For the cvs client, this list is based on comparing the modification time of the file against the modification time that the file had when it was last gotten or updated. Therefore, if a file's modification time has changed but its contents have not, it will show up as modified. The simplest way to handle this is simply not to worry about it—if you proceed with the commit cvs will detect that the contents are not modified and treat it as an unmodified file. The next update will clue cvs in to the fact that the file is unmodified, and it will reset its stored timestamp so that the file will not show up in future editor sessions. If you want to avoid starting an editor you can specify the log message on the command line using the ‘-m’ flag instead, like this: $ cvs commit -m "Added an optimization pass" backend.c Cleaning up Cleaning up Working copy, removing Removing your working copy Releasing your working copy Before you turn to other tasks you decide to remove your working copy of tc. One acceptable way to do that is of course $ cd .. $ rm -r tc but a better way is to use the release command (see ): $ cd .. $ cvs release -d tc M driver.c ? tc You have [1] altered files in this repository. Are you sure you want to release (and delete) directory `tc': n ** `release' aborted by user choice. The release command checks that all your modifications have been committed. If history logging is enabled it also makes a note in the history file. See . When you use the ‘-d’ flag with release, it also removes your working copy. In the example above, the release command wrote a couple of lines of output. ‘? tc’ means that the file tc is unknown to cvs. That is nothing to worry about: tc is the executable compiler, and it should not be stored in the repository. See , for information about how to make that warning go away. See , for a complete explanation of all possible output from release. M driver.c’ is more serious. It means that the file driver.c has been modified since it was checked out. The release command always finishes by telling you how many modified files you have in your working copy of the sources, and then asks you for confirmation before deleting any files or making any note in the history file. You decide to play it safe and answer n RET when release asks for confirmation. Viewing differences Viewing differences Diff You do not remember modifying driver.c, so you want to see what has happened to that file. $ cd tc $ cvs diff driver.c This command runs diff to compare the version of driver.c that you checked out with your working copy. When you see the output you remember that you added a command line option that enabled the optimization pass. You check it in, and release the module. $ cvs commit -m "Added an optimization pass" driver.c Checking in driver.c; /usr/local/cvsroot/tc/driver.c,v <-- driver.c new revision: 1.2; previous revision: 1.1 done $ cd .. $ cvs release -d tc ? tc You have [0] altered files in this repository. Are you sure you want to release (and delete) directory `tc': y The Repository Repository (intro) Repository, example Layout of repository Typical repository /usr/local/cvsroot, as example repository cvsroot The cvs repository stores a complete copy of all the files and directories which are under version control. Normally, you never access any of the files in the repository directly. Instead, you use cvs commands to get your own copy of the files into a working directory, and then work on that copy. When you've finished a set of changes, you check (or commit) them back into the repository. The repository then contains the changes which you have made, as well as recording exactly what you changed, when you changed it, and other such information. Note that the repository is not a subdirectory of the working directory, or vice versa; they should be in separate locations. :local:, setting up cvs can access a repository by a variety of means. It might be on the local computer, or it might be on a computer across the room or across the world. To distinguish various ways to access a repository, the repository name can start with an access method. For example, the access method :local: means to access a repository directory, so the repository :local:/usr/local/cvsroot means that the repository is in /usr/local/cvsroot on the computer running cvs. For information on other access methods, see . If the access method is omitted, then if the repository starts with ‘/’, then :local: is assumed. If it does not start with ‘/’ then either :ext: or :server: is assumed. For example, if you have a local repository in /usr/local/cvsroot, you can use /usr/local/cvsroot instead of :local:/usr/local/cvsroot. But if (under Windows NT, for example) your local repository is c:\src\cvsroot, then you must specify the access method, as in :local:c:/src/cvsroot. The repository is split in two parts. $CVSROOT/CVSROOT contains administrative files for cvs. The other directories contain the actual user-defined modules. Telling CVS where your repository is There are several ways to tell cvs where to find the repository. You can name the repository on the command line explicitly, with the -d (for "directory") option: cvs -d /usr/local/cvsroot checkout yoyodyne/tc .profile, setting CVSROOT in .cshrc, setting CVSROOT in .tcshrc, setting CVSROOT in .bashrc, setting CVSROOT in CVSROOT, environment variable Or you can set the $CVSROOT environment variable to an absolute path to the root of the repository, /usr/local/cvsroot in this example. To set $CVSROOT, csh and tcsh users should have this line in their .cshrc or .tcshrc files: setenv CVSROOT /usr/local/cvsroot sh and bash users should instead have these lines in their .profile or .bashrc: CVSROOT=/usr/local/cvsroot export CVSROOT Root file, in CVS directory CVS/Root file A repository specified with -d will override the $CVSROOT environment variable. Once you've checked a working copy out from the repository, it will remember where its repository is (the information is recorded in the CVS/Root file in the working copy). The -d option and the CVS/Root file both override the $CVSROOT environment variable. If -d option differs from CVS/Root, the former is used. Of course, for proper operation they should be two ways of referring to the same repository. How data is stored in the repository Repository, how data is stored For most purposes it isn't important how cvs stores information in the repository. In fact, the format has changed in the past, and is likely to change in the future. Since in almost all cases one accesses the repository via cvs commands, such changes need not be disruptive. However, in some cases it may be necessary to understand how cvs stores data in the repository, for example you might need to track down cvs locks (see ) or you might need to deal with the file permissions appropriate for the repository. Where files are stored within the repository The overall structure of the repository is a directory tree corresponding to the directories in the working directory. For example, supposing the repository is in /usr/local/cvsroot here is a possible directory tree (showing only the directories): /usr | +--local | | | +--cvsroot | | | | | +--CVSROOT | (administrative files) | +--gnu | | | +--diff | | (source code to gnu diff) | | | +--rcs | | (source code to rcs) | | | +--cvs | (source code to cvs) | +--yoyodyne | +--tc | | | +--man | | | +--testing | +--(other Yoyodyne software) With the directories are history files for each file under version control. The name of the history file is the name of the corresponding file with ‘,v’ appended to the end. Here is what the repository for the yoyodyne/tc directory might look like: $CVSROOT | +--yoyodyne | | | +--tc | | | +--Makefile,v +--backend.c,v +--driver.c,v +--frontend.c,v +--parser.c,v +--man | | | +--tc.1,v | +--testing | +--testpgm.t,v +--test2.t,v History files RCS history files The history files contain, among other things, enough information to recreate any revision of the file, a log of all commit messages and the user-name of the person who committed the revision. The history files are known as RCS files, because the first program to store files in that format was a version control system known as rcs. For a full description of the file format, see the man page rcsfile(5), distributed with rcs, or the file doc/RCSFILES in the cvs source distribution. This file format has become very common—many systems other than cvs or rcs can at least import history files in this format. The rcs files used in cvs differ in a few ways from the standard format. The biggest difference is magic branches; for more information see . Also in cvs the valid tag names are a subset of what rcs accepts; for cvs's rules see . File permissions Security, file permissions in repository File permissions, general Permissions, general Group, UNIX file permissions, in repository Read-only files, in repository All ‘,v’ files are created read-only, and you should not change the permission of those files. The directories inside the repository should be writable by the persons that have permission to modify the files in each directory. This normally means that you must create a UNIX group (see group(5)) consisting of the persons that are to edit the files in a project, and set up the repository so that it is that group that owns the directory. (On some systems, you also need to set the set-group-ID-on-execution bit on the repository directories (see chmod(1)) so that newly-created files and directories get the group-ID of the parent directory rather than that of the current process.) This means that you can only control access to files on a per-directory basis. Note that users must also have write access to check out files, because cvs needs to create lock files (see ). You can use LockDir in CVSROOT/config to put the lock files somewhere other than in the repository if you want to allow read-only access to some directories (see ). CVSROOT/val-tags file, and read-only access to projects val-tags file, and read-only access to projects Also note that users must have write access to the CVSROOT/val-tags file. cvs uses it to keep track of what tags are valid tag names (it is sometimes updated when tags are used, as well as when they are created). Each rcs file will be owned by the user who last checked it in. This has little significance; what really matters is who owns the directories. CVSUMASK, environment variable Umask, for repository files cvs tries to set up reasonable file permissions for new directories that are added inside the tree, but you must fix the permissions manually when a new directory should have different permissions than its parent directory. If you set the CVSUMASK environment variable that will control the file permissions which cvs uses in creating directories and/or files in the repository. CVSUMASK does not affect the file permissions in the working directory; such files have the permissions which are typical for newly created files, except that sometimes cvs creates them read-only (see the sections on watches, ; -r, ; or CVSREAD, ). Note that using the client/server cvs (see ), there is no good way to set CVSUMASK; the setting on the client machine has no effect. If you are connecting with rsh, you can set CVSUMASK in .bashrc or .cshrc, as described in the documentation for your operating system. This behavior might change in future versions of cvs; do not rely on the setting of CVSUMASK on the client having no effect. Using pserver, you will generally need stricter permissions on the cvsroot directory and directories above it in the tree; see . Setuid Setgid Security, setuid Installed images (VMS) Some operating systems have features which allow a particular program to run with the ability to perform operations which the caller of the program could not. For example, the set user ID (setuid) or set group ID (setgid) features of unix or the installed image feature of VMS. cvs was not written to use such features and therefore attempting to install cvs in this fashion will provide protection against only accidental lapses; anyone who is trying to circumvent the measure will be able to do so, and depending on how you have set it up may gain access to more than just cvs. You may wish to instead consider pserver. It shares some of the same attributes, in terms of possibly providing a false sense of security or opening security holes wider than the ones you are trying to fix, so read the documentation on pserver security carefully if you are considering this option (). File Permission issues specific to Windows Windows, and permissions File permissions, Windows-specific Permissions, Windows-specific Some file permission issues are specific to Windows operating systems (Windows 95, Windows NT, and presumably future operating systems in this family. Some of the following might apply to OS/2 but I'm not sure). If you are using local cvs and the repository is on a networked file system which is served by the Samba SMB server, some people have reported problems with permissions. Enabling WRITE=YES in the samba configuration is said to fix/workaround it. Disclaimer: I haven't investigated enough to know the implications of enabling that option, nor do I know whether there is something which cvs could be doing differently in order to avoid the problem. If you find something out, please let us know as described in . The attic Attic You will notice that sometimes cvs stores an rcs file in the Attic. For example, if the cvsroot is /usr/local/cvsroot and we are talking about the file backend.c in the directory yoyodyne/tc, then the file normally would be in /usr/local/cvsroot/yoyodyne/tc/backend.c,v but if it goes in the attic, it would be in /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v Dead state instead. It should not matter from a user point of view whether a file is in the attic; cvs keeps track of this and looks in the attic when it needs to. But in case you want to know, the rule is that the RCS file is stored in the attic if and only if the head revision on the trunk has state dead. A dead state means that file has been removed, or never added, for that revision. For example, if you add a file on a branch, it will have a trunk revision in dead state, and a branch revision in a non-dead state. The CVS directory in the repository CVS directory, in repository The CVS directory in each repository directory contains information such as file attributes (in a file called CVS/fileattr. In the future additional files may be added to this directory, so implementations should silently ignore additional files. This behavior is implemented only by cvs 1.7 and later; for details see . The format of the fileattr file is a series of entries of the following form (where ‘{’ and ‘}’ means the text between the braces can be repeated zero or more times): ent-type filename <tab> attrname = attrval {; attrname = attrval} <linefeed> ent-type is ‘F’ for a file, in which case the entry specifies the attributes for that file. ent-type is ‘D’, and filename empty, to specify default attributes to be used for newly added files. Other ent-type are reserved for future expansion. cvs 1.9 and older will delete them any time it writes file attributes. cvs 1.10 and later will preserve them. Note that the order of the lines is not significant; a program writing the fileattr file may rearrange them at its convenience. There is currently no way of quoting tabs or line feeds in the filename, ‘=’ in attrname, ‘;’ in attrval, etc. Note: some implementations also don't handle a NUL character in any of the fields, but implementations are encouraged to allow it. By convention, attrname starting with ‘_’ is for an attribute given special meaning by cvs; other attrnames are for user-defined attributes (or will be, once implementations start supporting user-defined attributes). Built-in attributes: _watched Present means the file is watched and should be checked outread-only. _watchers Users with watches for this file. Value iswatcher > type { , watcher > type }where watcher is a username, and typeis zero or more of edit,unedit,commit separated by‘+’ (that is, nothing if none; there is no "none" or "all" keyword). _editors Users editing this file. Value iseditor > val { , editor > val }where editor is a username, and val istime+hostname+pathname, wheretime is when the cvs edit command (orequivalent) happened,and hostname and pathname are for the working directory. Example: Ffile1 _watched=;_watchers=joe>edit,mary>commit Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs D _watched= means that the file file1 should be checked out read-only. Furthermore, joe is watching for edits and mary is watching for commits. The file file2 should be checked out read-only; sue started editing it on 8 Jan 1975 in the directory /home/sue/cvs on the machine workstn1. Future files which are added should be checked out read-only. To represent this example here, we have shown a space after ‘D’, ‘Ffile1’, and ‘Ffile2’, but in fact there must be a single tab character there and no spaces. CVS locks in the repository #cvs.rfl, technical details #cvs.wfl, technical details #cvs.lock, technical details Locks, cvs, technical details For an introduction to cvs locks focusing on user-visible behavior, see . The following section is aimed at people who are writing tools which want to access a cvs repository without interfering with other tools accessing the same repository. If you find yourself confused by concepts described here, like read lock, write lock, and deadlock, you might consult the literature on operating systems or databases. #cvs.tfl Any file in the repository with a name starting with #cvs.rfl. is a read lock. Any file in the repository with a name starting with #cvs.wfl is a write lock. Old versions of cvs (before cvs 1.5) also created files with names starting with #cvs.tfl, but they are not discussed here. The directory #cvs.lock serves as a master lock. That is, one must obtain this lock first before creating any of the other locks. To obtain a read lock, first create the #cvs.lock directory. This operation must be atomic (which should be true for creating a directory under most operating systems). If it fails because the directory already existed, wait for a while and try again. After obtaining the #cvs.lock lock, create a file whose name is #cvs.rfl. followed by information of your choice (for example, hostname and process identification number). Then remove the #cvs.lock directory to release the master lock. Then proceed with reading the repository. When you are done, remove the #cvs.rfl file to release the read lock. To obtain a write lock, first create the #cvs.lock directory, as with read locks. Then check that there are no files whose names start with #cvs.rfl.. If there are, remove #cvs.lock, wait for a while, and try again. If there are no readers, then create a file whose name is #cvs.wfl followed by information of your choice (for example, hostname and process identification number). Hang on to the #cvs.lock lock. Proceed with writing the repository. When you are done, first remove the #cvs.wfl file and then the #cvs.lock directory. Note that unlike the #cvs.rfl file, the #cvs.wfl file is just informational; it has no effect on the locking operation beyond what is provided by holding on to the #cvs.lock lock itself. Note that each lock (write lock or read lock) only locks a single directory in the repository, including Attic and CVS but not including subdirectories which represent other directories under version control. To lock an entire tree, you need to lock each directory (note that if you fail to obtain any lock you need, you must release the whole tree before waiting and trying again, to avoid deadlocks). Note also that cvs expects write locks to control access to individual foo,v files. rcs has a scheme where the ,foo, file serves as a lock, but cvs does not implement it and so taking out a cvs write lock is recommended. See the comments at rcs_internal_lockfile in the cvs source code for further discussion/rationale. How files are stored in the CVSROOT directory CVSROOT, storage of files The $CVSROOT/CVSROOT directory contains the various administrative files. In some ways this directory is just like any other directory in the repository; it contains rcs files whose names end in ‘,v’, and many of the cvs commands operate on it the same way. However, there are a few differences. For each administrative file, in addition to the rcs file, there is also a checked out copy of the file. For example, there is an rcs file loginfo,v and a file loginfo which contains the latest revision contained in loginfo,v. When you check in an administrative file, cvs should print cvs commit: Rebuilding administrative file database and update the checked out copy in $CVSROOT/CVSROOT. If it does not, there is something wrong (see ). To add your own files to the files to be updated in this fashion, you can add them to the checkoutlist administrative file (see ). modules.db modules.pag modules.dir By default, the modules file behaves as described above. If the modules file is very large, storing it as a flat text file may make looking up modules slow (I'm not sure whether this is as much of a concern now as when cvs first evolved this feature; I haven't seen benchmarks). Therefore, by making appropriate edits to the cvs source code one can store the modules file in a database which implements the ndbm interface, such as Berkeley db or GDBM. If this option is in use, then the modules database will be stored in the files modules.db, modules.pag, and/or modules.dir. For information on the meaning of the various administrative files, see . How data is stored in the working directory CVS directory, in working directory While we are discussing cvs internals which may become visible from time to time, we might as well talk about what cvs puts in the CVS directories in the working directories. As with the repository, cvs handles this information and one can usually access it via cvs commands. But in some cases it may be useful to look at it, and other programs, such as the jCVS graphical user interface or the VC package for emacs, may need to look at it. Such programs should follow the recommendations in this section if they hope to be able to work with other programs which use those files, including future versions of the programs just mentioned and the command-line cvs client. The CVS directory contains several files. Programs which are reading this directory should silently ignore files which are in the directory but which are not documented here, to allow for future expansion. The files are stored according to the text file convention for the system in question. This means that working directories are not portable between systems with differing conventions for storing text files. This is intentional, on the theory that the files being managed by cvs probably will not be portable between such systems either. Root This file contains the current cvs root, asdescribed in . Repository file, in CVS directory CVS/Repository file Repository This file contains the directory within the repositorywhich the current directory corresponds with. It canbe either an absolute pathname or a relative pathname;cvs has had the ability to read either formatsince at least version 1.3 or so. The relativepathname is relative to the root, and is the moresensible approach, but the absolute pathname is quitecommon and implementations should accept either. Forexample, after the command cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc Root will contain :local:/usr/local/cvsroot and Repository will contain either /usr/local/cvsroot/yoyodyne/tc or yoyodyne/tc If the particular working directory does not correspondto a directory in the repository, then Repositoryshould contain CVSROOT/Emptydir. Emptydir, in CVSROOT directory CVSROOT/Emptydir directory Entries file, in CVS directory CVS/Entries file Entries This file lists the files and directories in theworking directory.The first character of each line indicates what sort ofline it is. If the character is unrecognized, programsreading the file should silently skip that line, toallow for future expansion.If the first character is ‘/’, then the format is: /name/revision/timestamp[+conflict]/options/tagdate where ‘[’ and ‘]’ are not part of the entry,but instead indicate that the ‘+’ and conflictmarker are optional. name is the name of thefile within the directory. revision is therevision that the file in the working derives from, or‘0’ for an added file, or ‘-’ followed by arevision for a removed file. timestamp is thetimestamp of the file at the time that cvs createdit; if the timestamp differs with the actualmodification time of the file it means the file hasbeen modified. It is stored inthe format used by the ISO C asctime() function (forexample, ‘Sun Apr 7 01:29:26 1996’). One maywrite a string which is not in that format, forexample, ‘Result of merge’, to indicate that thefile should always be considered to be modified. Thisis not a special case; to see whether a file ismodified a program should take the timestamp of the fileand simply do a string compare with timestamp.If there was a conflict, conflict can be set tothe modification time of the file after the file has beenwritten with conflict markers (see ).Thus if conflict is subsequently the same as the actualmodification time of the file it means that the userhas obviously not resolved the conflict. optionscontains sticky options (for example ‘-kb’ for abinary file). tagdate contains ‘T’ followedby a tag name, or ‘D’ for a date, followed by asticky tag or date. Note that if timestampcontains a pair of timestamps separated by a space,rather than a single timestamp, you are dealing with aversion of cvs earlier than cvs 1.5 (notdocumented here).The timezone on the timestamp in CVS/Entries (local oruniversal) should be the same as the operating systemstores for the timestamp of the file itself. Forexample, on Unix the file's timestamp is in universaltime (UT), so the timestamp in CVS/Entries should betoo. On vms, the file's timestamp is in localtime, so cvs on vms should use local time.This rule is so that files do not appear to be modifiedmerely because the timezone changed (for example, to orfrom summer time). If the first character of a line in Entries is‘D’, then it indicates a subdirectory. ‘D’on a line all by itself indicates that the programwhich wrote the Entries file does recordsubdirectories (therefore, if there is such a line andno other lines beginning with ‘D’, one knows thereare no subdirectories). Otherwise, the line lookslike: D/name/filler1/filler2/filler3/filler4 where name is the name of the subdirectory, andall the filler fields should be silently ignored,for future expansion. Programs which modifyEntries files should preserve these fields.The lines in the Entries file can be in any order. Entries.Log file, in CVS directory CVS/Entries.Log file Entries.Log This file does not record any information beyond thatin Entries, but it does provide a way to updatethe information without having to rewrite the entireEntries file, including the ability to preservethe information even if the program writingEntries and Entries.Log abruptly aborts.Programs which are reading the Entries fileshould also check for Entries.Log. If the latterexists, they should read Entries and then applythe changes mentioned in Entries.Log. Afterapplying the changes, the recommended practice is torewrite Entries and then delete Entries.Log.The format of a line in Entries.Log is a singlecharacter command followed by a space followed by aline in the format specified for a line inEntries. The single character command is‘A’ to indicate that the entry is being added,‘R’ to indicate that the entry is being removed,or any other character to indicate that the entire linein Entries.Log should be silently ignored (forfuture expansion). If the second character of the linein Entries.Log is not a space, then it waswritten by an older version of cvs (not documentedhere).Programs which are writing rather than reading cansafely ignore Entries.Log if they so choose. Entries.Backup file, in CVS directory CVS/Entries.Backup file Entries.Backup This is a temporary file. Recommended usage is towrite a new entries file to Entries.Backup, andthen to rename it (atomically, where possible) to Entries. Entries.Static file, in CVS directory CVS/Entries.Static file Entries.Static The only relevant thing about this file is whether itexists or not. If it exists, then it means that onlypart of a directory was gotten and cvs willnot create additional files in that directory. Toclear it, use the update command with the‘-d’ option, which will get the additional filesand remove Entries.Static. Tag file, in CVS directory CVS/Tag file Sticky tags/dates, per-directory Per-directory sticky tags/dates Tag This file contains per-directory sticky tags or dates.The first character is ‘T’ for a branch tag,‘N’ for a non-branch tag, or ‘D’ for a date,or another character to mean the file should besilently ignored, for future expansion. This characteris followed by the tag or date. Note thatper-directory sticky tags or dates are used for thingslike applying to files which are newly added; theymight not be the same as the sticky tags or dates onindividual files. For general information on stickytags and dates, see . Notify file, in CVS directory CVS/Notify file Notify This file stores notifications (for example, foredit or unedit) which have not yet beensent to the server. Its format is not yet documentedhere. Notify.tmp file, in CVS directory CVS/Notify.tmp file Notify.tmp This file is to Notify as Entries.Backupis to Entries. That is, to write Notify,first write the new contents to Notify.tmp andthen (atomically where possible), rename it toNotify. Base directory, in CVS directory CVS/Base directory Base If watches are in use, then an edit commandstores the original copy of the file in the Basedirectory. This allows the unedit command tooperate even if it is unable to communicate with theserver. Baserev file, in CVS directory CVS/Baserev file Baserev The file lists the revision for each of the files inthe Base directory. The format is: Bname/rev/expansion where expansion should be ignored, to allow forfuture expansion. Baserev.tmp file, in CVS directory CVS/Baserev.tmp file Baserev.tmp This file is to Baserev as Entries.Backupis to Entries. That is, to write Baserev,first write the new contents to Baserev.tmp andthen (atomically where possible), rename it toBaserev. Template file, in CVS directory CVS/Template file Template This file contains the template specified by thercsinfo file (see ). It is only usedby the client; the non-client/server cvs consultsrcsinfo directly. The administrative files Administrative files (intro) Modules file CVSROOT, module name Defining modules (intro) The directory $CVSROOT/CVSROOT contains some administrative files. See , for a complete description. You can use cvs without any of these files, but some commands work better when at least the modules file is properly set up. The most important of these files is the modules file. It defines all modules in the repository. This is a sample modules file. CVSROOT CVSROOT modules CVSROOT modules cvs gnu/cvs rcs gnu/rcs diff gnu/diff tc yoyodyne/tc The modules file is line oriented. In its simplest form each line contains the name of the module, whitespace, and the directory where the module resides. The directory is a path relative to $CVSROOT. The last four lines in the example above are examples of such lines. The line that defines the module called ‘modules’ uses features that are not explained here. See , for a full explanation of all the available features. Editing administrative files Editing administrative files Administrative files, editing them You edit the administrative files in the same way that you would edit any other module. Use ‘cvs checkout CVSROOT’ to get a working copy, edit it, and commit your changes in the normal way. It is possible to commit an erroneous administrative file. You can often fix the error and check in a new revision, but sometimes a particularly bad error in the administrative file makes it impossible to commit new revisions. If and when this happens, you can correct the problem by temporarily copying a corrected administrative file directly into the $CVSROOT/CVSROOT repository directory, then committing the same correction via a checkout of the CVSROOT module. It is important that the correction also be made via the checked out copy, or the next checkout and commit to the <code>CVSROOT</code> module will overwrite the correction that was copied directly into the repository, possibly breaking things in such a way as to prevent commits again. Multiple repositories Multiple repositories Repositories, multiple Many repositories Parallel repositories Disjoint repositories CVSROOT, multiple repositories In some situations it is a good idea to have more than one repository, for instance if you have two development groups that work on separate projects without sharing any code. All you have to do to have several repositories is to specify the appropriate repository, using the CVSROOT environment variable, the ‘-d’ option to cvs, or (once you have checked out a working directory) by simply allowing cvs to use the repository that was used to check out the working directory (see ). The big advantage of having multiple repositories is that they can reside on different servers. With cvs version 1.10, a single command cannot recurse into directories from different repositories. With development versions of cvs, you can check out code from multiple servers into your working directory. cvs will recurse and handle all the details of making connections to as many server machines as necessary to perform the requested command. Here is an example of how to set up a working directory: cvs -d server1:/cvs co dir1 cd dir1 cvs -d server2:/root co sdir cvs update The cvs co commands set up the working directory, and then the cvs update command will contact server2, to update the dir1/sdir subdirectory, and server1, to update everything else. Creating a repository Repository, setting up Creating a repository Setting up a repository This section describes how to set up a cvs repository for any sort of access method. After completing the setup described in this section, you should be able to access your cvs repository immediately via the local access method and several remote access methods. For more information on setting up remote access to the repository you create in this section, please read the section on See . To set up a cvs repository, first choose the machine and disk on which you want to store the revision history of the source files. CPU and memory requirements are modest, so most machines should be adequate. For details see . To estimate disk space requirements, if you are importing RCS files from another system, the size of those files is the approximate initial size of your repository, or if you are starting without any version history, a rule of thumb is to allow for the server approximately three times the size of the code to be under cvs for the repository (you will eventually outgrow this, but not for a while). On the machines on which the developers will be working, you'll want disk space for approximately one working directory for each developer (either the entire tree or a portion of it, depending on what each developer uses). The repository should be accessible (directly or via a networked file system) from all machines which want to use cvs in server or local mode; the client machines need not have any access to it other than via the cvs protocol. It is not possible to use cvs to read from a repository which one only has read access to; cvs needs to be able to create lock files (see ). init (subcommand) To create a repository, run the cvs init command. It will set up an empty repository in the cvs root specified in the usual way (see ). For example, cvs -d /usr/local/cvsroot init cvs init is careful to never overwrite any existing files in the repository, so no harm is done if you run cvs init on an already set-up repository. cvs init will enable history logging; if you don't want that, remove the history file after running cvs init. See . Backing up a repository Repository, backing up Backing up, repository There is nothing particularly magical about the files in the repository; for the most part it is possible to back them up just like any other files. However, there are a few issues to consider. Locks, cvs, and backups #cvs.rfl, and backups The first is that to be paranoid, one should either not use cvs during the backup, or have the backup program lock cvs while doing the backup. To not use cvs, you might forbid logins to machines which can access the repository, turn off your cvs server, or similar mechanisms. The details would depend on your operating system and how you have cvs set up. To lock cvs, you would create #cvs.rfl locks in each repository directory. See , for more on cvs locks. Having said all this, if you just back up without any of these precautions, the results are unlikely to be particularly dire. Restoring from backup, the repository might be in an inconsistent state, but this would not be particularly hard to fix manually. When you restore a repository from backup, assuming that changes in the repository were made after the time of the backup, working directories which were not affected by the failure may refer to revisions which no longer exist in the repository. Trying to run cvs in such directories will typically produce an error message. One way to get those changes back into the repository is as follows: Get a new working directory. Copy the files from the working directory from beforethe failure over to the new working directory (do notcopy the contents of the CVS directories, ofcourse). Working in the new working directory, use commands suchas cvs update and cvs diff to figure outwhat has changed, and then when you are ready, committhe changes into the repository. Moving a repository Repository, moving Moving a repository Copying a repository Just as backing up the files in the repository is pretty much like backing up any other files, if you need to move a repository from one place to another it is also pretty much like just moving any other collection of files. The main thing to consider is that working directories point to the repository. The simplest way to deal with a moved repository is to just get a fresh working directory after the move. Of course, you'll want to make sure that the old working directory had been checked in before the move, or you figured out some other way to make sure that you don't lose any changes. If you really do want to reuse the existing working directory, it should be possible with manual surgery on the CVS/Repository files. You can see , for information on the CVS/Repository and CVS/Root files, but unless you are sure you want to bother, it probably isn't worth it. Remote repositories Repositories, remote Remote repositories Client/Server Operation Server, CVS Remote repositories, port specification Repositories, remote, port specification Client/Server Operation, port specification pserver (client/server connection method), port specification kserver (client/server connection method), port specification gserver (client/server connection method), port specification port, specifying for remote repositories Your working copy of the sources can be on a different machine than the repository. Using cvs in this manner is known as client/server operation. You run cvs on a machine which can mount your working directory, known as the client, and tell it to communicate to a machine which can mount the repository, known as the server. Generally, using a remote repository is just like using a local one, except that the format of the repository name is: [:method:][[user][:password]@]hostname[:[port]]/path/to/repository Specifying a password in the repository name is not recommended during checkout, since this will cause cvs to store a cleartext copy of the password in each created directory. cvs login first instead (see ). The details of exactly what needs to be set up depend on how you are connecting to the server. If method is not specified, and the repository name contains ‘:’, then the default is ext or server, depending on your platform; both are described in . Server requirements The quick answer to what sort of machine is suitable as a server is that requirements are modest—a server with 32M of memory or even less can handle a fairly large source tree with a fair amount of activity. The real answer, of course, is more complicated. Estimating the known areas of large memory consumption should be sufficient to estimate memory requirements. There are two such areas documented here; other memory consumption should be small by comparison (if you find that is not the case, let us know, as described in , so we can update this documentation). The first area of big memory consumption is large checkouts, when using the cvs server. The server consists of two processes for each client that it is serving. Memory consumption on the child process should remain fairly small. Memory consumption on the parent process, particularly if the network connection to the client is slow, can be expected to grow to slightly more than the size of the sources in a single directory, or two megabytes, whichever is larger. Multiplying the size of each cvs server by the number of servers which you expect to have active at one time should give an idea of memory requirements for the server. For the most part, the memory consumed by the parent process probably can be swap space rather than physical memory. The second area of large memory consumption is diff, when checking in large files. This is required even for binary files. The rule of thumb is to allow about ten times the size of the largest file you will want to check in, although five times may be adequate. For example, if you want to check in a file which is 10 megabytes, you should have 100 megabytes of memory on the machine doing the checkin (the server machine for client/server, or the machine running cvs for non-client/server). This can be swap space rather than physical memory. Because the memory is only required briefly, there is no particular need to allow memory for more than one such checkin at a time. Resource consumption for the client is even more modest—any machine with enough capacity to run the operating system in question should have little trouble. For information on disk space requirements, see . Connecting with rsh rsh cvs uses the ‘rsh’ protocol to perform these operations, so the remote user host needs to have a .rhosts file which grants access to the local user. For example, suppose you are the user ‘mozart’ on the local machine ‘toe.example.com’, and the server machine is ‘faun.example.org’. On faun, put the following line into the file .rhosts in ‘bach’'s home directory: toe.example.com mozart Then test that ‘rsh’ is working with rsh -l bach faun.example.org 'echo $PATH' CVS_SERVER, environment variable Next you have to make sure that rsh will be able to find the server. Make sure that the path which rsh printed in the above example includes the directory containing a program named cvs which is the server. You need to set the path in .bashrc, .cshrc, etc., not .login or .profile. Alternately, you can set the environment variable CVS_SERVER on the client machine to the filename of the server you want to use, for example /usr/local/bin/cvs-1.6. There is no need to edit inetd.conf or start a cvs server daemon. :server:, setting up :ext:, setting up Kerberos, using kerberized rsh SSH (rsh replacement) rsh replacements (Kerberized, SSH, &c) There are two access methods that you use in CVSROOT for rsh. :server: specifies an internal rsh client, which is supported only by some cvs ports. :ext: specifies an external rsh program. By default this is rsh but you may set the CVS_RSH environment variable to invoke another program which can access the remote server (for example, remsh on HP-UX 9 because rsh is something different). It must be a program which can transmit data to and from the server without modifying it; for example the Windows NT rsh is not suitable since it by default translates between CRLF and LF. The OS/2 cvs port has a hack to pass ‘-b’ to rsh to get around this, but since this could potentially cause problems for programs other than the standard rsh, it may change in the future. If you set CVS_RSH to SSH or some other rsh replacement, the instructions in the rest of this section concerning .rhosts and so on are likely to be inapplicable; consult the documentation for your rsh replacement. Continuing our example, supposing you want to access the module foo in the repository /usr/local/cvsroot/, on machine faun.example.org, you are ready to go: cvs -d :ext:bach@faun.example.org:/usr/local/cvsroot checkout foo (The bach@ can be omitted if the username is the same on both the local and remote hosts.) Direct connection with password authentication The cvs client can also connect to the server using a password protocol. This is particularly useful if using rsh is not feasible (for example, the server is behind a firewall), and Kerberos also is not available. To use this method, it is necessary to make some adjustments on both the server and client sides. Setting up the server for password authentication First of all, you probably want to tighten the permissions on the $CVSROOT and $CVSROOT/CVSROOT directories. See , for more details. pserver (subcommand) Remote repositories, port specification Repositories, remote, port specification Client/Server Operation, port specification pserver (client/server connection method), port specification kserver (client/server connection method), port specification gserver (client/server connection method), port specification port, specifying for remote repositories Password server, setting up Authenticating server, setting up inetd, configuring for pserver xinetd, configuring for pserver On the server side, the file /etc/inetd.conf needs to be edited so inetd knows to run the command cvs pserver when it receives a connection on the right port. By default, the port number is 2401; it would be different if your client were compiled with CVS_AUTH_PORT defined to something else, though. This can also be specified in the CVSROOT variable (see ) or overridden with the CVS_CLIENT_PORT environment variable (see ). If your inetd allows raw port numbers in /etc/inetd.conf, then the following (all on a single line in inetd.conf) should be sufficient: 2401 stream tcp nowait root /usr/local/bin/cvs cvs -f --allow-root=/usr/cvsroot pserver (You could also use the ‘-T’ option to specify a temporary directory.) The ‘--allow-root’ option specifies the allowable cvsroot directory. Clients which attempt to use a different cvsroot directory will not be allowed to connect. If there is more than one cvsroot directory which you want to allow, repeat the option. (Unfortunately, many versions of inetd have very small limits on the number of arguments and/or the total length of the command. The usual solution to this problem is to have inetd run a shell script which then invokes cvs with the necessary arguments.) If your inetd wants a symbolic service name instead of a raw port number, then put this in /etc/services: cvspserver 2401/tcp and put cvspserver instead of 2401 in inetd.conf. If your system uses xinetd instead of inetd, the procedure is slightly different. Create a file called /etc/xinetd.d/cvspserver containing the following: service cvspserver { port = 2401 socket_type = stream protocol = tcp wait = no user = root passenv = PATH server = /usr/local/bin/cvs server_args = -f --allow-root=/usr/cvsroot pserver } (If cvspserver is defined in /etc/services, you can omit the port line.) Once the above is taken care of, restart your inetd, or do whatever is necessary to force it to reread its initialization files. If you are having trouble setting this up, see . CVS passwd file passwd (admin file) Because the client stores and transmits passwords in cleartext (almost—see , for details), a separate cvs password file is generally used, so people don't compromise their regular passwords when they access the repository. This file is $CVSROOT/CVSROOT/passwd (see ). It uses a colon-separated format, similar to /etc/passwd on Unix systems, except that it has fewer fields: cvs username, optional password, and an optional system username for cvs to run as if authentication succeeds. Here is an example passwd file with five entries: anonymous: bach:ULtgRLXo7NRxs spwang:1sOp854gDF3DY melissa:tGX1fS8sun6rY:pubcvs qproj:XR4EZcEs0szik:pubcvs (The passwords are encrypted according to the standard Unix crypt() function, so it is possible to paste in passwords directly from regular Unix /etc/passwd files.) The first line in the example will grant access to any cvs client attempting to authenticate as user anonymous, no matter what password they use, including an empty password. (This is typical for sites granting anonymous read-only access; for information on how to do the "read-only" part, see .) The second and third lines will grant access to bach and spwang if they supply their respective plaintext passwords. User aliases The fourth line will grant access to melissa, if she supplies the correct password, but her cvs operations will actually run on the server side under the system user pubcvs. Thus, there need not be any system user named melissa, but there must be one named pubcvs. The fifth line shows that system user identities can be shared: any client who successfully authenticates as qproj will actually run as pubcvs, just as melissa does. That way you could create a single, shared system user for each project in your repository, and give each developer their own line in the $CVSROOT/CVSROOT/passwd file. The cvs username on each line would be different, but the system username would be the same. The reason to have different cvs usernames is that cvs will log their actions under those names: when melissa commits a change to a project, the checkin is recorded in the project's history under the name melissa, not pubcvs. And the reason to have them share a system username is so that you can arrange permissions in the relevant area of the repository such that only that account has write-permission there. If the system-user field is present, all password-authenticated cvs commands run as that user; if no system user is specified, cvs simply takes the cvs username as the system username and runs commands as that user. In either case, if there is no such user on the system, then the cvs operation will fail (regardless of whether the client supplied a valid password). The password and system-user fields can both be omitted (and if the system-user field is omitted, then also omit the colon that would have separated it from the encrypted password). For example, this would be a valid $CVSROOT/CVSROOT/passwd file: anonymous::pubcvs fish:rKa5jzULzmhOo:kfogel sussman:1sOp854gDF3DY When the password field is omitted or empty, then the client's authentication attempt will succeed with any password, including the empty string. However, the colon after the cvs username is always necessary, even if the password is empty. cvs can also fall back to use system authentication. When authenticating a password, the server first checks for the user in the $CVSROOT/CVSROOT/passwd file. If it finds the user, it will use that entry for authentication as described above. But if it does not find the user, or if the cvs passwd file does not exist, then the server can try to authenticate the username and password using the operating system's user-lookup routines (this "fallback" behavior can be disabled by setting SystemAuth=no in the cvs config file, see ). Be aware, however, that falling back to system authentication might be a security risk: cvs operations would then be authenticated with that user's regular login password, and the password flies across the network in plaintext. See for more on this. Right now, the only way to put a password in the cvs passwd file is to paste it there from somewhere else. Someday, there may be a cvs passwd command. Unlike many of the files in $CVSROOT/CVSROOT, it is normal to edit the passwd file in-place, rather than via cvs. This is because of the possible security risks of having the passwd file checked out to people's working copies. If you do want to include the passwd file in checkouts of $CVSROOT/CVSROOT, see . Using the client with password authentication Login (subcommand) Password client, using Authenticated client, using :pserver:, setting up To run a cvs command on a remote repository via the password-authenticating server, one specifies the pserver protocol, optional username, repository host, an optional port number, and path to the repository. For example: cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj or CVSROOT=:pserver:bach@faun.example.org:2401/usr/local/cvsroot cvs checkout someproj However, unless you're connecting to a public-access repository (i.e., one where that username doesn't require a password), you'll need to supply a password or log in first. Logging in verifies your password with the repository and stores it in a file. It's done with the login command, which will prompt you interactively for the password if you didn't supply one as part of $CVSROOT: cvs -d :pserver:bach@faun.example.org:/usr/local/cvsroot login CVS password: or cvs -d :pserver:bach:p4ss30rd@faun.example.org:/usr/local/cvsroot login After you enter the password, cvs verifies it with the server. If the verification succeeds, then that combination of username, host, repository, and password is permanently recorded, so future transactions with that repository won't require you to run cvs login. (If verification fails, cvs will exit complaining that the password was incorrect, and nothing will be recorded.) The records are stored, by default, in the file $HOME/.cvspass. That file's format is human-readable, and to a degree human-editable, but note that the passwords are not stored in cleartext—they are trivially encoded to protect them from "innocent" compromise (i.e., inadvertent viewing by a system administrator or other non-malicious person). CVS_PASSFILE, environment variable You can change the default location of this file by setting the CVS_PASSFILE environment variable. If you use this variable, make sure you set it before cvs login is run. If you were to set it after running cvs login, then later cvs commands would be unable to look up the password for transmission to the server. Once you have logged in, all cvs commands using that remote repository and username will authenticate with the stored password. So, for example cvs -d :pserver:bach@faun.example.org:/usr/local/cvsroot checkout foo should just work (unless the password changes on the server side, in which case you'll have to re-run cvs login). Note that if the ‘:pserver:’ were not present in the repository specification, cvs would assume it should use rsh to connect with the server instead (see ). Of course, once you have a working copy checked out and are running cvs commands from within it, there is no longer any need to specify the repository explicitly, because cvs can deduce the repository from the working copy's CVS subdirectory. Logout (subcommand) The password for a given remote repository can be removed from the CVS_PASSFILE by using the cvs logout command. Security considerations with password authentication Security, of pserver The passwords are stored on the client side in a trivial encoding of the cleartext, and transmitted in the same encoding. The encoding is done only to prevent inadvertent password compromises (i.e., a system administrator accidentally looking at the file), and will not prevent even a naive attacker from gaining the password. The separate cvs password file (see ) allows people to use a different password for repository access than for login access. On the other hand, once a user has non-read-only access to the repository, she can execute programs on the server system through a variety of means. Thus, repository access implies fairly broad system access as well. It might be possible to modify cvs to prevent that, but no one has done so as of this writing. Note that because the $CVSROOT/CVSROOT directory contains passwd and other files which are used to check security, you must control the permissions on this directory as tightly as the permissions on /etc. The same applies to the $CVSROOT directory itself and any directory above it in the tree. Anyone who has write access to such a directory will have the ability to become any user on the system. Note that these permissions are typically tighter than you would use if you are not using pserver. In summary, anyone who gets the password gets repository access (which may imply some measure of general system access as well). The password is available to anyone who can sniff network packets or read a protected (i.e., user read-only) file. If you want real security, get Kerberos. Direct connection with GSSAPI GSSAPI Security, GSSAPI :gserver:, setting up Kerberos, using :gserver: GSSAPI is a generic interface to network security systems such as Kerberos 5. If you have a working GSSAPI library, you can have cvs connect via a direct tcp connection, authenticating with GSSAPI. To do this, cvs needs to be compiled with GSSAPI support; when configuring cvs it tries to detect whether GSSAPI libraries using Kerberos version 5 are present. You can also use the --with-gssapi flag to configure. The connection is authenticated using GSSAPI, but the message stream is not authenticated by default. You must use the -a global option to request stream authentication. The data transmitted is not encrypted by default. Encryption support must be compiled into both the client and the server; use the --enable-encrypt configure option to turn it on. You must then use the -x global option to request encryption. GSSAPI connections are handled on the server side by the same server which handles the password authentication server; see . If you are using a GSSAPI mechanism such as Kerberos which provides for strong authentication, you will probably want to disable the ability to authenticate via cleartext passwords. To do so, create an empty CVSROOT/passwd password file, and set SystemAuth=no in the config file (see ). The GSSAPI server uses a principal name of cvs/hostname, where hostname is the canonical name of the server host. You will have to set this up as required by your GSSAPI mechanism. To connect using GSSAPI, use the ‘:gserver:’ method. For example, cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo Direct connection with Kerberos Kerberos, using :kserver: Security, Kerberos :kserver:, setting up The easiest way to use Kerberos is to use the Kerberos rsh, as described in . The main disadvantage of using rsh is that all the data needs to pass through additional programs, so it may be slower. So if you have Kerberos installed you can connect via a direct tcp connection, authenticating with Kerberos. This section concerns the Kerberos network security system, version 4. Kerberos version 5 is supported via the GSSAPI generic network security interface, as described in the previous section. To do this, cvs needs to be compiled with Kerberos support; when configuring cvs it tries to detect whether Kerberos is present or you can use the --with-krb4 flag to configure. The data transmitted is not encrypted by default. Encryption support must be compiled into both the client and server; use the --enable-encryption configure option to turn it on. You must then use the -x global option to request encryption. CVS_CLIENT_PORT You need to edit inetd.conf on the server machine to run cvs kserver. The client uses port 1999 by default; if you want to use another port specify it in the CVSROOT (see ) or the CVS_CLIENT_PORT environment variable (see ) on the client. kinit When you want to use cvs, get a ticket in the usual way (generally kinit); it must be a ticket which allows you to log into the server machine. Then you are ready to go: cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo Previous versions of cvs would fall back to a connection via rsh; this version will not do so. Connecting with fork fork, access method :fork:, setting up This access method allows you to connect to a repository on your local disk via the remote protocol. In other words it does pretty much the same thing as :local:, but various quirks, bugs and the like are those of the remote cvs rather than the local cvs. For day-to-day operations you might prefer either :local: or :fork:, depending on your preferences. Of course :fork: comes in particularly handy in testing or debugging cvs and the remote protocol. Specifically, we avoid all of the network-related setup/configuration, timeouts, and authentication inherent in the other remote access methods but still create a connection which uses the remote protocol. To connect using the fork method, use ‘:fork:’ and the pathname to your local repository. For example: cvs -d :fork:/usr/local/cvsroot checkout foo CVS_SERVER, and :fork: As with :ext:, the server is called ‘cvs’ by default, or the value of the CVS_SERVER environment variable. Read-only repository access Read-only repository access readers (admin file) writers (admin file) It is possible to grant read-only repository access to people using the password-authenticated server (see ). (The other access methods do not have explicit support for read-only users because those methods all assume login access to the repository machine anyway, and therefore the user can do whatever local file permissions allow her to do.) A user who has read-only access can do only those cvs operations which do not modify the repository, except for certain “administrative” files (such as lock files and the history file). It may be desirable to use this feature in conjunction with user-aliasing (see ). Unlike with previous versions of cvs, read-only users should be able merely to read the repository, and not to execute programs on the server or otherwise gain unexpected levels of access. Or to be more accurate, the known holes have been plugged. Because this feature is new and has not received a comprehensive security audit, you should use whatever level of caution seems warranted given your attitude concerning security. There are two ways to specify read-only access for a user: by inclusion, and by exclusion. "Inclusion" means listing that user specifically in the $CVSROOT/CVSROOT/readers file, which is simply a newline-separated list of users. Here is a sample readers file: melissa splotnik jrandom (Don't forget the newline after the last user.) "Exclusion" means explicitly listing everyone who has write access—if the file $CVSROOT/CVSROOT/writers exists, then only those users listed in it have write access, and everyone else has read-only access (of course, even the read-only users still need to be listed in the cvs passwd file). The writers file has the same format as the readers file. Note: if your cvs passwd file maps cvs users onto system users (see ), make sure you deny or grant read-only access using the cvs usernames, not the system usernames. That is, the readers and writers files contain cvs usernames, which may or may not be the same as system usernames. Here is a complete description of the server's behavior in deciding whether to grant read-only or read-write access: If readers exists, and this user is listed in it, then she gets read-only access. Or if writers exists, and this user is NOT listed in it, then she also gets read-only access (this is true even if readers exists but she is not listed there). Otherwise, she gets full read-write access. Of course there is a conflict if the user is listed in both files. This is resolved in the more conservative way, it being better to protect the repository too much than too little: such a user gets read-only access. Temporary directories for the server Temporary directories, and server Server, temporary directories While running, the cvs server creates temporary directories. They are named cvs-servpid where pid is the process identification number of the server. They are located in the directory specified by the ‘-T’ global option (see ), the TMPDIR environment variable (see ), or, failing that, /tmp. In most cases the server will remove the temporary directory when it is done, whether it finishes normally or abnormally. However, there are a few cases in which the server does not or cannot remove the temporary directory, for example: If the server aborts due to an internal server error,it may preserve the directory to aid in debugging If the server is killed in a way that it has no way ofcleaning up (most notably, ‘kill -KILL’ on unix). If the system shuts down without an orderly shutdown,which tells the server to clean up. In cases such as this, you will need to manually remove the cvs-servpid directories. As long as there is no server running with process identification number pid, it is safe to do so. Starting a project with CVS Starting a project with CVS Creating a project Because renaming files and moving them between directories is somewhat inconvenient, the first thing you do when you start a new project should be to think through your file organization. It is not impossible to rename or move files, but it does increase the potential for confusion and cvs does have some quirks particularly in the area of renaming directories. See . What to do next depends on the situation at hand. Setting up the files The first step is to create the files inside the repository. This can be done in a couple of different ways. Creating a directory tree from a number of files Importing files When you begin using cvs, you will probably already have several projects that can be put under cvs control. In these cases the easiest way is to use the import command. An example is probably the easiest way to explain how to use it. If the files you want to install in cvs reside in wdir, and you want them to appear in the repository as $CVSROOT/yoyodyne/rdir, you can do this: $ cd wdir $ cvs import -m "Imported sources" yoyodyne/rdir yoyo start Unless you supply a log message with the ‘-m’ flag, cvs starts an editor and prompts for a message. The string ‘yoyo’ is a vendor tag, and ‘start’ is a release tag. They may fill no purpose in this context, but since cvs requires them they must be present. See , for more information about them. You can now verify that it worked, and remove your original source directory. $ cd .. $ cvs checkout yoyodyne/rdir # Explanation below $ diff -r wdir yoyodyne/rdir $ rm -r wdir Erasing the original sources is a good idea, to make sure that you do not accidentally edit them in wdir, bypassing cvs. Of course, it would be wise to make sure that you have a backup of the sources before you remove them. The checkout command can either take a module name as argument (as it has done in all previous examples) or a path name relative to $CVSROOT, as it did in the example above. It is a good idea to check that the permissions cvs sets on the directories inside $CVSROOT are reasonable, and that they belong to the proper groups. See . If some of the files you want to import are binary, you may want to use the wrappers features to specify which files are binary and which are not. See . Creating Files From Other Version Control Systems Importing files, from other version control systems If you have a project which you are maintaining with another version control system, such as rcs, you may wish to put the files from that project into cvs, and preserve the revision history of the files. RCS, importing files fromFrom RCS If you have been using rcs, find the rcsfiles—usually a file named foo.c will have itsrcs file in RCS/foo.c,v (but it could beother places; consult the rcs documentation fordetails). Then create the appropriate directories incvs if they do not already exist. Then copy thefiles into the appropriate directories in the cvsrepository (the name in the repository must be the nameof the source file with ‘,v’ added; the files godirectly in the appropriate directory of the repository,not in an RCS subdirectory). This is one of thefew times when it is a good idea to access the cvsrepository directly, rather than using cvscommands. Then you are ready to check out a newworking directory. The rcs file should not be locked when you move itinto cvs; if it is, cvs will have troubleletting you operate on it. From another version control system Many version control systems have the ability to exportrcs files in the standard format. If yours does,export the rcs files and then follow the aboveinstructions.Failing that, probably your best bet is to write ascript that will check out the files one revision at atime using the command line interface to the othersystem, and then check the revisions into cvs.The sccs2rcs script mentioned below may be auseful example to follow. SCCS, importing files from From SCCS There is a script in the contrib directory ofthe cvs source distribution called sccs2rcswhich converts sccs files to rcs files.Note: you must run it on a machine which has bothsccs and rcs installed, and like everythingelse in contrib it is unsupported (your mileage mayvary). PVCS, importing files from From PVCS There is a script in the contrib directory ofthe cvs source distribution called pvcs_to_rcswhich converts pvcs archives to rcs files.You must run it on a machine which has bothpvcs and rcs installed, and like everythingelse in contrib it is unsupported (your mileage mayvary). See the comments in the script for details. Creating a directory tree from scratch For a new project, the easiest thing to do is probably to create an empty directory structure, like this: $ mkdir tc $ mkdir tc/man $ mkdir tc/testing After that, you use the import command to create the corresponding (empty) directory structure inside the repository: $ cd tc $ cvs import -m "Created directory structure" yoyodyne/dir yoyo start This will add yoyodyne/dir as a directory under $CVSROOT. Use checkout to get the new project. Then, use add to add files (and new directories) as needed. $ cd .. $ cvs co yoyodyne/dir Check that the permissions cvs sets on the directories inside $CVSROOT are reasonable. Defining the module Defining a module Editing the modules file Module, defining Modules file, changing The next step is to define the module in the modules file. This is not strictly necessary, but modules can be convenient in grouping together related files and directories. In simple cases these steps are sufficient to define a module. Get a working copy of the modules file. $ cvs checkout CVSROOT/modules $ cd CVSROOT Edit the file and insert a line that defines the module. See , for an introduction. See , for a fulldescription of the modules file. You can use thefollowing line to define the module ‘tc’: tc yoyodyne/tc Commit your changes to the modules file. $ cvs commit -m "Added the tc module." modules Release the modules module. $ cd .. $ cvs release -d CVSROOT Revisions For many uses of cvs, one doesn't need to worry too much about revision numbers; cvs assigns numbers such as 1.1, 1.2, and so on, and that is all one needs to know. However, some people prefer to have more knowledge and control concerning how cvs assigns revision numbers. If one wants to keep track of a set of revisions involving more than one file, such as which revisions went into a particular release, one uses a tag, which is a symbolic revision which can be assigned to a numeric revision in each file. Revision numbers Revision numbers Revision tree Linear development Number, revision- Decimal revision number Branch number Number, branch Each version of a file has a unique revision number. Revision numbers look like ‘1.1’, ‘1.2’, ‘1.3.2.2’ or even ‘1.3.2.2.4.5’. A revision number always has an even number of period-separated decimal integers. By default revision 1.1 is the first revision of a file. Each successive revision is given a new number by increasing the rightmost number by one. The following figure displays a few revisions, with newer revisions to the right. +-----+ +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! +-----+ +-----+ +-----+ +-----+ +-----+ It is also possible to end up with numbers containing more than one period, for example ‘1.3.2.2’. Such revisions represent revisions on branches (see ); such revision numbers are explained in detail in . Versions, revisions and releases Revisions, versions and releases Versions, revisions and releases Releases, revisions and versions A file can have several versions, as described above. Likewise, a software product can have several versions. A software product is often given a version number such as ‘4.1.1’. Versions in the first sense are called revisions in this document, and versions in the second sense are called releases. To avoid confusion, the word version is almost never used in this document. Assigning revisions By default, cvs will assign numeric revisions by leaving the first number the same and incrementing the second number. For example, 1.1, 1.2, 1.3, etc. When adding a new file, the second number will always be one and the first number will equal the highest first number of any file in that directory. For example, the current directory contains files whose highest numbered revisions are 1.7, 3.1, and 4.12, then an added file will be given the numeric revision 4.1. (When using client/server cvs, only files that are actually sent to the server are considered.) Normally there is no reason to care about the revision numbers—it is easier to treat them as internal numbers that cvs maintains, and tags provide a better way to distinguish between things like release 1 versus release 2 of your product (see ). However, if you want to set the numeric revisions, the ‘-r’ option to cvs commit can do that. The ‘-r’ option implies the ‘-f’ option, in the sense that it causes the files to be committed even if they are not modified. For example, to bring all your files up to revision 3.0 (including those that haven't changed), you might invoke: $ cvs commit -r 3.0 Note that the number you specify with ‘-r’ must be larger than any existing revision number. That is, if revision 3.0 exists, you cannot ‘cvs commit -r 1.3’. If you want to maintain several releases in parallel, you need to use a branch (see ). Tags–Symbolic revisions Tags The revision numbers live a life of their own. They need not have anything at all to do with the release numbers of your software product. Depending on how you use cvs the revision numbers might change several times between two releases. As an example, some of the source files that make up rcs 5.6 have the following revision numbers: RCS revision numbers ci.c 5.21 co.c 5.9 ident.c 5.3 rcs.c 5.12 rcsbase.h 5.11 rcsdiff.c 5.10 rcsedit.c 5.11 rcsfcmp.c 5.9 rcsgen.c 5.10 rcslex.c 5.11 rcsmap.c 5.2 rcsutil.c 5.10 tag, command, introduction Tag, symbolic name Symbolic name (tag) Name, symbolic (tag) HEAD, as reserved tag name BASE, as reserved tag name You can use the tag command to give a symbolic name to a certain revision of a file. You can use the ‘-v’ flag to the status command to see all tags that a file has, and which revision numbers they represent. Tag names must start with an uppercase or lowercase letter and can contain uppercase and lowercase letters, digits, ‘-’, and ‘_’. The two tag names BASE and HEAD are reserved for use by cvs. It is expected that future names which are special to cvs will be specially named, for example by starting with ‘.’, rather than being named analogously to BASE and HEAD, to avoid conflicts with actual tag names. You'll want to choose some convention for naming tags, based on information such as the name of the program and the version number of the release. For example, one might take the name of the program, immediately followed by the version number with ‘.’ changed to ‘-’, so that cvs 1.9 would be tagged with the name cvs1-9. If you choose a consistent convention, then you won't constantly be guessing whether a tag is cvs-1-9 or cvs1_9 or what. You might even want to consider enforcing your convention in the taginfo file (see ). Adding a tag Tag, example The following example shows how you can add a tag to a file. The commands must be issued inside your working directory. That is, you should issue the command in the directory where backend.c resides. $ cvs tag rel-0-4 backend.c T backend.c $ cvs status -v backend.c =================================================================== File: backend.c Status: Up-to-date Version: 1.4 Tue Dec 1 14:39:01 1992 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none) Existing Tags: rel-0-4 (revision: 1.4) For a complete summary of the syntax of cvs tag, including the various options, see . There is seldom reason to tag a file in isolation. A more common use is to tag all the files that constitute a module with the same tag at strategic points in the development life-cycle, such as when a release is made. $ cvs tag rel-1-0 . cvs tag: Tagging . T Makefile T backend.c T driver.c T frontend.c T parser.c (When you give cvs a directory as argument, it generally applies the operation to all the files in that directory, and (recursively), to any subdirectories that it may contain. See .) Retrieving an old revision using tags Tag, retrieving old revisions The checkout command has a flag, ‘-r’, that lets you check out a certain revision of a module. This flag makes it easy to retrieve the sources that make up release 1.0 of the module ‘tc’ at any time in the future: $ cvs checkout -r rel-1-0 tc This is useful, for instance, if someone claims that there is a bug in that release, but you cannot find the bug in the current working copy. You can also check out a module as it was at any given date. See . When specifying ‘-r’ to any of these commands, you will need beware of sticky tags; see . When you tag more than one file with the same tag you can think about the tag as "a curve drawn through a matrix of filename vs. revision number." Say we have 5 files with the following revisions: file1 file2 file3 file4 file5 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG 1.2*- 1.2 1.2 -1.2*- 1.3 \- 1.3*- 1.3 / 1.3 1.4 \ 1.4 / 1.4 \-1.5*- 1.5 1.6 At some time in the past, the * versions were tagged. You can think of the tag as a handle attached to the curve drawn through the tagged revisions. When you pull on the handle, you get all the tagged revisions. Another way to look at it is that you "sight" through a set of revisions that is "flat" along the tagged revisions, like this: file1 file2 file3 file4 file5 1.1 1.2 1.1 1.3 _ 1.1 1.2 1.4 1.1 / 1.2*----1.3*----1.5*----1.2*----1.1 (--- <--- Look here 1.3 1.6 1.3 \_ 1.4 1.4 1.5 Specifying what to tag from the working directory tag (subcommand) The example in the previous section demonstrates one of the most common ways to choose which revisions to tag. Namely, running the cvs tag command without arguments causes cvs to select the revisions which are checked out in the current working directory. For example, if the copy of backend.c in working directory was checked out from revision 1.4, then cvs will tag revision 1.4. Note that the tag is applied immediately to revision 1.4 in the repository; tagging is not like modifying a file, or other operations in which one first modifies the working directory and then runs cvs commit to transfer that modification to the repository. One potentially surprising aspect of the fact that cvs tag operates on the repository is that you are tagging the checked-in revisions, which may differ from locally modified files in your working directory. If you want to avoid doing this by mistake, specify the ‘-c’ option to cvs tag. If there are any locally modified files, cvs will abort with an error before it tags any files: $ cvs tag -c rel-0-4 cvs tag: backend.c is locally modified cvs [tag aborted]: correct the above errors first! Specifying what to tag by date or revision rtag (subcommand) The cvs rtag command tags the repository as of a certain date or time (or can be used to tag the latest revision). rtag works directly on the repository contents (it requires no prior checkout and does not look for a working directory). The following options specify which date or revision to tag. See , for a complete description of them. -D date Tag the most recent revision no later than date. -f Only useful with the ‘-D date’ or ‘-r tag’flags. If no matching revision is found, use the mostrecent revision (instead of ignoring the file). -r tag Only tag those files that contain existing tag tag. The cvs tag command also allows one to specify files by revision or date, using the same ‘-r’, ‘-D’, and ‘-f’ options. However, this feature is probably not what you want. The reason is that cvs tag chooses which files to tag based on the files that exist in the working directory, rather than the files which existed as of the given tag/date. Therefore, you are generally better off using cvs rtag. The exceptions might be cases like: cvs tag -r 1.4 backend.c Deleting, moving, and renaming tags Normally one does not modify tags. They exist in order to record the history of the repository and so deleting them or changing their meaning would, generally, not be what you want. However, there might be cases in which one uses a tag temporarily or accidentally puts one in the wrong place. Therefore, one might delete, move, or rename a tag. WARNING: the commands in this section are dangerous; they permanently discard historical information and it can be difficult or impossible to recover from errors. If you are a cvs administrator, you may consider restricting these commands with the taginfo file (see ). Deleting tags Deleting branch tags Removing tags Removing branch tags Tags, deleting Branch tags, deleting To delete a tag, specify the ‘-d’ option to either cvs tag or cvs rtag. For example: cvs rtag -d rel-0-4 tc deletes the non-branch tag rel-0-4 from the module tc. In the event that branch tags are encountered within the repository with the given name, a warning message will be issued and the branch tag will not be deleted. If you are absolutely certain you know what you are doing, the -B option may be specified to allow deletion of branch tags. In that case, any non-branch tags encountered will trigger warnings and will not be deleted. WARNING: Moving branch tags is very dangerous! If you think you need the -B option, think again and ask your cvs administrator about it (if that isn't you). There is almost certainly another way to accomplish what you want to accomplish. Moving tags Moving branch tags Tags, moving Branch tags, moving When we say move a tag, we mean to make the same name point to different revisions. For example, the stable tag may currently point to revision 1.4 of backend.c and perhaps we want to make it point to revision 1.6. To move a non-branch tag, specify the ‘-F’ option to either cvs tag or cvs rtag. For example, the task just mentioned might be accomplished as: cvs tag -r 1.6 -F stable backend.c If any branch tags are encountered in the repository with the given name, a warning is issued and the branch tag is not disturbed. If you are absolutely certain you wish to move the branch tag, the -B option may be specified. In that case, non-branch tags encountered with the given name are ignored with a warning message. WARNING: Moving branch tags is very dangerous! If you think you need the -B option, think again and ask your cvs administrator about it (if that isn't you). There is almost certainly another way to accomplish what you want to accomplish. Renaming tags Tags, renaming When we say rename a tag, we mean to make a different name point to the same revisions as the old tag. For example, one may have misspelled the tag name and want to correct it (hopefully before others are relying on the old spelling). To rename a tag, first create a new tag using the ‘-r’ option to cvs rtag, and then delete the old name. (Caution: this method will not work with branch tags.) This leaves the new tag on exactly the same files as the old tag. For example: cvs rtag -r old-name-0-4 rel-0-4 tc cvs rtag -d old-name-0-4 tc Tagging and adding and removing files The subject of exactly how tagging interacts with adding and removing files is somewhat obscure; for the most part cvs will keep track of whether files exist or not without too much fussing. By default, tags are applied to only files which have a revision corresponding to what is being tagged. Files which did not exist yet, or which were already removed, simply omit the tag, and cvs knows to treat the absence of a tag as meaning that the file didn't exist as of that tag. However, this can lose a small amount of information. For example, suppose a file was added and then removed. Then, if the tag is missing for that file, there is no way to know whether the tag refers to the time before the file was added, or the time after it was removed. If you specify the ‘-r’ option to cvs rtag, then cvs tags the files which have been removed, and thereby avoids this problem. For example, one might specify -r HEAD to tag the head. On the subject of adding and removing files, the cvs rtag command has a ‘-a’ option which means to clear the tag from removed files that would not otherwise be tagged. For example, one might specify this option in conjunction with ‘-F’ when moving a tag. If one moved a tag without ‘-a’, then the tag in the removed files might still refer to the old revision, rather than reflecting the fact that the file had been removed. I don't think this is necessary if ‘-r’ is specified, as noted above. Sticky tags Sticky tags Tags, sticky Sometimes a working copy's revision has extra data associated with it, for example it might be on a branch (see ), or restricted to versions prior to a certain date by ‘checkout -D’ or ‘update -D’. Because this data persists – that is, it applies to subsequent commands in the working copy – we refer to it as sticky. Most of the time, stickiness is an obscure aspect of cvs that you don't need to think about. However, even if you don't want to use the feature, you may need to know something about sticky tags (for example, how to avoid them!). You can use the status command to see if any sticky tags or dates are set: $ cvs status driver.c =================================================================== File: driver.c Status: Up-to-date Version: 1.7.2.1 Sat Dec 5 19:35:03 1992 RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v Sticky Tag: rel-1-0-patches (branch: 1.7.2) Sticky Date: (none) Sticky Options: (none) Resetting sticky tags Sticky tags, resetting Deleting sticky tags The sticky tags will remain on your working files until you delete them with ‘cvs update -A’. The ‘-A’ option merges local changes into the version of the file from the head of the trunk, removing any sticky tags, dates, or options (other than sticky ‘-k’ options on locally modified files). See for more on the operation of cvs update. Sticky date The most common use of sticky tags is to identify which branch one is working on, as described in . However, non-branch sticky tags have uses as well. For example, suppose that you want to avoid updating your working directory, to isolate yourself from possibly destabilizing changes other people are making. You can, of course, just refrain from running cvs update. But if you want to avoid updating only a portion of a larger tree, then sticky tags can help. If you check out a certain revision (such as 1.4) it will become sticky. Subsequent cvs update commands will not retrieve the latest revision until you reset the tag with cvs update -A. Likewise, use of the ‘-D’ option to update or checkout sets a sticky date, which, similarly, causes that date to be used for future retrievals. People often want to retrieve an old version of a file without setting a sticky tag. This can be done with the ‘-p’ option to checkout or update, which sends the contents of the file to standard output. For example: $ cvs update -p -r 1.1 file1 >file1 =================================================================== Checking out file1 RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v VERS: 1.1 *************** $ However, this isn't the easiest way, if you are asking how to undo a previous checkin (in this example, put file1 back to the way it was as of revision 1.1). In that case you are better off using the ‘-j’ option to update; for further discussion see . Branching and merging Branching Merging Copying changes Main trunk and branches Revision tree, making branches Branches, copying changes between Changes, copying between branches Modifications, copying between branches cvs allows you to isolate changes onto a separate line of development, known as a branch. When you change files on a branch, those changes do not appear on the main trunk or other branches. Later you can move changes from one branch to another branch (or the main trunk) by merging. Merging involves first running cvs update -j, to merge the changes into the working directory. You can then commit that revision, and thus effectively copy the changes onto another branch. What branches are good for Branches motivation What branches are good for Motivation for branches Suppose that release 1.0 of tc has been made. You are continuing to develop tc, planning to create release 1.1 in a couple of months. After a while your customers start to complain about a fatal bug. You check out release 1.0 (see ) and find the bug (which turns out to have a trivial fix). However, the current revision of the sources are in a state of flux and are not expected to be stable for at least another month. There is no way to make a bug fix release based on the newest sources. The thing to do in a situation like this is to create a branch on the revision trees for all the files that make up release 1.0 of tc. You can then make modifications to the branch without disturbing the main trunk. When the modifications are finished you can elect to either incorporate them on the main trunk, or leave them on the branch. Creating a branch Creating a branch Branch, creating a tag, creating a branch using rtag, creating a branch using You can create a branch with tag -b; for example, assuming you're in a working copy: $ cvs tag -b rel-1-0-patches This splits off a branch based on the current revisions in the working copy, assigning that branch the name ‘rel-1-0-patches’. It is important to understand that branches get created in the repository, not in the working copy. Creating a branch based on current revisions, as the above example does, will not automatically switch the working copy to be on the new branch. For information on how to do that, see . You can also create a branch without reference to any working copy, by using rtag: $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc -r rel-1-0’ says that this branch should be rooted at the revision that corresponds to the tag ‘rel-1-0’. It need not be the most recent revision – it's often useful to split a branch off an old revision (for example, when fixing a bug in a past release otherwise known to be stable). As with ‘tag’, the ‘-b’ flag tells rtag to create a branch (rather than just a symbolic revision name). Note that the numeric revision number that matches ‘rel-1-0’ will probably be different from file to file. So, the full effect of the command is to create a new branch – named ‘rel-1-0-patches’ – in module ‘tc’, rooted in the revision tree at the point tagged by ‘rel-1-0’. Accessing branches Check out a branch Retrieve a branch Access a branch Identifying a branch Branch, check out Branch, retrieving Branch, accessing Branch, identifying You can retrieve a branch in one of two ways: by checking it out fresh from the repository, or by switching an existing working copy over to the branch. To check out a branch from the repository, invoke ‘checkout’ with the ‘-r’ flag, followed by the tag name of the branch (see ): $ cvs checkout -r rel-1-0-patches tc Or, if you already have a working copy, you can switch it to a given branch with ‘update -r’: $ cvs update -r rel-1-0-patches tc or equivalently: $ cd tc $ cvs update -r rel-1-0-patches It does not matter if the working copy was originally on the main trunk or on some other branch – the above command will switch it to the named branch. And similarly to a regular ‘update’ command, ‘update -r’ merges any changes you have made, notifying you of conflicts where they occur. Once you have a working copy tied to a particular branch, it remains there until you tell it otherwise. This means that changes checked in from the working copy will add new revisions on that branch, while leaving the main trunk and other branches unaffected. Branches, sticky To find out what branch a working copy is on, you can use the ‘status’ command. In its output, look for the field named ‘Sticky tag’ (see ) – that's cvs's way of telling you the branch, if any, of the current working files: $ cvs status -v driver.c backend.c =================================================================== File: driver.c Status: Up-to-date Version: 1.7 Sat Dec 5 18:25:54 1992 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v Sticky Tag: rel-1-0-patches (branch: 1.7.2) Sticky Date: (none) Sticky Options: (none) Existing Tags: rel-1-0-patches (branch: 1.7.2) rel-1-0 (revision: 1.7) =================================================================== File: backend.c Status: Up-to-date Version: 1.4 Tue Dec 1 14:39:01 1992 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v Sticky Tag: rel-1-0-patches (branch: 1.4.2) Sticky Date: (none) Sticky Options: (none) Existing Tags: rel-1-0-patches (branch: 1.4.2) rel-1-0 (revision: 1.4) rel-0-4 (revision: 1.4) Don't be confused by the fact that the branch numbers for each file are different (‘1.7.2’ and ‘1.4.2’ respectively). The branch tag is the same, ‘rel-1-0-patches’, and the files are indeed on the same branch. The numbers simply reflect the point in each file's revision history at which the branch was made. In the above example, one can deduce that ‘driver.c’ had been through more changes than ‘backend.c’ before this branch was created. See for details about how branch numbers are constructed. Branches and revisions Branch number Number, branch Revision numbers (branches) Ordinarily, a file's revision history is a linear series of increments (see ): +-----+ +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! +-----+ +-----+ +-----+ +-----+ +-----+ However, cvs is not limited to linear development. The revision tree can be split into branches, where each branch is a self-maintained line of development. Changes made on one branch can easily be moved back to the main trunk. Each branch has a branch number, consisting of an odd number of period-separated decimal integers. The branch number is created by appending an integer to the revision number where the corresponding branch forked off. Having branch numbers allows more than one branch to be forked off from a certain revision. All revisions on a branch have revision numbers formed by appending an ordinal number to the branch number. The following figure illustrates branching with an example. +-------------+ Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 ! / +-------------+ / / +---------+ +---------+ +---------+ Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! / +---------+ +---------+ +---------+ / / +-----+ +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk +-----+ +-----+ +-----+ +-----+ +-----+ ! ! ! +---------+ +---------+ +---------+ Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 ! +---------+ +---------+ +---------+ The exact details of how the branch number is constructed is not something you normally need to be concerned about, but here is how it works: When cvs creates a branch number it picks the first unused even integer, starting with 2. So when you want to create a branch from revision 6.4 it will be numbered 6.4.2. All branch numbers ending in a zero (such as 6.4.0) are used internally by cvs (see ). The branch 1.1.1 has a special meaning. See . Magic branch numbers This section describes a cvs feature called magic branches. For most purposes, you need not worry about magic branches; cvs handles them for you. However, they are visible to you in certain circumstances, so it may be useful to have some idea of how it works. Externally, branch numbers consist of an odd number of dot-separated decimal integers. See . That is not the whole truth, however. For efficiency reasons cvs sometimes inserts an extra 0 in the second rightmost position (1.2.4 becomes 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so on). cvs does a pretty good job at hiding these so called magic branches, but in a few places the hiding is incomplete: The magic branch number appears in the output fromcvs log. You cannot specify a symbolic branch name to cvsadmin. You can use the admin command to reassign a symbolic name to a branch the way rcs expects it to be. If R4patches is assigned to the branch 1.4.2 (magic branch number 1.4.0.2) in file numbers.c you can do this: $ cvs admin -NR4patches:1.4.2 numbers.c It only works if at least one revision is already committed on the branch. Be very careful so that you do not assign the tag to the wrong number. (There is no way to see how the tag was assigned yesterday). Merging an entire branch Merging a branch -j (merging branches) You can merge changes made on a branch into your working copy by giving the ‘-j branchname’ flag to the update subcommand. With one ‘-j branchname’ option it merges the changes made between the greatest common ancestor (GCA) of the branch and the destination revision (in the simple case below the GCA is the point where the branch forked) and the newest revision on that branch into your working copy. Join The ‘-j’ stands for “join”. Branch merge example Example, branch merge Merge, branch example Consider this revision tree: +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk +-----+ +-----+ +-----+ +-----+ ! ! ! +---------+ +---------+ Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! +---------+ +---------+ The branch 1.2.2 has been given the tag (symbolic name) ‘R1fix’. The following example assumes that the module ‘mod’ contains only one file, m.c. $ cvs checkout mod # Retrieve the latest revision, 1.4 $ cvs update -j R1fix m.c # Merge all changes made on the branch, # i.e. the changes between revision 1.2 # and 1.2.2.2, into your working copy # of the file. $ cvs commit -m "Included R1fix" # Create revision 1.5. A conflict can result from a merge operation. If that happens, you should resolve it before committing the new revision. See . If your source files contain keywords (see ), you might be getting more conflicts than strictly necessary. See , for information on how to avoid this. The checkout command also supports the ‘-j branchname’ flag. The same effect as above could be achieved with this: $ cvs checkout -j R1fix mod $ cvs commit -m "Included R1fix" It should be noted that update -j tagname will also work but may not produce the desired result. See , for more. Merging from a branch several times Continuing our example, the revision tree now looks like this: +-----+ +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk +-----+ +-----+ +-----+ +-----+ +-----+ ! * ! * ! +---------+ +---------+ Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! +---------+ +---------+ where the starred line represents the merge from the ‘R1fix’ branch to the main trunk, as just discussed. Now suppose that development continues on the ‘R1fix’ branch: +-----+ +-----+ +-----+ +-----+ +-----+ ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk +-----+ +-----+ +-----+ +-----+ +-----+ ! * ! * ! +---------+ +---------+ +---------+ Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! +---------+ +---------+ +---------+ and then you want to merge those new changes onto the main trunk. If you just use the cvs update -j R1fix m.c command again, cvs will attempt to merge again the changes which you have already merged, which can have undesirable side effects. So instead you need to specify that you only want to merge the changes on the branch which have not yet been merged into the trunk. To do that you specify two ‘-j’ options, and cvs merges the changes from the first revision to the second revision. For example, in this case the simplest way would be cvs update -j 1.2.2.2 -j R1fix m.c # Merge changes from 1.2.2.2 to the # head of the R1fix branch The problem with this is that you need to specify the 1.2.2.2 revision manually. A slightly better approach might be to use the date the last merge was done: cvs update -j R1fix:yesterday -j R1fix m.c Better yet, tag the R1fix branch after every merge into the trunk, and then use that tag for subsequent merges: cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c Merging differences between any two revisions Merging two revisions Revisions, merging differences between Differences, merging With two ‘-j revision’ flags, the update (and checkout) command can merge the differences between any two revisions into your working file. Undoing a change Removing a change $ cvs update -j 1.5 -j 1.3 backend.c will undo all changes made between revision 1.3 and 1.5. Note the order of the revisions! If you try to use this option when operating on multiple files, remember that the numeric revisions will probably be very different between the various files. You almost always use symbolic tags rather than revision numbers when operating on multiple files. Restoring old version of removed file Resurrecting old version of dead file Specifying two ‘-j’ options can also undo file removals or additions. For example, suppose you have a file named file1 which existed as revision 1.1, and you then removed it (thus adding a dead revision 1.2). Now suppose you want to add it again, with the same contents it had previously. Here is how to do it: $ cvs update -j 1.2 -j 1.1 file1 U file1 $ cvs commit -m test Checking in file1; /tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 new revision: 1.3; previous revision: 1.2 done $ Merging can add or remove files If the changes which you are merging involve removing or adding some files, update -j will reflect such additions or removals. For example: cvs update -A touch a b c cvs add a b c ; cvs ci -m "added" a b c cvs tag -b branchtag cvs update -r branchtag touch d ; cvs add d rm a ; cvs rm a cvs ci -m "added d, removed a" cvs update -A cvs update -jbranchtag After these commands are executed and a ‘cvs commit’ is done, file a will be removed and file d added in the main branch. Note that using a single static tag (‘-j tagname’) rather than a dynamic tag (‘-j branchname’) to merge changes from a branch will usually not remove files which were removed on the branch since cvs does not automatically add static tags to dead revisions. The exception to this rule occurs when a static tag has been attached to a dead revision manually. Use the branch tag to merge all changes from the branch or use two static tags as merge endpoints to be sure that all intended changes are propagated in the merge. Merging and keywords Merging, and keyword substitution Keyword substitution, and merging -j (merging branches), and keyword substitution -kk, to avoid conflicts during a merge If you merge files containing keywords (see ), you will normally get numerous conflicts during the merge, because the keywords are expanded differently in the revisions which you are merging. Therefore, you will often want to specify the ‘-kk’ (see ) switch to the merge command line. By substituting just the name of the keyword, not the expanded value of that keyword, this option ensures that the revisions which you are merging will be the same as each other, and avoid spurious conflicts. For example, suppose you have a file like this: +---------+ _! 1.1.2.1 ! <- br1 / +---------+ / / +-----+ +-----+ ! 1.1 !----! 1.2 ! +-----+ +-----+ and your working directory is currently on the trunk (revision 1.2). Then you might get the following results from a merge: $ cat file1 key $Revision: 1.2 $ . . . $ cvs update -j br1 U file1 RCS file: /cvsroot/first-dir/file1,v retrieving revision 1.1 retrieving revision 1.1.2.1 Merging differences between 1.1 and 1.1.2.1 into file1 rcsmerge: warning: conflicts during merge $ cat file1 <<<<<<< file1 key $Revision: 1.2 $ ======= key $Revision: 1.1.2.1 $ >>>>>>> 1.1.2.1 . . . What happened was that the merge tried to merge the differences between 1.1 and 1.1.2.1 into your working directory. So, since the keyword changed from Revision: 1.1 to Revision: 1.1.2.1, cvs tried to merge that change into your working directory, which conflicted with the fact that your working directory had contained Revision: 1.2. Here is what happens if you had used ‘-kk’: $ cat file1 key $Revision: 1.2 $ . . . $ cvs update -kk -j br1 U file1 RCS file: /cvsroot/first-dir/file1,v retrieving revision 1.1 retrieving revision 1.1.2.1 Merging differences between 1.1 and 1.1.2.1 into file1 $ cat file1 key $Revision$ . . . What is going on here is that revision 1.1 and 1.1.2.1 both expand as plain Revision, and therefore merging the changes between them into the working directory need not change anything. Therefore, there is no conflict. There is, however, one major caveat with using ‘-kk’ on merges. Namely, it overrides whatever keyword expansion mode cvs would normally have used. In particular, this is a problem if the mode had been ‘-kb’ for a binary file. Therefore, if your repository contains binary files, you will need to deal with the conflicts rather than using ‘-kk’. As a result of using ‘-kk’ during the merge, each file examined by the update will have ‘-kk’ set as sticky options. Running update -A will clear the sticky options on unmodified files, but it will not clear the sticky options on modified files. To get back to the default keyword substitution for modified files, you must commit the results of the merge and then run update -A. Recursive behavior Recursive (directory descending) Directory, descending Descending directories Subdirectories Almost all of the subcommands of cvs work recursively when you specify a directory as an argument. For instance, consider this directory structure: $HOME | +--tc | | +--CVS | (internal cvs files) +--Makefile +--backend.c +--driver.c +--frontend.c +--parser.c +--man | | | +--CVS | | (internal cvs files) | +--tc.1 | +--testing | +--CVS | (internal cvs files) +--testpgm.t +--test2.t If tc is the current working directory, the following is true: cvs update testing’ is equivalent to cvs update testing/testpgm.t testing/test2.t cvs update testing man’ updates all files in thesubdirectories cvs update .’ or just ‘cvs update’ updatesall files in the tc directory If no arguments are given to update it will update all files in the current working directory and all its subdirectories. In other words, . is a default argument to update. This is also true for most of the cvs subcommands, not only the update command. The recursive behavior of the cvs subcommands can be turned off with the ‘-l’ option. Conversely, the ‘-R’ option can be used to force recursion if ‘-l’ is specified in ~/.cvsrc (see ). $ cvs update -l # Don't update files in subdirectories Adding, removing, and renaming files and directories In the course of a project, one will often add new files. Likewise with removing or renaming, or with directories. The general concept to keep in mind in all these cases is that instead of making an irreversible change you want cvs to record the fact that a change has taken place, just as with modifying an existing file. The exact mechanisms to do this in cvs vary depending on the situation. Adding files to a directory Adding files To add a new file to a directory, follow these steps. You must have a working copy of the directory.See . Create the new file inside your working copy of the directory. Use ‘cvs add filename’ to tell cvs that youwant to version control the file. If the file containsbinary data, specify ‘-kb’ (see ). Use ‘cvs commit filename’ to actually checkin the file into the repository. Other developerscannot see the file until you perform this step. You can also use the add command to add a new directory. Unlike most other commands, the add command is not recursive. You have to expcicitly name files and directories that you wish to add to the repository. However, each directory will need to be added separately before you will be able to add new files to those directories. $ mkdir -p foo/bar $ cp ~/myfile foo/bar/myfile $ cvs add foo foo/bar $ cvs add foo/bar/myfile add (subcommand) cvs add — Command: cvs add [ -k kflag ] [ -m message ] files Schedule files to be added to the repository.The files or directories specified with add mustalready exist in the current directory. To add a wholenew directory hierarchy to the source repository (forexample, files received from a third-party vendor), usethe import command instead. See .The added files are not placed in the source repositoryuntil you use commit to make the changepermanent. Doing an add on a file that wasremoved with the remove command will undo theeffect of the remove, unless a commitcommand intervened. See , for anexample.The ‘-k’ option specifies the default way thatthis file will be checked out; for more information see. The ‘-m’ option specifies a description for thefile. This description appears in the history log (ifit is enabled, see ). It will also besaved in the version history inside the repository whenthe file is committed. The log command displaysthis description. The description can be changed using‘admin -t’. See . If you omit the‘-m description’ flag, an empty string willbe used. You will not be prompted for a description. For example, the following commands add the file backend.c to the repository: $ cvs add backend.c $ cvs commit -m "Early version. Not yet compilable." backend.c When you add a file it is added only on the branch which you are working on (see ). You can later merge the additions to another branch if you want (see ). Removing files Removing files Deleting files Directories change. New files are added, and old files disappear. Still, you want to be able to retrieve an exact copy of old releases. Here is what you can do to remove a file, but remain able to retrieve old revisions: Make sure that you have not made any uncommittedmodifications to the file. See ,for one way to do that. You can also use thestatus or update command. If you removethe file without committing your changes, you will ofcourse not be able to retrieve the file as it wasimmediately before you deleted it. Remove the file from your working copy of the directory.You can for instance use rm. Use ‘cvs remove filename’ to tell cvs thatyou really want to delete the file. Use ‘cvs commit filename’ to actuallyperform the removal of the file from the repository. When you commit the removal of the file, cvs records the fact that the file no longer exists. It is possible for a file to exist on only some branches and not on others, or to re-add another file with the same name later. cvs will correctly create or not create the file, based on the ‘-r’ and ‘-D’ options specified to checkout or update. Remove (subcommand) cvs remove — Command: cvs remove [ options ] files Schedule file(s) to be removed from the repository(files which have not already been removed from theworking directory are not processed). This commanddoes not actually remove the file from the repositoryuntil you commit the removal. For a full list ofoptions, see . Here is an example of removing several files: $ cd test $ rm *.c $ cvs remove cvs remove: Removing . cvs remove: scheduling a.c for removal cvs remove: scheduling b.c for removal cvs remove: use 'cvs commit' to remove these files permanently $ cvs ci -m "Removed unneeded files" cvs commit: Examining . cvs commit: Committing . As a convenience you can remove the file and cvs remove it in one step, by specifying the ‘-f’ option. For example, the above example could also be done like this: $ cd test $ cvs remove -f *.c cvs remove: scheduling a.c for removal cvs remove: scheduling b.c for removal cvs remove: use 'cvs commit' to remove these files permanently $ cvs ci -m "Removed unneeded files" cvs commit: Examining . cvs commit: Committing . If you execute remove for a file, and then change your mind before you commit, you can undo the remove with an add command. $ ls CVS ja.h oj.c $ rm oj.c $ cvs remove oj.c cvs remove: scheduling oj.c for removal cvs remove: use 'cvs commit' to remove this file permanently $ cvs add oj.c U oj.c cvs add: oj.c, version 1.1.1.1, resurrected If you realize your mistake before you run the remove command you can use update to resurrect the file: $ rm oj.c $ cvs update oj.c cvs update: warning: oj.c was lost U oj.c When you remove a file it is removed only on the branch which you are working on (see ). You can later merge the removals to another branch if you want (see ). Removing directories Removing directories Directories, removing In concept, removing directories is somewhat similar to removing files—you want the directory to not exist in your current working directories, but you also want to be able to retrieve old releases in which the directory existed. The way that you remove a directory is to remove all the files in it. You don't remove the directory itself; there is no way to do that. Instead you specify the ‘-P’ option to cvs update or cvs checkout, which will cause cvs to remove empty directories from working directories. (Note that cvs export always removes empty directories.) Probably the best way to do this is to always specify ‘-P’; if you want an empty directory then put a dummy file (for example .keepme) in it to prevent ‘-P’ from removing it. Note that ‘-P’ is implied by the ‘-r’ or ‘-D’ options of checkout. This way, cvs will be able to correctly create the directory or not depending on whether the particular version you are checking out contains any files in that directory. Moving and renaming files Moving files Renaming files Files, moving Moving files to a different directory or renaming them is not difficult, but some of the ways in which this works may be non-obvious. (Moving or renaming a directory is even harder. See .). The examples below assume that the file old is renamed to new. The Normal way to Rename The normal way to move a file is to copy old to new, and then issue the normal cvs commands to remove old from the repository, and add new to it. $ mv old new $ cvs remove old $ cvs add new $ cvs commit -m "Renamed old to new" old new This is the simplest way to move a file, it is not error-prone, and it preserves the history of what was done. Note that to access the history of the file you must specify the old or the new name, depending on what portion of the history you are accessing. For example, cvs log old will give the log up until the time of the rename. When new is committed its revision numbers will start again, usually at 1.1, so if that bothers you, use the ‘-r rev’ option to commit. For more information see . Moving the history file This method is more dangerous, since it involves moving files inside the repository. Read this entire section before trying it out! $ cd $CVSROOT/dir $ mv old,v new,v Advantages: The log of changes is maintained intact. The revision numbers are not affected. Disadvantages: Old releases cannot easily be fetched from therepository. (The file will show up as new evenin revisions from the time before it was renamed). There is no log information of when the file was renamed. Nasty things might happen if someone accesses the history filewhile you are moving it. Make sure no one else runs any of the cvscommands while you move it. Copying the history file This way also involves direct modifications to the repository. It is safe, but not without drawbacks. # Copy the rcs file inside the repository $ cd $CVSROOT/dir $ cp old,v new,v # Remove the old file $ cd ~/dir $ rm old $ cvs remove old $ cvs commit old # Remove all tags from new $ cvs update new $ cvs log new # Remember the non-branch tag names $ cvs tag -d tag1 new $ cvs tag -d tag2 new By removing the tags you will be able to check out old revisions. Advantages: Checking out old revisions works correctly, as long asyou use ‘-rtag’ and not ‘-Ddate’to retrieve the revisions. The log of changes is maintained intact. The revision numbers are not affected. Disadvantages: You cannot easily see the history of the file across the rename. Moving and renaming directories Moving directories Renaming directories Directories, moving The normal way to rename or move a directory is to rename or move each file within it as described in . Then check out with the ‘-P’ option, as described in . If you really want to hack the repository to rename or delete a directory in the repository, you can do it like this: Inform everyone who has a checked out copy of the directory that thedirectory will be renamed. They should commit all their changes in all theircopies of the project containing the directory to be removed, and removeall their working copies of said project, before you take the steps below. Rename the directory inside the repository. $ cd $CVSROOT/parent-dir $ mv old-dir new-dir Fix the cvs administrative files, if necessary (forinstance if you renamed an entire module). Tell everyone that they can check out again and continueworking. If someone had a working copy the cvs commands will cease to work for him, until he removes the directory that disappeared inside the repository. It is almost always better to move the files in the directory instead of moving the directory. If you move the directory you are unlikely to be able to retrieve old releases correctly, since they probably depend on the name of the directories. History browsing History browsing Traceability Isolation Once you have used cvs to store a version control history—what files have changed when, how, and by whom, there are a variety of mechanisms for looking through the history. Log messages Whenever you commit a file you specify a log message. To look through the log messages which have been specified for every revision which has been committed, use the cvs log command (see ). The history database You can use the history file (see ) to log various cvs actions. To retrieve the information from the history file, use the cvs history command (see ). Note: you can control what is logged to this file by using the ‘LogHistory’ keyword in the CVSROOT/config file (see ). User-defined logging You can customize cvs to log various kinds of actions, in whatever manner you choose. These mechanisms operate by executing a script at various times. The script might append a message to a file listing the information and the programmer who created it, or send mail to a group of developers, or, perhaps, post a message to a particular newsgroup. To log commits, use the loginfo file (see ). To log tags, use the taginfo file (see ). To log commits, checkouts, exports, and tags, respectively, you can also use the ‘-i’, ‘-o’, ‘-e’, and ‘-t’ options in the modules file. For a more flexible way of giving notifications to various users, which requires less in the way of keeping centralized scripts up to date, use the cvs watch add command (see ); this command is useful even if you are not using cvs watch on. Handling binary files Binary files The most common use for cvs is to store text files. With text files, cvs can merge revisions, display the differences between revisions in a human-visible fashion, and other such operations. However, if you are willing to give up a few of these abilities, cvs can store binary files. For example, one might store a web site in cvs including both text files and binary images. The issues with binary files While the need to manage binary files may seem obvious if the files that you customarily work with are binary, putting them into version control does present some additional issues. One basic function of version control is to show the differences between two revisions. For example, if someone else checked in a new version of a file, you may wish to look at what they changed and determine whether their changes are good. For text files, cvs provides this functionality via the cvs diff command. For binary files, it may be possible to extract the two revisions and then compare them with a tool external to cvs (for example, word processing software often has such a feature). If there is no such tool, one must track changes via other mechanisms, such as urging people to write good log messages, and hoping that the changes they actually made were the changes that they intended to make. Another ability of a version control system is the ability to merge two revisions. For cvs this happens in two contexts. The first is when users make changes in separate working directories (see ). The second is when one merges explicitly with the ‘update -j’ command (see ). In the case of text files, cvs can merge changes made independently, and signal a conflict if the changes conflict. With binary files, the best that cvs can do is present the two different copies of the file, and leave it to the user to resolve the conflict. The user may choose one copy or the other, or may run an external merge tool which knows about that particular file format, if one exists. Note that having the user merge relies primarily on the user to not accidentally omit some changes, and thus is potentially error prone. If this process is thought to be undesirable, the best choice may be to avoid merging. To avoid the merges that result from separate working directories, see the discussion of reserved checkouts (file locking) in . To avoid the merges resulting from branches, restrict use of branches. How to store binary files There are two issues with using cvs to store binary files. The first is that cvs by default converts line endings between the canonical form in which they are stored in the repository (linefeed only), and the form appropriate to the operating system in use on the client (for example, carriage return followed by line feed for Windows NT). The second is that a binary file might happen to contain data which looks like a keyword (see ), so keyword expansion must be turned off. The ‘-kb’ option available with some cvs commands insures that neither line ending conversion nor keyword expansion will be done. Here is an example of how you can create a new file using the ‘-kb’ flag: $ echo '$Id$' > kotest $ cvs add -kb -m"A test file" kotest $ cvs ci -m"First checkin; contains a keyword" kotest If a file accidentally gets added without ‘-kb’, one can use the cvs admin command to recover. For example: $ echo '$Id$' > kotest $ cvs add -m"A test file" kotest $ cvs ci -m"First checkin; contains a keyword" kotest $ cvs admin -kb kotest $ cvs update -A kotest # For non-unix systems: # Copy in a good copy of the file from outside CVS $ cvs commit -m "make it binary" kotest When you check in the file kotest the file is not preserved as a binary file, because you did not check it in as a binary file. The cvs admin -kb command sets the default keyword substitution method for this file, but it does not alter the working copy of the file that you have. If you need to cope with line endings (that is, you are using cvs on a non-unix system), then you need to check in a new copy of the file, as shown by the cvs commit command above. On unix, the cvs update -A command suffices. (Note that you can use cvs log to determine the default keyword substitution method for a file and cvs status to determine the keyword substitution method for a working copy.) However, in using cvs admin -k to change the keyword expansion, be aware that the keyword expansion mode is not version controlled. This means that, for example, that if you have a text file in old releases, and a binary file with the same name in new releases, cvs provides no way to check out the file in text or binary mode depending on what version you are checking out. There is no good workaround for this problem. You can also set a default for whether cvs add and cvs import treat a file as binary based on its name; for example you could say that files who names end in ‘.exe’ are binary. See . There is currently no way to have cvs detect whether a file is binary based on its contents. The main difficulty with designing such a feature is that it is not clear how to distinguish between binary and non-binary files, and the rules to apply would vary considerably with the operating system. Multiple developers Multiple developers Team of developers File locking Locking files Working copy Reserved checkouts Unreserved checkouts RCS-style locking When more than one person works on a software project things often get complicated. Often, two people try to edit the same file simultaneously. One solution, known as file locking or reserved checkouts, is to allow only one person to edit each file at a time. This is the only solution with some version control systems, including rcs and sccs. Currently the usual way to get reserved checkouts with cvs is the cvs admin -l command (see ). This is not as nicely integrated into cvs as the watch features, described below, but it seems that most people with a need for reserved checkouts find it adequate. It also may be possible to use the watches features described below, together with suitable procedures (not enforced by software), to avoid having two people edit at the same time. The default model with cvs is known as unreserved checkouts. In this model, developers can edit their own working copy of a file simultaneously. The first person that commits his changes has no automatic way of knowing that another has started to edit it. Others will get an error message when they try to commit the file. They must then use cvs commands to bring their working copy up to date with the repository revision. This process is almost automatic. cvs also supports mechanisms which facilitate various kinds of communication, without actually enforcing rules like reserved checkouts do. The rest of this chapter describes how these various models work, and some of the issues involved in choosing between them. File status File status Status of a file Based on what operations you have performed on a checked out file, and what operations others have performed to that file in the repository, one can classify a file in a number of states. The states, as reported by the status command, are: Up-to-dateUp-to-date The file is identical with the latest revision in therepository for the branch in use. Locally Modified Locally ModifiedYou have edited the file, and not yet committed your changes. Locally Added Locally AddedYou have added the file with add, and not yetcommitted your changes. Locally Removed Locally RemovedYou have removed the file with remove, and not yetcommitted your changes. Needs Checkout Needs CheckoutSomeone else has committed a newer revision to therepository. The name is slightly misleading; you willordinarily use update rather thancheckout to get that newer revision. Needs Patch Needs Patch Like Needs Checkout, but the cvs server will senda patch rather than the entire file. Sending a patch orsending an entire file accomplishes the same thing. Needs Merge Needs MergeSomeone else has committed a newer revision to the repository, and youhave also made modifications to the file. Unresolved Conflict Unresolved Conflict A file with the same name as this new file has been added to the repositoryfrom a second workspace. This file will need to be moved out of the wayto allow an update to complete. File had conflicts on merge File had conflicts on merge This is like Locally Modified, except that a previousupdate command gave a conflict. If you have notalready done so, you need toresolve the conflict as described in . Unknown Unknowncvs doesn't know anything about this file. Forexample, you have created a new file and have not runadd. To help clarify the file status, status also reports the Working revision which is the revision that the file in the working directory derives from, and the Repository revision which is the latest revision in the repository for the branch in use. The options to status are listed in . For information on its Sticky tag and Sticky date output, see . For information on its Sticky options output, see the ‘-k’ option in . You can think of the status and update commands as somewhat complementary. You use update to bring your files up to date, and you can use status to give you some idea of what an update would do (of course, the state of the repository might change before you actually run update). In fact, if you want a command to display file status in a more brief format than is displayed by the status command, you can invoke update, to display file status $ cvs -n -q update The ‘-n’ option means to not actually do the update, but merely to display statuses; the ‘-q’ option avoids printing the name of each directory. For more information on the update command, and these options, see . Bringing a file up to date Bringing a file up to date Updating a file Merging a file Update, introduction When you want to update or merge a file, use the cvs update -d command. For files that are not up to date this is roughly equivalent to a checkout command: the newest revision of the file is extracted from the repository and put in your working directory. The -d option, not necessary with checkout, tells cvs that you wish it to create directories added by other developers. Your modifications to a file are never lost when you use update. If no newer revision exists, running update has no effect. If you have edited the file, and a newer revision is available, cvs will merge all changes into your working copy. For instance, imagine that you checked out revision 1.4 and started editing it. In the meantime someone else committed revision 1.5, and shortly after that revision 1.6. If you run update on the file now, cvs will incorporate all changes between revision 1.4 and 1.6 into your file. Overlap If any of the changes between 1.4 and 1.6 were made too close to any of the changes you have made, an overlap occurs. In such cases a warning is printed, and the resulting file includes both versions of the lines that overlap, delimited by special markers. See , for a complete description of the update command. Conflicts example Merge, an example Example of merge driver.c (merge example) Suppose revision 1.4 of driver.c contains this: #include <stdio.h> void main() { parse(); if (nerr == 0) gencode(); else fprintf(stderr, "No code generated.\n"); exit(nerr == 0 ? 0 : 1); } Revision 1.6 of driver.c contains this: #include <stdio.h> int main(int argc, char **argv) { parse(); if (argc != 1) { fprintf(stderr, "tc: No args expected.\n"); exit(1); } if (nerr == 0) gencode(); else fprintf(stderr, "No code generated.\n"); exit(!!nerr); } Your working copy of driver.c, based on revision 1.4, contains this before you run ‘cvs update’: #include <stdlib.h> #include <stdio.h> void main() { init_scanner(); parse(); if (nerr == 0) gencode(); else fprintf(stderr, "No code generated.\n"); exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } You run ‘cvs update’: $ cvs update driver.c RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v retrieving revision 1.4 retrieving revision 1.6 Merging differences between 1.4 and 1.6 into driver.c rcsmerge warning: overlaps during merge cvs update: conflicts found in driver.c C driver.c Conflicts (merge example) cvs tells you that there were some conflicts. Your original working file is saved unmodified in .#driver.c.1.4. The new version of driver.c contains this: #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { init_scanner(); parse(); if (argc != 1) { fprintf(stderr, "tc: No args expected.\n"); exit(1); } if (nerr == 0) gencode(); else fprintf(stderr, "No code generated.\n"); <<<<<<< driver.c exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); ======= exit(!!nerr); >>>>>>> 1.6 } Markers, conflict Conflict markers <<<<<<< >>>>>>> ======= Note how all non-overlapping modifications are incorporated in your working copy, and that the overlapping section is clearly marked with ‘<<<<<<<’, ‘=======’ and ‘>>>>>>>’. Resolving a conflict Conflict resolution You resolve the conflict by editing the file, removing the markers and the erroneous line. Suppose you end up with this file: #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { init_scanner(); parse(); if (argc != 1) { fprintf(stderr, "tc: No args expected.\n"); exit(1); } if (nerr == 0) gencode(); else fprintf(stderr, "No code generated.\n"); exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } You can now go ahead and commit this as revision 1.7. $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c Checking in driver.c; /usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c new revision: 1.7; previous revision: 1.6 done For your protection, cvs will refuse to check in a file if a conflict occurred and you have not resolved the conflict. Currently to resolve a conflict, you must change the timestamp on the file. In previous versions of cvs, you also needed to insure that the file contains no conflict markers. Because your file may legitimately contain conflict markers (that is, occurrences of ‘>>>>>>> ’ at the start of a line that don't mark a conflict), the current version of cvs will print a warning and proceed to check in the file. emerge If you use release 1.04 or later of pcl-cvs (a gnu Emacs front-end for cvs) you can use an Emacs package called emerge to help you resolve conflicts. See the documentation for pcl-cvs. Informing others about commits Informing others Spreading information Mail, automatic mail on commit It is often useful to inform others when you commit a new revision of a file. The ‘-i’ option of the modules file, or the loginfo file, can be used to automate this process. See . See . You can use these features of cvs to, for instance, instruct cvs to mail a message to all developers, or post a message to a local newsgroup. Several developers simultaneously attempting to run CVS Locks, cvs, introduction If several developers try to run cvs at the same time, one may get the following message: [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo #cvs.rfl, removing #cvs.wfl, removing #cvs.lock, removing cvs will try again every 30 seconds, and either continue with the operation or print the message again, if it still needs to wait. If a lock seems to stick around for an undue amount of time, find the person holding the lock and ask them about the cvs command they are running. If they aren't running a cvs command, look in the repository directory mentioned in the message and remove files which they own whose names start with #cvs.rfl, #cvs.wfl, or #cvs.lock. Note that these locks are to protect cvs's internal data structures and have no relationship to the word lock in the sense used by rcs—which refers to reserved checkouts (see ). Any number of people can be reading from a given repository at a time; only when someone is writing do the locks prevent other people from reading or writing. Atomic transactions, lack of Transactions, atomic, lack of One might hope for the following property: If someone commits some changes in one cvs command, then an update by someone else will either get all the changes, or none of them. but cvs does not have this property. For example, given the files a/one.c a/two.c b/three.c b/four.c if someone runs cvs ci a/two.c b/three.c and someone else runs cvs update at the same time, the person running update might get only the change to b/three.c and not the change to a/two.c. Mechanisms to track who is editing files Watches For many groups, use of cvs in its default mode is perfectly satisfactory. Users may sometimes go to check in a modification only to find that another modification has intervened, but they deal with it and proceed with their check in. Other groups prefer to be able to know who is editing what files, so that if two people try to edit the same file they can choose to talk about who is doing what when rather than be surprised at check in time. The features in this section allow such coordination, while retaining the ability of two developers to edit the same file at the same time. For maximum benefit developers should use cvs edit (not chmod) to make files read-write to edit them, and cvs release (not rm) to discard a working directory which is no longer in use, but cvs is not able to enforce this behavior. Telling CVS to watch certain files To enable the watch features, you first specify that certain files are to be watched. watch on (subcommand) cvs watch on — Command: cvs watch on [ -lR ] [ files ] Read-only files, and watchesSpecify that developers should run cvs editbefore editing files. cvs will create workingcopies of files read-only, to remind developersto run the cvs edit command before working onthem.If files includes the name of a directory, cvsarranges to watch all files added to the correspondingrepository directory, and sets a default for filesadded in the future; this allows the user to setnotification policies on a per-directory basis. Thecontents of the directory are processed recursively,unless the -l option is given.The -R option can be used to force recursion if the -loption is set in ~/.cvsrc (see ).If files is omitted, it defaults to the current directory. watch off (subcommand) cvs watch off — Command: cvs watch off [ -lR ] [ files ] Do not create files read-only on checkout; thus,developers will not be reminded to use cvs editand cvs unedit.The files and options are processed as for cvswatch on. Telling CVS to notify you You can tell cvs that you want to receive notifications about various actions taken on a file. You can do this without using cvs watch on for the file, but generally you will want to use cvs watch on, to remind developers to use the cvs edit command. watch add (subcommand) cvs watch add — Command: cvs watch add [ -lR ] [ -a action ] [ files ] Add the current user to the list of people to receive notification ofwork done on files.The -a option specifies what kinds of events cvs should notifythe user about. action is one of the following: edit Another user has applied the cvs edit command (describedbelow) to a watched file. commit Another user has committed changes to one of the named files. unedit Another user has abandoned editing a file (other than by committing changes).They can do this in several ways, by: applying the cvs unedit command (described below) to the file applying the cvs release command (see ) to the file's parent directory(or recursively to a directory more than one level up) deleting the file and allowing cvs update to recreate it all All of the above. none None of the above. (This is useful with cvs edit,described below.) The -a option may appear more than once, or not at all. Ifomitted, the action defaults to all.The files and options are processed as forcvs watch on. watch remove (subcommand) cvs watch remove — Command: cvs watch remove [ -lR ] [ -a action ] [ files ] Remove a notification request established using cvs watch add;the arguments are the same. If the -a option is present, onlywatches for the specified actions are removed. notify (admin file) When the conditions exist for notification, cvs calls the notify administrative file. Edit notify as one edits the other administrative files (see ). This file follows the usual conventions for administrative files (see ), where each line is a regular expression followed by a command to execute. The command should contain a single occurrence of ‘%s’ which will be replaced by the user to notify; the rest of the information regarding the notification will be supplied to the command on standard input. The standard thing to put in the notify file is the single line: ALL mail %s -s "CVS notification" This causes users to be notified by electronic mail. users (admin file) Note that if you set this up in the straightforward way, users receive notifications on the server machine. One could of course write a notify script which directed notifications elsewhere, but to make this easy, cvs allows you to associate a notification address for each user. To do so create a file users in CVSROOT with a line for each user in the format user:value. Then instead of passing the name of the user to be notified to notify, cvs will pass the value (normally an email address on some other machine). cvs does not notify you for your own changes. Currently this check is done based on whether the user name of the person taking the action which triggers notification matches the user name of the person getting notification. In fact, in general, the watches features only track one edit by each user. It probably would be more useful if watches tracked each working directory separately, so this behavior might be worth changing. How to edit a file which is being watched Checkout, as term for getting ready to edit Since a file which is being watched is checked out read-only, you cannot simply edit it. To make it read-write, and inform others that you are planning to edit it, use the cvs edit command. Some systems call this a checkout, but cvs uses that term for obtaining a copy of the sources (see ), an operation which those systems call a get or a fetch. edit (subcommand) cvs edit — Command: cvs edit [ -lR ] [ -a action ] [ files ] Prepare to edit the working files files. cvs makes thefiles read-write, and notifies users who have requestededit notification for any of files.The cvs edit command accepts the same options as thecvs watch add command, and establishes a temporary watch for theuser on files; cvs will remove the watch when files areunedited or committed. If the user does not wish toreceive notifications, she should specify -a none.The files and the options are processed as for the cvswatch commands. Normally when you are done with a set of changes, you use the cvs commit command, which checks in your changes and returns the watched files to their usual read-only state. But if you instead decide to abandon your changes, or not to make any changes, you can use the cvs unedit command. unedit (subcommand) Abandoning work Reverting to repository version cvs unedit — Command: cvs unedit [ -lR ] [ files ] Abandon work on the working files files, and revert them to therepository versions on which they are based. cvs makes thosefiles read-only for which users have requested notification usingcvs watch on. cvs notifies users who have requested uneditnotification for any of files.The files and options are processed as for thecvs watch commands.If watches are not in use, the unedit commandprobably does not work, and the way to revert to therepository version is with the command cvs update -C file(see ).The meaning isnot precisely the same; the latter may alsobring in some changes which have been made in therepository since the last time you updated. When using client/server cvs, you can use the cvs edit and cvs unedit commands even if cvs is unable to successfully communicate with the server; the notifications will be sent upon the next successful cvs command. Information about who is watching and editing watchers (subcommand) cvs watchers — Command: cvs watchers [ -lR ] [ files ] List the users currently watching changes to files. The reportincludes the files being watched, and the mail address of each watcher.The files and options are processed as for thecvs watch commands. editors (subcommand) cvs editors — Command: cvs editors [ -lR ] [ files ] List the users currently working on files. The reportincludes the mail address of each user, the time when the user beganworking with the file, and the host and path of the working directorycontaining the file.The files and options are processed as for thecvs watch commands. Using watches with old versions of CVS CVS 1.6, and watches If you use the watch features on a repository, it creates CVS directories in the repository and stores the information about watches in that directory. If you attempt to use cvs 1.6 or earlier with the repository, you get an error message such as the following (all on one line): cvs update: cannot open CVS/Entries for reading: No such file or directory and your operation will likely be aborted. To use the watch features, you must upgrade all copies of cvs which use that repository in local or server mode. If you cannot upgrade, use the watch off and watch remove commands to remove all watches, and that will restore the repository to a state which cvs 1.6 can cope with. Choosing between reserved or unreserved checkouts Choosing, reserved or unreserved checkouts Reserved and unreserved checkouts each have pros and cons. Let it be said that a lot of this is a matter of opinion or what works given different groups' working styles, but here is a brief description of some of the issues. There are many ways to organize a team of developers. cvs does not try to enforce a certain organization. It is a tool that can be used in several ways. Reserved checkouts can be very counter-productive. If two persons want to edit different parts of a file, there may be no reason to prevent either of them from doing so. Also, it is common for someone to take out a lock on a file, because they are planning to edit it, but then forget to release the lock. People, especially people who are familiar with reserved checkouts, often wonder how often conflicts occur if unreserved checkouts are used, and how difficult they are to resolve. The experience with many groups is that they occur rarely and usually are relatively straightforward to resolve. The rarity of serious conflicts may be surprising, until one realizes that they occur only when two developers disagree on the proper design for a given section of code; such a disagreement suggests that the team has not been communicating properly in the first place. In order to collaborate under any source management regimen, developers must agree on the general design of the system; given this agreement, overlapping changes are usually straightforward to merge. In some cases unreserved checkouts are clearly inappropriate. If no merge tool exists for the kind of file you are managing (for example word processor files or files edited by Computer Aided Design programs), and it is not desirable to change to a program which uses a mergeable data format, then resolving conflicts is going to be unpleasant enough that you generally will be better off to simply avoid the conflicts instead, by using reserved checkouts. The watches features described above in can be considered to be an intermediate model between reserved checkouts and unreserved checkouts. When you go to edit a file, it is possible to find out who else is editing it. And rather than having the system simply forbid both people editing the file, it can tell you what the situation is and let you figure out whether it is a problem in that particular case or not. Therefore, for some groups it can be considered the best of both the reserved checkout and unreserved checkout worlds. Revision management Revision management If you have read this far, you probably have a pretty good grasp on what cvs can do for you. This chapter talks a little about things that you still have to decide. If you are doing development on your own using cvs you could probably skip this chapter. The questions this chapter takes up become more important when more than one person is working in a repository. When to commit? When to commit Committing, when to Policy Your group should decide which policy to use regarding commits. Several policies are possible, and as your experience with cvs grows you will probably find out what works for you. If you commit files too quickly you might commit files that do not even compile. If your partner updates his working sources to include your buggy file, he will be unable to compile the code. On the other hand, other persons will not be able to benefit from the improvements you make to the code if you commit very seldom, and conflicts will probably be more common. It is common to only commit files after making sure that they can be compiled. Some sites require that the files pass a test suite. Policies like this can be enforced using the commitinfo file (see ), but you should think twice before you enforce such a convention. By making the development environment too controlled it might become too regimented and thus counter-productive to the real goal, which is to get software written. Keyword substitution Keyword substitution Keyword expansion Identifying files As long as you edit source files inside a working directory you can always find out the state of your files via ‘cvs status’ and ‘cvs log’. But as soon as you export the files from your development environment it becomes harder to identify which revisions they are. cvs can use a mechanism known as keyword substitution (or keyword expansion) to help identifying the files. Embedded strings of the form $keyword$ and $keyword:…$ in a file are replaced with strings of the form $keyword:value$ whenever you obtain a new revision of the file. Keyword List Keyword List This is a list of the keywords: Author keyword$Author$ The login name of the user who checked in the revision. Date keyword $Date$ The date and time (UTC) the revision was checked in. Header keyword $Header$ A standard header containing the full pathname of thercs file, the revision number, the date (UTC), theauthor, the state, and the locker (if locked). Fileswill normally never be locked when you use cvs. Id keyword $Id$ Same as $Header$, except that the rcsfilename is without a path. Name keyword $Name$ Tag name used to check out this file. The keyword isexpanded only if one checks out with an explicit tagname. For example, when running the command cvsco -r first, the keyword expands to ‘Name: first’. Locker keyword $Locker$ The login name of the user who locked the revision(empty if not locked, which is the normal case unlesscvs admin -l is in use). Log keyword $Log$ The log message supplied during commit, preceded by aheader containing the rcs filename, the revisionnumber, the author, and the date (UTC). Existing logmessages are not replaced. Instead, the new logmessage is inserted after $Log:…$.Each new line is prefixed with the same string whichprecedes the $Log keyword. For example, if thefile contains: /* Here is what people have been up to: * * $Log: frob.c,v $ * Revision 1.1 1997/01/03 14:23:51 joe * Add the superfrobnicate option * */ then additional lines which are added when expandingthe $Log keyword will be preceded by ‘ * ’.Unlike previous versions of cvs and rcs, thecomment leader from the rcs file is not used.The $Log keyword is useful foraccumulating a complete change log in a source file,but for several reasons it can be problematic.See . RCSfile keyword $RCSfile$ The name of the RCS file without a path. Revision keyword $Revision$ The revision number assigned to the revision. Source keyword $Source$ The full pathname of the RCS file. State keyword $State$ The state assigned to the revision. States can beassigned with cvs admin -s—see . Using keywords To include a keyword string you simply include the relevant text string, such as $Id$, inside the file, and commit the file. cvs will automatically (Or, more accurately, as part of the update run that automatically happens after a commit.) expand the string as part of the commit operation. It is common to embed the $Id$ string in the source files so that it gets passed through to generated files. For example, if you are managing computer program source code, you might include a variable which is initialized to contain that string. Or some C compilers may provide a #pragma ident directive. Or a document management system might provide a way to pass a string through to generated files. Ident (shell command) The ident command (which is part of the rcs package) can be used to extract keywords and their values from a file. This can be handy for text files, but it is even more useful for extracting keywords from binary files. $ ident samp.c samp.c: $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ $ gcc samp.c $ ident a.out a.out: $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ What (shell command) Sccs is another popular revision control system. It has a command, what, which is very similar to ident and used for the same purpose. Many sites without rcs have sccs. Since what looks for the character sequence @(#) it is easy to include keywords that are detected by either command. Simply prefix the keyword with the magic sccs phrase, like this: static char *id="@(#) $Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $"; Avoiding substitution Keyword substitution has its disadvantages. Sometimes you might want the literal text string ‘$Author$’ to appear inside a file without cvs interpreting it as a keyword and expanding it into something like ‘$Author: ceder $’. There is unfortunately no way to selectively turn off keyword substitution. You can use ‘-ko’ (see ) to turn off keyword substitution entirely. In many cases you can avoid using keywords in the source, even though they appear in the final product. For example, the source for this manual contains ‘$@asis{}Author$’ whenever the text ‘$Author$’ should appear. In nroff and troff you can embed the null-character \& inside the keyword for a similar effect. Substitution modes Keyword substitution, changing modes -k (keyword substitution) Kflag Each file has a stored default substitution mode, and each working directory copy of a file also has a substitution mode. The former is set by the ‘-k’ option to cvs add and cvs admin; the latter is set by the ‘-k’ or ‘-A’ options to cvs checkout or cvs update. cvs diff and cvs rdiff also have ‘-k’ options. For some examples, see , and . The modes available are: -kkvGenerate keyword strings using the default form, e.g.$Revision: 5.7 $ for the Revisionkeyword. -kkvlLike ‘-kkv’, except that a locker's name is alwaysinserted if the given revision is currently locked.The locker's name is only relevant if cvs admin-l is in use. -kkGenerate only keyword names in keyword strings; omittheir values. For example, for the Revisionkeyword, generate the string $Revision$instead of $Revision: 5.7 $. This optionis useful to ignore differences due to keywordsubstitution when comparing different revisions of afile (see ). -koGenerate the old keyword string, present in the workingfile just before it was checked in. For example, forthe Revision keyword, generate the string$Revision: 1.1 $ instead of$Revision: 5.7 $ if that is how thestring appeared when the file was checked in. -kbLike ‘-ko’, but also inhibit conversion of lineendings between the canonical form in which they arestored in the repository (linefeed only), and the formappropriate to the operating system in use on theclient. For systems, like unix, which use linefeedonly to terminate lines, this is the same as‘-ko’. For more information on binary files, see. -kvGenerate only keyword values for keyword strings. Forexample, for the Revision keyword, generate the string5.7 instead of $Revision: 5.7 $.This can help generate files in programming languageswhere it is hard to strip keyword delimiters like$Revision: $ from a string. However,further keyword substitution cannot be performed oncethe keyword names are removed, so this option should beused with care.One often would like to use ‘-kv’ with cvsexport—see . But be aware that doesn'thandle an export containing binary files correctly. Problems with the $Log$ keyword. The $Log$ keyword is somewhat controversial. As long as you are working on your development system the information is easily accessible even if you do not use the $Log$ keyword—just do a cvs log. Once you export the file the history information might be useless anyhow. A more serious concern is that cvs is not good at handling $Log$ entries when a branch is merged onto the main trunk. Conflicts often result from the merging operation. People also tend to "fix" the log entries in the file (correcting spelling mistakes and maybe even factual errors). If that is done the information from cvs log will not be consistent with the information inside the file. This may or may not be a problem in real life. It has been suggested that the $Log$ keyword should be inserted last in the file, and not in the files header, if it is to be used at all. That way the long list of change messages will not interfere with everyday source file browsing. Tracking third-party sources Third-party sources Tracking sources If you modify a program to better fit your site, you probably want to include your modifications when the next release of the program arrives. cvs can help you with this task. Vendor Vendor branch Branch, vendor- In the terminology used in cvs, the supplier of the program is called a vendor. The unmodified distribution from the vendor is checked in on its own branch, the vendor branch. cvs reserves branch 1.1.1 for this use. When you modify the source and commit it, your revision will end up on the main trunk. When a new release is made by the vendor, you commit it on the vendor branch and copy the modifications onto the main trunk. Use the import command to create and update the vendor branch. When you import a new file, the vendor branch is made the `head' revision, so anyone that checks out a copy of the file gets that revision. When a local modification is committed it is placed on the main trunk, and made the `head' revision. Importing for the first time Importing modules Use the import command to check in the sources for the first time. When you use the import command to track third-party sources, the vendor tag and release tags are useful. The vendor tag is a symbolic name for the branch (which is always 1.1.1, unless you use the ‘-b branch’ flag—see .). The release tags are symbolic names for a particular release, such as ‘FSF_0_04’. Note that import does not change the directory in which you invoke it. In particular, it does not set up that directory as a cvs working directory; if you want to work with the sources import them first and then check them out into a different directory (see ). wdiff (import example) Suppose you have the sources to a program called wdiff in a directory wdiff-0.04, and are going to make private modifications that you want to be able to use even when new releases are made in the future. You start by importing the source to your repository: $ cd wdiff-0.04 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04 The vendor tag is named ‘FSF_DIST’ in the above example, and the only release tag assigned is ‘WDIFF_0_04’. Updating with the import command When a new release of the source arrives, you import it into the repository with the same import command that you used to set up the repository in the first place. The only difference is that you specify a different release tag this time: $ tar xfz wdiff-0.05.tar.gz $ cd wdiff-0.05 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05 WARNING: If you use a release tag that already exists in one of the repository archives, files removed by an import may not be detected. For files that have not been modified locally, the newly created revision becomes the head revision. If you have made local changes, import will warn you that you must merge the changes into the main trunk, and tell you to use ‘checkout -j’ to do so: $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff The above command will check out the latest revision of ‘wdiff’, merging the changes made on the vendor branch ‘FSF_DIST’ since yesterday into the working copy. If any conflicts arise during the merge they should be resolved in the normal way (see ). Then, the modified files may be committed. However, it is much better to use the two release tags rather than using a date on the branch as suggested above: $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff The reason this is better is that using a date, as suggested above, assumes that you do not import more than one release of a product per day. More importantly, using the release tags allows cvs to detect files that were removed between the two vendor releases and mark them for removal. Since import has no way to detect removed files, you should do a merge like this even if import doesn't tell you to. Reverting to the latest vendor release You can also revert local changes completely and return to the latest vendor release by changing the `head' revision back to the vendor branch on all files. For example, if you have a checked-out copy of the sources in ~/work.d/wdiff, and you want to revert to the vendor's version for all the files in that directory, you would type: $ cd ~/work.d/wdiff $ cvs admin -bFSF_DIST . You must specify the ‘-bFSF_DIST’ without any space after the ‘-b’. See . How to handle binary files with cvs import Use the ‘-k’ wrapper option to tell import which files are binary. See . How to handle keyword substitution with cvs import The sources which you are importing may contain keywords (see ). For example, the vendor may use cvs or some other system which uses similar keyword expansion syntax. If you just import the files in the default fashion, then the keyword expansions supplied by the vendor will be replaced by keyword expansions supplied by your own copy of cvs. It may be more convenient to maintain the expansions supplied by the vendor, so that this information can supply information about the sources that you imported from the vendor. To maintain the keyword expansions supplied by the vendor, supply the ‘-ko’ option to cvs import the first time you import the file. This will turn off keyword expansion for that file entirely, so if you want to be more selective you'll have to think about what you want and use the ‘-k’ option to cvs update or cvs admin as appropriate. Multiple vendor branches All the examples so far assume that there is only one vendor from which you are getting sources. In some situations you might get sources from a variety of places. For example, suppose that you are dealing with a project where many different people and teams are modifying the software. There are a variety of ways to handle this, but in some cases you have a bunch of source trees lying around and what you want to do more than anything else is just to all put them in cvs so that you at least have them in one place. For handling situations in which there may be more than one vendor, you may specify the ‘-b’ option to cvs import. It takes as an argument the vendor branch to import to. The default is ‘-b 1.1.1’. For example, suppose that there are two teams, the red team and the blue team, that are sending you sources. You want to import the red team's efforts to branch 1.1.1 and use the vendor tag RED. You want to import the blue team's efforts to branch 1.1.3 and use the vendor tag BLUE. So the commands you might use are: $ cvs import dir RED RED_1-0 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5 Note that if your vendor tag does not match your ‘-b’ option, cvs will not detect this case! For example, $ cvs import -b 1.1.3 dir RED RED_1-0 Be careful; this kind of mismatch is sure to sow confusion or worse. I can't think of a useful purpose for the ability to specify a mismatch here, but if you discover such a use, don't. cvs is likely to make this an error in some future release. How your build system interacts with CVS Builds make As mentioned in the introduction, cvs does not contain software for building your software from source code. This section describes how various aspects of your build system might interact with cvs. One common question, especially from people who are accustomed to rcs, is how to make their build get an up to date copy of the sources. The answer to this with cvs is two-fold. First of all, since cvs itself can recurse through directories, there is no need to modify your Makefile (or whatever configuration file your build tool uses) to make sure each file is up to date. Instead, just use two commands, first cvs -q update and then make or whatever the command is to invoke your build tool. Secondly, you do not necessarily want to get a copy of a change someone else made until you have finished your own work. One suggested approach is to first update your sources, then implement, build and test the change you were thinking of, and then commit your sources (updating first if necessary). By periodically (in between changes, using the approach just described) updating your entire tree, you ensure that your sources are sufficiently up to date. Bill of materials One common need is to record which versions of which source files went into a particular build. This kind of functionality is sometimes called bill of materials or something similar. The best way to do this with cvs is to use the tag command to record which versions went into a given build (see ). Using cvs in the most straightforward manner possible, each developer will have a copy of the entire source tree which is used in a particular build. If the source tree is small, or if developers are geographically dispersed, this is the preferred solution. In fact one approach for larger projects is to break a project down into smaller separately-compiled subsystems, and arrange a way of releasing them internally so that each developer need check out only those subsystems which they are actively working on. Another approach is to set up a structure which allows developers to have their own copies of some files, and for other files to access source files from a central location. Many people have come up with some such a system using features such as the symbolic link feature found in many operating systems, or the VPATH feature found in many versions of make. One build tool which is designed to help with this kind of thing is Odin (see ftp://ftp.cs.colorado.edu/pub/distribs/odin). Special Files Special files Device nodes Ownership, saving in CVS Permissions, saving in CVS Hard links Symbolic links In normal circumstances, cvs works only with regular files. Every file in a project is assumed to be persistent; it must be possible to open, read and close them; and so on. cvs also ignores file permissions and ownerships, leaving such issues to be resolved by the developer at installation time. In other words, it is not possible to "check in" a device into a repository; if the device file cannot be opened, cvs will refuse to handle it. Files also lose their ownerships and permissions during repository transactions. Guide to CVS commands This appendix describes the overall structure of cvs commands, and describes some commands in detail (others are described elsewhere; for a quick reference to cvs commands, see ). Overall structure of CVS commands Structure CVS command structure Command structure Format of CVS commands The overall format of all cvs commands is: cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ] cvs The name of the cvs program. cvs_options Some options that affect all sub-commands of cvs. These aredescribed below. cvs_command One of several different sub-commands. Some of the commands havealiases that can be used instead; those aliases are noted in thereference manual for that command. There are only two situationswhere you may omit ‘cvs_command’: ‘cvs -H’ elicits alist of available commands, and ‘cvs -v’ displays versioninformation on cvs itself. command_options Options that are specific for the command. command_args Arguments to the commands. There is unfortunately some confusion between cvs_options and command_options. When given as a cvs_option, some options only affect some of the commands. When given as a command_option it may have a different meaning, and be accepted by more commands. In other words, do not take the above categorization too seriously. Look at the documentation instead. CVS's exit status Exit status, of CVS cvs can indicate to the calling environment whether it succeeded or failed by setting its exit status. The exact way of testing the exit status will vary from one operating system to another. For example in a unix shell script the ‘$?’ variable will be 0 if the last command returned a successful exit status, or greater than 0 if the exit status indicated failure. If cvs is successful, it returns a successful status; if there is an error, it prints an error message and returns a failure status. The one exception to this is the cvs diff command. It will return a successful status if it found no differences, or a failure status if there were differences or if there was an error. Because this behavior provides no good way to detect errors, in the future it is possible that cvs diff will be changed to behave like the other cvs commands. Default options and the ~/.cvsrc file .cvsrc file Option defaults There are some command_options that are used so often that you might have set up an alias or some other means to make sure you always specify that option. One example (the one that drove the implementation of the .cvsrc support, actually) is that many people find the default output of the ‘diff’ command to be very hard to read, and that either context diffs or unidiffs are much easier to understand. The ~/.cvsrc file is a way that you can add default options to cvs_commands within cvs, instead of relying on aliases or other shell scripts. The format of the ~/.cvsrc file is simple. The file is searched for a line that begins with the same name as the cvs_command being executed. If a match is found, then the remainder of the line is split up (at whitespace characters) into separate options and added to the command arguments before any options from the command line. If a command has two names (e.g., checkout and co), the official name, not necessarily the one used on the command line, will be used to match against the file. So if this is the contents of the user's ~/.cvsrc file: log -N diff -uN rdiff -u update -Pd checkout -P release -d the command ‘cvs checkout foo’ would have the ‘-P’ option added to the arguments, as well as ‘cvs co foo’. With the example file above, the output from ‘cvs diff foobar’ will be in unidiff format. ‘cvs diff -c foobar’ will provide context diffs, as usual. Getting "old" format diffs would be slightly more complicated, because diff doesn't have an option to specify use of the "old" format, so you would need ‘cvs -f diff foobar’. In place of the command name you can use cvs to specify global options (see ). For example the following line in .cvsrc cvs -z6 causes cvs to use compression level 6. Global options Options, global Global options Left-hand options The available ‘cvs_options’ (that are given to the left of ‘cvs_command’) are: --allow-root=rootdir Specify legal cvsroot directory. See. Authentication, stream Stream authentication -a Authenticate all communication between the client andthe server. Only has an effect on the cvs client.As of this writing, this is only implemented when usinga GSSAPI connection (see ).Authentication prevents certain sorts of attacksinvolving hijacking the active tcp connection.Enabling authentication does not enable encryption. RCSBIN, overriding Overriding RCSBIN -b bindir In cvs 1.9.18 and older, this specified thatrcs programs are in the bindir directory.Current versions of cvs do not run rcsprograms; for compatibility this option is accepted,but it does nothing. TMPDIR, overriding Overriding TMPDIR -T tempdir Use tempdir as the directory where temporary files arelocated. Overrides the setting of the $TMPDIR environmentvariable and any precompiled directory. This parameter should bespecified as an absolute pathname.(When running client/server, ‘-T’ affects only the local process;specifying ‘-T’ for the client has no effect on the server andvice versa.) CVSROOT, overriding Overriding CVSROOT -d cvs_root_directory Use cvs_root_directory as the root directorypathname of the repository. Overrides the setting ofthe $CVSROOT environment variable. See . EDITOR, overriding Overriding EDITOR -e editor Use editor to enter revision log information. Overrides thesetting of the $CVSEDITOR and $EDITORenvironment variables. For more information, see. -f Do not read the ~/.cvsrc file. Thisoption is most often used because of thenon-orthogonality of the cvs option set. Forexample, the ‘cvs log’ option ‘-N’ (turn offdisplay of tag names) does not have a correspondingoption to turn the display on. So if you have‘-N’ in the ~/.cvsrc entry for ‘log’,you may need to use ‘-f’ to show the tag names. -H--help Display usage information about the specified ‘cvs_command’(but do not actually execute the command). If you don't specifya command name, ‘cvs -H’ displays overall help forcvs, including a list of other help options. Read-only mode -n Do not change any files. Attempt to execute the‘cvs_command’, but only to issue reports; do not remove,update, or merge any existing files, or create any new files.Note that cvs will not necessarily produce exactlythe same output as without ‘-n’. In some casesthe output will be the same, but in other casescvs will skip some of the processing that wouldhave been required to produce the exact same output. -Q Cause the command to be really quiet; the command will onlygenerate output for serious problems. -q Cause the command to be somewhat quiet; informational messages,such as reports of recursion through subdirectories, aresuppressed. Read-only files, and -r -r Make new working files read-only. Same effectas if the $CVSREAD environment variable is set(see ). The default is tomake working files writable, unless watches are on(see ). -s variable=value Set a user variable (see ). Trace -t Trace program execution; display messages showing the steps ofcvs activity. Particularly useful with ‘-n’ to explore thepotential impact of an unfamiliar command. -v--version Display version and copyright information for cvs. CVSREAD, overriding Overriding CVSREAD -w Make new working files read-write. Overrides thesetting of the $CVSREAD environment variable.Files are created read-write by default, unless $CVSREAD isset or ‘-r’ is given. -x EncryptionEncrypt all communication between the client and theserver. Only has an effect on the cvs client. Asof this writing, this is only implemented when using aGSSAPI connection (see ) or aKerberos connection (see ).Enabling encryption implies that message traffic isalso authenticated. Encryption support is notavailable by default; it must be enabled using aspecial configure option, --enable-encryption,when you build cvs. -z gzip-level Compression GzipSet the compression level.Valid levels are 1 (high speed, low compression) to9 (low speed, high compression), or 0 to disablecompression (the default).Only has an effect on the cvs client. Common command options Common options Right-hand options This section describes the ‘command_options’ that are available across several cvs commands. These options are always given to the right of ‘cvs_command’. Not all commands support all of these options; each option is only supported for commands where it makes sense. However, when a command has one of these options you can almost always count on the same behavior of the option as in other commands. (Other command options, which are listed with the individual commands, may have different behavior from one cvs command to the other). The ‘history’ command is an exception; it supports many options that conflict even with these standard options. Dates Time Specifying dates-D date_spec Use the most recent revision no later than date_spec.date_spec is a single argument, a date descriptionspecifying a date in the past.The specification is sticky when you use it to make aprivate copy of a source file; that is, when you get a workingfile using ‘-D’, cvs records the date you specified, so thatfurther updates in the same directory will use the same date(for more information on sticky tags/dates, see ).‘-D’ is available with the annotate, checkout,diff, export, history,rdiff, rtag, and update commands.(The history command uses this option in aslightly different way; see ). Timezone, in input Zone, time, in inputA wide variety of date formats are supported bycvs. The most standard ones are ISO8601 (from theInternational Standards Organization) and the Internete-mail standard (specified in RFC822 as amended byRFC1123). ISO8601 dates have many variants but a few examplesare: 1972-09-24 1972-09-24 20:05 There are a lot more ISO8601 date formats, and cvsaccepts many of them, but you probably don't want tohear the whole long story :-). In addition to the dates allowed in Internet e-mailitself, cvs also allows some of the fields to beomitted. For example: 24 Sep 1972 20:05 24 Sep The date is interpreted as being in thelocal timezone, unless a specific timezone isspecified.These two date formats are preferred. However,cvs currently accepts a wide variety of other dateformats. They are intentionally not documented here inany detail, and future versions of cvs might notaccept all of them. One such format ismonth/day/year. This mayconfuse people who are accustomed to having the monthand day in the other order; ‘1/4/96’ is January 4,not April 1.Remember to quote the argument to the ‘-D’flag so that your shell doesn't interpret spaces asargument separators. A command using the ‘-D’flag can look like this: $ cvs diff -D "1 hour ago" cvs.texinfo Forcing a tag match -f When you specify a particular date or tag to cvs commands, theynormally ignore files that do not contain the tag (or did notexist prior to the date) that you specified. Use the ‘-f’ optionif you want files retrieved even when there is no match for thetag or date. (The most recent revision of the filewill be used).Note that even with ‘-f’, a tag that you specifymust exist (that is, in some file, not necessary inevery file). This is so that cvs will continue togive an error if you mistype a tag name.‘-f’ is available with these commands:annotate, checkout, export,rdiff, rtag, and update.WARNING: The commit and removecommands also have a‘-f’ option, but it has a different behavior forthose commands. See , and. -k kflag Alter the default processing of keywords.See , for the meaning ofkflag. Your kflag specification issticky when you use it to create a private copyof a source file; that is, when you use this optionwith the checkout or update commands,cvs associates your selected kflag with thefile, and continues to use it with future updatecommands on the same file until you specify otherwise.The ‘-k’ option is available with the add,checkout, diff, rdiff, import andupdate commands. -l Local; run only in current working directory, rather thanrecursing through subdirectories.Available with the following commands: annotate, checkout,commit, diff, edit, editors, export,log, rdiff, remove, rtag,status, tag, unedit, update, watch,and watchers. Editor, avoiding invocation of Avoiding editor invocation -m message Use message as log information, instead ofinvoking an editor.Available with the following commands: add,commit and import. -n Do not run any tag program. (A program can bespecified to run in the modulesdatabase (see ); this option bypasses it).This is not the same as the ‘cvs -n’program option, which you can specify to the left of a cvs command!Available with the checkout, export,and rtag commands. -P Prune empty directories. See . -p Pipe the files retrieved from the repository to standard output,rather than writing them in the current directory. Availablewith the checkout and update commands. -R Process directories recursively. This is on by default.Available with the following commands: annotate, checkout,commit, diff, edit, editors, export,rdiff, remove, rtag,status, tag, unedit, update, watch,and watchers. -r tag HEAD, special tag BASE, special tagUse the revision specified by the tag argument instead of thedefault head revision. As well as arbitrary tags definedwith the tag or rtag command, two special tags arealways available: ‘HEAD’ refers to the most recent versionavailable in the repository, and ‘BASE’ refers to therevision you last checked out into the current working directory. The tag specification is sticky when you use this with checkout or update to make your owncopy of a file: cvs remembers the tag and continues to use it onfuture update commands, until you specify otherwise (for more informationon sticky tags/dates, see ).The tag can be either a symbolic or numeric tag, asdescribed in , or the name of a branch, asdescribed in .When a command expects a specific revision,the name of a branch is interpreted as the most recentrevision on that branch.Specifying the ‘-q’ global option along with the‘-r’ command option is often useful, to suppressthe warning messages when the rcs filedoes not contain the specified tag.This is not the same as the overall ‘cvs -r’ option,which you can specify to the left of a cvs command!-r’ is available with the annotate, checkout,commit, diff, history, export, rdiff,rtag, and update commands. -W Specify file names that should be filtered. You canuse this option repeatedly. The spec can be a filename pattern of the same type that you can specify inthe .cvswrappers file.Available with the following commands: import,and update. admin—Administration Admin (subcommand) Requires: repository, working directory. Changes: repository. Synonym: rcs This is the cvs interface to assorted administrative facilities. Some of them have questionable usefulness for cvs but exist for historical purposes. Some of the questionable options are likely to disappear in the future. This command does work recursively, so extreme care should be used. cvsadmin On unix, if there is a group named cvsadmin, only members of that group can run cvs admin (except for the cvs admin -k command, which can be run by anybody). This group should exist on the server, or any system running the non-client/server cvs. To disallow cvs admin for all users, create a group with no users in it. On NT, the cvsadmin feature does not exist and all users can run cvs admin. admin options Some of these options have questionable usefulness for cvs but exist for historical purposes. Some even make it impossible to use cvs until you undo the effect! -Aoldfile Might not work together with cvs. Append theaccess list of oldfile to the access list of thercs file. -alogins Might not work together with cvs. Append thelogin names appearing in the comma-separated listlogins to the access list of the rcs file. -b[rev] Set the default branch to rev. In cvs, younormally do not manipulate default branches; stickytags (see ) are a better way to decidewhich branch you want to work on. There is one reasonto run cvs admin -b: to revert to the vendor'sversion when using vendor branches (see ).There can be no space between ‘-b’ and its argument. Comment leader -cstring Sets the comment leader to string. The commentleader is not used by current versions of cvs orrcs 5.7. Therefore, you can almost surely notworry about it. See . -e[logins] Might not work together with cvs. Erase the loginnames appearing in the comma-separated listlogins from the access list of the RCS file. Iflogins is omitted, erase the entire access list.There can be no space between ‘-e’ and its argument. -I Run interactively, even if the standard input is not aterminal. This option does not work with theclient/server cvs and is likely to disappear ina future release of cvs. -i Useless with cvs. This creates and initializes anew rcs file, without depositing a revision. Withcvs, add files with the cvs add command(see ). -ksubst Set the default keywordsubstitution to subst. See . Giving an explicit ‘-k’ option tocvs update, cvs export, or cvscheckout overrides this default. -l[rev] Lock the revision with number rev. If a branchis given, lock the latest revision on that branch. Ifrev is omitted, lock the latest revision on thedefault branch. There can be no space between‘-l’ and its argument.This can be used in conjunction with thercslock.pl script in the contribdirectory of the cvs source distribution toprovide reserved checkouts (where only one user can beediting a given file at a time). See the comments inthat file for details (and see the README filein that directory for disclaimers about the unsupportednature of contrib). According to comments in thatfile, locking must set to strict (which is the default). -L Set locking to strict. Strict locking means that theowner of an RCS file is not exempt from locking forcheckin. For use with cvs, strict locking must beset; see the discussion under the ‘-l’ option above. Changing a log message Replacing a log message Correcting a log message Fixing a log message Log message, correcting -mrev:msg Replace the log message of revision rev withmsg. -Nname[:[rev]] Act like ‘-n’, except override any previousassignment of name. For use with magic branches,see . -nname[:[rev]] Associate the symbolic name name with the branchor revision rev. It is normally better to use‘cvs tag’ or ‘cvs rtag’ instead. Delete thesymbolic name if both ‘:’ and rev areomitted; otherwise, print an error message ifname is already associated with another number.If rev is symbolic, it is expanded beforeassociation. A rev consisting of a branch numberfollowed by a ‘.’ stands for the current latestrevision in the branch. A ‘:’ with an emptyrev stands for the current latest revision on thedefault branch, normally the trunk. For example,‘cvs admin -nname:’ associates name with thecurrent latest revision of all the RCS files;this contrasts with ‘cvs admin -nname:$’ whichassociates name with the revision numbersextracted from keyword strings in the correspondingworking files. Deleting revisions Outdating revisions Saving space -orange Deletes (outdates) the revisions given byrange.Note that this command can be quite dangerous unlessyou know exactly what you are doing (for examplesee the warnings below about how therev1:rev2 syntax is confusing).If you are short on disc this option might help you.But think twice before using it—there is no way shortof restoring the latest backup to undo this command!If you delete different revisions than you planned,either due to carelessness or (heaven forbid) a cvsbug, there is no opportunity to correct the errorbefore the revisions are deleted. It probably would bea good idea to experiment on a copy of the repositoryfirst.Specify range in one of the following ways: rev1::rev2 Collapse all revisions between rev1 and rev2, so thatcvs only stores the differences associated with goingfrom rev1 to rev2, not intermediate steps. Forexample, after ‘-o 1.3::1.5’ one can retrieverevision 1.3, revision 1.5, or the differences to getfrom 1.3 to 1.5, but not the revision 1.4, or thedifferences between 1.3 and 1.4. Other examples:‘-o 1.3::1.4’ and ‘-o 1.3::1.3’ have noeffect, because there are no intermediate revisions toremove. ::rev Collapse revisions between the beginning of the branchcontaining rev and rev itself. Thebranchpoint and rev are left intact. Forexample, ‘-o ::1.3.2.6’ deletes revision 1.3.2.1,revision 1.3.2.5, and everything in between, but leaves1.3 and 1.3.2.6 intact. rev:: Collapse revisions between rev and the end of thebranch containing rev. Revision rev isleft intact but the head revision is deleted. rev Delete the revision rev. For example, ‘-o1.3’ is equivalent to ‘-o 1.2::1.4’. rev1:rev2 Delete the revisions from rev1 to rev2,inclusive, on the same branch. One will not be able toretrieve rev1 or rev2 or any of therevisions in between. For example, the command‘cvs admin -oR_1_01:R_1_02 .’ is rarely useful.It means to delete revisions up to, and including, thetag R_1_02. But beware! If there are files that have notchanged between R_1_02 and R_1_03 the file will havethe same numerical revision number assigned tothe tags R_1_02 and R_1_03. So not only will it beimpossible to retrieve R_1_02; R_1_03 will also have tobe restored from the tapes! In most cases you want tospecify rev1::rev2 instead. :rev Delete revisions from the beginning of thebranch containing rev up to and includingrev. rev: Delete revisions from revision rev, includingrev itself, to the end of the branch containingrev. None of the revisions to be deleted may havebranches or locks.If any of the revisions to be deleted have symbolicnames, and one specifies one of the ‘::’ syntaxes,then cvs will give an error and not delete anyrevisions. If you really want to delete both thesymbolic names and the revisions, first delete thesymbolic names with cvs tag -d, then runcvs admin -o. If one specifies thenon-‘::’ syntaxes, then cvs will delete therevisions but leave the symbolic names pointing tononexistent revisions. This behavior is preserved forcompatibility with previous versions of cvs, butbecause it isn't very useful, in the future it maychange to be like the ‘::’ case.Due to the way cvs handles branches revcannot be specified symbolically if it is a branch.See , for an explanation. Make sure that no-one has checked out a copy of therevision you outdate. Strange things will happen if hestarts to edit it and tries to check it back in. Forthis reason, this option is not a good way to take backa bogus commit; commit a new revision undoing the boguschange instead (see ). -q Run quietly; do not print diagnostics. -sstate[:rev] Useful with cvs. Set the state attribute of therevision rev to state. If rev is abranch number, assume the latest revision on thatbranch. If rev is omitted, assume the latestrevision on the default branch. Any identifier isacceptable for state. A useful set of states is‘Exp’ (for experimental), ‘Stab’ (forstable), and ‘Rel’ (for released). By default,the state of a new revision is set to ‘Exp’ whenit is created. The state is visible in the output fromcvs log (see ), and in the‘$Log$’ and ‘$State$’ keywords(see ). Note that cvsuses the dead state for its own purposes (see ); totake a file to or from the dead state usecommands like cvs remove and cvs add(see ), not cvs admin -s. -t[file] Useful with cvs. Write descriptive text from thecontents of the named file into the RCS file,deleting the existing text. The file pathnamemay not begin with ‘-’. The descriptive text can be seen in theoutput from ‘cvs log’ (see ).There can be no space between ‘-t’ and its argument.If file is omitted,obtain the text from standard input, terminated byend-of-file or by a line containing ‘.’ by itself.Prompt for the text if interaction is possible; see‘-I’. -t-string Similar to ‘-tfile’. Write descriptive textfrom the string into the rcs file, deletingthe existing text.There can be no space between ‘-t’ and its argument. -U Set locking to non-strict. Non-strict locking meansthat the owner of a file need not lock a revision forcheckin. For use with cvs, strict locking must beset; see the discussion under the ‘-l’ optionabove. -u[rev] See the option ‘-l’ above, for a discussion ofusing this option with cvs. Unlock the revisionwith number rev. If a branch is given, unlockthe latest revision on that branch. If rev isomitted, remove the latest lock held by the caller.Normally, only the locker of a revision may unlock it;somebody else unlocking a revision breaks the lock.This causes the original locker to be sent a commitnotification (see ).There can be no space between ‘-u’ and its argument. -Vn In previous versions of cvs, this option meant towrite an rcs file which would be acceptable torcs version n, but it is now obsolete andspecifying it will produce an error. -xsuffixes In previous versions of cvs, this was documentedas a way of specifying the names of the rcsfiles. However, cvs has always required that thercs files used by cvs end in ‘,v’, sothis option has never done anything useful. annotate—What revision modified each line of a file? annotate (subcommand) Synopsis: annotate [options] files… Requires: repository. Changes: nothing. For each file in files, print the head revision of the trunk, together with information on the last modification for each line. annotate options These standard options are supported by annotate (see , for a complete description of them): -l Local directory only, no recursion. -R Process directories recursively. -f Use head revision if tag/date not found. -F Annotate binary files. -r revision Annotate file as of specified revision/tag. -D date Annotate file as of specified date. annotate example For example: $ cvs annotate ssfile Annotations for ssfile *************** 1.1 (mary 27-Mar-96): ssfile line 1 1.2 (joe 28-Mar-96): ssfile line 2 The file ssfile currently contains two lines. The ssfile line 1 line was checked in by mary on March 27. Then, on March 28, joe added a line ssfile line 2, without modifying the ssfile line 1 line. This report doesn't tell you anything about lines which have been deleted or replaced; you need to use cvs diff for that (see ). The options to cvs annotate are listed in , and can be used to select the files and revisions to annotate. The options are described in more detail there and in . checkout—Check out sources for editing checkout (subcommand) co (subcommand) Synopsis: checkout [options] modules… Requires: repository. Changes: working directory. Synonyms: co, get Create or update a working directory containing copies of the source files specified by modules. You must execute checkout before using most of the other cvs commands, since most of them operate on your working directory. The modules are either symbolic names for some collection of source directories and files, or paths to directories or files in the repository. The symbolic names are defined in the ‘modules’ file. See . Depending on the modules you specify, checkout may recursively create directories and populate them with the appropriate source files. You can then edit these source files at any time (regardless of whether other software developers are editing their own copies of the sources); update them to include new changes applied by others to the source repository; or commit your work as a permanent change to the source repository. Note that checkout is used to create directories. The top-level directory created is always added to the directory where checkout is invoked, and usually has the same name as the specified module. In the case of a module alias, the created sub-directory may have a different name, but you can be sure that it will be a sub-directory, and that checkout will show the relative path leading to each file as it is extracted into your private work area (unless you specify the ‘-Q’ global option). The files created by checkout are created read-write, unless the ‘-r’ option to cvs (see ) is specified, the CVSREAD environment variable is specified (see ), or a watch is in effect for that file (see ). Note that running checkout on a directory that was already built by a prior checkout is also permitted. This is similar to specifying the ‘-d’ option to the update command in the sense that new directories that have been created in the repository will appear in your work area. However, checkout takes a module name whereas update takes a directory name. Also to use checkout this way it must be run from the top level directory (where you originally ran checkout from), so before you run checkout to update an existing directory, don't forget to change your directory to the top level directory. For the output produced by the checkout command see . checkout options These standard options are supported by checkout (see , for a complete description of them): -D date Use the most recent revision no later than date.This option is sticky, and implies ‘-P’. See, for more information on sticky tags/dates. -f Only useful with the ‘-D date’ or ‘-rtag’ flags. If no matching revision is found,retrieve the most recent revision (instead of ignoringthe file). -k kflag Process keywords according to kflag. See.This option is sticky; future updates ofthis file in this working directory will use the samekflag. The status command can be viewedto see the sticky options. See , formore information on the status command. -l Local; run only in current working directory. -n Do not run any checkout program (as specifiedwith the ‘-o’ option in the modules file;see ). -P Prune empty directories. See . -p Pipe files to the standard output. -R Checkout directories recursively. This option is on by default. -r tag Use revision tag. This option is sticky, and implies ‘-P’.See , for more information on sticky tags/dates. In addition to those, you can use these special command options with checkout: -A Reset any sticky tags, dates, or ‘-k’ options.Does not reset sticky ‘-k’ options on modified files.See , for more information on sticky tags/dates. -c Copy the module file, sorted, to the standard output,instead of creating or modifying any files ordirectories in your working directory. -d dir Create a directory called dir for the workingfiles, instead of using the module name. In general,using this flag is equivalent to using ‘mkdirdir; cd dir’ followed by the checkoutcommand without the ‘-d’ flag.There is an important exception, however. It is veryconvenient when checking out a single item to have theoutput appear in a directory that doesn't contain emptyintermediate directories. In this case only,cvs tries to “shorten” pathnames to avoid those emptydirectories.For example, given a module ‘foo’ that containsthe file ‘bar.c’, the command ‘cvs co -d dirfoo’ will create directory ‘dir’ and place‘bar.c’ inside. Similarly, given a module‘bar’ which has subdirectory ‘baz’ whereinthere is a file ‘quux.c’, the command ‘cvs co-d dir bar/baz’ will create directory ‘dir’ andplace ‘quux.c’ inside.Using the ‘-N’ flag will defeat this behavior.Given the same module definitions above, ‘cvs co-N -d dir foo’ will create directories ‘dir/foo’and place ‘bar.c’ inside, while ‘cvs co -N -ddir bar/baz’ will create directories ‘dir/bar/baz’and place ‘quux.c’ inside. -j tag With two ‘-j’ options, merge changes from therevision specified with the first ‘-j’ option tothe revision specified with the second ‘j’ option,into the working directory.With one ‘-j’ option, merge changes from theancestor revision to the revision specified with the‘-j’ option, into the working directory. Theancestor revision is the common ancestor of therevision which the working directory is based on, andthe revision specified in the ‘-j’ option.In addition, each -j option can contain an optionaldate specification which, when used with branches, canlimit the chosen revision to one within a specificdate. An optional date is specified by adding a colon(:) to the tag:‘-jSymbolic_Tag:Date_Specifier’.See . -N Only useful together with ‘-d dir’. Withthis option, cvs will not “shorten” module pathsin your working directory when you check out a singlemodule. See the ‘-d’ flag for examples and adiscussion. -s Like ‘-c’, but include the status of all modules,and sort it by the status string. See , forinfo about the ‘-s’ option that is used inside themodules file to set the module status. checkout examples Get a copy of the module ‘tc’: $ cvs checkout tc Get a copy of the module ‘tc’ as it looked one day ago: $ cvs checkout -D yesterday tc commit—Check files into the repository commit (subcommand) Synopsis: commit [-lRf] [-m 'log_message' |-F file] [-r revision] [files…] Requires: working directory, repository. Changes: repository. Synonym: ci Use commit when you want to incorporate changes from your working source files into the source repository. If you don't specify particular files to commit, all of the files in your working current directory are examined. commit is careful to change in the repository only those files that you have really changed. By default (or if you explicitly specify the ‘-R’ option), files in subdirectories are also examined and committed if they have changed; you can use the ‘-l’ option to limit commit to the current directory only. commit verifies that the selected files are up to date with the current revisions in the source repository; it will notify you, and exit without committing, if any of the specified files must be made current first with update (see ). commit does not call the update command for you, but rather leaves that for you to do when the time is right. When all is well, an editor is invoked to allow you to enter a log message that will be written to one or more logging programs (see , and see ) and placed in the rcs file inside the repository. This log message can be retrieved with the log command; see . You can specify the log message on the command line with the ‘-m message’ option, and thus avoid the editor invocation, or use the ‘-F file’ option to specify that the argument file contains the log message. commit options These standard options are supported by commit (see , for a complete description of them): -l Local; run only in current working directory. -R Commit directories recursively. This is on by default. -r revision Commit to revision. revision must beeither a branch, or a revision on the main trunk thatis higher than any existing revision number(see ). Youcannot commit to a specific revision on a branch. commit also supports these options: -F file Read the log message from file, insteadof invoking an editor. -f Note that this is not the standard behavior ofthe ‘-f’ option as defined in .Force cvs to commit a new revision even if you haven'tmade any changes to the file. If the current revisionof file is 1.7, then the following two commandsare equivalent: $ cvs commit -f file $ cvs commit -r 1.8 file The ‘-f’ option disables recursion (i.e., itimplies ‘-l’). To force cvs to commit a newrevision for all files in all subdirectories, you mustuse ‘-f -R’. -m message Use message as the log message, instead ofinvoking an editor. commit examples Committing to a branch You can commit to a branch revision (one that has an even number of dots) with the ‘-r’ option. To create a branch revision, use the ‘-b’ option of the rtag or tag commands (see ). Then, either checkout or update can be used to base your sources on the newly created branch. From that point on, all commit changes made within these working sources will be automatically added to a branch revision, thereby not disturbing main-line development in any way. For example, if you had to create a patch to the 1.2 version of the product, even though the 2.0 version is already under development, you might do: $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module $ cvs checkout -r FCS1_2_Patch product_module $ cd product_module [[ hack away ]] $ cvs commit This works automatically since the ‘-r’ option is sticky. Creating the branch after editing Say you have been working on some extremely experimental software, based on whatever revision you happened to checkout last week. If others in your group would like to work on this software with you, but without disturbing main-line development, you could commit your change to a new branch. Others can then checkout your experimental stuff and utilize the full benefit of cvs conflict resolution. The scenario might look like: [[ hacked sources are present ]] $ cvs tag -b EXPR1 $ cvs update -r EXPR1 $ cvs commit The update command will make the ‘-r EXPR1’ option sticky on all files. Note that your changes to the files will never be removed by the update command. The commit will automatically commit to the correct branch, because the ‘-r’ is sticky. You could also do like this: [[ hacked sources are present ]] $ cvs tag -b EXPR1 $ cvs commit -r EXPR1 but then, only those files that were changed by you will have the ‘-r EXPR1’ sticky flag. If you hack away, and commit without specifying the ‘-r EXPR1’ flag, some files may accidentally end up on the main trunk. To work with you on the experimental change, others would simply do $ cvs checkout -r EXPR1 whatever_module diff—Show differences between revisions diff (subcommand) Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files…] Requires: working directory, repository. Changes: nothing. The diff command is used to compare different revisions of files. The default action is to compare your working files with the revisions they were based on, and report any differences that are found. If any file names are given, only those files are compared. If any directories are given, all files under them will be compared. The exit status for diff is different than for other cvs commands; for details . diff options These standard options are supported by diff (see , for a complete description of them): -D date Use the most recent revision no later than date.See ‘-r’ for how this affects the comparison. -k kflag Process keywords according to kflag. See. -l Local; run only in current working directory. -R Examine directories recursively. This option is on bydefault. -r tag Compare with revision tag. Zero, one or two‘-r’ options can be present. With no ‘-r’option, the working file will be compared with therevision it was based on. With one ‘-r’, thatrevision will be compared to your current working file.With two ‘-r’ options those two revisions will becompared (and your working file will not affect theoutcome in any way). One or both ‘-r’ options can be replaced by a‘-D date’ option, described above. The following options specify the format of the output. They have the same meaning as in GNU diff. Most options have two equivalent names, one of which is a single letter preceded by ‘-’, and the other of which is a long name preceded by ‘--’. -linesShow lines (an integer) lines of context. This option does notspecify an output format by itself; it has no effect unless it iscombined with ‘-c’ or ‘-u’. This option is obsolete. For properoperation, patch typically needs at least two lines of context. -aTreat all files as text and compare them line-by-line, even if theydo not seem to be text. -bIgnore trailing white space and consider all other sequences of one ormore white space characters to be equivalent. -BIgnore changes that just insert or delete blank lines. --binaryRead and write data in binary mode. --briefReport only whether the files differ, not the details of thedifferences. -cUse the context output format. -C lines’‘--context[=lines]Use the context output format, showing lines (an integer) lines ofcontext, or three if lines is not given.For proper operation, patch typically needs at least two lines ofcontext. --changed-group-format=formatUse format to output a line group containing differing lines fromboth files in if-then-else format. See . -dChange the algorithm to perhaps find a smaller set of changes. This makesdiff slower (sometimes much slower). -e’‘--edMake output that is a valid ed script. --expand-tabsExpand tabs to spaces in the output, to preserve the alignment of tabsin the input files. -fMake output that looks vaguely like an ed script but has changesin the order they appear in the file. -F regexpIn context and unified format, for each hunk of differences, show someof the last preceding line that matches regexp. --forward-edMake output that looks vaguely like an ed script but has changesin the order they appear in the file. -HUse heuristics to speed handling of large files that have numerousscattered small changes. --horizon-lines=linesDo not discard the last lines lines of the common prefixand the first lines lines of the common suffix. -iIgnore changes in case; consider upper- and lower-case lettersequivalent. -I regexpIgnore changes that just insert or delete lines that match regexp. --ifdef=nameMake merged if-then-else output using name. --ignore-all-spaceIgnore white space when comparing lines. --ignore-blank-linesIgnore changes that just insert or delete blank lines. --ignore-caseIgnore changes in case; consider upper- and lower-case to be the same. --ignore-matching-lines=regexpIgnore changes that just insert or delete lines that match regexp. --ignore-space-changeIgnore trailing white space and consider all other sequences of one ormore white space characters to be equivalent. --initial-tabOutput a tab rather than a space before the text of a line in normal orcontext format. This causes the alignment of tabs in the line to looknormal. -L labelUse label instead of the file name in the context formatand unified format headers. --label=labelUse label instead of the file name in the context formatand unified format headers. --left-columnPrint only the left column of two common lines in side by side format. --line-format=formatUse format to output all input lines in if-then-else format.See . --minimalChange the algorithm to perhaps find a smaller set of changes. Thismakes diff slower (sometimes much slower). -nOutput RCS-format diffs; like ‘-f’ except that each commandspecifies the number of lines affected. -N’‘--new-fileIn directory comparison, if a file is found in only one directory,treat it as present but empty in the other directory. --new-group-format=formatUse format to output a group of lines taken from just the secondfile in if-then-else format. See . --new-line-format=formatUse format to output a line taken from just the second file inif-then-else format. See . --old-group-format=formatUse format to output a group of lines taken from just the firstfile in if-then-else format. See . --old-line-format=formatUse format to output a line taken from just the first file inif-then-else format. See . -pShow which C function each change is in. --rcsOutput RCS-format diffs; like ‘-f’ except that each commandspecifies the number of lines affected. --report-identical-files’‘-sReport when two files are the same. --show-c-functionShow which C function each change is in. --show-function-line=regexpIn context and unified format, for each hunk of differences, show someof the last preceding line that matches regexp. --side-by-sideUse the side by side output format. --speed-large-filesUse heuristics to speed handling of large files that have numerousscattered small changes. --suppress-common-linesDo not print common lines in side by side format. -tExpand tabs to spaces in the output, to preserve the alignment of tabsin the input files. -TOutput a tab rather than a space before the text of a line in normal orcontext format. This causes the alignment of tabs in the line to looknormal. --textTreat all files as text and compare them line-by-line, even if theydo not appear to be text. -uUse the unified output format. --unchanged-group-format=formatUse format to output a group of common lines taken from both filesin if-then-else format. See . --unchanged-line-format=formatUse format to output a line common to both files in if-then-elseformat. See . -U lines’‘--unified[=lines]Use the unified output format, showing lines (an integer) lines ofcontext, or three if lines is not given.For proper operation, patch typically needs at least two lines ofcontext. -wIgnore white space when comparing lines. -W columns’‘--width=columnsUse an output width of columns in side by side format. -yUse the side by side output format. Line group formats Line group formats let you specify formats suitable for many applications that allow if-then-else input, including programming languages and text formatting languages. A line group format specifies the output format for a contiguous group of similar lines. For example, the following command compares the TeX file myfile with the original version from the repository, and outputs a merged file in which old regions are surrounded by ‘\begin{em}’-‘\end{em}’ lines, and new regions are surrounded by ‘\begin{bf}’-‘\end{bf}’ lines. cvs diff \ --old-group-format='\begin{em} %<\end{em} ' \ --new-group-format='\begin{bf} %>\end{bf} ' \ myfile The following command is equivalent to the above example, but it is a little more verbose, because it spells out the default line group formats. cvs diff \ --old-group-format='\begin{em} %<\end{em} ' \ --new-group-format='\begin{bf} %>\end{bf} ' \ --unchanged-group-format='%=' \ --changed-group-format='\begin{em} %<\end{em} \begin{bf} %>\end{bf} ' \ myfile Here is a more advanced example, which outputs a diff listing with headers containing line numbers in a “plain English” style. cvs diff \ --unchanged-group-format='' \ --old-group-format='-------- %dn line%(n=1?:s) deleted at %df: %<' \ --new-group-format='-------- %dN line%(N=1?:s) added after %de: %>' \ --changed-group-format='-------- %dn line%(n=1?:s) changed at %df: %<-------- to: %>' \ myfile To specify a line group format, use one of the options listed below. You can specify up to four line group formats, one for each kind of line group. You should quote format, because it typically contains shell metacharacters. --old-group-format=formatThese line groups are hunks containing only lines from the first file.The default old group format is the same as the changed group format ifit is specified; otherwise it is a format that outputs the line group as-is. --new-group-format=formatThese line groups are hunks containing only lines from the secondfile. The default new group format is same as the changed groupformat if it is specified; otherwise it is a format that outputs theline group as-is. --changed-group-format=formatThese line groups are hunks containing lines from both files. Thedefault changed group format is the concatenation of the old and newgroup formats. --unchanged-group-format=formatThese line groups contain lines common to both files. The defaultunchanged group format is a format that outputs the line group as-is. In a line group format, ordinary characters represent themselves; conversion specifications start with ‘%’ and have one of the following forms. %<stands for the lines from the first file, including the trailing newline.Each line is formatted according to the old line format (see ). %>stands for the lines from the second file, including the trailing newline.Each line is formatted according to the new line format. %=stands for the lines common to both files, including the trailing newline.Each line is formatted according to the unchanged line format. %%stands for ‘%’. %c'C'where C is a single character, stands for C.C may not be a backslash or an apostrophe.For example, ‘%c':'’ stands for a colon, even insidethe then-part of an if-then-else format, which a colon wouldnormally terminate. %c'\O'where O is a string of 1, 2, or 3 octal digits,stands for the character with octal code O.For example, ‘%c'\0'’ stands for a null character. Fnwhere F is a printf conversion specification and n is oneof the following letters, stands for n's value formatted with F. eThe line number of the line just before the group in the old file. fThe line number of the first line in the group in the old file;equals e + 1. lThe line number of the last line in the group in the old file. mThe line number of the line just after the group in the old file;equals l + 1. nThe number of lines in the group in the old file; equals l - f + 1. E, F, L, M, NLikewise, for lines in the new file. The printf conversion specification can be ‘%d’,‘%o’, ‘%x’, or ‘%X’, specifying decimal, octal,lower case hexadecimal, or upper case hexadecimal outputrespectively. After the ‘%’ the following options can appear insequence: a ‘-’ specifying left-justification; an integerspecifying the minimum field width; and a period followed by anoptional integer specifying the minimum number of digits.For example, ‘%5dN’ prints the number of new lines in the groupin a field of width 5 characters, using the printf format "%5d". (A=B?T:E)If A equals B then T else E.A and B are each either a decimal constantor a single letter interpreted as above.This format spec is equivalent to T ifA's value equals B's; otherwise it is equivalent to E.For example, ‘%(N=0?no:%dN) line%(N=1?:s)’ is equivalent to‘no lines’ if N (the number of lines in the group in thenew file) is 0, to ‘1 line’ if N is 1, and to ‘%dN lines’otherwise. Line formats Line formats control how each line taken from an input file is output as part of a line group in if-then-else format. For example, the following command outputs text with a one-column change indicator to the left of the text. The first column of output is ‘-’ for deleted lines, ‘|’ for added lines, and a space for unchanged lines. The formats contain newline characters where newlines are desired on output. cvs diff \ --old-line-format='-%l ' \ --new-line-format='|%l ' \ --unchanged-line-format=' %l ' \ myfile To specify a line format, use one of the following options. You should quote format, since it often contains shell metacharacters. --old-line-format=formatformats lines just from the first file. --new-line-format=formatformats lines just from the second file. --unchanged-line-format=formatformats lines common to both files. --line-format=formatformats all lines; in effect, it sets all three above options simultaneously. In a line format, ordinary characters represent themselves; conversion specifications start with ‘%’ and have one of the following forms. %lstands for the contents of the line, not counting its trailingnewline (if any). This format ignores whether the line is incomplete. %Lstands for the contents of the line, including its trailing newline(if any). If a line is incomplete, this format preserves itsincompleteness. %%stands for ‘%’. %c'C'where C is a single character, stands for C.C may not be a backslash or an apostrophe.For example, ‘%c':'’ stands for a colon. %c'\O'where O is a string of 1, 2, or 3 octal digits,stands for the character with octal code O.For example, ‘%c'\0'’ stands for a null character. Fnwhere F is a printf conversion specification,stands for the line number formatted with F.For example, ‘%.5dn’ prints the line number using theprintf format "%.5d". See , formore about printf conversion specifications. The default line format is ‘%l’ followed by a newline character. If the input contains tab characters and it is important that they line up on output, you should ensure that ‘%l’ or ‘%L’ in a line format is just after a tab stop (e.g. by preceding ‘%l’ or ‘%L’ with a tab character), or you should use the ‘-t’ or ‘--expand-tabs’ option. Taken together, the line and line group formats let you specify many different formats. For example, the following command uses a format similar to diff's normal format. You can tailor this command to get fine control over diff's output. cvs diff \ --old-line-format='< %l ' \ --new-line-format='> %l ' \ --old-group-format='%df%(f=l?:,%dl)d%dE %<' \ --new-group-format='%dea%dF%(F=L?:,%dL) %>' \ --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL) %<--- %>' \ --unchanged-group-format='' \ myfile diff examples The following line produces a Unidiff (‘-u’ flag) between revision 1.14 and 1.19 of backend.c. Due to the ‘-kk’ flag no keywords are substituted, so differences that only depend on keyword substitution are ignored. $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c Suppose the experimental branch EXPR1 was based on a set of files tagged RELEASE_1_0. To see what has happened on that branch, the following can be used: $ cvs diff -r RELEASE_1_0 -r EXPR1 A command like this can be used to produce a context diff between two releases: $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs If you are maintaining ChangeLogs, a command like the following just before you commit your changes may help you write the ChangeLog entry. All local modifications that have not yet been committed will be printed. $ cvs diff -u | less export—Export sources from CVS, similar to checkout export (subcommand) Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module… Requires: repository. Changes: current directory. This command is a variant of checkout; use it when you want a copy of the source for module without the cvs administrative directories. For example, you might use export to prepare source for shipment off-site. This command requires that you specify a date or tag (with ‘-D’ or ‘-r’), so that you can count on reproducing the source you ship to others (and thus it always prunes empty directories). One often would like to use ‘-kv’ with cvs export. This causes any keywords to be expanded such that an import done at some other site will not lose the keyword revision information. But be aware that doesn't handle an export containing binary files correctly. Also be aware that after having used ‘-kv’, one can no longer use the ident command (which is part of the rcs suite—see ident(1)) which looks for keyword strings. If you want to be able to use ident you must not use ‘-kv’. export options These standard options are supported by export (see , for a complete description of them): -D date Use the most recent revision no later than date. -f If no matching revision is found, retrieve the mostrecent revision (instead of ignoring the file). -l Local; run only in current working directory. -n Do not run any checkout program. -R Export directories recursively. This is on by default. -r tag Use revision tag. In addition, these options (that are common to checkout and export) are also supported: -d dir Create a directory called dir for the workingfiles, instead of using the module name.See , for complete details on howcvs handles this flag. -k subst Set keyword expansion mode (see ). -N Only useful together with ‘-d dir’.See , for complete details on howcvs handles this flag. history—Show status of files and users history (subcommand) Synopsis: history [-report] [-flags] [-options args] [files…] Requires: the file $CVSROOT/CVSROOT/history Changes: nothing. cvs can keep a history file that tracks each use of the checkout, commit, rtag, update, and release commands. You can use history to display this information in various formats. Logging must be enabled by creating the file $CVSROOT/CVSROOT/history. history uses ‘-f’, ‘-l’, ‘-n’, and ‘-p’ in ways that conflict with the normal use inside cvs (see ). history options Several options (shown above as ‘-report’) control what kind of report is generated: -c Report on each time commit was used (i.e., each timethe repository was modified). -e Everything (all record types). Equivalent tospecifying ‘-x’ with all record types. Of course,‘-e’ will also include record types which areadded in a future version of cvs; if you arewriting a script which can only handle certain recordtypes, you'll want to specify ‘-x’. -m module Report on a particular module. (You can meaningfullyuse ‘-m’ more than once on the command line.) -o Report on checked-out modules. This is the default report type. -T Report on all tags. -x type Extract a particular set of record types type from the cvshistory. The types are indicated by single letters,which you may specify in combination.Certain commands have a single record type: F release O checkout E export T rtag One of five record types may result from an update: C A merge was necessary but collisions weredetected (requiring manual merging). G A merge was necessary and it succeeded. U A working file was copied from the repository. P A working file was patched to match the repository. W The working copy of a file was deleted duringupdate (because it was gone from the repository). One of three record types results from commit: A A file was added for the first time. M A file was modified. R A file was removed. The options shown as ‘-flags’ constrain or expand the report without requiring option arguments: -a Show data for all users (the default is to show dataonly for the user executing history). -l Show last modification only. -w Show only the records for modifications done from thesame working directory where history isexecuting. The options shown as ‘-options args’ constrain the report based on an argument: -b str Show data back to a record containing the stringstr in either the module name, the file name, orthe repository path. -D date Show data since date. This is slightly differentfrom the normal use of ‘-D date’, whichselects the newest revision older than date. -f file Show data for a particular file(you can specify several ‘-f’ options on the same command line).This is equivalent to specifying the file on the command line. -n module Show data for a particular module(you can specify several ‘-n’ options on the same command line). -p repository Show data for a particular source repository (youcan specify several ‘-p’ options on the same commandline). -r rev Show records referring to revisions since the revisionor tag named rev appears in individual rcsfiles. Each rcs file is searched for the revision ortag. -t tag Show records since tag tag was last added to thehistory file. This differs from the ‘-r’ flagabove in that it reads only the history file, not thercs files, and is much faster. -u name Show records for user name. -z timezone Show times in the selected records using the specifiedtime zone instead of UTC. import—Import sources into CVS, using vendor branches import (subcommand) Synopsis: import [-options] repository vendortag releasetag… Requires: Repository, source distribution directory. Changes: repository. Use import to incorporate an entire source distribution from an outside source (e.g., a source vendor) into your source repository directory. You can use this command both for initial creation of a repository, and for wholesale updates to the module from the outside source. See , for a discussion on this subject. The repository argument gives a directory name (or a path to a directory) under the cvs root directory for repositories; if the directory did not exist, import creates it. When you use import for updates to source that has been modified in your source repository (since a prior import), it will notify you of any files that conflict in the two branches of development; use ‘checkout -j’ to reconcile the differences, as import instructs you to do. If cvs decides a file should be ignored (see ), it does not import it and prints ‘I ’ followed by the filename (see , for a complete description of the output). If the file $CVSROOT/CVSROOT/cvswrappers exists, any file whose names match the specifications in that file will be treated as packages and the appropriate filtering will be performed on the file/directory before being imported. See . The outside source is saved in a first-level branch, by default 1.1.1. Updates are leaves of this branch; for example, files from the first imported collection of source will be revision 1.1.1.1, then files from the first imported update will be revision 1.1.1.2, and so on. At least three arguments are required. repository is needed to identify the collection of source. vendortag is a tag for the entire branch (e.g., for 1.1.1). You must also specify at least one releasetag to uniquely identify the files at the leaves created each time you execute import. The releasetag should be new, not previously existing in the repository file, and uniquely identify the imported release, Note that import does not change the directory in which you invoke it. In particular, it does not set up that directory as a cvs working directory; if you want to work with the sources import them first and then check them out into a different directory (see ). import options This standard option is supported by import (see , for a complete description): -m message Use message as log information, instead ofinvoking an editor. There are the following additional special options. -b branch See . -k subst Indicate the keyword expansion mode desired. Thissetting will apply to all files created during theimport, but not to any files that previously existed inthe repository. See , for alist of valid ‘-k’ settings. -I name Specify file names that should be ignored duringimport. You can use this option repeatedly. To avoidignoring any files at all (even those ignored bydefault), specify `-I !'.name can be a file name pattern of the same typethat you can specify in the .cvsignore file.See . -W spec Specify file names that should be filtered duringimport. You can use this option repeatedly.spec can be a file name pattern of the same typethat you can specify in the .cvswrappersfile. See . import output import keeps you informed of its progress by printing a line for each file, preceded by one character indicating the status of the file: U file The file already exists in the repository and has not been locallymodified; a new revision has been created (if necessary). N file The file is a new file which has been added to the repository. C file The file already exists in the repository but has been locally modified;you will have to merge the changes. I file The file is being ignored (see ). Symbolic link, importing Link, symbolic, importing L file The file is a symbolic link; cvs import ignores symbolic links.People periodically suggest that this behavior shouldbe changed, but if there is a consensus on what itshould be changed to, it doesn't seem to be apparent.(Various options in the modules file can be usedto recreate symbolic links on checkout, update, etc.;see .) import examples See , and . log—Print out log information for files log (subcommand) Synopsis: log [options] [files…] Requires: repository, working directory. Changes: nothing. Display log information for files. log used to call the rcs utility rlog. Although this is no longer true in the current sources, this history determines the format of the output and the options, which are not quite in the style of the other cvs commands. Timezone, in output Zone, time, in output The output includes the location of the rcs file, the head revision (the latest revision on the trunk), all symbolic names (tags) and some other things. For each revision, the revision number, the author, the number of lines added/deleted and the log message are printed. All times are displayed in Coordinated Universal Time (UTC). (Other parts of cvs print times in the local timezone). log uses ‘-R’ in a way that conflicts with the normal use inside cvs (see ). log options By default, log prints all information that is available. All other options restrict the output. Note that the revision selection options (-d, -r, -s, and -w) have no effect, other than possibly causing a search for files in Attic directories, when used in conjunction with the options that restrict the output to only log header fields (-b, -h, -R, and -t) unless the -S option is also specified. -b Print information about the revisions on the defaultbranch, normally the highest branch on the trunk. -d dates Print information about revisions with a checkindate/time in the range given by thesemicolon-separated list of dates. The date formatsaccepted are those accepted by the ‘-D’ option tomany other cvs commands (see ).Dates can be combined into ranges as follows: d1<d2d2>d1 Select the revisions that were deposited betweend1 and d2. <dd> Select all revisions dated d or earlier. d<>d Select all revisions dated d or later. d Select the single, latest revision dated d orearlier. The ‘>’ or ‘<’ characters may be followed by‘=’ to indicate an inclusive range rather than anexclusive one.Note that the separator is a semicolon (;). -h Print only the name of the rcs file, nameof the file in the working directory, head,default branch, access list, locks, symbolic names, andsuffix. -l Local; run only in current working directory. (Defaultis to run recursively). -N Do not print the list of tags for this file. Thisoption can be very useful when your site uses a lot oftags, so rather than "more"'ing over 3 pages of taginformation, the log information is presented withouttags at all. -R Print only the name of the rcs file. -rrevisions Print information about revisions given in thecomma-separated list revisions of revisions andranges. The following table explains the availablerange formats: rev1:rev2 Revisions rev1 to rev2 (which must be onthe same branch). rev1::rev2 The same, but excluding rev1. :rev::rev Revisions from the beginning of the branch up toand including rev. rev: Revisions starting with rev to the end of thebranch containing rev. rev:: Revisions starting just after rev to the end of thebranch containing rev. branch An argument that is a branch means all revisions onthat branch. branch1:branch2branch1::branch2 A range of branches means all revisionson the branches in that range. branch. The latest revision in branch. A bare ‘-r’ with no revisions means the latestrevision on the default branch, normally the trunk.There can be no space between the ‘-r’ option andits argument. -S Suppress the header if no revisions are selected. -s states Print information about revisions whose stateattributes match one of the states given in thecomma-separated list states. Individual states maybe any text string, though cvs commonly only uses twostates, ‘Exp’ and ‘dead’. See for more information. -t Print the same as ‘-h’, plus the descriptive text. -wlogins Print information about revisions checked in by userswith login names appearing in the comma-separated listlogins. If logins is omitted, the user'slogin is assumed. There can be no space between the‘-w’ option and its argument. log prints the intersection of the revisions selected with the options ‘-d’, ‘-s’, and ‘-w’, intersected with the union of the revisions selected by ‘-b’ and ‘-r’. log examples Contributed examples are gratefully accepted. rdiff—'patch' format diffs between releases rdiff (subcommand) rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules… Requires: repository. Changes: nothing. Synonym: patch Builds a Larry Wall format patch(1) file between two releases, that can be fed directly into the patch program to bring an old release up-to-date with the new release. (This is one of the few cvs commands that operates directly from the repository, and doesn't require a prior checkout.) The diff output is sent to the standard output device. You can specify (using the standard ‘-r’ and ‘-D’ options) any combination of one or two revisions or dates. If only one revision or date is specified, the patch file reflects differences between that revision or date and the current head revisions in the rcs file. Note that if the software release affected is contained in more than one directory, then it may be necessary to specify the ‘-p’ option to the patch command when patching the old sources, so that patch is able to find the files that are located in other directories. rdiff options These standard options are supported by rdiff (see , for a complete description of them): -D date Use the most recent revision no later than date. -f If no matching revision is found, retrieve the mostrecent revision (instead of ignoring the file). -k kflag Process keywords according to kflag. See. -l Local; don't descend subdirectories. -R Examine directories recursively. This option is on by default. -r tag Use revision tag. In addition to the above, these options are available: -c Use the context diff format. This is the default format. -s Create a summary change report instead of a patch. Thesummary includes information about files that werechanged or added between the releases. It is sent tothe standard output device. This is useful for findingout, for example, which files have changed between twodates or revisions. -t A diff of the top two revisions is sent to the standardoutput device. This is most useful for seeing what thelast change to a file was. -u Use the unidiff format for the context diffs.Remember that old versionsof the patch program can't handle the unidiffformat, so if you plan to post this patch to the netyou should probably not use ‘-u’. -V vn Expand keywords according to the rules current inrcs version vn (the expansion format changed withrcs version 5). Note that this option is nolonger accepted. cvs will always expand keywords theway that rcs version 5 does. rdiff examples Suppose you receive mail from foo@example.net asking for an update from release 1.2 to 1.4 of the tc compiler. You have no such patches on hand, but with cvs that can easily be fixed with a command such as this: $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \ $$ Mail -s 'The patches you asked for' foo@example.net Suppose you have made release 1.3, and forked a branch called ‘R_1_3fix’ for bug fixes. ‘R_1_3_1’ corresponds to release 1.3.1, which was made some time ago. Now, you want to see how much development has been done on the branch. This command can be used: $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name cvs rdiff: Diffing module-name File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4 File bar.h,v changed from revision 1.29.2.1 to 1.2 release—Indicate that a Module is no longer in use release (subcommand) release [-d] directories… Requires: Working directory. Changes: Working directory, history log. This command is meant to safely cancel the effect of ‘cvs checkout’. Since cvs doesn't lock files, it isn't strictly necessary to use this command. You can always simply delete your working directory, if you like; but you risk losing changes you may have forgotten, and you leave no trace in the cvs history file (see ) that you've abandoned your checkout. Use ‘cvs release’ to avoid these problems. This command checks that no uncommitted changes are present; that you are executing it from immediately above a cvs working directory; and that the repository recorded for your files is the same as the repository defined in the module database. If all these conditions are true, ‘cvs release’ leaves a record of its execution (attesting to your intentionally abandoning your checkout) in the cvs history log. release options The release command supports one command option: -d Delete your working copy of the file if the releasesucceeds. If this flag is not given your files willremain in your working directory.WARNING: The release command deletesall directories and files recursively. Thishas the very serious side-effect that any directorythat you have created inside your checked-out sources,and not added to the repository (using the addcommand; see ) will be silently deleted—evenif it is non-empty! release output Before release releases your sources it will print a one-line message for any file that is not up-to-date. U fileP file There exists a newer revision of this file in therepository, and you have not modified your local copyof the file (‘U’ and ‘P’ mean the same thing). A file The file has been added to your private copy of thesources, but has not yet been committed to therepository. If you delete your copy of the sourcesthis file will be lost. R file The file has been removed from your private copy of thesources, but has not yet been removed from therepository, since you have not yet committed theremoval. See . M file The file is modified in your working directory. Theremight also be a newer revision inside the repository. ? file file is in your working directory, but does notcorrespond to anything in the source repository, and isnot in the list of files for cvs to ignore (see thedescription of the ‘-I’ option, andsee ). If you remove your workingsources, this file will be lost. release examples Release the tc directory, and delete your local working copy of the files. $ cd .. # You must stand immediately above the # sources when you issue cvs release’. $ cvs release -d tc You have [0] altered files in this repository. Are you sure you want to release (and delete) directory `tc': y $ update—Bring work tree in sync with repository update (subcommand) update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files… Requires: repository, working directory. Changes: working directory. After you've run checkout to create your private copy of source from the common repository, other developers will continue changing the central source. From time to time, when it is convenient in your development process, you can use the update command from within your working directory to reconcile your work with any revisions applied to the source repository since your last checkout or update. update options These standard options are available with update (see , for a complete description of them): -D date Use the most recent revision no later than date.This option is sticky, and implies ‘-P’.See , for more information on sticky tags/dates. -f Only useful with the ‘-D date’ or ‘-rtag’ flags. If no matching revision is found,retrieve the most recent revision (instead of ignoringthe file). -k kflag Process keywords according to kflag. See.This option is sticky; future updates ofthis file in this working directory will use the samekflag. The status command can be viewedto see the sticky options. See , formore information on the status command. -l Local; run only in current working directory. See . -P Prune empty directories. See . -p Pipe files to the standard output. -R Update directories recursively (default). See . -r rev Retrieve revision/tag rev. This option is sticky,and implies ‘-P’.See , for more information on sticky tags/dates. These special options are also available with update. -A Reset any sticky tags, dates, or ‘-k’ options.Does not reset sticky ‘-k’ options on modified files.See , for more information on sticky tags/dates. -C Overwrite locally modified files with clean copies fromthe repository (the modified file is saved in.#file.revision, however). -d Create any directories that exist in the repository ifthey're missing from the working directory. Normally,update acts only on directories and files thatwere already enrolled in your working directory.This is useful for updating directories that werecreated in the repository since the initial checkout;but it has an unfortunate side effect. If youdeliberately avoided certain directories in therepository when you created your working directory(either through use of a module name or by listingexplicitly the files and directories you wanted on thecommand line), then updating with ‘-d’ will createthose directories, which may not be what you want. -I name Ignore files whose names match name (in yourworking directory) during the update. You can specify‘-I’ more than once on the command line to specifyseveral files to ignore. Use ‘-I !’ to avoidignoring any files at all. See , for otherways to make cvs ignore some files. -Wspec Specify file names that should be filtered duringupdate. You can use this option repeatedly.spec can be a file name pattern of the same typethat you can specify in the .cvswrappersfile. See . -jrevision With two ‘-j’ options, merge changes from therevision specified with the first ‘-j’ option tothe revision specified with the second ‘j’ option,into the working directory.With one ‘-j’ option, merge changes from theancestor revision to the revision specified with the‘-j’ option, into the working directory. Theancestor revision is the common ancestor of therevision which the working directory is based on, andthe revision specified in the ‘-j’ option.Note that using a single ‘-j tagname’ option rather than‘-j branchname’ to merge changes from a branch willoften not remove files which were removed on the branch.See , for more.In addition, each ‘-j’ option can contain an optionaldate specification which, when used with branches, canlimit the chosen revision to one within a specificdate. An optional date is specified by adding a colon(:) to the tag:‘-jSymbolic_Tag:Date_Specifier’.See . update output update and checkout keep you informed of their progress by printing a line for each file, preceded by one character indicating the status of the file: U file The file was brought up to date with respect to therepository. This is done for any file that exists inthe repository but not in your working directory, and for filesthat you haven't changed but are not the most recentversions available in the repository. P file Like ‘U’, but the cvs server sends a patch instead of an entirefile. This accomplishes the same thing as ‘U’ using less bandwidth. A file The file has been added to your private copy of thesources, and will be added to the source repositorywhen you run commit on the file. This is areminder to you that the file needs to be committed. R file The file has been removed from your private copy of thesources, and will be removed from the source repositorywhen you run commit on the file. This is areminder to you that the file needs to be committed. M file The file is modified in your working directory.‘M’ can indicate one of two states for a fileyou're working on: either there were no modificationsto the same file in the repository, so that your fileremains as you last saw it; or there were modificationsin the repository as well as in your copy, but theywere merged successfully, without conflict, in yourworking directory.cvs will print some messages if it merges your work,and a backup copy of your working file (as it lookedbefore you ran update) will be made. The exactname of that file is printed while update runs. C file .# files __ files (VMS)A conflict was detected while trying to merge yourchanges to file with changes from the sourcerepository. file (the copy in your workingdirectory) is now the result of attempting to mergethe two revisions; an unmodified copy of your fileis also in your working directory, with the name.#file.revision where revisionis the revision that your modified file startedfrom. Resolve the conflict as described in. (Note that some systems automatically purgefiles that begin with .# if they have not beenaccessed for a few days. If you intend to keep a copyof your original file, it is a very good idea to renameit.) Under vms, the file name starts with__ rather than .#. ? file file is in your working directory, but does notcorrespond to anything in the source repository, and isnot in the list of files for cvs to ignore (see thedescription of the ‘-I’ option, andsee ). Quick reference to CVS commands Command reference Reference, commands Invoking CVS This appendix describes how to invoke cvs, with references to where each command or feature is described in detail. For other references run the cvs --help command, or see . A cvs command looks like: cvs [ global_options ] command [ command_options ] [ command_args ] Global options: --allow-root=rootdir Specify legal cvsroot directory (server only) (notin cvs 1.9 and older). See . -a Authenticate all communication (client only) (not in cvs1.9 and older). See . -b Specify RCS location (cvs 1.9 and older). See. -d root Specify the cvsroot. See . -e editor Edit messages with editor. See . -f Do not read the ~/.cvsrc file. See . -H--help Print a help message. See . -n Do not change any files. See . -Q Be really quiet. See . -q Be somewhat quiet. See . -r Make new working files read-only. See . -s variable=value Set a user variable. See . -T tempdir Put temporary files in tempdir. See . -t Trace cvs execution. See . -v--version Display version and copyright information for cvs. -w Make new working files read-write. See . -x Encrypt all communication (client only).See . -z gzip-level Compression GzipSet the compression level (client only).See . Keyword expansion modes (see ): -kkv $Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp $ -kkvl $Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ -kk $Id$ -kv file1,v 1.1 1993/12/09 03:21:13 joe Exp -ko no expansion -kb no expansion, file is binary Keywords (see ): $Author: joe $ $Date: 1993/12/09 03:21:13 $ $Header: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ $Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ $Locker: harry $ $Name: snapshot_1_14 $ $RCSfile: file1,v $ $Revision: 1.1 $ $Source: /home/files/file1,v $ $State: Exp $ $Log: file1,v $ Revision 1.1 1993/12/09 03:30:17 joe Initial revision Commands, command options, and command arguments: add [options] [files…] Add a new file/directory. See . -k kflag Set keyword expansion. -m msg Set file description. admin [options] [files…] Administration of history files in the repository. See. -b[rev] Set default branch. See . -cstring Set comment leader. -ksubst Set keyword substitution. See . -l[rev] Lock revision rev, or latest revision. -mrev:msg Replace the log message of revision rev withmsg. -orange Delete revisions from the repository. See. -q Run quietly; do not print diagnostics. -sstate[:rev] Set the state. See for more information on possiblestates. -t Set file description from standard input. -tfile Set file description from file. -t-string Set file description to string. -u[rev] Unlock revision rev, or latest revision. annotate [options] [files…] Show last revision where each line was modified. See. -D date Annotate the most recent revision no later thandate. See . -F Force annotation of binary files. (Without this option,binary files are skipped with a message.) -f Use head revision if tag/date not found. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . -r tag Annotate revision tag. See . checkout [options] modules Get a copy of the sources. See . -A Reset any sticky tags/date/options. See and . -c Output the module database. See . -D date Check out revisions as of date (is sticky). See. -d dir Check out into dir. See . -f Use head revision if tag/date not found. See. -j rev Merge in changes. See . -k kflag Use kflag keyword expansion. See. -l Local; run only in current working directory. See . -N Don't “shorten” module paths if -d specified. See. -n Do not run module program (if any). See . -P Prune empty directories. See . -p Check out files to standard output (avoidsstickiness). See . -R Operate recursively (default). See . -r tag Checkout revision tag (is sticky). See . -s Like -c, but include module status. See . commit [options] [files…] Check changes into the repository. See . -F file Read log message from file. See . -f Force the file to be committed; disables recursion.See . -l Local; run only in current working directory. See . -m msg Use msg as log message. See . -n Do not run module program (if any). See . -R Operate recursively (default). See . -r rev Commit to rev. See . diff [options] [files…] Show differences between revisions. See .In addition to the options shown below, accepts a widevariety of options to control output style, for example‘-c’ for context diffs. -D date1 Diff revision for date against working file. See. -D date2 Diff rev1/date1 against date2. See. -l Local; run only in current working directory. See . -N Include diffs for added and removed files. See. -R Operate recursively (default). See . -r rev1 Diff revision for rev1 against working file. See. -r rev2 Diff rev1/date1 against rev2. See . edit [options] [files…] Get ready to edit a watched file. See . -a actions Specify actions for temporary watch, whereactions is edit, unedit,commit, all, or none. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . editors [options] [files…] See who is editing a watched file. See . -l Local; run only in current working directory. See . -R Operate recursively (default). See . export [options] modules Export files from cvs. See . -D date Check out revisions as of date. See. -d dir Check out into dir. See . -f Use head revision if tag/date not found. See. -k kflag Use kflag keyword expansion. See. -l Local; run only in current working directory. See . -N Don't “shorten” module paths if -d specified. See. -n Do not run module program (if any). See . -R Operate recursively (default). See . -r tag Checkout revision tag. See . history [options] [files…] Show repository access history. See . -a All users (default is self). See . -b str Back to record with str in module/file/reposfield. See . -c Report on committed (modified) files. See . -D date Since date. See . -e Report on all record types. See . -l Last modified (committed or modified report). See . -m module Report on module (repeatable). See . -n module In module. See . -o Report on checked out modules. See . -p repository In repository. See . -r rev Since revision rev. See . -T Produce report on all TAGs. See . -t tag Since tag record placed in history file (by anyone).See . -u user For user user (repeatable). See . -w Working directory must match. See . -x types Report on types, one or more ofTOEFWUPCGMAR. See . -z zone Output for time zone zone. See . import [options] repository vendor-tag release-tags Import files into cvs, using vendor branches. See. -b bra Import to vendor branch bra. See. -d Use the file's modification time as the time ofimport. See . -k kflag Set default keyword substitution mode. See. -m msg Use msg for log message. See. -I ign More files to ignore (! to reset). See. -W spec More wrappers. See . init Create a cvs repository if it doesn't exist. See. kserver Kerberos authenticated server.See . log [options] [files…] Print out history information for files. See . -b Only list revisions on the default branch. See . -d dates Specify dates (d1<d2 for range, d forlatest before). See . -h Only print header. See . -l Local; run only in current working directory. See . -N Do not list tags. See . -R Only print name of RCS file. See . -rrevs Only list revisions revs. See . -s states Only list revisions with specified states. See . -t Only print header and descriptive text. See . -wlogins Only list revisions checked in by specified logins. See . login Prompt for password for authenticating server. See. logout Remove stored password for authenticating server. See. pserver Password authenticated server.See . rannotate [options] [modules…] Show last revision where each line was modified. See. -D date Annotate the most recent revision no later thandate. See . -F Force annotation of binary files. (Without this option,binary files are skipped with a message.) -f Use head revision if tag/date not found. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . -r tag Annotate revision tag. See . rdiff [options] modules Show differences between releases. See . -c Context diff output format (default). See . -D date Select revisions based on date. See . -f Use head revision if tag/date not found. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . -r rev Select revisions based on rev. See . -s Short patch - one liner per file. See . -t Top two diffs - last change made to the file. See. -u Unidiff output format. See . -V vers Use RCS Version vers for keyword expansion (obsolete). See. release [options] directory Indicate that a directory is no longer in use. See. -d Delete the given directory. See . remove [options] [files…] Remove an entry from the repository. See . -f Delete the file before removing it. See . -l Local; run only in current working directory. See . -R Operate recursively (default). See . rlog [options] [files…] Print out history information for modules. See . -b Only list revisions on the default branch. See . -d dates Specify dates (d1<d2 for range, d forlatest before). See . -h Only print header. See . -l Local; run only in current working directory. See . -N Do not list tags. See . -R Only print name of RCS file. See . -rrevs Only list revisions revs. See . -s states Only list revisions with specified states. See . -t Only print header and descriptive text. See . -wlogins Only list revisions checked in by specified logins. See . rtag [options] tag modules Add a symbolic tag to a module.See and . -a Clear tag from removed files that would not otherwisebe tagged. See . -b Create a branch named tag. See . -B Used in conjunction with -F or -d, enables movement and deletion ofbranch tags. Use with extreme caution. -D date Tag revisions as of date. See . -d Delete tag. See . -F Move tag if it already exists. See . -f Force a head revision match if tag/date not found.See . -l Local; run only in current working directory. See . -n No execution of tag program. See . -R Operate recursively (default). See . -r rev Tag existing tag rev. See . server Rsh server. See . status [options] files Display status information in a working directory. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . -v Include tag information for file. See . tag [options] tag [files…] Add a symbolic tag to checked out version of files.See and . -b Create a branch named tag. See . -c Check that working files are unmodified. See. -D date Tag revisions as of date. See . -d Delete tag. See . -F Move tag if it already exists. See . -f Force a head revision match if tag/date not found.See . -l Local; run only in current working directory. See . -R Operate recursively (default). See . -r rev Tag existing tag rev. See . unedit [options] [files…] Undo an edit command. See . -l Local; run only in current working directory. See . -R Operate recursively (default). See . update [options] [files…] Bring work tree in sync with repository. See. -A Reset any sticky tags/date/options. See and . -C Overwrite locally modified files with clean copies fromthe repository (the modified file is saved in.#file.revision, however). -D date Check out revisions as of date (is sticky). See. -d Create directories. See . -f Use head revision if tag/date not found. See. -I ign More files to ignore (! to reset). See. -j rev Merge in changes. See . -k kflag Use kflag keyword expansion. See. -l Local; run only in current working directory. See . -P Prune empty directories. See . -p Check out files to standard output (avoidsstickiness). See . -R Operate recursively (default). See . -r tag Checkout revision tag (is sticky). See . -W spec More wrappers. See . version version (subcommand)Display the version of cvs being used. If the repositoryis remote, display both the client and server versions. watch [on|off|add|remove] [options] [files…] on/off: turn on/off read-only checkouts of files. See.add/remove: add or remove notification on actions. See. -a actions Specify actions for temporary watch, whereactions is edit, unedit,commit, all, or none. See. -l Local; run only in current working directory. See . -R Operate recursively (default). See . watchers [options] [files…] See who is watching a file. See . -l Local; run only in current working directory. See . -R Operate recursively (default). See . Reference manual for Administrative files Administrative files (reference) Files, reference manual Reference manual (files) CVSROOT (file) Inside the repository, in the directory $CVSROOT/CVSROOT, there are a number of supportive files for cvs. You can use cvs in a limited fashion without any of them, but if they are set up properly they can help make life easier. For a discussion of how to edit them, see . The most important of these files is the modules file, which defines the modules inside the repository. The modules file Modules (admin file) Defining modules (reference manual) The modules file records your definitions of names for collections of source code. cvs will use these definitions if you use cvs to update the modules file (use normal commands like add, commit, etc). The modules file may contain blank lines and comments (lines beginning with ‘#’) as well as module definitions. Long lines can be continued on the next line by specifying a backslash (‘\’) as the last character on the line. There are three basic types of modules: alias modules, regular modules, and ampersand modules. The difference between them is the way that they map files in the repository to files in the working directory. In all of the following examples, the top-level repository contains a directory called first-dir, which contains two files, file1 and file2, and a directory sdir. first-dir/sdir contains a file sfile. Alias modules Alias modules -a, in modules file Alias modules are the simplest kind of module: mname -a aliases This represents the simplest way of defining a modulemname. The ‘-a’ flags the definition as asimple alias: cvs will treat any use of mname (asa command argument) as if the list of namesaliases had been specified instead.aliases may contain either other module names orpaths. When you use paths in aliases, checkoutcreates all intermediate directories in the workingdirectory, just as if the path had been specifiedexplicitly in the cvs arguments. For example, if the modules file contains: amodule -a first-dir then the following two commands are equivalent: $ cvs co amodule $ cvs co first-dir and they each would provide output such as: cvs checkout: Updating first-dir U first-dir/file1 U first-dir/file2 cvs checkout: Updating first-dir/sdir U first-dir/sdir/sfile Regular modules Regular modules mname [ options ] dir [ files… ] In the simplest case, this form of module definitionreduces to ‘mname dir’. This definesall the files in directory dir as module mname.dir is a relative path (from $CVSROOT) to adirectory of source in the source repository. In thiscase, on checkout, a single directory calledmname is created as a working directory; nointermediate directory levels are used by default, evenif dir was a path involving several directorylevels. For example, if a module is defined by: regmodule first-dir then regmodule will contain the files from first-dir: $ cvs co regmodule cvs checkout: Updating regmodule U regmodule/file1 U regmodule/file2 cvs checkout: Updating regmodule/sdir U regmodule/sdir/sfile $ By explicitly specifying files in the module definition after dir, you can select particular files from directory dir. Here is an example: regfiles first-dir/sdir sfile With this definition, getting the regfiles module will create a single working directory regfiles containing the file listed, which comes from a directory deeper in the cvs source repository: $ cvs co regfiles U regfiles/sfile $ Ampersand modules Ampersand modules &, in modules file A module definition can refer to other modules by including ‘&module’ in its definition. mname [ options ] &module Then getting the module creates a subdirectory for each such module, in the directory containing the module. For example, if modules contains ampermod &first-dir then a checkout will create an ampermod directory which contains a directory called first-dir, which in turns contains all the directories and files which live there. For example, the command $ cvs co ampermod will create the following files: ampermod/first-dir/file1 ampermod/first-dir/file2 ampermod/first-dir/sdir/sfile There is one quirk/bug: the messages that cvs prints omit the ampermod, and thus do not correctly display the location to which it is checking out the files: $ cvs co ampermod cvs checkout: Updating first-dir U first-dir/file1 U first-dir/file2 cvs checkout: Updating first-dir/sdir U first-dir/sdir/sfile $ Do not rely on this buggy behavior; it may get fixed in a future release of cvs. Excluding directories Excluding directories, in modules file !, in modules file An alias module may exclude particular directories from other modules by using an exclamation mark (‘!’) before the name of each directory to be excluded. For example, if the modules file contains: exmodule -a !first-dir/sdir first-dir then checking out the module ‘exmodule’ will check out everything in ‘first-dir’ except any files in the subdirectory ‘first-dir/sdir’. Module options Options, in modules file Either regular modules or ampersand modules can contain options, which supply additional information concerning the module. -d, in modules file-d name Name the working directory something other than themodule name. Export program -e, in modules file -e prog Specify a program prog to run whenever files in amodule are exported. prog runs with a singleargument, the module name. Checkout program -o, in modules file -o prog Specify a program prog to run whenever files in amodule are checked out. prog runs with a singleargument, the module name. See forinformation on how prog is called. Status of a module Module status -s, in modules file -s status Assign a status to the module. When the module file isprinted with ‘cvs checkout -s’ the modules aresorted according to primarily module status, andsecondarily according to the module name. This optionhas no other meaning. You can use this option forseveral things besides status: for instance, list theperson that is responsible for this module. Tag program -t, in modules file -t prog Specify a program prog to run whenever files in amodule are tagged with rtag. prog runswith two arguments: the module name and the symbolictag specified to rtag. It is not runwhen tag is executed. Generally you will findthat the taginfo file is a better solution (see ). You should also see see about how the “program options” programs are run. How the modules file “program options” programs are run Modules file program options -t, in modules file -o, in modules file -e, in modules file For checkout, rtag, and export, the program is server-based, and as such the following applies:- If using remote access methods (pserver, ext, etc.), cvs will execute this program on the server from a temporary directory. The path is searched for this program. If using “local access” (on a local or remote NFS file system, i.e. repository set just to a path), the program will be executed from the newly checked-out tree, if found there, or alternatively searched for in the path if not. The programs are all run after the operation has effectively completed. The cvswrappers file cvswrappers (admin file) CVSWRAPPERS, environment variable Wrappers Wrappers refers to a cvs feature which lets you control certain settings based on the name of the file which is being operated on. The settings are ‘-k’ for binary files, and ‘-m’ for nonmergeable text files. The ‘-m’ option specifies the merge methodology that should be used when a non-binary file is updated. MERGE means the usual cvs behavior: try to merge the files. COPY means that cvs update will refuse to merge files, as it also does for files specified as binary with ‘-kb’ (but if the file is specified as binary, there is no need to specify ‘-m 'COPY'’). cvs will provide the user with the two versions of the files, and require the user using mechanisms outside cvs, to insert any necessary changes. WARNING: do not use COPY with cvs 1.9 or earlier - such versions of cvs will copy one version of your file over the other, wiping out the previous contents. The ‘-m’ wrapper option only affects behavior when merging is done on update; it does not affect how files are stored. See , for more on binary files. The basic format of the file cvswrappers is: wildcard [option value][option value]... where option is one of -m update methodology value: MERGE or COPY -k keyword expansion value: expansion mode and value is a single-quote delimited value. For example, the following command imports a directory, treating files whose name ends in ‘.exe’ as binary: cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag The Trigger Scripts Info files Trigger scripts Several of the administrative files support triggers, or the launching external scripts or programs at specific times before or after particular events. The individual files are discussed in the later sections, and , but some of the common elements are discussed here. All the trigger scripts are launched in a copy of the user sandbox being committed, on the server, in client-server mode. In local mode, the scripts are actually launched directly from the user sandbox directory being committed. For most intents and purposes, the same scripts can be run in both locations without alteration. The common syntax Info files (syntax) Syntax of info files Common syntax of info files The administrative files such as commitinfo, loginfo, rcsinfo, verifymsg, etc., all have a common format. The purpose of the files are described later on. The common syntax is described here. Regular expression syntax Each line contains the following: A regular expression. This is a basic regularexpression in the syntax used by GNU emacs. A whitespace separator—one or more spaces and/or tabs. A file name or command-line template. Blank lines are ignored. Lines that start with the character ‘#’ are treated as comments. Long lines unfortunately can not be broken in two parts in any way. The first regular expression that matches the current directory name in the repository is used. The rest of the line is used as a file name or command-line as appropriate. Security and the Trigger Scripts Info files, security Trigger scripts, security Security is a huge subject, and implementing a secure system is a non-trivial task. This section will barely touch on all the issues involved, but it is well to note that, as with any script you will be allowing an untrusted user to run on your server, there are measures you can take to help prevent your trigger scripts from being abused. For instance, since the CVS trigger scripts all run in a copy of the user's sandbox on the server, a naively coded Perl trigger script which attempts to use a Perl module that is not installed on the system can be hijacked by any user with commit access who is checking in a file with the correct name. Other scripting languages may be vulnerable to similar hacks. One way to make a script more secure, at least with Perl, is to use scripts which invoke the -T, or "taint-check" switch on their #! line. In the most basic terms, this causes Perl to avoid running code that may have come from an external source. Please run the perldoc perlsec command for more on Perl security. Again, other languages may implement other security verification hooks which look more or less like Perl's "taint-check" mechanism. The commit support files Committing, administrative support files There are three kinds of trigger scripts (see ) that can be run at various times during a commit. They are specified in files in the repository, as described below. The following table summarizes the file names and the purpose of the corresponding programs. commitinfo The program is responsible for checking that the commitis allowed. If it exits with a non-zero exit statusthe commit will be aborted. verifymsg The specified program is used to evaluate the log message,and possibly verify that it contains all requiredfields. This is most useful in combination with thercsinfo file, which can hold a log messagetemplate (see ). editinfo The specified program is used to edit the log message,and possibly verify that it contains all requiredfields. This is most useful in combination with thercsinfo file, which can hold a log messagetemplate (see ). (obsolete) loginfo The specified program is called when the commit iscomplete. It receives the log message and someadditional information and can store the log message ina file, or mail it to appropriate persons, or maybepost it to a local newsgroup, or… Yourimagination is the limit! Commitinfo commitinfo Commits, precommit verification of Precommit checking The commitinfo file defines programs to execute whenever ‘cvs commit’ is about to execute. These programs are used for pre-commit checking to verify that the modified, added and removed files are really ready to be committed. This could be used, for instance, to verify that the changed files conform to to your site's standards for coding practice. As mentioned earlier, each line in the commitinfo file consists of a regular expression and a command-line template. The template can include a program name and any number of arguments you wish to supply to it. The full path to the current source repository is appended to the template, followed by the file names of any files involved in the commit (added, removed, and modified files). Exit status, of commitinfo The first line with a regular expression matching the directory within the repository will be used. If the command returns a non-zero exit status the commit will be aborted. DEFAULT in commitinfo If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified. ALL in commitinfo All occurrences of the name ‘ALL’ appearing as a regular expression are used in addition to the first matching regular expression or the name ‘DEFAULT’. commitinfo, working directory commitinfo, command environment The command will be run in the root of the workspace containing the new versions of any files the user would like to modify (commit), or in a copy of the workspace on the server (see ). If a file is being removed, there will be no copy of the file under the current directory. If a file is being added, there will be no corresponding archive file in the repository unless the file is being resurrected. Note that both the repository directory and the corresponding Attic (see ) directory may need to be checked to locate the archive file corresponding to any given file being committed. Much of the information about the specific commit request being made, including the destination branch, commit message, and command line options specified, is not available to the command. Verifying log messages verifymsg (admin file) Log message, verifying Once you have entered a log message, you can evaluate that message to check for specific content, such as a bug ID. Use the verifymsg file to specify a program that is used to verify the log message. This program could be a simple script that checks that the entered message contains the required fields. The verifymsg file is often most useful together with the rcsinfo file, which can be used to specify a log message template. Each line in the verifymsg file consists of a regular expression and a command-line template. The template must include a program name, and can include any number of arguments. The full path to the current log message template file is appended to the template. One thing that should be noted is that the ‘ALL’ keyword is not supported. If more than one matching line is found, the first one is used. This can be useful for specifying a default verification script in a directory, and then overriding it in a subdirectory. DEFAULT in verifymsg If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified. Exit status, of verifymsg If the verification script exits with a non-zero exit status, the commit is aborted. verifymsg, changing the log message In the default configuration, CVS allows the verification script to change the log message. This is controlled via the RereadLogAfterVerify CVSROOT/config option. When ‘RereadLogAfterVerify=always’ or ‘RereadLogAfterVerify=stat’, the log message will either always be reread after the verification script is run or reread only if the log message file status has changed. See , for more on CVSROOT/config options. It is NOT a good idea for a verifymsg script to interact directly with the user in the various client/server methods. For the pserver method, there is no protocol support for communicating between verifymsg and the client on the remote end. For the ext and server methods, it is possible for CVS to become confused by the characters going along the same channel as the CVS protocol messages. See , for more information on client/server setups. In addition, at the time the verifymsg script runs, the CVS server has locks in place in the repository. If control is returned to the user here then other users may be stuck waiting for access to the repository. This option can be useful if you find yourself using an rcstemplate that needs to be modified to remove empty elements or to fill in default values. It can also be useful if the rcstemplate has changed in the repository and the CVS/Template was not updated, but is able to be adapted to the new format by the verification script that is run by verifymsg. An example of an update might be to change all occurrences of 'BugId:' to be 'DefectId:' (which can be useful if the rcstemplate has recently been changed and there are still checked-out user trees with cached copies in the CVS/Template file of the older version). Another example of an update might be to delete a line that contains 'BugID: none' from the log message after validation of that value as being allowed is made. The following is a little silly example of a verifymsg file, together with the corresponding rcsinfo file, the log message template and an verification script. We begin with the log message template. We want to always record a bug-id number on the first line of the log message. The rest of log message is free text. The following template is found in the file /usr/cvssupport/tc.template. BugId: The script /usr/cvssupport/bugid.verify is used to evaluate the log message. #!/bin/sh # # bugid.verify filename # # Verify that the log message contains a valid bugid # on the first line. # if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then exit 0 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then # It is okay to allow commits with 'BugId: none', # but do not put that text into the real log message. grep -v '^BugId:[ ]*none$' > $1.rewrite mv $1.rewrite $1 exit 0 else echo "No BugId found." exit 1 fi The verifymsg file contains this line: ^tc /usr/cvssupport/bugid.verify The rcsinfo file contains this line: ^tc /usr/cvssupport/tc.template The config file contains this line: RereadLogAfterVerify=always Editinfo editinfo (admin file) Editor, specifying per module Per-module editor Log messages, editing The editinfo feature has been rendered obsolete. To set a default editor for log messages use the CVSEDITOR, EDITOR environment variables (see ) or the ‘-e’ global option (see ). See , for information on the use of the verifymsg feature for evaluating log messages. If you want to make sure that all log messages look the same way, you can use the editinfo file to specify a program that is used to edit the log message. This program could be a custom-made editor that always enforces a certain style of the log message, or maybe a simple shell script that calls an editor, and checks that the entered message contains the required fields. If no matching line is found in the editinfo file, the editor specified in the environment variable $CVSEDITOR is used instead. If that variable is not set, then the environment variable $EDITOR is used instead. If that variable is not set a default will be used. See . The editinfo file is often most useful together with the rcsinfo file, which can be used to specify a log message template. Each line in the editinfo file consists of a regular expression and a command-line template. The template must include a program name, and can include any number of arguments. The full path to the current log message template file is appended to the template. One thing that should be noted is that the ‘ALL’ keyword is not supported. If more than one matching line is found, the first one is used. This can be useful for specifying a default edit script in a module, and then overriding it in a subdirectory. DEFAULT in editinfo If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified. If the edit script exits with a non-zero exit status, the commit is aborted. Note: when cvs is accessing a remote repository, or when the ‘-m’ or ‘-F’ options to cvs commit are used, editinfo will not be consulted. There is no good workaround for this; use verifymsg instead. Editinfo example The following is a little silly example of a editinfo file, together with the corresponding rcsinfo file, the log message template and an editor script. We begin with the log message template. We want to always record a bug-id number on the first line of the log message. The rest of log message is free text. The following template is found in the file /usr/cvssupport/tc.template. BugId: The script /usr/cvssupport/bugid.edit is used to edit the log message. #!/bin/sh # # bugid.edit filename # # Call $EDITOR on FILENAME, and verify that the # resulting file contains a valid bugid on the first # line. if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi $CVSEDITOR $1 until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1 do echo -n "No BugId found. Edit again? ([y]/n)" read ans case ${ans} in n*) exit 1;; esac $CVSEDITOR $1 done The editinfo file contains this line: ^tc /usr/cvssupport/bugid.edit The rcsinfo file contains this line: ^tc /usr/cvssupport/tc.template Loginfo loginfo (admin file) Storing log messages Mailing log messages Distributing log messages Log messages The loginfo file is used to control where ‘cvs commit’ log information is sent. The first entry on a line is a regular expression which is tested against the directory that the change is being made to, relative to the $CVSROOT. If a match is found, then the remainder of the line is a filter program that should expect log information on its standard input. Note that the filter program must read all of the log information or cvs may fail with a broken pipe signal. If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified. All occurrences of the name ‘ALL’ appearing as a regular expression are used in addition to the first matching regular expression or ‘DEFAULT’. The first matching regular expression is used. See , for a description of the syntax of the loginfo file. The user may specify a format string as part of the filter. The string is composed of a ‘%’ followed by a space, or followed by a single format character, or followed by a set of format characters surrounded by ‘{’ and ‘}’ as separators. The format characters are: s file name V old version number (pre-checkin) v new version number (post-checkin) All other characters that appear in a format string expand to an empty field (commas separating fields are still provided). For example, some valid format strings are ‘%’, ‘%s’, ‘%{s}’, and ‘%{sVv}’. The output will be a space separated string of tokens enclosed in quotation marks ("). Any embedded dollar signs ($), backticks (`), backslashes (\), or quotation marks will be preceded by a backslash (this allows the shell to correctly parse it as a single string, reguardless of the characters it contains). For backwards compatibility, the first token will be the repository subdirectory. The rest of the tokens will be comma-delimited lists of the information requested in the format string. For example, if ‘/u/src/master/yoyodyne/tc’ is the repository, ‘%{sVv}’ is the format string, and three files (ChangeLog, Makefile, foo.c) were modified, the output might be: "yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13" As another example, ‘%{}’ means that only the name of the repository will be generated. Note: when cvs is accessing a remote repository, loginfo will be run on the remote (i.e., server) side, not the client side (see ). Loginfo example The following loginfo file, together with the tiny shell-script below, appends all log messages to the file $CVSROOT/CVSROOT/commitlog, and any commits to the administrative files (inside the CVSROOT directory) are also logged in /usr/adm/cvsroot-log. Commits to the prog1 directory are mailed to ceder. ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER ^CVSROOT /usr/local/bin/cvs-log /usr/adm/cvsroot-log ^prog1 Mail -s %s ceder The shell-script /usr/local/bin/cvs-log looks like this: #!/bin/sh (echo "------------------------------------------------------"; echo -n $2" "; date; echo; cat) >> $1 Keeping a checked out copy Keeping a checked out copy Checked out copy, keeping Web pages, maintaining with CVS It is often useful to maintain a directory tree which contains files which correspond to the latest version in the repository. For example, other developers might want to refer to the latest sources without having to check them out, or you might be maintaining a web site with cvs and want every checkin to cause the files used by the web server to be updated. The way to do this is by having loginfo invoke cvs update. Doing so in the naive way will cause a problem with locks, so the cvs update must be run in the background. Here is an example for unix (this should all be on one line): ^cyclic-pages (date; cat; (sleep 2; cd /u/www/local-docs; cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1 This will cause checkins to repository directories starting with cyclic-pages to update the checked out tree in /u/www/local-docs. Rcsinfo rcsinfo (admin file) Form for log message Log message template Template for log message The rcsinfo file can be used to specify a form to edit when filling out the commit log. The rcsinfo file has a syntax similar to the verifymsg, commitinfo and loginfo files. See . Unlike the other files the second part is not a command-line template. Instead, the part after the regular expression should be a full pathname to a file containing the log message template. If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified. All occurrences of the name ‘ALL’ appearing as a regular expression are used in addition to the first matching regular expression or ‘DEFAULT’. The log message template will be used as a default log message. If you specify a log message with ‘cvs commit -m message’ or ‘cvs commit -f file’ that log message will override the template. See , for an example rcsinfo file. When cvs is accessing a remote repository, the contents of rcsinfo at the time a directory is first checked out will specify a template which does not then change. If you edit rcsinfo or its templates, you may need to check out a new working directory. Taginfo taginfo (admin file) Tags, logging Tags, verifying The taginfo file defines programs to execute when someone executes a tag or rtag command. The taginfo file has the standard form for trigger scripts (see ), where each line is a regular expression followed by a command to execute (see ). The arguments passed to the command are, in order, the tagname, operation (add for tag, mov for tag -F, and del for tag -d), repository, and any remaining are pairs of filename revision. A non-zero exit of the filter program will cause the tag to be aborted. Here is an example of using the taginfo file to log tag and rtag commands. In the taginfo file put: ALL /usr/local/cvsroot/CVSROOT/loggit Where /usr/local/cvsroot/CVSROOT/loggit contains the following script: #!/bin/sh echo "$@" >>/home/kingdon/cvsroot/CVSROOT/taglog Ignoring files via cvsignore cvsignore (admin file), global Global cvsignore Ignoring files There are certain file names that frequently occur inside your working copy, but that you don't want to put under cvs control. Examples are all the object files that you get while you compile your sources. Normally, when you run ‘cvs update’, it prints a line for each file it encounters that it doesn't know about (see ). cvs has a list of files (or sh(1) file name patterns) that it should ignore while running update, import and release. This list is constructed in the following way. The list is initialized to include certain file namepatterns: names associated with cvsadministration, or with other common source controlsystems; common names for patch files, object files,archive files, and editor backup files; and other namesthat are usually artifacts of assorted utilities.Currently, the default list of ignored file namepatterns is: Ignored files Automatically ignored files RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core The per-repository list in$CVSROOT/CVSROOT/cvsignore is appended tothe list, if that file exists. The per-user list in .cvsignore in your homedirectory is appended to the list, if it exists. Any entries in the environment variable$CVSIGNORE is appended to the list. Any ‘-I’ options given to cvs is appended. As cvs traverses through your directories, the contentsof any .cvsignore will be appended to the list.The patterns found in .cvsignore are only validfor the directory that contains them, not forany sub-directories. In any of the 5 places listed above, a single exclamation mark (‘!’) clears the ignore list. This can be used if you want to store any file which normally is ignored by cvs. Specifying ‘-I !’ to cvs import will import everything, which is generally what you want to do if you are importing files from a pristine distribution or any other source which is known to not contain any extraneous files. However, looking at the rules above you will see there is a fly in the ointment; if the distribution contains any .cvsignore files, then the patterns from those files will be processed even if ‘-I !’ is specified. The only workaround is to remove the .cvsignore files in order to do the import. Because this is awkward, in the future ‘-I !’ might be modified to override .cvsignore files in each directory. Note that the syntax of the ignore files consists of a series of lines, each of which contains a space separated list of filenames. This offers no clean way to specify filenames which contain spaces, but you can use a workaround like foo?bar to match a file named foo bar (it also matches fooxbar and the like). Also note that there is currently no way to specify comments. The checkoutlist file checkoutlist It may be helpful to use cvs to maintain your own files in the CVSROOT directory. For example, suppose that you have a script logcommit.pl which you run by including the following line in the commitinfo administrative file: ALL $CVSROOT/CVSROOT/logcommit.pl To maintain logcommit.pl with cvs you would add the following line to the checkoutlist administrative file: logcommit.pl The format of checkoutlist is one line for each file that you want to maintain using cvs, giving the name of the file, followed optionally by more whitespace and any error message that should print if the file cannot be checked out into CVSROOT after a commit: logcommit.pl Could not update CVSROOT/logcommit.pl. After setting up checkoutlist in this fashion, the files listed there will function just like cvs's built-in administrative files. For example, when checking in one of the files you should get a message such as: cvs commit: Rebuilding administrative file database and the checked out copy in the CVSROOT directory should be updated. Note that listing passwd (see ) in checkoutlist is not recommended for security reasons. For information about keeping a checkout out copy in a more general context than the one provided by checkoutlist, see . The history file History file Log information, saving The file $CVSROOT/CVSROOT/history is used to log information for the history command (see ). This file must be created to turn on logging. This is done automatically if the cvs init command is used to set up the repository (see ). The file format of the history file is documented only in comments in the cvs source code, but generally programs should use the cvs history command to access it anyway, in case the format changes with future releases of cvs. Expansions in administrative files Internal variables Variables Sometimes in writing an administrative file, you might want the file to be able to know various things based on environment cvs is running in. There are several mechanisms to do that. To find the home directory of the user running cvs (from the HOME environment variable), use ‘~’ followed by ‘/’ or the end of the line. Likewise for the home directory of user, use ‘~user’. These variables are expanded on the server machine, and don't get any reasonable expansion if pserver (see ) is in use; therefore user variables (see below) may be a better choice to customize behavior based on the user running cvs. One may want to know about various pieces of information internal to cvs. A cvs internal variable has the syntax ${variable}, where variable starts with a letter and consists of alphanumeric characters and ‘_’. If the character following variable is a non-alphanumeric character other than ‘_’, the ‘{’ and ‘}’ can be omitted. The cvs internal variables are: CVSROOT CVSROOT, internal variableThis is the absolute path to the current cvs root directory.See , for a description of the variousways to specify this, but note that the internalvariable contains just the directory and not anyof the access method information. RCSBIN RCSBIN, internal variableIn cvs 1.9.18 and older, this specified thedirectory where cvs was looking for rcsprograms. Because cvs no longer runs rcsprograms, specifying this internal variable is now anerror. CVSEDITOR CVSEDITOR, internal variable EDITOR EDITOR, internal variable VISUAL VISUAL, internal variableThese all expand to the same value, which is the editorthat cvs is using. See , for howto specify this. USER USER, internal variableUsername of the user running cvs (on the cvsserver machine).When using pserver, this is the user specified in the repositoryspecification which need not be the same as the username theserver is running as (see ).Do not confuse this with the environment variable of the same name. If you want to pass a value to the administrative files which the user who is running cvs can specify, use a user variable. User variables To expand a user variable, the administrative file contains ${=variable}. To set a user variable, specify the global option ‘-s’ to cvs, with argument variable=value. It may be particularly useful to specify this option via .cvsrc (see ). For example, if you want the administrative file to refer to a test directory you might create a user variable TESTDIR. Then if cvs is invoked as cvs -s TESTDIR=/work/local/tests and the administrative file contains sh ${=TESTDIR}/runtests, then that string is expanded to sh /work/local/tests/runtests. All other strings containing ‘$’ are reserved; there is no way to quote a ‘$’ character so that ‘$’ represents itself. Environment variables passed to administrative files are: environment variables, passed to administrative filesCVS_USER CVS_USER, environment variableThe cvs-specific username provided by the user, if itcan be provided (currently just for the pserver accessmethod), and to the empty string otherwise. (CVS_USERand USER may differ when $CVSROOT/CVSROOT/passwdis used to map cvs usernames to system usernames.) LOGNAME LOGNAME, environment variableThe username of the system user. USER USER, environment variableSame as LOGNAME.Do not confuse this with the internal variable of the same name. The CVSROOT/config configuration file config, in CVSROOT CVSROOT/config The administrative file config contains various miscellaneous settings which affect the behavior of cvs. The syntax is slightly different from the other administrative files. Variables are not expanded. Lines which start with ‘#’ are considered comments. Other lines consist of a keyword, ‘=’, and a value. Note that this syntax is very strict. Extraneous spaces or tabs are not permitted. Currently defined keywords are: RCSBIN, in CVSROOT/configRCSBIN=bindir For cvs 1.9.12 through 1.9.18, this setting toldcvs to look for rcs programs in thebindir directory. Current versions of cvsdo not run rcs programs; for compatibility thissetting is accepted, but it does nothing. SystemAuth, in CVSROOT/config SystemAuth=value If value is ‘yes’, then pserver should checkfor users in the system's user database if not found inCVSROOT/passwd. If it is ‘no’, then allpserver users must exist in CVSROOT/passwd.The default is ‘yes’. For more on pserver, see. TopLevelAdmin, in CVSROOT/config TopLevelAdmin=value Modify the ‘checkout’ command to create a‘CVS’ directory at the top level of the newworking directory, in addition to ‘CVS’directories created within checked-out directories.The default value is ‘no’.This option is useful if you find yourself performingmany commands at the top level of your workingdirectory, rather than in one of the checked outsubdirectories. The CVS directory created therewill mean you don't have to specify CVSROOT foreach command. It also provides a place for theCVS/Template file (see ). LockDir, in CVSROOT/config LockDir=directory Put cvs lock files in directory rather thandirectly in the repository. This is useful if you wantto let users read from the repository while giving themwrite access only to directory, not to therepository.It can also be used to put the locks on a very fastin-memory file system to speed up locking and unlockingthe repository.You need to create directory, butcvs will create subdirectories of directory as itneeds them. For information on cvs locks, see. Before enabling the LockDir option, make sure that youhave tracked down and removed any copies of cvs 1.9 orolder. Such versions neither support LockDir, nor willgive an error indicating that they don't support it.The result, if this is allowed to happen, is that somecvs users will put the locks one place, and others willput them another place, and therefore the repositorycould become corrupted. cvs 1.10 does not supportLockDir but it will print a warning if run on arepository with LockDir enabled. LogHistory, in CVSROOT/config LogHistory=value Control what is logged to the CVSROOT/history file (see ).Default of ‘TOEFWUPCGMAR’ (or simply ‘all’) will logall transactions. Any subset of the default islegal. (For example, to only log transactions that modify the*,v files, use ‘LogHistory=TMAR’.) RereadLogAfterVerify, in CVSROOT/config verifymsg, changing the log message RereadLogAfterVerify=value Modify the ‘commit’ command such that CVS will reread thelog message after running the program specified by verifymsg.value may be one of ‘yes’ or ‘always’, indicating thatthe log message should always be reread; ‘no’or ‘never’, indicating that it should never bereread; or value may be ‘stat’, indicatingthat the file should be checked with the file system‘stat()’ function to see if it has changed (see warning below)before rereading. The default value is ‘always’.The `stat' mode can cause CVS to pause for up toone extra second per directory committed. This can be less IO andCPU intensive but is not recommended for use with large repositoriesSee , for more information on how verifymsgmay be used. All environment variables which affect CVS Environment variables Reference manual for variables This is a complete list of all environment variables that affect cvs. CVSIGNORE, environment variable$CVSIGNORE A whitespace-separated list of file name patterns thatcvs should ignore. See . CVSWRAPPERS, environment variable $CVSWRAPPERS A whitespace-separated list of file name patterns thatcvs should treat as wrappers. See . CVSREAD, environment variable Read-only files, and CVSREAD $CVSREAD If this is set, checkout and update willtry hard to make the files in your working directoryread-only. When this is not set, the default behavioris to permit modification of your working files. $CVSUMASK Controls permissions of files in the repository. See. $CVSROOT Should contain the full pathname to the root of the cvssource repository (where the rcs files arekept). This information must be available to cvs formost commands to execute; if $CVSROOT is not set,or if you wish to override it for one invocation, youcan supply it on the command line: ‘cvs -d cvsrootcvs_command…’ Once you have checked out a workingdirectory, cvs stores the appropriate root (inthe file CVS/Root), so normally you only need toworry about this when initially checking out a workingdirectory. $CVSEDITOR CVSEDITOR, environment variable $EDITOR EDITOR, environment variable $VISUAL VISUAL, environment variableSpecifies the program to use for recording log messagesduring commit. $CVSEDITOR overrides$EDITOR, which overrides $VISUAL.See for more or for alternative ways of specifying alog editor. PATH, environment variable $PATH If $RCSBIN is not set, and no path is compiledinto cvs, it will use $PATH to try to find allprograms it uses. HOME, environment variable $HOME HOMEPATH, environment variable $HOMEPATH HOMEDRIVE, environment variable $HOMEDRIVE Used to locate the directory where the .cvsrcfile, and other such files, are searched. On Unix, cvsjust checks for HOME. On Windows NT, the system willset HOMEDRIVE, for example to ‘d:’ and HOMEPATH,for example to \joe. On Windows 95, you'llprobably need to set HOMEDRIVE and HOMEPATH yourself. CVS_RSH, environment variable $CVS_RSH Specifies the external program which cvs connects with,when :ext: access method is specified.see . $CVS_SERVER Used in client-server mode when accessing a remoterepository using rsh. It specifies the name ofthe program to start on the server side (and anynecessary arguments) when accessing a remote repositoryusing the :ext:, :fork:, or :server: access methods.The default value for :ext: and :server: is cvs;the default value for :fork: is the name used to run the client.see $CVS_PASSFILE Used in client-server mode when accessing the cvslogin server. Default value is $HOME/.cvspass.see $CVS_CLIENT_PORT Used in client-server mode to set the port to use when accessing the servervia Kerberos, GSSAPI, or cvs's password authentication protocolif the port is not specified in the CVSROOT.see CVS_RCMD_PORT, environment variable $CVS_RCMD_PORT Used in client-server mode. If set, specifies the portnumber to be used when accessing the rcmd demon onthe server side. (Currently not used for Unix clients). CVS_CLIENT_LOG, environment variable $CVS_CLIENT_LOG Used for debugging only in client-servermode. If set, everything sent to the server is loggedinto $CVS_CLIENT_LOG.in and everythingsent from the server is logged into$CVS_CLIENT_LOG.out. CVS_SERVER_SLEEP, environment variable $CVS_SERVER_SLEEP Used only for debugging the server side inclient-server mode. If set, delays the start of theserver child process the specified amount ofseconds so that you can attach to it with a debugger. CVS_IGNORE_REMOTE_ROOT, environment variable $CVS_IGNORE_REMOTE_ROOT For cvs 1.10 and older, setting this variableprevents cvs from overwriting the CVS/Rootfile when the ‘-d’ global option is specified.Later versions of cvs do not rewriteCVS/Root, so CVS_IGNORE_REMOTE_ROOT has noeffect. COMSPEC, environment variable $COMSPEC Used under OS/2 only. It specifies the name of thecommand interpreter and defaults to cmd.exe. TMPDIR, environment variable $TMPDIR TMP, environment variable $TMP TEMP, environment variable $TEMP Temporary files, location of Directory in which temporary files are located.The cvs server usesTMPDIR. See , for adescription of how to specify this.Some parts of cvs will always use /tmp (viathe tmpnam function provided by the system).On Windows NT, TMP is used (via the _tempnamfunction provided by the system).The patch program which is used by the cvsclient uses TMPDIR, and if it is not set, uses/tmp (at least with GNU patch 2.1). Note thatif your server and client are both running cvs1.9.10 or later, cvs will not invoke an externalpatch program. Compatibility between CVS Versions CVS, versions of Versions, of CVS Compatibility, between CVS versions The repository format is compatible going back to cvs 1.3. But see , if you have copies of cvs 1.6 or older and you want to use the optional developer communication features. The working directory format is compatible going back to cvs 1.5. It did change between cvs 1.3 and cvs 1.5. If you run cvs 1.5 or newer on a working directory checked out with cvs 1.3, cvs will convert it, but to go back to cvs 1.3 you need to check out a new working directory with cvs 1.3. The remote protocol is interoperable going back to cvs 1.5, but no further (1.5 was the first official release with the remote protocol, but some older versions might still be floating around). In many cases you need to upgrade both the client and the server to take advantage of new features and bug fixes, however. Troubleshooting If you are having trouble with cvs, this appendix may help. If there is a particular error message which you are seeing, then you can look up the message alphabetically. If not, you can look through the section on other problems to see if your problem is mentioned there. Partial list of error messages Here is a partial list of error messages that you may see from cvs. It is not a complete list—cvs is capable of printing many, many error messages, often with parts of them supplied by the operating system, but the intention is to list the common and/or potentially confusing error messages. The messages are alphabetical, but introductory text such as ‘cvs update: ’ is not considered in ordering them. In some cases the list includes messages printed by old versions of cvs (partly because users may not be sure which version of cvs they are using at any particular moment). file:line: Assertion 'text' failed The exact format of this message may vary depending onyour system. It indicates a bug in cvs, which canbe handled as described in . cvs command: authorization failed: server host rejected access This is a generic response when trying to connect to apserver server which chooses not to provide aspecific reason for denying authorization. Check thatthe username and password specified are correct andthat the CVSROOT specified is allowed by ‘--allow-root’in inetd.conf. See . cvs command: conflict: removed file was modified by second party This message indicates that you removed a file, andsomeone else modified it. To resolve the conflict,first run ‘cvs add file’. If desired, lookat the other party's modification to decide whether youstill want to remove it. If you don't want to removeit, stop here. If you do want to remove it, proceedwith ‘cvs remove file’ and commit yourremoval. cannot change permissions on temporary directory Operation not permitted This message has been happening in a non-reproducible,occasional way when we run the client/server testsuite,both on Red Hat Linux 3.0.3 and 4.1. We haven't beenable to figure out what causes it, nor is it knownwhether it is specific to Linux (or even to thisparticular machine!). If the problem does occur onother unices, ‘Operation not permitted’ would belikely to read ‘Not owner’ or whatever the systemin question uses for the unix EPERM error. Ifyou have any information to add, please let us know asdescribed in . If you experience this errorwhile using cvs, retrying the operation whichproduced it should work fine. cvs [server aborted]: Cannot check out files into the repository itself The obvious cause for this message (especially fornon-client/server cvs) is that the cvs rootis, for example, /usr/local/cvsroot and you tryto check out files when you are in a subdirectory, suchas /usr/local/cvsroot/test. However, there is amore subtle cause, which is that the temporarydirectory on the server is set to a subdirectory of theroot (which is also not allowed). If this is theproblem, set the temporary directory to somewhere else,for example /var/tmp; see TMPDIR in, for how to set thetemporary directory. cannot commit files as 'root' See ‘'root' is not allowed to commit files’. cannot open CVS/Entries for reading: No such file or directory This generally indicates a cvs internal error, andcan be handled as with other cvs bugs(see ). Usually there is a workaround—theexact nature of which would depend on the situation butwhich hopefully could be figured out. cvs [init aborted]: cannot open CVS/Root: No such file or directory This message is harmless. Provided it is notaccompanied by other errors, the operation hascompleted successfully. This message should not occurwith current versions of cvs, but it is documentedhere for the benefit of cvs 1.9 and older. cvs server: cannot open /root/.cvsignore: Permission deniedcvs [server aborted]: can't chdir(/root): Permission denied See . cvs [checkout aborted]: cannot rename file file to CVS/,,file: Invalid argument This message has been reported as intermittentlyhappening with cvs 1.9 on Solaris 2.5. The cause isunknown; if you know more about what causes it, let usknow as described in . cvs [command aborted]: cannot start server via rcmd This, unfortunately, is a rather nonspecific errormessage which cvs 1.9 will print if you arerunning the cvs client and it is having troubleconnecting to the server. Current versions of cvsshould print a much more specific error message. Ifyou get this message when you didn't mean to run theclient at all, you probably forgot to specify:local:, as described in . ci: file,v: bad diff output line: Binary files - and /tmp/T2a22651 differ cvs 1.9 and older will print this messagewhen trying to check in a binary file ifrcs is not correctly installed. Re-read theinstructions that came with your rcs distributionand the install file in the cvsdistribution. Alternately, upgrade to a currentversion of cvs, which checks in files itselfrather than via rcs. cvs checkout: could not check out file With cvs 1.9, this can mean that the co program(part of rcs) returned a failure. It should bepreceded by another error message, however it has beenobserved without another error message and the cause isnot well-understood. With the current version of cvs,which does not run co, if this message occurswithout another error message, it is definitely a cvsbug (see ). cvs [login aborted]: could not find out home directory This means that you need to set the environmentvariables that cvs uses to locate your home directory.See the discussion of HOME, HOMEDRIVE, and HOMEPATH in. cvs update: could not merge revision rev of file: No such file or directory cvs 1.9 and older will print this message if there wasa problem finding the rcsmerge program. Makesure that it is in your PATH, or upgrade to acurrent version of cvs, which does not requirean external rcsmerge program. cvs [update aborted]: could not patch file: No such file or directory This means that there was a problem finding thepatch program. Make sure that it is in yourPATH. Note that despite appearances the messageis not referring to whether it can find file.If both the client and the server are running a currentversion of cvs, then there is no need for anexternal patch program and you should not see thismessage. But if either client or server is runningcvs 1.9, then you need patch. cvs update: could not patch file; will refetch This means that for whatever reason the client wasunable to apply a patch that the server sent. Themessage is nothing to be concerned about, becauseinability to apply the patch only slows things down andhas no effect on what cvs does. dying gasps from server unexpected There is a known bug in the server for cvs 1.9.18and older which can cause this. For me, this wasreproducible if I used the ‘-t’ global option. Itwas fixed by Andy Piper's 14 Nov 1997 change tosrc/filesubr.c, if anyone is curious.If you see the message,you probably can just retry the operation which failed,or if you have discovered information concerning itscause, please let us know as described in . end of file from server (consult above messages if any) The most common cause for this message is if you areusing an external rsh program and it exited withan error. In this case the rsh program shouldhave printed a message, which will appear before theabove message. For more information on setting up acvs client and server, see . cvs [update aborted]: EOF in key in RCS file file,vcvs [checkout aborted]: EOF while looking for end of string in RCS file file,v This means that there is a syntax error in the givenrcs file. Note that this might be true even if rcs canread the file OK; cvs does more error checking oferrors in the RCS file. That is why you may see thismessage when upgrading from cvs 1.9 to cvs1.10. The likely cause for the original corruption ishardware, the operating system, or the like. Ofcourse, if you find a case in which cvs seems tocorrupting the file, by all means report it,(see ).There are quite a few variations of this error message,depending on exactly where in the rcs file cvsfinds the syntax error. mkmodules cvs commit: Executing 'mkmodules' This means that your repository is set up for a versionof cvs prior to cvs 1.8. When using cvs1.8 or later, the above message will be preceded by cvs commit: Rebuilding administrative file database If you see both messages, the database is being rebuilttwice, which is unnecessary but harmless. If you wishto avoid the duplication, and you have no versions ofcvs 1.7 or earlier in use, remove -i mkmodulesevery place it appears in your modulesfile. For more information on the modules file,see . missing author Typically this can happen if you created an RCS filewith your username set to empty. cvs will, bogusly,create an illegal RCS file with no value for the authorfield. The solution is to make sure your username isset to a non-empty value and re-create the RCS file. cvs [checkout aborted]: no such tag tag This message means that cvs isn't familiar withthe tag tag. Usually this means that you havemistyped a tag name; however there are (relativelyobscure) cases in which cvs will require you to try a few other cvs commands involving that tag,before you find one which will cause cvs to update CVSROOT/val-tags file, forcing tags into val-tags file, forcing tags intothe val-tags file; see discussion of val-tags in. You only need to worry aboutthis once for a given tag; when a tag is listed inval-tags, it stays there. Note that using‘-f’ to not require tag matches does not overridethis check; see . *PANIC* administration files missing This typically means that there is a directory namedcvs but it does not contain the administrative fileswhich cvs puts in a CVS directory. If the problem isthat you created a CVS directory via some mechanismother than cvs, then the answer is simple, use a nameother than cvs. If not, it indicates a cvs bug(see ). rcs error: Unknown option: -x,v/ This message will be followed by a usage message forrcs. It means that you have an old version ofrcs (probably supplied with your operatingsystem), as well as an old version of cvs.cvs 1.9.18 and earlier only work with rcs version 5 andlater; current versions of cvs do not run rcs programs. cvs [server aborted]: received broken pipe signal This message can be caused by a loginfo program that fails toread all of the log information from its standard input.If you find it happening in any other circumstances,please let us know as described in . 'root' is not allowed to commit files When committing a permanent change, cvs makes a log entry ofwho committed the change. If you are committing the change loggedin as "root" (not under "su" or other root-priv giving program),cvs cannot determine who is actually making the change.As such, by default, cvs disallows changes to be committed by userslogged in as "root". (You can disable this option by passing the--enable-rootcommit option to configure and recompiling cvs.On some systems this means editing the appropriate config.h filebefore building cvs.) Terminated with fatal signal 11 This message usually indicates that cvs (the server, if you'reusing client/server mode) has run out of (virtual) memory.Although cvs tries to catch the error and issue a more meaningfulmessage, there are many circumstances where that is not possible.If you appear to have lots of memory available to the system,the problem is most likely that you're running into a system-widelimit on the amount of memory a single process can use or asimilar process-specific limit.The mechanisms for displaying and setting such limits vary fromsystem to system, so you'll have to consult an expert for yourparticular system if you don't know how to do that. Too many arguments! This message is typically printed by the log.plscript which is in the contrib directory in thecvs source distribution. In some versions ofcvs, log.pl has been part of the defaultcvs installation. The log.pl script getscalled from the loginfo administrative file.Check that the arguments passed in loginfo matchwhat your version of log.pl expects. Inparticular, the log.pl from cvs 1.3 andolder expects the log file as an argument whereas thelog.pl from cvs 1.5 and newer expects thelog file to be specified with a ‘-f’ option. Ofcourse, if you don't need log.pl you can justcomment it out of loginfo. cvs [update aborted]: unexpected EOF reading file,v See ‘EOF in key in RCS file’. cvs [login aborted]: unrecognized auth response from server This message typically means that the server is not setup properly. For example, if inetd.conf pointsto a nonexistent cvs executable. To debug it further,find the log file which inetd writes(/var/log/messages or whatever inetd uses onyour system). For details, see , and. cvs commit: Up-to-date check failed for `file' This means that someone else has committed a change tothat file since the last time that you did a cvsupdate. So before proceeding with your cvscommit you need to cvs update. cvs will mergethe changes that you made and the changes that theother person made. If it does not detect any conflictsit will report ‘M file’ and you are readyto cvs commit. If it detects conflicts it willprint a message saying so, will report ‘C file’,and you need to manually resolve theconflict. For more details on this process see. Usage: diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3 Only one of [exEX3] allowed This indicates a problem with the installation ofdiff3 and rcsmerge. Specificallyrcsmerge was compiled to look for GNU diff3, butit is finding unix diff3 instead. The exact text ofthe message will vary depending on the system. Thesimplest solution is to upgrade to a current version ofcvs, which does not rely on externalrcsmerge or diff3 programs. warning: unrecognized response `text' from cvs server If text contains a valid response (such as‘ok’) followed by an extra carriage returncharacter (on many systems this will cause the secondpart of the message to overwrite the first part), thenit probably means that you are using the ‘:ext:’access method with a version of rsh, such as mostnon-unix rsh versions, which does not by defaultprovide a transparent data stream. In such cases youprobably want to try ‘:server:’ instead of‘:ext:’. If text is something else, thismay signify a problem with your cvs server.Double-check your installation against the instructionsfor setting up the cvs server. cvs commit: [time] waiting for user's lock in directory This is a normal message, not an error. See, for more details. cvs commit: warning: editor session failed Exit status, of editorThis means that the editor which cvs is using exits with a nonzeroexit status. Some versions of vi will do this even when there was nota problem editing the file. If so, point theCVSEDITOR environment variable to a small scriptsuch as: #!/bin/sh vi $* exit 0 cvs update: warning: file was lost This means that the working copy of file has been deletedbut it has not been removed from cvs.This is nothing to be concerned about,the update will just recreate the local file from the repository.(This is a convenient way to discard local changes to a file:just delete it and then run cvs update.) cvs update: warning: file is not (any longer) pertinent This means that the working copy of file has been deleted,it has not been removed from cvs in the current working directory,but it has been removed from cvs in some other working directory.This is nothing to be concerned about,the update would have removed the local file anyway. Trouble making a connection to a CVS server This section concerns what to do if you are having trouble making a connection to a cvs server. If you are running the cvs command line client running on Windows, first upgrade the client to cvs 1.9.12 or later. The error reporting in earlier versions provided much less information about what the problem was. If the client is non-Windows, cvs 1.9 should be fine. If the error messages are not sufficient to track down the problem, the next steps depend largely on which access method you are using. :ext:, troubleshooting:ext: Try running the rsh program from the command line. Forexample: "rsh servername cvs -v" should print cvsversion information. If this doesn't work, you need tofix it before you can worry about cvs problems. :server:, troubleshooting :server: You don't need a command line rsh program to use thisaccess method, but if you have an rsh program around,it may be useful as a debugging tool. Follow thedirections given for :ext:. :pserver:, troubleshooting :pserver: Errors along the lines of "connection refused" typically indicatethat inetd isn't even listening for connections on port 2401whereas errors like "connection reset by peer","received broken pipe signal", "recv() from server: EOF",or "end of file from server"typically indicate that inetd is listening forconnections but is unable to start cvs (this is frequentlycaused by having an incorrect path in inetd.confor by firewall software rejecting the connection)."unrecognized auth response" errors are caused by a bad commandline in inetd.conf, typically an invalid option or forgettingto put the ‘pserver’ command at the end of the line.Another less common problem is invisible control characters thatyour editor "helpfully" added without you noticing.One good debugging tool is to "telnet servername2401". After connecting, send any text (for example"foo" followed by return). If cvs is workingcorrectly, it will respond with cvs [pserver aborted]: bad auth protocol start: foo If instead you get: Usage: cvs [cvs-options] command [command-options-and-arguments] ... then you're missing the ‘pserver’ command at the end of theline in inetd.conf; check to make sure that the entire commandis on one line and that it's complete.Likewise, if you get something like: Unknown command: `pserved' CVS commands are: add Add a new file/directory to the repository ... then you've misspelled ‘pserver’ in some way. If it isn'tobvious, check for invisible control characters (particularlycarriage returns) in inetd.conf.If it fails to work at all, then make sure inetd is workingright. Change the invocation in inetd.conf to run theecho program instead of cvs. For example: 2401 stream tcp nowait root /bin/echo echo hello After making that change and instructing inetd tore-read its configuration file, "telnet servername2401" should show you the text hello and then theserver should close the connection. If this doesn'twork, you need to fix it before you can worry aboutcvs problems.On AIX systems, the system will often have its ownprogram trying to use port 2401. This is AIX's problemin the sense that port 2401 is registered for use withcvs. I hear that there is an AIX patch availableto address this problem.Another good debugging tool is the ‘-d’(debugging) option to inetd. Consult your systemdocumentation for more information.If you seem to be connecting but get errors like: cvs server: cannot open /root/.cvsignore: Permission denied cvs [server aborted]: can't chdir(/root): Permission denied then you probably haven't specified ‘-f’ in inetd.conf.(In releases prior to cvs 1.11.1, this problem can be caused byyour system setting the $HOME environment variablefor programs being run by inetd. In this case, you can eitherhave inetd run a shell script that unsets $HOME and then runscvs, or you can use env to run cvs with a pristineenvironment.)If you can connect successfully for a while but then can't,you've probably hit inetd's rate limit.(If inetd receives too many requests for the same servicein a short period of time, it assumes that something is wrongand temporarily disables the service.)Check your inetd documentation to find out how to adjust therate limit (some versions of inetd have a single rate limit,others allow you to set the limit for each service separately.) Other common problems Here is a list of problems which do not fit into the above categories. They are in no particular order. On Windows, if there is a 30 second or so delay whenyou run a cvs command, it may mean that you haveyour home directory set to C:/, for example (seeHOMEDRIVE and HOMEPATH in). cvs expects the homedirectory to not end in a slash, for example C:or C:\cvs. If you are running cvs 1.9.18 or older, andcvs update finds a conflict and tries tomerge, as described in , butdoesn't tell you there were conflicts, then you mayhave an old version of rcs. The easiest solutionprobably is to upgrade to a current version ofcvs, which does not rely on external rcsprograms. Credits Contributors (manual) Credits (manual) Roland Pesch, then of Cygnus Support <roland@wrs.com> wrote the manual pages which were distributed with cvs 1.3. Much of their text was copied into this manual. He also read an early draft of this manual and contributed many ideas and corrections. The mailing-list info-cvs is sometimes informative. I have included information from postings made by the following persons: David G. Grubbs <dgg@think.com>. Some text has been extracted from the man pages for rcs. The cvs faq by David G. Grubbs has provided useful material. The faq is no longer maintained, however, and this manual is about the closest thing there is to a successor (with respect to documenting how to use cvs, at least). In addition, the following persons have helped by telling me about mistakes I've made: Roxanne Brunskill <rbrunski@datap.ca>, Kathy Dyer <dyer@phoenix.ocf.llnl.gov>, Karl Pingle <pingle@acuson.com>, Thomas A Peterson <tap@src.honeywell.com>, Inge Wallin <ingwa@signum.se>, Dirk Koschuetzki <koschuet@fmi.uni-passau.de> and Michael Brown <brown@wi.extrel.com>. The list of contributors here is not comprehensive; for a more complete list of who has contributed to this manual see the file doc/ChangeLog in the cvs source distribution. Dealing with bugs in CVS or this manual Bugs in this manual or CVS Neither cvs nor this manual is perfect, and they probably never will be. If you are having trouble using cvs, or think you have found a bug, there are a number of things you can do about it. Note that if the manual is unclear, that can be considered a bug in the manual, so these problems are often worth doing something about as well as problems with cvs itself. Reporting bugs Bugs, reporting Errors, reporting If you want someone to help you and fix bugs that youreport, there are companies which will do that for afee. One such company is: Ximbiot Support, getting CVS support Ximbiot 319 S. River St. Harrisburg, PA 17104-1657 USA Email: info@ximbiot.com Phone: (717) 579-6168 Fax: (717) 234-3125 http://ximbiot.com/ If you got cvs through a distributor, such as anoperating system vendor or a vendor of freewarecd-roms, you may wish to see whether thedistributor provides support. Often, they will provideno support or minimal support, but this may vary fromdistributor to distributor. If you have the skills and time to do so, you may wishto fix the bug yourself. If you wish to submit yourfix for inclusion in future releases of cvs, seethe file hacking in the cvs sourcedistribution. It contains much more information on theprocess of submitting fixes. There may be resources on the net which can help. Agood place to start is: http://cvs.nongnu.org/ If you are so inspired, increasing the informationavailable on the net is likely to be appreciated. Forexample, before the standard cvs distributionworked on Windows 95, there was a web page with someexplanation and patches for running cvs on Windows95, and various people helped out by mentioning thispage on mailing lists or newsgroups when the subjectcame up. It is also possible to report bugs to .Note that someone may or may not want to do anythingwith your bug report—if you need a solution considerone of the options mentioned above. People probably dowant to hear about bugs which are particularly severein consequences and/or easy to fix, however. You canalso increase your odds by being as clear as possibleabout the exact nature of the bug and any otherrelevant information. The way to report bugs is tosend email to . Notethat submissions to may be distributedunder the terms of the gnu Public License, so ifyou don't like this, don't submit them. There isusually no justification for sending mail directly toone of the cvs maintainers rather than to; those maintainers who want to hearabout such bug reports read . Also notethat sending a bug report to other mailing lists ornewsgroups is not a substitute for sending it to. It is fine to discuss cvs bugs onwhatever forum you prefer, but there are notnecessarily any maintainers reading bug reports sentanywhere except . Known bugs in this manual or CVS People often ask if there is a list of known bugs or whether a particular bug is a known one. The file bugs in the cvs source distribution is one list of known bugs, but it doesn't necessarily try to be comprehensive. Perhaps there will never be a comprehensive, detailed list of known bugs. xreflabel="Index" id="Index"> Index Index !, in modules file, see #cvs.lock, removing, see #cvs.lock, technical details, see #cvs.rfl, and backups, see #cvs.rfl, removing, see #cvs.rfl, technical details, see #cvs.tfl, see #cvs.wfl, removing, see #cvs.wfl, technical details, see &, in modules file, see -a, in modules file, see -d, in modules file, see -e, in modules file, see -e, in modules file, see -j (merging branches), see -j (merging branches), and keyword substitution, see -k (keyword substitution), see -kk, to avoid conflicts during a merge, see -o, in modules file, see -o, in modules file, see -s, in modules file, see -t, in modules file, see -t, in modules file, see .# files, see .bashrc, setting CVSROOT in, see .cshrc, setting CVSROOT in, see .cvsrc file, see .profile, setting CVSROOT in, see .tcshrc, setting CVSROOT in, see /usr/local/cvsroot, as example repository, see :ext:, setting up, see :ext:, troubleshooting, see :fork:, setting up, see :gserver:, setting up, see :kserver:, setting up, see :local:, setting up, see :pserver:, setting up, see :pserver:, troubleshooting, see :server:, setting up, see :server:, troubleshooting, see <<<<<<<, see =======, see >>>>>>>, see __ files (VMS), see A Abandoning work, see Access a branch, see add (subcommand), see Adding a tag, see Adding files, see Admin (subcommand), see Administrative files (intro), see Administrative files (reference), see Administrative files, editing them, see Alias modules, see ALL in commitinfo, see Ampersand modules, see annotate (subcommand), see Atomic transactions, lack of, see Attic, see Authenticated client, using, see Authenticating server, setting up, see Authentication, stream, see Author keyword, see Automatically ignored files, see Avoiding editor invocation, see B Backing up, repository, see Base directory, in CVS directory, see BASE, as reserved tag name, see BASE, special tag, see Baserev file, in CVS directory, see Baserev.tmp file, in CVS directory, see Bill of materials, see Binary files, see Branch merge example, see Branch number, see Branch number, see Branch tags, deleting, see Branch tags, moving, see Branch, accessing, see Branch, check out, see Branch, creating a, see Branch, identifying, see Branch, retrieving, see Branch, vendor-, see Branches motivation, see Branches, copying changes between, see Branches, sticky, see Branching, see Bringing a file up to date, see Bugs in this manual or CVS, see Bugs, reporting, see Builds, see C Changes, copying between branches, see Changing a log message, see Check out a branch, see Checked out copy, keeping, see Checking out source, see checkout (subcommand), see Checkout program, see Checkout, as term for getting ready to edit, see Checkout, example, see checkoutlist, see Choosing, reserved or unreserved checkouts, see Cleaning up, see Client/Server Operation, see Client/Server Operation, port specification, see Client/Server Operation, port specification, see co (subcommand), see Command reference, see Command structure, see Comment leader, see commit (subcommand), see commitinfo, see commitinfo, command environment, see commitinfo, working directory, see Commits, precommit verification of, see Committing changes to files, see Committing, administrative support files, see Committing, when to, see Common options, see Common syntax of info files, see Compatibility, between CVS versions, see Compression, see Compression, see COMSPEC, environment variable, see config, in CVSROOT, see Conflict markers, see Conflict resolution, see Conflicts (merge example), see Contributors (CVS program), see Contributors (manual), see Copying a repository, see Copying changes, see Correcting a log message, see Creating a branch, see Creating a project, see Creating a repository, see Credits (CVS program), see Credits (manual), see CVS 1.6, and watches, see CVS command structure, see CVS directory, in repository, see CVS directory, in working directory, see CVS passwd file, see CVS, history of, see CVS, introduction to, see CVS, versions of, see CVS/Base directory, see CVS/Baserev file, see CVS/Baserev.tmp file, see CVS/Entries file, see CVS/Entries.Backup file, see CVS/Entries.Log file, see CVS/Entries.Static file, see CVS/Notify file, see CVS/Notify.tmp file, see CVS/Repository file, see CVS/Root file, see CVS/Tag file, see CVS/Template file, see CVS_CLIENT_LOG, environment variable, see CVS_CLIENT_PORT, see CVS_IGNORE_REMOTE_ROOT, environment variable, see CVS_PASSFILE, environment variable, see CVS_RCMD_PORT, environment variable, see CVS_RSH, environment variable, see CVS_SERVER, and :fork:, see CVS_SERVER, environment variable, see CVS_SERVER_SLEEP, environment variable, see CVS_USER, environment variable, see cvsadmin, see CVSEDITOR, environment variable, see CVSEDITOR, environment variable, see CVSEDITOR, internal variable, see cvsignore (admin file), global, see CVSIGNORE, environment variable, see CVSREAD, environment variable, see CVSREAD, overriding, see cvsroot, see CVSROOT (file), see CVSROOT, environment variable, see CVSROOT, internal variable, see CVSROOT, module name, see CVSROOT, multiple repositories, see CVSROOT, overriding, see CVSROOT, storage of files, see CVSROOT/config, see CVSROOT/Emptydir directory, see CVSROOT/val-tags file, and read-only access to projects, see CVSROOT/val-tags file, forcing tags into, see CVSUMASK, environment variable, see cvswrappers (admin file), see CVSWRAPPERS, environment variable, see CVSWRAPPERS, environment variable, see D Date keyword, see Dates, see Dead state, see Decimal revision number, see DEFAULT in commitinfo, see DEFAULT in editinfo, see DEFAULT in verifymsg, see Defining a module, see Defining modules (intro), see Defining modules (reference manual), see Deleting branch tags, see Deleting files, see Deleting revisions, see Deleting sticky tags, see Deleting tags, see Descending directories, see Device nodes, see Diff, see diff (subcommand), see Differences, merging, see Directories, moving, see Directories, removing, see Directory, descending, see Disjoint repositories, see Distributing log messages, see driver.c (merge example), see E edit (subcommand), see editinfo (admin file), see Editing administrative files, see Editing the modules file, see Editor, avoiding invocation of, see EDITOR, environment variable, see EDITOR, environment variable, see EDITOR, internal variable, see EDITOR, overriding, see Editor, specifying per module, see editors (subcommand), see emerge, see Emptydir, in CVSROOT directory, see Encryption, see Entries file, in CVS directory, see Entries.Backup file, in CVS directory, see Entries.Log file, in CVS directory, see Entries.Static file, in CVS directory, see Environment variables, see environment variables, passed to administrative files, see Errors, reporting, see Example of a work-session, see Example of merge, see Example, branch merge, see Excluding directories, in modules file, see Exit status, of commitinfo, see Exit status, of CVS, see Exit status, of editor, see Exit status, of verifymsg, see export (subcommand), see Export program, see F Fetching source, see File had conflicts on merge, see File locking, see File permissions, general, see File permissions, Windows-specific, see File status, see Files, moving, see Files, reference manual, see Fixing a log message, see Forcing a tag match, see fork, access method, see Form for log message, see Format of CVS commands, see G Getting started, see Getting the source, see Global cvsignore, see Global options, see Group, UNIX file permissions, in repository, see gserver (client/server connection method), port specification, see gserver (client/server connection method), port specification, see GSSAPI, see Gzip, see Gzip, see H Hard links, see HEAD, as reserved tag name, see HEAD, special tag, see Header keyword, see history (subcommand), see History browsing, see History file, see History files, see History of CVS, see HOME, environment variable, see HOMEDRIVE, environment variable, see HOMEPATH, environment variable, see I Id keyword, see Ident (shell command), see Identifying a branch, see Identifying files, see Ignored files, see Ignoring files, see import (subcommand), see Importing files, see Importing files, from other version control systems, see Importing modules, see Index, see inetd, configuring for pserver, see Info files, see Info files (syntax), see Info files, security, see Informing others, see init (subcommand), see Installed images (VMS), see Internal variables, see Introduction to CVS, see Invoking CVS, see Isolation, see J Join, see K Keeping a checked out copy, see Kerberos, using :gserver:, see Kerberos, using :kserver:, see Kerberos, using kerberized rsh, see Keyword expansion, see Keyword List, see Keyword substitution, see Keyword substitution, and merging, see Keyword substitution, changing modes, see Kflag, see kinit, see Known bugs in this manual or CVS, see kserver (client/server connection method), port specification, see kserver (client/server connection method), port specification, see L Layout of repository, see Left-hand options, see Linear development, see Link, symbolic, importing, see List, mailing list, see Locally Added, see Locally Modified, see Locally Removed, see LockDir, in CVSROOT/config, see Locker keyword, see Locking files, see Locks, cvs, and backups, see Locks, cvs, introduction, see Locks, cvs, technical details, see log (subcommand), see Log information, saving, see Log keyword, see Log message entry, see Log message template, see Log message, correcting, see Log message, verifying, see Log messages, see Log messages, editing, see LogHistory, in CVSROOT/config, see Login (subcommand), see loginfo (admin file), see LOGNAME, environment variable, see Logout (subcommand), see M Mail, automatic mail on commit, see Mailing list, see Mailing log messages, see Main trunk and branches, see make, see Many repositories, see Markers, conflict, see Merge, an example, see Merge, branch example, see Merging, see Merging a branch, see Merging a file, see Merging two revisions, see Merging, and keyword substitution, see mkmodules, see Modifications, copying between branches, see Module status, see Module, defining, see Modules (admin file), see Modules file, see Modules file program options, see Modules file, changing, see modules.db, see modules.dir, see modules.pag, see Motivation for branches, see Moving a repository, see Moving branch tags, see Moving directories, see Moving files, see Moving tags, see Multiple developers, see Multiple repositories, see N Name keyword, see Name, symbolic (tag), see Needs Checkout, see Needs Merge, see Needs Patch, see Newsgroups, see notify (admin file), see Notify file, in CVS directory, see Notify.tmp file, in CVS directory, see Number, branch, see Number, branch, see Number, revision-, see O Option defaults, see Options, global, see Options, in modules file, see Outdating revisions, see Overlap, see Overriding CVSREAD, see Overriding CVSROOT, see Overriding EDITOR, see Overriding RCSBIN, see Overriding TMPDIR, see Overview, see Ownership, saving in CVS, see P Parallel repositories, see passwd (admin file), see Password client, using, see Password server, setting up, see PATH, environment variable, see Per-directory sticky tags/dates, see Per-module editor, see Permissions, general, see Permissions, saving in CVS, see Permissions, Windows-specific, see Policy, see port, specifying for remote repositories, see port, specifying for remote repositories, see Precommit checking, see pserver (client/server connection method), port specification, see pserver (client/server connection method), port specification, see pserver (subcommand), see PVCS, importing files from, see R RCS history files, see RCS revision numbers, see RCS, importing files from, see RCS-style locking, see RCSBIN, in CVSROOT/config, see RCSBIN, internal variable, see RCSBIN, overriding, see RCSfile keyword, see rcsinfo (admin file), see rdiff (subcommand), see Read-only files, and -r, see Read-only files, and CVSREAD, see Read-only files, and watches, see Read-only files, in repository, see Read-only mode, see Read-only repository access, see readers (admin file), see Recursive (directory descending), see Reference manual (files), see Reference manual for variables, see Reference, commands, see Regular expression syntax, see Regular modules, see release (subcommand), see Releases, revisions and versions, see Releasing your working copy, see Remote repositories, see Remote repositories, port specification, see Remote repositories, port specification, see Remove (subcommand), see Removing a change, see Removing branch tags, see Removing directories, see Removing files, see Removing tags, see Removing your working copy, see Renaming directories, see Renaming files, see Renaming tags, see Replacing a log message, see Reporting bugs, see Repositories, multiple, see Repositories, remote, see Repositories, remote, port specification, see Repositories, remote, port specification, see Repository (intro), see Repository file, in CVS directory, see Repository, backing up, see Repository, example, see Repository, how data is stored, see Repository, moving, see Repository, setting up, see RereadLogAfterVerify, in CVSROOT/config, see Reserved checkouts, see Resetting sticky tags, see Resolving a conflict, see Restoring old version of removed file, see Resurrecting old version of dead file, see Retrieve a branch, see Retrieving an old revision using tags, see Reverting to repository version, see Revision keyword, see Revision management, see Revision numbers, see Revision numbers (branches), see Revision tree, see Revision tree, making branches, see Revisions, merging differences between, see Revisions, versions and releases, see Right-hand options, see Root file, in CVS directory, see rsh, see rsh replacements (Kerberized, SSH, &c), see rtag (subcommand), see rtag, creating a branch using, see S Saving space, see SCCS, importing files from, see Security, file permissions in repository, see Security, GSSAPI, see Security, Kerberos, see Security, of pserver, see Security, setuid, see Server, CVS, see Server, temporary directories, see Setgid, see Setting up a repository, see Setuid, see Source keyword, see Source, getting CVS source, see Source, getting from CVS, see Special files, see Specifying dates, see Spreading information, see SSH (rsh replacement), see Starting a project with CVS, see State keyword, see Status of a file, see Status of a module, see Sticky date, see Sticky tags, see Sticky tags, resetting, see Sticky tags/dates, per-directory, see Storing log messages, see Stream authentication, see Structure, see Subdirectories, see Support, getting CVS support, see Symbolic link, importing, see Symbolic links, see Symbolic name (tag), see Syntax of info files, see SystemAuth, in CVSROOT/config, see T tag (subcommand), see Tag file, in CVS directory, see Tag program, see tag, command, introduction, see tag, creating a branch using, see Tag, example, see Tag, retrieving old revisions, see Tag, symbolic name, see taginfo (admin file), see Tags, see Tags, deleting, see Tags, logging, see Tags, moving, see Tags, renaming, see Tags, sticky, see Tags, verifying, see tc, Trivial Compiler (example), see Team of developers, see TEMP, environment variable, see Template file, in CVS directory, see Template for log message, see Temporary directories, and server, see Temporary files, location of, see Third-party sources, see Time, see Timezone, in input, see Timezone, in output, see TMP, environment variable, see TMPDIR, environment variable, see TMPDIR, overriding, see TopLevelAdmin, in CVSROOT/config, see Trace, see Traceability, see Tracking sources, see Transactions, atomic, lack of, see Trigger scripts, see Trigger scripts, security, see Trivial Compiler (example), see Typical repository, see U Umask, for repository files, see Undoing a change, see unedit (subcommand), see Unknown, see Unreserved checkouts, see Unresolved Conflict, see Up-to-date, see update (subcommand), see Update, introduction, see update, to display file status, see Updating a file, see User aliases, see User variables, see USER, environment variable, see USER, internal variable, see users (admin file), see V val-tags file, and read-only access to projects, see val-tags file, forcing tags into, see Variables, see Vendor, see Vendor branch, see verifymsg (admin file), see verifymsg, changing the log message, see verifymsg, changing the log message, see version (subcommand), see Versions, of CVS, see Versions, revisions and releases, see Viewing differences, see VISUAL, environment variable, see VISUAL, environment variable, see VISUAL, internal variable, see W watch add (subcommand), see watch off (subcommand), see watch on (subcommand), see watch remove (subcommand), see watchers (subcommand), see Watches, see wdiff (import example), see Web pages, maintaining with CVS, see What (shell command), see What branches are good for, see What is CVS not?, see What is CVS?, see When to commit, see Windows, and permissions, see Work-session, example of, see Working copy, see Working copy, removing, see Wrappers, see writers (admin file), see X Ximbiot, see xinetd, configuring for pserver, see Z Zone, time, in input, see Zone, time, in output, see