1This is cvs.info, produced by makeinfo version 4.13 from cvs.texi.
2
3INFO-DIR-SECTION GNU Packages
4START-INFO-DIR-ENTRY
5* CVS: (cvs).                   Concurrent Versions System
6END-INFO-DIR-ENTRY
7INFO-DIR-SECTION Individual utilities
8START-INFO-DIR-ENTRY
9* cvs: (cvs)CVS commands.       Concurrent Versions System
10END-INFO-DIR-ENTRY
11
12
13File: cvs.info,  Node: Top,  Next: Overview,  Up: (dir)
14
15CVS--Concurrent Versions System v4.2
16************************************
17
18This info manual describes how to use and administer CVS version 4.2.
19
20Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
212001, 2002, 2003 Free Software Foundation, Inc.
22
23Portions
24          Copyright (C) 1999, 2000, 2001, 2002, 2003 Derek R. Price,
25          Copyright (C) 2002, 2003 Ximbiot <http://ximbiot.com>,
26          Copyright (C) 1992, 1993, 1999 Signum Support AB,
27          and Copyright (C) others.
28
29   Permission is granted to make and distribute verbatim copies of this
30manual provided the copyright notice and this permission notice are
31preserved on all copies.
32
33   Permission is granted to copy and distribute modified versions of
34this manual under the conditions for verbatim copying, provided also
35that the entire resulting derived work is distributed under the terms of
36a permission notice identical to this one.
37
38   Permission is granted to copy and distribute translations of this
39manual into another language, under the above conditions for modified
40versions, except that this permission notice may be stated in a
41translation approved by the Free Software Foundation.
42
43* Menu:
44
45* Overview::                    An introduction to CVS
46* Repository::                  Where all your sources are stored
47* Starting a new project::      Starting a project with CVS
48* Revisions::                   Numeric and symbolic names for revisions
49* Branching and merging::       Diverging/rejoining branches of development
50* Recursive behavior::          CVS descends directories
51* Adding and removing::         Adding/removing/renaming files/directories
52* History browsing::            Viewing the history of files in various ways
53
54CVS and the Real World.
55-----------------------
56* Binary files::                CVS can handle binary files
57* Multiple developers::         How CVS helps a group of developers
58* Revision management::         Policy questions for revision management
59* Keyword substitution::        CVS can include the revision inside the file
60* Tracking sources::            Tracking third-party sources
61* Builds::                      Issues related to CVS and builds
62* Special Files::		Devices, links and other non-regular files
63
64References.
65-----------
66* CVS commands::                CVS commands share some things
67* Invoking CVS::                Quick reference to CVS commands
68* Administrative files::        Reference manual for the Administrative files
69* Environment variables::       All environment variables which affect CVS
70* Compatibility::               Upgrading CVS versions
71* Troubleshooting::             Some tips when nothing works
72* Credits::                     Some of the contributors to this manual
73* BUGS::                        Dealing with bugs in CVS or this manual
74* Index::                       Index
75
76
77File: cvs.info,  Node: Overview,  Next: Repository,  Prev: Top,  Up: Top
78
791 Overview
80**********
81
82This chapter is for people who have never used CVS, and perhaps have
83never used version control software before.
84
85   If you are already familiar with CVS and are just trying to learn a
86particular feature or remember a certain command, you can probably skip
87everything here.
88
89* Menu:
90
91* What is CVS?::                What you can do with CVS
92* What is CVS not?::            Problems CVS doesn't try to solve
93* A sample session::            A tour of basic CVS usage
94
95
96File: cvs.info,  Node: What is CVS?,  Next: What is CVS not?,  Up: Overview
97
981.1 What is CVS?
99================
100
101CVS is a version control system.  Using it, you can record the history
102of your source files.
103
104   For example, bugs sometimes creep in when software is modified, and
105you might not detect the bug until a long time after you make the
106modification.  With CVS, you can easily retrieve old versions to see
107exactly which change caused the bug.  This can sometimes be a big help.
108
109   You could of course save every version of every file you have ever
110created.  This would however waste an enormous amount of disk space.
111CVS stores all the versions of a file in a single file in a clever way
112that only stores the differences between versions.
113
114   CVS also helps you if you are part of a group of people working on
115the same project.  It is all too easy to overwrite each others' changes
116unless you are extremely careful.  Some editors, like GNU Emacs, try to
117make sure that the same file is never modified by two people at the same
118time.  Unfortunately, if someone is using another editor, that safeguard
119will not work.  CVS solves this problem by insulating the different
120developers from each other.  Every developer works in his own directory,
121and CVS merges the work when each developer is done.
122
123   CVS started out as a bunch of shell scripts written by Dick Grune,
124posted to the newsgroup `comp.sources.unix' in the volume 6 release of
125July, 1986.  While no actual code from these shell scripts is present in
126the current version of CVS much of the CVS conflict resolution
127algorithms come from them.
128
129   In April, 1989, Brian Berliner designed and coded CVS.  Jeff Polk
130later helped Brian with the design of the CVS module and vendor branch
131support.
132
133   You can get CVS in a variety of ways, including free download from
134the internet.  For more information on downloading CVS and other CVS
135topics, see:
136
137     http://www.cvshome.org/
138     http://www.loria.fr/~molli/cvs-index.html
139
140   There is a mailing list, known as `info-cvs', devoted to CVS.  To
141subscribe or unsubscribe write to `info-cvs-request@gnu.org'.  If you
142prefer a usenet group, the right group is `comp.software.config-mgmt'
143which is for CVS discussions (along with other configuration management
144systems).  In the future, it might be possible to create a
145`comp.software.config-mgmt.cvs', but probably only if there is
146sufficient CVS traffic on `comp.software.config-mgmt'.
147
148   You can also subscribe to the `bug-cvs' mailing list, described in
149more detail in *note BUGS::.  To subscribe send mail to
150`bug-cvs-request@gnu.org'.
151
152
153File: cvs.info,  Node: What is CVS not?,  Next: A sample session,  Prev: What is CVS?,  Up: Overview
154
1551.2 What is CVS not?
156====================
157
158CVS can do a lot of things for you, but it does not try to be everything
159for everyone.
160
161CVS is not a build system.
162     Though the structure of your repository and modules file interact
163     with your build system (e.g. `Makefile's), they are essentially
164     independent.
165
166     CVS does not dictate how you build anything.  It merely stores
167     files for retrieval in a tree structure you devise.
168
169     CVS does not dictate how to use disk space in the checked out
170     working directories.  If you write your `Makefile's or scripts in
171     every directory so they have to know the relative positions of
172     everything else, you wind up requiring the entire repository to be
173     checked out.
174
175     If you modularize your work, and construct a build system that will
176     share files (via links, mounts, `VPATH' in `Makefile's, etc.), you
177     can arrange your disk usage however you like.
178
179     But you have to remember that _any_ such system is a lot of work to
180     construct and maintain.  CVS does not address the issues involved.
181
182     Of course, you should place the tools created to support such a
183     build system (scripts, `Makefile's, etc) under CVS.
184
185     Figuring out what files need to be rebuilt when something changes
186     is, again, something to be handled outside the scope of CVS.  One
187     traditional approach is to use `make' for building, and use some
188     automated tool for generating the dependencies which `make' uses.
189
190     See *note Builds::, for more information on doing builds in
191     conjunction with CVS.
192
193CVS is not a substitute for management.
194     Your managers and project leaders are expected to talk to you
195     frequently enough to make certain you are aware of schedules, merge
196     points, branch names and release dates.  If they don't, CVS can't
197     help.
198
199     CVS is an instrument for making sources dance to your tune.  But
200     you are the piper and the composer.  No instrument plays itself or
201     writes its own music.
202
203CVS is not a substitute for developer communication.
204     When faced with conflicts within a single file, most developers
205     manage to resolve them without too much effort.  But a more general
206     definition of "conflict" includes problems too difficult to solve
207     without communication between developers.
208
209     CVS cannot determine when simultaneous changes within a single
210     file, or across a whole collection of files, will logically
211     conflict with one another.  Its concept of a "conflict" is purely
212     textual, arising when two changes to the same base file are near
213     enough to spook the merge (i.e. `diff3') command.
214
215     CVS does not claim to help at all in figuring out non-textual or
216     distributed conflicts in program logic.
217
218     For example: Say you change the arguments to function `X' defined
219     in file `A'.  At the same time, someone edits file `B', adding new
220     calls to function `X' using the old arguments.  You are outside the
221     realm of CVS's competence.
222
223     Acquire the habit of reading specs and talking to your peers.
224
225CVS does not have change control
226     Change control refers to a number of things.  First of all it can
227     mean "bug-tracking", that is being able to keep a database of
228     reported bugs and the status of each one (is it fixed?  in what
229     release?  has the bug submitter agreed that it is fixed?).  For
230     interfacing CVS to an external bug-tracking system, see the
231     `rcsinfo' and `verifymsg' files (*note Administrative files::).
232
233     Another aspect of change control is keeping track of the fact that
234     changes to several files were in fact changed together as one
235     logical change.  If you check in several files in a single `cvs
236     commit' operation, CVS then forgets that those files were checked
237     in together, and the fact that they have the same log message is
238     the only thing tying them together.  Keeping a GNU style
239     `ChangeLog' can help somewhat.
240
241     Another aspect of change control, in some systems, is the ability
242     to keep track of the status of each change.  Some changes have been
243     written by a developer, others have been reviewed by a second
244     developer, and so on.  Generally, the way to do this with CVS is to
245     generate a diff (using `cvs diff' or `diff') and email it to
246     someone who can then apply it using the `patch' utility.  This is
247     very flexible, but depends on mechanisms outside CVS to make sure
248     nothing falls through the cracks.
249
250CVS is not an automated testing program
251     It should be possible to enforce mandatory use of a testsuite using
252     the `commitinfo' file.  I haven't heard a lot about projects trying
253     to do that or whether there are subtle gotchas, however.
254
255CVS does not have a builtin process model
256     Some systems provide ways to ensure that changes or releases go
257     through various steps, with various approvals as needed.
258     Generally, one can accomplish this with CVS but it might be a
259     little more work.  In some cases you'll want to use the
260     `commitinfo', `loginfo', `rcsinfo', or `verifymsg' files, to
261     require that certain steps be performed before cvs will allow a
262     checkin.  Also consider whether features such as branches and tags
263     can be used to perform tasks such as doing work in a development
264     tree and then merging certain changes over to a stable tree only
265     once they have been proven.
266
267
268File: cvs.info,  Node: A sample session,  Prev: What is CVS not?,  Up: Overview
269
2701.3 A sample session
271====================
272
273As a way of introducing CVS, we'll go through a typical work-session
274using CVS.  The first thing to understand is that CVS stores all files
275in a centralized "repository" (*note Repository::); this section assumes
276that a repository is set up.
277
278   Suppose you are working on a simple compiler.  The source consists of
279a handful of C files and a `Makefile'.  The compiler is called `tc'
280(Trivial Compiler), and the repository is set up so that there is a
281module called `tc'.
282
283* Menu:
284
285* Getting the source::          Creating a workspace
286* Committing your changes::     Making your work available to others
287* Cleaning up::                 Cleaning up
288* Viewing differences::         Viewing differences
289
290
291File: cvs.info,  Node: Getting the source,  Next: Committing your changes,  Up: A sample session
292
2931.3.1 Getting the source
294------------------------
295
296The first thing you must do is to get your own working copy of the
297source for `tc'.  For this, you use the `checkout' command:
298
299     $ cvs checkout tc
300
301This will create a new directory called `tc' and populate it with the
302source files.
303
304     $ cd tc
305     $ ls
306     CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
307
308   The `CVS' directory is used internally by CVS.  Normally, you should
309not modify or remove any of the files in it.
310
311   You start your favorite editor, hack away at `backend.c', and a
312couple of hours later you have added an optimization pass to the
313compiler.  A note to RCS and SCCS users: There is no need to lock the
314files that you want to edit.  *Note Multiple developers::, for an
315explanation.
316
317
318File: cvs.info,  Node: Committing your changes,  Next: Cleaning up,  Prev: Getting the source,  Up: A sample session
319
3201.3.2 Committing your changes
321-----------------------------
322
323When you have checked that the compiler is still compilable you decide
324to make a new version of `backend.c'.  This will store your new
325`backend.c' in the repository and make it available to anyone else who
326is using that same repository.
327
328     $ cvs commit backend.c
329
330CVS starts an editor, to allow you to enter a log message.  You type in
331"Added an optimization pass.", save the temporary file, and exit the
332editor.
333
334   The environment variable `$CVSEDITOR' determines which editor is
335started.  If `$CVSEDITOR' is not set, then if the environment variable
336`$EDITOR' is set, it will be used. If both `$CVSEDITOR' and `$EDITOR'
337are not set then there is a default which will vary with your operating
338system, for example `vi' for unix or `notepad' for Windows NT/95.
339
340   In addition, CVS checks the `$VISUAL' environment variable.  Opinions
341vary on whether this behavior is desirable and whether future releases
342of CVS should check `$VISUAL' or ignore it.  You will be OK either way
343if you make sure that `$VISUAL' is either unset or set to the same thing
344as `$EDITOR'.
345
346   When CVS starts the editor, it includes a list of files which are
347modified.  For the CVS client, this list is based on comparing the
348modification time of the file against the modification time that the
349file had when it was last gotten or updated.  Therefore, if a file's
350modification time has changed but its contents have not, it will show up
351as modified.  The simplest way to handle this is simply not to worry
352about it--if you proceed with the commit CVS will detect that the
353contents are not modified and treat it as an unmodified file.  The next
354`update' will clue CVS in to the fact that the file is unmodified, and
355it will reset its stored timestamp so that the file will not show up in
356future editor sessions.
357
358   If you want to avoid starting an editor you can specify the log
359message on the command line using the `-m' flag instead, like this:
360
361     $ cvs commit -m "Added an optimization pass" backend.c
362
363
364File: cvs.info,  Node: Cleaning up,  Next: Viewing differences,  Prev: Committing your changes,  Up: A sample session
365
3661.3.3 Cleaning up
367-----------------
368
369Before you turn to other tasks you decide to remove your working copy of
370tc.  One acceptable way to do that is of course
371
372     $ cd ..
373     $ rm -r tc
374
375but a better way is to use the `release' command (*note release::):
376
377     $ cd ..
378     $ cvs release -d tc
379     M driver.c
380     ? tc
381     You have [1] altered files in this repository.
382     Are you sure you want to release (and delete) directory `tc': n
383     ** `release' aborted by user choice.
384
385   The `release' command checks that all your modifications have been
386committed.  If history logging is enabled it also makes a note in the
387history file.  *Note history file::.
388
389   When you use the `-d' flag with `release', it also removes your
390working copy.
391
392   In the example above, the `release' command wrote a couple of lines
393of output.  `? tc' means that the file `tc' is unknown to CVS.  That is
394nothing to worry about: `tc' is the executable compiler, and it should
395not be stored in the repository.  *Note cvsignore::, for information
396about how to make that warning go away.  *Note release output::, for a
397complete explanation of all possible output from `release'.
398
399   `M driver.c' is more serious.  It means that the file `driver.c' has
400been modified since it was checked out.
401
402   The `release' command always finishes by telling you how many
403modified files you have in your working copy of the sources, and then
404asks you for confirmation before deleting any files or making any note
405in the history file.
406
407   You decide to play it safe and answer `n <RET>' when `release' asks
408for confirmation.
409
410
411File: cvs.info,  Node: Viewing differences,  Prev: Cleaning up,  Up: A sample session
412
4131.3.4 Viewing differences
414-------------------------
415
416You do not remember modifying `driver.c', so you want to see what has
417happened to that file.
418
419     $ cd tc
420     $ cvs diff driver.c
421
422   This command runs `diff' to compare the version of `driver.c' that
423you checked out with your working copy.  When you see the output you
424remember that you added a command line option that enabled the
425optimization pass.  You check it in, and release the module.
426
427     $ cvs commit -m "Added an optimization pass" driver.c
428     Checking in driver.c;
429     /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
430     new revision: 1.2; previous revision: 1.1
431     done
432     $ cd ..
433     $ cvs release -d tc
434     ? tc
435     You have [0] altered files in this repository.
436     Are you sure you want to release (and delete) directory `tc': y
437
438
439File: cvs.info,  Node: Repository,  Next: Starting a new project,  Prev: Overview,  Up: Top
440
4412 The Repository
442****************
443
444The CVS "repository" stores a complete copy of all the files and
445directories which are under version control.
446
447   Normally, you never access any of the files in the repository
448directly.  Instead, you use CVS commands to get your own copy of the
449files into a "working directory", and then work on that copy.  When
450you've finished a set of changes, you check (or "commit") them back into
451the repository.  The repository then contains the changes which you have
452made, as well as recording exactly what you changed, when you changed
453it, and other such information.  Note that the repository is not a
454subdirectory of the working directory, or vice versa; they should be in
455separate locations.
456
457   CVS can access a repository by a variety of means.  It might be on
458the local computer, or it might be on a computer across the room or
459across the world.  To distinguish various ways to access a repository,
460the repository name can start with an "access method".  For example, the
461access method `:local:' means to access a repository directory, so the
462repository `:local:/usr/local/cvsroot' means that the repository is in
463`/usr/local/cvsroot' on the computer running CVS.  For information on
464other access methods, see *note Remote repositories::.
465
466   If the access method is omitted, then if the repository starts with
467`/', then `:local:' is assumed.  If it does not start with `/' then
468either `:ext:' or `:server:' is assumed.  For example, if you have a
469local repository in `/usr/local/cvsroot', you can use
470`/usr/local/cvsroot' instead of `:local:/usr/local/cvsroot'.  But if
471(under Windows NT, for example) your local repository is
472`c:\src\cvsroot', then you must specify the access method, as in
473`:local:c:/src/cvsroot'.
474
475   The repository is split in two parts.  `$CVSROOT/CVSROOT' contains
476administrative files for CVS.  The other directories contain the actual
477user-defined modules.
478
479* Menu:
480
481* Specifying a repository::     Telling CVS where your repository is
482* Repository storage::          The structure of the repository
483* Working directory storage::   The structure of working directories
484* Intro administrative files::  Defining modules
485* Multiple repositories::       Multiple repositories
486* Creating a repository::       Creating a repository
487* Backing up::                  Backing up a repository
488* Moving a repository::         Moving a repository
489* Remote repositories::         Accessing repositories on remote machines
490* Read-only access::            Granting read-only access to the repository
491* Server temporary directory::  The server creates temporary directories
492
493
494File: cvs.info,  Node: Specifying a repository,  Next: Repository storage,  Up: Repository
495
4962.1 Telling CVS where your repository is
497========================================
498
499There are several ways to tell CVS where to find the repository.  You
500can name the repository on the command line explicitly, with the `-d'
501(for "directory") option:
502
503     cvs -d /usr/local/cvsroot checkout yoyodyne/tc
504
505   Or you can set the `$CVSROOT' environment variable to an absolute
506path to the root of the repository, `/usr/local/cvsroot' in this
507example.  To set `$CVSROOT', `csh' and `tcsh' users should have this
508line in their `.cshrc' or `.tcshrc' files:
509
510     setenv CVSROOT /usr/local/cvsroot
511
512`sh' and `bash' users should instead have these lines in their
513`.profile' or `.bashrc':
514
515     CVSROOT=/usr/local/cvsroot
516     export CVSROOT
517
518   A repository specified with `-d' will override the `$CVSROOT'
519environment variable.  Once you've checked a working copy out from the
520repository, it will remember where its repository is (the information is
521recorded in the `CVS/Root' file in the working copy).
522
523   The `-d' option and the `CVS/Root' file both override the `$CVSROOT'
524environment variable.  If `-d' option differs from `CVS/Root', the
525former is used.  Of course, for proper operation they should be two ways
526of referring to the same repository.
527
528
529File: cvs.info,  Node: Repository storage,  Next: Working directory storage,  Prev: Specifying a repository,  Up: Repository
530
5312.2 How data is stored in the repository
532========================================
533
534For most purposes it isn't important _how_ CVS stores information in the
535repository.  In fact, the format has changed in the past, and is likely
536to change in the future.  Since in almost all cases one accesses the
537repository via CVS commands, such changes need not be disruptive.
538
539   However, in some cases it may be necessary to understand how CVS
540stores data in the repository, for example you might need to track down
541CVS locks (*note Concurrency::) or you might need to deal with the file
542permissions appropriate for the repository.
543
544* Menu:
545
546* Repository files::            What files are stored in the repository
547* File permissions::            File permissions
548* Windows permissions::         Issues specific to Windows
549* Attic::                       Some files are stored in the Attic
550* CVS in repository::           Additional information in CVS directory
551* Locks::                       CVS locks control concurrent accesses
552* CVSROOT storage::             A few things about CVSROOT are different
553
554
555File: cvs.info,  Node: Repository files,  Next: File permissions,  Up: Repository storage
556
5572.2.1 Where files are stored within the repository
558--------------------------------------------------
559
560The overall structure of the repository is a directory tree
561corresponding to the directories in the working directory.  For example,
562supposing the repository is in
563
564     /usr/local/cvsroot
565
566here is a possible directory tree (showing only the directories):
567
568     /usr
569      |
570      +--local
571      |   |
572      |   +--cvsroot
573      |   |    |
574      |   |    +--CVSROOT
575               |      (administrative files)
576               |
577               +--gnu
578               |   |
579               |   +--diff
580               |   |   (source code to GNU diff)
581               |   |
582               |   +--rcs
583               |   |   (source code to RCS)
584               |   |
585               |   +--cvs
586               |       (source code to CVS)
587               |
588               +--yoyodyne
589                   |
590                   +--tc
591                   |    |
592                   |    +--man
593                   |    |
594                   |    +--testing
595                   |
596                   +--(other Yoyodyne software)
597
598   With the directories are "history files" for each file under version
599control.  The name of the history file is the name of the corresponding
600file with `,v' appended to the end.  Here is what the repository for the
601`yoyodyne/tc' directory might look like:
602       `$CVSROOT'
603         |
604         +--yoyodyne
605         |   |
606         |   +--tc
607         |   |   |
608                 +--Makefile,v
609                 +--backend.c,v
610                 +--driver.c,v
611                 +--frontend.c,v
612                 +--parser.c,v
613                 +--man
614                 |    |
615                 |    +--tc.1,v
616                 |
617                 +--testing
618                      |
619                      +--testpgm.t,v
620                      +--test2.t,v
621
622   The history files contain, among other things, enough information to
623recreate any revision of the file, a log of all commit messages and the
624user-name of the person who committed the revision.  The history files
625are known as "RCS files", because the first program to store files in
626that format was a version control system known as RCS.  For a full
627description of the file format, see the `man' page `rcsfile(5)',
628distributed with RCS, or the file `doc/RCSFILES' in the CVS source
629distribution.  This file format has become very common--many systems
630other than CVS or RCS can at least import history files in this format.
631
632   The RCS files used in CVS differ in a few ways from the standard
633format.  The biggest difference is magic branches; for more information
634see *note Magic branch numbers::.  Also in CVS the valid tag names are a
635subset of what RCS accepts; for CVS's rules see *note Tags::.
636
637
638File: cvs.info,  Node: File permissions,  Next: Windows permissions,  Prev: Repository files,  Up: Repository storage
639
6402.2.2 File permissions
641----------------------
642
643All `,v' files are created read-only, and you should not change the
644permission of those files.  The directories inside the repository should
645be writable by the persons that have permission to modify the files in
646each directory.  This normally means that you must create a UNIX group
647(see group(5)) consisting of the persons that are to edit the files in a
648project, and set up the repository so that it is that group that owns
649the directory.  (On some systems, you also need to set the
650set-group-ID-on-execution bit on the repository directories (see
651chmod(1)) so that newly-created files and directories get the group-ID
652of the parent directory rather than that of the current process.)
653
654   This means that you can only control access to files on a
655per-directory basis.
656
657   Note that users must also have write access to check out files,
658because CVS needs to create lock files (*note Concurrency::).  You can
659use LockDir in CVSROOT/config to put the lock files somewhere other than
660in the repository if you want to allow read-only access to some
661directories (*note config::).
662
663   Also note that users must have write access to the `CVSROOT/val-tags'
664file.  CVS uses it to keep track of what tags are valid tag names (it is
665sometimes updated when tags are used, as well as when they are created).
666
667   Each RCS file will be owned by the user who last checked it in.  This
668has little significance; what really matters is who owns the
669directories.
670
671   CVS tries to set up reasonable file permissions for new directories
672that are added inside the tree, but you must fix the permissions
673manually when a new directory should have different permissions than its
674parent directory.  If you set the `CVSUMASK' environment variable that
675will control the file permissions which CVS uses in creating directories
676and/or files in the repository.  `CVSUMASK' does not affect the file
677permissions in the working directory; such files have the permissions
678which are typical for newly created files, except that sometimes CVS
679creates them read-only (see the sections on watches, *note Setting a
680watch::; -r, *note Global options::; or `CVSREAD', *note Environment
681variables::).
682
683   Note that using the client/server CVS (*note Remote repositories::),
684there is no good way to set `CVSUMASK'; the setting on the client
685machine has no effect.  If you are connecting with `rsh', you can set
686`CVSUMASK' in `.bashrc' or `.cshrc', as described in the documentation
687for your operating system.  This behavior might change in future
688versions of CVS; do not rely on the setting of `CVSUMASK' on the client
689having no effect.
690
691   Using pserver, you will generally need stricter permissions on the
692CVSROOT directory and directories above it in the tree; see *note
693Password authentication security::.
694
695   Some operating systems have features which allow a particular program
696to run with the ability to perform operations which the caller of the
697program could not.  For example, the set user ID (setuid) or set group
698ID (setgid) features of unix or the installed image feature of VMS.  CVS
699was not written to use such features and therefore attempting to install
700CVS in this fashion will provide protection against only accidental
701lapses; anyone who is trying to circumvent the measure will be able to
702do so, and depending on how you have set it up may gain access to more
703than just CVS.  You may wish to instead consider pserver.  It shares
704some of the same attributes, in terms of possibly providing a false
705sense of security or opening security holes wider than the ones you are
706trying to fix, so read the documentation on pserver security carefully
707if you are considering this option (*note Password authentication
708security::).
709
710
711File: cvs.info,  Node: Windows permissions,  Next: Attic,  Prev: File permissions,  Up: Repository storage
712
7132.2.3 File Permission issues specific to Windows
714------------------------------------------------
715
716Some file permission issues are specific to Windows operating systems
717(Windows 95, Windows NT, and presumably future operating systems in this
718family.  Some of the following might apply to OS/2 but I'm not sure).
719
720   If you are using local CVS and the repository is on a networked file
721system which is served by the Samba SMB server, some people have
722reported problems with permissions.  Enabling WRITE=YES in the samba
723configuration is said to fix/workaround it.  Disclaimer: I haven't
724investigated enough to know the implications of enabling that option,
725nor do I know whether there is something which CVS could be doing
726differently in order to avoid the problem.  If you find something out,
727please let us know as described in *note BUGS::.
728
729
730File: cvs.info,  Node: Attic,  Next: CVS in repository,  Prev: Windows permissions,  Up: Repository storage
731
7322.2.4 The attic
733---------------
734
735You will notice that sometimes CVS stores an RCS file in the `Attic'.
736For example, if the CVSROOT is `/usr/local/cvsroot' and we are talking
737about the file `backend.c' in the directory `yoyodyne/tc', then the file
738normally would be in
739
740     /usr/local/cvsroot/yoyodyne/tc/backend.c,v
741
742but if it goes in the attic, it would be in
743
744     /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
745
746instead.  It should not matter from a user point of view whether a file
747is in the attic; CVS keeps track of this and looks in the attic when it
748needs to.  But in case you want to know, the rule is that the RCS file
749is stored in the attic if and only if the head revision on the trunk has
750state `dead'.  A `dead' state means that file has been removed, or never
751added, for that revision.  For example, if you add a file on a branch,
752it will have a trunk revision in `dead' state, and a branch revision in
753a non-`dead' state.
754
755
756File: cvs.info,  Node: CVS in repository,  Next: Locks,  Prev: Attic,  Up: Repository storage
757
7582.2.5 The CVS directory in the repository
759-----------------------------------------
760
761The `CVS' directory in each repository directory contains information
762such as file attributes (in a file called `CVS/fileattr'.  In the future
763additional files may be added to this directory, so implementations
764should silently ignore additional files.
765
766   This behavior is implemented only by CVS 1.7 and later; for details
767see *note Watches Compatibility::.
768
769   The format of the fileattr file is a series of entries of the
770following form (where `{' and `}' means the text between the braces can
771be repeated zero or more times):
772
773   ENT-TYPE FILENAME <tab> ATTRNAME = ATTRVAL   {; ATTRNAME = ATTRVAL}
774<linefeed>
775
776   ENT-TYPE is `F' for a file, in which case the entry specifies the
777attributes for that file.
778
779   ENT-TYPE is `D', and FILENAME empty, to specify default attributes to
780be used for newly added files.
781
782   Other ENT-TYPE are reserved for future expansion.  CVS 1.9 and older
783will delete them any time it writes file attributes.  CVS 1.10 and later
784will preserve them.
785
786   Note that the order of the lines is not significant; a program
787writing the fileattr file may rearrange them at its convenience.
788
789   There is currently no way of quoting tabs or linefeeds in the
790filename, `=' in ATTRNAME, `;' in ATTRVAL, etc.  Note: some
791implementations also don't handle a NUL character in any of the fields,
792but implementations are encouraged to allow it.
793
794   By convention, ATTRNAME starting with `_' is for an attribute given
795special meaning by CVS; other ATTRNAMEs are for user-defined attributes
796(or will be, once implementations start supporting user-defined
797attributes).
798
799   Builtin attributes:
800
801`_watched'
802     Present means the file is watched and should be checked out
803     read-only.
804
805`_watchers'
806     Users with watches for this file.  Value is WATCHER > TYPE { ,
807     WATCHER > TYPE } where WATCHER is a username, and TYPE is zero or
808     more of edit,unedit,commit separated by `+' (that is, nothing if
809     none; there is no "none" or "all" keyword).
810
811`_editors'
812     Users editing this file.  Value is EDITOR > VAL { , EDITOR > VAL }
813     where EDITOR is a username, and VAL is TIME+HOSTNAME+PATHNAME,
814     where TIME is when the `cvs edit' command (or equivalent) happened,
815     and HOSTNAME and PATHNAME are for the working directory.
816
817   Example:
818
819     Ffile1 _watched=;_watchers=joe>edit,mary>commit
820     Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
821     D _watched=
822
823means that the file `file1' should be checked out read-only.
824Furthermore, joe is watching for edits and mary is watching for commits.
825The file `file2' should be checked out read-only; sue started editing it
826on 8 Jan 1975 in the directory `/home/sue/cvs' on the machine
827`workstn1'.  Future files which are added should be checked out
828read-only.  To represent this example here, we have shown a space after
829`D', `Ffile1', and `Ffile2', but in fact there must be a single tab
830character there and no spaces.
831
832
833File: cvs.info,  Node: Locks,  Next: CVSROOT storage,  Prev: CVS in repository,  Up: Repository storage
834
8352.2.6 CVS locks in the repository
836---------------------------------
837
838For an introduction to CVS locks focusing on user-visible behavior, see
839*note Concurrency::.  The following section is aimed at people who are
840writing tools which want to access a CVS repository without interfering
841with other tools accessing the same repository.  If you find yourself
842confused by concepts described here, like "read lock", "write lock", and
843"deadlock", you might consult the literature on operating systems or
844databases.
845
846   Any file in the repository with a name starting with `#cvs.rfl.' is a
847read lock.  Any file in the repository with a name starting with
848`#cvs.wfl' is a write lock.  Old versions of CVS (before CVS 1.5) also
849created files with names starting with `#cvs.tfl', but they are not
850discussed here.  The directory `#cvs.lock' serves as a master lock.
851That is, one must obtain this lock first before creating any of the
852other locks.
853
854   To obtain a readlock, first create the `#cvs.lock' directory.  This
855operation must be atomic (which should be true for creating a directory
856under most operating systems).  If it fails because the directory
857already existed, wait for a while and try again.  After obtaining the
858`#cvs.lock' lock, create a file whose name is `#cvs.rfl.' followed by
859information of your choice (for example, hostname and process
860identification number).  Then remove the `#cvs.lock' directory to
861release the master lock.  Then proceed with reading the repository.
862When you are done, remove the `#cvs.rfl' file to release the read lock.
863
864   To obtain a writelock, first create the `#cvs.lock' directory, as
865with a readlock.  Then check that there are no files whose names start
866with `#cvs.rfl.'.  If there are, remove `#cvs.lock', wait for a while,
867and try again.  If there are no readers, then create a file whose name
868is `#cvs.wfl' followed by information of your choice (for example,
869hostname and process identification number).  Hang on to the `#cvs.lock'
870lock.  Proceed with writing the repository.  When you are done, first
871remove the `#cvs.wfl' file and then the `#cvs.lock' directory. Note that
872unlike the `#cvs.rfl' file, the `#cvs.wfl' file is just informational;
873it has no effect on the locking operation beyond what is provided by
874holding on to the `#cvs.lock' lock itself.
875
876   Note that each lock (writelock or readlock) only locks a single
877directory in the repository, including `Attic' and `CVS' but not
878including subdirectories which represent other directories under version
879control.  To lock an entire tree, you need to lock each directory (note
880that if you fail to obtain any lock you need, you must release the whole
881tree before waiting and trying again, to avoid deadlocks).
882
883   Note also that CVS expects writelocks to control access to individual
884`foo,v' files.  RCS has a scheme where the `,foo,' file serves as a
885lock, but CVS does not implement it and so taking out a CVS writelock is
886recommended.  See the comments at rcs_internal_lockfile in the CVS
887source code for further discussion/rationale.
888
889
890File: cvs.info,  Node: CVSROOT storage,  Prev: Locks,  Up: Repository storage
891
8922.2.7 How files are stored in the CVSROOT directory
893---------------------------------------------------
894
895The `$CVSROOT/CVSROOT' directory contains the various administrative
896files.  In some ways this directory is just like any other directory in
897the repository; it contains RCS files whose names end in `,v', and many
898of the CVS commands operate on it the same way.  However, there are a
899few differences.
900
901   For each administrative file, in addition to the RCS file, there is
902also a checked out copy of the file.  For example, there is an RCS file
903`loginfo,v' and a file `loginfo' which contains the latest revision
904contained in `loginfo,v'.  When you check in an administrative file, CVS
905should print
906
907     cvs commit: Rebuilding administrative file database
908
909and update the checked out copy in `$CVSROOT/CVSROOT'.  If it does not,
910there is something wrong (*note BUGS::).  To add your own files to the
911files to be updated in this fashion, you can add them to the
912`checkoutlist' administrative file (*note checkoutlist::).
913
914   By default, the `modules' file behaves as described above.  If the
915modules file is very large, storing it as a flat text file may make
916looking up modules slow (I'm not sure whether this is as much of a
917concern now as when CVS first evolved this feature; I haven't seen
918benchmarks).  Therefore, by making appropriate edits to the CVS source
919code one can store the modules file in a database which implements the
920`ndbm' interface, such as Berkeley db or GDBM.  If this option is in
921use, then the modules database will be stored in the files `modules.db',
922`modules.pag', and/or `modules.dir'.
923
924   For information on the meaning of the various administrative files,
925see *note Administrative files::.
926
927
928File: cvs.info,  Node: Working directory storage,  Next: Intro administrative files,  Prev: Repository storage,  Up: Repository
929
9302.3 How data is stored in the working directory
931===============================================
932
933While we are discussing CVS internals which may become visible from time
934to time, we might as well talk about what CVS puts in the `CVS'
935directories in the working directories.  As with the repository, CVS
936handles this information and one can usually access it via CVS commands.
937But in some cases it may be useful to look at it, and other programs,
938such as the `jCVS' graphical user interface or the `VC' package for
939emacs, may need to look at it.  Such programs should follow the
940recommendations in this section if they hope to be able to work with
941other programs which use those files, including future versions of the
942programs just mentioned and the command-line CVS client.
943
944   The `CVS' directory contains several files.  Programs which are
945reading this directory should silently ignore files which are in the
946directory but which are not documented here, to allow for future
947expansion.
948
949   The files are stored according to the text file convention for the
950system in question.  This means that working directories are not
951portable between systems with differing conventions for storing text
952files.  This is intentional, on the theory that the files being managed
953by CVS probably will not be portable between such systems either.
954
955`Root'
956     This file contains the current CVS root, as described in *note
957     Specifying a repository::.
958
959`Repository'
960     This file contains the directory within the repository which the
961     current directory corresponds with.  It can be either an absolute
962     pathname or a relative pathname; CVS has had the ability to read
963     either format since at least version 1.3 or so.  The relative
964     pathname is relative to the root, and is the more sensible
965     approach, but the absolute pathname is quite common and
966     implementations should accept either.  For example, after the
967     command
968
969          cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
970
971     `Root' will contain
972
973          :local:/usr/local/cvsroot
974
975     and `Repository' will contain either
976
977          /usr/local/cvsroot/yoyodyne/tc
978
979     or
980
981          yoyodyne/tc
982
983     If the particular working directory does not correspond to a
984     directory in the repository, then `Repository' should contain
985     `CVSROOT/Emptydir'.
986
987`Entries'
988     This file lists the files and directories in the working directory.
989     The first character of each line indicates what sort of line it is.
990     If the character is unrecognized, programs reading the file should
991     silently skip that line, to allow for future expansion.
992
993     If the first character is `/', then the format is:
994
995          /NAME/REVISION/TIMESTAMP[+CONFLICT]/OPTIONS/TAGDATE
996
997     where `[' and `]' are not part of the entry, but instead indicate
998     that the `+' and conflict marker are optional.  NAME is the name of
999     the file within the directory.  REVISION is the revision that the
1000     file in the working derives from, or `0' for an added file, or `-'
1001     followed by a revision for a removed file.  TIMESTAMP is the
1002     timestamp of the file at the time that CVS created it; if the
1003     timestamp differs with the actual modification time of the file it
1004     means the file has been modified.  It is stored in the format used
1005     by the ISO C asctime() function (for example, `Sun Apr  7 01:29:26
1006     1996').  One may write a string which is not in that format, for
1007     example, `Result of merge', to indicate that the file should always
1008     be considered to be modified.  This is not a special case; to see
1009     whether a file is modified a program should take the timestamp of
1010     the file and simply do a string compare with TIMESTAMP.  If there
1011     was a conflict, CONFLICT can be set to the modification time of the
1012     file after the file has been written with conflict markers (*note
1013     Conflicts example::).  Thus if CONFLICT is subsequently the same as
1014     the actual modification time of the file it means that the user has
1015     obviously not resolved the conflict.  OPTIONS contains sticky
1016     options (for example `-kb' for a binary file).  TAGDATE contains
1017     `T' followed by a tag name, or `D' for a date, followed by a sticky
1018     tag or date.  Note that if TIMESTAMP contains a pair of timestamps
1019     separated by a space, rather than a single timestamp, you are
1020     dealing with a version of CVS earlier than CVS 1.5 (not documented
1021     here).
1022
1023     The timezone on the timestamp in CVS/Entries (local or universal)
1024     should be the same as the operating system stores for the timestamp
1025     of the file itself.  For example, on Unix the file's timestamp is
1026     in universal time (UT), so the timestamp in CVS/Entries should be
1027     too.  On VMS, the file's timestamp is in local time, so CVS on VMS
1028     should use local time.  This rule is so that files do not appear to
1029     be modified merely because the timezone changed (for example, to or
1030     from summer time).
1031
1032     If the first character of a line in `Entries' is `D', then it
1033     indicates a subdirectory.  `D' on a line all by itself indicates
1034     that the program which wrote the `Entries' file does record
1035     subdirectories (therefore, if there is such a line and no other
1036     lines beginning with `D', one knows there are no subdirectories).
1037     Otherwise, the line looks like:
1038
1039          D/NAME/FILLER1/FILLER2/FILLER3/FILLER4
1040
1041     where NAME is the name of the subdirectory, and all the FILLER
1042     fields should be silently ignored, for future expansion.  Programs
1043     which modify `Entries' files should preserve these fields.
1044
1045     The lines in the `Entries' file can be in any order.
1046
1047`Entries.Log'
1048     This file does not record any information beyond that in `Entries',
1049     but it does provide a way to update the information without having
1050     to rewrite the entire `Entries' file, including the ability to
1051     preserve the information even if the program writing `Entries' and
1052     `Entries.Log' abruptly aborts.  Programs which are reading the
1053     `Entries' file should also check for `Entries.Log'.  If the latter
1054     exists, they should read `Entries' and then apply the changes
1055     mentioned in `Entries.Log'.  After applying the changes, the
1056     recommended practice is to rewrite `Entries' and then delete
1057     `Entries.Log'.  The format of a line in `Entries.Log' is a single
1058     character command followed by a space followed by a line in the
1059     format specified for a line in `Entries'.  The single character
1060     command is `A' to indicate that the entry is being added, `R' to
1061     indicate that the entry is being removed, or any other character to
1062     indicate that the entire line in `Entries.Log' should be silently
1063     ignored (for future expansion).  If the second character of the
1064     line in `Entries.Log' is not a space, then it was written by an
1065     older version of CVS (not documented here).
1066
1067     Programs which are writing rather than reading can safely ignore
1068     `Entries.Log' if they so choose.
1069
1070`Entries.Backup'
1071     This is a temporary file.  Recommended usage is to write a new
1072     entries file to `Entries.Backup', and then to rename it
1073     (atomically, where possible) to `Entries'.
1074
1075`Entries.Static'
1076     The only relevant thing about this file is whether it exists or
1077     not.  If it exists, then it means that only part of a directory was
1078     gotten and CVS will not create additional files in that directory.
1079     To clear it, use the `update' command with the `-d' option, which
1080     will get the additional files and remove `Entries.Static'.
1081
1082`Tag'
1083     This file contains per-directory sticky tags or dates.  The first
1084     character is `T' for a branch tag, `N' for a non-branch tag, or `D'
1085     for a date, or another character to mean the file should be
1086     silently ignored, for future expansion.  This character is followed
1087     by the tag or date.  Note that per-directory sticky tags or dates
1088     are used for things like applying to files which are newly added;
1089     they might not be the same as the sticky tags or dates on
1090     individual files.  For general information on sticky tags and
1091     dates, see *note Sticky tags::.
1092
1093`Notify'
1094     This file stores notifications (for example, for `edit' or
1095     `unedit') which have not yet been sent to the server.  Its format
1096     is not yet documented here.
1097
1098`Notify.tmp'
1099     This file is to `Notify' as `Entries.Backup' is to `Entries'.  That
1100     is, to write `Notify', first write the new contents to `Notify.tmp'
1101     and then (atomically where possible), rename it to `Notify'.
1102
1103`Base'
1104     If watches are in use, then an `edit' command stores the original
1105     copy of the file in the `Base' directory.  This allows the `unedit'
1106     command to operate even if it is unable to communicate with the
1107     server.
1108
1109`Baserev'
1110     The file lists the revision for each of the files in the `Base'
1111     directory.  The format is:
1112
1113          BNAME/REV/EXPANSION
1114
1115     where EXPANSION should be ignored, to allow for future expansion.
1116
1117`Baserev.tmp'
1118     This file is to `Baserev' as `Entries.Backup' is to `Entries'.
1119     That is, to write `Baserev', first write the new contents to
1120     `Baserev.tmp' and then (atomically where possible), rename it to
1121     `Baserev'.
1122
1123`Template'
1124     This file contains the template specified by the `rcsinfo' file
1125     (*note rcsinfo::).  It is only used by the client; the
1126     non-client/server CVS consults `rcsinfo' directly.
1127
1128
1129File: cvs.info,  Node: Intro administrative files,  Next: Multiple repositories,  Prev: Working directory storage,  Up: Repository
1130
11312.4 The administrative files
1132============================
1133
1134The directory `$CVSROOT/CVSROOT' contains some "administrative files".
1135*Note Administrative files::, for a complete description.  You can use
1136CVS without any of these files, but some commands work better when at
1137least the `modules' file is properly set up.
1138
1139   The most important of these files is the `modules' file.  It defines
1140all modules in the repository.  This is a sample `modules' file.
1141
1142     CVSROOT         CVSROOT
1143     modules         CVSROOT modules
1144     cvs             gnu/cvs
1145     rcs             gnu/rcs
1146     diff            gnu/diff
1147     tc              yoyodyne/tc
1148
1149   The `modules' file is line oriented.  In its simplest form each line
1150contains the name of the module, whitespace, and the directory where the
1151module resides.  The directory is a path relative to `$CVSROOT'.  The
1152last four lines in the example above are examples of such lines.
1153
1154   The line that defines the module called `modules' uses features that
1155are not explained here.  *Note modules::, for a full explanation of all
1156the available features.
1157
11582.4.1 Editing administrative files
1159----------------------------------
1160
1161You edit the administrative files in the same way that you would edit
1162any other module.  Use `cvs checkout CVSROOT' to get a working copy,
1163edit it, and commit your changes in the normal way.
1164
1165   It is possible to commit an erroneous administrative file.  You can
1166often fix the error and check in a new revision, but sometimes a
1167particularly bad error in the administrative file makes it impossible to
1168commit new revisions.
1169
1170
1171File: cvs.info,  Node: Multiple repositories,  Next: Creating a repository,  Prev: Intro administrative files,  Up: Repository
1172
11732.5 Multiple repositories
1174=========================
1175
1176In some situations it is a good idea to have more than one repository,
1177for instance if you have two development groups that work on separate
1178projects without sharing any code.  All you have to do to have several
1179repositories is to specify the appropriate repository, using the
1180`CVSROOT' environment variable, the `-d' option to CVS, or (once you
1181have checked out a working directory) by simply allowing CVS to use the
1182repository that was used to check out the working directory (*note
1183Specifying a repository::).
1184
1185   The big advantage of having multiple repositories is that they can
1186reside on different servers.  With CVS version 1.10, a single command
1187cannot recurse into directories from different repositories.  With
1188development versions of CVS, you can check out code from multiple
1189servers into your working directory.  CVS will recurse and handle all
1190the details of making connections to as many server machines as
1191necessary to perform the requested command.  Here is an example of how
1192to set up a working directory:
1193
1194     cvs -d server1:/cvs co dir1
1195     cd dir1
1196     cvs -d server2:/root co sdir
1197     cvs update
1198
1199   The `cvs co' commands set up the working directory, and then the `cvs
1200update' command will contact server2, to update the dir1/sdir
1201subdirectory, and server1, to update everything else.
1202
1203
1204File: cvs.info,  Node: Creating a repository,  Next: Backing up,  Prev: Multiple repositories,  Up: Repository
1205
12062.6 Creating a repository
1207=========================
1208
1209To set up a CVS repository, first choose the machine and disk on which
1210you want to store the revision history of the source files.  CPU and
1211memory requirements are modest, so most machines should be adequate.
1212For details see *note Server requirements::.
1213
1214   To estimate disk space requirements, if you are importing RCS files
1215from another system, the size of those files is the approximate initial
1216size of your repository, or if you are starting without any version
1217history, a rule of thumb is to allow for the server approximately three
1218times the size of the code to be under CVS for the repository (you will
1219eventually outgrow this, but not for a while).  On the machines on which
1220the developers will be working, you'll want disk space for approximately
1221one working directory for each developer (either the entire tree or a
1222portion of it, depending on what each developer uses).
1223
1224   The repository should be accessible (directly or via a networked file
1225system) from all machines which want to use CVS in server or local mode;
1226the client machines need not have any access to it other than via the
1227CVS protocol.  It is not possible to use CVS to read from a repository
1228which one only has read access to; CVS needs to be able to create lock
1229files (*note Concurrency::).
1230
1231   To create a repository, run the `cvs init' command.  It will set up
1232an empty repository in the CVS root specified in the usual way (*note
1233Repository::).  For example,
1234
1235     cvs -d /usr/local/cvsroot init
1236
1237   `cvs init' is careful to never overwrite any existing files in the
1238repository, so no harm is done if you run `cvs init' on an already
1239set-up repository.
1240
1241   `cvs init' will enable history logging; if you don't want that,
1242remove the history file after running `cvs init'.  *Note history file::.
1243
1244
1245File: cvs.info,  Node: Backing up,  Next: Moving a repository,  Prev: Creating a repository,  Up: Repository
1246
12472.7 Backing up a repository
1248===========================
1249
1250There is nothing particularly magical about the files in the repository;
1251for the most part it is possible to back them up just like any other
1252files.  However, there are a few issues to consider.
1253
1254   The first is that to be paranoid, one should either not use CVS
1255during the backup, or have the backup program lock CVS while doing the
1256backup.  To not use CVS, you might forbid logins to machines which can
1257access the repository, turn off your CVS server, or similar mechanisms.
1258The details would depend on your operating system and how you have CVS
1259set up.  To lock CVS, you would create `#cvs.rfl' locks in each
1260repository directory.  See *note Concurrency::, for more on CVS locks.
1261Having said all this, if you just back up without any of these
1262precautions, the results are unlikely to be particularly dire.
1263Restoring from backup, the repository might be in an inconsistent state,
1264but this would not be particularly hard to fix manually.
1265
1266   When you restore a repository from backup, assuming that changes in
1267the repository were made after the time of the backup, working
1268directories which were not affected by the failure may refer to
1269revisions which no longer exist in the repository.  Trying to run CVS in
1270such directories will typically produce an error message.  One way to
1271get those changes back into the repository is as follows:
1272
1273   * Get a new working directory.
1274
1275   * Copy the files from the working directory from before the failure
1276     over to the new working directory (do not copy the contents of the
1277     `CVS' directories, of course).
1278
1279   * Working in the new working directory, use commands such as `cvs
1280     update' and `cvs diff' to figure out what has changed, and then
1281     when you are ready, commit the changes into the repository.
1282
1283
1284File: cvs.info,  Node: Moving a repository,  Next: Remote repositories,  Prev: Backing up,  Up: Repository
1285
12862.8 Moving a repository
1287=======================
1288
1289Just as backing up the files in the repository is pretty much like
1290backing up any other files, if you need to move a repository from one
1291place to another it is also pretty much like just moving any other
1292collection of files.
1293
1294   The main thing to consider is that working directories point to the
1295repository.  The simplest way to deal with a moved repository is to just
1296get a fresh working directory after the move.  Of course, you'll want to
1297make sure that the old working directory had been checked in before the
1298move, or you figured out some other way to make sure that you don't lose
1299any changes.  If you really do want to reuse the existing working
1300directory, it should be possible with manual surgery on the
1301`CVS/Repository' files.  You can see *note Working directory storage::,
1302for information on the `CVS/Repository' and `CVS/Root' files, but unless
1303you are sure you want to bother, it probably isn't worth it.
1304
1305
1306File: cvs.info,  Node: Remote repositories,  Next: Read-only access,  Prev: Moving a repository,  Up: Repository
1307
13082.9 Remote repositories
1309=======================
1310
1311Your working copy of the sources can be on a different machine than the
1312repository.  Using CVS in this manner is known as "client/server"
1313operation.  You run CVS on a machine which can mount your working
1314directory, known as the "client", and tell it to communicate to a
1315machine which can mount the repository, known as the "server".
1316Generally, using a remote repository is just like using a local one,
1317except that the format of the repository name is:
1318
1319     [:METHOD:][[USER][:PASSWORD]@]HOSTNAME[:[PORT]]/path/to/repository
1320
1321   Specifying a password in the repository name is not recommended
1322during checkout, since this will cause CVS to store a cleartext copy of
1323the password in each created directory.  `cvs login' first instead
1324(*note Password authentication client::).
1325
1326   The details of exactly what needs to be set up depend on how you are
1327connecting to the server.
1328
1329   If METHOD is not specified, and the repository name contains `:',
1330then the default is `ext' or `server', depending on your platform; both
1331are described in *note Connecting via rsh::.
1332
1333* Menu:
1334
1335* Server requirements::         Memory and other resources for servers
1336* Connecting via rsh::          Using the `rsh' program to connect
1337* Password authenticated::      Direct connections using passwords
1338* GSSAPI authenticated::        Direct connections using GSSAPI
1339* Kerberos authenticated::      Direct connections with kerberos
1340* Connecting via fork::         Using a forked `cvs server' to connect
1341
1342
1343File: cvs.info,  Node: Server requirements,  Next: Connecting via rsh,  Up: Remote repositories
1344
13452.9.1 Server requirements
1346-------------------------
1347
1348The quick answer to what sort of machine is suitable as a server is that
1349requirements are modest--a server with 32M of memory or even less can
1350handle a fairly large source tree with a fair amount of activity.
1351
1352   The real answer, of course, is more complicated.  Estimating the
1353known areas of large memory consumption should be sufficient to estimate
1354memory requirements.  There are two such areas documented here; other
1355memory consumption should be small by comparison (if you find that is
1356not the case, let us know, as described in *note BUGS::, so we can
1357update this documentation).
1358
1359   The first area of big memory consumption is large checkouts, when
1360using the CVS server.  The server consists of two processes for each
1361client that it is serving.  Memory consumption on the child process
1362should remain fairly small.  Memory consumption on the parent process,
1363particularly if the network connection to the client is slow, can be
1364expected to grow to slightly more than the size of the sources in a
1365single directory, or two megabytes, whichever is larger.
1366
1367   Multiplying the size of each CVS server by the number of servers
1368which you expect to have active at one time should give an idea of
1369memory requirements for the server.  For the most part, the memory
1370consumed by the parent process probably can be swap space rather than
1371physical memory.
1372
1373   The second area of large memory consumption is `diff', when checking
1374in large files.  This is required even for binary files.  The rule of
1375thumb is to allow about ten times the size of the largest file you will
1376want to check in, although five times may be adequate.  For example, if
1377you want to check in a file which is 10 megabytes, you should have 100
1378megabytes of memory on the machine doing the checkin (the server machine
1379for client/server, or the machine running CVS for non-client/server).
1380This can be swap space rather than physical memory.  Because the memory
1381is only required briefly, there is no particular need to allow memory
1382for more than one such checkin at a time.
1383
1384   Resource consumption for the client is even more modest--any machine
1385with enough capacity to run the operating system in question should have
1386little trouble.
1387
1388   For information on disk space requirements, see *note Creating a
1389repository::.
1390
1391
1392File: cvs.info,  Node: Connecting via rsh,  Next: Password authenticated,  Prev: Server requirements,  Up: Remote repositories
1393
13942.9.2 Connecting with rsh
1395-------------------------
1396
1397CVS uses the `rsh' protocol to perform these operations, so the remote
1398user host needs to have a `.rhosts' file which grants access to the
1399local user. Note that the program that CVS uses for this purpose may be
1400specified using the `--with-rsh' flag to configure.
1401
1402   For example, suppose you are the user `mozart' on the local machine
1403`toe.example.com', and the server machine is `faun.example.org'.  On
1404faun, put the following line into the file `.rhosts' in `bach''s home
1405directory:
1406
1407     toe.example.com  mozart
1408
1409Then test that `rsh' is working with
1410
1411     rsh -l bach faun.example.org 'echo $PATH'
1412
1413   Next you have to make sure that `rsh' will be able to find the
1414server.  Make sure that the path which `rsh' printed in the above
1415example includes the directory containing a program named `cvs' which is
1416the server.  You need to set the path in `.bashrc', `.cshrc', etc., not
1417`.login' or `.profile'.  Alternately, you can set the environment
1418variable `CVS_SERVER' on the client machine to the filename of the
1419server you want to use, for example `/usr/local/bin/cvs-1.6'.
1420
1421   There is no need to edit `inetd.conf' or start a CVS server daemon.
1422
1423   There are two access methods that you use in `CVSROOT' for rsh.
1424`:server:' specifies an internal rsh client, which is supported only by
1425some CVS ports.  `:ext:' specifies an external rsh program.  By default
1426this is `rsh' (unless otherwise specified by the `--with-rsh' flag to
1427configure) but you may set the `CVS_RSH' environment variable to invoke
1428another program which can access the remote server (for example, `remsh'
1429on HP-UX 9 because `rsh' is something different).  It must be a program
1430which can transmit data to and from the server without modifying it; for
1431example the Windows NT `rsh' is not suitable since it by default
1432translates between CRLF and LF.  The OS/2 CVS port has a hack to pass
1433`-b' to `rsh' to get around this, but since this could potentially cause
1434problems for programs other than the standard `rsh', it may change in
1435the future.  If you set `CVS_RSH' to `SSH' or some other rsh
1436replacement, the instructions in the rest of this section concerning
1437`.rhosts' and so on are likely to be inapplicable; consult the
1438documentation for your rsh replacement.
1439
1440   Continuing our example, supposing you want to access the module `foo'
1441in the repository `/usr/local/cvsroot/', on machine `faun.example.org',
1442you are ready to go:
1443
1444     cvs -d :ext:bach@faun.example.org:/usr/local/cvsroot checkout foo
1445
1446(The `bach@' can be omitted if the username is the same on both the
1447local and remote hosts.)
1448
1449
1450File: cvs.info,  Node: Password authenticated,  Next: GSSAPI authenticated,  Prev: Connecting via rsh,  Up: Remote repositories
1451
14522.9.3 Direct connection with password authentication
1453----------------------------------------------------
1454
1455The CVS client can also connect to the server using a password protocol.
1456This is particularly useful if using `rsh' is not feasible (for example,
1457the server is behind a firewall), and Kerberos also is not available.
1458
1459   To use this method, it is necessary to make some adjustments on both
1460the server and client sides.
1461
1462* Menu:
1463
1464* Password authentication server::     Setting up the server
1465* Password authentication client::     Using the client
1466* Password authentication security::   What this method does and does not do
1467
1468
1469File: cvs.info,  Node: Password authentication server,  Next: Password authentication client,  Up: Password authenticated
1470
14712.9.3.1 Setting up the server for password authentication
1472.........................................................
1473
1474First of all, you probably want to tighten the permissions on the
1475`$CVSROOT' and `$CVSROOT/CVSROOT' directories.  See *note Password
1476authentication security::, for more details.
1477
1478   On the server side, the file `/etc/inetd.conf' needs to be edited so
1479`inetd' knows to run the command `cvs pserver' when it receives a
1480connection on the right port.  By default, the port number is 2401; it
1481would be different if your client were compiled with `CVS_AUTH_PORT'
1482defined to something else, though.  This can also be specified in the
1483CVSROOT variable (*note Remote repositories::) or overridden with the
1484CVS_CLIENT_PORT environment variable (*note Environment variables::).
1485
1486   If your `inetd' allows raw port numbers in `/etc/inetd.conf', then
1487the following (all on a single line in `inetd.conf') should be
1488sufficient:
1489
1490     2401  stream  tcp  nowait  root  /usr/local/bin/cvs
1491     cvs -f --allow-root=/usr/cvsroot pserver
1492
1493(You could also use the `-T' option to specify a temporary directory.)
1494
1495   The `--allow-root' option specifies the allowable CVSROOT directory.
1496Clients which attempt to use a different CVSROOT directory will not be
1497allowed to connect.  If there is more than one CVSROOT directory which
1498you want to allow, repeat the option.  (Unfortunately, many versions of
1499`inetd' have very small limits on the number of arguments and/or the
1500total length of the command.  The usual solution to this problem is to
1501have `inetd' run a shell script which then invokes CVS with the
1502necessary arguments.)
1503
1504   If your `inetd' wants a symbolic service name instead of a raw port
1505number, then put this in `/etc/services':
1506
1507     cvspserver      2401/tcp
1508
1509and put `cvspserver' instead of `2401' in `inetd.conf'.
1510
1511   If your system uses `xinetd' instead of `inetd', the procedure is
1512slightly different.  Create a file called `/etc/xinetd.d/cvspserver'
1513containing the following:
1514
1515     service cvspserver
1516     {
1517        port        = 2401
1518        socket_type = stream
1519        protocol    = tcp
1520        wait        = no
1521        user        = root
1522        passenv     = PATH
1523        server      = /usr/local/bin/cvs
1524        server_args = -f --allow-root=/usr/cvsroot pserver
1525     }
1526
1527(If `cvspserver' is defined in `/etc/services', you can omit the `port'
1528line.)
1529
1530   Once the above is taken care of, restart your `inetd', or do whatever
1531is necessary to force it to reread its initialization files.
1532
1533   If you are having trouble setting this up, see *note Connection::.
1534
1535   Because the client stores and transmits passwords in cleartext
1536(almost--see *note Password authentication security::, for details), a
1537separate CVS password file is generally used, so people don't compromise
1538their regular passwords when they access the repository.  This file is
1539`$CVSROOT/CVSROOT/passwd' (*note Intro administrative files::).  It uses
1540a colon-separated format, similar to `/etc/passwd' on Unix systems,
1541except that it has fewer fields: CVS username, optional password, and an
1542optional system username for CVS to run as if authentication succeeds.
1543Here is an example `passwd' file with five entries:
1544
1545     anonymous:
1546     bach:ULtgRLXo7NRxs
1547     spwang:1sOp854gDF3DY
1548     melissa:tGX1fS8sun6rY:pubcvs
1549     qproj:XR4EZcEs0szik:pubcvs
1550
1551(The passwords are encrypted according to the standard Unix `crypt()'
1552function, so it is possible to paste in passwords directly from regular
1553Unix `/etc/passwd' files.)
1554
1555   The first line in the example will grant access to any CVS client
1556attempting to authenticate as user `anonymous', no matter what password
1557they use, including an empty password.  (This is typical for sites
1558granting anonymous read-only access; for information on how to do the
1559"read-only" part, see *note Read-only access::.)
1560
1561   The second and third lines will grant access to `bach' and `spwang'
1562if they supply their respective plaintext passwords.
1563
1564   The fourth line will grant access to `melissa', if she supplies the
1565correct password, but her CVS operations will actually run on the server
1566side under the system user `pubcvs'.  Thus, there need not be any system
1567user named `melissa', but there _must_ be one named `pubcvs'.
1568
1569   The fifth line shows that system user identities can be shared: any
1570client who successfully authenticates as `qproj' will actually run as
1571`pubcvs', just as `melissa' does.  That way you could create a single,
1572shared system user for each project in your repository, and give each
1573developer their own line in the `$CVSROOT/CVSROOT/passwd' file.  The CVS
1574username on each line would be different, but the system username would
1575be the same.  The reason to have different CVS usernames is that CVS
1576will log their actions under those names: when `melissa' commits a
1577change to a project, the checkin is recorded in the project's history
1578under the name `melissa', not `pubcvs'.  And the reason to have them
1579share a system username is so that you can arrange permissions in the
1580relevant area of the repository such that only that account has
1581write-permission there.
1582
1583   If the system-user field is present, all password-authenticated CVS
1584commands run as that user; if no system user is specified, CVS simply
1585takes the CVS username as the system username and runs commands as that
1586user.  In either case, if there is no such user on the system, then the
1587CVS operation will fail (regardless of whether the client supplied a
1588valid password).
1589
1590   The password and system-user fields can both be omitted (and if the
1591system-user field is omitted, then also omit the colon that would have
1592separated it from the encrypted password).  For example, this would be a
1593valid `$CVSROOT/CVSROOT/passwd' file:
1594
1595     anonymous::pubcvs
1596     fish:rKa5jzULzmhOo:kfogel
1597     sussman:1sOp854gDF3DY
1598
1599When the password field is omitted or empty, then the client's
1600authentication attempt will succeed with any password, including the
1601empty string.  However, the colon after the CVS username is always
1602necessary, even if the password is empty.
1603
1604   CVS can also fall back to use system authentication.  When
1605authenticating a password, the server first checks for the user in the
1606`$CVSROOT/CVSROOT/passwd' file.  If it finds the user, it will use that
1607entry for authentication as described above.  But if it does not find
1608the user, or if the CVS `passwd' file does not exist, then the server
1609can try to authenticate the username and password using the operating
1610system's user-lookup routines (this "fallback" behavior can be disabled
1611by setting `SystemAuth=no' in the CVS `config' file, *note config::).
1612
1613   The default fallback behaviour is to look in `/etc/passwd' for this
1614system password unless your system has PAM (Pluggable Authentication
1615Modules) and your CVS server executable was configured to use it at
1616compile time (using `./configure --enable-pam' - see the INSTALL file
1617for more).  In this case, PAM will be consulted instead.  This means
1618that CVS can be configured to use any password authentication source PAM
1619can be configured to use (possibilities include a simple UNIX password,
1620NIS, LDAP, and others) in its global configuration file (usually
1621`/etc/pam.conf' or possibly `/etc/pam.d/cvs').  See your PAM
1622documentation for more details on PAM configuration.
1623
1624   Note that PAM is an experimental feature in CVS and feedback is
1625encouraged.  Please send a mail to one of the CVS mailing lists
1626(`info-cvs@gnu.org' or `bug-cvs@gnu.org') if you use the CVS PAM
1627support.
1628
1629   *WARNING: Using PAM gives the system administrator much more
1630flexibility about how CVS users are authenticated but no more security
1631than other methods.  See below for more.*
1632
1633   CVS needs an "auth" and "account" module in the PAM configuration
1634file. A typical PAM configuration would therefore have the following
1635lines in `/etc/pam.conf' to emulate the standard CVS system
1636`/etc/passwd' authentication:
1637
1638     cvs	auth	    required	pam_unix.so
1639     cvs	account	    required	pam_unix.so
1640
1641   The the equivalent `/etc/pam.d/cvs' would contain
1642
1643     auth	    required	pam_unix.so
1644     account	    required	pam_unix.so
1645
1646   Some systems require a full path to the module so that `pam_unix.so'
1647(Linux) would become something like
1648`/usr/lib/security/$ISA/pam_unix.so.1' (Sun Solaris).  See the
1649`contrib/pam' subdirectory of the CVS source distribution for further
1650example configurations.
1651
1652   The PAM service name given above as "cvs" is just the service name in
1653the default configuration amd can be set using `./configure
1654--with-hardcoded-pam-service-name=<pam-service-name>' before compiling.
1655CVS can also be configured to use whatever name it is invoked as as its
1656PAM service name using `./configure
1657--without-hardcoded-pam-service-name', but this feature should not be
1658used if you may not have control of the name CVS will be invoked as.
1659
1660   Be aware, also, that falling back to system authentication might be a
1661security risk: CVS operations would then be authenticated with that
1662user's regular login password, and the password flies across the network
1663in plaintext.  See *note Password authentication security:: for more on
1664this.  This may be more of a problem with PAM authentication because it
1665is likely that the source of the system password is some central
1666authentication service like LDAP which is also used to authenticate
1667other services.
1668
1669   On the other hand, PAM makes it very easy to change your password
1670regularly.  If they are given the option of a one-password system for
1671all of their activities, users are often more willing to change their
1672password on a regular basis.
1673
1674   In the non-PAM configuration where the password is stored in the
1675`CVSROOT/passwd' file, it is difficult to change passwords on a regular
1676basis since only administrative users (or in some cases processes that
1677act as an administrative user) are typicaly given access to modify this
1678file.  Either there needs to be some hand-crafted web page or set-uid
1679program to update the file, or the update needs to be done by submitting
1680a request to an administrator to perform the duty by hand.  In the first
1681case, having to remember to update a separate password on a periodic
1682basis can be difficult.  In the second case, the manual nature of the
1683change will typically mean that the password will not be changed unless
1684it is absolutely necessary.
1685
1686   Note that PAM administrators should probably avoid configuring
1687one-time-passwords (OTP) for CVS authentication/authorization.  If OTPs
1688are desired, the administrator may wish to encourage the use of one of
1689the other Client/Server access methods.  See the section on *note Remote
1690repositories:: for a list of other methods.
1691
1692   Right now, the only way to put a password in the CVS `passwd' file is
1693to paste it there from somewhere else.  Someday, there may be a `cvs
1694passwd' command.
1695
1696   Unlike many of the files in `$CVSROOT/CVSROOT', it is normal to edit
1697the `passwd' file in-place, rather than via CVS.  This is because of the
1698possible security risks of having the `passwd' file checked out to
1699people's working copies.  If you do want to include the `passwd' file in
1700checkouts of `$CVSROOT/CVSROOT', see *note checkoutlist::.
1701
1702
1703File: cvs.info,  Node: Password authentication client,  Next: Password authentication security,  Prev: Password authentication server,  Up: Password authenticated
1704
17052.9.3.2 Using the client with password authentication
1706.....................................................
1707
1708To run a CVS command on a remote repository via the
1709password-authenticating server, one specifies the `pserver' protocol,
1710optional username, repository host, an optional port number, and path to
1711the repository.  For example:
1712
1713     cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
1714
1715or
1716
1717     CVSROOT=:pserver:bach@faun.example.org:2401/usr/local/cvsroot
1718     cvs checkout someproj
1719
1720   However, unless you're connecting to a public-access repository
1721(i.e., one where that username doesn't require a password), you'll need
1722to supply a password or "log in" first.  Logging in verifies your
1723password with the repository and stores it in a file.  It's done with
1724the `login' command, which will prompt you interactively for the
1725password if you didn't supply one as part of $CVSROOT:
1726
1727     cvs -d :pserver:bach@faun.example.org:/usr/local/cvsroot login
1728     CVS password:
1729
1730or
1731
1732     cvs -d :pserver:bach:p4ss30rd@faun.example.org:/usr/local/cvsroot login
1733
1734   After you enter the password, CVS verifies it with the server.  If
1735the verification succeeds, then that combination of username, host,
1736repository, and password is permanently recorded, so future transactions
1737with that repository won't require you to run `cvs login'.  (If
1738verification fails, CVS will exit complaining that the password was
1739incorrect, and nothing will be recorded.)
1740
1741   The records are stored, by default, in the file `$HOME/.cvspass'.
1742That file's format is human-readable, and to a degree human-editable,
1743but note that the passwords are not stored in cleartext--they are
1744trivially encoded to protect them from "innocent" compromise (i.e.,
1745inadvertent viewing by a system administrator or other non-malicious
1746person).
1747
1748   You can change the default location of this file by setting the
1749`CVS_PASSFILE' environment variable.  If you use this variable, make
1750sure you set it _before_ `cvs login' is run.  If you were to set it
1751after running `cvs login', then later CVS commands would be unable to
1752look up the password for transmission to the server.
1753
1754   Once you have logged in, all CVS commands using that remote
1755repository and username will authenticate with the stored password.  So,
1756for example
1757
1758     cvs -d :pserver:bach@faun.example.org:/usr/local/cvsroot checkout foo
1759
1760should just work (unless the password changes on the server side, in
1761which case you'll have to re-run `cvs login').
1762
1763   Note that if the `:pserver:' were not present in the repository
1764specification, CVS would assume it should use `rsh' to connect with the
1765server instead (*note Connecting via rsh::).
1766
1767   Of course, once you have a working copy checked out and are running
1768CVS commands from within it, there is no longer any need to specify the
1769repository explicitly, because CVS can deduce the repository from the
1770working copy's `CVS' subdirectory.
1771
1772   The password for a given remote repository can be removed from the
1773`CVS_PASSFILE' by using the `cvs logout' command.
1774
1775
1776File: cvs.info,  Node: Password authentication security,  Prev: Password authentication client,  Up: Password authenticated
1777
17782.9.3.3 Security considerations with password authentication
1779............................................................
1780
1781The passwords are stored on the client side in a trivial encoding of the
1782cleartext, and transmitted in the same encoding.  The encoding is done
1783only to prevent inadvertent password compromises (i.e., a system
1784administrator accidentally looking at the file), and will not prevent
1785even a naive attacker from gaining the password.
1786
1787   The separate CVS password file (*note Password authentication
1788server::) allows people to use a different password for repository
1789access than for login access.  On the other hand, once a user has
1790non-read-only access to the repository, she can execute programs on the
1791server system through a variety of means.  Thus, repository access
1792implies fairly broad system access as well.  It might be possible to
1793modify CVS to prevent that, but no one has done so as of this writing.
1794
1795   Note that because the `$CVSROOT/CVSROOT' directory contains `passwd'
1796and other files which are used to check security, you must control the
1797permissions on this directory as tightly as the permissions on `/etc'.
1798The same applies to the `$CVSROOT' directory itself and any directory
1799above it in the tree.  Anyone who has write access to such a directory
1800will have the ability to become any user on the system.  Note that these
1801permissions are typically tighter than you would use if you are not
1802using pserver.
1803
1804   In summary, anyone who gets the password gets repository access
1805(which may imply some measure of general system access as well).  The
1806password is available to anyone who can sniff network packets or read a
1807protected (i.e., user read-only) file.  If you want real security, get
1808Kerberos.
1809
1810
1811File: cvs.info,  Node: GSSAPI authenticated,  Next: Kerberos authenticated,  Prev: Password authenticated,  Up: Remote repositories
1812
18132.9.4 Direct connection with GSSAPI
1814-----------------------------------
1815
1816GSSAPI is a generic interface to network security systems such as
1817Kerberos 5.  If you have a working GSSAPI library, you can have CVS
1818connect via a direct TCP connection, authenticating with GSSAPI.
1819
1820   To do this, CVS needs to be compiled with GSSAPI support; when
1821configuring CVS it tries to detect whether GSSAPI libraries using
1822kerberos version 5 are present.  You can also use the `--with-gssapi'
1823flag to configure.
1824
1825   The connection is authenticated using GSSAPI, but the message stream
1826is _not_ authenticated by default.  You must use the `-a' global option
1827to request stream authentication.
1828
1829   The data transmitted is _not_ encrypted by default.  Encryption
1830support must be compiled into both the client and the server; use the
1831`--enable-encrypt' configure option to turn it on.  You must then use
1832the `-x' global option to request encryption.
1833
1834   GSSAPI connections are handled on the server side by the same server
1835which handles the password authentication server; see *note Password
1836authentication server::.  If you are using a GSSAPI mechanism such as
1837Kerberos which provides for strong authentication, you will probably
1838want to disable the ability to authenticate via cleartext passwords.  To
1839do so, create an empty `CVSROOT/passwd' password file, and set
1840`SystemAuth=no' in the config file (*note config::).
1841
1842   The GSSAPI server uses a principal name of cvs/HOSTNAME, where
1843HOSTNAME is the canonical name of the server host.  You will have to set
1844this up as required by your GSSAPI mechanism.
1845
1846   To connect using GSSAPI, use `:gserver:'.  For example,
1847
1848     cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
1849
1850
1851File: cvs.info,  Node: Kerberos authenticated,  Next: Connecting via fork,  Prev: GSSAPI authenticated,  Up: Remote repositories
1852
18532.9.5 Direct connection with kerberos
1854-------------------------------------
1855
1856The easiest way to use kerberos is to use the kerberos `rsh', as
1857described in *note Connecting via rsh::.  The main disadvantage of using
1858rsh is that all the data needs to pass through additional programs, so
1859it may be slower.  So if you have kerberos installed you can connect via
1860a direct TCP connection, authenticating with kerberos.
1861
1862   This section concerns the kerberos network security system, version
18634.  Kerberos version 5 is supported via the GSSAPI generic network
1864security interface, as described in the previous section.
1865
1866   To do this, CVS needs to be compiled with kerberos support; when
1867configuring CVS it tries to detect whether kerberos is present or you
1868can use the `--with-krb4' flag to configure.
1869
1870   The data transmitted is _not_ encrypted by default.  Encryption
1871support must be compiled into both the client and server; use the
1872`--enable-encryption' configure option to turn it on.  You must then use
1873the `-x' global option to request encryption.
1874
1875   You need to edit `inetd.conf' on the server machine to run `cvs
1876kserver'.  The client uses port 1999 by default; if you want to use
1877another port specify it in the `CVSROOT' (*note Remote repositories::)
1878or the `CVS_CLIENT_PORT' environment variable (*note Environment
1879variables::) on the client.
1880
1881   When you want to use CVS, get a ticket in the usual way (generally
1882`kinit'); it must be a ticket which allows you to log into the server
1883machine.  Then you are ready to go:
1884
1885     cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
1886
1887   Previous versions of CVS would fall back to a connection via rsh;
1888this version will not do so.
1889
1890
1891File: cvs.info,  Node: Connecting via fork,  Prev: Kerberos authenticated,  Up: Remote repositories
1892
18932.9.6 Connecting with fork
1894--------------------------
1895
1896This access method allows you to connect to a repository on your local
1897disk via the remote protocol.  In other words it does pretty much the
1898same thing as `:local:', but various quirks, bugs and the like are those
1899of the remote CVS rather than the local CVS.
1900
1901   For day-to-day operations you might prefer either `:local:' or
1902`:fork:', depending on your preferences.  Of course `:fork:' comes in
1903particularly handy in testing or debugging `cvs' and the remote
1904protocol.  Specifically, we avoid all of the network-related
1905setup/configuration, timeouts, and authentication inherent in the other
1906remote access methods but still create a connection which uses the
1907remote protocol.
1908
1909   To connect using the `fork' method, use `:fork:' and the pathname to
1910your local repository.  For example:
1911
1912     cvs -d :fork:/usr/local/cvsroot checkout foo
1913
1914   As with `:ext:', the server is called `cvs' by default, or the value
1915of the `CVS_SERVER' environment variable.
1916
1917
1918File: cvs.info,  Node: Read-only access,  Next: Server temporary directory,  Prev: Remote repositories,  Up: Repository
1919
19202.10 Read-only repository access
1921================================
1922
1923It is possible to grant read-only repository access to people using the
1924password-authenticated server (*note Password authenticated::).  (The
1925other access methods do not have explicit support for read-only users
1926because those methods all assume login access to the repository machine
1927anyway, and therefore the user can do whatever local file permissions
1928allow her to do.)
1929
1930   A user who has read-only access can do only those CVS operations
1931which do not modify the repository, except for certain "administrative"
1932files (such as lock files and the history file).  It may be desirable to
1933use this feature in conjunction with user-aliasing (*note Password
1934authentication server::).
1935
1936   Unlike with previous versions of CVS, read-only users should be able
1937merely to read the repository, and not to execute programs on the server
1938or otherwise gain unexpected levels of access.  Or to be more accurate,
1939the _known_ holes have been plugged.  Because this feature is new and
1940has not received a comprehensive security audit, you should use whatever
1941level of caution seems warranted given your attitude concerning
1942security.
1943
1944   There are two ways to specify read-only access for a user: by
1945inclusion, and by exclusion.
1946
1947   "Inclusion" means listing that user specifically in the
1948`$CVSROOT/CVSROOT/readers' file, which is simply a newline-separated
1949list of users.  Here is a sample `readers' file:
1950
1951     melissa
1952     splotnik
1953     jrandom
1954
1955(Don't forget the newline after the last user.)
1956
1957   "Exclusion" means explicitly listing everyone who has _write_
1958access--if the file
1959
1960     $CVSROOT/CVSROOT/writers
1961
1962exists, then only those users listed in it have write access, and
1963everyone else has read-only access (of course, even the read-only users
1964still need to be listed in the CVS `passwd' file).  The `writers' file
1965has the same format as the `readers' file.
1966
1967   Note: if your CVS `passwd' file maps cvs users onto system users
1968(*note Password authentication server::), make sure you deny or grant
1969read-only access using the _cvs_ usernames, not the system usernames.
1970That is, the `readers' and `writers' files contain cvs usernames, which
1971may or may not be the same as system usernames.
1972
1973   Here is a complete description of the server's behavior in deciding
1974whether to grant read-only or read-write access:
1975
1976   If `readers' exists, and this user is listed in it, then she gets
1977read-only access.  Or if `writers' exists, and this user is NOT listed
1978in it, then she also gets read-only access (this is true even if
1979`readers' exists but she is not listed there).  Otherwise, she gets full
1980read-write access.
1981
1982   Of course there is a conflict if the user is listed in both files.
1983This is resolved in the more conservative way, it being better to
1984protect the repository too much than too little: such a user gets
1985read-only access.
1986
1987
1988File: cvs.info,  Node: Server temporary directory,  Prev: Read-only access,  Up: Repository
1989
19902.11 Temporary directories for the server
1991=========================================
1992
1993While running, the CVS server creates temporary directories.  They are
1994named
1995
1996     cvs-servPID
1997
1998where PID is the process identification number of the server.  They are
1999located in the directory specified by the `-T' global option (*note
2000Global options::), the `TMPDIR' environment variable (*note Environment
2001variables::), or, failing that, `/tmp'.
2002
2003   In most cases the server will remove the temporary directory when it
2004is done, whether it finishes normally or abnormally.  However, there are
2005a few cases in which the server does not or cannot remove the temporary
2006directory, for example:
2007
2008   * If the server aborts due to an internal server error, it may
2009     preserve the directory to aid in debugging
2010
2011   * If the server is killed in a way that it has no way of cleaning up
2012     (most notably, `kill -KILL' on unix).
2013
2014   * If the system shuts down without an orderly shutdown, which tells
2015     the server to clean up.
2016
2017   In cases such as this, you will need to manually remove the
2018`cvs-servPID' directories.  As long as there is no server running with
2019process identification number PID, it is safe to do so.
2020
2021
2022File: cvs.info,  Node: Starting a new project,  Next: Revisions,  Prev: Repository,  Up: Top
2023
20243 Starting a project with CVS
2025*****************************
2026
2027Because renaming files and moving them between directories is somewhat
2028inconvenient, the first thing you do when you start a new project should
2029be to think through your file organization.  It is not impossible to
2030rename or move files, but it does increase the potential for confusion
2031and CVS does have some quirks particularly in the area of renaming
2032directories.  *Note Moving files::.
2033
2034   What to do next depends on the situation at hand.
2035
2036* Menu:
2037
2038* Setting up the files::        Getting the files into the repository
2039* Defining the module::         How to make a module of the files
2040
2041
2042File: cvs.info,  Node: Setting up the files,  Next: Defining the module,  Up: Starting a new project
2043
20443.1 Setting up the files
2045========================
2046
2047The first step is to create the files inside the repository.  This can
2048be done in a couple of different ways.
2049
2050* Menu:
2051
2052* From files::                  This method is useful with old projects
2053                                where files already exists.
2054* From other version control systems::  Old projects where you want to
2055                                        preserve history from another system.
2056* From scratch::                Creating a directory tree from scratch.
2057
2058
2059File: cvs.info,  Node: From files,  Next: From other version control systems,  Up: Setting up the files
2060
20613.1.1 Creating a directory tree from a number of files
2062------------------------------------------------------
2063
2064When you begin using CVS, you will probably already have several
2065projects that can be put under CVS control.  In these cases the easiest
2066way is to use the `import' command.  An example is probably the easiest
2067way to explain how to use it.  If the files you want to install in CVS
2068reside in `WDIR', and you want them to appear in the repository as
2069`$CVSROOT/yoyodyne/RDIR', you can do this:
2070
2071     $ cd WDIR
2072     $ cvs import -m "Imported sources" yoyodyne/RDIR yoyo start
2073
2074   Unless you supply a log message with the `-m' flag, CVS starts an
2075editor and prompts for a message.  The string `yoyo' is a "vendor tag",
2076and `start' is a "release tag".  They may fill no purpose in this
2077context, but since CVS requires them they must be present.  *Note
2078Tracking sources::, for more information about them.
2079
2080   You can now verify that it worked, and remove your original source
2081directory.
2082
2083     $ cd ..
2084     $ cvs checkout yoyodyne/RDIR       # Explanation below
2085     $ diff -r WDIR yoyodyne/RDIR
2086     $ rm -r WDIR
2087
2088Erasing the original sources is a good idea, to make sure that you do
2089not accidentally edit them in WDIR, bypassing CVS.  Of course, it would
2090be wise to make sure that you have a backup of the sources before you
2091remove them.
2092
2093   The `checkout' command can either take a module name as argument (as
2094it has done in all previous examples) or a path name relative to
2095`$CVSROOT', as it did in the example above.
2096
2097   It is a good idea to check that the permissions CVS sets on the
2098directories inside `$CVSROOT' are reasonable, and that they belong to
2099the proper groups.  *Note File permissions::.
2100
2101   If some of the files you want to import are binary, you may want to
2102use the wrappers features to specify which files are binary and which
2103are not.  *Note Wrappers::.
2104
2105
2106File: cvs.info,  Node: From other version control systems,  Next: From scratch,  Prev: From files,  Up: Setting up the files
2107
21083.1.2 Creating Files From Other Version Control Systems
2109-------------------------------------------------------
2110
2111If you have a project which you are maintaining with another version
2112control system, such as RCS, you may wish to put the files from that
2113project into CVS, and preserve the revision history of the files.
2114
2115From RCS
2116     If you have been using RCS, find the RCS files--usually a file
2117     named `foo.c' will have its RCS file in `RCS/foo.c,v' (but it could
2118     be other places; consult the RCS documentation for details).  Then
2119     create the appropriate directories in CVS if they do not already
2120     exist.  Then copy the files into the appropriate directories in the
2121     CVS repository (the name in the repository must be the name of the
2122     source file with `,v' added; the files go directly in the
2123     appropriate directory of the repository, not in an `RCS'
2124     subdirectory).  This is one of the few times when it is a good idea
2125     to access the CVS repository directly, rather than using CVS
2126     commands.  Then you are ready to check out a new working directory.
2127
2128     The RCS file should not be locked when you move it into CVS; if it
2129     is, CVS will have trouble letting you operate on it.
2130
2131From another version control system
2132     Many version control systems have the ability to export RCS files
2133     in the standard format.  If yours does, export the RCS files and
2134     then follow the above instructions.
2135
2136     Failing that, probably your best bet is to write a script that will
2137     check out the files one revision at a time using the command line
2138     interface to the other system, and then check the revisions into
2139     CVS.  The `sccs2rcs' script mentioned below may be a useful example
2140     to follow.
2141
2142From SCCS
2143     There is a script in the `contrib' directory of the CVS source
2144     distribution called `sccs2rcs' which converts SCCS files to RCS
2145     files.  Note: you must run it on a machine which has both SCCS and
2146     RCS installed, and like everything else in contrib it is
2147     unsupported (your mileage may vary).
2148
2149From PVCS
2150     There is a script in the `contrib' directory of the CVS source
2151     distribution called `pvcs_to_rcs' which converts PVCS archives to
2152     RCS files.  You must run it on a machine which has both PVCS and
2153     RCS installed, and like everything else in contrib it is
2154     unsupported (your mileage may vary).  See the comments in the
2155     script for details.
2156
2157
2158File: cvs.info,  Node: From scratch,  Prev: From other version control systems,  Up: Setting up the files
2159
21603.1.3 Creating a directory tree from scratch
2161--------------------------------------------
2162
2163For a new project, the easiest thing to do is probably to create an
2164empty directory structure, like this:
2165
2166     $ mkdir tc
2167     $ mkdir tc/man
2168     $ mkdir tc/testing
2169
2170   After that, you use the `import' command to create the corresponding
2171(empty) directory structure inside the repository:
2172
2173     $ cd tc
2174     $ cvs import -m "Created directory structure" yoyodyne/DIR yoyo start
2175
2176   Then, use `add' to add files (and new directories) as they appear.
2177
2178   Check that the permissions CVS sets on the directories inside
2179`$CVSROOT' are reasonable.
2180
2181
2182File: cvs.info,  Node: Defining the module,  Prev: Setting up the files,  Up: Starting a new project
2183
21843.2 Defining the module
2185=======================
2186
2187The next step is to define the module in the `modules' file.  This is
2188not strictly necessary, but modules can be convenient in grouping
2189together related files and directories.
2190
2191   In simple cases these steps are sufficient to define a module.
2192
2193  1. Get a working copy of the modules file.
2194
2195          $ cvs checkout CVSROOT/modules
2196          $ cd CVSROOT
2197
2198  2. Edit the file and insert a line that defines the module.  *Note
2199     Intro administrative files::, for an introduction.  *Note
2200     modules::, for a full description of the modules file.  You can use
2201     the following line to define the module `tc':
2202
2203          tc   yoyodyne/tc
2204
2205  3. Commit your changes to the modules file.
2206
2207          $ cvs commit -m "Added the tc module." modules
2208
2209  4. Release the modules module.
2210
2211          $ cd ..
2212          $ cvs release -d CVSROOT
2213
2214
2215File: cvs.info,  Node: Revisions,  Next: Branching and merging,  Prev: Starting a new project,  Up: Top
2216
22174 Revisions
2218***********
2219
2220For many uses of CVS, one doesn't need to worry too much about revision
2221numbers; CVS assigns numbers such as `1.1', `1.2', and so on, and that
2222is all one needs to know.  However, some people prefer to have more
2223knowledge and control concerning how CVS assigns revision numbers.
2224
2225   If one wants to keep track of a set of revisions involving more than
2226one file, such as which revisions went into a particular release, one
2227uses a "tag", which is a symbolic revision which can be assigned to a
2228numeric revision in each file.
2229
2230* Menu:
2231
2232* Revision numbers::            The meaning of a revision number
2233* Versions revisions releases::  Terminology used in this manual
2234* Assigning revisions::         Assigning revisions
2235* Tags::                        Tags--Symbolic revisions
2236* Tagging the working directory::  The cvs tag command
2237* Tagging by date/tag::         The cvs rtag command
2238* Modifying tags::              Adding, renaming, and deleting tags
2239* Tagging add/remove::          Tags with adding and removing files
2240* Sticky tags::                 Certain tags are persistent
2241
2242
2243File: cvs.info,  Node: Revision numbers,  Next: Versions revisions releases,  Up: Revisions
2244
22454.1 Revision numbers
2246====================
2247
2248Each version of a file has a unique "revision number".  Revision numbers
2249look like `1.1', `1.2', `1.3.2.2' or even `1.3.2.2.4.5'.  A revision
2250number always has an even number of period-separated decimal integers.
2251By default revision 1.1 is the first revision of a file.  Each
2252successive revision is given a new number by increasing the rightmost
2253number by one.  The following figure displays a few revisions, with
2254newer revisions to the right.
2255
2256            +-----+    +-----+    +-----+    +-----+    +-----+
2257            ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
2258            +-----+    +-----+    +-----+    +-----+    +-----+
2259
2260   It is also possible to end up with numbers containing more than one
2261period, for example `1.3.2.2'.  Such revisions represent revisions on
2262branches (*note Branching and merging::); such revision numbers are
2263explained in detail in *note Branches and revisions::.
2264
2265
2266File: cvs.info,  Node: Versions revisions releases,  Next: Assigning revisions,  Prev: Revision numbers,  Up: Revisions
2267
22684.2 Versions, revisions and releases
2269====================================
2270
2271A file can have several versions, as described above.  Likewise, a
2272software product can have several versions.  A software product is often
2273given a version number such as `4.1.1'.
2274
2275   Versions in the first sense are called "revisions" in this document,
2276and versions in the second sense are called "releases".  To avoid
2277confusion, the word "version" is almost never used in this document.
2278
2279
2280File: cvs.info,  Node: Assigning revisions,  Next: Tags,  Prev: Versions revisions releases,  Up: Revisions
2281
22824.3 Assigning revisions
2283=======================
2284
2285By default, CVS will assign numeric revisions by leaving the first
2286number the same and incrementing the second number.  For example, `1.1',
2287`1.2', `1.3', etc.
2288
2289   When adding a new file, the second number will always be one and the
2290first number will equal the highest first number of any file in that
2291directory.  For example, the current directory contains files whose
2292highest numbered revisions are `1.7', `3.1', and `4.12', then an added
2293file will be given the numeric revision `4.1'.
2294
2295   Normally there is no reason to care about the revision numbers--it is
2296easier to treat them as internal numbers that CVS maintains, and tags
2297provide a better way to distinguish between things like release 1 versus
2298release 2 of your product (*note Tags::).  However, if you want to set
2299the numeric revisions, the `-r' option to `cvs commit' can do that.  The
2300`-r' option implies the `-f' option, in the sense that it causes the
2301files to be committed even if they are not modified.
2302
2303   For example, to bring all your files up to revision 3.0 (including
2304those that haven't changed), you might invoke:
2305
2306     $ cvs commit -r 3.0
2307
2308   Note that the number you specify with `-r' must be larger than any
2309existing revision number.  That is, if revision 3.0 exists, you cannot
2310`cvs commit -r 1.3'.  If you want to maintain several releases in
2311parallel, you need to use a branch (*note Branching and merging::).
2312
2313
2314File: cvs.info,  Node: Tags,  Next: Tagging the working directory,  Prev: Assigning revisions,  Up: Revisions
2315
23164.4 Tags-Symbolic revisions
2317===========================
2318
2319The revision numbers live a life of their own.  They need not have
2320anything at all to do with the release numbers of your software product.
2321Depending on how you use CVS the revision numbers might change several
2322times between two releases.  As an example, some of the source files
2323that make up RCS 5.6 have the following revision numbers:
2324
2325     ci.c            5.21
2326     co.c            5.9
2327     ident.c         5.3
2328     rcs.c           5.12
2329     rcsbase.h       5.11
2330     rcsdiff.c       5.10
2331     rcsedit.c       5.11
2332     rcsfcmp.c       5.9
2333     rcsgen.c        5.10
2334     rcslex.c        5.11
2335     rcsmap.c        5.2
2336     rcsutil.c       5.10
2337
2338   You can use the `tag' command to give a symbolic name to a certain
2339revision of a file.  You can use the `-v' flag to the `status' command
2340to see all tags that a file has, and which revision numbers they
2341represent.  Tag names must start with an uppercase or lowercase letter
2342and can contain uppercase and lowercase letters, digits, `-', and `_'.
2343The two tag names `BASE' and `HEAD' are reserved for use by CVS.  It is
2344expected that future names which are special to CVS will be specially
2345named, for example by starting with `.', rather than being named
2346analogously to `BASE' and `HEAD', to avoid conflicts with actual tag
2347names.
2348
2349   You'll want to choose some convention for naming tags, based on
2350information such as the name of the program and the version number of
2351the release.  For example, one might take the name of the program,
2352immediately followed by the version number with `.' changed to `-', so
2353that CVS 1.9 would be tagged with the name `cvs1-9'.  If you choose a
2354consistent convention, then you won't constantly be guessing whether a
2355tag is `cvs-1-9' or `cvs1_9' or what.  You might even want to consider
2356enforcing your convention in the taginfo file (*note user-defined
2357logging::).
2358
2359   The following example shows how you can add a tag to a file.  The
2360commands must be issued inside your working directory.  That is, you
2361should issue the command in the directory where `backend.c' resides.
2362
2363     $ cvs tag rel-0-4 backend.c
2364     T backend.c
2365     $ cvs status -v backend.c
2366     ===================================================================
2367     File: backend.c         Status: Up-to-date
2368
2369         Version:            1.4     Tue Dec  1 14:39:01 1992
2370         RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
2371         Sticky Tag:         (none)
2372         Sticky Date:        (none)
2373         Sticky Options:     (none)
2374
2375         Existing Tags:
2376             rel-0-4                     (revision: 1.4)
2377
2378   For a complete summary of the syntax of `cvs tag', including the
2379various options, see *note Invoking CVS::.
2380
2381   There is seldom reason to tag a file in isolation.  A more common use
2382is to tag all the files that constitute a module with the same tag at
2383strategic points in the development life-cycle, such as when a release
2384is made.
2385
2386     $ cvs tag rel-1-0 .
2387     cvs tag: Tagging .
2388     T Makefile
2389     T backend.c
2390     T driver.c
2391     T frontend.c
2392     T parser.c
2393
2394(When you give CVS a directory as argument, it generally applies the
2395operation to all the files in that directory, and (recursively), to any
2396subdirectories that it may contain.  *Note Recursive behavior::.)
2397
2398   The `checkout' command has a flag, `-r', that lets you check out a
2399certain revision of a module.  This flag makes it easy to retrieve the
2400sources that make up release 1.0 of the module `tc' at any time in the
2401future:
2402
2403     $ cvs checkout -r rel-1-0 tc
2404
2405This is useful, for instance, if someone claims that there is a bug in
2406that release, but you cannot find the bug in the current working copy.
2407
2408   You can also check out a module as it was at any given date.  *Note
2409checkout options::.  When specifying `-r' to any of these commands, you
2410will need beware of sticky tags; see *note Sticky tags::.
2411
2412   When you tag more than one file with the same tag you can think about
2413the tag as "a curve drawn through a matrix of filename vs. revision
2414number."  Say we have 5 files with the following revisions:
2415
2416             file1   file2   file3   file4   file5
2417
2418             1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
2419             1.2*-   1.2     1.2    -1.2*-
2420             1.3  \- 1.3*-   1.3   / 1.3
2421             1.4          \  1.4  /  1.4
2422                           \-1.5*-   1.5
2423                             1.6
2424
2425   At some time in the past, the `*' versions were tagged.  You can
2426think of the tag as a handle attached to the curve drawn through the
2427tagged revisions.  When you pull on the handle, you get all the tagged
2428revisions.  Another way to look at it is that you "sight" through a set
2429of revisions that is "flat" along the tagged revisions, like this:
2430
2431             file1   file2   file3   file4   file5
2432
2433                             1.1
2434                             1.2
2435                     1.1     1.3                       _
2436             1.1     1.2     1.4     1.1              /
2437             1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
2438             1.3             1.6     1.3              \_
2439             1.4                     1.4
2440                                     1.5
2441
2442
2443File: cvs.info,  Node: Tagging the working directory,  Next: Tagging by date/tag,  Prev: Tags,  Up: Revisions
2444
24454.5 Specifying what to tag from the working directory
2446=====================================================
2447
2448The example in the previous section demonstrates one of the most common
2449ways to choose which revisions to tag.  Namely, running the `cvs tag'
2450command without arguments causes CVS to select the revisions which are
2451checked out in the current working directory.  For example, if the copy
2452of `backend.c' in working directory was checked out from revision 1.4,
2453then CVS will tag revision 1.4.  Note that the tag is applied
2454immediately to revision 1.4 in the repository; tagging is not like
2455modifying a file, or other operations in which one first modifies the
2456working directory and then runs `cvs commit' to transfer that
2457modification to the repository.
2458
2459   One potentially surprising aspect of the fact that `cvs tag' operates
2460on the repository is that you are tagging the checked-in revisions,
2461which may differ from locally modified files in your working directory.
2462If you want to avoid doing this by mistake, specify the `-c' option to
2463`cvs tag'.  If there are any locally modified files, CVS will abort with
2464an error before it tags any files:
2465
2466     $ cvs tag -c rel-0-4
2467     cvs tag: backend.c is locally modified
2468     cvs [tag aborted]: correct the above errors first!
2469
2470
2471File: cvs.info,  Node: Tagging by date/tag,  Next: Modifying tags,  Prev: Tagging the working directory,  Up: Revisions
2472
24734.6 Specifying what to tag by date or revision
2474==============================================
2475
2476The `cvs rtag' command tags the repository as of a certain date or time
2477(or can be used to tag the latest revision).  `rtag' works directly on
2478the repository contents (it requires no prior checkout and does not look
2479for a working directory).
2480
2481   The following options specify which date or revision to tag.  See
2482*note Common options::, for a complete description of them.
2483
2484`-D DATE'
2485     Tag the most recent revision no later than DATE.
2486
2487`-f'
2488     Only useful with the `-D DATE' or `-r TAG' flags.  If no matching
2489     revision is found, use the most recent revision (instead of
2490     ignoring the file).
2491
2492`-r TAG'
2493     Only tag those files that contain existing tag TAG.
2494
2495   The `cvs tag' command also allows one to specify files by revision or
2496date, using the same `-r', `-D', and `-f' options.  However, this
2497feature is probably not what you want.  The reason is that `cvs tag'
2498chooses which files to tag based on the files that exist in the working
2499directory, rather than the files which existed as of the given tag/date.
2500Therefore, you are generally better off using `cvs rtag'.  The
2501exceptions might be cases like:
2502
2503     cvs tag -r 1.4 stable backend.c
2504
2505
2506File: cvs.info,  Node: Modifying tags,  Next: Tagging add/remove,  Prev: Tagging by date/tag,  Up: Revisions
2507
25084.7 Deleting, moving, and renaming tags
2509=======================================
2510
2511Normally one does not modify tags.  They exist in order to record the
2512history of the repository and so deleting them or changing their meaning
2513would, generally, not be what you want.
2514
2515   However, there might be cases in which one uses a tag temporarily or
2516accidentally puts one in the wrong place.  Therefore, one might delete,
2517move, or rename a tag.
2518
2519*WARNING: the commands in this section are dangerous; they permanently
2520discard historical information and it can be difficult or impossible to
2521recover from errors.  If you are a CVS administrator, you may consider
2522restricting these commands with taginfo (*note user-defined logging::).*
2523
2524   To delete a tag, specify the `-d' option to either `cvs tag' or `cvs
2525rtag'.  For example:
2526
2527     cvs rtag -d rel-0-4 tc
2528
2529deletes the non-branch tag `rel-0-4' from the module `tc'.  In the event
2530that branch tags are encountered within the repository with the given
2531name, a warning message will be issued and the branch tag will not be
2532deleted.  If you are absolutely certain you know what you are doing, the
2533`-B' option may be specified to allow deletion of branch tags.  In that
2534case, any non-branch tags encountered will trigger warnings and will not
2535be deleted.
2536
2537*WARNING: Moving branch tags is very dangerous!  If you think you need
2538the `-B' option, think again and ask your CVS administrator about it (if
2539that isn't you).  There is almost certainly another way to accomplish
2540what you want to accomplish.*
2541
2542   When we say "move" a tag, we mean to make the same name point to
2543different revisions.  For example, the `stable' tag may currently point
2544to revision 1.4 of `backend.c' and perhaps we want to make it point to
2545revision 1.6.  To move a non-branch tag, specify the `-F' option to
2546either `cvs tag' or `cvs rtag'.  For example, the task just mentioned
2547might be accomplished as:
2548
2549     cvs tag -r 1.6 -F stable backend.c
2550
2551If any branch tags are encountered in the repository with the given
2552name, a warning is issued and the branch tag is not disturbed.  If you
2553are absolutely certain you wish to move the branch tag, the `-B' option
2554may be specified.  In that case, non-branch tags encountered with the
2555given name are ignored with a warning message.
2556
2557*WARNING: Moving branch tags is very dangerous!  If you think you need
2558the `-B' option, think again and ask your CVS administrator about it (if
2559that isn't you).  There is almost certainly another way to accomplish
2560what you want to accomplish.*
2561
2562   When we say "rename" a tag, we mean to make a different name point to
2563the same revisions as the old tag.  For example, one may have misspelled
2564the tag name and want to correct it (hopefully before others are relying
2565on the old spelling).  To rename a tag, first create a new tag using the
2566`-r' option to `cvs rtag', and then delete the old name.  (Caution: this
2567method will not work with branch tags.)  This leaves the new tag on
2568exactly the same files as the old tag.  For example:
2569
2570     cvs rtag -r old-name-0-4 rel-0-4 tc
2571     cvs rtag -d old-name-0-4 tc
2572
2573
2574File: cvs.info,  Node: Tagging add/remove,  Next: Sticky tags,  Prev: Modifying tags,  Up: Revisions
2575
25764.8 Tagging and adding and removing files
2577=========================================
2578
2579The subject of exactly how tagging interacts with adding and removing
2580files is somewhat obscure; for the most part CVS will keep track of
2581whether files exist or not without too much fussing.  By default, tags
2582are applied to only files which have a revision corresponding to what is
2583being tagged.  Files which did not exist yet, or which were already
2584removed, simply omit the tag, and CVS knows to treat the absence of a
2585tag as meaning that the file didn't exist as of that tag.
2586
2587   However, this can lose a small amount of information.  For example,
2588suppose a file was added and then removed.  Then, if the tag is missing
2589for that file, there is no way to know whether the tag refers to the
2590time before the file was added, or the time after it was removed.  If
2591you specify the `-r' option to `cvs rtag', then CVS tags the files which
2592have been removed, and thereby avoids this problem.  For example, one
2593might specify `-r HEAD' to tag the head.
2594
2595   On the subject of adding and removing files, the `cvs rtag' command
2596has a `-a' option which means to clear the tag from removed files that
2597would not otherwise be tagged.  For example, one might specify this
2598option in conjunction with `-F' when moving a tag.  If one moved a tag
2599without `-a', then the tag in the removed files might still refer to the
2600old revision, rather than reflecting the fact that the file had been
2601removed.  I don't think this is necessary if `-r' is specified, as noted
2602above.
2603
2604
2605File: cvs.info,  Node: Sticky tags,  Prev: Tagging add/remove,  Up: Revisions
2606
26074.9 Sticky tags
2608===============
2609
2610Sometimes a working copy's revision has extra data associated with it,
2611for example it might be on a branch (*note Branching and merging::), or
2612restricted to versions prior to a certain date by `checkout -D' or
2613`update -D'.  Because this data persists - that is, it applies to
2614subsequent commands in the working copy - we refer to it as "sticky".
2615
2616   Most of the time, stickiness is an obscure aspect of CVS that you
2617don't need to think about.  However, even if you don't want to use the
2618feature, you may need to know _something_ about sticky tags (for
2619example, how to avoid them!).
2620
2621   You can use the `status' command to see if any sticky tags or dates
2622are set:
2623
2624     $ cvs status driver.c
2625     ===================================================================
2626     File: driver.c          Status: Up-to-date
2627
2628         Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
2629         RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
2630         Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
2631         Sticky Date:        (none)
2632         Sticky Options:     (none)
2633
2634   The sticky tags will remain on your working files until you delete
2635them with `cvs update -A'.  The `-A' option merges local changes into
2636the version of the file from the head of the trunk, removing any sticky
2637tags, dates, or options.  See *note update:: for more on the operation
2638of `cvs update'.
2639
2640   The most common use of sticky tags is to identify which branch one is
2641working on, as described in *note Accessing branches::.  However,
2642non-branch sticky tags have uses as well.  For example, suppose that you
2643want to avoid updating your working directory, to isolate yourself from
2644possibly destabilizing changes other people are making.  You can, of
2645course, just refrain from running `cvs update'.  But if you want to
2646avoid updating only a portion of a larger tree, then sticky tags can
2647help.  If you check out a certain revision (such as 1.4) it will become
2648sticky.  Subsequent `cvs update' commands will not retrieve the latest
2649revision until you reset the tag with `cvs update -A'.  Likewise, use of
2650the `-D' option to `update' or `checkout' sets a "sticky date", which,
2651similarly, causes that date to be used for future retrievals.
2652
2653   People often want to retrieve an old version of a file without
2654setting a sticky tag.  This can be done with the `-p' option to
2655`checkout' or `update', which sends the contents of the file to standard
2656output.  For example:
2657     $ cvs update -p -r 1.1 file1 >file1
2658     ===================================================================
2659     Checking out file1
2660     RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
2661     VERS: 1.1
2662     ***************
2663     $
2664
2665   However, this isn't the easiest way, if you are asking how to undo a
2666previous checkin (in this example, put `file1' back to the way it was as
2667of revision 1.1).  In that case you are better off using the `-j' option
2668to `update'; for further discussion see *note Merging two revisions::.
2669
2670
2671File: cvs.info,  Node: Branching and merging,  Next: Recursive behavior,  Prev: Revisions,  Up: Top
2672
26735 Branching and merging
2674***********************
2675
2676CVS allows you to isolate changes onto a separate line of development,
2677known as a "branch".  When you change files on a branch, those changes
2678do not appear on the main trunk or other branches.
2679
2680   Later you can move changes from one branch to another branch (or the
2681main trunk) by "merging".  Merging involves first running `cvs update
2682-j', to merge the changes into the working directory.  You can then
2683commit that revision, and thus effectively copy the changes onto another
2684branch.
2685
2686* Menu:
2687
2688* Branches motivation::         What branches are good for
2689* Creating a branch::           Creating a branch
2690* Accessing branches::          Checking out and updating branches
2691* Branches and revisions::      Branches are reflected in revision numbers
2692* Magic branch numbers::        Magic branch numbers
2693* Merging a branch::            Merging an entire branch
2694* Merging more than once::      Merging from a branch several times
2695* Merging two revisions::       Merging differences between two revisions
2696* Merging adds and removals::   What if files are added or removed?
2697* Merging and keywords::        Avoiding conflicts due to keyword substitution
2698
2699
2700File: cvs.info,  Node: Branches motivation,  Next: Creating a branch,  Up: Branching and merging
2701
27025.1 What branches are good for
2703==============================
2704
2705Suppose that release 1.0 of tc has been made.  You are continuing to
2706develop tc, planning to create release 1.1 in a couple of months.  After
2707a while your customers start to complain about a fatal bug.  You check
2708out release 1.0 (*note Tags::) and find the bug (which turns out to have
2709a trivial fix).  However, the current revision of the sources are in a
2710state of flux and are not expected to be stable for at least another
2711month.  There is no way to make a bugfix release based on the newest
2712sources.
2713
2714   The thing to do in a situation like this is to create a "branch" on
2715the revision trees for all the files that make up release 1.0 of tc.
2716You can then make modifications to the branch without disturbing the
2717main trunk.  When the modifications are finished you can elect to either
2718incorporate them on the main trunk, or leave them on the branch.
2719
2720
2721File: cvs.info,  Node: Creating a branch,  Next: Accessing branches,  Prev: Branches motivation,  Up: Branching and merging
2722
27235.2 Creating a branch
2724=====================
2725
2726You can create a branch with `tag -b'; for example, assuming you're in a
2727working copy:
2728
2729     $ cvs tag -b rel-1-0-patches
2730
2731   This splits off a branch based on the current revisions in the
2732working copy, assigning that branch the name `rel-1-0-patches'.
2733
2734   It is important to understand that branches get created in the
2735repository, not in the working copy.  Creating a branch based on current
2736revisions, as the above example does, will _not_ automatically switch
2737the working copy to be on the new branch.  For information on how to do
2738that, see *note Accessing branches::.
2739
2740   You can also create a branch without reference to any working copy,
2741by using `rtag':
2742
2743     $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
2744
2745   `-r rel-1-0' says that this branch should be rooted at the revision
2746that corresponds to the tag `rel-1-0'.  It need not be the most recent
2747revision - it's often useful to split a branch off an old revision (for
2748example, when fixing a bug in a past release otherwise known to be
2749stable).
2750
2751   As with `tag', the `-b' flag tells `rtag' to create a branch (rather
2752than just a symbolic revision name).  Note that the numeric revision
2753number that matches `rel-1-0' will probably be different from file to
2754file.
2755
2756   So, the full effect of the command is to create a new branch - named
2757`rel-1-0-patches' - in module `tc', rooted in the revision tree at the
2758point tagged by `rel-1-0'.
2759
2760
2761File: cvs.info,  Node: Accessing branches,  Next: Branches and revisions,  Prev: Creating a branch,  Up: Branching and merging
2762
27635.3 Accessing branches
2764======================
2765
2766You can retrieve a branch in one of two ways: by checking it out fresh
2767from the repository, or by switching an existing working copy over to
2768the branch.
2769
2770   To check out a branch from the repository, invoke `checkout' with the
2771`-r' flag, followed by the tag name of the branch (*note Creating a
2772branch::):
2773
2774     $ cvs checkout -r rel-1-0-patches tc
2775
2776   Or, if you already have a working copy, you can switch it to a given
2777branch with `update -r':
2778
2779     $ cvs update -r rel-1-0-patches tc
2780
2781or equivalently:
2782
2783     $ cd tc
2784     $ cvs update -r rel-1-0-patches
2785
2786   It does not matter if the working copy was originally on the main
2787trunk or on some other branch - the above command will switch it to the
2788named branch.  And similarly to a regular `update' command, `update -r'
2789merges any changes you have made, notifying you of conflicts where they
2790occur.
2791
2792   Once you have a working copy tied to a particular branch, it remains
2793there until you tell it otherwise.  This means that changes checked in
2794from the working copy will add new revisions on that branch, while
2795leaving the main trunk and other branches unaffected.
2796
2797   To find out what branch a working copy is on, you can use the
2798`status' command.  In its output, look for the field named `Sticky tag'
2799(*note Sticky tags::) - that's CVS's way of telling you the branch, if
2800any, of the current working files:
2801
2802     $ cvs status -v driver.c backend.c
2803     ===================================================================
2804     File: driver.c          Status: Up-to-date
2805
2806         Version:            1.7     Sat Dec  5 18:25:54 1992
2807         RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
2808         Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
2809         Sticky Date:        (none)
2810         Sticky Options:     (none)
2811
2812         Existing Tags:
2813             rel-1-0-patches             (branch: 1.7.2)
2814             rel-1-0                     (revision: 1.7)
2815
2816     ===================================================================
2817     File: backend.c         Status: Up-to-date
2818
2819         Version:            1.4     Tue Dec  1 14:39:01 1992
2820         RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
2821         Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
2822         Sticky Date:        (none)
2823         Sticky Options:     (none)
2824
2825         Existing Tags:
2826             rel-1-0-patches             (branch: 1.4.2)
2827             rel-1-0                     (revision: 1.4)
2828             rel-0-4                     (revision: 1.4)
2829
2830   Don't be confused by the fact that the branch numbers for each file
2831are different (`1.7.2' and `1.4.2' respectively).  The branch tag is the
2832same, `rel-1-0-patches', and the files are indeed on the same branch.
2833The numbers simply reflect the point in each file's revision history at
2834which the branch was made.  In the above example, one can deduce that
2835`driver.c' had been through more changes than `backend.c' before this
2836branch was created.
2837
2838   See *note Branches and revisions:: for details about how branch
2839numbers are constructed.
2840
2841
2842File: cvs.info,  Node: Branches and revisions,  Next: Magic branch numbers,  Prev: Accessing branches,  Up: Branching and merging
2843
28445.4 Branches and revisions
2845==========================
2846
2847Ordinarily, a file's revision history is a linear series of increments
2848(*note Revision numbers::):
2849
2850            +-----+    +-----+    +-----+    +-----+    +-----+
2851            ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
2852            +-----+    +-----+    +-----+    +-----+    +-----+
2853
2854   However, CVS is not limited to linear development.  The "revision
2855tree" can be split into "branches", where each branch is a
2856self-maintained line of development.  Changes made on one branch can
2857easily be moved back to the main trunk.
2858
2859   Each branch has a "branch number", consisting of an odd number of
2860period-separated decimal integers.  The branch number is created by
2861appending an integer to the revision number where the corresponding
2862branch forked off.  Having branch numbers allows more than one branch to
2863be forked off from a certain revision.
2864
2865   All revisions on a branch have revision numbers formed by appending
2866an ordinal number to the branch number.  The following figure
2867illustrates branching with an example.
2868
2869                                                           +-------------+
2870                                Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
2871                                                         / +-------------+
2872                                                        /
2873                                                       /
2874                      +---------+    +---------+    +---------+
2875     Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
2876                    / +---------+    +---------+    +---------+
2877                   /
2878                  /
2879     +-----+    +-----+    +-----+    +-----+    +-----+
2880     ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
2881     +-----+    +-----+    +-----+    +-----+    +-----+
2882                     !
2883                     !
2884                     !   +---------+    +---------+    +---------+
2885     Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
2886                         +---------+    +---------+    +---------+
2887
2888   The exact details of how the branch number is constructed is not
2889something you normally need to be concerned about, but here is how it
2890works: When CVS creates a branch number it picks the first unused even
2891integer, starting with 2.  So when you want to create a branch from
2892revision 6.4 it will be numbered 6.4.2.  All branch numbers ending in a
2893zero (such as 6.4.0) are used internally by CVS (*note Magic branch
2894numbers::).  The branch 1.1.1 has a special meaning.  *Note Tracking
2895sources::.
2896
2897
2898File: cvs.info,  Node: Magic branch numbers,  Next: Merging a branch,  Prev: Branches and revisions,  Up: Branching and merging
2899
29005.5 Magic branch numbers
2901========================
2902
2903This section describes a CVS feature called "magic branches".  For most
2904purposes, you need not worry about magic branches; CVS handles them for
2905you.  However, they are visible to you in certain circumstances, so it
2906may be useful to have some idea of how it works.
2907
2908   Externally, branch numbers consist of an odd number of dot-separated
2909decimal integers.  *Note Revision numbers::.  That is not the whole
2910truth, however.  For efficiency reasons CVS sometimes inserts an extra 0
2911in the second rightmost position (1.2.4 becomes 1.2.0.4, 8.9.10.11.12
2912becomes 8.9.10.11.0.12 and so on).
2913
2914   CVS does a pretty good job at hiding these so called magic branches,
2915but in a few places the hiding is incomplete:
2916
2917   * The magic branch number appears in the output from `cvs log'.
2918
2919   * You cannot specify a symbolic branch name to `cvs admin'.
2920
2921   You can use the `admin' command to reassign a symbolic name to a
2922branch the way RCS expects it to be.  If `R4patches' is assigned to the
2923branch 1.4.2 (magic branch number 1.4.0.2) in file `numbers.c' you can
2924do this:
2925
2926     $ cvs admin -NR4patches:1.4.2 numbers.c
2927
2928   It only works if at least one revision is already committed on the
2929branch.  Be very careful so that you do not assign the tag to the wrong
2930number.  (There is no way to see how the tag was assigned yesterday).
2931
2932
2933File: cvs.info,  Node: Merging a branch,  Next: Merging more than once,  Prev: Magic branch numbers,  Up: Branching and merging
2934
29355.6 Merging an entire branch
2936============================
2937
2938You can merge changes made on a branch into your working copy by giving
2939the `-j BRANCHNAME' flag to the `update' subcommand.  With one `-j
2940BRANCHNAME' option it merges the changes made between the greatest
2941common ancestor (GCA) of the branch and the destination revision (in the
2942simple case below the GCA is the point where the branch forked) and the
2943newest revision on that branch into your working copy.
2944
2945   The `-j' stands for "join".
2946
2947   Consider this revision tree:
2948
2949     +-----+    +-----+    +-----+    +-----+
2950     ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
2951     +-----+    +-----+    +-----+    +-----+
2952                     !
2953                     !
2954                     !   +---------+    +---------+
2955     Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
2956                         +---------+    +---------+
2957
2958The branch 1.2.2 has been given the tag (symbolic name) `R1fix'.  The
2959following example assumes that the module `mod' contains only one file,
2960`m.c'.
2961
2962     $ cvs checkout mod               # Retrieve the latest revision, 1.4
2963
2964     $ cvs update -j R1fix m.c        # Merge all changes made on the branch,
2965                                      # i.e. the changes between revision 1.2
2966                                      # and 1.2.2.2, into your working copy
2967                                      # of the file.
2968
2969     $ cvs commit -m "Included R1fix" # Create revision 1.5.
2970
2971   A conflict can result from a merge operation.  If that happens, you
2972should resolve it before committing the new revision.  *Note Conflicts
2973example::.
2974
2975   If your source files contain keywords (*note Keyword substitution::),
2976you might be getting more conflicts than strictly necessary.  See *note
2977Merging and keywords::, for information on how to avoid this.
2978
2979   The `checkout' command also supports the `-j BRANCHNAME' flag.  The
2980same effect as above could be achieved with this:
2981
2982     $ cvs checkout -j R1fix mod
2983     $ cvs commit -m "Included R1fix"
2984
2985   It should be noted that `update -j TAGNAME' will also work but may
2986not produce the desired result.  *Note Merging adds and removals::, for
2987more.
2988
2989
2990File: cvs.info,  Node: Merging more than once,  Next: Merging two revisions,  Prev: Merging a branch,  Up: Branching and merging
2991
29925.7 Merging from a branch several times
2993=======================================
2994
2995Continuing our example, the revision tree now looks like this:
2996
2997     +-----+    +-----+    +-----+    +-----+    +-----+
2998     ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
2999     +-----+    +-----+    +-----+    +-----+    +-----+
3000                     !                           *
3001                     !                          *
3002                     !   +---------+    +---------+
3003     Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
3004                         +---------+    +---------+
3005
3006where the starred line represents the merge from the `R1fix' branch to
3007the main trunk, as just discussed.
3008
3009   Now suppose that development continues on the `R1fix' branch:
3010
3011     +-----+    +-----+    +-----+    +-----+    +-----+
3012     ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
3013     +-----+    +-----+    +-----+    +-----+    +-----+
3014                     !                           *
3015                     !                          *
3016                     !   +---------+    +---------+    +---------+
3017     Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
3018                         +---------+    +---------+    +---------+
3019
3020and then you want to merge those new changes onto the main trunk.  If
3021you just use the `cvs update -j R1fix m.c' command again, CVS will
3022attempt to merge again the changes which you have already merged, which
3023can have undesirable side effects.
3024
3025   So instead you need to specify that you only want to merge the
3026changes on the branch which have not yet been merged into the trunk.  To
3027do that you specify two `-j' options, and CVS merges the changes from
3028the first revision to the second revision.  For example, in this case
3029the simplest way would be
3030
3031     cvs update -j 1.2.2.2 -j R1fix m.c    # Merge changes from 1.2.2.2 to the
3032                                           # head of the R1fix branch
3033
3034   The problem with this is that you need to specify the 1.2.2.2
3035revision manually.  A slightly better approach might be to use the date
3036the last merge was done:
3037
3038     cvs update -j R1fix:yesterday -j R1fix m.c
3039
3040   Better yet, tag the R1fix branch after every merge into the trunk,
3041and then use that tag for subsequent merges:
3042
3043     cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
3044
3045
3046File: cvs.info,  Node: Merging two revisions,  Next: Merging adds and removals,  Prev: Merging more than once,  Up: Branching and merging
3047
30485.8 Merging differences between any two revisions
3049=================================================
3050
3051With two `-j REVISION' flags, the `update' (and `checkout') command can
3052merge the differences between any two revisions into your working file.
3053
3054     $ cvs update -j 1.5 -j 1.3 backend.c
3055
3056will undo all changes made between revision 1.3 and 1.5.  Note the order
3057of the revisions!
3058
3059   If you try to use this option when operating on multiple files,
3060remember that the numeric revisions will probably be very different
3061between the various files.  You almost always use symbolic tags rather
3062than revision numbers when operating on multiple files.
3063
3064   Specifying two `-j' options can also undo file removals or additions.
3065For example, suppose you have a file named `file1' which existed as
3066revision 1.1, and you then removed it (thus adding a dead revision 1.2).
3067Now suppose you want to add it again, with the same contents it had
3068previously.  Here is how to do it:
3069
3070     $ cvs update -j 1.2 -j 1.1 file1
3071     U file1
3072     $ cvs commit -m test
3073     Checking in file1;
3074     /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
3075     new revision: 1.3; previous revision: 1.2
3076     done
3077     $
3078
3079
3080File: cvs.info,  Node: Merging adds and removals,  Next: Merging and keywords,  Prev: Merging two revisions,  Up: Branching and merging
3081
30825.9 Merging can add or remove files
3083===================================
3084
3085If the changes which you are merging involve removing or adding some
3086files, `update -j' will reflect such additions or removals.
3087
3088   For example:
3089     cvs update -A
3090     touch a b c
3091     cvs add a b c ; cvs ci -m "added" a b c
3092     cvs tag -b branchtag
3093     cvs update -r branchtag
3094     touch d ; cvs add d
3095     rm a ; cvs rm a
3096     cvs ci -m "added d, removed a"
3097     cvs update -A
3098     cvs update -jbranchtag
3099
3100   After these commands are executed and a `cvs commit' is done, file
3101`a' will be removed and file `d' added in the main branch.
3102
3103   Note that using a single static tag (`-j TAGNAME') rather than a
3104dynamic tag (`-j BRANCHNAME') to merge changes from a branch will
3105usually not remove files which were removed on the branch since CVS does
3106not automatically add static tags to dead revisions.  The exception to
3107this rule occurs when a static tag has been attached to a dead revision
3108manually.  Use the branch tag to merge all changes from the branch or
3109use two static tags as merge endpoints to be sure that all intended
3110changes are propagated in the merge.
3111
3112
3113File: cvs.info,  Node: Merging and keywords,  Prev: Merging adds and removals,  Up: Branching and merging
3114
31155.10 Merging and keywords
3116=========================
3117
3118If you merge files containing keywords (*note Keyword substitution::),
3119you will normally get numerous conflicts during the merge, because the
3120keywords are expanded differently in the revisions which you are
3121merging.
3122
3123   Therefore, you will often want to specify the `-kk' (*note
3124Substitution modes::) switch to the merge command line.  By substituting
3125just the name of the keyword, not the expanded value of that keyword,
3126this option ensures that the revisions which you are merging will be the
3127same as each other, and avoid spurious conflicts.
3128
3129   For example, suppose you have a file like this:
3130
3131            +---------+
3132           _! 1.1.2.1 !   <-  br1
3133          / +---------+
3134         /
3135        /
3136     +-----+    +-----+
3137     ! 1.1 !----! 1.2 !
3138     +-----+    +-----+
3139
3140and your working directory is currently on the trunk (revision 1.2).
3141Then you might get the following results from a merge:
3142
3143     $ cat file1
3144     key $ Revision: 1.2 $
3145     . . .
3146     $ cvs update -j br1
3147     U file1
3148     RCS file: /cvsroot/first-dir/file1,v
3149     retrieving revision 1.1
3150     retrieving revision 1.1.2.1
3151     Merging differences between 1.1 and 1.1.2.1 into file1
3152     rcsmerge: warning: conflicts during merge
3153     $ cat file1
3154     <<<<<<< file1
3155     key $ Revision: 1.2 $
3156     =======
3157     key $ Revision: 1.1.2.1 $
3158     >>>>>>> 1.1.2.1
3159     . . .
3160
3161   What happened was that the merge tried to merge the differences
3162between 1.1 and 1.1.2.1 into your working directory.  So, since the
3163keyword changed from `Revision: 1.1' to `Revision: 1.1.2.1', CVS tried
3164to merge that change into your working directory, which conflicted with
3165the fact that your working directory had contained `Revision: 1.2'.
3166
3167   Here is what happens if you had used `-kk':
3168
3169     $ cat file1
3170     key $ Revision: 1.2 $
3171     . . .
3172     $ cvs update -kk -j br1
3173     U file1
3174     RCS file: /cvsroot/first-dir/file1,v
3175     retrieving revision 1.1
3176     retrieving revision 1.1.2.1
3177     Merging differences between 1.1 and 1.1.2.1 into file1
3178     $ cat file1
3179     key $ Revision$
3180     . . .
3181
3182   What is going on here is that revision 1.1 and 1.1.2.1 both expand as
3183plain `Revision', and therefore merging the changes between them into
3184the working directory need not change anything.  Therefore, there is no
3185conflict.
3186
3187   *WARNING: In versions of CVS prior to 1.12.2, there was a major
3188problem with using `-kk' on merges.  Namely, `-kk' overrode any default
3189keyword expansion mode set in the archive file in the repository.  This
3190could, unfortunately for some users, cause data corruption in binary
3191files (with a default keyword expansion mode set to `-kb').  Therefore,
3192when a repository contained binary files, conflicts had to be dealt with
3193manually rather than using `-kk' in a merge command.*
3194
3195   In CVS version 1.12.2 and later, the keyword expansion mode provided
3196on the command line to any CVS command no longer overrides the `-kb'
3197keyword expansion mode setting for binary files, though it will still
3198override other default keyword expansion modes.  You can now safely
3199merge using `-kk' to avoid spurious conflicts on lines containing RCS
3200keywords, even when your repository contains binary files.
3201
3202
3203File: cvs.info,  Node: Recursive behavior,  Next: Adding and removing,  Prev: Branching and merging,  Up: Top
3204
32056 Recursive behavior
3206********************
3207
3208Almost all of the subcommands of CVS work recursively when you specify a
3209directory as an argument.  For instance, consider this directory
3210structure:
3211
3212           `$HOME'
3213             |
3214             +--tc
3215             |   |
3216                 +--CVS
3217                 |      (internal CVS files)
3218                 +--Makefile
3219                 +--backend.c
3220                 +--driver.c
3221                 +--frontend.c
3222                 +--parser.c
3223                 +--man
3224                 |    |
3225                 |    +--CVS
3226                 |    |  (internal CVS files)
3227                 |    +--tc.1
3228                 |
3229                 +--testing
3230                      |
3231                      +--CVS
3232                      |  (internal CVS files)
3233                      +--testpgm.t
3234                      +--test2.t
3235
3236If `tc' is the current working directory, the following is true:
3237
3238   * `cvs update testing' is equivalent to
3239
3240          cvs update testing/testpgm.t testing/test2.t
3241
3242   * `cvs update testing man' updates all files in the subdirectories
3243
3244   * `cvs update .' or just `cvs update' updates all files in the `tc'
3245     directory
3246
3247   If no arguments are given to `update' it will update all files in the
3248current working directory and all its subdirectories.  In other words,
3249`.' is a default argument to `update'.  This is also true for most of
3250the CVS subcommands, not only the `update' command.
3251
3252   The recursive behavior of the CVS subcommands can be turned off with
3253the `-l' option.  Conversely, the `-R' option can be used to force
3254recursion if `-l' is specified in `~/.cvsrc' (*note ~/.cvsrc::).
3255
3256     $ cvs update -l         # Don't update files in subdirectories
3257
3258
3259File: cvs.info,  Node: Adding and removing,  Next: History browsing,  Prev: Recursive behavior,  Up: Top
3260
32617 Adding, removing, and renaming files and directories
3262******************************************************
3263
3264In the course of a project, one will often add new files.  Likewise with
3265removing or renaming, or with directories.  The general concept to keep
3266in mind in all these cases is that instead of making an irreversible
3267change you want CVS to record the fact that a change has taken place,
3268just as with modifying an existing file.  The exact mechanisms to do
3269this in CVS vary depending on the situation.
3270
3271* Menu:
3272
3273* Adding files::                Adding files
3274* Removing files::              Removing files
3275* Removing directories::        Removing directories
3276* Moving files::                Moving and renaming files
3277* Moving directories::          Moving and renaming directories
3278
3279
3280File: cvs.info,  Node: Adding files,  Next: Removing files,  Up: Adding and removing
3281
32827.1 Adding files to a directory
3283===============================
3284
3285To add a new file to a directory, follow these steps.
3286
3287   * You must have a working copy of the directory.  *Note Getting the
3288     source::.
3289
3290   * Create the new file inside your working copy of the directory.
3291
3292   * Use `cvs add FILENAME' to tell CVS that you want to version control
3293     the file.  If the file contains binary data, specify `-kb' (*note
3294     Binary files::).
3295
3296   * Use `cvs commit FILENAME' to actually check in the file into the
3297     repository.  Other developers cannot see the file until you perform
3298     this step.
3299
3300   You can also use the `add' command to add a new directory.
3301
3302   Unlike most other commands, the `add' command is not recursive.  You
3303cannot even type `cvs add foo/bar'!  Instead, you have to
3304
3305     $ cd foo
3306     $ cvs add bar
3307
3308 -- Command: cvs add [`-k' kflag] [`-m' message] files ...
3309     Schedule FILES to be added to the repository.  The files or
3310     directories specified with `add' must already exist in the current
3311     directory.  To add a whole new directory hierarchy to the source
3312     repository (for example, files received from a third-party vendor),
3313     use the `import' command instead.  *Note import::.
3314
3315     The added files are not placed in the source repository until you
3316     use `commit' to make the change permanent.  Doing an `add' on a
3317     file that was removed with the `remove' command will undo the
3318     effect of the `remove', unless a `commit' command intervened.
3319     *Note Removing files::, for an example.
3320
3321     The `-k' option specifies the default way that this file will be
3322     checked out; for more information see *note Substitution modes::.
3323
3324     The `-m' option specifies a description for the file.  This
3325     description appears in the history log (if it is enabled, *note
3326     history file::).  It will also be saved in the version history
3327     inside the repository when the file is committed.  The `log'
3328     command displays this description.  The description can be changed
3329     using `admin -t'.  *Note admin::.  If you omit the `-m DESCRIPTION'
3330     flag, an empty string will be used.  You will not be prompted for a
3331     description.
3332
3333   For example, the following commands add the file `backend.c' to the
3334repository:
3335
3336     $ cvs add backend.c
3337     $ cvs commit -m "Early version. Not yet compilable." backend.c
3338
3339   When you add a file it is added only on the branch which you are
3340working on (*note Branching and merging::).  You can later merge the
3341additions to another branch if you want (*note Merging adds and
3342removals::).
3343
3344
3345File: cvs.info,  Node: Removing files,  Next: Removing directories,  Prev: Adding files,  Up: Adding and removing
3346
33477.2 Removing files
3348==================
3349
3350Directories change.  New files are added, and old files disappear.
3351Still, you want to be able to retrieve an exact copy of old releases.
3352
3353   Here is what you can do to remove a file, but remain able to retrieve
3354old revisions:
3355
3356   * Make sure that you have not made any uncommitted modifications to
3357     the file.  *Note Viewing differences::, for one way to do that.
3358     You can also use the `status' or `update' command.  If you remove
3359     the file without committing your changes, you will of course not be
3360     able to retrieve the file as it was immediately before you deleted
3361     it.
3362
3363   * Remove the file from your working copy of the directory.  You can
3364     for instance use `rm'.
3365
3366   * Use `cvs remove FILENAME' to tell CVS that you really want to
3367     delete the file.
3368
3369   * Use `cvs commit FILENAME' to actually perform the removal of the
3370     file from the repository.
3371
3372   When you commit the removal of the file, CVS records the fact that
3373the file no longer exists.  It is possible for a file to exist on only
3374some branches and not on others, or to re-add another file with the same
3375name later.  CVS will correctly create or not create the file, based on
3376the `-r' and `-D' options specified to `checkout' or `update'.
3377
3378 -- Command: cvs remove [options] files ...
3379     Schedule file(s) to be removed from the repository (files which
3380     have not already been removed from the working directory are not
3381     processed).  This command does not actually remove the file from
3382     the repository until you commit the removal.  For a full list of
3383     options, see *note Invoking CVS::.
3384
3385   Here is an example of removing several files:
3386
3387     $ cd test
3388     $ rm *.c
3389     $ cvs remove
3390     cvs remove: Removing .
3391     cvs remove: scheduling a.c for removal
3392     cvs remove: scheduling b.c for removal
3393     cvs remove: use 'cvs commit' to remove these files permanently
3394     $ cvs ci -m "Removed unneeded files"
3395     cvs commit: Examining .
3396     cvs commit: Committing .
3397
3398   As a convenience you can remove the file and `cvs remove' it in one
3399step, by specifying the `-f' option.  For example, the above example
3400could also be done like this:
3401
3402     $ cd test
3403     $ cvs remove -f *.c
3404     cvs remove: scheduling a.c for removal
3405     cvs remove: scheduling b.c for removal
3406     cvs remove: use 'cvs commit' to remove these files permanently
3407     $ cvs ci -m "Removed unneeded files"
3408     cvs commit: Examining .
3409     cvs commit: Committing .
3410
3411   If you execute `remove' for a file, and then change your mind before
3412you commit, you can undo the `remove' with an `add' command.
3413
3414     $ ls
3415     CVS   ja.h  oj.c
3416     $ rm oj.c
3417     $ cvs remove oj.c
3418     cvs remove: scheduling oj.c for removal
3419     cvs remove: use 'cvs commit' to remove this file permanently
3420     $ cvs add oj.c
3421     U oj.c
3422     cvs add: oj.c, version 1.1.1.1, resurrected
3423
3424   If you realize your mistake before you run the `remove' command you
3425can use `update' to resurrect the file:
3426
3427     $ rm oj.c
3428     $ cvs update oj.c
3429     cvs update: warning: oj.c was lost
3430     U oj.c
3431
3432   When you remove a file it is removed only on the branch which you are
3433working on (*note Branching and merging::).  You can later merge the
3434removals to another branch if you want (*note Merging adds and
3435removals::).
3436
3437
3438File: cvs.info,  Node: Removing directories,  Next: Moving files,  Prev: Removing files,  Up: Adding and removing
3439
34407.3 Removing directories
3441========================
3442
3443In concept removing directories is somewhat similar to removing
3444files--you want the directory to not exist in your current working
3445directories, but you also want to be able to retrieve old releases in
3446which the directory existed.
3447
3448   The way that you remove a directory is to remove all the files in it.
3449You don't remove the directory itself; there is no way to do that.
3450Instead you specify the `-P' option to `cvs update' or `cvs checkout',
3451which will cause CVS to remove empty directories from working
3452directories.  (Note that `cvs export' always removes empty directories.)
3453Probably the best way to do this is to always specify `-P'; if you want
3454an empty directory then put a dummy file (for example `.keepme') in it
3455to prevent `-P' from removing it.
3456
3457   Note that `-P' is implied by the `-r' or `-D' options of `checkout'.
3458This way CVS will be able to correctly create the directory or not
3459depending on whether the particular version you are checking out
3460contains any files in that directory.
3461
3462
3463File: cvs.info,  Node: Moving files,  Next: Moving directories,  Prev: Removing directories,  Up: Adding and removing
3464
34657.4 Moving and renaming files
3466=============================
3467
3468Moving files to a different directory or renaming them is not difficult,
3469but some of the ways in which this works may be non-obvious.  (Moving or
3470renaming a directory is even harder.  *Note Moving directories::.).
3471
3472   The examples below assume that the file OLD is renamed to NEW.
3473
3474* Menu:
3475
3476* Outside::                     The normal way to Rename
3477* Inside::                      A tricky, alternative way
3478* Rename by copying::           Another tricky, alternative way
3479
3480
3481File: cvs.info,  Node: Outside,  Next: Inside,  Up: Moving files
3482
34837.4.1 The Normal way to Rename
3484------------------------------
3485
3486The normal way to move a file is to copy OLD to NEW, and then issue the
3487normal CVS commands to remove OLD from the repository, and add NEW to
3488it.
3489
3490     $ mv OLD NEW
3491     $ cvs remove OLD
3492     $ cvs add NEW
3493     $ cvs commit -m "Renamed OLD to NEW" OLD NEW
3494
3495   This is the simplest way to move a file, it is not error-prone, and
3496it preserves the history of what was done.  Note that to access the
3497history of the file you must specify the old or the new name, depending
3498on what portion of the history you are accessing.  For example, `cvs log
3499OLD' will give the log up until the time of the rename.
3500
3501   When NEW is committed its revision numbers will start again, usually
3502at 1.1, so if that bothers you, use the `-r rev' option to commit.  For
3503more information see *note Assigning revisions::.
3504
3505
3506File: cvs.info,  Node: Inside,  Next: Rename by copying,  Prev: Outside,  Up: Moving files
3507
35087.4.2 Moving the history file
3509-----------------------------
3510
3511This method is more dangerous, since it involves moving files inside the
3512repository.  Read this entire section before trying it out!
3513
3514     $ cd $CVSROOT/DIR
3515     $ mv OLD,v NEW,v
3516
3517Advantages:
3518
3519   * The log of changes is maintained intact.
3520
3521   * The revision numbers are not affected.
3522
3523Disadvantages:
3524
3525   * Old releases cannot easily be fetched from the repository.  (The
3526     file will show up as NEW even in revisions from the time before it
3527     was renamed).
3528
3529   * There is no log information of when the file was renamed.
3530
3531   * Nasty things might happen if someone accesses the history file
3532     while you are moving it.  Make sure no one else runs any of the CVS
3533     commands while you move it.
3534
3535
3536File: cvs.info,  Node: Rename by copying,  Prev: Inside,  Up: Moving files
3537
35387.4.3 Copying the history file
3539------------------------------
3540
3541This way also involves direct modifications to the repository.  It is
3542safe, but not without drawbacks.
3543
3544     # Copy the RCS file inside the repository
3545     $ cd $CVSROOT/DIR
3546     $ cp OLD,v NEW,v
3547     # Remove the old file
3548     $ cd ~/DIR
3549     $ rm OLD
3550     $ cvs remove OLD
3551     $ cvs commit OLD
3552     # Remove all tags from NEW
3553     $ cvs update NEW
3554     $ cvs log NEW             # Remember the non-branch tag names
3555     $ cvs tag -d TAG1 NEW
3556     $ cvs tag -d TAG2 NEW
3557     ...
3558
3559   By removing the tags you will be able to check out old revisions.
3560
3561Advantages:
3562
3563   * Checking out old revisions works correctly, as long as you use
3564     `-rTAG' and not `-DDATE' to retrieve the revisions.
3565
3566   * The log of changes is maintained intact.
3567
3568   * The revision numbers are not affected.
3569
3570Disadvantages:
3571
3572   * You cannot easily see the history of the file across the rename.
3573
3574
3575File: cvs.info,  Node: Moving directories,  Prev: Moving files,  Up: Adding and removing
3576
35777.5 Moving and renaming directories
3578===================================
3579
3580The normal way to rename or move a directory is to rename or move each
3581file within it as described in *note Outside::.  Then check out with the
3582`-P' option, as described in *note Removing directories::.
3583
3584   If you really want to hack the repository to rename or delete a
3585directory in the repository, you can do it like this:
3586
3587  1. Inform everyone who has a checked out copy of the directory that
3588     the directory will be renamed.  They should commit all their
3589     changes, and remove their working copies, before you take the steps
3590     below.
3591
3592  2. Rename the directory inside the repository.
3593
3594          $ cd $CVSROOT/PARENT-DIR
3595          $ mv OLD-DIR NEW-DIR
3596
3597  3. Fix the CVS administrative files, if necessary (for instance if you
3598     renamed an entire module).
3599
3600  4. Tell everyone that they can check out again and continue working.
3601
3602   If someone had a working copy the CVS commands will cease to work for
3603him, until he removes the directory that disappeared inside the
3604repository.
3605
3606   It is almost always better to move the files in the directory instead
3607of moving the directory.  If you move the directory you are unlikely to
3608be able to retrieve old releases correctly, since they probably depend
3609on the name of the directories.
3610
3611
3612File: cvs.info,  Node: History browsing,  Next: Binary files,  Prev: Adding and removing,  Up: Top
3613
36148 History browsing
3615******************
3616
3617Once you have used CVS to store a version control history--what files
3618have changed when, how, and by whom, there are a variety of mechanisms
3619for looking through the history.
3620
3621* Menu:
3622
3623* log messages::                Log messages
3624* history database::            The history database
3625* user-defined logging::        User-defined logging
3626* annotate::                    What revision modified each line of a file?
3627
3628
3629File: cvs.info,  Node: log messages,  Next: history database,  Up: History browsing
3630
36318.1 Log messages
3632================
3633
3634Whenever you commit a file you specify a log message.
3635
3636   To look through the log messages which have been specified for every
3637revision which has been committed, use the `cvs log' command (*note
3638log::).
3639
3640
3641File: cvs.info,  Node: history database,  Next: user-defined logging,  Prev: log messages,  Up: History browsing
3642
36438.2 The history database
3644========================
3645
3646You can use the history file (*note history file::) to log various CVS
3647actions.  To retrieve the information from the history file, use the
3648`cvs history' command (*note history::).
3649
3650   Note: you can control what is logged to this file by using the
3651`LogHistory' keyword in the `CVSROOT/config' file (*note config::).
3652
3653
3654File: cvs.info,  Node: user-defined logging,  Next: annotate,  Prev: history database,  Up: History browsing
3655
36568.3 User-defined logging
3657========================
3658
3659You can customize CVS to log various kinds of actions, in whatever
3660manner you choose.  These mechanisms operate by executing a script at
3661various times.  The script might append a message to a file listing the
3662information and the programmer who created it, or send mail to a group
3663of developers, or, perhaps, post a message to a particular newsgroup.
3664To log commits, use the `loginfo' file (*note loginfo::).  To log
3665commits, checkouts, exports, and tags, respectively, you can also use
3666the `-i', `-o', `-e', and `-t' options in the modules file.  For a more
3667flexible way of giving notifications to various users, which requires
3668less in the way of keeping centralized scripts up to date, use the `cvs
3669watch add' command (*note Getting Notified::); this command is useful
3670even if you are not using `cvs watch on'.
3671
3672   The `taginfo' file defines programs to execute when someone executes
3673a `tag' or `rtag' command.  The `taginfo' file has the standard form for
3674administrative files (*note Administrative files::), where each line is
3675a regular expression followed by a command to execute.  The arguments
3676passed to the command are, in order, the TAGNAME, OPERATION (`add' for
3677`tag', `mov' for `tag -F', and `del' for `tag -d'), REPOSITORY, and any
3678remaining are pairs of FILENAME REVISION.  A non-zero exit of the filter
3679program will cause the tag to be aborted.
3680
3681   Here is an example of using taginfo to log tag and rtag commands.  In
3682the taginfo file put:
3683
3684     ALL /usr/local/cvsroot/CVSROOT/loggit
3685
3686Where `/usr/local/cvsroot/CVSROOT/loggit' contains the following script:
3687
3688     #!/bin/sh
3689     echo "$@" >>/home/kingdon/cvsroot/CVSROOT/taglog
3690
3691
3692File: cvs.info,  Node: annotate,  Prev: user-defined logging,  Up: History browsing
3693
36948.4 Annotate command
3695====================
3696
3697 -- Command: cvs annotate [`-FflR'] [`-r rev'|`-D date'] files ...
3698     For each file in FILES, print the head revision of the trunk,
3699     together with information on the last modification for each line.
3700     For example:
3701
3702          $ cvs annotate ssfile
3703          Annotations for ssfile
3704          ***************
3705          1.1          (mary     27-Mar-96): ssfile line 1
3706          1.2          (joe      28-Mar-96): ssfile line 2
3707
3708     The file `ssfile' currently contains two lines.  The `ssfile line
3709     1' line was checked in by `mary' on March 27.  Then, on March 28,
3710     `joe' added a line `ssfile line 2', without modifying the `ssfile
3711     line 1' line.  This report doesn't tell you anything about lines
3712     which have been deleted or replaced; you need to use `cvs diff' for
3713     that (*note diff::).
3714
3715   The options to `cvs annotate' are listed in *note Invoking CVS::, and
3716can be used to select the files and revisions to annotate.  The options
3717are described in more detail there and in *note Common options::.
3718
3719
3720File: cvs.info,  Node: Binary files,  Next: Multiple developers,  Prev: History browsing,  Up: Top
3721
37229 Handling binary files
3723***********************
3724
3725The most common use for CVS is to store text files.  With text files,
3726CVS can merge revisions, display the differences between revisions in a
3727human-visible fashion, and other such operations.  However, if you are
3728willing to give up a few of these abilities, CVS can store binary files.
3729For example, one might store a web site in CVS including both text files
3730and binary images.
3731
3732* Menu:
3733
3734* Binary why::     More details on issues with binary files
3735* Binary howto::   How to store them
3736
3737
3738File: cvs.info,  Node: Binary why,  Next: Binary howto,  Up: Binary files
3739
37409.1 The issues with binary files
3741================================
3742
3743While the need to manage binary files may seem obvious if the files that
3744you customarily work with are binary, putting them into version control
3745does present some additional issues.
3746
3747   One basic function of version control is to show the differences
3748between two revisions.  For example, if someone else checked in a new
3749version of a file, you may wish to look at what they changed and
3750determine whether their changes are good.  For text files, CVS provides
3751this functionality via the `cvs diff' command.  For binary files, it may
3752be possible to extract the two revisions and then compare them with a
3753tool external to CVS (for example, word processing software often has
3754such a feature).  If there is no such tool, one must track changes via
3755other mechanisms, such as urging people to write good log messages, and
3756hoping that the changes they actually made were the changes that they
3757intended to make.
3758
3759   Another ability of a version control system is the ability to merge
3760two revisions.  For CVS this happens in two contexts.  The first is when
3761users make changes in separate working directories (*note Multiple
3762developers::).  The second is when one merges explicitly with the
3763`update -j' command (*note Branching and merging::).
3764
3765   In the case of text files, CVS can merge changes made independently,
3766and signal a conflict if the changes conflict.  With binary files, the
3767best that CVS can do is present the two different copies of the file,
3768and leave it to the user to resolve the conflict.  The user may choose
3769one copy or the other, or may run an external merge tool which knows
3770about that particular file format, if one exists.  Note that having the
3771user merge relies primarily on the user to not accidentally omit some
3772changes, and thus is potentially error prone.
3773
3774   If this process is thought to be undesirable, the best choice may be
3775to avoid merging.  To avoid the merges that result from separate working
3776directories, see the discussion of reserved checkouts (file locking) in
3777*note Multiple developers::.  To avoid the merges resulting from
3778branches, restrict use of branches.
3779
3780
3781File: cvs.info,  Node: Binary howto,  Prev: Binary why,  Up: Binary files
3782
37839.2 How to store binary files
3784=============================
3785
3786There are two issues with using CVS to store binary files.  The first is
3787that CVS by default converts line endings between the canonical form in
3788which they are stored in the repository (linefeed only), and the form
3789appropriate to the operating system in use on the client (for example,
3790carriage return followed by line feed for Windows NT).
3791
3792   The second is that a binary file might happen to contain data which
3793looks like a keyword (*note Keyword substitution::), so keyword
3794expansion must be turned off.
3795
3796   The `-kb' option available with some CVS commands insures that
3797neither line ending conversion nor keyword expansion will be done.
3798
3799   Here is an example of how you can create a new file using the `-kb'
3800flag:
3801
3802     $ echo '$ Id$' > kotest
3803     $ cvs add -kb -m"A test file" kotest
3804     $ cvs ci -m"First checkin; contains a keyword" kotest
3805
3806   If a file accidentally gets added without `-kb', one can use the `cvs
3807admin' command to recover.  For example:
3808
3809     $ echo '$ Id$' > kotest
3810     $ cvs add -m"A test file" kotest
3811     $ cvs ci -m"First checkin; contains a keyword" kotest
3812     $ cvs admin -kb kotest
3813     $ cvs update -A kotest
3814     # For non-unix systems:
3815     # Copy in a good copy of the file from outside CVS
3816     $ cvs commit -m "make it binary" kotest
3817
3818   When you check in the file `kotest' the file is not preserved as a
3819binary file, because you did not check it in as a binary file.  The `cvs
3820admin -kb' command sets the default keyword substitution method for this
3821file, but it does not alter the working copy of the file that you have.
3822If you need to cope with line endings (that is, you are using CVS on a
3823non-unix system), then you need to check in a new copy of the file, as
3824shown by the `cvs commit' command above.  On unix, the `cvs update -A'
3825command suffices.  (Note that you can use `cvs log' to determine the
3826default keyword substitution method for a file and `cvs status' to
3827determine the keyword substitution method for a working copy.)
3828
3829   However, in using `cvs admin -k' to change the keyword expansion, be
3830aware that the keyword expansion mode is not version controlled.  This
3831means that, for example, that if you have a text file in old releases,
3832and a binary file with the same name in new releases, CVS provides no
3833way to check out the file in text or binary mode depending on what
3834version you are checking out.  There is no good workaround for this
3835problem.
3836
3837   You can also set a default for whether `cvs add' and `cvs import'
3838treat a file as binary based on its name; for example you could say that
3839files who names end in `.exe' are binary.  *Note Wrappers::.  There is
3840currently no way to have CVS detect whether a file is binary based on
3841its contents.  The main difficulty with designing such a feature is that
3842it is not clear how to distinguish between binary and non-binary files,
3843and the rules to apply would vary considerably with the operating
3844system.
3845
3846
3847File: cvs.info,  Node: Multiple developers,  Next: Revision management,  Prev: Binary files,  Up: Top
3848
384910 Multiple developers
3850**********************
3851
3852When more than one person works on a software project things often get
3853complicated.  Often, two people try to edit the same file
3854simultaneously.  One solution, known as "file locking" or "reserved
3855checkouts", is to allow only one person to edit each file at a time.
3856This is the only solution with some version control systems, including
3857RCS and SCCS.  Currently the usual way to get reserved checkouts with
3858CVS is the `cvs admin -l' command (*note admin options::).  This is not
3859as nicely integrated into CVS as the watch features, described below,
3860but it seems that most people with a need for reserved checkouts find it
3861adequate.  It also may be possible to use the watches features described
3862below, together with suitable procedures (not enforced by software), to
3863avoid having two people edit at the same time.
3864
3865   The default model with CVS is known as "unreserved checkouts".  In
3866this model, developers can edit their own "working copy" of a file
3867simultaneously.  The first person that commits his changes has no
3868automatic way of knowing that another has started to edit it.  Others
3869will get an error message when they try to commit the file.  They must
3870then use CVS commands to bring their working copy up to date with the
3871repository revision.  This process is almost automatic.
3872
3873   CVS also supports mechanisms which facilitate various kinds of
3874communication, without actually enforcing rules like reserved checkouts
3875do.
3876
3877   The rest of this chapter describes how these various models work, and
3878some of the issues involved in choosing between them.
3879
3880* Menu:
3881
3882* File status::                 A file can be in several states
3883* Updating a file::             Bringing a file up-to-date
3884* Conflicts example::           An informative example
3885* Informing others::            To cooperate you must inform
3886* Concurrency::                 Simultaneous repository access
3887* Watches::                     Mechanisms to track who is editing files
3888* Choosing a model::            Reserved or unreserved checkouts?
3889
3890
3891File: cvs.info,  Node: File status,  Next: Updating a file,  Up: Multiple developers
3892
389310.1 File status
3894================
3895
3896Based on what operations you have performed on a checked out file, and
3897what operations others have performed to that file in the repository,
3898one can classify a file in a number of states.  The states, as reported
3899by the `status' command, are:
3900
3901Up-to-date
3902     The file is identical with the latest revision in the repository
3903     for the branch in use.
3904
3905Locally Modified
3906     You have edited the file, and not yet committed your changes.
3907
3908Locally Added
3909     You have added the file with `add', and not yet committed your
3910     changes.
3911
3912Locally Removed
3913     You have removed the file with `remove', and not yet committed your
3914     changes.
3915
3916Needs Checkout
3917     Someone else has committed a newer revision to the repository.  The
3918     name is slightly misleading; you will ordinarily use `update'
3919     rather than `checkout' to get that newer revision.
3920
3921Needs Patch
3922     Like Needs Checkout, but the CVS server will send a patch rather
3923     than the entire file.  Sending a patch or sending an entire file
3924     accomplishes the same thing.
3925
3926Needs Merge
3927     Someone else has committed a newer revision to the repository, and
3928     you have also made modifications to the file.
3929
3930Unresolved Conflict
3931     A file with the same name as this new file has been added to the
3932     repository from a second workspace.  This file will need to be
3933     moved out of the way to allow an `update' to complete.
3934
3935File had conflicts on merge
3936     This is like Locally Modified, except that a previous `update'
3937     command gave a conflict.  If you have not already done so, you need
3938     to resolve the conflict as described in *note Conflicts example::.
3939
3940Unknown
3941     CVS doesn't know anything about this file.  For example, you have
3942     created a new file and have not run `add'.
3943
3944   To help clarify the file status, `status' also reports the `Working
3945revision' which is the revision that the file in the working directory
3946derives from, and the `Repository revision' which is the latest revision
3947in the repository for the branch in use.
3948
3949   The options to `status' are listed in *note Invoking CVS::.  For
3950information on its `Sticky tag' and `Sticky date' output, see *note
3951Sticky tags::.  For information on its `Sticky options' output, see the
3952`-k' option in *note update options::.
3953
3954   You can think of the `status' and `update' commands as somewhat
3955complementary.  You use `update' to bring your files up to date, and you
3956can use `status' to give you some idea of what an `update' would do (of
3957course, the state of the repository might change before you actually run
3958`update').  In fact, if you want a command to display file status in a
3959more brief format than is displayed by the `status' command, you can
3960invoke
3961
3962     $ cvs -n -q update
3963
3964   The `-n' option means to not actually do the update, but merely to
3965display statuses; the `-q' option avoids printing the name of each
3966directory.  For more information on the `update' command, and these
3967options, see *note Invoking CVS::.
3968
3969
3970File: cvs.info,  Node: Updating a file,  Next: Conflicts example,  Prev: File status,  Up: Multiple developers
3971
397210.2 Bringing a file up to date
3973===============================
3974
3975When you want to update or merge a file, use the `update' command.  For
3976files that are not up to date this is roughly equivalent to a `checkout'
3977command: the newest revision of the file is extracted from the
3978repository and put in your working directory.
3979
3980   Your modifications to a file are never lost when you use `update'.
3981If no newer revision exists, running `update' has no effect.  If you
3982have edited the file, and a newer revision is available, CVS will merge
3983all changes into your working copy.
3984
3985   For instance, imagine that you checked out revision 1.4 and started
3986editing it.  In the meantime someone else committed revision 1.5, and
3987shortly after that revision 1.6.  If you run `update' on the file now,
3988CVS will incorporate all changes between revision 1.4 and 1.6 into your
3989file.
3990
3991   If any of the changes between 1.4 and 1.6 were made too close to any
3992of the changes you have made, an "overlap" occurs.  In such cases a
3993warning is printed, and the resulting file includes both versions of the
3994lines that overlap, delimited by special markers.  *Note update::, for a
3995complete description of the `update' command.
3996
3997
3998File: cvs.info,  Node: Conflicts example,  Next: Informing others,  Prev: Updating a file,  Up: Multiple developers
3999
400010.3 Conflicts example
4001======================
4002
4003Suppose revision 1.4 of `driver.c' contains this:
4004
4005     #include <stdio.h>
4006
4007     void main()
4008     {
4009         parse();
4010         if (nerr == 0)
4011             gencode();
4012         else
4013             fprintf(stderr, "No code generated.\n");
4014         exit(nerr == 0 ? 0 : 1);
4015     }
4016
4017Revision 1.6 of `driver.c' contains this:
4018
4019     #include <stdio.h>
4020
4021     int main(int argc,
4022              char **argv)
4023     {
4024         parse();
4025         if (argc != 1)
4026         {
4027             fprintf(stderr, "tc: No args expected.\n");
4028             exit(1);
4029         }
4030         if (nerr == 0)
4031             gencode();
4032         else
4033             fprintf(stderr, "No code generated.\n");
4034         exit(!!nerr);
4035     }
4036
4037Your working copy of `driver.c', based on revision 1.4, contains this
4038before you run `cvs update':
4039
4040     #include <stdlib.h>
4041     #include <stdio.h>
4042
4043     void main()
4044     {
4045         init_scanner();
4046         parse();
4047         if (nerr == 0)
4048             gencode();
4049         else
4050             fprintf(stderr, "No code generated.\n");
4051         exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
4052     }
4053
4054You run `cvs update':
4055
4056     $ cvs update driver.c
4057     RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
4058     retrieving revision 1.4
4059     retrieving revision 1.6
4060     Merging differences between 1.4 and 1.6 into driver.c
4061     rcsmerge warning: overlaps during merge
4062     cvs update: conflicts found in driver.c
4063     C driver.c
4064
4065CVS tells you that there were some conflicts.  Your original working
4066file is saved unmodified in `.#driver.c.1.4'.  The new version of
4067`driver.c' contains this:
4068
4069     #include <stdlib.h>
4070     #include <stdio.h>
4071
4072     int main(int argc,
4073              char **argv)
4074     {
4075         init_scanner();
4076         parse();
4077         if (argc != 1)
4078         {
4079             fprintf(stderr, "tc: No args expected.\n");
4080             exit(1);
4081         }
4082         if (nerr == 0)
4083             gencode();
4084         else
4085             fprintf(stderr, "No code generated.\n");
4086     <<<<<<< driver.c
4087         exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
4088     =======
4089         exit(!!nerr);
4090     >>>>>>> 1.6
4091     }
4092
4093Note how all non-overlapping modifications are incorporated in your
4094working copy, and that the overlapping section is clearly marked with
4095`<<<<<<<', `=======' and `>>>>>>>'.
4096
4097   You resolve the conflict by editing the file, removing the markers
4098and the erroneous line.  Suppose you end up with this file:
4099     #include <stdlib.h>
4100     #include <stdio.h>
4101
4102     int main(int argc,
4103              char **argv)
4104     {
4105         init_scanner();
4106         parse();
4107         if (argc != 1)
4108         {
4109             fprintf(stderr, "tc: No args expected.\n");
4110             exit(1);
4111         }
4112         if (nerr == 0)
4113             gencode();
4114         else
4115             fprintf(stderr, "No code generated.\n");
4116         exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
4117     }
4118
4119You can now go ahead and commit this as revision 1.7.
4120
4121     $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
4122     Checking in driver.c;
4123     /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
4124     new revision: 1.7; previous revision: 1.6
4125     done
4126
4127   For your protection, CVS will refuse to check in a file if a conflict
4128occurred and you have not resolved the conflict.  Currently to resolve a
4129conflict, you must change the timestamp on the file.  In previous
4130versions of CVS, you also needed to insure that the file contains no
4131conflict markers.  Because your file may legitimately contain conflict
4132markers (that is, occurrences of `>>>>>>> ' at the start of a line that
4133don't mark a conflict), the current version of CVS will print a warning
4134and proceed to check in the file.
4135
4136   If you use release 1.04 or later of pcl-cvs (a GNU Emacs front-end
4137for CVS) you can use an Emacs package called emerge to help you resolve
4138conflicts.  See the documentation for pcl-cvs.
4139
4140
4141File: cvs.info,  Node: Informing others,  Next: Concurrency,  Prev: Conflicts example,  Up: Multiple developers
4142
414310.4 Informing others about commits
4144===================================
4145
4146It is often useful to inform others when you commit a new revision of a
4147file.  The `-i' option of the `modules' file, or the `loginfo' file, can
4148be used to automate this process.  *Note modules::.  *Note loginfo::.
4149You can use these features of CVS to, for instance, instruct CVS to mail
4150a message to all developers, or post a message to a local newsgroup.
4151
4152
4153File: cvs.info,  Node: Concurrency,  Next: Watches,  Prev: Informing others,  Up: Multiple developers
4154
415510.5 Several developers simultaneously attempting to run CVS
4156============================================================
4157
4158If several developers try to run CVS at the same time, one may get the
4159following message:
4160
4161     [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
4162
4163   CVS will try again every 30 seconds, and either continue with the
4164operation or print the message again, if it still needs to wait.  If a
4165lock seems to stick around for an undue amount of time, find the person
4166holding the lock and ask them about the cvs command they are running.
4167If they aren't running a cvs command, look in the repository directory
4168mentioned in the message and remove files which they own whose names
4169start with `#cvs.rfl', `#cvs.wfl', or `#cvs.lock'.
4170
4171   Note that these locks are to protect CVS's internal data structures
4172and have no relationship to the word "lock" in the sense used by
4173RCS--which refers to reserved checkouts (*note Multiple developers::).
4174
4175   Any number of people can be reading from a given repository at a
4176time; only when someone is writing do the locks prevent other people
4177from reading or writing.
4178
4179   One might hope for the following property:
4180
4181     If someone commits some changes in one cvs command, then an update
4182     by someone else will either get all the changes, or none of them.
4183
4184but CVS does _not_ have this property.  For example, given the files
4185
4186     a/one.c
4187     a/two.c
4188     b/three.c
4189     b/four.c
4190
4191if someone runs
4192
4193     cvs ci a/two.c b/three.c
4194
4195and someone else runs `cvs update' at the same time, the person running
4196`update' might get only the change to `b/three.c' and not the change to
4197`a/two.c'.
4198
4199
4200File: cvs.info,  Node: Watches,  Next: Choosing a model,  Prev: Concurrency,  Up: Multiple developers
4201
420210.6 Mechanisms to track who is editing files
4203=============================================
4204
4205For many groups, use of CVS in its default mode is perfectly
4206satisfactory.  Users may sometimes go to check in a modification only to
4207find that another modification has intervened, but they deal with it and
4208proceed with their check in.  Other groups prefer to be able to know who
4209is editing what files, so that if two people try to edit the same file
4210they can choose to talk about who is doing what when rather than be
4211surprised at check in time.  The features in this section allow such
4212coordination, while retaining the ability of two developers to edit the
4213same file at the same time.
4214
4215   For maximum benefit developers should use `cvs edit' (not `chmod') to
4216make files read-write to edit them, and `cvs release' (not `rm') to
4217discard a working directory which is no longer in use, but CVS is not
4218able to enforce this behavior.
4219
4220* Menu:
4221
4222* Setting a watch::             Telling CVS to watch certain files
4223* Getting Notified::            Telling CVS to notify you
4224* Editing files::               How to edit a file which is being watched
4225* Watch information::           Information about who is watching and editing
4226* Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
4227
4228
4229File: cvs.info,  Node: Setting a watch,  Next: Getting Notified,  Up: Watches
4230
423110.6.1 Telling CVS to watch certain files
4232-----------------------------------------
4233
4234To enable the watch features, you first specify that certain files are
4235to be watched.
4236
4237 -- Command: cvs watch on [`-lR'] [FILES]...
4238     Specify that developers should run `cvs edit' before editing FILES.
4239     CVS will create working copies of FILES read-only, to remind
4240     developers to run the `cvs edit' command before working on them.
4241
4242     If FILES includes the name of a directory, CVS arranges to watch
4243     all files added to the corresponding repository directory, and sets
4244     a default for files added in the future; this allows the user to
4245     set notification policies on a per-directory basis.  The contents
4246     of the directory are processed recursively, unless the `-l' option
4247     is given.  The `-R' option can be used to force recursion if the
4248     `-l' option is set in `~/.cvsrc' (*note ~/.cvsrc::).
4249
4250     If FILES is omitted, it defaults to the current directory.
4251
4252 -- Command: cvs watch off [`-lR'] [FILES]...
4253     Do not create FILES read-only on checkout; thus, developers will
4254     not be reminded to use `cvs edit' and `cvs unedit'.
4255
4256     The FILES and options are processed as for `cvs watch on'.
4257
4258
4259File: cvs.info,  Node: Getting Notified,  Next: Editing files,  Prev: Setting a watch,  Up: Watches
4260
426110.6.2 Telling CVS to notify you
4262--------------------------------
4263
4264You can tell CVS that you want to receive notifications about various
4265actions taken on a file.  You can do this without using `cvs watch on'
4266for the file, but generally you will want to use `cvs watch on', to
4267remind developers to use the `cvs edit' command.
4268
4269 -- Command: cvs watch add [`-lR'] [`-a' ACTION]... [FILES]...
4270     Add the current user to the list of people to receive notification
4271     of work done on FILES.
4272
4273     The `-a' option specifies what kinds of events CVS should notify
4274     the user about.  ACTION is one of the following:
4275
4276     `edit'
4277          Another user has applied the `cvs edit' command (described
4278          below) to a watched file.
4279
4280     `commit'
4281          Another user has committed changes to one of the named FILES.
4282
4283     `unedit'
4284          Another user has abandoned editing a file (other than by
4285          committing changes).  They can do this in several ways, by:
4286
4287             * applying the `cvs unedit' command (described below) to
4288               the file
4289
4290             * applying the `cvs release' command (*note release::) to
4291               the file's parent directory (or recursively to a
4292               directory more than one level up)
4293
4294             * deleting the file and allowing `cvs update' to recreate
4295               it
4296
4297     `all'
4298          All of the above.
4299
4300     `none'
4301          None of the above.  (This is useful with `cvs edit', described
4302          below.)
4303
4304     The `-a' option may appear more than once, or not at all.  If
4305     omitted, the action defaults to `all'.
4306
4307     The FILES and options are processed as for `cvs watch on'.
4308
4309 -- Command: cvs watch remove [`-lR'] [`-a' ACTION]... [FILES]...
4310     Remove a notification request established using `cvs watch add';
4311     the arguments are the same.  If the `-a' option is present, only
4312     watches for the specified actions are removed.
4313
4314   When the conditions exist for notification, CVS calls the `notify'
4315administrative file.  Edit `notify' as one edits the other
4316administrative files (*note Intro administrative files::).  This file
4317follows the usual conventions for administrative files (*note syntax::),
4318where each line is a regular expression followed by a command to
4319execute.  The command should contain a single occurrence of `%s' which
4320will be replaced by the user to notify; the rest of the information
4321regarding the notification will be supplied to the command on standard
4322input.  The standard thing to put in the `notify' file is the single
4323line:
4324
4325     ALL mail %s -s "CVS notification"
4326
4327This causes users to be notified by electronic mail.
4328
4329   Note that if you set this up in the straightforward way, users
4330receive notifications on the server machine.  One could of course write
4331a `notify' script which directed notifications elsewhere, but to make
4332this easy, CVS allows you to associate a notification address for each
4333user.  To do so create a file `users' in `CVSROOT' with a line for each
4334user in the format USER:VALUE.  Then instead of passing the name of the
4335user to be notified to `notify', CVS will pass the VALUE (normally an
4336email address on some other machine).
4337
4338   CVS does not notify you for your own changes.  Currently this check
4339is done based on whether the user name of the person taking the action
4340which triggers notification matches the user name of the person getting
4341notification.  In fact, in general, the watches features only track one
4342edit by each user.  It probably would be more useful if watches tracked
4343each working directory separately, so this behavior might be worth
4344changing.
4345
4346
4347File: cvs.info,  Node: Editing files,  Next: Watch information,  Prev: Getting Notified,  Up: Watches
4348
434910.6.3 How to edit a file which is being watched
4350------------------------------------------------
4351
4352Since a file which is being watched is checked out read-only, you cannot
4353simply edit it.  To make it read-write, and inform others that you are
4354planning to edit it, use the `cvs edit' command.  Some systems call this
4355a "checkout", but CVS uses that term for obtaining a copy of the sources
4356(*note Getting the source::), an operation which those systems call a
4357"get" or a "fetch".
4358
4359 -- Command: cvs edit [`-lR'] [`-a' ACTION]... [FILES]...
4360     Prepare to edit the working files FILES.  CVS makes the FILES
4361     read-write, and notifies users who have requested `edit'
4362     notification for any of FILES.
4363
4364     The `cvs edit' command accepts the same options as the `cvs watch
4365     add' command, and establishes a temporary watch for the user on
4366     FILES; CVS will remove the watch when FILES are `unedit'ed or
4367     `commit'ted.  If the user does not wish to receive notifications,
4368     she should specify `-a none'.
4369
4370     The FILES and the options are processed as for the `cvs watch'
4371     commands.
4372
4373   Normally when you are done with a set of changes, you use the `cvs
4374commit' command, which checks in your changes and returns the watched
4375files to their usual read-only state.  But if you instead decide to
4376abandon your changes, or not to make any changes, you can use the `cvs
4377unedit' command.
4378
4379 -- Command: cvs unedit [`-lR'] [FILES]...
4380     Abandon work on the working files FILES, and revert them to the
4381     repository versions on which they are based.  CVS makes those FILES
4382     read-only for which users have requested notification using `cvs
4383     watch on'.  CVS notifies users who have requested `unedit'
4384     notification for any of FILES.
4385
4386     The FILES and options are processed as for the `cvs watch'
4387     commands.
4388
4389     If watches are not in use, the `unedit' command probably does not
4390     work, and the way to revert to the repository version is with the
4391     command `cvs update -C file' (*note update::).  The meaning is not
4392     precisely the same; the latter may also bring in some changes which
4393     have been made in the repository since the last time you updated.
4394
4395   When using client/server CVS, you can use the `cvs edit' and `cvs
4396unedit' commands even if CVS is unable to successfully communicate with
4397the server; the notifications will be sent upon the next successful CVS
4398command.
4399
4400
4401File: cvs.info,  Node: Watch information,  Next: Watches Compatibility,  Prev: Editing files,  Up: Watches
4402
440310.6.4 Information about who is watching and editing
4404----------------------------------------------------
4405
4406 -- Command: cvs watchers [`-lR'] [FILES]...
4407     List the users currently watching changes to FILES.  The report
4408     includes the files being watched, and the mail address of each
4409     watcher.
4410
4411     The FILES and options are processed as for the `cvs watch'
4412     commands.
4413
4414 -- Command: cvs editors [`-lR'] [FILES]...
4415     List the users currently working on FILES.  The report includes the
4416     mail address of each user, the time when the user began working
4417     with the file, and the host and path of the working directory
4418     containing the file.
4419
4420     The FILES and options are processed as for the `cvs watch'
4421     commands.
4422
4423
4424File: cvs.info,  Node: Watches Compatibility,  Prev: Watch information,  Up: Watches
4425
442610.6.5 Using watches with old versions of CVS
4427---------------------------------------------
4428
4429If you use the watch features on a repository, it creates `CVS'
4430directories in the repository and stores the information about watches
4431in that directory.  If you attempt to use CVS 1.6 or earlier with the
4432repository, you get an error message such as the following (all on one
4433line):
4434
4435     cvs update: cannot open CVS/Entries for reading:
4436     No such file or directory
4437
4438and your operation will likely be aborted.  To use the watch features,
4439you must upgrade all copies of CVS which use that repository in local or
4440server mode.  If you cannot upgrade, use the `watch off' and `watch
4441remove' commands to remove all watches, and that will restore the
4442repository to a state which CVS 1.6 can cope with.
4443
4444
4445File: cvs.info,  Node: Choosing a model,  Prev: Watches,  Up: Multiple developers
4446
444710.7 Choosing between reserved or unreserved checkouts
4448======================================================
4449
4450Reserved and unreserved checkouts each have pros and cons.  Let it be
4451said that a lot of this is a matter of opinion or what works given
4452different groups' working styles, but here is a brief description of
4453some of the issues.  There are many ways to organize a team of
4454developers.  CVS does not try to enforce a certain organization.  It is
4455a tool that can be used in several ways.
4456
4457   Reserved checkouts can be very counter-productive.  If two persons
4458want to edit different parts of a file, there may be no reason to
4459prevent either of them from doing so.  Also, it is common for someone to
4460take out a lock on a file, because they are planning to edit it, but
4461then forget to release the lock.
4462
4463   People, especially people who are familiar with reserved checkouts,
4464often wonder how often conflicts occur if unreserved checkouts are used,
4465and how difficult they are to resolve.  The experience with many groups
4466is that they occur rarely and usually are relatively straightforward to
4467resolve.
4468
4469   The rarity of serious conflicts may be surprising, until one realizes
4470that they occur only when two developers disagree on the proper design
4471for a given section of code; such a disagreement suggests that the team
4472has not been communicating properly in the first place.  In order to
4473collaborate under _any_ source management regimen, developers must agree
4474on the general design of the system; given this agreement, overlapping
4475changes are usually straightforward to merge.
4476
4477   In some cases unreserved checkouts are clearly inappropriate.  If no
4478merge tool exists for the kind of file you are managing (for example
4479word processor files or files edited by Computer Aided Design programs),
4480and it is not desirable to change to a program which uses a mergeable
4481data format, then resolving conflicts is going to be unpleasant enough
4482that you generally will be better off to simply avoid the conflicts
4483instead, by using reserved checkouts.
4484
4485   The watches features described above in *note Watches:: can be
4486considered to be an intermediate model between reserved checkouts and
4487unreserved checkouts.  When you go to edit a file, it is possible to
4488find out who else is editing it.  And rather than having the system
4489simply forbid both people editing the file, it can tell you what the
4490situation is and let you figure out whether it is a problem in that
4491particular case or not.  Therefore, for some groups it can be considered
4492the best of both the reserved checkout and unreserved checkout worlds.
4493
4494
4495File: cvs.info,  Node: Revision management,  Next: Keyword substitution,  Prev: Multiple developers,  Up: Top
4496
449711 Revision management
4498**********************
4499
4500If you have read this far, you probably have a pretty good grasp on what
4501CVS can do for you.  This chapter talks a little about things that you
4502still have to decide.
4503
4504   If you are doing development on your own using CVS you could probably
4505skip this chapter.  The questions this chapter takes up become more
4506important when more than one person is working in a repository.
4507
4508* Menu:
4509
4510* When to commit::              Some discussion on the subject
4511
4512
4513File: cvs.info,  Node: When to commit,  Up: Revision management
4514
451511.1 When to commit?
4516====================
4517
4518Your group should decide which policy to use regarding commits.  Several
4519policies are possible, and as your experience with CVS grows you will
4520probably find out what works for you.
4521
4522   If you commit files too quickly you might commit files that do not
4523even compile.  If your partner updates his working sources to include
4524your buggy file, he will be unable to compile the code.  On the other
4525hand, other persons will not be able to benefit from the improvements
4526you make to the code if you commit very seldom, and conflicts will
4527probably be more common.
4528
4529   It is common to only commit files after making sure that they can be
4530compiled.  Some sites require that the files pass a test suite.
4531Policies like this can be enforced using the commitinfo file (*note
4532commitinfo::), but you should think twice before you enforce such a
4533convention.  By making the development environment too controlled it
4534might become too regimented and thus counter-productive to the real
4535goal, which is to get software written.
4536
4537
4538File: cvs.info,  Node: Keyword substitution,  Next: Tracking sources,  Prev: Revision management,  Up: Top
4539
454012 Keyword substitution
4541***********************
4542
4543As long as you edit source files inside a working directory you can
4544always find out the state of your files via `cvs status' and `cvs log'.
4545But as soon as you export the files from your development environment it
4546becomes harder to identify which revisions they are.
4547
4548   CVS can use a mechanism known as "keyword substitution" (or "keyword
4549expansion") to help identifying the files.  Embedded strings of the form
4550`$KEYWORD$' and `$KEYWORD:...$' in a file are replaced with strings of
4551the form `$KEYWORD:VALUE$' whenever you obtain a new revision of the
4552file.
4553
4554* Menu:
4555
4556* Keyword list::                   Keywords
4557* Using keywords::                 Using keywords
4558* Avoiding substitution::          Avoiding substitution
4559* Substitution modes::             Substitution modes
4560* Configuring keyword expansion::  Configuring keyword expansion
4561* Log keyword::                    Problems with the $ Log$ keyword.
4562
4563
4564File: cvs.info,  Node: Keyword list,  Next: Using keywords,  Up: Keyword substitution
4565
456612.1 Keyword List
4567=================
4568
4569This is a list of the keywords:
4570
4571`$ Author$'
4572     The login name of the user who checked in the revision.
4573
4574`$ CVSHeader'
4575     A standard header (similar to $ Header$, but with the CVS root
4576     stripped off). It contains the relative pathname of the RCS file to
4577     the CVS root, the revision number, the date (UTC), the author, the
4578     state, and the locker (if locked). Files will normally never be
4579     locked when you use CVS.
4580
4581     Note that this keyword has only been recently introduced to CVS and
4582     may cause problems with existing installations if $ CVSHeader$ is
4583     already in the files for a different purpose. This keyword may be
4584     excluded using the `KeywordExpansion=eCVSHeader' in the
4585     `CVSROOT/config' file.  See *note Configuring keyword expansion::
4586     for more details.
4587
4588`$ Date$'
4589     The date and time (UTC) the revision was checked in.
4590
4591`$ Header$'
4592     A standard header containing the full pathname of the RCS file, the
4593     revision number, the date (UTC), the author, the state, and the
4594     locker (if locked).  Files will normally never be locked when you
4595     use CVS.
4596
4597`$ Id$'
4598     Same as `$ Header$', except that the RCS filename is without a
4599     path.
4600
4601`$ Name$'
4602     Tag name used to check out this file.  The keyword is expanded only
4603     if one checks out with an explicit tag name.  For example, when
4604     running the command `cvs co -r first', the keyword expands to
4605     `Name: first'.
4606
4607`$ Locker$'
4608     The login name of the user who locked the revision (empty if not
4609     locked, which is the normal case unless `cvs admin -l' is in use).
4610
4611`$ Log$'
4612     The log message supplied during commit, preceded by a header
4613     containing the RCS filename, the revision number, the author, and
4614     the date (UTC).  Existing log messages are _not_ replaced.
4615     Instead, the new log message is inserted after `$ Log:...$'.  Each
4616     new line is prefixed with the same string which precedes the `$Log'
4617     keyword.  For example, if the file contains:
4618
4619            /* Here is what people have been up to:
4620             *
4621             * $ Log: frob.c,v $
4622             * Revision 1.1  1997/01/03 14:23:51  joe
4623             * Add the superfrobnicate option
4624             *
4625             */
4626
4627     then additional lines which are added when expanding the `$Log'
4628     keyword will be preceded by `   * '.  Unlike previous versions of
4629     CVS and RCS, the "comment leader" from the RCS file is not used.
4630     The `$Log' keyword is useful for accumulating a complete change log
4631     in a source file, but for several reasons it can be problematic.
4632     *Note Log keyword::.
4633
4634`$ RCSfile$'
4635     The name of the RCS file without a path.
4636
4637`$ Revision$'
4638     The revision number assigned to the revision.
4639
4640`$ Source$'
4641     The full pathname of the RCS file.
4642
4643`$ State$'
4644     The state assigned to the revision.  States can be assigned with
4645     `cvs admin -s'--see *note admin options::.
4646
4647`Local keyword'
4648     The `LocalKeyword' option in the `CVSROOT/config' file may be used
4649     to specify a local keyword which is to be used as an alias for one
4650     of the other keywords. For example, if the `CVSROOT/config' file
4651     contains a line with `LocalKeyword=MYBSD=CVSHeader', then a file
4652     with the local keyword $ MYBSD$ will be expanded as if it were a $
4653     CVSHeader$ keyword. If the src/frob.c file contained this keyword,
4654     it might look something like this:
4655
4656            /*
4657             * $ MYBSD: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $
4658             */
4659
4660     Many repositories make use of a such a "local keyword" feature. An
4661     old patch to CVS provided the `LocalKeyword' feature using a `tag='
4662     option and called this the "custom tag" or "local tag" feature. It
4663     was used in conjunction with the what they called the `tagexpand='
4664     option. In CVS this other option is known as the `KeywordExpand'
4665     option.  See *note Configuring keyword expansion:: for more
4666     details.
4667
4668     Examples from popular projects include: $ FreeBSD$, $ NetBSD$, $
4669     OpenBSD$, $ XFree86$, $ Xorg$.
4670
4671     The advantage of this is that you can include your local version
4672     information in a file using this local keyword without disrupting
4673     the upstream version information (which may be a different local
4674     keyword or a standard keyword). Allowing bug reports and the like
4675     to more properly identify the source of the original bug to the
4676     third-party and reducing the number of conflicts that arise during
4677     an import of a new version.
4678
4679     All keyword expansion except the local keyword may be disabled
4680     using the `KeywordExpansion' option in the `CVSROOT/config'
4681     file--see *note Configuring keyword expansion:: for more details.
4682
4683
4684File: cvs.info,  Node: Using keywords,  Next: Avoiding substitution,  Prev: Keyword list,  Up: Keyword substitution
4685
468612.2 Using keywords
4687===================
4688
4689To include a keyword string you simply include the relevant text string,
4690such as `$ Id$', inside the file, and commit the file.  CVS will
4691automatically expand the string as part of the commit operation.
4692
4693   It is common to embed the `$ Id$' string in the source files so that
4694it gets passed through to generated files.  For example, if you are
4695managing computer program source code, you might include a variable
4696which is initialized to contain that string.  Or some C compilers may
4697provide a `#pragma ident' directive.  Or a document management system
4698might provide a way to pass a string through to generated files.
4699
4700   The `ident' command (which is part of the RCS package) can be used to
4701extract keywords and their values from a file.  This can be handy for
4702text files, but it is even more useful for extracting keywords from
4703binary files.
4704
4705     $ ident samp.c
4706     samp.c:
4707          $ Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
4708     $ gcc samp.c
4709     $ ident a.out
4710     a.out:
4711          $ Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
4712
4713   SCCS is another popular revision control system.  It has a command,
4714`what', which is very similar to `ident' and used for the same purpose.
4715Many sites without RCS have SCCS.  Since `what' looks for the character
4716sequence `@(#)' it is easy to include keywords that are detected by
4717either command.  Simply prefix the keyword with the magic SCCS phrase,
4718like this:
4719
4720     static char *id="@(#) $ Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
4721
4722
4723File: cvs.info,  Node: Avoiding substitution,  Next: Substitution modes,  Prev: Using keywords,  Up: Keyword substitution
4724
472512.3 Avoiding substitution
4726==========================
4727
4728Keyword substitution has its disadvantages.  Sometimes you might want
4729the literal text string `$ Author$' to appear inside a file without CVS
4730interpreting it as a keyword and expanding it into something like `$
4731Author: ceder $'.
4732
4733   There is unfortunately no way to selectively turn off keyword
4734substitution.  You can use `-ko' (*note Substitution modes::) to turn
4735off keyword substitution entirely.
4736
4737   In many cases you can avoid using keywords in the source, even though
4738they appear in the final product.  For example, the source for this
4739manual contains `$@asis{}Author$' whenever the text `$ Author$' should
4740appear.  In `nroff' and `troff' you can embed the null-character `\&'
4741inside the keyword for a similar effect.
4742
4743   It is also possible to specify an explicit list of keywords to
4744include or exclude using the `KeywordExpand' option in the
4745`CVSROOT/config' file-see *note Configuring keyword expansion:: for more
4746details. This feature is intended primarily for use with the
4747`LocalKeyword' option-see *note Keyword list::.
4748
4749
4750File: cvs.info,  Node: Substitution modes,  Next: Configuring keyword expansion,  Prev: Avoiding substitution,  Up: Keyword substitution
4751
475212.4 Substitution modes
4753=======================
4754
4755Each file has a stored default substitution mode, and each working
4756directory copy of a file also has a substitution mode.  The former is
4757set by the `-k' option to `cvs add' and `cvs admin'; the latter is set
4758by the `-k' or `-A' options to `cvs checkout' or `cvs update'.  `cvs
4759diff' also has a `-k' option.  For some examples, see *note Binary
4760files::, and *note Merging and keywords::.
4761
4762   The modes available are:
4763
4764`-kkv'
4765     Generate keyword strings using the default form, e.g.  `$ Revision:
4766     5.7 $' for the `Revision' keyword.
4767
4768`-kkvl'
4769     Like `-kkv', except that a locker's name is always inserted if the
4770     given revision is currently locked.  The locker's name is only
4771     relevant if `cvs admin -l' is in use.
4772
4773`-kk'
4774     Generate only keyword names in keyword strings; omit their values.
4775     For example, for the `Revision' keyword, generate the string `$
4776     Revision$' instead of `$ Revision: 5.7 $'.  This option is useful
4777     to ignore differences due to keyword substitution when comparing
4778     different revisions of a file (*note Merging and keywords::).
4779
4780`-ko'
4781     Generate the old keyword string, present in the working file just
4782     before it was checked in.  For example, for the `Revision' keyword,
4783     generate the string `$ Revision: 1.1 $' instead of `$ Revision: 5.7
4784     $' if that is how the string appeared when the file was checked in.
4785
4786`-kb'
4787     Like `-ko', but also inhibit conversion of line endings between the
4788     canonical form in which they are stored in the repository (linefeed
4789     only), and the form appropriate to the operating system in use on
4790     the client.  For systems, like unix, which use linefeed only to
4791     terminate lines, this is very similar to `-ko'.  For more
4792     information on binary files, see *note Binary files::.  In CVS
4793     version 1.12.2 and later `-kb', as set by `cvs add', `cvs admin',
4794     or `cvs import' may not be overridden by a `-k' option specified on
4795     the command line.
4796
4797`-kv'
4798     Generate only keyword values for keyword strings.  For example, for
4799     the `Revision' keyword, generate the string `5.7' instead of `$
4800     Revision: 5.7 $'.  This can help generate files in programming
4801     languages where it is hard to strip keyword delimiters like `$
4802     Revision: $' from a string.  However, further keyword substitution
4803     cannot be performed once the keyword names are removed, so this
4804     option should be used with care.
4805
4806     One often would like to use `-kv' with `cvs export'--*note
4807     export::.  But be aware that doesn't handle an export containing
4808     binary files correctly.
4809
4810
4811File: cvs.info,  Node: Configuring keyword expansion,  Next: Log keyword,  Prev: Substitution modes,  Up: Keyword substitution
4812
481312.5 Configuring Keyord Expansion
4814=================================
4815
4816In a repository that includes third-party software on vendor branches,
4817it is sometimes helpful to configure CVS to use a local keyword instead
4818of the standard $ Id$ or $ Header$ keywords. Examples from real projects
4819includ, $ Xorg$, $ XFree86$, $ FreeBSD$, $ NetBSD$, $ OpenBSD$, and even
4820$ dotat$.  The advantage of this is that you can include your local
4821version information in a file using this local keyword (sometimes called
4822a "custom tag" or a "local tag") without disrupting the upstream version
4823information (which may be a different local keyword or a standard
4824keyword). In these cases, it is typically desirable to disable the
4825expansion of all keywords except the configured local keyword.
4826
4827   The `KeywordExpansion' option in the `CVSROOT/config' file is
4828intended to allow for the either the explicit exclusion of a keyword or
4829list of keywords, or for the explicit inclusion of a keyword or a list
4830of keywords. This list may include the `LocalKeyword' that has been
4831configured.
4832
4833   The `KeywordExpansion' option is followed by `=' and the next
4834character may either be `i' to start an inclusion list or `e' to start
4835an exclusion list. If the following lines were added to the
4836`CVSROOT/config' file:
4837
4838             # Add a "MyBSD" keyword and restrict keyword
4839             # expansion
4840             LocalKeyword=MyBSD=CVSHeader
4841             KeywordExpand=iMyBSD
4842
4843   then only the $ MyBSD$ keyword would be expanded.  A list may be
4844used. The this example:
4845
4846             # Add a "MyBSD" keyword and restrict keyword
4847             # expansion to the MyBSD, Name and Date keywords.
4848             LocalKeyword=MyBSD=CVSHeader
4849             KeywordExpand=iMyBSD,Name,Date
4850
4851   would allow $ MyBSD$, $ Name$, and $ Date$ to be expanded.
4852
4853   It is also possible to configure an exclusion list using the
4854following:
4855
4856             # Do not expand the non-RCS keyword CVSHeader
4857             KeywordExpand=eCVSHeader
4858
4859   This allows CVS to ignore the recently introduced $ CVSHeader$
4860keyword and retain all of the others. The exclusion entry could also
4861contain the standard RCS keyword list, but this could be confusing to
4862users that expect RCS keywords to be expanded, so ycare should be taken
4863to properly set user expectations for a repository that is configured in
4864that manner.
4865
4866   If there is a desire to not have any RCS keywords expanded and not
4867use the `-ko' flags everywhere, an administrator may disable all keyword
4868expansion using the `CVSROOT/config' line:
4869
4870     	# Do not expand any RCS keywords
4871     	KeywordExpand=i
4872
4873   this could be confusing to users that expect RCS keywords like $ Id$
4874to be expanded properly, so care should be taken to properly set user
4875expectations for a repository so configured.
4876
4877   It should be noted that a patch to provide both the `KeywordExpand'
4878and `LocalKeyword' features has been around a long time. However, that
4879patch implemented these features using `tag=' and `tagexpand=' keywords
4880and those keywords are NOT recognized.
4881
4882
4883File: cvs.info,  Node: Log keyword,  Prev: Configuring keyword expansion,  Up: Keyword substitution
4884
488512.6 Problems with the $ Log$ keyword.
4886======================================
4887
4888The `$ Log$' keyword is somewhat controversial.  As long as you are
4889working on your development system the information is easily accessible
4890even if you do not use the `$ Log$' keyword--just do a `cvs log'.  Once
4891you export the file the history information might be useless anyhow.
4892
4893   A more serious concern is that CVS is not good at handling `$ Log$'
4894entries when a branch is merged onto the main trunk.  Conflicts often
4895result from the merging operation.
4896
4897   People also tend to "fix" the log entries in the file (correcting
4898spelling mistakes and maybe even factual errors).  If that is done the
4899information from `cvs log' will not be consistent with the information
4900inside the file.  This may or may not be a problem in real life.
4901
4902   It has been suggested that the `$ Log$' keyword should be inserted
4903_last_ in the file, and not in the files header, if it is to be used at
4904all.  That way the long list of change messages will not interfere with
4905everyday source file browsing.
4906
4907
4908File: cvs.info,  Node: Tracking sources,  Next: Builds,  Prev: Keyword substitution,  Up: Top
4909
491013 Tracking third-party sources
4911*******************************
4912
4913If you modify a program to better fit your site, you probably want to
4914include your modifications when the next release of the program arrives.
4915CVS can help you with this task.
4916
4917   In the terminology used in CVS, the supplier of the program is called
4918a "vendor".  The unmodified distribution from the vendor is checked in
4919on its own branch, the "vendor branch".  CVS reserves branch 1.1.1 for
4920this use.
4921
4922   When you modify the source and commit it, your revision will end up
4923on the main trunk.  When a new release is made by the vendor, you commit
4924it on the vendor branch and copy the modifications onto the main trunk.
4925
4926   Use the `import' command to create and update the vendor branch.
4927When you import a new file, the vendor branch is made the `head'
4928revision, so anyone that checks out a copy of the file gets that
4929revision.  When a local modification is committed it is placed on the
4930main trunk, and made the `head' revision.
4931
4932* Menu:
4933
4934* First import::                Importing for the first time
4935* Update imports::              Updating with the import command
4936* Reverting local changes::     Reverting to the latest vendor release
4937* Binary files in imports::     Binary files require special handling
4938* Keywords in imports::         Keyword substitution might be undesirable
4939* Multiple vendor branches::    What if you get sources from several places?
4940
4941
4942File: cvs.info,  Node: First import,  Next: Update imports,  Up: Tracking sources
4943
494413.1 Importing for the first time
4945=================================
4946
4947Use the `import' command to check in the sources for the first time.
4948When you use the `import' command to track third-party sources, the
4949"vendor tag" and "release tags" are useful.  The "vendor tag" is a
4950symbolic name for the branch (which is always 1.1.1, unless you use the
4951`-b BRANCH' flag--see *note Multiple vendor branches::.).  The "release
4952tags" are symbolic names for a particular release, such as `FSF_0_04'.
4953
4954   Note that `import' does _not_ change the directory in which you
4955invoke it.  In particular, it does not set up that directory as a CVS
4956working directory; if you want to work with the sources import them
4957first and then check them out into a different directory (*note Getting
4958the source::).
4959
4960   Suppose you have the sources to a program called `wdiff' in a
4961directory `wdiff-0.04', and are going to make private modifications that
4962you want to be able to use even when new releases are made in the
4963future.  You start by importing the source to your repository:
4964
4965     $ cd wdiff-0.04
4966     $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
4967
4968   The vendor tag is named `FSF_DIST' in the above example, and the only
4969release tag assigned is `WDIFF_0_04'.
4970
4971
4972File: cvs.info,  Node: Update imports,  Next: Reverting local changes,  Prev: First import,  Up: Tracking sources
4973
497413.2 Updating with the import command
4975=====================================
4976
4977When a new release of the source arrives, you import it into the
4978repository with the same `import' command that you used to set up the
4979repository in the first place.  The only difference is that you specify
4980a different release tag this time:
4981
4982     $ tar xfz wdiff-0.05.tar.gz
4983     $ cd wdiff-0.05
4984     $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
4985
4986   For files that have not been modified locally, the newly created
4987revision becomes the head revision.  If you have made local changes,
4988`import' will warn you that you must merge the changes into the main
4989trunk, and tell you to use `checkout -j' to do so:
4990
4991     $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
4992
4993The above command will check out the latest revision of `wdiff', merging
4994the changes made on the vendor branch `FSF_DIST' since yesterday into
4995the working copy.  If any conflicts arise during the merge they should
4996be resolved in the normal way (*note Conflicts example::).  Then, the
4997modified files may be committed.
4998
4999   However, it is much better to use the two release tags rather than
5000using a date on the branch as suggested above:
5001
5002     $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
5003
5004The reason this is better is that using a date, as suggested above,
5005assumes that you do not import more than one release of a product per
5006day.  More importantly, using the release tags allows CVS to detect
5007files that were removed between the two vendor releases and mark them
5008for removal.  Since `import' has no way to detect removed files, you
5009should do a merge like this even if `import' doesn't tell you to.
5010
5011
5012File: cvs.info,  Node: Reverting local changes,  Next: Binary files in imports,  Prev: Update imports,  Up: Tracking sources
5013
501413.3 Reverting to the latest vendor release
5015===========================================
5016
5017You can also revert local changes completely and return to the latest
5018vendor release by changing the `head' revision back to the vendor branch
5019on all files.  For example, if you have a checked-out copy of the
5020sources in `~/work.d/wdiff', and you want to revert to the vendor's
5021version for all the files in that directory, you would type:
5022
5023     $ cd ~/work.d/wdiff
5024     $ cvs admin -bWDIFF .
5025
5026You must specify the `-bWDIFF' without any space after the `-b'.  *Note
5027admin options::.
5028
5029
5030File: cvs.info,  Node: Binary files in imports,  Next: Keywords in imports,  Prev: Reverting local changes,  Up: Tracking sources
5031
503213.4 How to handle binary files with cvs import
5033===============================================
5034
5035Use the `-k' wrapper option to tell import which files are binary.
5036*Note Wrappers::.
5037
5038
5039File: cvs.info,  Node: Keywords in imports,  Next: Multiple vendor branches,  Prev: Binary files in imports,  Up: Tracking sources
5040
504113.5 How to handle keyword substitution with cvs import
5042=======================================================
5043
5044The sources which you are importing may contain keywords (*note Keyword
5045substitution::).  For example, the vendor may use CVS or some other
5046system which uses similar keyword expansion syntax.  If you just import
5047the files in the default fashion, then the keyword expansions supplied
5048by the vendor will be replaced by keyword expansions supplied by your
5049own copy of CVS.  It may be more convenient to maintain the expansions
5050supplied by the vendor, so that this information can supply information
5051about the sources that you imported from the vendor.
5052
5053   To maintain the keyword expansions supplied by the vendor, supply the
5054`-ko' option to `cvs import' the first time you import the file.  This
5055will turn off keyword expansion for that file entirely, so if you want
5056to be more selective you'll have to think about what you want and use
5057the `-k' option to `cvs update' or `cvs admin' as appropriate.
5058
5059
5060File: cvs.info,  Node: Multiple vendor branches,  Prev: Keywords in imports,  Up: Tracking sources
5061
506213.6 Multiple vendor branches
5063=============================
5064
5065All the examples so far assume that there is only one vendor from which
5066you are getting sources.  In some situations you might get sources from
5067a variety of places.  For example, suppose that you are dealing with a
5068project where many different people and teams are modifying the
5069software.  There are a variety of ways to handle this, but in some cases
5070you have a bunch of source trees lying around and what you want to do
5071more than anything else is just to all put them in CVS so that you at
5072least have them in one place.
5073
5074   For handling situations in which there may be more than one vendor,
5075you may specify the `-b' option to `cvs import'.  It takes as an
5076argument the vendor branch to import to.  The default is `-b 1.1.1'.
5077
5078   For example, suppose that there are two teams, the red team and the
5079blue team, that are sending you sources.  You want to import the red
5080team's efforts to branch 1.1.1 and use the vendor tag RED.  You want to
5081import the blue team's efforts to branch 1.1.3 and use the vendor tag
5082BLUE.  So the commands you might use are:
5083
5084     $ cvs import dir RED RED_1-0
5085     $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
5086
5087   Note that if your vendor tag does not match your `-b' option, CVS
5088will not detect this case!  For example,
5089
5090     $ cvs import -b 1.1.3 dir RED RED_1-0
5091
5092Be careful; this kind of mismatch is sure to sow confusion or worse.  I
5093can't think of a useful purpose for the ability to specify a mismatch
5094here, but if you discover such a use, don't.  CVS is likely to make this
5095an error in some future release.
5096
5097
5098File: cvs.info,  Node: Builds,  Next: Special Files,  Prev: Tracking sources,  Up: Top
5099
510014 How your build system interacts with CVS
5101*******************************************
5102
5103As mentioned in the introduction, CVS does not contain software for
5104building your software from source code.  This section describes how
5105various aspects of your build system might interact with CVS.
5106
5107   One common question, especially from people who are accustomed to
5108RCS, is how to make their build get an up to date copy of the sources.
5109The answer to this with CVS is two-fold.  First of all, since CVS itself
5110can recurse through directories, there is no need to modify your
5111`Makefile' (or whatever configuration file your build tool uses) to make
5112sure each file is up to date.  Instead, just use two commands, first
5113`cvs -q update' and then `make' or whatever the command is to invoke
5114your build tool.  Secondly, you do not necessarily _want_ to get a copy
5115of a change someone else made until you have finished your own work.
5116One suggested approach is to first update your sources, then implement,
5117build and test the change you were thinking of, and then commit your
5118sources (updating first if necessary).  By periodically (in between
5119changes, using the approach just described) updating your entire tree,
5120you ensure that your sources are sufficiently up to date.
5121
5122   One common need is to record which versions of which source files
5123went into a particular build.  This kind of functionality is sometimes
5124called "bill of materials" or something similar.  The best way to do
5125this with CVS is to use the `tag' command to record which versions went
5126into a given build (*note Tags::).
5127
5128   Using CVS in the most straightforward manner possible, each developer
5129will have a copy of the entire source tree which is used in a particular
5130build.  If the source tree is small, or if developers are geographically
5131dispersed, this is the preferred solution.  In fact one approach for
5132larger projects is to break a project down into smaller
5133separately-compiled subsystems, and arrange a way of releasing them
5134internally so that each developer need check out only those subsystems
5135which they are actively working on.
5136
5137   Another approach is to set up a structure which allows developers to
5138have their own copies of some files, and for other files to access
5139source files from a central location.  Many people have come up with
5140some such a system using features such as the symbolic link feature
5141found in many operating systems, or the `VPATH' feature found in many
5142versions of `make'.  One build tool which is designed to help with this
5143kind of thing is Odin (see
5144`ftp://ftp.cs.colorado.edu/pub/distribs/odin').
5145
5146
5147File: cvs.info,  Node: Special Files,  Next: CVS commands,  Prev: Builds,  Up: Top
5148
514915 Special Files
5150****************
5151
5152In normal circumstances, CVS works only with regular files.  Every file
5153in a project is assumed to be persistent; it must be possible to open,
5154read and close them; and so on.  CVS also ignores file permissions and
5155ownerships, leaving such issues to be resolved by the developer at
5156installation time.  In other words, it is not possible to "check in" a
5157device into a repository; if the device file cannot be opened, CVS will
5158refuse to handle it.  Files also lose their ownerships and permissions
5159during repository transactions.
5160
5161
5162File: cvs.info,  Node: CVS commands,  Next: Invoking CVS,  Prev: Special Files,  Up: Top
5163
5164Appendix A Guide to CVS commands
5165********************************
5166
5167This appendix describes the overall structure of CVS commands, and
5168describes some commands in detail (others are described elsewhere; for a
5169quick reference to CVS commands, *note Invoking CVS::).
5170
5171* Menu:
5172
5173* Structure::                   Overall structure of CVS commands
5174* Exit status::                 Indicating CVS's success or failure
5175* ~/.cvsrc::                    Default options with the ~/.csvrc file
5176* Global options::              Options you give to the left of cvs_command
5177* Common options::              Options you give to the right of cvs_command
5178* admin::                       Administration
5179* checkout::                    Checkout sources for editing
5180* commit::                      Check files into the repository
5181* diff::                        Show differences between revisions
5182* export::                      Export sources from CVS, similar to checkout
5183* history::                     Show status of files and users
5184* import::                      Import sources into CVS, using vendor branches
5185* log::                         Show log messages for files
5186* rdiff::                       'patch' format diffs between releases
5187* release::                     Indicate that a directory is no longer in use
5188* update::                      Bring work tree in sync with repository
5189
5190
5191File: cvs.info,  Node: Structure,  Next: Exit status,  Up: CVS commands
5192
5193A.1 Overall structure of CVS commands
5194=====================================
5195
5196The overall format of all CVS commands is:
5197
5198     cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
5199
5200`cvs'
5201     The name of the CVS program.
5202
5203`cvs_options'
5204     Some options that affect all sub-commands of CVS.  These are
5205     described below.
5206
5207`cvs_command'
5208     One of several different sub-commands.  Some of the commands have
5209     aliases that can be used instead; those aliases are noted in the
5210     reference manual for that command.  There are only two situations
5211     where you may omit `cvs_command': `cvs -H' elicits a list of
5212     available commands, and `cvs -v' displays version information on
5213     CVS itself.
5214
5215`command_options'
5216     Options that are specific for the command.
5217
5218`command_args'
5219     Arguments to the commands.
5220
5221   There is unfortunately some confusion between `cvs_options' and
5222`command_options'.  `-l', when given as a `cvs_option', only affects
5223some of the commands.  When it is given as a `command_option' is has a
5224different meaning, and is accepted by more commands.  In other words, do
5225not take the above categorization too seriously.  Look at the
5226documentation instead.
5227
5228
5229File: cvs.info,  Node: Exit status,  Next: ~/.cvsrc,  Prev: Structure,  Up: CVS commands
5230
5231A.2 CVS's exit status
5232=====================
5233
5234CVS can indicate to the calling environment whether it succeeded or
5235failed by setting its "exit status".  The exact way of testing the exit
5236status will vary from one operating system to another.  For example in a
5237unix shell script the `$?' variable will be 0 if the last command
5238returned a successful exit status, or greater than 0 if the exit status
5239indicated failure.
5240
5241   If CVS is successful, it returns a successful status; if there is an
5242error, it prints an error message and returns a failure status.  The one
5243exception to this is the `cvs diff' command.  It will return a
5244successful status if it found no differences, or a failure status if
5245there were differences or if there was an error.  Because this behavior
5246provides no good way to detect errors, in the future it is possible that
5247`cvs diff' will be changed to behave like the other CVS commands.
5248
5249
5250File: cvs.info,  Node: ~/.cvsrc,  Next: Global options,  Prev: Exit status,  Up: CVS commands
5251
5252A.3 Default options and the ~/.cvsrc file
5253=========================================
5254
5255There are some `command_options' that are used so often that you might
5256have set up an alias or some other means to make sure you always specify
5257that option.  One example (the one that drove the implementation of the
5258`.cvsrc' support, actually) is that many people find the default output
5259of the `diff' command to be very hard to read, and that either context
5260diffs or unidiffs are much easier to understand.
5261
5262   The `~/.cvsrc' file is a way that you can add default options to
5263`cvs_commands' within cvs, instead of relying on aliases or other shell
5264scripts.
5265
5266   The format of the `~/.cvsrc' file is simple.  The file is searched
5267for a line that begins with the same name as the `cvs_command' being
5268executed.  If a match is found, then the remainder of the line is split
5269up (at whitespace characters) into separate options and added to the
5270command arguments _before_ any options from the command line.
5271
5272   If a command has two names (e.g., `checkout' and `co'), the official
5273name, not necessarily the one used on the command line, will be used to
5274match against the file.  So if this is the contents of the user's
5275`~/.cvsrc' file:
5276
5277     log -N
5278     diff -uN
5279     rdiff -u
5280     update -Pd
5281     checkout -P
5282     release -d
5283
5284the command `cvs checkout foo' would have the `-P' option added to the
5285arguments, as well as `cvs co foo'.
5286
5287   With the example file above, the output from `cvs diff foobar' will
5288be in unidiff format.  `cvs diff -c foobar' will provide context diffs,
5289as usual.  Getting "old" format diffs would be slightly more
5290complicated, because `diff' doesn't have an option to specify use of the
5291"old" format, so you would need `cvs -f diff foobar'.
5292
5293   In place of the command name you can use `cvs' to specify global
5294options (*note Global options::).  For example the following line in
5295`.cvsrc'
5296
5297     cvs -z6
5298
5299causes CVS to use compression level 6.
5300
5301
5302File: cvs.info,  Node: Global options,  Next: Common options,  Prev: ~/.cvsrc,  Up: CVS commands
5303
5304A.4 Global options
5305==================
5306
5307The available `cvs_options' (that are given to the left of
5308`cvs_command') are:
5309
5310`--allow-root=ROOTDIR'
5311     Specify legal CVSROOT directory.  See *note Password authentication
5312     server::.
5313
5314`-a'
5315     Authenticate all communication between the client and the server.
5316     Only has an effect on the CVS client.  As of this writing, this is
5317     only implemented when using a GSSAPI connection (*note GSSAPI
5318     authenticated::).  Authentication prevents certain sorts of attacks
5319     involving hijacking the active TCP connection.  Enabling
5320     authentication does not enable encryption.
5321
5322`-b BINDIR'
5323     In CVS 1.9.18 and older, this specified that RCS programs are in
5324     the BINDIR directory.  Current versions of CVS do not run RCS
5325     programs; for compatibility this option is accepted, but it does
5326     nothing.
5327
5328`-T TEMPDIR'
5329     Use TEMPDIR as the directory where temporary files are located.
5330     Overrides the setting of the `$TMPDIR' environment variable and any
5331     precompiled directory.  This parameter should be specified as an
5332     absolute pathname.  (When running client/server, `-T' affects only
5333     the local process; specifying `-T' for the client has no effect on
5334     the server and vice versa.)
5335
5336`-d CVS_ROOT_DIRECTORY'
5337     Use CVS_ROOT_DIRECTORY as the root directory pathname of the
5338     repository.  Overrides the setting of the `$CVSROOT' environment
5339     variable.  *Note Repository::.
5340
5341`-e EDITOR'
5342     Use EDITOR to enter revision log information.  Overrides the
5343     setting of the `$CVSEDITOR' and `$EDITOR' environment variables.
5344     For more information, see *note Committing your changes::.
5345
5346`-f'
5347     Do not read the `~/.cvsrc' file.  This option is most often used
5348     because of the non-orthogonality of the CVS option set.  For
5349     example, the `cvs log' option `-N' (turn off display of tag names)
5350     does not have a corresponding option to turn the display on.  So if
5351     you have `-N' in the `~/.cvsrc' entry for `log', you may need to
5352     use `-f' to show the tag names.
5353
5354`-H'
5355`--help'
5356     Display usage information about the specified `cvs_command' (but do
5357     not actually execute the command).  If you don't specify a command
5358     name, `cvs -H' displays overall help for CVS, including a list of
5359     other help options.
5360
5361`-l'
5362     Do not log the `cvs_command' in the command history (but execute it
5363     anyway).  *Note history::, for information on command history.
5364
5365`-R'
5366     Turns on read-only repository mode.  This allows one to check out
5367     from a read-only repository, such as within an anoncvs server, or
5368     from a CDROM repository.
5369
5370     Same effect as if the `CVSREADONLYFS' environment variable is set.
5371     Using `-R' can also considerably speed up checkout's over NFS.
5372
5373`-n'
5374     Do not change any files.  Attempt to execute the `cvs_command', but
5375     only to issue reports; do not remove, update, or merge any existing
5376     files, or create any new files.
5377
5378     Note that CVS will not necessarily produce exactly the same output
5379     as without `-n'.  In some cases the output will be the same, but in
5380     other cases CVS will skip some of the processing that would have
5381     been required to produce the exact same output.
5382
5383`-Q'
5384     Cause the command to be really quiet; the command will only
5385     generate output for serious problems.
5386
5387`-q'
5388     Cause the command to be somewhat quiet; informational messages,
5389     such as reports of recursion through subdirectories, are
5390     suppressed.
5391
5392`-r'
5393     Make new working files read-only.  Same effect as if the `$CVSREAD'
5394     environment variable is set (*note Environment variables::).  The
5395     default is to make working files writable, unless watches are on
5396     (*note Watches::).
5397
5398`-s VARIABLE=VALUE'
5399     Set a user variable (*note Variables::).
5400
5401`-t'
5402     Trace program execution; display messages showing the steps of CVS
5403     activity.  Particularly useful with `-n' to explore the potential
5404     impact of an unfamiliar command.
5405
5406`-v'
5407
5408`--version'
5409     Display version and copyright information for CVS.
5410
5411`-w'
5412     Make new working files read-write.  Overrides the setting of the
5413     `$CVSREAD' environment variable.  Files are created read-write by
5414     default, unless `$CVSREAD' is set or `-r' is given.
5415
5416`-x'
5417     Encrypt all communication between the client and the server.  Only
5418     has an effect on the CVS client.  As of this writing, this is only
5419     implemented when using a GSSAPI connection (*note GSSAPI
5420     authenticated::) or a Kerberos connection (*note Kerberos
5421     authenticated::).  Enabling encryption implies that message traffic
5422     is also authenticated.  Encryption support is not available by
5423     default; it must be enabled using a special configure option,
5424     `--enable-encryption', when you build CVS.
5425
5426`-z GZIP-LEVEL'
5427     Set the compression level.  Valid levels are 1 (high speed, low
5428     compression) to 9 (low speed, high compression), or 0 to disable
5429     compression (the default).  Only has an effect on the CVS client.
5430
5431
5432File: cvs.info,  Node: Common options,  Next: admin,  Prev: Global options,  Up: CVS commands
5433
5434A.5 Common command options
5435==========================
5436
5437This section describes the `command_options' that are available across
5438several CVS commands.  These options are always given to the right of
5439`cvs_command'. Not all commands support all of these options; each
5440option is only supported for commands where it makes sense.  However,
5441when a command has one of these options you can almost always count on
5442the same behavior of the option as in other commands.  (Other command
5443options, which are listed with the individual commands, may have
5444different behavior from one CVS command to the other).
5445
5446   *Note: the `history' command is an exception; it supports many
5447options that conflict even with these standard options.*
5448
5449`-D DATE_SPEC'
5450     Use the most recent revision no later than DATE_SPEC.  DATE_SPEC is
5451     a single argument, a date description specifying a date in the
5452     past.
5453
5454     The specification is "sticky" when you use it to make a private
5455     copy of a source file; that is, when you get a working file using
5456     `-D', CVS records the date you specified, so that further updates
5457     in the same directory will use the same date (for more information
5458     on sticky tags/dates, *note Sticky tags::).
5459
5460     `-D' is available with the `annotate', `checkout', `diff',
5461     `export', `history', `rdiff', `rtag', `tag', and `update' commands.
5462     (The `history' command uses this option in a slightly different
5463     way; *note history options::).
5464
5465     A wide variety of date formats are supported by CVS.  The most
5466     standard ones are ISO8601 (from the International Standards
5467     Organization) and the Internet e-mail standard (specified in RFC822
5468     as amended by RFC1123).
5469
5470     ISO8601 dates have many variants but a few examples are:
5471
5472          1972-09-24
5473          1972-09-24 20:05
5474
5475     There are a lot more ISO8601 date formats, and CVS accepts many of
5476     them, but you probably don't want to hear the _whole_ long story
5477     :-).
5478
5479     In addition to the dates allowed in Internet e-mail itself, CVS
5480     also allows some of the fields to be omitted.  For example:
5481
5482          24 Sep 1972 20:05
5483          24 Sep
5484
5485     The date is interpreted as being in the local timezone, unless a
5486     specific timezone is specified.
5487
5488     These two date formats are preferred.  However, CVS currently
5489     accepts a wide variety of other date formats.  They are
5490     intentionally not documented here in any detail, and future
5491     versions of CVS might not accept all of them.
5492
5493     One such format is `MONTH/DAY/YEAR'.  This may confuse people who
5494     are accustomed to having the month and day in the other order;
5495     `1/4/96' is January 4, not April 1.
5496
5497     Remember to quote the argument to the `-D' flag so that your shell
5498     doesn't interpret spaces as argument separators.  A command using
5499     the `-D' flag can look like this:
5500
5501          $ cvs diff -D "1 hour ago" cvs.texinfo
5502
5503`-f'
5504     When you specify a particular date or tag to CVS commands, they
5505     normally ignore files that do not contain the tag (or did not exist
5506     prior to the date) that you specified.  Use the `-f' option if you
5507     want files retrieved even when there is no match for the tag or
5508     date.  (The most recent revision of the file will be used).
5509
5510     Note that even with `-f', a tag that you specify must exist (that
5511     is, in some file, not necessary in every file).  This is so that
5512     CVS will continue to give an error if you mistype a tag name.
5513
5514     `-f' is available with these commands: `annotate', `checkout',
5515     `export', `rdiff', `rtag', and `update'.
5516
5517     *WARNING:  The `commit' and `remove' commands also have a `-f'
5518     option, but it has a different behavior for those commands.  See
5519     *note commit options::, and *note Removing files::.*
5520
5521`-k KFLAG'
5522     Override the default processing of RCS keywords other than `-kb'.
5523     *Note Keyword substitution::, for the meaning of KFLAG.  Used with
5524     the `checkout' and `update' commands, your KFLAG specification is
5525     "sticky"; that is, when you use this option with a `checkout' or
5526     `update' command, CVS associates your selected KFLAG with any files
5527     it operates on, and continues to use that KFLAG with future
5528     commands on the same files until you specify otherwise.
5529
5530     The `-k' option is available with the `add', `checkout', `diff',
5531     `export', `import' and `update' commands.
5532
5533     *WARNING: Prior to CVS version 1.12.2, the `-k' flag overrode the
5534     `-kb' indication for a binary file.  This could sometimes corrupt
5535     binary files.  *Note Merging and keywords::, for more.*
5536
5537`-l'
5538     Local; run only in current working directory, rather than recursing
5539     through subdirectories.
5540
5541     Available with the following commands: `annotate', `checkout',
5542     `commit', `diff', `edit', `editors', `export', `log', `rdiff',
5543     `remove', `rtag', `status', `tag', `unedit', `update', `watch', and
5544     `watchers'.
5545
5546`-m MESSAGE'
5547     Use MESSAGE as log information, instead of invoking an editor.
5548
5549     Available with the following commands: `add', `commit' and
5550     `import'.
5551
5552`-n'
5553     Do not run any tag program.  (A program can be specified to run in
5554     the modules database (*note modules::); this option bypasses it).
5555
5556     *Note: this is not the same as the `cvs -n' program option, which
5557     you can specify to the left of a cvs command!*
5558
5559     Available with the `checkout', `commit', `export', and `rtag'
5560     commands.
5561
5562`-P'
5563     Prune empty directories.  See *note Removing directories::.
5564
5565`-p'
5566     Pipe the files retrieved from the repository to standard output,
5567     rather than writing them in the current directory.  Available with
5568     the `checkout' and `update' commands.
5569
5570`-R'
5571     Process directories recursively.  This is on by default.
5572
5573     Available with the following commands: `annotate', `checkout',
5574     `commit', `diff', `edit', `editors', `export', `rdiff', `remove',
5575     `rtag', `status', `tag', `unedit', `update', `watch', and
5576     `watchers'.
5577
5578`-r TAG'
5579     Use the revision specified by the TAG argument instead of the
5580     default "head" revision.  As well as arbitrary tags defined with
5581     the `tag' or `rtag' command, two special tags are always available:
5582     `HEAD' refers to the most recent version available in the
5583     repository, and `BASE' refers to the revision you last checked out
5584     into the current working directory.
5585
5586     The tag specification is sticky when you use this with `checkout'
5587     or `update' to make your own copy of a file: CVS remembers the tag
5588     and continues to use it on future update commands, until you
5589     specify otherwise (for more information on sticky tags/dates, *note
5590     Sticky tags::).
5591
5592     The tag can be either a symbolic or numeric tag, as described in
5593     *note Tags::, or the name of a branch, as described in *note
5594     Branching and merging::.
5595
5596     Specifying the `-q' global option along with the `-r' command
5597     option is often useful, to suppress the warning messages when the
5598     RCS file does not contain the specified tag.
5599
5600     *Note: this is not the same as the overall `cvs -r' option, which
5601     you can specify to the left of a CVS command!*
5602
5603     `-r' is available with the `checkout', `commit', `diff', `history',
5604     `export', `rdiff', `rtag', and `update' commands.
5605
5606`-W'
5607     Specify file names that should be filtered.  You can use this
5608     option repeatedly.  The spec can be a file name pattern of the same
5609     type that you can specify in the `.cvswrappers' file.  Available
5610     with the following commands: `import', and `update'.
5611
5612
5613File: cvs.info,  Node: admin,  Next: checkout,  Prev: Common options,  Up: CVS commands
5614
5615A.6 admin--Administration
5616=========================
5617
5618   * Requires: repository, working directory.
5619
5620   * Changes: repository.
5621
5622   * Synonym: rcs
5623
5624   This is the CVS interface to assorted administrative facilities.
5625Some of them have questionable usefulness for CVS but exist for
5626historical purposes.  Some of the questionable options are likely to
5627disappear in the future.  This command _does_ work recursively, so
5628extreme care should be used.
5629
5630   On unix, if there is a group named `cvsadmin', only members of that
5631group can run `cvs admin' commands, except for those specified using the
5632`UserAdminOptions' configuration option in the `CVSROOT/config' file.
5633Options specified using `UserAdminOptions' can be run by any user.  See
5634*note config:: for more on `UserAdminOptions'.
5635
5636   The `cvsadmin' group should exist on the server, or any system
5637running the non-client/server CVS.  To disallow `cvs admin' for all
5638users, create a group with no users in it.  On NT, the `cvsadmin'
5639feature does not exist and all users can run `cvs admin'.
5640
5641* Menu:
5642
5643* admin options::               admin options
5644
5645
5646File: cvs.info,  Node: admin options,  Up: admin
5647
5648A.6.1 admin options
5649-------------------
5650
5651Some of these options have questionable usefulness for CVS but exist for
5652historical purposes.  Some even make it impossible to use CVS until you
5653undo the effect!
5654
5655`-AOLDFILE'
5656     Might not work together with CVS.  Append the access list of
5657     OLDFILE to the access list of the RCS file.
5658
5659`-aLOGINS'
5660     Might not work together with CVS.  Append the login names appearing
5661     in the comma-separated list LOGINS to the access list of the RCS
5662     file.
5663
5664`-b[REV]'
5665     Set the default branch to REV.  In CVS, you normally do not
5666     manipulate default branches; sticky tags (*note Sticky tags::) are
5667     a better way to decide which branch you want to work on.  There is
5668     one reason to run `cvs admin -b': to revert to the vendor's version
5669     when using vendor branches (*note Reverting local changes::).
5670     There can be no space between `-b' and its argument.
5671
5672`-cSTRING'
5673     Sets the comment leader to STRING.  The comment leader is not used
5674     by current versions of CVS or RCS 5.7.  Therefore, you can almost
5675     surely not worry about it.  *Note Keyword substitution::.
5676
5677`-e[LOGINS]'
5678     Might not work together with CVS.  Erase the login names appearing
5679     in the comma-separated list LOGINS from the access list of the RCS
5680     file.  If LOGINS is omitted, erase the entire access list.  There
5681     can be no space between `-e' and its argument.
5682
5683`-I'
5684     Run interactively, even if the standard input is not a terminal.
5685     This option does not work with the client/server CVS and is likely
5686     to disappear in a future release of CVS.
5687
5688`-i'
5689     Useless with CVS.  This creates and initializes a new RCS file,
5690     without depositing a revision.  With CVS, add files with the `cvs
5691     add' command (*note Adding files::).
5692
5693`-kSUBST'
5694     Set the default keyword substitution to SUBST.  *Note Keyword
5695     substitution::.  Giving an explicit `-k' option to `cvs update',
5696     `cvs export', or `cvs checkout' overrides this default.
5697
5698`-l[REV]'
5699     Lock the revision with number REV.  If a branch is given, lock the
5700     latest revision on that branch.  If REV is omitted, lock the latest
5701     revision on the default branch.  There can be no space between `-l'
5702     and its argument.
5703
5704     This can be used in conjunction with the `rcslock.pl' script in the
5705     `contrib' directory of the CVS source distribution to provide
5706     reserved checkouts (where only one user can be editing a given file
5707     at a time).  See the comments in that file for details (and see the
5708     `README' file in that directory for disclaimers about the
5709     unsupported nature of contrib).  According to comments in that
5710     file, locking must set to strict (which is the default).
5711
5712`-L'
5713     Set locking to strict.  Strict locking means that the owner of an
5714     RCS file is not exempt from locking for checkin.  For use with CVS,
5715     strict locking must be set; see the discussion under the `-l'
5716     option above.
5717
5718`-mREV:MSG'
5719     Replace the log message of revision REV with MSG.
5720
5721`-NNAME[:[REV]]'
5722     Act like `-n', except override any previous assignment of NAME.
5723     For use with magic branches, see *note Magic branch numbers::.
5724
5725`-nNAME[:[REV]]'
5726     Associate the symbolic name NAME with the branch or revision REV.
5727     It is normally better to use `cvs tag' or `cvs rtag' instead.
5728     Delete the symbolic name if both `:' and REV are omitted;
5729     otherwise, print an error message if NAME is already associated
5730     with another number.  If REV is symbolic, it is expanded before
5731     association.  A REV consisting of a branch number followed by a `.'
5732     stands for the current latest revision in the branch.  A `:' with
5733     an empty REV stands for the current latest revision on the default
5734     branch, normally the trunk.  For example, `cvs admin -nNAME:'
5735     associates NAME with the current latest revision of all the RCS
5736     files; this contrasts with `cvs admin -nNAME:$' which associates
5737     NAME with the revision numbers extracted from keyword strings in
5738     the corresponding working files.
5739
5740`-oRANGE'
5741     Deletes ("outdates") the revisions given by RANGE.
5742
5743     Note that this command can be quite dangerous unless you know
5744     _exactly_ what you are doing (for example see the warnings below
5745     about how the REV1:REV2 syntax is confusing).
5746
5747     If you are short on disc this option might help you.  But think
5748     twice before using it--there is no way short of restoring the
5749     latest backup to undo this command!  If you delete different
5750     revisions than you planned, either due to carelessness or (heaven
5751     forbid) a CVS bug, there is no opportunity to correct the error
5752     before the revisions are deleted.  It probably would be a good idea
5753     to experiment on a copy of the repository first.
5754
5755     Specify RANGE in one of the following ways:
5756
5757     `REV1::REV2'
5758          Collapse all revisions between rev1 and rev2, so that CVS only
5759          stores the differences associated with going from rev1 to
5760          rev2, not intermediate steps.  For example, after `-o
5761          1.3::1.5' one can retrieve revision 1.3, revision 1.5, or the
5762          differences to get from 1.3 to 1.5, but not the revision 1.4,
5763          or the differences between 1.3 and 1.4.  Other examples: `-o
5764          1.3::1.4' and `-o 1.3::1.3' have no effect, because there are
5765          no intermediate revisions to remove.
5766
5767     `::REV'
5768          Collapse revisions between the beginning of the branch
5769          containing REV and REV itself.  The branchpoint and REV are
5770          left intact.  For example, `-o ::1.3.2.6' deletes revision
5771          1.3.2.1, revision 1.3.2.5, and everything in between, but
5772          leaves 1.3 and 1.3.2.6 intact.
5773
5774     `REV::'
5775          Collapse revisions between REV and the end of the branch
5776          containing REV.  Revision REV is left intact but the head
5777          revision is deleted.
5778
5779     `REV'
5780          Delete the revision REV.  For example, `-o 1.3' is equivalent
5781          to `-o 1.2::1.4'.
5782
5783     `REV1:REV2'
5784          Delete the revisions from REV1 to REV2, inclusive, on the same
5785          branch.  One will not be able to retrieve REV1 or REV2 or any
5786          of the revisions in between.  For example, the command `cvs
5787          admin -oR_1_01:R_1_02 .' is rarely useful.  It means to delete
5788          revisions up to, and including, the tag R_1_02.  But beware!
5789          If there are files that have not changed between R_1_02 and
5790          R_1_03 the file will have _the same_ numerical revision number
5791          assigned to the tags R_1_02 and R_1_03.  So not only will it
5792          be impossible to retrieve R_1_02; R_1_03 will also have to be
5793          restored from the tapes!  In most cases you want to specify
5794          REV1::REV2 instead.
5795
5796     `:REV'
5797          Delete revisions from the beginning of the branch containing
5798          REV up to and including REV.
5799
5800     `REV:'
5801          Delete revisions from revision REV, including REV itself, to
5802          the end of the branch containing REV.
5803
5804     None of the revisions to be deleted may have branches or locks.
5805
5806     If any of the revisions to be deleted have symbolic names, and one
5807     specifies one of the `::' syntaxes, then CVS will give an error and
5808     not delete any revisions.  If you really want to delete both the
5809     symbolic names and the revisions, first delete the symbolic names
5810     with `cvs tag -d', then run `cvs admin -o'.  If one specifies the
5811     non-`::' syntaxes, then CVS will delete the revisions but leave the
5812     symbolic names pointing to nonexistent revisions.  This behavior is
5813     preserved for compatibility with previous versions of CVS, but
5814     because it isn't very useful, in the future it may change to be
5815     like the `::' case.
5816
5817     Due to the way CVS handles branches REV cannot be specified
5818     symbolically if it is a branch.  *Note Magic branch numbers::, for
5819     an explanation.
5820
5821     Make sure that no-one has checked out a copy of the revision you
5822     outdate.  Strange things will happen if he starts to edit it and
5823     tries to check it back in.  For this reason, this option is not a
5824     good way to take back a bogus commit; commit a new revision undoing
5825     the bogus change instead (*note Merging two revisions::).
5826
5827`-q'
5828     Run quietly; do not print diagnostics.
5829
5830`-sSTATE[:REV]'
5831     Useful with CVS.  Set the state attribute of the revision REV to
5832     STATE.  If REV is a branch number, assume the latest revision on
5833     that branch.  If REV is omitted, assume the latest revision on the
5834     default branch.  Any identifier is acceptable for STATE.  A useful
5835     set of states is `Exp' (for experimental), `Stab' (for stable), and
5836     `Rel' (for released).  By default, the state of a new revision is
5837     set to `Exp' when it is created.  The state is visible in the
5838     output from CVS LOG (*note log::), and in the `$ Log$' and `$
5839     State$' keywords (*note Keyword substitution::).  Note that CVS
5840     uses the `dead' state for its own purposes; to take a file to or
5841     from the `dead' state use commands like `cvs remove' and `cvs add',
5842     not `cvs admin -s'.
5843
5844`-t[FILE]'
5845     Useful with CVS.  Write descriptive text from the contents of the
5846     named FILE into the RCS file, deleting the existing text.  The FILE
5847     pathname may not begin with `-'.  The descriptive text can be seen
5848     in the output from `cvs log' (*note log::).  There can be no space
5849     between `-t' and its argument.
5850
5851     If FILE is omitted, obtain the text from standard input, terminated
5852     by end-of-file or by a line containing `.' by itself.  Prompt for
5853     the text if interaction is possible; see `-I'.
5854
5855`-t-STRING'
5856     Similar to `-tFILE'. Write descriptive text from the STRING into
5857     the RCS file, deleting the existing text.  There can be no space
5858     between `-t' and its argument.
5859
5860`-U'
5861     Set locking to non-strict.  Non-strict locking means that the owner
5862     of a file need not lock a revision for checkin.  For use with CVS,
5863     strict locking must be set; see the discussion under the `-l'
5864     option above.
5865
5866`-u[REV]'
5867     See the option `-l' above, for a discussion of using this option
5868     with CVS.  Unlock the revision with number REV.  If a branch is
5869     given, unlock the latest revision on that branch.  If REV is
5870     omitted, remove the latest lock held by the caller.  Normally, only
5871     the locker of a revision may unlock it; somebody else unlocking a
5872     revision breaks the lock.  This causes the original locker to be
5873     sent a `commit' notification (*note Getting Notified::).  There can
5874     be no space between `-u' and its argument.
5875
5876`-VN'
5877     In previous versions of CVS, this option meant to write an RCS file
5878     which would be acceptable to RCS version N, but it is now obsolete
5879     and specifying it will produce an error.
5880
5881`-xSUFFIXES'
5882     In previous versions of CVS, this was documented as a way of
5883     specifying the names of the RCS files.  However, CVS has always
5884     required that the RCS files used by CVS end in `,v', so this option
5885     has never done anything useful.
5886
5887
5888File: cvs.info,  Node: checkout,  Next: commit,  Prev: admin,  Up: CVS commands
5889
5890A.7 checkout--Check out sources for editing
5891===========================================
5892
5893   * Synopsis: checkout [options] modules...
5894
5895   * Requires: repository.
5896
5897   * Changes: working directory.
5898
5899   * Synonyms: co, get
5900
5901   Create or update a working directory containing copies of the source
5902files specified by MODULES.  You must execute `checkout' before using
5903most of the other CVS commands, since most of them operate on your
5904working directory.
5905
5906   The MODULES are either symbolic names for some collection of source
5907directories and files, or paths to directories or files in the
5908repository.  The symbolic names are defined in the `modules' file.
5909*Note modules::.
5910
5911   Depending on the modules you specify, `checkout' may recursively
5912create directories and populate them with the appropriate source files.
5913You can then edit these source files at any time (regardless of whether
5914other software developers are editing their own copies of the sources);
5915update them to include new changes applied by others to the source
5916repository; or commit your work as a permanent change to the source
5917repository.
5918
5919   Note that `checkout' is used to create directories.  The top-level
5920directory created is always added to the directory where `checkout' is
5921invoked, and usually has the same name as the specified module.  In the
5922case of a module alias, the created sub-directory may have a different
5923name, but you can be sure that it will be a sub-directory, and that
5924`checkout' will show the relative path leading to each file as it is
5925extracted into your private work area (unless you specify the `-Q'
5926global option).
5927
5928   The files created by `checkout' are created read-write, unless the
5929`-r' option to CVS (*note Global options::) is specified, the `CVSREAD'
5930environment variable is specified (*note Environment variables::), or a
5931watch is in effect for that file (*note Watches::).
5932
5933   Note that running `checkout' on a directory that was already built by
5934a prior `checkout' is also permitted.  This is similar to specifying the
5935`-d' option to the `update' command in the sense that new directories
5936that have been created in the repository will appear in your work area.
5937However, `checkout' takes a module name whereas `update' takes a
5938directory name.  Also to use `checkout' this way it must be run from the
5939top level directory (where you originally ran `checkout' from), so
5940before you run `checkout' to update an existing directory, don't forget
5941to change your directory to the top level directory.
5942
5943   For the output produced by the `checkout' command see *note update
5944output::.
5945
5946* Menu:
5947
5948* checkout options::            checkout options
5949* checkout examples::           checkout examples
5950
5951
5952File: cvs.info,  Node: checkout options,  Next: checkout examples,  Up: checkout
5953
5954A.7.1 checkout options
5955----------------------
5956
5957These standard options are supported by `checkout' (*note Common
5958options::, for a complete description of them):
5959
5960`-D DATE'
5961     Use the most recent revision no later than DATE.  This option is
5962     sticky, and implies `-P'.  See *note Sticky tags::, for more
5963     information on sticky tags/dates.
5964
5965`-f'
5966     Only useful with the `-D DATE' or `-r TAG' flags.  If no matching
5967     revision is found, retrieve the most recent revision (instead of
5968     ignoring the file).
5969
5970`-k KFLAG'
5971     Process keywords according to KFLAG.  See *note Keyword
5972     substitution::.  This option is sticky; future updates of this file
5973     in this working directory will use the same KFLAG.  The `status'
5974     command can be viewed to see the sticky options.  See *note
5975     Invoking CVS::, for more information on the `status' command.
5976
5977`-l'
5978     Local; run only in current working directory.
5979
5980`-n'
5981     Do not run any checkout program (as specified with the `-o' option
5982     in the modules file; *note modules::).
5983
5984`-P'
5985     Prune empty directories.  See *note Moving directories::.
5986
5987`-p'
5988     Pipe files to the standard output.
5989
5990`-R'
5991     Checkout directories recursively.  This option is on by default.
5992
5993`-r TAG'
5994     Use revision TAG.  This option is sticky, and implies `-P'.  See
5995     *note Sticky tags::, for more information on sticky tags/dates.
5996
5997   In addition to those, you can use these special command options with
5998`checkout':
5999
6000`-A'
6001     Reset any sticky tags, dates, or `-k' options.  See *note Sticky
6002     tags::, for more information on sticky tags/dates.
6003
6004`-c'
6005     Copy the module file, sorted, to the standard output, instead of
6006     creating or modifying any files or directories in your working
6007     directory.
6008
6009`-d DIR'
6010     Create a directory called DIR for the working files, instead of
6011     using the module name.  In general, using this flag is equivalent
6012     to using `mkdir DIR; cd DIR' followed by the checkout command
6013     without the `-d' flag.
6014
6015     There is an important exception, however.  It is very convenient
6016     when checking out a single item to have the output appear in a
6017     directory that doesn't contain empty intermediate directories.  In
6018     this case _only_, CVS tries to "shorten" pathnames to avoid those
6019     empty directories.
6020
6021     For example, given a module `foo' that contains the file `bar.c',
6022     the command `cvs co -d dir foo' will create directory `dir' and
6023     place `bar.c' inside.  Similarly, given a module `bar' which has
6024     subdirectory `baz' wherein there is a file `quux.c', the command
6025     `cvs co -d dir bar/baz' will create directory `dir' and place
6026     `quux.c' inside.
6027
6028     Using the `-N' flag will defeat this behavior.  Given the same
6029     module definitions above, `cvs co -N -d dir foo' will create
6030     directories `dir/foo' and place `bar.c' inside, while `cvs co -N -d
6031     dir bar/baz' will create directories `dir/bar/baz' and place
6032     `quux.c' inside.
6033
6034`-j TAG'
6035     With two `-j' options, merge changes from the revision specified
6036     with the first `-j' option to the revision specified with the
6037     second `j' option, into the working directory.
6038
6039     With one `-j' option, merge changes from the ancestor revision to
6040     the revision specified with the `-j' option, into the working
6041     directory.  The ancestor revision is the common ancestor of the
6042     revision which the working directory is based on, and the revision
6043     specified in the `-j' option.
6044
6045     In addition, each -j option can contain an optional date
6046     specification which, when used with branches, can limit the chosen
6047     revision to one within a specific date.  An optional date is
6048     specified by adding a colon (:) to the tag:
6049     `-jSYMBOLIC_TAG:DATE_SPECIFIER'.
6050
6051     *Note Branching and merging::.
6052
6053`-N'
6054     Only useful together with `-d DIR'.  With this option, CVS will not
6055     "shorten" module paths in your working directory when you check out
6056     a single module.  See the `-d' flag for examples and a discussion.
6057
6058`-s'
6059     Like `-c', but include the status of all modules, and sort it by
6060     the status string.  *Note modules::, for info about the `-s' option
6061     that is used inside the modules file to set the module status.
6062
6063
6064File: cvs.info,  Node: checkout examples,  Prev: checkout options,  Up: checkout
6065
6066A.7.2 checkout examples
6067-----------------------
6068
6069Get a copy of the module `tc':
6070
6071     $ cvs checkout tc
6072
6073   Get a copy of the module `tc' as it looked one day ago:
6074
6075     $ cvs checkout -D yesterday tc
6076
6077
6078File: cvs.info,  Node: commit,  Next: diff,  Prev: checkout,  Up: CVS commands
6079
6080A.8 commit--Check files into the repository
6081===========================================
6082
6083   * Synopsis: commit [-lnRf] [-m 'log_message' | -F file] [-r revision]
6084     [files...]
6085
6086   * Requires: working directory, repository.
6087
6088   * Changes: repository.
6089
6090   * Synonym: ci
6091
6092   Use `commit' when you want to incorporate changes from your working
6093source files into the source repository.
6094
6095   If you don't specify particular files to commit, all of the files in
6096your working current directory are examined.  `commit' is careful to
6097change in the repository only those files that you have really changed.
6098By default (or if you explicitly specify the `-R' option), files in
6099subdirectories are also examined and committed if they have changed; you
6100can use the `-l' option to limit `commit' to the current directory only.
6101
6102   `commit' verifies that the selected files are up to date with the
6103current revisions in the source repository; it will notify you, and exit
6104without committing, if any of the specified files must be made current
6105first with `update' (*note update::).  `commit' does not call the
6106`update' command for you, but rather leaves that for you to do when the
6107time is right.
6108
6109   When all is well, an editor is invoked to allow you to enter a log
6110message that will be written to one or more logging programs (*note
6111modules::, and *note loginfo::) and placed in the RCS file inside the
6112repository.  This log message can be retrieved with the `log' command;
6113see *note log::.  You can specify the log message on the command line
6114with the `-m MESSAGE' option, and thus avoid the editor invocation, or
6115use the `-F FILE' option to specify that the argument file contains the
6116log message.
6117
6118* Menu:
6119
6120* commit options::              commit options
6121* commit examples::             commit examples
6122
6123
6124File: cvs.info,  Node: commit options,  Next: commit examples,  Up: commit
6125
6126A.8.1 commit options
6127--------------------
6128
6129These standard options are supported by `commit' (*note Common
6130options::, for a complete description of them):
6131
6132`-l'
6133     Local; run only in current working directory.
6134
6135`-R'
6136     Commit directories recursively.  This is on by default.
6137
6138`-r REVISION'
6139     Commit to REVISION.  REVISION must be either a branch, or a
6140     revision on the main trunk that is higher than any existing
6141     revision number (*note Assigning revisions::).  You cannot commit
6142     to a specific revision on a branch.
6143
6144   `commit' also supports these options:
6145
6146`-F FILE'
6147     Read the log message from FILE, instead of invoking an editor.
6148
6149`-f'
6150     Note that this is not the standard behavior of the `-f' option as
6151     defined in *note Common options::.
6152
6153     Force CVS to commit a new revision even if you haven't made any
6154     changes to the file.  If the current revision of FILE is 1.7, then
6155     the following two commands are equivalent:
6156
6157          $ cvs commit -f FILE
6158          $ cvs commit -r 1.8 FILE
6159
6160     The `-f' option disables recursion (i.e., it implies `-l').  To
6161     force CVS to commit a new revision for all files in all
6162     subdirectories, you must use `-f -R'.
6163
6164`-m MESSAGE'
6165     Use MESSAGE as the log message, instead of invoking an editor.
6166
6167
6168File: cvs.info,  Node: commit examples,  Prev: commit options,  Up: commit
6169
6170A.8.2 commit examples
6171---------------------
6172
6173A.8.2.1 Committing to a branch
6174..............................
6175
6176You can commit to a branch revision (one that has an even number of
6177dots) with the `-r' option.  To create a branch revision, use the `-b'
6178option of the `rtag' or `tag' commands (*note Branching and merging::).
6179Then, either `checkout' or `update' can be used to base your sources on
6180the newly created branch.  From that point on, all `commit' changes made
6181within these working sources will be automatically added to a branch
6182revision, thereby not disturbing main-line development in any way.  For
6183example, if you had to create a patch to the 1.2 version of the product,
6184even though the 2.0 version is already under development, you might do:
6185
6186     $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
6187     $ cvs checkout -r FCS1_2_Patch product_module
6188     $ cd product_module
6189     [[ hack away ]]
6190     $ cvs commit
6191
6192This works automatically since the `-r' option is sticky.
6193
6194A.8.2.2 Creating the branch after editing
6195.........................................
6196
6197Say you have been working on some extremely experimental software, based
6198on whatever revision you happened to checkout last week.  If others in
6199your group would like to work on this software with you, but without
6200disturbing main-line development, you could commit your change to a new
6201branch.  Others can then checkout your experimental stuff and utilize
6202the full benefit of CVS conflict resolution.  The scenario might look
6203like:
6204
6205     [[ hacked sources are present ]]
6206     $ cvs tag -b EXPR1
6207     $ cvs update -r EXPR1
6208     $ cvs commit
6209
6210   The `update' command will make the `-r EXPR1' option sticky on all
6211files.  Note that your changes to the files will never be removed by the
6212`update' command.  The `commit' will automatically commit to the correct
6213branch, because the `-r' is sticky.  You could also do like this:
6214
6215     [[ hacked sources are present ]]
6216     $ cvs tag -b EXPR1
6217     $ cvs commit -r EXPR1
6218
6219but then, only those files that were changed by you will have the `-r
6220EXPR1' sticky flag.  If you hack away, and commit without specifying the
6221`-r EXPR1' flag, some files may accidentally end up on the main trunk.
6222
6223   To work with you on the experimental change, others would simply do
6224
6225     $ cvs checkout -r EXPR1 whatever_module
6226
6227
6228File: cvs.info,  Node: diff,  Next: export,  Prev: commit,  Up: CVS commands
6229
6230A.9 diff--Show differences between revisions
6231============================================
6232
6233   * Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D
6234     date1] [-r rev2 |  -D date2]] [files...]
6235
6236   * Requires: working directory, repository.
6237
6238   * Changes: nothing.
6239
6240   The `diff' command is used to compare different revisions of files.
6241The default action is to compare your working files with the revisions
6242they were based on, and report any differences that are found.
6243
6244   If any file names are given, only those files are compared.  If any
6245directories are given, all files under them will be compared.
6246
6247   The exit status for diff is different than for other CVS commands;
6248for details *note Exit status::.
6249
6250* Menu:
6251
6252* diff options::                diff options
6253* diff examples::               diff examples
6254
6255
6256File: cvs.info,  Node: diff options,  Next: diff examples,  Up: diff
6257
6258A.9.1 diff options
6259------------------
6260
6261These standard options are supported by `diff' (*note Common options::,
6262for a complete description of them):
6263
6264`-D DATE'
6265     Use the most recent revision no later than DATE.  See `-r' for how
6266     this affects the comparison.
6267
6268`-k KFLAG'
6269     Process keywords according to KFLAG.  See *note Keyword
6270     substitution::.
6271
6272`-l'
6273     Local; run only in current working directory.
6274
6275`-R'
6276     Examine directories recursively.  This option is on by default.
6277
6278`-r TAG'
6279     Compare with revision TAG.  Zero, one or two `-r' options can be
6280     present.  With no `-r' option, the working file will be compared
6281     with the revision it was based on.  With one `-r', that revision
6282     will be compared to your current working file.  With two `-r'
6283     options those two revisions will be compared (and your working file
6284     will not affect the outcome in any way).
6285
6286     One or both `-r' options can be replaced by a `-D DATE' option,
6287     described above.
6288
6289   The following options specify the format of the output.  They have
6290the same meaning as in GNU diff.  Most options have two equivalent
6291names, one of which is a single letter preceded by `-', and the other of
6292which is a long name preceded by `--'.
6293
6294`-LINES'
6295     Show LINES (an integer) lines of context.  This option does not
6296     specify an output format by itself; it has no effect unless it is
6297     combined with `-c' or `-u'.  This option is obsolete.  For proper
6298     operation, `patch' typically needs at least two lines of context.
6299
6300`-a'
6301     Treat all files as text and compare them line-by-line, even if they
6302     do not seem to be text.
6303
6304`-b'
6305     Ignore trailing white space and consider all other sequences of one
6306     or more white space characters to be equivalent.
6307
6308`-B'
6309     Ignore changes that just insert or delete blank lines.
6310
6311`--binary'
6312     Read and write data in binary mode.
6313
6314`--brief'
6315     Report only whether the files differ, not the details of the
6316     differences.
6317
6318`-c'
6319     Use the context output format.
6320
6321`-C LINES'
6322`--context[=LINES]'
6323     Use the context output format, showing LINES (an integer) lines of
6324     context, or three if LINES is not given.  For proper operation,
6325     `patch' typically needs at least two lines of context.
6326
6327`--changed-group-format=FORMAT'
6328     Use FORMAT to output a line group containing differing lines from
6329     both files in if-then-else format.  *Note Line group formats::.
6330
6331`-d'
6332     Change the algorithm to perhaps find a smaller set of changes.
6333     This makes `diff' slower (sometimes much slower).
6334
6335`-e'
6336`--ed'
6337     Make output that is a valid `ed' script.
6338
6339`--expand-tabs'
6340     Expand tabs to spaces in the output, to preserve the alignment of
6341     tabs in the input files.
6342
6343`-f'
6344     Make output that looks vaguely like an `ed' script but has changes
6345     in the order they appear in the file.
6346
6347`-F REGEXP'
6348     In context and unified format, for each hunk of differences, show
6349     some of the last preceding line that matches REGEXP.
6350
6351`--forward-ed'
6352     Make output that looks vaguely like an `ed' script but has changes
6353     in the order they appear in the file.
6354
6355`-H'
6356     Use heuristics to speed handling of large files that have numerous
6357     scattered small changes.
6358
6359`--horizon-lines=LINES'
6360     Do not discard the last LINES lines of the common prefix and the
6361     first LINES lines of the common suffix.
6362
6363`-i'
6364     Ignore changes in case; consider upper- and lower-case letters
6365     equivalent.
6366
6367`-I REGEXP'
6368     Ignore changes that just insert or delete lines that match REGEXP.
6369
6370`--ifdef=NAME'
6371     Make merged if-then-else output using NAME.
6372
6373`--ignore-all-space'
6374     Ignore white space when comparing lines.
6375
6376`--ignore-blank-lines'
6377     Ignore changes that just insert or delete blank lines.
6378
6379`--ignore-case'
6380     Ignore changes in case; consider upper- and lower-case to be the
6381     same.
6382
6383`--ignore-matching-lines=REGEXP'
6384     Ignore changes that just insert or delete lines that match REGEXP.
6385
6386`--ignore-space-change'
6387     Ignore trailing white space and consider all other sequences of one
6388     or more white space characters to be equivalent.
6389
6390`--initial-tab'
6391     Output a tab rather than a space before the text of a line in
6392     normal or context format.  This causes the alignment of tabs in the
6393     line to look normal.
6394
6395`-L LABEL'
6396     Use LABEL instead of the file name in the context format and
6397     unified format headers.
6398
6399`--label=LABEL'
6400     Use LABEL instead of the file name in the context format and
6401     unified format headers.
6402
6403`--left-column'
6404     Print only the left column of two common lines in side by side
6405     format.
6406
6407`--line-format=FORMAT'
6408     Use FORMAT to output all input lines in if-then-else format.  *Note
6409     Line formats::.
6410
6411`--minimal'
6412     Change the algorithm to perhaps find a smaller set of changes.
6413     This makes `diff' slower (sometimes much slower).
6414
6415`-n'
6416     Output RCS-format diffs; like `-f' except that each command
6417     specifies the number of lines affected.
6418
6419`-N'
6420`--new-file'
6421     In directory comparison, if a file is found in only one directory,
6422     treat it as present but empty in the other directory.
6423
6424`--new-group-format=FORMAT'
6425     Use FORMAT to output a group of lines taken from just the second
6426     file in if-then-else format.  *Note Line group formats::.
6427
6428`--new-line-format=FORMAT'
6429     Use FORMAT to output a line taken from just the second file in
6430     if-then-else format.  *Note Line formats::.
6431
6432`--old-group-format=FORMAT'
6433     Use FORMAT to output a group of lines taken from just the first
6434     file in if-then-else format.  *Note Line group formats::.
6435
6436`--old-line-format=FORMAT'
6437     Use FORMAT to output a line taken from just the first file in
6438     if-then-else format.  *Note Line formats::.
6439
6440`-p'
6441     Show which C function each change is in.
6442
6443`--rcs'
6444     Output RCS-format diffs; like `-f' except that each command
6445     specifies the number of lines affected.
6446
6447`--report-identical-files'
6448`-s'
6449     Report when two files are the same.
6450
6451`--show-c-function'
6452     Show which C function each change is in.
6453
6454`--show-function-line=REGEXP'
6455     In context and unified format, for each hunk of differences, show
6456     some of the last preceding line that matches REGEXP.
6457
6458`--side-by-side'
6459     Use the side by side output format.
6460
6461`--speed-large-files'
6462     Use heuristics to speed handling of large files that have numerous
6463     scattered small changes.
6464
6465`--suppress-common-lines'
6466     Do not print common lines in side by side format.
6467
6468`-t'
6469     Expand tabs to spaces in the output, to preserve the alignment of
6470     tabs in the input files.
6471
6472`-T'
6473     Output a tab rather than a space before the text of a line in
6474     normal or context format.  This causes the alignment of tabs in the
6475     line to look normal.
6476
6477`--text'
6478     Treat all files as text and compare them line-by-line, even if they
6479     do not appear to be text.
6480
6481`-u'
6482     Use the unified output format.
6483
6484`--unchanged-group-format=FORMAT'
6485     Use FORMAT to output a group of common lines taken from both files
6486     in if-then-else format.  *Note Line group formats::.
6487
6488`--unchanged-line-format=FORMAT'
6489     Use FORMAT to output a line common to both files in if-then-else
6490     format.  *Note Line formats::.
6491
6492`-U LINES'
6493`--unified[=LINES]'
6494     Use the unified output format, showing LINES (an integer) lines of
6495     context, or three if LINES is not given.  For proper operation,
6496     `patch' typically needs at least two lines of context.
6497
6498`-w'
6499     Ignore white space when comparing lines.
6500
6501`-W COLUMNS'
6502`--width=COLUMNS'
6503     Use an output width of COLUMNS in side by side format.
6504
6505`-y'
6506     Use the side by side output format.
6507
6508* Menu:
6509
6510* Line group formats::          Line group formats
6511* Line formats::                Line formats
6512
6513
6514File: cvs.info,  Node: Line group formats,  Next: Line formats,  Up: diff options
6515
6516A.9.1.1 Line group formats
6517..........................
6518
6519Line group formats let you specify formats suitable for many
6520applications that allow if-then-else input, including programming
6521languages and text formatting languages.  A line group format specifies
6522the output format for a contiguous group of similar lines.
6523
6524   For example, the following command compares the TeX file `myfile'
6525with the original version from the repository, and outputs a merged file
6526in which old regions are surrounded by `\begin{em}'-`\end{em}' lines,
6527and new regions are surrounded by `\begin{bf}'-`\end{bf}' lines.
6528
6529     cvs diff \
6530        --old-group-format='\begin{em}
6531     %<\end{em}
6532     ' \
6533        --new-group-format='\begin{bf}
6534     %>\end{bf}
6535     ' \
6536        myfile
6537
6538   The following command is equivalent to the above example, but it is a
6539little more verbose, because it spells out the default line group
6540formats.
6541
6542     cvs diff \
6543        --old-group-format='\begin{em}
6544     %<\end{em}
6545     ' \
6546        --new-group-format='\begin{bf}
6547     %>\end{bf}
6548     ' \
6549        --unchanged-group-format='%=' \
6550        --changed-group-format='\begin{em}
6551     %<\end{em}
6552     \begin{bf}
6553     %>\end{bf}
6554     ' \
6555        myfile
6556
6557   Here is a more advanced example, which outputs a diff listing with
6558headers containing line numbers in a "plain English" style.
6559
6560     cvs diff \
6561        --unchanged-group-format='' \
6562        --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
6563     %<' \
6564        --new-group-format='-------- %dN line%(N=1?:s) added after %de:
6565     %>' \
6566        --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
6567     %<-------- to:
6568     %>' \
6569        myfile
6570
6571   To specify a line group format, use one of the options listed below.
6572You can specify up to four line group formats, one for each kind of line
6573group.  You should quote FORMAT, because it typically contains shell
6574metacharacters.
6575
6576`--old-group-format=FORMAT'
6577     These line groups are hunks containing only lines from the first
6578     file.  The default old group format is the same as the changed
6579     group format if it is specified; otherwise it is a format that
6580     outputs the line group as-is.
6581
6582`--new-group-format=FORMAT'
6583     These line groups are hunks containing only lines from the second
6584     file.  The default new group format is same as the changed group
6585     format if it is specified; otherwise it is a format that outputs
6586     the line group as-is.
6587
6588`--changed-group-format=FORMAT'
6589     These line groups are hunks containing lines from both files.  The
6590     default changed group format is the concatenation of the old and
6591     new group formats.
6592
6593`--unchanged-group-format=FORMAT'
6594     These line groups contain lines common to both files.  The default
6595     unchanged group format is a format that outputs the line group
6596     as-is.
6597
6598   In a line group format, ordinary characters represent themselves;
6599conversion specifications start with `%' and have one of the following
6600forms.
6601
6602`%<'
6603     stands for the lines from the first file, including the trailing
6604     newline.  Each line is formatted according to the old line format
6605     (*note Line formats::).
6606
6607`%>'
6608     stands for the lines from the second file, including the trailing
6609     newline.  Each line is formatted according to the new line format.
6610
6611`%='
6612     stands for the lines common to both files, including the trailing
6613     newline.  Each line is formatted according to the unchanged line
6614     format.
6615
6616`%%'
6617     stands for `%'.
6618
6619`%c'C''
6620     where C is a single character, stands for C.  C may not be a
6621     backslash or an apostrophe.  For example, `%c':'' stands for a
6622     colon, even inside the then-part of an if-then-else format, which a
6623     colon would normally terminate.
6624
6625`%c'\O''
6626     where O is a string of 1, 2, or 3 octal digits, stands for the
6627     character with octal code O.  For example, `%c'\0'' stands for a
6628     null character.
6629
6630`FN'
6631     where F is a `printf' conversion specification and N is one of the
6632     following letters, stands for N's value formatted with F.
6633
6634     `e'
6635          The line number of the line just before the group in the old
6636          file.
6637
6638     `f'
6639          The line number of the first line in the group in the old
6640          file; equals E + 1.
6641
6642     `l'
6643          The line number of the last line in the group in the old file.
6644
6645     `m'
6646          The line number of the line just after the group in the old
6647          file; equals L + 1.
6648
6649     `n'
6650          The number of lines in the group in the old file; equals L - F
6651          + 1.
6652
6653     `E, F, L, M, N'
6654          Likewise, for lines in the new file.
6655
6656     The `printf' conversion specification can be `%d', `%o', `%x', or
6657     `%X', specifying decimal, octal, lower case hexadecimal, or upper
6658     case hexadecimal output respectively.  After the `%' the following
6659     options can appear in sequence: a `-' specifying
6660     left-justification; an integer specifying the minimum field width;
6661     and a period followed by an optional integer specifying the minimum
6662     number of digits.  For example, `%5dN' prints the number of new
6663     lines in the group in a field of width 5 characters, using the
6664     `printf' format `"%5d"'.
6665
6666`(A=B?T:E)'
6667     If A equals B then T else E.  A and B are each either a decimal
6668     constant or a single letter interpreted as above.  This format spec
6669     is equivalent to T if A's value equals B's; otherwise it is
6670     equivalent to E.
6671
6672     For example, `%(N=0?no:%dN) line%(N=1?:s)' is equivalent to `no
6673     lines' if N (the number of lines in the group in the new file) is
6674     0, to `1 line' if N is 1, and to `%dN lines' otherwise.
6675
6676
6677File: cvs.info,  Node: Line formats,  Prev: Line group formats,  Up: diff options
6678
6679A.9.1.2 Line formats
6680....................
6681
6682Line formats control how each line taken from an input file is output as
6683part of a line group in if-then-else format.
6684
6685   For example, the following command outputs text with a one-column
6686change indicator to the left of the text.  The first column of output is
6687`-' for deleted lines, `|' for added lines, and a space for unchanged
6688lines.  The formats contain newline characters where newlines are
6689desired on output.
6690
6691     cvs diff \
6692        --old-line-format='-%l
6693     ' \
6694        --new-line-format='|%l
6695     ' \
6696        --unchanged-line-format=' %l
6697     ' \
6698        myfile
6699
6700   To specify a line format, use one of the following options.  You
6701should quote FORMAT, since it often contains shell metacharacters.
6702
6703`--old-line-format=FORMAT'
6704     formats lines just from the first file.
6705
6706`--new-line-format=FORMAT'
6707     formats lines just from the second file.
6708
6709`--unchanged-line-format=FORMAT'
6710     formats lines common to both files.
6711
6712`--line-format=FORMAT'
6713     formats all lines; in effect, it sets all three above options
6714     simultaneously.
6715
6716   In a line format, ordinary characters represent themselves;
6717conversion specifications start with `%' and have one of the following
6718forms.
6719
6720`%l'
6721     stands for the contents of the line, not counting its trailing
6722     newline (if any).  This format ignores whether the line is
6723     incomplete.
6724
6725`%L'
6726     stands for the contents of the line, including its trailing newline
6727     (if any).  If a line is incomplete, this format preserves its
6728     incompleteness.
6729
6730`%%'
6731     stands for `%'.
6732
6733`%c'C''
6734     where C is a single character, stands for C.  C may not be a
6735     backslash or an apostrophe.  For example, `%c':'' stands for a
6736     colon.
6737
6738`%c'\O''
6739     where O is a string of 1, 2, or 3 octal digits, stands for the
6740     character with octal code O.  For example, `%c'\0'' stands for a
6741     null character.
6742
6743`Fn'
6744     where F is a `printf' conversion specification, stands for the line
6745     number formatted with F.  For example, `%.5dn' prints the line
6746     number using the `printf' format `"%.5d"'.  *Note Line group
6747     formats::, for more about printf conversion specifications.
6748
6749   The default line format is `%l' followed by a newline character.
6750
6751   If the input contains tab characters and it is important that they
6752line up on output, you should ensure that `%l' or `%L' in a line format
6753is just after a tab stop (e.g. by preceding `%l' or `%L' with a tab
6754character), or you should use the `-t' or `--expand-tabs' option.
6755
6756   Taken together, the line and line group formats let you specify many
6757different formats.  For example, the following command uses a format
6758similar to `diff''s normal format.  You can tailor this command to get
6759fine control over `diff''s output.
6760
6761     cvs diff \
6762        --old-line-format='< %l
6763     ' \
6764        --new-line-format='> %l
6765     ' \
6766        --old-group-format='%df%(f=l?:,%dl)d%dE
6767     %<' \
6768        --new-group-format='%dea%dF%(F=L?:,%dL)
6769     %>' \
6770        --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
6771     %<---
6772     %>' \
6773        --unchanged-group-format='' \
6774        myfile
6775
6776
6777File: cvs.info,  Node: diff examples,  Prev: diff options,  Up: diff
6778
6779A.9.2 diff examples
6780-------------------
6781
6782The following line produces a Unidiff (`-u' flag) between revision 1.14
6783and 1.19 of `backend.c'.  Due to the `-kk' flag no keywords are
6784substituted, so differences that only depend on keyword substitution are
6785ignored.
6786
6787     $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
6788
6789   Suppose the experimental branch EXPR1 was based on a set of files
6790tagged RELEASE_1_0.  To see what has happened on that branch, the
6791following can be used:
6792
6793     $ cvs diff -r RELEASE_1_0 -r EXPR1
6794
6795   A command like this can be used to produce a context diff between two
6796releases:
6797
6798     $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
6799
6800   If you are maintaining ChangeLogs, a command like the following just
6801before you commit your changes may help you write the ChangeLog entry.
6802All local modifications that have not yet been committed will be
6803printed.
6804
6805     $ cvs diff -u | less
6806
6807
6808File: cvs.info,  Node: export,  Next: history,  Prev: diff,  Up: CVS commands
6809
6810A.10 export--Export sources from CVS, similar to checkout
6811=========================================================
6812
6813   * Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir]
6814     module...
6815
6816   * Requires: repository.
6817
6818   * Changes: current directory.
6819
6820   This command is a variant of `checkout'; use it when you want a copy
6821of the source for module without the CVS administrative directories.
6822For example, you might use `export' to prepare source for shipment
6823off-site.  This command requires that you specify a date or tag (with
6824`-D' or `-r'), so that you can count on reproducing the source you ship
6825to others (and thus it always prunes empty directories).
6826
6827   One often would like to use `-kv' with `cvs export'.  This causes any
6828keywords to be expanded such that an import done at some other site will
6829not lose the keyword revision information.  But be aware that doesn't
6830handle an export containing binary files correctly.  Also be aware that
6831after having used `-kv', one can no longer use the `ident' command
6832(which is part of the RCS suite--see ident(1)) which looks for keyword
6833strings.  If you want to be able to use `ident' you must not use `-kv'.
6834
6835* Menu:
6836
6837* export options::              export options
6838
6839
6840File: cvs.info,  Node: export options,  Up: export
6841
6842A.10.1 export options
6843---------------------
6844
6845These standard options are supported by `export' (*note Common
6846options::, for a complete description of them):
6847
6848`-D DATE'
6849     Use the most recent revision no later than DATE.
6850
6851`-f'
6852     If no matching revision is found, retrieve the most recent revision
6853     (instead of ignoring the file).
6854
6855`-l'
6856     Local; run only in current working directory.
6857
6858`-n'
6859     Do not run any checkout program.
6860
6861`-R'
6862     Export directories recursively.  This is on by default.
6863
6864`-r TAG'
6865     Use revision TAG.
6866
6867   In addition, these options (that are common to `checkout' and
6868`export') are also supported:
6869
6870`-d DIR'
6871     Create a directory called DIR for the working files, instead of
6872     using the module name.  *Note checkout options::, for complete
6873     details on how CVS handles this flag.
6874
6875`-k SUBST'
6876     Set keyword expansion mode (*note Substitution modes::).
6877
6878`-N'
6879     Only useful together with `-d DIR'.  *Note checkout options::, for
6880     complete details on how CVS handles this flag.
6881
6882
6883File: cvs.info,  Node: history,  Next: import,  Prev: export,  Up: CVS commands
6884
6885A.11 history--Show status of files and users
6886============================================
6887
6888   * Synopsis:     history [-report] [-flags] [-options args] [files...]
6889
6890   * Requires: the file `$CVSROOT/CVSROOT/history'
6891
6892   * Changes: nothing.
6893
6894   CVS can keep a history file that tracks each use of the `checkout',
6895`commit', `rtag', `update', and `release' commands.  You can use
6896`history' to display this information in various formats.
6897
6898   Logging must be enabled by creating the file
6899`$CVSROOT/CVSROOT/history'.
6900
6901   *Note: `history' uses `-f', `-l', `-n', and `-p' in ways that
6902conflict with the normal use inside CVS (*note Common options::).*
6903
6904* Menu:
6905
6906* history options::             history options
6907
6908
6909File: cvs.info,  Node: history options,  Up: history
6910
6911A.11.1 history options
6912----------------------
6913
6914Several options (shown above as `-report')  control  what kind of report
6915is generated:
6916
6917`-c'
6918     Report on each time commit was used (i.e., each time the repository
6919     was modified).
6920
6921`-e'
6922     Everything (all record types).  Equivalent to specifying `-x' with
6923     all record types.  Of course, `-e' will also include record types
6924     which are added in a future version of CVS; if you are writing a
6925     script which can only handle certain record types, you'll want to
6926     specify `-x'.
6927
6928`-m MODULE'
6929     Report on a particular module.  (You can meaningfully use `-m' more
6930     than once on the command line.)
6931
6932`-o'
6933     Report on checked-out modules.  This is the default report type.
6934
6935`-T'
6936     Report on all tags.
6937
6938`-x TYPE'
6939     Extract a particular set of record types TYPE from the CVS history.
6940     The types are indicated by single letters, which you may specify in
6941     combination.
6942
6943     Certain commands have a single record type:
6944
6945     `F'
6946          release
6947
6948     `O'
6949          checkout
6950
6951     `E'
6952          export
6953
6954     `T'
6955          rtag
6956
6957     One of four record types may result from an update:
6958
6959     `C'
6960          A merge was necessary but collisions were detected (requiring
6961          manual merging).
6962
6963     `G'
6964          A merge was necessary and it succeeded.
6965
6966     `U'
6967          A working file was copied from the repository.
6968
6969     `W'
6970          The working copy of a file was deleted during update (because
6971          it was gone from the repository).
6972
6973     One of three record types results from commit:
6974
6975     `A'
6976          A file was added for the first time.
6977
6978     `M'
6979          A file was modified.
6980
6981     `R'
6982          A file was removed.
6983
6984   The options shown as `-flags' constrain or expand the report without
6985requiring option arguments:
6986
6987`-a'
6988     Show data for all users (the default is to show data only for the
6989     user executing `history').
6990
6991`-l'
6992     Show last modification only.
6993
6994`-w'
6995     Show only the records for modifications done from the same working
6996     directory where `history' is executing.
6997
6998   The options shown as `-options ARGS' constrain the report based on an
6999argument:
7000
7001`-b STR'
7002     Show data back to a record containing  the  string STR  in  either
7003     the module name, the file name, or the repository path.
7004
7005`-D DATE'
7006     Show data since DATE.  This is slightly different from the normal
7007     use of `-D DATE', which selects the newest revision older than
7008     DATE.
7009
7010`-f FILE'
7011     Show data for a particular file (you can specify several `-f'
7012     options on the same command line).  This is equivalent to
7013     specifying the file on the command line.
7014
7015`-n MODULE'
7016     Show data for a particular module (you can specify several `-n'
7017     options on the same command line).
7018
7019`-p REPOSITORY'
7020     Show data for a particular source repository  (you can specify
7021     several `-p' options on the same command line).
7022
7023`-r REV'
7024     Show records referring to revisions since the revision or tag named
7025     REV appears in individual RCS files.  Each RCS file is searched for
7026     the revision or tag.
7027
7028`-t TAG'
7029     Show records since tag TAG was last added to the history file.
7030     This differs from the `-r' flag above in that it reads only the
7031     history file, not the RCS files, and is much faster.
7032
7033`-u NAME'
7034     Show records for user NAME.
7035
7036`-z TIMEZONE'
7037     Show times in the selected records using the specified time zone
7038     instead of UTC.
7039
7040
7041File: cvs.info,  Node: import,  Next: log,  Prev: history,  Up: CVS commands
7042
7043A.12 import--Import sources into CVS, using vendor branches
7044===========================================================
7045
7046   * Synopsis: import [-options] repository vendortag releasetag...
7047
7048   * Requires: Repository, source distribution directory.
7049
7050   * Changes: repository.
7051
7052   Use `import' to incorporate an entire source distribution from an
7053outside source (e.g., a source vendor) into your source repository
7054directory.  You can use this command both for initial creation of a
7055repository, and for wholesale updates to the module from the outside
7056source.  *Note Tracking sources::, for a discussion on this subject.
7057
7058   The REPOSITORY argument gives a directory name (or a path to a
7059directory) under the CVS root directory for repositories; if the
7060directory did not exist, import creates it.
7061
7062   When you use import for updates to source that has been modified in
7063your source repository (since a prior import), it will notify you of any
7064files that conflict in the two branches of development; use `checkout
7065-j' to reconcile the differences, as import instructs you to do.
7066
7067   If CVS decides a file should be ignored (*note cvsignore::), it does
7068not import it and prints `I ' followed by the filename (*note import
7069output::, for a complete description of the output).
7070
7071   If the file `$CVSROOT/CVSROOT/cvswrappers' exists, any file whose
7072names match the specifications in that file will be treated as packages
7073and the appropriate filtering will be performed on the file/directory
7074before being imported.  *Note Wrappers::.
7075
7076   The outside source is saved in a first-level branch, by default
70771.1.1.  Updates are leaves of this branch; for example, files from the
7078first imported collection of source will be revision 1.1.1.1, then files
7079from the first imported update will be revision 1.1.1.2, and so on.
7080
7081   At least three arguments are required.  REPOSITORY is needed to
7082identify the collection of source.  VENDORTAG is a tag for the entire
7083branch (e.g., for 1.1.1).  You must also specify at least one RELEASETAG
7084to identify the files at the leaves created each time you execute
7085`import'.
7086
7087   Note that `import' does _not_ change the directory in which you
7088invoke it.  In particular, it does not set up that directory as a CVS
7089working directory; if you want to work with the sources import them
7090first and then check them out into a different directory (*note Getting
7091the source::).
7092
7093* Menu:
7094
7095* import options::              import options
7096* import output::               import output
7097* import examples::             import examples
7098
7099
7100File: cvs.info,  Node: import options,  Next: import output,  Up: import
7101
7102A.12.1 import options
7103---------------------
7104
7105This standard option is supported by `import' (*note Common options::,
7106for a complete description):
7107
7108`-m MESSAGE'
7109     Use MESSAGE as log information, instead of invoking an editor.
7110
7111   There are the following additional special options.
7112
7113`-b BRANCH'
7114     See *note Multiple vendor branches::.
7115
7116`-k SUBST'
7117     Indicate the keyword expansion mode desired.  This setting will
7118     apply to all files created during the import, but not to any files
7119     that previously existed in the repository.  See *note Substitution
7120     modes::, for a list of valid `-k' settings.
7121
7122`-I NAME'
7123     Specify file names that should be ignored during import.  You can
7124     use this option repeatedly.  To avoid ignoring any files at all
7125     (even those ignored by default), specify `-I !'.
7126
7127     NAME can be a file name pattern of the same type that you can
7128     specify in the `.cvsignore' file.  *Note cvsignore::.
7129
7130`-W SPEC'
7131     Specify file names that should be filtered during import.  You can
7132     use this option repeatedly.
7133
7134     SPEC can be a file name pattern of the same type that you can
7135     specify in the `.cvswrappers' file. *Note Wrappers::.
7136
7137
7138File: cvs.info,  Node: import output,  Next: import examples,  Prev: import options,  Up: import
7139
7140A.12.2 import output
7141--------------------
7142
7143`import' keeps you informed of its progress by printing a line for each
7144file, preceded by one character indicating the status of the file:
7145
7146`U FILE'
7147     The file already exists in the repository and has not been locally
7148     modified; a new revision has been created (if necessary).
7149
7150`N FILE'
7151     The file is a new file which has been added to the repository.
7152
7153`C FILE'
7154     The file already exists in the repository but has been locally
7155     modified; you will have to merge the changes.
7156
7157`I FILE'
7158     The file is being ignored (*note cvsignore::).
7159
7160`L FILE'
7161     The file is a symbolic link; `cvs import' ignores symbolic links.
7162     People periodically suggest that this behavior should be changed,
7163     but if there is a consensus on what it should be changed to, it is
7164     not apparent.  (Various options in the `modules' file can be used
7165     to recreate symbolic links on checkout, update, etc.; *note
7166     modules::.)
7167
7168
7169File: cvs.info,  Node: import examples,  Prev: import output,  Up: import
7170
7171A.12.3 import examples
7172----------------------
7173
7174See *note Tracking sources::, and *note From files::.
7175
7176
7177File: cvs.info,  Node: log,  Next: rdiff,  Prev: import,  Up: CVS commands
7178
7179A.13 log--Print out log information for files
7180=============================================
7181
7182   * Synopsis: log [options] [files...]
7183
7184   * Requires: repository, working directory.
7185
7186   * Changes: nothing.
7187
7188   Display log information for files.  `log' used to call the RCS
7189utility `rlog'.  Although this is no longer true in the current sources,
7190this history determines the format of the output and the options, which
7191are not quite in the style of the other CVS commands.
7192
7193   The output includes the location of the RCS file, the "head" revision
7194(the latest revision on the trunk), all symbolic names (tags) and some
7195other things.  For each revision, the revision number, the author, the
7196number of lines added/deleted and the log message are printed.  All
7197times are displayed in Coordinated Universal Time (UTC).  (Other parts
7198of CVS print times in the local timezone).
7199
7200   *Note: `log' uses `-R' in a way that conflicts with the normal use
7201inside CVS (*note Common options::).*
7202
7203* Menu:
7204
7205* log options::                 log options
7206* log examples::                log examples
7207
7208
7209File: cvs.info,  Node: log options,  Next: log examples,  Up: log
7210
7211A.13.1 log options
7212------------------
7213
7214By default, `log' prints all information that is available.  All other
7215options restrict the output.
7216
7217`-b'
7218     Print information about the revisions on the default branch,
7219     normally the highest branch on the trunk.
7220
7221`-d DATES'
7222     Print information about revisions with a checkin date/time in the
7223     range given by the semicolon-separated list of dates.  The date
7224     formats accepted are those accepted by the `-D' option to many
7225     other CVS commands (*note Common options::).  Dates can be combined
7226     into ranges as follows:
7227
7228     `D1<D2'
7229     `D2>D1'
7230          Select the revisions that were deposited between D1 and D2.
7231
7232     `<D'
7233     `D>'
7234          Select all revisions dated D or earlier.
7235
7236     `D<'
7237     `>D'
7238          Select all revisions dated D or later.
7239
7240     `D'
7241          Select the single, latest revision dated D or earlier.
7242
7243     The `>' or `<' characters may be followed by `=' to indicate an
7244     inclusive range rather than an exclusive one.
7245
7246     Note that the separator is a semicolon (;).
7247
7248`-h'
7249     Print only the name of the RCS file, name of the file in the
7250     working directory, head, default branch, access list, locks,
7251     symbolic names, and suffix.
7252
7253`-l'
7254     Local; run only in current working directory.  (Default is to run
7255     recursively).
7256
7257`-N'
7258     Do not print the list of tags for this file.  This option can be
7259     very useful when your site uses a lot of tags, so rather than
7260     "more"'ing over 3 pages of tag information, the log information is
7261     presented without tags at all.
7262
7263`-R'
7264     Print only the name of the RCS file.
7265
7266`-rREVISIONS'
7267     Print information about revisions given in the comma-separated list
7268     REVISIONS of revisions and ranges.  The following table explains
7269     the available range formats:
7270
7271     `REV1:REV2'
7272          Revisions REV1 to REV2 (which must be on the same branch).
7273
7274     `REV1::REV2'
7275          The same, but excluding REV1.
7276
7277     `:REV'
7278     `::REV'
7279          Revisions from the beginning of the branch up to and including
7280          REV.
7281
7282     `REV:'
7283          Revisions starting with REV to the end of the branch
7284          containing REV.
7285
7286     `REV::'
7287          Revisions starting just after REV to the end of the branch
7288          containing REV.
7289
7290     `BRANCH'
7291          An argument that is a branch means all revisions on that
7292          branch.
7293
7294     `BRANCH1:BRANCH2'
7295     `BRANCH1::BRANCH2'
7296          A range of branches means all revisions on the branches in
7297          that range.
7298
7299     `BRANCH.'
7300          The latest revision in BRANCH.
7301
7302     A bare `-r' with no revisions means the latest revision on the
7303     default branch, normally the trunk.  There can be no space between
7304     the `-r' option and its argument.
7305
7306`-S'
7307     Suppress the header if no revisions are selected.
7308
7309`-s STATES'
7310     Print information about revisions whose state attributes match one
7311     of the states given in the comma-separated list STATES.
7312
7313`-t'
7314     Print the same as `-h', plus the descriptive text.
7315
7316`-wLOGINS'
7317     Print information about revisions checked in by users with login
7318     names appearing in the comma-separated list LOGINS.  If LOGINS is
7319     omitted, the user's login is assumed.  There can be no space
7320     between the `-w' option and its argument.
7321
7322   `log' prints the intersection of the revisions selected with the
7323options `-d', `-s', and `-w', intersected with the union of the
7324revisions selected by `-b' and `-r'.
7325
7326