xref: /openbsd/gnu/usr.bin/cvs/doc/cvs.texinfo (revision 5af055cd)
1\input texinfo  @c -*-texinfo-*-
2@comment Documentation for CVS.
3@comment Copyright (C) 1992, 1993, 1999 Signum Support AB
4@comment Copyright (C) 1993 Free Software Foundation, Inc.
5
6@comment This file is part of the CVS distribution.
7
8@comment CVS is free software; you can redistribute it and/or modify
9@comment it under the terms of the GNU General Public License as published by
10@comment the Free Software Foundation; either version 2, or (at your option)
11@comment any later version.
12
13@comment CVS is distributed in the hope that it will be useful,
14@comment but WITHOUT ANY WARRANTY; without even the implied warranty of
15@comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16@comment GNU General Public License for more details.
17
18@c See ../README for A4 vs. US letter size.
19@c When we provided A4 postscript, and people tried to
20@c print it on US letter, the usual complaint was that the
21@c page numbers would get cut off.
22@c If one prints US letter on A4, reportedly there is
23@c some extra space at the top and/or bottom, and the side
24@c margins are a bit narrow, but no text is lost.
25@c
26@c See
27@c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
28@c for more on paper sizes.  Insuring that margins are
29@c big enough to print on either A4 or US letter does
30@c indeed seem to be the usual approach (RFC2346).
31
32@c This document seems to get overfull hboxes with some
33@c frequency (probably because the tendency is to
34@c sanity-check it with "make info" and run TeX less
35@c often).  The big ugly boxes just seem to add insult
36@c to injury, and I'm not aware of them helping to fix
37@c the overfull hboxes at all.
38@finalout
39
40@setfilename cvs.info
41@include CVSvn.texi
42@settitle CVS---Concurrent Versions System v@value{CVSVN}
43@setchapternewpage odd
44
45@c -- TODO list:
46@c -- Fix all lines that match "^@c -- "
47@c -- Also places marked with FIXME should be manual
48@c problems (as opposed to FIXCVS for CVS problems).
49
50@ifinfo
51@format
52START-INFO-DIR-ENTRY
53* CVS: (cvs).          Concurrent Versions System
54END-INFO-DIR-ENTRY
55@end format
56@end ifinfo
57
58@ifinfo
59Copyright @copyright{} 1992, 1993 Signum Support AB
60Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc.
61
62Permission is granted to make and distribute verbatim copies of
63this manual provided the copyright notice and this permission notice
64are preserved on all copies.
65
66@ignore
67Permission is granted to process this file through Tex and print the
68results, provided the printed document carries copying permission
69notice identical to this one except for the removal of this paragraph
70(this paragraph not being relevant to the printed manual).
71
72@end ignore
73Permission is granted to copy and distribute modified versions of this
74manual under the conditions for verbatim copying, provided also that the
75entire resulting derived work is distributed under the terms of a
76permission notice identical to this one.
77
78Permission is granted to copy and distribute translations of this manual
79into another language, under the above conditions for modified versions,
80except that this permission notice may be stated in a translation
81approved by the Free Software Foundation.
82@end ifinfo
83
84@comment The titlepage section does not appear in the Info file.
85@titlepage
86@sp 4
87@comment The title is printed in a large font.
88@center @titlefont{Version Management}
89@sp
90@center @titlefont{with}
91@sp
92@center @titlefont{CVS}
93@sp 2
94@center for @sc{cvs} @value{CVSVN}
95@comment -release-
96@sp 3
97@center Per Cederqvist et al
98
99@comment  The following two commands start the copyright page
100@comment  for the printed manual.  This will not appear in the Info file.
101@page
102@vskip 0pt plus 1filll
103Copyright @copyright{} 1992, 1993 Signum Support AB
104
105Permission is granted to make and distribute verbatim copies of
106this manual provided the copyright notice and this permission notice
107are preserved on all copies.
108
109Permission is granted to copy and distribute modified versions of this
110manual under the conditions for verbatim copying, provided also that the
111entire resulting derived work is distributed under the terms of a
112permission notice identical to this one.
113
114Permission is granted to copy and distribute translations of this manual
115into another language, under the above conditions for modified versions,
116except that this permission notice may be stated in a translation
117approved by the Free Software Foundation.
118@end titlepage
119
120@comment ================================================================
121@comment                   The real text starts here
122@comment ================================================================
123
124@ifinfo
125@c ---------------------------------------------------------------------
126@node    Top
127@top
128@c Note: there is a space after that @top command.
129@c The texinfo-format-buffer Emacs function and
130@c the makeinfo shell command disagree on what arguments
131@c @top takes; @top followed by a single space is
132@c something they can both cope with.
133
134This info manual describes how to use and administer
135@sc{cvs} version @value{CVSVN}.
136@end ifinfo
137
138@c This menu is pretty long.  Not sure how easily that
139@c can be fixed (no brilliant ideas right away)...
140@menu
141* Overview::                    An introduction to CVS
142* Repository::                  Where all your sources are stored
143* Starting a new project::      Starting a project with CVS
144* Revisions::                   Numeric and symbolic names for revisions
145* Branching and merging::       Diverging/rejoining branches of development
146* Recursive behavior::          CVS descends directories
147* Adding and removing::         Adding/removing/renaming files/directories
148* History browsing::            Viewing the history of files in various ways
149
150CVS and the Real World.
151-----------------------
152* Binary files::                CVS can handle binary files
153* Multiple developers::         How CVS helps a group of developers
154* Revision management::         Policy questions for revision management
155* Keyword substitution::        CVS can include the revision inside the file
156* Tracking sources::            Tracking third-party sources
157* Builds::                      Issues related to CVS and builds
158* Special Files::		Devices, links and other non-regular files
159
160References.
161-----------
162* CVS commands::                CVS commands share some things
163* Invoking CVS::                Quick reference to CVS commands
164* Administrative files::        Reference manual for the Administrative files
165* Environment variables::       All environment variables which affect CVS
166* Compatibility::               Upgrading CVS versions
167* Troubleshooting::             Some tips when nothing works
168* Credits::                     Some of the contributors to this manual
169* BUGS::                        Dealing with bugs in CVS or this manual
170* Index::                       Index
171@end menu
172
173@c ---------------------------------------------------------------------
174@node Overview
175@chapter Overview
176@cindex Overview
177
178This chapter is for people who have never used
179@sc{cvs}, and perhaps have never used version control
180software before.
181
182If you are already familiar with @sc{cvs} and are just
183trying to learn a particular feature or remember a
184certain command, you can probably skip everything here.
185
186@menu
187* What is CVS?::                What you can do with @sc{cvs}
188* What is CVS not?::            Problems @sc{cvs} doesn't try to solve
189* A sample session::            A tour of basic @sc{cvs} usage
190@end menu
191
192@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
193@node What is CVS?
194@section What is CVS?
195@cindex What is CVS?
196@cindex Introduction to CVS
197@cindex CVS, introduction to
198
199@sc{cvs} is a version control system.  Using it, you can
200record the history of your source files.
201
202@c -- ///
203@c -- ///Those who cannot remember the past are condemned to repeat it.
204@c -- ///               -- George Santayana
205@c -- //////
206
207@c -- Insert history  quote here!
208For example, bugs sometimes creep in when
209software is modified, and you might not detect the bug
210until a long time after you make the modification.
211With @sc{cvs}, you can easily retrieve old versions to see
212exactly which change caused the bug.  This can
213sometimes be a big help.
214
215You could of course save every version of every file
216you have ever created.  This would
217however waste an enormous amount of disk space.  @sc{cvs}
218stores all the versions of a file in a single file in a
219clever way that only stores the differences between
220versions.
221
222@sc{cvs} also helps you if you are part of a group of people working
223on the same project.  It is all too easy to overwrite
224each others' changes unless you are extremely careful.
225Some editors, like @sc{gnu} Emacs, try to make sure that
226the same file is never modified by two people at the
227same time.  Unfortunately, if someone is using another
228editor, that safeguard will not work.  @sc{cvs} solves this problem
229by insulating the different developers from each other.  Every
230developer works in his own directory, and @sc{cvs} merges
231the work when each developer is done.
232
233@cindex History of CVS
234@cindex CVS, history of
235@cindex Credits (CVS program)
236@cindex Contributors (CVS program)
237@sc{cvs} started out as a bunch of shell scripts written by
238Dick Grune, posted to the newsgroup
239@code{comp.sources.unix} in the volume 6
240release of December, 1986.  While no actual code from
241these shell scripts is present in the current version
242of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
243come from them.
244
245In April, 1989, Brian Berliner designed and coded @sc{cvs}.
246Jeff Polk later helped Brian with the design of the @sc{cvs}
247module and vendor branch support.
248
249@cindex Source, getting CVS source
250You can get @sc{cvs} in a variety of ways, including
251free download from the internet.  For more information
252on downloading @sc{cvs} and other @sc{cvs} topics, see:
253
254@example
255http://www.cvshome.org/
256http://www.loria.fr/~molli/cvs-index.html
257@end example
258
259@cindex Mailing list
260@cindex List, mailing list
261@cindex Newsgroups
262There is a mailing list, known as @w{@code{info-cvs}},
263devoted to @sc{cvs}.  To subscribe or
264unsubscribe
265write to
266@w{@code{info-cvs-request@@gnu.org}}.
267If you prefer a usenet group, the right
268group is @code{comp.software.config-mgmt} which is for
269@sc{cvs} discussions (along with other configuration
270management systems).  In the future, it might be
271possible to create a
272@code{comp.software.config-mgmt.cvs}, but probably only
273if there is sufficient @sc{cvs} traffic on
274@code{comp.software.config-mgmt}.
275@c Other random data is that past attempts to create a
276@c gnu.* group have failed (the relevant authorities
277@c say they'll do it, but don't), and that tale was very
278@c skeptical of comp.software.config-mgmt.cvs when the
279@c subject came up around 1995 or so (for one
280@c thing, because creating it would be a "reorg" which
281@c would need to take a more comprehensive look at the
282@c whole comp.software.config-mgmt.* hierarchy).
283
284You can also subscribe to the bug-cvs mailing list,
285described in more detail in @ref{BUGS}.  To subscribe
286send mail to bug-cvs-request@@gnu.org.
287
288@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
289@node What is CVS not?
290@section What is CVS not?
291@cindex What is CVS not?
292
293@sc{cvs} can do a lot of things for you, but it does
294not try to be everything for everyone.
295
296@table @asis
297@item @sc{cvs} is not a build system.
298
299Though the structure of your repository and modules
300file interact with your build system
301(e.g. @file{Makefile}s), they are essentially
302independent.
303
304@sc{cvs} does not dictate how you build anything.  It
305merely stores files for retrieval in a tree structure
306you devise.
307
308@sc{cvs} does not dictate how to use disk space in the
309checked out working directories.  If you write your
310@file{Makefile}s or scripts in every directory so they
311have to know the relative positions of everything else,
312you wind up requiring the entire repository to be
313checked out.
314
315If you modularize your work, and construct a build
316system that will share files (via links, mounts,
317@code{VPATH} in @file{Makefile}s, etc.), you can
318arrange your disk usage however you like.
319
320But you have to remember that @emph{any} such system is
321a lot of work to construct and maintain.  @sc{cvs} does
322not address the issues involved.
323
324Of course, you should place the tools created to
325support such a build system (scripts, @file{Makefile}s,
326etc) under @sc{cvs}.
327
328Figuring out what files need to be rebuilt when
329something changes is, again, something to be handled
330outside the scope of @sc{cvs}.  One traditional
331approach is to use @code{make} for building, and use
332some automated tool for generating the dependencies which
333@code{make} uses.
334
335See @ref{Builds}, for more information on doing builds
336in conjunction with @sc{cvs}.
337
338@item @sc{cvs} is not a substitute for management.
339
340Your managers and project leaders are expected to talk
341to you frequently enough to make certain you are aware
342of schedules, merge points, branch names and release
343dates.  If they don't, @sc{cvs} can't help.
344
345@sc{cvs} is an instrument for making sources dance to
346your tune.  But you are the piper and the composer.  No
347instrument plays itself or writes its own music.
348
349@item @sc{cvs} is not a substitute for developer communication.
350
351When faced with conflicts within a single file, most
352developers manage to resolve them without too much
353effort.  But a more general definition of ``conflict''
354includes problems too difficult to solve without
355communication between developers.
356
357@sc{cvs} cannot determine when simultaneous changes
358within a single file, or across a whole collection of
359files, will logically conflict with one another.  Its
360concept of a @dfn{conflict} is purely textual, arising
361when two changes to the same base file are near enough
362to spook the merge (i.e. @code{diff3}) command.
363
364@sc{cvs} does not claim to help at all in figuring out
365non-textual or distributed conflicts in program logic.
366
367For example: Say you change the arguments to function
368@code{X} defined in file @file{A}.  At the same time,
369someone edits file @file{B}, adding new calls to
370function @code{X} using the old arguments.  You are
371outside the realm of @sc{cvs}'s competence.
372
373Acquire the habit of reading specs and talking to your
374peers.
375
376
377@item @sc{cvs} does not have change control
378
379Change control refers to a number of things.  First of
380all it can mean @dfn{bug-tracking}, that is being able
381to keep a database of reported bugs and the status of
382each one (is it fixed?  in what release?  has the bug
383submitter agreed that it is fixed?).  For interfacing
384@sc{cvs} to an external bug-tracking system, see the
385@file{rcsinfo} and @file{verifymsg} files
386(@pxref{Administrative files}).
387
388Another aspect of change control is keeping track of
389the fact that changes to several files were in fact
390changed together as one logical change.  If you check
391in several files in a single @code{cvs commit}
392operation, @sc{cvs} then forgets that those files were
393checked in together, and the fact that they have the
394same log message is the only thing tying them
395together.  Keeping a @sc{gnu} style @file{ChangeLog}
396can help somewhat.
397@c FIXME: should have an xref to a section which talks
398@c more about keeping ChangeLog's with CVS, but that
399@c section hasn't been written yet.
400
401Another aspect of change control, in some systems, is
402the ability to keep track of the status of each
403change.  Some changes have been written by a developer,
404others have been reviewed by a second developer, and so
405on.  Generally, the way to do this with @sc{cvs} is to
406generate a diff (using @code{cvs diff} or @code{diff})
407and email it to someone who can then apply it using the
408@code{patch} utility.  This is very flexible, but
409depends on mechanisms outside @sc{cvs} to make sure
410nothing falls through the cracks.
411
412@item @sc{cvs} is not an automated testing program
413
414It should be possible to enforce mandatory use of a
415testsuite using the @code{commitinfo} file.  I haven't
416heard a lot about projects trying to do that or whether
417there are subtle gotchas, however.
418
419@item @sc{cvs} does not have a builtin process model
420
421Some systems provide ways to ensure that changes or
422releases go through various steps, with various
423approvals as needed.  Generally, one can accomplish
424this with @sc{cvs} but it might be a little more work.
425In some cases you'll want to use the @file{commitinfo},
426@file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
427files, to require that certain steps be performed
428before cvs will allow a checkin.  Also consider whether
429features such as branches and tags can be used to
430perform tasks such as doing work in a development tree
431and then merging certain changes over to a stable tree
432only once they have been proven.
433@end table
434
435@c ---------------------------------------------------------------------
436@node A sample session
437@section A sample session
438@cindex Example of a work-session
439@cindex Getting started
440@cindex Work-session, example of
441@cindex tc, Trivial Compiler (example)
442@cindex Trivial Compiler (example)
443
444@c I think an example is a pretty good way to start.  But
445@c somewhere in here, maybe after the sample session,
446@c we need something which is kind of
447@c a "roadmap" which is more directed at sketching out
448@c the functionality of CVS and pointing people to
449@c various other parts of the manual.  As it stands now
450@c people who read in order get dumped right into all
451@c manner of hair regarding remote repositories,
452@c creating a repository, etc.
453@c
454@c The following was in the old Basic concepts node.  I don't
455@c know how good a job it does at introducing modules,
456@c or whether they need to be introduced so soon, but
457@c something of this sort might go into some
458@c introductory material somewhere.
459@ignore
460@cindex Modules (intro)
461The repository contains directories and files, in an
462arbitrary tree.  The @dfn{modules} feature can be used
463to group together a set of directories or files into a
464single entity (@pxref{modules}).  A typical usage is to
465define one module per project.
466@end ignore
467
468As a way of introducing @sc{cvs}, we'll go through a
469typical work-session using @sc{cvs}.  The first thing
470to understand is that @sc{cvs} stores all files in a
471centralized @dfn{repository} (@pxref{Repository}); this
472section assumes that a repository is set up.
473@c I'm not sure that the sentence concerning the
474@c repository quite tells the user what they need to
475@c know at this point.  Might need to expand on "centralized"
476@c slightly (maybe not here, maybe further down in the example?)
477
478Suppose you are working on a simple compiler.  The source
479consists of a handful of C files and a @file{Makefile}.
480The compiler is called @samp{tc} (Trivial Compiler),
481and the repository is set up so that there is a module
482called @samp{tc}.
483
484@menu
485* Getting the source::          Creating a workspace
486* Committing your changes::     Making your work available to others
487* Cleaning up::                 Cleaning up
488* Viewing differences::         Viewing differences
489@end menu
490
491@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
492@node Getting the source
493@subsection Getting the source
494@cindex Getting the source
495@cindex Checking out source
496@cindex Fetching source
497@cindex Source, getting from CVS
498@cindex Checkout, example
499
500The first thing you must do is to get your own working copy of the
501source for @samp{tc}.  For this, you use the @code{checkout} command:
502
503@example
504$ cvs checkout tc
505@end example
506
507@noindent
508This will create a new directory called @file{tc} and populate it with
509the source files.
510
511@example
512$ cd tc
513$ ls
514CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
515@end example
516
517The @file{CVS} directory is used internally by
518@sc{cvs}.  Normally, you should not modify or remove
519any of the files in it.
520
521You start your favorite editor, hack away at @file{backend.c}, and a couple
522of hours later you have added an optimization pass to the compiler.
523A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
524you want to edit.  @xref{Multiple developers}, for an explanation.
525
526@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
527@node Committing your changes
528@subsection Committing your changes
529@cindex Committing changes
530@cindex Log message entry
531@cindex CVSEDITOR, environment variable
532@cindex EDITOR, environment variable
533
534When you have checked that the compiler is still compilable you decide
535to make a new version of @file{backend.c}.  This will
536store your new @file{backend.c} in the repository and
537make it available to anyone else who is using that same
538repository.
539
540@example
541$ cvs commit backend.c
542@end example
543
544@noindent
545@sc{cvs} starts an editor, to allow you to enter a log
546message.  You type in ``Added an optimization pass.'',
547save the temporary file, and exit the editor.
548
549The environment variable @code{$CVSEDITOR} determines
550which editor is started.  If @code{$CVSEDITOR} is not
551set, then if the environment variable @code{$EDITOR} is
552set, it will be used. If both @code{$CVSEDITOR} and
553@code{$EDITOR} are not set then there is a default
554which will vary with your operating system, for example
555@code{vi} for unix or @code{notepad} for Windows
556NT/95.
557
558@cindex VISUAL, environment variable
559In addition, @sc{cvs} checks the @code{$VISUAL} environment
560variable.  Opinions vary on whether this behavior is desirable and
561whether future releases of @sc{cvs} should check @code{$VISUAL} or
562ignore it.  You will be OK either way if you make sure that
563@code{$VISUAL} is either unset or set to the same thing as
564@code{$EDITOR}.
565
566@c This probably should go into some new node
567@c containing detailed info on the editor, rather than
568@c the intro.  In fact, perhaps some of the stuff with
569@c CVSEDITOR and -m and so on should too.
570When @sc{cvs} starts the editor, it includes a list of
571files which are modified.  For the @sc{cvs} client,
572this list is based on comparing the modification time
573of the file against the modification time that the file
574had when it was last gotten or updated.  Therefore, if
575a file's modification time has changed but its contents
576have not, it will show up as modified.  The simplest
577way to handle this is simply not to worry about it---if
578you proceed with the commit @sc{cvs} will detect that
579the contents are not modified and treat it as an
580unmodified file.  The next @code{update} will clue
581@sc{cvs} in to the fact that the file is unmodified,
582and it will reset its stored timestamp so that the file
583will not show up in future editor sessions.
584@c FIXCVS: Might be nice if "commit" and other commands
585@c would reset that timestamp too, but currently commit
586@c doesn't.
587@c FIXME: Need to talk more about the process of
588@c prompting for the log message.  Like show an example
589@c of what it pops up in the editor, for example.  Also
590@c a discussion of how to get the "a)bort, c)ontinue,
591@c e)dit" prompt and what to do with it.  Might also
592@c work in the suggestion that if you want a diff, you
593@c should make it before running commit (someone
594@c suggested that the diff pop up in the editor.  I'm
595@c not sure that is better than telling people to run
596@c "cvs diff" first if that is what they want, but if
597@c we want to tell people that, the manual possibly
598@c should say it).
599
600If you want to avoid
601starting an editor you can specify the log message on
602the command line using the @samp{-m} flag instead, like
603this:
604
605@example
606$ cvs commit -m "Added an optimization pass" backend.c
607@end example
608
609@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
610@node Cleaning up
611@subsection Cleaning up
612@cindex Cleaning up
613@cindex Working copy, removing
614@cindex Removing your working copy
615@cindex Releasing your working copy
616
617Before you turn to other tasks you decide to remove your working copy of
618tc.  One acceptable way to do that is of course
619
620@example
621$ cd ..
622$ rm -r tc
623@end example
624
625@noindent
626but a better way is to use the @code{release} command (@pxref{release}):
627
628@example
629$ cd ..
630$ cvs release -d tc
631M driver.c
632? tc
633You have [1] altered files in this repository.
634Are you sure you want to release (and delete) directory `tc': n
635** `release' aborted by user choice.
636@end example
637
638The @code{release} command checks that all your modifications have been
639committed.  If history logging is enabled it also makes a note in the
640history file.  @xref{history file}.
641
642When you use the @samp{-d} flag with @code{release}, it
643also removes your working copy.
644
645In the example above, the @code{release} command wrote a couple of lines
646of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
647That is nothing to worry about: @file{tc} is the executable compiler,
648and it should not be stored in the repository.  @xref{cvsignore},
649for information about how to make that warning go away.
650@xref{release output}, for a complete explanation of
651all possible output from @code{release}.
652
653@samp{M driver.c} is more serious.  It means that the
654file @file{driver.c} has been modified since it was
655checked out.
656
657The @code{release} command always finishes by telling
658you how many modified files you have in your working
659copy of the sources, and then asks you for confirmation
660before deleting any files or making any note in the
661history file.
662
663You decide to play it safe and answer @kbd{n @key{RET}}
664when @code{release} asks for confirmation.
665
666@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
667@node Viewing differences
668@subsection Viewing differences
669@cindex Viewing differences
670@cindex Diff
671
672You do not remember modifying @file{driver.c}, so you want to see what
673has happened to that file.
674
675@example
676$ cd tc
677$ cvs diff driver.c
678@end example
679
680This command runs @code{diff} to compare the version of @file{driver.c}
681that you checked out with your working copy.  When you see the output
682you remember that you added a command line option that enabled the
683optimization pass.  You check it in, and release the module.
684@c FIXME: we haven't yet defined the term "check in".
685
686@example
687$ cvs commit -m "Added an optimization pass" driver.c
688Checking in driver.c;
689/usr/local/cvsroot/tc/driver.c,v  <--  driver.c
690new revision: 1.2; previous revision: 1.1
691done
692$ cd ..
693$ cvs release -d tc
694? tc
695You have [0] altered files in this repository.
696Are you sure you want to release (and delete) directory `tc': y
697@end example
698
699@c ---------------------------------------------------------------------
700@node Repository
701@chapter The Repository
702@cindex Repository (intro)
703@cindex Repository, example
704@cindex Layout of repository
705@cindex Typical repository
706@cindex /usr/local/cvsroot, as example repository
707@cindex cvsroot
708
709The @sc{cvs} @dfn{repository} stores a complete copy of
710all the files and directories which are under version
711control.
712
713Normally, you never access any of the files in the
714repository directly.  Instead, you use @sc{cvs}
715commands to get your own copy of the files into a
716@dfn{working directory}, and then
717work on that copy.  When you've finished a set of
718changes, you check (or @dfn{commit}) them back into the
719repository.  The repository then contains the changes
720which you have made, as well as recording exactly what
721you changed, when you changed it, and other such
722information.  Note that the repository is not a
723subdirectory of the working directory, or vice versa;
724they should be in separate locations.
725@c Need some example, e.g. repository
726@c /usr/local/cvsroot; working directory
727@c /home/joe/sources.  But this node is too long
728@c as it is; need a little reorganization...
729
730@cindex :local:, setting up
731@sc{cvs} can access a repository by a variety of
732means.  It might be on the local computer, or it might
733be on a computer across the room or across the world.
734To distinguish various ways to access a repository, the
735repository name can start with an @dfn{access method}.
736For example, the access method @code{:local:} means to
737access a repository directory, so the repository
738@code{:local:/usr/local/cvsroot} means that the
739repository is in @file{/usr/local/cvsroot} on the
740computer running @sc{cvs}.  For information on other
741access methods, see @ref{Remote repositories}.
742
743@c Can se say this more concisely?  Like by passing
744@c more of the buck to the Remote repositories node?
745If the access method is omitted, then if the repository
746does not contain @samp{:}, then @code{:local:} is
747assumed.  If it does contain @samp{:} then either
748@code{:ext:} or @code{:server:} is assumed.  For
749example, if you have a local repository in
750@file{/usr/local/cvsroot}, you can use
751@code{/usr/local/cvsroot} instead of
752@code{:local:/usr/local/cvsroot}.  But if (under
753Windows NT, for example) your local repository is
754@file{c:\src\cvsroot}, then you must specify the access
755method, as in @code{:local:c:\src\cvsroot}.
756
757@c This might appear to go in Repository storage, but
758@c actually it is describing something which is quite
759@c user-visible, when you do a "cvs co CVSROOT".  This
760@c isn't necessary the perfect place for that, though.
761The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
762administrative files for @sc{cvs}.  The other directories contain the actual
763user-defined modules.
764
765@menu
766* Specifying a repository::     Telling CVS where your repository is
767* Repository storage::          The structure of the repository
768* Working directory storage::   The structure of working directories
769* Intro administrative files::  Defining modules
770* Multiple repositories::       Multiple repositories
771* Creating a repository::       Creating a repository
772* Backing up::                  Backing up a repository
773* Moving a repository::         Moving a repository
774* Remote repositories::         Accessing repositories on remote machines
775* Read-only access::            Granting read-only access to the repository
776* Server temporary directory::  The server creates temporary directories
777@end menu
778
779@node Specifying a repository
780@section Telling CVS where your repository is
781
782There are several ways to tell @sc{cvs}
783where to find the repository.  You can name the
784repository on the command line explicitly, with the
785@code{-d} (for "directory") option:
786
787@example
788cvs -d /usr/local/cvsroot checkout yoyodyne/tc
789@end example
790
791@cindex .profile, setting CVSROOT in
792@cindex .cshrc, setting CVSROOT in
793@cindex .tcshrc, setting CVSROOT in
794@cindex .bashrc, setting CVSROOT in
795@cindex CVSROOT, environment variable
796        Or you can set the @code{$CVSROOT} environment
797variable to an absolute path to the root of the
798repository, @file{/usr/local/cvsroot} in this example.
799To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
800users should have this line in their @file{.cshrc} or
801@file{.tcshrc} files:
802
803@example
804setenv CVSROOT /usr/local/cvsroot
805@end example
806
807@noindent
808@code{sh} and @code{bash} users should instead have these lines in their
809@file{.profile} or @file{.bashrc}:
810
811@example
812CVSROOT=/usr/local/cvsroot
813export CVSROOT
814@end example
815
816@cindex Root file, in CVS directory
817@cindex CVS/Root file
818        A repository specified with @code{-d} will
819override the @code{$CVSROOT} environment variable.
820Once you've checked a working copy out from the
821repository, it will remember where its repository is
822(the information is recorded in the
823@file{CVS/Root} file in the working copy).
824
825The @code{-d} option and the @file{CVS/Root} file both
826override the @code{$CVSROOT} environment variable.  If
827@code{-d} option differs from @file{CVS/Root}, the
828former is used.  Of course, for proper operation they
829should be two ways of referring to the same repository.
830
831@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
832@node Repository storage
833@section How data is stored in the repository
834@cindex Repository, how data is stored
835
836For most purposes it isn't important @emph{how}
837@sc{cvs} stores information in the repository.  In
838fact, the format has changed in the past, and is likely
839to change in the future.  Since in almost all cases one
840accesses the repository via @sc{cvs} commands, such
841changes need not be disruptive.
842
843However, in some cases it may be necessary to
844understand how @sc{cvs} stores data in the repository,
845for example you might need to track down @sc{cvs} locks
846(@pxref{Concurrency}) or you might need to deal with
847the file permissions appropriate for the repository.
848
849@menu
850* Repository files::            What files are stored in the repository
851* File permissions::            File permissions
852* Windows permissions::         Issues specific to Windows
853* Attic::                       Some files are stored in the Attic
854* CVS in repository::           Additional information in CVS directory
855* Locks::                       CVS locks control concurrent accesses
856* CVSROOT storage::             A few things about CVSROOT are different
857@end menu
858
859@node Repository files
860@subsection Where files are stored within the repository
861
862@c @cindex Filenames, legal
863@c @cindex Legal filenames
864@c Somewhere we need to say something about legitimate
865@c characters in filenames in working directory and
866@c repository.  Not "/" (not even on non-unix).  And
867@c here is a specific set of issues:
868@c 	Files starting with a - are handled inconsistently. They can not
869@c   be added to a repository with an add command, because it they are
870@c   interpreted as a switch. They can appear in a repository if they are
871@c   part of a tree that is imported. They can not be removed from the tree
872@c   once they are there.
873@c Note that "--" *is* supported (as a
874@c consequence of using GNU getopt).  Should document
875@c this somewhere ("Common options"?).  The other usual technique,
876@c "./-foo", isn't as effective, at least for "cvs add"
877@c which doesn't support pathnames containing "/".
878
879The overall structure of the repository is a directory
880tree corresponding to the directories in the working
881directory.  For example, supposing the repository is in
882
883@example
884/usr/local/cvsroot
885@end example
886
887@noindent
888here is a possible directory tree (showing only the
889directories):
890
891@example
892@t{/usr}
893 |
894 +--@t{local}
895 |   |
896 |   +--@t{cvsroot}
897 |   |    |
898 |   |    +--@t{CVSROOT}
899          |      (administrative files)
900          |
901          +--@t{gnu}
902          |   |
903          |   +--@t{diff}
904          |   |   (source code to @sc{gnu} diff)
905          |   |
906          |   +--@t{rcs}
907          |   |   (source code to @sc{rcs})
908          |   |
909          |   +--@t{cvs}
910          |       (source code to @sc{cvs})
911          |
912          +--@t{yoyodyne}
913              |
914              +--@t{tc}
915              |    |
916              |    +--@t{man}
917              |    |
918              |    +--@t{testing}
919              |
920              +--(other Yoyodyne software)
921@end example
922
923With the directories are @dfn{history files} for each file
924under version control.  The name of the history file is
925the name of the corresponding file with @samp{,v}
926appended to the end.  Here is what the repository for
927the @file{yoyodyne/tc} directory might look like:
928@c FIXME: Should also mention CVS (CVSREP)
929@c FIXME? Should we introduce Attic with an xref to
930@c Attic?  Not sure whether that is a good idea or not.
931@example
932  @code{$CVSROOT}
933    |
934    +--@t{yoyodyne}
935    |   |
936    |   +--@t{tc}
937    |   |   |
938            +--@t{Makefile,v}
939            +--@t{backend.c,v}
940            +--@t{driver.c,v}
941            +--@t{frontend.c,v}
942            +--@t{parser.c,v}
943            +--@t{man}
944            |    |
945            |    +--@t{tc.1,v}
946            |
947            +--@t{testing}
948                 |
949                 +--@t{testpgm.t,v}
950                 +--@t{test2.t,v}
951@end example
952
953@cindex History files
954@cindex RCS history files
955@c The first sentence, about what history files
956@c contain, is kind of redundant with our intro to what the
957@c repository does in node Repository....
958The history files contain, among other things, enough
959information to recreate any revision of the file, a log
960of all commit messages and the user-name of the person
961who committed the revision.  The history files are
962known as @dfn{RCS files}, because the first program to
963store files in that format was a version control system
964known as @sc{rcs}.  For a full
965description of the file format, see the @code{man} page
966@cite{rcsfile(5)}, distributed with @sc{rcs}, or the
967file @file{doc/RCSFILES} in the @sc{cvs} source
968distribution.  This
969file format has become very common---many systems other
970than @sc{cvs} or @sc{rcs} can at least import history
971files in this format.
972@c FIXME: Think about including documentation for this
973@c rather than citing it?  In the long run, getting
974@c this to be a standard (not sure if we can cope with
975@c a standards process as formal as IEEE/ANSI/ISO/etc,
976@c though...) is the way to go, so maybe citing is
977@c better.
978
979The @sc{rcs} files used in @sc{cvs} differ in a few
980ways from the standard format.  The biggest difference
981is magic branches; for more information see @ref{Magic
982branch numbers}.  Also in @sc{cvs} the valid tag names
983are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
984rules see @ref{Tags}.
985
986@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
987@node File permissions
988@subsection File permissions
989@c -- Move this to @node Creating a repository or similar
990@cindex Security, file permissions in repository
991@cindex File permissions, general
992@cindex Permissions, general
993@c FIXME: we need to somehow reflect "permissions in
994@c repository" versus "permissions in working
995@c directory" in the index entries.
996@cindex Group
997@cindex Read-only files, in repository
998All @samp{,v} files are created read-only, and you
999should not change the permission of those files.  The
1000directories inside the repository should be writable by
1001the persons that have permission to modify the files in
1002each directory.  This normally means that you must
1003create a UNIX group (see group(5)) consisting of the
1004persons that are to edit the files in a project, and
1005set up the repository so that it is that group that
1006owns the directory.
1007@c See also comment in commitinfo node regarding cases
1008@c which are really awkward with unix groups.
1009
1010This means that you can only control access to files on
1011a per-directory basis.
1012
1013Note that users must also have write access to check
1014out files, because @sc{cvs} needs to create lock files
1015(@pxref{Concurrency}).
1016
1017@c CVS seems to use CVSUMASK in picking permissions for
1018@c val-tags, but maybe we should say more about this.
1019@c Like val-tags gets created by someone who doesn't
1020@c have CVSUMASK set right?
1021Also note that users must have write access to the
1022@file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1023track of what tags are valid tag names (it is sometimes
1024updated when tags are used, as well as when they are
1025created).
1026
1027Each @sc{rcs} file will be owned by the user who last
1028checked it in.  This has little significance; what
1029really matters is who owns the directories.
1030
1031@cindex CVSUMASK, environment variable
1032@cindex Umask, for repository files
1033@sc{cvs} tries to set up reasonable file permissions
1034for new directories that are added inside the tree, but
1035you must fix the permissions manually when a new
1036directory should have different permissions than its
1037parent directory.  If you set the @code{CVSUMASK}
1038environment variable that will control the file
1039permissions which @sc{cvs} uses in creating directories
1040and/or files in the repository.  @code{CVSUMASK} does
1041not affect the file permissions in the working
1042directory; such files have the permissions which are
1043typical for newly created files, except that sometimes
1044@sc{cvs} creates them read-only (see the sections on
1045watches, @ref{Setting a watch}; -r, @ref{Global
1046options}; or @code{CVSREAD}, @ref{Environment variables}).
1047@c FIXME: Need more discussion of which
1048@c group should own the file in the repository.
1049@c Include a somewhat detailed example of the usual
1050@c case where CVSUMASK is 007, the developers are all
1051@c in a group, and that group owns stuff in the
1052@c repository.  Need to talk about group ownership of
1053@c newly-created directories/files (on some unices,
1054@c such as SunOS4, setting the setgid bit on the
1055@c directories will make files inherit the directory's
1056@c group.  On other unices, your mileage may vary.  I
1057@c can't remember what POSIX says about this, if
1058@c anything).
1059
1060Note that using the client/server @sc{cvs}
1061(@pxref{Remote repositories}), there is no good way to
1062set @code{CVSUMASK}; the setting on the client machine
1063has no effect.  If you are connecting with @code{rsh}, you
1064can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1065described in the documentation for your operating
1066system.  This behavior might change in future versions
1067of @sc{cvs}; do not rely on the setting of
1068@code{CVSUMASK} on the client having no effect.
1069@c FIXME: need to explain what a umask is or cite
1070@c someplace which does.
1071@c
1072@c There is also a larger (largely separate) issue
1073@c about the meaning of CVSUMASK in a non-unix context.
1074@c For example, whether there is
1075@c an equivalent which fits better into other
1076@c protection schemes like POSIX.6, VMS, &c.
1077@c
1078@c FIXME: Need one place which discusses this
1079@c read-only files thing.  Why would one use -r or
1080@c CVSREAD?  Why would one use watches?  How do they
1081@c interact?
1082@c
1083@c FIXME: We need to state
1084@c whether using CVSUMASK removes the need for manually
1085@c fixing permissions (in fact, if we are going to mention
1086@c manually fixing permission, we better document a lot
1087@c better just what we mean by "fix").
1088
1089Using pserver, you will generally need stricter
1090permissions on the @sc{cvsroot} directory and
1091directories above it in the tree; see @ref{Password
1092authentication security}.
1093
1094@cindex Setuid
1095@cindex Setgid
1096@cindex Security, setuid
1097@cindex Installed images (VMS)
1098Some operating systems have features which allow a
1099particular program to run with the ability to perform
1100operations which the caller of the program could not.
1101For example, the set user ID (setuid) or set group ID
1102(setgid) features of unix or the installed image
1103feature of VMS.  @sc{cvs} was not written to use such
1104features and therefore attempting to install @sc{cvs} in
1105this fashion will provide protection against only
1106accidental lapses; anyone who is trying to circumvent
1107the measure will be able to do so, and depending on how
1108you have set it up may gain access to more than just
1109@sc{cvs}.  You may wish to instead consider pserver.  It
1110shares some of the same attributes, in terms of
1111possibly providing a false sense of security or opening
1112security holes wider than the ones you are trying to
1113fix, so read the documentation on pserver security
1114carefully if you are considering this option
1115(@ref{Password authentication security}).
1116
1117@node Windows permissions
1118@subsection File Permission issues specific to Windows
1119@cindex Windows, and permissions
1120@cindex File permissions, Windows-specific
1121@cindex Permissions, Windows-specific
1122
1123Some file permission issues are specific to Windows
1124operating systems (Windows 95, Windows NT, and
1125presumably future operating systems in this family.
1126Some of the following might apply to OS/2 but I'm not
1127sure).
1128
1129If you are using local @sc{cvs} and the repository is on a
1130networked file system which is served by the Samba SMB
1131server, some people have reported problems with
1132permissions.  Enabling WRITE=YES in the samba
1133configuration is said to fix/workaround it.
1134Disclaimer: I haven't investigated enough to know the
1135implications of enabling that option, nor do I know
1136whether there is something which @sc{cvs} could be doing
1137differently in order to avoid the problem.  If you find
1138something out, please let us know as described in
1139@ref{BUGS}.
1140
1141@node Attic
1142@subsection The attic
1143@cindex Attic
1144
1145You will notice that sometimes @sc{cvs} stores an
1146@sc{rcs} file in the @code{Attic}.  For example, if the
1147@sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1148talking about the file @file{backend.c} in the
1149directory @file{yoyodyne/tc}, then the file normally
1150would be in
1151
1152@example
1153/usr/local/cvsroot/yoyodyne/tc/backend.c,v
1154@end example
1155
1156but if it goes in the attic, it would be in
1157
1158@example
1159/usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1160@end example
1161
1162@cindex Dead state
1163instead.  It should not matter from a user point of
1164view whether a file is in the attic; @sc{cvs} keeps
1165track of this and looks in the attic when it needs to.
1166But in case you want to know, the rule is that the RCS
1167file is stored in the attic if and only if the head
1168revision on the trunk has state @code{dead}.  A
1169@code{dead} state means that file has been removed, or
1170never added, for that revision.  For example, if you
1171add a file on a branch, it will have a trunk revision
1172in @code{dead} state, and a branch revision in a
1173non-@code{dead} state.
1174@c Probably should have some more concrete examples
1175@c here, or somewhere (not sure exactly how we should
1176@c arrange the discussion of the dead state, versus
1177@c discussion of the attic).
1178
1179@node CVS in repository
1180@subsection The CVS directory in the repository
1181@cindex CVS directory, in repository
1182
1183The @file{CVS} directory in each repository directory
1184contains information such as file attributes (in a file
1185called @file{CVS/fileattr}.  In the
1186future additional files may be added to this directory,
1187so implementations should silently ignore additional
1188files.
1189
1190This behavior is implemented only by @sc{cvs} 1.7 and
1191later; for details see @ref{Watches Compatibility}.
1192
1193The format of the fileattr file is a series of entries
1194of the following form (where @samp{@{} and @samp{@}}
1195means the text between the braces can be repeated zero
1196or more times):
1197
1198@var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1199  @{; @var{attrname} = @var{attrval}@} <linefeed>
1200
1201@var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1202attributes for that file.
1203
1204@var{ent-type} is @samp{D},
1205and @var{filename} empty, to specify default attributes
1206to be used for newly added files.
1207
1208Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1209will delete them any time it writes file attributes.
1210@sc{cvs} 1.10 and later will preserve them.
1211
1212Note that the order of the lines is not significant;
1213a program writing the fileattr file may
1214rearrange them at its convenience.
1215
1216There is currently no way of quoting tabs or linefeeds in the
1217filename, @samp{=} in @var{attrname},
1218@samp{;} in @var{attrval}, etc.  Note: some implementations also
1219don't handle a NUL character in any of the fields, but
1220implementations are encouraged to allow it.
1221
1222By convention, @var{attrname} starting with @samp{_} is for an attribute given
1223special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1224(or will be, once implementations start supporting user-defined attributes).
1225
1226Builtin attributes:
1227
1228@table @code
1229@item _watched
1230Present means the file is watched and should be checked out
1231read-only.
1232
1233@item _watchers
1234Users with watches for this file.  Value is
1235@var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1236where @var{watcher} is a username, and @var{type}
1237is zero or more of edit,unedit,commit separated by
1238@samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1239
1240@item _editors
1241Users editing this file.  Value is
1242@var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1243where @var{editor} is a username, and @var{val} is
1244@var{time}+@var{hostname}+@var{pathname}, where
1245@var{time} is when the @code{cvs edit} command (or
1246equivalent) happened,
1247and @var{hostname} and @var{pathname} are for the working directory.
1248@end table
1249
1250Example:
1251
1252@c FIXME: sanity.sh should contain a similar test case
1253@c so we can compare this example from something from
1254@c Real Life(TM).  See cvsclient.texi (under Notify) for more
1255@c discussion of the date format of _editors.
1256@example
1257Ffile1 _watched=;_watchers=joe>edit,mary>commit
1258Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1259D _watched=
1260@end example
1261
1262means that the file @file{file1} should be checked out
1263read-only.  Furthermore, joe is watching for edits and
1264mary is watching for commits.  The file @file{file2}
1265should be checked out read-only; sue started editing it
1266on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1267the machine @code{workstn1}.  Future files which are
1268added should be checked out read-only.  To represent
1269this example here, we have shown a space after
1270@samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1271there must be a single tab character there and no spaces.
1272
1273@node Locks
1274@subsection CVS locks in the repository
1275
1276@cindex #cvs.rfl, technical details
1277@cindex #cvs.wfl, technical details
1278@cindex #cvs.lock, technical details
1279@cindex Locks, cvs, technical details
1280For an introduction to @sc{cvs} locks focusing on
1281user-visible behavior, see @ref{Concurrency}.  The
1282following section is aimed at people who are writing
1283tools which want to access a @sc{cvs} repository without
1284interfering with other tools acessing the same
1285repository.  If you find yourself confused by concepts
1286described here, like @dfn{read lock}, @dfn{write lock},
1287and @dfn{deadlock}, you might consult the literature on
1288operating systems or databases.
1289
1290@cindex #cvs.tfl
1291Any file in the repository with a name starting
1292with @file{#cvs.rfl.} is a read lock.  Any file in
1293the repository with a name starting with
1294@file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1295(before @sc{cvs} 1.5) also created files with names starting
1296with @file{#cvs.tfl}, but they are not discussed here.
1297The directory @file{#cvs.lock} serves as a master
1298lock.  That is, one must obtain this lock first before
1299creating any of the other locks.
1300
1301To obtain a readlock, first create the @file{#cvs.lock}
1302directory.  This operation must be atomic (which should
1303be true for creating a directory under most operating
1304systems).  If it fails because the directory already
1305existed, wait for a while and try again.  After
1306obtaining the @file{#cvs.lock} lock, create a file
1307whose name is @file{#cvs.rfl.} followed by information
1308of your choice (for example, hostname and process
1309identification number).  Then remove the
1310@file{#cvs.lock} directory to release the master lock.
1311Then proceed with reading the repository.  When you are
1312done, remove the @file{#cvs.rfl} file to release the
1313read lock.
1314
1315To obtain a writelock, first create the
1316@file{#cvs.lock} directory, as with a readlock.  Then
1317check that there are no files whose names start with
1318@file{#cvs.rfl.}.  If there are, remove
1319@file{#cvs.lock}, wait for a while, and try again.  If
1320there are no readers, then create a file whose name is
1321@file{#cvs.wfl} followed by information of your choice
1322(for example, hostname and process identification
1323number).  Hang on to the @file{#cvs.lock} lock.  Proceed
1324with writing the repository.  When you are done, first
1325remove the @file{#cvs.wfl} file and then the
1326@file{#cvs.lock} directory. Note that unlike the
1327@file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1328informational; it has no effect on the locking operation
1329beyond what is provided by holding on to the
1330@file{#cvs.lock} lock itself.
1331
1332Note that each lock (writelock or readlock) only locks
1333a single directory in the repository, including
1334@file{Attic} and @file{CVS} but not including
1335subdirectories which represent other directories under
1336version control.  To lock an entire tree, you need to
1337lock each directory (note that if you fail to obtain
1338any lock you need, you must release the whole tree
1339before waiting and trying again, to avoid deadlocks).
1340
1341Note also that @sc{cvs} expects writelocks to control
1342access to individual @file{foo,v} files.  @sc{rcs} has
1343a scheme where the @file{,foo,} file serves as a lock,
1344but @sc{cvs} does not implement it and so taking out a
1345@sc{cvs} writelock is recommended.  See the comments at
1346rcs_internal_lockfile in the @sc{cvs} source code for
1347further discussion/rationale.
1348
1349@node CVSROOT storage
1350@subsection How files are stored in the CVSROOT directory
1351@cindex CVSROOT, storage of files
1352
1353The @file{$CVSROOT/CVSROOT} directory contains the
1354various administrative files.  In some ways this
1355directory is just like any other directory in the
1356repository; it contains @sc{rcs} files whose names end
1357in @samp{,v}, and many of the @sc{cvs} commands operate
1358on it the same way.  However, there are a few
1359differences.
1360
1361For each administrative file, in addition to the
1362@sc{rcs} file, there is also a checked out copy of the
1363file.  For example, there is an @sc{rcs} file
1364@file{loginfo,v} and a file @file{loginfo} which
1365contains the latest revision contained in
1366@file{loginfo,v}.  When you check in an administrative
1367file, @sc{cvs} should print
1368
1369@example
1370cvs commit: Rebuilding administrative file database
1371@end example
1372
1373@noindent
1374and update the checked out copy in
1375@file{$CVSROOT/CVSROOT}.  If it does not, there is
1376something wrong (@pxref{BUGS}).  To add your own files
1377to the files to be updated in this fashion, you can add
1378them to the @file{checkoutlist} administrative file
1379(@pxref{checkoutlist}).
1380
1381@cindex modules.db
1382@cindex modules.pag
1383@cindex modules.dir
1384By default, the @file{modules} file behaves as
1385described above.  If the modules file is very large,
1386storing it as a flat text file may make looking up
1387modules slow (I'm not sure whether this is as much of a
1388concern now as when @sc{cvs} first evolved this
1389feature; I haven't seen benchmarks).  Therefore, by
1390making appropriate edits to the @sc{cvs} source code
1391one can store the modules file in a database which
1392implements the @code{ndbm} interface, such as Berkeley
1393db or GDBM.  If this option is in use, then the modules
1394database will be stored in the files @file{modules.db},
1395@file{modules.pag}, and/or @file{modules.dir}.
1396@c I think fileattr also will use the database stuff.
1397@c Anything else?
1398
1399For information on the meaning of the various
1400administrative files, see @ref{Administrative files}.
1401
1402@node Working directory storage
1403@section How data is stored in the working directory
1404
1405@c FIXME: Somewhere we should discuss timestamps (test
1406@c case "stamps" in sanity.sh).  But not here.  Maybe
1407@c in some kind of "working directory" chapter which
1408@c would encompass the "Builds" one?  But I'm not sure
1409@c whether that is a good organization (is it based on
1410@c what the user wants to do?).
1411
1412@cindex CVS directory, in working directory
1413While we are discussing @sc{cvs} internals which may
1414become visible from time to time, we might as well talk
1415about what @sc{cvs} puts in the @file{CVS} directories
1416in the working directories.  As with the repository,
1417@sc{cvs} handles this information and one can usually
1418access it via @sc{cvs} commands.  But in some cases it
1419may be useful to look at it, and other programs, such
1420as the @code{jCVS} graphical user interface or the
1421@code{VC} package for emacs, may need to look at it.
1422Such programs should follow the recommendations in this
1423section if they hope to be able to work with other
1424programs which use those files, including future
1425versions of the programs just mentioned and the
1426command-line @sc{cvs} client.
1427
1428The @file{CVS} directory contains several files.
1429Programs which are reading this directory should
1430silently ignore files which are in the directory but
1431which are not documented here, to allow for future
1432expansion.
1433
1434The files are stored according to the text file
1435convention for the system in question.  This means that
1436working directories are not portable between systems
1437with differing conventions for storing text files.
1438This is intentional, on the theory that the files being
1439managed by @sc{cvs} probably will not be portable between
1440such systems either.
1441
1442@table @file
1443@item Root
1444This file contains the current @sc{cvs} root, as
1445described in @ref{Specifying a repository}.
1446
1447@cindex Repository file, in CVS directory
1448@cindex CVS/Repository file
1449@item Repository
1450This file contains the directory within the repository
1451which the current directory corresponds with.  It can
1452be either an absolute pathname or a relative pathname;
1453@sc{cvs} has had the ability to read either format
1454since at least version 1.3 or so.  The relative
1455pathname is relative to the root, and is the more
1456sensible approach, but the absolute pathname is quite
1457common and implementations should accept either.  For
1458example, after the command
1459
1460@example
1461cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1462@end example
1463
1464@file{Root} will contain
1465
1466@example
1467:local:/usr/local/cvsroot
1468@end example
1469
1470and @file{Repository} will contain either
1471
1472@example
1473/usr/local/cvsroot/yoyodyne/tc
1474@end example
1475
1476@noindent
1477or
1478
1479@example
1480yoyodyne/tc
1481@end example
1482
1483If the particular working directory does not correspond
1484to a directory in the repository, then @file{Repository}
1485should contain @file{CVSROOT/Emptydir}.
1486
1487@cindex Entries file, in CVS directory
1488@cindex CVS/Entries file
1489@item Entries
1490This file lists the files and directories in the
1491working directory.
1492The first character of each line indicates what sort of
1493line it is.  If the character is unrecognized, programs
1494reading the file should silently skip that line, to
1495allow for future expansion.
1496
1497If the first character is @samp{/}, then the format is:
1498
1499@example
1500/@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1501@end example
1502
1503where @samp{[} and @samp{]} are not part of the entry,
1504but instead indicate that the @samp{+} and conflict
1505marker are optional.  @var{name} is the name of the
1506file within the directory.  @var{revision} is the
1507revision that the file in the working derives from, or
1508@samp{0} for an added file, or @samp{-} followed by a
1509revision for a removed file.  @var{timestamp} is the
1510timestamp of the file at the time that @sc{cvs} created
1511it; if the timestamp differs with the actual
1512modification time of the file it means the file has
1513been modified.  It is stored in
1514the format used by the ISO C asctime() function (for
1515example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1516write a string which is not in that format, for
1517example, @samp{Result of merge}, to indicate that the
1518file should always be considered to be modified.  This
1519is not a special case; to see whether a file is
1520modified a program should take the timestamp of the file
1521and simply do a string compare with @var{timestamp}.
1522If there was a conflict, @var{conflict} can be set to
1523the modification time of the file after the file has been
1524written with conflict markers (@pxref{Conflicts example}).
1525Thus if @var{conflict} is subsequently the same as the actual
1526modification time of the file it means that the user
1527has obviously not resolved the conflict.  @var{options}
1528contains sticky options (for example @samp{-kb} for a
1529binary file).  @var{tagdate} contains @samp{T} followed
1530by a tag name, or @samp{D} for a date, followed by a
1531sticky tag or date.  Note that if @var{timestamp}
1532contains a pair of timestamps separated by a space,
1533rather than a single timestamp, you are dealing with a
1534version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1535documented here).
1536
1537The timezone on the timestamp in CVS/Entries (local or
1538universal) should be the same as the operating system
1539stores for the timestamp of the file itself.  For
1540example, on Unix the file's timestamp is in universal
1541time (UT), so the timestamp in CVS/Entries should be
1542too.  On @sc{vms}, the file's timestamp is in local
1543time, so @sc{cvs} on @sc{vms} should use local time.
1544This rule is so that files do not appear to be modified
1545merely because the timezone changed (for example, to or
1546from summer time).
1547@c See comments and calls to gmtime() and friends in
1548@c src/vers_ts.c (function time_stamp).
1549
1550If the first character of a line in @file{Entries} is
1551@samp{D}, then it indicates a subdirectory.  @samp{D}
1552on a line all by itself indicates that the program
1553which wrote the @file{Entries} file does record
1554subdirectories (therefore, if there is such a line and
1555no other lines beginning with @samp{D}, one knows there
1556are no subdirectories).  Otherwise, the line looks
1557like:
1558
1559@example
1560D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1561@end example
1562
1563where @var{name} is the name of the subdirectory, and
1564all the @var{filler} fields should be silently ignored,
1565for future expansion.  Programs which modify
1566@code{Entries} files should preserve these fields.
1567
1568The lines in the @file{Entries} file can be in any order.
1569
1570@cindex Entries.Log file, in CVS directory
1571@cindex CVS/Entries.Log file
1572@item Entries.Log
1573This file does not record any information beyond that
1574in @file{Entries}, but it does provide a way to update
1575the information without having to rewrite the entire
1576@file{Entries} file, including the ability to preserve
1577the information even if the program writing
1578@file{Entries} and @file{Entries.Log} abruptly aborts.
1579Programs which are reading the @file{Entries} file
1580should also check for @file{Entries.Log}.  If the latter
1581exists, they should read @file{Entries} and then apply
1582the changes mentioned in @file{Entries.Log}.  After
1583applying the changes, the recommended practice is to
1584rewrite @file{Entries} and then delete @file{Entries.Log}.
1585The format of a line in @file{Entries.Log} is a single
1586character command followed by a space followed by a
1587line in the format specified for a line in
1588@file{Entries}.  The single character command is
1589@samp{A} to indicate that the entry is being added,
1590@samp{R} to indicate that the entry is being removed,
1591or any other character to indicate that the entire line
1592in @file{Entries.Log} should be silently ignored (for
1593future expansion).  If the second character of the line
1594in @file{Entries.Log} is not a space, then it was
1595written by an older version of @sc{cvs} (not documented
1596here).
1597
1598Programs which are writing rather than reading can
1599safely ignore @file{Entries.Log} if they so choose.
1600
1601@cindex Entries.Backup file, in CVS directory
1602@cindex CVS/Entries.Backup file
1603@item Entries.Backup
1604This is a temporary file.  Recommended usage is to
1605write a new entries file to @file{Entries.Backup}, and
1606then to rename it (atomically, where possible) to @file{Entries}.
1607
1608@cindex Entries.Static file, in CVS directory
1609@cindex CVS/Entries.Static file
1610@item Entries.Static
1611The only relevant thing about this file is whether it
1612exists or not.  If it exists, then it means that only
1613part of a directory was gotten and @sc{cvs} will
1614not create additional files in that directory.  To
1615clear it, use the @code{update} command with the
1616@samp{-d} option, which will get the additional files
1617and remove @file{Entries.Static}.
1618@c FIXME: This needs to be better documented, in places
1619@c other than Working Directory Storage.
1620@c FIXCVS: The fact that this setting exists needs to
1621@c be more visible to the user.  For example "cvs
1622@c status foo", in the case where the file would be
1623@c gotten except for Entries.Static, might say
1624@c something to distinguish this from other cases.
1625@c One thing that periodically gets suggested is to
1626@c have "cvs update" print something when it skips
1627@c files due to Entries.Static, but IMHO that kind of
1628@c noise pretty much makes the Entries.Static feature
1629@c useless.
1630
1631@cindex Tag file, in CVS directory
1632@cindex CVS/Tag file
1633@cindex Sticky tags/dates, per-directory
1634@cindex Per-directory sticky tags/dates
1635@item Tag
1636This file contains per-directory sticky tags or dates.
1637The first character is @samp{T} for a branch tag,
1638@samp{N} for a non-branch tag, or @samp{D} for a date,
1639or another character to mean the file should be
1640silently ignored, for future expansion.  This character
1641is followed by the tag or date.  Note that
1642per-directory sticky tags or dates are used for things
1643like applying to files which are newly added; they
1644might not be the same as the sticky tags or dates on
1645individual files.  For general information on sticky
1646tags and dates, see @ref{Sticky tags}.
1647@c FIXME: This needs to be much better documented,
1648@c preferably not in the context of "working directory
1649@c storage".
1650@c FIXME: The Sticky tags node needs to discuss, or xref to
1651@c someplace which discusses, per-directory sticky
1652@c tags and the distinction with per-file sticky tags.
1653
1654@cindex Checkin.prog file, in CVS directory
1655@cindex CVS/Checkin.prog file
1656@cindex Update.prog file, in CVS directory
1657@cindex CVS/Update.prog file
1658@item Checkin.prog
1659@itemx Update.prog
1660These files store the programs specified by the
1661@samp{-i} and @samp{-u} options in the modules file,
1662respectively.
1663
1664@cindex Notify file, in CVS directory
1665@cindex CVS/Notify file
1666@item Notify
1667This file stores notifications (for example, for
1668@code{edit} or @code{unedit}) which have not yet been
1669sent to the server.  Its format is not yet documented
1670here.
1671
1672@cindex Notify.tmp file, in CVS directory
1673@cindex CVS/Notify.tmp file
1674@item Notify.tmp
1675This file is to @file{Notify} as @file{Entries.Backup}
1676is to @file{Entries}.  That is, to write @file{Notify},
1677first write the new contents to @file{Notify.tmp} and
1678then (atomically where possible), rename it to
1679@file{Notify}.
1680
1681@cindex Base directory, in CVS directory
1682@cindex CVS/Base directory
1683@item Base
1684If watches are in use, then an @code{edit} command
1685stores the original copy of the file in the @file{Base}
1686directory.  This allows the @code{unedit} command to
1687operate even if it is unable to communicate with the
1688server.
1689
1690@cindex Baserev file, in CVS directory
1691@cindex CVS/Baserev file
1692@item Baserev
1693The file lists the revision for each of the files in
1694the @file{Base} directory.  The format is:
1695
1696@example
1697B@var{name}/@var{rev}/@var{expansion}
1698@end example
1699
1700where @var{expansion} should be ignored, to allow for
1701future expansion.
1702
1703@cindex Baserev.tmp file, in CVS directory
1704@cindex CVS/Baserev.tmp file
1705@item Baserev.tmp
1706This file is to @file{Baserev} as @file{Entries.Backup}
1707is to @file{Entries}.  That is, to write @file{Baserev},
1708first write the new contents to @file{Baserev.tmp} and
1709then (atomically where possible), rename it to
1710@file{Baserev}.
1711
1712@cindex Template file, in CVS directory
1713@cindex CVS/Template file
1714@item Template
1715This file contains the template specified by the
1716@file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1717by the client; the non-client/server @sc{cvs} consults
1718@file{rcsinfo} directly.
1719@end table
1720
1721@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1722@node Intro administrative files
1723@section The administrative files
1724@cindex Administrative files (intro)
1725@cindex Modules file
1726@cindex CVSROOT, module name
1727@cindex Defining modules (intro)
1728
1729@c FIXME: this node should be reorganized into "general
1730@c information about admin files" and put the "editing
1731@c admin files" stuff up front rather than jumping into
1732@c the details of modules right away.  Then the
1733@c Administrative files node can go away, the information
1734@c on each admin file distributed to a place appropriate
1735@c to its function, and this node can contain a table
1736@c listing each file and a @ref to its detailed description.
1737
1738The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1739files}.  @xref{Administrative files}, for a complete description.
1740You can use @sc{cvs} without any of these files, but
1741some commands work better when at least the
1742@file{modules} file is properly set up.
1743
1744The most important of these files is the @file{modules}
1745file.  It defines all modules in the repository.  This
1746is a sample @file{modules} file.
1747
1748@c FIXME: The CVSROOT line is a goofy example now that
1749@c mkmodules doesn't exist.
1750@example
1751CVSROOT         CVSROOT
1752modules         CVSROOT modules
1753cvs             gnu/cvs
1754rcs             gnu/rcs
1755diff            gnu/diff
1756tc              yoyodyne/tc
1757@end example
1758
1759The @file{modules} file is line oriented.  In its
1760simplest form each line contains the name of the
1761module, whitespace, and the directory where the module
1762resides.  The directory is a path relative to
1763@code{$CVSROOT}.  The last four lines in the example
1764above are examples of such lines.
1765
1766@c FIXME: might want to introduce the concept of options in modules file
1767@c (the old example which was here, -i mkmodules, is obsolete).
1768
1769The line that defines the module called @samp{modules}
1770uses features that are not explained here.
1771@xref{modules}, for a full explanation of all the
1772available features.
1773
1774@c FIXME: subsection without node is bogus
1775@subsection Editing administrative files
1776@cindex Editing administrative files
1777@cindex Administrative files, editing them
1778
1779You edit the administrative files in the same way that you would edit
1780any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1781copy, edit it, and commit your changes in the normal way.
1782
1783It is possible to commit an erroneous administrative
1784file.  You can often fix the error and check in a new
1785revision, but sometimes a particularly bad error in the
1786administrative file makes it impossible to commit new
1787revisions.
1788@c @xref{Bad administrative files} for a hint
1789@c about how to solve such situations.
1790@c -- administrative file checking--
1791
1792@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1793@node Multiple repositories
1794@section Multiple repositories
1795@cindex Multiple repositories
1796@cindex Repositories, multiple
1797@cindex Many repositories
1798@cindex Parallel repositories
1799@cindex Disjoint repositories
1800@cindex CVSROOT, multiple repositories
1801
1802In some situations it is a good idea to have more than
1803one repository, for instance if you have two
1804development groups that work on separate projects
1805without sharing any code.  All you have to do to have
1806several repositories is to specify the appropriate
1807repository, using the @code{CVSROOT} environment
1808variable, the @samp{-d} option to @sc{cvs}, or (once
1809you have checked out a working directory) by simply
1810allowing @sc{cvs} to use the repository that was used
1811to check out the working directory
1812(@pxref{Specifying a repository}).
1813
1814The big advantage of having multiple repositories is
1815that they can reside on different servers.  With @sc{cvs}
1816version 1.10, a single command cannot recurse into
1817directories from different repositories.  With development
1818versions of @sc{cvs}, you can check out code from multiple
1819servers into your working directory.  @sc{cvs} will
1820recurse and handle all the details of making
1821connections to as many server machines as necessary to
1822perform the requested command.  Here is an example of
1823how to set up a working directory:
1824
1825@example
1826cvs -d server1:/cvs co dir1
1827cd dir1
1828cvs -d server2:/root co sdir
1829cvs update
1830@end example
1831
1832The @code{cvs co} commands set up the working
1833directory, and then the @code{cvs update} command will
1834contact server2, to update the dir1/sdir subdirectory,
1835and server1, to update everything else.
1836
1837@c FIXME: Does the FAQ have more about this?  I have a
1838@c dim recollection, but I'm too lazy to check right now.
1839
1840@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1841@node Creating a repository
1842@section Creating a repository
1843
1844@cindex Repository, setting up
1845@cindex Creating a repository
1846@cindex Setting up a repository
1847
1848To set up a @sc{cvs} repository, first choose the
1849machine and disk on which you want to store the
1850revision history of the source files.  CPU and memory
1851requirements are modest, so most machines should be
1852adequate.  For details see @ref{Server requirements}.
1853@c Possible that we should be providing a quick rule of
1854@c thumb, like the 32M memory for the server.  That
1855@c might increase the number of people who are happy
1856@c with the answer, without following the xref.
1857
1858To estimate disk space
1859requirements, if you are importing RCS files from
1860another system, the size of those files is the
1861approximate initial size of your repository, or if you
1862are starting without any version history, a rule of
1863thumb is to allow for the server approximately three
1864times the size of the code to be under @sc{cvs} for the
1865repository (you will eventually outgrow this, but not
1866for a while).  On the machines on which the developers
1867will be working, you'll want disk space for
1868approximately one working directory for each developer
1869(either the entire tree or a portion of it, depending
1870on what each developer uses).
1871
1872The repository should be accessible
1873(directly or via a networked file system) from all
1874machines which want to use @sc{cvs} in server or local
1875mode; the client machines need not have any access to
1876it other than via the @sc{cvs} protocol.  It is not
1877possible to use @sc{cvs} to read from a repository
1878which one only has read access to; @sc{cvs} needs to be
1879able to create lock files (@pxref{Concurrency}).
1880
1881@cindex init (subcommand)
1882To create a repository, run the @code{cvs init}
1883command.  It will set up an empty repository in the
1884@sc{cvs} root specified in the usual way
1885(@pxref{Repository}).  For example,
1886
1887@example
1888cvs -d /usr/local/cvsroot init
1889@end example
1890
1891@code{cvs init} is careful to never overwrite any
1892existing files in the repository, so no harm is done if
1893you run @code{cvs init} on an already set-up
1894repository.
1895
1896@code{cvs init} will enable history logging; if you
1897don't want that, remove the history file after running
1898@code{cvs init}.  @xref{history file}.
1899
1900@node Backing up
1901@section Backing up a repository
1902@cindex Repository, backing up
1903@cindex Backing up, repository
1904
1905There is nothing particularly magical about the files
1906in the repository; for the most part it is possible to
1907back them up just like any other files.  However, there
1908are a few issues to consider.
1909
1910@cindex Locks, cvs, and backups
1911@cindex #cvs.rfl, and backups
1912The first is that to be paranoid, one should either not
1913use @sc{cvs} during the backup, or have the backup
1914program lock @sc{cvs} while doing the backup.  To not
1915use @sc{cvs}, you might forbid logins to machines which
1916can access the repository, turn off your @sc{cvs}
1917server, or similar mechanisms.  The details would
1918depend on your operating system and how you have
1919@sc{cvs} set up.  To lock @sc{cvs}, you would create
1920@file{#cvs.rfl} locks in each repository directory.
1921See @ref{Concurrency}, for more on @sc{cvs} locks.
1922Having said all this, if you just back up without any
1923of these precautions, the results are unlikely to be
1924particularly dire.  Restoring from backup, the
1925repository might be in an inconsistent state, but this
1926would not be particularly hard to fix manually.
1927
1928When you restore a repository from backup, assuming
1929that changes in the repository were made after the time
1930of the backup, working directories which were not
1931affected by the failure may refer to revisions which no
1932longer exist in the repository.  Trying to run @sc{cvs}
1933in such directories will typically produce an error
1934message.  One way to get those changes back into the
1935repository is as follows:
1936
1937@itemize @bullet
1938@item
1939Get a new working directory.
1940
1941@item
1942Copy the files from the working directory from before
1943the failure over to the new working directory (do not
1944copy the contents of the @file{CVS} directories, of
1945course).
1946
1947@item
1948Working in the new working directory, use commands such
1949as @code{cvs update} and @code{cvs diff} to figure out
1950what has changed, and then when you are ready, commit
1951the changes into the repository.
1952@end itemize
1953
1954@node Moving a repository
1955@section Moving a repository
1956@cindex Repository, moving
1957@cindex Moving a repository
1958@cindex Copying a repository
1959
1960Just as backing up the files in the repository is
1961pretty much like backing up any other files, if you
1962need to move a repository from one place to another it
1963is also pretty much like just moving any other
1964collection of files.
1965
1966The main thing to consider is that working directories
1967point to the repository.  The simplest way to deal with
1968a moved repository is to just get a fresh working
1969directory after the move.  Of course, you'll want to
1970make sure that the old working directory had been
1971checked in before the move, or you figured out some
1972other way to make sure that you don't lose any
1973changes.  If you really do want to reuse the existing
1974working directory, it should be possible with manual
1975surgery on the @file{CVS/Repository} files.  You can
1976see @ref{Working directory storage}, for information on
1977the @file{CVS/Repository} and @file{CVS/Root} files, but
1978unless you are sure you want to bother, it probably
1979isn't worth it.
1980@c FIXME: Surgery on CVS/Repository should be avoided
1981@c by making RELATIVE_REPOS the default.
1982@c FIXME-maybe: might want some documented way to
1983@c change the CVS/Root files in some particular tree.
1984@c But then again, I don't know, maybe just having
1985@c people do this in perl/shell/&c isn't so bad...
1986
1987@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1988@node Remote repositories
1989@section Remote repositories
1990@cindex Repositories, remote
1991@cindex Remote repositories
1992@cindex Client/Server Operation
1993@cindex Server, CVS
1994@cindex Remote repositories, port specification
1995@cindex Repositories, remote, port specification
1996@cindex Client/Server Operation, port specification
1997@cindex pserver (client/server connection method), port specification
1998@cindex kserver (client/server connection method), port specification
1999@cindex gserver (client/server connection method), port specification
2000@cindex port, specifying for remote repositories
2001
2002        Your working copy of the sources can be on a
2003different machine than the repository.  Using @sc{cvs}
2004in this manner is known as @dfn{client/server}
2005operation.  You run @sc{cvs} on a machine which can
2006mount your working directory, known as the
2007@dfn{client}, and tell it to communicate to a machine
2008which can mount the repository, known as the
2009@dfn{server}.  Generally, using a remote
2010repository is just like using a local one, except that
2011the format of the repository name is:
2012
2013@example
2014:@var{method}:[[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2015@end example
2016
2017Specifying a password in the repository name is not recommended during
2018checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2019password in each created directory.  @code{cvs login} first instead
2020(@pxref{Password authentication client}).
2021
2022The details of exactly what needs to be set up depend
2023on how you are connecting to the server.
2024
2025If @var{method} is not specified, and the repository
2026name contains @samp{:}, then the default is @code{ext}
2027or @code{server}, depending on your platform; both are
2028described in @ref{Connecting via rsh}.
2029@c Should we try to explain which platforms are which?
2030@c Platforms like unix and VMS, which only allow
2031@c privileged programs to bind to sockets <1024 lose on
2032@c :server:
2033@c Platforms like Mac and VMS, whose rsh program is
2034@c unusable or nonexistent, lose on :ext:
2035@c Platforms like OS/2 and NT probably could plausibly
2036@c default either way (modulo -b troubles).
2037
2038@c FIXME: We need to have a better way of explaining
2039@c what method to use.  This presentation totally
2040@c obscures the fact that :ext: and CVS_RSH is the way to
2041@c use SSH, for example.  Plus it incorrectly implies
2042@c that you need an @code{rsh} binary on the client to use
2043@c :server:.
2044@c Also note that rsh not pserver is the right choice if you want
2045@c users to be able to create their own repositories
2046@c (because of the --allow-root related issues).
2047@menu
2048* Server requirements::         Memory and other resources for servers
2049* Connecting via rsh::          Using the @code{rsh} program to connect
2050* Password authenticated::      Direct connections using passwords
2051* GSSAPI authenticated::        Direct connections using GSSAPI
2052* Kerberos authenticated::      Direct connections with kerberos
2053* Connecting via fork::         Using a forked @code{cvs server} to connect
2054@end menu
2055
2056@node Server requirements
2057@subsection Server requirements
2058
2059The quick answer to what sort of machine is suitable as
2060a server is that requirements are modest---a server
2061with 32M of memory or even less can handle a fairly
2062large source tree with a fair amount of activity.
2063@c Say something about CPU speed too?  I'm even less sure
2064@c what to say on that subject...
2065
2066The real answer, of course, is more complicated.
2067Estimating the known areas of large memory consumption
2068should be sufficient to estimate memory requirements.
2069There are two such areas documented here; other memory
2070consumption should be small by comparison (if you find
2071that is not the case, let us know, as described in
2072@ref{BUGS}, so we can update this documentation).
2073
2074The first area of big memory consumption is large
2075checkouts, when using the @sc{cvs} server.  The server
2076consists of two processes for each client that it is
2077serving.  Memory consumption on the child process
2078should remain fairly small.  Memory consumption on the
2079parent process, particularly if the network connection
2080to the client is slow, can be expected to grow to
2081slightly more than the size of the sources in a single
2082directory, or two megabytes, whichever is larger.
2083@c "two megabytes" of course is SERVER_HI_WATER.  But
2084@c we don't mention that here because we are
2085@c documenting the default configuration of CVS.  If it
2086@c is a "standard" thing to change that value, it
2087@c should be some kind of run-time configuration.
2088@c
2089@c See cvsclient.texi for more on the design decision
2090@c to not have locks in place while waiting for the
2091@c client, which is what results in memory consumption
2092@c as high as this.
2093
2094Multiplying the size of each @sc{cvs} server by the
2095number of servers which you expect to have active at
2096one time should give an idea of memory requirements for
2097the server.  For the most part, the memory consumed by
2098the parent process probably can be swap space rather
2099than physical memory.
2100@c Has anyone verified that notion about swap space?
2101@c I say it based pretty much on guessing that the
2102@c ->text of the struct buffer_data only gets accessed
2103@c in a first in, first out fashion, but I haven't
2104@c looked very closely.
2105
2106@c What about disk usage in /tmp on the server?  I think that
2107@c it can be substantial, but I haven't looked at this
2108@c again and tried to figure it out ("cvs import" is
2109@c probably the worst case...).
2110
2111The second area of large memory consumption is
2112@code{diff}, when checking in large files.  This is
2113required even for binary files.  The rule of thumb is
2114to allow about ten times the size of the largest file
2115you will want to check in, although five times may be
2116adequate.  For example, if you want to check in a file
2117which is 10 megabytes, you should have 100 megabytes of
2118memory on the machine doing the checkin (the server
2119machine for client/server, or the machine running
2120@sc{cvs} for non-client/server).  This can be swap
2121space rather than physical memory.  Because the memory
2122is only required briefly, there is no particular need
2123to allow memory for more than one such checkin at a
2124time.
2125@c The 5-10 times rule of thumb is from Paul Eggert for
2126@c GNU diff.  I don't think it is in the GNU diff
2127@c manual or anyplace like that.
2128@c
2129@c Probably we could be saying more about
2130@c non-client/server CVS.
2131@c I would guess for non-client/server CVS in an NFS
2132@c environment the biggest issues are the network and
2133@c the NFS server.
2134
2135Resource consumption for the client is even more
2136modest---any machine with enough capacity to run the
2137operating system in question should have little
2138trouble.
2139@c Is that true?  I think the client still wants to
2140@c (bogusly) store entire files in memory at times.
2141
2142For information on disk space requirements, see
2143@ref{Creating a repository}.
2144
2145@node Connecting via rsh
2146@subsection Connecting with rsh
2147
2148@cindex rsh
2149@sc{cvs} uses the @file{rsh} protocol to perform these
2150operations, so the remote user host needs to have a
2151@file{.rhosts} file which grants access to the local
2152user.
2153
2154For example, suppose you are the user @file{mozart} on
2155the local machine @file{toe.example.com}, and the
2156server machine is @file{faun.example.org}.  On
2157faun, put the following line into the file
2158@file{.rhosts} in @file{bach}'s home directory:
2159
2160@example
2161toe.example.com  mozart
2162@end example
2163
2164Then test that @code{rsh} is working with
2165
2166@example
2167rsh -l bach faun.example.org 'echo $PATH'
2168@end example
2169
2170@cindex CVS_SERVER, environment variable
2171Next you have to make sure that @code{rsh} will be able
2172to find the server.  Make sure that the path which
2173@code{rsh} printed in the above example includes the
2174directory containing a program named @code{cvs} which
2175is the server.  You need to set the path in
2176@file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2177or @file{.profile}.  Alternately, you can set the
2178environment variable @code{CVS_SERVER} on the client
2179machine to the filename of the server you want to use,
2180for example @file{/usr/local/bin/cvs-1.6}.
2181@c FIXME: there should be a way to specify the
2182@c program in CVSROOT, not CVS_SERVER, so that one can use
2183@c different ones for different roots.  e.g. ":server;cvs=cvs-1.6:"
2184@c instead of ":server:".
2185
2186There is no need to edit @file{inetd.conf} or start a
2187@sc{cvs} server daemon.
2188
2189@cindex :server:, setting up
2190@cindex :ext:, setting up
2191@cindex Kerberos, using kerberized rsh
2192@cindex SSH (rsh replacement)
2193@cindex rsh replacements (Kerberized, SSH, &c)
2194There are two access methods that you use in @code{CVSROOT}
2195for rsh.  @code{:server:} specifies an internal rsh
2196client, which is supported only by some @sc{cvs} ports.
2197@code{:ext:} specifies an external rsh program.  By
2198default this is @code{rsh} but you may set the
2199@code{CVS_RSH} environment variable to invoke another
2200program which can access the remote server (for
2201example, @code{remsh} on HP-UX 9 because @code{rsh} is
2202something different).  It must be a program which can
2203transmit data to and from the server without modifying
2204it; for example the Windows NT @code{rsh} is not
2205suitable since it by default translates between CRLF
2206and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2207to @code{rsh} to get around this, but since this could
2208potentially cause problems for programs other than the
2209standard @code{rsh}, it may change in the future.  If
2210you set @code{CVS_RSH} to @code{SSH} or some other rsh
2211replacement, the instructions in the rest of this
2212section concerning @file{.rhosts} and so on are likely
2213to be inapplicable; consult the documentation for your rsh
2214replacement.
2215@c FIXME: there should be a way to specify the
2216@c program in CVSROOT, not CVS_RSH, so that one can use
2217@c different ones for different roots.  e.g. ":ext;rsh=remsh:"
2218@c instead of ":ext:".
2219@c See also the comment in src/client.c for rationale
2220@c concerning "rsh" being the default and never
2221@c "remsh".
2222
2223Continuing our example, supposing you want to access
2224the module @file{foo} in the repository
2225@file{/usr/local/cvsroot/}, on machine
2226@file{faun.example.org}, you are ready to go:
2227
2228@example
2229cvs -d :ext:bach@@faun.example.org/usr/local/cvsroot checkout foo
2230@end example
2231
2232(The @file{bach@@} can be omitted if the username is
2233the same on both the local and remote hosts.)
2234
2235@c Should we mention "rsh host echo hi" and "rsh host
2236@c cat" (the latter followed by typing text and ^D)
2237@c as troubleshooting techniques?  Probably yes
2238@c (people tend to have trouble setting this up),
2239@c but this kind of thing can be hard to spell out.
2240
2241@node Password authenticated
2242@subsection Direct connection with password authentication
2243
2244The @sc{cvs} client can also connect to the server
2245using a password protocol.  This is particularly useful
2246if using @code{rsh} is not feasible (for example,
2247the server is behind a firewall), and Kerberos also is
2248not available.
2249
2250        To use this method, it is necessary to make
2251some adjustments on both the server and client sides.
2252
2253@menu
2254* Password authentication server::     Setting up the server
2255* Password authentication client::     Using the client
2256* Password authentication security::   What this method does and does not do
2257@end menu
2258
2259@node Password authentication server
2260@subsubsection Setting up the server for password authentication
2261
2262First of all, you probably want to tighten the
2263permissions on the @file{$CVSROOT} and
2264@file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2265authentication security}, for more details.
2266
2267@cindex pserver (subcommand)
2268@cindex Remote repositories, port specification
2269@cindex Repositories, remote, port specification
2270@cindex Client/Server Operation, port specification
2271@cindex pserver (client/server connection method), port specification
2272@cindex kserver (client/server connection method), port specification
2273@cindex gserver (client/server connection method), port specification
2274@cindex port, specifying for remote repositories
2275@cindex Password server, setting up
2276@cindex Authenticating server, setting up
2277@c FIXME: this isn't quite right regarding port
2278@c numbers; CVS looks up "cvspserver" in
2279@c /etc/services (on unix, but what about non-unix?).
2280On the server side, the file @file{/etc/inetd.conf}
2281needs to be edited so @code{inetd} knows to run the
2282command @code{cvs pserver} when it receives a
2283connection on the right port.  By default, the port
2284number is 2401; it would be different if your client
2285were compiled with @code{CVS_AUTH_PORT} defined to
2286something else, though.  This can also be sepcified in the CVSROOT variable
2287(@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2288environment variable (@pxref{Environment variables}).
2289
2290        If your @code{inetd} allows raw port numbers in
2291@file{/etc/inetd.conf}, then the following (all on a
2292single line in @file{inetd.conf}) should be sufficient:
2293
2294@example
22952401  stream  tcp  nowait  root  /usr/local/bin/cvs
2296cvs -f --allow-root=/usr/cvsroot pserver
2297@end example
2298
2299You could also use the
2300@samp{-T} option to specify a temporary directory.
2301
2302The @samp{--allow-root} option specifies the allowable
2303@sc{cvsroot} directory.  Clients which attempt to use a
2304different @sc{cvsroot} directory will not be allowed to
2305connect.  If there is more than one @sc{cvsroot}
2306directory which you want to allow, repeat the option.
2307(Unfortunately, many versions of @code{inetd} have very small
2308limits on the number of arguments and/or the total length
2309of the command.  The usual solution to this problem is
2310to have @code{inetd} run a shell script which then invokes
2311@sc{cvs} with the necessary arguments.)
2312
2313        If your @code{inetd} wants a symbolic service
2314name instead of a raw port number, then put this in
2315@file{/etc/services}:
2316
2317@example
2318cvspserver      2401/tcp
2319@end example
2320
2321        and put @code{cvspserver} instead of
2322@code{2401} in @file{inetd.conf}.
2323
2324        Once the above is taken care of, restart your
2325@code{inetd}, or do whatever is necessary to force it
2326to reread its initialization files.
2327
2328If you are having trouble setting this up, see
2329@ref{Connection}.
2330
2331@cindex CVS passwd file
2332@cindex passwd (admin file)
2333Because the client stores and transmits passwords in
2334cleartext (almost---see @ref{Password authentication
2335security}, for details), a separate @sc{cvs} password
2336file is generally used, so people don't compromise
2337their regular passwords when they access the
2338repository.  This file is
2339@file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2340administrative files}).  It uses a colon-separated
2341format, similar to @file{/etc/passwd} on Unix systems,
2342except that it has fewer fields: @sc{cvs} username,
2343optional password, and an optional system username for
2344@sc{cvs} to run as if authentication succeeds.  Here is
2345an example @file{passwd} file with five entries:
2346
2347@example
2348anonymous:
2349bach:ULtgRLXo7NRxs
2350spwang:1sOp854gDF3DY
2351melissa:tGX1fS8sun6rY:pubcvs
2352qproj:XR4EZcEs0szik:pubcvs
2353@end example
2354
2355(The passwords are encrypted according to the standard
2356Unix @code{crypt()} function, so it is possible to
2357paste in passwords directly from regular Unix
2358@file{/etc/passwd} files.)
2359
2360The first line in the example will grant access to any
2361@sc{cvs} client attempting to authenticate as user
2362@code{anonymous}, no matter what password they use,
2363including an empty password.  (This is typical for
2364sites granting anonymous read-only access; for
2365information on how to do the "read-only" part, see
2366@ref{Read-only access}.)
2367
2368The second and third lines will grant access to
2369@code{bach} and @code{spwang} if they supply their
2370respective plaintext passwords.
2371
2372@cindex User aliases
2373The fourth line will grant access to @code{melissa}, if
2374she supplies the correct password, but her @sc{cvs}
2375operations will actually run on the server side under
2376the system user @code{pubcvs}.  Thus, there need not be
2377any system user named @code{melissa}, but there
2378@emph{must} be one named @code{pubcvs}.
2379
2380The fifth line shows that system user identities can be
2381shared: any client who successfully authenticates as
2382@code{qproj} will actually run as @code{pubcvs}, just
2383as @code{melissa} does.  That way you could create a
2384single, shared system user for each project in your
2385repository, and give each developer their own line in
2386the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2387username on each line would be different, but the
2388system username would be the same.  The reason to have
2389different @sc{cvs} usernames is that @sc{cvs} will log their
2390actions under those names: when @code{melissa} commits
2391a change to a project, the checkin is recorded in the
2392project's history under the name @code{melissa}, not
2393@code{pubcvs}.  And the reason to have them share a
2394system username is so that you can arrange permissions
2395in the relevant area of the repository such that only
2396that account has write-permission there.
2397
2398If the system-user field is present, all
2399password-authenticated @sc{cvs} commands run as that
2400user; if no system user is specified, @sc{cvs} simply
2401takes the @sc{cvs} username as the system username and
2402runs commands as that user.  In either case, if there
2403is no such user on the system, then the @sc{cvs}
2404operation will fail (regardless of whether the client
2405supplied a valid password).
2406
2407The password and system-user fields can both be omitted
2408(and if the system-user field is omitted, then also
2409omit the colon that would have separated it from the
2410encrypted password).  For example, this would be a
2411valid @file{$CVSROOT/CVSROOT/passwd} file:
2412
2413@example
2414anonymous::pubcvs
2415fish:rKa5jzULzmhOo:kfogel
2416sussman:1sOp854gDF3DY
2417@end example
2418
2419When the password field is omitted or empty, then the
2420client's authentication attempt will succeed with any
2421password, including the empty string.  However, the
2422colon after the @sc{cvs} username is always necessary,
2423even if the password is empty.
2424
2425@sc{cvs} can also fall back to use system authentication.
2426When authenticating a password, the server first checks
2427for the user in the @file{$CVSROOT/CVSROOT/passwd}
2428file.  If it finds the user, it will use that entry for
2429authentication as described above.  But if it does not
2430find the user, or if the @sc{cvs} @file{passwd} file
2431does not exist, then the server can try to authenticate
2432the username and password using the operating system's
2433user-lookup routines (this "fallback" behavior can be
2434disabled by setting @code{SystemAuth=no} in the
2435@sc{cvs} @file{config} file, @pxref{config}).  Be
2436aware, however, that falling back to system
2437authentication might be a security risk: @sc{cvs}
2438operations would then be authenticated with that user's
2439regular login password, and the password flies across
2440the network in plaintext.  See @ref{Password
2441authentication security} for more on this.
2442
2443Right now, the only way to put a password in the
2444@sc{cvs} @file{passwd} file is to paste it there from
2445somewhere else.  Someday, there may be a @code{cvs
2446passwd} command.
2447
2448Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2449is normal to edit the @file{passwd} file in-place,
2450rather than via @sc{cvs}.  This is because of the
2451possible security risks of having the @file{passwd}
2452file checked out to people's working copies.  If you do
2453want to include the @file{passwd} file in checkouts of
2454@file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2455
2456@c We might also suggest using the @code{htpasswd} command
2457@c from freely available web servers as well, but that
2458@c would open up a can of worms in that the users next
2459@c questions are likely to be "where do I get it?" and
2460@c "how do I use it?"
2461@c Also note that htpasswd, at least the version I had,
2462@c likes to clobber the third field.
2463
2464@node Password authentication client
2465@subsubsection Using the client with password authentication
2466@cindex Login (subcommand)
2467@cindex Password client, using
2468@cindex Authenticated client, using
2469@cindex :pserver:, setting up
2470To run a @sc{cvs} command on a remote repository via
2471the password-authenticating server, one specifies the
2472@code{pserver} protocol, optional username, repository host, an
2473optional port number, and path to the repository.  For example:
2474
2475@example
2476cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2477@end example
2478
2479or
2480
2481@example
2482CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2483cvs checkout someproj
2484@end example
2485
2486However, unless you're connecting to a public-access
2487repository (i.e., one where that username doesn't
2488require a password), you'll need to supply a password or @dfn{log in} first.
2489Logging in verifies your password with the repository and stores it in a file.
2490It's done with the @code{login} command, which will
2491prompt you interactively for the password if you didn't supply one as part of
2492@var{$CVSROOT}:
2493
2494@example
2495cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2496CVS password:
2497@end example
2498
2499or
2500
2501@example
2502cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2503@end example
2504
2505After you enter the password, @sc{cvs} verifies it with
2506the server.  If the verification succeeds, then that
2507combination of username, host, repository, and password
2508is permanently recorded, so future transactions with
2509that repository won't require you to run @code{cvs
2510login}.  (If verification fails, @sc{cvs} will exit
2511complaining that the password was incorrect, and
2512nothing will be recorded.)
2513
2514The records are stored, by default, in the file
2515@file{$HOME/.cvspass}.  That file's format is
2516human-readable, and to a degree human-editable, but
2517note that the passwords are not stored in
2518cleartext---they are trivially encoded to protect them
2519from "innocent" compromise (i.e., inadvertent viewing
2520by a system administrator or other non-malicious
2521person).
2522
2523@cindex CVS_PASSFILE, environment variable
2524You can change the default location of this file by
2525setting the @code{CVS_PASSFILE} environment variable.
2526If you use this variable, make sure you set it
2527@emph{before} @code{cvs login} is run.  If you were to
2528set it after running @code{cvs login}, then later
2529@sc{cvs} commands would be unable to look up the
2530password for transmission to the server.
2531
2532Once you have logged in, all @sc{cvs} commands using
2533that remote repository and username will authenticate
2534with the stored password.  So, for example
2535
2536@example
2537cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2538@end example
2539
2540should just work (unless the password changes on the
2541server side, in which case you'll have to re-run
2542@code{cvs login}).
2543
2544Note that if the @samp{:pserver:} were not present in
2545the repository specification, @sc{cvs} would assume it
2546should use @code{rsh} to connect with the server
2547instead (@pxref{Connecting via rsh}).
2548
2549Of course, once you have a working copy checked out and
2550are running @sc{cvs} commands from within it, there is
2551no longer any need to specify the repository
2552explicitly, because @sc{cvs} can deduce the repository
2553from the working copy's @file{CVS} subdirectory.
2554
2555@c FIXME: seems to me this needs somewhat more
2556@c explanation.
2557@cindex Logout (subcommand)
2558The password for a given remote repository can be
2559removed from the @code{CVS_PASSFILE} by using the
2560@code{cvs logout} command.
2561
2562@node Password authentication security
2563@subsubsection Security considerations with password authentication
2564
2565@cindex Security, of pserver
2566The passwords are stored on the client side in a
2567trivial encoding of the cleartext, and transmitted in
2568the same encoding.  The encoding is done only to
2569prevent inadvertent password compromises (i.e., a
2570system administrator accidentally looking at the file),
2571and will not prevent even a naive attacker from gaining
2572the password.
2573
2574@c FIXME: The bit about "access to the repository
2575@c implies general access to the system is *not* specific
2576@c to pserver; it applies to kerberos and SSH and
2577@c everything else too.  Should reorganize the
2578@c documentation to make this clear.
2579The separate @sc{cvs} password file (@pxref{Password
2580authentication server}) allows people
2581to use a different password for repository access than
2582for login access.  On the other hand, once a user has
2583non-read-only
2584access to the repository, she can execute programs on
2585the server system through a variety of means.  Thus, repository
2586access implies fairly broad system access as well.  It
2587might be possible to modify @sc{cvs} to prevent that,
2588but no one has done so as of this writing.
2589@c OpenBSD uses chroot() and copies the repository to
2590@c provide anonymous read-only access (for details see
2591@c http://www.openbsd.org/anoncvs.shar).  While this
2592@c closes the most obvious holes, I'm not sure it
2593@c closes enough holes to recommend it (plus it is
2594@c *very* easy to accidentally screw up a setup of this
2595@c type).
2596
2597Note that because the @file{$CVSROOT/CVSROOT} directory
2598contains @file{passwd} and other files which are used
2599to check security, you must control the permissions on
2600this directory as tightly as the permissions on
2601@file{/etc}.  The same applies to the @file{$CVSROOT}
2602directory itself and any directory
2603above it in the tree.  Anyone who has write access to
2604such a directory will have the ability to become any
2605user on the system.  Note that these permissions are
2606typically tighter than you would use if you are not
2607using pserver.
2608@c TODO: Would be really nice to document/implement a
2609@c scheme where the CVS server can run as some non-root
2610@c user, e.g. "cvs".  CVSROOT/passwd would contain a
2611@c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2612@c would be implicit).  This would greatly reduce
2613@c security risks such as those hinted at in the
2614@c previous paragraph.  I think minor changes to CVS
2615@c might be required but mostly this would just need
2616@c someone who wants to play with it, document it, &c.
2617
2618In summary, anyone who gets the password gets
2619repository access (which may imply some measure of general system
2620access as well).  The password is available to anyone
2621who can sniff network packets or read a protected
2622(i.e., user read-only) file.  If you want real
2623security, get Kerberos.
2624
2625@node GSSAPI authenticated
2626@subsection Direct connection with GSSAPI
2627
2628@cindex GSSAPI
2629@cindex Security, GSSAPI
2630@cindex :gserver:, setting up
2631@cindex Kerberos, using :gserver:
2632GSSAPI is a generic interface to network security
2633systems such as Kerberos 5.
2634If you have a working GSSAPI library, you can have
2635@sc{cvs} connect via a direct @sc{tcp} connection,
2636authenticating with GSSAPI.
2637
2638To do this, @sc{cvs} needs to be compiled with GSSAPI
2639support; when configuring @sc{cvs} it tries to detect
2640whether GSSAPI libraries using kerberos version 5 are
2641present.  You can also use the @file{--with-gssapi}
2642flag to configure.
2643
2644The connection is authenticated using GSSAPI, but the
2645message stream is @emph{not} authenticated by default.
2646You must use the @code{-a} global option to request
2647stream authentication.
2648
2649The data transmitted is @emph{not} encrypted by
2650default.  Encryption support must be compiled into both
2651the client and the server; use the
2652@file{--enable-encrypt} configure option to turn it on.
2653You must then use the @code{-x} global option to
2654request encryption.
2655
2656GSSAPI connections are handled on the server side by
2657the same server which handles the password
2658authentication server; see @ref{Password authentication
2659server}.  If you are using a GSSAPI mechanism such as
2660Kerberos which provides for strong authentication, you
2661will probably want to disable the ability to
2662authenticate via cleartext passwords.  To do so, create
2663an empty @file{CVSROOT/passwd} password file, and set
2664@code{SystemAuth=no} in the config file
2665(@pxref{config}).
2666
2667The GSSAPI server uses a principal name of
2668cvs/@var{hostname}, where @var{hostname} is the
2669canonical name of the server host.  You will have to
2670set this up as required by your GSSAPI mechanism.
2671
2672To connect using GSSAPI, use @samp{:gserver:}.  For
2673example,
2674
2675@example
2676cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2677@end example
2678
2679@node Kerberos authenticated
2680@subsection Direct connection with kerberos
2681
2682@cindex Kerberos, using :kserver:
2683@cindex Security, kerberos
2684@cindex :kserver:, setting up
2685The easiest way to use kerberos is to use the kerberos
2686@code{rsh}, as described in @ref{Connecting via rsh}.
2687The main disadvantage of using rsh is that all the data
2688needs to pass through additional programs, so it may be
2689slower.  So if you have kerberos installed you can
2690connect via a direct @sc{tcp} connection,
2691authenticating with kerberos.
2692
2693This section concerns the kerberos network security
2694system, version 4.  Kerberos version 5 is supported via
2695the GSSAPI generic network security interface, as
2696described in the previous section.
2697
2698To do this, @sc{cvs} needs to be compiled with kerberos
2699support; when configuring @sc{cvs} it tries to detect
2700whether kerberos is present or you can use the
2701@file{--with-krb4} flag to configure.
2702
2703The data transmitted is @emph{not} encrypted by
2704default.  Encryption support must be compiled into both
2705the client and server; use the
2706@file{--enable-encryption} configure option to turn it
2707on.  You must then use the @code{-x} global option to
2708request encryption.
2709
2710@cindex CVS_CLIENT_PORT
2711You need to edit @file{inetd.conf} on the server
2712machine to run @code{cvs kserver}.  The client uses
2713port 1999 by default; if you want to use another port
2714specify it in the @code{CVSROOT} (@pxref{Remote repositories})
2715or the @code{CVS_CLIENT_PORT} environment variable on the client.
2716
2717@cindex kinit
2718When you want to use @sc{cvs}, get a ticket in the
2719usual way (generally @code{kinit}); it must be a ticket
2720which allows you to log into the server machine.  Then
2721you are ready to go:
2722
2723@example
2724cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
2725@end example
2726
2727Previous versions of @sc{cvs} would fall back to a
2728connection via rsh; this version will not do so.
2729
2730@node Connecting via fork
2731@subsection Connecting with fork
2732
2733@cindex fork, access method
2734@cindex :fork:, setting up
2735This access method allows you to connect to a
2736repository on your local disk via the remote protocol.
2737In other words it does pretty much the same thing as
2738@code{:local:}, but various quirks, bugs and the like are
2739those of the remote @sc{cvs} rather than the local
2740@sc{cvs}.
2741
2742For day-to-day operations you might prefer either
2743@code{:local:} or @code{:fork:}, depending on your
2744preferences.  Of course @code{:fork:} comes in
2745particularly handy in testing or
2746debugging @code{cvs} and the remote protocol.
2747Specifically, we avoid all of the network-related
2748setup/configuration, timeouts, and authentication
2749inherent in the other remote access methods but still
2750create a connection which uses the remote protocol.
2751
2752To connect using the @code{fork} method, use
2753@samp{:fork:} and the pathname to your local
2754repository.  For example:
2755
2756@example
2757cvs -d :fork:/usr/local/cvsroot checkout foo
2758@end example
2759
2760@cindex CVS_SERVER, and :fork:
2761As with @code{:ext:}, the server is called @samp{cvs}
2762by default, or the value of the @code{CVS_SERVER}
2763environment variable.
2764
2765@c ---------------------------------------------------------------------
2766@node Read-only access
2767@section Read-only repository access
2768@cindex Read-only repository access
2769@cindex readers (admin file)
2770@cindex writers (admin file)
2771
2772        It is possible to grant read-only repository
2773access to people using the password-authenticated
2774server (@pxref{Password authenticated}).  (The
2775other access methods do not have explicit support for
2776read-only users because those methods all assume login
2777access to the repository machine anyway, and therefore
2778the user can do whatever local file permissions allow
2779her to do.)
2780
2781        A user who has read-only access can do only
2782those @sc{cvs} operations which do not modify the
2783repository, except for certain ``administrative'' files
2784(such as lock files and the history file).  It may be
2785desirable to use this feature in conjunction with
2786user-aliasing (@pxref{Password authentication server}).
2787
2788Unlike with previous versions of @sc{cvs}, read-only
2789users should be able merely to read the repository, and
2790not to execute programs on the server or otherwise gain
2791unexpected levels of access.  Or to be more accurate,
2792the @emph{known} holes have been plugged.  Because this
2793feature is new and has not received a comprehensive
2794security audit, you should use whatever level of
2795caution seems warranted given your attitude concerning
2796security.
2797
2798        There are two ways to specify read-only access
2799for a user: by inclusion, and by exclusion.
2800
2801        "Inclusion" means listing that user
2802specifically in the @file{$CVSROOT/CVSROOT/readers}
2803file, which is simply a newline-separated list of
2804users.  Here is a sample @file{readers} file:
2805
2806@example
2807melissa
2808splotnik
2809jrandom
2810@end example
2811
2812        (Don't forget the newline after the last user.)
2813
2814        "Exclusion" means explicitly listing everyone
2815who has @emph{write} access---if the file
2816
2817@example
2818$CVSROOT/CVSROOT/writers
2819@end example
2820
2821@noindent
2822exists, then only
2823those users listed in it have write access, and
2824everyone else has read-only access (of course, even the
2825read-only users still need to be listed in the
2826@sc{cvs} @file{passwd} file).  The
2827@file{writers} file has the same format as the
2828@file{readers} file.
2829
2830        Note: if your @sc{cvs} @file{passwd}
2831file maps cvs users onto system users (@pxref{Password
2832authentication server}), make sure you deny or grant
2833read-only access using the @emph{cvs} usernames, not
2834the system usernames.  That is, the @file{readers} and
2835@file{writers} files contain cvs usernames, which may
2836or may not be the same as system usernames.
2837
2838        Here is a complete description of the server's
2839behavior in deciding whether to grant read-only or
2840read-write access:
2841
2842        If @file{readers} exists, and this user is
2843listed in it, then she gets read-only access.  Or if
2844@file{writers} exists, and this user is NOT listed in
2845it, then she also gets read-only access (this is true
2846even if @file{readers} exists but she is not listed
2847there).  Otherwise, she gets full read-write access.
2848
2849        Of course there is a conflict if the user is
2850listed in both files.  This is resolved in the more
2851conservative way, it being better to protect the
2852repository too much than too little: such a user gets
2853read-only access.
2854
2855@node Server temporary directory
2856@section Temporary directories for the server
2857@cindex Temporary directories, and server
2858@cindex Server, temporary directories
2859
2860While running, the @sc{cvs} server creates temporary
2861directories.  They are named
2862
2863@example
2864cvs-serv@var{pid}
2865@end example
2866
2867@noindent
2868where @var{pid} is the process identification number of
2869the server.  They are located in the directory
2870specified by the @code{TMPDIR} environment variable
2871(@pxref{Environment variables}), the @samp{-T} global
2872option (@pxref{Global options}), or failing that
2873@file{/tmp}.
2874
2875In most cases the server will remove the temporary
2876directory when it is done, whether it finishes normally
2877or abnormally.  However, there are a few cases in which
2878the server does not or cannot remove the temporary
2879directory, for example:
2880
2881@itemize @bullet
2882@item
2883If the server aborts due to an internal server error,
2884it may preserve the directory to aid in debugging
2885
2886@item
2887If the server is killed in a way that it has no way of
2888cleaning up (most notably, @samp{kill -KILL} on unix).
2889
2890@item
2891If the system shuts down without an orderly shutdown,
2892which tells the server to clean up.
2893@end itemize
2894
2895In cases such as this, you will need to manually remove
2896the @file{cvs-serv@var{pid}} directories.  As long as
2897there is no server running with process identification
2898number @var{pid}, it is safe to do so.
2899
2900@c ---------------------------------------------------------------------
2901@node Starting a new project
2902@chapter Starting a project with CVS
2903@cindex Starting a project with CVS
2904@cindex Creating a project
2905
2906@comment --moduledb--
2907Because renaming files and moving them between
2908directories is somewhat inconvenient, the first thing
2909you do when you start a new project should be to think
2910through your file organization.  It is not impossible
2911to rename or move files, but it does increase the
2912potential for confusion and @sc{cvs} does have some
2913quirks particularly in the area of renaming
2914directories.  @xref{Moving files}.
2915
2916What to do next depends on the situation at hand.
2917
2918@menu
2919* Setting up the files::        Getting the files into the repository
2920* Defining the module::         How to make a module of the files
2921@end menu
2922@c -- File permissions!
2923
2924@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2925@node Setting up the files
2926@section Setting up the files
2927
2928The first step is to create the files inside the repository.  This can
2929be done in a couple of different ways.
2930
2931@c -- The contributed scripts
2932@menu
2933* From files::                  This method is useful with old projects
2934                                where files already exists.
2935* From other version control systems::  Old projects where you want to
2936                                        preserve history from another system.
2937* From scratch::                Creating a directory tree from scratch.
2938@end menu
2939
2940@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2941@node From files
2942@subsection Creating a directory tree from a number of files
2943@cindex Importing files
2944
2945When you begin using @sc{cvs}, you will probably already have several
2946projects that can be
2947put under @sc{cvs} control.  In these cases the easiest way is to use the
2948@code{import} command.  An example is probably the easiest way to
2949explain how to use it.  If the files you want to install in
2950@sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
2951repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
2952
2953@example
2954$ cd @var{wdir}
2955$ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
2956@end example
2957
2958Unless you supply a log message with the @samp{-m}
2959flag, @sc{cvs} starts an editor and prompts for a
2960message.  The string @samp{yoyo} is a @dfn{vendor tag},
2961and @samp{start} is a @dfn{release tag}.  They may fill
2962no purpose in this context, but since @sc{cvs} requires
2963them they must be present.  @xref{Tracking sources}, for
2964more information about them.
2965
2966You can now verify that it worked, and remove your
2967original source directory.
2968@c FIXME: Need to say more about "verify that it
2969@c worked".  What should the user look for in the output
2970@c from "diff -r"?
2971
2972@example
2973$ cd ..
2974$ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
2975$ diff -r @var{wdir} yoyodyne/@var{rdir}
2976$ rm -r @var{wdir}
2977@end example
2978
2979@noindent
2980Erasing the original sources is a good idea, to make sure that you do
2981not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
2982Of course, it would be wise to make sure that you have
2983a backup of the sources before you remove them.
2984
2985The @code{checkout} command can either take a module
2986name as argument (as it has done in all previous
2987examples) or a path name relative to @code{$CVSROOT},
2988as it did in the example above.
2989
2990It is a good idea to check that the permissions
2991@sc{cvs} sets on the directories inside @code{$CVSROOT}
2992are reasonable, and that they belong to the proper
2993groups.  @xref{File permissions}.
2994
2995If some of the files you want to import are binary, you
2996may want to use the wrappers features to specify which
2997files are binary and which are not.  @xref{Wrappers}.
2998
2999@c The node name is too long, but I am having trouble
3000@c thinking of something more concise.
3001@node From other version control systems
3002@subsection Creating Files From Other Version Control Systems
3003@cindex Importing files, from other version control systems
3004
3005If you have a project which you are maintaining with
3006another version control system, such as @sc{rcs}, you
3007may wish to put the files from that project into
3008@sc{cvs}, and preserve the revision history of the
3009files.
3010
3011@table @asis
3012@cindex RCS, importing files from
3013@item From RCS
3014If you have been using @sc{rcs}, find the @sc{rcs}
3015files---usually a file named @file{foo.c} will have its
3016@sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3017other places; consult the @sc{rcs} documentation for
3018details).  Then create the appropriate directories in
3019@sc{cvs} if they do not already exist.  Then copy the
3020files into the appropriate directories in the @sc{cvs}
3021repository (the name in the repository must be the name
3022of the source file with @samp{,v} added; the files go
3023directly in the appropriate directory of the repository,
3024not in an @file{RCS} subdirectory).  This is one of the
3025few times when it is a good idea to access the @sc{cvs}
3026repository directly, rather than using @sc{cvs}
3027commands.  Then you are ready to check out a new
3028working directory.
3029@c Someday there probably should be a "cvs import -t
3030@c rcs" or some such.  It could even create magic
3031@c branches.  It could also do something about the case
3032@c where the RCS file had a (non-magic) "0" branch.
3033
3034The @sc{rcs} file should not be locked when you move it
3035into @sc{cvs}; if it is, @sc{cvs} will have trouble
3036letting you operate on it.
3037@c What is the easiest way to unlock your files if you
3038@c have them locked?  Especially if you have a lot of them?
3039@c This is a CVS bug/misfeature; importing RCS files
3040@c should ignore whether they are locked and leave them in
3041@c an unlocked state.  Yet another reason for a separate
3042@c "import RCS file" command.
3043
3044@c How many is "many"? Or do they just import RCS files?
3045@item From another version control system
3046Many version control systems have the ability to export
3047@sc{rcs} files in the standard format.  If yours does,
3048export the @sc{rcs} files and then follow the above
3049instructions.
3050
3051Failing that, probably your best bet is to write a
3052script that will check out the files one revision at a
3053time using the command line interface to the other
3054system, and then check the revisions into @sc{cvs}.
3055The @file{sccs2rcs} script mentioned below may be a
3056useful example to follow.
3057
3058@cindex SCCS, importing files from
3059@item From SCCS
3060There is a script in the @file{contrib} directory of
3061the @sc{cvs} source distribution called @file{sccs2rcs}
3062which converts @sc{sccs} files to @sc{rcs} files.
3063Note: you must run it on a machine which has both
3064@sc{sccs} and @sc{rcs} installed, and like everything
3065else in contrib it is unsupported (your mileage may
3066vary).
3067
3068@cindex PVCS, importing files from
3069@item From PVCS
3070There is a script in the @file{contrib} directory of
3071the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3072which converts @sc{pvcs} archives to @sc{rcs} files.
3073You must run it on a machine which has both
3074@sc{pvcs} and @sc{rcs} installed, and like everything
3075else in contrib it is unsupported (your mileage may
3076vary).  See the comments in the script for details.
3077@end table
3078@c CMZ and/or PATCHY were systems that were used in the
3079@c high energy physics community (especially for
3080@c CERNLIB).  CERN has replaced them with CVS, but the
3081@c CAR format seems to live on as a way to submit
3082@c changes.  There is a program car2cvs which converts
3083@c but I'm not sure where one gets a copy.
3084@c Not sure it is worth mentioning here, since it would
3085@c appear to affect only one particular community.
3086@c Best page for more information is:
3087@c http://wwwcn1.cern.ch/asd/cvs/index.html
3088@c See also:
3089@c http://ecponion.cern.ch/ecpsa/cernlib.html
3090
3091@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3092@node From scratch
3093@subsection Creating a directory tree from scratch
3094
3095@c Also/instead should be documenting
3096@c $ cvs co -l .
3097@c $ mkdir tc
3098@c $ cvs add tc
3099@c $ cd tc
3100@c $ mkdir man
3101@c $ cvs add man
3102@c etc.
3103@c Using import to create the directories only is
3104@c probably a somewhat confusing concept.
3105For a new project, the easiest thing to do is probably
3106to create an empty directory structure, like this:
3107
3108@example
3109$ mkdir tc
3110$ mkdir tc/man
3111$ mkdir tc/testing
3112@end example
3113
3114After that, you use the @code{import} command to create
3115the corresponding (empty) directory structure inside
3116the repository:
3117
3118@example
3119$ cd tc
3120$ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3121@end example
3122
3123Then, use @code{add} to add files (and new directories)
3124as they appear.
3125
3126Check that the permissions @sc{cvs} sets on the
3127directories inside @code{$CVSROOT} are reasonable.
3128
3129@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3130@node Defining the module
3131@section Defining the module
3132@cindex Defining a module
3133@cindex Editing the modules file
3134@cindex Module, defining
3135@cindex Modules file, changing
3136
3137The next step is to define the module in the
3138@file{modules} file.  This is not strictly necessary,
3139but modules can be convenient in grouping together
3140related files and directories.
3141
3142In simple cases these steps are sufficient to define a module.
3143
3144@enumerate
3145@item
3146Get a working copy of the modules file.
3147
3148@example
3149$ cvs checkout CVSROOT/modules
3150$ cd CVSROOT
3151@end example
3152
3153@item
3154Edit the file and insert a line that defines the module.  @xref{Intro
3155administrative files}, for an introduction.  @xref{modules}, for a full
3156description of the modules file.  You can use the
3157following line to define the module @samp{tc}:
3158
3159@example
3160tc   yoyodyne/tc
3161@end example
3162
3163@item
3164Commit your changes to the modules file.
3165
3166@example
3167$ cvs commit -m "Added the tc module." modules
3168@end example
3169
3170@item
3171Release the modules module.
3172
3173@example
3174$ cd ..
3175$ cvs release -d CVSROOT
3176@end example
3177@end enumerate
3178
3179@c ---------------------------------------------------------------------
3180@node Revisions
3181@chapter Revisions
3182
3183For many uses of @sc{cvs}, one doesn't need to worry
3184too much about revision numbers; @sc{cvs} assigns
3185numbers such as @code{1.1}, @code{1.2}, and so on, and
3186that is all one needs to know.  However, some people
3187prefer to have more knowledge and control concerning
3188how @sc{cvs} assigns revision numbers.
3189
3190If one wants to keep track of a set of revisions
3191involving more than one file, such as which revisions
3192went into a particular release, one uses a @dfn{tag},
3193which is a symbolic revision which can be assigned to a
3194numeric revision in each file.
3195
3196@menu
3197* Revision numbers::            The meaning of a revision number
3198* Versions revisions releases::  Terminology used in this manual
3199* Assigning revisions::         Assigning revisions
3200* Tags::                        Tags--Symbolic revisions
3201* Tagging the working directory::  The cvs tag command
3202* Tagging by date/tag::         The cvs rtag command
3203* Modifying tags::              Adding, renaming, and deleting tags
3204* Tagging add/remove::          Tags with adding and removing files
3205* Sticky tags::                 Certain tags are persistent
3206@end menu
3207
3208@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3209@node Revision numbers
3210@section Revision numbers
3211@cindex Revision numbers
3212@cindex Revision tree
3213@cindex Linear development
3214@cindex Number, revision-
3215@cindex Decimal revision number
3216@cindex Branch number
3217@cindex Number, branch
3218
3219Each version of a file has a unique @dfn{revision
3220number}.  Revision numbers look like @samp{1.1},
3221@samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3222A revision number always has an even number of
3223period-separated decimal integers.  By default revision
32241.1 is the first revision of a file.  Each successive
3225revision is given a new number by increasing the
3226rightmost number by one.  The following figure displays
3227a few revisions, with newer revisions to the right.
3228
3229@example
3230       +-----+    +-----+    +-----+    +-----+    +-----+
3231       ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3232       +-----+    +-----+    +-----+    +-----+    +-----+
3233@end example
3234
3235It is also possible to end up with numbers containing
3236more than one period, for example @samp{1.3.2.2}.  Such
3237revisions represent revisions on branches
3238(@pxref{Branching and merging}); such revision numbers
3239are explained in detail in @ref{Branches and
3240revisions}.
3241
3242@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3243@node Versions revisions releases
3244@section Versions, revisions and releases
3245@cindex Revisions, versions and releases
3246@cindex Versions, revisions and releases
3247@cindex Releases, revisions and versions
3248
3249A file can have several versions, as described above.
3250Likewise, a software product can have several versions.
3251A software product is often given a version number such
3252as @samp{4.1.1}.
3253
3254Versions in the first sense are called @dfn{revisions}
3255in this document, and versions in the second sense are
3256called @dfn{releases}.  To avoid confusion, the word
3257@dfn{version} is almost never used in this document.
3258
3259@node Assigning revisions
3260@section Assigning revisions
3261
3262@c We avoid the "major revision" terminology.  It seems
3263@c like jargon.  Hopefully "first number" is clear enough.
3264By default, @sc{cvs} will assign numeric revisions by
3265leaving the first number the same and incrementing the
3266second number.  For example, @code{1.1}, @code{1.2},
3267@code{1.3}, etc.
3268
3269When adding a new file, the second number will always
3270be one and the first number will equal the highest
3271first number of any file in that directory.  For
3272example, the current directory contains files whose
3273highest numbered revisions are @code{1.7}, @code{3.1},
3274and @code{4.12}, then an added file will be given the
3275numeric revision @code{4.1}.
3276
3277@c This is sort of redundant with something we said a
3278@c while ago.  Somewhere we need a better way of
3279@c introducing how the first number can be anything
3280@c except "1", perhaps.  Also I don't think this
3281@c presentation is clear on why we are discussing releases
3282@c and first numbers of numeric revisions in the same
3283@c breath.
3284Normally there is no reason to care
3285about the revision numbers---it is easier to treat them
3286as internal numbers that @sc{cvs} maintains, and tags
3287provide a better way to distinguish between things like
3288release 1 versus release 2 of your product
3289(@pxref{Tags}).  However, if you want to set the
3290numeric revisions, the @samp{-r} option to @code{cvs
3291commit} can do that.  The @samp{-r} option implies the
3292@samp{-f} option, in the sense that it causes the
3293files to be committed even if they are not modified.
3294
3295For example, to bring all your files up to
3296revision 3.0 (including those that haven't changed),
3297you might invoke:
3298
3299@example
3300$ cvs commit -r 3.0
3301@end example
3302
3303Note that the number you specify with @samp{-r} must be
3304larger than any existing revision number.  That is, if
3305revision 3.0 exists, you cannot @samp{cvs commit
3306-r 1.3}.  If you want to maintain several releases in
3307parallel, you need to use a branch (@pxref{Branching and merging}).
3308
3309@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3310@node Tags
3311@section Tags--Symbolic revisions
3312@cindex Tags
3313
3314The revision numbers live a life of their own.  They
3315need not have anything at all to do with the release
3316numbers of your software product.  Depending
3317on how you use @sc{cvs} the revision numbers might change several times
3318between two releases.  As an example, some of the
3319source files that make up @sc{rcs} 5.6 have the following
3320revision numbers:
3321@cindex RCS revision numbers
3322
3323@example
3324ci.c            5.21
3325co.c            5.9
3326ident.c         5.3
3327rcs.c           5.12
3328rcsbase.h       5.11
3329rcsdiff.c       5.10
3330rcsedit.c       5.11
3331rcsfcmp.c       5.9
3332rcsgen.c        5.10
3333rcslex.c        5.11
3334rcsmap.c        5.2
3335rcsutil.c       5.10
3336@end example
3337
3338@cindex tag, command, introduction
3339@cindex Tag, symbolic name
3340@cindex Symbolic name (tag)
3341@cindex Name, symbolic (tag)
3342@cindex HEAD, as reserved tag name
3343@cindex BASE, as reserved tag name
3344You can use the @code{tag} command to give a symbolic name to a
3345certain revision of a file.  You can use the @samp{-v} flag to the
3346@code{status} command to see all tags that a file has, and
3347which revision numbers they represent.  Tag names must
3348start with an uppercase or lowercase letter and can
3349contain uppercase and lowercase letters, digits,
3350@samp{-}, and @samp{_}.  The two tag names @code{BASE}
3351and @code{HEAD} are reserved for use by @sc{cvs}.  It
3352is expected that future names which are special to
3353@sc{cvs} will be specially named, for example by
3354starting with @samp{.}, rather than being named analogously to
3355@code{BASE} and @code{HEAD}, to avoid conflicts with
3356actual tag names.
3357@c Including a character such as % or = has also been
3358@c suggested as the naming convention for future
3359@c special tag names.  Starting with . is nice because
3360@c that is not a legal tag name as far as RCS is concerned.
3361@c FIXME: CVS actually accepts quite a few characters
3362@c in tag names, not just the ones documented above
3363@c (see RCS_check_tag).  RCS
3364@c defines legitimate tag names by listing illegal
3365@c characters rather than legal ones.  CVS is said to lose its
3366@c mind if you try to use "/" (try making such a tag sticky
3367@c and using "cvs status" client/server--see remote
3368@c protocol format for entries line for probable cause).
3369@c TODO: The testsuite
3370@c should test for whatever are documented above as
3371@c officially-OK tag names, and CVS should at least reject
3372@c characters that won't work, like "/".
3373
3374You'll want to choose some convention for naming tags,
3375based on information such as the name of the program
3376and the version number of the release.  For example,
3377one might take the name of the program, immediately
3378followed by the version number with @samp{.} changed to
3379@samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3380@code{cvs1-9}.  If you choose a consistent convention,
3381then you won't constantly be guessing whether a tag is
3382@code{cvs-1-9} or @code{cvs1_9} or what.  You might
3383even want to consider enforcing your convention in the
3384taginfo file (@pxref{user-defined logging}).
3385@c Might be nice to say more about using taginfo this
3386@c way, like giving an example, or pointing out any particular
3387@c issues which arise.
3388
3389@cindex Adding a tag
3390@cindex Tag, example
3391The following example shows how you can add a tag to a
3392file.  The commands must be issued inside your working
3393directory.  That is, you should issue the
3394command in the directory where @file{backend.c}
3395resides.
3396
3397@example
3398$ cvs tag rel-0-4 backend.c
3399T backend.c
3400$ cvs status -v backend.c
3401===================================================================
3402File: backend.c         Status: Up-to-date
3403
3404    Version:            1.4     Tue Dec  1 14:39:01 1992
3405    RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3406    Sticky Tag:         (none)
3407    Sticky Date:        (none)
3408    Sticky Options:     (none)
3409
3410    Existing Tags:
3411        rel-0-4                     (revision: 1.4)
3412
3413@end example
3414
3415For a complete summary of the syntax of @code{cvs tag},
3416including the various options, see @ref{Invoking CVS}.
3417
3418There is seldom reason to tag a file in isolation.  A more common use is
3419to tag all the files that constitute a module with the same tag at
3420strategic points in the development life-cycle, such as when a release
3421is made.
3422
3423@example
3424$ cvs tag rel-1-0 .
3425cvs tag: Tagging .
3426T Makefile
3427T backend.c
3428T driver.c
3429T frontend.c
3430T parser.c
3431@end example
3432
3433(When you give @sc{cvs} a directory as argument, it generally applies the
3434operation to all the files in that directory, and (recursively), to any
3435subdirectories that it may contain.  @xref{Recursive behavior}.)
3436
3437@cindex Retrieving an old revision using tags
3438@cindex Tag, retrieving old revisions
3439The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3440a certain revision of a module.  This flag makes it easy to
3441retrieve the sources that make up release 1.0 of the module @samp{tc} at
3442any time in the future:
3443
3444@example
3445$ cvs checkout -r rel-1-0 tc
3446@end example
3447
3448@noindent
3449This is useful, for instance, if someone claims that there is a bug in
3450that release, but you cannot find the bug in the current working copy.
3451
3452You can also check out a module as it was at any given date.
3453@xref{checkout options}.  When specifying @samp{-r} to
3454any of these commands, you will need beware of sticky
3455tags; see @ref{Sticky tags}.
3456
3457When you tag more than one file with the same tag you
3458can think about the tag as "a curve drawn through a
3459matrix of filename vs. revision number."  Say we have 5
3460files with the following revisions:
3461
3462@example
3463@group
3464        file1   file2   file3   file4   file5
3465
3466        1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3467        1.2*-   1.2     1.2    -1.2*-
3468        1.3  \- 1.3*-   1.3   / 1.3
3469        1.4          \  1.4  /  1.4
3470                      \-1.5*-   1.5
3471                        1.6
3472@end group
3473@end example
3474
3475At some time in the past, the @code{*} versions were tagged.
3476You can think of the tag as a handle attached to the curve
3477drawn through the tagged revisions.  When you pull on
3478the handle, you get all the tagged revisions.  Another
3479way to look at it is that you "sight" through a set of
3480revisions that is "flat" along the tagged revisions,
3481like this:
3482
3483@example
3484@group
3485        file1   file2   file3   file4   file5
3486
3487                        1.1
3488                        1.2
3489                1.1     1.3                       _
3490        1.1     1.2     1.4     1.1              /
3491        1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
3492        1.3             1.6     1.3              \_
3493        1.4                     1.4
3494                                1.5
3495@end group
3496@end example
3497
3498@node Tagging the working directory
3499@section Specifying what to tag from the working directory
3500
3501@cindex tag (subcommand)
3502The example in the previous section demonstrates one of
3503the most common ways to choose which revisions to tag.
3504Namely, running the @code{cvs tag} command without
3505arguments causes @sc{cvs} to select the revisions which
3506are checked out in the current working directory.  For
3507example, if the copy of @file{backend.c} in working
3508directory was checked out from revision 1.4, then
3509@sc{cvs} will tag revision 1.4.  Note that the tag is
3510applied immediately to revision 1.4 in the repository;
3511tagging is not like modifying a file, or other
3512operations in which one first modifies the working
3513directory and then runs @code{cvs commit} to transfer
3514that modification to the repository.
3515
3516One potentially surprising aspect of the fact that
3517@code{cvs tag} operates on the repository is that you
3518are tagging the checked-in revisions, which may differ
3519from locally modified files in your working directory.
3520If you want to avoid doing this by mistake, specify the
3521@samp{-c} option to @code{cvs tag}.  If there are any
3522locally modified files, @sc{cvs} will abort with an
3523error before it tags any files:
3524
3525@example
3526$ cvs tag -c rel-0-4
3527cvs tag: backend.c is locally modified
3528cvs [tag aborted]: correct the above errors first!
3529@end example
3530
3531@node Tagging by date/tag
3532@section Specifying what to tag by date or revision
3533@cindex rtag (subcommand)
3534
3535The @code{cvs rtag} command tags the repository as of a
3536certain date or time (or can be used to tag the latest
3537revision).  @code{rtag} works directly on the
3538repository contents (it requires no prior checkout and
3539does not look for a working directory).
3540
3541The following options specify which date or revision to
3542tag.  See @ref{Common options}, for a complete
3543description of them.
3544
3545@table @code
3546@item -D @var{date}
3547Tag the most recent revision no later than @var{date}.
3548
3549@item -f
3550Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
3551flags.  If no matching revision is found, use the most
3552recent revision (instead of ignoring the file).
3553
3554@item -r @var{tag}
3555Only tag those files that contain existing tag @var{tag}.
3556@end table
3557
3558The @code{cvs tag} command also allows one to specify
3559files by revision or date, using the same @samp{-r},
3560@samp{-D}, and @samp{-f} options.  However, this
3561feature is probably not what you want.  The reason is
3562that @code{cvs tag} chooses which files to tag based on
3563the files that exist in the working directory, rather
3564than the files which existed as of the given tag/date.
3565Therefore, you are generally better off using @code{cvs
3566rtag}.  The exceptions might be cases like:
3567
3568@example
3569cvs tag -r 1.4 backend.c
3570@end example
3571
3572@node Modifying tags
3573@section Deleting, moving, and renaming tags
3574
3575@c Also see:
3576@c  "How do I move or rename a magic branch tag?"
3577@c in the FAQ (I think the issues it talks about still
3578@c apply, but this could use some sanity.sh work).
3579
3580Normally one does not modify tags.  They exist in order
3581to record the history of the repository and so deleting
3582them or changing their meaning would, generally, not be
3583what you want.
3584
3585However, there might be cases in which one uses a tag
3586temporarily or accidentally puts one in the wrong
3587place.  Therefore, one might delete, move, or rename a
3588tag.  Warning: the commands in this section are
3589dangerous; they permanently discard historical
3590information and it can difficult or impossible to
3591recover from errors.  If you are a @sc{cvs}
3592administrator, you may consider restricting these
3593commands with taginfo (@pxref{user-defined logging}).
3594
3595@cindex Deleting tags
3596@cindex Removing tags
3597@cindex Tags, deleting
3598To delete a tag, specify the @samp{-d} option to either
3599@code{cvs tag} or @code{cvs rtag}.  For example:
3600
3601@example
3602cvs rtag -d rel-0-4 tc
3603@end example
3604
3605deletes the tag @code{rel-0-4} from the module @code{tc}.
3606
3607@cindex Moving tags
3608@cindex Tags, moving
3609When we say @dfn{move} a tag, we mean to make the same
3610name point to different revisions.  For example, the
3611@code{stable} tag may currently point to revision 1.4
3612of @file{backend.c} and perhaps we want to make it
3613point to revision 1.6.  To move a tag, specify the
3614@samp{-F} option to either @code{cvs tag} or @code{cvs
3615rtag}.  For example, the task just mentioned might be
3616accomplished as:
3617
3618@example
3619cvs tag -r 1.6 -F stable backend.c
3620@end example
3621
3622@cindex Renaming tags
3623@cindex Tags, renaming
3624When we say @dfn{rename} a tag, we mean to make a
3625different name point to the same revisions as the old
3626tag.  For example, one may have misspelled the tag name
3627and want to correct it (hopefully before others are
3628relying on the old spelling).  To rename a tag, first
3629create a new tag using the @samp{-r} option to
3630@code{cvs rtag}, and then delete the old name.  This
3631leaves the new tag on exactly the same files as the old
3632tag.  For example:
3633
3634@example
3635cvs rtag -r old-name-0-4 rel-0-4 tc
3636cvs rtag -d old-name-0-4 tc
3637@end example
3638
3639@node Tagging add/remove
3640@section Tagging and adding and removing files
3641
3642The subject of exactly how tagging interacts with
3643adding and removing files is somewhat obscure; for the
3644most part @sc{cvs} will keep track of whether files
3645exist or not without too much fussing.  By default,
3646tags are applied to only files which have a revision
3647corresponding to what is being tagged.  Files which did
3648not exist yet, or which were already removed, simply
3649omit the tag, and @sc{cvs} knows to treat the absence
3650of a tag as meaning that the file didn't exist as of
3651that tag.
3652
3653However, this can lose a small amount of information.
3654For example, suppose a file was added and then removed.
3655Then, if the tag is missing for that file, there is no
3656way to know whether the tag refers to the time before
3657the file was added, or the time after it was removed.
3658If you specify the @samp{-r} option to @code{cvs rtag},
3659then @sc{cvs} tags the files which have been removed,
3660and thereby avoids this problem.  For example, one
3661might specify @code{-r HEAD} to tag the head.
3662
3663On the subject of adding and removing files, the
3664@code{cvs rtag} command has a @samp{-a} option which
3665means to clear the tag from removed files that would
3666not otherwise be tagged.  For example, one might
3667specify this option in conjunction with @samp{-F} when
3668moving a tag.  If one moved a tag without @samp{-a},
3669then the tag in the removed files might still refer to
3670the old revision, rather than reflecting the fact that
3671the file had been removed.  I don't think this is
3672necessary if @samp{-r} is specified, as noted above.
3673
3674@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3675@node Sticky tags
3676@section Sticky tags
3677@cindex Sticky tags
3678@cindex Tags, sticky
3679
3680@c A somewhat related issue is per-directory sticky
3681@c tags (see comment at CVS/Tag in node Working
3682@c directory storage); we probably want to say
3683@c something like "you can set a sticky tag for only
3684@c some files, but you don't want to" or some such.
3685
3686Sometimes a working copy's revision has extra data
3687associated with it, for example it might be on a branch
3688(@pxref{Branching and merging}), or restricted to
3689versions prior to a certain date by @samp{checkout -D}
3690or @samp{update -D}.  Because this data persists --
3691that is, it applies to subsequent commands in the
3692working copy -- we refer to it as @dfn{sticky}.
3693
3694Most of the time, stickiness is an obscure aspect of
3695@sc{cvs} that you don't need to think about.  However,
3696even if you don't want to use the feature, you may need
3697to know @emph{something} about sticky tags (for
3698example, how to avoid them!).
3699
3700You can use the @code{status} command to see if any
3701sticky tags or dates are set:
3702
3703@example
3704$ cvs status driver.c
3705===================================================================
3706File: driver.c          Status: Up-to-date
3707
3708    Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
3709    RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
3710    Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
3711    Sticky Date:        (none)
3712    Sticky Options:     (none)
3713
3714@end example
3715
3716@cindex Resetting sticky tags
3717@cindex Sticky tags, resetting
3718@cindex Deleting sticky tags
3719The sticky tags will remain on your working files until
3720you delete them with @samp{cvs update -A}.  The
3721@samp{-A} option retrieves the version of the file from
3722the head of the trunk, and forgets any sticky tags,
3723dates, or options.
3724
3725@cindex Sticky date
3726The most common use of sticky tags is to identify which
3727branch one is working on, as described in
3728@ref{Accessing branches}.  However, non-branch
3729sticky tags have uses as well.  For example,
3730suppose that you want to avoid updating your working
3731directory, to isolate yourself from possibly
3732destabilizing changes other people are making.  You
3733can, of course, just refrain from running @code{cvs
3734update}.  But if you want to avoid updating only a
3735portion of a larger tree, then sticky tags can help.
3736If you check out a certain revision (such as 1.4) it
3737will become sticky.  Subsequent @code{cvs update}
3738commands will
3739not retrieve the latest revision until you reset the
3740tag with @code{cvs update -A}.  Likewise, use of the
3741@samp{-D} option to @code{update} or @code{checkout}
3742sets a @dfn{sticky date}, which, similarly, causes that
3743date to be used for future retrievals.
3744
3745People often want to retrieve an old version of
3746a file without setting a sticky tag.  This can
3747be done with the @samp{-p} option to @code{checkout} or
3748@code{update}, which sends the contents of the file to
3749standard output.  For example:
3750@example
3751$ cvs update -p -r 1.1 file1 >file1
3752===================================================================
3753Checking out file1
3754RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
3755VERS: 1.1
3756***************
3757$
3758@end example
3759
3760However, this isn't the easiest way, if you are asking
3761how to undo a previous checkin (in this example, put
3762@file{file1} back to the way it was as of revision
37631.1).  In that case you are better off using the
3764@samp{-j} option to @code{update}; for further
3765discussion see @ref{Merging two revisions}.
3766
3767@c ---------------------------------------------------------------------
3768@node Branching and merging
3769@chapter Branching and merging
3770@cindex Branching
3771@cindex Merging
3772@cindex Copying changes
3773@cindex Main trunk and branches
3774@cindex Revision tree, making branches
3775@cindex Branches, copying changes between
3776@cindex Changes, copying between branches
3777@cindex Modifications, copying between branches
3778
3779@sc{cvs} allows you to isolate changes onto a separate
3780line of development, known as a @dfn{branch}.  When you
3781change files on a branch, those changes do not appear
3782on the main trunk or other branches.
3783
3784Later you can move changes from one branch to another
3785branch (or the main trunk) by @dfn{merging}.  Merging
3786involves first running @code{cvs update -j}, to merge
3787the changes into the working directory.
3788You can then commit that revision, and thus effectively
3789copy the changes onto another branch.
3790
3791@menu
3792* Branches motivation::         What branches are good for
3793* Creating a branch::           Creating a branch
3794* Accessing branches::          Checking out and updating branches
3795* Branches and revisions::      Branches are reflected in revision numbers
3796* Magic branch numbers::        Magic branch numbers
3797* Merging a branch::            Merging an entire branch
3798* Merging more than once::      Merging from a branch several times
3799* Merging two revisions::       Merging differences between two revisions
3800* Merging adds and removals::   What if files are added or removed?
3801* Merging and keywords::        Avoiding conflicts due to keyword substitution
3802@end menu
3803
3804@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3805@node Branches motivation
3806@section What branches are good for
3807@cindex Branches motivation
3808@cindex What branches are good for
3809@cindex Motivation for branches
3810
3811@c FIXME: this node mentions one way to use branches,
3812@c but it is by no means the only way.  For example,
3813@c the technique of committing a new feature on a branch,
3814@c until it is ready for the main trunk.  The whole
3815@c thing is generally speaking more akin to the
3816@c "Revision management" node although it isn't clear to
3817@c me whether policy matters should be centralized or
3818@c distributed throughout the relevant sections.
3819Suppose that release 1.0 of tc has been made.  You are continuing to
3820develop tc, planning to create release 1.1 in a couple of months.  After a
3821while your customers start to complain about a fatal bug.  You check
3822out release 1.0 (@pxref{Tags}) and find the bug
3823(which turns out to have a trivial fix).  However, the current revision
3824of the sources are in a state of flux and are not expected to be stable
3825for at least another month.  There is no way to make a
3826bugfix release based on the newest sources.
3827
3828The thing to do in a situation like this is to create a @dfn{branch} on
3829the revision trees for all the files that make up
3830release 1.0 of tc.  You can then make
3831modifications to the branch without disturbing the main trunk.  When the
3832modifications are finished you can elect to either incorporate them on
3833the main trunk, or leave them on the branch.
3834
3835@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3836@node Creating a branch
3837@section Creating a branch
3838@cindex Creating a branch
3839@cindex Branch, creating a
3840@cindex tag, creating a branch using
3841@cindex rtag, creating a branch using
3842
3843You can create a branch with @code{tag -b}; for
3844example, assuming you're in a working copy:
3845
3846@example
3847$ cvs tag -b rel-1-0-patches
3848@end example
3849
3850@c FIXME: we should be more explicit about the value of
3851@c having a tag on the branchpoint.  For example
3852@c "cvs tag rel-1-0-patches-branchpoint" before
3853@c the "cvs tag -b".  This points out that
3854@c rel-1-0-patches is a pretty awkward name for
3855@c this example (more so than for the rtag example
3856@c below).
3857
3858This splits off a branch based on the current revisions
3859in the working copy, assigning that branch the name
3860@samp{rel-1-0-patches}.
3861
3862It is important to understand that branches get created
3863in the repository, not in the working copy.  Creating a
3864branch based on current revisions, as the above example
3865does, will @emph{not} automatically switch the working
3866copy to be on the new branch.  For information on how
3867to do that, see @ref{Accessing branches}.
3868
3869You can also create a branch without reference to any
3870working copy, by using @code{rtag}:
3871
3872@example
3873$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
3874@end example
3875
3876@samp{-r rel-1-0} says that this branch should be
3877rooted at the revision that
3878corresponds to the tag @samp{rel-1-0}.  It need not
3879be the most recent revision -- it's often useful to
3880split a branch off an old revision (for example, when
3881fixing a bug in a past release otherwise known to be
3882stable).
3883
3884As with @samp{tag}, the @samp{-b} flag tells
3885@code{rtag} to create a branch (rather than just a
3886symbolic revision name).  Note that the numeric
3887revision number that matches @samp{rel-1-0} will
3888probably be different from file to file.
3889
3890So, the full effect of the command is to create a new
3891branch -- named @samp{rel-1-0-patches} -- in module
3892@samp{tc}, rooted in the revision tree at the point tagged
3893by @samp{rel-1-0}.
3894
3895@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3896@node Accessing branches
3897@section Accessing branches
3898@cindex Check out a branch
3899@cindex Retrieve a branch
3900@cindex Access a branch
3901@cindex Identifying a branch
3902@cindex Branch, check out
3903@cindex Branch, retrieving
3904@cindex Branch, accessing
3905@cindex Branch, identifying
3906
3907You can retrieve a branch in one of two ways: by
3908checking it out fresh from the repository, or by
3909switching an existing working copy over to the branch.
3910
3911To check out a branch from the repository, invoke
3912@samp{checkout} with the @samp{-r} flag, followed by
3913the tag name of the branch (@pxref{Creating a branch}):
3914
3915@example
3916$ cvs checkout -r rel-1-0-patches tc
3917@end example
3918
3919Or, if you already have a working copy, you can switch
3920it to a given branch with @samp{update -r}:
3921
3922@example
3923$ cvs update -r rel-1-0-patches tc
3924@end example
3925
3926or equivalently:
3927
3928@example
3929$ cd tc
3930$ cvs update -r rel-1-0-patches
3931@end example
3932
3933It does not matter if the working copy was originally
3934on the main trunk or on some other branch -- the above
3935command will switch it to the named branch.  And
3936similarly to a regular @samp{update} command,
3937@samp{update -r} merges any changes you have made,
3938notifying you of conflicts where they occur.
3939
3940Once you have a working copy tied to a particular
3941branch, it remains there until you tell it otherwise.
3942This means that changes checked in from the working
3943copy will add new revisions on that branch, while
3944leaving the main trunk and other branches unaffected.
3945
3946@cindex Branches, sticky
3947To find out what branch a working copy is on, you can
3948use the @samp{status} command.  In its output, look for
3949the field named @samp{Sticky tag} (@pxref{Sticky tags})
3950-- that's @sc{cvs}'s way of telling you the branch, if
3951any, of the current working files:
3952
3953@example
3954$ cvs status -v driver.c backend.c
3955===================================================================
3956File: driver.c          Status: Up-to-date
3957
3958    Version:            1.7     Sat Dec  5 18:25:54 1992
3959    RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
3960    Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
3961    Sticky Date:        (none)
3962    Sticky Options:     (none)
3963
3964    Existing Tags:
3965        rel-1-0-patches             (branch: 1.7.2)
3966        rel-1-0                     (revision: 1.7)
3967
3968===================================================================
3969File: backend.c         Status: Up-to-date
3970
3971    Version:            1.4     Tue Dec  1 14:39:01 1992
3972    RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3973    Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
3974    Sticky Date:        (none)
3975    Sticky Options:     (none)
3976
3977    Existing Tags:
3978        rel-1-0-patches             (branch: 1.4.2)
3979        rel-1-0                     (revision: 1.4)
3980        rel-0-4                     (revision: 1.4)
3981
3982@end example
3983
3984Don't be confused by the fact that the branch numbers
3985for each file are different (@samp{1.7.2} and
3986@samp{1.4.2} respectively).  The branch tag is the
3987same, @samp{rel-1-0-patches}, and the files are
3988indeed on the same branch.  The numbers simply reflect
3989the point in each file's revision history at which the
3990branch was made.  In the above example, one can deduce
3991that @samp{driver.c} had been through more changes than
3992@samp{backend.c} before this branch was created.
3993
3994See @ref{Branches and revisions} for details about how
3995branch numbers are constructed.
3996
3997@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3998@node Branches and revisions
3999@section Branches and revisions
4000@cindex Branch number
4001@cindex Number, branch
4002@cindex Revision numbers (branches)
4003
4004Ordinarily, a file's revision history is a linear
4005series of increments (@pxref{Revision numbers}):
4006
4007@example
4008       +-----+    +-----+    +-----+    +-----+    +-----+
4009       ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4010       +-----+    +-----+    +-----+    +-----+    +-----+
4011@end example
4012
4013However, @sc{cvs} is not limited to linear development.  The
4014@dfn{revision tree} can be split into @dfn{branches},
4015where each branch is a self-maintained line of
4016development.  Changes made on one branch can easily be
4017moved back to the main trunk.
4018
4019Each branch has a @dfn{branch number}, consisting of an
4020odd number of period-separated decimal integers.  The
4021branch number is created by appending an integer to the
4022revision number where the corresponding branch forked
4023off.  Having branch numbers allows more than one branch
4024to be forked off from a certain revision.
4025
4026@need 3500
4027All revisions on a branch have revision numbers formed
4028by appending an ordinal number to the branch number.
4029The following figure illustrates branching with an
4030example.
4031
4032@example
4033@c This example used to have a 1.2.2.4 revision, which
4034@c might help clarify that development can continue on
4035@c 1.2.2.  Might be worth reinstating if it can be done
4036@c without overfull hboxes.
4037@group
4038                                                      +-------------+
4039                           Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4040                                                    / +-------------+
4041                                                   /
4042                                                  /
4043                 +---------+    +---------+    +---------+
4044Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4045               / +---------+    +---------+    +---------+
4046              /
4047             /
4048+-----+    +-----+    +-----+    +-----+    +-----+
4049! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4050+-----+    +-----+    +-----+    +-----+    +-----+
4051                !
4052                !
4053                !   +---------+    +---------+    +---------+
4054Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4055                    +---------+    +---------+    +---------+
4056
4057@end group
4058@end example
4059
4060@c --   However, at least for me the figure is not enough.  I suggest more
4061@c --   text to accompany it.  "A picture is worth a thousand words", so you
4062@c --   have to make sure the reader notices the couple of hundred words
4063@c --   *you* had in mind more than the others!
4064
4065@c --   Why an even number of segments?  This section implies that this is
4066@c --   how the main trunk is distinguished from branch roots, but you never
4067@c --   explicitly say that this is the purpose of the [by itself rather
4068@c --   surprising] restriction to an even number of segments.
4069
4070The exact details of how the branch number is
4071constructed is not something you normally need to be
4072concerned about, but here is how it works: When
4073@sc{cvs} creates a branch number it picks the first
4074unused even integer, starting with 2.  So when you want
4075to create a branch from revision 6.4 it will be
4076numbered 6.4.2.  All branch numbers ending in a zero
4077(such as 6.4.0) are used internally by @sc{cvs}
4078(@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4079special meaning.  @xref{Tracking sources}.
4080
4081@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4082@node Magic branch numbers
4083@section Magic branch numbers
4084
4085@c Want xref to here from "log"?
4086
4087This section describes a @sc{cvs} feature called
4088@dfn{magic branches}.  For most purposes, you need not
4089worry about magic branches; @sc{cvs} handles them for
4090you.  However, they are visible to you in certain
4091circumstances, so it may be useful to have some idea of
4092how it works.
4093
4094Externally, branch numbers consist of an odd number of
4095dot-separated decimal integers.  @xref{Revision
4096numbers}.  That is not the whole truth, however.  For
4097efficiency reasons @sc{cvs} sometimes inserts an extra 0
4098in the second rightmost position (1.2.4 becomes
40991.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4100on).
4101
4102@sc{cvs} does a pretty good job at hiding these so
4103called magic branches, but in a few places the hiding
4104is incomplete:
4105
4106@itemize @bullet
4107@ignore
4108@c This is in ignore as I'm taking their word for it,
4109@c that this was fixed
4110@c a long time ago.  But before deleting this
4111@c entirely, I'd rather verify it (and add a test
4112@c case to the testsuite).
4113@item
4114The magic branch can appear in the output from
4115@code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4116fixed in @sc{cvs} 1.3-s2.
4117
4118@end ignore
4119@item
4120The magic branch number appears in the output from
4121@code{cvs log}.
4122@c What output should appear instead?
4123
4124@item
4125You cannot specify a symbolic branch name to @code{cvs
4126admin}.
4127
4128@end itemize
4129
4130@c Can CVS do this automatically the first time
4131@c you check something in to that branch?  Should
4132@c it?
4133You can use the @code{admin} command to reassign a
4134symbolic name to a branch the way @sc{rcs} expects it
4135to be.  If @code{R4patches} is assigned to the branch
41361.4.2 (magic branch number 1.4.0.2) in file
4137@file{numbers.c} you can do this:
4138
4139@example
4140$ cvs admin -NR4patches:1.4.2 numbers.c
4141@end example
4142
4143It only works if at least one revision is already
4144committed on the branch.  Be very careful so that you
4145do not assign the tag to the wrong number.  (There is
4146no way to see how the tag was assigned yesterday).
4147
4148@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4149@node Merging a branch
4150@section Merging an entire branch
4151@cindex Merging a branch
4152@cindex -j (merging branches)
4153
4154You can merge changes made on a branch into your working copy by giving
4155the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4156@samp{-j @var{branchname}} option it merges the changes made between the
4157point where the branch forked and newest revision on that branch (into
4158your working copy).
4159
4160@cindex Join
4161The @samp{-j} stands for ``join''.
4162
4163@cindex Branch merge example
4164@cindex Example, branch merge
4165@cindex Merge, branch example
4166Consider this revision tree:
4167
4168@example
4169+-----+    +-----+    +-----+    +-----+
4170! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4171+-----+    +-----+    +-----+    +-----+
4172                !
4173                !
4174                !   +---------+    +---------+
4175Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4176                    +---------+    +---------+
4177@end example
4178
4179@noindent
4180The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4181following example assumes that the module @samp{mod} contains only one
4182file, @file{m.c}.
4183
4184@example
4185$ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4186
4187$ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4188                                 # @r{i.e. the changes between revision 1.2}
4189                                 # @r{and 1.2.2.2, into your working copy}
4190                                 # @r{of the file.}
4191
4192$ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4193@end example
4194
4195A conflict can result from a merge operation.  If that
4196happens, you should resolve it before committing the
4197new revision.  @xref{Conflicts example}.
4198
4199If your source files contain keywords (@pxref{Keyword substitution}),
4200you might be getting more conflicts than strictly necessary.  See
4201@ref{Merging and keywords}, for information on how to avoid this.
4202
4203The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4204same effect as above could be achieved with this:
4205
4206@example
4207$ cvs checkout -j R1fix mod
4208$ cvs commit -m "Included R1fix"
4209@end example
4210
4211It should be noted that @code{update -j @var{tagname}} will also work but may
4212not produce the desired result.  @xref{Merging adds and removals}, for more.
4213
4214@node Merging more than once
4215@section Merging from a branch several times
4216
4217Continuing our example, the revision tree now looks
4218like this:
4219
4220@example
4221+-----+    +-----+    +-----+    +-----+    +-----+
4222! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4223+-----+    +-----+    +-----+    +-----+    +-----+
4224                !                           *
4225                !                          *
4226                !   +---------+    +---------+
4227Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4228                    +---------+    +---------+
4229@end example
4230
4231where the starred line represents the merge from the
4232@samp{R1fix} branch to the main trunk, as just
4233discussed.
4234
4235Now suppose that development continues on the
4236@samp{R1fix} branch:
4237
4238@example
4239+-----+    +-----+    +-----+    +-----+    +-----+
4240! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4241+-----+    +-----+    +-----+    +-----+    +-----+
4242                !                           *
4243                !                          *
4244                !   +---------+    +---------+    +---------+
4245Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4246                    +---------+    +---------+    +---------+
4247@end example
4248
4249and then you want to merge those new changes onto the
4250main trunk.  If you just use the @code{cvs update -j
4251R1fix m.c} command again, @sc{cvs} will attempt to
4252merge again the changes which you have already merged,
4253which can have undesirable side effects.
4254
4255So instead you need to specify that you only want to
4256merge the changes on the branch which have not yet been
4257merged into the trunk.  To do that you specify two
4258@samp{-j} options, and @sc{cvs} merges the changes from
4259the first revision to the second revision.  For
4260example, in this case the simplest way would be
4261
4262@example
4263cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4264                                      # @r{head of the R1fix branch}
4265@end example
4266
4267The problem with this is that you need to specify the
42681.2.2.2 revision manually.  A slightly better approach
4269might be to use the date the last merge was done:
4270
4271@example
4272cvs update -j R1fix:yesterday -j R1fix m.c
4273@end example
4274
4275Better yet, tag the R1fix branch after every merge into
4276the trunk, and then use that tag for subsequent merges:
4277
4278@example
4279cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4280@end example
4281
4282@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4283@node Merging two revisions
4284@section Merging differences between any two revisions
4285@cindex Merging two revisions
4286@cindex Revisions, merging differences between
4287@cindex Differences, merging
4288
4289With two @samp{-j @var{revision}} flags, the @code{update}
4290(and @code{checkout}) command can merge the differences
4291between any two revisions into your working file.
4292
4293@cindex Undoing a change
4294@cindex Removing a change
4295@example
4296$ cvs update -j 1.5 -j 1.3 backend.c
4297@end example
4298
4299@noindent
4300will undo all changes made between revision
43011.3 and 1.5.  Note the order of the revisions!
4302
4303If you try to use this option when operating on
4304multiple files, remember that the numeric revisions will
4305probably be very different between the various files.
4306You almost always use symbolic
4307tags rather than revision numbers when operating on
4308multiple files.
4309
4310@cindex Restoring old version of removed file
4311@cindex Resurrecting old version of dead file
4312Specifying two @samp{-j} options can also undo file
4313removals or additions.  For example, suppose you have
4314a file
4315named @file{file1} which existed as revision 1.1, and
4316you then removed it (thus adding a dead revision 1.2).
4317Now suppose you want to add it again, with the same
4318contents it had previously.  Here is how to do it:
4319
4320@example
4321$ cvs update -j 1.2 -j 1.1 file1
4322U file1
4323$ cvs commit -m test
4324Checking in file1;
4325/tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4326new revision: 1.3; previous revision: 1.2
4327done
4328$
4329@end example
4330
4331@node Merging adds and removals
4332@section Merging can add or remove files
4333
4334If the changes which you are merging involve removing
4335or adding some files, @code{update -j} will reflect
4336such additions or removals.
4337
4338@c FIXME: This example needs a lot more explanation.
4339@c We also need other examples for some of the other
4340@c cases (not all--there are too many--as long as we present a
4341@c coherent general principle).
4342For example:
4343@example
4344cvs update -A
4345touch a b c
4346cvs add a b c ; cvs ci -m "added" a b c
4347cvs tag -b branchtag
4348cvs update -r branchtag
4349touch d ; cvs add d
4350rm a ; cvs rm a
4351cvs ci -m "added d, removed a"
4352cvs update -A
4353cvs update -jbranchtag
4354@end example
4355
4356After these commands are executed and a @samp{cvs commit} is done,
4357file @file{a} will be removed and file @file{d} added in the main branch.
4358@c (which was determined by trying it)
4359
4360Note that using a single static tag (@samp{-j @var{tagname}})
4361rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4362changes from a branch will usually not remove files which were removed on the
4363branch since @sc{cvs} does not automatically add static tags to dead revisions.
4364The exception to this rule occurs when
4365a static tag has been attached to a dead revision manually.  Use the branch tag
4366to merge all changes from the branch or use two static tags as merge endpoints
4367to be sure that all intended changes are propogated in the merge.
4368
4369@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4370@node Merging and keywords
4371@section Merging and keywords
4372@cindex Merging, and keyword substitution
4373@cindex Keyword substitution, and merging
4374@cindex -j (merging branches), and keyword substitution
4375@cindex -kk, to avoid conflicts during a merge
4376
4377If you merge files containing keywords (@pxref{Keyword
4378substitution}), you will normally get numerous
4379conflicts during the merge, because the keywords are
4380expanded differently in the revisions which you are
4381merging.
4382
4383Therefore, you will often want to specify the
4384@samp{-kk} (@pxref{Substitution modes}) switch to the
4385merge command line.  By substituting just the name of
4386the keyword, not the expanded value of that keyword,
4387this option ensures that the revisions which you are
4388merging will be the same as each other, and avoid
4389spurious conflicts.
4390
4391For example, suppose you have a file like this:
4392
4393@example
4394       +---------+
4395      _! 1.1.2.1 !   <-  br1
4396     / +---------+
4397    /
4398   /
4399+-----+    +-----+
4400! 1.1 !----! 1.2 !
4401+-----+    +-----+
4402@end example
4403
4404and your working directory is currently on the trunk
4405(revision 1.2).  Then you might get the following
4406results from a merge:
4407
4408@example
4409$ cat file1
4410key $@asis{}Revision: 1.2 $
4411. . .
4412$ cvs update -j br1
4413U file1
4414RCS file: /cvsroot/first-dir/file1,v
4415retrieving revision 1.1
4416retrieving revision 1.1.2.1
4417Merging differences between 1.1 and 1.1.2.1 into file1
4418rcsmerge: warning: conflicts during merge
4419$ cat file1
4420@asis{}<<<<<<< file1
4421key $@asis{}Revision: 1.2 $
4422@asis{}=======
4423key $@asis{}Revision: 1.1.2.1 $
4424@asis{}>>>>>>> 1.1.2.1
4425. . .
4426@end example
4427
4428What happened was that the merge tried to merge the
4429differences between 1.1 and 1.1.2.1 into your working
4430directory.  So, since the keyword changed from
4431@code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4432@sc{cvs} tried to merge that change into your working
4433directory, which conflicted with the fact that your
4434working directory had contained @code{Revision: 1.2}.
4435
4436Here is what happens if you had used @samp{-kk}:
4437
4438@example
4439$ cat file1
4440key $@asis{}Revision: 1.2 $
4441. . .
4442$ cvs update -kk -j br1
4443U file1
4444RCS file: /cvsroot/first-dir/file1,v
4445retrieving revision 1.1
4446retrieving revision 1.1.2.1
4447Merging differences between 1.1 and 1.1.2.1 into file1
4448$ cat file1
4449key $@asis{}Revision$
4450. . .
4451@end example
4452
4453What is going on here is that revision 1.1 and 1.1.2.1
4454both expand as plain @code{Revision}, and therefore
4455merging the changes between them into the working
4456directory need not change anything.  Therefore, there
4457is no conflict.
4458
4459There is, however, one major caveat with using
4460@samp{-kk} on merges.  Namely, it overrides whatever
4461keyword expansion mode @sc{cvs} would normally have
4462used.  In particular, this is a problem if the mode had
4463been @samp{-kb} for a binary file.  Therefore, if your
4464repository contains binary files, you will need to deal
4465with the conflicts rather than using @samp{-kk}.
4466
4467@ignore
4468The following seems rather confusing, possibly buggy,
4469and in general, in need of much more thought before it
4470is a recommended technique.  For one thing, does it
4471apply on Windows as well as on Unix?
4472
4473Unchanged binary files will undergo the same keyword substitution
4474but will not be checked in on a subsequent
4475@code{cvs commit}.  Be aware that binary files containing keyword
4476strings which are present in or below the working directory
4477will most likely remain corrupt until repaired, however.  A simple
4478@code{cvs update -A} is sufficient to fix these otherwise unaltered binary files
4479if the merge is being done to the main branch but
4480this must be done after the merge has been committed or the merge itself
4481will be lost.
4482
4483For Example:
4484@example
4485cvs update -Akk -jbranchtag
4486cvs commit
4487cvs update -A
4488@end example
4489
4490@noindent
4491will update the current directory from the main trunk of the
4492repository, substituting the base keyword strings for keywords,
4493and merge changes made on the branch @samp{branchtag} into the new
4494work files, performing the same keyword substitution on that file set before
4495comparing the two sets.  The final @code{cvs update -A} will restore any
4496corrupted binary files as well as resetting the sticky @samp{-kk} tags which
4497were present on the files in and below the working directory.
4498Unfortunately, this doesn't work as well with an arbitrary branch tag, as the
4499@samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk}
4500switches attached to the working files as @samp{-A} does.  The workaround
4501for this is to release the working directory after the merge has been
4502committed and check it out again.
4503@end ignore
4504
4505@c ---------------------------------------------------------------------
4506@node Recursive behavior
4507@chapter Recursive behavior
4508@cindex Recursive (directory descending)
4509@cindex Directory, descending
4510@cindex Descending directories
4511@cindex Subdirectories
4512
4513Almost all of the subcommands of @sc{cvs} work
4514recursively when you specify a directory as an
4515argument.  For instance, consider this directory
4516structure:
4517
4518@example
4519      @code{$HOME}
4520        |
4521        +--@t{tc}
4522        |   |
4523            +--@t{CVS}
4524            |      (internal @sc{cvs} files)
4525            +--@t{Makefile}
4526            +--@t{backend.c}
4527            +--@t{driver.c}
4528            +--@t{frontend.c}
4529            +--@t{parser.c}
4530            +--@t{man}
4531            |    |
4532            |    +--@t{CVS}
4533            |    |  (internal @sc{cvs} files)
4534            |    +--@t{tc.1}
4535            |
4536            +--@t{testing}
4537                 |
4538                 +--@t{CVS}
4539                 |  (internal @sc{cvs} files)
4540                 +--@t{testpgm.t}
4541                 +--@t{test2.t}
4542@end example
4543
4544@noindent
4545If @file{tc} is the current working directory, the
4546following is true:
4547
4548@itemize @bullet
4549@item
4550@samp{cvs update testing} is equivalent to
4551
4552@example
4553cvs update testing/testpgm.t testing/test2.t
4554@end example
4555
4556@item
4557@samp{cvs update testing man} updates all files in the
4558subdirectories
4559
4560@item
4561@samp{cvs update .} or just @samp{cvs update} updates
4562all files in the @code{tc} directory
4563@end itemize
4564
4565If no arguments are given to @code{update} it will
4566update all files in the current working directory and
4567all its subdirectories.  In other words, @file{.} is a
4568default argument to @code{update}.  This is also true
4569for most of the @sc{cvs} subcommands, not only the
4570@code{update} command.
4571
4572The recursive behavior of the @sc{cvs} subcommands can be
4573turned off with the @samp{-l} option.
4574Conversely, the @samp{-R} option can be used to force recursion if
4575@samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4576
4577@example
4578$ cvs update -l         # @r{Don't update files in subdirectories}
4579@end example
4580
4581@c ---------------------------------------------------------------------
4582@node Adding and removing
4583@chapter Adding, removing, and renaming files and directories
4584
4585In the course of a project, one will often add new
4586files.  Likewise with removing or renaming, or with
4587directories.  The general concept to keep in mind in
4588all these cases is that instead of making an
4589irreversible change you want @sc{cvs} to record the
4590fact that a change has taken place, just as with
4591modifying an existing file.  The exact mechanisms to do
4592this in @sc{cvs} vary depending on the situation.
4593
4594@menu
4595* Adding files::                Adding files
4596* Removing files::              Removing files
4597* Removing directories::        Removing directories
4598* Moving files::                Moving and renaming files
4599* Moving directories::          Moving and renaming directories
4600@end menu
4601
4602@node Adding files
4603@section Adding files to a directory
4604@cindex Adding files
4605
4606To add a new file to a directory, follow these steps.
4607
4608@itemize @bullet
4609@item
4610You must have a working copy of the directory.
4611@xref{Getting the source}.
4612
4613@item
4614Create the new file inside your working copy of the directory.
4615
4616@item
4617Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
4618want to version control the file.  If the file contains
4619binary data, specify @samp{-kb} (@pxref{Binary files}).
4620
4621@item
4622Use @samp{cvs commit @var{filename}} to actually check
4623in the file into the repository.  Other developers
4624cannot see the file until you perform this step.
4625@end itemize
4626
4627You can also use the @code{add} command to add a new
4628directory.
4629@c FIXCVS and/or FIXME: Adding a directory doesn't
4630@c require the commit step.  This probably can be
4631@c considered a CVS bug, but it is possible we should
4632@c warn people since this behavior probably won't be
4633@c changing right away.
4634
4635Unlike most other commands, the @code{add} command is
4636not recursive.  You cannot even type @samp{cvs add
4637foo/bar}!  Instead, you have to
4638@c FIXCVS: This is, of course, not a feature.  It is
4639@c just that no one has gotten around to fixing "cvs add
4640@c foo/bar".
4641
4642@example
4643$ cd foo
4644$ cvs add bar
4645@end example
4646
4647@cindex add (subcommand)
4648@deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
4649
4650Schedule @var{files} to be added to the repository.
4651The files or directories specified with @code{add} must
4652already exist in the current directory.  To add a whole
4653new directory hierarchy to the source repository (for
4654example, files received from a third-party vendor), use
4655the @code{import} command instead.  @xref{import}.
4656
4657The added files are not placed in the source repository
4658until you use @code{commit} to make the change
4659permanent.  Doing an @code{add} on a file that was
4660removed with the @code{remove} command will undo the
4661effect of the @code{remove}, unless a @code{commit}
4662command intervened.  @xref{Removing files}, for an
4663example.
4664
4665The @samp{-k} option specifies the default way that
4666this file will be checked out; for more information see
4667@ref{Substitution modes}.
4668
4669@c As noted in BUGS, -m is broken client/server (Nov
4670@c 96).  Also see testsuite log2-* tests.
4671The @samp{-m} option specifies a description for the
4672file.  This description appears in the history log (if
4673it is enabled, @pxref{history file}).  It will also be
4674saved in the version history inside the repository when
4675the file is committed.  The @code{log} command displays
4676this description.  The description can be changed using
4677@samp{admin -t}.  @xref{admin}.  If you omit the
4678@samp{-m @var{description}} flag, an empty string will
4679be used.  You will not be prompted for a description.
4680@end deffn
4681
4682For example, the following commands add the file
4683@file{backend.c} to the repository:
4684
4685@c This example used to specify
4686@c     -m "Optimizer and code generation passes."
4687@c to the cvs add command, but that doesn't work
4688@c client/server (see log2 in sanity.sh).  Should fix CVS,
4689@c but also seems strange to document things which
4690@c don't work...
4691@example
4692$ cvs add backend.c
4693$ cvs commit -m "Early version. Not yet compilable." backend.c
4694@end example
4695
4696When you add a file it is added only on the branch
4697which you are working on (@pxref{Branching and merging}).  You can
4698later merge the additions to another branch if you want
4699(@pxref{Merging adds and removals}).
4700@c Should we mention that earlier versions of CVS
4701@c lacked this feature (1.3) or implemented it in a buggy
4702@c way (well, 1.8 had many bugs in cvs update -j)?
4703@c Should we mention the bug/limitation regarding a
4704@c file being a regular file on one branch and a directory
4705@c on another?
4706@c FIXME: This needs an example, or several, here or
4707@c elsewhere, for it to make much sense.
4708@c Somewhere we need to discuss the aspects of death
4709@c support which don't involve branching, I guess.
4710@c Like the ability to re-create a release from a tag.
4711
4712@c ---------------------------------------------------------------------
4713@node Removing files
4714@section Removing files
4715@cindex Removing files
4716@cindex Deleting files
4717
4718@c FIXME: this node wants to be split into several
4719@c smaller nodes.  Could make these children of
4720@c "Adding and removing", probably (death support could
4721@c be its own section, for example, as could the
4722@c various bits about undoing mistakes in adding and
4723@c removing).
4724Directories change.  New files are added, and old files
4725disappear.  Still, you want to be able to retrieve an
4726exact copy of old releases.
4727
4728Here is what you can do to remove a file,
4729but remain able to retrieve old revisions:
4730
4731@itemize @bullet
4732@c FIXME: should probably be saying something about
4733@c having a working directory in the first place.
4734@item
4735Make sure that you have not made any uncommitted
4736modifications to the file.  @xref{Viewing differences},
4737for one way to do that.  You can also use the
4738@code{status} or @code{update} command.  If you remove
4739the file without committing your changes, you will of
4740course not be able to retrieve the file as it was
4741immediately before you deleted it.
4742
4743@item
4744Remove the file from your working copy of the directory.
4745You can for instance use @code{rm}.
4746
4747@item
4748Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
4749you really want to delete the file.
4750
4751@item
4752Use @samp{cvs commit @var{filename}} to actually
4753perform the removal of the file from the repository.
4754@end itemize
4755
4756@c FIXME: Somehow this should be linked in with a more
4757@c general discussion of death support.  I don't know
4758@c whether we want to use the term "death support" or
4759@c not (we can perhaps get by without it), but we do
4760@c need to discuss the "dead" state in "cvs log" and
4761@c related subjects.  The current discussion is
4762@c scattered around, and not xref'd to each other.
4763@c FIXME: I think this paragraph wants to be moved
4764@c later down, at least after the first example.
4765When you commit the removal of the file, @sc{cvs}
4766records the fact that the file no longer exists.  It is
4767possible for a file to exist on only some branches and
4768not on others, or to re-add another file with the same
4769name later.  @sc{cvs} will correctly create or not create
4770the file, based on the @samp{-r} and @samp{-D} options
4771specified to @code{checkout} or @code{update}.
4772
4773@c FIXME: This style seems to clash with how we
4774@c document things in general.
4775@cindex Remove (subcommand)
4776@deffn Command {cvs remove} [options] files @dots{}
4777
4778Schedule file(s) to be removed from the repository
4779(files which have not already been removed from the
4780working directory are not processed).  This command
4781does not actually remove the file from the repository
4782until you commit the removal.  For a full list of
4783options, see @ref{Invoking CVS}.
4784@end deffn
4785
4786Here is an example of removing several files:
4787
4788@example
4789$ cd test
4790$ rm *.c
4791$ cvs remove
4792cvs remove: Removing .
4793cvs remove: scheduling a.c for removal
4794cvs remove: scheduling b.c for removal
4795cvs remove: use 'cvs commit' to remove these files permanently
4796$ cvs ci -m "Removed unneeded files"
4797cvs commit: Examining .
4798cvs commit: Committing .
4799@end example
4800
4801As a convenience you can remove the file and @code{cvs
4802remove} it in one step, by specifying the @samp{-f}
4803option.  For example, the above example could also be
4804done like this:
4805
4806@example
4807$ cd test
4808$ cvs remove -f *.c
4809cvs remove: scheduling a.c for removal
4810cvs remove: scheduling b.c for removal
4811cvs remove: use 'cvs commit' to remove these files permanently
4812$ cvs ci -m "Removed unneeded files"
4813cvs commit: Examining .
4814cvs commit: Committing .
4815@end example
4816
4817If you execute @code{remove} for a file, and then
4818change your mind before you commit, you can undo the
4819@code{remove} with an @code{add} command.
4820@ignore
4821@c is this worth saying or not?  Somehow it seems
4822@c confusing to me.
4823Of course,
4824since you have removed your copy of file in the working
4825directory, @sc{cvs} does not necessarily bring back the
4826contents of the file from right before you executed
4827@code{remove}; instead it gets the file from the
4828repository again.
4829@end ignore
4830
4831@c FIXME: what if you change your mind after you commit
4832@c it?  (answer is also "cvs add" but we don't say that...).
4833@c We need some index entries for thinks like "undoing
4834@c removal" too.
4835
4836@example
4837$ ls
4838CVS   ja.h  oj.c
4839$ rm oj.c
4840$ cvs remove oj.c
4841cvs remove: scheduling oj.c for removal
4842cvs remove: use 'cvs commit' to remove this file permanently
4843$ cvs add oj.c
4844U oj.c
4845cvs add: oj.c, version 1.1.1.1, resurrected
4846@end example
4847
4848If you realize your mistake before you run the
4849@code{remove} command you can use @code{update} to
4850resurrect the file:
4851
4852@example
4853$ rm oj.c
4854$ cvs update oj.c
4855cvs update: warning: oj.c was lost
4856U oj.c
4857@end example
4858
4859When you remove a file it is removed only on the branch
4860which you are working on (@pxref{Branching and merging}).  You can
4861later merge the removals to another branch if you want
4862(@pxref{Merging adds and removals}).
4863
4864@node Removing directories
4865@section Removing directories
4866@cindex Removing directories
4867@cindex Directories, removing
4868
4869In concept removing directories is somewhat similar to
4870removing files---you want the directory to not exist in
4871your current working directories, but you also want to
4872be able to retrieve old releases in which the directory
4873existed.
4874
4875The way that you remove a directory is to remove all
4876the files in it.  You don't remove the directory
4877itself; there is no way to do that.
4878Instead you specify the @samp{-P} option to
4879@code{cvs update} or @code{cvs checkout},
4880which will cause @sc{cvs} to remove empty
4881directories from working directories.
4882(Note that @code{cvs export} always removes empty directories.)
4883Probably the
4884best way to do this is to always specify @samp{-P}; if
4885you want an empty directory then put a dummy file (for
4886example @file{.keepme}) in it to prevent @samp{-P} from
4887removing it.
4888
4889@c I'd try to give a rationale for this, but I'm not
4890@c sure there is a particularly convincing one.  What
4891@c we would _like_ is for CVS to do a better job of version
4892@c controlling whether directories exist, to eliminate the
4893@c need for -P and so that a file can be a directory in
4894@c one revision and a regular file in another.
4895Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
4896options of @code{checkout}.  This way
4897@sc{cvs} will be able to correctly create the directory
4898or not depending on whether the particular version you
4899are checking out contains any files in that directory.
4900
4901@c ---------------------------------------------------------------------
4902@node Moving files
4903@section Moving and renaming files
4904@cindex Moving files
4905@cindex Renaming files
4906@cindex Files, moving
4907
4908Moving files to a different directory or renaming them
4909is not difficult, but some of the ways in which this
4910works may be non-obvious.  (Moving or renaming a
4911directory is even harder.  @xref{Moving directories}.).
4912
4913The examples below assume that the file @var{old} is renamed to
4914@var{new}.
4915
4916@menu
4917* Outside::                     The normal way to Rename
4918* Inside::                      A tricky, alternative way
4919* Rename by copying::           Another tricky, alternative way
4920@end menu
4921
4922@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4923@node Outside
4924@subsection The Normal way to Rename
4925
4926@c More rename issues.  Not sure whether these are
4927@c worth documenting; I'm putting them here because
4928@c it seems to be as good a place as any to try to
4929@c set down the issues.
4930@c * "cvs annotate" will annotate either the new
4931@c file or the old file; it cannot annotate _each
4932@c line_ based on whether it was last changed in the
4933@c new or old file.  Unlike "cvs log", where the
4934@c consequences of having to select either the new
4935@c or old name seem fairly benign, this may be a
4936@c real advantage to having CVS know about renames
4937@c other than as a deletion and an addition.
4938
4939The normal way to move a file is to copy @var{old} to
4940@var{new}, and then issue the normal @sc{cvs} commands
4941to remove @var{old} from the repository, and add
4942@var{new} to it.
4943@c The following sentence is not true: one must cd into
4944@c the directory to run "cvs add".
4945@c  (Both @var{old} and @var{new} could
4946@c contain relative paths, for example @file{foo/bar.c}).
4947
4948@example
4949$ mv @var{old} @var{new}
4950$ cvs remove @var{old}
4951$ cvs add @var{new}
4952$ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
4953@end example
4954
4955This is the simplest way to move a file, it is not
4956error-prone, and it preserves the history of what was
4957done.  Note that to access the history of the file you
4958must specify the old or the new name, depending on what
4959portion of the history you are accessing.  For example,
4960@code{cvs log @var{old}} will give the log up until the
4961time of the rename.
4962
4963When @var{new} is committed its revision numbers will
4964start again, usually at 1.1, so if that bothers you,
4965use the @samp{-r rev} option to commit.  For more
4966information see @ref{Assigning revisions}.
4967
4968@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4969@node Inside
4970@subsection Moving the history file
4971
4972This method is more dangerous, since it involves moving
4973files inside the repository.  Read this entire section
4974before trying it out!
4975
4976@example
4977$ cd $CVSROOT/@var{dir}
4978$ mv @var{old},v @var{new},v
4979@end example
4980
4981@noindent
4982Advantages:
4983
4984@itemize @bullet
4985@item
4986The log of changes is maintained intact.
4987
4988@item
4989The revision numbers are not affected.
4990@end itemize
4991
4992@noindent
4993Disadvantages:
4994
4995@itemize @bullet
4996@item
4997Old releases cannot easily be fetched from the
4998repository.  (The file will show up as @var{new} even
4999in revisions from the time before it was renamed).
5000
5001@item
5002There is no log information of when the file was renamed.
5003
5004@item
5005Nasty things might happen if someone accesses the history file
5006while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5007commands while you move it.
5008@end itemize
5009
5010@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5011@node Rename by copying
5012@subsection Copying the history file
5013
5014This way also involves direct modifications to the
5015repository.  It is safe, but not without drawbacks.
5016
5017@example
5018# @r{Copy the @sc{rcs} file inside the repository}
5019$ cd $CVSROOT/@var{dir}
5020$ cp @var{old},v @var{new},v
5021# @r{Remove the old file}
5022$ cd ~/@var{dir}
5023$ rm @var{old}
5024$ cvs remove @var{old}
5025$ cvs commit @var{old}
5026# @r{Remove all tags from @var{new}}
5027$ cvs update @var{new}
5028$ cvs log @var{new}             # @r{Remember the non-branch tag names}
5029$ cvs tag -d @var{tag1} @var{new}
5030$ cvs tag -d @var{tag2} @var{new}
5031@dots{}
5032@end example
5033
5034By removing the tags you will be able to check out old
5035revisions.
5036
5037@noindent
5038Advantages:
5039
5040@itemize @bullet
5041@item
5042@c FIXME: Is this true about -D now that we have death
5043@c support?  See 5B.3 in the FAQ.
5044Checking out old revisions works correctly, as long as
5045you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
5046to retrieve the revisions.
5047
5048@item
5049The log of changes is maintained intact.
5050
5051@item
5052The revision numbers are not affected.
5053@end itemize
5054
5055@noindent
5056Disadvantages:
5057
5058@itemize @bullet
5059@item
5060You cannot easily see the history of the file across the rename.
5061
5062@ignore
5063@c Is this true?  I don't see how the revision numbers
5064@c _could_ start over, when new,v is just old,v with
5065@c the tags deleted.
5066@c If there is some need to reinstate this text,
5067@c it is "usually 1.1", not "1.0" and it needs an
5068@c xref to Assigning revisions
5069@item
5070Unless you use the @samp{-r rev} (@pxref{commit
5071options}) flag when @var{new} is committed its revision
5072numbers will start at 1.0 again.
5073@end ignore
5074@end itemize
5075
5076@c ---------------------------------------------------------------------
5077@node Moving directories
5078@section Moving and renaming directories
5079@cindex Moving directories
5080@cindex Renaming directories
5081@cindex Directories, moving
5082
5083The normal way to rename or move a directory is to
5084rename or move each file within it as described in
5085@ref{Outside}.  Then check out with the @samp{-P}
5086option, as described in @ref{Removing directories}.
5087
5088If you really want to hack the repository to rename or
5089delete a directory in the repository, you can do it
5090like this:
5091
5092@enumerate
5093@item
5094Inform everyone who has a checked out copy of the directory that the
5095directory will be renamed.  They should commit all
5096their changes, and remove their working copies,
5097before you take the steps below.
5098
5099@item
5100Rename the directory inside the repository.
5101
5102@example
5103$ cd $CVSROOT/@var{parent-dir}
5104$ mv @var{old-dir} @var{new-dir}
5105@end example
5106
5107@item
5108Fix the @sc{cvs} administrative files, if necessary (for
5109instance if you renamed an entire module).
5110
5111@item
5112Tell everyone that they can check out again and continue
5113working.
5114
5115@end enumerate
5116
5117If someone had a working copy the @sc{cvs} commands will
5118cease to work for him, until he removes the directory
5119that disappeared inside the repository.
5120
5121It is almost always better to move the files in the
5122directory instead of moving the directory.  If you move the
5123directory you are unlikely to be able to retrieve old
5124releases correctly, since they probably depend on the
5125name of the directories.
5126
5127@c ---------------------------------------------------------------------
5128@node History browsing
5129@chapter History browsing
5130@cindex History browsing
5131@cindex Traceability
5132@cindex Isolation
5133
5134@ignore
5135@c This is too long for an introduction (goal is
5136@c one 20x80 character screen), and also mixes up a
5137@c variety of issues (parallel development, history,
5138@c maybe even touches on process control).
5139
5140@c -- @quote{To lose ones history is to lose ones soul.}
5141@c -- ///
5142@c -- ///Those who cannot remember the past are condemned to repeat it.
5143@c -- ///               -- George Santayana
5144@c -- ///
5145
5146@sc{cvs} tries to make it easy for a group of people to work
5147together.  This is done in two ways:
5148
5149@itemize @bullet
5150@item
5151Isolation---You have your own working copy of the
5152source.  You are not affected by modifications made by
5153others until you decide to incorporate those changes
5154(via the @code{update} command---@pxref{update}).
5155
5156@item
5157Traceability---When something has changed, you can
5158always see @emph{exactly} what changed.
5159@end itemize
5160
5161There are several features of @sc{cvs} that together lead
5162to traceability:
5163
5164@itemize @bullet
5165@item
5166Each revision of a file has an accompanying log
5167message.
5168
5169@item
5170All commits are optionally logged to a central history
5171database.
5172
5173@item
5174Logging information can be sent to a user-defined
5175program (@pxref{loginfo}).
5176@end itemize
5177
5178@c -- More text here.
5179
5180This chapter should talk about the history file, the
5181@code{log} command, the usefulness of ChangeLogs
5182even when you run @sc{cvs}, and things like that.
5183
5184@end ignore
5185
5186@c kind of lame, in a lot of ways the above text inside
5187@c the @ignore motivates this chapter better
5188Once you have used @sc{cvs} to store a version control
5189history---what files have changed when, how, and by
5190whom, there are a variety of mechanisms for looking
5191through the history.
5192
5193@c FIXME: should also be talking about how you look at
5194@c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5195@menu
5196* log messages::                Log messages
5197* history database::            The history database
5198* user-defined logging::        User-defined logging
5199* annotate::                    What revision modified each line of a file?
5200@end menu
5201
5202@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5203@node log messages
5204@section Log messages
5205
5206@c FIXME: @xref to place where we talk about how to
5207@c specify message to commit.
5208Whenever you commit a file you specify a log message.
5209
5210@c FIXME: bring the information here, and get rid of or
5211@c greatly shrink the "log" node.
5212To look through the log messages which have been
5213specified for every revision which has been committed,
5214use the @code{cvs log} command (@pxref{log}).
5215
5216@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5217@node history database
5218@section The history database
5219
5220@c FIXME: bring the information from the history file
5221@c and history nodes here.  Rewrite it to be motivated
5222@c better (start out by clearly explaining what gets
5223@c logged in history, for example).
5224You can use the history file (@pxref{history file}) to
5225log various @sc{cvs} actions.  To retrieve the
5226information from the history file, use the @code{cvs
5227history} command (@pxref{history}).
5228
5229Note: you can control what is logged to this file by using the
5230@samp{LogHistory} keyword in the @file{CVSROOT/config} file
5231(@pxref{config}).
5232
5233@c
5234@c The history database has many problems:
5235@c * It is very unclear what field means what.  This
5236@c could be improved greatly by better documentation,
5237@c but there are still non-orthogonalities (for
5238@c example, tag does not record the "repository"
5239@c field but most records do).
5240@c * Confusion about files, directories, and modules.
5241@c Some commands record one, some record others.
5242@c * File removal is not logged.  There is an 'R'
5243@c record type documented, but CVS never uses it.
5244@c * Tags are only logged for the "cvs rtag" command,
5245@c not "cvs tag".  The fix for this is not completely
5246@c clear (see above about modules vs. files).
5247@c * Are there other cases of operations that are not
5248@c logged?  One would hope for all changes to the
5249@c repository to be logged somehow (particularly
5250@c operations like tagging, "cvs admin -k", and other
5251@c operations which do not record a history that one
5252@c can get with "cvs log").  Operations on the working
5253@c directory, like export, get, and release, are a
5254@c second category also covered by the current "cvs
5255@c history".
5256@c * The history file does not record the options given
5257@c to a command.  The most serious manifestation of
5258@c this is perhaps that it doesn't record whether a command
5259@c was recursive.  It is not clear to me whether one
5260@c wants to log at a level very close to the command
5261@c line, as a sort of way of logging each command
5262@c (more or less), or whether one wants
5263@c to log more at the level of what was changed (or
5264@c something in between), but either way the current
5265@c information has pretty big gaps.
5266@c * Further details about a tag--like whether it is a
5267@c branch tag or, if a non-branch tag, which branch it
5268@c is on.  One can find out this information about the
5269@c tag as it exists _now_, but if the tag has been
5270@c moved, one doesn't know what it was like at the time
5271@c the history record was written.
5272@c * Whether operating on a particular tag, date, or
5273@c options was implicit (sticky) or explicit.
5274@c
5275@c Another item, only somewhat related to the above, is a
5276@c way to control what is logged in the history file.
5277@c This is probably the only good way to handle
5278@c different people having different ideas about
5279@c information/space tradeoffs.
5280@c
5281@c It isn't really clear that it makes sense to try to
5282@c patch up the history file format as it exists now to
5283@c include all that stuff.  It might be better to
5284@c design a whole new CVSROOT/nhistory file and "cvs
5285@c nhistory" command, or some such, or in some other
5286@c way trying to come up with a clean break from the
5287@c past, which can address the above concerns.  Another
5288@c open question is how/whether this relates to
5289@c taginfo/loginfo/etc.
5290
5291@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5292@node user-defined logging
5293@section User-defined logging
5294
5295@c FIXME: should probably also mention the fact the -l
5296@c global option can disable most of the mechanisms
5297@c discussed here (why?  What is the -l global option for?).
5298@c
5299@c FIXME: probably should centralize this information
5300@c here, at least to some extent.  Maybe by moving the
5301@c loginfo, etc., nodes here and replacing
5302@c the "user-defined logging" node with one node for
5303@c each method.
5304You can customize @sc{cvs} to log various kinds of
5305actions, in whatever manner you choose.  These
5306mechanisms operate by executing a script at various
5307times.  The script might append a message to a file
5308listing the information and the programmer who created
5309it, or send mail to a group of developers, or, perhaps,
5310post a message to a particular newsgroup.  To log
5311commits, use the @file{loginfo} file (@pxref{loginfo}).
5312@c FIXME: What is difference between doing it in the
5313@c modules file and using loginfo/taginfo?  Why should
5314@c user use one or the other?
5315To log commits, checkouts, exports, and tags,
5316respectively, you can also use the @samp{-i},
5317@samp{-o}, @samp{-e}, and @samp{-t} options in the
5318modules file.  For a more flexible way of giving
5319notifications to various users, which requires less in
5320the way of keeping centralized scripts up to date, use
5321the @code{cvs watch add} command (@pxref{Getting
5322Notified}); this command is useful even if you are not
5323using @code{cvs watch on}.
5324
5325@cindex taginfo
5326@cindex Exit status, of taginfo
5327The @file{taginfo} file defines programs to execute
5328when someone executes a @code{tag} or @code{rtag}
5329command.  The @file{taginfo} file has the standard form
5330for administrative files (@pxref{Administrative
5331files}), where each line is a regular expression
5332followed by a command to execute.  The arguments passed
5333to the command are, in order, the @var{tagname},
5334@var{operation} (@code{add} for @code{tag},
5335@code{mov} for @code{tag -F}, and @code{del} for
5336@code{tag -d}), @var{repository}, and any remaining are
5337pairs of @var{filename} @var{revision}.  A non-zero
5338exit of the filter program will cause the tag to be
5339aborted.
5340
5341Here is an example of using taginfo to log tag and rtag
5342commands.  In the taginfo file put:
5343
5344@example
5345ALL /usr/local/cvsroot/CVSROOT/loggit
5346@end example
5347
5348Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
5349following script:
5350
5351@example
5352#!/bin/sh
5353echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
5354@end example
5355
5356@node annotate
5357@section Annotate command
5358@cindex annotate (subcommand)
5359
5360@deffn Command {cvs annotate} [@code{-flR}] [@code{-r rev}|@code{-D date}] files @dots{}
5361
5362For each file in @var{files}, print the head revision
5363of the trunk, together with information on the last
5364modification for each line.  For example:
5365
5366@example
5367$ cvs annotate ssfile
5368Annotations for ssfile
5369***************
53701.1          (mary     27-Mar-96): ssfile line 1
53711.2          (joe      28-Mar-96): ssfile line 2
5372@end example
5373
5374The file @file{ssfile} currently contains two lines.
5375The @code{ssfile line 1} line was checked in by
5376@code{mary} on March 27.  Then, on March 28, @code{joe}
5377added a line @code{ssfile line 2}, without modifying
5378the @code{ssfile line 1} line.  This report doesn't
5379tell you anything about lines which have been deleted
5380or replaced; you need to use @code{cvs diff} for that
5381(@pxref{diff}).
5382
5383@end deffn
5384
5385The options to @code{cvs annotate} are listed in
5386@ref{Invoking CVS}, and can be used to select the files
5387and revisions to annotate.  The options are described
5388in more detail in @ref{Common options}.
5389
5390@c FIXME: maybe an example using the options?  Just
5391@c what it means to select a revision might be worth a
5392@c few words of explanation ("you want to see who
5393@c changed this line *before* 1.4"...).
5394
5395@c ---------------------------------------------------------------------
5396@node Binary files
5397@chapter Handling binary files
5398@cindex Binary files
5399
5400The most common use for @sc{cvs} is to store text
5401files.  With text files, @sc{cvs} can merge revisions,
5402display the differences between revisions in a
5403human-visible fashion, and other such operations.
5404However, if you are willing to give up a few of these
5405abilities, @sc{cvs} can store binary files.  For
5406example, one might store a web site in @sc{cvs}
5407including both text files and binary images.
5408
5409@menu
5410* Binary why::     More details on issues with binary files
5411* Binary howto::   How to store them
5412@end menu
5413
5414@node Binary why
5415@section The issues with binary files
5416
5417While the need to manage binary files may seem obvious
5418if the files that you customarily work with are binary,
5419putting them into version control does present some
5420additional issues.
5421
5422One basic function of version control is to show the
5423differences between two revisions.  For example, if
5424someone else checked in a new version of a file, you
5425may wish to look at what they changed and determine
5426whether their changes are good.  For text files,
5427@sc{cvs} provides this functionality via the @code{cvs
5428diff} command.  For binary files, it may be possible to
5429extract the two revisions and then compare them with a
5430tool external to @sc{cvs} (for example, word processing
5431software often has such a feature).  If there is no
5432such tool, one must track changes via other mechanisms,
5433such as urging people to write good log messages, and
5434hoping that the changes they actually made were the
5435changes that they intended to make.
5436
5437Another ability of a version control system is the
5438ability to merge two revisions.  For @sc{cvs} this
5439happens in two contexts.  The first is when users make
5440changes in separate working directories
5441(@pxref{Multiple developers}).  The second is when one
5442merges explicitly with the @samp{update -j} command
5443(@pxref{Branching and merging}).
5444
5445In the case of text
5446files, @sc{cvs} can merge changes made independently,
5447and signal a conflict if the changes conflict.  With
5448binary files, the best that @sc{cvs} can do is present
5449the two different copies of the file, and leave it to
5450the user to resolve the conflict.  The user may choose
5451one copy or the other, or may run an external merge
5452tool which knows about that particular file format, if
5453one exists.
5454Note that having the user merge relies primarily on the
5455user to not accidentally omit some changes, and thus is
5456potentially error prone.
5457
5458If this process is thought to be undesirable, the best
5459choice may be to avoid merging.  To avoid the merges
5460that result from separate working directories, see the
5461discussion of reserved checkouts (file locking) in
5462@ref{Multiple developers}.  To avoid the merges
5463resulting from branches, restrict use of branches.
5464
5465@node Binary howto
5466@section How to store binary files
5467
5468There are two issues with using @sc{cvs} to store
5469binary files.  The first is that @sc{cvs} by default
5470converts line endings between the canonical form in
5471which they are stored in the repository (linefeed
5472only), and the form appropriate to the operating system
5473in use on the client (for example, carriage return
5474followed by line feed for Windows NT).
5475
5476The second is that a binary file might happen to
5477contain data which looks like a keyword (@pxref{Keyword
5478substitution}), so keyword expansion must be turned
5479off.
5480
5481@c FIXME: the third is that one can't do merges with
5482@c binary files.  xref to Multiple Developers and the
5483@c reserved checkout issues.
5484
5485The @samp{-kb} option available with some @sc{cvs}
5486commands insures that neither line ending conversion
5487nor keyword expansion will be done.
5488
5489Here is an example of how you can create a new file
5490using the @samp{-kb} flag:
5491
5492@example
5493$ echo '$@asis{}Id$' > kotest
5494$ cvs add -kb -m"A test file" kotest
5495$ cvs ci -m"First checkin; contains a keyword" kotest
5496@end example
5497
5498If a file accidentally gets added without @samp{-kb},
5499one can use the @code{cvs admin} command to recover.
5500For example:
5501
5502@example
5503$ echo '$@asis{}Id$' > kotest
5504$ cvs add -m"A test file" kotest
5505$ cvs ci -m"First checkin; contains a keyword" kotest
5506$ cvs admin -kb kotest
5507$ cvs update -A kotest
5508# @r{For non-unix systems:}
5509# @r{Copy in a good copy of the file from outside CVS}
5510$ cvs commit -m "make it binary" kotest
5511@end example
5512
5513@c Trying to describe this for both unix and non-unix
5514@c in the same description is very confusing.  Might
5515@c want to split the two, or just ditch the unix "shortcut"
5516@c (unixheads don't do much with binary files, anyway).
5517@c This used to say "(Try the above example, and do a
5518@c @code{cat kotest} after every command)".  But that
5519@c only really makes sense for the unix case.
5520When you check in the file @file{kotest} the file is
5521not preserved as a binary file, because you did not
5522check it in as a binary file.  The @code{cvs
5523admin -kb} command sets the default keyword
5524substitution method for this file, but it does not
5525alter the working copy of the file that you have.  If you need to
5526cope with line endings (that is, you are using
5527@sc{cvs} on a non-unix system), then you need to
5528check in a new copy of the file, as shown by the
5529@code{cvs commit} command above.
5530On unix, the @code{cvs update -A} command suffices.
5531@c FIXME: should also describe what the *other users*
5532@c need to do, if they have checked out copies which
5533@c have been corrupted by lack of -kb.  I think maybe
5534@c "cvs update -kb" or "cvs
5535@c update -A" would suffice, although the user who
5536@c reported this suggested removing the file, manually
5537@c removing it from CVS/Entries, and then "cvs update"
5538
5539However, in using @code{cvs admin -k} to change the
5540keyword expansion, be aware that the keyword expansion
5541mode is not version controlled.  This means that, for
5542example, that if you have a text file in old releases,
5543and a binary file with the same name in new releases,
5544@sc{cvs} provides no way to check out the file in text
5545or binary mode depending on what version you are
5546checking out.  There is no good workaround for this
5547problem.
5548
5549You can also set a default for whether @code{cvs add}
5550and @code{cvs import} treat a file as binary based on
5551its name; for example you could say that files who
5552names end in @samp{.exe} are binary.  @xref{Wrappers}.
5553There is currently no way to have @sc{cvs} detect
5554whether a file is binary based on its contents.  The
5555main difficulty with designing such a feature is that
5556it is not clear how to distinguish between binary and
5557non-binary files, and the rules to apply would vary
5558considerably with the operating system.
5559@c For example, it would be good on MS-DOS-family OSes
5560@c for anything containing ^Z to be binary.  Having
5561@c characters with the 8th bit set imply binary is almost
5562@c surely a bad idea in the context of ISO-8859-* and
5563@c other such character sets.  On VMS or the Mac, we
5564@c could use the OS's file typing.  This is a
5565@c commonly-desired feature, and something of this sort
5566@c may make sense.  But there are a lot of pitfalls here.
5567@c
5568@c Another, probably better, way to tell is to read the
5569@c file in text mode, write it to a temp file in text
5570@c mode, and then do a binary mode compare of the two
5571@c files.  If they differ, it is a binary file.  This
5572@c might have problems on VMS (or some other system
5573@c with several different text modes), but in general
5574@c should be relatively portable.  The only other
5575@c downside I can think of is that it would be fairly
5576@c slow, but that is perhaps a small price to pay for
5577@c not having your files corrupted.  Another issue is
5578@c what happens if you import a text file with bare
5579@c linefeeds on Windows.  Such files will show up on
5580@c Windows sometimes (I think some native windows
5581@c programs even write them, on occasion).  Perhaps it
5582@c is reasonable to treat such files as binary; after
5583@c all it is something of a presumption to assume that
5584@c the user would want the linefeeds converted to CRLF.
5585
5586@c ---------------------------------------------------------------------
5587@node Multiple developers
5588@chapter Multiple developers
5589@cindex Multiple developers
5590@cindex Team of developers
5591@cindex File locking
5592@cindex Locking files
5593@cindex Working copy
5594@cindex Reserved checkouts
5595@cindex Unreserved checkouts
5596@cindex RCS-style locking
5597
5598When more than one person works on a software project
5599things often get complicated.  Often, two people try to
5600edit the same file simultaneously.  One solution, known
5601as @dfn{file locking} or @dfn{reserved checkouts}, is
5602to allow only one person to edit each file at a time.
5603This is the only solution with some version control
5604systems, including @sc{rcs} and @sc{sccs}.  Currently
5605the usual way to get reserved checkouts with @sc{cvs}
5606is the @code{cvs admin -l} command (@pxref{admin
5607options}).  This is not as nicely integrated into
5608@sc{cvs} as the watch features, described below, but it
5609seems that most people with a need for reserved
5610checkouts find it adequate.
5611@c Or "find it better than worrying about implementing
5612@c nicely integrated reserved checkouts" or ...?
5613It also may be possible to use the watches
5614features described below, together with suitable
5615procedures (not enforced by software), to avoid having
5616two people edit at the same time.
5617
5618@c Our unreserved checkout model might not
5619@c be quite the same as others.  For example, I
5620@c think that some systems will tend to create a branch
5621@c in the case where CVS prints "up-to-date check failed".
5622@c It isn't clear to me whether we should try to
5623@c explore these subtleties; it could easily just
5624@c confuse people.
5625The default model with @sc{cvs} is known as
5626@dfn{unreserved checkouts}.  In this model, developers
5627can edit their own @dfn{working copy} of a file
5628simultaneously.  The first person that commits his
5629changes has no automatic way of knowing that another
5630has started to edit it.  Others will get an error
5631message when they try to commit the file.  They must
5632then use @sc{cvs} commands to bring their working copy
5633up to date with the repository revision.  This process
5634is almost automatic.
5635
5636@c FIXME? should probably use the word "watch" here, to
5637@c tie this into the text below and above.
5638@sc{cvs} also supports mechanisms which facilitate
5639various kinds of communication, without actually
5640enforcing rules like reserved checkouts do.
5641
5642The rest of this chapter describes how these various
5643models work, and some of the issues involved in
5644choosing between them.
5645
5646@ignore
5647Here is a draft reserved checkout design or discussion
5648of the issues.  This seems like as good a place as any
5649for this.
5650
5651Might want a cvs lock/cvs unlock--in which the names
5652differ from edit/unedit because the network must be up
5653for these to work.  unedit gives an error if there is a
5654reserved checkout in place (so that people don't
5655accidentally leave locks around); unlock gives an error
5656if one is not in place (this is more arguable; perhaps
5657it should act like unedit in that case).
5658
5659On the other hand, might want it so that emacs,
5660scripts, etc., can get ready to edit a file without
5661having to know which model is in use.  In that case we
5662would have a "cvs watch lock" (or .cvsrc?) (that is,
5663three settings, "on", "off", and "lock").  Having cvs
5664watch lock set would cause a get to record in the CVS
5665directory which model is in use, and cause "cvs edit"
5666to change behaviors.  We'd want a way to query which
5667setting is in effect (this would be handy even if it is
5668only "on" or "off" as presently).  If lock is in
5669effect, then commit would require a lock before
5670allowing a checkin; chmod wouldn't suffice (might be
5671debatable--see chmod comment below, in watches--but it
5672is the way people expect RCS to work and I can't think
5673of any significant downside.  On the other hand, maybe
5674it isn't worth bothering, because people who are used
5675to RCS wouldn't think to use chmod anyway).
5676
5677Implementation: use file attributes or use RCS
5678locking.  The former avoids more dependence on RCS
5679behaviors we will need to reimplement as we librarify
5680RCS, and makes it easier to import/export RCS files (in
5681that context, want to ignore the locker field).  But
5682note that RCS locks are per-branch, which is the
5683correct behavior (this is also an issue for the "watch
5684on" features; they should be per-branch too).
5685
5686Here are a few more random notes about implementation
5687details, assuming "cvs watch lock" and
5688
5689CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
5690Cases: (1) file is checked out (unreserved or with watch on) by old
5691version of @sc{cvs}, now we do something with new one, (2) file is checked
5692out by new version, now we do something with old one.
5693
5694Remote protocol would have a "Watched" analogous to "Mode".  Of course
5695it would apply to all Updated-like requests.  How do we keep this
5696setting up to date?  I guess that there wants to be a Watched request,
5697and the server would send a new one if it isn't up to date? (Ugh--hard
5698to implement and slows down "cvs -q update"--is there an easier way?)
5699
5700"cvs edit"--checks CVS/Watched, and if watch lock, then sends
5701"edit-lock" request.  Which comes back with a Checked-in with
5702appropriate Watched (off, on, lock, locked, or some such?), or error
5703message if already locked.
5704
5705"cvs commit"--only will commit if off/on/locked.  lock is not OK.
5706
5707Doc:
5708note that "cvs edit" must be connected to network if watch lock is in
5709effect.
5710
5711Talk about what to do if someone has locked a file and you want to
5712edit that file.  (breaking locks, or lack thereof).
5713
5714
5715One other idea (which could work along with the
5716existing "cvs admin -l" reserved checkouts, as well as
5717the above):
5718
5719"cvs editors" could show who has the file locked, if
5720someone does.
5721
5722@end ignore
5723
5724@menu
5725* File status::                 A file can be in several states
5726* Updating a file::             Bringing a file up-to-date
5727* Conflicts example::           An informative example
5728* Informing others::            To cooperate you must inform
5729* Concurrency::                 Simultaneous repository access
5730* Watches::                     Mechanisms to track who is editing files
5731* Choosing a model::            Reserved or unreserved checkouts?
5732@end menu
5733
5734@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5735@node File status
5736@section File status
5737@cindex File status
5738@cindex Status of a file
5739
5740@c Shouldn't this start with an example or something,
5741@c introducing the unreserved checkout model?  Before we
5742@c dive into listing states?
5743Based on what operations you have performed on a
5744checked out file, and what operations others have
5745performed to that file in the repository, one can
5746classify a file in a number of states.  The states, as
5747reported by the @code{status} command, are:
5748
5749@c The order of items is chosen to group logically
5750@c similar outputs together.
5751@c People who want alphabetical can use the index...
5752@table @asis
5753@cindex Up-to-date
5754@item Up-to-date
5755The file is identical with the latest revision in the
5756repository for the branch in use.
5757@c FIXME: should we clarify "in use"?  The answer is
5758@c sticky tags, and trying to distinguish branch sticky
5759@c tags from non-branch sticky tags seems rather awkward
5760@c here.
5761@c FIXME: What happens with non-branch sticky tags?  Is
5762@c a stuck file "Up-to-date" or "Needs checkout" or what?
5763
5764@item Locally Modified
5765@cindex Locally Modified
5766You have edited the file, and not yet committed your changes.
5767
5768@item Locally Added
5769@cindex Locally Added
5770You have added the file with @code{add}, and not yet
5771committed your changes.
5772@c There are many cases involving the file being
5773@c added/removed/modified in the working directory, and
5774@c added/removed/modified in the repository, which we
5775@c don't try to describe here.  I'm not sure that "cvs
5776@c status" produces a non-confusing output in most of
5777@c those cases.
5778
5779@item Locally Removed
5780@cindex Locally Removed
5781You have removed the file with @code{remove}, and not yet
5782committed your changes.
5783
5784@item Needs Checkout
5785@cindex Needs Checkout
5786Someone else has committed a newer revision to the
5787repository.  The name is slightly misleading; you will
5788ordinarily use @code{update} rather than
5789@code{checkout} to get that newer revision.
5790
5791@item Needs Patch
5792@cindex Needs Patch
5793@c See also newb-123j0 in sanity.sh (although that case
5794@c should probably be changed rather than documented).
5795Like Needs Checkout, but the @sc{cvs} server will send
5796a patch rather than the entire file.  Sending a patch or
5797sending an entire file accomplishes the same thing.
5798
5799@item Needs Merge
5800@cindex Needs Merge
5801Someone else has committed a newer revision to the repository, and you
5802have also made modifications to the file.
5803
5804@item File had conflicts on merge
5805@cindex File had conflicts on merge
5806@c is it worth saying that this message was "Unresolved
5807@c Conflict" in CVS 1.9 and earlier?  I'm inclined to
5808@c think that is unnecessarily confusing to new users.
5809This is like Locally Modified, except that a previous
5810@code{update} command gave a conflict.  If you have not
5811already done so, you need to
5812resolve the conflict as described in @ref{Conflicts example}.
5813
5814@item Unknown
5815@cindex Unknown
5816@sc{cvs} doesn't know anything about this file.  For
5817example, you have created a new file and have not run
5818@code{add}.
5819@c
5820@c "Entry Invalid" and "Classify Error" are also in the
5821@c status.c.  The latter definitely indicates a CVS bug
5822@c (should it be worded more like "internal error" so
5823@c people submit bug reports if they see it?).  The former
5824@c I'm not as sure; I haven't tracked down whether/when it
5825@c appears in "cvs status" output.
5826
5827@end table
5828
5829To help clarify the file status, @code{status} also
5830reports the @code{Working revision} which is the
5831revision that the file in the working directory derives
5832from, and the @code{Repository revision} which is the
5833latest revision in the repository for the branch in
5834use.
5835@c FIXME: should we clarify "in use"?  The answer is
5836@c sticky tags, and trying to distinguish branch sticky
5837@c tags from non-branch sticky tags seems rather awkward
5838@c here.
5839@c FIXME: What happens with non-branch sticky tags?
5840@c What is the Repository Revision there?  See the
5841@c comment at vn_rcs in cvs.h, which is kind of
5842@c confused--we really need to document better what this
5843@c field contains.
5844@c Q: Should we document "New file!" and other such
5845@c outputs or are they self-explanatory?
5846@c FIXME: what about the date to the right of "Working
5847@c revision"?  It doesn't appear with client/server and
5848@c seems unnecessary (redundant with "ls -l") so
5849@c perhaps it should be removed for non-client/server too?
5850@c FIXME: Need some examples.
5851@c FIXME: Working revision can also be something like
5852@c "-1.3" for a locally removed file.  Not at all
5853@c self-explanatory (and it is possible that CVS should
5854@c be changed rather than documenting this).
5855
5856@c Would be nice to have an @example showing output
5857@c from cvs status, with comments showing the xref
5858@c where each part of the output is described.  This
5859@c might fit in nicely if it is desirable to split this
5860@c node in two; one to introduce "cvs status" and one
5861@c to list each of the states.
5862The options to @code{status} are listed in
5863@ref{Invoking CVS}.  For information on its @code{Sticky tag}
5864and @code{Sticky date} output, see @ref{Sticky tags}.
5865For information on its @code{Sticky options} output,
5866see the @samp{-k} option in @ref{update options}.
5867
5868You can think of the @code{status} and @code{update}
5869commands as somewhat complementary.  You use
5870@code{update} to bring your files up to date, and you
5871can use @code{status} to give you some idea of what an
5872@code{update} would do (of course, the state of the
5873repository might change before you actually run
5874@code{update}).  In fact, if you want a command to
5875display file status in a more brief format than is
5876displayed by the @code{status} command, you can invoke
5877
5878@cindex update, to display file status
5879@example
5880$ cvs -n -q update
5881@end example
5882
5883The @samp{-n} option means to not actually do the
5884update, but merely to display statuses; the @samp{-q}
5885option avoids printing the name of each directory.  For
5886more information on the @code{update} command, and
5887these options, see @ref{Invoking CVS}.
5888
5889@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5890@node Updating a file
5891@section Bringing a file up to date
5892@cindex Bringing a file up to date
5893@cindex Updating a file
5894@cindex Merging a file
5895@cindex Update, introduction
5896
5897When you want to update or merge a file, use the @code{update}
5898command.  For files that are not up to date this is roughly equivalent
5899to a @code{checkout} command: the newest revision of the file is
5900extracted from the repository and put in your working directory.
5901
5902Your modifications to a file are never lost when you
5903use @code{update}.  If no newer revision exists,
5904running @code{update} has no effect.  If you have
5905edited the file, and a newer revision is available,
5906@sc{cvs} will merge all changes into your working copy.
5907
5908For instance, imagine that you checked out revision 1.4 and started
5909editing it.  In the meantime someone else committed revision 1.5, and
5910shortly after that revision 1.6.  If you run @code{update} on the file
5911now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
5912your file.
5913
5914@cindex Overlap
5915If any of the changes between 1.4 and 1.6 were made too
5916close to any of the changes you have made, an
5917@dfn{overlap} occurs.  In such cases a warning is
5918printed, and the resulting file includes both
5919versions of the lines that overlap, delimited by
5920special markers.
5921@xref{update}, for a complete description of the
5922@code{update} command.
5923
5924@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5925@node Conflicts example
5926@section Conflicts example
5927@cindex Merge, an example
5928@cindex Example of merge
5929@cindex driver.c (merge example)
5930
5931Suppose revision 1.4 of @file{driver.c} contains this:
5932
5933@example
5934#include <stdio.h>
5935
5936void main()
5937@{
5938    parse();
5939    if (nerr == 0)
5940        gencode();
5941    else
5942        fprintf(stderr, "No code generated.\n");
5943    exit(nerr == 0 ? 0 : 1);
5944@}
5945@end example
5946
5947@noindent
5948Revision 1.6 of @file{driver.c} contains this:
5949
5950@example
5951#include <stdio.h>
5952
5953int main(int argc,
5954         char **argv)
5955@{
5956    parse();
5957    if (argc != 1)
5958    @{
5959        fprintf(stderr, "tc: No args expected.\n");
5960        exit(1);
5961    @}
5962    if (nerr == 0)
5963        gencode();
5964    else
5965        fprintf(stderr, "No code generated.\n");
5966    exit(!!nerr);
5967@}
5968@end example
5969
5970@noindent
5971Your working copy of @file{driver.c}, based on revision
59721.4, contains this before you run @samp{cvs update}:
5973@c -- Really include "cvs"?
5974
5975@example
5976#include <stdlib.h>
5977#include <stdio.h>
5978
5979void main()
5980@{
5981    init_scanner();
5982    parse();
5983    if (nerr == 0)
5984        gencode();
5985    else
5986        fprintf(stderr, "No code generated.\n");
5987    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
5988@}
5989@end example
5990
5991@noindent
5992You run @samp{cvs update}:
5993@c -- Really include "cvs"?
5994
5995@example
5996$ cvs update driver.c
5997RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
5998retrieving revision 1.4
5999retrieving revision 1.6
6000Merging differences between 1.4 and 1.6 into driver.c
6001rcsmerge warning: overlaps during merge
6002cvs update: conflicts found in driver.c
6003C driver.c
6004@end example
6005
6006@noindent
6007@cindex Conflicts (merge example)
6008@sc{cvs} tells you that there were some conflicts.
6009Your original working file is saved unmodified in
6010@file{.#driver.c.1.4}.  The new version of
6011@file{driver.c} contains this:
6012
6013@example
6014#include <stdlib.h>
6015#include <stdio.h>
6016
6017int main(int argc,
6018         char **argv)
6019@{
6020    init_scanner();
6021    parse();
6022    if (argc != 1)
6023    @{
6024        fprintf(stderr, "tc: No args expected.\n");
6025        exit(1);
6026    @}
6027    if (nerr == 0)
6028        gencode();
6029    else
6030        fprintf(stderr, "No code generated.\n");
6031@asis{}<<<<<<< driver.c
6032    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6033@asis{}=======
6034    exit(!!nerr);
6035@asis{}>>>>>>> 1.6
6036@}
6037@end example
6038
6039@noindent
6040@cindex Markers, conflict
6041@cindex Conflict markers
6042@cindex <<<<<<<
6043@cindex >>>>>>>
6044@cindex =======
6045
6046Note how all non-overlapping modifications are incorporated in your working
6047copy, and that the overlapping section is clearly marked with
6048@samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6049
6050@cindex Resolving a conflict
6051@cindex Conflict resolution
6052You resolve the conflict by editing the file, removing the markers and
6053the erroneous line.  Suppose you end up with this file:
6054@c -- Add xref to the pcl-cvs manual when it talks
6055@c -- about this.
6056@example
6057#include <stdlib.h>
6058#include <stdio.h>
6059
6060int main(int argc,
6061         char **argv)
6062@{
6063    init_scanner();
6064    parse();
6065    if (argc != 1)
6066    @{
6067        fprintf(stderr, "tc: No args expected.\n");
6068        exit(1);
6069    @}
6070    if (nerr == 0)
6071        gencode();
6072    else
6073        fprintf(stderr, "No code generated.\n");
6074    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6075@}
6076@end example
6077
6078@noindent
6079You can now go ahead and commit this as revision 1.7.
6080
6081@example
6082$ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6083Checking in driver.c;
6084/usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6085new revision: 1.7; previous revision: 1.6
6086done
6087@end example
6088
6089For your protection, @sc{cvs} will refuse to check in a
6090file if a conflict occurred and you have not resolved
6091the conflict.  Currently to resolve a conflict, you
6092must change the timestamp on the file.  In previous
6093versions of @sc{cvs}, you also needed to
6094insure that the file contains no conflict markers.
6095Because
6096your file may legitimately contain conflict markers (that
6097is, occurrences of @samp{>>>>>>> } at the start of a
6098line that don't mark a conflict), the current
6099version of @sc{cvs} will print a warning and proceed to
6100check in the file.
6101@c The old behavior was really icky; the only way out
6102@c was to start hacking on
6103@c the @code{CVS/Entries} file or other such workarounds.
6104@c
6105@c If the timestamp thing isn't considered nice enough,
6106@c maybe there should be a "cvs resolved" command
6107@c which clears the conflict indication.  For a nice user
6108@c interface, this should be invoked by an interactive
6109@c merge tool like emerge rather than by the user
6110@c directly--such a tool can verify that the user has
6111@c really dealt with each conflict.
6112
6113@cindex emerge
6114If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6115Emacs front-end for @sc{cvs}) you can use an Emacs
6116package called emerge to help you resolve conflicts.
6117See the documentation for pcl-cvs.
6118
6119@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6120@node Informing others
6121@section Informing others about commits
6122@cindex Informing others
6123@cindex Spreading information
6124@cindex Mail, automatic mail on commit
6125
6126It is often useful to inform others when you commit a
6127new revision of a file.  The @samp{-i} option of the
6128@file{modules} file, or the @file{loginfo} file, can be
6129used to automate this process.  @xref{modules}.
6130@xref{loginfo}.  You can use these features of @sc{cvs}
6131to, for instance, instruct @sc{cvs} to mail a
6132message to all developers, or post a message to a local
6133newsgroup.
6134@c -- More text would be nice here.
6135
6136@node Concurrency
6137@section Several developers simultaneously attempting to run CVS
6138
6139@cindex Locks, cvs, introduction
6140@c For a discussion of *why* CVS creates locks, see
6141@c the comment at the start of src/lock.c
6142If several developers try to run @sc{cvs} at the same
6143time, one may get the following message:
6144
6145@example
6146[11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6147@end example
6148
6149@cindex #cvs.rfl, removing
6150@cindex #cvs.wfl, removing
6151@cindex #cvs.lock, removing
6152@sc{cvs} will try again every 30 seconds, and either
6153continue with the operation or print the message again,
6154if it still needs to wait.  If a lock seems to stick
6155around for an undue amount of time, find the person
6156holding the lock and ask them about the cvs command
6157they are running.  If they aren't running a cvs
6158command, look in the repository directory mentioned in
6159the message and remove files which they own whose names
6160start with @file{#cvs.rfl},
6161@file{#cvs.wfl}, or @file{#cvs.lock}.
6162
6163Note that these locks are to protect @sc{cvs}'s
6164internal data structures and have no relationship to
6165the word @dfn{lock} in the sense used by
6166@sc{rcs}---which refers to reserved checkouts
6167(@pxref{Multiple developers}).
6168
6169Any number of people can be reading from a given
6170repository at a time; only when someone is writing do
6171the locks prevent other people from reading or writing.
6172
6173@cindex Atomic transactions, lack of
6174@cindex Transactions, atomic, lack of
6175@c the following talks about what one might call commit/update
6176@c atomicity.
6177@c Probably also should say something about
6178@c commit/commit atomicity, that is, "An update will
6179@c not get partial versions of more than one commit".
6180@c CVS currently has this property and I guess we can
6181@c make it a documented feature.
6182@c For example one person commits
6183@c a/one.c and b/four.c and another commits a/two.c and
6184@c b/three.c.  Then an update cannot get the new a/one.c
6185@c and a/two.c and the old b/four.c and b/three.c.
6186One might hope for the following property
6187
6188@example
6189If someone commits some changes in one cvs command,
6190then an update by someone else will either get all the
6191changes, or none of them.
6192@end example
6193
6194but @sc{cvs} does @emph{not} have this property.  For
6195example, given the files
6196
6197@example
6198a/one.c
6199a/two.c
6200b/three.c
6201b/four.c
6202@end example
6203
6204if someone runs
6205
6206@example
6207cvs ci a/two.c b/three.c
6208@end example
6209
6210and someone else runs @code{cvs update} at the same
6211time, the person running @code{update} might get only
6212the change to @file{b/three.c} and not the change to
6213@file{a/two.c}.
6214
6215@node Watches
6216@section Mechanisms to track who is editing files
6217@cindex Watches
6218
6219For many groups, use of @sc{cvs} in its default mode is
6220perfectly satisfactory.  Users may sometimes go to
6221check in a modification only to find that another
6222modification has intervened, but they deal with it and
6223proceed with their check in.  Other groups prefer to be
6224able to know who is editing what files, so that if two
6225people try to edit the same file they can choose to
6226talk about who is doing what when rather than be
6227surprised at check in time.  The features in this
6228section allow such coordination, while retaining the
6229ability of two developers to edit the same file at the
6230same time.
6231
6232@c Some people might ask why CVS does not enforce the
6233@c rule on chmod, by requiring a cvs edit before a cvs
6234@c commit.  The main reason is that it could always be
6235@c circumvented--one could edit the file, and
6236@c then when ready to check it in, do the cvs edit and put
6237@c in the new contents and do the cvs commit.  One
6238@c implementation note: if we _do_ want to have cvs commit
6239@c require a cvs edit, we should store the state on
6240@c whether the cvs edit has occurred in the working
6241@c directory, rather than having the server try to keep
6242@c track of what working directories exist.
6243@c FIXME: should the above discussion be part of the
6244@c manual proper, somewhere, not just in a comment?
6245For maximum benefit developers should use @code{cvs
6246edit} (not @code{chmod}) to make files read-write to
6247edit them, and @code{cvs release} (not @code{rm}) to
6248discard a working directory which is no longer in use,
6249but @sc{cvs} is not able to enforce this behavior.
6250
6251@c I'm a little dissatisfied with this presentation,
6252@c because "watch on"/"edit"/"editors" are one set of
6253@c functionality, and "watch add"/"watchers" is another
6254@c which is somewhat orthogonal even though they interact in
6255@c various ways.  But I think it might be
6256@c confusing to describe them separately (e.g. "watch
6257@c add" with loginfo).  I don't know.
6258
6259@menu
6260* Setting a watch::             Telling CVS to watch certain files
6261* Getting Notified::            Telling CVS to notify you
6262* Editing files::               How to edit a file which is being watched
6263* Watch information::           Information about who is watching and editing
6264* Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6265@end menu
6266
6267@node Setting a watch
6268@subsection Telling CVS to watch certain files
6269
6270To enable the watch features, you first specify that
6271certain files are to be watched.
6272
6273@cindex watch on (subcommand)
6274@deffn Command {cvs watch on} [@code{-lR}] files @dots{}
6275
6276@cindex Read-only files, and watches
6277Specify that developers should run @code{cvs edit}
6278before editing @var{files}.  @sc{cvs} will create working
6279copies of @var{files} read-only, to remind developers
6280to run the @code{cvs edit} command before working on
6281them.
6282
6283If @var{files} includes the name of a directory, @sc{cvs}
6284arranges to watch all files added to the corresponding
6285repository directory, and sets a default for files
6286added in the future; this allows the user to set
6287notification policies on a per-directory basis.  The
6288contents of the directory are processed recursively,
6289unless the @code{-l} option is given.
6290The @code{-R} option can be used to force recursion if the @code{-l}
6291option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6292
6293If @var{files} is omitted, it defaults to the current directory.
6294
6295@cindex watch off (subcommand)
6296@end deffn
6297
6298@deffn Command {cvs watch off} [@code{-lR}] files @dots{}
6299
6300Do not create @var{files} read-only on checkout; thus,
6301developers will not be reminded to use @code{cvs edit}
6302and @code{cvs unedit}.
6303@ignore
6304@sc{cvs} will check out @var{files}
6305read-write as usual, unless other permissions override
6306due to the @code{PreservePermissions} option being
6307enabled in the @file{config} administrative file
6308(@pxref{Special Files}, @pxref{config})
6309@end ignore
6310
6311The @var{files} and options are processed as for @code{cvs
6312watch on}.
6313
6314@end deffn
6315
6316@node Getting Notified
6317@subsection Telling CVS to notify you
6318
6319You can tell @sc{cvs} that you want to receive
6320notifications about various actions taken on a file.
6321You can do this without using @code{cvs watch on} for
6322the file, but generally you will want to use @code{cvs
6323watch on}, so that developers use the @code{cvs edit}
6324command.
6325
6326@cindex watch add (subcommand)
6327@deffn Command {cvs watch add} [@code{-a} action] [@code{-lR}] files @dots{}
6328
6329Add the current user to the list of people to receive notification of
6330work done on @var{files}.
6331
6332The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6333the user about.  @var{action} is one of the following:
6334
6335@table @code
6336
6337@item edit
6338Another user has applied the @code{cvs edit} command (described
6339below) to a file.
6340
6341@item unedit
6342Another user has applied the @code{cvs unedit} command (described
6343below) or the @code{cvs release} command to a file, or has deleted
6344the file and allowed @code{cvs update} to recreate it.
6345
6346@item commit
6347Another user has committed changes to a file.
6348
6349@item all
6350All of the above.
6351
6352@item none
6353None of the above.  (This is useful with @code{cvs edit},
6354described below.)
6355
6356@end table
6357
6358The @code{-a} option may appear more than once, or not at all.  If
6359omitted, the action defaults to @code{all}.
6360
6361The @var{files} and options are processed as for the
6362@code{cvs watch} commands.
6363
6364@end deffn
6365
6366
6367@cindex watch remove (subcommand)
6368@deffn Command {cvs watch remove} [@code{-a} action] [@code{-lR}] files @dots{}
6369
6370Remove a notification request established using @code{cvs watch add};
6371the arguments are the same.  If the @code{-a} option is present, only
6372watches for the specified actions are removed.
6373
6374@end deffn
6375
6376@cindex notify (admin file)
6377When the conditions exist for notification, @sc{cvs}
6378calls the @file{notify} administrative file.  Edit
6379@file{notify} as one edits the other administrative
6380files (@pxref{Intro administrative files}).  This
6381file follows the usual conventions for administrative
6382files (@pxref{syntax}), where each line is a regular
6383expression followed by a command to execute.  The
6384command should contain a single occurrence of @samp{%s}
6385which will be replaced by the user to notify; the rest
6386of the information regarding the notification will be
6387supplied to the command on standard input.  The
6388standard thing to put in the @code{notify} file is the
6389single line:
6390
6391@example
6392ALL mail %s -s "CVS notification"
6393@end example
6394
6395This causes users to be notified by electronic mail.
6396@c FIXME: should it be this hard to set up this
6397@c behavior (and the result when one fails to do so,
6398@c silent failure to notify, so non-obvious)?  Should
6399@c CVS give a warning if no line in notify matches (and
6400@c document the use of "DEFAULT :" for the case where
6401@c skipping the notification is indeed desired)?
6402
6403@cindex users (admin file)
6404Note that if you set this up in the straightforward
6405way, users receive notifications on the server machine.
6406One could of course write a @file{notify} script which
6407directed notifications elsewhere, but to make this
6408easy, @sc{cvs} allows you to associate a notification
6409address for each user.  To do so create a file
6410@file{users} in @file{CVSROOT} with a line for each
6411user in the format @var{user}:@var{value}.  Then
6412instead of passing the name of the user to be notified
6413to @file{notify}, @sc{cvs} will pass the @var{value}
6414(normally an email address on some other machine).
6415
6416@sc{cvs} does not notify you for your own changes.
6417Currently this check is done based on whether the user
6418name of the person taking the action which triggers
6419notification matches the user name of the person
6420getting notification.  In fact, in general, the watches
6421features only track one edit by each user.  It probably
6422would be more useful if watches tracked each working
6423directory separately, so this behavior might be worth
6424changing.
6425@c "behavior might be worth changing" is an effort to
6426@c point to future directions while also not promising
6427@c that "they" (as in "why don't they fix CVS to....")
6428@c will do this.
6429@c one implementation issue is identifying whether a
6430@c working directory is same or different.  Comparing
6431@c pathnames/hostnames is hopeless, but having the server
6432@c supply a serial number which the client stores in the
6433@c CVS directory as a magic cookie should work.
6434
6435@node Editing files
6436@subsection How to edit a file which is being watched
6437
6438@cindex Checkout, as term for getting ready to edit
6439Since a file which is being watched is checked out
6440read-only, you cannot simply edit it.  To make it
6441read-write, and inform others that you are planning to
6442edit it, use the @code{cvs edit} command.  Some systems
6443call this a @dfn{checkout}, but @sc{cvs} uses that term
6444for obtaining a copy of the sources (@pxref{Getting the
6445source}), an operation which those systems call a
6446@dfn{get} or a @dfn{fetch}.
6447@c Issue to think about: should we transition CVS
6448@c towards the "get" terminology?  "cvs get" is already a
6449@c synonym for "cvs checkout" and that section of the
6450@c manual refers to "Getting the source".  If this is
6451@c done, needs to be done gingerly (for example, we should
6452@c still accept "checkout" in .cvsrc files indefinitely
6453@c even if the CVS's messages are changed from "cvs checkout: "
6454@c to "cvs get: ").
6455@c There is a concern about whether "get" is not as
6456@c good for novices because it is a more general term
6457@c than "checkout" (and thus arguably harder to assign
6458@c a technical meaning for).
6459
6460@cindex edit (subcommand)
6461@deffn Command {cvs edit} [options] files @dots{}
6462
6463Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6464@var{files} read-write, and notifies users who have requested
6465@code{edit} notification for any of @var{files}.
6466
6467The @code{cvs edit} command accepts the same @var{options} as the
6468@code{cvs watch add} command, and establishes a temporary watch for the
6469user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6470@code{unedit}ed or @code{commit}ted.  If the user does not wish to
6471receive notifications, she should specify @code{-a none}.
6472
6473The @var{files} and options are processed as for the @code{cvs
6474watch} commands.
6475
6476@ignore
6477@strong{Caution:} If the @code{PreservePermissions}
6478option is enabled in the repository (@pxref{config}),
6479@sc{cvs} will not change the permissions on any of the
6480@var{files}.  The reason for this change is to ensure
6481that using @samp{cvs edit} does not interfere with the
6482ability to store file permissions in the @sc{cvs}
6483repository.
6484@end ignore
6485
6486@end deffn
6487
6488Normally when you are done with a set of changes, you
6489use the @code{cvs commit} command, which checks in your
6490changes and returns the watched files to their usual
6491read-only state.  But if you instead decide to abandon
6492your changes, or not to make any changes, you can use
6493the @code{cvs unedit} command.
6494
6495@cindex unedit (subcommand)
6496@cindex Abandoning work
6497@cindex Reverting to repository version
6498@deffn Command {cvs unedit} [@code{-lR}] files @dots{}
6499
6500Abandon work on the working files @var{files}, and revert them to the
6501repository versions on which they are based.  @sc{cvs} makes those
6502@var{files} read-only for which users have requested notification using
6503@code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6504notification for any of @var{files}.
6505
6506The @var{files} and options are processed as for the
6507@code{cvs watch} commands.
6508
6509If watches are not in use, the @code{unedit} command
6510probably does not work, and the way to revert to the
6511repository version is to remove the file and then use
6512@code{cvs update} to get a new copy.  The meaning is
6513not precisely the same; removing and updating may also
6514bring in some changes which have been made in the
6515repository since the last time you updated.
6516@c It would be a useful enhancement to CVS to make
6517@c unedit work in the non-watch case as well.
6518@end deffn
6519
6520When using client/server @sc{cvs}, you can use the
6521@code{cvs edit} and @code{cvs unedit} commands even if
6522@sc{cvs} is unable to successfully communicate with the
6523server; the notifications will be sent upon the next
6524successful @sc{cvs} command.
6525
6526@node Watch information
6527@subsection Information about who is watching and editing
6528
6529@cindex watchers (subcommand)
6530@deffn Command {cvs watchers} [@code{-lR}] files @dots{}
6531
6532List the users currently watching changes to @var{files}.  The report
6533includes the files being watched, and the mail address of each watcher.
6534
6535The @var{files} and options are processed as for the
6536@code{cvs watch} commands.
6537
6538@end deffn
6539
6540
6541@cindex editors (subcommand)
6542@deffn Command {cvs editors} [@code{-lR}] files @dots{}
6543
6544List the users currently working on @var{files}.  The report
6545includes the mail address of each user, the time when the user began
6546working with the file, and the host and path of the working directory
6547containing the file.
6548
6549The @var{files} and options are processed as for the
6550@code{cvs watch} commands.
6551
6552@end deffn
6553
6554@node Watches Compatibility
6555@subsection Using watches with old versions of CVS
6556
6557@cindex CVS 1.6, and watches
6558If you use the watch features on a repository, it
6559creates @file{CVS} directories in the repository and
6560stores the information about watches in that directory.
6561If you attempt to use @sc{cvs} 1.6 or earlier with the
6562repository, you get an error message such as the
6563following (all on one line):
6564
6565@example
6566cvs update: cannot open CVS/Entries for reading:
6567No such file or directory
6568@end example
6569
6570and your operation will likely be aborted.  To use the
6571watch features, you must upgrade all copies of @sc{cvs}
6572which use that repository in local or server mode.  If
6573you cannot upgrade, use the @code{watch off} and
6574@code{watch remove} commands to remove all watches, and
6575that will restore the repository to a state which
6576@sc{cvs} 1.6 can cope with.
6577
6578@node Choosing a model
6579@section Choosing between reserved or unreserved checkouts
6580@cindex Choosing, reserved or unreserved checkouts
6581
6582Reserved and unreserved checkouts each have pros and
6583cons.  Let it be said that a lot of this is a matter of
6584opinion or what works given different groups' working
6585styles, but here is a brief description of some of the
6586issues.  There are many ways to organize a team of
6587developers.  @sc{cvs} does not try to enforce a certain
6588organization.  It is a tool that can be used in several
6589ways.
6590
6591Reserved checkouts can be very counter-productive.  If
6592two persons want to edit different parts of a file,
6593there may be no reason to prevent either of them from
6594doing so.  Also, it is common for someone to take out a
6595lock on a file, because they are planning to edit it,
6596but then forget to release the lock.
6597
6598@c "many groups"?  specifics?  cites to papers on this?
6599@c some way to weasel-word it a bit more so we don't
6600@c need facts :-)?
6601People, especially people who are familiar with
6602reserved checkouts, often wonder how often conflicts
6603occur if unreserved checkouts are used, and how
6604difficult they are to resolve.  The experience with
6605many groups is that they occur rarely and usually are
6606relatively straightforward to resolve.
6607
6608The rarity of serious conflicts may be surprising, until one realizes
6609that they occur only when two developers disagree on the proper design
6610for a given section of code; such a disagreement suggests that the
6611team has not been communicating properly in the first place.  In order
6612to collaborate under @emph{any} source management regimen, developers
6613must agree on the general design of the system; given this agreement,
6614overlapping changes are usually straightforward to merge.
6615
6616In some cases unreserved checkouts are clearly
6617inappropriate.  If no merge tool exists for the kind of
6618file you are managing (for example word processor files
6619or files edited by Computer Aided Design programs), and
6620it is not desirable to change to a program which uses a
6621mergeable data format, then resolving conflicts is
6622going to be unpleasant enough that you generally will
6623be better off to simply avoid the conflicts instead, by
6624using reserved checkouts.
6625
6626The watches features described above in @ref{Watches}
6627can be considered to be an intermediate model between
6628reserved checkouts and unreserved checkouts.  When you
6629go to edit a file, it is possible to find out who else
6630is editing it.  And rather than having the system
6631simply forbid both people editing the file, it can tell
6632you what the situation is and let you figure out
6633whether it is a problem in that particular case or not.
6634Therefore, for some groups it can be considered the
6635best of both the reserved checkout and unreserved
6636checkout worlds.
6637
6638@c ---------------------------------------------------------------------
6639@node Revision management
6640@chapter Revision management
6641@cindex Revision management
6642
6643@c -- This chapter could be expanded a lot.
6644@c -- Experiences are very welcome!
6645
6646If you have read this far, you probably have a pretty
6647good grasp on what @sc{cvs} can do for you.  This
6648chapter talks a little about things that you still have
6649to decide.
6650
6651If you are doing development on your own using @sc{cvs}
6652you could probably skip this chapter.  The questions
6653this chapter takes up become more important when more
6654than one person is working in a repository.
6655
6656@menu
6657* When to commit::              Some discussion on the subject
6658@end menu
6659
6660@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6661@node When to commit
6662@section When to commit?
6663@cindex When to commit
6664@cindex Commit, when to
6665@cindex Policy
6666
6667Your group should decide which policy to use regarding
6668commits.  Several policies are possible, and as your
6669experience with @sc{cvs} grows you will probably find
6670out what works for you.
6671
6672If you commit files too quickly you might commit files
6673that do not even compile.  If your partner updates his
6674working sources to include your buggy file, he will be
6675unable to compile the code.  On the other hand, other
6676persons will not be able to benefit from the
6677improvements you make to the code if you commit very
6678seldom, and conflicts will probably be more common.
6679
6680It is common to only commit files after making sure
6681that they can be compiled.  Some sites require that the
6682files pass a test suite.  Policies like this can be
6683enforced using the commitinfo file
6684(@pxref{commitinfo}), but you should think twice before
6685you enforce such a convention.  By making the
6686development environment too controlled it might become
6687too regimented and thus counter-productive to the real
6688goal, which is to get software written.
6689
6690@c ---------------------------------------------------------------------
6691@node Keyword substitution
6692@chapter Keyword substitution
6693@cindex Keyword substitution
6694@cindex Keyword expansion
6695@cindex Identifying files
6696
6697@comment   Be careful when editing this chapter.
6698@comment   Remember that this file is kept under
6699@comment   version control, so we must not accidentally
6700@comment   include a valid keyword in the running text.
6701
6702As long as you edit source files inside a working
6703directory you can always find out the state of
6704your files via @samp{cvs status} and @samp{cvs log}.
6705But as soon as you export the files from your
6706development environment it becomes harder to identify
6707which revisions they are.
6708
6709@sc{cvs} can use a mechanism known as @dfn{keyword
6710substitution} (or @dfn{keyword expansion}) to help
6711identifying the files.  Embedded strings of the form
6712@code{$@var{keyword}$} and
6713@code{$@var{keyword}:@dots{}$} in a file are replaced
6714with strings of the form
6715@code{$@var{keyword}:@var{value}$} whenever you obtain
6716a new revision of the file.
6717
6718@menu
6719* Keyword list::                Keywords
6720* Using keywords::              Using keywords
6721* Avoiding substitution::       Avoiding substitution
6722* Substitution modes::          Substitution modes
6723* Log keyword::                 Problems with the $@asis{}Log$ keyword.
6724@end menu
6725
6726@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6727@node Keyword list
6728@section Keyword List
6729@cindex Keyword List
6730
6731@c FIXME: need some kind of example here I think,
6732@c perhaps in a
6733@c "Keyword intro" node.  The intro in the "Keyword
6734@c substitution" node itself seems OK, but to launch
6735@c into a list of the keywords somehow seems too abrupt.
6736
6737This is a list of the keywords:
6738
6739@table @code
6740@cindex Author keyword
6741@item $@asis{Author}$
6742The login name of the user who checked in the revision.
6743
6744@cindex Date keyword
6745@item $@asis{Date}$
6746The date and time (UTC) the revision was checked in.
6747
6748@cindex Header keyword
6749@item $@asis{Header}$
6750A standard header containing the full pathname of the
6751@sc{rcs} file, the revision number, the date (UTC), the
6752author, the state, and the locker (if locked).  Files
6753will normally never be locked when you use @sc{cvs}.
6754
6755@cindex Id keyword
6756@item $@asis{Id}$
6757Same as @code{$@asis{Header}$}, except that the @sc{rcs}
6758filename is without a path.
6759
6760@cindex Name keyword
6761@item $@asis{Name}$
6762Tag name used to check out this file.  The keyword is
6763expanded only if one checks out with an explicit tag
6764name.  For example, when running the command @code{cvs
6765co -r first}, the keyword expands to @samp{Name: first}.
6766
6767@cindex Locker keyword
6768@item $@asis{Locker}$
6769The login name of the user who locked the revision
6770(empty if not locked, which is the normal case unless
6771@code{cvs admin -l} is in use).
6772
6773@cindex Log keyword
6774@item $@asis{Log}$
6775The log message supplied during commit, preceded by a
6776header containing the @sc{rcs} filename, the revision
6777number, the author, and the date (UTC).  Existing log
6778messages are @emph{not} replaced.  Instead, the new log
6779message is inserted after @code{$@asis{Log:@dots{}}$}.
6780Each new line is prefixed with the same string which
6781precedes the @code{$Log} keyword.  For example, if the
6782file contains
6783
6784@example
6785  /* Here is what people have been up to:
6786   *
6787   * $@asis{}Log: frob.c,v $
6788   * Revision 1.1  1997/01/03 14:23:51  joe
6789   * Add the superfrobnicate option
6790   *
6791   */
6792@end example
6793
6794@noindent
6795then additional lines which are added when expanding
6796the @code{$Log} keyword will be preceded by @samp{   * }.
6797Unlike previous versions of @sc{cvs} and @sc{rcs}, the
6798@dfn{comment leader} from the @sc{rcs} file is not used.
6799The @code{$Log} keyword is useful for
6800accumulating a complete change log in a source file,
6801but for several reasons it can be problematic.
6802@xref{Log keyword}.
6803
6804@cindex RCSfile keyword
6805@item $@asis{RCSfile}$
6806The name of the RCS file without a path.
6807
6808@cindex Revision keyword
6809@item $@asis{Revision}$
6810The revision number assigned to the revision.
6811
6812@cindex Source keyword
6813@item $@asis{Source}$
6814The full pathname of the RCS file.
6815
6816@cindex State keyword
6817@item $@asis{State}$
6818The state assigned to the revision.  States can be
6819assigned with @code{cvs admin -s}---see @ref{admin options}.
6820
6821@end table
6822
6823@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6824@node Using keywords
6825@section Using keywords
6826
6827To include a keyword string you simply include the
6828relevant text string, such as @code{$@asis{Id}$}, inside the
6829file, and commit the file.  @sc{cvs} will automatically
6830expand the string as part of the commit operation.
6831
6832It is common to embed the @code{$@asis{}Id$} string in
6833the source files so that it gets passed through to
6834generated files.  For example, if you are managing
6835computer program source code, you might include a
6836variable which is initialized to contain that string.
6837Or some C compilers may provide a @code{#pragma ident}
6838directive.  Or a document management system might
6839provide a way to pass a string through to generated
6840files.
6841
6842@c Would be nice to give an example, but doing this in
6843@c portable C is not possible and the problem with
6844@c picking any one language (VMS HELP files, Ada,
6845@c troff, whatever) is that people use CVS for all
6846@c kinds of files.
6847
6848@cindex Ident (shell command)
6849The @code{ident} command (which is part of the @sc{rcs}
6850package) can be used to extract keywords and their
6851values from a file.  This can be handy for text files,
6852but it is even more useful for extracting keywords from
6853binary files.
6854
6855@example
6856$ ident samp.c
6857samp.c:
6858     $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6859$ gcc samp.c
6860$ ident a.out
6861a.out:
6862     $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6863@end example
6864
6865@cindex What (shell command)
6866S@sc{ccs} is another popular revision control system.
6867It has a command, @code{what}, which is very similar to
6868@code{ident} and used for the same purpose.  Many sites
6869without @sc{rcs} have @sc{sccs}.  Since @code{what}
6870looks for the character sequence @code{@@(#)} it is
6871easy to include keywords that are detected by either
6872command.  Simply prefix the keyword with the
6873magic @sc{sccs} phrase, like this:
6874
6875@example
6876static char *id="@@(#) $@asis{}Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
6877@end example
6878
6879@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6880@node Avoiding substitution
6881@section Avoiding substitution
6882
6883Keyword substitution has its disadvantages.  Sometimes
6884you might want the literal text string
6885@samp{$@asis{}Author$} to appear inside a file without
6886@sc{cvs} interpreting it as a keyword and expanding it
6887into something like @samp{$@asis{}Author: ceder $}.
6888
6889There is unfortunately no way to selectively turn off
6890keyword substitution.  You can use @samp{-ko}
6891(@pxref{Substitution modes}) to turn off keyword
6892substitution entirely.
6893
6894In many cases you can avoid using keywords in
6895the source, even though they appear in the final
6896product.  For example, the source for this manual
6897contains @samp{$@@asis@{@}Author$} whenever the text
6898@samp{$@asis{}Author$} should appear.  In @code{nroff}
6899and @code{troff} you can embed the null-character
6900@code{\&} inside the keyword for a similar effect.
6901
6902@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6903@node Substitution modes
6904@section Substitution modes
6905@cindex Keyword substitution, changing modes
6906@cindex -k (keyword substitution)
6907@cindex Kflag
6908
6909@c FIXME: This could be made more coherent, by expanding it
6910@c with more examples or something.
6911Each file has a stored default substitution mode, and
6912each working directory copy of a file also has a
6913substitution mode.  The former is set by the @samp{-k}
6914option to @code{cvs add} and @code{cvs admin}; the
6915latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
6916checkout} or @code{cvs update}.  @code{cvs diff} also
6917has a @samp{-k} option.  For some examples,
6918see @ref{Binary files}, and @ref{Merging and keywords}.
6919@c The fact that -A is overloaded to mean both reset
6920@c sticky options and reset sticky tags/dates is
6921@c somewhat questionable.  Perhaps there should be
6922@c separate options to reset sticky options (e.g. -k
6923@c A") and tags/dates (someone suggested -r HEAD could
6924@c do this instead of setting a sticky tag of "HEAD"
6925@c as in the status quo but I haven't thought much
6926@c about that idea.  Of course -r .reset or something
6927@c could be coined if this needs to be a new option).
6928@c On the other hand, having -A mean "get things back
6929@c into the state after a fresh checkout" has a certain
6930@c appeal, and maybe there is no sufficient reason for
6931@c creeping featurism in this area.
6932
6933The modes available are:
6934
6935@table @samp
6936@item -kkv
6937Generate keyword strings using the default form, e.g.
6938@code{$@asis{}Revision: 5.7 $} for the @code{Revision}
6939keyword.
6940
6941@item -kkvl
6942Like @samp{-kkv}, except that a locker's name is always
6943inserted if the given revision is currently locked.
6944The locker's name is only relevant if @code{cvs admin
6945-l} is in use.
6946
6947@item -kk
6948Generate only keyword names in keyword strings; omit
6949their values.  For example, for the @code{Revision}
6950keyword, generate the string @code{$@asis{}Revision$}
6951instead of @code{$@asis{}Revision: 5.7 $}.  This option
6952is useful to ignore differences due to keyword
6953substitution when comparing different revisions of a
6954file (@pxref{Merging and keywords}).
6955
6956@item -ko
6957Generate the old keyword string, present in the working
6958file just before it was checked in.  For example, for
6959the @code{Revision} keyword, generate the string
6960@code{$@asis{}Revision: 1.1 $} instead of
6961@code{$@asis{}Revision: 5.7 $} if that is how the
6962string appeared when the file was checked in.
6963
6964@item -kb
6965Like @samp{-ko}, but also inhibit conversion of line
6966endings between the canonical form in which they are
6967stored in the repository (linefeed only), and the form
6968appropriate to the operating system in use on the
6969client.  For systems, like unix, which use linefeed
6970only to terminate lines, this is the same as
6971@samp{-ko}.  For more information on binary files, see
6972@ref{Binary files}.
6973
6974@item -kv
6975Generate only keyword values for keyword strings.  For
6976example, for the @code{Revision} keyword, generate the string
6977@code{5.7} instead of @code{$@asis{}Revision: 5.7 $}.
6978This can help generate files in programming languages
6979where it is hard to strip keyword delimiters like
6980@code{$@asis{}Revision: $} from a string.  However,
6981further keyword substitution cannot be performed once
6982the keyword names are removed, so this option should be
6983used with care.
6984
6985One often would like to use @samp{-kv} with @code{cvs
6986export}---@pxref{export}.  But be aware that doesn't
6987handle an export containing binary files correctly.
6988
6989@end table
6990
6991@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6992@node Log keyword
6993@section Problems with the $@asis{}Log$ keyword.
6994
6995The @code{$@asis{}Log$} keyword is somewhat
6996controversial.  As long as you are working on your
6997development system the information is easily accessible
6998even if you do not use the @code{$@asis{}Log$}
6999keyword---just do a @code{cvs log}.  Once you export
7000the file the history information might be useless
7001anyhow.
7002
7003A more serious concern is that @sc{cvs} is not good at
7004handling @code{$@asis{}Log$} entries when a branch is
7005merged onto the main trunk.  Conflicts often result
7006from the merging operation.
7007@c Might want to check whether the CVS implementation
7008@c of RCS_merge has this problem the same way rcsmerge
7009@c does.  I would assume so....
7010
7011People also tend to "fix" the log entries in the file
7012(correcting spelling mistakes and maybe even factual
7013errors).  If that is done the information from
7014@code{cvs log} will not be consistent with the
7015information inside the file.  This may or may not be a
7016problem in real life.
7017
7018It has been suggested that the @code{$@asis{}Log$}
7019keyword should be inserted @emph{last} in the file, and
7020not in the files header, if it is to be used at all.
7021That way the long list of change messages will not
7022interfere with everyday source file browsing.
7023
7024@c ---------------------------------------------------------------------
7025@node Tracking sources
7026@chapter Tracking third-party sources
7027@cindex Third-party sources
7028@cindex Tracking sources
7029
7030@c FIXME: Need discussion of added and removed files.
7031@c FIXME: This doesn't really adequately introduce the
7032@c concepts of "vendor" and "you".  They don't *have*
7033@c to be separate organizations or separate people.
7034@c We want a description which is somewhat more based on
7035@c the technical issues of which sources go where, but
7036@c also with enough examples of how this relates to
7037@c relationships like customer-supplier, developer-QA,
7038@c maintainer-contributor, or whatever, to make it
7039@c seem concrete.
7040If you modify a program to better fit your site, you
7041probably want to include your modifications when the next
7042release of the program arrives.  @sc{cvs} can help you with
7043this task.
7044
7045@cindex Vendor
7046@cindex Vendor branch
7047@cindex Branch, vendor-
7048In the terminology used in @sc{cvs}, the supplier of the
7049program is called a @dfn{vendor}.  The unmodified
7050distribution from the vendor is checked in on its own
7051branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
70521.1.1 for this use.
7053
7054When you modify the source and commit it, your revision
7055will end up on the main trunk.  When a new release is
7056made by the vendor, you commit it on the vendor branch
7057and copy the modifications onto the main trunk.
7058
7059Use the @code{import} command to create and update
7060the vendor branch.  When you import a new file,
7061the vendor branch is made the `head' revision, so
7062anyone that checks out a copy of the file gets that
7063revision.  When a local modification is committed it is
7064placed on the main trunk, and made the `head'
7065revision.
7066
7067@menu
7068* First import::                Importing for the first time
7069* Update imports::              Updating with the import command
7070* Reverting local changes::     Reverting to the latest vendor release
7071* Binary files in imports::     Binary files require special handling
7072* Keywords in imports::         Keyword substitution might be undesirable
7073* Multiple vendor branches::    What if you get sources from several places?
7074@end menu
7075
7076@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7077@node First import
7078@section Importing for the first time
7079@cindex Importing modules
7080
7081@c Should mention naming conventions for vendor tags,
7082@c release tags, and perhaps directory names.
7083Use the @code{import} command to check in the sources
7084for the first time.  When you use the @code{import}
7085command to track third-party sources, the @dfn{vendor
7086tag} and @dfn{release tags} are useful.  The
7087@dfn{vendor tag} is a symbolic name for the branch
7088(which is always 1.1.1, unless you use the @samp{-b
7089@var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7090@dfn{release tags} are symbolic names for a particular
7091release, such as @samp{FSF_0_04}.
7092
7093@c I'm not completely sure this belongs here.  But
7094@c we need to say it _somewhere_ reasonably obvious; it
7095@c is a common misconception among people first learning CVS
7096Note that @code{import} does @emph{not} change the
7097directory in which you invoke it.  In particular, it
7098does not set up that directory as a @sc{cvs} working
7099directory; if you want to work with the sources import
7100them first and then check them out into a different
7101directory (@pxref{Getting the source}).
7102
7103@cindex wdiff (import example)
7104Suppose you have the sources to a program called
7105@code{wdiff} in a directory @file{wdiff-0.04},
7106and are going to make private modifications that you
7107want to be able to use even when new releases are made
7108in the future.  You start by importing the source to
7109your repository:
7110
7111@example
7112$ cd wdiff-0.04
7113$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7114@end example
7115
7116The vendor tag is named @samp{FSF_DIST} in the above
7117example, and the only release tag assigned is
7118@samp{WDIFF_0_04}.
7119@c FIXME: Need to say where fsf/wdiff comes from.
7120
7121@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7122@node Update imports
7123@section Updating with the import command
7124
7125When a new release of the source arrives, you import it into the
7126repository with the same @code{import} command that you used to set up
7127the repository in the first place.  The only difference is that you
7128specify a different release tag this time.
7129
7130@example
7131$ tar xfz wdiff-0.05.tar.gz
7132$ cd wdiff-0.05
7133$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7134@end example
7135
7136For files that have not been modified locally, the newly created
7137revision becomes the head revision.  If you have made local
7138changes, @code{import} will warn you that you must merge the changes
7139into the main trunk, and tell you to use @samp{checkout -j} to do so.
7140
7141@c FIXME: why "wdiff" here and "fsf/wdiff" in the
7142@c "import"?  I think the assumption is that one has
7143@c "wdiff fsf/wdiff" or some such in modules, but it
7144@c would be better to not use modules in this example.
7145@example
7146$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7147@end example
7148
7149@noindent
7150The above command will check out the latest revision of
7151@samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7152since yesterday into the working copy.  If any conflicts arise during
7153the merge they should be resolved in the normal way (@pxref{Conflicts
7154example}).  Then, the modified files may be committed.
7155
7156Using a date, as suggested above, assumes that you do
7157not import more than one release of a product per
7158day. If you do, you can always use something like this
7159instead:
7160
7161@example
7162$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7163@end example
7164
7165@noindent
7166In this case, the two above commands are equivalent.
7167
7168@node Reverting local changes
7169@section Reverting to the latest vendor release
7170
7171You can also revert local changes completely and return
7172to the latest vendor release by changing the `head'
7173revision back to the vendor branch on all files.  For
7174example, if you have a checked-out copy of the sources
7175in @file{~/work.d/wdiff}, and you want to revert to the
7176vendor's version for all the files in that directory,
7177you would type:
7178
7179@example
7180$ cd ~/work.d/wdiff
7181$ cvs admin -bWDIFF .
7182@end example
7183
7184@noindent
7185You must specify the @samp{-bWDIFF} without any space
7186after the @samp{-b}.  @xref{admin options}.
7187
7188@node Binary files in imports
7189@section How to handle binary files with cvs import
7190
7191Use the @samp{-k} wrapper option to tell import which
7192files are binary.  @xref{Wrappers}.
7193
7194@node Keywords in imports
7195@section How to handle keyword substitution with cvs import
7196
7197The sources which you are importing may contain
7198keywords (@pxref{Keyword substitution}).  For example,
7199the vendor may use @sc{cvs} or some other system
7200which uses similar keyword expansion syntax.  If you
7201just import the files in the default fashion, then
7202the keyword expansions supplied by the vendor will
7203be replaced by keyword expansions supplied by your
7204own copy of @sc{cvs}.  It may be more convenient to
7205maintain the expansions supplied by the vendor, so
7206that this information can supply information about
7207the sources that you imported from the vendor.
7208
7209To maintain the keyword expansions supplied by the
7210vendor, supply the @samp{-ko} option to @code{cvs
7211import} the first time you import the file.
7212This will turn off keyword expansion
7213for that file entirely, so if you want to be more
7214selective you'll have to think about what you want
7215and use the @samp{-k} option to @code{cvs update} or
7216@code{cvs admin} as appropriate.
7217@c Supplying -ko to import if the file already existed
7218@c has no effect.  Not clear to me whether it should
7219@c or not.
7220
7221@node Multiple vendor branches
7222@section Multiple vendor branches
7223
7224All the examples so far assume that there is only one
7225vendor from which you are getting sources.  In some
7226situations you might get sources from a variety of
7227places.  For example, suppose that you are dealing with
7228a project where many different people and teams are
7229modifying the software.  There are a variety of ways to
7230handle this, but in some cases you have a bunch of
7231source trees lying around and what you want to do more
7232than anything else is just to all put them in @sc{cvs} so
7233that you at least have them in one place.
7234
7235For handling situations in which there may be more than
7236one vendor, you may specify the @samp{-b} option to
7237@code{cvs import}.  It takes as an argument the vendor
7238branch to import to.  The default is @samp{-b 1.1.1}.
7239
7240For example, suppose that there are two teams, the red
7241team and the blue team, that are sending you sources.
7242You want to import the red team's efforts to branch
72431.1.1 and use the vendor tag RED.  You want to import
7244the blue team's efforts to branch 1.1.3 and use the
7245vendor tag BLUE.  So the commands you might use are:
7246
7247@example
7248$ cvs import dir RED RED_1-0
7249$ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7250@end example
7251
7252Note that if your vendor tag does not match your
7253@samp{-b} option, @sc{cvs} will not detect this case!  For
7254example,
7255
7256@example
7257$ cvs import -b 1.1.3 dir RED RED_1-0
7258@end example
7259
7260@noindent
7261Be careful; this kind of mismatch is sure to sow
7262confusion or worse.  I can't think of a useful purpose
7263for the ability to specify a mismatch here, but if you
7264discover such a use, don't.  @sc{cvs} is likely to make this
7265an error in some future release.
7266
7267@c Probably should say more about the semantics of
7268@c multiple branches.  What about the default branch?
7269@c What about joining (perhaps not as useful with
7270@c multiple branches, or perhaps it is.  Either way
7271@c should be mentioned).
7272
7273@c I'm not sure about the best location for this.  In
7274@c one sense, it might belong right after we've introduced
7275@c CVS's basic version control model, because people need
7276@c to figure out builds right away.  The current location
7277@c is based on the theory that it kind of akin to the
7278@c "Revision management" section.
7279@node Builds
7280@chapter How your build system interacts with CVS
7281@cindex Builds
7282@cindex make
7283
7284As mentioned in the introduction, @sc{cvs} does not
7285contain software for building your software from source
7286code.  This section describes how various aspects of
7287your build system might interact with @sc{cvs}.
7288
7289@c Is there a way to discuss this without reference to
7290@c tools other than CVS?  I'm not sure there is; I
7291@c wouldn't think that people who learn CVS first would
7292@c even have this concern.
7293One common question, especially from people who are
7294accustomed to @sc{rcs}, is how to make their build get
7295an up to date copy of the sources.  The answer to this
7296with @sc{cvs} is two-fold.  First of all, since
7297@sc{cvs} itself can recurse through directories, there
7298is no need to modify your @file{Makefile} (or whatever
7299configuration file your build tool uses) to make sure
7300each file is up to date.  Instead, just use two
7301commands, first @code{cvs -q update} and then
7302@code{make} or whatever the command is to invoke your
7303build tool.  Secondly, you do not necessarily
7304@emph{want} to get a copy of a change someone else made
7305until you have finished your own work.  One suggested
7306approach is to first update your sources, then
7307implement, build and
7308test the change you were thinking of, and then commit
7309your sources (updating first if necessary).  By
7310periodically (in between changes, using the approach
7311just described) updating your entire tree, you ensure
7312that your sources are sufficiently up to date.
7313
7314@cindex Bill of materials
7315One common need is to record which versions of which
7316source files went into a particular build.  This kind
7317of functionality is sometimes called @dfn{bill of
7318materials} or something similar.  The best way to do
7319this with @sc{cvs} is to use the @code{tag} command to
7320record which versions went into a given build
7321(@pxref{Tags}).
7322
7323Using @sc{cvs} in the most straightforward manner
7324possible, each developer will have a copy of the entire
7325source tree which is used in a particular build.  If
7326the source tree is small, or if developers are
7327geographically dispersed, this is the preferred
7328solution.  In fact one approach for larger projects is
7329to break a project down into smaller
7330@c I say subsystem instead of module because they may or
7331@c may not use the modules file.
7332separately-compiled subsystems, and arrange a way of
7333releasing them internally so that each developer need
7334check out only those subsystems which are they are
7335actively working on.
7336
7337Another approach is to set up a structure which allows
7338developers to have their own copies of some files, and
7339for other files to access source files from a central
7340location.  Many people have come up with some such a
7341@c two such people are paul@sander.cupertino.ca.us (for
7342@c a previous employer)
7343@c and gtornblo@senet.abb.se (spicm and related tools),
7344@c but as far as I know
7345@c no one has nicely packaged or released such a system (or
7346@c instructions for constructing one).
7347system using features such as the symbolic link feature
7348found in many operating systems, or the @code{VPATH}
7349feature found in many versions of @code{make}.  One build
7350tool which is designed to help with this kind of thing
7351is Odin (see
7352@code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7353@c Should we be saying more about Odin?  Or how you use
7354@c it with CVS?  Also, the Prime Time Freeware for Unix
7355@c disk (see http://www.ptf.com/) has Odin (with a nice
7356@c paragraph summarizing it on the web), so that might be a
7357@c semi-"official" place to point people.
7358@c
7359@c Of course, many non-CVS systems have this kind of
7360@c functionality, for example OSF's ODE
7361@c (http://www.osf.org/ode/) or mk
7362@c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7363@c He has changed providers in the past; a search engine search
7364@c for "Peter Ziobrzynski" probably won't get too many
7365@c spurious hits :-).  A more stable URL might be
7366@c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7367@c there is any point in mentioning them here unless they
7368@c can work with CVS.
7369
7370@c ---------------------------------------------------------------------
7371@node Special Files
7372@chapter Special Files
7373
7374@cindex Special files
7375@cindex Device nodes
7376@cindex Ownership, saving in CVS
7377@cindex Permissions, saving in CVS
7378@cindex Hard links
7379@cindex Symbolic links
7380
7381In normal circumstances, @sc{cvs} works only with regular
7382files.  Every file in a project is assumed to be
7383persistent; it must be possible to open, read and close
7384them; and so on.  @sc{cvs} also ignores file permissions and
7385ownerships, leaving such issues to be resolved by the
7386developer at installation time.  In other words, it is
7387not possible to "check in" a device into a repository;
7388if the device file cannot be opened, @sc{cvs} will refuse to
7389handle it.  Files also lose their ownerships and
7390permissions during repository transactions.
7391
7392@ignore
7393If the configuration variable @code{PreservePermissions}
7394(@pxref{config}) is set in the repository, @sc{cvs} will
7395save the following file characteristics in the
7396repository:
7397
7398@itemize @bullet
7399@item user and group ownership
7400@item permissions
7401@item major and minor device numbers
7402@item symbolic links
7403@item hard link structure
7404@end itemize
7405
7406Using the @code{PreservePermissions} option affects the
7407behavior of @sc{cvs} in several ways.  First, some of the
7408new operations supported by @sc{cvs} are not accessible to
7409all users.  In particular, file ownership and special
7410file characteristics may only be changed by the
7411superuser.  When the @code{PreservePermissions}
7412configuration variable is set, therefore, users will
7413have to be `root' in order to perform @sc{cvs} operations.
7414
7415When @code{PreservePermissions} is in use, some @sc{cvs}
7416operations (such as @samp{cvs status}) will not
7417recognize a file's hard link structure, and so will
7418emit spurious warnings about mismatching hard links.
7419The reason is that @sc{cvs}'s internal structure does not
7420make it easy for these operations to collect all the
7421necessary data about hard links, so they check for file
7422conflicts with inaccurate data.
7423
7424A more subtle difference is that @sc{cvs} considers a file
7425to have changed only if its contents have changed
7426(specifically, if the modification time of the working
7427file does not match that of the repository's file).
7428Therefore, if only the permissions, ownership or hard
7429linkage have changed, or if a device's major or minor
7430numbers have changed, @sc{cvs} will not notice.  In order to
7431commit such a change to the repository, you must force
7432the commit with @samp{cvs commit -f}.  This also means
7433that if a file's permissions have changed and the
7434repository file is newer than the working copy,
7435performing @samp{cvs update} will silently change the
7436permissions on the working copy.
7437
7438Changing hard links in a @sc{cvs} repository is particularly
7439delicate.  Suppose that file @file{foo} is linked to
7440file @file{old}, but is later relinked to file
7441@file{new}.  You can wind up in the unusual situation
7442where, although @file{foo}, @file{old} and @file{new}
7443have all had their underlying link patterns changed,
7444only @file{foo} and @file{new} have been modified, so
7445@file{old} is not considered a candidate for checking
7446in.  It can be very easy to produce inconsistent
7447results this way.  Therefore, we recommend that when it
7448is important to save hard links in a repository, the
7449prudent course of action is to @code{touch} any file
7450whose linkage or status has changed since the last
7451checkin.  Indeed, it may be wise to @code{touch *}
7452before each commit in a directory with complex hard
7453link structures.
7454
7455It is worth noting that only regular files may
7456be merged, for reasons that hopefully are obvious.  If
7457@samp{cvs update} or @samp{cvs checkout -j} attempts to
7458merge a symbolic link with a regular file, or two
7459device files for different kinds of devices, @sc{cvs} will
7460report a conflict and refuse to perform the merge.  At
7461the same time, @samp{cvs diff} will not report any
7462differences between these files, since no meaningful
7463textual comparisons can be made on files which contain
7464no text.
7465
7466The @code{PreservePermissions} features do not work
7467with client/server @sc{cvs}.  Another limitation is
7468that hard links must be to other files within the same
7469directory; hard links across directories are not
7470supported.
7471@end ignore
7472
7473@c ---------------------------------------------------------------------
7474@node CVS commands
7475@appendix Guide to CVS commands
7476
7477This appendix describes the overall structure of
7478@sc{cvs} commands, and describes some commands in
7479detail (others are described elsewhere; for a quick
7480reference to @sc{cvs} commands, @pxref{Invoking CVS}).
7481@c The idea is that we want to move the commands which
7482@c are described here into the main body of the manual,
7483@c in the process reorganizing the manual to be
7484@c organized around what the user wants to do, not
7485@c organized around CVS commands.
7486@c
7487@c Note that many users do expect a manual which is
7488@c organized by command.  At least some users do.
7489@c One good addition to the "organized by command"
7490@c section (if any) would be "see also" links.
7491@c The awk manual might be a good example; it has a
7492@c reference manual which is more verbose than Invoking
7493@c CVS but probably somewhat less verbose than CVS
7494@c Commands.
7495
7496@menu
7497* Structure::                   Overall structure of CVS commands
7498* Exit status::                 Indicating CVS's success or failure
7499* ~/.cvsrc::                    Default options with the ~/.csvrc file
7500* Global options::              Options you give to the left of cvs_command
7501* Common options::              Options you give to the right of cvs_command
7502* admin::                       Administration
7503* checkout::                    Checkout sources for editing
7504* commit::                      Check files into the repository
7505* diff::                        Show differences between revisions
7506* export::                      Export sources from CVS, similar to checkout
7507* history::                     Show status of files and users
7508* import::                      Import sources into CVS, using vendor branches
7509* log::                         Show log messages for files
7510* rdiff::                       'patch' format diffs between releases
7511* release::                     Indicate that a directory is no longer in use
7512* update::                      Bring work tree in sync with repository
7513@end menu
7514
7515@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7516@node Structure
7517@appendixsec Overall structure of CVS commands
7518@cindex Structure
7519@cindex CVS command structure
7520@cindex Command structure
7521@cindex Format of CVS commands
7522
7523The overall format of all @sc{cvs} commands is:
7524
7525@example
7526cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
7527@end example
7528
7529@table @code
7530@item cvs
7531The name of the @sc{cvs} program.
7532
7533@item cvs_options
7534Some options that affect all sub-commands of @sc{cvs}.  These are
7535described below.
7536
7537@item cvs_command
7538One of several different sub-commands.  Some of the commands have
7539aliases that can be used instead; those aliases are noted in the
7540reference manual for that command.  There are only two situations
7541where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
7542list of available commands, and @samp{cvs -v} displays version
7543information on @sc{cvs} itself.
7544
7545@item command_options
7546Options that are specific for the command.
7547
7548@item command_args
7549Arguments to the commands.
7550@end table
7551
7552There is unfortunately some confusion between
7553@code{cvs_options} and @code{command_options}.
7554@samp{-l}, when given as a @code{cvs_option}, only
7555affects some of the commands.  When it is given as a
7556@code{command_option} is has a different meaning, and
7557is accepted by more commands.  In other words, do not
7558take the above categorization too seriously.  Look at
7559the documentation instead.
7560
7561@node Exit status
7562@appendixsec CVS's exit status
7563@cindex Exit status, of CVS
7564
7565@sc{cvs} can indicate to the calling environment whether it
7566succeeded or failed by setting its @dfn{exit status}.
7567The exact way of testing the exit status will vary from
7568one operating system to another.  For example in a unix
7569shell script the @samp{$?} variable will be 0 if the
7570last command returned a successful exit status, or
7571greater than 0 if the exit status indicated failure.
7572
7573If @sc{cvs} is successful, it returns a successful status;
7574if there is an error, it prints an error message and
7575returns a failure status.  The one exception to this is
7576the @code{cvs diff} command.  It will return a
7577successful status if it found no differences, or a
7578failure status if there were differences or if there
7579was an error.  Because this behavior provides no good
7580way to detect errors, in the future it is possible that
7581@code{cvs diff} will be changed to behave like the
7582other @sc{cvs} commands.
7583@c It might seem like checking whether cvs -q diff
7584@c produces empty or non-empty output can tell whether
7585@c there were differences or not.  But it seems like
7586@c there are cases with output but no differences
7587@c (testsuite basica-8b).  It is not clear to me how
7588@c useful it is for a script to be able to check
7589@c whether there were differences.
7590@c FIXCVS? In previous versions of CVS, cvs diff
7591@c returned 0 for no differences, 1 for differences, or
7592@c 2 for errors.  Is this behavior worth trying to
7593@c bring back (but what does it mean for VMS?)?
7594
7595@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7596@node ~/.cvsrc
7597@appendixsec Default options and the ~/.cvsrc file
7598@cindex .cvsrc file
7599@cindex Option defaults
7600
7601There are some @code{command_options} that are used so
7602often that you might have set up an alias or some other
7603means to make sure you always specify that option.  One
7604example (the one that drove the implementation of the
7605@file{.cvsrc} support, actually) is that many people find the
7606default output of the @samp{diff} command to be very
7607hard to read, and that either context diffs or unidiffs
7608are much easier to understand.
7609
7610The @file{~/.cvsrc} file is a way that you can add
7611default options to @code{cvs_commands} within cvs,
7612instead of relying on aliases or other shell scripts.
7613
7614The format of the @file{~/.cvsrc} file is simple.  The
7615file is searched for a line that begins with the same
7616name as the @code{cvs_command} being executed.  If a
7617match is found, then the remainder of the line is split
7618up (at whitespace characters) into separate options and
7619added to the command arguments @emph{before} any
7620options from the command line.
7621
7622If a command has two names (e.g., @code{checkout} and
7623@code{co}), the official name, not necessarily the one
7624used on the command line, will be used to match against
7625the file.  So if this is the contents of the user's
7626@file{~/.cvsrc} file:
7627
7628@example
7629log -N
7630diff -u
7631update -P
7632checkout -P
7633@end example
7634
7635@noindent
7636the command @samp{cvs checkout foo} would have the
7637@samp{-P} option added to the arguments, as well as
7638@samp{cvs co foo}.
7639
7640With the example file above, the output from @samp{cvs
7641diff foobar} will be in unidiff format.  @samp{cvs diff
7642-c foobar} will provide context diffs, as usual.
7643Getting "old" format diffs would be slightly more
7644complicated, because @code{diff} doesn't have an option
7645to specify use of the "old" format, so you would need
7646@samp{cvs -f diff foobar}.
7647
7648In place of the command name you can use @code{cvs} to
7649specify global options (@pxref{Global options}).  For
7650example the following line in @file{.cvsrc}
7651
7652@example
7653cvs -z6
7654@end example
7655
7656causes @sc{cvs} to use compression level 6.
7657
7658@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7659@node Global options
7660@appendixsec Global options
7661@cindex Options, global
7662@cindex Global options
7663@cindex Left-hand options
7664
7665The available @samp{cvs_options} (that are given to the
7666left of @samp{cvs_command}) are:
7667
7668@table @code
7669@item --allow-root=@var{rootdir}
7670Specify legal @sc{cvsroot} directory.  See
7671@ref{Password authentication server}.
7672
7673@cindex Authentication, stream
7674@cindex Stream authentication
7675@item -a
7676Authenticate all communication between the client and
7677the server.  Only has an effect on the @sc{cvs} client.
7678As of this writing, this is only implemented when using
7679a GSSAPI connection (@pxref{GSSAPI authenticated}).
7680Authentication prevents certain sorts of attacks
7681involving hijacking the active @sc{tcp} connection.
7682Enabling authentication does not enable encryption.
7683
7684@cindex RCSBIN, overriding
7685@cindex Overriding RCSBIN
7686@item -b @var{bindir}
7687In @sc{cvs} 1.9.18 and older, this specified that
7688@sc{rcs} programs are in the @var{bindir} directory.
7689Current versions of @sc{cvs} do not run @sc{rcs}
7690programs; for compatibility this option is accepted,
7691but it does nothing.
7692
7693@cindex TMPDIR, overriding
7694@cindex Overriding TMPDIR
7695@item -T @var{tempdir}
7696Use @var{tempdir} as the directory where temporary files are
7697located.  Overrides the setting of the @code{$TMPDIR} environment
7698variable and any precompiled directory.  This parameter should be
7699specified as an absolute pathname.
7700
7701@cindex CVSROOT, overriding
7702@cindex Overriding CVSROOT
7703@item -d @var{cvs_root_directory}
7704Use @var{cvs_root_directory} as the root directory
7705pathname of the repository.  Overrides the setting of
7706the @code{$CVSROOT} environment variable.  @xref{Repository}.
7707
7708@cindex EDITOR, overriding
7709@cindex Overriding EDITOR
7710@item -e @var{editor}
7711Use @var{editor} to enter revision log information.  Overrides the
7712setting of the @code{$CVSEDITOR} and @code{$EDITOR}
7713environment variables.  For more information, see
7714@ref{Committing your changes}.
7715
7716@item -f
7717Do not read the @file{~/.cvsrc} file.  This
7718option is most often used because of the
7719non-orthogonality of the @sc{cvs} option set.  For
7720example, the @samp{cvs log} option @samp{-N} (turn off
7721display of tag names) does not have a corresponding
7722option to turn the display on.  So if you have
7723@samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
7724you may need to use @samp{-f} to show the tag names.
7725
7726@item -H
7727@itemx --help
7728Display usage information about the specified @samp{cvs_command}
7729(but do not actually execute the command).  If you don't specify
7730a command name, @samp{cvs -H} displays overall help for
7731@sc{cvs}, including a list of other help options.
7732@c It seems to me it is better to document it this way
7733@c rather than trying to update this documentation
7734@c every time that we add a --help-foo option.  But
7735@c perhaps that is confusing...
7736
7737@item -l
7738Do not log the @samp{cvs_command} in the command history (but execute it
7739anyway).  @xref{history}, for information on command history.
7740
7741@cindex Read-only mode
7742@item -n
7743Do not change any files.  Attempt to execute the
7744@samp{cvs_command}, but only to issue reports; do not remove,
7745update, or merge any existing files, or create any new files.
7746
7747Note that @sc{cvs} will not necessarily produce exactly
7748the same output as without @samp{-n}.  In some cases
7749the output will be the same, but in other cases
7750@sc{cvs} will skip some of the processing that would
7751have been required to produce the exact same output.
7752
7753@item -Q
7754Cause the command to be really quiet; the command will only
7755generate output for serious problems.
7756
7757@item -q
7758Cause the command to be somewhat quiet; informational messages,
7759such as reports of recursion through subdirectories, are
7760suppressed.
7761
7762@cindex Read-only files, and -r
7763@item -r
7764Make new working files read-only.  Same effect
7765as if the @code{$CVSREAD} environment variable is set
7766(@pxref{Environment variables}).  The default is to
7767make working files writable, unless watches are on
7768(@pxref{Watches}).
7769
7770@item -s @var{variable}=@var{value}
7771Set a user variable (@pxref{Variables}).
7772
7773@cindex Trace
7774@item -t
7775Trace program execution; display messages showing the steps of
7776@sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
7777potential impact of an unfamiliar command.
7778
7779@item -v
7780@item --version
7781Display version and copyright information for @sc{cvs}.
7782
7783@cindex CVSREAD, overriding
7784@cindex Overriding CVSREAD
7785@item -w
7786Make new working files read-write.  Overrides the
7787setting of the @code{$CVSREAD} environment variable.
7788Files are created read-write by default, unless @code{$CVSREAD} is
7789set or @samp{-r} is given.
7790@c Note that -w only overrides -r and CVSREAD; it has
7791@c no effect on files which are readonly because of
7792@c "cvs watch on".  My guess is that is the way it
7793@c should be (or should "cvs -w get" on a watched file
7794@c be the same as a get and a cvs edit?), but I'm not
7795@c completely sure whether to document it this way.
7796
7797@item -x
7798@cindex Encryption
7799Encrypt all communication between the client and the
7800server.  Only has an effect on the @sc{cvs} client.  As
7801of this writing, this is only implemented when using a
7802GSSAPI connection (@pxref{GSSAPI authenticated}) or a
7803Kerberos connection (@pxref{Kerberos authenticated}).
7804Enabling encryption implies that message traffic is
7805also authenticated.  Encryption support is not
7806available by default; it must be enabled using a
7807special configure option, @file{--enable-encryption},
7808when you build @sc{cvs}.
7809
7810@item -z @var{gzip-level}
7811@cindex Compression
7812@cindex Gzip
7813Set the compression level.
7814Valid levels are 1 (high speed, low compression) to
78159 (low speed, high compression), or 0 to disable
7816compression (the default).
7817Only has an effect on the @sc{cvs} client.
7818
7819@end table
7820
7821@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7822@node Common options
7823@appendixsec Common command options
7824@cindex Common options
7825@cindex Right-hand options
7826
7827This section describes the @samp{command_options} that
7828are available across several @sc{cvs} commands.  These
7829options are always given to the right of
7830@samp{cvs_command}. Not all
7831commands support all of these options; each option is
7832only supported for commands where it makes sense.
7833However, when a command has one of these options you
7834can almost always count on the same behavior of the
7835option as in other commands.  (Other command options,
7836which are listed with the individual commands, may have
7837different behavior from one @sc{cvs} command to the other).
7838
7839@strong{Warning:} the @samp{history} command is an exception; it supports
7840many options that conflict even with these standard options.
7841
7842@table @code
7843@cindex Dates
7844@cindex Time
7845@cindex Specifying dates
7846@item -D @var{date_spec}
7847Use the most recent revision no later than @var{date_spec}.
7848@var{date_spec} is a single argument, a date description
7849specifying a date in the past.
7850
7851The specification is @dfn{sticky} when you use it to make a
7852private copy of a source file; that is, when you get a working
7853file using @samp{-D}, @sc{cvs} records the date you specified, so that
7854further updates in the same directory will use the same date
7855(for more information on sticky tags/dates, @pxref{Sticky tags}).
7856
7857@samp{-D} is available with the @code{checkout},
7858@code{diff}, @code{export}, @code{history},
7859@code{rdiff}, @code{rtag}, and @code{update} commands.
7860(The @code{history} command uses this option in a
7861slightly different way; @pxref{history options}).
7862
7863@c What other formats should we accept?  I don't want
7864@c to start accepting a whole mess of non-standard
7865@c new formats (there are a lot which are in wide use in
7866@c one context or another), but practicality does
7867@c dictate some level of flexibility.
7868@c * POSIX.2 (e.g. touch, ls output, date) and other
7869@c POSIX and/or de facto unix standards (e.g. at).  The
7870@c practice here is too inconsistent to be of any use.
7871@c * VMS dates.  This is not a formal standard, but
7872@c there is a published specification (see SYS$ASCTIM
7873@c and SYS$BINTIM in the _VMS System Services Reference
7874@c Manual_), it is implemented consistently in VMS
7875@c utilities, and VMS users will expect CVS running on
7876@c VMS to support this format (and if we're going to do
7877@c that, better to make CVS support it on all
7878@c platforms.  Maybe).
7879@c
7880@c NOTE: The tar manual has some documentation for
7881@c getdate.y (just for our info; we don't want to
7882@c attempt to document all the formats accepted by
7883@c getdate.y).
7884@c
7885@c One more note: In output, CVS should consistently
7886@c use one date format, and that format should be one that
7887@c it accepts in input as well.  The former isn't
7888@c really true (see survey below), and I'm not
7889@c sure that either of those formats is accepted in
7890@c input.
7891@c
7892@c cvs log
7893@c   current 1996/01/02 13:45:31
7894@c   Internet 02 Jan 1996 13:45:31 UT
7895@c   ISO 1996-01-02 13:45:31
7896@c cvs ann
7897@c   current 02-Jan-96
7898@c   Internet-like 02 Jan 96
7899@c   ISO 96-01-02
7900@c cvs status
7901@c   current Tue Jun 11 02:54:53 1996
7902@c   Internet [Tue,] 11 Jun 1996 02:54:53
7903@c   ISO 1996-06-11 02:54:53
7904@c   note: date possibly should be omitted entirely for
7905@c   other reasons.
7906@c cvs editors
7907@c   current Tue Jun 11 02:54:53 1996 GMT
7908@c cvs history
7909@c   current 06/11 02:54 +0000
7910@c any others?
7911@c There is a good chance the proper solution has to
7912@c involve at least some level of letting the user
7913@c decide which format (with the default being the
7914@c formats CVS has always used; changing these might be
7915@c _very_ disruptive since scripts may very well be
7916@c parsing them).
7917@c
7918@c Another random bit of prior art concerning dates is
7919@c the strptime function which takes templates such as
7920@c "%m/%d/%y", and apparent a variant of getdate()
7921@c which also honors them.  See
7922@c X/Open CAE Specification, System Interfaces and
7923@c Headers Issue 4, Version 2 (September 1994), in the
7924@c entry for getdate() on page 231
7925
7926@cindex Timezone, in input
7927@cindex Zone, time, in input
7928A wide variety of date formats are supported by
7929@sc{cvs}.  The most standard ones are ISO8601 (from the
7930International Standards Organization) and the Internet
7931e-mail standard (specified in RFC822 as amended by
7932RFC1123).
7933
7934@c Probably should be doing more to spell out just what
7935@c the rules are, rather than just giving examples.
7936@c But I want to keep this simple too.
7937@c So I don't know....
7938@c A few specific issues: (1) Maybe should reassure
7939@c people that years after 2000
7940@c work (they are in the testsuite, so they do indeed
7941@c work).  (2) What do two digit years
7942@c mean?  Where do we accept them?  (3) Local times can
7943@c be ambiguous or nonexistent if they fall during the
7944@c hour when daylight savings time goes into or out of
7945@c effect.  Pretty obscure, so I'm not at all sure we
7946@c should be documenting the behavior in that case.
7947ISO8601 dates have many variants but a few examples
7948are:
7949
7950@example
79511972-09-24
79521972-09-24 20:05
7953@end example
7954@c I doubt we really accept all ISO8601 format dates
7955@c (for example, decimal hours like 1972-09-24 20,2)
7956@c I'm not sure we should, many of them are pretty
7957@c bizarre and it has lots of gratuitous multiple ways
7958@c to specify the same thing.
7959
7960There are a lot more ISO8601 date formats, and @sc{cvs}
7961accepts many of them, but you probably don't want to
7962hear the @emph{whole} long story :-).
7963
7964@c Citing a URL here is kind of problematic given how
7965@c much they change and people who have old versions of
7966@c this manual, but in case we want to reinstate an
7967@c ISO8601 URL, a few are:
7968@c http://www.saqqara.demon.co.uk/datefmt.htm
7969@c http://www.cl.cam.ac.uk/~mgk25/iso-time.html
7970@c Citing some other ISO8601 source is probably even
7971@c worse :-).
7972
7973In addition to the dates allowed in Internet e-mail
7974itself, @sc{cvs} also allows some of the fields to be
7975omitted.  For example:
7976@c FIXME: Need to figure out better, and document,
7977@c what we want to allow the user to omit.
7978@c NOTE: "omit" does not imply "reorder".
7979@c FIXME: Need to cite a web page describing how to get
7980@c RFC's.
7981
7982@example
798324 Sep 1972 20:05
798424 Sep
7985@end example
7986
7987The date is interpreted as being in the
7988local timezone, unless a specific timezone is
7989specified.
7990
7991These two date formats are preferred.  However,
7992@sc{cvs} currently accepts a wide variety of other date
7993formats.  They are intentionally not documented here in
7994any detail, and future versions of @sc{cvs} might not
7995accept all of them.
7996@c We should document and testsuite "now" and
7997@c "yesterday".  "now" is mentioned in the FAQ and
7998@c "yesterday" is mentioned in this document (and the
7999@c message from "cvs import" suggesting a merge
8000@c command).  What else?  Probably some/all of the "3
8001@c weeks ago" family.
8002@c
8003@c Maybe at
8004@c some point have CVS start give warnings on "unofficial"
8005@c formats (many of which might be typos or user
8006@c misunderstandings, and/or formats people never/rarely
8007@c use to specify dates)?
8008
8009One such format is
8010@code{@var{month}/@var{day}/@var{year}}.  This may
8011confuse people who are accustomed to having the month
8012and day in the other order; @samp{1/4/96} is January 4,
8013not April 1.
8014
8015Remember to quote the argument to the @samp{-D}
8016flag so that your shell doesn't interpret spaces as
8017argument separators.  A command using the @samp{-D}
8018flag can look like this:
8019
8020@example
8021$ cvs diff -D "1 hour ago" cvs.texinfo
8022@end example
8023
8024@cindex Forcing a tag match
8025@item -f
8026When you specify a particular date or tag to @sc{cvs} commands, they
8027normally ignore files that do not contain the tag (or did not
8028exist prior to the date) that you specified.  Use the @samp{-f} option
8029if you want files retrieved even when there is no match for the
8030tag or date.  (The most recent revision of the file
8031will be used).
8032
8033Note that even with @samp{-f}, a tag that you specify
8034must exist (that is, in some file, not necessary in
8035every file).  This is so that @sc{cvs} will continue to
8036give an error if you mistype a tag name.
8037
8038@need 800
8039@samp{-f} is available with these commands:
8040@code{annotate}, @code{checkout}, @code{export},
8041@code{rdiff}, @code{rtag}, and @code{update}.
8042
8043@strong{Warning:}  The @code{commit} and @code{remove}
8044commands also have a
8045@samp{-f} option, but it has a different behavior for
8046those commands.  See @ref{commit options}, and
8047@ref{Removing files}.
8048
8049@item -k @var{kflag}
8050Alter the default processing of keywords.
8051@xref{Keyword substitution}, for the meaning of
8052@var{kflag}.  Your @var{kflag} specification is
8053@dfn{sticky} when you use it to create a private copy
8054of a source file; that is, when you use this option
8055with the @code{checkout} or @code{update} commands,
8056@sc{cvs} associates your selected @var{kflag} with the
8057file, and continues to use it with future update
8058commands on the same file until you specify otherwise.
8059
8060The @samp{-k} option is available with the @code{add},
8061@code{checkout}, @code{diff}, @code{import} and
8062@code{update} commands.
8063
8064@item -l
8065Local; run only in current working directory, rather than
8066recursing through subdirectories.
8067
8068@strong{Warning:} this is not the same
8069as the overall @samp{cvs -l} option, which you can specify to the
8070left of a cvs command!
8071
8072Available with the following commands: @code{annotate}, @code{checkout},
8073@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8074@code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8075@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8076and @code{watchers}.
8077
8078@cindex Editor, avoiding invocation of
8079@cindex Avoiding editor invocation
8080@item -m @var{message}
8081Use @var{message} as log information, instead of
8082invoking an editor.
8083
8084Available with the following commands: @code{add},
8085@code{commit} and @code{import}.
8086
8087@item -n
8088Do not run any checkout/commit/tag program.  (A program can be
8089specified to run on each of these activities, in the modules
8090database (@pxref{modules}); this option bypasses it).
8091
8092@strong{Warning:} this is not the same as the overall @samp{cvs -n}
8093option, which you can specify to the left of a cvs command!
8094
8095Available with the @code{checkout}, @code{commit}, @code{export},
8096and @code{rtag} commands.
8097
8098@item -P
8099Prune empty directories.  See @ref{Removing directories}.
8100
8101@item -p
8102Pipe the files retrieved from the repository to standard output,
8103rather than writing them in the current directory.  Available
8104with the @code{checkout} and @code{update} commands.
8105
8106@item -R
8107Process directories recursively.  This is on by default.
8108
8109Available with the following commands: @code{annotate}, @code{checkout},
8110@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8111@code{rdiff}, @code{remove}, @code{rtag},
8112@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8113and @code{watchers}.
8114
8115@item -r @var{tag}
8116@cindex HEAD, special tag
8117@cindex BASE, special tag
8118Use the revision specified by the @var{tag} argument instead of the
8119default @dfn{head} revision.  As well as arbitrary tags defined
8120with the @code{tag} or @code{rtag} command, two special tags are
8121always available: @samp{HEAD} refers to the most recent version
8122available in the repository, and @samp{BASE} refers to the
8123revision you last checked out into the current working directory.
8124
8125@c FIXME: What does HEAD really mean?  I believe that
8126@c the current answer is the head of the default branch
8127@c for all cvs commands except diff.  For diff, it
8128@c seems to be (a) the head of the trunk (or the default
8129@c branch?) if there is no sticky tag, (b) the head of the
8130@c branch for the sticky tag, if there is a sticky tag.
8131@c (b) is ugly as it differs
8132@c from what HEAD means for other commands, but people
8133@c and/or scripts are quite possibly used to it.
8134@c See "head" tests in sanity.sh.
8135@c Probably the best fix is to introduce two new
8136@c special tags, ".thead" for the head of the trunk,
8137@c and ".bhead" for the head of the current branch.
8138@c Then deprecate HEAD.  This has the advantage of
8139@c not surprising people with a change to HEAD, and a
8140@c side benefit of also phasing out the poorly-named
8141@c HEAD (see discussion of reserved tag names in node
8142@c "Tags").  Of course, .thead and .bhead should be
8143@c carefully implemented (with the implementation the
8144@c same for "diff" as for everyone else), test cases
8145@c written (similar to the ones in "head"), new tests
8146@c cases written for things like default branches, &c.
8147
8148The tag specification is sticky when you use this
8149@c option
8150with @code{checkout} or @code{update} to make your own
8151copy of a file: @sc{cvs} remembers the tag and continues to use it on
8152future update commands, until you specify otherwise (for more information
8153on sticky tags/dates, @pxref{Sticky tags}).
8154
8155The tag can be either a symbolic or numeric tag, as
8156described in @ref{Tags}, or the name of a branch, as
8157described in @ref{Branching and merging}.
8158
8159Specifying the @samp{-q} global option along with the
8160@samp{-r} command option is often useful, to suppress
8161the warning messages when the @sc{rcs} file
8162does not contain the specified tag.
8163
8164@strong{Warning:} this is not the same as the overall @samp{cvs -r} option,
8165which you can specify to the left of a @sc{cvs} command!
8166
8167@samp{-r} is available with the @code{checkout}, @code{commit},
8168@code{diff}, @code{history}, @code{export}, @code{rdiff},
8169@code{rtag}, and @code{update} commands.
8170
8171@item -W
8172Specify file names that should be filtered.  You can
8173use this option repeatedly.  The spec can be a file
8174name pattern of the same type that you can specify in
8175the @file{.cvswrappers} file.
8176Available with the following commands: @code{import},
8177and @code{update}.
8178
8179@end table
8180
8181@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8182@node admin
8183@appendixsec admin---Administration
8184@cindex Admin (subcommand)
8185
8186@itemize @bullet
8187@item
8188Requires: repository, working directory.
8189@item
8190Changes: repository.
8191@item
8192Synonym: rcs
8193@end itemize
8194
8195This is the @sc{cvs} interface to assorted
8196administrative facilities.  Some of them have
8197questionable usefulness for @sc{cvs} but exist for
8198historical purposes.  Some of the questionable options
8199are likely to disappear in the future.  This command
8200@emph{does} work recursively, so extreme care should be
8201used.
8202
8203@cindex cvsadmin
8204On unix, if there is a group named @code{cvsadmin},
8205only members of that group can run @code{cvs admin}
8206(except for the @code{cvs admin -k} command, which can
8207be run by anybody).  This group should exist on the
8208server, or any system running the non-client/server
8209@sc{cvs}.  To disallow @code{cvs admin} for all users,
8210create a group with no users in it.  On NT, the
8211@code{cvsadmin} feature does not exist and all users
8212can run @code{cvs admin}.
8213
8214@menu
8215* admin options::               admin options
8216@end menu
8217
8218@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8219@node admin options
8220@appendixsubsec admin options
8221
8222Some of these options have questionable usefulness for
8223@sc{cvs} but exist for historical purposes.  Some even
8224make it impossible to use @sc{cvs} until you undo the
8225effect!
8226
8227@table @code
8228@item -A@var{oldfile}
8229Might not work together with @sc{cvs}.  Append the
8230access list of @var{oldfile} to the access list of the
8231@sc{rcs} file.
8232
8233@item -a@var{logins}
8234Might not work together with @sc{cvs}.  Append the
8235login names appearing in the comma-separated list
8236@var{logins} to the access list of the @sc{rcs} file.
8237
8238@item -b[@var{rev}]
8239Set the default branch to @var{rev}.  In @sc{cvs}, you
8240normally do not manipulate default branches; sticky
8241tags (@pxref{Sticky tags}) are a better way to decide
8242which branch you want to work on.  There is one reason
8243to run @code{cvs admin -b}: to revert to the vendor's
8244version when using vendor branches (@pxref{Reverting
8245local changes}).
8246There can be no space between @samp{-b} and its argument.
8247@c Hmm, we don't document the usage where rev is
8248@c omitted.  Maybe that usage can/should be deprecated
8249@c (and replaced with -bHEAD or something?) (so we can toss
8250@c the optional argument).  Note that -bHEAD does not
8251@c work, as of 17 Sep 1997, but probably will once "cvs
8252@c admin" is internal to CVS.
8253
8254@cindex Comment leader
8255@item -c@var{string}
8256Sets the comment leader to @var{string}.  The comment
8257leader is not used by current versions of @sc{cvs} or
8258@sc{rcs} 5.7.  Therefore, you can almost surely not
8259worry about it.  @xref{Keyword substitution}.
8260
8261@item -e[@var{logins}]
8262Might not work together with @sc{cvs}.  Erase the login
8263names appearing in the comma-separated list
8264@var{logins} from the access list of the RCS file.  If
8265@var{logins} is omitted, erase the entire access list.
8266There can be no space between @samp{-e} and its argument.
8267
8268@item -I
8269Run interactively, even if the standard input is not a
8270terminal.  This option does not work with the
8271client/server @sc{cvs} and is likely to disappear in
8272a future release of @sc{cvs}.
8273
8274@item -i
8275Useless with @sc{cvs}.  This creates and initializes a
8276new @sc{rcs} file, without depositing a revision.  With
8277@sc{cvs}, add files with the @code{cvs add} command
8278(@pxref{Adding files}).
8279
8280@item -k@var{subst}
8281Set the default keyword
8282substitution to @var{subst}.  @xref{Keyword
8283substitution}.  Giving an explicit @samp{-k} option to
8284@code{cvs update}, @code{cvs export}, or @code{cvs
8285checkout} overrides this default.
8286
8287@item -l[@var{rev}]
8288Lock the revision with number @var{rev}.  If a branch
8289is given, lock the latest revision on that branch.  If
8290@var{rev} is omitted, lock the latest revision on the
8291default branch.  There can be no space between
8292@samp{-l} and its argument.
8293
8294This can be used in conjunction with the
8295@file{rcslock.pl} script in the @file{contrib}
8296directory of the @sc{cvs} source distribution to
8297provide reserved checkouts (where only one user can be
8298editing a given file at a time).  See the comments in
8299that file for details (and see the @file{README} file
8300in that directory for disclaimers about the unsupported
8301nature of contrib).  According to comments in that
8302file, locking must set to strict (which is the default).
8303
8304@item -L
8305Set locking to strict.  Strict locking means that the
8306owner of an RCS file is not exempt from locking for
8307checkin.  For use with @sc{cvs}, strict locking must be
8308set; see the discussion under the @samp{-l} option above.
8309
8310@cindex Changing a log message
8311@cindex Replacing a log message
8312@cindex Correcting a log message
8313@cindex Fixing a log message
8314@cindex Log message, correcting
8315@item -m@var{rev}:@var{msg}
8316Replace the log message of revision @var{rev} with
8317@var{msg}.
8318
8319@c The rcs -M option, to suppress sending mail, has never been
8320@c documented as a cvs admin option.
8321
8322@item -N@var{name}[:[@var{rev}]]
8323Act like @samp{-n}, except override any previous
8324assignment of @var{name}.  For use with magic branches,
8325see @ref{Magic branch numbers}.
8326
8327@item -n@var{name}[:[@var{rev}]]
8328Associate the symbolic name @var{name} with the branch
8329or revision @var{rev}.  It is normally better to use
8330@samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8331symbolic name if both @samp{:} and @var{rev} are
8332omitted; otherwise, print an error message if
8333@var{name} is already associated with another number.
8334If @var{rev} is symbolic, it is expanded before
8335association.  A @var{rev} consisting of a branch number
8336followed by a @samp{.} stands for the current latest
8337revision in the branch.  A @samp{:} with an empty
8338@var{rev} stands for the current latest revision on the
8339default branch, normally the trunk.  For example,
8340@samp{cvs admin -n@var{name}:} associates @var{name} with the
8341current latest revision of all the RCS files;
8342this contrasts with @samp{cvs admin -n@var{name}:$} which
8343associates @var{name} with the revision numbers
8344extracted from keyword strings in the corresponding
8345working files.
8346
8347@cindex Deleting revisions
8348@cindex Outdating revisions
8349@cindex Saving space
8350@item -o@var{range}
8351Deletes (@dfn{outdates}) the revisions given by
8352@var{range}.
8353
8354Note that this command can be quite dangerous unless
8355you know @emph{exactly} what you are doing (for example
8356see the warnings below about how the
8357@var{rev1}:@var{rev2} syntax is confusing).
8358
8359If you are short on disc this option might help you.
8360But think twice before using it---there is no way short
8361of restoring the latest backup to undo this command!
8362If you delete different revisions than you planned,
8363either due to carelessness or (heaven forbid) a @sc{cvs}
8364bug, there is no opportunity to correct the error
8365before the revisions are deleted.  It probably would be
8366a good idea to experiment on a copy of the repository
8367first.
8368
8369Specify @var{range} in one of the following ways:
8370
8371@table @code
8372@item @var{rev1}::@var{rev2}
8373Collapse all revisions between rev1 and rev2, so that
8374@sc{cvs} only stores the differences associated with going
8375from rev1 to rev2, not intermediate steps.  For
8376example, after @samp{-o 1.3::1.5} one can retrieve
8377revision 1.3, revision 1.5, or the differences to get
8378from 1.3 to 1.5, but not the revision 1.4, or the
8379differences between 1.3 and 1.4.  Other examples:
8380@samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8381effect, because there are no intermediate revisions to
8382remove.
8383
8384@item ::@var{rev}
8385Collapse revisions between the beginning of the branch
8386containing @var{rev} and @var{rev} itself.  The
8387branchpoint and @var{rev} are left intact.  For
8388example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8389revision 1.3.2.5, and everything in between, but leaves
83901.3 and 1.3.2.6 intact.
8391
8392@item @var{rev}::
8393Collapse revisions between @var{rev} and the end of the
8394branch containing @var{rev}.  Revision @var{rev} is
8395left intact but the head revision is deleted.
8396
8397@item @var{rev}
8398Delete the revision @var{rev}.  For example, @samp{-o
83991.3} is equivalent to @samp{-o 1.2::1.4}.
8400
8401@item @var{rev1}:@var{rev2}
8402Delete the revisions from @var{rev1} to @var{rev2},
8403inclusive, on the same branch.  One will not be able to
8404retrieve @var{rev1} or @var{rev2} or any of the
8405revisions in between.  For example, the command
8406@samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8407It means to delete revisions up to, and including, the
8408tag R_1_02.  But beware!  If there are files that have not
8409changed between R_1_02 and R_1_03 the file will have
8410@emph{the same} numerical revision number assigned to
8411the tags R_1_02 and R_1_03.  So not only will it be
8412impossible to retrieve R_1_02; R_1_03 will also have to
8413be restored from the tapes!  In most cases you want to
8414specify @var{rev1}::@var{rev2} instead.
8415
8416@item :@var{rev}
8417Delete revisions from the beginning of the
8418branch containing @var{rev} up to and including
8419@var{rev}.
8420
8421@item @var{rev}:
8422Delete revisions from revision @var{rev}, including
8423@var{rev} itself, to the end of the branch containing
8424@var{rev}.
8425@end table
8426
8427None of the revisions to be deleted may have
8428branches or locks.
8429
8430If any of the revisions to be deleted have symbolic
8431names, and one specifies one of the @samp{::} syntaxes,
8432then @sc{cvs} will give an error and not delete any
8433revisions.  If you really want to delete both the
8434symbolic names and the revisions, first delete the
8435symbolic names with @code{cvs tag -d}, then run
8436@code{cvs admin -o}.  If one specifies the
8437non-@samp{::} syntaxes, then @sc{cvs} will delete the
8438revisions but leave the symbolic names pointing to
8439nonexistent revisions.  This behavior is preserved for
8440compatibility with previous versions of @sc{cvs}, but
8441because it isn't very useful, in the future it may
8442change to be like the @samp{::} case.
8443
8444Due to the way @sc{cvs} handles branches @var{rev}
8445cannot be specified symbolically if it is a branch.
8446@xref{Magic branch numbers}, for an explanation.
8447@c FIXME: is this still true?  I suspect not.
8448
8449Make sure that no-one has checked out a copy of the
8450revision you outdate.  Strange things will happen if he
8451starts to edit it and tries to check it back in.  For
8452this reason, this option is not a good way to take back
8453a bogus commit; commit a new revision undoing the bogus
8454change instead (@pxref{Merging two revisions}).
8455
8456@item -q
8457Run quietly; do not print diagnostics.
8458
8459@item -s@var{state}[:@var{rev}]
8460Useful with @sc{cvs}.  Set the state attribute of the
8461revision @var{rev} to @var{state}.  If @var{rev} is a
8462branch number, assume the latest revision on that
8463branch.  If @var{rev} is omitted, assume the latest
8464revision on the default branch.  Any identifier is
8465acceptable for @var{state}.  A useful set of states is
8466@samp{Exp} (for experimental), @samp{Stab} (for
8467stable), and @samp{Rel} (for released).  By default,
8468the state of a new revision is set to @samp{Exp} when
8469it is created.  The state is visible in the output from
8470@var{cvs log} (@pxref{log}), and in the
8471@samp{$@asis{}Log$} and @samp{$@asis{}State$} keywords
8472(@pxref{Keyword substitution}).  Note that @sc{cvs}
8473uses the @code{dead} state for its own purposes; to
8474take a file to or from the @code{dead} state use
8475commands like @code{cvs remove} and @code{cvs add}, not
8476@code{cvs admin -s}.
8477
8478@item -t[@var{file}]
8479Useful with @sc{cvs}.  Write descriptive text from the
8480contents of the named @var{file} into the RCS file,
8481deleting the existing text.  The @var{file} pathname
8482may not begin with @samp{-}.  The descriptive text can be seen in the
8483output from @samp{cvs log} (@pxref{log}).
8484There can be no space between @samp{-t} and its argument.
8485
8486If @var{file} is omitted,
8487obtain the text from standard input, terminated by
8488end-of-file or by a line containing @samp{.} by itself.
8489Prompt for the text if interaction is possible; see
8490@samp{-I}.
8491
8492@item -t-@var{string}
8493Similar to @samp{-t@var{file}}. Write descriptive text
8494from the @var{string} into the @sc{rcs} file, deleting
8495the existing text.
8496There can be no space between @samp{-t} and its argument.
8497
8498@c The rcs -T option, do not update last-mod time for
8499@c minor changes, has never been documented as a
8500@c cvs admin option.
8501
8502@item -U
8503Set locking to non-strict.  Non-strict locking means
8504that the owner of a file need not lock a revision for
8505checkin.  For use with @sc{cvs}, strict locking must be
8506set; see the discussion under the @samp{-l} option
8507above.
8508
8509@item -u[@var{rev}]
8510See the option @samp{-l} above, for a discussion of
8511using this option with @sc{cvs}.  Unlock the revision
8512with number @var{rev}.  If a branch is given, unlock
8513the latest revision on that branch.  If @var{rev} is
8514omitted, remove the latest lock held by the caller.
8515Normally, only the locker of a revision may unlock it;
8516somebody else unlocking a revision breaks the lock.
8517This causes the original locker to be sent a @code{commit}
8518notification (@pxref{Getting Notified}).
8519There can be no space between @samp{-u} and its argument.
8520
8521@item -V@var{n}
8522In previous versions of @sc{cvs}, this option meant to
8523write an @sc{rcs} file which would be acceptable to
8524@sc{rcs} version @var{n}, but it is now obsolete and
8525specifying it will produce an error.
8526@c Note that -V without an argument has never been
8527@c documented as a cvs admin option.
8528
8529@item -x@var{suffixes}
8530In previous versions of @sc{cvs}, this was documented
8531as a way of specifying the names of the @sc{rcs}
8532files.  However, @sc{cvs} has always required that the
8533@sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
8534this option has never done anything useful.
8535
8536@c The rcs -z option, to specify the timezone, has
8537@c never been documented as a cvs admin option.
8538@end table
8539
8540
8541@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8542@node checkout
8543@appendixsec checkout---Check out sources for editing
8544@cindex checkout (subcommand)
8545@cindex co (subcommand)
8546
8547@itemize @bullet
8548@item
8549Synopsis: checkout [options] modules@dots{}
8550@item
8551Requires: repository.
8552@item
8553Changes: working directory.
8554@item
8555Synonyms: co, get
8556@end itemize
8557
8558Create or update a working directory containing copies of the
8559source files specified by @var{modules}.  You must execute
8560@code{checkout} before using most of the other @sc{cvs}
8561commands, since most of them operate on your working
8562directory.
8563
8564The @var{modules} are either
8565symbolic names for some
8566collection of source directories and files, or paths to
8567directories or files in the repository.  The symbolic
8568names are defined in the @samp{modules} file.
8569@xref{modules}.
8570@c Needs an example, particularly of the non-"modules"
8571@c case but probably of both.
8572
8573@c FIXME: this seems like a very odd place to introduce
8574@c people to how CVS works.  The bit about unreserved
8575@c checkouts is also misleading as it depends on how
8576@c things are set up.
8577Depending on the modules you specify, @code{checkout} may
8578recursively create directories and populate them with
8579the appropriate source files.  You can then edit these
8580source files at any time (regardless of whether other
8581software developers are editing their own copies of the
8582sources); update them to include new changes applied by
8583others to the source repository; or commit your work as
8584a permanent change to the source repository.
8585
8586Note that @code{checkout} is used to create
8587directories.  The top-level directory created is always
8588added to the directory where @code{checkout} is
8589invoked, and usually has the same name as the specified
8590module.  In the case of a module alias, the created
8591sub-directory may have a different name, but you can be
8592sure that it will be a sub-directory, and that
8593@code{checkout} will show the relative path leading to
8594each file as it is extracted into your private work
8595area (unless you specify the @samp{-Q} global option).
8596
8597The files created by @code{checkout} are created
8598read-write, unless the @samp{-r} option to @sc{cvs}
8599(@pxref{Global options}) is specified, the
8600@code{CVSREAD} environment variable is specified
8601(@pxref{Environment variables}), or a watch is in
8602effect for that file (@pxref{Watches}).
8603
8604Note that running @code{checkout} on a directory that was already
8605built by a prior @code{checkout} is also permitted.
8606This is similar to specifying the @samp{-d} option
8607to the @code{update} command in the sense that new
8608directories that have been created in the repository
8609will appear in your work area.
8610However, @code{checkout} takes a module name whereas
8611@code{update} takes a directory name.  Also
8612to use @code{checkout} this way it must be run from the
8613top level directory (where you originally ran
8614@code{checkout} from), so before you run
8615@code{checkout} to update an existing directory, don't
8616forget to change your directory to the top level
8617directory.
8618
8619For the output produced by the @code{checkout} command
8620see @ref{update output}.
8621
8622@menu
8623* checkout options::            checkout options
8624* checkout examples::           checkout examples
8625@end menu
8626
8627@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8628@node checkout options
8629@appendixsubsec checkout options
8630
8631These standard options are supported by @code{checkout}
8632(@pxref{Common options}, for a complete description of
8633them):
8634
8635@table @code
8636@item -D @var{date}
8637Use the most recent revision no later than @var{date}.
8638This option is sticky, and implies @samp{-P}.  See
8639@ref{Sticky tags}, for more information on sticky tags/dates.
8640
8641@item -f
8642Only useful with the @samp{-D @var{date}} or @samp{-r
8643@var{tag}} flags.  If no matching revision is found,
8644retrieve the most recent revision (instead of ignoring
8645the file).
8646
8647@item -k @var{kflag}
8648Process keywords according to @var{kflag}.  See
8649@ref{Keyword substitution}.
8650This option is sticky; future updates of
8651this file in this working directory will use the same
8652@var{kflag}.  The @code{status} command can be viewed
8653to see the sticky options.  See @ref{Invoking CVS}, for
8654more information on the @code{status} command.
8655
8656@item -l
8657Local; run only in current working directory.
8658
8659@item -n
8660Do not run any checkout program (as specified
8661with the @samp{-o} option in the modules file;
8662@pxref{modules}).
8663
8664@item -P
8665Prune empty directories.  See @ref{Moving directories}.
8666
8667@item -p
8668Pipe files to the standard output.
8669
8670@item -R
8671Checkout directories recursively.  This option is on by default.
8672
8673@item -r @var{tag}
8674Use revision @var{tag}.  This option is sticky, and implies @samp{-P}.
8675See @ref{Sticky tags}, for more information on sticky tags/dates.
8676@end table
8677
8678In addition to those, you can use these special command
8679options with @code{checkout}:
8680
8681@table @code
8682@item -A
8683Reset any sticky tags, dates, or @samp{-k} options.
8684See @ref{Sticky tags}, for more information on sticky tags/dates.
8685
8686@item -c
8687Copy the module file, sorted, to the standard output,
8688instead of creating or modifying any files or
8689directories in your working directory.
8690
8691@item -d @var{dir}
8692Create a directory called @var{dir} for the working
8693files, instead of using the module name.  In general,
8694using this flag is equivalent to using @samp{mkdir
8695@var{dir}; cd @var{dir}} followed by the checkout
8696command without the @samp{-d} flag.
8697
8698There is an important exception, however.  It is very
8699convenient when checking out a single item to have the
8700output appear in a directory that doesn't contain empty
8701intermediate directories.  In this case @emph{only},
8702@sc{cvs} tries to ``shorten'' pathnames to avoid those empty
8703directories.
8704
8705For example, given a module @samp{foo} that contains
8706the file @samp{bar.c}, the command @samp{cvs co -d dir
8707foo} will create directory @samp{dir} and place
8708@samp{bar.c} inside.  Similarly, given a module
8709@samp{bar} which has subdirectory @samp{baz} wherein
8710there is a file @samp{quux.c}, the command @samp{cvs -d
8711dir co bar/baz} will create directory @samp{dir} and
8712place @samp{quux.c} inside.
8713
8714Using the @samp{-N} flag will defeat this behavior.
8715Given the same module definitions above, @samp{cvs co
8716-N -d dir foo} will create directories @samp{dir/foo}
8717and place @samp{bar.c} inside, while @samp{cvs co -N -d
8718dir bar/baz} will create directories @samp{dir/bar/baz}
8719and place @samp{quux.c} inside.
8720
8721@item -j @var{tag}
8722With two @samp{-j} options, merge changes from the
8723revision specified with the first @samp{-j} option to
8724the revision specified with the second @samp{j} option,
8725into the working directory.
8726
8727With one @samp{-j} option, merge changes from the
8728ancestor revision to the revision specified with the
8729@samp{-j} option, into the working directory.  The
8730ancestor revision is the common ancestor of the
8731revision which the working directory is based on, and
8732the revision specified in the @samp{-j} option.
8733
8734In addition, each -j option can contain an optional
8735date specification which, when used with branches, can
8736limit the chosen revision to one within a specific
8737date.  An optional date is specified by adding a colon
8738(:) to the tag:
8739@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
8740
8741@xref{Branching and merging}.
8742
8743@item -N
8744Only useful together with @samp{-d @var{dir}}.  With
8745this option, @sc{cvs} will not ``shorten'' module paths
8746in your working directory when you check out a single
8747module.  See the @samp{-d} flag for examples and a
8748discussion.
8749
8750@item -s
8751Like @samp{-c}, but include the status of all modules,
8752and sort it by the status string.  @xref{modules}, for
8753info about the @samp{-s} option that is used inside the
8754modules file to set the module status.
8755@end table
8756
8757@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8758@node checkout examples
8759@appendixsubsec checkout examples
8760
8761Get a copy of the module @samp{tc}:
8762
8763@example
8764$ cvs checkout tc
8765@end example
8766
8767Get a copy of the module @samp{tc} as it looked one day
8768ago:
8769
8770@example
8771$ cvs checkout -D yesterday tc
8772@end example
8773
8774@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8775@node commit
8776@appendixsec commit---Check files into the repository
8777@cindex commit (subcommand)
8778
8779@itemize @bullet
8780@item
8781Synopsis: commit [-lnRf] [-m 'log_message' |
8782-F file] [-r revision] [files@dots{}]
8783@item
8784Requires: working directory, repository.
8785@item
8786Changes: repository.
8787@item
8788Synonym: ci
8789@end itemize
8790
8791Use @code{commit} when you want to incorporate changes
8792from your working source files into the source
8793repository.
8794
8795If you don't specify particular files to commit, all of
8796the files in your working current directory are
8797examined.  @code{commit} is careful to change in the
8798repository only those files that you have really
8799changed.  By default (or if you explicitly specify the
8800@samp{-R} option), files in subdirectories are also
8801examined and committed if they have changed; you can
8802use the @samp{-l} option to limit @code{commit} to the
8803current directory only.
8804
8805@code{commit} verifies that the selected files are up
8806to date with the current revisions in the source
8807repository; it will notify you, and exit without
8808committing, if any of the specified files must be made
8809current first with @code{update} (@pxref{update}).
8810@code{commit} does not call the @code{update} command
8811for you, but rather leaves that for you to do when the
8812time is right.
8813
8814When all is well, an editor is invoked to allow you to
8815enter a log message that will be written to one or more
8816logging programs (@pxref{modules}, and @pxref{loginfo})
8817and placed in the @sc{rcs} file inside the
8818repository.  This log message can be retrieved with the
8819@code{log} command; see @ref{log}.  You can specify the
8820log message on the command line with the @samp{-m
8821@var{message}} option, and thus avoid the editor invocation,
8822or use the @samp{-F @var{file}} option to specify
8823that the argument file contains the log message.
8824
8825@menu
8826* commit options::              commit options
8827* commit examples::             commit examples
8828@end menu
8829
8830@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8831@node commit options
8832@appendixsubsec commit options
8833
8834These standard options are supported by @code{commit}
8835(@pxref{Common options}, for a complete description of
8836them):
8837
8838@table @code
8839@item -l
8840Local; run only in current working directory.
8841
8842@item -n
8843Do not run any module program.
8844
8845@item -R
8846Commit directories recursively.  This is on by default.
8847
8848@item -r @var{revision}
8849Commit to @var{revision}.  @var{revision} must be
8850either a branch, or a revision on the main trunk that
8851is higher than any existing revision number
8852(@pxref{Assigning revisions}).  You
8853cannot commit to a specific revision on a branch.
8854@c FIXME: Need xref for branch case.
8855@end table
8856
8857@code{commit} also supports these options:
8858
8859@table @code
8860@item -F @var{file}
8861Read the log message from @var{file}, instead
8862of invoking an editor.
8863
8864@item -f
8865Note that this is not the standard behavior of
8866the @samp{-f} option as defined in @ref{Common options}.
8867
8868Force @sc{cvs} to commit a new revision even if you haven't
8869made any changes to the file.  If the current revision
8870of @var{file} is 1.7, then the following two commands
8871are equivalent:
8872
8873@example
8874$ cvs commit -f @var{file}
8875$ cvs commit -r 1.8 @var{file}
8876@end example
8877
8878@c This is odd, but it's how CVS has worked for some
8879@c time.
8880The @samp{-f} option disables recursion (i.e., it
8881implies @samp{-l}).  To force @sc{cvs} to commit a new
8882revision for all files in all subdirectories, you must
8883use @samp{-f -R}.
8884
8885@item -m @var{message}
8886Use @var{message} as the log message, instead of
8887invoking an editor.
8888@end table
8889
8890@need 2000
8891@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8892@node commit examples
8893@appendixsubsec commit examples
8894
8895@c FIXME: this material wants to be somewhere
8896@c in "Branching and merging".
8897
8898@appendixsubsubsec Committing to a branch
8899
8900You can commit to a branch revision (one that has an
8901even number of dots) with the @samp{-r} option.  To
8902create a branch revision, use the @samp{-b} option
8903of the @code{rtag} or @code{tag} commands
8904(@pxref{Branching and merging}).  Then, either @code{checkout} or
8905@code{update} can be used to base your sources on the
8906newly created branch.  From that point on, all
8907@code{commit} changes made within these working sources
8908will be automatically added to a branch revision,
8909thereby not disturbing main-line development in any
8910way.  For example, if you had to create a patch to the
89111.2 version of the product, even though the 2.0 version
8912is already under development, you might do:
8913
8914@example
8915$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
8916$ cvs checkout -r FCS1_2_Patch product_module
8917$ cd product_module
8918[[ hack away ]]
8919$ cvs commit
8920@end example
8921
8922@noindent
8923This works automatically since the @samp{-r} option is
8924sticky.
8925
8926@appendixsubsubsec Creating the branch after editing
8927
8928Say you have been working on some extremely
8929experimental software, based on whatever revision you
8930happened to checkout last week.  If others in your
8931group would like to work on this software with you, but
8932without disturbing main-line development, you could
8933commit your change to a new branch.  Others can then
8934checkout your experimental stuff and utilize the full
8935benefit of @sc{cvs} conflict resolution.  The scenario might
8936look like:
8937
8938@c FIXME: Should we be recommending tagging the branchpoint?
8939@example
8940[[ hacked sources are present ]]
8941$ cvs tag -b EXPR1
8942$ cvs update -r EXPR1
8943$ cvs commit
8944@end example
8945
8946The @code{update} command will make the @samp{-r
8947EXPR1} option sticky on all files.  Note that your
8948changes to the files will never be removed by the
8949@code{update} command.  The @code{commit} will
8950automatically commit to the correct branch, because the
8951@samp{-r} is sticky.  You could also do like this:
8952
8953@c FIXME: Should we be recommending tagging the branchpoint?
8954@example
8955[[ hacked sources are present ]]
8956$ cvs tag -b EXPR1
8957$ cvs commit -r EXPR1
8958@end example
8959
8960@noindent
8961but then, only those files that were changed by you
8962will have the @samp{-r EXPR1} sticky flag.  If you hack
8963away, and commit without specifying the @samp{-r EXPR1}
8964flag, some files may accidentally end up on the main
8965trunk.
8966
8967To work with you on the experimental change, others
8968would simply do
8969
8970@example
8971$ cvs checkout -r EXPR1 whatever_module
8972@end example
8973
8974@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8975@node diff
8976@appendixsec diff---Show differences between revisions
8977@cindex diff (subcommand)
8978
8979@itemize @bullet
8980@item
8981Synopsis: diff [-lR] [format_options] [[-r rev1 | -D date1] [-r rev2 |  -D date2]] [files@dots{}]
8982@item
8983Requires: working directory, repository.
8984@item
8985Changes: nothing.
8986@end itemize
8987
8988The @code{diff} command is used to compare different
8989revisions of files.  The default action is to compare
8990your working files with the revisions they were based
8991on, and report any differences that are found.
8992
8993If any file names are given, only those files are
8994compared.  If any directories are given, all files
8995under them will be compared.
8996
8997The exit status for diff is different than for other
8998@sc{cvs} commands; for details @ref{Exit status}.
8999
9000@menu
9001* diff options::                diff options
9002* diff examples::               diff examples
9003@end menu
9004
9005@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9006@node diff options
9007@appendixsubsec diff options
9008
9009These standard options are supported by @code{diff}
9010(@pxref{Common options}, for a complete description of
9011them):
9012
9013@table @code
9014@item -D @var{date}
9015Use the most recent revision no later than @var{date}.
9016See @samp{-r} for how this affects the comparison.
9017
9018@item -k @var{kflag}
9019Process keywords according to @var{kflag}.  See
9020@ref{Keyword substitution}.
9021
9022@item -l
9023Local; run only in current working directory.
9024
9025@item -R
9026Examine directories recursively.  This option is on by
9027default.
9028
9029@item -r @var{tag}
9030Compare with revision @var{tag}.  Zero, one or two
9031@samp{-r} options can be present.  With no @samp{-r}
9032option, the working file will be compared with the
9033revision it was based on.  With one @samp{-r}, that
9034revision will be compared to your current working file.
9035With two @samp{-r} options those two revisions will be
9036compared (and your working file will not affect the
9037outcome in any way).
9038@c We should be a lot more explicit, with examples,
9039@c about the difference between "cvs diff" and "cvs
9040@c diff -r HEAD".  This often confuses new users.
9041
9042One or both @samp{-r} options can be replaced by a
9043@samp{-D @var{date}} option, described above.
9044@end table
9045
9046@c Conceptually, this is a disaster.  There are 3
9047@c zillion diff formats that we support via the diff
9048@c library.  It is not obvious to me that we should
9049@c document them all.  Maybe just the most common ones
9050@c like -c and -u, and think about phasing out the
9051@c obscure ones.
9052@c FIXCVS: also should be a way to specify an external
9053@c diff program (which can be different for different
9054@c file types) and pass through
9055@c arbitrary options, so that the user can do
9056@c "--pass=-Z --pass=foo" or something even if CVS
9057@c doesn't know about the "-Z foo" option to diff.
9058@c This would fit nicely with deprecating/eliminating
9059@c the obscure options of the diff library, because it
9060@c would let people specify an external GNU diff if
9061@c they are into that sort of thing.
9062The following options specify the format of the
9063output.  They have the same meaning as in GNU diff.
9064
9065@example
9066-0 -1 -2 -3 -4 -5 -6 -7 -8 -9
9067--binary
9068--brief
9069--changed-group-format=@var{arg}
9070-c
9071  -C @var{nlines}
9072  --context[=@var{lines}]
9073-e --ed
9074-t --expand-tabs
9075-f --forward-ed
9076--horizon-lines=@var{arg}
9077--ifdef=@var{arg}
9078-w --ignore-all-space
9079-B --ignore-blank-lines
9080-i --ignore-case
9081-I @var{regexp}
9082   --ignore-matching-lines=@var{regexp}
9083-h
9084-b --ignore-space-change
9085-T --initial-tab
9086-L @var{label}
9087  --label=@var{label}
9088--left-column
9089-d --minimal
9090-N --new-file
9091--new-line-format=@var{arg}
9092--old-line-format=@var{arg}
9093--paginate
9094-n --rcs
9095-s --report-identical-files
9096-p
9097--show-c-function
9098-y --side-by-side
9099-F @var{regexp}
9100--show-function-line=@var{regexp}
9101-H --speed-large-files
9102--suppress-common-lines
9103-a --text
9104--unchanged-group-format=@var{arg}
9105-u
9106  -U @var{nlines}
9107  --unified[=@var{lines}]
9108@c FIXCVS: This option is accepted by src/diff.c but
9109@c not diff/diff.c; it would appear that any attempt to
9110@c use it would get an error.
9111-V @var{arg}
9112-W @var{columns}
9113  --width=@var{columns}
9114@end example
9115
9116@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9117@node diff examples
9118@appendixsubsec diff examples
9119
9120The following line produces a Unidiff (@samp{-u} flag)
9121between revision 1.14 and 1.19 of
9122@file{backend.c}.  Due to the @samp{-kk} flag no
9123keywords are substituted, so differences that only depend
9124on keyword substitution are ignored.
9125
9126@example
9127$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
9128@end example
9129
9130Suppose the experimental branch EXPR1 was based on a
9131set of files tagged RELEASE_1_0.  To see what has
9132happened on that branch, the following can be used:
9133
9134@example
9135$ cvs diff -r RELEASE_1_0 -r EXPR1
9136@end example
9137
9138A command like this can be used to produce a context
9139diff between two releases:
9140
9141@example
9142$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
9143@end example
9144
9145If you are maintaining ChangeLogs, a command like the following
9146just before you commit your changes may help you write
9147the ChangeLog entry.  All local modifications that have
9148not yet been committed will be printed.
9149
9150@example
9151$ cvs diff -u | less
9152@end example
9153
9154@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9155@node export
9156@appendixsec export---Export sources from CVS, similar to checkout
9157@cindex export (subcommand)
9158
9159@itemize @bullet
9160@item
9161Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
9162@item
9163Requires: repository.
9164@item
9165Changes: current directory.
9166@end itemize
9167
9168This command is a variant of @code{checkout}; use it
9169when you want a copy of the source for module without
9170the @sc{cvs} administrative directories.  For example, you
9171might use @code{export} to prepare source for shipment
9172off-site.  This command requires that you specify a
9173date or tag (with @samp{-D} or @samp{-r}), so that you
9174can count on reproducing the source you ship to others
9175(and thus it always prunes empty directories).
9176
9177One often would like to use @samp{-kv} with @code{cvs
9178export}.  This causes any keywords to be
9179expanded such that an import done at some other site
9180will not lose the keyword revision information.  But be
9181aware that doesn't handle an export containing binary
9182files correctly.  Also be aware that after having used
9183@samp{-kv}, one can no longer use the @code{ident}
9184command (which is part of the @sc{rcs} suite---see
9185ident(1)) which looks for keyword strings.  If
9186you want to be able to use @code{ident} you must not
9187use @samp{-kv}.
9188
9189@menu
9190* export options::              export options
9191@end menu
9192
9193@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9194@node export options
9195@appendixsubsec export options
9196
9197These standard options are supported by @code{export}
9198(@pxref{Common options}, for a complete description of
9199them):
9200
9201@table @code
9202@item -D @var{date}
9203Use the most recent revision no later than @var{date}.
9204
9205@item -f
9206If no matching revision is found, retrieve the most
9207recent revision (instead of ignoring the file).
9208
9209@item -l
9210Local; run only in current working directory.
9211
9212@item -n
9213Do not run any checkout program.
9214
9215@item -R
9216Export directories recursively.  This is on by default.
9217
9218@item -r @var{tag}
9219Use revision @var{tag}.
9220@end table
9221
9222In addition, these options (that are common to
9223@code{checkout} and @code{export}) are also supported:
9224
9225@table @code
9226@item -d @var{dir}
9227Create a directory called @var{dir} for the working
9228files, instead of using the module name.
9229@xref{checkout options}, for complete details on how
9230@sc{cvs} handles this flag.
9231
9232@item -k @var{subst}
9233Set keyword expansion mode (@pxref{Substitution modes}).
9234
9235@item -N
9236Only useful together with @samp{-d @var{dir}}.
9237@xref{checkout options}, for complete details on how
9238@sc{cvs} handles this flag.
9239@end table
9240
9241@ignore
9242@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9243@c @node export examples
9244@appendixsubsec export examples
9245
9246Contributed examples are gratefully accepted.
9247@c -- Examples here!!
9248@end ignore
9249
9250@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9251@node history
9252@appendixsec history---Show status of files and users
9253@cindex history (subcommand)
9254
9255@itemize @bullet
9256@item
9257Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
9258@item
9259Requires: the file @file{$CVSROOT/CVSROOT/history}
9260@item
9261Changes: nothing.
9262@end itemize
9263
9264@sc{cvs} can keep a history file that tracks each use of the
9265@code{checkout}, @code{commit}, @code{rtag},
9266@code{update}, and @code{release} commands.  You can
9267use @code{history} to display this information in
9268various formats.
9269
9270Logging must be enabled by creating the file
9271@file{$CVSROOT/CVSROOT/history}.
9272
9273@strong{Warning:} @code{history} uses @samp{-f}, @samp{-l},
9274@samp{-n}, and @samp{-p} in ways that conflict with the
9275normal use inside @sc{cvs} (@pxref{Common options}).
9276
9277@menu
9278* history options::             history options
9279@end menu
9280
9281@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9282@node history options
9283@appendixsubsec history options
9284
9285Several options (shown above as @samp{-report})  control  what
9286kind of report is generated:
9287
9288@table @code
9289@item -c
9290Report on each time commit was used (i.e., each time
9291the repository was modified).
9292
9293@item -e
9294Everything (all record types).  Equivalent to
9295specifying @samp{-x} with all record types.  Of course,
9296@samp{-e} will also include record types which are
9297added in a future version of @sc{cvs}; if you are
9298writing a script which can only handle certain record
9299types, you'll want to specify @samp{-x}.
9300
9301@item -m @var{module}
9302Report on a particular module.  (You can meaningfully
9303use @samp{-m} more than once on the command line.)
9304
9305@item -o
9306Report on checked-out modules.  This is the default report type.
9307
9308@item -T
9309Report on all tags.
9310
9311@item -x @var{type}
9312Extract a particular set of record types @var{type} from the @sc{cvs}
9313history.  The types are indicated by single letters,
9314which you may specify in combination.
9315
9316Certain commands have a single record type:
9317
9318@table @code
9319@item F
9320release
9321@item O
9322checkout
9323@item E
9324export
9325@item T
9326rtag
9327@end table
9328
9329@noindent
9330One of four record types may result from an update:
9331
9332@table @code
9333@item C
9334A merge was necessary but collisions were
9335detected (requiring manual merging).
9336@item G
9337A merge was necessary and it succeeded.
9338@item U
9339A working file was copied from the repository.
9340@item W
9341The working copy of a file was deleted during
9342update (because it was gone from the repository).
9343@end table
9344
9345@noindent
9346One of three record types results from commit:
9347
9348@table @code
9349@item A
9350A file was added for the first time.
9351@item M
9352A file was modified.
9353@item R
9354A file was removed.
9355@end table
9356@end table
9357
9358The options shown as @samp{-flags} constrain or expand
9359the report without requiring option arguments:
9360
9361@table @code
9362@item -a
9363Show data for all users (the default is to show data
9364only for the user executing @code{history}).
9365
9366@item -l
9367Show last modification only.
9368
9369@item -w
9370Show only the records for modifications done from the
9371same working directory where @code{history} is
9372executing.
9373@end table
9374
9375The options shown as @samp{-options @var{args}} constrain the report
9376based on an argument:
9377
9378@table @code
9379@item -b @var{str}
9380Show data back to a record containing  the  string
9381@var{str}  in  either the module name, the file name, or
9382the repository path.
9383
9384@item -D @var{date}
9385Show data since @var{date}.  This is slightly different
9386from the normal use of @samp{-D @var{date}}, which
9387selects the newest revision older than @var{date}.
9388
9389@item -f @var{file}
9390Show data for a particular file
9391(you can specify several @samp{-f} options on the same command line).
9392This is equivalent to specifying the file on the command line.
9393
9394@item -n @var{module}
9395Show data for a particular module
9396(you can specify several @samp{-n} options on the same command line).
9397
9398@item -p @var{repository}
9399Show data for a particular source repository  (you
9400can specify several @samp{-p} options on the same command
9401line).
9402
9403@item -r @var{rev}
9404Show records referring to revisions since the revision
9405or tag named @var{rev} appears in individual @sc{rcs}
9406files.  Each @sc{rcs} file is searched for the revision or
9407tag.
9408
9409@item -t @var{tag}
9410Show records since tag @var{tag} was last added to the
9411history file.  This differs from the @samp{-r} flag
9412above in that it reads only the history file, not the
9413@sc{rcs} files, and is much faster.
9414
9415@item -u @var{name}
9416Show records for user @var{name}.
9417
9418@item -z @var{timezone}
9419Show times in the selected records using the specified
9420time zone instead of UTC.
9421@end table
9422
9423@ignore
9424@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9425@c @node history examples
9426@appendixsubsec history examples
9427
9428Contributed examples will gratefully be accepted.
9429@c -- Examples here!
9430@end ignore
9431
9432@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9433@node import
9434@appendixsec import---Import sources into CVS, using vendor branches
9435@cindex import (subcommand)
9436
9437@c FIXME: This node is way too long for one which has subnodes.
9438
9439@itemize @bullet
9440@item
9441Synopsis: import [-options] repository vendortag releasetag@dots{}
9442@item
9443Requires: Repository, source distribution directory.
9444@item
9445Changes: repository.
9446@end itemize
9447
9448Use @code{import} to incorporate an entire source
9449distribution from an outside source (e.g., a source
9450vendor) into your source repository directory.  You can
9451use this command both for initial creation of a
9452repository, and for wholesale updates to the module
9453from the outside source.  @xref{Tracking sources}, for
9454a discussion on this subject.
9455
9456The @var{repository} argument gives a directory name
9457(or a path to a directory) under the @sc{cvs} root directory
9458for repositories; if the directory did not exist,
9459import creates it.
9460
9461When you use import for updates to source that has been
9462modified in your source repository (since a prior
9463import), it will notify you of any files that conflict
9464in the two branches of development; use @samp{checkout
9465-j} to reconcile the differences, as import instructs
9466you to do.
9467
9468If @sc{cvs} decides a file should be ignored
9469(@pxref{cvsignore}), it does not import it and prints
9470@samp{I } followed by the filename (@pxref{import output}, for a
9471complete description of the output).
9472
9473If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
9474any file whose names match the specifications in that
9475file will be treated as packages and the appropriate
9476filtering will be performed on the file/directory
9477before being imported.  @xref{Wrappers}.
9478
9479The outside source is saved in a first-level
9480branch, by default 1.1.1.  Updates are leaves of this
9481branch; for example, files from the first imported
9482collection of source will be revision 1.1.1.1, then
9483files from the first imported update will be revision
94841.1.1.2, and so on.
9485
9486At least three arguments are required.
9487@var{repository} is needed to identify the collection
9488of source.  @var{vendortag} is a tag for the entire
9489branch (e.g., for 1.1.1).  You must also specify at
9490least one @var{releasetag} to identify the files at
9491the leaves created each time you execute @code{import}.
9492
9493@c I'm not completely sure this belongs here.  But
9494@c we need to say it _somewhere_ reasonably obvious; it
9495@c is a common misconception among people first learning CVS
9496Note that @code{import} does @emph{not} change the
9497directory in which you invoke it.  In particular, it
9498does not set up that directory as a @sc{cvs} working
9499directory; if you want to work with the sources import
9500them first and then check them out into a different
9501directory (@pxref{Getting the source}).
9502
9503@menu
9504* import options::              import options
9505* import output::               import output
9506* import examples::             import examples
9507@end menu
9508
9509@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9510@node import options
9511@appendixsubsec import options
9512
9513This standard option is supported by @code{import}
9514(@pxref{Common options}, for a complete description):
9515
9516@table @code
9517@item -m @var{message}
9518Use @var{message} as log information, instead of
9519invoking an editor.
9520@end table
9521
9522There are the following additional special options.
9523
9524@table @code
9525@item -b @var{branch}
9526See @ref{Multiple vendor branches}.
9527
9528@item -k @var{subst}
9529Indicate the keyword expansion mode desired.  This
9530setting will apply to all files created during the
9531import, but not to any files that previously existed in
9532the repository.  See @ref{Substitution modes}, for a
9533list of valid @samp{-k} settings.
9534
9535@item -I @var{name}
9536Specify file names that should be ignored during
9537import.  You can use this option repeatedly.  To avoid
9538ignoring any files at all (even those ignored by
9539default), specify `-I !'.
9540
9541@var{name} can be a file name pattern of the same type
9542that you can specify in the @file{.cvsignore} file.
9543@xref{cvsignore}.
9544@c -- Is this really true?
9545
9546@item -W @var{spec}
9547Specify file names that should be filtered during
9548import.  You can use this option repeatedly.
9549
9550@var{spec} can be a file name pattern of the same type
9551that you can specify in the @file{.cvswrappers}
9552file. @xref{Wrappers}.
9553@end table
9554
9555@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9556@node import output
9557@appendixsubsec import output
9558
9559@code{import} keeps you informed of its progress by printing a line
9560for each file, preceded by one character indicating the status of the file:
9561
9562@table @code
9563@item U @var{file}
9564The file already exists in the repository and has not been locally
9565modified; a new revision has been created (if necessary).
9566
9567@item N @var{file}
9568The file is a new file which has been added to the repository.
9569
9570@item C @var{file}
9571The file already exists in the repository but has been locally modified;
9572you will have to merge the changes.
9573
9574@item I @var{file}
9575The file is being ignored (@pxref{cvsignore}).
9576
9577@cindex Symbolic link, importing
9578@cindex Link, symbolic, importing
9579@c FIXME: also (somewhere else) probably
9580@c should be documenting what happens if you "cvs add"
9581@c a symbolic link.  Also maybe what happens if
9582@c you manually create symbolic links within the
9583@c repository (? - not sure why we'd want to suggest
9584@c doing that).
9585@item L @var{file}
9586The file is a symbolic link; @code{cvs import} ignores symbolic links.
9587People periodically suggest that this behavior should
9588be changed, but if there is a consensus on what it
9589should be changed to, it doesn't seem to be apparent.
9590(Various options in the @file{modules} file can be used
9591to recreate symbolic links on checkout, update, etc.;
9592@pxref{modules}.)
9593@end table
9594
9595@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9596@node import examples
9597@appendixsubsec import examples
9598
9599See @ref{Tracking sources}, and @ref{From files}.
9600
9601@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9602@node log
9603@appendixsec log---Print out log information for files
9604@cindex log (subcommand)
9605
9606@itemize @bullet
9607@item
9608Synopsis: log [options] [files@dots{}]
9609@item
9610Requires: repository, working directory.
9611@item
9612Changes: nothing.
9613@end itemize
9614
9615Display log information for files.  @code{log} used to
9616call the @sc{rcs} utility @code{rlog}.  Although this
9617is no longer true in the current sources, this history
9618determines the format of the output and the options,
9619which are not quite in the style of the other @sc{cvs}
9620commands.
9621
9622@cindex Timezone, in output
9623@cindex Zone, time, in output
9624@c Kind of a funny place to document the timezone used
9625@c in output from commands other than @code{log}.
9626@c There is also more we need to say about this,
9627@c including what happens in a client/server environment.
9628The output includes the location of the @sc{rcs} file,
9629the @dfn{head} revision (the latest revision on the
9630trunk), all symbolic names (tags) and some other
9631things.  For each revision, the revision number, the
9632author, the number of lines added/deleted and the log
9633message are printed.  All times are displayed in
9634Coordinated Universal Time (UTC).  (Other parts of
9635@sc{cvs} print times in the local timezone).
9636@c FIXCVS: need a better way to control the timezone
9637@c used in output.  Previous/current versions of CVS did/do
9638@c sometimes support -z in RCSINIT, and/or an
9639@c undocumented (except by reference to 'rlog') -z option
9640@c to cvs log, but this has not been a consistent,
9641@c documented feature.  Perhaps a new global option,
9642@c where LT means the client's timezone, which the
9643@c client then communicates to the server, is the
9644@c right solution.
9645
9646@strong{Warning:} @code{log} uses @samp{-R} in a way that conflicts
9647with the normal use inside @sc{cvs} (@pxref{Common options}).
9648
9649@menu
9650* log options::                 log options
9651* log examples::                log examples
9652@end menu
9653
9654@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9655@node log options
9656@appendixsubsec log options
9657
9658By default, @code{log} prints all information that is
9659available.  All other options restrict the output.
9660
9661@table @code
9662@item -b
9663Print information about the revisions on the default
9664branch, normally the highest branch on the trunk.
9665
9666@item -d @var{dates}
9667Print information about revisions with a checkin
9668date/time in the range given by the
9669semicolon-separated list of dates.  The date formats
9670accepted are those accepted by the @samp{-D} option to
9671many other @sc{cvs} commands (@pxref{Common options}).
9672Dates can be combined into ranges as follows:
9673
9674@c Should we be thinking about accepting ISO8601
9675@c ranges?  For example "1972-09-10/1972-09-12".
9676@table @code
9677@item @var{d1}<@var{d2}
9678@itemx @var{d2}>@var{d1}
9679Select the revisions that were deposited between
9680@var{d1} and @var{d2}.
9681
9682@item <@var{d}
9683@itemx @var{d}>
9684Select all revisions dated @var{d} or earlier.
9685
9686@item @var{d}<
9687@itemx >@var{d}
9688Select all revisions dated @var{d} or later.
9689
9690@item @var{d}
9691Select the single, latest revision dated @var{d} or
9692earlier.
9693@end table
9694
9695The @samp{>} or @samp{<} characters may be followed by
9696@samp{=} to indicate an inclusive range rather than an
9697exclusive one.
9698
9699Note that the separator is a semicolon (;).
9700
9701@item -h
9702Print only the name of the @sc{rcs} file, name
9703of the file in the working directory, head,
9704default branch, access list, locks, symbolic names, and
9705suffix.
9706
9707@item -l
9708Local; run only in current working directory.  (Default
9709is to run recursively).
9710
9711@item -N
9712Do not print the list of tags for this file.  This
9713option can be very useful when your site uses a lot of
9714tags, so rather than "more"'ing over 3 pages of tag
9715information, the log information is presented without
9716tags at all.
9717
9718@item -R
9719Print only the name of the @sc{rcs} file.
9720
9721@c Note that using a bare revision (in addition to not
9722@c being explicitly documented here) is potentially
9723@c confusing; it shows the log message to get from the
9724@c previous revision to that revision.  "-r1.3 -r1.6"
9725@c (equivalent to "-r1.3,1.6") is even worse; it
9726@c prints the messages to get from 1.2 to 1.3 and 1.5
9727@c to 1.6.  By analogy with "cvs diff", users might
9728@c expect that it is more like specifying a range.
9729@c It is not 100% clear to me how much of this should
9730@c be documented (for example, multiple -r options
9731@c perhaps could/should be deprecated given the false
9732@c analogy with "cvs diff").
9733@c In general, this section should be rewritten to talk
9734@c about messages to get from revision rev1 to rev2,
9735@c rather than messages for revision rev2 (that is, the
9736@c messages are associated with a change not a static
9737@c revision and failing to make this distinction causes
9738@c much confusion).
9739@item -r@var{revisions}
9740Print information about revisions given in the
9741comma-separated list @var{revisions} of revisions and
9742ranges.  The following table explains the available
9743range formats:
9744
9745@table @code
9746@item @var{rev1}:@var{rev2}
9747Revisions @var{rev1} to @var{rev2} (which must be on
9748the same branch).
9749
9750@item @var{rev1}::@var{rev2}
9751Revisions between, but not including, @var{rev1} and @var{rev2}.
9752
9753@item :@var{rev}
9754Revisions from the beginning of the branch up to
9755and including @var{rev}.
9756
9757@item ::@var{rev}
9758Revisions from the beginning of the branch up to,
9759but not including, @var{rev}.
9760
9761@item @var{rev}:
9762Revisions starting with @var{rev} to the end of the
9763branch containing @var{rev}.
9764
9765@item @var{rev}:
9766Revisions starting just after @var{rev} to the end of the
9767branch containing @var{rev}.
9768
9769@item @var{branch}
9770An argument that is a branch means all revisions on
9771that branch.
9772
9773@item @var{branch1}:@var{branch2}
9774@itemx @var{branch1}::@var{branch2}
9775A range of branches means all revisions
9776on the branches in that range.
9777
9778@item @var{branch}.
9779The latest revision in @var{branch}.
9780@end table
9781
9782A bare @samp{-r} with no revisions means the latest
9783revision on the default branch, normally the trunk.
9784There can be no space between the @samp{-r} option and
9785its argument.
9786
9787@item -s @var{states}
9788Print information about revisions whose state
9789attributes match one of the states given in the
9790comma-separated list @var{states}.
9791
9792@item -t
9793Print the same as @samp{-h}, plus the descriptive text.
9794
9795@item -w@var{logins}
9796Print information about revisions checked in by users
9797with login names appearing in the comma-separated list
9798@var{logins}.  If @var{logins} is omitted, the user's
9799login is assumed.  There can be no space between the
9800@samp{-w} option and its argument.
9801@end table
9802
9803@code{log} prints the intersection of the revisions
9804selected with the options @samp{-d}, @samp{-s}, and
9805@samp{-w}, intersected with the union of the revisions
9806selected by @samp{-b} and @samp{-r}.
9807
9808@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9809@node log examples
9810@appendixsubsec log examples
9811
9812Contributed examples are gratefully accepted.
9813
9814@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9815@node rdiff
9816@appendixsec rdiff---'patch' format diffs between releases
9817@cindex rdiff (subcommand)
9818
9819@itemize @bullet
9820@item
9821rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
9822@item
9823Requires: repository.
9824@item
9825Changes: nothing.
9826@item
9827Synonym: patch
9828@end itemize
9829
9830Builds a Larry Wall format patch(1) file between two
9831releases, that can be fed directly into the @code{patch}
9832program to bring an old release up-to-date with the new
9833release.  (This is one of the few @sc{cvs} commands that
9834operates directly from the repository, and doesn't
9835require a prior checkout.) The diff output is sent to
9836the standard output device.
9837
9838You can specify (using the standard @samp{-r} and
9839@samp{-D} options) any combination of one or two
9840revisions or dates.  If only one revision or date is
9841specified, the patch file reflects differences between
9842that revision or date and the current head revisions in
9843the @sc{rcs} file.
9844
9845Note that if the software release affected is contained
9846in more than one directory, then it may be necessary to
9847specify the @samp{-p} option to the @code{patch} command when
9848patching the old sources, so that @code{patch} is able to find
9849the files that are located in other directories.
9850
9851@menu
9852* rdiff options::               rdiff options
9853* rdiff examples::              rdiff examples
9854@end menu
9855
9856@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9857@node rdiff options
9858@appendixsubsec rdiff options
9859
9860These standard options are supported by @code{rdiff}
9861(@pxref{Common options}, for a complete description of
9862them):
9863
9864@table @code
9865@item -D @var{date}
9866Use the most recent revision no later than @var{date}.
9867
9868@item -f
9869If no matching revision is found, retrieve the most
9870recent revision (instead of ignoring the file).
9871
9872@item -l
9873Local; don't descend subdirectories.
9874
9875@item -R
9876Examine directories recursively.  This option is on by default.
9877
9878@item -r @var{tag}
9879Use revision @var{tag}.
9880@end table
9881
9882In addition to the above, these options are available:
9883
9884@table @code
9885@item -c
9886Use the context diff format.  This is the default format.
9887
9888@item -s
9889Create a summary change report instead of a patch.  The
9890summary includes information about files that were
9891changed or added between the releases.  It is sent to
9892the standard output device.  This is useful for finding
9893out, for example, which files have changed between two
9894dates or revisions.
9895
9896@item -t
9897A diff of the top two revisions is sent to the standard
9898output device.  This is most useful for seeing what the
9899last change to a file was.
9900
9901@item -u
9902Use the unidiff format for the context diffs.
9903Remember that old versions
9904of the @code{patch} program can't handle the unidiff
9905format, so if you plan to post this patch to the net
9906you should probably not use @samp{-u}.
9907
9908@item -V @var{vn}
9909Expand keywords according to the rules current in
9910@sc{rcs} version @var{vn} (the expansion format changed with
9911@sc{rcs} version 5).  Note that this option is no
9912longer accepted.  @sc{cvs} will always expand keywords the
9913way that @sc{rcs} version 5 does.
9914@end table
9915
9916@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9917@node rdiff examples
9918@appendixsubsec rdiff examples
9919
9920Suppose you receive mail from @t{foo@@example.net} asking for an
9921update from release 1.2 to 1.4 of the tc compiler.  You
9922have no such patches on hand, but with @sc{cvs} that can
9923easily be fixed with a command such as this:
9924
9925@example
9926$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
9927$$ Mail -s 'The patches you asked for' foo@@example.net
9928@end example
9929
9930Suppose you have made release 1.3, and forked a branch
9931called @samp{R_1_3fix} for bugfixes.  @samp{R_1_3_1}
9932corresponds to release 1.3.1, which was made some time
9933ago.  Now, you want to see how much development has been
9934done on the branch.  This command can be used:
9935
9936@example
9937$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
9938cvs rdiff: Diffing module-name
9939File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
9940File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
9941File bar.h,v changed from revision 1.29.2.1 to 1.2
9942@end example
9943
9944@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9945@node release
9946@appendixsec release---Indicate that a Module is no longer in use
9947@cindex release (subcommand)
9948
9949@itemize @bullet
9950@item
9951release [-d] directories@dots{}
9952@item
9953Requires: Working directory.
9954@item
9955Changes: Working directory, history log.
9956@end itemize
9957
9958This command is meant to safely cancel the effect of
9959@samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
9960isn't strictly necessary to use this command.  You can
9961always simply delete your working directory, if you
9962like; but you risk losing changes you may have
9963forgotten, and you leave no trace in the @sc{cvs} history
9964file (@pxref{history file}) that you've abandoned your
9965checkout.
9966
9967Use @samp{cvs release} to avoid these problems.  This
9968command checks that no uncommitted changes are
9969present; that you are executing it from immediately
9970above a @sc{cvs} working directory; and that the repository
9971recorded for your files is the same as the repository
9972defined in the module database.
9973
9974If all these conditions are true, @samp{cvs release}
9975leaves a record of its execution (attesting to your
9976intentionally abandoning your checkout) in the @sc{cvs}
9977history log.
9978
9979@menu
9980* release options::             release options
9981* release output::              release output
9982* release examples::            release examples
9983@end menu
9984
9985@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9986@node release options
9987@appendixsubsec release options
9988
9989The @code{release} command supports one command option:
9990
9991@table @code
9992@item -d
9993Delete your working copy of the file if the release
9994succeeds.  If this flag is not given your files will
9995remain in your working directory.
9996
9997@strong{Warning:}  The @code{release} command deletes
9998all directories and files recursively.  This
9999has the very serious side-effect that any directory
10000that you have created inside your checked-out sources,
10001and not added to the repository (using the @code{add}
10002command; @pxref{Adding files}) will be silently deleted---even
10003if it is non-empty!
10004@end table
10005
10006@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10007@node release output
10008@appendixsubsec release output
10009
10010Before @code{release} releases your sources it will
10011print a one-line message for any file that is not
10012up-to-date.
10013
10014@strong{Warning:}  Any new directories that you have
10015created, but not added to the @sc{cvs} directory hierarchy
10016with the @code{add} command (@pxref{Adding files}) will be
10017silently ignored (and deleted, if @samp{-d} is
10018specified), even if they contain files.
10019@c FIXCVS: This is a bug.  But is it true?  I think
10020@c maybe they print "? dir" now.
10021
10022@table @code
10023@item U @var{file}
10024@itemx P @var{file}
10025There exists a newer revision of this file in the
10026repository, and you have not modified your local copy
10027of the file (@samp{U} and @samp{P} mean the same thing).
10028
10029@item A @var{file}
10030The file has been added to your private copy of the
10031sources, but has not yet been committed to the
10032repository.  If you delete your copy of the sources
10033this file will be lost.
10034
10035@item R @var{file}
10036The file has been removed from your private copy of the
10037sources, but has not yet been removed from the
10038repository, since you have not yet committed the
10039removal.  @xref{commit}.
10040
10041@item M @var{file}
10042The file is modified in your working directory.  There
10043might also be a newer revision inside the repository.
10044
10045@item ? @var{file}
10046@var{file} is in your working directory, but does not
10047correspond to anything in the source repository, and is
10048not in the list of files for @sc{cvs} to ignore (see the
10049description of the @samp{-I} option, and
10050@pxref{cvsignore}).  If you remove your working
10051sources, this file will be lost.
10052@end table
10053
10054@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10055@node release examples
10056@appendixsubsec release examples
10057
10058Release the @file{tc} directory, and delete your local working copy
10059of the files.
10060
10061@example
10062$ cd ..         # @r{You must stand immediately above the}
10063                # @r{sources when you issue @samp{cvs release}.}
10064$ cvs release -d tc
10065You have [0] altered files in this repository.
10066Are you sure you want to release (and delete) directory `tc': y
10067$
10068@end example
10069
10070@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10071@node update
10072@appendixsec update---Bring work tree in sync with repository
10073@cindex update (subcommand)
10074
10075@itemize @bullet
10076@item
10077update [-AdflPpR] [-d] [-r tag|-D date] files@dots{}
10078@item
10079Requires: repository, working directory.
10080@item
10081Changes: working directory.
10082@end itemize
10083
10084After you've run checkout to create your private copy
10085of source from the common repository, other developers
10086will continue changing the central source.  From time
10087to time, when it is convenient in your development
10088process, you can use the @code{update} command from
10089within your working directory to reconcile your work
10090with any revisions applied to the source repository
10091since your last checkout or update.
10092
10093@menu
10094* update options::              update options
10095* update output::               update output
10096@end menu
10097
10098@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10099@node update options
10100@appendixsubsec update options
10101
10102These standard options are available with @code{update}
10103(@pxref{Common options}, for a complete description of
10104them):
10105
10106@table @code
10107@item -D date
10108Use the most recent revision no later than @var{date}.
10109This option is sticky, and implies @samp{-P}.
10110See @ref{Sticky tags}, for more information on sticky tags/dates.
10111
10112@item -f
10113Only useful with the @samp{-D @var{date}} or @samp{-r
10114@var{tag}} flags.  If no matching revision is found,
10115retrieve the most recent revision (instead of ignoring
10116the file).
10117
10118@item -k @var{kflag}
10119Process keywords according to @var{kflag}.  See
10120@ref{Keyword substitution}.
10121This option is sticky; future updates of
10122this file in this working directory will use the same
10123@var{kflag}.  The @code{status} command can be viewed
10124to see the sticky options.  See @ref{Invoking CVS}, for
10125more information on the @code{status} command.
10126
10127@item -l
10128Local; run only in current working directory.  @xref{Recursive behavior}.
10129
10130@item -P
10131Prune empty directories.  See @ref{Moving directories}.
10132
10133@item -p
10134Pipe files to the standard output.
10135
10136@item -R
10137Update directories recursively (default).  @xref{Recursive
10138behavior}.
10139
10140@item -r rev
10141Retrieve revision/tag @var{rev}.  This option is sticky,
10142and implies @samp{-P}.
10143See @ref{Sticky tags}, for more information on sticky tags/dates.
10144@end table
10145
10146@need 800
10147These special options are also available with
10148@code{update}.
10149
10150@table @code
10151@item -A
10152Reset any sticky tags, dates, or @samp{-k} options.
10153See @ref{Sticky tags}, for more information on sticky tags/dates.
10154
10155@item -C
10156Overwrite locally modified files with clean copies from
10157the repository (the modified file is saved in
10158@file{.#@var{file}.@var{revision}}, however).
10159
10160@item -d
10161Create any directories that exist in the repository if
10162they're missing from the working directory.  Normally,
10163@code{update} acts only on directories and files that
10164were already enrolled in your working directory.
10165
10166This is useful for updating directories that were
10167created in the repository since the initial checkout;
10168but it has an unfortunate side effect.  If you
10169deliberately avoided certain directories in the
10170repository when you created your working directory
10171(either through use of a module name or by listing
10172explicitly the files and directories you wanted on the
10173command line), then updating with @samp{-d} will create
10174those directories, which may not be what you want.
10175
10176@item -I @var{name}
10177Ignore files whose names match @var{name} (in your
10178working directory) during the update.  You can specify
10179@samp{-I} more than once on the command line to specify
10180several files to ignore.  Use @samp{-I !} to avoid
10181ignoring any files at all.  @xref{cvsignore}, for other
10182ways to make @sc{cvs} ignore some files.
10183
10184@item -W@var{spec}
10185Specify file names that should be filtered during
10186update.  You can use this option repeatedly.
10187
10188@var{spec} can be a file name pattern of the same type
10189that you can specify in the @file{.cvswrappers}
10190file. @xref{Wrappers}.
10191
10192@item -j@var{revision}
10193With two @samp{-j} options, merge changes from the
10194revision specified with the first @samp{-j} option to
10195the revision specified with the second @samp{j} option,
10196into the working directory.
10197
10198With one @samp{-j} option, merge changes from the
10199ancestor revision to the revision specified with the
10200@samp{-j} option, into the working directory.  The
10201ancestor revision is the common ancestor of the
10202revision which the working directory is based on, and
10203the revision specified in the @samp{-j} option.
10204
10205Note that using a single @samp{-j @var{tagname}} option rather than
10206@samp{-j @var{branchname}} to merge changes from a branch will
10207often not remove files which were removed on the branch.
10208@xref{Merging adds and removals}, for more.
10209
10210In addition, each @samp{-j} option can contain an optional
10211date specification which, when used with branches, can
10212limit the chosen revision to one within a specific
10213date.  An optional date is specified by adding a colon
10214(:) to the tag:
10215@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
10216
10217@xref{Branching and merging}.
10218
10219@end table
10220
10221@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10222@node update output
10223@appendixsubsec update output
10224
10225@code{update} and @code{checkout} keep you informed of
10226their progress by printing a line for each file, preceded
10227by one character indicating the status of the file:
10228
10229@table @code
10230@item U @var{file}
10231The file was brought up to date with respect to the
10232repository.  This is done for any file that exists in
10233the repository but not in your source, and for files
10234that you haven't changed but are not the most recent
10235versions available in the repository.
10236
10237@item P @var{file}
10238Like @samp{U}, but the @sc{cvs} server sends a patch
10239instead of an entire file.  These two things accomplish
10240the same thing.
10241
10242@item A @var{file}
10243The file has been added to your private copy of the
10244sources, and will be added to the source repository
10245when you run @code{commit} on the file.  This is a
10246reminder to you that the file needs to be committed.
10247
10248@item R @var{file}
10249The file has been removed from your private copy of the
10250sources, and will be removed from the source repository
10251when you run @code{commit} on the file.  This is a
10252reminder to you that the file needs to be committed.
10253
10254@item M @var{file}
10255The file is modified in  your  working  directory.
10256
10257@samp{M} can indicate one of two states for a file
10258you're working on: either there were no modifications
10259to the same file in the repository, so that your file
10260remains as you last saw it; or there were modifications
10261in the repository as well as in your copy, but they
10262were merged successfully, without conflict, in your
10263working directory.
10264
10265@sc{cvs} will print some messages if it merges your work,
10266and a backup copy of your working file (as it looked
10267before you ran @code{update}) will be made.  The exact
10268name of that file is printed while @code{update} runs.
10269
10270@item C @var{file}
10271@cindex .# files
10272@cindex __ files (VMS)
10273A conflict was detected while trying to merge your
10274changes to @var{file} with changes from the source
10275repository.  @var{file} (the copy in your working
10276directory) is now the result of attempting to merge
10277the two revisions; an unmodified copy of your file
10278is also in your working directory, with the name
10279@file{.#@var{file}.@var{revision}} where @var{revision}
10280is the revision that your modified file started
10281from.  Resolve the conflict as described in
10282@ref{Conflicts example}.
10283@c "some systems" as in out-of-the-box OSes?  Not as
10284@c far as I know.  We need to advise sysadmins as well
10285@c as users how to set up this kind of purge, if that is
10286@c what they want.
10287@c We also might want to think about cleaner solutions,
10288@c like having CVS remove the .# file once the conflict
10289@c has been resolved or something like that.
10290(Note that some systems automatically purge
10291files that begin with @file{.#} if they have not been
10292accessed for a few days.  If you intend to keep a copy
10293of your original file, it is a very good idea to rename
10294it.)  Under @sc{vms}, the file name starts with
10295@file{__} rather than @file{.#}.
10296
10297@item ? @var{file}
10298@var{file} is in your working directory, but does not
10299correspond to anything in the source repository, and is
10300not in the list of files for @sc{cvs} to ignore (see the
10301description of the @samp{-I} option, and
10302@pxref{cvsignore}).
10303@end table
10304
10305@node Invoking CVS
10306@appendix Quick reference to CVS commands
10307@cindex Command reference
10308@cindex Reference, commands
10309@cindex Invoking CVS
10310
10311This appendix describes how to invoke @sc{cvs}, with
10312references to where each command or feature is
10313described in detail.  For other references run the
10314@code{cvs --help} command, or see @ref{Index}.
10315
10316A @sc{cvs} command looks like:
10317
10318@example
10319cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
10320@end example
10321
10322Global options:
10323
10324@table @code
10325@item --allow-root=@var{rootdir}
10326Specify legal @sc{cvsroot} directory (server only) (not
10327in @sc{cvs} 1.9 and older).  See @ref{Password
10328authentication server}.
10329
10330@item -a
10331Authenticate all communication (client only) (not in @sc{cvs}
103321.9 and older).  See @ref{Global options}.
10333
10334@item -b
10335Specify RCS location (@sc{cvs} 1.9 and older).  See
10336@ref{Global options}.
10337
10338@item -d @var{root}
10339Specify the @sc{cvsroot}.  See @ref{Repository}.
10340
10341@item -e @var{editor}
10342Edit messages with @var{editor}.  See @ref{Committing
10343your changes}.
10344
10345@item -f
10346Do not read the @file{~/.cvsrc} file.  See @ref{Global
10347options}.
10348
10349@item -H
10350@itemx --help
10351Print a help message.  See @ref{Global options}.
10352
10353@item -l
10354Do not log in @file{$CVSROOT/CVSROOT/history} file.  See @ref{Global
10355options}.
10356
10357@item -n
10358Do not change any files.  See @ref{Global options}.
10359
10360@item -Q
10361Be really quiet.  See @ref{Global options}.
10362
10363@item -q
10364Be somewhat quiet.  See @ref{Global options}.
10365
10366@item -r
10367Make new working files read-only.  See @ref{Global options}.
10368
10369@item -s @var{variable}=@var{value}
10370Set a user variable.  See @ref{Variables}.
10371
10372@item -T @var{tempdir}
10373Put temporary files in @var{tempdir}.  See @ref{Global
10374options}.
10375
10376@item -t
10377Trace @sc{cvs} execution.  See @ref{Global options}.
10378
10379@item -v
10380@item --version
10381Display version and copyright information for @sc{cvs}.
10382
10383@item -w
10384Make new working files read-write.  See @ref{Global
10385options}.
10386
10387@item -x
10388Encrypt all communication (client only).
10389See @ref{Global options}.
10390
10391@item -z @var{gzip-level}
10392@cindex Compression
10393@cindex Gzip
10394Set the compression level (client only).
10395See @ref{Global options}.
10396@end table
10397
10398Keyword expansion modes (@pxref{Substitution modes}):
10399
10400@example
10401-kkv  $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
10402-kkvl $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
10403-kk   $@asis{}Id$
10404-kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
10405-ko   @i{no expansion}
10406-kb   @i{no expansion, file is binary}
10407@end example
10408
10409Keywords (@pxref{Keyword list}):
10410
10411@example
10412$@asis{}Author: joe $
10413$@asis{}Date: 1993/12/09 03:21:13 $
10414$@asis{}Header: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
10415$@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
10416$@asis{}Locker: harry $
10417$@asis{}Name: snapshot_1_14 $
10418$@asis{}RCSfile: file1,v $
10419$@asis{}Revision: 1.1 $
10420$@asis{}Source: /home/files/file1,v $
10421$@asis{}State: Exp $
10422$@asis{}Log: file1,v $
10423Revision 1.1  1993/12/09 03:30:17  joe
10424Initial revision
10425
10426@end example
10427
10428@c The idea behind this table is that we want each item
10429@c to be a sentence or two at most.  Preferably a
10430@c single line.
10431@c
10432@c In some cases refs to "foo options" are just to get
10433@c this thing written quickly, not because the "foo
10434@c options" node is really the best place to point.
10435Commands, command options, and command arguments:
10436
10437@table @code
10438@item add [@var{options}] [@var{files}@dots{}]
10439Add a new file/directory.  See @ref{Adding files}.
10440
10441@table @code
10442@item -k @var{kflag}
10443Set keyword expansion.
10444
10445@item -m @var{msg}
10446Set file description.
10447@end table
10448
10449@item admin [@var{options}] [@var{files}@dots{}]
10450Administration of history files in the repository.  See
10451@ref{admin}.
10452@c This list omits those options which are not
10453@c documented as being useful with CVS.  That might be
10454@c a mistake...
10455
10456@table @code
10457@item -b[@var{rev}]
10458Set default branch.  See @ref{Reverting local changes}.
10459
10460@item -c@var{string}
10461Set comment leader.
10462
10463@item -k@var{subst}
10464Set keyword substitution.  See @ref{Keyword
10465substitution}.
10466
10467@item -l[@var{rev}]
10468Lock revision @var{rev}, or latest revision.
10469
10470@item -m@var{rev}:@var{msg}
10471Replace the log message of revision @var{rev} with
10472@var{msg}.
10473
10474@item -o@var{range}
10475Delete revisions from the repository.  See
10476@ref{admin options}.
10477
10478@item -q
10479Run quietly; do not print diagnostics.
10480
10481@item -s@var{state}[:@var{rev}]
10482Set the state.
10483
10484@c Does not work for client/server CVS
10485@item -t
10486Set file description from standard input.
10487
10488@item -t@var{file}
10489Set file description from @var{file}.
10490
10491@item -t-@var{string}
10492Set file description to @var{string}.
10493
10494@item -u[@var{rev}]
10495Unlock revision @var{rev}, or latest revision.
10496@end table
10497
10498@item annotate [@var{options}] [@var{files}@dots{}]
10499Show last revision where each line was modified.  See
10500@ref{annotate}.
10501
10502@table @code
10503@item -D @var{date}
10504Annotate the most recent revision no later than
10505@var{date}.  See @ref{Common options}.
10506
10507@item -f
10508Use head revision if tag/date not found.  See
10509@ref{Common options}.
10510
10511@item -l
10512Local; run only in current working directory.  @xref{Recursive behavior}.
10513
10514@item -R
10515Operate recursively (default).  @xref{Recursive
10516behavior}.
10517
10518@item -r @var{tag}
10519Annotate revision @var{tag}.  See @ref{Common options}.
10520@end table
10521
10522@item checkout [@var{options}] @var{modules}@dots{}
10523Get a copy of the sources.  See @ref{checkout}.
10524
10525@table @code
10526@item -A
10527Reset any sticky tags/date/options.  See @ref{Sticky
10528tags} and @ref{Keyword substitution}.
10529
10530@item -c
10531Output the module database.  See @ref{checkout options}.
10532
10533@item -D @var{date}
10534Check out revisions as of @var{date} (is sticky).  See
10535@ref{Common options}.
10536
10537@item -d @var{dir}
10538Check out into @var{dir}.  See @ref{checkout options}.
10539
10540@item -f
10541Use head revision if tag/date not found.  See
10542@ref{Common options}.
10543
10544@c Probably want to use rev1/rev2 style like for diff
10545@c -r.  Here and in on-line help.
10546@item -j @var{rev}
10547Merge in changes.  See @ref{checkout options}.
10548
10549@item -k @var{kflag}
10550Use @var{kflag} keyword expansion.  See
10551@ref{Substitution modes}.
10552
10553@item -l
10554Local; run only in current working directory.  @xref{Recursive behavior}.
10555
10556@item -N
10557Don't ``shorten'' module paths if -d specified.  See
10558@ref{checkout options}.
10559
10560@item -n
10561Do not run module program (if any).  See @ref{checkout options}.
10562
10563@item -P
10564Prune empty directories.  See @ref{Moving directories}.
10565
10566@item -p
10567Check out files to standard output (avoids
10568stickiness).  See @ref{checkout options}.
10569
10570@item -R
10571Operate recursively (default).  @xref{Recursive
10572behavior}.
10573
10574@item -r @var{tag}
10575Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
10576
10577@item -s
10578Like -c, but include module status.  See @ref{checkout options}.
10579@end table
10580
10581@item commit [@var{options}] [@var{files}@dots{}]
10582Check changes into the repository.  See @ref{commit}.
10583
10584@table @code
10585@item -F @var{file}
10586Read log message from @var{file}.  See @ref{commit options}.
10587
10588@item -f
10589@c What is this "disables recursion"?  It is from the
10590@c on-line help; is it documented in this manual?
10591Force the file to be committed; disables recursion.
10592See @ref{commit options}.
10593
10594@item -l
10595Local; run only in current working directory.  See @ref{Recursive behavior}.
10596
10597@item -m @var{msg}
10598Use @var{msg} as log message.  See @ref{commit options}.
10599
10600@item -n
10601Do not run module program (if any).  See @ref{commit options}.
10602
10603@item -R
10604Operate recursively (default).  @xref{Recursive
10605behavior}.
10606
10607@item -r @var{rev}
10608Commit to @var{rev}.  See @ref{commit options}.
10609@c FIXME: should be dragging over text from
10610@c commit options, especially if it can be cleaned up
10611@c and made concise enough.
10612@end table
10613
10614@item diff [@var{options}] [@var{files}@dots{}]
10615Show differences between revisions.  See @ref{diff}.
10616In addition to the options shown below, accepts a wide
10617variety of options to control output style, for example
10618@samp{-c} for context diffs.
10619
10620@table @code
10621@item -D @var{date1}
10622Diff revision for date against working file.  See
10623@ref{diff options}.
10624
10625@item -D @var{date2}
10626Diff @var{rev1}/@var{date1} against @var{date2}.  See
10627@ref{diff options}.
10628
10629@item -l
10630Local; run only in current working directory.  See @ref{Recursive behavior}.
10631
10632@item -N
10633Include diffs for added and removed files.  See
10634@ref{diff options}.
10635
10636@item -R
10637Operate recursively (default).  @xref{Recursive
10638behavior}.
10639
10640@item -r @var{rev1}
10641Diff revision for @var{rev1} against working file.  See
10642@ref{diff options}.
10643
10644@item -r @var{rev2}
10645Diff @var{rev1}/@var{date1} against @var{rev2}.  See @ref{diff options}.
10646@end table
10647
10648@item edit [@var{options}] [@var{files}@dots{}]
10649Get ready to edit a watched file.  See @ref{Editing files}.
10650
10651@table @code
10652@item -a @var{actions}
10653Specify actions for temporary watch, where
10654@var{actions} is @code{edit}, @code{unedit},
10655@code{commit}, @code{all}, or @code{none}.  See
10656@ref{Editing files}.
10657
10658@item -l
10659Local; run only in current working directory.  See @ref{Recursive behavior}.
10660
10661@item -R
10662Operate recursively (default).  @xref{Recursive
10663behavior}.
10664@end table
10665
10666@item editors [@var{options}] [@var{files}@dots{}]
10667See who is editing a watched file.  See @ref{Watch information}.
10668
10669@table @code
10670@item -l
10671Local; run only in current working directory.  See @ref{Recursive behavior}.
10672
10673@item -R
10674Operate recursively (default).  @xref{Recursive
10675behavior}.
10676@end table
10677
10678@item export [@var{options}] @var{modules}@dots{}
10679Export files from @sc{cvs}.  See @ref{export}.
10680
10681@table @code
10682@item -D @var{date}
10683Check out revisions as of @var{date}.  See
10684@ref{Common options}.
10685
10686@item -d @var{dir}
10687Check out into @var{dir}.  See @ref{export options}.
10688
10689@item -f
10690Use head revision if tag/date not found.  See
10691@ref{Common options}.
10692
10693@item -k @var{kflag}
10694Use @var{kflag} keyword expansion.  See
10695@ref{Substitution modes}.
10696
10697@item -l
10698Local; run only in current working directory.  @xref{Recursive behavior}.
10699
10700@item -N
10701Don't ``shorten'' module paths if -d specified.  See
10702@ref{export options}.
10703
10704@item -n
10705Do not run module program (if any).  See @ref{export options}.
10706
10707@item -P
10708Prune empty directories.  See @ref{Moving directories}.
10709
10710@item -R
10711Operate recursively (default).  @xref{Recursive
10712behavior}.
10713
10714@item -r @var{tag}
10715Checkout revision @var{tag}.  See @ref{Common options}.
10716@end table
10717
10718@item history [@var{options}] [@var{files}@dots{}]
10719Show repository access history.  See @ref{history}.
10720
10721@table @code
10722@item -a
10723All users (default is self).  See @ref{history options}.
10724
10725@item -b @var{str}
10726Back to record with @var{str} in module/file/repos
10727field.  See @ref{history options}.
10728
10729@item -c
10730Report on committed (modified) files.  See @ref{history options}.
10731
10732@item -D @var{date}
10733Since @var{date}.  See @ref{history options}.
10734
10735@item -e
10736Report on all record types.  See @ref{history options}.
10737
10738@item -l
10739Last modified (committed or modified report).  See @ref{history options}.
10740
10741@item -m @var{module}
10742Report on @var{module} (repeatable).  See @ref{history
10743options}.
10744
10745@item -n @var{module}
10746In @var{module}.  See @ref{history options}.
10747
10748@item -o
10749Report on checked out modules.  See @ref{history options}.
10750
10751@item -r @var{rev}
10752Since revision @var{rev}.  See @ref{history options}.
10753
10754@item -T
10755@c What the @#$@# is a TAG?  Same as a tag?  This
10756@c wording is also in the online-line help.
10757Produce report on all TAGs.  See @ref{history options}.
10758
10759@item -t @var{tag}
10760Since tag record placed in history file (by anyone).
10761See @ref{history options}.
10762
10763@item -u @var{user}
10764For user @var{user} (repeatable).  See @ref{history
10765options}.
10766
10767@item -w
10768Working directory must match.  See @ref{history options}.
10769
10770@item -x @var{types}
10771Report on @var{types}, one or more of
10772@code{TOEFWUCGMAR}.  See @ref{history options}.
10773
10774@item -z @var{zone}
10775Output for time zone @var{zone}.  See @ref{history
10776options}.
10777@end table
10778
10779@item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
10780Import files into @sc{cvs}, using vendor branches.  See
10781@ref{import}.
10782
10783@table @code
10784@item -b @var{bra}
10785Import to vendor branch @var{bra}.  See
10786@ref{Multiple vendor branches}.
10787
10788@item -d
10789Use the file's modification time as the time of
10790import.  See @ref{import options}.
10791
10792@item -k @var{kflag}
10793Set default keyword substitution mode.  See
10794@ref{import options}.
10795
10796@item -m @var{msg}
10797Use @var{msg} for log message.  See
10798@ref{import options}.
10799
10800@item -I @var{ign}
10801More files to ignore (! to reset).  See
10802@ref{import options}.
10803
10804@item -W @var{spec}
10805More wrappers.  See @ref{import options}.
10806@end table
10807
10808@item init
10809Create a @sc{cvs} repository if it doesn't exist.  See
10810@ref{Creating a repository}.
10811
10812@item log [@var{options}] [@var{files}@dots{}]
10813Print out history information for files.  See @ref{log}.
10814
10815@table @code
10816@item -b
10817Only list revisions on the default branch.  See @ref{log options}.
10818
10819@item -d @var{dates}
10820Specify dates (@var{d1}<@var{d2} for range, @var{d} for
10821latest before).  See @ref{log options}.
10822
10823@item -h
10824Only print header.  See @ref{log options}.
10825
10826@item -l
10827Local; run only in current working directory.  See @ref{Recursive behavior}.
10828
10829@item -N
10830Do not list tags.  See @ref{log options}.
10831
10832@item -R
10833Only print name of RCS file.  See @ref{log options}.
10834
10835@item -r@var{revs}
10836Only list revisions @var{revs}.  See @ref{log options}.
10837
10838@item -s @var{states}
10839Only list revisions with specified states.  See @ref{log options}.
10840
10841@item -t
10842Only print header and descriptive text.  See @ref{log
10843options}.
10844
10845@item -w@var{logins}
10846Only list revisions checked in by specified logins.  See @ref{log options}.
10847@end table
10848
10849@item login
10850Prompt for password for authenticating server.  See
10851@ref{Password authentication client}.
10852
10853@item logout
10854Remove stored password for authenticating server.  See
10855@ref{Password authentication client}.
10856
10857@item rdiff [@var{options}] @var{modules}@dots{}
10858Show differences between releases.  See @ref{rdiff}.
10859
10860@table @code
10861@item -c
10862Context diff output format (default).  See @ref{rdiff options}.
10863
10864@item -D @var{date}
10865Select revisions based on @var{date}.  See @ref{Common options}.
10866
10867@item -f
10868Use head revision if tag/date not found.  See
10869@ref{Common options}.
10870
10871@item -l
10872Local; run only in current working directory.  See @ref{Recursive behavior}.
10873
10874@item -R
10875Operate recursively (default).  @xref{Recursive
10876behavior}.
10877
10878@item -r @var{rev}
10879Select revisions based on @var{rev}.  See @ref{Common options}.
10880
10881@item -s
10882Short patch - one liner per file.  See @ref{rdiff options}.
10883
10884@item -t
10885Top two diffs - last change made to the file.  See
10886@ref{diff options}.
10887
10888@item -u
10889Unidiff output format.  See @ref{rdiff options}.
10890
10891@item -V @var{vers}
10892Use RCS Version @var{vers} for keyword expansion (obsolete).  See
10893@ref{rdiff options}.
10894@end table
10895
10896@item release [@var{options}] @var{directory}
10897Indicate that a directory is no longer in use.  See
10898@ref{release}.
10899
10900@table @code
10901@item -d
10902Delete the given directory.  See @ref{release options}.
10903@end table
10904
10905@item remove [@var{options}] [@var{files}@dots{}]
10906Remove an entry from the repository.  See @ref{Removing files}.
10907
10908@table @code
10909@item -f
10910Delete the file before removing it.  See @ref{Removing files}.
10911
10912@item -l
10913Local; run only in current working directory.  See @ref{Recursive behavior}.
10914
10915@item -R
10916Operate recursively (default).  @xref{Recursive
10917behavior}.
10918@end table
10919
10920@item rtag [@var{options}] @var{tag} @var{modules}@dots{}
10921Add a symbolic tag to a module.
10922See @ref{Revisions} and @ref{Branching and merging}.
10923
10924@table @code
10925@item -a
10926Clear tag from removed files that would not otherwise
10927be tagged.  See @ref{Tagging add/remove}.
10928
10929@item -b
10930Create a branch named @var{tag}.  See @ref{Branching and merging}.
10931
10932@item -D @var{date}
10933Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
10934
10935@item -d
10936Delete @var{tag}.  See @ref{Modifying tags}.
10937
10938@item -F
10939Move @var{tag} if it already exists.  See @ref{Modifying tags}.
10940
10941@item -f
10942Force a head revision match if tag/date not found.
10943See @ref{Tagging by date/tag}.
10944
10945@item -l
10946Local; run only in current working directory.  See @ref{Recursive behavior}.
10947
10948@item -n
10949No execution of tag program.  See @ref{Common options}.
10950
10951@item -R
10952Operate recursively (default).  @xref{Recursive
10953behavior}.
10954
10955@item -r @var{rev}
10956Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
10957@end table
10958
10959@item status [@var{options}] @var{files}@dots{}
10960Display status information in a working directory.  See
10961@ref{File status}.
10962
10963@table @code
10964@item -l
10965Local; run only in current working directory.  See @ref{Recursive behavior}.
10966
10967@item -R
10968Operate recursively (default).  @xref{Recursive
10969behavior}.
10970
10971@item -v
10972Include tag information for file.  See @ref{Tags}.
10973@end table
10974
10975@item tag [@var{options}] @var{tag} [@var{files}@dots{}]
10976Add a symbolic tag to checked out version of files.
10977See @ref{Revisions} and @ref{Branching and merging}.
10978
10979@table @code
10980@item -b
10981Create a branch named @var{tag}.  See @ref{Branching and merging}.
10982
10983@item -c
10984Check that working files are unmodified.  See
10985@ref{Tagging the working directory}.
10986
10987@item -D @var{date}
10988Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
10989
10990@item -d
10991Delete @var{tag}.  See @ref{Modifying tags}.
10992
10993@item -F
10994Move @var{tag} if it already exists.  See @ref{Modifying tags}.
10995
10996@item -f
10997Force a head revision match if tag/date not found.
10998See @ref{Tagging by date/tag}.
10999
11000@item -l
11001Local; run only in current working directory.  See @ref{Recursive behavior}.
11002
11003@item -R
11004Operate recursively (default).  @xref{Recursive
11005behavior}.
11006
11007@item -r @var{rev}
11008Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
11009@end table
11010
11011@item unedit [@var{options}] [@var{files}@dots{}]
11012Undo an edit command.  See @ref{Editing files}.
11013
11014@table @code
11015@item -a @var{actions}
11016Specify actions for temporary watch, where
11017@var{actions} is @code{edit}, @code{unedit},
11018@code{commit}, @code{all}, or @code{none}.  See
11019@ref{Editing files}.
11020
11021@item -l
11022Local; run only in current working directory.  See @ref{Recursive behavior}.
11023
11024@item -R
11025Operate recursively (default).  @xref{Recursive
11026behavior}.
11027@end table
11028
11029@item update [@var{options}] [@var{files}@dots{}]
11030Bring work tree in sync with repository.  See
11031@ref{update}.
11032
11033@table @code
11034@item -A
11035Reset any sticky tags/date/options.  See @ref{Sticky
11036tags} and @ref{Keyword substitution}.
11037
11038@item -C
11039Overwrite locally modified files with clean copies from
11040the repository (the modified file is saved in
11041@file{.#@var{file}.@var{revision}}, however).
11042
11043@item -D @var{date}
11044Check out revisions as of @var{date} (is sticky).  See
11045@ref{Common options}.
11046
11047@item -d
11048Create directories.  See @ref{update options}.
11049
11050@item -f
11051Use head revision if tag/date not found.  See
11052@ref{Common options}.
11053
11054@item -I @var{ign}
11055More files to ignore (! to reset).  See
11056@ref{import options}.
11057
11058@c Probably want to use rev1/rev2 style like for diff
11059@c -r.  Here and in on-line help.
11060@item -j @var{rev}
11061Merge in changes.  See @ref{update options}.
11062
11063@item -k @var{kflag}
11064Use @var{kflag} keyword expansion.  See
11065@ref{Substitution modes}.
11066
11067@item -l
11068Local; run only in current working directory.  @xref{Recursive behavior}.
11069
11070@item -P
11071Prune empty directories.  See @ref{Moving directories}.
11072
11073@item -p
11074Check out files to standard output (avoids
11075stickiness).  See @ref{update options}.
11076
11077@item -R
11078Operate recursively (default).  @xref{Recursive
11079behavior}.
11080
11081@item -r @var{tag}
11082Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11083
11084@item -W @var{spec}
11085More wrappers.  See @ref{import options}.
11086@end table
11087
11088@item version
11089@cindex version (subcommand)
11090
11091Display the version of @sc{cvs} being used.  If the repository
11092is remote, display both the client and server versions.
11093
11094@item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
11095
11096on/off: turn on/off read-only checkouts of files.  See
11097@ref{Setting a watch}.
11098
11099add/remove: add or remove notification on actions.  See
11100@ref{Getting Notified}.
11101
11102@table @code
11103@item -a @var{actions}
11104Specify actions for temporary watch, where
11105@var{actions} is @code{edit}, @code{unedit},
11106@code{commit}, @code{all}, or @code{none}.  See
11107@ref{Editing files}.
11108
11109@item -l
11110Local; run only in current working directory.  See @ref{Recursive behavior}.
11111
11112@item -R
11113Operate recursively (default).  @xref{Recursive
11114behavior}.
11115@end table
11116
11117@item watchers [@var{options}] [@var{files}@dots{}]
11118See who is watching a file.  See @ref{Watch information}.
11119
11120@table @code
11121@item -l
11122Local; run only in current working directory.  See @ref{Recursive behavior}.
11123
11124@item -R
11125Operate recursively (default).  @xref{Recursive
11126behavior}.
11127@end table
11128
11129@end table
11130
11131@c ---------------------------------------------------------------------
11132@node Administrative files
11133@appendix Reference manual for Administrative files
11134@cindex Administrative files (reference)
11135@cindex Files, reference manual
11136@cindex Reference manual (files)
11137@cindex CVSROOT (file)
11138
11139@c FIXME?  Somewhere there needs to be a more "how-to"
11140@c guide to writing these.  I think the triggers
11141@c (commitinfo, loginfo, taginfo, &c) are perhaps a
11142@c different case than files like modules.  One
11143@c particular issue that people sometimes are
11144@c (unnecessarily?) worried about is performance, and
11145@c the impact of writing in perl or sh or ____.
11146Inside the repository, in the directory
11147@file{$CVSROOT/CVSROOT}, there are a number of
11148supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
11149fashion without any of them, but if they are set up
11150properly they can help make life easier.  For a
11151discussion of how to edit them, see @ref{Intro
11152administrative files}.
11153
11154The most important of these files is the @file{modules}
11155file, which defines the modules inside the repository.
11156
11157@menu
11158* modules::                     Defining modules
11159* Wrappers::                    Specify binary-ness based on file name
11160* commit files::                The commit support files
11161* commitinfo::                  Pre-commit checking
11162* verifymsg::                   How are log messages evaluated?
11163* editinfo::                    Specifying how log messages are created
11164                                (obsolete)
11165* loginfo::                     Where should log messages be sent?
11166* rcsinfo::                     Templates for the log messages
11167* cvsignore::                   Ignoring files via cvsignore
11168* checkoutlist::                Adding your own administrative files
11169* history file::                History information
11170* Variables::                   Various variables are expanded
11171* config::                      Miscellaneous CVS configuration
11172@end menu
11173
11174@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11175@node modules
11176@appendixsec The modules file
11177@cindex Modules (admin file)
11178@cindex Defining modules (reference manual)
11179
11180The @file{modules} file records your definitions of
11181names for collections of source code.  @sc{cvs} will
11182use these definitions if you use @sc{cvs} to update the
11183modules file (use normal commands like @code{add},
11184@code{commit}, etc).
11185
11186The @file{modules} file may contain blank lines and
11187comments (lines beginning with @samp{#}) as well as
11188module definitions.  Long lines can be continued on the
11189next line by specifying a backslash (@samp{\}) as the
11190last character on the line.
11191
11192There are three basic types of modules: alias modules,
11193regular modules, and ampersand modules.  The difference
11194between them is the way that they map files in the
11195repository to files in the working directory.  In all
11196of the following examples, the top-level repository
11197contains a directory called @file{first-dir}, which
11198contains two files, @file{file1} and @file{file2}, and a
11199directory @file{sdir}.  @file{first-dir/sdir} contains
11200a file @file{sfile}.
11201
11202@c FIXME: should test all the examples in this section.
11203
11204@menu
11205* Alias modules::             The simplest kind of module
11206* Regular modules::
11207* Ampersand modules::
11208* Excluding directories::     Excluding directories from a module
11209* Module options::            Regular and ampersand modules can take options
11210* Module program options::    How the modules ``program options'' programs
11211                              are run.
11212@end menu
11213
11214@node Alias modules
11215@appendixsubsec Alias modules
11216@cindex Alias modules
11217@cindex -a, in modules file
11218
11219Alias modules are the simplest kind of module:
11220
11221@table @code
11222@item @var{mname} -a @var{aliases}@dots{}
11223This represents the simplest way of defining a module
11224@var{mname}.  The @samp{-a} flags the definition as a
11225simple alias: @sc{cvs} will treat any use of @var{mname} (as
11226a command argument) as if the list of names
11227@var{aliases} had been specified instead.
11228@var{aliases} may contain either other module names or
11229paths.  When you use paths in aliases, @code{checkout}
11230creates all intermediate directories in the working
11231directory, just as if the path had been specified
11232explicitly in the @sc{cvs} arguments.
11233@end table
11234
11235For example, if the modules file contains:
11236
11237@example
11238amodule -a first-dir
11239@end example
11240
11241@noindent
11242then the following two commands are equivalent:
11243
11244@example
11245$ cvs co amodule
11246$ cvs co first-dir
11247@end example
11248
11249@noindent
11250and they each would provide output such as:
11251
11252@example
11253cvs checkout: Updating first-dir
11254U first-dir/file1
11255U first-dir/file2
11256cvs checkout: Updating first-dir/sdir
11257U first-dir/sdir/sfile
11258@end example
11259
11260@node Regular modules
11261@appendixsubsec Regular modules
11262@cindex Regular modules
11263
11264@table @code
11265@item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
11266In the simplest case, this form of module definition
11267reduces to @samp{@var{mname} @var{dir}}.  This defines
11268all the files in directory @var{dir} as module mname.
11269@var{dir} is a relative path (from @code{$CVSROOT}) to a
11270directory of source in the source repository.  In this
11271case, on checkout, a single directory called
11272@var{mname} is created as a working directory; no
11273intermediate directory levels are used by default, even
11274if @var{dir} was a path involving several directory
11275levels.
11276@end table
11277
11278For example, if a module is defined by:
11279
11280@example
11281regmodule first-dir
11282@end example
11283
11284@noindent
11285then regmodule will contain the files from first-dir:
11286
11287@example
11288$ cvs co regmodule
11289cvs checkout: Updating regmodule
11290U regmodule/file1
11291U regmodule/file2
11292cvs checkout: Updating regmodule/sdir
11293U regmodule/sdir/sfile
11294$
11295@end example
11296
11297By explicitly specifying files in the module definition
11298after @var{dir}, you can select particular files from
11299directory @var{dir}.  Here is
11300an example:
11301
11302@example
11303regfiles first-dir/sdir sfile
11304@end example
11305
11306@noindent
11307With this definition, getting the regfiles module
11308will create a single working directory
11309@file{regfiles} containing the file listed, which
11310comes from a directory deeper
11311in the @sc{cvs} source repository:
11312
11313@example
11314$ cvs co regfiles
11315U regfiles/sfile
11316$
11317@end example
11318
11319@node Ampersand modules
11320@appendixsubsec Ampersand modules
11321@cindex Ampersand modules
11322@cindex &, in modules file
11323
11324A module definition can refer to other modules by
11325including @samp{&@var{module}} in its definition.
11326@example
11327@var{mname} [ options ] @var{&module}@dots{}
11328@end example
11329
11330Then getting the module creates a subdirectory for each such
11331module, in the directory containing the module.  For
11332example, if modules contains
11333
11334@example
11335ampermod &first-dir
11336@end example
11337
11338then a checkout will create an @code{ampermod} directory
11339which contains a directory called @code{first-dir},
11340which in turns contains all the directories and files
11341which live there.  For example, the command
11342
11343@example
11344$ cvs co ampermod
11345@end example
11346
11347@noindent
11348will create the following files:
11349
11350@example
11351ampermod/first-dir/file1
11352ampermod/first-dir/file2
11353ampermod/first-dir/sdir/sfile
11354@end example
11355
11356There is one quirk/bug: the messages that @sc{cvs}
11357prints omit the @file{ampermod}, and thus do not
11358correctly display the location to which it is checking
11359out the files:
11360
11361@example
11362$ cvs co ampermod
11363cvs checkout: Updating first-dir
11364U first-dir/file1
11365U first-dir/file2
11366cvs checkout: Updating first-dir/sdir
11367U first-dir/sdir/sfile
11368$
11369@end example
11370
11371Do not rely on this buggy behavior; it may get fixed in
11372a future release of @sc{cvs}.
11373
11374@c FIXCVS: What happens if regular and & modules are
11375@c combined, as in "ampermodule first-dir &second-dir"?
11376@c When I tried it, it seemed to just ignore the
11377@c "first-dir".  I think perhaps it should be an error
11378@c (but this needs further investigation).
11379@c In addition to discussing what each one does, we
11380@c should put in a few words about why you would use one or
11381@c the other in various situations.
11382
11383@node Excluding directories
11384@appendixsubsec Excluding directories
11385@cindex Excluding directories, in modules file
11386@cindex !, in modules file
11387
11388An alias module may exclude particular directories from
11389other modules by using an exclamation mark (@samp{!})
11390before the name of each directory to be excluded.
11391
11392For example, if the modules file contains:
11393
11394@example
11395exmodule -a !first-dir/sdir first-dir
11396@end example
11397
11398then checking out the module @samp{exmodule} will check
11399out everything in @samp{first-dir} except any files in
11400the subdirectory @samp{first-dir/sdir}.
11401@c Note that the "!first-dir/sdir" sometimes must be listed
11402@c before "first-dir".  That seems like a probable bug, in which
11403@c case perhaps it should be fixed (to allow either
11404@c order) rather than documented.  See modules4 in testsuite.
11405
11406@node Module options
11407@appendixsubsec Module options
11408@cindex Options, in modules file
11409
11410Either regular modules or ampersand modules can contain
11411options, which supply additional information concerning
11412the module.
11413
11414@table @code
11415@cindex -d, in modules file
11416@item -d @var{name}
11417Name the working directory something other than the
11418module name.
11419@c FIXME: Needs a bunch of examples, analogous to the
11420@c examples for alias, regular, and ampersand modules
11421@c which show where the files go without -d.
11422
11423@cindex Export program
11424@cindex -e, in modules file
11425@item -e @var{prog}
11426Specify a program @var{prog} to run whenever files in a
11427module are exported.  @var{prog} runs with a single
11428argument, the module name.
11429@c FIXME: Is it run on server? client?
11430
11431@cindex Checkin program
11432@cindex -i, in modules file
11433@item -i @var{prog}
11434Specify a program @var{prog} to run whenever files in a
11435module are committed.  @var{prog} runs with a single
11436argument, the full pathname of the affected directory
11437in a source repository.  The @file{commitinfo},
11438@file{loginfo}, and @file{verifymsg} files provide other
11439ways to call a program on commit.
11440@c FIXME: Is it run on server? client?
11441
11442@cindex Checkout program
11443@cindex -o, in modules file
11444@item -o @var{prog}
11445Specify a program @var{prog} to run whenever files in a
11446module are checked out.  @var{prog} runs with a single
11447argument, the module name.
11448@c FIXME: Is it run on server? client?
11449
11450@cindex Status of a module
11451@cindex Module status
11452@cindex -s, in modules file
11453@item -s @var{status}
11454Assign a status to the module.  When the module file is
11455printed with @samp{cvs checkout -s} the modules are
11456sorted according to primarily module status, and
11457secondarily according to the module name.  This option
11458has no other meaning.  You can use this option for
11459several things besides status: for instance, list the
11460person that is responsible for this module.
11461
11462@cindex Tag program
11463@cindex -t, in modules file
11464@item -t @var{prog}
11465Specify a program @var{prog} to run whenever files in a
11466module are tagged with @code{rtag}.  @var{prog} runs
11467with two arguments: the module name and the symbolic
11468tag specified to @code{rtag}.  It is not run
11469when @code{tag} is executed.  Generally you will find
11470that taginfo is a better solution (@pxref{user-defined logging}).
11471@c FIXME: Is it run on server? client?
11472@c Problems with -t include:
11473@c * It is run after the tag not before
11474@c * It doesn't get passed all the information that
11475@c   taginfo does ("mov", &c).
11476@c * It only is run for rtag, not tag.
11477
11478@cindex Update program
11479@cindex -u, in modules file
11480@item -u @var{prog}
11481Specify a program @var{prog} to run whenever @samp{cvs
11482update} is executed from the top-level directory of the
11483checked-out module.  @var{prog} runs with a single
11484argument, the full path to the source repository for
11485this module.
11486@c FIXME: Is it run on server? client?
11487@c One drawback of -u and -i are that CVS/Update.prog
11488@c and CVS/Checkin.prog only get updated on initial
11489@c checkout, and don't get updated if the modules file
11490@c changes.  Also, the user can edit them, which means
11491@c they are no good for security-type stuff.
11492@end table
11493
11494You should also see @pxref{Module program options} about how the
11495``program options'' programs are run.
11496
11497@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11498
11499@node Module program options
11500@appendixsubsec How the modules file ``program options'' programs are run
11501@cindex Modules file program options
11502@cindex -u, in modules file
11503@cindex -t, in modules file
11504@cindex -o, in modules file
11505@cindex -i, in modules file
11506@cindex -e, in modules file
11507
11508@noindent
11509For checkout, rtag, and export, the program is server-based, and as such the
11510following applies:-
11511
11512If using remote access methods (pserver, ext, etc.),
11513@sc{cvs} will execute this program on the server from a temporary
11514directory. The path is searched for this program.
11515
11516If using ``local access'' (on a local or remote NFS filesystem, i.e.
11517repository set just to a path),
11518the program will be executed from the newly checked-out tree, if
11519found there, or alternatively searched for in the path if not.
11520
11521@noindent
11522The commit and update programs are locally-based, and are run as
11523follows:-
11524
11525The program is always run locally. One must
11526re-checkout the tree one is using if these options are updated in the
11527modules administrative file. The file CVS/Checkin.prog contains the
11528value of the option `-i' set in the modules file, and similarly for
11529the file CVS/Update.prog and `-u'. The program is always executed from
11530the top level of the checked-out copy on the client. Again, the program
11531is first searched for in the checked-out copy and then using the path.
11532
11533The programs are all run after the operation has effectively
11534completed.
11535
11536
11537@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11538@node Wrappers
11539@appendixsec The cvswrappers file
11540@cindex cvswrappers (admin file)
11541@cindex CVSWRAPPERS, environment variable
11542@cindex Wrappers
11543
11544@c FIXME: need some better way of separating this out
11545@c by functionality.  -t/-f is one feature, -m is
11546@c another, and -k is a third.  And this discussion
11547@c should be better motivated (e.g. start with the
11548@c problems, then explain how the feature solves it).
11549
11550Wrappers refers to a @sc{cvs} feature which lets you
11551control certain settings based on the name of the file
11552which is being operated on.  The settings are @samp{-k}
11553for binary files, and @samp{-m} for nonmergeable text
11554files.
11555
11556@ignore
11557Wrappers allow you to set a hook which transforms files on
11558their way in and out of @sc{cvs}.
11559
11560The file @file{cvswrappers} defines the script that will be
11561run on a file when its name matches a regular
11562expression. There are two scripts that can be run on a
11563file or directory. One script is executed on the file/directory
11564before being checked into the repository (this is denoted
11565with the @code{-t} flag) and the other when the file is
11566checked out of the repository (this is denoted with the
11567@code{-f} flag).  The @samp{-t}/@samp{-f} feature does
11568not work with client/server @sc{cvs}.
11569@c I think maybe -t/-f works client/server if a single
11570@c file converts to/from a single file, as opposed to
11571@c the file<->directory case.  Could use more
11572@c investigation...
11573@end ignore
11574
11575The @samp{-m} option
11576specifies the merge methodology that should be used when
11577a non-binary file is updated.  @code{MERGE} means the usual
11578@sc{cvs} behavior: try to merge the files.  @code{COPY}
11579means that @code{cvs update} will refuse to merge
11580files, as it also does for files specified as binary
11581with @samp{-kb} (but if the file is specified as
11582binary, there is no need to specify @samp{-m 'COPY'}).
11583@sc{cvs} will provide the user with the
11584two versions of the files, and require the user using
11585mechanisms outside @sc{cvs}, to insert any necessary
11586changes.  @strong{WARNING}: do not use @code{COPY} with
11587@sc{cvs} 1.9 or earlier--such versions of @sc{cvs} will
11588copy one version of your file over the other, wiping
11589out the previous contents.
11590@c Ordinarily we don't document the behavior of old
11591@c versions.  But this one is so dangerous, I think we
11592@c must.  I almost renamed it to -m 'NOMERGE' so we
11593@c could say "never use -m 'COPY'".
11594The @samp{-m} wrapper option only affects behavior when
11595merging is done on update; it does not affect how files
11596are stored.  See @ref{Binary files}, for more on
11597binary files.
11598
11599The basic format of the file @file{cvswrappers} is:
11600
11601@c FIXME: @example is all wrong for this.  Use @deffn or
11602@c something more sensible.
11603@example
11604wildcard     [option value][option value]...
11605
11606where option is one of
11607@ignore
11608-f           from cvs filter         value: path to filter
11609-t           to cvs filter           value: path to filter
11610@end ignore
11611-m           update methodology      value: MERGE or COPY
11612-k           keyword expansion       value: expansion mode
11613
11614and value is a single-quote delimited value.
11615@end example
11616
11617@ignore
11618@example
11619*.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
11620*.c      -t 'indent %s %s'
11621@end example
11622@c When does the filter need to be an absolute pathname
11623@c and when will something like the above work?  I
11624@c suspect it relates to the PATH of the server (which
11625@c in turn depends on all kinds of stuff, e.g. inetd
11626@c for pserver).  I'm not sure whether/where to discuss
11627@c this.
11628@c FIXME: What do the %s's stand for?
11629
11630@noindent
11631The above example of a @file{cvswrappers} file
11632states that all files/directories that end with a @code{.nib}
11633should be filtered with the @file{wrap} program before
11634checking the file into the repository. The file should
11635be filtered though the @file{unwrap} program when the
11636file is checked out of the repository. The
11637@file{cvswrappers} file also states that a @code{COPY}
11638methodology should be used when updating the files in
11639the repository (that is, no merging should be performed).
11640
11641@c What pitfalls arise when using indent this way?  Is
11642@c it a winning thing to do?  Would be nice to at least
11643@c hint at those issues; we want our examples to tell
11644@c how to solve problems, not just to say that cvs can
11645@c do certain things.
11646The last example line says that all files that end with
11647@code{.c} should be filtered with @file{indent}
11648before being checked into the repository. Unlike the previous
11649example, no filtering of the @code{.c} file is done when
11650it is checked out of the repository.
11651@noindent
11652The @code{-t} filter is called with two arguments,
11653the first is the name of the file/directory to filter
11654and the second is the pathname to where the resulting
11655filtered file should be placed.
11656
11657@noindent
11658The @code{-f} filter is called with one argument,
11659which is the name of the file to filter from. The end
11660result of this filter will be a file in the users directory
11661that they can work on as they normally would.
11662
11663Note that the @samp{-t}/@samp{-f} features do not
11664conveniently handle one portion of @sc{cvs}'s operation:
11665determining when files are modified.  @sc{cvs} will still
11666want a file (or directory) to exist, and it will use
11667its modification time to determine whether a file is
11668modified.  If @sc{cvs} erroneously thinks a file is
11669unmodified (for example, a directory is unchanged but
11670one of the files within it is changed), you can force
11671it to check in the file anyway by specifying the
11672@samp{-f} option to @code{cvs commit} (@pxref{commit
11673options}).
11674@c This is, of course, a serious design flaw in -t/-f.
11675@c Probably the whole functionality needs to be
11676@c redesigned (starting from requirements) to fix this.
11677@end ignore
11678
11679@c FIXME: We don't document -W or point to where it is
11680@c documented.  Or .cvswrappers.
11681For example, the following command imports a
11682directory, treating files whose name ends in
11683@samp{.exe} as binary:
11684
11685@example
11686cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
11687@end example
11688
11689@c Another good example, would be storing files
11690@c (e.g. binary files) compressed in the repository.
11691@c 	::::::::::::::::::
11692@c 	cvswrappers
11693@c 	::::::::::::::::::
11694@c 	*.t12 -m 'COPY'
11695@c 	*.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
11696@c
11697@c	::::::::::::::::::
11698@c	gunzipcp
11699@c	::::::::::::::::::
11700@c	:
11701@c	[ -f $1 ] || exit 1
11702@c	zcat $1 > /tmp/.#$1.$$
11703@c	mv /tmp/.#$1.$$ $1
11704@c
11705@c	::::::::::::::::::
11706@c	gzipcp
11707@c	::::::::::::::::::
11708@c	:
11709@c	DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
11710@c	if [ ! -d $DIRNAME ] ; then
11711@c	      DIRNAME=`echo $1 | sed -e "s|.*/||g"`
11712@c	fi
11713@c	gzip -c  $DIRNAME  > $2
11714@c One catch--"cvs diff" will not invoke the wrappers
11715@c (probably a CVS bug, although I haven't thought it out).
11716
11717@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11718@node commit files
11719@appendixsec The commit support files
11720@cindex Commit files
11721
11722The @samp{-i} flag in the @file{modules} file can be
11723used to run a certain program whenever files are
11724committed (@pxref{modules}).  The files described in
11725this section provide other, more flexible, ways to run
11726programs whenever something is committed.
11727
11728There are three kind of programs that can be run on
11729commit.  They are specified in files in the repository,
11730as described below.  The following table summarizes the
11731file names and the purpose of the corresponding
11732programs.
11733
11734@table @file
11735@item commitinfo
11736The program is responsible for checking that the commit
11737is allowed.  If it exits with a non-zero exit status
11738the commit will be aborted.
11739
11740@item verifymsg
11741The specified program is used to evaluate the log message,
11742and possibly verify that it contains all required
11743fields.  This is most useful in combination with the
11744@file{rcsinfo} file, which can hold a log message
11745template (@pxref{rcsinfo}).
11746
11747@item editinfo
11748The specified program is used to edit the log message,
11749and possibly verify that it contains all required
11750fields.  This is most useful in combination with the
11751@file{rcsinfo} file, which can hold a log message
11752template (@pxref{rcsinfo}).  (obsolete)
11753
11754@item loginfo
11755The specified program is called when the commit is
11756complete.  It receives the log message and some
11757additional information and can store the log message in
11758a file, or mail it to appropriate persons, or maybe
11759post it to a local newsgroup, or@dots{}  Your
11760imagination is the limit!
11761@end table
11762
11763@menu
11764* syntax::                      The common syntax
11765@end menu
11766
11767@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11768@node syntax
11769@appendixsubsec The common syntax
11770@cindex Info files (syntax)
11771@cindex Syntax of info files
11772@cindex Common syntax of info files
11773
11774@c FIXME: having this so totally separate from the
11775@c Variables node is rather bogus.
11776
11777The administrative files such as @file{commitinfo},
11778@file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
11779all have a common format.  The purpose of the files are
11780described later on.  The common syntax is described
11781here.
11782
11783@cindex Regular expression syntax
11784Each line contains the following:
11785@itemize @bullet
11786@item
11787@c Say anything about DEFAULT and ALL?  Right now we
11788@c leave that to the description of each file (and in fact
11789@c the practice is inconsistent which is really annoying).
11790A regular expression.  This is a basic regular
11791expression in the syntax used by GNU emacs.
11792@c FIXME: What we probably should be saying is "POSIX Basic
11793@c Regular Expression with the following extensions (`\('
11794@c `\|' '+' etc)"
11795@c rather than define it with reference to emacs.
11796@c The reference to emacs is not strictly speaking
11797@c true, as we don't support \=, \s, or \S.  Also it isn't
11798@c clear we should document and/or promise to continue to
11799@c support all the obscure emacs extensions like \<.
11800@c Also need to better cite (or include) full
11801@c documentation for the syntax.
11802@c Also see comment in configure.in about what happens to the
11803@c syntax if we pick up a system-supplied regexp matcher.
11804
11805@item
11806A whitespace separator---one or more spaces and/or tabs.
11807
11808@item
11809A file name or command-line template.
11810@end itemize
11811
11812@noindent
11813Blank lines are ignored.  Lines that start with the
11814character @samp{#} are treated as comments.  Long lines
11815unfortunately can @emph{not} be broken in two parts in
11816any way.
11817
11818The first regular expression that matches the current
11819directory name in the repository is used.  The rest of the line
11820is used as a file name or command-line as appropriate.
11821
11822@c FIXME: need an example.  In particular, show what
11823@c the regular expression is matched against (one
11824@c ordinarily clueful person got confused about whether it
11825@c includes the filename--"directory name" above should be
11826@c unambiguous but there is nothing like an example to
11827@c confirm people's understanding of this sort of thing).
11828
11829@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11830@node commitinfo
11831@appendixsec Commitinfo
11832@cindex Commitinfo
11833@cindex Checking commits
11834@cindex Precommit checking
11835
11836The @file{commitinfo} file defines programs to execute
11837whenever @samp{cvs commit} is about to execute.  These
11838programs are used for pre-commit checking to verify
11839that the modified, added and removed files are really
11840ready to be committed.  This could be used, for
11841instance, to verify that the changed files conform to
11842to your site's standards for coding practice.
11843
11844As mentioned earlier, each line in the
11845@file{commitinfo} file consists of a regular expression
11846and a command-line template.  The template can include
11847a program name and any number of arguments you wish to
11848supply to it.  The full path to the current source
11849repository is appended to the template, followed by the
11850file names of any files involved in the commit (added,
11851removed, and modified files).
11852
11853@cindex Exit status, of commitinfo
11854The first line with a regular expression matching the
11855directory within the repository will be used.  If the
11856command returns a non-zero exit status the commit will
11857be aborted.
11858@c FIXME: need example(s) of what "directory within the
11859@c repository" means.
11860
11861@cindex DEFAULT in commitinfo
11862If the repository name does not match any of the
11863regular expressions in this file, the @samp{DEFAULT}
11864line is used, if it is specified.
11865
11866@cindex ALL in commitinfo
11867All occurrences of the name @samp{ALL} appearing as a
11868regular expression are used in addition to the first
11869matching regular expression or the name @samp{DEFAULT}.
11870
11871Note: when @sc{cvs} is accessing a remote repository,
11872@file{commitinfo} will be run on the @emph{remote}
11873(i.e., server) side, not the client side (@pxref{Remote
11874repositories}).
11875
11876@c FIXME: should discuss using commitinfo to control
11877@c who has checkin access to what (e.g. Joe can check into
11878@c directories a, b, and c, and Mary can check into
11879@c directories b, c, and d--note this case cannot be
11880@c conveniently handled with unix groups).  Of course,
11881@c adding a new set of features to CVS might be a more
11882@c natural way to fix this problem than telling people to
11883@c use commitinfo.
11884@c FIXME: Should make some reference, especially in
11885@c the context of controlling who has access, to the fact
11886@c that commitinfo can be circumvented.  Perhaps
11887@c mention SETXID (but has it been carefully examined
11888@c for holes?).  This fits in with the discussion of
11889@c general CVS security in "Password authentication
11890@c security" (the bit which is not pserver-specific).
11891
11892@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11893@node verifymsg
11894@appendixsec Verifying log messages
11895@cindex verifymsg (admin file)
11896@cindex Log message, verifying
11897
11898Once you have entered a log message, you can evaluate
11899that message to check for specific content, such as
11900a bug ID.  Use the @file{verifymsg} file to
11901specify a program that is used to verify the log message.
11902This program could be a simple script that checks
11903that the entered message contains the required fields.
11904
11905The @file{verifymsg} file is often most useful together
11906with the @file{rcsinfo} file, which can be used to
11907specify a log message template.
11908
11909Each line in the @file{verifymsg} file consists of a
11910regular expression and a command-line template.  The
11911template must include a program name, and can include
11912any number of arguments.  The full path to the current
11913log message template file is appended to the template.
11914
11915One thing that should be noted is that the @samp{ALL}
11916keyword is not supported.  If more than one matching
11917line is found, the first one is used.  This can be
11918useful for specifying a default verification script in a
11919directory, and then overriding it in a subdirectory.
11920
11921@cindex DEFAULT in verifymsg
11922If the repository name does not match any of the
11923regular expressions in this file, the @samp{DEFAULT}
11924line is used, if it is specified.
11925
11926@cindex Exit status, of verifymsg
11927If the verification script exits with a non-zero exit status,
11928the commit is aborted.
11929
11930Note that the verification script cannot change the log
11931message; it can merely accept it or reject it.
11932@c FIXME?  Is this an annoying limitation?  It would be
11933@c relatively easy to fix (although it would *not* be a
11934@c good idea for a verifymsg script to interact with the user
11935@c at least in the client/server case because of locks
11936@c and all that jazz).
11937
11938The following is a little silly example of a
11939@file{verifymsg} file, together with the corresponding
11940@file{rcsinfo} file, the log message template and an
11941verification  script.  We begin with the log message template.
11942We want to always record a bug-id number on the first
11943line of the log message.  The rest of log message is
11944free text.  The following template is found in the file
11945@file{/usr/cvssupport/tc.template}.
11946
11947@example
11948BugId:
11949@end example
11950
11951The script @file{/usr/cvssupport/bugid.verify} is used to
11952evaluate the log message.
11953
11954@example
11955#!/bin/sh
11956#
11957#       bugid.verify filename
11958#
11959#  Verify that the log message contains a valid bugid
11960#  on the first line.
11961#
11962if head -1 < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
11963    exit 0
11964else
11965    echo "No BugId found."
11966    exit 1
11967fi
11968@end example
11969
11970The @file{verifymsg} file contains this line:
11971
11972@example
11973^tc     /usr/cvssupport/bugid.verify
11974@end example
11975
11976The @file{rcsinfo} file contains this line:
11977
11978@example
11979^tc     /usr/cvssupport/tc.template
11980@end example
11981
11982
11983
11984@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11985@node editinfo
11986@appendixsec Editinfo
11987@cindex editinfo (admin file)
11988@cindex Editor, specifying per module
11989@cindex Per-module editor
11990@cindex Log messages, editing
11991
11992@emph{NOTE:} The @file{editinfo} feature has been
11993rendered obsolete.  To set a default editor for log
11994messages use the @code{EDITOR} environment variable
11995(@pxref{Environment variables}) or the @samp{-e} global
11996option (@pxref{Global options}).  See @ref{verifymsg},
11997for information on the use of the @file{verifymsg}
11998feature for evaluating log messages.
11999
12000If you want to make sure that all log messages look the
12001same way, you can use the @file{editinfo} file to
12002specify a program that is used to edit the log message.
12003This program could be a custom-made editor that always
12004enforces a certain style of the log message, or maybe a
12005simple shell script that calls an editor, and checks
12006that the entered message contains the required fields.
12007
12008If no matching line is found in the @file{editinfo}
12009file, the editor specified in the environment variable
12010@code{$CVSEDITOR} is used instead.  If that variable is
12011not set, then the environment variable @code{$EDITOR}
12012is used instead.  If that variable is not
12013set a default will be used.  See @ref{Committing your changes}.
12014
12015The @file{editinfo} file is often most useful together
12016with the @file{rcsinfo} file, which can be used to
12017specify a log message template.
12018
12019Each line in the @file{editinfo} file consists of a
12020regular expression and a command-line template.  The
12021template must include a program name, and can include
12022any number of arguments.  The full path to the current
12023log message template file is appended to the template.
12024
12025One thing that should be noted is that the @samp{ALL}
12026keyword is not supported.  If more than one matching
12027line is found, the first one is used.  This can be
12028useful for specifying a default edit script in a
12029module, and then overriding it in a subdirectory.
12030
12031@cindex DEFAULT in editinfo
12032If the repository name does not match any of the
12033regular expressions in this file, the @samp{DEFAULT}
12034line is used, if it is specified.
12035
12036If the edit script exits with a non-zero exit status,
12037the commit is aborted.
12038
12039Note: when @sc{cvs} is accessing a remote repository,
12040or when the @samp{-m} or @samp{-F} options to @code{cvs
12041commit} are used, @file{editinfo} will not be consulted.
12042There is no good workaround for this; use
12043@file{verifymsg} instead.
12044
12045@menu
12046* editinfo example::            Editinfo example
12047@end menu
12048
12049@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12050@node editinfo example
12051@appendixsubsec Editinfo example
12052
12053The following is a little silly example of a
12054@file{editinfo} file, together with the corresponding
12055@file{rcsinfo} file, the log message template and an
12056editor script.  We begin with the log message template.
12057We want to always record a bug-id number on the first
12058line of the log message.  The rest of log message is
12059free text.  The following template is found in the file
12060@file{/usr/cvssupport/tc.template}.
12061
12062@example
12063BugId:
12064@end example
12065
12066The script @file{/usr/cvssupport/bugid.edit} is used to
12067edit the log message.
12068
12069@example
12070#!/bin/sh
12071#
12072#       bugid.edit filename
12073#
12074#  Call $EDITOR on FILENAME, and verify that the
12075#  resulting file contains a valid bugid on the first
12076#  line.
12077if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
12078if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
12079$CVSEDITOR $1
12080until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
12081do  echo -n  "No BugId found.  Edit again? ([y]/n)"
12082    read ans
12083    case $@{ans@} in
12084        n*) exit 1;;
12085    esac
12086    $CVSEDITOR $1
12087done
12088@end example
12089
12090The @file{editinfo} file contains this line:
12091
12092@example
12093^tc     /usr/cvssupport/bugid.edit
12094@end example
12095
12096The @file{rcsinfo} file contains this line:
12097
12098@example
12099^tc     /usr/cvssupport/tc.template
12100@end example
12101
12102@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12103@node loginfo
12104@appendixsec Loginfo
12105@cindex loginfo (admin file)
12106@cindex Storing log messages
12107@cindex Mailing log messages
12108@cindex Distributing log messages
12109@cindex Log messages
12110
12111@c "cvs commit" is not quite right.  What we
12112@c mean is "when the repository gets changed" which
12113@c also includes "cvs import" and "cvs add" on a directory.
12114The @file{loginfo} file is used to control where
12115@samp{cvs commit} log information is sent.  The first
12116entry on a line is a regular expression which is tested
12117against the directory that the change is being made to,
12118relative to the @code{$CVSROOT}.  If a match is found, then
12119the remainder of the line is a filter program that
12120should expect log information on its standard input.
12121
12122If the repository name does not match any of the
12123regular expressions in this file, the @samp{DEFAULT}
12124line is used, if it is specified.
12125
12126All occurrences of the name @samp{ALL} appearing as a
12127regular expression are used in addition to the first
12128matching regular expression or @samp{DEFAULT}.
12129
12130The first matching regular expression is used.
12131
12132@xref{commit files}, for a description of the syntax of
12133the @file{loginfo} file.
12134
12135The user may specify a format string as
12136part of the filter.  The string is composed of a
12137@samp{%} followed by a space, or followed by a single
12138format character, or followed by a set of format
12139characters surrounded by @samp{@{} and @samp{@}} as
12140separators.  The format characters are:
12141
12142@table @t
12143@item s
12144file name
12145@item V
12146old version number (pre-checkin)
12147@item v
12148new version number (post-checkin)
12149@end table
12150
12151All other characters that appear in a format string
12152expand to an empty field (commas separating fields are
12153still provided).
12154
12155For example, some valid format strings are @samp{%},
12156@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
12157
12158The output will be a string of tokens separated by
12159spaces.  For backwards compatibility, the first
12160token will be the repository subdirectory.  The rest of the
12161tokens will be comma-delimited lists of the information
12162requested in the format string.  For example, if
12163@samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}}
12164is the format string, and three files (@t{ChangeLog},
12165@t{Makefile}, @t{foo.c}) were modified, the output
12166might be:
12167
12168@example
12169yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13
12170@end example
12171
12172As another example, @samp{%@{@}} means that only the
12173name of the repository will be generated.
12174
12175Note: when @sc{cvs} is accessing a remote repository,
12176@file{loginfo} will be run on the @emph{remote}
12177(i.e., server) side, not the client side (@pxref{Remote
12178repositories}).
12179
12180@menu
12181* loginfo example::             Loginfo example
12182* Keeping a checked out copy::  Updating a tree on every checkin
12183@end menu
12184
12185@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12186@node loginfo example
12187@appendixsubsec Loginfo example
12188
12189The following @file{loginfo} file, together with the
12190tiny shell-script below, appends all log messages
12191to the file @file{$CVSROOT/CVSROOT/commitlog},
12192and any commits to the administrative files (inside
12193the @file{CVSROOT} directory) are also logged in
12194@file{/usr/adm/cvsroot-log}.
12195Commits to the @file{prog1} directory are mailed to @t{ceder}.
12196
12197@c FIXME: is it a CVS feature or bug that only the
12198@c first matching line is used?  It is documented
12199@c above, but is it useful?  For example, if we wanted
12200@c to run both "cvs-log" and "Mail" for the CVSROOT
12201@c directory, it is kind of awkward if
12202@c only the first matching line is used.
12203@example
12204ALL             /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
12205^CVSROOT        /usr/local/bin/cvs-log /usr/adm/cvsroot-log
12206^prog1          Mail -s %s ceder
12207@end example
12208
12209The shell-script @file{/usr/local/bin/cvs-log} looks
12210like this:
12211
12212@example
12213#!/bin/sh
12214(echo "------------------------------------------------------";
12215 echo -n $2"  ";
12216 date;
12217 echo;
12218 cat) >> $1
12219@end example
12220
12221@node Keeping a checked out copy
12222@appendixsubsec Keeping a checked out copy
12223
12224@c What other index entries?  It seems like
12225@c people might want to use a lot of different
12226@c words for this functionality.
12227@cindex Keeping a checked out copy
12228@cindex Checked out copy, keeping
12229@cindex Web pages, maintaining with CVS
12230
12231It is often useful to maintain a directory tree which
12232contains files which correspond to the latest version
12233in the repository.  For example, other developers might
12234want to refer to the latest sources without having to
12235check them out, or you might be maintaining a web site
12236with @sc{cvs} and want every checkin to cause the files
12237used by the web server to be updated.
12238@c Can we offer more details on the web example?  Or
12239@c point the user at how to figure it out?  This text
12240@c strikes me as sufficient for someone who already has
12241@c some idea of what we mean but not enough for the naive
12242@c user/sysadmin to understand it and set it up.
12243
12244The way to do this is by having loginfo invoke
12245@code{cvs update}.  Doing so in the naive way will
12246cause a problem with locks, so the @code{cvs update}
12247must be run in the background.
12248@c Should we try to describe the problem with locks?
12249@c It seems like a digression for someone who just
12250@c wants to know how to make it work.
12251@c Another choice which might work for a single file
12252@c is to use "cvs -n update -p" which doesn't take
12253@c out locks (I think) but I don't see many advantages
12254@c of that and we might as well document something which
12255@c works for multiple files.
12256Here is an example for unix (this should all be on one line):
12257
12258@example
12259^cyclic-pages		(date; cat; (sleep 2; cd /u/www/local-docs;
12260 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
12261@end example
12262
12263This will cause checkins to repository directories
12264starting with @code{cyclic-pages} to update the checked
12265out tree in @file{/u/www/local-docs}.
12266@c More info on some of the details?  The "sleep 2" is
12267@c so if we are lucky the lock will be gone by the time
12268@c we start and we can wait 2 seconds instead of 30.
12269
12270@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12271@node rcsinfo
12272@appendixsec Rcsinfo
12273@cindex rcsinfo (admin file)
12274@cindex Form for log message
12275@cindex Log message template
12276@cindex Template for log message
12277
12278The @file{rcsinfo} file can be used to specify a form to
12279edit when filling out the commit log.  The
12280@file{rcsinfo} file has a syntax similar to the
12281@file{verifymsg}, @file{commitinfo} and @file{loginfo}
12282files.  @xref{syntax}.  Unlike the other files the second
12283part is @emph{not} a command-line template.  Instead,
12284the part after the regular expression should be a full pathname to
12285a file containing the log message template.
12286
12287If the repository name does not match any of the
12288regular expressions in this file, the @samp{DEFAULT}
12289line is used, if it is specified.
12290
12291All occurrences of the name @samp{ALL} appearing as a
12292regular expression are used in addition to the first
12293matching regular expression or @samp{DEFAULT}.
12294
12295@c FIXME: should be offering advice, somewhere around
12296@c here, about where to put the template file.  The
12297@c verifymsg example uses /usr/cvssupport but doesn't
12298@c say anything about what that directory is for or
12299@c whether it is hardwired into CVS or who creates
12300@c it or anything.  In particular we should say
12301@c how to version control the template file.  A
12302@c probably better answer than the /usr/cvssupport
12303@c stuff is to use checkoutlist (with xref to the
12304@c checkoutlist doc).
12305@c Also I am starting to see a connection between
12306@c this and the Keeping a checked out copy node.
12307@c Probably want to say something about that.
12308The log message template will be used as a default log
12309message.  If you specify a log message with @samp{cvs
12310commit -m @var{message}} or @samp{cvs commit -f
12311@var{file}} that log message will override the
12312template.
12313
12314@xref{verifymsg}, for an example @file{rcsinfo}
12315file.
12316
12317When @sc{cvs} is accessing a remote repository,
12318the contents of @file{rcsinfo} at the time a directory
12319is first checked out will specify a template which does
12320not then change.  If you edit @file{rcsinfo} or its
12321templates, you may need to check out a new working
12322directory.
12323@c Would be nice to fix CVS so this isn't needed.  For
12324@c example, a mechanism analogous to CVS/Entries, where
12325@c the client keeps track of what version of the template
12326@c it has.
12327
12328@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12329@node cvsignore
12330@appendixsec Ignoring files via cvsignore
12331@cindex cvsignore (admin file), global
12332@cindex Global cvsignore
12333@cindex Ignoring files
12334@c -- This chapter should maybe be moved to the
12335@c tutorial part of the manual?
12336
12337There are certain file names that frequently occur
12338inside your working copy, but that you don't want to
12339put under @sc{cvs} control.  Examples are all the object
12340files that you get while you compile your sources.
12341Normally, when you run @samp{cvs update}, it prints a
12342line for each file it encounters that it doesn't know
12343about (@pxref{update output}).
12344
12345@sc{cvs} has a list of files (or sh(1) file name patterns)
12346that it should ignore while running @code{update},
12347@code{import} and @code{release}.
12348@c -- Are those the only three commands affected?
12349This list is constructed in the following way.
12350
12351@itemize @bullet
12352@item
12353The list is initialized to include certain file name
12354patterns: names associated with @sc{cvs}
12355administration, or with other common source control
12356systems; common names for patch files, object files,
12357archive files, and editor backup files; and other names
12358that are usually artifacts of assorted utilities.
12359Currently, the default list of ignored file name
12360patterns is:
12361
12362@cindex Ignored files
12363@cindex Automatically ignored files
12364@example
12365    RCS     SCCS    CVS     CVS.adm
12366    RCSLOG  cvslog.*        .git
12367    tags    TAGS
12368    .make.state     .nse_depinfo   .*.swp
12369    *~      #*      .#*     ,*      _$*     *$
12370    *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
12371    *.a     *.olb   *.o     *.obj   *.so    *.exe
12372    *.Z     *.elc   *.ln    *.depend
12373    *.core
12374@end example
12375
12376@item
12377The per-repository list in
12378@file{$CVSROOT/CVSROOT/cvsignore} is appended to
12379the list, if that file exists.
12380
12381@item
12382The per-user list in @file{.cvsignore} in your home
12383directory is appended to the list, if it exists.
12384
12385@item
12386Any entries in the environment variable
12387@code{$CVSIGNORE} is appended to the list.
12388
12389@item
12390Any @samp{-I} options given to @sc{cvs} is appended.
12391
12392@item
12393As @sc{cvs} traverses through your directories, the contents
12394of any @file{.cvsignore} will be appended to the list.
12395The patterns found in @file{.cvsignore} are only valid
12396for the directory that contains them, not for
12397any sub-directories.
12398@end itemize
12399
12400In any of the 5 places listed above, a single
12401exclamation mark (@samp{!}) clears the ignore list.
12402This can be used if you want to store any file which
12403normally is ignored by @sc{cvs}.
12404
12405Specifying @samp{-I !} to @code{cvs import} will import
12406everything, which is generally what you want to do if
12407you are importing files from a pristine distribution or
12408any other source which is known to not contain any
12409extraneous files.  However, looking at the rules above
12410you will see there is a fly in the ointment; if the
12411distribution contains any @file{.cvsignore} files, then
12412the patterns from those files will be processed even if
12413@samp{-I !} is specified.  The only workaround is to
12414remove the @file{.cvsignore} files in order to do the
12415import.  Because this is awkward, in the future
12416@samp{-I !} might be modified to override
12417@file{.cvsignore} files in each directory.
12418
12419Note that the syntax of the ignore files consists of a
12420series of lines, each of which contains a space
12421separated list of filenames.  This offers no clean way
12422to specify filenames which contain spaces, but you can
12423use a workaround like @file{foo?bar} to match a file
12424named @file{foo bar} (it also matches @file{fooxbar}
12425and the like).  Also note that there is currently no
12426way to specify comments.
12427@c FIXCVS?  I don't _like_ this syntax at all, but
12428@c changing it raises all the usual compatibility
12429@c issues and I'm also not sure what to change it to.
12430
12431@node checkoutlist
12432@appendixsec The checkoutlist file
12433@cindex checkoutlist
12434
12435It may be helpful to use @sc{cvs} to maintain your own
12436files in the @file{CVSROOT} directory.  For example,
12437suppose that you have a script @file{logcommit.pl}
12438which you run by including the following line in the
12439@file{commitinfo} administrative file:
12440
12441@example
12442ALL   $CVSROOT/CVSROOT/logcommit.pl
12443@end example
12444
12445To maintain @file{logcommit.pl} with @sc{cvs} you would
12446add the following line to the @file{checkoutlist}
12447administrative file:
12448
12449@example
12450logcommit.pl
12451@end example
12452
12453The format of @file{checkoutlist} is one line for each
12454file that you want to maintain using @sc{cvs}, giving
12455the name of the file.
12456
12457After setting up @file{checkoutlist} in this fashion,
12458the files listed there will function just like
12459@sc{cvs}'s built-in administrative files.  For example,
12460when checking in one of the files you should get a
12461message such as:
12462
12463@example
12464cvs commit: Rebuilding administrative file database
12465@end example
12466
12467and the checked out copy in the @file{CVSROOT}
12468directory should be updated.
12469
12470Note that listing @file{passwd} (@pxref{Password
12471authentication server}) in @file{checkoutlist} is not
12472recommended for security reasons.
12473
12474For information about keeping a checkout out copy in a
12475more general context than the one provided by
12476@file{checkoutlist}, see @ref{Keeping a checked out
12477copy}.
12478
12479@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12480@node history file
12481@appendixsec The history file
12482@cindex History file
12483@cindex Log information, saving
12484
12485The file @file{$CVSROOT/CVSROOT/history} is used
12486to log information for the @code{history} command
12487(@pxref{history}).  This file must be created to turn
12488on logging.  This is done automatically if the
12489@code{cvs init} command is used to set up the
12490repository (@pxref{Creating a repository}).
12491
12492The file format of the @file{history} file is
12493documented only in comments in the @sc{cvs} source
12494code, but generally programs should use the @code{cvs
12495history} command to access it anyway, in case the
12496format changes with future releases of @sc{cvs}.
12497
12498@node Variables
12499@appendixsec Expansions in administrative files
12500@cindex Internal variables
12501@cindex Variables
12502
12503Sometimes in writing an administrative file, you might
12504want the file to be able to know various things based
12505on environment @sc{cvs} is running in.  There are
12506several mechanisms to do that.
12507
12508To find the home directory of the user running @sc{cvs}
12509(from the @code{HOME} environment variable), use
12510@samp{~} followed by @samp{/} or the end of the line.
12511Likewise for the home directory of @var{user}, use
12512@samp{~@var{user}}.  These variables are expanded on
12513the server machine, and don't get any reasonable
12514expansion if pserver (@pxref{Password authenticated})
12515is in use; therefore user variables (see below) may be
12516a better choice to customize behavior based on the user
12517running @sc{cvs}.
12518@c Based on these limitations, should we deprecate ~?
12519@c What is it good for?  Are people using it?
12520
12521One may want to know about various pieces of
12522information internal to @sc{cvs}.  A @sc{cvs} internal
12523variable has the syntax @code{$@{@var{variable}@}},
12524where @var{variable} starts with a letter and consists
12525of alphanumeric characters and @samp{_}.  If the
12526character following @var{variable} is a
12527non-alphanumeric character other than @samp{_}, the
12528@samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
12529internal variables are:
12530
12531@table @code
12532@item CVSROOT
12533@cindex CVSROOT, internal variable
12534This is the value of the @sc{cvs} root in use.
12535@xref{Repository}, for a description of the various
12536ways to specify this.
12537
12538@item RCSBIN
12539@cindex RCSBIN, internal variable
12540In @sc{cvs} 1.9.18 and older, this specified the
12541directory where @sc{cvs} was looking for @sc{rcs}
12542programs.  Because @sc{cvs} no longer runs @sc{rcs}
12543programs, specifying this internal variable is now an
12544error.
12545
12546@item CVSEDITOR
12547@cindex CVSEDITOR, internal variable
12548@itemx VISUAL
12549@cindex VISUAL, internal variable
12550@itemx EDITOR
12551@cindex EDITOR, internal variable
12552These all expand to the same value, which is the editor
12553that @sc{cvs} is using.  @xref{Global options}, for how
12554to specify this.
12555
12556@item USER
12557@cindex USER, internal variable
12558Username of the user running @sc{cvs} (on the @sc{cvs}
12559server machine).
12560When using pserver, this is the user specified in the repository
12561specification which need not be the same as the username the
12562server is running as (@pxref{Password authentication server}).
12563@end table
12564
12565If you want to pass a value to the administrative files
12566which the user who is running @sc{cvs} can specify,
12567use a user variable.
12568@cindex User variables
12569To expand a user variable, the
12570administrative file contains
12571@code{$@{=@var{variable}@}}.  To set a user variable,
12572specify the global option @samp{-s} to @sc{cvs}, with
12573argument @code{@var{variable}=@var{value}}.  It may be
12574particularly useful to specify this option via
12575@file{.cvsrc} (@pxref{~/.cvsrc}).
12576
12577For example, if you want the administrative file to
12578refer to a test directory you might create a user
12579variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
12580as
12581
12582@example
12583cvs -s TESTDIR=/work/local/tests
12584@end example
12585
12586@noindent
12587and the
12588administrative file contains @code{sh
12589$@{=TESTDIR@}/runtests}, then that string is expanded
12590to @code{sh /work/local/tests/runtests}.
12591
12592All other strings containing @samp{$} are reserved;
12593there is no way to quote a @samp{$} character so that
12594@samp{$} represents itself.
12595
12596Environment variables passed to administrative files are:
12597
12598@table @code
12599@cindex environment variables, passed to administrative files
12600@c FIXME: should document USER, LOGNAME, and whatever else is
12601@c available both in internal variables and environment variables.
12602
12603@item CVS_USER
12604The @sc{cvs}-specific username provided by the user, if it
12605can be provided (currently just for the pserver access
12606method), and to the empty string otherwise.  (CVS_USER
12607and USER may differ when @file{$CVSROOT/CVSROOT/passwd}
12608is used to map cvs usernames to system usernames.)
12609@end table
12610
12611@node config
12612@appendixsec The CVSROOT/config configuration file
12613
12614@cindex config, in CVSROOT
12615@cindex CVSROOT/config
12616
12617The administrative file @file{config} contains various
12618miscellaneous settings which affect the behavior of
12619@sc{cvs}.  The syntax is slightly different from the
12620other administrative files.  Variables are not
12621expanded.  Lines which start with @samp{#} are
12622considered comments.
12623@c FIXME: where do we define comments for the other
12624@c administrative files.
12625Other lines consist of a keyword, @samp{=}, and a
12626value.  Note that this syntax is very strict.
12627Extraneous spaces or tabs are not permitted.
12628@c See comments in parseinfo.c:parse_config for more
12629@c discussion of this strictness.
12630
12631Currently defined keywords are:
12632
12633@table @code
12634@cindex RCSBIN, in CVSROOT/config
12635@item RCSBIN=@var{bindir}
12636For @sc{cvs} 1.9.12 through 1.9.18, this setting told
12637@sc{cvs} to look for @sc{rcs} programs in the
12638@var{bindir} directory.  Current versions of @sc{cvs}
12639do not run @sc{rcs} programs; for compatibility this
12640setting is accepted, but it does nothing.
12641
12642@cindex SystemAuth, in CVSROOT/config
12643@item SystemAuth=@var{value}
12644If @var{value} is @samp{yes}, then pserver should check
12645for users in the system's user database if not found in
12646@file{CVSROOT/passwd}.  If it is @samp{no}, then all
12647pserver users must exist in @file{CVSROOT/passwd}.
12648The default is @samp{yes}.  For more on pserver, see
12649@ref{Password authenticated}.
12650
12651@ignore
12652@cindex PreservePermissions, in CVSROOT/config
12653@item PreservePermissions=@var{value}
12654Enable support for saving special device files,
12655symbolic links, file permissions and ownerships in the
12656repository.  The default value is @samp{no}.
12657@xref{Special Files}, for the full implications of using
12658this keyword.
12659@end ignore
12660
12661@cindex TopLevelAdmin, in CVSROOT/config
12662@item TopLevelAdmin=@var{value}
12663Modify the @samp{checkout} command to create a
12664@samp{CVS} directory at the top level of the new
12665working directory, in addition to @samp{CVS}
12666directories created within checked-out directories.
12667The default value is @samp{no}.
12668
12669This option is useful if you find yourself performing
12670many commands at the top level of your working
12671directory, rather than in one of the checked out
12672subdirectories.  The @file{CVS} directory created there
12673will mean you don't have to specify @code{CVSROOT} for
12674each command.  It also provides a place for the
12675@file{CVS/Template} file (@pxref{Working directory
12676storage}).
12677
12678@cindex LockDir, in CVSROOT/config
12679@item LockDir=@var{directory}
12680Put @sc{cvs} lock files in @var{directory} rather than
12681directly in the repository.  This is useful if you want
12682to let users read from the repository while giving them
12683write access only to @var{directory}, not to the
12684repository.  You need to create @var{directory}, but
12685@sc{cvs} will create subdirectories of @var{directory} as it
12686needs them.  For information on @sc{cvs} locks, see
12687@ref{Concurrency}.
12688
12689@c Mention this in Compatibility section?
12690Before enabling the LockDir option, make sure that you
12691have tracked down and removed any copies of @sc{cvs} 1.9 or
12692older.  Such versions neither support LockDir, nor will
12693give an error indicating that they don't support it.
12694The result, if this is allowed to happen, is that some
12695@sc{cvs} users will put the locks one place, and others will
12696put them another place, and therefore the repository
12697could become corrupted.  @sc{cvs} 1.10 does not support
12698LockDir but it will print a warning if run on a
12699repository with LockDir enabled.
12700
12701@cindex LogHistory, in CVSROOT/config
12702@item LogHistory=@var{value}
12703Control what is logged to the @file{CVSROOT/history} file.
12704Default of @samp{TOFEWGCMAR} (or simply @samp{all}) will log
12705all transactions.  Any subset of the default is
12706legal.  (For example, to only log transactions that modify the
12707@file{*,v} files, use @samp{LogHistory=TMAR}.)
12708@end table
12709
12710@c ---------------------------------------------------------------------
12711@node Environment variables
12712@appendix All environment variables which affect CVS
12713@cindex Environment variables
12714@cindex Reference manual for variables
12715
12716This is a complete list of all environment variables
12717that affect @sc{cvs}.
12718
12719@table @code
12720@cindex CVSIGNORE, environment variable
12721@item $CVSIGNORE
12722A whitespace-separated list of file name patterns that
12723@sc{cvs} should ignore. @xref{cvsignore}.
12724
12725@cindex CVSWRAPPERS, environment variable
12726@item $CVSWRAPPERS
12727A whitespace-separated list of file name patterns that
12728@sc{cvs} should treat as wrappers. @xref{Wrappers}.
12729
12730@cindex CVSREAD, environment variable
12731@cindex Read-only files, and CVSREAD
12732@item $CVSREAD
12733If this is set, @code{checkout} and @code{update} will
12734try hard to make the files in your working directory
12735read-only.  When this is not set, the default behavior
12736is to permit modification of your working files.
12737
12738@item $CVSUMASK
12739Controls permissions of files in the repository.  See
12740@ref{File permissions}.
12741
12742@item $CVSROOT
12743Should contain the full pathname to the root of the @sc{cvs}
12744source repository (where the @sc{rcs} files are
12745kept).  This information must be available to @sc{cvs} for
12746most commands to execute; if @code{$CVSROOT} is not set,
12747or if you wish to override it for one invocation, you
12748can supply it on the command line: @samp{cvs -d cvsroot
12749cvs_command@dots{}} Once you have checked out a working
12750directory, @sc{cvs} stores the appropriate root (in
12751the file @file{CVS/Root}), so normally you only need to
12752worry about this when initially checking out a working
12753directory.
12754
12755@item $EDITOR
12756@itemx $CVSEDITOR
12757@itemx $VISUAL
12758Specifies the program to use for recording log messages
12759during commit.  @code{$CVSEDITOR} overrides
12760@code{$EDITOR}.  See @ref{Committing your changes}.
12761
12762@cindex PATH, environment variable
12763@item $PATH
12764If @code{$RCSBIN} is not set, and no path is compiled
12765into @sc{cvs}, it will use @code{$PATH} to try to find all
12766programs it uses.
12767
12768@cindex HOME, environment variable
12769@item $HOME
12770@cindex HOMEPATH, environment variable
12771@item $HOMEPATH
12772@cindex HOMEDRIVE, environment variable
12773@item $HOMEDRIVE
12774Used to locate the directory where the @file{.cvsrc}
12775file, and other such files, are searched.  On Unix, @sc{cvs}
12776just checks for @code{HOME}.  On Windows NT, the system will
12777set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
12778for example to @file{\joe}.  On Windows 95, you'll
12779probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
12780@c We are being vague about whether HOME works on
12781@c Windows; see long comment in windows-NT/filesubr.c.
12782
12783@cindex CVS_RSH, environment variable
12784@item $CVS_RSH
12785Specifies the external program which @sc{cvs} connects with,
12786when @code{:ext:} access method is specified.
12787@pxref{Connecting via rsh}.
12788
12789@item $CVS_SERVER
12790Used in client-server mode when accessing a remote
12791repository using @sc{rsh}.  It specifies the name of
12792the program to start on the server side when accessing
12793a remote repository using @sc{rsh}.  The default value
12794is @code{cvs}.  @pxref{Connecting via rsh}
12795
12796@item $CVS_PASSFILE
12797Used in client-server mode when accessing the @code{cvs
12798login server}.  Default value is @file{$HOME/.cvspass}.
12799@pxref{Password authentication client}
12800
12801@item $CVS_CLIENT_PORT
12802Used in client-server mode when accessing the server
12803via Kerberos, GSSAPI, or @sc{cvs}'s password authentication if the port is not
12804specified in $CVSROOT.
12805@pxref{Remote repositories}
12806
12807@cindex CVS_RCMD_PORT, environment variable
12808@item $CVS_RCMD_PORT
12809Used in client-server mode.  If set, specifies the port
12810number to be used when accessing the @sc{rcmd} demon on
12811the server side. (Currently not used for Unix clients).
12812
12813@cindex CVS_CLIENT_LOG, environment variable
12814@item $CVS_CLIENT_LOG
12815Used for debugging only in client-server
12816mode.  If set, everything sent to the server is logged
12817into @file{@code{$CVS_CLIENT_LOG}.in} and everything
12818sent from the server is logged into
12819@file{@code{$CVS_CLIENT_LOG}.out}.
12820
12821@cindex CVS_SERVER_SLEEP, environment variable
12822@item $CVS_SERVER_SLEEP
12823Used only for debugging the server side in
12824client-server mode.  If set, delays the start of the
12825server child process the specified amount of
12826seconds so that you can attach to it with a debugger.
12827
12828@cindex CVS_IGNORE_REMOTE_ROOT, environment variable
12829@item $CVS_IGNORE_REMOTE_ROOT
12830For @sc{cvs} 1.10 and older, setting this variable
12831prevents @sc{cvs} from overwriting the @file{CVS/Root}
12832file when the @samp{-d} global option is specified.
12833Later versions of @sc{cvs} do not rewrite
12834@file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
12835effect.
12836
12837@cindex COMSPEC, environment variable
12838@item $COMSPEC
12839Used under OS/2 only.  It specifies the name of the
12840command interpreter and defaults to @sc{cmd.exe}.
12841
12842@cindex TMPDIR, environment variable
12843@item $TMPDIR
12844@cindex TMP, environment variable
12845@itemx $TMP
12846@cindex TEMP, environment variable
12847@itemx $TEMP
12848@cindex Temporary files, location of
12849@c This is quite nuts.  We don't talk about tempnam
12850@c or mkstemp which we sometimes use.  The discussion
12851@c of "Global options" is semi-incoherent.
12852@c I'm not even sure those are the only inaccuracies.
12853@c Furthermore, the conventions are
12854@c pretty crazy and they should be simplified.
12855Directory in which temporary files are located.
12856The @sc{cvs} server uses
12857@code{TMPDIR}.  @xref{Global options}, for a
12858description of how to specify this.
12859Some parts of @sc{cvs} will always use @file{/tmp} (via
12860the @code{tmpnam} function provided by the system).
12861
12862On Windows NT, @code{TMP} is used (via the @code{_tempnam}
12863function provided by the system).
12864
12865The @code{patch} program which is used by the @sc{cvs}
12866client uses @code{TMPDIR}, and if it is not set, uses
12867@file{/tmp} (at least with GNU patch 2.1).  Note that
12868if your server and client are both running @sc{cvs}
128691.9.10 or later, @sc{cvs} will not invoke an external
12870@code{patch} program.
12871@end table
12872
12873@node Compatibility
12874@appendix Compatibility between CVS Versions
12875
12876@cindex CVS, versions of
12877@cindex Versions, of CVS
12878@cindex Compatibility, between CVS versions
12879@c We don't mention versions older than CVS 1.3
12880@c on the theory that it would clutter it up for the vast
12881@c majority of people, who don't have anything that old.
12882@c
12883The repository format is compatible going back to
12884@sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
12885you have copies of @sc{cvs} 1.6 or older and you want
12886to use the optional developer communication features.
12887@c If you "cvs rm" and commit using 1.3, then you'll
12888@c want to run "rcs -sdead <file,v>" on each of the
12889@c files in the Attic if you then want 1.5 and
12890@c later to recognize those files as dead (I think the
12891@c symptom if this is not done is that files reappear
12892@c in joins).  (Wait: the above will work but really to
12893@c be strictly correct we should suggest checking
12894@c in a new revision rather than just changing the
12895@c state of the head revision, shouldn't we?).
12896@c The old convert.sh script was for this, but it never
12897@c did get updated to reflect use of the RCS "dead"
12898@c state.
12899@c Note: this is tricky to document without confusing
12900@c people--need to carefully say what CVS version we
12901@c are talking about and keep in mind the distinction
12902@c between a
12903@c repository created with 1.3 and on which one now
12904@c uses 1.5+, and a repository on which one wants to
12905@c use both versions side by side (e.g. during a
12906@c transition period).
12907@c Wait, can't CVS just detect the case in which a file
12908@c is in the Attic but the head revision is not dead?
12909@c Not sure whether this should produce a warning or
12910@c something, and probably needs further thought, but
12911@c it would appear that the situation can be detected.
12912@c
12913@c We might want to separate out the 1.3 compatibility
12914@c section (for repository & working directory) from the
12915@c rest--that might help avoid confusing people who
12916@c are upgrading (for example) from 1.6 to 1.8.
12917@c
12918@c A minor incompatibility is if a current version of CVS
12919@c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
12920@c see this as if there is no tag.  Seems to me this is
12921@c too obscure to mention.
12922
12923The working directory format is compatible going back
12924to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
12925and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
12926a working directory checked out with @sc{cvs} 1.3,
12927@sc{cvs} will convert it, but to go back to @sc{cvs}
129281.3 you need to check out a new working directory with
12929@sc{cvs} 1.3.
12930
12931The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
12932further (1.5 was the first official release with the remote protocol,
12933but some older versions might still be floating around).  In many
12934cases you need to upgrade both the client and the server to take
12935advantage of new features and bugfixes, however.
12936
12937@c Perhaps should be saying something here about the
12938@c "D" lines in Entries (written by CVS 1.9; 1.8 and
12939@c older don't use them).  These are supposed to be
12940@c compatible in both directions, but I'm not sure
12941@c they quite are 100%.  One common gripe is if you
12942@c "rm -r" a directory and 1.9 gets confused, as it
12943@c still sees it in Entries.  That one is fixed in
12944@c (say) 1.9.6.  Someone else reported problems with
12945@c starting with a directory which was checked out with
12946@c an old version, and then using a new version, and
12947@c some "D" lines appeared, but not for every
12948@c directory, causing some directories to be skipped.
12949@c They weren't sure how to reproduce this, though.
12950
12951@c ---------------------------------------------------------------------
12952@node Troubleshooting
12953@appendix Troubleshooting
12954
12955If you are having trouble with @sc{cvs}, this appendix
12956may help.  If there is a particular error message which
12957you are seeing, then you can look up the message
12958alphabetically.  If not, you can look through the
12959section on other problems to see if your problem is
12960mentioned there.
12961
12962@menu
12963* Error messages::              Partial list of CVS errors
12964* Connection::                  Trouble making a connection to a CVS server
12965* Other problems::              Problems not readily listed by error message
12966@end menu
12967
12968@ignore
12969@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12970@c @node Bad administrative files
12971@appendixsec Bad administrative files
12972
12973@c -- Give hints on how to fix them
12974@end ignore
12975
12976@node Error messages
12977@appendixsec Partial list of error messages
12978
12979Here is a partial list of error messages that you may
12980see from @sc{cvs}.  It is not a complete list---@sc{cvs}
12981is capable of printing many, many error messages, often
12982with parts of them supplied by the operating system,
12983but the intention is to list the common and/or
12984potentially confusing error messages.
12985
12986The messages are alphabetical, but introductory text
12987such as @samp{cvs update: } is not considered in
12988ordering them.
12989
12990In some cases the list includes messages printed by old
12991versions of @sc{cvs} (partly because users may not be
12992sure which version of @sc{cvs} they are using at any
12993particular moment).
12994@c If we want to start retiring messages, perhaps we
12995@c should pick a cutoff version (for example, no more
12996@c messages which are specific to versions before 1.9)
12997@c and then move the old messages to an "old messages"
12998@c node rather than deleting them completely.
12999
13000@table @code
13001@c FIXME: What is the correct way to format a multiline
13002@c error message here?  Maybe @table is the wrong
13003@c choice?  Texinfo gurus?
13004@item cvs @var{command}: authorization failed: server @var{host} rejected access
13005This is a generic response when trying to connect to a
13006pserver server which chooses not to provide a
13007specific reason for denying authorization.  Check that
13008the username and password specified are correct and
13009that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
13010in @file{inetd.conf}.  See @ref{Password authenticated}.
13011
13012@item @var{file}:@var{line}: Assertion '@var{text}' failed
13013The exact format of this message may vary depending on
13014your system.  It indicates a bug in @sc{cvs}, which can
13015be handled as described in @ref{BUGS}.
13016
13017@item cvs @var{command}: conflict: removed @var{file} was modified by second party
13018This message indicates that you removed a file, and
13019someone else modified it.  To resolve the conflict,
13020first run @samp{cvs add @var{file}}.  If desired, look
13021at the other party's modification to decide whether you
13022still want to remove it.  If you don't want to remove
13023it, stop here.  If you do want to remove it, proceed
13024with @samp{cvs remove @var{file}} and commit your
13025removal.
13026@c Tests conflicts2-142b* in sanity.sh test for this.
13027
13028@item cannot change permissions on temporary directory
13029@example
13030Operation not permitted
13031@end example
13032This message has been happening in a non-reproducible,
13033occasional way when we run the client/server testsuite,
13034both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
13035able to figure out what causes it, nor is it known
13036whether it is specific to linux (or even to this
13037particular machine!).  If the problem does occur on
13038other unices, @samp{Operation not permitted} would be
13039likely to read @samp{Not owner} or whatever the system
13040in question uses for the unix @code{EPERM} error.  If
13041you have any information to add, please let us know as
13042described in @ref{BUGS}.  If you experience this error
13043while using @sc{cvs}, retrying the operation which
13044produced it should work fine.
13045@c This has been seen in a variety of tests, including
13046@c multibranch-2, multibranch-5, and basic1-24-rm-rm,
13047@c so it doesn't seem particularly specific to any one
13048@c test.
13049
13050@item cvs [server aborted]: Cannot check out files into the repository itself
13051The obvious cause for this message (especially for
13052non-client/server @sc{cvs}) is that the @sc{cvs} root
13053is, for example, @file{/usr/local/cvsroot} and you try
13054to check out files when you are in a subdirectory, such
13055as @file{/usr/local/cvsroot/test}.  However, there is a
13056more subtle cause, which is that the temporary
13057directory on the server is set to a subdirectory of the
13058root (which is also not allowed).  If this is the
13059problem, set the temporary directory to somewhere else,
13060for example @file{/var/tmp}; see @code{TMPDIR} in
13061@ref{Environment variables}, for how to set the
13062temporary directory.
13063
13064@c For one example see basica-1a10 in the testsuite
13065@c For another example, "cvs co ." on NT; see comment
13066@c at windows-NT/filesubr.c (expand_wild).
13067@c For another example, "cvs co foo/bar" where foo exists.
13068@item cannot open CVS/Entries for reading: No such file or directory
13069This generally indicates a @sc{cvs} internal error, and
13070can be handled as with other @sc{cvs} bugs
13071(@pxref{BUGS}).  Usually there is a workaround---the
13072exact nature of which would depend on the situation but
13073which hopefully could be figured out.
13074
13075@c This is more obscure than it might sound; it only
13076@c happens if you run "cvs init" from a directory which
13077@c contains a CVS/Root file at the start.
13078@item cvs [init aborted]: cannot open CVS/Root: No such file or directory
13079This message is harmless.  Provided it is not
13080accompanied by other errors, the operation has
13081completed successfully.  This message should not occur
13082with current versions of @sc{cvs}, but it is documented
13083here for the benefit of @sc{cvs} 1.9 and older.
13084
13085@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
13086This message has been reported as intermittently
13087happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
13088unknown; if you know more about what causes it, let us
13089know as described in @ref{BUGS}.
13090
13091@item cvs [@var{command} aborted]: cannot start server via rcmd
13092This, unfortunately, is a rather nonspecific error
13093message which @sc{cvs} 1.9 will print if you are
13094running the @sc{cvs} client and it is having trouble
13095connecting to the server.  Current versions of @sc{cvs}
13096should print a much more specific error message.  If
13097you get this message when you didn't mean to run the
13098client at all, you probably forgot to specify
13099@code{:local:}, as described in @ref{Repository}.
13100
13101@item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
13102@sc{cvs} 1.9 and older will print this message
13103when trying to check in a binary file if
13104@sc{rcs} is not correctly installed.  Re-read the
13105instructions that came with your @sc{rcs} distribution
13106and the @sc{install} file in the @sc{cvs}
13107distribution.  Alternately, upgrade to a current
13108version of @sc{cvs}, which checks in files itself
13109rather than via @sc{rcs}.
13110
13111@item cvs checkout: could not check out @var{file}
13112With @sc{cvs} 1.9, this can mean that the @code{co} program
13113(part of @sc{rcs}) returned a failure.  It should be
13114preceded by another error message, however it has been
13115observed without another error message and the cause is
13116not well-understood.  With the current version of @sc{cvs},
13117which does not run @code{co}, if this message occurs
13118without another error message, it is definitely a @sc{cvs}
13119bug (@pxref{BUGS}).
13120@c My current suspicion is that the RCS in the rcs (not
13121@c cvs/winnt/rcs57nt.zip) directory on the _Practical_
13122@c CD is bad (remains to be confirmed).
13123@c There is also a report of something which looks
13124@c very similar on SGI, Irix 5.2, so I dunno.
13125
13126@item cvs [login aborted]: could not find out home directory
13127This means that you need to set the environment
13128variables that @sc{cvs} uses to locate your home directory.
13129See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
13130@ref{Environment variables}.
13131
13132@item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
13133@sc{cvs} 1.9 and older will print this message if there was
13134a problem finding the @code{rcsmerge} program.  Make
13135sure that it is in your @code{PATH}, or upgrade to a
13136current version of @sc{cvs}, which does not require
13137an external @code{rcsmerge} program.
13138
13139@item cvs [update aborted]: could not patch @var{file}: No such file or directory
13140This means that there was a problem finding the
13141@code{patch} program.  Make sure that it is in your
13142@code{PATH}.  Note that despite appearances the message
13143is @emph{not} referring to whether it can find @var{file}.
13144If both the client and the server are running a current
13145version of @sc{cvs}, then there is no need for an
13146external patch program and you should not see this
13147message.  But if either client or server is running
13148@sc{cvs} 1.9, then you need @code{patch}.
13149
13150@item cvs update: could not patch @var{file}; will refetch
13151This means that for whatever reason the client was
13152unable to apply a patch that the server sent.  The
13153message is nothing to be concerned about, because
13154inability to apply the patch only slows things down and
13155has no effect on what @sc{cvs} does.
13156@c xref to update output.  Or File status?
13157@c Or some place else that
13158@c explains this whole "patch"/P/Needs Patch thing?
13159
13160@item dying gasps from @var{server} unexpected
13161There is a known bug in the server for @sc{cvs} 1.9.18
13162and older which can cause this.  For me, this was
13163reproducible if I used the @samp{-t} global option.  It
13164was fixed by Andy Piper's 14 Nov 1997 change to
13165src/filesubr.c, if anyone is curious.
13166If you see the message,
13167you probably can just retry the operation which failed,
13168or if you have discovered information concerning its
13169cause, please let us know as described in @ref{BUGS}.
13170
13171@item end of file from server (consult above messages if any)
13172The most common cause for this message is if you are
13173using an external @code{rsh} program and it exited with
13174an error.  In this case the @code{rsh} program should
13175have printed a message, which will appear before the
13176above message.  For more information on setting up a
13177@sc{cvs} client and server, see @ref{Remote repositories}.
13178
13179@item cvs [update aborted]: EOF in key in RCS file @var{file},v
13180@itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
13181This means that there is a syntax error in the given
13182@sc{rcs} file.  Note that this might be true even if @sc{rcs} can
13183read the file OK; @sc{cvs} does more error checking of
13184errors in the RCS file.  That is why you may see this
13185message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
131861.10.  The likely cause for the original corruption is
13187hardware, the operating system, or the like.  Of
13188course, if you find a case in which @sc{cvs} seems to
13189corrupting the file, by all means report it,
13190(@pxref{BUGS}).
13191There are quite a few variations of this error message,
13192depending on exactly where in the @sc{rcs} file @sc{cvs}
13193finds the syntax error.
13194
13195@cindex mkmodules
13196@item cvs commit: Executing 'mkmodules'
13197This means that your repository is set up for a version
13198of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
131991.8 or later, the above message will be preceded by
13200
13201@example
13202cvs commit: Rebuilding administrative file database
13203@end example
13204
13205If you see both messages, the database is being rebuilt
13206twice, which is unnecessary but harmless.  If you wish
13207to avoid the duplication, and you have no versions of
13208@sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
13209every place it appears in your @code{modules}
13210file.  For more information on the @code{modules} file,
13211see @ref{modules}.
13212
13213@c This message comes from "co", and I believe is
13214@c possible only with older versions of CVS which call
13215@c co.  The problem with being able to create the bogus
13216@c RCS file still exists, though (and I think maybe
13217@c there is a different symptom(s) now).
13218@c FIXME: Would be nice to have a more exact wording
13219@c for this message.
13220@item missing author
13221Typically this can happen if you created an RCS file
13222with your username set to empty.  @sc{cvs} will, bogusly,
13223create an illegal RCS file with no value for the author
13224field.  The solution is to make sure your username is
13225set to a non-empty value and re-create the RCS file.
13226@c "make sure your username is set" is complicated in
13227@c and of itself, as there are the environment
13228@c variables the system login name, &c, and it depends
13229@c on the version of CVS.
13230
13231@item cvs [checkout aborted]: no such tag @var{tag}
13232This message means that @sc{cvs} isn't familiar with
13233the tag @var{tag}.  Usually this means that you have
13234mistyped a tag name; however there are (relatively
13235obscure) cases in which @sc{cvs} will require you to
13236@c Search sanity.sh for "no such tag" to see some of
13237@c the relatively obscure cases.
13238try a few other @sc{cvs} commands involving that tag,
13239before you find one which will cause @sc{cvs} to update
13240the @file{val-tags} file; see discussion of val-tags in
13241@ref{File permissions}.  You only need to worry about
13242this once for a given tag; when a tag is listed in
13243@file{val-tags}, it stays there.  Note that using
13244@samp{-f} to not require tag matches does not override
13245this check; see @ref{Common options}.
13246
13247@item *PANIC* administration files missing
13248This typically means that there is a directory named
13249@sc{cvs} but it does not contain the administrative files
13250which @sc{cvs} puts in a CVS directory.  If the problem is
13251that you created a CVS directory via some mechanism
13252other than @sc{cvs}, then the answer is simple, use a name
13253other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
13254(@pxref{BUGS}).
13255
13256@item rcs error: Unknown option: -x,v/
13257This message will be followed by a usage message for
13258@sc{rcs}.  It means that you have an old version of
13259@sc{rcs} (probably supplied with your operating
13260system), as well as an old version of @sc{cvs}.
13261@sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
13262later; current versions of @sc{cvs} do not run @sc{rcs} programs.
13263@c For more information on installing @sc{cvs}, see
13264@c (FIXME: where?  it depends on whether you are
13265@c getting binaries or sources or what).
13266@c The message can also say "ci error" or something
13267@c instead of "rcs error", I suspect.
13268
13269@item cvs [server aborted]: received broken pipe signal
13270This message seems to be caused by a hard-to-track-down
13271bug in @sc{cvs} or the systems it runs on (we don't
13272know---we haven't tracked it down yet!).  It seems to
13273happen only after a @sc{cvs} command has completed, and
13274you should be able to just ignore the message.
13275However, if you have discovered information concerning its
13276cause, please let us know as described in @ref{BUGS}.
13277
13278@item Too many arguments!
13279This message is typically printed by the @file{log.pl}
13280script which is in the @file{contrib} directory in the
13281@sc{cvs} source distribution.  In some versions of
13282@sc{cvs}, @file{log.pl} has been part of the default
13283@sc{cvs} installation.  The @file{log.pl} script gets
13284called from the @file{loginfo} administrative file.
13285Check that the arguments passed in @file{loginfo} match
13286what your version of @file{log.pl} expects.  In
13287particular, the @file{log.pl} from @sc{cvs} 1.3 and
13288older expects the logfile as an argument whereas the
13289@file{log.pl} from @sc{cvs} 1.5 and newer expects the
13290logfile to be specified with a @samp{-f} option.  Of
13291course, if you don't need @file{log.pl} you can just
13292comment it out of @file{loginfo}.
13293
13294@item cvs [update aborted]: unexpected EOF reading @var{file},v
13295See @samp{EOF in key in RCS file}.
13296
13297@item cvs [login aborted]: unrecognized auth response from @var{server}
13298This message typically means that the server is not set
13299up properly.  For example, if @file{inetd.conf} points
13300to a nonexistent cvs executable.  To debug it further,
13301find the log file which inetd writes
13302(@file{/var/log/messages} or whatever inetd uses on
13303your system).  For details, see @ref{Connection}, and
13304@ref{Password authentication server}.
13305
13306@item cvs server: cannot open /root/.cvsignore: Permission denied
13307@itemx cvs [server aborted]: can't chdir(/root): Permission denied
13308See @ref{Connection}.
13309
13310@item cvs commit: Up-to-date check failed for `@var{file}'
13311This means that someone else has committed a change to
13312that file since the last time that you did a @code{cvs
13313update}.  So before proceeding with your @code{cvs
13314commit} you need to @code{cvs update}.  @sc{cvs} will merge
13315the changes that you made and the changes that the
13316other person made.  If it does not detect any conflicts
13317it will report @samp{M @var{file}} and you are ready
13318to @code{cvs commit}.  If it detects conflicts it will
13319print a message saying so, will report @samp{C @var{file}},
13320and you need to manually resolve the
13321conflict.  For more details on this process see
13322@ref{Conflicts example}.
13323
13324@item Usage:	diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
13325@example
13326Only one of [exEX3] allowed
13327@end example
13328This indicates a problem with the installation of
13329@code{diff3} and @code{rcsmerge}.  Specifically
13330@code{rcsmerge} was compiled to look for GNU diff3, but
13331it is finding unix diff3 instead.  The exact text of
13332the message will vary depending on the system.  The
13333simplest solution is to upgrade to a current version of
13334@sc{cvs}, which does not rely on external
13335@code{rcsmerge} or @code{diff3} programs.
13336
13337@item warning: unrecognized response `@var{text}' from cvs server
13338If @var{text} contains a valid response (such as
13339@samp{ok}) followed by an extra carriage return
13340character (on many systems this will cause the second
13341part of the message to overwrite the first part), then
13342it probably means that you are using the @samp{:ext:}
13343access method with a version of rsh, such as most
13344non-unix rsh versions, which does not by default
13345provide a transparent data stream.  In such cases you
13346probably want to try @samp{:server:} instead of
13347@samp{:ext:}.  If @var{text} is something else, this
13348may signify a problem with your @sc{cvs} server.
13349Double-check your installation against the instructions
13350for setting up the @sc{cvs} server.
13351@c FIXCVS: should be printing CR as \r or \015 or some
13352@c such, probably.
13353
13354@item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
13355This is a normal message, not an error.  See
13356@ref{Concurrency}, for more details.
13357
13358@item cvs commit: warning: editor session failed
13359@cindex Exit status, of editor
13360This means that the editor which @sc{cvs} is using exits with a nonzero
13361exit status.  Some versions of vi will do this even when there was not
13362a problem editing the file.  If so, point the
13363@code{CVSEDITOR} environment variable to a small script
13364such as:
13365
13366@example
13367#!/bin/sh
13368vi $*
13369exit 0
13370@end example
13371
13372@c "warning: foo was lost" and "no longer pertinent" (both normal).
13373@c Would be nice to write these up--they are
13374@c potentially confusing for the new user.
13375@end table
13376
13377@node Connection
13378@appendixsec Trouble making a connection to a CVS server
13379
13380This section concerns what to do if you are having
13381trouble making a connection to a @sc{cvs} server.  If
13382you are running the @sc{cvs} command line client
13383running on Windows, first upgrade the client to
13384@sc{cvs} 1.9.12 or later.  The error reporting in
13385earlier versions provided much less information about
13386what the problem was.  If the client is non-Windows,
13387@sc{cvs} 1.9 should be fine.
13388
13389If the error messages are not sufficient to track down
13390the problem, the next steps depend largely on which
13391access method you are using.
13392
13393@table @code
13394@cindex :ext:, troubleshooting
13395@item :ext:
13396Try running the rsh program from the command line.  For
13397example: "rsh servername cvs -v" should print @sc{cvs}
13398version information.  If this doesn't work, you need to
13399fix it before you can worry about @sc{cvs} problems.
13400
13401@cindex :server:, troubleshooting
13402@item :server:
13403You don't need a command line rsh program to use this
13404access method, but if you have an rsh program around,
13405it may be useful as a debugging tool.  Follow the
13406directions given for :ext:.
13407
13408@cindex :pserver:, troubleshooting
13409@item :pserver:
13410Errors along the lines of "connection refused" typically indicate
13411that inetd isn't even listening for connections on port 2401
13412whereas errors like "connection reset by peer" or "recv() from
13413server: EOF" typically indicate that inetd is listening for
13414connections but is unable to start @sc{cvs} (this is frequently
13415caused by having an incorrect path in @file{inetd.conf}).
13416"unrecognized auth response" errors are caused by a bad command
13417line in @file{inetd.conf}, typically an invalid option or forgetting
13418to put the @samp{pserver} command at the end of the line.
13419Another less common problem is invisible control characters that
13420your editor "helpfully" added without you noticing.
13421
13422One good debugging tool is to "telnet servername
134232401".  After connecting, send any text (for example
13424"foo" followed by return).  If @sc{cvs} is working
13425correctly, it will respond with
13426
13427@example
13428cvs [pserver aborted]: bad auth protocol start: foo
13429@end example
13430
13431If instead you get:
13432
13433@example
13434Usage: cvs [cvs-options] command [command-options-and-arguments]
13435...
13436@end example
13437
13438then you're missing the @samp{pserver} command at the end of the
13439line in @file{inetd.conf}; check to make sure that the entire command
13440is on one line and that it's complete.
13441
13442Likewise, if you get something like:
13443
13444@example
13445Unknown command: `pserved'
13446
13447CVS commands are:
13448        add          Add a new file/directory to the repository
13449...
13450@end example
13451
13452then you've misspelled @samp{pserver} in some way.  If it isn't
13453obvious, check for invisible control characters (particularly
13454carriage returns) in @file{inetd.conf}.
13455
13456If it fails to work at all, then make sure inetd is working
13457right.  Change the invocation in @file{inetd.conf} to run the
13458echo program instead of cvs.  For example:
13459
13460@example
134612401  stream  tcp  nowait  root /bin/echo echo hello
13462@end example
13463
13464After making that change and instructing inetd to
13465re-read its configuration file, "telnet servername
134662401" should show you the text hello and then the
13467server should close the connection.  If this doesn't
13468work, you need to fix it before you can worry about
13469@sc{cvs} problems.
13470
13471On AIX systems, the system will often have its own
13472program trying to use port 2401.  This is AIX's problem
13473in the sense that port 2401 is registered for use with
13474@sc{cvs}.  I hear that there is an AIX patch available
13475to address this problem.
13476
13477Another good debugging tool is the @samp{-d}
13478(debugging) option to inetd.  Consult your system
13479documentation for more information.
13480
13481If you seem to be connecting but get errors like:
13482
13483@example
13484cvs server: cannot open /root/.cvsignore: Permission denied
13485cvs [server aborted]: can't chdir(/root): Permission denied
13486@end example
13487
13488then you probably haven't specified @samp{-f} in @file{inetd.conf}.
13489
13490If you can connect successfully for a while but then can't,
13491you've probably hit inetd's rate limit.
13492(If inetd receives too many requests for the same service
13493in a short period of time, it assumes that something is wrong
13494and temporarily disables the service.)
13495Check your inetd documentation to find out how to adjust the
13496rate limit (some versions of inetd have a single rate limit,
13497others allow you to set the limit for each service separately.)
13498@end table
13499
13500@node Other problems
13501@appendixsec Other common problems
13502
13503Here is a list of problems which do not fit into the
13504above categories.  They are in no particular order.
13505
13506@itemize @bullet
13507@item
13508On Windows, if there is a 30 second or so delay when
13509you run a @sc{cvs} command, it may mean that you have
13510your home directory set to @file{C:/}, for example (see
13511@code{HOMEDRIVE} and @code{HOMEPATH} in
13512@ref{Environment variables}).  @sc{cvs} expects the home
13513directory to not end in a slash, for example @file{C:}
13514or @file{C:\cvs}.
13515@c FIXCVS: CVS should at least detect this and print an
13516@c error, presumably.
13517
13518@item
13519If you are running @sc{cvs} 1.9.18 or older, and
13520@code{cvs update} finds a conflict and tries to
13521merge, as described in @ref{Conflicts example}, but
13522doesn't tell you there were conflicts, then you may
13523have an old version of @sc{rcs}.  The easiest solution
13524probably is to upgrade to a current version of
13525@sc{cvs}, which does not rely on external @sc{rcs}
13526programs.
13527@end itemize
13528
13529@c ---------------------------------------------------------------------
13530@node Credits
13531@appendix Credits
13532
13533@cindex Contributors (manual)
13534@cindex Credits (manual)
13535Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
13536wrote the manual pages which were distributed with
13537@sc{cvs} 1.3.  Much of their text was copied into this
13538manual.  He also read an early draft
13539of this manual and contributed many ideas and
13540corrections.
13541
13542The mailing-list @code{info-cvs} is sometimes
13543informative. I have included information from postings
13544made by the following persons:
13545David G. Grubbs <@t{dgg@@think.com}>.
13546
13547Some text has been extracted from the man pages for
13548@sc{rcs}.
13549
13550The @sc{cvs} @sc{faq} by David G. Grubbs has provided
13551useful material.  The @sc{faq} is no longer maintained,
13552however, and this manual is about the closest thing there
13553is to a successor (with respect to documenting how to
13554use @sc{cvs}, at least).
13555
13556In addition, the following persons have helped by
13557telling me about mistakes I've made:
13558
13559@display
13560Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
13561Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
13562Karl Pingle <@t{pingle@@acuson.com}>,
13563Thomas A Peterson <@t{tap@@src.honeywell.com}>,
13564Inge Wallin <@t{ingwa@@signum.se}>,
13565Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
13566and Michael Brown <@t{brown@@wi.extrel.com}>.
13567@end display
13568
13569The list of contributors here is not comprehensive; for a more
13570complete list of who has contributed to this manual see
13571the file @file{doc/ChangeLog} in the @sc{cvs} source
13572distribution.
13573
13574@c ---------------------------------------------------------------------
13575@node BUGS
13576@appendix Dealing with bugs in CVS or this manual
13577
13578@cindex Bugs in this manual or CVS
13579Neither @sc{cvs} nor this manual is perfect, and they
13580probably never will be.  If you are having trouble
13581using @sc{cvs}, or think you have found a bug, there
13582are a number of things you can do about it.  Note that
13583if the manual is unclear, that can be considered a bug
13584in the manual, so these problems are often worth doing
13585something about as well as problems with @sc{cvs} itself.
13586
13587@cindex Reporting bugs
13588@cindex Bugs, reporting
13589@cindex Errors, reporting
13590@itemize @bullet
13591@item
13592If you want someone to help you and fix bugs that you
13593report, there are companies which will do that for a
13594fee.  One such company is:
13595
13596@cindex Signum Support
13597@cindex Support, getting CVS support
13598@example
13599Signum Support AB
13600Box 2044
13601S-580 02  Linkoping
13602Sweden
13603Email: info@@signum.se
13604Phone: +46 (0)13 - 21 46 00
13605Fax:   +46 (0)13 - 21 47 00
13606http://www.signum.se/
13607
13608@end example
13609
13610@item
13611If you got @sc{cvs} through a distributor, such as an
13612operating system vendor or a vendor of freeware
13613@sc{cd-rom}s, you may wish to see whether the
13614distributor provides support.  Often, they will provide
13615no support or minimal support, but this may vary from
13616distributor to distributor.
13617
13618@item
13619If you have the skills and time to do so, you may wish
13620to fix the bug yourself.  If you wish to submit your
13621fix for inclusion in future releases of @sc{cvs}, see
13622the file @sc{hacking} in the @sc{cvs} source
13623distribution.  It contains much more information on the
13624process of submitting fixes.
13625
13626@item
13627There may be resources on the net which can help.  Two
13628good places to start are:
13629
13630@example
13631http://www.cvshome.org
13632http://www.loria.fr/~molli/cvs-index.html
13633@end example
13634
13635If you are so inspired, increasing the information
13636available on the net is likely to be appreciated.  For
13637example, before the standard @sc{cvs} distribution
13638worked on Windows 95, there was a web page with some
13639explanation and patches for running @sc{cvs} on Windows
1364095, and various people helped out by mentioning this
13641page on mailing lists or newsgroups when the subject
13642came up.
13643
13644@item
13645It is also possible to report bugs to @code{bug-cvs}.
13646Note that someone may or may not want to do anything
13647with your bug report---if you need a solution consider
13648one of the options mentioned above.  People probably do
13649want to hear about bugs which are particularly severe
13650in consequences and/or easy to fix, however.  You can
13651also increase your odds by being as clear as possible
13652about the exact nature of the bug and any other
13653relevant information.  The way to report bugs is to
13654send email to @code{bug-cvs@@gnu.org}.  Note
13655that submissions to @code{bug-cvs} may be distributed
13656under the terms of the @sc{gnu} Public License, so if
13657you don't like this, don't submit them.  There is
13658usually no justification for sending mail directly to
13659one of the @sc{cvs} maintainers rather than to
13660@code{bug-cvs}; those maintainers who want to hear
13661about such bug reports read @code{bug-cvs}.  Also note
13662that sending a bug report to other mailing lists or
13663newsgroups is @emph{not} a substitute for sending it to
13664@code{bug-cvs}.  It is fine to discuss @sc{cvs} bugs on
13665whatever forum you prefer, but there are not
13666necessarily any maintainers reading bug reports sent
13667anywhere except @code{bug-cvs}.
13668@end itemize
13669
13670@cindex Known bugs in this manual or CVS
13671People often ask if there is a list of known bugs or
13672whether a particular bug is a known one.  The file
13673@sc{bugs} in the @sc{cvs} source distribution is one
13674list of known bugs, but it doesn't necessarily try to
13675be comprehensive.  Perhaps there will never be a
13676comprehensive, detailed list of known bugs.
13677
13678@c ---------------------------------------------------------------------
13679@node Index
13680@unnumbered Index
13681@cindex Index
13682
13683@printindex cp
13684
13685@summarycontents
13686
13687@contents
13688
13689@bye
13690
13691Local Variables:
13692fill-column: 55
13693End:
13694