1\input texinfo  @c -*-texinfo-*-
2@comment Documentation for CVS.
3@setfilename cvs.info
4@afourpaper
5@comment $MirOS: src/gnu/usr.bin/cvs/doc/cvs.texinfo,v 1.20 2014/02/09 21:56:22 tg Exp $
6@macro copyleftnotice
7@noindent
8Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
9                       2001, 2002, 2003, 2004, 2005
10                       Free Software Foundation, Inc.
11
12@multitable @columnfractions .12 .88
13@item Portions
14@item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005
15                                  Derek R. Price,
16@item @tab Copyright @copyright{} 2002, 2003, 2004, 2005
17                                  Ximbiot @url{http://ximbiot.com},
18@item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
19@item @tab and Copyright @copyright{} others.
20@end multitable
21
22@ignore
23Permission is granted to process this file through Tex and print the
24results, provided the printed document carries copying permission
25notice identical to this one except for the removal of this paragraph
26(this paragraph not being relevant to the printed manual).
27
28@end ignore
29Permission is granted to make and distribute verbatim copies of
30this manual provided the copyright notice and this permission notice
31are preserved on all copies.
32
33Permission is granted to copy and distribute modified versions of this
34manual under the conditions for verbatim copying, provided also that the
35entire resulting derived work is distributed under the terms of a
36permission notice identical to this one.
37
38Permission is granted to copy and distribute translations of this manual
39into another language, under the above conditions for modified versions,
40except that this permission notice may be stated in a translation
41approved by the Free Software Foundation.
42@end macro
43
44@comment This file is part of the CVS distribution.
45
46@comment CVS is free software; you can redistribute it and/or modify
47@comment it under the terms of the GNU General Public License as published by
48@comment the Free Software Foundation; either version 2, or (at your option)
49@comment any later version.
50
51@comment CVS is distributed in the hope that it will be useful,
52@comment but WITHOUT ANY WARRANTY; without even the implied warranty of
53@comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54@comment GNU General Public License for more details.
55
56@c See ../README for A4 vs. US letter size.
57@c When we provided A4 postscript, and people tried to
58@c print it on US letter, the usual complaint was that the
59@c page numbers would get cut off.
60@c If one prints US letter on A4, reportedly there is
61@c some extra space at the top and/or bottom, and the side
62@c margins are a bit narrow, but no text is lost.
63@c
64@c See
65@c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
66@c for more on paper sizes.  Insuring that margins are
67@c big enough to print on either A4 or US letter does
68@c indeed seem to be the usual approach (RFC2346).
69
70@c This document seems to get overfull hboxes with some
71@c frequency (probably because the tendency is to
72@c sanity-check it with "make info" and run TeX less
73@c often).  The big ugly boxes just seem to add insult
74@c to injury, and I'm not aware of them helping to fix
75@c the overfull hboxes at all.
76@finalout
77
78@include version.texi
79@settitle CVS---Concurrent Versions System v@value{VERSION}
80@setchapternewpage odd
81
82@c -- TODO list:
83@c -- Fix all lines that match "^@c -- "
84@c -- Also places marked with FIXME should be manual
85@c problems (as opposed to FIXCVS for CVS problems).
86
87@c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
88@c @asis when generating info and dvi, and by <i></i> in the generated html,
89@c such that keywords are not expanded in the generated html.
90@ifnothtml
91@macro splitrcskeyword {arg}
92@asis{}\arg\
93@end macro
94@end ifnothtml
95
96@ifhtml
97@macro splitrcskeyword {arg}
98@i{}\arg\
99@end macro
100@end ifhtml
101
102@dircategory GNU Packages
103@direntry
104* CVS: (cvs).                   Concurrent Versions System
105@end direntry
106@dircategory Individual utilities
107@direntry
108* cvs: (cvs)CVS commands.       Concurrent Versions System
109@end direntry
110
111@comment The titlepage section does not appear in the Info file.
112@titlepage
113@sp 4
114@comment The title is printed in a large font.
115@center @titlefont{Version Management}
116@sp 1
117@center @titlefont{with}
118@sp 1
119@center @titlefont{CVS}
120@sp 2
121@center for @sc{cvs} @value{VERSION}
122@comment -release-
123@sp 3
124@center Per Cederqvist et al
125
126@comment  The following two commands start the copyright page
127@comment  for the printed manual.  This will not appear in the Info file.
128@page
129@vskip 0pt plus 1filll
130@copyleftnotice
131@end titlepage
132
133@summarycontents
134
135@contents
136
137@comment ================================================================
138@comment                   The real text starts here
139@comment ================================================================
140
141@ifnottex
142@c ---------------------------------------------------------------------
143@node    Top
144@top
145
146This info manual describes how to use and administer
147@sc{cvs} version @value{VERSION}.
148@end ifnottex
149
150@ifinfo
151@copyleftnotice
152@end ifinfo
153
154@c This menu is pretty long.  Not sure how easily that
155@c can be fixed (no brilliant ideas right away)...
156@menu
157* Overview::                    An introduction to CVS
158* Repository::                  Where all your sources are stored
159* Starting a new project::      Starting a project with CVS
160* Revisions::                   Numeric and symbolic names for revisions
161* Branching and merging::       Diverging/rejoining branches of development
162* Recursive behavior::          CVS descends directories
163* Adding and removing::         Adding/removing/renaming files/directories
164* History browsing::            Viewing the history of files in various ways
165
166CVS and the Real World.
167-----------------------
168* Binary files::                CVS can handle binary files
169* Multiple developers::         How CVS helps a group of developers
170* Revision management::         Policy questions for revision management
171* Keyword substitution::        CVS can include the revision inside the file
172* Tracking sources::            Tracking third-party sources
173* Builds::                      Issues related to CVS and builds
174* Special Files::		Devices, links and other non-regular files
175
176References.
177-----------
178* CVS commands::                CVS commands share some things
179* Invoking CVS::                Quick reference to CVS commands
180* Administrative files::        Reference manual for the Administrative files
181* Environment variables::       All environment variables which affect CVS
182* Compatibility::               Upgrading CVS versions
183* Troubleshooting::             Some tips when nothing works
184* Credits::                     Some of the contributors to this manual
185* BUGS::                        Dealing with bugs in CVS or this manual
186* Index::                       Index
187@end menu
188
189@c ---------------------------------------------------------------------
190@node Overview
191@chapter Overview
192@cindex Overview
193
194This chapter is for people who have never used
195@sc{cvs}, and perhaps have never used version control
196software before.
197
198If you are already familiar with @sc{cvs} and are just
199trying to learn a particular feature or remember a
200certain command, you can probably skip everything here.
201
202@menu
203* What is CVS?::                What you can do with @sc{cvs}
204* What is CVS not?::            Problems @sc{cvs} doesn't try to solve
205* A sample session::            A tour of basic @sc{cvs} usage
206@end menu
207
208@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
209@node What is CVS?
210@section What is CVS?
211@cindex What is CVS?
212@cindex Introduction to CVS
213@cindex CVS, introduction to
214
215@sc{cvs} is a version control system.  Using it, you can
216record the history of your source files.
217
218@c -- ///
219@c -- ///Those who cannot remember the past are condemned to repeat it.
220@c -- ///               -- George Santayana
221@c -- //////
222
223@c -- Insert history  quote here!
224For example, bugs sometimes creep in when
225software is modified, and you might not detect the bug
226until a long time after you make the modification.
227With @sc{cvs}, you can easily retrieve old versions to see
228exactly which change caused the bug.  This can
229sometimes be a big help.
230
231You could of course save every version of every file
232you have ever created.  This would
233however waste an enormous amount of disk space.  @sc{cvs}
234stores all the versions of a file in a single file in a
235clever way that only stores the differences between
236versions.
237
238@sc{cvs} also helps you if you are part of a group of people working
239on the same project.  It is all too easy to overwrite
240each others' changes unless you are extremely careful.
241Some editors, like @sc{gnu} Emacs, try to make sure that
242two people never modify the same file at the
243same time.  Unfortunately, if someone is using another
244editor, that safeguard will not work.  @sc{cvs} solves this problem
245by insulating the different developers from each other.  Every
246developer works in his own directory, and @sc{cvs} merges
247the work when each developer is done.
248
249@cindex History of CVS
250@cindex CVS, history of
251@cindex Credits (CVS program)
252@cindex Contributors (CVS program)
253@sc{cvs} started out as a bunch of shell scripts written by
254Dick Grune, posted to the newsgroup
255@code{comp.sources.unix} in the volume 6
256release of July, 1986.  While no actual code from
257these shell scripts is present in the current version
258of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
259come from them.
260
261In April, 1989, Brian Berliner designed and coded @sc{cvs}.
262Jeff Polk later helped Brian with the design of the @sc{cvs}
263module and vendor branch support.
264
265@cindex Source, getting CVS source
266You can get @sc{cvs} in a variety of ways, including
267free download from the Internet.  For more information
268on downloading @sc{cvs} and other @sc{cvs} topics, see:
269
270@example
271@url{http://cvs.nongnu.org/}
272@end example
273
274@cindex Mailing list
275@cindex List, mailing list
276@cindex Newsgroups
277There is a mailing list, known as @email{info-cvs@@nongnu.org},
278devoted to @sc{cvs}.  To subscribe or
279unsubscribe
280write to
281@email{info-cvs-request@@nongnu.org}.
282If you prefer a Usenet group, there is a one-way mirror (posts to the email
283list are usually sent to the news group, but not visa versa) of
284@email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}.  The right
285Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
286@sc{cvs} discussions (along with other configuration
287management systems).  In the future, it might be
288possible to create a
289@code{comp.software.config-mgmt.cvs}, but probably only
290if there is sufficient @sc{cvs} traffic on
291@url{news:comp.software.config-mgmt}.
292@c Other random data is that the tale was very
293@c skeptical of comp.software.config-mgmt.cvs when the
294@c subject came up around 1995 or so (for one
295@c thing, because creating it would be a "reorg" which
296@c would need to take a more comprehensive look at the
297@c whole comp.software.config-mgmt.* hierarchy).
298
299You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list,
300described in more detail in @ref{BUGS}.  To subscribe
301send mail to @email{bug-cvs-request@@nongnu.org}.  There is a two-way
302Usenet mirror (posts to the Usenet group are usually sent to the email list and
303visa versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}.
304
305@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
306@node What is CVS not?
307@section What is CVS not?
308@cindex What is CVS not?
309
310@sc{cvs} can do a lot of things for you, but it does
311not try to be everything for everyone.
312
313@table @asis
314@item @sc{cvs} is not a build system.
315
316Though the structure of your repository and modules
317file interact with your build system
318(e.g. @file{Makefile}s), they are essentially
319independent.
320
321@sc{cvs} does not dictate how you build anything.  It
322merely stores files for retrieval in a tree structure
323you devise.
324
325@sc{cvs} does not dictate how to use disk space in the
326checked out working directories.  If you write your
327@file{Makefile}s or scripts in every directory so they
328have to know the relative positions of everything else,
329you wind up requiring the entire repository to be
330checked out.
331
332If you modularize your work, and construct a build
333system that will share files (via links, mounts,
334@code{VPATH} in @file{Makefile}s, etc.), you can
335arrange your disk usage however you like.
336
337But you have to remember that @emph{any} such system is
338a lot of work to construct and maintain.  @sc{cvs} does
339not address the issues involved.
340
341Of course, you should place the tools created to
342support such a build system (scripts, @file{Makefile}s,
343etc) under @sc{cvs}.
344
345Figuring out what files need to be rebuilt when
346something changes is, again, something to be handled
347outside the scope of @sc{cvs}.  One traditional
348approach is to use @code{make} for building, and use
349some automated tool for generating the dependencies which
350@code{make} uses.
351
352See @ref{Builds}, for more information on doing builds
353in conjunction with @sc{cvs}.
354
355@item @sc{cvs} is not a substitute for management.
356
357Your managers and project leaders are expected to talk
358to you frequently enough to make certain you are aware
359of schedules, merge points, branch names and release
360dates.  If they don't, @sc{cvs} can't help.
361
362@sc{cvs} is an instrument for making sources dance to
363your tune.  But you are the piper and the composer.  No
364instrument plays itself or writes its own music.
365
366@item @sc{cvs} is not a substitute for developer communication.
367
368When faced with conflicts within a single file, most
369developers manage to resolve them without too much
370effort.  But a more general definition of ``conflict''
371includes problems too difficult to solve without
372communication between developers.
373
374@sc{cvs} cannot determine when simultaneous changes
375within a single file, or across a whole collection of
376files, will logically conflict with one another.  Its
377concept of a @dfn{conflict} is purely textual, arising
378when two changes to the same base file are near enough
379to spook the merge (i.e. @code{diff3}) command.
380
381@sc{cvs} does not claim to help at all in figuring out
382non-textual or distributed conflicts in program logic.
383
384For example: Say you change the arguments to function
385@code{X} defined in file @file{A}.  At the same time,
386someone edits file @file{B}, adding new calls to
387function @code{X} using the old arguments.  You are
388outside the realm of @sc{cvs}'s competence.
389
390Acquire the habit of reading specs and talking to your
391peers.
392
393
394@item @sc{cvs} does not have change control
395
396Change control refers to a number of things.  First of
397all it can mean @dfn{bug-tracking}, that is being able
398to keep a database of reported bugs and the status of
399each one (is it fixed?  in what release?  has the bug
400submitter agreed that it is fixed?).  For interfacing
401@sc{cvs} to an external bug-tracking system, see the
402@file{rcsinfo} and @file{verifymsg} files
403(@pxref{Administrative files}).
404
405Another aspect of change control is keeping track of
406the fact that changes to several files were in fact
407changed together as one logical change.  If you check
408in several files in a single @code{cvs commit}
409operation, @sc{cvs} then forgets that those files were
410checked in together, and the fact that they have the
411same log message is the only thing tying them
412together.  Keeping a @sc{gnu} style @file{ChangeLog}
413can help somewhat.
414@c FIXME: should have an xref to a section which talks
415@c more about keeping ChangeLog's with CVS, but that
416@c section hasn't been written yet.
417
418Another aspect of change control, in some systems, is
419the ability to keep track of the status of each
420change.  Some changes have been written by a developer,
421others have been reviewed by a second developer, and so
422on.  Generally, the way to do this with @sc{cvs} is to
423generate a diff (using @code{cvs diff} or @code{diff})
424and email it to someone who can then apply it using the
425@code{patch} utility.  This is very flexible, but
426depends on mechanisms outside @sc{cvs} to make sure
427nothing falls through the cracks.
428
429@item @sc{cvs} is not an automated testing program
430
431It should be possible to enforce mandatory use of a
432test suite using the @code{commitinfo} file.  I haven't
433heard a lot about projects trying to do that or whether
434there are subtle gotchas, however.
435
436@item @sc{cvs} does not have a built-in process model
437
438Some systems provide ways to ensure that changes or
439releases go through various steps, with various
440approvals as needed.  Generally, one can accomplish
441this with @sc{cvs} but it might be a little more work.
442In some cases you'll want to use the @file{commitinfo},
443@file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
444files, to require that certain steps be performed
445before cvs will allow a checkin.  Also consider whether
446features such as branches and tags can be used to
447perform tasks such as doing work in a development tree
448and then merging certain changes over to a stable tree
449only once they have been proven.
450@end table
451
452@c ---------------------------------------------------------------------
453@node A sample session
454@section A sample session
455@cindex Example of a work-session
456@cindex Getting started
457@cindex Work-session, example of
458@cindex tc, Trivial Compiler (example)
459@cindex Trivial Compiler (example)
460
461@c I think an example is a pretty good way to start.  But
462@c somewhere in here, maybe after the sample session,
463@c we need something which is kind of
464@c a "roadmap" which is more directed at sketching out
465@c the functionality of CVS and pointing people to
466@c various other parts of the manual.  As it stands now
467@c people who read in order get dumped right into all
468@c manner of hair regarding remote repositories,
469@c creating a repository, etc.
470@c
471@c The following was in the old Basic concepts node.  I don't
472@c know how good a job it does at introducing modules,
473@c or whether they need to be introduced so soon, but
474@c something of this sort might go into some
475@c introductory material somewhere.
476@ignore
477@cindex Modules (intro)
478The repository contains directories and files, in an
479arbitrary tree.  The @dfn{modules} feature can be used
480to group together a set of directories or files into a
481single entity (@pxref{modules}).  A typical usage is to
482define one module per project.
483@end ignore
484
485As a way of introducing @sc{cvs}, we'll go through a
486typical work-session using @sc{cvs}.  The first thing
487to understand is that @sc{cvs} stores all files in a
488centralized @dfn{repository} (@pxref{Repository}); this
489section assumes that a repository is set up.
490@c I'm not sure that the sentence concerning the
491@c repository quite tells the user what they need to
492@c know at this point.  Might need to expand on "centralized"
493@c slightly (maybe not here, maybe further down in the example?)
494
495Suppose you are working on a simple compiler.  The source
496consists of a handful of C files and a @file{Makefile}.
497The compiler is called @samp{tc} (Trivial Compiler),
498and the repository is set up so that there is a module
499called @samp{tc}.
500
501@menu
502* Getting the source::          Creating a workspace
503* Committing your changes::     Making your work available to others
504* Cleaning up::                 Cleaning up
505* Viewing differences::         Viewing differences
506@end menu
507
508@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
509@node Getting the source
510@subsection Getting the source
511@cindex Getting the source
512@cindex Checking out source
513@cindex Fetching source
514@cindex Source, getting from CVS
515@cindex Checkout, example
516
517The first thing you must do is to get your own working copy of the
518source for @samp{tc}.  For this, you use the @code{checkout} command:
519
520@example
521$ cvs checkout tc
522@end example
523
524@noindent
525This will create a new directory called @file{tc} and populate it with
526the source files.
527
528@example
529$ cd tc
530$ ls
531CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
532@end example
533
534The @file{CVS} directory is used internally by
535@sc{cvs}.  Normally, you should not modify or remove
536any of the files in it.
537
538You start your favorite editor, hack away at @file{backend.c}, and a couple
539of hours later you have added an optimization pass to the compiler.
540A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
541you want to edit.  @xref{Multiple developers}, for an explanation.
542
543@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
544@node Committing your changes
545@subsection Committing your changes
546@cindex Committing changes to files
547@cindex Log message entry
548
549When you have checked that the compiler is still compilable you decide
550to make a new version of @file{backend.c}.  This will
551store your new @file{backend.c} in the repository and
552make it available to anyone else who is using that same
553repository.
554
555@example
556$ cvs commit backend.c
557@end example
558
559@noindent
560@sc{cvs} starts an editor, to allow you to enter a log
561message.  You type in ``Added an optimization pass.'',
562save the temporary file, and exit the editor.
563
564@cindex CVSEDITOR, environment variable
565@cindex EDITOR, environment variable
566The environment variable @code{$CVSEDITOR} determines
567which editor is started.  If @code{$CVSEDITOR} is not
568set, then if the environment variable @code{$EDITOR} is
569set, it will be used. If both @code{$CVSEDITOR} and
570@code{$EDITOR} are not set then there is a default
571which will vary with your operating system, for example
572@code{vi} for unix or @code{notepad} for Windows
573NT/95.
574
575@cindex VISUAL, environment variable
576In addition, @sc{cvs} checks the @code{$VISUAL} environment
577variable.  Opinions vary on whether this behavior is desirable and
578whether future releases of @sc{cvs} should check @code{$VISUAL} or
579ignore it.  You will be OK either way if you make sure that
580@code{$VISUAL} is either unset or set to the same thing as
581@code{$EDITOR}.
582
583@c This probably should go into some new node
584@c containing detailed info on the editor, rather than
585@c the intro.  In fact, perhaps some of the stuff with
586@c CVSEDITOR and -m and so on should too.
587When @sc{cvs} starts the editor, it includes a list of
588files which are modified.  For the @sc{cvs} client,
589this list is based on comparing the modification time
590of the file against the modification time that the file
591had when it was last gotten or updated.  Therefore, if
592a file's modification time has changed but its contents
593have not, it will show up as modified.  The simplest
594way to handle this is simply not to worry about it---if
595you proceed with the commit @sc{cvs} will detect that
596the contents are not modified and treat it as an
597unmodified file.  The next @code{update} will clue
598@sc{cvs} in to the fact that the file is unmodified,
599and it will reset its stored timestamp so that the file
600will not show up in future editor sessions.
601@c FIXCVS: Might be nice if "commit" and other commands
602@c would reset that timestamp too, but currently commit
603@c doesn't.
604@c FIXME: Need to talk more about the process of
605@c prompting for the log message.  Like show an example
606@c of what it pops up in the editor, for example.  Also
607@c a discussion of how to get the "a)bort, c)ontinue,
608@c e)dit" prompt and what to do with it.  Might also
609@c work in the suggestion that if you want a diff, you
610@c should make it before running commit (someone
611@c suggested that the diff pop up in the editor.  I'm
612@c not sure that is better than telling people to run
613@c "cvs diff" first if that is what they want, but if
614@c we want to tell people that, the manual possibly
615@c should say it).
616
617If you want to avoid
618starting an editor you can specify the log message on
619the command line using the @samp{-m} flag instead, like
620this:
621
622@example
623$ cvs commit -m "Added an optimization pass" backend.c
624@end example
625
626@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
627@node Cleaning up
628@subsection Cleaning up
629@cindex Cleaning up
630@cindex Working copy, removing
631@cindex Removing your working copy
632@cindex Releasing your working copy
633
634Before you turn to other tasks you decide to remove your working copy of
635tc.  One acceptable way to do that is of course
636
637@example
638$ cd ..
639$ rm -r tc
640@end example
641
642@noindent
643but a better way is to use the @code{release} command (@pxref{release}):
644
645@example
646$ cd ..
647$ cvs release -d tc
648M driver.c
649? tc
650You have [1] altered files in this repository.
651Are you sure you want to release (and delete) directory `tc': n
652** `release' aborted by user choice.
653@end example
654
655The @code{release} command checks that all your modifications have been
656committed.  If history logging is enabled it also makes a note in the
657history file.  @xref{history file}.
658
659When you use the @samp{-d} flag with @code{release}, it
660also removes your working copy.
661
662In the example above, the @code{release} command wrote a couple of lines
663of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
664That is nothing to worry about: @file{tc} is the executable compiler,
665and it should not be stored in the repository.  @xref{cvsignore},
666for information about how to make that warning go away.
667@xref{release output}, for a complete explanation of
668all possible output from @code{release}.
669
670@samp{M driver.c} is more serious.  It means that the
671file @file{driver.c} has been modified since it was
672checked out.
673
674The @code{release} command always finishes by telling
675you how many modified files you have in your working
676copy of the sources, and then asks you for confirmation
677before deleting any files or making any note in the
678history file.
679
680You decide to play it safe and answer @kbd{n @key{RET}}
681when @code{release} asks for confirmation.
682
683@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
684@node Viewing differences
685@subsection Viewing differences
686@cindex Viewing differences
687@cindex Diff
688
689You do not remember modifying @file{driver.c}, so you want to see what
690has happened to that file.
691
692@example
693$ cd tc
694$ cvs diff driver.c
695@end example
696
697This command runs @code{diff} to compare the version of @file{driver.c}
698that you checked out with your working copy.  When you see the output
699you remember that you added a command line option that enabled the
700optimization pass.  You check it in, and release the module.
701@c FIXME: we haven't yet defined the term "check in".
702
703@example
704$ cvs commit -m "Added an optimization pass" driver.c
705Checking in driver.c;
706/usr/local/cvsroot/tc/driver.c,v  <--  driver.c
707new revision: 1.2; previous revision: 1.1
708done
709$ cd ..
710$ cvs release -d tc
711? tc
712You have [0] altered files in this repository.
713Are you sure you want to release (and delete) directory `tc': y
714@end example
715
716@c ---------------------------------------------------------------------
717@node Repository
718@chapter The Repository
719@cindex Repository (intro)
720@cindex Repository, example
721@cindex Layout of repository
722@cindex Typical repository
723@cindex /usr/local/cvsroot, as example repository
724@cindex cvsroot
725
726The @sc{cvs} @dfn{repository} stores a complete copy of
727all the files and directories which are under version
728control.
729
730Normally, you never access any of the files in the
731repository directly.  Instead, you use @sc{cvs}
732commands to get your own copy of the files into a
733@dfn{working directory}, and then
734work on that copy.  When you've finished a set of
735changes, you check (or @dfn{commit}) them back into the
736repository.  The repository then contains the changes
737which you have made, as well as recording exactly what
738you changed, when you changed it, and other such
739information.  Note that the repository is not a
740subdirectory of the working directory, or vice versa;
741they should be in separate locations.
742@c Need some example, e.g. repository
743@c /usr/local/cvsroot; working directory
744@c /home/joe/sources.  But this node is too long
745@c as it is; need a little reorganization...
746
747@cindex local method, setting up
748@sc{cvs} can access a repository by a variety of
749means.  It might be on the local computer, or it might
750be on a computer across the room or across the world.
751To distinguish various ways to access a repository, the
752repository name can start with an @dfn{access method}.
753For example, the access method @code{:local:} means to
754access a repository directory, so the repository
755@code{:local:/usr/local/cvsroot} means that the
756repository is in @file{/usr/local/cvsroot} on the
757computer running @sc{cvs}.  For information on other
758access methods, see @ref{Remote repositories}.
759
760@c Can se say this more concisely?  Like by passing
761@c more of the buck to the Remote repositories node?
762If the access method is omitted, then if the repository
763starts with @samp{/}, then @code{:local:} is
764assumed.  If it does not start with @samp{/} then either
765@code{:ext:} or @code{:server:} is assumed.  For
766example, if you have a local repository in
767@file{/usr/local/cvsroot}, you can use
768@code{/usr/local/cvsroot} instead of
769@code{:local:/usr/local/cvsroot}.  But if (under
770Windows NT, for example) your local repository is
771@file{c:\src\cvsroot}, then you must specify the access
772method, as in @code{:local:c:/src/cvsroot}.
773
774@c This might appear to go in Repository storage, but
775@c actually it is describing something which is quite
776@c user-visible, when you do a "cvs co CVSROOT".  This
777@c isn't necessary the perfect place for that, though.
778The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
779administrative files for @sc{cvs}.  The other directories contain the actual
780user-defined modules.
781
782@menu
783* Specifying a repository::     Telling CVS where your repository is
784* Repository storage::          The structure of the repository
785* Working directory storage::   The structure of working directories
786* Intro administrative files::  Defining modules
787* Multiple repositories::       Multiple repositories
788* Creating a repository::       Creating a repository
789* Backing up::                  Backing up a repository
790* Moving a repository::         Moving a repository
791* Remote repositories::         Accessing repositories on remote machines
792* Read-only access::            Granting read-only access to the repository
793* Server temporary directory::  The server creates temporary directories
794@end menu
795
796@node Specifying a repository
797@section Telling CVS where your repository is
798
799There are several ways to tell @sc{cvs}
800where to find the repository.  You can name the
801repository on the command line explicitly, with the
802@code{-d} (for "directory") option:
803
804@example
805cvs -d /usr/local/cvsroot checkout yoyodyne/tc
806@end example
807
808@cindex .profile, setting CVSROOT in
809@cindex .cshrc, setting CVSROOT in
810@cindex .tcshrc, setting CVSROOT in
811@cindex .bashrc, setting CVSROOT in
812@cindex CVSROOT, environment variable
813        Or you can set the @code{$CVSROOT} environment
814variable to an absolute path to the root of the
815repository, @file{/usr/local/cvsroot} in this example.
816To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
817users should have this line in their @file{.cshrc} or
818@file{.tcshrc} files:
819
820@example
821setenv CVSROOT /usr/local/cvsroot
822@end example
823
824@noindent
825@code{sh} and @code{bash} users should instead have these lines in their
826@file{.profile} or @file{.bashrc}:
827
828@example
829CVSROOT=/usr/local/cvsroot
830export CVSROOT
831@end example
832
833@cindex Root file, in CVS directory
834@cindex CVS/Root file
835        A repository specified with @code{-d} will
836override the @code{$CVSROOT} environment variable.
837Once you've checked a working copy out from the
838repository, it will remember where its repository is
839(the information is recorded in the
840@file{CVS/Root} file in the working copy).
841
842The @code{-d} option and the @file{CVS/Root} file both
843override the @code{$CVSROOT} environment variable.  If
844@code{-d} option differs from @file{CVS/Root}, the
845former is used.  Of course, for proper operation they
846should be two ways of referring to the same repository.
847
848@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
849@node Repository storage
850@section How data is stored in the repository
851@cindex Repository, how data is stored
852
853For most purposes it isn't important @emph{how}
854@sc{cvs} stores information in the repository.  In
855fact, the format has changed in the past, and is likely
856to change in the future.  Since in almost all cases one
857accesses the repository via @sc{cvs} commands, such
858changes need not be disruptive.
859
860However, in some cases it may be necessary to
861understand how @sc{cvs} stores data in the repository,
862for example you might need to track down @sc{cvs} locks
863(@pxref{Concurrency}) or you might need to deal with
864the file permissions appropriate for the repository.
865
866@menu
867* Repository files::            What files are stored in the repository
868* File permissions::            File permissions
869* Windows permissions::         Issues specific to Windows
870* Attic::                       Some files are stored in the Attic
871* CVS in repository::           Additional information in CVS directory
872* Locks::                       CVS locks control concurrent accesses
873* CVSROOT storage::             A few things about CVSROOT are different
874@end menu
875
876@node Repository files
877@subsection Where files are stored within the repository
878
879@c @cindex Filenames, legal
880@c @cindex Legal filenames
881@c Somewhere we need to say something about legitimate
882@c characters in filenames in working directory and
883@c repository.  Not "/" (not even on non-unix).  And
884@c here is a specific set of issues:
885@c 	Files starting with a - are handled inconsistently. They can not
886@c   be added to a repository with an add command, because it they are
887@c   interpreted as a switch. They can appear in a repository if they are
888@c   part of a tree that is imported. They can not be removed from the tree
889@c   once they are there.
890@c Note that "--" *is* supported (as a
891@c consequence of using GNU getopt).  Should document
892@c this somewhere ("Common options"?).  The other usual technique,
893@c "./-foo", isn't as effective, at least for "cvs add"
894@c which doesn't support pathnames containing "/".
895
896The overall structure of the repository is a directory
897tree corresponding to the directories in the working
898directory.  For example, supposing the repository is in
899
900@example
901/usr/local/cvsroot
902@end example
903
904@noindent
905here is a possible directory tree (showing only the
906directories):
907
908@example
909@t{/usr}
910 |
911 +--@t{local}
912 |   |
913 |   +--@t{cvsroot}
914 |   |    |
915 |   |    +--@t{CVSROOT}
916          |      (administrative files)
917          |
918          +--@t{gnu}
919          |   |
920          |   +--@t{diff}
921          |   |   (source code to @sc{gnu} diff)
922          |   |
923          |   +--@t{rcs}
924          |   |   (source code to @sc{rcs})
925          |   |
926          |   +--@t{cvs}
927          |       (source code to @sc{cvs})
928          |
929          +--@t{yoyodyne}
930              |
931              +--@t{tc}
932              |    |
933              |    +--@t{man}
934              |    |
935              |    +--@t{testing}
936              |
937              +--(other Yoyodyne software)
938@end example
939
940With the directories are @dfn{history files} for each file
941under version control.  The name of the history file is
942the name of the corresponding file with @samp{,v}
943appended to the end.  Here is what the repository for
944the @file{yoyodyne/tc} directory might look like:
945@c FIXME: Should also mention CVS (CVSREP)
946@c FIXME? Should we introduce Attic with an xref to
947@c Attic?  Not sure whether that is a good idea or not.
948@example
949  @code{$CVSROOT}
950    |
951    +--@t{yoyodyne}
952    |   |
953    |   +--@t{tc}
954    |   |   |
955            +--@t{Makefile,v}
956            +--@t{backend.c,v}
957            +--@t{driver.c,v}
958            +--@t{frontend.c,v}
959            +--@t{parser.c,v}
960            +--@t{man}
961            |    |
962            |    +--@t{tc.1,v}
963            |
964            +--@t{testing}
965                 |
966                 +--@t{testpgm.t,v}
967                 +--@t{test2.t,v}
968@end example
969
970@cindex History files
971@cindex RCS history files
972@c The first sentence, about what history files
973@c contain, is kind of redundant with our intro to what the
974@c repository does in node Repository....
975The history files contain, among other things, enough
976information to recreate any revision of the file, a log
977of all commit messages and the user-name of the person
978who committed the revision.  The history files are
979known as @dfn{RCS files}, because the first program to
980store files in that format was a version control system
981known as @sc{rcs}.  For a full
982description of the file format, see the @code{man} page
983@cite{rcsfile(5)}, distributed with @sc{rcs}, or the
984file @file{doc/RCSFILES} in the @sc{cvs} source
985distribution.  This
986file format has become very common---many systems other
987than @sc{cvs} or @sc{rcs} can at least import history
988files in this format.
989@c FIXME: Think about including documentation for this
990@c rather than citing it?  In the long run, getting
991@c this to be a standard (not sure if we can cope with
992@c a standards process as formal as IEEE/ANSI/ISO/etc,
993@c though...) is the way to go, so maybe citing is
994@c better.
995
996The @sc{rcs} files used in @sc{cvs} differ in a few
997ways from the standard format.  The biggest difference
998is magic branches; for more information see @ref{Magic
999branch numbers}.  Also in @sc{cvs} the valid tag names
1000are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
1001rules see @ref{Tags}.
1002
1003@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1004@node File permissions
1005@subsection File permissions
1006@c -- Move this to @node Creating a repository or similar
1007@cindex Security, file permissions in repository
1008@cindex File permissions, general
1009@cindex Permissions, general
1010@c FIXME: we need to somehow reflect "permissions in
1011@c repository" versus "permissions in working
1012@c directory" in the index entries.
1013@cindex Group, UNIX file permissions, in repository
1014@cindex Read-only files, in repository
1015All @samp{,v} files are created read-only, and you
1016should not change the permission of those files.  The
1017directories inside the repository should be writable by
1018the persons that have permission to modify the files in
1019each directory.  This normally means that you must
1020create a UNIX group (see group(5)) consisting of the
1021persons that are to edit the files in a project, and
1022set up the repository so that it is that group that
1023owns the directory.
1024(On some systems, you also need to set the set-group-ID-on-execution bit
1025on the repository directories (see chmod(1)) so that newly-created files
1026and directories get the group-ID of the parent directory rather than
1027that of the current process.)
1028
1029@c See also comment in commitinfo node regarding cases
1030@c which are really awkward with unix groups.
1031
1032This means that you can only control access to files on
1033a per-directory basis.
1034
1035Note that users must also have write access to check
1036out files, because @sc{cvs} needs to create lock files
1037(@pxref{Concurrency}).  You can use LockDir in CVSROOT/config
1038to put the lock files somewhere other than in the repository
1039if you want to allow read-only access to some directories
1040(@pxref{config}).
1041
1042@c CVS seems to use CVSUMASK in picking permissions for
1043@c val-tags, but maybe we should say more about this.
1044@c Like val-tags gets created by someone who doesn't
1045@c have CVSUMASK set right?
1046@cindex CVSROOT/val-tags file, and read-only access to projects
1047@cindex val-tags file, and read-only access to projects
1048Also note that users must have write access to the
1049@file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1050track of what tags are valid tag names (it is sometimes
1051updated when tags are used, as well as when they are
1052created).
1053
1054Each @sc{rcs} file will be owned by the user who last
1055checked it in.  This has little significance; what
1056really matters is who owns the directories.
1057
1058@cindex CVSUMASK, environment variable
1059@cindex Umask, for repository files
1060@sc{cvs} tries to set up reasonable file permissions
1061for new directories that are added inside the tree, but
1062you must fix the permissions manually when a new
1063directory should have different permissions than its
1064parent directory.  If you set the @code{CVSUMASK}
1065environment variable that will control the file
1066permissions which @sc{cvs} uses in creating directories
1067and/or files in the repository.  @code{CVSUMASK} does
1068not affect the file permissions in the working
1069directory; such files have the permissions which are
1070typical for newly created files, except that sometimes
1071@sc{cvs} creates them read-only (see the sections on
1072watches, @ref{Setting a watch}; -r, @ref{Global
1073options}; or @code{CVSREAD}, @ref{Environment variables}).
1074@c FIXME: Need more discussion of which
1075@c group should own the file in the repository.
1076@c Include a somewhat detailed example of the usual
1077@c case where CVSUMASK is 007, the developers are all
1078@c in a group, and that group owns stuff in the
1079@c repository.  Need to talk about group ownership of
1080@c newly-created directories/files (on some unices,
1081@c such as SunOS4, setting the setgid bit on the
1082@c directories will make files inherit the directory's
1083@c group.  On other unices, your mileage may vary.  I
1084@c can't remember what POSIX says about this, if
1085@c anything).
1086
1087Note that using the client/server @sc{cvs}
1088(@pxref{Remote repositories}), there is no good way to
1089set @code{CVSUMASK}; the setting on the client machine
1090has no effect.  If you are connecting with @code{rsh}, you
1091can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1092described in the documentation for your operating
1093system.  This behavior might change in future versions
1094of @sc{cvs}; do not rely on the setting of
1095@code{CVSUMASK} on the client having no effect.
1096@c FIXME: need to explain what a umask is or cite
1097@c someplace which does.
1098@c
1099@c There is also a larger (largely separate) issue
1100@c about the meaning of CVSUMASK in a non-unix context.
1101@c For example, whether there is
1102@c an equivalent which fits better into other
1103@c protection schemes like POSIX.6, VMS, &c.
1104@c
1105@c FIXME: Need one place which discusses this
1106@c read-only files thing.  Why would one use -r or
1107@c CVSREAD?  Why would one use watches?  How do they
1108@c interact?
1109@c
1110@c FIXME: We need to state
1111@c whether using CVSUMASK removes the need for manually
1112@c fixing permissions (in fact, if we are going to mention
1113@c manually fixing permission, we better document a lot
1114@c better just what we mean by "fix").
1115
1116Using pserver, you will generally need stricter
1117permissions on the @sc{cvsroot} directory and
1118directories above it in the tree; see @ref{Password
1119authentication security}.
1120
1121@cindex Setuid
1122@cindex Setgid
1123@cindex Security, setuid
1124@cindex Installed images (VMS)
1125Some operating systems have features which allow a
1126particular program to run with the ability to perform
1127operations which the caller of the program could not.
1128For example, the set user ID (setuid) or set group ID
1129(setgid) features of unix or the installed image
1130feature of VMS.  @sc{cvs} was not written to use such
1131features and therefore attempting to install @sc{cvs} in
1132this fashion will provide protection against only
1133accidental lapses; anyone who is trying to circumvent
1134the measure will be able to do so, and depending on how
1135you have set it up may gain access to more than just
1136@sc{cvs}.  You may wish to instead consider pserver.  It
1137shares some of the same attributes, in terms of
1138possibly providing a false sense of security or opening
1139security holes wider than the ones you are trying to
1140fix, so read the documentation on pserver security
1141carefully if you are considering this option
1142(@ref{Password authentication security}).
1143
1144@node Windows permissions
1145@subsection File Permission issues specific to Windows
1146@cindex Windows, and permissions
1147@cindex File permissions, Windows-specific
1148@cindex Permissions, Windows-specific
1149
1150Some file permission issues are specific to Windows
1151operating systems (Windows 95, Windows NT, and
1152presumably future operating systems in this family.
1153Some of the following might apply to OS/2 but I'm not
1154sure).
1155
1156If you are using local @sc{cvs} and the repository is on a
1157networked file system which is served by the Samba SMB
1158server, some people have reported problems with
1159permissions.  Enabling WRITE=YES in the samba
1160configuration is said to fix/workaround it.
1161Disclaimer: I haven't investigated enough to know the
1162implications of enabling that option, nor do I know
1163whether there is something which @sc{cvs} could be doing
1164differently in order to avoid the problem.  If you find
1165something out, please let us know as described in
1166@ref{BUGS}.
1167
1168@node Attic
1169@subsection The attic
1170@cindex Attic
1171
1172You will notice that sometimes @sc{cvs} stores an
1173@sc{rcs} file in the @code{Attic}.  For example, if the
1174@sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1175talking about the file @file{backend.c} in the
1176directory @file{yoyodyne/tc}, then the file normally
1177would be in
1178
1179@example
1180/usr/local/cvsroot/yoyodyne/tc/backend.c,v
1181@end example
1182
1183@noindent
1184but if it goes in the attic, it would be in
1185
1186@example
1187/usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1188@end example
1189
1190@noindent
1191@cindex Dead state
1192instead.  It should not matter from a user point of
1193view whether a file is in the attic; @sc{cvs} keeps
1194track of this and looks in the attic when it needs to.
1195But in case you want to know, the rule is that the RCS
1196file is stored in the attic if and only if the head
1197revision on the trunk has state @code{dead}.  A
1198@code{dead} state means that file has been removed, or
1199never added, for that revision.  For example, if you
1200add a file on a branch, it will have a trunk revision
1201in @code{dead} state, and a branch revision in a
1202non-@code{dead} state.
1203@c Probably should have some more concrete examples
1204@c here, or somewhere (not sure exactly how we should
1205@c arrange the discussion of the dead state, versus
1206@c discussion of the attic).
1207
1208@node CVS in repository
1209@subsection The CVS directory in the repository
1210@cindex CVS directory, in repository
1211
1212The @file{CVS} directory in each repository directory
1213contains information such as file attributes (in a file
1214called @file{CVS/fileattr}.  In the
1215future additional files may be added to this directory,
1216so implementations should silently ignore additional
1217files.
1218
1219This behavior is implemented only by @sc{cvs} 1.7 and
1220later; for details see @ref{Watches Compatibility}.
1221
1222The format of the @file{fileattr} file is a series of entries
1223of the following form (where @samp{@{} and @samp{@}}
1224means the text between the braces can be repeated zero
1225or more times):
1226
1227@var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1228  @{; @var{attrname} = @var{attrval}@} <linefeed>
1229
1230@var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1231attributes for that file.
1232
1233@var{ent-type} is @samp{D},
1234and @var{filename} empty, to specify default attributes
1235to be used for newly added files.
1236
1237Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1238will delete them any time it writes file attributes.
1239@sc{cvs} 1.10 and later will preserve them.
1240
1241Note that the order of the lines is not significant;
1242a program writing the fileattr file may
1243rearrange them at its convenience.
1244
1245There is currently no way of quoting tabs or line feeds in the
1246filename, @samp{=} in @var{attrname},
1247@samp{;} in @var{attrval}, etc.  Note: some implementations also
1248don't handle a NUL character in any of the fields, but
1249implementations are encouraged to allow it.
1250
1251By convention, @var{attrname} starting with @samp{_} is for an attribute given
1252special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1253(or will be, once implementations start supporting user-defined attributes).
1254
1255Built-in attributes:
1256
1257@table @code
1258@item _watched
1259Present means the file is watched and should be checked out
1260read-only.
1261
1262@item _watchers
1263Users with watches for this file.  Value is
1264@var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1265where @var{watcher} is a username, and @var{type}
1266is zero or more of edit,unedit,commit separated by
1267@samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1268
1269@item _editors
1270Users editing this file.  Value is
1271@var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1272where @var{editor} is a username, and @var{val} is
1273@var{time}+@var{hostname}+@var{pathname}, where
1274@var{time} is when the @code{cvs edit} command (or
1275equivalent) happened,
1276and @var{hostname} and @var{pathname} are for the working directory.
1277@end table
1278
1279Example:
1280
1281@c FIXME: sanity.sh should contain a similar test case
1282@c so we can compare this example from something from
1283@c Real Life(TM).  See cvsclient.texi (under Notify) for more
1284@c discussion of the date format of _editors.
1285@example
1286Ffile1 _watched=;_watchers=joe>edit,mary>commit
1287Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1288D _watched=
1289@end example
1290
1291@noindent
1292means that the file @file{file1} should be checked out
1293read-only.  Furthermore, joe is watching for edits and
1294mary is watching for commits.  The file @file{file2}
1295should be checked out read-only; sue started editing it
1296on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1297the machine @code{workstn1}.  Future files which are
1298added should be checked out read-only.  To represent
1299this example here, we have shown a space after
1300@samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1301there must be a single tab character there and no spaces.
1302
1303@node Locks
1304@subsection CVS locks in the repository
1305
1306@cindex #cvs.rfl, technical details
1307@cindex #cvs.pfl, technical details
1308@cindex #cvs.wfl, technical details
1309@cindex #cvs.lock, technical details
1310@cindex Locks, cvs, technical details
1311For an introduction to @sc{cvs} locks focusing on
1312user-visible behavior, see @ref{Concurrency}.  The
1313following section is aimed at people who are writing
1314tools which want to access a @sc{cvs} repository without
1315interfering with other tools accessing the same
1316repository.  If you find yourself confused by concepts
1317described here, like @dfn{read lock}, @dfn{write lock},
1318and @dfn{deadlock}, you might consult the literature on
1319operating systems or databases.
1320
1321@cindex #cvs.tfl
1322Any file in the repository with a name starting
1323with @file{#cvs.rfl.} is a read lock.  Any file in
1324the repository with a name starting with
1325@file{#cvs.pfl} is a promotable read lock.  Any file in
1326the repository with a name starting with
1327@file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1328(before @sc{cvs} 1.5) also created files with names starting
1329with @file{#cvs.tfl}, but they are not discussed here.
1330The directory @file{#cvs.lock} serves as a master
1331lock.  That is, one must obtain this lock first before
1332creating any of the other locks.
1333
1334To obtain a read lock, first create the @file{#cvs.lock}
1335directory.  This operation must be atomic (which should
1336be true for creating a directory under most operating
1337systems).  If it fails because the directory already
1338existed, wait for a while and try again.  After
1339obtaining the @file{#cvs.lock} lock, create a file
1340whose name is @file{#cvs.rfl.} followed by information
1341of your choice (for example, hostname and process
1342identification number).  Then remove the
1343@file{#cvs.lock} directory to release the master lock.
1344Then proceed with reading the repository.  When you are
1345done, remove the @file{#cvs.rfl} file to release the
1346read lock.
1347
1348Promotable read locks are a concept you may not find in other literature on
1349concurrency.  They are used to allow a two (or more) pass process to only lock
1350a file for read on the first (read) pass(es), then upgrade its read locks to
1351write locks if necessary for a final pass, still assured that the files have
1352not changed since they were first read.  @sc{cvs} uses promotable read locks,
1353for example, to prevent commit and tag verification passes from interfering
1354with other reading processes.  It can then lock only a single directory at a
1355time for write during the write pass.
1356
1357To obtain a promotable read lock, first create the @file{#cvs.lock} directory,
1358as with a non-promotable read lock.  Then check
1359that there are no files that start with
1360@file{#cvs.pfl}.  If there are, remove the master @file{#cvs.lock} directory,
1361wait awhile (CVS waits 30 seconds between lock attempts), and try again.  If
1362there are no other promotable locks, go ahead and create a file whose name is
1363@file{#cvs.pfl} followed by information of your choice (for example, CVS uses
1364its hostname and the process identification number of the CVS server process
1365creating the lock).  If versions of @sc{cvs} older than version 1.12.4 access
1366your repository directly (not via a @sc{cvs} server of version 1.12.4 or
1367later), then you should also create a read lock since older versions of CVS
1368will ignore the promotable lock when attempting to create their own write lock.
1369Then remove the master @file{#cvs.lock} directory in order to allow other
1370processes to obtain read locks.
1371
1372To obtain a write lock, first create the
1373@file{#cvs.lock} directory, as with read locks.  Then
1374check that there are no files whose names start with
1375@file{#cvs.rfl.} and no files whose names start with @file{#cvs.pfl} that are
1376not owned by the process attempting to get the write lock.  If either exist,
1377remove @file{#cvs.lock}, wait for a while, and try again.  If
1378there are no readers or promotable locks from other processes, then create a
1379file whose name is @file{#cvs.wfl} followed by information of your choice
1380(again, CVS uses the hostname and server process identification
1381number).  Remove your @file{#cvs.pfl} file if present.  Hang on to the
1382@file{#cvs.lock} lock.  Proceed
1383with writing the repository.  When you are done, first
1384remove the @file{#cvs.wfl} file and then the
1385@file{#cvs.lock} directory. Note that unlike the
1386@file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1387informational; it has no effect on the locking operation
1388beyond what is provided by holding on to the
1389@file{#cvs.lock} lock itself.
1390
1391Note that each lock (write lock or read lock) only locks
1392a single directory in the repository, including
1393@file{Attic} and @file{CVS} but not including
1394subdirectories which represent other directories under
1395version control.  To lock an entire tree, you need to
1396lock each directory (note that if you fail to obtain
1397any lock you need, you must release the whole tree
1398before waiting and trying again, to avoid deadlocks).
1399
1400Note also that @sc{cvs} expects write locks to control
1401access to individual @file{foo,v} files.  @sc{rcs} has
1402a scheme where the @file{,foo,} file serves as a lock,
1403but @sc{cvs} does not implement it and so taking out a
1404@sc{cvs} write lock is recommended.  See the comments at
1405rcs_internal_lockfile in the @sc{cvs} source code for
1406further discussion/rationale.
1407
1408@node CVSROOT storage
1409@subsection How files are stored in the CVSROOT directory
1410@cindex CVSROOT, storage of files
1411
1412The @file{$CVSROOT/CVSROOT} directory contains the
1413various administrative files.  In some ways this
1414directory is just like any other directory in the
1415repository; it contains @sc{rcs} files whose names end
1416in @samp{,v}, and many of the @sc{cvs} commands operate
1417on it the same way.  However, there are a few
1418differences.
1419
1420For each administrative file, in addition to the
1421@sc{rcs} file, there is also a checked out copy of the
1422file.  For example, there is an @sc{rcs} file
1423@file{loginfo,v} and a file @file{loginfo} which
1424contains the latest revision contained in
1425@file{loginfo,v}.  When you check in an administrative
1426file, @sc{cvs} should print
1427
1428@example
1429cvs commit: Rebuilding administrative file database
1430@end example
1431
1432@noindent
1433and update the checked out copy in
1434@file{$CVSROOT/CVSROOT}.  If it does not, there is
1435something wrong (@pxref{BUGS}).  To add your own files
1436to the files to be updated in this fashion, you can add
1437them to the @file{checkoutlist} administrative file
1438(@pxref{checkoutlist}).
1439
1440@cindex modules.db
1441@cindex modules.pag
1442@cindex modules.dir
1443By default, the @file{modules} file behaves as
1444described above.  If the modules file is very large,
1445storing it as a flat text file may make looking up
1446modules slow (I'm not sure whether this is as much of a
1447concern now as when @sc{cvs} first evolved this
1448feature; I haven't seen benchmarks).  Therefore, by
1449making appropriate edits to the @sc{cvs} source code
1450one can store the modules file in a database which
1451implements the @code{ndbm} interface, such as Berkeley
1452db or GDBM.  If this option is in use, then the modules
1453database will be stored in the files @file{modules.db},
1454@file{modules.pag}, and/or @file{modules.dir}.
1455@c I think fileattr also will use the database stuff.
1456@c Anything else?
1457
1458For information on the meaning of the various
1459administrative files, see @ref{Administrative files}.
1460
1461@node Working directory storage
1462@section How data is stored in the working directory
1463
1464@c FIXME: Somewhere we should discuss timestamps (test
1465@c case "stamps" in sanity.sh).  But not here.  Maybe
1466@c in some kind of "working directory" chapter which
1467@c would encompass the "Builds" one?  But I'm not sure
1468@c whether that is a good organization (is it based on
1469@c what the user wants to do?).
1470
1471@cindex CVS directory, in working directory
1472While we are discussing @sc{cvs} internals which may
1473become visible from time to time, we might as well talk
1474about what @sc{cvs} puts in the @file{CVS} directories
1475in the working directories.  As with the repository,
1476@sc{cvs} handles this information and one can usually
1477access it via @sc{cvs} commands.  But in some cases it
1478may be useful to look at it, and other programs, such
1479as the @code{jCVS} graphical user interface or the
1480@code{VC} package for emacs, may need to look at it.
1481Such programs should follow the recommendations in this
1482section if they hope to be able to work with other
1483programs which use those files, including future
1484versions of the programs just mentioned and the
1485command-line @sc{cvs} client.
1486
1487The @file{CVS} directory contains several files.
1488Programs which are reading this directory should
1489silently ignore files which are in the directory but
1490which are not documented here, to allow for future
1491expansion.
1492
1493The files are stored according to the text file
1494convention for the system in question.  This means that
1495working directories are not portable between systems
1496with differing conventions for storing text files.
1497This is intentional, on the theory that the files being
1498managed by @sc{cvs} probably will not be portable between
1499such systems either.
1500
1501@table @file
1502@item Root
1503This file contains the current @sc{cvs} root, as
1504described in @ref{Specifying a repository}.
1505
1506@cindex Repository file, in CVS directory
1507@cindex CVS/Repository file
1508@item Repository
1509This file contains the directory within the repository
1510which the current directory corresponds with.  It can
1511be either an absolute pathname or a relative pathname;
1512@sc{cvs} has had the ability to read either format
1513since at least version 1.3 or so.  The relative
1514pathname is relative to the root, and is the more
1515sensible approach, but the absolute pathname is quite
1516common and implementations should accept either.  For
1517example, after the command
1518
1519@example
1520cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1521@end example
1522
1523@noindent
1524@file{Root} will contain
1525
1526@example
1527:local:/usr/local/cvsroot
1528@end example
1529
1530@noindent
1531and @file{Repository} will contain either
1532
1533@example
1534/usr/local/cvsroot/yoyodyne/tc
1535@end example
1536
1537@noindent
1538or
1539
1540@example
1541yoyodyne/tc
1542@end example
1543
1544If the particular working directory does not correspond
1545to a directory in the repository, then @file{Repository}
1546should contain @file{CVSROOT/Emptydir}.
1547@cindex Emptydir, in CVSROOT directory
1548@cindex CVSROOT/Emptydir directory
1549
1550@cindex Entries file, in CVS directory
1551@cindex CVS/Entries file
1552@item Entries
1553This file lists the files and directories in the
1554working directory.
1555The first character of each line indicates what sort of
1556line it is.  If the character is unrecognized, programs
1557reading the file should silently skip that line, to
1558allow for future expansion.
1559
1560If the first character is @samp{/}, then the format is:
1561
1562@example
1563/@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1564@end example
1565
1566@noindent
1567where @samp{[} and @samp{]} are not part of the entry,
1568but instead indicate that the @samp{+} and conflict
1569marker are optional.  @var{name} is the name of the
1570file within the directory.  @var{revision} is the
1571revision that the file in the working derives from, or
1572@samp{0} for an added file, or @samp{-} followed by a
1573revision for a removed file.  @var{timestamp} is the
1574timestamp of the file at the time that @sc{cvs} created
1575it; if the timestamp differs with the actual
1576modification time of the file it means the file has
1577been modified.  It is stored in
1578the format used by the ISO C asctime() function (for
1579example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1580write a string which is not in that format, for
1581example, @samp{Result of merge}, to indicate that the
1582file should always be considered to be modified.  This
1583is not a special case; to see whether a file is
1584modified a program should take the timestamp of the file
1585and simply do a string compare with @var{timestamp}.
1586If there was a conflict, @var{conflict} can be set to
1587the modification time of the file after the file has been
1588written with conflict markers (@pxref{Conflicts example}).
1589Thus if @var{conflict} is subsequently the same as the actual
1590modification time of the file it means that the user
1591has obviously not resolved the conflict.  @var{options}
1592contains sticky options (for example @samp{-kb} for a
1593binary file).  @var{tagdate} contains @samp{T} followed
1594by a tag name, or @samp{D} for a date, followed by a
1595sticky tag or date.  Note that if @var{timestamp}
1596contains a pair of timestamps separated by a space,
1597rather than a single timestamp, you are dealing with a
1598version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1599documented here).
1600
1601The timezone on the timestamp in CVS/Entries (local or
1602universal) should be the same as the operating system
1603stores for the timestamp of the file itself.  For
1604example, on Unix the file's timestamp is in universal
1605time (UT), so the timestamp in CVS/Entries should be
1606too.  On @sc{vms}, the file's timestamp is in local
1607time, so @sc{cvs} on @sc{vms} should use local time.
1608This rule is so that files do not appear to be modified
1609merely because the timezone changed (for example, to or
1610from summer time).
1611@c See comments and calls to gmtime() and friends in
1612@c src/vers_ts.c (function time_stamp).
1613
1614If the first character of a line in @file{Entries} is
1615@samp{D}, then it indicates a subdirectory.  @samp{D}
1616on a line all by itself indicates that the program
1617which wrote the @file{Entries} file does record
1618subdirectories (therefore, if there is such a line and
1619no other lines beginning with @samp{D}, one knows there
1620are no subdirectories).  Otherwise, the line looks
1621like:
1622
1623@example
1624D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1625@end example
1626
1627@noindent
1628where @var{name} is the name of the subdirectory, and
1629all the @var{filler} fields should be silently ignored,
1630for future expansion.  Programs which modify
1631@code{Entries} files should preserve these fields.
1632
1633The lines in the @file{Entries} file can be in any order.
1634
1635@cindex Entries.Log file, in CVS directory
1636@cindex CVS/Entries.Log file
1637@item Entries.Log
1638This file does not record any information beyond that
1639in @file{Entries}, but it does provide a way to update
1640the information without having to rewrite the entire
1641@file{Entries} file, including the ability to preserve
1642the information even if the program writing
1643@file{Entries} and @file{Entries.Log} abruptly aborts.
1644Programs which are reading the @file{Entries} file
1645should also check for @file{Entries.Log}.  If the latter
1646exists, they should read @file{Entries} and then apply
1647the changes mentioned in @file{Entries.Log}.  After
1648applying the changes, the recommended practice is to
1649rewrite @file{Entries} and then delete @file{Entries.Log}.
1650The format of a line in @file{Entries.Log} is a single
1651character command followed by a space followed by a
1652line in the format specified for a line in
1653@file{Entries}.  The single character command is
1654@samp{A} to indicate that the entry is being added,
1655@samp{R} to indicate that the entry is being removed,
1656or any other character to indicate that the entire line
1657in @file{Entries.Log} should be silently ignored (for
1658future expansion).  If the second character of the line
1659in @file{Entries.Log} is not a space, then it was
1660written by an older version of @sc{cvs} (not documented
1661here).
1662
1663Programs which are writing rather than reading can
1664safely ignore @file{Entries.Log} if they so choose.
1665
1666@cindex Entries.Backup file, in CVS directory
1667@cindex CVS/Entries.Backup file
1668@item Entries.Backup
1669This is a temporary file.  Recommended usage is to
1670write a new entries file to @file{Entries.Backup}, and
1671then to rename it (atomically, where possible) to @file{Entries}.
1672
1673@cindex Entries.Static file, in CVS directory
1674@cindex CVS/Entries.Static file
1675@item Entries.Static
1676The only relevant thing about this file is whether it
1677exists or not.  If it exists, then it means that only
1678part of a directory was gotten and @sc{cvs} will
1679not create additional files in that directory.  To
1680clear it, use the @code{update} command with the
1681@samp{-d} option, which will get the additional files
1682and remove @file{Entries.Static}.
1683@c FIXME: This needs to be better documented, in places
1684@c other than Working Directory Storage.
1685@c FIXCVS: The fact that this setting exists needs to
1686@c be more visible to the user.  For example "cvs
1687@c status foo", in the case where the file would be
1688@c gotten except for Entries.Static, might say
1689@c something to distinguish this from other cases.
1690@c One thing that periodically gets suggested is to
1691@c have "cvs update" print something when it skips
1692@c files due to Entries.Static, but IMHO that kind of
1693@c noise pretty much makes the Entries.Static feature
1694@c useless.
1695
1696@cindex Tag file, in CVS directory
1697@cindex CVS/Tag file
1698@cindex Sticky tags/dates, per-directory
1699@cindex Per-directory sticky tags/dates
1700@item Tag
1701This file contains per-directory sticky tags or dates.
1702The first character is @samp{T} for a branch tag,
1703@samp{N} for a non-branch tag, or @samp{D} for a date,
1704or another character to mean the file should be
1705silently ignored, for future expansion.  This character
1706is followed by the tag or date.  Note that
1707per-directory sticky tags or dates are used for things
1708like applying to files which are newly added; they
1709might not be the same as the sticky tags or dates on
1710individual files.  For general information on sticky
1711tags and dates, see @ref{Sticky tags}.
1712@c FIXME: This needs to be much better documented,
1713@c preferably not in the context of "working directory
1714@c storage".
1715@c FIXME: The Sticky tags node needs to discuss, or xref to
1716@c someplace which discusses, per-directory sticky
1717@c tags and the distinction with per-file sticky tags.
1718
1719@cindex Notify file, in CVS directory
1720@cindex CVS/Notify file
1721@item Notify
1722This file stores notifications (for example, for
1723@code{edit} or @code{unedit}) which have not yet been
1724sent to the server.  Its format is not yet documented
1725here.
1726
1727@cindex Notify.tmp file, in CVS directory
1728@cindex CVS/Notify.tmp file
1729@item Notify.tmp
1730This file is to @file{Notify} as @file{Entries.Backup}
1731is to @file{Entries}.  That is, to write @file{Notify},
1732first write the new contents to @file{Notify.tmp} and
1733then (atomically where possible), rename it to
1734@file{Notify}.
1735
1736@cindex Base directory, in CVS directory
1737@cindex CVS/Base directory
1738@item Base
1739If watches are in use, then an @code{edit} command
1740stores the original copy of the file in the @file{Base}
1741directory.  This allows the @code{unedit} command to
1742operate even if it is unable to communicate with the
1743server.
1744
1745@cindex Baserev file, in CVS directory
1746@cindex CVS/Baserev file
1747@item Baserev
1748The file lists the revision for each of the files in
1749the @file{Base} directory.  The format is:
1750
1751@example
1752B@var{name}/@var{rev}/@var{expansion}
1753@end example
1754
1755@noindent
1756where @var{expansion} should be ignored, to allow for
1757future expansion.
1758
1759@cindex Baserev.tmp file, in CVS directory
1760@cindex CVS/Baserev.tmp file
1761@item Baserev.tmp
1762This file is to @file{Baserev} as @file{Entries.Backup}
1763is to @file{Entries}.  That is, to write @file{Baserev},
1764first write the new contents to @file{Baserev.tmp} and
1765then (atomically where possible), rename it to
1766@file{Baserev}.
1767
1768@cindex Template file, in CVS directory
1769@cindex CVS/Template file
1770@item Template
1771This file contains the template specified by the
1772@file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1773by the client; the non-client/server @sc{cvs} consults
1774@file{rcsinfo} directly.
1775@end table
1776
1777@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1778@node Intro administrative files
1779@section The administrative files
1780@cindex Administrative files (intro)
1781@cindex Modules file
1782@cindex CVSROOT, module name
1783@cindex Defining modules (intro)
1784
1785@c FIXME: this node should be reorganized into "general
1786@c information about admin files" and put the "editing
1787@c admin files" stuff up front rather than jumping into
1788@c the details of modules right away.  Then the
1789@c Administrative files node can go away, the information
1790@c on each admin file distributed to a place appropriate
1791@c to its function, and this node can contain a table
1792@c listing each file and a @ref to its detailed description.
1793
1794The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1795files}.  @xref{Administrative files}, for a complete description.
1796You can use @sc{cvs} without any of these files, but
1797some commands work better when at least the
1798@file{modules} file is properly set up.
1799
1800The most important of these files is the @file{modules}
1801file.  It defines all modules in the repository.  This
1802is a sample @file{modules} file.
1803
1804@c FIXME: The CVSROOT line is a goofy example now that
1805@c mkmodules doesn't exist.
1806@example
1807CVSROOT         CVSROOT
1808modules         CVSROOT modules
1809cvs             gnu/cvs
1810rcs             gnu/rcs
1811diff            gnu/diff
1812tc              yoyodyne/tc
1813@end example
1814
1815The @file{modules} file is line oriented.  In its
1816simplest form each line contains the name of the
1817module, whitespace, and the directory where the module
1818resides.  The directory is a path relative to
1819@code{$CVSROOT}.  The last four lines in the example
1820above are examples of such lines.
1821
1822@c FIXME: might want to introduce the concept of options in modules file
1823@c (the old example which was here, -i mkmodules, is obsolete).
1824
1825The line that defines the module called @samp{modules}
1826uses features that are not explained here.
1827@xref{modules}, for a full explanation of all the
1828available features.
1829
1830@c FIXME: subsection without node is bogus
1831@subsection Editing administrative files
1832@cindex Editing administrative files
1833@cindex Administrative files, editing them
1834
1835You edit the administrative files in the same way that you would edit
1836any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1837copy, edit it, and commit your changes in the normal way.
1838
1839It is possible to commit an erroneous administrative
1840file.  You can often fix the error and check in a new
1841revision, but sometimes a particularly bad error in the
1842administrative file makes it impossible to commit new
1843revisions.
1844@c @xref{Bad administrative files} for a hint
1845@c about how to solve such situations.
1846@c -- administrative file checking--
1847
1848@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1849@node Multiple repositories
1850@section Multiple repositories
1851@cindex Multiple repositories
1852@cindex Repositories, multiple
1853@cindex Many repositories
1854@cindex Parallel repositories
1855@cindex Disjoint repositories
1856@cindex CVSROOT, multiple repositories
1857
1858In some situations it is a good idea to have more than
1859one repository, for instance if you have two
1860development groups that work on separate projects
1861without sharing any code.  All you have to do to have
1862several repositories is to specify the appropriate
1863repository, using the @code{CVSROOT} environment
1864variable, the @samp{-d} option to @sc{cvs}, or (once
1865you have checked out a working directory) by simply
1866allowing @sc{cvs} to use the repository that was used
1867to check out the working directory
1868(@pxref{Specifying a repository}).
1869
1870The big advantage of having multiple repositories is
1871that they can reside on different servers.  With @sc{cvs}
1872version 1.10, a single command cannot recurse into
1873directories from different repositories.  With development
1874versions of @sc{cvs}, you can check out code from multiple
1875servers into your working directory.  @sc{cvs} will
1876recurse and handle all the details of making
1877connections to as many server machines as necessary to
1878perform the requested command.  Here is an example of
1879how to set up a working directory:
1880
1881@example
1882cvs -d server1:/cvs co dir1
1883cd dir1
1884cvs -d server2:/root co sdir
1885cvs update
1886@end example
1887
1888The @code{cvs co} commands set up the working
1889directory, and then the @code{cvs update} command will
1890contact server2, to update the dir1/sdir subdirectory,
1891and server1, to update everything else.
1892
1893@c FIXME: Does the FAQ have more about this?  I have a
1894@c dim recollection, but I'm too lazy to check right now.
1895
1896@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1897@node Creating a repository
1898@section Creating a repository
1899
1900@cindex Repository, setting up
1901@cindex Creating a repository
1902@cindex Setting up a repository
1903
1904This section describes how to set up a @sc{cvs} repository for any
1905sort of access method.  After completing the setup described in this
1906section, you should be able to access your @sc{cvs} repository immediately
1907via the local access method and several remote access methods.  For
1908more information on setting up remote access to the repository you create
1909in this section, please read the section on @xref{Remote repositories}.
1910
1911To set up a @sc{cvs} repository, first choose the
1912machine and disk on which you want to store the
1913revision history of the source files.  CPU and memory
1914requirements are modest, so most machines should be
1915adequate.  For details see @ref{Server requirements}.
1916@c Possible that we should be providing a quick rule of
1917@c thumb, like the 32M memory for the server.  That
1918@c might increase the number of people who are happy
1919@c with the answer, without following the xref.
1920
1921To estimate disk space
1922requirements, if you are importing RCS files from
1923another system, the size of those files is the
1924approximate initial size of your repository, or if you
1925are starting without any version history, a rule of
1926thumb is to allow for the server approximately three
1927times the size of the code to be under @sc{cvs} for the
1928repository (you will eventually outgrow this, but not
1929for a while).  On the machines on which the developers
1930will be working, you'll want disk space for
1931approximately one working directory for each developer
1932(either the entire tree or a portion of it, depending
1933on what each developer uses).
1934
1935The repository should be accessible
1936(directly or via a networked file system) from all
1937machines which want to use @sc{cvs} in server or local
1938mode; the client machines need not have any access to
1939it other than via the @sc{cvs} protocol.  It is not
1940possible to use @sc{cvs} to read from a repository
1941which one only has read access to; @sc{cvs} needs to be
1942able to create lock files (@pxref{Concurrency}).
1943
1944@cindex init (subcommand)
1945To create a repository, run the @code{cvs init}
1946command.  It will set up an empty repository in the
1947@sc{cvs} root specified in the usual way
1948(@pxref{Repository}).  For example,
1949
1950@example
1951cvs -d /usr/local/cvsroot init
1952@end example
1953
1954@code{cvs init} is careful to never overwrite any
1955existing files in the repository, so no harm is done if
1956you run @code{cvs init} on an already set-up
1957repository.
1958
1959@code{cvs init} will enable history logging; if you
1960don't want that, remove the history file after running
1961@code{cvs init}.  @xref{history file}.
1962
1963@node Backing up
1964@section Backing up a repository
1965@cindex Repository, backing up
1966@cindex Backing up, repository
1967
1968There is nothing particularly magical about the files
1969in the repository; for the most part it is possible to
1970back them up just like any other files.  However, there
1971are a few issues to consider.
1972
1973@cindex Locks, cvs, and backups
1974@cindex #cvs.rfl, and backups
1975The first is that to be paranoid, one should either not
1976use @sc{cvs} during the backup, or have the backup
1977program lock @sc{cvs} while doing the backup.  To not
1978use @sc{cvs}, you might forbid logins to machines which
1979can access the repository, turn off your @sc{cvs}
1980server, or similar mechanisms.  The details would
1981depend on your operating system and how you have
1982@sc{cvs} set up.  To lock @sc{cvs}, you would create
1983@file{#cvs.rfl} locks in each repository directory.
1984See @ref{Concurrency}, for more on @sc{cvs} locks.
1985Having said all this, if you just back up without any
1986of these precautions, the results are unlikely to be
1987particularly dire.  Restoring from backup, the
1988repository might be in an inconsistent state, but this
1989would not be particularly hard to fix manually.
1990
1991When you restore a repository from backup, assuming
1992that changes in the repository were made after the time
1993of the backup, working directories which were not
1994affected by the failure may refer to revisions which no
1995longer exist in the repository.  Trying to run @sc{cvs}
1996in such directories will typically produce an error
1997message.  One way to get those changes back into the
1998repository is as follows:
1999
2000@itemize @bullet
2001@item
2002Get a new working directory.
2003
2004@item
2005Copy the files from the working directory from before
2006the failure over to the new working directory (do not
2007copy the contents of the @file{CVS} directories, of
2008course).
2009
2010@item
2011Working in the new working directory, use commands such
2012as @code{cvs update} and @code{cvs diff} to figure out
2013what has changed, and then when you are ready, commit
2014the changes into the repository.
2015@end itemize
2016
2017@node Moving a repository
2018@section Moving a repository
2019@cindex Repository, moving
2020@cindex Moving a repository
2021@cindex Copying a repository
2022
2023Just as backing up the files in the repository is
2024pretty much like backing up any other files, if you
2025need to move a repository from one place to another it
2026is also pretty much like just moving any other
2027collection of files.
2028
2029The main thing to consider is that working directories
2030point to the repository.  The simplest way to deal with
2031a moved repository is to just get a fresh working
2032directory after the move.  Of course, you'll want to
2033make sure that the old working directory had been
2034checked in before the move, or you figured out some
2035other way to make sure that you don't lose any
2036changes.  If you really do want to reuse the existing
2037working directory, it should be possible with manual
2038surgery on the @file{CVS/Repository} files.  You can
2039see @ref{Working directory storage}, for information on
2040the @file{CVS/Repository} and @file{CVS/Root} files, but
2041unless you are sure you want to bother, it probably
2042isn't worth it.
2043@c FIXME: Surgery on CVS/Repository should be avoided
2044@c by making RELATIVE_REPOS the default.
2045@c FIXME-maybe: might want some documented way to
2046@c change the CVS/Root files in some particular tree.
2047@c But then again, I don't know, maybe just having
2048@c people do this in perl/shell/&c isn't so bad...
2049
2050@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2051@node Remote repositories
2052@section Remote repositories
2053@cindex Repositories, remote
2054@cindex Remote repositories
2055@cindex Client/Server Operation
2056@cindex Server, CVS
2057@cindex Remote repositories, port specification
2058@cindex Repositories, remote, port specification
2059@cindex Client/Server Operation, port specification
2060@cindex pserver (client/server connection method), port specification
2061@cindex kserver (client/server connection method), port specification
2062@cindex gserver (client/server connection method), port specification
2063@cindex port, specifying for remote repositories
2064
2065        Your working copy of the sources can be on a
2066different machine than the repository.  Using @sc{cvs}
2067in this manner is known as @dfn{client/server}
2068operation.  You run @sc{cvs} on a machine which can
2069mount your working directory, known as the
2070@dfn{client}, and tell it to communicate to a machine
2071which can mount the repository, known as the
2072@dfn{server}.  Generally, using a remote
2073repository is just like using a local one, except that
2074the format of the repository name is:
2075
2076@example
2077[:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2078@end example
2079
2080Specifying a password in the repository name is not recommended during
2081checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2082password in each created directory.  @code{cvs login} first instead
2083(@pxref{Password authentication client}).
2084
2085The details of exactly what needs to be set up depend
2086on how you are connecting to the server.
2087
2088@c Should we try to explain which platforms are which?
2089@c Platforms like unix and VMS, which only allow
2090@c privileged programs to bind to sockets <1024 lose on
2091@c :server:
2092@c Platforms like Mac and VMS, whose rsh program is
2093@c unusable or nonexistent, lose on :ext:
2094@c Platforms like OS/2 and NT probably could plausibly
2095@c default either way (modulo -b troubles).
2096
2097@menu
2098* Server requirements::         Memory and other resources for servers
2099* The connection method::       Connection methods and method options
2100* Connecting via rsh::          Using the @code{rsh} program to connect
2101* Password authenticated::      Direct connections using passwords
2102* GSSAPI authenticated::        Direct connections using GSSAPI
2103* Kerberos authenticated::      Direct connections with Kerberos
2104* Connecting via fork::         Using a forked @code{cvs server} to connect
2105* Write proxies::               Distributing load across several CVS servers
2106@end menu
2107
2108@node Server requirements
2109@subsection Server requirements
2110
2111The quick answer to what sort of machine is suitable as
2112a server is that requirements are modest---a server
2113with 32M of memory or even less can handle a fairly
2114large source tree with a fair amount of activity.
2115@c Say something about CPU speed too?  I'm even less sure
2116@c what to say on that subject...
2117
2118The real answer, of course, is more complicated.
2119Estimating the known areas of large memory consumption
2120should be sufficient to estimate memory requirements.
2121There are two such areas documented here; other memory
2122consumption should be small by comparison (if you find
2123that is not the case, let us know, as described in
2124@ref{BUGS}, so we can update this documentation).
2125
2126The first area of big memory consumption is large
2127checkouts, when using the @sc{cvs} server.  The server
2128consists of two processes for each client that it is
2129serving.  Memory consumption on the child process
2130should remain fairly small.  Memory consumption on the
2131parent process, particularly if the network connection
2132to the client is slow, can be expected to grow to
2133slightly more than the size of the sources in a single
2134directory, or two megabytes, whichever is larger.
2135@c "two megabytes" of course is SERVER_HI_WATER.  But
2136@c we don't mention that here because we are
2137@c documenting the default configuration of CVS.  If it
2138@c is a "standard" thing to change that value, it
2139@c should be some kind of run-time configuration.
2140@c
2141@c See cvsclient.texi for more on the design decision
2142@c to not have locks in place while waiting for the
2143@c client, which is what results in memory consumption
2144@c as high as this.
2145
2146Multiplying the size of each @sc{cvs} server by the
2147number of servers which you expect to have active at
2148one time should give an idea of memory requirements for
2149the server.  For the most part, the memory consumed by
2150the parent process probably can be swap space rather
2151than physical memory.
2152@c Has anyone verified that notion about swap space?
2153@c I say it based pretty much on guessing that the
2154@c ->text of the struct buffer_data only gets accessed
2155@c in a first in, first out fashion, but I haven't
2156@c looked very closely.
2157
2158@c What about disk usage in /tmp on the server?  I think that
2159@c it can be substantial, but I haven't looked at this
2160@c again and tried to figure it out ("cvs import" is
2161@c probably the worst case...).
2162
2163The second area of large memory consumption is
2164@code{diff}, when checking in large files.  This is
2165required even for binary files.  The rule of thumb is
2166to allow about ten times the size of the largest file
2167you will want to check in, although five times may be
2168adequate.  For example, if you want to check in a file
2169which is 10 megabytes, you should have 100 megabytes of
2170memory on the machine doing the checkin (the server
2171machine for client/server, or the machine running
2172@sc{cvs} for non-client/server).  This can be swap
2173space rather than physical memory.  Because the memory
2174is only required briefly, there is no particular need
2175to allow memory for more than one such checkin at a
2176time.
2177@c The 5-10 times rule of thumb is from Paul Eggert for
2178@c GNU diff.  I don't think it is in the GNU diff
2179@c manual or anyplace like that.
2180@c
2181@c Probably we could be saying more about
2182@c non-client/server CVS.
2183@c I would guess for non-client/server CVS in an NFS
2184@c environment the biggest issues are the network and
2185@c the NFS server.
2186
2187Resource consumption for the client is even more
2188modest---any machine with enough capacity to run the
2189operating system in question should have little
2190trouble.
2191@c Is that true?  I think the client still wants to
2192@c (bogusly) store entire files in memory at times.
2193
2194For information on disk space requirements, see
2195@ref{Creating a repository}.
2196
2197@node The connection method
2198@subsection The connection method
2199
2200In its simplest form, the @var{method} portion of the repository string
2201(@pxref{Remote repositories}) may be one of @samp{ext}, @samp{fork},
2202@samp{gserver}, @samp{kserver}, @samp{local}, @samp{pserver}, and, on some
2203platforms, @samp{server}.
2204
2205If @var{method} is not specified, and the repository
2206name starts with a @samp{/}, then the default is @code{local}.
2207If @var{method} is not specified, and the repository
2208name does not start with a @samp{/}, then the default is @code{ext}
2209or @code{server}, depending on your platform; both the @samp{ext}
2210and @samp{server} methods are described in @ref{Connecting via rsh}.
2211
2212@cindex connection method options
2213@cindex options, connection method
2214The @code{ext}, @code{fork}, @code{gserver}, and @code{pserver} connection
2215methods all accept optional method options, specified as part of the
2216@var{method} string, like so:
2217
2218@example
2219:@var{method}[;@var{option}=@var{arg}...]:@var{other_connection_data}
2220@end example
2221
2222@sc{cvs} is not sensitive to the case of @var{method} or @var{option}, though
2223it may sometimes be sensitive to the case of @var{arg}.  The possible method
2224options are as follows:
2225
2226@table @code
2227@cindex CVS_PROXY_PORT
2228@cindex proxy, method option
2229@cindex proxyport, method option
2230@cindex proxies, web, connecting via
2231@cindex web proxies, connecting via
2232@cindex proxies, HTTP, connecting via
2233@cindex HTTP proxies, connecting via
2234@item proxy=@var{hostname}
2235@itemx proxyport=@var{port}
2236These two method options can be used to connect via an HTTP tunnel style web
2237proxy.  @var{hostname} should be the name of the HTTP proxy server to connect
2238through and @var{port} is the port number on the HTTP proxy server to connect
2239via.  @var{port} defaults to 8080.
2240
2241@emph{NOTE: An HTTP proxy server is not the same as a @sc{cvs} write proxy
2242server - please see @ref{Write proxies} for more on @sc{cvs} write proxies.}
2243
2244For example, to connect pserver via a web proxy listening on port 8000 of
2245www.myproxy.net, you would use a method of:
2246
2247@example
2248:pserver;proxy=www.myproxy.net;proxyport=8000:@var{pserver_connection_string}
2249@end example
2250
2251@emph{NOTE: In the above example, @var{pserver_connection_string} is still
2252required to connect and authenticate to the CVS server, as noted in the
2253upcoming sections on password authentication, @code{gserver}, and
2254@code{kserver}.  The example above only demonstrates a modification to the
2255@var{method} portion of the repository name.}
2256
2257These options first appeared in @sc{cvs} version 1.12.7 and are valid as
2258modifcations to the @code{gserver} and @code{pserver} connection methods.
2259
2260@cindex CVS_RSH method option
2261@item CVS_RSH=@var{path}
2262This method option can be used with the @code{ext} method to specify the path
2263the @sc{cvs} client will use to find the remote shell used to contact the
2264@sc{cvs} server and takes precedence over any path specified in the
2265@code{$CVS_RSH} environment variable (@pxref{Connecting via rsh}).  For
2266example, to connect to a @sc{cvs} server via the local
2267@file{/path/to/ssh/command} command, you could choose to specify the following
2268@var{path} via the @code{CVS_RSH} method option:
2269
2270@example
2271:ext;CVS_RSH=/path/to/ssh/command:@var{ext_connection_string}
2272@end example
2273
2274This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2275as a modifcation to the @code{ext} connection method.
2276
2277@cindex CVS_SERVER method option
2278@item CVS_SERVER=@var{path}
2279This method option can be used with the @code{ext} and @code{fork} methods to
2280specify the path @sc{cvs} will use to find the @sc{cvs} executable on the
2281@sc{cvs} server and takes precedence over any path specified in the
2282@code{$CVS_SERVER} environment variable (@pxref{Connecting via rsh}).  For
2283example, to select the remote @file{/path/to/cvs/command} executable as your
2284@sc{cvs} server application on the @sc{cvs} server machine, you could choose to
2285specify the following @var{path} via the @code{CVS_SERVER} method option:
2286
2287@example
2288:ext;CVS_SERVER=/path/to/cvs/command:@var{ext_connection_string}
2289@end example
2290
2291@noindent
2292or, to select an executable named @samp{cvs-1.12.11}, assuming it is in your
2293@code{$PATH} on the @sc{cvs} server:
2294
2295@example
2296:ext;CVS_SERVER=cvs-1.12.11:@var{ext_connection_string}
2297@end example
2298
2299This method option first appeared in @sc{cvs} version 1.12.11 and is valid
2300as a modifcation to both the @code{ext} and @code{fork} connection methods.
2301
2302@cindex Redirect, method option
2303@item Redirect=@var{boolean-state}
2304The @code{Redirect} method option determines whether the @sc{cvs} client will
2305allow a @sc{cvs} server to redirect it to a different @sc{cvs} server, usually
2306for write requests, as in a write proxy setup.
2307
2308A @var{boolean-state} of any value acceptable for boolean @file{CVSROOT/config}
2309file options is acceptable here (@pxref{config}).  For example, @samp{on},
2310@samp{off}, @samp{true}, and @samp{false} are all valid values for
2311@var{boolean-state}.  @var{boolean-state} for the @code{Redirect} method option
2312defaults to @samp{on}.
2313
2314This option will have no effect when talking to any non-secondary @sc{cvs}
2315server.  For more on write proxies and secondary servers, please see
2316@ref{Write proxies}.
2317
2318This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2319as a modifcation to the @code{ext} connection method.
2320@end table
2321
2322As a further example, to combine both the @code{CVS_RSH} and @code{CVS_SERVER}
2323options, a method specification like the following would work:
2324
2325@example
2326:ext;CVS_RSH=/path/to/ssh/command;CVS_SERVER=/path/to/cvs/command:
2327@end example
2328
2329This means that you would not need to have
2330the @code{CVS_SERVER} or @code{CVS_RSH} environment
2331variables set correctly.  See @ref{Connecting via rsh}, for more details on
2332these environment variables.
2333
2334@node Connecting via rsh
2335@subsection Connecting with rsh
2336
2337@cindex rsh
2338@sc{cvs} uses the @samp{rsh} protocol to perform these
2339operations, so the remote user host needs to have a
2340@file{.rhosts} file which grants access to the local
2341user. Note that the program that @sc{cvs} uses for this
2342purpose may be specified using the @file{--with-rsh}
2343flag to configure.
2344
2345For example, suppose you are the user @samp{mozart} on
2346the local machine @samp{toe.example.com}, and the
2347server machine is @samp{faun.example.org}.  On
2348faun, put the following line into the file
2349@file{.rhosts} in @samp{bach}'s home directory:
2350
2351@example
2352toe.example.com  mozart
2353@end example
2354
2355@noindent
2356Then test that @samp{rsh} is working with
2357
2358@example
2359rsh -l bach faun.example.org 'echo $PATH'
2360@end example
2361
2362@cindex CVS_SERVER, environment variable
2363Next you have to make sure that @code{rsh} will be able
2364to find the server.  Make sure that the path which
2365@code{rsh} printed in the above example includes the
2366directory containing a program named @code{cvs} which
2367is the server.  You need to set the path in
2368@file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2369or @file{.profile}.  Alternately, you can set the
2370environment variable @code{CVS_SERVER} on the client
2371machine to the filename of the server you want to use,
2372for example @file{/usr/local/bin/cvs-1.6}.
2373For the @code{ext} and @code{fork} methods, you may
2374also specify @var{CVS_SERVER} as an otpion in the
2375@var{CVSROOT} so that you may use different servers for
2376differnt roots. See @ref{Remote repositories} for more
2377details.
2378
2379There is no need to edit @file{inetd.conf} or start a
2380@sc{cvs} server daemon.
2381
2382@cindex server method, setting up
2383@cindex ext method, setting up
2384@cindex Kerberos, using kerberized rsh
2385@cindex SSH (rsh replacement)
2386@cindex rsh replacements (Kerberized, SSH, &c)
2387There are two access methods that you use in @code{CVSROOT}
2388for rsh.  @code{:server:} specifies an internal rsh
2389client, which is supported only by some @sc{cvs} ports.
2390This is not supported on most Unix-style systems.
2391@code{:ext:} specifies an external rsh program.  By
2392default this is @code{rsh} (unless otherwise specified
2393by the @file{--with-rsh} flag to configure) but you may set the
2394@code{CVS_RSH} environment variable to invoke another
2395program which can access the remote server (for
2396example, @code{remsh} on HP-UX 9 because @code{rsh} is
2397something different, or @code{ssh} to allow the use of secure
2398and/or compressed connections).  It must be a program which can
2399transmit data to and from the server without modifying
2400it; for example the Windows NT @code{rsh} is not
2401suitable since it by default translates between CRLF
2402and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2403to @code{rsh} to get around this, but since this could
2404potentially cause problems for programs other than the
2405standard @code{rsh}, it may change in the future.  If
2406you set @code{CVS_RSH} to @code{SSH} or some other rsh
2407replacement, the instructions in the rest of this
2408section concerning @file{.rhosts} and so on are likely
2409to be inapplicable; consult the documentation for your rsh
2410replacement.
2411
2412In the Debian and MirBSD versions of @sc{cvs}, you can
2413also specify @code{:extssh:} to force use of the Secure
2414Shell, or @code{:ext=prog:} or @code{:ext=/path/to/prog:}
2415to specify the remote shell to use without needing to
2416touch the @code{CVS_RSH} environment variable.
2417
2418You may choose to specify the @var{CVS_RSH} option as a method option
2419in the @var{CVSROOT} string to allow you to use different connection tools
2420for different roots (@pxref{The connection method}).  For example, allowing
2421some roots to use @code{CVS_RSH=remsh} and some to use
2422@code{CVS_RSH=ssh} for the @code{ext} method.  See also
2423the @ref{Remote repositories} for more details.
2424@c See also the comment in src/client.c for rationale
2425@c concerning "rsh" being the default and never
2426@c "remsh".
2427
2428Continuing our example, supposing you want to access
2429the module @file{foo} in the repository
2430@file{/usr/local/cvsroot/}, on machine
2431@file{faun.example.org}, you are ready to go:
2432
2433@example
2434cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2435@end example
2436
2437@noindent
2438(The @file{bach@@} can be omitted if the username is
2439the same on both the local and remote hosts.)
2440
2441@c Should we mention "rsh host echo hi" and "rsh host
2442@c cat" (the latter followed by typing text and ^D)
2443@c as troubleshooting techniques?  Probably yes
2444@c (people tend to have trouble setting this up),
2445@c but this kind of thing can be hard to spell out.
2446
2447@node Password authenticated
2448@subsection Direct connection with password authentication
2449
2450The @sc{cvs} client can also connect to the server
2451using a password protocol.  This is particularly useful
2452if using @code{rsh} is not feasible (for example,
2453the server is behind a firewall), and Kerberos also is
2454not available.
2455
2456        To use this method, it is necessary to make
2457some adjustments on both the server and client sides.
2458
2459@menu
2460* Password authentication server::     Setting up the server
2461* Password authentication client::     Using the client
2462* Password authentication security::   What this method does and does not do
2463@end menu
2464
2465@node Password authentication server
2466@subsubsection Setting up the server for password authentication
2467
2468First of all, you probably want to tighten the
2469permissions on the @file{$CVSROOT} and
2470@file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2471authentication security}, for more details.
2472
2473@cindex pserver (subcommand)
2474@cindex Remote repositories, port specification
2475@cindex Repositories, remote, port specification
2476@cindex Client/Server Operation, port specification
2477@cindex pserver (client/server connection method), port specification
2478@cindex kserver (client/server connection method), port specification
2479@cindex gserver (client/server connection method), port specification
2480@cindex port, specifying for remote repositories
2481@cindex Password server, setting up
2482@cindex Authenticating server, setting up
2483@cindex inetd, configuring for pserver
2484@cindex xinetd, configuring for pserver
2485@c FIXME: this isn't quite right regarding port
2486@c numbers; CVS looks up "cvspserver" in
2487@c /etc/services (on unix, but what about non-unix?).
2488On the server side, the file @file{/etc/inetd.conf}
2489needs to be edited so @code{inetd} knows to run the
2490command @code{cvs pserver} when it receives a
2491connection on the right port.  By default, the port
2492number is 2401; it would be different if your client
2493were compiled with @code{CVS_AUTH_PORT} defined to
2494something else, though.  This can also be specified in the CVSROOT variable
2495(@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2496environment variable (@pxref{Environment variables}).
2497
2498        If your @code{inetd} allows raw port numbers in
2499@file{/etc/inetd.conf}, then the following (all on a
2500single line in @file{inetd.conf}) should be sufficient:
2501
2502@example
25032401  stream  tcp  nowait  root  /usr/local/bin/cvs
2504cvs -f --allow-root=/usr/cvsroot pserver
2505@end example
2506
2507@noindent
2508(You could also use the
2509@samp{-T} option to specify a temporary directory.)
2510
2511The @samp{--allow-root} option specifies the allowable
2512@sc{cvsroot} directory.  Clients which attempt to use a
2513different @sc{cvsroot} directory will not be allowed to
2514connect.  If there is more than one @sc{cvsroot}
2515directory which you want to allow, repeat the option.
2516(Unfortunately, many versions of @code{inetd} have very small
2517limits on the number of arguments and/or the total length
2518of the command.  The usual solution to this problem is
2519to have @code{inetd} run a shell script which then invokes
2520@sc{cvs} with the necessary arguments.)
2521
2522        If your @code{inetd} wants a symbolic service
2523name instead of a raw port number, then put this in
2524@file{/etc/services}:
2525
2526@example
2527cvspserver      2401/tcp
2528@end example
2529
2530@noindent
2531and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2532
2533If your system uses @code{xinetd} instead of @code{inetd},
2534the procedure is slightly different.
2535Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2536
2537@example
2538service cvspserver
2539@{
2540   port        = 2401
2541   socket_type = stream
2542   protocol    = tcp
2543   wait        = no
2544   user        = root
2545   passenv     = PATH
2546   server      = /usr/local/bin/cvs
2547   server_args = -f --allow-root=/usr/cvsroot pserver
2548@}
2549@end example
2550
2551@noindent
2552(If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2553the @code{port} line.)
2554
2555        Once the above is taken care of, restart your
2556@code{inetd}, or do whatever is necessary to force it
2557to reread its initialization files.
2558
2559If you are having trouble setting this up, see
2560@ref{Connection}.
2561
2562@cindex CVS passwd file
2563@cindex passwd (admin file)
2564Because the client stores and transmits passwords in
2565cleartext (almost---see @ref{Password authentication
2566security}, for details), a separate @sc{cvs} password
2567file is generally used, so people don't compromise
2568their regular passwords when they access the
2569repository.  This file is
2570@file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2571administrative files}).  It uses a colon-separated
2572format, similar to @file{/etc/passwd} on Unix systems,
2573except that it has fewer fields: @sc{cvs} username,
2574optional password, and an optional system username for
2575@sc{cvs} to run as if authentication succeeds.  Here is
2576an example @file{passwd} file with five entries:
2577
2578@example
2579anonymous:
2580bach:ULtgRLXo7NRxs
2581spwang:1sOp854gDF3DY
2582melissa:tGX1fS8sun6rY:pubcvs
2583qproj:XR4EZcEs0szik:pubcvs
2584@end example
2585
2586@noindent
2587(The passwords are encrypted according to the standard
2588Unix @code{crypt()} function, so it is possible to
2589paste in passwords directly from regular Unix
2590@file{/etc/passwd} files.)
2591
2592The first line in the example will grant access to any
2593@sc{cvs} client attempting to authenticate as user
2594@code{anonymous}, no matter what password they use,
2595including an empty password.  (This is typical for
2596sites granting anonymous read-only access; for
2597information on how to do the "read-only" part, see
2598@ref{Read-only access}.)
2599
2600The second and third lines will grant access to
2601@code{bach} and @code{spwang} if they supply their
2602respective plaintext passwords.
2603
2604@cindex User aliases
2605The fourth line will grant access to @code{melissa}, if
2606she supplies the correct password, but her @sc{cvs}
2607operations will actually run on the server side under
2608the system user @code{pubcvs}.  Thus, there need not be
2609any system user named @code{melissa}, but there
2610@emph{must} be one named @code{pubcvs}.
2611
2612The fifth line shows that system user identities can be
2613shared: any client who successfully authenticates as
2614@code{qproj} will actually run as @code{pubcvs}, just
2615as @code{melissa} does.  That way you could create a
2616single, shared system user for each project in your
2617repository, and give each developer their own line in
2618the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2619username on each line would be different, but the
2620system username would be the same.  The reason to have
2621different @sc{cvs} usernames is that @sc{cvs} will log their
2622actions under those names: when @code{melissa} commits
2623a change to a project, the checkin is recorded in the
2624project's history under the name @code{melissa}, not
2625@code{pubcvs}.  And the reason to have them share a
2626system username is so that you can arrange permissions
2627in the relevant area of the repository such that only
2628that account has write-permission there.
2629
2630If the system-user field is present, all
2631password-authenticated @sc{cvs} commands run as that
2632user; if no system user is specified, @sc{cvs} simply
2633takes the @sc{cvs} username as the system username and
2634runs commands as that user.  In either case, if there
2635is no such user on the system, then the @sc{cvs}
2636operation will fail (regardless of whether the client
2637supplied a valid password).
2638
2639The password and system-user fields can both be omitted
2640(and if the system-user field is omitted, then also
2641omit the colon that would have separated it from the
2642encrypted password).  For example, this would be a
2643valid @file{$CVSROOT/CVSROOT/passwd} file:
2644
2645@example
2646anonymous::pubcvs
2647fish:rKa5jzULzmhOo:kfogel
2648sussman:1sOp854gDF3DY
2649@end example
2650
2651@noindent
2652When the password field is omitted or empty, then the
2653client's authentication attempt will succeed with any
2654password, including the empty string.  However, the
2655colon after the @sc{cvs} username is always necessary,
2656even if the password is empty.
2657
2658@sc{cvs} can also fall back to use system authentication.
2659When authenticating a password, the server first checks
2660for the user in the @file{$CVSROOT/CVSROOT/passwd}
2661file.  If it finds the user, it will use that entry for
2662authentication as described above.  But if it does not
2663find the user, or if the @sc{cvs} @file{passwd} file
2664does not exist, then the server can try to authenticate
2665the username and password using the operating system's
2666user-lookup routines (this "fallback" behavior can be
2667disabled by setting @code{SystemAuth=no} in the
2668@sc{cvs} @file{config} file, @pxref{config}).
2669
2670The default fallback behavior is to look in
2671@file{/etc/passwd} for this system user unless your
2672system has PAM (Pluggable Authentication Modules)
2673and your @sc{cvs} server executable was configured to
2674use it at compile time (using @code{./configure --enable-pam} - see the
2675INSTALL file for more).  In this case, PAM will be consulted instead.
2676This means that @sc{cvs} can be configured to use any password
2677authentication source PAM can be configured to use (possibilities
2678include a simple UNIX password, NIS, LDAP, and others) in its
2679global configuration file (usually @file{/etc/pam.conf}
2680or possibly @file{/etc/pam.d/cvs}).  See your PAM documentation
2681for more details on PAM configuration.
2682
2683Note that PAM is an experimental feature in @sc{cvs} and feedback is
2684encouraged.  Please send a mail to one of the @sc{cvs} mailing lists
2685(@code{info-cvs@@nongnu.org} or @code{bug-cvs@@nongnu.org}) if you use the
2686@sc{cvs} PAM support.
2687
2688@emph{WARNING: Using PAM gives the system administrator much more
2689flexibility about how @sc{cvs} users are authenticated but
2690no more security than other methods.  See below for more.}
2691
2692CVS needs an "auth", "account" and "session" module in the
2693PAM configuration file. A typical PAM configuration
2694would therefore have the following lines
2695in @file{/etc/pam.conf} to emulate the standard @sc{cvs}
2696system @file{/etc/passwd} authentication:
2697
2698@example
2699cvs	auth	    required	pam_unix.so
2700cvs	account	    required	pam_unix.so
2701cvs	session	    required	pam_unix.so
2702@end example
2703
2704The the equivalent @file{/etc/pam.d/cvs} would contain
2705
2706@example
2707auth	    required	pam_unix.so
2708account	    required	pam_unix.so
2709session	    required	pam_unix.so
2710@end example
2711
2712Some systems require a full path to the module so that
2713@file{pam_unix.so} (Linux) would become something like
2714@file{/usr/lib/security/$ISA/pam_unix.so.1} (Sun Solaris).
2715See the @file{contrib/pam} subdirectory of the @sc{cvs}
2716source distribution for further example configurations.
2717
2718The PAM service name given above as "cvs" is just
2719the service name in the default configuration and can be
2720set using
2721@code{./configure --with-hardcoded-pam-service-name=<pam-service-name>}
2722before compiling.  @sc{cvs} can also be configured to use whatever
2723name it is invoked as as its PAM service name using
2724@code{./configure --without-hardcoded-pam-service-name}, but this
2725feature should not be used if you may not have control of the name
2726@sc{cvs} will be invoked as.
2727
2728Be aware, also, that falling back to system
2729authentication might be a security risk: @sc{cvs}
2730operations would then be authenticated with that user's
2731regular login password, and the password flies across
2732the network in plaintext.  See @ref{Password
2733authentication security} for more on this.
2734This may be more of a problem with PAM authentication
2735because it is likely that the source of the system
2736password is some central authentication service like
2737LDAP which is also used to authenticate other services.
2738
2739On the other hand, PAM makes it very easy to change your password
2740regularly.  If they are given the option of a one-password system for
2741all of their activities, users are often more willing to change their
2742password on a regular basis.
2743
2744In the non-PAM configuration where the password is stored in the
2745@file{CVSROOT/passwd} file, it is difficult to change passwords on a
2746regular basis since only administrative users (or in some cases
2747processes that act as an administrative user) are typically given
2748access to modify this file.  Either there needs to be some
2749hand-crafted web page or set-uid program to update the file, or the
2750update needs to be done by submitting a request to an administrator to
2751perform the duty by hand.  In the first case, having to remember to
2752update a separate password on a periodic basis can be difficult.  In
2753the second case, the manual nature of the change will typically mean
2754that the password will not be changed unless it is absolutely
2755necessary.
2756
2757Note that PAM administrators should probably avoid configuring
2758one-time-passwords (OTP) for @sc{cvs} authentication/authorization.  If
2759OTPs are desired, the administrator may wish to encourage the use of
2760one of the other Client/Server access methods.  See the section on
2761@pxref{Remote repositories} for a list of other methods.
2762
2763Right now, the only way to put a password in the
2764@sc{cvs} @file{passwd} file is to paste it there from
2765somewhere else.  Someday, there may be a @code{cvs
2766passwd} command.
2767
2768Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2769is normal to edit the @file{passwd} file in-place,
2770rather than via @sc{cvs}.  This is because of the
2771possible security risks of having the @file{passwd}
2772file checked out to people's working copies.  If you do
2773want to include the @file{passwd} file in checkouts of
2774@file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2775
2776@c We might also suggest using the @code{htpasswd} command
2777@c from freely available web servers as well, but that
2778@c would open up a can of worms in that the users next
2779@c questions are likely to be "where do I get it?" and
2780@c "how do I use it?"
2781@c Also note that htpasswd, at least the version I had,
2782@c likes to clobber the third field.
2783
2784@node Password authentication client
2785@subsubsection Using the client with password authentication
2786@cindex Login (subcommand)
2787@cindex Password client, using
2788@cindex Authenticated client, using
2789@cindex pserver method, setting up
2790To run a @sc{cvs} command on a remote repository via
2791the password-authenticating server, one specifies the
2792@code{pserver} protocol, optional username, repository host, an
2793optional port number, and path to the repository.  For example:
2794
2795@example
2796cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2797@end example
2798
2799@noindent
2800or
2801
2802@example
2803CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2804cvs checkout someproj
2805@end example
2806
2807However, unless you're connecting to a public-access
2808repository (i.e., one where that username doesn't
2809require a password), you'll need to supply a password or @dfn{log in} first.
2810Logging in verifies your password with the repository and stores it in a file.
2811It's done with the @code{login} command, which will
2812prompt you interactively for the password if you didn't supply one as part of
2813@var{$CVSROOT}:
2814
2815@example
2816cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2817CVS password:
2818@end example
2819
2820@noindent
2821or
2822
2823@example
2824cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2825@end example
2826
2827After you enter the password, @sc{cvs} verifies it with
2828the server.  If the verification succeeds, then that
2829combination of username, host, repository, and password
2830is permanently recorded, so future transactions with
2831that repository won't require you to run @code{cvs
2832login}.  (If verification fails, @sc{cvs} will exit
2833complaining that the password was incorrect, and
2834nothing will be recorded.)
2835
2836The records are stored, by default, in the file
2837@file{$HOME/.cvspass}.  That file's format is
2838human-readable, and to a degree human-editable, but
2839note that the passwords are not stored in
2840cleartext---they are trivially encoded to protect them
2841from "innocent" compromise (i.e., inadvertent viewing
2842by a system administrator or other non-malicious
2843person).
2844
2845@cindex CVS_PASSFILE, environment variable
2846You can change the default location of this file by
2847setting the @code{CVS_PASSFILE} environment variable.
2848If you use this variable, make sure you set it
2849@emph{before} @code{cvs login} is run.  If you were to
2850set it after running @code{cvs login}, then later
2851@sc{cvs} commands would be unable to look up the
2852password for transmission to the server.
2853
2854Once you have logged in, all @sc{cvs} commands using
2855that remote repository and username will authenticate
2856with the stored password.  So, for example
2857
2858@example
2859cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2860@end example
2861
2862@noindent
2863should just work (unless the password changes on the
2864server side, in which case you'll have to re-run
2865@code{cvs login}).
2866
2867Note that if the @samp{:pserver:} were not present in
2868the repository specification, @sc{cvs} would assume it
2869should use @code{rsh} to connect with the server
2870instead (@pxref{Connecting via rsh}).
2871
2872Of course, once you have a working copy checked out and
2873are running @sc{cvs} commands from within it, there is
2874no longer any need to specify the repository
2875explicitly, because @sc{cvs} can deduce the repository
2876from the working copy's @file{CVS} subdirectory.
2877
2878@c FIXME: seems to me this needs somewhat more
2879@c explanation.
2880@cindex Logout (subcommand)
2881The password for a given remote repository can be
2882removed from the @code{CVS_PASSFILE} by using the
2883@code{cvs logout} command.
2884
2885@node Password authentication security
2886@subsubsection Security considerations with password authentication
2887
2888@cindex Security, of pserver
2889The passwords are stored on the client side in a
2890trivial encoding of the cleartext, and transmitted in
2891the same encoding.  The encoding is done only to
2892prevent inadvertent password compromises (i.e., a
2893system administrator accidentally looking at the file),
2894and will not prevent even a naive attacker from gaining
2895the password.
2896
2897@c FIXME: The bit about "access to the repository
2898@c implies general access to the system is *not* specific
2899@c to pserver; it applies to kerberos and SSH and
2900@c everything else too.  Should reorganize the
2901@c documentation to make this clear.
2902The separate @sc{cvs} password file (@pxref{Password
2903authentication server}) allows people
2904to use a different password for repository access than
2905for login access.  On the other hand, once a user has
2906non-read-only
2907access to the repository, she can execute programs on
2908the server system through a variety of means.  Thus, repository
2909access implies fairly broad system access as well.  It
2910might be possible to modify @sc{cvs} to prevent that,
2911but no one has done so as of this writing.
2912@c OpenBSD uses chroot() and copies the repository to
2913@c provide anonymous read-only access (for details see
2914@c http://www.openbsd.org/anoncvs.shar).  While this
2915@c closes the most obvious holes, I'm not sure it
2916@c closes enough holes to recommend it (plus it is
2917@c *very* easy to accidentally screw up a setup of this
2918@c type).
2919
2920Note that because the @file{$CVSROOT/CVSROOT} directory
2921contains @file{passwd} and other files which are used
2922to check security, you must control the permissions on
2923this directory as tightly as the permissions on
2924@file{/etc}.  The same applies to the @file{$CVSROOT}
2925directory itself and any directory
2926above it in the tree.  Anyone who has write access to
2927such a directory will have the ability to become any
2928user on the system.  Note that these permissions are
2929typically tighter than you would use if you are not
2930using pserver.
2931@c TODO: Would be really nice to document/implement a
2932@c scheme where the CVS server can run as some non-root
2933@c user, e.g. "cvs".  CVSROOT/passwd would contain a
2934@c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2935@c would be implicit).  This would greatly reduce
2936@c security risks such as those hinted at in the
2937@c previous paragraph.  I think minor changes to CVS
2938@c might be required but mostly this would just need
2939@c someone who wants to play with it, document it, &c.
2940
2941In summary, anyone who gets the password gets
2942repository access (which may imply some measure of general system
2943access as well).  The password is available to anyone
2944who can sniff network packets or read a protected
2945(i.e., user read-only) file.  If you want real
2946security, get Kerberos.
2947
2948@node GSSAPI authenticated
2949@subsection Direct connection with GSSAPI
2950
2951@cindex GSSAPI
2952@cindex Security, GSSAPI
2953@cindex gserver method, setting up
2954@cindex Kerberos, using gserver method
2955GSSAPI is a generic interface to network security
2956systems such as Kerberos 5.
2957If you have a working GSSAPI library, you can have
2958@sc{cvs} connect via a direct @sc{tcp} connection,
2959authenticating with GSSAPI.
2960
2961To do this, @sc{cvs} needs to be compiled with GSSAPI
2962support; when configuring @sc{cvs} it tries to detect
2963whether GSSAPI libraries using Kerberos version 5 are
2964present.  You can also use the @file{--with-gssapi}
2965flag to configure.
2966
2967The connection is authenticated using GSSAPI, but the
2968message stream is @emph{not} authenticated by default.
2969You must use the @code{-a} global option to request
2970stream authentication.
2971
2972The data transmitted is @emph{not} encrypted by
2973default.  Encryption support must be compiled into both
2974the client and the server; use the
2975@file{--enable-encrypt} configure option to turn it on.
2976You must then use the @code{-x} global option to
2977request encryption.
2978
2979GSSAPI connections are handled on the server side by
2980the same server which handles the password
2981authentication server; see @ref{Password authentication
2982server}.  If you are using a GSSAPI mechanism such as
2983Kerberos which provides for strong authentication, you
2984will probably want to disable the ability to
2985authenticate via cleartext passwords.  To do so, create
2986an empty @file{CVSROOT/passwd} password file, and set
2987@code{SystemAuth=no} in the config file
2988(@pxref{config}).
2989
2990The GSSAPI server uses a principal name of
2991cvs/@var{hostname}, where @var{hostname} is the
2992canonical name of the server host.  You will have to
2993set this up as required by your GSSAPI mechanism.
2994
2995To connect using GSSAPI, use the @samp{:gserver:} method.  For
2996example,
2997
2998@example
2999cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
3000@end example
3001
3002@node Kerberos authenticated
3003@subsection Direct connection with Kerberos
3004
3005@cindex Kerberos, using kserver method
3006@cindex Security, Kerberos
3007@cindex kserver method, setting up
3008The easiest way to use Kerberos is to use the Kerberos
3009@code{rsh}, as described in @ref{Connecting via rsh}.
3010The main disadvantage of using rsh is that all the data
3011needs to pass through additional programs, so it may be
3012slower.  So if you have Kerberos installed you can
3013connect via a direct @sc{tcp} connection,
3014authenticating with Kerberos.
3015
3016This section concerns the Kerberos network security
3017system, version 4.  Kerberos version 5 is supported via
3018the GSSAPI generic network security interface, as
3019described in the previous section.
3020
3021To do this, @sc{cvs} needs to be compiled with Kerberos
3022support; when configuring @sc{cvs} it tries to detect
3023whether Kerberos is present or you can use the
3024@file{--with-krb4} flag to configure.
3025
3026The data transmitted is @emph{not} encrypted by
3027default.  Encryption support must be compiled into both
3028the client and server; use the
3029@file{--enable-encryption} configure option to turn it
3030on.  You must then use the @code{-x} global option to
3031request encryption.
3032
3033The CVS client will attempt to connect to port 1999 by default.
3034
3035@cindex kinit
3036When you want to use @sc{cvs}, get a ticket in the
3037usual way (generally @code{kinit}); it must be a ticket
3038which allows you to log into the server machine.  Then
3039you are ready to go:
3040
3041@example
3042cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
3043@end example
3044
3045Previous versions of @sc{cvs} would fall back to a
3046connection via rsh; this version will not do so.
3047
3048@node Connecting via fork
3049@subsection Connecting with fork
3050
3051@cindex fork, access method
3052@cindex fork method, setting up
3053This access method allows you to connect to a
3054repository on your local disk via the remote protocol.
3055In other words it does pretty much the same thing as
3056@code{:local:}, but various quirks, bugs and the like are
3057those of the remote @sc{cvs} rather than the local
3058@sc{cvs}.
3059
3060For day-to-day operations you might prefer either
3061@code{:local:} or @code{:fork:}, depending on your
3062preferences.  Of course @code{:fork:} comes in
3063particularly handy in testing or
3064debugging @code{cvs} and the remote protocol.
3065Specifically, we avoid all of the network-related
3066setup/configuration, timeouts, and authentication
3067inherent in the other remote access methods but still
3068create a connection which uses the remote protocol.
3069
3070To connect using the @code{fork} method, use
3071@samp{:fork:} and the pathname to your local
3072repository.  For example:
3073
3074@example
3075cvs -d :fork:/usr/local/cvsroot checkout foo
3076@end example
3077
3078@cindex CVS_SERVER, and fork method
3079As with @code{:ext:}, the server is called @samp{cvs}
3080by default, or the value of the @code{CVS_SERVER}
3081environment variable.
3082
3083
3084@node Write proxies
3085@subsection Distributing load across several CVS servers
3086
3087@cindex PrimaryServer, in CVSROOT/config
3088@cindex Primary server
3089@cindex Secondary server
3090@cindex proxy, write
3091@cindex write proxy
3092@sc{cvs} can be configured to distribute usage across several @sc{cvs}
3093servers.  This is accomplished by means of one or more @dfn{write proxies}, or
3094@dfn{secondary servers}, for a single @dfn{primary server}.
3095
3096When a @sc{cvs} client accesses a secondary server and only sends read
3097requests, then the secondary server handles the entire request.  If the client
3098sends any write requests, however, the secondary server asks the client to
3099redirect its write request to the primary server, if the client supports
3100redirect requests, and otherwise becomes a transparent proxy for the primary
3101server, which actually handles the write request.
3102
3103In this manner, any number of read-only secondary servers may be configured as
3104write proxies for the primary server, effectively distributing the load from
3105all read operations between the secondary servers and restricting the load on
3106the primary server to write operations and pushing changes to the secondaries.
3107
3108Primary servers will not automatically push changes to secondaries.  This must
3109be configured via @file{loginfo}, @file{postadmin}, @file{posttag}, &
3110@file{postwatch} scripts (@pxref{Trigger Scripts}) like the following:
3111
3112@example
3113ALL	rsync -gopr -essh ./ secondary:/cvsroot/%p &
3114@end example
3115
3116You would probably actually want to lock directories for write on the secondary
3117and for read on the primary before running the @samp{rsync} in the above
3118example, but describing such a setup is beyond the scope of this document.
3119
3120A secondary advantage of a write proxy setup is that users pointing at the
3121secondary server can still execute fast read operations while on a network that
3122connects to the primary over a slow link or even one where the link to the
3123primary is periodically broken.  Only write operations will require the network
3124link to the primary.
3125
3126To configure write proxies, the primary must be specified with the
3127@samp{PrimaryServer} option in @file{CVSROOT/config} (@pxref{config}).  For the
3128transparent proxy mode to work, all secondary servers must also be running the
3129same version of the @sc{cvs} server, or at least one that provides the same
3130list of supported requests to the client as the primary server.  This is not
3131necessary for redirection.
3132
3133Once a primary server is configured, secondary servers may be configured by:
3134
3135@enumerate
3136@item
3137Duplicating the primary repository at the new location.
3138@item
3139Setting up the @file{loginfo}, @file{postadmin}, @file{posttag}, and
3140@file{postwatch} files on the primary to propagate writes to the new secondary.
3141@item
3142Configure remote access to the secondary(ies) as you would configure access
3143to any other CVS server (@pxref{Remote repositories}).
3144@item
3145Ensuring that @code{--allow-root=@var{secondary-cvsroot}} is passed to
3146@strong{all} incovations of the secondary server if the path to the @sc{cvs}
3147repository directory is different on the two servers and you wish to support
3148clients that do not handle the @samp{Redirect} resopnse (CVS 1.12.9 and earlier
3149clients do not handle the @samp{Redirect} response).
3150
3151Please note, again, that writethrough proxy suport requires
3152@code{--allow-root=@var{secondary-cvsroot}} to be specified for @strong{all}
3153incovations of the secondary server, not just @samp{pserver} invocations.
3154This may require a wrapper script for the @sc{cvs} executable
3155on your server machine.
3156@end enumerate
3157
3158
3159@c ---------------------------------------------------------------------
3160@node Read-only access
3161@section Read-only repository access
3162@cindex Read-only repository access
3163@cindex readers (admin file)
3164@cindex writers (admin file)
3165
3166        It is possible to grant read-only repository
3167access to people using the password-authenticated
3168server (@pxref{Password authenticated}).  (The
3169other access methods do not have explicit support for
3170read-only users because those methods all assume login
3171access to the repository machine anyway, and therefore
3172the user can do whatever local file permissions allow
3173her to do.)
3174
3175        A user who has read-only access can do only
3176those @sc{cvs} operations which do not modify the
3177repository, except for certain ``administrative'' files
3178(such as lock files and the history file).  It may be
3179desirable to use this feature in conjunction with
3180user-aliasing (@pxref{Password authentication server}).
3181
3182Unlike with previous versions of @sc{cvs}, read-only
3183users should be able merely to read the repository, and
3184not to execute programs on the server or otherwise gain
3185unexpected levels of access.  Or to be more accurate,
3186the @emph{known} holes have been plugged.  Because this
3187feature is new and has not received a comprehensive
3188security audit, you should use whatever level of
3189caution seems warranted given your attitude concerning
3190security.
3191
3192        There are two ways to specify read-only access
3193for a user: by inclusion, and by exclusion.
3194
3195        "Inclusion" means listing that user
3196specifically in the @file{$CVSROOT/CVSROOT/readers}
3197file, which is simply a newline-separated list of
3198users.  Here is a sample @file{readers} file:
3199
3200@example
3201melissa
3202splotnik
3203jrandom
3204@end example
3205
3206@noindent
3207        (Don't forget the newline after the last user.)
3208
3209        "Exclusion" means explicitly listing everyone
3210who has @emph{write} access---if the file
3211
3212@example
3213$CVSROOT/CVSROOT/writers
3214@end example
3215
3216@noindent
3217exists, then only
3218those users listed in it have write access, and
3219everyone else has read-only access (of course, even the
3220read-only users still need to be listed in the
3221@sc{cvs} @file{passwd} file).  The
3222@file{writers} file has the same format as the
3223@file{readers} file.
3224
3225        Note: if your @sc{cvs} @file{passwd}
3226file maps cvs users onto system users (@pxref{Password
3227authentication server}), make sure you deny or grant
3228read-only access using the @emph{cvs} usernames, not
3229the system usernames.  That is, the @file{readers} and
3230@file{writers} files contain cvs usernames, which may
3231or may not be the same as system usernames.
3232
3233        Here is a complete description of the server's
3234behavior in deciding whether to grant read-only or
3235read-write access:
3236
3237        If @file{readers} exists, and this user is
3238listed in it, then she gets read-only access.  Or if
3239@file{writers} exists, and this user is NOT listed in
3240it, then she also gets read-only access (this is true
3241even if @file{readers} exists but she is not listed
3242there).  Otherwise, she gets full read-write access.
3243
3244        Of course there is a conflict if the user is
3245listed in both files.  This is resolved in the more
3246conservative way, it being better to protect the
3247repository too much than too little: such a user gets
3248read-only access.
3249
3250@node Server temporary directory
3251@section Temporary directories for the server
3252@cindex Temporary directories, and server
3253@cindex Server, temporary directories
3254
3255While running, the @sc{cvs} server creates temporary
3256directories.  They are named
3257
3258@example
3259cvs-serv@var{pid}
3260@end example
3261
3262@noindent
3263where @var{pid} is the process identification number of
3264the server.
3265They are located in the directory specified by
3266the @samp{-T} global option (@pxref{Global options}),
3267the @code{TMPDIR} environment variable (@pxref{Environment variables}),
3268or, failing that, @file{/tmp}.
3269
3270In most cases the server will remove the temporary
3271directory when it is done, whether it finishes normally
3272or abnormally.  However, there are a few cases in which
3273the server does not or cannot remove the temporary
3274directory, for example:
3275
3276@itemize @bullet
3277@item
3278If the server aborts due to an internal server error,
3279it may preserve the directory to aid in debugging
3280
3281@item
3282If the server is killed in a way that it has no way of
3283cleaning up (most notably, @samp{kill -KILL} on unix).
3284
3285@item
3286If the system shuts down without an orderly shutdown,
3287which tells the server to clean up.
3288@end itemize
3289
3290In cases such as this, you will need to manually remove
3291the @file{cvs-serv@var{pid}} directories.  As long as
3292there is no server running with process identification
3293number @var{pid}, it is safe to do so.
3294
3295@c ---------------------------------------------------------------------
3296@node Starting a new project
3297@chapter Starting a project with CVS
3298@cindex Starting a project with CVS
3299@cindex Creating a project
3300
3301@comment --moduledb--
3302Because renaming files and moving them between
3303directories is somewhat inconvenient, the first thing
3304you do when you start a new project should be to think
3305through your file organization.  It is not impossible
3306to rename or move files, but it does increase the
3307potential for confusion and @sc{cvs} does have some
3308quirks particularly in the area of renaming
3309directories.  @xref{Moving files}.
3310
3311What to do next depends on the situation at hand.
3312
3313@menu
3314* Setting up the files::        Getting the files into the repository
3315* Defining the module::         How to make a module of the files
3316@end menu
3317@c -- File permissions!
3318
3319@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3320@node Setting up the files
3321@section Setting up the files
3322
3323The first step is to create the files inside the repository.  This can
3324be done in a couple of different ways.
3325
3326@c -- The contributed scripts
3327@menu
3328* From files::                  This method is useful with old projects
3329                                where files already exists.
3330* From other version control systems::  Old projects where you want to
3331                                        preserve history from another system.
3332* From scratch::                Creating a directory tree from scratch.
3333@end menu
3334
3335@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3336@node From files
3337@subsection Creating a directory tree from a number of files
3338@cindex Importing files
3339
3340When you begin using @sc{cvs}, you will probably already have several
3341projects that can be
3342put under @sc{cvs} control.  In these cases the easiest way is to use the
3343@code{import} command.  An example is probably the easiest way to
3344explain how to use it.  If the files you want to install in
3345@sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3346repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3347
3348@example
3349$ cd @var{wdir}
3350$ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3351@end example
3352
3353Unless you supply a log message with the @samp{-m}
3354flag, @sc{cvs} starts an editor and prompts for a
3355message.  The string @samp{yoyo} is a @dfn{vendor tag},
3356and @samp{start} is a @dfn{release tag}.  They may fill
3357no purpose in this context, but since @sc{cvs} requires
3358them they must be present.  @xref{Tracking sources}, for
3359more information about them.
3360
3361You can now verify that it worked, and remove your
3362original source directory.
3363@c FIXME: Need to say more about "verify that it
3364@c worked".  What should the user look for in the output
3365@c from "diff -r"?
3366
3367@example
3368$ cd ..
3369$ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3370$ diff -r @var{wdir} yoyodyne/@var{rdir}
3371$ rm -r @var{wdir}
3372@end example
3373
3374@noindent
3375Erasing the original sources is a good idea, to make sure that you do
3376not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3377Of course, it would be wise to make sure that you have
3378a backup of the sources before you remove them.
3379
3380The @code{checkout} command can either take a module
3381name as argument (as it has done in all previous
3382examples) or a path name relative to @code{$CVSROOT},
3383as it did in the example above.
3384
3385It is a good idea to check that the permissions
3386@sc{cvs} sets on the directories inside @code{$CVSROOT}
3387are reasonable, and that they belong to the proper
3388groups.  @xref{File permissions}.
3389
3390If some of the files you want to import are binary, you
3391may want to use the wrappers features to specify which
3392files are binary and which are not.  @xref{Wrappers}.
3393
3394@c The node name is too long, but I am having trouble
3395@c thinking of something more concise.
3396@node From other version control systems
3397@subsection Creating Files From Other Version Control Systems
3398@cindex Importing files, from other version control systems
3399
3400If you have a project which you are maintaining with
3401another version control system, such as @sc{rcs}, you
3402may wish to put the files from that project into
3403@sc{cvs}, and preserve the revision history of the
3404files.
3405
3406@table @asis
3407@cindex RCS, importing files from
3408@item From RCS
3409If you have been using @sc{rcs}, find the @sc{rcs}
3410files---usually a file named @file{foo.c} will have its
3411@sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3412other places; consult the @sc{rcs} documentation for
3413details).  Then create the appropriate directories in
3414@sc{cvs} if they do not already exist.  Then copy the
3415files into the appropriate directories in the @sc{cvs}
3416repository (the name in the repository must be the name
3417of the source file with @samp{,v} added; the files go
3418directly in the appropriate directory of the repository,
3419not in an @file{RCS} subdirectory).  This is one of the
3420few times when it is a good idea to access the @sc{cvs}
3421repository directly, rather than using @sc{cvs}
3422commands.  Then you are ready to check out a new
3423working directory.
3424@c Someday there probably should be a "cvs import -t
3425@c rcs" or some such.  It could even create magic
3426@c branches.  It could also do something about the case
3427@c where the RCS file had a (non-magic) "0" branch.
3428
3429The @sc{rcs} file should not be locked when you move it
3430into @sc{cvs}; if it is, @sc{cvs} will have trouble
3431letting you operate on it.
3432@c What is the easiest way to unlock your files if you
3433@c have them locked?  Especially if you have a lot of them?
3434@c This is a CVS bug/misfeature; importing RCS files
3435@c should ignore whether they are locked and leave them in
3436@c an unlocked state.  Yet another reason for a separate
3437@c "import RCS file" command.
3438
3439@c How many is "many"? Or do they just import RCS files?
3440@item From another version control system
3441Many version control systems have the ability to export
3442@sc{rcs} files in the standard format.  If yours does,
3443export the @sc{rcs} files and then follow the above
3444instructions.
3445
3446Failing that, probably your best bet is to write a
3447script that will check out the files one revision at a
3448time using the command line interface to the other
3449system, and then check the revisions into @sc{cvs}.
3450The @file{sccs2rcs} script mentioned below may be a
3451useful example to follow.
3452
3453@cindex SCCS, importing files from
3454@item From SCCS
3455There is a script in the @file{contrib} directory of
3456the @sc{cvs} source distribution called @file{sccs2rcs}
3457which converts @sc{sccs} files to @sc{rcs} files.
3458Note: you must run it on a machine which has both
3459@sc{sccs} and @sc{rcs} installed, and like everything
3460else in contrib it is unsupported (your mileage may
3461vary).
3462
3463@cindex PVCS, importing files from
3464@item From PVCS
3465There is a script in the @file{contrib} directory of
3466the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3467which converts @sc{pvcs} archives to @sc{rcs} files.
3468You must run it on a machine which has both
3469@sc{pvcs} and @sc{rcs} installed, and like everything
3470else in contrib it is unsupported (your mileage may
3471vary).  See the comments in the script for details.
3472@end table
3473@c CMZ and/or PATCHY were systems that were used in the
3474@c high energy physics community (especially for
3475@c CERNLIB).  CERN has replaced them with CVS, but the
3476@c CAR format seems to live on as a way to submit
3477@c changes.  There is a program car2cvs which converts
3478@c but I'm not sure where one gets a copy.
3479@c Not sure it is worth mentioning here, since it would
3480@c appear to affect only one particular community.
3481@c Best page for more information is:
3482@c http://wwwcn1.cern.ch/asd/cvs/index.html
3483@c See also:
3484@c http://ecponion.cern.ch/ecpsa/cernlib.html
3485
3486@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3487@node From scratch
3488@subsection Creating a directory tree from scratch
3489
3490@c Also/instead should be documenting
3491@c $ cvs co -l .
3492@c $ mkdir tc
3493@c $ cvs add tc
3494@c $ cd tc
3495@c $ mkdir man
3496@c $ cvs add man
3497@c etc.
3498@c Using import to create the directories only is
3499@c probably a somewhat confusing concept.
3500For a new project, the easiest thing to do is probably
3501to create an empty directory structure, like this:
3502
3503@example
3504$ mkdir tc
3505$ mkdir tc/man
3506$ mkdir tc/testing
3507@end example
3508
3509After that, you use the @code{import} command to create
3510the corresponding (empty) directory structure inside
3511the repository:
3512
3513@example
3514$ cd tc
3515$ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3516@end example
3517
3518This will add yoyodyne/@var{dir} as a directory under
3519@code{$CVSROOT}.
3520
3521Use @code{checkout} to get the new project.  Then, use @code{add}
3522to add files (and new directories) as needed.
3523
3524@example
3525$ cd ..
3526$ cvs co yoyodyne/@var{dir}
3527@end example
3528
3529Check that the permissions @sc{cvs} sets on the
3530directories inside @code{$CVSROOT} are reasonable.
3531
3532@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3533@node Defining the module
3534@section Defining the module
3535@cindex Defining a module
3536@cindex Editing the modules file
3537@cindex Module, defining
3538@cindex Modules file, changing
3539
3540The next step is to define the module in the
3541@file{modules} file.  This is not strictly necessary,
3542but modules can be convenient in grouping together
3543related files and directories.
3544
3545In simple cases these steps are sufficient to define a module.
3546
3547@enumerate
3548@item
3549Get a working copy of the modules file.
3550
3551@example
3552$ cvs checkout CVSROOT/modules
3553$ cd CVSROOT
3554@end example
3555
3556@item
3557Edit the file and insert a line that defines the module.  @xref{Intro
3558administrative files}, for an introduction.  @xref{modules}, for a full
3559description of the modules file.  You can use the
3560following line to define the module @samp{tc}:
3561
3562@example
3563tc   yoyodyne/tc
3564@end example
3565
3566@item
3567Commit your changes to the modules file.
3568
3569@example
3570$ cvs commit -m "Added the tc module." modules
3571@end example
3572
3573@item
3574Release the modules module.
3575
3576@example
3577$ cd ..
3578$ cvs release -d CVSROOT
3579@end example
3580@end enumerate
3581
3582@c ---------------------------------------------------------------------
3583@node Revisions
3584@chapter Revisions
3585
3586For many uses of @sc{cvs}, one doesn't need to worry
3587too much about revision numbers; @sc{cvs} assigns
3588numbers such as @code{1.1}, @code{1.2}, and so on, and
3589that is all one needs to know.  However, some people
3590prefer to have more knowledge and control concerning
3591how @sc{cvs} assigns revision numbers.
3592
3593If one wants to keep track of a set of revisions
3594involving more than one file, such as which revisions
3595went into a particular release, one uses a @dfn{tag},
3596which is a symbolic revision which can be assigned to a
3597numeric revision in each file.
3598
3599@menu
3600* Revision numbers::            The meaning of a revision number
3601* Versions revisions releases::  Terminology used in this manual
3602* Assigning revisions::         Assigning revisions
3603* Tags::                        Tags--Symbolic revisions
3604* Tagging the working directory::  The cvs tag command
3605* Tagging by date/tag::         The cvs rtag command
3606* Modifying tags::              Adding, renaming, and deleting tags
3607* Tagging add/remove::          Tags with adding and removing files
3608* Sticky tags::                 Certain tags are persistent
3609@end menu
3610
3611@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3612@node Revision numbers
3613@section Revision numbers
3614@cindex Revision numbers
3615@cindex Revision tree
3616@cindex Linear development
3617@cindex Number, revision-
3618@cindex Decimal revision number
3619@cindex Branch number
3620@cindex Number, branch
3621
3622Each version of a file has a unique @dfn{revision
3623number}.  Revision numbers look like @samp{1.1},
3624@samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3625A revision number always has an even number of
3626period-separated decimal integers.  By default revision
36271.1 is the first revision of a file.  Each successive
3628revision is given a new number by increasing the
3629rightmost number by one.  The following figure displays
3630a few revisions, with newer revisions to the right.
3631
3632@example
3633       +-----+    +-----+    +-----+    +-----+    +-----+
3634       ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3635       +-----+    +-----+    +-----+    +-----+    +-----+
3636@end example
3637
3638It is also possible to end up with numbers containing
3639more than one period, for example @samp{1.3.2.2}.  Such
3640revisions represent revisions on branches
3641(@pxref{Branching and merging}); such revision numbers
3642are explained in detail in @ref{Branches and
3643revisions}.
3644
3645@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3646@node Versions revisions releases
3647@section Versions, revisions and releases
3648@cindex Revisions, versions and releases
3649@cindex Versions, revisions and releases
3650@cindex Releases, revisions and versions
3651
3652A file can have several versions, as described above.
3653Likewise, a software product can have several versions.
3654A software product is often given a version number such
3655as @samp{4.1.1}.
3656
3657Versions in the first sense are called @dfn{revisions}
3658in this document, and versions in the second sense are
3659called @dfn{releases}.  To avoid confusion, the word
3660@dfn{version} is almost never used in this document.
3661
3662@node Assigning revisions
3663@section Assigning revisions
3664
3665@c We avoid the "major revision" terminology.  It seems
3666@c like jargon.  Hopefully "first number" is clear enough.
3667@c
3668@c Well, in the context of software release numbers,
3669@c "major" and "minor" release or version numbers are
3670@c documented in at least the GNU Coding Standards, but I'm
3671@c still not sure I find that a valid reason to apply the
3672@c terminology to RCS revision numbers.  "First", "Second",
3673@c "subsequent", and so on is almost surely clearer,
3674@c especially to a novice reader. -DRP
3675By default, @sc{cvs} will assign numeric revisions by
3676leaving the first number the same and incrementing the
3677second number.  For example, @code{1.1}, @code{1.2},
3678@code{1.3}, etc.
3679
3680When adding a new file, the second number will always
3681be one and the first number will equal the highest
3682first number of any file in that directory.  For
3683example, the current directory contains files whose
3684highest numbered revisions are @code{1.7}, @code{3.1},
3685and @code{4.12}, then an added file will be given the
3686numeric revision @code{4.1}.
3687(When using client/server @sc{cvs},
3688only files that are actually sent to the server are considered.)
3689
3690@c This is sort of redundant with something we said a
3691@c while ago.  Somewhere we need a better way of
3692@c introducing how the first number can be anything
3693@c except "1", perhaps.  Also I don't think this
3694@c presentation is clear on why we are discussing releases
3695@c and first numbers of numeric revisions in the same
3696@c breath.
3697Normally there is no reason to care
3698about the revision numbers---it is easier to treat them
3699as internal numbers that @sc{cvs} maintains, and tags
3700provide a better way to distinguish between things like
3701release 1 versus release 2 of your product
3702(@pxref{Tags}).  However, if you want to set the
3703numeric revisions, the @samp{-r} option to @code{cvs
3704commit} can do that.  The @samp{-r} option implies the
3705@samp{-f} option, in the sense that it causes the
3706files to be committed even if they are not modified.
3707
3708For example, to bring all your files up to
3709revision 3.0 (including those that haven't changed),
3710you might invoke:
3711
3712@example
3713$ cvs commit -r 3.0
3714@end example
3715
3716Note that the number you specify with @samp{-r} must be
3717larger than any existing revision number.  That is, if
3718revision 3.0 exists, you cannot @samp{cvs commit
3719-r 1.3}.  If you want to maintain several releases in
3720parallel, you need to use a branch (@pxref{Branching and merging}).
3721
3722@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3723@node Tags
3724@section Tags--Symbolic revisions
3725@cindex Tags
3726
3727The revision numbers live a life of their own.  They
3728need not have anything at all to do with the release
3729numbers of your software product.  Depending
3730on how you use @sc{cvs} the revision numbers might change several times
3731between two releases.  As an example, some of the
3732source files that make up @sc{rcs} 5.6 have the following
3733revision numbers:
3734@cindex RCS revision numbers
3735
3736@example
3737ci.c            5.21
3738co.c            5.9
3739ident.c         5.3
3740rcs.c           5.12
3741rcsbase.h       5.11
3742rcsdiff.c       5.10
3743rcsedit.c       5.11
3744rcsfcmp.c       5.9
3745rcsgen.c        5.10
3746rcslex.c        5.11
3747rcsmap.c        5.2
3748rcsutil.c       5.10
3749@end example
3750
3751@cindex tag (subcommand), introduction
3752@cindex Tags, symbolic name
3753@cindex Symbolic name (tag)
3754@cindex Name, symbolic (tag)
3755@cindex HEAD, as reserved tag name
3756@cindex BASE, as reserved tag name
3757You can use the @code{tag} command to give a symbolic name to a
3758certain revision of a file.  You can use the @samp{-v} flag to the
3759@code{status} command to see all tags that a file has, and
3760which revision numbers they represent.  Tag names must
3761start with an uppercase or lowercase letter and can
3762contain uppercase and lowercase letters, digits,
3763@samp{-}, and @samp{_}.  The two tag names @code{BASE}
3764and @code{HEAD} are reserved for use by @sc{cvs}.  It
3765is expected that future names which are special to
3766@sc{cvs} will be specially named, for example by
3767starting with @samp{.}, rather than being named analogously to
3768@code{BASE} and @code{HEAD}, to avoid conflicts with
3769actual tag names.
3770@c Including a character such as % or = has also been
3771@c suggested as the naming convention for future
3772@c special tag names.  Starting with . is nice because
3773@c that is not a legal tag name as far as RCS is concerned.
3774@c FIXME: CVS actually accepts quite a few characters
3775@c in tag names, not just the ones documented above
3776@c (see RCS_check_tag).  RCS
3777@c defines legitimate tag names by listing illegal
3778@c characters rather than legal ones.  CVS is said to lose its
3779@c mind if you try to use "/" (try making such a tag sticky
3780@c and using "cvs status" client/server--see remote
3781@c protocol format for entries line for probable cause).
3782@c TODO: The testsuite
3783@c should test for whatever are documented above as
3784@c officially-OK tag names, and CVS should at least reject
3785@c characters that won't work, like "/".
3786
3787You'll want to choose some convention for naming tags,
3788based on information such as the name of the program
3789and the version number of the release.  For example,
3790one might take the name of the program, immediately
3791followed by the version number with @samp{.} changed to
3792@samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3793@code{cvs1-9}.  If you choose a consistent convention,
3794then you won't constantly be guessing whether a tag is
3795@code{cvs-1-9} or @code{cvs1_9} or what.  You might
3796even want to consider enforcing your convention in the
3797@file{taginfo} file (@pxref{taginfo}).
3798@c Might be nice to say more about using taginfo this
3799@c way, like giving an example, or pointing out any particular
3800@c issues which arise.
3801
3802@cindex Adding a tag
3803@cindex Tags, example
3804The following example shows how you can add a tag to a
3805file.  The commands must be issued inside your working
3806directory.  That is, you should issue the
3807command in the directory where @file{backend.c}
3808resides.
3809
3810@example
3811$ cvs tag rel-0-4 backend.c
3812T backend.c
3813$ cvs status -v backend.c
3814===================================================================
3815File: backend.c         Status: Up-to-date
3816
3817    Version:            1.4     Tue Dec  1 14:39:01 1992
3818    RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3819    Sticky Tag:         (none)
3820    Sticky Date:        (none)
3821    Sticky Options:     (none)
3822
3823    Existing Tags:
3824        rel-0-4                     (revision: 1.4)
3825
3826@end example
3827
3828For a complete summary of the syntax of @code{cvs tag},
3829including the various options, see @ref{Invoking CVS}.
3830
3831There is seldom reason to tag a file in isolation.  A more common use is
3832to tag all the files that constitute a module with the same tag at
3833strategic points in the development life-cycle, such as when a release
3834is made.
3835
3836@example
3837$ cvs tag rel-1-0 .
3838cvs tag: Tagging .
3839T Makefile
3840T backend.c
3841T driver.c
3842T frontend.c
3843T parser.c
3844@end example
3845
3846@noindent
3847(When you give @sc{cvs} a directory as argument, it generally applies the
3848operation to all the files in that directory, and (recursively), to any
3849subdirectories that it may contain.  @xref{Recursive behavior}.)
3850
3851@cindex Retrieving an old revision using tags
3852@cindex Tags, retrieving old revisions
3853The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3854a certain revision of a module.  This flag makes it easy to
3855retrieve the sources that make up release 1.0 of the module @samp{tc} at
3856any time in the future:
3857
3858@example
3859$ cvs checkout -r rel-1-0 tc
3860@end example
3861
3862@noindent
3863This is useful, for instance, if someone claims that there is a bug in
3864that release, but you cannot find the bug in the current working copy.
3865
3866You can also check out a module as it was on any branch at any given date.
3867@xref{checkout options}.  When specifying @samp{-r} or @samp{-D} to
3868any of these commands, you will need beware of sticky
3869tags; see @ref{Sticky tags}.
3870
3871When you tag more than one file with the same tag you
3872can think about the tag as "a curve drawn through a
3873matrix of filename vs. revision number."  Say we have 5
3874files with the following revisions:
3875
3876@example
3877@group
3878        file1   file2   file3   file4   file5
3879
3880        1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3881        1.2*-   1.2     1.2    -1.2*-
3882        1.3  \- 1.3*-   1.3   / 1.3
3883        1.4          \  1.4  /  1.4
3884                      \-1.5*-   1.5
3885                        1.6
3886@end group
3887@end example
3888
3889At some time in the past, the @code{*} versions were tagged.
3890You can think of the tag as a handle attached to the curve
3891drawn through the tagged revisions.  When you pull on
3892the handle, you get all the tagged revisions.  Another
3893way to look at it is that you "sight" through a set of
3894revisions that is "flat" along the tagged revisions,
3895like this:
3896
3897@example
3898@group
3899        file1   file2   file3   file4   file5
3900
3901                        1.1
3902                        1.2
3903                1.1     1.3                       _
3904        1.1     1.2     1.4     1.1              /
3905        1.2*----1.3*----1.5*----1.2*----1.1*    (--- <--- Look here
3906        1.3             1.6     1.3              \_
3907        1.4                     1.4
3908                                1.5
3909@end group
3910@end example
3911
3912@node Tagging the working directory
3913@section Specifying what to tag from the working directory
3914
3915@cindex tag (subcommand)
3916The example in the previous section demonstrates one of
3917the most common ways to choose which revisions to tag.
3918Namely, running the @code{cvs tag} command without
3919arguments causes @sc{cvs} to select the revisions which
3920are checked out in the current working directory.  For
3921example, if the copy of @file{backend.c} in working
3922directory was checked out from revision 1.4, then
3923@sc{cvs} will tag revision 1.4.  Note that the tag is
3924applied immediately to revision 1.4 in the repository;
3925tagging is not like modifying a file, or other
3926operations in which one first modifies the working
3927directory and then runs @code{cvs commit} to transfer
3928that modification to the repository.
3929
3930One potentially surprising aspect of the fact that
3931@code{cvs tag} operates on the repository is that you
3932are tagging the checked-in revisions, which may differ
3933from locally modified files in your working directory.
3934If you want to avoid doing this by mistake, specify the
3935@samp{-c} option to @code{cvs tag}.  If there are any
3936locally modified files, @sc{cvs} will abort with an
3937error before it tags any files:
3938
3939@example
3940$ cvs tag -c rel-0-4
3941cvs tag: backend.c is locally modified
3942cvs [tag aborted]: correct the above errors first!
3943@end example
3944
3945@node Tagging by date/tag
3946@section Specifying what to tag by date or revision
3947@cindex rtag (subcommand)
3948
3949The @code{cvs rtag} command tags the repository as of a
3950certain date or time (or can be used to tag the latest
3951revision).  @code{rtag} works directly on the
3952repository contents (it requires no prior checkout and
3953does not look for a working directory).
3954
3955The following options specify which date or revision to
3956tag.  See @ref{Common options}, for a complete
3957description of them.
3958
3959@table @code
3960@item -D @var{date}
3961Tag the most recent revision no later than @var{date}.
3962
3963@item -f
3964Only useful with the @samp{-D} or @samp{-r}
3965flags.  If no matching revision is found, use the most
3966recent revision (instead of ignoring the file).
3967
3968@item -r @var{tag}[:@var{date}]
3969Tag the revision already tagged with @var{tag} or, when @var{date} is specified
3970and @var{tag} is a branch tag, the version from the branch @var{tag} as it
3971existed on @var{date}.  See @ref{Common options}.
3972@end table
3973
3974The @code{cvs tag} command also allows one to specify
3975files by revision or date, using the same @samp{-r},
3976@samp{-D}, and @samp{-f} options.  However, this
3977feature is probably not what you want.  The reason is
3978that @code{cvs tag} chooses which files to tag based on
3979the files that exist in the working directory, rather
3980than the files which existed as of the given tag/date.
3981Therefore, you are generally better off using @code{cvs
3982rtag}.  The exceptions might be cases like:
3983
3984@example
3985cvs tag -r 1.4 stable backend.c
3986@end example
3987
3988@node Modifying tags
3989@section Deleting, moving, and renaming tags
3990
3991@c Also see:
3992@c  "How do I move or rename a magic branch tag?"
3993@c in the FAQ (I think the issues it talks about still
3994@c apply, but this could use some sanity.sh work).
3995
3996Normally one does not modify tags.  They exist in order
3997to record the history of the repository and so deleting
3998them or changing their meaning would, generally, not be
3999what you want.
4000
4001However, there might be cases in which one uses a tag
4002temporarily or accidentally puts one in the wrong
4003place.  Therefore, one might delete, move, or rename a
4004tag.
4005
4006@noindent
4007@emph{WARNING: the commands in this section are
4008dangerous; they permanently discard historical
4009information and it can be difficult or impossible to
4010recover from errors.  If you are a @sc{cvs}
4011administrator, you may consider restricting these
4012commands with the @file{taginfo} file (@pxref{taginfo}).}
4013
4014@cindex Deleting tags
4015@cindex Deleting branch tags
4016@cindex Removing tags
4017@cindex Removing branch tags
4018@cindex Tags, deleting
4019@cindex Branch tags, deleting
4020To delete a tag, specify the @samp{-d} option to either
4021@code{cvs tag} or @code{cvs rtag}.  For example:
4022
4023@example
4024cvs rtag -d rel-0-4 tc
4025@end example
4026
4027@noindent
4028deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
4029In the event that branch tags are encountered within the repository
4030with the given name, a warning message will be issued and the branch
4031tag will not be deleted.  If you are absolutely certain you know what
4032you are doing, the @code{-B} option may be specified to allow deletion
4033of branch tags.  In that case, any non-branch tags encountered will
4034trigger warnings and will not be deleted.
4035
4036@noindent
4037@emph{WARNING: Moving branch tags is very dangerous!  If you think
4038you need the @code{-B} option, think again and ask your @sc{cvs}
4039administrator about it (if that isn't you).  There is almost certainly
4040another way to accomplish what you want to accomplish.}
4041
4042@cindex Moving tags
4043@cindex Moving branch tags
4044@cindex Tags, moving
4045@cindex Branch tags, moving
4046When we say @dfn{move} a tag, we mean to make the same
4047name point to different revisions.  For example, the
4048@code{stable} tag may currently point to revision 1.4
4049of @file{backend.c} and perhaps we want to make it
4050point to revision 1.6.  To move a non-branch tag, specify the
4051@samp{-F} option to either @code{cvs tag} or @code{cvs
4052rtag}.  For example, the task just mentioned might be
4053accomplished as:
4054
4055@example
4056cvs tag -r 1.6 -F stable backend.c
4057@end example
4058
4059@noindent
4060If any branch tags are encountered in the repository
4061with the given name, a warning is issued and the branch
4062tag is not disturbed.  If you are absolutely certain you
4063wish to move the branch tag, the @code{-B} option may be specified.
4064In that case, non-branch tags encountered with the given
4065name are ignored with a warning message.
4066
4067@noindent
4068@emph{WARNING: Moving branch tags is very dangerous!  If you think you
4069need the @code{-B} option, think again and ask your @sc{cvs}
4070administrator about it (if that isn't you).  There is almost certainly
4071another way to accomplish what you want to accomplish.}
4072
4073@cindex Renaming tags
4074@cindex Tags, renaming
4075When we say @dfn{rename} a tag, we mean to make a
4076different name point to the same revisions as the old
4077tag.  For example, one may have misspelled the tag name
4078and want to correct it (hopefully before others are
4079relying on the old spelling).  To rename a tag, first
4080create a new tag using the @samp{-r} option to
4081@code{cvs rtag}, and then delete the old name.  (Caution:
4082this method will not work with branch tags.)
4083This leaves the new tag on exactly the
4084same files as the old tag.  For example:
4085
4086@example
4087cvs rtag -r old-name-0-4 rel-0-4 tc
4088cvs rtag -d old-name-0-4 tc
4089@end example
4090
4091@node Tagging add/remove
4092@section Tagging and adding and removing files
4093
4094The subject of exactly how tagging interacts with
4095adding and removing files is somewhat obscure; for the
4096most part @sc{cvs} will keep track of whether files
4097exist or not without too much fussing.  By default,
4098tags are applied to only files which have a revision
4099corresponding to what is being tagged.  Files which did
4100not exist yet, or which were already removed, simply
4101omit the tag, and @sc{cvs} knows to treat the absence
4102of a tag as meaning that the file didn't exist as of
4103that tag.
4104
4105However, this can lose a small amount of information.
4106For example, suppose a file was added and then removed.
4107Then, if the tag is missing for that file, there is no
4108way to know whether the tag refers to the time before
4109the file was added, or the time after it was removed.
4110If you specify the @samp{-r} option to @code{cvs rtag},
4111then @sc{cvs} tags the files which have been removed,
4112and thereby avoids this problem.  For example, one
4113might specify @code{-r HEAD} to tag the head.
4114
4115On the subject of adding and removing files, the
4116@code{cvs rtag} command has a @samp{-a} option which
4117means to clear the tag from removed files that would
4118not otherwise be tagged.  For example, one might
4119specify this option in conjunction with @samp{-F} when
4120moving a tag.  If one moved a tag without @samp{-a},
4121then the tag in the removed files might still refer to
4122the old revision, rather than reflecting the fact that
4123the file had been removed.  I don't think this is
4124necessary if @samp{-r} is specified, as noted above.
4125
4126@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4127@node Sticky tags
4128@section Sticky tags
4129@cindex Sticky tags
4130@cindex Tags, sticky
4131
4132@c A somewhat related issue is per-directory sticky
4133@c tags (see comment at CVS/Tag in node Working
4134@c directory storage); we probably want to say
4135@c something like "you can set a sticky tag for only
4136@c some files, but you don't want to" or some such.
4137
4138Sometimes a working copy's revision has extra data
4139associated with it, for example it might be on a branch
4140(@pxref{Branching and merging}), or restricted to
4141versions prior to a certain date by @samp{checkout -D}
4142or @samp{update -D}.  Because this data persists --
4143that is, it applies to subsequent commands in the
4144working copy -- we refer to it as @dfn{sticky}.
4145
4146Most of the time, stickiness is an obscure aspect of
4147@sc{cvs} that you don't need to think about.  However,
4148even if you don't want to use the feature, you may need
4149to know @emph{something} about sticky tags (for
4150example, how to avoid them!).
4151
4152You can use the @code{status} command to see if any
4153sticky tags or dates are set:
4154
4155@example
4156$ cvs status driver.c
4157===================================================================
4158File: driver.c          Status: Up-to-date
4159
4160    Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
4161    RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
4162    Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4163    Sticky Date:        (none)
4164    Sticky Options:     (none)
4165
4166@end example
4167
4168@cindex Resetting sticky tags
4169@cindex Sticky tags, resetting
4170@cindex Deleting sticky tags
4171The sticky tags will remain on your working files until
4172you delete them with @samp{cvs update -A}.  The
4173@samp{-A} option merges local changes into the version of the
4174file from the head of the trunk, removing any sticky tags,
4175dates, or options.  See @ref{update} for more on the operation
4176of @code{cvs update}.
4177
4178@cindex Sticky date
4179The most common use of sticky tags is to identify which
4180branch one is working on, as described in
4181@ref{Accessing branches}.  However, non-branch
4182sticky tags have uses as well.  For example,
4183suppose that you want to avoid updating your working
4184directory, to isolate yourself from possibly
4185destabilizing changes other people are making.  You
4186can, of course, just refrain from running @code{cvs
4187update}.  But if you want to avoid updating only a
4188portion of a larger tree, then sticky tags can help.
4189If you check out a certain revision (such as 1.4) it
4190will become sticky.  Subsequent @code{cvs update}
4191commands will
4192not retrieve the latest revision until you reset the
4193tag with @code{cvs update -A}.  Likewise, use of the
4194@samp{-D} option to @code{update} or @code{checkout}
4195sets a @dfn{sticky date}, which, similarly, causes that
4196date to be used for future retrievals.
4197
4198People often want to retrieve an old version of
4199a file without setting a sticky tag.  This can
4200be done with the @samp{-p} option to @code{checkout} or
4201@code{update}, which sends the contents of the file to
4202standard output.  For example:
4203@example
4204$ cvs update -p -r 1.1 file1 >file1
4205===================================================================
4206Checking out file1
4207RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
4208VERS: 1.1
4209***************
4210$
4211@end example
4212
4213However, this isn't the easiest way, if you are asking
4214how to undo a previous checkin (in this example, put
4215@file{file1} back to the way it was as of revision
42161.1).  In that case you are better off using the
4217@samp{-j} option to @code{update}; for further
4218discussion see @ref{Merging two revisions}.
4219
4220@c ---------------------------------------------------------------------
4221@node Branching and merging
4222@chapter Branching and merging
4223@cindex Branching
4224@cindex Merging
4225@cindex Copying changes
4226@cindex Main trunk and branches
4227@cindex Revision tree, making branches
4228@cindex Branches, copying changes between
4229@cindex Changes, copying between branches
4230@cindex Modifications, copying between branches
4231
4232@sc{cvs} allows you to isolate changes onto a separate
4233line of development, known as a @dfn{branch}.  When you
4234change files on a branch, those changes do not appear
4235on the main trunk or other branches.
4236
4237Later you can move changes from one branch to another
4238branch (or the main trunk) by @dfn{merging}.  Merging
4239involves first running @code{cvs update -j}, to merge
4240the changes into the working directory.
4241You can then commit that revision, and thus effectively
4242copy the changes onto another branch.
4243
4244@menu
4245* Branches motivation::         What branches are good for
4246* Creating a branch::           Creating a branch
4247* Accessing branches::          Checking out and updating branches
4248* Branches and revisions::      Branches are reflected in revision numbers
4249* Magic branch numbers::        Magic branch numbers
4250* Merging a branch::            Merging an entire branch
4251* Merging more than once::      Merging from a branch several times
4252* Merging two revisions::       Merging differences between two revisions
4253* Merging adds and removals::   What if files are added or removed?
4254* Merging and keywords::        Avoiding conflicts due to keyword substitution
4255@end menu
4256
4257@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4258@node Branches motivation
4259@section What branches are good for
4260@cindex Branches motivation
4261@cindex What branches are good for
4262@cindex Motivation for branches
4263
4264@c FIXME: this node mentions one way to use branches,
4265@c but it is by no means the only way.  For example,
4266@c the technique of committing a new feature on a branch,
4267@c until it is ready for the main trunk.  The whole
4268@c thing is generally speaking more akin to the
4269@c "Revision management" node although it isn't clear to
4270@c me whether policy matters should be centralized or
4271@c distributed throughout the relevant sections.
4272Suppose that release 1.0 of tc has been made.  You are continuing to
4273develop tc, planning to create release 1.1 in a couple of months.  After a
4274while your customers start to complain about a fatal bug.  You check
4275out release 1.0 (@pxref{Tags}) and find the bug
4276(which turns out to have a trivial fix).  However, the current revision
4277of the sources are in a state of flux and are not expected to be stable
4278for at least another month.  There is no way to make a
4279bug fix release based on the newest sources.
4280
4281The thing to do in a situation like this is to create a @dfn{branch} on
4282the revision trees for all the files that make up
4283release 1.0 of tc.  You can then make
4284modifications to the branch without disturbing the main trunk.  When the
4285modifications are finished you can elect to either incorporate them on
4286the main trunk, or leave them on the branch.
4287
4288@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4289@node Creating a branch
4290@section Creating a branch
4291@cindex Creating a branch
4292@cindex Branch, creating a
4293@cindex tag (subcommand), creating a branch using
4294@cindex rtag (subcommand), creating a branch using
4295
4296You can create a branch with @code{tag -b}; for
4297example, assuming you're in a working copy:
4298
4299@example
4300$ cvs tag -b rel-1-0-patches
4301@end example
4302
4303@c FIXME: we should be more explicit about the value of
4304@c having a tag on the branchpoint.  For example
4305@c "cvs tag rel-1-0-patches-branchpoint" before
4306@c the "cvs tag -b".  This points out that
4307@c rel-1-0-patches is a pretty awkward name for
4308@c this example (more so than for the rtag example
4309@c below).
4310
4311This splits off a branch based on the current revisions
4312in the working copy, assigning that branch the name
4313@samp{rel-1-0-patches}.
4314
4315It is important to understand that branches get created
4316in the repository, not in the working copy.  Creating a
4317branch based on current revisions, as the above example
4318does, will @emph{not} automatically switch the working
4319copy to be on the new branch.  For information on how
4320to do that, see @ref{Accessing branches}.
4321
4322You can also create a branch without reference to any
4323working copy, by using @code{rtag}:
4324
4325@example
4326$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
4327@end example
4328
4329@samp{-r rel-1-0} says that this branch should be
4330rooted at the revision that
4331corresponds to the tag @samp{rel-1-0}.  It need not
4332be the most recent revision -- it's often useful to
4333split a branch off an old revision (for example, when
4334fixing a bug in a past release otherwise known to be
4335stable).
4336
4337As with @samp{tag}, the @samp{-b} flag tells
4338@code{rtag} to create a branch (rather than just a
4339symbolic revision name).  Note that the numeric
4340revision number that matches @samp{rel-1-0} will
4341probably be different from file to file.
4342
4343So, the full effect of the command is to create a new
4344branch -- named @samp{rel-1-0-patches} -- in module
4345@samp{tc}, rooted in the revision tree at the point tagged
4346by @samp{rel-1-0}.
4347
4348@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4349@node Accessing branches
4350@section Accessing branches
4351@cindex Check out a branch
4352@cindex Retrieve a branch
4353@cindex Access a branch
4354@cindex Identifying a branch
4355@cindex Branch, check out
4356@cindex Branch, retrieving
4357@cindex Branch, accessing
4358@cindex Branch, identifying
4359
4360You can retrieve a branch in one of two ways: by
4361checking it out fresh from the repository, or by
4362switching an existing working copy over to the branch.
4363
4364To check out a branch from the repository, invoke
4365@samp{checkout} with the @samp{-r} flag, followed by
4366the tag name of the branch (@pxref{Creating a branch}):
4367
4368@example
4369$ cvs checkout -r rel-1-0-patches tc
4370@end example
4371
4372Or, if you already have a working copy, you can switch
4373it to a given branch with @samp{update -r}:
4374
4375@example
4376$ cvs update -r rel-1-0-patches tc
4377@end example
4378
4379@noindent
4380or equivalently:
4381
4382@example
4383$ cd tc
4384$ cvs update -r rel-1-0-patches
4385@end example
4386
4387It does not matter if the working copy was originally
4388on the main trunk or on some other branch -- the above
4389command will switch it to the named branch.  And
4390similarly to a regular @samp{update} command,
4391@samp{update -r} merges any changes you have made,
4392notifying you of conflicts where they occur.
4393
4394Once you have a working copy tied to a particular
4395branch, it remains there until you tell it otherwise.
4396This means that changes checked in from the working
4397copy will add new revisions on that branch, while
4398leaving the main trunk and other branches unaffected.
4399
4400@cindex Branches, sticky
4401To find out what branch a working copy is on, you can
4402use the @samp{status} command.  In its output, look for
4403the field named @samp{Sticky tag} (@pxref{Sticky tags})
4404-- that's @sc{cvs}'s way of telling you the branch, if
4405any, of the current working files:
4406
4407@example
4408$ cvs status -v driver.c backend.c
4409===================================================================
4410File: driver.c          Status: Up-to-date
4411
4412    Version:            1.7     Sat Dec  5 18:25:54 1992
4413    RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4414    Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4415    Sticky Date:        (none)
4416    Sticky Options:     (none)
4417
4418    Existing Tags:
4419        rel-1-0-patches             (branch: 1.7.2)
4420        rel-1-0                     (revision: 1.7)
4421
4422===================================================================
4423File: backend.c         Status: Up-to-date
4424
4425    Version:            1.4     Tue Dec  1 14:39:01 1992
4426    RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4427    Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4428    Sticky Date:        (none)
4429    Sticky Options:     (none)
4430
4431    Existing Tags:
4432        rel-1-0-patches             (branch: 1.4.2)
4433        rel-1-0                     (revision: 1.4)
4434        rel-0-4                     (revision: 1.4)
4435
4436@end example
4437
4438Don't be confused by the fact that the branch numbers
4439for each file are different (@samp{1.7.2} and
4440@samp{1.4.2} respectively).  The branch tag is the
4441same, @samp{rel-1-0-patches}, and the files are
4442indeed on the same branch.  The numbers simply reflect
4443the point in each file's revision history at which the
4444branch was made.  In the above example, one can deduce
4445that @samp{driver.c} had been through more changes than
4446@samp{backend.c} before this branch was created.
4447
4448See @ref{Branches and revisions} for details about how
4449branch numbers are constructed.
4450
4451@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4452@node Branches and revisions
4453@section Branches and revisions
4454@cindex Branch number
4455@cindex Number, branch
4456@cindex Revision numbers (branches)
4457
4458Ordinarily, a file's revision history is a linear
4459series of increments (@pxref{Revision numbers}):
4460
4461@example
4462       +-----+    +-----+    +-----+    +-----+    +-----+
4463       ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4464       +-----+    +-----+    +-----+    +-----+    +-----+
4465@end example
4466
4467However, @sc{cvs} is not limited to linear development.  The
4468@dfn{revision tree} can be split into @dfn{branches},
4469where each branch is a self-maintained line of
4470development.  Changes made on one branch can easily be
4471moved back to the main trunk.
4472
4473Each branch has a @dfn{branch number}, consisting of an
4474odd number of period-separated decimal integers.  The
4475branch number is created by appending an integer to the
4476revision number where the corresponding branch forked
4477off.  Having branch numbers allows more than one branch
4478to be forked off from a certain revision.
4479
4480@need 3500
4481All revisions on a branch have revision numbers formed
4482by appending an ordinal number to the branch number.
4483The following figure illustrates branching with an
4484example.
4485
4486@example
4487@c This example used to have a 1.2.2.4 revision, which
4488@c might help clarify that development can continue on
4489@c 1.2.2.  Might be worth reinstating if it can be done
4490@c without overfull hboxes.
4491@group
4492                                                      +-------------+
4493                           Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4494                                                    / +-------------+
4495                                                   /
4496                                                  /
4497                 +---------+    +---------+    +---------+
4498Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4499               / +---------+    +---------+    +---------+
4500              /
4501             /
4502+-----+    +-----+    +-----+    +-----+    +-----+
4503! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4504+-----+    +-----+    +-----+    +-----+    +-----+
4505                !
4506                !
4507                !   +---------+    +---------+    +---------+
4508Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4509                    +---------+    +---------+    +---------+
4510
4511@end group
4512@end example
4513
4514@c --   However, at least for me the figure is not enough.  I suggest more
4515@c --   text to accompany it.  "A picture is worth a thousand words", so you
4516@c --   have to make sure the reader notices the couple of hundred words
4517@c --   *you* had in mind more than the others!
4518
4519@c --   Why an even number of segments?  This section implies that this is
4520@c --   how the main trunk is distinguished from branch roots, but you never
4521@c --   explicitly say that this is the purpose of the [by itself rather
4522@c --   surprising] restriction to an even number of segments.
4523
4524The exact details of how the branch number is
4525constructed is not something you normally need to be
4526concerned about, but here is how it works: When
4527@sc{cvs} creates a branch number it picks the first
4528unused even integer, starting with 2.  So when you want
4529to create a branch from revision 6.4 it will be
4530numbered 6.4.2.  All branch numbers ending in a zero
4531(such as 6.4.0) are used internally by @sc{cvs}
4532(@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4533special meaning.  @xref{Tracking sources}.
4534
4535@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4536@node Magic branch numbers
4537@section Magic branch numbers
4538
4539@c Want xref to here from "log"?
4540
4541This section describes a @sc{cvs} feature called
4542@dfn{magic branches}.  For most purposes, you need not
4543worry about magic branches; @sc{cvs} handles them for
4544you.  However, they are visible to you in certain
4545circumstances, so it may be useful to have some idea of
4546how it works.
4547
4548Externally, branch numbers consist of an odd number of
4549dot-separated decimal integers.  @xref{Revision
4550numbers}.  That is not the whole truth, however.  For
4551efficiency reasons @sc{cvs} sometimes inserts an extra 0
4552in the second rightmost position (1.2.4 becomes
45531.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4554on).
4555
4556@sc{cvs} does a pretty good job at hiding these so
4557called magic branches, but in a few places the hiding
4558is incomplete:
4559
4560@itemize @bullet
4561@ignore
4562@c This is in ignore as I'm taking their word for it,
4563@c that this was fixed
4564@c a long time ago.  But before deleting this
4565@c entirely, I'd rather verify it (and add a test
4566@c case to the testsuite).
4567@item
4568The magic branch can appear in the output from
4569@code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4570fixed in @sc{cvs} 1.3-s2.
4571
4572@end ignore
4573@item
4574The magic branch number appears in the output from
4575@code{cvs log}.
4576@c What output should appear instead?
4577
4578@item
4579You cannot specify a symbolic branch name to @code{cvs
4580admin}.
4581
4582@end itemize
4583
4584@c Can CVS do this automatically the first time
4585@c you check something in to that branch?  Should
4586@c it?
4587You can use the @code{admin} command to reassign a
4588symbolic name to a branch the way @sc{rcs} expects it
4589to be.  If @code{R4patches} is assigned to the branch
45901.4.2 (magic branch number 1.4.0.2) in file
4591@file{numbers.c} you can do this:
4592
4593@example
4594$ cvs admin -NR4patches:1.4.2 numbers.c
4595@end example
4596
4597It only works if at least one revision is already
4598committed on the branch.  Be very careful so that you
4599do not assign the tag to the wrong number.  (There is
4600no way to see how the tag was assigned yesterday).
4601
4602@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4603@node Merging a branch
4604@section Merging an entire branch
4605@cindex Merging a branch
4606@cindex -j (merging branches)
4607
4608You can merge changes made on a branch into your working copy by giving
4609the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4610@samp{-j @var{branchname}} option it merges the changes made between the
4611greatest common ancestor (GCA) of the branch and the destination revision (in
4612the simple case below the GCA is the point where the branch forked) and the
4613newest revision on that branch into your working copy.
4614
4615@cindex Join
4616The @samp{-j} stands for ``join''.
4617
4618@cindex Branch merge example
4619@cindex Example, branch merge
4620@cindex Merge, branch example
4621Consider this revision tree:
4622
4623@example
4624+-----+    +-----+    +-----+    +-----+
4625! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4626+-----+    +-----+    +-----+    +-----+
4627                !
4628                !
4629                !   +---------+    +---------+
4630Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4631                    +---------+    +---------+
4632@end example
4633
4634@noindent
4635The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4636following example assumes that the module @samp{mod} contains only one
4637file, @file{m.c}.
4638
4639@example
4640$ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4641
4642$ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4643                                 # @r{i.e. the changes between revision 1.2}
4644                                 # @r{and 1.2.2.2, into your working copy}
4645                                 # @r{of the file.}
4646
4647$ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4648@end example
4649
4650A conflict can result from a merge operation.  If that
4651happens, you should resolve it before committing the
4652new revision.  @xref{Conflicts example}.
4653
4654If your source files contain keywords (@pxref{Keyword substitution}),
4655you might be getting more conflicts than strictly necessary.  See
4656@ref{Merging and keywords}, for information on how to avoid this.
4657
4658The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4659same effect as above could be achieved with this:
4660
4661@example
4662$ cvs checkout -j R1fix mod
4663$ cvs commit -m "Included R1fix"
4664@end example
4665
4666It should be noted that @code{update -j @var{tagname}} will also work but may
4667not produce the desired result.  @xref{Merging adds and removals}, for more.
4668
4669@node Merging more than once
4670@section Merging from a branch several times
4671
4672Continuing our example, the revision tree now looks
4673like this:
4674
4675@example
4676+-----+    +-----+    +-----+    +-----+    +-----+
4677! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4678+-----+    +-----+    +-----+    +-----+    +-----+
4679                !                           *
4680                !                          *
4681                !   +---------+    +---------+
4682Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4683                    +---------+    +---------+
4684@end example
4685
4686@noindent
4687where the starred line represents the merge from the
4688@samp{R1fix} branch to the main trunk, as just
4689discussed.
4690
4691Now suppose that development continues on the
4692@samp{R1fix} branch:
4693
4694@example
4695+-----+    +-----+    +-----+    +-----+    +-----+
4696! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4697+-----+    +-----+    +-----+    +-----+    +-----+
4698                !                           *
4699                !                          *
4700                !   +---------+    +---------+    +---------+
4701Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4702                    +---------+    +---------+    +---------+
4703@end example
4704
4705@noindent
4706and then you want to merge those new changes onto the
4707main trunk.  If you just use the @code{cvs update -j
4708R1fix m.c} command again, @sc{cvs} will attempt to
4709merge again the changes which you have already merged,
4710which can have undesirable side effects.
4711
4712So instead you need to specify that you only want to
4713merge the changes on the branch which have not yet been
4714merged into the trunk.  To do that you specify two
4715@samp{-j} options, and @sc{cvs} merges the changes from
4716the first revision to the second revision.  For
4717example, in this case the simplest way would be
4718
4719@example
4720cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4721                                      # @r{head of the R1fix branch}
4722@end example
4723
4724The problem with this is that you need to specify the
47251.2.2.2 revision manually.  A slightly better approach
4726might be to use the date the last merge was done:
4727
4728@example
4729cvs update -j R1fix:yesterday -j R1fix m.c
4730@end example
4731
4732Better yet, tag the R1fix branch after every merge into
4733the trunk, and then use that tag for subsequent merges:
4734
4735@example
4736cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4737@end example
4738
4739@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4740@node Merging two revisions
4741@section Merging differences between any two revisions
4742@cindex Merging two revisions
4743@cindex Revisions, merging differences between
4744@cindex Differences, merging
4745
4746With two @samp{-j @var{revision}} flags, the @code{update}
4747(and @code{checkout}) command can merge the differences
4748between any two revisions into your working file.
4749
4750@cindex Undoing a change
4751@cindex Removing a change
4752@example
4753$ cvs update -j 1.5 -j 1.3 backend.c
4754@end example
4755
4756@noindent
4757will undo all changes made between revision
47581.3 and 1.5.  Note the order of the revisions!
4759
4760If you try to use this option when operating on
4761multiple files, remember that the numeric revisions will
4762probably be very different between the various files.
4763You almost always use symbolic
4764tags rather than revision numbers when operating on
4765multiple files.
4766
4767@cindex Restoring old version of removed file
4768@cindex Resurrecting old version of dead file
4769Specifying two @samp{-j} options can also undo file
4770removals or additions.  For example, suppose you have
4771a file
4772named @file{file1} which existed as revision 1.1, and
4773you then removed it (thus adding a dead revision 1.2).
4774Now suppose you want to add it again, with the same
4775contents it had previously.  Here is how to do it:
4776
4777@example
4778$ cvs update -j 1.2 -j 1.1 file1
4779U file1
4780$ cvs commit -m test
4781Checking in file1;
4782/tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4783new revision: 1.3; previous revision: 1.2
4784done
4785$
4786@end example
4787
4788@node Merging adds and removals
4789@section Merging can add or remove files
4790
4791If the changes which you are merging involve removing
4792or adding some files, @code{update -j} will reflect
4793such additions or removals.
4794
4795@c FIXME: This example needs a lot more explanation.
4796@c We also need other examples for some of the other
4797@c cases (not all--there are too many--as long as we present a
4798@c coherent general principle).
4799For example:
4800@example
4801cvs update -A
4802touch a b c
4803cvs add a b c ; cvs ci -m "added" a b c
4804cvs tag -b branchtag
4805cvs update -r branchtag
4806touch d ; cvs add d
4807rm a ; cvs rm a
4808cvs ci -m "added d, removed a"
4809cvs update -A
4810cvs update -jbranchtag
4811@end example
4812
4813After these commands are executed and a @samp{cvs commit} is done,
4814file @file{a} will be removed and file @file{d} added in the main branch.
4815@c (which was determined by trying it)
4816
4817Note that using a single static tag (@samp{-j @var{tagname}})
4818rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4819changes from a branch will usually not remove files which were removed on the
4820branch since @sc{cvs} does not automatically add static tags to dead revisions.
4821The exception to this rule occurs when
4822a static tag has been attached to a dead revision manually.  Use the branch tag
4823to merge all changes from the branch or use two static tags as merge endpoints
4824to be sure that all intended changes are propagated in the merge.
4825
4826@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4827@node Merging and keywords
4828@section Merging and keywords
4829@cindex Merging, and keyword substitution
4830@cindex Keyword substitution, and merging
4831@cindex -j (merging branches), and keyword substitution
4832@cindex -kk, to avoid conflicts during a merge
4833
4834If you merge files containing keywords (@pxref{Keyword
4835substitution}), you will normally get numerous
4836conflicts during the merge, because the keywords are
4837expanded differently in the revisions which you are
4838merging.
4839
4840Therefore, you will often want to specify the
4841@samp{-kk} (@pxref{Substitution modes}) switch to the
4842merge command line.  By substituting just the name of
4843the keyword, not the expanded value of that keyword,
4844this option ensures that the revisions which you are
4845merging will be the same as each other, and avoid
4846spurious conflicts.
4847
4848For example, suppose you have a file like this:
4849
4850@example
4851       +---------+
4852      _! 1.1.2.1 !   <-  br1
4853     / +---------+
4854    /
4855   /
4856+-----+    +-----+
4857! 1.1 !----! 1.2 !
4858+-----+    +-----+
4859@end example
4860
4861@noindent
4862and your working directory is currently on the trunk
4863(revision 1.2).  Then you might get the following
4864results from a merge:
4865
4866@example
4867$ cat file1
4868key $@splitrcskeyword{Revision}: 1.2 $
4869. . .
4870$ cvs update -j br1
4871U file1
4872RCS file: /cvsroot/first-dir/file1,v
4873retrieving revision 1.1
4874retrieving revision 1.1.2.1
4875Merging differences between 1.1 and 1.1.2.1 into file1
4876rcsmerge: warning: conflicts during merge
4877$ cat file1
4878@asis{}<<<<<<< file1
4879key $@splitrcskeyword{Revision}: 1.2 $
4880@asis{}=======
4881key $@splitrcskeyword{Revision}: 1.1.2.1 $
4882@asis{}>>>>>>> 1.1.2.1
4883. . .
4884@end example
4885
4886What happened was that the merge tried to merge the
4887differences between 1.1 and 1.1.2.1 into your working
4888directory.  So, since the keyword changed from
4889@code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4890@sc{cvs} tried to merge that change into your working
4891directory, which conflicted with the fact that your
4892working directory had contained @code{Revision: 1.2}.
4893
4894Here is what happens if you had used @samp{-kk}:
4895
4896@example
4897$ cat file1
4898key $@splitrcskeyword{Revision}: 1.2 $
4899. . .
4900$ cvs update -kk -j br1
4901U file1
4902RCS file: /cvsroot/first-dir/file1,v
4903retrieving revision 1.1
4904retrieving revision 1.1.2.1
4905Merging differences between 1.1 and 1.1.2.1 into file1
4906$ cat file1
4907key $@splitrcskeyword{Revision}$
4908. . .
4909@end example
4910
4911What is going on here is that revision 1.1 and 1.1.2.1
4912both expand as plain @code{Revision}, and therefore
4913merging the changes between them into the working
4914directory need not change anything.  Therefore, there
4915is no conflict.
4916
4917@emph{WARNING: In versions of @sc{cvs} prior to 1.12.2, there was a
4918major problem with using @samp{-kk} on merges.  Namely, @samp{-kk}
4919overrode any default keyword expansion mode set in the archive file in
4920the repository.  This could, unfortunately for some users, cause data
4921corruption in binary files (with a default keyword expansion mode set
4922to @samp{-kb}).  Therefore, when a repository contained binary files,
4923conflicts had to be dealt with manually rather than using @samp{-kk} in
4924a merge command.}
4925
4926In @sc{cvs} version 1.12.2 and later, the keyword expansion mode
4927provided on the command line to any @sc{cvs} command no longer
4928overrides the @samp{-kb} keyword expansion mode setting for binary
4929files, though it will still override other default keyword expansion
4930modes.  You can now safely merge using @samp{-kk} to avoid spurious conflicts
4931on lines containing RCS keywords, even when your repository contains
4932binary files.
4933
4934@c ---------------------------------------------------------------------
4935@node Recursive behavior
4936@chapter Recursive behavior
4937@cindex Recursive (directory descending)
4938@cindex Directory, descending
4939@cindex Descending directories
4940@cindex Subdirectories
4941
4942Almost all of the subcommands of @sc{cvs} work
4943recursively when you specify a directory as an
4944argument.  For instance, consider this directory
4945structure:
4946
4947@example
4948      @code{$HOME}
4949        |
4950        +--@t{tc}
4951        |   |
4952            +--@t{CVS}
4953            |      (internal @sc{cvs} files)
4954            +--@t{Makefile}
4955            +--@t{backend.c}
4956            +--@t{driver.c}
4957            +--@t{frontend.c}
4958            +--@t{parser.c}
4959            +--@t{man}
4960            |    |
4961            |    +--@t{CVS}
4962            |    |  (internal @sc{cvs} files)
4963            |    +--@t{tc.1}
4964            |
4965            +--@t{testing}
4966                 |
4967                 +--@t{CVS}
4968                 |  (internal @sc{cvs} files)
4969                 +--@t{testpgm.t}
4970                 +--@t{test2.t}
4971@end example
4972
4973@noindent
4974If @file{tc} is the current working directory, the
4975following is true:
4976
4977@itemize @bullet
4978@item
4979@samp{cvs update testing} is equivalent to
4980
4981@example
4982cvs update testing/testpgm.t testing/test2.t
4983@end example
4984
4985@item
4986@samp{cvs update testing man} updates all files in the
4987subdirectories
4988
4989@item
4990@samp{cvs update .} or just @samp{cvs update} updates
4991all files in the @code{tc} directory
4992@end itemize
4993
4994If no arguments are given to @code{update} it will
4995update all files in the current working directory and
4996all its subdirectories.  In other words, @file{.} is a
4997default argument to @code{update}.  This is also true
4998for most of the @sc{cvs} subcommands, not only the
4999@code{update} command.
5000
5001The recursive behavior of the @sc{cvs} subcommands can be
5002turned off with the @samp{-l} option.
5003Conversely, the @samp{-R} option can be used to force recursion if
5004@samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
5005
5006@example
5007$ cvs update -l         # @r{Don't update files in subdirectories}
5008@end example
5009
5010@c ---------------------------------------------------------------------
5011@node Adding and removing
5012@chapter Adding, removing, and renaming files and directories
5013
5014In the course of a project, one will often add new
5015files.  Likewise with removing or renaming, or with
5016directories.  The general concept to keep in mind in
5017all these cases is that instead of making an
5018irreversible change you want @sc{cvs} to record the
5019fact that a change has taken place, just as with
5020modifying an existing file.  The exact mechanisms to do
5021this in @sc{cvs} vary depending on the situation.
5022
5023@menu
5024* Adding files::                Adding files
5025* Removing files::              Removing files
5026* Removing directories::        Removing directories
5027* Moving files::                Moving and renaming files
5028* Moving directories::          Moving and renaming directories
5029@end menu
5030
5031@node Adding files
5032@section Adding files to a directory
5033@cindex Adding files
5034
5035To add a new file to a directory, follow these steps.
5036
5037@itemize @bullet
5038@item
5039You must have a working copy of the directory.
5040@xref{Getting the source}.
5041
5042@item
5043Create the new file inside your working copy of the directory.
5044
5045@item
5046Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
5047want to version control the file.  If the file contains
5048binary data, specify @samp{-kb} (@pxref{Binary files}).
5049
5050@item
5051Use @samp{cvs commit @var{filename}} to actually check
5052in the file into the repository.  Other developers
5053cannot see the file until you perform this step.
5054@end itemize
5055
5056You can also use the @code{add} command to add a new
5057directory.
5058@c FIXCVS and/or FIXME: Adding a directory doesn't
5059@c require the commit step.  This probably can be
5060@c considered a CVS bug, but it is possible we should
5061@c warn people since this behavior probably won't be
5062@c changing right away.
5063
5064Unlike most other commands, the @code{add} command is
5065not recursive.  You have to expcicitly name files and
5066directories that you wish to add to the repository.
5067However, each directory will need to be added
5068separately before you will be able to add new files
5069to those directories.
5070
5071@example
5072$ mkdir -p foo/bar
5073$ cp ~/myfile foo/bar/myfile
5074$ cvs add foo foo/bar
5075$ cvs add foo/bar/myfile
5076@end example
5077
5078@cindex add (subcommand)
5079@deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
5080
5081Schedule @var{files} to be added to the repository.
5082The files or directories specified with @code{add} must
5083already exist in the current directory.  To add a whole
5084new directory hierarchy to the source repository (for
5085example, files received from a third-party vendor), use
5086the @code{import} command instead.  @xref{import}.
5087
5088The added files are not placed in the source repository
5089until you use @code{commit} to make the change
5090permanent.  Doing an @code{add} on a file that was
5091removed with the @code{remove} command will undo the
5092effect of the @code{remove}, unless a @code{commit}
5093command intervened.  @xref{Removing files}, for an
5094example.
5095
5096The @samp{-k} option specifies the default way that
5097this file will be checked out; for more information see
5098@ref{Substitution modes}.
5099
5100@c As noted in BUGS, -m is broken client/server (Nov
5101@c 96).  Also see testsuite log2-* tests.
5102The @samp{-m} option specifies a description for the
5103file.  This description appears in the history log (if
5104it is enabled, @pxref{history file}).  It will also be
5105saved in the version history inside the repository when
5106the file is committed.  The @code{log} command displays
5107this description.  The description can be changed using
5108@samp{admin -t}.  @xref{admin}.  If you omit the
5109@samp{-m @var{description}} flag, an empty string will
5110be used.  You will not be prompted for a description.
5111@end deffn
5112
5113For example, the following commands add the file
5114@file{backend.c} to the repository:
5115
5116@c This example used to specify
5117@c     -m "Optimizer and code generation passes."
5118@c to the cvs add command, but that doesn't work
5119@c client/server (see log2 in sanity.sh).  Should fix CVS,
5120@c but also seems strange to document things which
5121@c don't work...
5122@example
5123$ cvs add backend.c
5124$ cvs commit -m "Early version. Not yet compilable." backend.c
5125@end example
5126
5127When you add a file it is added only on the branch
5128which you are working on (@pxref{Branching and merging}).  You can
5129later merge the additions to another branch if you want
5130(@pxref{Merging adds and removals}).
5131@c Should we mention that earlier versions of CVS
5132@c lacked this feature (1.3) or implemented it in a buggy
5133@c way (well, 1.8 had many bugs in cvs update -j)?
5134@c Should we mention the bug/limitation regarding a
5135@c file being a regular file on one branch and a directory
5136@c on another?
5137@c FIXME: This needs an example, or several, here or
5138@c elsewhere, for it to make much sense.
5139@c Somewhere we need to discuss the aspects of death
5140@c support which don't involve branching, I guess.
5141@c Like the ability to re-create a release from a tag.
5142
5143@c ---------------------------------------------------------------------
5144@node Removing files
5145@section Removing files
5146@cindex Removing files
5147@cindex Deleting files
5148
5149@c FIXME: this node wants to be split into several
5150@c smaller nodes.  Could make these children of
5151@c "Adding and removing", probably (death support could
5152@c be its own section, for example, as could the
5153@c various bits about undoing mistakes in adding and
5154@c removing).
5155Directories change.  New files are added, and old files
5156disappear.  Still, you want to be able to retrieve an
5157exact copy of old releases.
5158
5159Here is what you can do to remove a file,
5160but remain able to retrieve old revisions:
5161
5162@itemize @bullet
5163@c FIXME: should probably be saying something about
5164@c having a working directory in the first place.
5165@item
5166Make sure that you have not made any uncommitted
5167modifications to the file.  @xref{Viewing differences},
5168for one way to do that.  You can also use the
5169@code{status} or @code{update} command.  If you remove
5170the file without committing your changes, you will of
5171course not be able to retrieve the file as it was
5172immediately before you deleted it.
5173
5174@item
5175Remove the file from your working copy of the directory.
5176You can for instance use @code{rm}.
5177
5178@item
5179Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
5180you really want to delete the file.
5181
5182@item
5183Use @samp{cvs commit @var{filename}} to actually
5184perform the removal of the file from the repository.
5185@end itemize
5186
5187@c FIXME: Somehow this should be linked in with a more
5188@c general discussion of death support.  I don't know
5189@c whether we want to use the term "death support" or
5190@c not (we can perhaps get by without it), but we do
5191@c need to discuss the "dead" state in "cvs log" and
5192@c related subjects.  The current discussion is
5193@c scattered around, and not xref'd to each other.
5194@c FIXME: I think this paragraph wants to be moved
5195@c later down, at least after the first example.
5196When you commit the removal of the file, @sc{cvs}
5197records the fact that the file no longer exists.  It is
5198possible for a file to exist on only some branches and
5199not on others, or to re-add another file with the same
5200name later.  @sc{cvs} will correctly create or not create
5201the file, based on the @samp{-r} and @samp{-D} options
5202specified to @code{checkout} or @code{update}.
5203
5204@c FIXME: This style seems to clash with how we
5205@c document things in general.
5206@cindex Remove (subcommand)
5207@deffn Command {cvs remove} [options] files @dots{}
5208
5209Schedule file(s) to be removed from the repository
5210(files which have not already been removed from the
5211working directory are not processed).  This command
5212does not actually remove the file from the repository
5213until you commit the removal.  For a full list of
5214options, see @ref{Invoking CVS}.
5215@end deffn
5216
5217Here is an example of removing several files:
5218
5219@example
5220$ cd test
5221$ rm *.c
5222$ cvs remove
5223cvs remove: Removing .
5224cvs remove: scheduling a.c for removal
5225cvs remove: scheduling b.c for removal
5226cvs remove: use 'cvs commit' to remove these files permanently
5227$ cvs ci -m "Removed unneeded files"
5228cvs commit: Examining .
5229cvs commit: Committing .
5230@end example
5231
5232As a convenience you can remove the file and @code{cvs
5233remove} it in one step, by specifying the @samp{-f}
5234option.  For example, the above example could also be
5235done like this:
5236
5237@example
5238$ cd test
5239$ cvs remove -f *.c
5240cvs remove: scheduling a.c for removal
5241cvs remove: scheduling b.c for removal
5242cvs remove: use 'cvs commit' to remove these files permanently
5243$ cvs ci -m "Removed unneeded files"
5244cvs commit: Examining .
5245cvs commit: Committing .
5246@end example
5247
5248If you execute @code{remove} for a file, and then
5249change your mind before you commit, you can undo the
5250@code{remove} with an @code{add} command.
5251@ignore
5252@c is this worth saying or not?  Somehow it seems
5253@c confusing to me.
5254Of course,
5255since you have removed your copy of file in the working
5256directory, @sc{cvs} does not necessarily bring back the
5257contents of the file from right before you executed
5258@code{remove}; instead it gets the file from the
5259repository again.
5260@end ignore
5261
5262@c FIXME: what if you change your mind after you commit
5263@c it?  (answer is also "cvs add" but we don't say that...).
5264@c We need some index entries for thinks like "undoing
5265@c removal" too.
5266
5267@example
5268$ ls
5269CVS   ja.h  oj.c
5270$ rm oj.c
5271$ cvs remove oj.c
5272cvs remove: scheduling oj.c for removal
5273cvs remove: use 'cvs commit' to remove this file permanently
5274$ cvs add oj.c
5275U oj.c
5276cvs add: oj.c, version 1.1.1.1, resurrected
5277@end example
5278
5279If you realize your mistake before you run the
5280@code{remove} command you can use @code{update} to
5281resurrect the file:
5282
5283@example
5284$ rm oj.c
5285$ cvs update oj.c
5286cvs update: warning: oj.c was lost
5287U oj.c
5288@end example
5289
5290When you remove a file it is removed only on the branch
5291which you are working on (@pxref{Branching and merging}).  You can
5292later merge the removals to another branch if you want
5293(@pxref{Merging adds and removals}).
5294
5295@node Removing directories
5296@section Removing directories
5297@cindex Removing directories
5298@cindex Directories, removing
5299
5300In concept, removing directories is somewhat similar to
5301removing files---you want the directory to not exist in
5302your current working directories, but you also want to
5303be able to retrieve old releases in which the directory
5304existed.
5305
5306The way that you remove a directory is to remove all
5307the files in it.  You don't remove the directory
5308itself; there is no way to do that.
5309Instead you specify the @samp{-P} option to
5310@code{cvs update} or @code{cvs checkout},
5311which will cause @sc{cvs} to remove empty
5312directories from working directories.
5313(Note that @code{cvs export} always removes empty directories.)
5314Probably the
5315best way to do this is to always specify @samp{-P}; if
5316you want an empty directory then put a dummy file (for
5317example @file{.keepme}) in it to prevent @samp{-P} from
5318removing it.
5319
5320@c I'd try to give a rationale for this, but I'm not
5321@c sure there is a particularly convincing one.  What
5322@c we would _like_ is for CVS to do a better job of version
5323@c controlling whether directories exist, to eliminate the
5324@c need for -P and so that a file can be a directory in
5325@c one revision and a regular file in another.
5326Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5327options of @code{checkout}.  This way,
5328@sc{cvs} will be able to correctly create the directory
5329or not depending on whether the particular version you
5330are checking out contains any files in that directory.
5331
5332@c ---------------------------------------------------------------------
5333@node Moving files
5334@section Moving and renaming files
5335@cindex Moving files
5336@cindex Renaming files
5337@cindex Files, moving
5338
5339Moving files to a different directory or renaming them
5340is not difficult, but some of the ways in which this
5341works may be non-obvious.  (Moving or renaming a
5342directory is even harder.  @xref{Moving directories}.).
5343
5344The examples below assume that the file @var{old} is renamed to
5345@var{new}.
5346
5347@menu
5348* Outside::                     The normal way to Rename
5349* Inside::                      A tricky, alternative way
5350* Rename by copying::           Another tricky, alternative way
5351@end menu
5352
5353@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5354@node Outside
5355@subsection The Normal way to Rename
5356
5357@c More rename issues.  Not sure whether these are
5358@c worth documenting; I'm putting them here because
5359@c it seems to be as good a place as any to try to
5360@c set down the issues.
5361@c * "cvs annotate" will annotate either the new
5362@c file or the old file; it cannot annotate _each
5363@c line_ based on whether it was last changed in the
5364@c new or old file.  Unlike "cvs log", where the
5365@c consequences of having to select either the new
5366@c or old name seem fairly benign, this may be a
5367@c real advantage to having CVS know about renames
5368@c other than as a deletion and an addition.
5369
5370The normal way to move a file is to copy @var{old} to
5371@var{new}, and then issue the normal @sc{cvs} commands
5372to remove @var{old} from the repository, and add
5373@var{new} to it.
5374@c The following sentence is not true: one must cd into
5375@c the directory to run "cvs add".
5376@c  (Both @var{old} and @var{new} could
5377@c contain relative paths, for example @file{foo/bar.c}).
5378
5379@example
5380$ mv @var{old} @var{new}
5381$ cvs remove @var{old}
5382$ cvs add @var{new}
5383$ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5384@end example
5385
5386This is the simplest way to move a file, it is not
5387error-prone, and it preserves the history of what was
5388done.  Note that to access the history of the file you
5389must specify the old or the new name, depending on what
5390portion of the history you are accessing.  For example,
5391@code{cvs log @var{old}} will give the log up until the
5392time of the rename.
5393
5394When @var{new} is committed its revision numbers will
5395start again, usually at 1.1, so if that bothers you,
5396use the @samp{-r @var{tag}} option to commit.  For more
5397information see @ref{Assigning revisions}.
5398
5399@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5400@node Inside
5401@subsection Moving the history file
5402
5403This method is more dangerous, since it involves moving
5404files inside the repository.  Read this entire section
5405before trying it out!
5406
5407@example
5408$ cd $CVSROOT/@var{dir}
5409$ mv @var{old},v @var{new},v
5410@end example
5411
5412@noindent
5413Advantages:
5414
5415@itemize @bullet
5416@item
5417The log of changes is maintained intact.
5418
5419@item
5420The revision numbers are not affected.
5421@end itemize
5422
5423@noindent
5424Disadvantages:
5425
5426@itemize @bullet
5427@item
5428Old releases cannot easily be fetched from the
5429repository.  (The file will show up as @var{new} even
5430in revisions from the time before it was renamed).
5431
5432@item
5433There is no log information of when the file was renamed.
5434
5435@item
5436Nasty things might happen if someone accesses the history file
5437while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5438commands while you move it.
5439@end itemize
5440
5441@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5442@node Rename by copying
5443@subsection Copying the history file
5444
5445This way also involves direct modifications to the
5446repository.  It is safe, but not without drawbacks.
5447
5448@example
5449# @r{Copy the @sc{rcs} file inside the repository}
5450$ cd $CVSROOT/@var{dir}
5451$ cp @var{old},v @var{new},v
5452# @r{Remove the old file}
5453$ cd ~/@var{dir}
5454$ rm @var{old}
5455$ cvs remove @var{old}
5456$ cvs commit @var{old}
5457# @r{Remove all tags from @var{new}}
5458$ cvs update @var{new}
5459$ cvs log @var{new}             # @r{Remember the non-branch tag names}
5460$ cvs tag -d @var{tag1} @var{new}
5461$ cvs tag -d @var{tag2} @var{new}
5462@dots{}
5463@end example
5464
5465By removing the tags you will be able to check out old
5466revisions.
5467
5468@noindent
5469Advantages:
5470
5471@itemize @bullet
5472@item
5473@c FIXME: Is this true about -D now that we have death
5474@c support?  See 5B.3 in the FAQ.
5475Checking out old revisions works correctly, as long as
5476you use @samp{-r @var{tag}} and not @samp{-D @var{date}}
5477to retrieve the revisions.
5478
5479@item
5480The log of changes is maintained intact.
5481
5482@item
5483The revision numbers are not affected.
5484@end itemize
5485
5486@noindent
5487Disadvantages:
5488
5489@itemize @bullet
5490@item
5491You cannot easily see the history of the file across the rename.
5492
5493@ignore
5494@c Is this true?  I don't see how the revision numbers
5495@c _could_ start over, when new,v is just old,v with
5496@c the tags deleted.
5497@c If there is some need to reinstate this text,
5498@c it is "usually 1.1", not "1.0" and it needs an
5499@c xref to Assigning revisions
5500@item
5501Unless you use the @samp{-r @var{tag}} (@pxref{commit
5502options}) flag when @var{new} is committed its revision
5503numbers will start at 1.0 again.
5504@end ignore
5505@end itemize
5506
5507@c ---------------------------------------------------------------------
5508@node Moving directories
5509@section Moving and renaming directories
5510@cindex Moving directories
5511@cindex Renaming directories
5512@cindex Directories, moving
5513
5514The normal way to rename or move a directory is to
5515rename or move each file within it as described in
5516@ref{Outside}.  Then check out with the @samp{-P}
5517option, as described in @ref{Removing directories}.
5518
5519If you really want to hack the repository to rename or
5520delete a directory in the repository, you can do it
5521like this:
5522
5523@enumerate
5524@item
5525Inform everyone who has a checked out copy of the directory that the
5526directory will be renamed.  They should commit all their changes in all their
5527copies of the project containing the directory to be removed, and remove
5528all their working copies of said project, before you take the steps below.
5529
5530@item
5531Rename the directory inside the repository.
5532
5533@example
5534$ cd $CVSROOT/@var{parent-dir}
5535$ mv @var{old-dir} @var{new-dir}
5536@end example
5537
5538@item
5539Fix the @sc{cvs} administrative files, if necessary (for
5540instance if you renamed an entire module).
5541
5542@item
5543Tell everyone that they can check out again and continue
5544working.
5545
5546@end enumerate
5547
5548If someone had a working copy the @sc{cvs} commands will
5549cease to work for him, until he removes the directory
5550that disappeared inside the repository.
5551
5552It is almost always better to move the files in the
5553directory instead of moving the directory.  If you move the
5554directory you are unlikely to be able to retrieve old
5555releases correctly, since they probably depend on the
5556name of the directories.
5557
5558@c ---------------------------------------------------------------------
5559@node History browsing
5560@chapter History browsing
5561@cindex History browsing
5562@cindex Traceability
5563@cindex Isolation
5564
5565@ignore
5566@c This is too long for an introduction (goal is
5567@c one 20x80 character screen), and also mixes up a
5568@c variety of issues (parallel development, history,
5569@c maybe even touches on process control).
5570
5571@c -- @quote{To lose ones history is to lose ones soul.}
5572@c -- ///
5573@c -- ///Those who cannot remember the past are condemned to repeat it.
5574@c -- ///               -- George Santayana
5575@c -- ///
5576
5577@sc{cvs} tries to make it easy for a group of people to work
5578together.  This is done in two ways:
5579
5580@itemize @bullet
5581@item
5582Isolation---You have your own working copy of the
5583source.  You are not affected by modifications made by
5584others until you decide to incorporate those changes
5585(via the @code{update} command---@pxref{update}).
5586
5587@item
5588Traceability---When something has changed, you can
5589always see @emph{exactly} what changed.
5590@end itemize
5591
5592There are several features of @sc{cvs} that together lead
5593to traceability:
5594
5595@itemize @bullet
5596@item
5597Each revision of a file has an accompanying log
5598message.
5599
5600@item
5601All commits are optionally logged to a central history
5602database.
5603
5604@item
5605Logging information can be sent to a user-defined
5606program (@pxref{loginfo}).
5607@end itemize
5608
5609@c -- More text here.
5610
5611This chapter should talk about the history file, the
5612@code{log} command, the usefulness of ChangeLogs
5613even when you run @sc{cvs}, and things like that.
5614
5615@end ignore
5616
5617@c kind of lame, in a lot of ways the above text inside
5618@c the @ignore motivates this chapter better
5619Once you have used @sc{cvs} to store a version control
5620history---what files have changed when, how, and by
5621whom, there are a variety of mechanisms for looking
5622through the history.
5623
5624@c FIXME: should also be talking about how you look at
5625@c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5626@menu
5627* log messages::                Log messages
5628* history database::            The history database
5629* user-defined logging::        User-defined logging
5630@end menu
5631
5632@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5633@node log messages
5634@section Log messages
5635
5636@c FIXME: @xref to place where we talk about how to
5637@c specify message to commit.
5638Whenever you commit a file you specify a log message.
5639
5640@c FIXME: bring the information here, and get rid of or
5641@c greatly shrink the "log" node.
5642To look through the log messages which have been
5643specified for every revision which has been committed,
5644use the @code{cvs log} command (@pxref{log}).
5645
5646@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5647@node history database
5648@section The history database
5649
5650@c FIXME: bring the information from the history file
5651@c and history nodes here.  Rewrite it to be motivated
5652@c better (start out by clearly explaining what gets
5653@c logged in history, for example).
5654You can use the history file (@pxref{history file}) to
5655log various @sc{cvs} actions.  To retrieve the
5656information from the history file, use the @code{cvs
5657history} command (@pxref{history}).
5658
5659Note: you can control what is logged to this file by using the
5660@samp{LogHistory} keyword in the @file{CVSROOT/config} file
5661(@pxref{config}).
5662
5663@c
5664@c The history database has many problems:
5665@c * It is very unclear what field means what.  This
5666@c could be improved greatly by better documentation,
5667@c but there are still non-orthogonalities (for
5668@c example, tag does not record the "repository"
5669@c field but most records do).
5670@c * Confusion about files, directories, and modules.
5671@c Some commands record one, some record others.
5672@c * File removal is not logged.  There is an 'R'
5673@c record type documented, but CVS never uses it.
5674@c * Tags are only logged for the "cvs rtag" command,
5675@c not "cvs tag".  The fix for this is not completely
5676@c clear (see above about modules vs. files).
5677@c * Are there other cases of operations that are not
5678@c logged?  One would hope for all changes to the
5679@c repository to be logged somehow (particularly
5680@c operations like tagging, "cvs admin -k", and other
5681@c operations which do not record a history that one
5682@c can get with "cvs log").  Operations on the working
5683@c directory, like export, get, and release, are a
5684@c second category also covered by the current "cvs
5685@c history".
5686@c * The history file does not record the options given
5687@c to a command.  The most serious manifestation of
5688@c this is perhaps that it doesn't record whether a command
5689@c was recursive.  It is not clear to me whether one
5690@c wants to log at a level very close to the command
5691@c line, as a sort of way of logging each command
5692@c (more or less), or whether one wants
5693@c to log more at the level of what was changed (or
5694@c something in between), but either way the current
5695@c information has pretty big gaps.
5696@c * Further details about a tag--like whether it is a
5697@c branch tag or, if a non-branch tag, which branch it
5698@c is on.  One can find out this information about the
5699@c tag as it exists _now_, but if the tag has been
5700@c moved, one doesn't know what it was like at the time
5701@c the history record was written.
5702@c * Whether operating on a particular tag, date, or
5703@c options was implicit (sticky) or explicit.
5704@c
5705@c Another item, only somewhat related to the above, is a
5706@c way to control what is logged in the history file.
5707@c This is probably the only good way to handle
5708@c different people having different ideas about
5709@c information/space tradeoffs.
5710@c
5711@c It isn't really clear that it makes sense to try to
5712@c patch up the history file format as it exists now to
5713@c include all that stuff.  It might be better to
5714@c design a whole new CVSROOT/nhistory file and "cvs
5715@c nhistory" command, or some such, or in some other
5716@c way trying to come up with a clean break from the
5717@c past, which can address the above concerns.  Another
5718@c open question is how/whether this relates to
5719@c taginfo/loginfo/etc.
5720
5721@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5722@node user-defined logging
5723@section User-defined logging
5724
5725@c FIXME: probably should centralize this information
5726@c here, at least to some extent.  Maybe by moving the
5727@c loginfo, etc., nodes here and replacing
5728@c the "user-defined logging" node with one node for
5729@c each method.
5730You can customize @sc{cvs} to log various kinds of
5731actions, in whatever manner you choose.  These
5732mechanisms operate by executing a script at various
5733times.  The script might append a message to a file
5734listing the information and the programmer who created
5735it, or send mail to a group of developers, or, perhaps,
5736post a message to a particular newsgroup.  To log
5737commits, use the @file{loginfo} file (@pxref{loginfo}), and
5738to log tagging operations, use the @file{taginfo} file
5739(@pxref{taginfo}).
5740
5741@c FIXME: What is difference between doing it in the
5742@c modules file and using loginfo/taginfo?  Why should
5743@c user use one or the other?
5744To log commits, checkouts, exports, and tags,
5745respectively, you can also use the @samp{-i},
5746@samp{-o}, @samp{-e}, and @samp{-t} options in the
5747modules file.  For a more flexible way of giving
5748notifications to various users, which requires less in
5749the way of keeping centralized scripts up to date, use
5750the @code{cvs watch add} command (@pxref{Getting
5751Notified}); this command is useful even if you are not
5752using @code{cvs watch on}.
5753
5754@c ---------------------------------------------------------------------
5755@node Binary files
5756@chapter Handling binary files
5757@cindex Binary files
5758
5759The most common use for @sc{cvs} is to store text
5760files.  With text files, @sc{cvs} can merge revisions,
5761display the differences between revisions in a
5762human-visible fashion, and other such operations.
5763However, if you are willing to give up a few of these
5764abilities, @sc{cvs} can store binary files.  For
5765example, one might store a web site in @sc{cvs}
5766including both text files and binary images.
5767
5768@menu
5769* Binary why::     More details on issues with binary files
5770* Binary howto::   How to store them
5771@end menu
5772
5773@node Binary why
5774@section The issues with binary files
5775
5776While the need to manage binary files may seem obvious
5777if the files that you customarily work with are binary,
5778putting them into version control does present some
5779additional issues.
5780
5781One basic function of version control is to show the
5782differences between two revisions.  For example, if
5783someone else checked in a new version of a file, you
5784may wish to look at what they changed and determine
5785whether their changes are good.  For text files,
5786@sc{cvs} provides this functionality via the @code{cvs
5787diff} command.  For binary files, it may be possible to
5788extract the two revisions and then compare them with a
5789tool external to @sc{cvs} (for example, word processing
5790software often has such a feature).  If there is no
5791such tool, one must track changes via other mechanisms,
5792such as urging people to write good log messages, and
5793hoping that the changes they actually made were the
5794changes that they intended to make.
5795
5796Another ability of a version control system is the
5797ability to merge two revisions.  For @sc{cvs} this
5798happens in two contexts.  The first is when users make
5799changes in separate working directories
5800(@pxref{Multiple developers}).  The second is when one
5801merges explicitly with the @samp{update -j} command
5802(@pxref{Branching and merging}).
5803
5804In the case of text
5805files, @sc{cvs} can merge changes made independently,
5806and signal a conflict if the changes conflict.  With
5807binary files, the best that @sc{cvs} can do is present
5808the two different copies of the file, and leave it to
5809the user to resolve the conflict.  The user may choose
5810one copy or the other, or may run an external merge
5811tool which knows about that particular file format, if
5812one exists.
5813Note that having the user merge relies primarily on the
5814user to not accidentally omit some changes, and thus is
5815potentially error prone.
5816
5817If this process is thought to be undesirable, the best
5818choice may be to avoid merging.  To avoid the merges
5819that result from separate working directories, see the
5820discussion of reserved checkouts (file locking) in
5821@ref{Multiple developers}.  To avoid the merges
5822resulting from branches, restrict use of branches.
5823
5824@node Binary howto
5825@section How to store binary files
5826
5827There are two issues with using @sc{cvs} to store
5828binary files.  The first is that @sc{cvs} by default
5829converts line endings between the canonical form in
5830which they are stored in the repository (linefeed
5831only), and the form appropriate to the operating system
5832in use on the client (for example, carriage return
5833followed by line feed for Windows NT).
5834
5835The second is that a binary file might happen to
5836contain data which looks like a keyword (@pxref{Keyword
5837substitution}), so keyword expansion must be turned
5838off.
5839
5840@c FIXME: the third is that one can't do merges with
5841@c binary files.  xref to Multiple Developers and the
5842@c reserved checkout issues.
5843
5844The @samp{-kb} option available with some @sc{cvs}
5845commands insures that neither line ending conversion
5846nor keyword expansion will be done.
5847
5848Here is an example of how you can create a new file
5849using the @samp{-kb} flag:
5850
5851@example
5852$ echo '$@splitrcskeyword{Id}$' > kotest
5853$ cvs add -kb -m"A test file" kotest
5854$ cvs ci -m"First checkin; contains a keyword" kotest
5855@end example
5856
5857If a file accidentally gets added without @samp{-kb},
5858one can use the @code{cvs admin} command to recover.
5859For example:
5860
5861@example
5862$ echo '$@splitrcskeyword{Id}$' > kotest
5863$ cvs add -m"A test file" kotest
5864$ cvs ci -m"First checkin; contains a keyword" kotest
5865$ cvs admin -kb kotest
5866$ cvs update -A kotest
5867# @r{For non-unix systems:}
5868# @r{Copy in a good copy of the file from outside CVS}
5869$ cvs commit -m "make it binary" kotest
5870@end example
5871
5872@c Trying to describe this for both unix and non-unix
5873@c in the same description is very confusing.  Might
5874@c want to split the two, or just ditch the unix "shortcut"
5875@c (unixheads don't do much with binary files, anyway).
5876@c This used to say "(Try the above example, and do a
5877@c @code{cat kotest} after every command)".  But that
5878@c only really makes sense for the unix case.
5879When you check in the file @file{kotest} the file is
5880not preserved as a binary file, because you did not
5881check it in as a binary file.  The @code{cvs
5882admin -kb} command sets the default keyword
5883substitution method for this file, but it does not
5884alter the working copy of the file that you have.  If you need to
5885cope with line endings (that is, you are using
5886@sc{cvs} on a non-unix system), then you need to
5887check in a new copy of the file, as shown by the
5888@code{cvs commit} command above.
5889On unix, the @code{cvs update -A} command suffices.
5890@c FIXME: should also describe what the *other users*
5891@c need to do, if they have checked out copies which
5892@c have been corrupted by lack of -kb.  I think maybe
5893@c "cvs update -kb" or "cvs
5894@c update -A" would suffice, although the user who
5895@c reported this suggested removing the file, manually
5896@c removing it from CVS/Entries, and then "cvs update"
5897(Note that you can use @code{cvs log} to determine the default keyword
5898substitution method for a file and @code{cvs status} to determine
5899the keyword substitution method for a working copy.)
5900
5901However, in using @code{cvs admin -k} to change the
5902keyword expansion, be aware that the keyword expansion
5903mode is not version controlled.  This means that, for
5904example, that if you have a text file in old releases,
5905and a binary file with the same name in new releases,
5906@sc{cvs} provides no way to check out the file in text
5907or binary mode depending on what version you are
5908checking out.  There is no good workaround for this
5909problem.
5910
5911You can also set a default for whether @code{cvs add}
5912and @code{cvs import} treat a file as binary based on
5913its name; for example you could say that files who
5914names end in @samp{.exe} are binary.  @xref{Wrappers}.
5915There is currently no way to have @sc{cvs} detect
5916whether a file is binary based on its contents.  The
5917main difficulty with designing such a feature is that
5918it is not clear how to distinguish between binary and
5919non-binary files, and the rules to apply would vary
5920considerably with the operating system.
5921@c For example, it would be good on MS-DOS-family OSes
5922@c for anything containing ^Z to be binary.  Having
5923@c characters with the 8th bit set imply binary is almost
5924@c surely a bad idea in the context of ISO-8859-* and
5925@c other such character sets.  On VMS or the Mac, we
5926@c could use the OS's file typing.  This is a
5927@c commonly-desired feature, and something of this sort
5928@c may make sense.  But there are a lot of pitfalls here.
5929@c
5930@c Another, probably better, way to tell is to read the
5931@c file in text mode, write it to a temp file in text
5932@c mode, and then do a binary mode compare of the two
5933@c files.  If they differ, it is a binary file.  This
5934@c might have problems on VMS (or some other system
5935@c with several different text modes), but in general
5936@c should be relatively portable.  The only other
5937@c downside I can think of is that it would be fairly
5938@c slow, but that is perhaps a small price to pay for
5939@c not having your files corrupted.  Another issue is
5940@c what happens if you import a text file with bare
5941@c linefeeds on Windows.  Such files will show up on
5942@c Windows sometimes (I think some native windows
5943@c programs even write them, on occasion).  Perhaps it
5944@c is reasonable to treat such files as binary; after
5945@c all it is something of a presumption to assume that
5946@c the user would want the linefeeds converted to CRLF.
5947
5948@c ---------------------------------------------------------------------
5949@node Multiple developers
5950@chapter Multiple developers
5951@cindex Multiple developers
5952@cindex Team of developers
5953@cindex File locking
5954@cindex Locking files
5955@cindex Working copy
5956@cindex Reserved checkouts
5957@cindex Unreserved checkouts
5958@cindex RCS-style locking
5959
5960When more than one person works on a software project
5961things often get complicated.  Often, two people try to
5962edit the same file simultaneously.  One solution, known
5963as @dfn{file locking} or @dfn{reserved checkouts}, is
5964to allow only one person to edit each file at a time.
5965This is the only solution with some version control
5966systems, including @sc{rcs} and @sc{sccs}.  Currently
5967the usual way to get reserved checkouts with @sc{cvs}
5968is the @code{cvs admin -l} command (@pxref{admin
5969options}).  This is not as nicely integrated into
5970@sc{cvs} as the watch features, described below, but it
5971seems that most people with a need for reserved
5972checkouts find it adequate.
5973@c Or "find it better than worrying about implementing
5974@c nicely integrated reserved checkouts" or ...?
5975
5976As of @sc{cvs} version 1.12.10, another technique for getting most of the
5977effect of reserved checkouts is to enable advisory locks.  To enable advisory
5978locks, have all developers put "edit -c", "commit -c" in their
5979.cvsrc file, and turn on watches in the repository.  This
5980prevents them from doing a @code{cvs edit} if anyone is
5981already editing the file.  It also may
5982be possible to use plain watches together with suitable
5983procedures (not enforced by software), to avoid having
5984two people edit at the same time.
5985
5986@c Our unreserved checkout model might not
5987@c be quite the same as others.  For example, I
5988@c think that some systems will tend to create a branch
5989@c in the case where CVS prints "up-to-date check failed".
5990@c It isn't clear to me whether we should try to
5991@c explore these subtleties; it could easily just
5992@c confuse people.
5993The default model with @sc{cvs} is known as
5994@dfn{unreserved checkouts}.  In this model, developers
5995can edit their own @dfn{working copy} of a file
5996simultaneously.  The first person that commits his
5997changes has no automatic way of knowing that another
5998has started to edit it.  Others will get an error
5999message when they try to commit the file.  They must
6000then use @sc{cvs} commands to bring their working copy
6001up to date with the repository revision.  This process
6002is almost automatic.
6003
6004@c FIXME? should probably use the word "watch" here, to
6005@c tie this into the text below and above.
6006@sc{cvs} also supports mechanisms which facilitate
6007various kinds of communication, without actually
6008enforcing rules like reserved checkouts do.
6009
6010The rest of this chapter describes how these various
6011models work, and some of the issues involved in
6012choosing between them.
6013
6014@ignore
6015Here is a draft reserved checkout design or discussion
6016of the issues.  This seems like as good a place as any
6017for this.
6018
6019Might want a cvs lock/cvs unlock--in which the names
6020differ from edit/unedit because the network must be up
6021for these to work.  unedit gives an error if there is a
6022reserved checkout in place (so that people don't
6023accidentally leave locks around); unlock gives an error
6024if one is not in place (this is more arguable; perhaps
6025it should act like unedit in that case).
6026
6027On the other hand, might want it so that emacs,
6028scripts, etc., can get ready to edit a file without
6029having to know which model is in use.  In that case we
6030would have a "cvs watch lock" (or .cvsrc?) (that is,
6031three settings, "on", "off", and "lock").  Having cvs
6032watch lock set would cause a get to record in the CVS
6033directory which model is in use, and cause "cvs edit"
6034to change behaviors.  We'd want a way to query which
6035setting is in effect (this would be handy even if it is
6036only "on" or "off" as presently).  If lock is in
6037effect, then commit would require a lock before
6038allowing a checkin; chmod wouldn't suffice (might be
6039debatable--see chmod comment below, in watches--but it
6040is the way people expect RCS to work and I can't think
6041of any significant downside.  On the other hand, maybe
6042it isn't worth bothering, because people who are used
6043to RCS wouldn't think to use chmod anyway).
6044
6045Implementation: use file attributes or use RCS
6046locking.  The former avoids more dependence on RCS
6047behaviors we will need to re-implement as we librarify
6048RCS, and makes it easier to import/export RCS files (in
6049that context, want to ignore the locker field).  But
6050note that RCS locks are per-branch, which is the
6051correct behavior (this is also an issue for the "watch
6052on" features; they should be per-branch too).
6053
6054Here are a few more random notes about implementation
6055details, assuming "cvs watch lock" and
6056
6057CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
6058Cases: (1) file is checked out (unreserved or with watch on) by old
6059version of @sc{cvs}, now we do something with new one, (2) file is checked
6060out by new version, now we do something with old one.
6061
6062Remote protocol would have a "Watched" analogous to "Mode".  Of course
6063it would apply to all Updated-like requests.  How do we keep this
6064setting up to date?  I guess that there wants to be a Watched request,
6065and the server would send a new one if it isn't up to date? (Ugh--hard
6066to implement and slows down "cvs -q update"--is there an easier way?)
6067
6068"cvs edit"--checks CVS/Watched, and if watch lock, then sends
6069"edit-lock" request.  Which comes back with a Checked-in with
6070appropriate Watched (off, on, lock, locked, or some such?), or error
6071message if already locked.
6072
6073"cvs commit"--only will commit if off/on/locked.  lock is not OK.
6074
6075Doc:
6076note that "cvs edit" must be connected to network if watch lock is in
6077effect.
6078
6079Talk about what to do if someone has locked a file and you want to
6080edit that file.  (breaking locks, or lack thereof).
6081
6082
6083One other idea (which could work along with the
6084existing "cvs admin -l" reserved checkouts, as well as
6085the above):
6086
6087"cvs editors" could show who has the file locked, if
6088someone does.
6089
6090@end ignore
6091
6092@menu
6093* File status::                 A file can be in several states
6094* Updating a file::             Bringing a file up-to-date
6095* Conflicts example::           An informative example
6096* Informing others::            To cooperate you must inform
6097* Concurrency::                 Simultaneous repository access
6098* Watches::                     Mechanisms to track who is editing files
6099* Choosing a model::            Reserved or unreserved checkouts?
6100@end menu
6101
6102@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6103@node File status
6104@section File status
6105@cindex File status
6106@cindex Status of a file
6107
6108@c Shouldn't this start with an example or something,
6109@c introducing the unreserved checkout model?  Before we
6110@c dive into listing states?
6111Based on what operations you have performed on a
6112checked out file, and what operations others have
6113performed to that file in the repository, one can
6114classify a file in a number of states.  The states, as
6115reported by the @code{status} command, are:
6116
6117@c The order of items is chosen to group logically
6118@c similar outputs together.
6119@c People who want alphabetical can use the index...
6120@table @asis
6121@cindex Up-to-date
6122@item Up-to-date
6123The file is identical with the latest revision in the
6124repository for the branch in use.
6125@c FIXME: should we clarify "in use"?  The answer is
6126@c sticky tags, and trying to distinguish branch sticky
6127@c tags from non-branch sticky tags seems rather awkward
6128@c here.
6129@c FIXME: What happens with non-branch sticky tags?  Is
6130@c a stuck file "Up-to-date" or "Needs checkout" or what?
6131
6132@item Locally Modified
6133@cindex Locally Modified
6134You have edited the file, and not yet committed your changes.
6135
6136@item Locally Added
6137@cindex Locally Added
6138You have added the file with @code{add}, and not yet
6139committed your changes.
6140@c There are many cases involving the file being
6141@c added/removed/modified in the working directory, and
6142@c added/removed/modified in the repository, which we
6143@c don't try to describe here.  I'm not sure that "cvs
6144@c status" produces a non-confusing output in most of
6145@c those cases.
6146
6147@item Locally Removed
6148@cindex Locally Removed
6149You have removed the file with @code{remove}, and not yet
6150committed your changes.
6151
6152@item Needs Checkout
6153@cindex Needs Checkout
6154Someone else has committed a newer revision to the
6155repository.  The name is slightly misleading; you will
6156ordinarily use @code{update} rather than
6157@code{checkout} to get that newer revision.
6158
6159@item Needs Patch
6160@cindex Needs Patch
6161@c See also newb-123j0 in sanity.sh (although that case
6162@c should probably be changed rather than documented).
6163Like Needs Checkout, but the @sc{cvs} server will send
6164a patch rather than the entire file.  Sending a patch or
6165sending an entire file accomplishes the same thing.
6166
6167@item Needs Merge
6168@cindex Needs Merge
6169Someone else has committed a newer revision to the repository, and you
6170have also made modifications to the file.
6171
6172@item Unresolved Conflict
6173@cindex Unresolved Conflict
6174@c FIXCVS - This file status needs to be changed to some more informative
6175@c text that distinguishes it more clearly from each of the Locally Added,
6176@c File had conflicts on merge, and Unknown status types, but an exact and
6177@c succinct wording escapes me at the moment.
6178A file with the same name as this new file has been added to the repository
6179from a second workspace.  This file will need to be moved out of the way
6180to allow an @code{update} to complete.
6181
6182@item File had conflicts on merge
6183@cindex File had conflicts on merge
6184@c is it worth saying that this message was "Unresolved
6185@c Conflict" in CVS 1.9 and earlier?  I'm inclined to
6186@c think that is unnecessarily confusing to new users.
6187This is like Locally Modified, except that a previous
6188@code{update} command gave a conflict.  If you have not
6189already done so, you need to
6190resolve the conflict as described in @ref{Conflicts example}.
6191
6192@item Unknown
6193@cindex Unknown
6194@sc{cvs} doesn't know anything about this file.  For
6195example, you have created a new file and have not run
6196@code{add}.
6197@c
6198@c "Entry Invalid" and "Classify Error" are also in the
6199@c status.c.  The latter definitely indicates a CVS bug
6200@c (should it be worded more like "internal error" so
6201@c people submit bug reports if they see it?).  The former
6202@c I'm not as sure; I haven't tracked down whether/when it
6203@c appears in "cvs status" output.
6204
6205@end table
6206
6207To help clarify the file status, @code{status} also
6208reports the @code{Working revision} which is the
6209revision that the file in the working directory derives
6210from, and the @code{Repository revision} which is the
6211latest revision in the repository for the branch in
6212use.
6213The @samp{Commit Identifier} reflects the unique commitid
6214of the @code{commit}.
6215@c FIXME: should we clarify "in use"?  The answer is
6216@c sticky tags, and trying to distinguish branch sticky
6217@c tags from non-branch sticky tags seems rather awkward
6218@c here.
6219@c FIXME: What happens with non-branch sticky tags?
6220@c What is the Repository Revision there?  See the
6221@c comment at vn_rcs in cvs.h, which is kind of
6222@c confused--we really need to document better what this
6223@c field contains.
6224@c Q: Should we document "New file!" and other such
6225@c outputs or are they self-explanatory?
6226@c FIXME: what about the date to the right of "Working
6227@c revision"?  It doesn't appear with client/server and
6228@c seems unnecessary (redundant with "ls -l") so
6229@c perhaps it should be removed for non-client/server too?
6230@c FIXME: Need some examples.
6231@c FIXME: Working revision can also be something like
6232@c "-1.3" for a locally removed file.  Not at all
6233@c self-explanatory (and it is possible that CVS should
6234@c be changed rather than documenting this).
6235
6236@c Would be nice to have an @example showing output
6237@c from cvs status, with comments showing the xref
6238@c where each part of the output is described.  This
6239@c might fit in nicely if it is desirable to split this
6240@c node in two; one to introduce "cvs status" and one
6241@c to list each of the states.
6242The options to @code{status} are listed in
6243@ref{Invoking CVS}.  For information on its @code{Sticky tag}
6244and @code{Sticky date} output, see @ref{Sticky tags}.
6245For information on its @code{Sticky options} output,
6246see the @samp{-k} option in @ref{update options}.
6247
6248You can think of the @code{status} and @code{update}
6249commands as somewhat complementary.  You use
6250@code{update} to bring your files up to date, and you
6251can use @code{status} to give you some idea of what an
6252@code{update} would do (of course, the state of the
6253repository might change before you actually run
6254@code{update}).  In fact, if you want a command to
6255display file status in a more brief format than is
6256displayed by the @code{status} command, you can invoke
6257
6258@cindex update, to display file status
6259@example
6260$ cvs -n -q update
6261@end example
6262
6263The @samp{-n} option means to not actually do the
6264update, but merely to display statuses; the @samp{-q}
6265option avoids printing the name of each directory.  For
6266more information on the @code{update} command, and
6267these options, see @ref{Invoking CVS}.
6268
6269@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6270@node Updating a file
6271@section Bringing a file up to date
6272@cindex Bringing a file up to date
6273@cindex Updating a file
6274@cindex Merging a file
6275@cindex Update, introduction
6276
6277When you want to update or merge a file, use the @code{cvs update -d}
6278command.  For files that are not up to date this is roughly equivalent
6279to a @code{checkout} command: the newest revision of the file is
6280extracted from the repository and put in your working directory.  The
6281@code{-d} option, not necessary with @code{checkout}, tells @sc{cvs}
6282that you wish it to create directories added by other developers.
6283
6284Your modifications to a file are never lost when you
6285use @code{update}.  If no newer revision exists,
6286running @code{update} has no effect.  If you have
6287edited the file, and a newer revision is available,
6288@sc{cvs} will merge all changes into your working copy.
6289
6290For instance, imagine that you checked out revision 1.4 and started
6291editing it.  In the meantime someone else committed revision 1.5, and
6292shortly after that revision 1.6.  If you run @code{update} on the file
6293now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
6294your file.
6295
6296@cindex Overlap
6297If any of the changes between 1.4 and 1.6 were made too
6298close to any of the changes you have made, an
6299@dfn{overlap} occurs.  In such cases a warning is
6300printed, and the resulting file includes both
6301versions of the lines that overlap, delimited by
6302special markers.
6303@xref{update}, for a complete description of the
6304@code{update} command.
6305
6306@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6307@node Conflicts example
6308@section Conflicts example
6309@cindex Merge, an example
6310@cindex Example of merge
6311@cindex driver.c (merge example)
6312
6313Suppose revision 1.4 of @file{driver.c} contains this:
6314
6315@example
6316#include <stdio.h>
6317
6318void main()
6319@{
6320    parse();
6321    if (nerr == 0)
6322        gencode();
6323    else
6324        fprintf(stderr, "No code generated.\n");
6325    exit(nerr == 0 ? 0 : 1);
6326@}
6327@end example
6328
6329@noindent
6330Revision 1.6 of @file{driver.c} contains this:
6331
6332@example
6333#include <stdio.h>
6334
6335int main(int argc,
6336         char **argv)
6337@{
6338    parse();
6339    if (argc != 1)
6340    @{
6341        fprintf(stderr, "tc: No args expected.\n");
6342        exit(1);
6343    @}
6344    if (nerr == 0)
6345        gencode();
6346    else
6347        fprintf(stderr, "No code generated.\n");
6348    exit(!!nerr);
6349@}
6350@end example
6351
6352@noindent
6353Your working copy of @file{driver.c}, based on revision
63541.4, contains this before you run @samp{cvs update}:
6355@c -- Really include "cvs"?
6356
6357@example
6358#include <stdlib.h>
6359#include <stdio.h>
6360
6361void main()
6362@{
6363    init_scanner();
6364    parse();
6365    if (nerr == 0)
6366        gencode();
6367    else
6368        fprintf(stderr, "No code generated.\n");
6369    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6370@}
6371@end example
6372
6373@noindent
6374You run @samp{cvs update}:
6375@c -- Really include "cvs"?
6376
6377@example
6378$ cvs update driver.c
6379RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6380retrieving revision 1.4
6381retrieving revision 1.6
6382Merging differences between 1.4 and 1.6 into driver.c
6383rcsmerge warning: overlaps during merge
6384cvs update: conflicts found in driver.c
6385C driver.c
6386@end example
6387
6388@noindent
6389@cindex Conflicts (merge example)
6390@sc{cvs} tells you that there were some conflicts.
6391Your original working file is saved unmodified in
6392@file{.#driver.c.1.4}.  The new version of
6393@file{driver.c} contains this:
6394
6395@example
6396#include <stdlib.h>
6397#include <stdio.h>
6398
6399int main(int argc,
6400         char **argv)
6401@{
6402    init_scanner();
6403    parse();
6404    if (argc != 1)
6405    @{
6406        fprintf(stderr, "tc: No args expected.\n");
6407        exit(1);
6408    @}
6409    if (nerr == 0)
6410        gencode();
6411    else
6412        fprintf(stderr, "No code generated.\n");
6413@asis{}<<<<<<< driver.c
6414    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6415@asis{}=======
6416    exit(!!nerr);
6417@asis{}>>>>>>> 1.6
6418@}
6419@end example
6420
6421@noindent
6422@cindex Markers, conflict
6423@cindex Conflict markers
6424@cindex <<<<<<<
6425@cindex >>>>>>>
6426@cindex =======
6427
6428Note how all non-overlapping modifications are incorporated in your working
6429copy, and that the overlapping section is clearly marked with
6430@samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6431
6432@cindex Resolving a conflict
6433@cindex Conflict resolution
6434You resolve the conflict by editing the file, removing the markers and
6435the erroneous line.  Suppose you end up with this file:
6436@c -- Add xref to the pcl-cvs manual when it talks
6437@c -- about this.
6438@example
6439#include <stdlib.h>
6440#include <stdio.h>
6441
6442int main(int argc,
6443         char **argv)
6444@{
6445    init_scanner();
6446    parse();
6447    if (argc != 1)
6448    @{
6449        fprintf(stderr, "tc: No args expected.\n");
6450        exit(1);
6451    @}
6452    if (nerr == 0)
6453        gencode();
6454    else
6455        fprintf(stderr, "No code generated.\n");
6456    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6457@}
6458@end example
6459
6460@noindent
6461You can now go ahead and commit this as revision 1.7.
6462
6463@example
6464$ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6465Checking in driver.c;
6466/usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6467new revision: 1.7; previous revision: 1.6
6468done
6469@end example
6470
6471For your protection, @sc{cvs} will refuse to check in a
6472file if a conflict occurred and you have not resolved
6473the conflict.  Currently to resolve a conflict, you
6474must change the timestamp on the file.  In previous
6475versions of @sc{cvs}, you also needed to
6476insure that the file contains no conflict markers.
6477Because
6478your file may legitimately contain conflict markers (that
6479is, occurrences of @samp{>>>>>>> } at the start of a
6480line that don't mark a conflict), the current
6481version of @sc{cvs} will print a warning and proceed to
6482check in the file.
6483@c The old behavior was really icky; the only way out
6484@c was to start hacking on
6485@c the @code{CVS/Entries} file or other such workarounds.
6486@c
6487@c If the timestamp thing isn't considered nice enough,
6488@c maybe there should be a "cvs resolved" command
6489@c which clears the conflict indication.  For a nice user
6490@c interface, this should be invoked by an interactive
6491@c merge tool like emerge rather than by the user
6492@c directly--such a tool can verify that the user has
6493@c really dealt with each conflict.
6494
6495@cindex emerge
6496If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6497Emacs front-end for @sc{cvs}) you can use an Emacs
6498package called emerge to help you resolve conflicts.
6499See the documentation for pcl-cvs.
6500
6501@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6502@node Informing others
6503@section Informing others about commits
6504@cindex Informing others
6505@cindex Spreading information
6506@cindex Mail, automatic mail on commit
6507
6508It is often useful to inform others when you commit a
6509new revision of a file.  The @samp{-i} option of the
6510@file{modules} file, or the @file{loginfo} file, can be
6511used to automate this process.  @xref{modules}.
6512@xref{loginfo}.  You can use these features of @sc{cvs}
6513to, for instance, instruct @sc{cvs} to mail a
6514message to all developers, or post a message to a local
6515newsgroup.
6516@c -- More text would be nice here.
6517
6518@node Concurrency
6519@section Several developers simultaneously attempting to run CVS
6520
6521@cindex Locks, cvs, introduction
6522@c For a discussion of *why* CVS creates locks, see
6523@c the comment at the start of src/lock.c
6524If several developers try to run @sc{cvs} at the same
6525time, one may get the following message:
6526
6527@example
6528[11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6529@end example
6530
6531@cindex #cvs.rfl, removing
6532@cindex #cvs.wfl, removing
6533@cindex #cvs.lock, removing
6534@sc{cvs} will try again every 30 seconds, and either
6535continue with the operation or print the message again,
6536if it still needs to wait.  If a lock seems to stick
6537around for an undue amount of time, find the person
6538holding the lock and ask them about the cvs command
6539they are running.  If they aren't running a cvs
6540command, look in the repository directory mentioned in
6541the message and remove files which they own whose names
6542start with @file{#cvs.rfl},
6543@file{#cvs.wfl}, or @file{#cvs.lock}.
6544
6545Note that these locks are to protect @sc{cvs}'s
6546internal data structures and have no relationship to
6547the word @dfn{lock} in the sense used by
6548@sc{rcs}---which refers to reserved checkouts
6549(@pxref{Multiple developers}).
6550
6551Any number of people can be reading from a given
6552repository at a time; only when someone is writing do
6553the locks prevent other people from reading or writing.
6554
6555@cindex Atomic transactions, lack of
6556@cindex Transactions, atomic, lack of
6557@c the following talks about what one might call commit/update
6558@c atomicity.
6559@c Probably also should say something about
6560@c commit/commit atomicity, that is, "An update will
6561@c not get partial versions of more than one commit".
6562@c CVS currently has this property and I guess we can
6563@c make it a documented feature.
6564@c For example one person commits
6565@c a/one.c and b/four.c and another commits a/two.c and
6566@c b/three.c.  Then an update cannot get the new a/one.c
6567@c and a/two.c and the old b/four.c and b/three.c.
6568One might hope for the following property:
6569
6570@quotation
6571If someone commits some changes in one cvs command,
6572then an update by someone else will either get all the
6573changes, or none of them.
6574@end quotation
6575
6576@noindent
6577but @sc{cvs} does @emph{not} have this property.  For
6578example, given the files
6579
6580@example
6581a/one.c
6582a/two.c
6583b/three.c
6584b/four.c
6585@end example
6586
6587@noindent
6588if someone runs
6589
6590@example
6591cvs ci a/two.c b/three.c
6592@end example
6593
6594@noindent
6595and someone else runs @code{cvs update} at the same
6596time, the person running @code{update} might get only
6597the change to @file{b/three.c} and not the change to
6598@file{a/two.c}.
6599
6600@node Watches
6601@section Mechanisms to track who is editing files
6602@cindex Watches
6603
6604For many groups, use of @sc{cvs} in its default mode is
6605perfectly satisfactory.  Users may sometimes go to
6606check in a modification only to find that another
6607modification has intervened, but they deal with it and
6608proceed with their check in.  Other groups prefer to be
6609able to know who is editing what files, so that if two
6610people try to edit the same file they can choose to
6611talk about who is doing what when rather than be
6612surprised at check in time.  The features in this
6613section allow such coordination, while retaining the
6614ability of two developers to edit the same file at the
6615same time.
6616
6617@c Some people might ask why CVS does not enforce the
6618@c rule on chmod, by requiring a cvs edit before a cvs
6619@c commit.  The main reason is that it could always be
6620@c circumvented--one could edit the file, and
6621@c then when ready to check it in, do the cvs edit and put
6622@c in the new contents and do the cvs commit.  One
6623@c implementation note: if we _do_ want to have cvs commit
6624@c require a cvs edit, we should store the state on
6625@c whether the cvs edit has occurred in the working
6626@c directory, rather than having the server try to keep
6627@c track of what working directories exist.
6628@c FIXME: should the above discussion be part of the
6629@c manual proper, somewhere, not just in a comment?
6630For maximum benefit developers should use @code{cvs
6631edit} (not @code{chmod}) to make files read-write to
6632edit them, and @code{cvs release} (not @code{rm}) to
6633discard a working directory which is no longer in use,
6634but @sc{cvs} is not able to enforce this behavior.
6635
6636If a development team wants stronger enforcement of
6637watches and all team members are using a @sc{cvs} client version 1.12.10 or
6638greater to access a @sc{cvs} server version 1.12.10 or greater, they can
6639enable advisory locks.  To enable advisory locks, have all developers
6640put "edit -c" and "commit -c" into all .cvsrc files,
6641and make files default to read only by turning on watches
6642or putting "cvs -r" into all .cvsrc files.
6643This prevents multiple people from editing a file at
6644the same time (unless explicitly overriden with @samp{-f}).
6645
6646@c I'm a little dissatisfied with this presentation,
6647@c because "watch on"/"edit"/"editors" are one set of
6648@c functionality, and "watch add"/"watchers" is another
6649@c which is somewhat orthogonal even though they interact in
6650@c various ways.  But I think it might be
6651@c confusing to describe them separately (e.g. "watch
6652@c add" with loginfo).  I don't know.
6653
6654@menu
6655* Setting a watch::             Telling CVS to watch certain files
6656* Getting Notified::            Telling CVS to notify you
6657* Editing files::               How to edit a file which is being watched
6658* Watch information::           Information about who is watching and editing
6659* Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6660@end menu
6661
6662@node Setting a watch
6663@subsection Telling CVS to watch certain files
6664
6665To enable the watch features, you first specify that
6666certain files are to be watched.
6667
6668@cindex watch on (subcommand)
6669@deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6670
6671@cindex Read-only files, and watches
6672Specify that developers should run @code{cvs edit}
6673before editing @var{files}.  @sc{cvs} will create working
6674copies of @var{files} read-only, to remind developers
6675to run the @code{cvs edit} command before working on
6676them.
6677
6678If @var{files} includes the name of a directory, @sc{cvs}
6679arranges to watch all files added to the corresponding
6680repository directory, and sets a default for files
6681added in the future; this allows the user to set
6682notification policies on a per-directory basis.  The
6683contents of the directory are processed recursively,
6684unless the @code{-l} option is given.
6685The @code{-R} option can be used to force recursion if the @code{-l}
6686option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6687
6688If @var{files} is omitted, it defaults to the current directory.
6689
6690@cindex watch off (subcommand)
6691@end deffn
6692
6693@deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6694
6695Do not create @var{files} read-only on checkout; thus,
6696developers will not be reminded to use @code{cvs edit}
6697and @code{cvs unedit}.
6698@ignore
6699@sc{cvs} will check out @var{files}
6700read-write as usual, unless other permissions override
6701due to the @code{PreservePermissions} option being
6702enabled in the @file{config} administrative file
6703(@pxref{Special Files}, @pxref{config})
6704@end ignore
6705
6706The @var{files} and options are processed as for @code{cvs
6707watch on}.
6708
6709@end deffn
6710
6711@node Getting Notified
6712@subsection Telling CVS to notify you
6713
6714You can tell @sc{cvs} that you want to receive
6715notifications about various actions taken on a file.
6716You can do this without using @code{cvs watch on} for
6717the file, but generally you will want to use @code{cvs
6718watch on}, to remind developers to use the @code{cvs edit}
6719command.
6720
6721@cindex watch add (subcommand)
6722@deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6723
6724Add the current user to the list of people to receive notification of
6725work done on @var{files}.
6726
6727The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6728the user about.  @var{action} is one of the following:
6729
6730@table @code
6731
6732@item edit
6733Another user has applied the @code{cvs edit} command (described
6734below) to a watched file.
6735
6736@item commit
6737Another user has committed changes to one of the named @var{files}.
6738
6739@item unedit
6740Another user has abandoned editing a file (other than by committing changes).
6741They can do this in several ways, by:
6742
6743@itemize @bullet
6744
6745@item
6746applying the @code{cvs unedit} command (described below) to the file
6747
6748@item
6749applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6750(or recursively to a directory more than one level up)
6751
6752@item
6753deleting the file and allowing @code{cvs update} to recreate it
6754
6755@end itemize
6756
6757@item all
6758All of the above.
6759
6760@item none
6761None of the above.  (This is useful with @code{cvs edit},
6762described below.)
6763
6764@end table
6765
6766The @code{-a} option may appear more than once, or not at all.  If
6767omitted, the action defaults to @code{all}.
6768
6769The @var{files} and options are processed as for
6770@code{cvs watch on}.
6771
6772@end deffn
6773
6774
6775@cindex watch remove (subcommand)
6776@deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6777
6778Remove a notification request established using @code{cvs watch add};
6779the arguments are the same.  If the @code{-a} option is present, only
6780watches for the specified actions are removed.
6781
6782@end deffn
6783
6784@cindex notify (admin file)
6785When the conditions exist for notification, @sc{cvs}
6786calls the @file{notify} administrative file.  Edit
6787@file{notify} as one edits the other administrative
6788files (@pxref{Intro administrative files}).  This
6789file follows the usual conventions for administrative
6790files (@pxref{syntax}), where each line is a regular
6791expression followed by a command to execute.  The
6792command should contain a single occurrence of @samp{%s}
6793which will be replaced by the user to notify; the rest
6794of the information regarding the notification will be
6795supplied to the command on standard input.  The
6796standard thing to put in the @code{notify} file is the
6797single line:
6798
6799@example
6800ALL mail %s -s "CVS notification"
6801@end example
6802
6803@noindent
6804This causes users to be notified by electronic mail.
6805@c FIXME: should it be this hard to set up this
6806@c behavior (and the result when one fails to do so,
6807@c silent failure to notify, so non-obvious)?  Should
6808@c CVS give a warning if no line in notify matches (and
6809@c document the use of "DEFAULT :" for the case where
6810@c skipping the notification is indeed desired)?
6811
6812@cindex users (admin file)
6813Note that if you set this up in the straightforward
6814way, users receive notifications on the server machine.
6815One could of course write a @file{notify} script which
6816directed notifications elsewhere, but to make this
6817easy, @sc{cvs} allows you to associate a notification
6818address for each user.  To do so create a file
6819@file{users} in @file{CVSROOT} with a line for each
6820user in the format @var{user}:@var{value}.  Then
6821instead of passing the name of the user to be notified
6822to @file{notify}, @sc{cvs} will pass the @var{value}
6823(normally an email address on some other machine).
6824
6825@sc{cvs} does not notify you for your own changes.
6826Currently this check is done based on whether the user
6827name of the person taking the action which triggers
6828notification matches the user name of the person
6829getting notification.  In fact, in general, the watches
6830features only track one edit by each user.  It probably
6831would be more useful if watches tracked each working
6832directory separately, so this behavior might be worth
6833changing.
6834@c "behavior might be worth changing" is an effort to
6835@c point to future directions while also not promising
6836@c that "they" (as in "why don't they fix CVS to....")
6837@c will do this.
6838@c one implementation issue is identifying whether a
6839@c working directory is same or different.  Comparing
6840@c pathnames/hostnames is hopeless, but having the server
6841@c supply a serial number which the client stores in the
6842@c CVS directory as a magic cookie should work.
6843
6844@node Editing files
6845@subsection How to edit a file which is being watched
6846
6847@cindex Checkout, as term for getting ready to edit
6848Since a file which is being watched is checked out
6849read-only, you cannot simply edit it.  To make it
6850read-write, and inform others that you are planning to
6851edit it, use the @code{cvs edit} command.  Some systems
6852call this a @dfn{checkout}, but @sc{cvs} uses that term
6853for obtaining a copy of the sources (@pxref{Getting the
6854source}), an operation which those systems call a
6855@dfn{get} or a @dfn{fetch}.
6856@c Issue to think about: should we transition CVS
6857@c towards the "get" terminology?  "cvs get" is already a
6858@c synonym for "cvs checkout" and that section of the
6859@c manual refers to "Getting the source".  If this is
6860@c done, needs to be done gingerly (for example, we should
6861@c still accept "checkout" in .cvsrc files indefinitely
6862@c even if the CVS's messages are changed from "cvs checkout: "
6863@c to "cvs get: ").
6864@c There is a concern about whether "get" is not as
6865@c good for novices because it is a more general term
6866@c than "checkout" (and thus arguably harder to assign
6867@c a technical meaning for).
6868
6869@cindex edit (subcommand)
6870@deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6871
6872Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6873@var{files} read-write, and notifies users who have requested
6874@code{edit} notification for any of @var{files}.
6875
6876The @code{cvs edit} command accepts the same options as the
6877@code{cvs watch add} command, and establishes a temporary watch for the
6878user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6879@code{unedit}ed or @code{commit}ted.  If the user does not wish to
6880receive notifications, she should specify @code{-a none}.
6881
6882The @var{files} and the options are processed as for the @code{cvs
6883watch} commands.
6884
6885There are two additional options that @code{cvs edit} understands as of
6886@sc{cvs} client and server versions 1.12.10 but @code{cvs watch} does not.
6887The first is @code{-c}, which causes @code{cvs edit} to fail if anyone else
6888is editing the file.  This is probably only useful when @samp{edit -c} and
6889@samp{commit -c} are specified in all developers' @file{.cvsrc} files.  This
6890behavior may be overriden this via the @code{-f} option, which overrides
6891@code{-c} and allows multiple edits to succeed.
6892
6893@ignore
6894@strong{Caution: If the @code{PreservePermissions}
6895option is enabled in the repository (@pxref{config}),
6896@sc{cvs} will not change the permissions on any of the
6897@var{files}.  The reason for this change is to ensure
6898that using @samp{cvs edit} does not interfere with the
6899ability to store file permissions in the @sc{cvs}
6900repository.}
6901@end ignore
6902
6903@end deffn
6904
6905Normally when you are done with a set of changes, you
6906use the @code{cvs commit} command, which checks in your
6907changes and returns the watched files to their usual
6908read-only state.  But if you instead decide to abandon
6909your changes, or not to make any changes, you can use
6910the @code{cvs unedit} command.
6911
6912@cindex unedit (subcommand)
6913@cindex Abandoning work
6914@cindex Reverting to repository version
6915@deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6916
6917Abandon work on the working files @var{files}, and revert them to the
6918repository versions on which they are based.  @sc{cvs} makes those
6919@var{files} read-only for which users have requested notification using
6920@code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6921notification for any of @var{files}.
6922
6923The @var{files} and options are processed as for the
6924@code{cvs watch} commands.
6925
6926If watches are not in use, the @code{unedit} command
6927probably does not work, and the way to revert to the
6928repository version is with the command @code{cvs update -C file}
6929(@pxref{update}).
6930The meaning is
6931not precisely the same; the latter may also
6932bring in some changes which have been made in the
6933repository since the last time you updated.
6934@c It would be a useful enhancement to CVS to make
6935@c unedit work in the non-watch case as well.
6936@end deffn
6937
6938When using client/server @sc{cvs}, you can use the
6939@code{cvs edit} and @code{cvs unedit} commands even if
6940@sc{cvs} is unable to successfully communicate with the
6941server; the notifications will be sent upon the next
6942successful @sc{cvs} command.
6943
6944@node Watch information
6945@subsection Information about who is watching and editing
6946
6947@cindex watchers (subcommand)
6948@deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6949
6950List the users currently watching changes to @var{files}.  The report
6951includes the files being watched, and the mail address of each watcher.
6952
6953The @var{files} and options are processed as for the
6954@code{cvs watch} commands.
6955
6956@end deffn
6957
6958
6959@cindex editors (subcommand)
6960@deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6961
6962List the users currently working on @var{files}.  The report
6963includes the mail address of each user, the time when the user began
6964working with the file, and the host and path of the working directory
6965containing the file.
6966
6967The @var{files} and options are processed as for the
6968@code{cvs watch} commands.
6969
6970@end deffn
6971
6972@node Watches Compatibility
6973@subsection Using watches with old versions of CVS
6974
6975@cindex CVS 1.6, and watches
6976If you use the watch features on a repository, it
6977creates @file{CVS} directories in the repository and
6978stores the information about watches in that directory.
6979If you attempt to use @sc{cvs} 1.6 or earlier with the
6980repository, you get an error message such as the
6981following (all on one line):
6982
6983@example
6984cvs update: cannot open CVS/Entries for reading:
6985No such file or directory
6986@end example
6987
6988@noindent
6989and your operation will likely be aborted.  To use the
6990watch features, you must upgrade all copies of @sc{cvs}
6991which use that repository in local or server mode.  If
6992you cannot upgrade, use the @code{watch off} and
6993@code{watch remove} commands to remove all watches, and
6994that will restore the repository to a state which
6995@sc{cvs} 1.6 can cope with.
6996
6997@node Choosing a model
6998@section Choosing between reserved or unreserved checkouts
6999@cindex Choosing, reserved or unreserved checkouts
7000
7001Reserved and unreserved checkouts each have pros and
7002cons.  Let it be said that a lot of this is a matter of
7003opinion or what works given different groups' working
7004styles, but here is a brief description of some of the
7005issues.  There are many ways to organize a team of
7006developers.  @sc{cvs} does not try to enforce a certain
7007organization.  It is a tool that can be used in several
7008ways.
7009
7010Reserved checkouts can be very counter-productive.  If
7011two persons want to edit different parts of a file,
7012there may be no reason to prevent either of them from
7013doing so.  Also, it is common for someone to take out a
7014lock on a file, because they are planning to edit it,
7015but then forget to release the lock.
7016
7017@c "many groups"?  specifics?  cites to papers on this?
7018@c some way to weasel-word it a bit more so we don't
7019@c need facts :-)?
7020People, especially people who are familiar with
7021reserved checkouts, often wonder how often conflicts
7022occur if unreserved checkouts are used, and how
7023difficult they are to resolve.  The experience with
7024many groups is that they occur rarely and usually are
7025relatively straightforward to resolve.
7026
7027The rarity of serious conflicts may be surprising, until one realizes
7028that they occur only when two developers disagree on the proper design
7029for a given section of code; such a disagreement suggests that the
7030team has not been communicating properly in the first place.  In order
7031to collaborate under @emph{any} source management regimen, developers
7032must agree on the general design of the system; given this agreement,
7033overlapping changes are usually straightforward to merge.
7034
7035In some cases unreserved checkouts are clearly
7036inappropriate.  If no merge tool exists for the kind of
7037file you are managing (for example word processor files
7038or files edited by Computer Aided Design programs), and
7039it is not desirable to change to a program which uses a
7040mergeable data format, then resolving conflicts is
7041going to be unpleasant enough that you generally will
7042be better off to simply avoid the conflicts instead, by
7043using reserved checkouts.
7044
7045The watches features described above in @ref{Watches}
7046can be considered to be an intermediate model between
7047reserved checkouts and unreserved checkouts.  When you
7048go to edit a file, it is possible to find out who else
7049is editing it.  And rather than having the system
7050simply forbid both people editing the file, it can tell
7051you what the situation is and let you figure out
7052whether it is a problem in that particular case or not.
7053Therefore, for some groups watches can be
7054considered the best of both the reserved checkout and unreserved
7055checkout worlds.
7056
7057As of @sc{cvs} client and server versions 1.12.10, you may also enable
7058advisory locks by putting @samp{edit -c} and @samp{commit -c} in all
7059developers' @file{.cvsrc} files.  After this is done, @code{cvs edit}
7060will fail if there are any other editors, and @code{cvs commit} will
7061fail if the committer has not registered to edit the file via @code{cvs edit}.
7062This is most effective in conjunction with files checked out read-only by
7063default, which may be enabled by turning on watches in the repository or by
7064putting @samp{cvs -r} in all @file{.cvsrc} files.
7065
7066
7067@c ---------------------------------------------------------------------
7068@node Revision management
7069@chapter Revision management
7070@cindex Revision management
7071
7072@c -- This chapter could be expanded a lot.
7073@c -- Experiences are very welcome!
7074
7075If you have read this far, you probably have a pretty
7076good grasp on what @sc{cvs} can do for you.  This
7077chapter talks a little about things that you still have
7078to decide.
7079
7080If you are doing development on your own using @sc{cvs}
7081you could probably skip this chapter.  The questions
7082this chapter takes up become more important when more
7083than one person is working in a repository.
7084
7085@menu
7086* When to commit::              Some discussion on the subject
7087@end menu
7088
7089@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7090@node When to commit
7091@section When to commit?
7092@cindex When to commit
7093@cindex Committing, when to
7094@cindex Policy
7095
7096Your group should decide which policy to use regarding
7097commits.  Several policies are possible, and as your
7098experience with @sc{cvs} grows you will probably find
7099out what works for you.
7100
7101If you commit files too quickly you might commit files
7102that do not even compile.  If your partner updates his
7103working sources to include your buggy file, he will be
7104unable to compile the code.  On the other hand, other
7105persons will not be able to benefit from the
7106improvements you make to the code if you commit very
7107seldom, and conflicts will probably be more common.
7108
7109It is common to only commit files after making sure
7110that they can be compiled.  Some sites require that the
7111files pass a test suite.  Policies like this can be
7112enforced using the commitinfo file
7113(@pxref{commitinfo}), but you should think twice before
7114you enforce such a convention.  By making the
7115development environment too controlled it might become
7116too regimented and thus counter-productive to the real
7117goal, which is to get software written.
7118
7119@c ---------------------------------------------------------------------
7120@node Keyword substitution
7121@chapter Keyword substitution
7122@cindex Keyword substitution
7123@cindex Keyword expansion
7124@cindex Identifying files
7125
7126@comment   Be careful when editing this chapter.
7127@comment   Remember that this file is kept under
7128@comment   version control, so we must not accidentally
7129@comment   include a valid keyword in the running text.
7130
7131As long as you edit source files inside a working
7132directory you can always find out the state of
7133your files via @samp{cvs status} and @samp{cvs log}.
7134But as soon as you export the files from your
7135development environment it becomes harder to identify
7136which revisions they are.
7137
7138@sc{cvs} can use a mechanism known as @dfn{keyword
7139substitution} (or @dfn{keyword expansion}) to help
7140identifying the files.  Embedded strings of the form
7141@code{$@var{keyword}$} and
7142@code{$@var{keyword}:@dots{}$} in a file are replaced
7143with strings of the form
7144@code{$@var{keyword}:@var{value}$} whenever you obtain
7145a new revision of the file.
7146
7147@menu
7148* Keyword list::                   Keywords
7149* Using keywords::                 Using keywords
7150* Avoiding substitution::          Avoiding substitution
7151* Substitution modes::             Substitution modes
7152* Configuring keyword expansion::  Configuring keyword expansion
7153* Log keyword::                    Problems with the $@splitrcskeyword{Log}$ keyword.
7154@end menu
7155
7156@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7157@node Keyword list
7158@section Keyword List
7159@cindex Keyword List
7160
7161@c FIXME: need some kind of example here I think,
7162@c perhaps in a
7163@c "Keyword intro" node.  The intro in the "Keyword
7164@c substitution" node itself seems OK, but to launch
7165@c into a list of the keywords somehow seems too abrupt.
7166
7167This is a list of the keywords:
7168
7169@table @code
7170@cindex Author keyword
7171@item $@splitrcskeyword{Author}$
7172The login name of the user who checked in the revision.
7173
7174@cindex CVSHeader keyword
7175@item $@splitrcskeyword{CVSHeader}$
7176A standard header (similar to $@splitrcskeyword{Header}$, but with
7177the CVS root stripped off). It contains the relative
7178pathname of the @sc{rcs} file to the CVS root, the
7179revision number, the date (UTC), the author, the state,
7180and the locker (if locked). Files will normally never
7181be locked when you use @sc{cvs}.
7182
7183Note that this keyword has only been recently
7184introduced to @sc{cvs} and may cause problems with
7185existing installations if $@splitrcskeyword{CVSHeader}$ is already
7186in the files for a different purpose. This keyword may
7187be excluded using the @code{KeywordExpand=eCVSHeader}
7188in the @file{CVSROOT/config} file.
7189See @ref{Configuring keyword expansion} for more details.
7190
7191@cindex Date keyword
7192@item $@splitrcskeyword{Date}$
7193The date and time (UTC) the revision was checked in.
7194
7195@cindex Mdocdate keyword
7196@item $@splitrcskeyword{Mdocdate}$
7197The date (UTC) the revision was checked in, in a format suitable
7198for the Berkeley mdoc macro processing.
7199
7200@example
7201$Mdocdate: February 9 2014 $
7202@end example
7203
7204@cindex Header keyword
7205@item $@splitrcskeyword{Header}$
7206A standard header containing the full pathname of the
7207@sc{rcs} file, the revision number, the date (UTC), the
7208author, the state, and the locker (if locked).  Files
7209will normally never be locked when you use @sc{cvs}.
7210
7211@cindex Id keyword
7212@item $@splitrcskeyword{Id}$
7213Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
7214filename is without a path.
7215
7216@cindex Name keyword
7217@item $@splitrcskeyword{Name}$
7218Tag name used to check out this file.  The keyword is
7219expanded only if one checks out with an explicit tag
7220name.  For example, when running the command @code{cvs
7221co -r first}, the keyword expands to @samp{Name: first}.
7222
7223@cindex Locker keyword
7224@item $@splitrcskeyword{Locker}$
7225The login name of the user who locked the revision
7226(empty if not locked, which is the normal case unless
7227@code{cvs admin -l} is in use).
7228
7229@cindex Log keyword
7230@cindex MaxCommentLeaderLength
7231@cindex UseArchiveCommentLeader
7232@cindex Log keyword, configuring substitution behavior
7233@item $@splitrcskeyword{Log}$
7234The log message supplied during commit, preceded by a
7235header containing the @sc{rcs} filename, the revision
7236number, the author, and the date (UTC).  Existing log
7237messages are @emph{not} replaced.  Instead, the new log
7238message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
7239By default, each new line is prefixed with the same string which
7240precedes the @code{$@splitrcskeyword{Log}$} keyword, unless it exceeds the
7241@code{MaxCommentLeaderLength} set in @file{CVSROOT/config}.
7242
7243For example, if the file contains:
7244
7245@example
7246  /* Here is what people have been up to:
7247   *
7248   * $@splitrcskeyword{Log}: frob.c,v $
7249   * Revision 1.1  1997/01/03 14:23:51  joe
7250   * Add the superfrobnicate option
7251   *
7252   */
7253@end example
7254
7255@noindent
7256then additional lines which are added when expanding
7257the @code{$@splitrcskeyword{Log}$} keyword will be preceded by @samp{   * }.
7258Unlike previous versions of @sc{cvs} and @sc{rcs}, the
7259@dfn{comment leader} from the @sc{rcs} file is not used.
7260The @code{$@splitrcskeyword{Log}$} keyword is useful for
7261accumulating a complete change log in a source file,
7262but for several reasons it can be problematic.
7263
7264If the prefix of the @code{$@splitrcskeyword{Log}$} keyword turns out to be
7265longer than @code{MaxCommentLeaderLength}, CVS will skip expansion of this
7266keyword unless @code{UseArchiveCommentLeader} is also set in
7267@file{CVSROOT/config} and a @samp{comment leader} is set in the RCS archive
7268file, in which case the comment leader will be used instead.  For more on
7269setting the comment leader in the RCS archive file, @xref{admin}.  For more
7270on configuring the default @code{$@splitrcskeyword{Log}$} substitution
7271behavior, @xref{config}.
7272
7273@xref{Log keyword}.
7274
7275@cindex RCSfile keyword
7276@item $@splitrcskeyword{RCSfile}$
7277The name of the RCS file without a path.
7278
7279@cindex Revision keyword
7280@item $@splitrcskeyword{Revision}$
7281The revision number assigned to the revision.
7282
7283@cindex Source keyword
7284@item $@splitrcskeyword{Source}$
7285The full pathname of the RCS file.
7286
7287@cindex State keyword
7288@item $@splitrcskeyword{State}$
7289The state assigned to the revision.  States can be
7290assigned with @code{cvs admin -s}---see @ref{admin options}.
7291
7292@cindex Local keyword
7293@item Local keyword
7294The @code{LocalKeyword} option in the @file{CVSROOT/config} file
7295may be used to specify a local keyword which is to be
7296used as an alias for one of the keywords: $@splitrcskeyword{Id}$,
7297$@splitrcskeyword{Header}$, or $@splitrcskeyword{CVSHeader}$. For
7298example, if the @file{CVSROOT/config} file contains
7299a line with @code{LocalKeyword=MYBSD=CVSHeader}, then a
7300file with the local keyword $@splitrcskeyword{MYBSD}$ will be
7301expanded as if it were a $@splitrcskeyword{CVSHeader}$ keyword. If
7302the src/frob.c file contained this keyword, it might
7303look something like this:
7304
7305@example
7306  /*
7307   * $@splitrcskeyword{MYBSD}: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $
7308   */
7309@end example
7310
7311Many repositories make use of a such a ``local
7312keyword'' feature. An old patch to @sc{cvs} provided
7313the @code{LocalKeyword} feature using a @code{tag=}
7314option and called this the ``custom tag'' or ``local
7315tag'' feature. It was used in conjunction with the
7316what they called the @code{tagexpand=} option. In
7317@sc{cvs} this other option is known as the
7318@code{KeywordExpand} option.
7319See @ref{Configuring keyword expansion} for more
7320details.
7321
7322Examples from popular projects include:
7323$@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7324$@splitrcskeyword{OpenBSD}$, $@splitrcskeyword{XFree86}$,
7325$@splitrcskeyword{Xorg}$.
7326
7327The advantage of this is that you can include your
7328local version information in a file using this local
7329keyword without disrupting the upstream version
7330information (which may be a different local keyword or
7331a standard keyword). Allowing bug reports and the like
7332to more properly identify the source of the original
7333bug to the third-party and reducing the number of
7334conflicts that arise during an import of a new version.
7335
7336All keyword expansion except the local keyword may be
7337disabled using the @code{KeywordExpand} option in
7338the @file{CVSROOT/config} file---see
7339@ref{Configuring keyword expansion} for more details.
7340
7341@end table
7342
7343@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7344@node Using keywords
7345@section Using keywords
7346
7347To include a keyword string you simply include the
7348relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
7349file, and commit the file.  @sc{cvs} will automatically (Or,
7350more accurately, as part of the update run that
7351automatically happens after a commit.)
7352expand the string as part of the commit operation.
7353
7354It is common to embed the @code{$@splitrcskeyword{Id}$} string in
7355the source files so that it gets passed through to
7356generated files.  For example, if you are managing
7357computer program source code, you might include a
7358variable which is initialized to contain that string.
7359Or some C compilers may provide a @code{#pragma ident}
7360directive.  Or a document management system might
7361provide a way to pass a string through to generated
7362files.
7363
7364@c Would be nice to give an example, but doing this in
7365@c portable C is not possible and the problem with
7366@c picking any one language (VMS HELP files, Ada,
7367@c troff, whatever) is that people use CVS for all
7368@c kinds of files.
7369
7370@cindex Ident (shell command)
7371The @code{ident} command (which is part of the @sc{rcs}
7372package) can be used to extract keywords and their
7373values from a file.  This can be handy for text files,
7374but it is even more useful for extracting keywords from
7375binary files.
7376
7377@example
7378$ ident samp.c
7379samp.c:
7380     $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7381$ gcc samp.c
7382$ ident a.out
7383a.out:
7384     $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7385@end example
7386
7387@cindex What (shell command)
7388S@sc{ccs} is another popular revision control system.
7389It has a command, @code{what}, which is very similar to
7390@code{ident} and used for the same purpose.  Many sites
7391without @sc{rcs} have @sc{sccs}.  Since @code{what}
7392looks for the character sequence @code{@@(#)} it is
7393easy to include keywords that are detected by either
7394command.  Simply prefix the keyword with the
7395magic @sc{sccs} phrase, like this:
7396
7397@example
7398static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
7399@end example
7400
7401@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7402@node Avoiding substitution
7403@section Avoiding substitution
7404
7405Keyword substitution has its disadvantages.  Sometimes
7406you might want the literal text string
7407@samp{$@splitrcskeyword{Author}$} to appear inside a file without
7408@sc{cvs} interpreting it as a keyword and expanding it
7409into something like @samp{$@splitrcskeyword{Author}: ceder $}.
7410
7411There is unfortunately no way to selectively turn off
7412keyword substitution.  You can use @samp{-ko}
7413(@pxref{Substitution modes}) to turn off keyword
7414substitution entirely.
7415
7416In many cases you can avoid using keywords in
7417the source, even though they appear in the final
7418product.  For example, the source for this manual
7419contains @samp{$@@asis@{@}Author$} whenever the text
7420@samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
7421and @code{troff} you can embed the null-character
7422@code{\&} inside the keyword for a similar effect.
7423
7424It is also possible to specify an explicit list of
7425keywords to include or exclude using the
7426@code{KeywordExpand} option in the
7427@file{CVSROOT/config} file--see @ref{Configuring keyword expansion}
7428for more details. This feature is intended primarily
7429for use with the @code{LocalKeyword} option--see
7430@ref{Keyword list}.
7431
7432@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7433@node Substitution modes
7434@section Substitution modes
7435@cindex Keyword substitution, changing modes
7436@cindex -k (keyword substitution)
7437@cindex Kflag
7438
7439@c FIXME: This could be made more coherent, by expanding it
7440@c with more examples or something.
7441Each file has a stored default substitution mode, and
7442each working directory copy of a file also has a
7443substitution mode.  The former is set by the @samp{-k}
7444option to @code{cvs add} and @code{cvs admin}; the
7445latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7446checkout} or @code{cvs update}.
7447@code{cvs diff} and @code{cvs rdiff} also
7448have @samp{-k} options.
7449For some examples,
7450see @ref{Binary files}, and @ref{Merging and keywords}.
7451@c The fact that -A is overloaded to mean both reset
7452@c sticky options and reset sticky tags/dates is
7453@c somewhat questionable.  Perhaps there should be
7454@c separate options to reset sticky options (e.g. -k
7455@c A") and tags/dates (someone suggested -r HEAD could
7456@c do this instead of setting a sticky tag of "HEAD"
7457@c as in the status quo but I haven't thought much
7458@c about that idea.  Of course -r .reset or something
7459@c could be coined if this needs to be a new option).
7460@c On the other hand, having -A mean "get things back
7461@c into the state after a fresh checkout" has a certain
7462@c appeal, and maybe there is no sufficient reason for
7463@c creeping featurism in this area.
7464
7465The modes available are:
7466
7467@table @samp
7468@item -kkv
7469Generate keyword strings using the default form, e.g.
7470@code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7471keyword.
7472
7473@item -kkvl
7474Like @samp{-kkv}, except that a locker's name is always
7475inserted if the given revision is currently locked.
7476The locker's name is only relevant if @code{cvs admin
7477-l} is in use.
7478
7479@item -kk
7480Generate only keyword names in keyword strings; omit
7481their values.  For example, for the @code{Revision}
7482keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7483instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7484is useful to ignore differences due to keyword
7485substitution when comparing different revisions of a
7486file (@pxref{Merging and keywords}).
7487
7488@item -ko
7489Generate the old keyword string, present in the working
7490file just before it was checked in.  For example, for
7491the @code{Revision} keyword, generate the string
7492@code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7493@code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7494string appeared when the file was checked in.
7495
7496@item -kb
7497Like @samp{-ko}, but also inhibit conversion of line
7498endings between the canonical form in which they are
7499stored in the repository (linefeed only), and the form
7500appropriate to the operating system in use on the
7501client.  For systems, like unix, which use linefeed
7502only to terminate lines, this is very similar to
7503@samp{-ko}.  For more information on binary files, see
7504@ref{Binary files}.  In @sc{cvs} version 1.12.2 and later
7505@samp{-kb}, as set by @code{cvs add}, @code{cvs admin}, or
7506@code{cvs import} may not be overridden by a @samp{-k} option
7507specified on the command line.
7508
7509@item -kv
7510Generate only keyword values for keyword strings.  For
7511example, for the @code{Revision} keyword, generate the string
7512@code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7513This can help generate files in programming languages
7514where it is hard to strip keyword delimiters like
7515@code{$@splitrcskeyword{Revision}: $} from a string.  However,
7516further keyword substitution cannot be performed once
7517the keyword names are removed, so this option should be
7518used with care.
7519
7520One often would like to use @samp{-kv} with @code{cvs
7521export}---@pxref{export}.  But be aware that doesn't
7522handle an export containing binary files correctly.
7523
7524@end table
7525
7526@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7527@node Configuring keyword expansion
7528@section Configuring Keyword Expansion
7529@cindex Configuring keyword expansion
7530
7531In a repository that includes third-party software on
7532vendor branches, it is sometimes helpful to configure
7533CVS to use a local keyword instead of the standard
7534$@splitrcskeyword{Id}$ or $@splitrcskeyword{Header}$ keywords. Examples from
7535real projects include $@splitrcskeyword{Xorg}$, $@splitrcskeyword{XFree86}$,
7536$@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7537$@splitrcskeyword{OpenBSD}$, and even $@splitrcskeyword{dotat}$.
7538The advantage of this is that
7539you can include your local version information in a
7540file using this local keyword (sometimes called a
7541``custom tag'' or a ``local tag'') without disrupting
7542the upstream version information (which may be a
7543different local keyword or a standard keyword). In
7544these cases, it is typically desirable to disable the
7545expansion of all keywords except the configured local
7546keyword.
7547
7548The @code{KeywordExpand} option in the
7549@file{CVSROOT/config} file is intended to allow for the
7550either the explicit exclusion of a keyword or list of
7551keywords, or for the explicit inclusion of a keyword or
7552a list of keywords. This list may include the
7553@code{LocalKeyword} that has been configured.
7554
7555The @code{KeywordExpand} option is followed by
7556@code{=} and the next character may either be @code{i}
7557to start an inclusion list or @code{e} to start an
7558exclusion list. If the following lines were added to
7559the @file{CVSROOT/config} file:
7560
7561@example
7562        # Add a "MyBSD" keyword and restrict keyword
7563        # expansion
7564        LocalKeyword=MyBSD=CVSHeader
7565        KeywordExpand=iMyBSD
7566@end example
7567
7568then only the $@splitrcskeyword{MyBSD}$ keyword would be expanded.
7569A list may be used. The this example:
7570
7571@example
7572        # Add a "MyBSD" keyword and restrict keyword expansion
7573        # to the MyBSD, Name, Date and Mdocdate keywords.
7574        LocalKeyword=MyBSD=CVSHeader
7575        KeywordExpand=iMyBSD,Name,Date,Mdocdate
7576@end example
7577
7578would allow $@splitrcskeyword{MyBSD}$, $@splitrcskeyword{Name}$,
7579$@splitrcskeyword{Mdocdate} and
7580$@splitrcskeyword{Date}$ to be expanded.
7581
7582It is also possible to configure an exclusion list
7583using the following:
7584
7585@example
7586        # Do not expand the non-RCS keyword CVSHeader
7587        KeywordExpand=eCVSHeader
7588@end example
7589
7590This allows @sc{cvs} to ignore the recently introduced
7591$@splitrcskeyword{CVSHeader}$ keyword and retain all of the
7592others. The exclusion entry could also contain the
7593standard RCS keyword list, but this could be confusing
7594to users that expect RCS keywords to be expanded, so
7595care should be taken to properly set user expectations
7596for a repository that is configured in that manner.
7597
7598If there is a desire to not have any RCS keywords
7599expanded and not use the @code{-ko} flags everywhere,
7600an administrator may disable all keyword expansion
7601using the @file{CVSROOT/config} line:
7602
7603@example
7604	# Do not expand any RCS keywords
7605	KeywordExpand=i
7606@end example
7607
7608this could be confusing to users that expect RCS
7609keywords like $@splitrcskeyword{Id}$ to be expanded properly,
7610so care should be taken to properly set user
7611expectations for a repository so configured.
7612
7613It should be noted that a patch to provide both the
7614@code{KeywordExpand} and @code{LocalKeyword} features
7615has been around a long time. However, that patch
7616implemented these features using @code{tag=} and
7617@code{tagexpand=} keywords and those keywords are NOT
7618recognized.
7619
7620@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7621@node Log keyword
7622@section Problems with the $@splitrcskeyword{Log}$ keyword.
7623
7624The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7625controversial.  As long as you are working on your
7626development system the information is easily accessible
7627even if you do not use the @code{$@splitrcskeyword{Log}$}
7628keyword---just do a @code{cvs log}.  Once you export
7629the file the history information might be useless
7630anyhow.
7631
7632A more serious concern is that @sc{cvs} is not good at
7633handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7634merged onto the main trunk.  Conflicts often result
7635from the merging operation.
7636@c Might want to check whether the CVS implementation
7637@c of RCS_merge has this problem the same way rcsmerge
7638@c does.  I would assume so....
7639
7640People also tend to "fix" the log entries in the file
7641(correcting spelling mistakes and maybe even factual
7642errors).  If that is done the information from
7643@code{cvs log} will not be consistent with the
7644information inside the file.  This may or may not be a
7645problem in real life.
7646
7647It has been suggested that the @code{$@splitrcskeyword{Log}$}
7648keyword should be inserted @emph{last} in the file, and
7649not in the files header, if it is to be used at all.
7650That way the long list of change messages will not
7651interfere with everyday source file browsing.
7652
7653@c ---------------------------------------------------------------------
7654@node Tracking sources
7655@chapter Tracking third-party sources
7656@cindex Third-party sources
7657@cindex Tracking sources
7658
7659@c FIXME: Need discussion of added and removed files.
7660@c FIXME: This doesn't really adequately introduce the
7661@c concepts of "vendor" and "you".  They don't *have*
7662@c to be separate organizations or separate people.
7663@c We want a description which is somewhat more based on
7664@c the technical issues of which sources go where, but
7665@c also with enough examples of how this relates to
7666@c relationships like customer-supplier, developer-QA,
7667@c maintainer-contributor, or whatever, to make it
7668@c seem concrete.
7669If you modify a program to better fit your site, you
7670probably want to include your modifications when the next
7671release of the program arrives.  @sc{cvs} can help you with
7672this task.
7673
7674@cindex Vendor
7675@cindex Vendor branch
7676@cindex Branch, vendor-
7677In the terminology used in @sc{cvs}, the supplier of the
7678program is called a @dfn{vendor}.  The unmodified
7679distribution from the vendor is checked in on its own
7680branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
76811.1.1 for this use.
7682
7683When you modify the source and commit it, your revision
7684will end up on the main trunk.  When a new release is
7685made by the vendor, you commit it on the vendor branch
7686and copy the modifications onto the main trunk.
7687
7688Use the @code{import} command to create and update
7689the vendor branch.  When you import a new file,
7690(usually) the vendor branch is made the `head' revision, so
7691anyone that checks out a copy of the file gets that
7692revision.  When a local modification is committed it is
7693placed on the main trunk, and made the `head'
7694revision.
7695
7696@menu
7697* First import::                Importing for the first time
7698* Update imports::              Updating with the import command
7699* Reverting local changes::     Reverting to the latest vendor release
7700* Binary files in imports::     Binary files require special handling
7701* Keywords in imports::         Keyword substitution might be undesirable
7702* Multiple vendor branches::    What if you get sources from several places?
7703@end menu
7704
7705@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7706@node First import
7707@section Importing for the first time
7708@cindex Importing modules
7709
7710@c Should mention naming conventions for vendor tags,
7711@c release tags, and perhaps directory names.
7712Use the @code{import} command to check in the sources
7713for the first time.  When you use the @code{import}
7714command to track third-party sources, the @dfn{vendor
7715tag} and @dfn{release tags} are useful.  The
7716@dfn{vendor tag} is a symbolic name for the branch
7717(which is always 1.1.1, unless you use the @samp{-b
7718@var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7719@dfn{release tags} are symbolic names for a particular
7720release, such as @samp{FSF_0_04}.
7721
7722@c I'm not completely sure this belongs here.  But
7723@c we need to say it _somewhere_ reasonably obvious; it
7724@c is a common misconception among people first learning CVS
7725Note that @code{import} does @emph{not} change the
7726directory in which you invoke it.  In particular, it
7727does not set up that directory as a @sc{cvs} working
7728directory; if you want to work with the sources import
7729them first and then check them out into a different
7730directory (@pxref{Getting the source}).
7731
7732@cindex wdiff (import example)
7733Suppose you have the sources to a program called
7734@code{wdiff} in a directory @file{wdiff-0.04},
7735and are going to make private modifications that you
7736want to be able to use even when new releases are made
7737in the future.  You start by importing the source to
7738your repository:
7739
7740@example
7741$ cd wdiff-0.04
7742$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7743@end example
7744
7745The vendor tag is named @samp{FSF_DIST} in the above
7746example, and the only release tag assigned is
7747@samp{WDIFF_0_04}.
7748@c FIXME: Need to say where fsf/wdiff comes from.
7749
7750@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7751@node Update imports
7752@section Updating with the import command
7753
7754When a new release of the source arrives, you import it into the
7755repository with the same @code{import} command that you used to set up
7756the repository in the first place.  The only difference is that you
7757specify a different release tag this time:
7758
7759@example
7760$ tar xfz wdiff-0.05.tar.gz
7761$ cd wdiff-0.05
7762$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7763@end example
7764
7765@emph{WARNING: If you use a release tag that already exists in one of the
7766repository archives, files removed by an import may not be detected.}
7767
7768For files that have not been modified locally, the newly created
7769revision becomes the head revision.  If you have made local
7770changes, @code{import} will warn you that you must merge the changes
7771into the main trunk, and tell you to use @samp{checkout -j} to do so:
7772
7773@c FIXME: why "wdiff" here and "fsf/wdiff" in the
7774@c "import"?  I think the assumption is that one has
7775@c "wdiff fsf/wdiff" or some such in modules, but it
7776@c would be better to not use modules in this example.
7777@example
7778$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7779@end example
7780
7781@noindent
7782The above command will check out the latest revision of
7783@samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7784since yesterday into the working copy.  If any conflicts arise during
7785the merge they should be resolved in the normal way (@pxref{Conflicts
7786example}).  Then, the modified files may be committed.
7787
7788However, it is much better to use the two release tags rather than using
7789a date on the branch as suggested above:
7790
7791@example
7792$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7793@end example
7794
7795@noindent
7796The reason this is better is that
7797using a date, as suggested above, assumes that you do
7798not import more than one release of a product per day.
7799More importantly, using the release tags allows @sc{cvs} to detect files
7800that were removed between the two vendor releases and mark them for
7801removal.  Since @code{import} has no way to detect removed files, you
7802should do a merge like this even if @code{import} doesn't tell you to.
7803
7804@node Reverting local changes
7805@section Reverting to the latest vendor release
7806
7807You can also revert local changes completely and return
7808to the latest vendor release by changing the `head'
7809revision back to the vendor branch on all files.  This
7810does, however, produce weird results if you should ever
7811edit this file again, for anyone looking at the output
7812from the @code{log} command or CVSweb.  To fix this,
7813first commit a revision of the file which equals the
7814vendor branch, then use @code{admin} @samp{-b}. For
7815example, if you have a checked-out copy of the sources
7816in @file{~/work.d/wdiff}, and you want to revert to the
7817vendor's version for all the files in that directory,
7818you would type:
7819
7820@example
7821$ cd ~/work.d/wdiff
7822$ cvs admin -bFSF_DIST .
7823@end example
7824
7825@noindent
7826You must specify the @samp{-bFSF_DIST} without any space
7827after the @samp{-b}.  @xref{admin options}.
7828
7829@node Binary files in imports
7830@section How to handle binary files with cvs import
7831
7832Use the @samp{-k} wrapper option to tell import which
7833files are binary.  @xref{Wrappers}.
7834
7835@node Keywords in imports
7836@section How to handle keyword substitution with cvs import
7837
7838The sources which you are importing may contain
7839keywords (@pxref{Keyword substitution}).  For example,
7840the vendor may use @sc{cvs} or some other system
7841which uses similar keyword expansion syntax.  If you
7842just import the files in the default fashion, then
7843the keyword expansions supplied by the vendor will
7844be replaced by keyword expansions supplied by your
7845own copy of @sc{cvs}.  It may be more convenient to
7846maintain the expansions supplied by the vendor, so
7847that this information can supply information about
7848the sources that you imported from the vendor.
7849
7850To maintain the keyword expansions supplied by the
7851vendor, supply the @samp{-ko} option to @code{cvs
7852import} the first time you import the file.
7853This will turn off keyword expansion
7854for that file entirely, so if you want to be more
7855selective you'll have to think about what you want
7856and use the @samp{-k} option to @code{cvs update} or
7857@code{cvs admin} as appropriate.
7858@c Supplying -ko to import if the file already existed
7859@c has no effect.  Not clear to me whether it should
7860@c or not.
7861
7862@node Multiple vendor branches
7863@section Multiple vendor branches
7864
7865All the examples so far assume that there is only one
7866vendor from which you are getting sources.  In some
7867situations you might get sources from a variety of
7868places.  For example, suppose that you are dealing with
7869a project where many different people and teams are
7870modifying the software.  There are a variety of ways to
7871handle this, but in some cases you have a bunch of
7872source trees lying around and what you want to do more
7873than anything else is just to all put them in @sc{cvs} so
7874that you at least have them in one place.
7875
7876For handling situations in which there may be more than
7877one vendor, you may specify the @samp{-b} option to
7878@code{cvs import}.  It takes as an argument the vendor
7879branch to import to.  The default is @samp{-b 1.1.1}.
7880
7881Vendor branches can only be in the format 1.1.x where
7882@samp{x} is an @emph{uneven} number, because branch
7883tags use even numbers.
7884
7885For example, suppose that there are two teams, the red
7886team and the blue team, that are sending you sources.
7887You want to import the red team's efforts to branch
78881.1.1 and use the vendor tag RED.  You want to import
7889the blue team's efforts to branch 1.1.3 and use the
7890vendor tag BLUE.  So the commands you might use are:
7891
7892@example
7893$ cvs import dir RED RED_1-0
7894$ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7895@end example
7896
7897Note that if your vendor tag does not match your
7898@samp{-b} option, @sc{cvs} will not detect this case!  For
7899example,
7900
7901@example
7902$ cvs import -b 1.1.3 dir RED RED_1-0
7903@end example
7904
7905@noindent
7906Be careful; this kind of mismatch is sure to sow
7907confusion or worse.  I can't think of a useful purpose
7908for the ability to specify a mismatch here, but if you
7909discover such a use, don't.  @sc{cvs} is likely to make this
7910an error in some future release.
7911
7912@c Probably should say more about the semantics of
7913@c multiple branches.  What about the default branch?
7914@c What about joining (perhaps not as useful with
7915@c multiple branches, or perhaps it is.  Either way
7916@c should be mentioned).
7917
7918@c I'm not sure about the best location for this.  In
7919@c one sense, it might belong right after we've introduced
7920@c CVS's basic version control model, because people need
7921@c to figure out builds right away.  The current location
7922@c is based on the theory that it kind of akin to the
7923@c "Revision management" section.
7924@node Builds
7925@chapter How your build system interacts with CVS
7926@cindex Builds
7927@cindex make
7928
7929As mentioned in the introduction, @sc{cvs} does not
7930contain software for building your software from source
7931code.  This section describes how various aspects of
7932your build system might interact with @sc{cvs}.
7933
7934@c Is there a way to discuss this without reference to
7935@c tools other than CVS?  I'm not sure there is; I
7936@c wouldn't think that people who learn CVS first would
7937@c even have this concern.
7938One common question, especially from people who are
7939accustomed to @sc{rcs}, is how to make their build get
7940an up to date copy of the sources.  The answer to this
7941with @sc{cvs} is two-fold.  First of all, since
7942@sc{cvs} itself can recurse through directories, there
7943is no need to modify your @file{Makefile} (or whatever
7944configuration file your build tool uses) to make sure
7945each file is up to date.  Instead, just use two
7946commands, first @code{cvs -q update} and then
7947@code{make} or whatever the command is to invoke your
7948build tool.  Secondly, you do not necessarily
7949@emph{want} to get a copy of a change someone else made
7950until you have finished your own work.  One suggested
7951approach is to first update your sources, then
7952implement, build and
7953test the change you were thinking of, and then commit
7954your sources (updating first if necessary).  By
7955periodically (in between changes, using the approach
7956just described) updating your entire tree, you ensure
7957that your sources are sufficiently up to date.
7958
7959@cindex Bill of materials
7960One common need is to record which versions of which
7961source files went into a particular build.  This kind
7962of functionality is sometimes called @dfn{bill of
7963materials} or something similar.  The best way to do
7964this with @sc{cvs} is to use the @code{tag} command to
7965record which versions went into a given build
7966(@pxref{Tags}).
7967
7968Using @sc{cvs} in the most straightforward manner
7969possible, each developer will have a copy of the entire
7970source tree which is used in a particular build.  If
7971the source tree is small, or if developers are
7972geographically dispersed, this is the preferred
7973solution.  In fact one approach for larger projects is
7974to break a project down into smaller
7975@c I say subsystem instead of module because they may or
7976@c may not use the modules file.
7977separately-compiled subsystems, and arrange a way of
7978releasing them internally so that each developer need
7979check out only those subsystems which they are
7980actively working on.
7981
7982Another approach is to set up a structure which allows
7983developers to have their own copies of some files, and
7984for other files to access source files from a central
7985location.  Many people have come up with some such a
7986@c two such people are paul@sander.cupertino.ca.us (for
7987@c a previous employer)
7988@c and gunnar.tornblom@se.abb.com (spicm and related tools),
7989@c but as far as I know
7990@c no one has nicely packaged or released such a system (or
7991@c instructions for constructing one).
7992system using features such as the symbolic link feature
7993found in many operating systems, or the @code{VPATH}
7994feature found in many versions of @code{make}.  One build
7995tool which is designed to help with this kind of thing
7996is Odin (see
7997@code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7998@c Should we be saying more about Odin?  Or how you use
7999@c it with CVS?  Also, the Prime Time Freeware for Unix
8000@c disk (see http://www.ptf.com/) has Odin (with a nice
8001@c paragraph summarizing it on the web), so that might be a
8002@c semi-"official" place to point people.
8003@c
8004@c Of course, many non-CVS systems have this kind of
8005@c functionality, for example OSF's ODE
8006@c (http://www.osf.org/ode/) or mk
8007@c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
8008@c He has changed providers in the past; a search engine search
8009@c for "Peter Ziobrzynski" probably won't get too many
8010@c spurious hits :-).  A more stable URL might be
8011@c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
8012@c there is any point in mentioning them here unless they
8013@c can work with CVS.
8014
8015@c ---------------------------------------------------------------------
8016@node Special Files
8017@chapter Special Files
8018
8019@cindex Special files
8020@cindex Device nodes
8021@cindex Ownership, saving in CVS
8022@cindex Permissions, saving in CVS
8023@cindex Hard links
8024@cindex Symbolic links
8025
8026In normal circumstances, @sc{cvs} works only with regular
8027files.  Every file in a project is assumed to be
8028persistent; it must be possible to open, read and close
8029them; and so on.  @sc{cvs} also ignores file permissions and
8030ownerships, leaving such issues to be resolved by the
8031developer at installation time.  In other words, it is
8032not possible to "check in" a device into a repository;
8033if the device file cannot be opened, @sc{cvs} will refuse to
8034handle it.  Files also lose their ownerships and
8035permissions during repository transactions.
8036
8037@ignore
8038If the configuration variable @code{PreservePermissions}
8039(@pxref{config}) is set in the repository, @sc{cvs} will
8040save the following file characteristics in the
8041repository:
8042
8043@itemize @bullet
8044@item user and group ownership
8045@item permissions
8046@item major and minor device numbers
8047@item symbolic links
8048@item hard link structure
8049@end itemize
8050
8051Using the @code{PreservePermissions} option affects the
8052behavior of @sc{cvs} in several ways.  First, some of the
8053new operations supported by @sc{cvs} are not accessible to
8054all users.  In particular, file ownership and special
8055file characteristics may only be changed by the
8056superuser.  When the @code{PreservePermissions}
8057configuration variable is set, therefore, users will
8058have to be `root' in order to perform @sc{cvs} operations.
8059
8060When @code{PreservePermissions} is in use, some @sc{cvs}
8061operations (such as @samp{cvs status}) will not
8062recognize a file's hard link structure, and so will
8063emit spurious warnings about mismatching hard links.
8064The reason is that @sc{cvs}'s internal structure does not
8065make it easy for these operations to collect all the
8066necessary data about hard links, so they check for file
8067conflicts with inaccurate data.
8068
8069A more subtle difference is that @sc{cvs} considers a file
8070to have changed only if its contents have changed
8071(specifically, if the modification time of the working
8072file does not match that of the repository's file).
8073Therefore, if only the permissions, ownership or hard
8074linkage have changed, or if a device's major or minor
8075numbers have changed, @sc{cvs} will not notice.  In order to
8076commit such a change to the repository, you must force
8077the commit with @samp{cvs commit -f}.  This also means
8078that if a file's permissions have changed and the
8079repository file is newer than the working copy,
8080performing @samp{cvs update} will silently change the
8081permissions on the working copy.
8082
8083Changing hard links in a @sc{cvs} repository is particularly
8084delicate.  Suppose that file @file{foo} is linked to
8085file @file{old}, but is later relinked to file
8086@file{new}.  You can wind up in the unusual situation
8087where, although @file{foo}, @file{old} and @file{new}
8088have all had their underlying link patterns changed,
8089only @file{foo} and @file{new} have been modified, so
8090@file{old} is not considered a candidate for checking
8091in.  It can be very easy to produce inconsistent
8092results this way.  Therefore, we recommend that when it
8093is important to save hard links in a repository, the
8094prudent course of action is to @code{touch} any file
8095whose linkage or status has changed since the last
8096checkin.  Indeed, it may be wise to @code{touch *}
8097before each commit in a directory with complex hard
8098link structures.
8099
8100It is worth noting that only regular files may
8101be merged, for reasons that hopefully are obvious.  If
8102@samp{cvs update} or @samp{cvs checkout -j} attempts to
8103merge a symbolic link with a regular file, or two
8104device files for different kinds of devices, @sc{cvs} will
8105report a conflict and refuse to perform the merge.  At
8106the same time, @samp{cvs diff} will not report any
8107differences between these files, since no meaningful
8108textual comparisons can be made on files which contain
8109no text.
8110
8111The @code{PreservePermissions} features do not work
8112with client/server @sc{cvs}.  Another limitation is
8113that hard links must be to other files within the same
8114directory; hard links across directories are not
8115supported.
8116@end ignore
8117
8118@c ---------------------------------------------------------------------
8119@c ----- START MAN 1 -----
8120@node CVS commands
8121@appendix Guide to CVS commands
8122
8123This appendix describes the overall structure of
8124@sc{cvs} commands, and describes some commands in
8125detail (others are described elsewhere; for a quick
8126reference to @sc{cvs} commands, @pxref{Invoking CVS}).
8127@c The idea is that we want to move the commands which
8128@c are described here into the main body of the manual,
8129@c in the process reorganizing the manual to be
8130@c organized around what the user wants to do, not
8131@c organized around CVS commands.
8132@c
8133@c Note that many users do expect a manual which is
8134@c organized by command.  At least some users do.
8135@c One good addition to the "organized by command"
8136@c section (if any) would be "see also" links.
8137@c The awk manual might be a good example; it has a
8138@c reference manual which is more verbose than Invoking
8139@c CVS but probably somewhat less verbose than CVS
8140@c Commands.
8141
8142@menu
8143* Structure::                   Overall structure of CVS commands
8144* Exit status::                 Indicating CVS's success or failure
8145* ~/.cvsrc::                    Default options with the ~/.cvsrc file
8146* Global options::              Options you give to the left of cvs_command
8147* Common options::              Options you give to the right of cvs_command
8148* Date input formats::		Acceptable formats for date specifications
8149* admin::                       Administration
8150* annotate::                    What revision modified each line of a file?
8151* checkout::                    Checkout sources for editing
8152* commit::                      Check files into the repository
8153* diff::                        Show differences between revisions
8154* export::                      Export sources from CVS, similar to checkout
8155* history::                     Show status of files and users
8156* import::                      Import sources into CVS, using vendor branches
8157* log::                         Show log messages for files
8158* ls & rls::                    List files in the repository
8159* rdiff::                       'patch' format diffs between releases
8160* release::                     Indicate that a directory is no longer in use
8161* server & pserver::            Act as a server for a client on stdin/stdout
8162* suck::                        Download RCS ,v file raw
8163* update::                      Bring work tree in sync with repository
8164@end menu
8165
8166@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8167@node Structure
8168@appendixsec Overall structure of CVS commands
8169@cindex Structure
8170@cindex CVS command structure
8171@cindex Command structure
8172@cindex Format of CVS commands
8173
8174The overall format of all @sc{cvs} commands is:
8175
8176@example
8177cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
8178@end example
8179
8180@table @code
8181@item cvs
8182The name of the @sc{cvs} program.
8183
8184@item cvs_options
8185Some options that affect all sub-commands of @sc{cvs}.  These are
8186described below.
8187
8188@item cvs_command
8189One of several different sub-commands.  Some of the commands have
8190aliases that can be used instead; those aliases are noted in the
8191reference manual for that command.  There are only two situations
8192where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
8193list of available commands, and @samp{cvs -v} displays version
8194information on @sc{cvs} itself.
8195
8196@item command_options
8197Options that are specific for the command.
8198
8199@item command_args
8200Arguments to the commands.
8201@end table
8202
8203There is unfortunately some confusion between
8204@code{cvs_options} and @code{command_options}.
8205When given as a @code{cvs_option}, some options only
8206affect some of the commands.  When given as a
8207@code{command_option} it may have a different meaning, and
8208be accepted by more commands.  In other words, do not
8209take the above categorization too seriously.  Look at
8210the documentation instead.
8211
8212@node Exit status
8213@appendixsec CVS's exit status
8214@cindex Exit status, of CVS
8215
8216@sc{cvs} can indicate to the calling environment whether it
8217succeeded or failed by setting its @dfn{exit status}.
8218The exact way of testing the exit status will vary from
8219one operating system to another.  For example in a unix
8220shell script the @samp{$?} variable will be 0 if the
8221last command returned a successful exit status, or
8222greater than 0 if the exit status indicated failure.
8223
8224If @sc{cvs} is successful, it returns a successful status;
8225if there is an error, it prints an error message and
8226returns a failure status.  The one exception to this is
8227the @code{cvs diff} command.  It will return a
8228successful status if it found no differences, or a
8229failure status if there were differences or if there
8230was an error.  Because this behavior provides no good
8231way to detect errors, in the future it is possible that
8232@code{cvs diff} will be changed to behave like the
8233other @sc{cvs} commands.
8234@c It might seem like checking whether cvs -q diff
8235@c produces empty or non-empty output can tell whether
8236@c there were differences or not.  But it seems like
8237@c there are cases with output but no differences
8238@c (testsuite basica-8b).  It is not clear to me how
8239@c useful it is for a script to be able to check
8240@c whether there were differences.
8241@c FIXCVS? In previous versions of CVS, cvs diff
8242@c returned 0 for no differences, 1 for differences, or
8243@c 2 for errors.  Is this behavior worth trying to
8244@c bring back (but what does it mean for VMS?)?
8245
8246@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8247@node ~/.cvsrc
8248@appendixsec Default options and the ~/.cvsrc file
8249@cindex .cvsrc file
8250@cindex Option defaults
8251
8252There are some @code{command_options} that are used so
8253often that you might have set up an alias or some other
8254means to make sure you always specify that option.  One
8255example (the one that drove the implementation of the
8256@file{.cvsrc} support, actually) is that many people find the
8257default output of the @samp{diff} command to be very
8258hard to read, and that either context diffs or unidiffs
8259are much easier to understand.
8260
8261The @file{~/.cvsrc} file is a way that you can add
8262default options to @code{cvs_commands} within cvs,
8263instead of relying on aliases or other shell scripts.
8264
8265The format of the @file{~/.cvsrc} file is simple.  The
8266file is searched for a line that begins with the same
8267name as the @code{cvs_command} being executed.  If a
8268match is found, then the remainder of the line is split
8269up (at whitespace characters) into separate options and
8270added to the command arguments @emph{before} any
8271options from the command line.
8272
8273If a command has two names (e.g., @code{checkout} and
8274@code{co}), the official name, not necessarily the one
8275used on the command line, will be used to match against
8276the file.  So if this is the contents of the user's
8277@file{~/.cvsrc} file:
8278
8279@example
8280log -N
8281diff -uN
8282rdiff -u
8283update -Pd
8284checkout -P
8285release -d
8286@end example
8287
8288@noindent
8289the command @samp{cvs checkout foo} would have the
8290@samp{-P} option added to the arguments, as well as
8291@samp{cvs co foo}.
8292
8293With the example file above, the output from @samp{cvs
8294diff foobar} will be in unidiff format.  @samp{cvs diff
8295-c foobar} will provide context diffs, as usual.
8296Getting "old" format diffs would be slightly more
8297complicated, because @code{diff} doesn't have an option
8298to specify use of the "old" format, so you would need
8299@samp{cvs -f diff foobar}.
8300
8301In place of the command name you can use @code{cvs} to
8302specify global options (@pxref{Global options}).  For
8303example the following line in @file{.cvsrc}
8304
8305@example
8306cvs -z6
8307@end example
8308
8309@noindent
8310causes @sc{cvs} to use compression level 6.
8311
8312@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8313@node Global options
8314@appendixsec Global options
8315@cindex Options, global
8316@cindex Global options
8317@cindex Left-hand options
8318
8319The available @samp{cvs_options} (that are given to the
8320left of @samp{cvs_command}) are:
8321
8322@table @code
8323@item --allow-root=@var{rootdir}
8324May be invoked multiple times to specify one legal @sc{cvsroot} directory with
8325each invocation.  Also causes CVS to preparse the configuration file for each
8326specified root, which can be useful when configuring write proxies,  See
8327@ref{Password authentication server} & @ref{Write proxies}.
8328
8329@cindex Authentication, stream
8330@cindex Stream authentication
8331@item -a
8332Authenticate all communication between the client and
8333the server.  Only has an effect on the @sc{cvs} client.
8334As of this writing, this is only implemented when using
8335a GSSAPI connection (@pxref{GSSAPI authenticated}).
8336Authentication prevents certain sorts of attacks
8337involving hijacking the active @sc{tcp} connection.
8338Enabling authentication does not enable encryption.
8339
8340@cindex RCSBIN, overriding
8341@cindex Overriding RCSBIN
8342@item -b @var{bindir}
8343In @sc{cvs} 1.9.18 and older, this specified that
8344@sc{rcs} programs are in the @var{bindir} directory.
8345Current versions of @sc{cvs} do not run @sc{rcs}
8346programs; for compatibility this option is accepted,
8347but it does nothing.
8348
8349@cindex TMPDIR, environment variable
8350@cindex temporary file directory, set via command line
8351@cindex temporary file directory, set via environment variable
8352@cindex temporary file directory, set via config
8353@cindex temporary files, location of
8354@item -T @var{tempdir}
8355Use @var{tempdir} as the directory where temporary files are
8356located.
8357
8358The @sc{cvs} client and server store temporary files in a temporary directory.
8359The path to this temporary directory is set via, in order of precedence:
8360
8361@itemize @bullet
8362@item
8363The argument to the global @samp{-T} option.
8364
8365@item
8366The value set for @code{TmpDir} in the config file (server only -
8367@pxref{config}).
8368
8369@item
8370The contents of the @code{$TMPDIR} environment variable (@code{%TMPDIR%} on
8371Windows - @pxref{Environment variables}).
8372
8373@item
8374/tmp
8375
8376@end itemize
8377
8378Temporary directories should always be specified as an absolute pathname.
8379When running a CVS client, @samp{-T} affects only the local process;
8380specifying @samp{-T} for the client has no effect on the server and
8381vice versa.
8382
8383@cindex CVSROOT, overriding
8384@cindex Overriding CVSROOT
8385@item -d @var{cvs_root_directory}
8386Use @var{cvs_root_directory} as the root directory
8387pathname of the repository.  Overrides the setting of
8388the @code{$CVSROOT} environment variable.  @xref{Repository}.
8389
8390@cindex EDITOR, overriding
8391@cindex Overriding EDITOR
8392@item -e @var{editor}
8393Use @var{editor} to enter revision log information.  Overrides the
8394setting of the @code{$CVSEDITOR} and @code{$EDITOR}
8395environment variables.  For more information, see
8396@ref{Committing your changes}.
8397
8398@item -f
8399Do not read the @file{~/.cvsrc} file.  This
8400option is most often used because of the
8401non-orthogonality of the @sc{cvs} option set.  For
8402example, the @samp{cvs log} option @samp{-N} (turn off
8403display of tag names) does not have a corresponding
8404option to turn the display on.  So if you have
8405@samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
8406you may need to use @samp{-f} to show the tag names.
8407
8408@item -g
8409Forges group-writable permissions on files in the working copy.
8410This option is typically used when you have multiple users sharing
8411a single checked out source tree, allowing them to operate their
8412shells with a less dangerous umask at the expense of @sc{cvs} security.
8413To use this feature, create a directory to hold the checked-out
8414source tree, set it to a private group, and set up the directory
8415such that files created under it inherit the gid of the directory.
8416On BSD systems, this occurs automatically. On SYSV systems and
8417GNU/Linux, the sgid bit must be set on the directory for this.
8418The users who are to share the checked out tree must be placed in
8419that group which owns the directory.
8420
8421Note that the sharing of a single checked-out source tree is very
8422different from giving several users access to a common @sc{cvs} repository.
8423Access to a common @sc{cvs} repository already maintains shared group-write
8424permissions and does not require this option.
8425
8426Due to the security implications, setting this option globally in
8427your @file{.cvsrc} file is strongly discouraged; if you must, ensure
8428all source checkouts are "firewalled" within a private group or a
8429private mode 0700 directory.
8430
8431This option is a MidnightBSD extension merged into MirBSD @sc{cvs}.
8432
8433@item -H
8434@itemx --help
8435Display usage information about the specified @samp{cvs_command}
8436(but do not actually execute the command).  If you don't specify
8437a command name, @samp{cvs -H} displays overall help for
8438@sc{cvs}, including a list of other help options.
8439@c It seems to me it is better to document it this way
8440@c rather than trying to update this documentation
8441@c every time that we add a --help-foo option.  But
8442@c perhaps that is confusing...
8443
8444@cindex Read-only repository mode
8445@item -R
8446Turns on read-only repository mode.  This allows one to check out from a
8447read-only repository, such as within an anoncvs server, or from a @sc{cd-rom}
8448repository.
8449
8450Same effect as if the @code{CVSREADONLYFS} environment
8451variable is set. Using @samp{-R} can also considerably
8452speed up checkouts over NFS.
8453
8454@cindex Read-only mode
8455@item -n
8456Do not change any files.  Attempt to execute the
8457@samp{cvs_command}, but only to issue reports; do not remove,
8458update, or merge any existing files, or create any new files.
8459
8460Note that @sc{cvs} will not necessarily produce exactly
8461the same output as without @samp{-n}.  In some cases
8462the output will be the same, but in other cases
8463@sc{cvs} will skip some of the processing that would
8464have been required to produce the exact same output.
8465
8466@item -Q
8467Cause the command to be really quiet; the command will only
8468generate output for serious problems.
8469
8470@item -q
8471Cause the command to be somewhat quiet; informational messages,
8472such as reports of recursion through subdirectories, are
8473suppressed.
8474
8475@cindex Read-only files, and -r
8476@item -r
8477Make new working files read-only.  Same effect
8478as if the @code{$CVSREAD} environment variable is set
8479(@pxref{Environment variables}).  The default is to
8480make working files writable, unless watches are on
8481(@pxref{Watches}).
8482
8483@item -s @var{variable}=@var{value}
8484Set a user variable (@pxref{Variables}).
8485
8486@cindex Trace
8487@item -t
8488Trace program execution; display messages showing the steps of
8489@sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
8490potential impact of an unfamiliar command.
8491
8492@item -v
8493@item --version
8494Display version and copyright information for @sc{cvs}.
8495
8496@cindex CVSREAD, overriding
8497@cindex Overriding CVSREAD
8498@item -w
8499Make new working files read-write.  Overrides the
8500setting of the @code{$CVSREAD} environment variable.
8501Files are created read-write by default, unless @code{$CVSREAD} is
8502set or @samp{-r} is given.
8503@c Note that -w only overrides -r and CVSREAD; it has
8504@c no effect on files which are readonly because of
8505@c "cvs watch on".  My guess is that is the way it
8506@c should be (or should "cvs -w get" on a watched file
8507@c be the same as a get and a cvs edit?), but I'm not
8508@c completely sure whether to document it this way.
8509
8510@item -x
8511@cindex Encryption
8512Encrypt all communication between the client and the
8513server.  Only has an effect on the @sc{cvs} client.  As
8514of this writing, this is only implemented when using a
8515GSSAPI connection (@pxref{GSSAPI authenticated}) or a
8516Kerberos connection (@pxref{Kerberos authenticated}).
8517Enabling encryption implies that message traffic is
8518also authenticated.  Encryption support is not
8519available by default; it must be enabled using a
8520special configure option, @file{--enable-encryption},
8521when you build @sc{cvs}.
8522
8523@item -z @var{level}
8524@cindex Compression
8525@cindex Gzip
8526Request compression @var{level} for network traffic.
8527@sc{cvs} interprets @var{level} identically to the @code{gzip} program.
8528Valid levels are 1 (high speed, low compression) to
85299 (low speed, high compression), or 0 to disable
8530compression (the default).  Data sent to the server will
8531be compressed at the requested level and the client will request
8532the server use the same compression level for data returned.  The
8533server will use the closest level allowed by the server administrator to
8534compress returned data.  This option only has an effect when passed to
8535the @sc{cvs} client.
8536@end table
8537
8538@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8539@node Common options
8540@appendixsec Common command options
8541@cindex Common options
8542@cindex Right-hand options
8543
8544This section describes the @samp{command_options} that
8545are available across several @sc{cvs} commands.  These
8546options are always given to the right of
8547@samp{cvs_command}. Not all
8548commands support all of these options; each option is
8549only supported for commands where it makes sense.
8550However, when a command has one of these options you
8551can almost always count on the same behavior of the
8552option as in other commands.  (Other command options,
8553which are listed with the individual commands, may have
8554different behavior from one @sc{cvs} command to the other).
8555
8556@emph{Note: the @samp{history} command is an exception; it supports
8557many options that conflict even with these standard options.}
8558
8559@table @code
8560@cindex Dates
8561@cindex Time
8562@cindex Specifying dates
8563@item -D @var{date_spec}
8564Use the most recent revision no later than @var{date_spec}.
8565@var{date_spec} is a single argument, a date description
8566specifying a date in the past.
8567
8568The specification is @dfn{sticky} when you use it to make a
8569private copy of a source file; that is, when you get a working
8570file using @samp{-D}, @sc{cvs} records the date you specified, so that
8571further updates in the same directory will use the same date
8572(for more information on sticky tags/dates, @pxref{Sticky tags}).
8573
8574@samp{-D} is available with the @code{annotate}, @code{checkout},
8575@code{diff}, @code{export}, @code{history}, @code{ls},
8576@code{rdiff}, @code{rls}, @code{rtag}, @code{tag}, and @code{update} commands.
8577(The @code{history} command uses this option in a
8578slightly different way; @pxref{history options}).
8579
8580For a complete description of the date formats accepted by @sc{cvs},
8581@pxref{Date input formats}.
8582@c What other formats should we accept?  I don't want
8583@c to start accepting a whole mess of non-standard
8584@c new formats (there are a lot which are in wide use in
8585@c one context or another), but practicality does
8586@c dictate some level of flexibility.
8587@c * POSIX.2 (e.g. touch, ls output, date) and other
8588@c POSIX and/or de facto unix standards (e.g. at).  The
8589@c practice here is too inconsistent to be of any use.
8590@c * VMS dates.  This is not a formal standard, but
8591@c there is a published specification (see SYS$ASCTIM
8592@c and SYS$BINTIM in the _VMS System Services Reference
8593@c Manual_), it is implemented consistently in VMS
8594@c utilities, and VMS users will expect CVS running on
8595@c VMS to support this format (and if we're going to do
8596@c that, better to make CVS support it on all
8597@c platforms.  Maybe).
8598@c
8599@c One more note: In output, CVS should consistently
8600@c use one date format, and that format should be one that
8601@c it accepts in input as well.  The former isn't
8602@c really true (see survey below), and I'm not
8603@c sure that either of those formats is accepted in
8604@c input.
8605@c
8606@c cvs log
8607@c   current 1996/01/02 13:45:31
8608@c   Internet 02 Jan 1996 13:45:31 UT
8609@c   ISO 1996-01-02 13:45:31
8610@c cvs ann
8611@c   current 02-Jan-96
8612@c   Internet-like 02 Jan 96
8613@c   ISO 96-01-02
8614@c cvs status
8615@c   current Tue Jun 11 02:54:53 1996
8616@c   Internet [Tue,] 11 Jun 1996 02:54:53
8617@c   ISO 1996-06-11 02:54:53
8618@c   note: date possibly should be omitted entirely for
8619@c   other reasons.
8620@c cvs editors
8621@c   current Tue Jun 11 02:54:53 1996 GMT
8622@c cvs history
8623@c   current 06/11 02:54 +0000
8624@c any others?
8625@c There is a good chance the proper solution has to
8626@c involve at least some level of letting the user
8627@c decide which format (with the default being the
8628@c formats CVS has always used; changing these might be
8629@c _very_ disruptive since scripts may very well be
8630@c parsing them).
8631@c
8632@c Another random bit of prior art concerning dates is
8633@c the strptime function which takes templates such as
8634@c "%m/%d/%y", and apparent a variant of getdate()
8635@c which also honors them.  See
8636@c X/Open CAE Specification, System Interfaces and
8637@c Headers Issue 4, Version 2 (September 1994), in the
8638@c entry for getdate() on page 231
8639
8640Remember to quote the argument to the @samp{-D}
8641flag so that your shell doesn't interpret spaces as
8642argument separators.  A command using the @samp{-D}
8643flag can look like this:
8644
8645@example
8646$ cvs diff -D "1 hour ago" cvs.texinfo
8647@end example
8648
8649@cindex Forcing a tag match
8650@item -f
8651When you specify a particular date or tag to @sc{cvs} commands, they
8652normally ignore files that do not contain the tag (or did not
8653exist prior to the date) that you specified.  Use the @samp{-f} option
8654if you want files retrieved even when there is no match for the
8655tag or date.  (The most recent revision of the file
8656will be used).
8657
8658Note that even with @samp{-f}, a tag that you specify
8659must exist (that is, in some file, not necessary in
8660every file).  This is so that @sc{cvs} will continue to
8661give an error if you mistype a tag name.
8662
8663@need 800
8664@samp{-f} is available with these commands:
8665@code{annotate}, @code{checkout}, @code{export},
8666@code{rdiff}, @code{rtag}, and @code{update}.
8667
8668@emph{WARNING:  The @code{commit} and @code{remove}
8669commands also have a
8670@samp{-f} option, but it has a different behavior for
8671those commands.  See @ref{commit options}, and
8672@ref{Removing files}.}
8673
8674@item -k @var{kflag}
8675Override the default processing of RCS keywords other than
8676@samp{-kb}.  @xref{Keyword substitution}, for the meaning of
8677@var{kflag}.  Used with the @code{checkout} and @code{update}
8678commands, your @var{kflag} specification is
8679@dfn{sticky}; that is, when you use this option
8680with a @code{checkout} or @code{update} command,
8681@sc{cvs} associates your selected @var{kflag} with any files
8682it operates on, and continues to use that @var{kflag} with future
8683commands on the same files until you specify otherwise.
8684
8685The @samp{-k} option is available with the @code{add},
8686@code{checkout}, @code{diff}, @code{export}, @code{import},
8687@code{rdiff}, and @code{update} commands.
8688
8689@emph{WARNING: Prior to CVS version 1.12.2, the @samp{-k} flag
8690overrode the @samp{-kb} indication for a binary file.  This could
8691sometimes corrupt binary files.  @xref{Merging and keywords}, for
8692more.}
8693
8694@item -l
8695Local; run only in current working directory, rather than
8696recursing through subdirectories.
8697
8698Available with the following commands: @code{annotate}, @code{checkout},
8699@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8700@code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8701@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8702and @code{watchers}.
8703
8704@cindex Editor, avoiding invocation of
8705@cindex Avoiding editor invocation
8706@item -m @var{message}
8707Use @var{message} as log information, instead of
8708invoking an editor.
8709
8710Available with the following commands: @code{add},
8711@code{commit} and @code{import}.
8712
8713@item -n
8714Do not run any tag program.  (A program can be
8715specified to run in the modules
8716database (@pxref{modules}); this option bypasses it).
8717
8718@emph{Note: this is not the same as the @samp{cvs -n}
8719program option, which you can specify to the left of a cvs command!}
8720
8721Available with the @code{checkout}, @code{commit}, @code{export},
8722and @code{rtag} commands.
8723
8724@item -P
8725Prune empty directories.  See @ref{Removing directories}.
8726
8727@item -p
8728Pipe the files retrieved from the repository to standard output,
8729rather than writing them in the current directory.  Available
8730with the @code{checkout} and @code{update} commands.
8731
8732@item -R
8733Process directories recursively.  This is the default for all @sc{cvs}
8734commands, with the exception of @code{ls} & @code{rls}.
8735
8736Available with the following commands: @code{annotate}, @code{checkout},
8737@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8738@code{ls}, @code{rdiff}, @code{remove}, @code{rls}, @code{rtag},
8739@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8740and @code{watchers}.
8741
8742@item -r @var{tag}
8743@item -r @var{tag}[:@var{date}]
8744@cindex HEAD, special tag
8745@cindex BASE, special tag
8746@cindex BASE, special date
8747Use the revision specified by the @var{tag} argument (and the @var{date}
8748argument for the commands which accept it) instead of the
8749default @dfn{head} revision.  As well as arbitrary tags defined
8750with the @code{tag} or @code{rtag} command, two special tags are
8751always available: @samp{HEAD} refers to the most recent version
8752available in the repository (also known as the tip of the @samp{MAIN}
8753branch, also known as trunk; the name of a branch refers to its tip;
8754this version of @sc{cvs} introduces @samp{.bhead}, but only for the
8755@sc{diff} command, for the same), and @samp{BASE} refers to the
8756revision you last checked out into the current working directory.
8757
8758@c fixed: HEAD is changed now; .bhead is the name of the branch,
8759@c but added for cases where it is unknown.
8760@c --mirabilos
8761@c FIXME: What does HEAD really mean?  I believe that
8762@c the current answer is the head of the default branch
8763@c for all cvs commands except diff.  For diff, it
8764@c seems to be (a) the head of the trunk (or the default
8765@c branch?) if there is no sticky tag, (b) the head of the
8766@c branch for the sticky tag, if there is a sticky tag.
8767@c (b) is ugly as it differs
8768@c from what HEAD means for other commands, but people
8769@c and/or scripts are quite possibly used to it.
8770@c See "head" tests in sanity.sh.
8771@c Probably the best fix is to introduce two new
8772@c special tags, ".thead" for the head of the trunk,
8773@c and ".bhead" for the head of the current branch.
8774@c Then deprecate HEAD.  This has the advantage of
8775@c not surprising people with a change to HEAD, and a
8776@c side benefit of also phasing out the poorly-named
8777@c HEAD (see discussion of reserved tag names in node
8778@c "Tags").  Of course, .thead and .bhead should be
8779@c carefully implemented (with the implementation the
8780@c same for "diff" as for everyone else), test cases
8781@c written (similar to the ones in "head"), new tests
8782@c cases written for things like default branches, &c.
8783
8784The tag specification is sticky when you use this
8785with @code{checkout} or @code{update} to make your own
8786copy of a file: @sc{cvs} remembers the tag and continues to use it on
8787future update commands, until you specify otherwise (for more information
8788on sticky tags/dates, @pxref{Sticky tags}).
8789
8790The tag can be either a symbolic or numeric tag, as
8791described in @ref{Tags}, or the name of a branch, as
8792described in @ref{Branching and merging}.
8793When @var{tag} is the name of a
8794branch, some commands accept the optional @var{date} argument to specify
8795the revision as of the given date on the branch.
8796When a command expects a specific revision,
8797the name of a branch is interpreted as the most recent
8798revision on that branch.
8799
8800As a MirOS @sc{cvs} extension, specifying @samp{BASE} as the @var{date}
8801portion of the argument yields the @emph{base revision} of the branch
8802specified by the @var{tag} portion of the argument, i.e. the revision
8803on the parent branch the @var{tag} branch split off, or, where both
8804branches were the same.
8805This option has not received very much testing, beware!
8806
8807Specifying the @samp{-q} global option along with the
8808@samp{-r} command option is often useful, to suppress
8809the warning messages when the @sc{rcs} file
8810does not contain the specified tag.
8811
8812@emph{Note: this is not the same as the overall @samp{cvs -r} option,
8813which you can specify to the left of a @sc{cvs} command!}
8814
8815@samp{-r @var{tag}} is available with the @code{commit} and @code{history}
8816commands.
8817
8818@samp{-r @var{tag}[:@var{date}]} is available with the @code{annotate},
8819@code{checkout}, @code{diff}, @code{export}, @code{rdiff}, @code{rtag},
8820and @code{update} commands.
8821
8822@item -W
8823Specify file names that should be filtered.  You can
8824use this option repeatedly.  The spec can be a file
8825name pattern of the same type that you can specify in
8826the @file{.cvswrappers} file.
8827Available with the following commands: @code{import},
8828and @code{update}.
8829
8830@end table
8831
8832@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8833@include getdate-cvs.texi
8834
8835@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8836@node admin
8837@appendixsec admin---Administration
8838@cindex Admin (subcommand)
8839
8840@itemize @bullet
8841@item
8842Requires: repository, working directory.
8843@item
8844Changes: repository.
8845@item
8846Synonym: rcs
8847@end itemize
8848
8849This is the @sc{cvs} interface to assorted
8850administrative facilities.  Some of them have
8851questionable usefulness for @sc{cvs} but exist for
8852historical purposes.  Some of the questionable options
8853are likely to disappear in the future.  This command
8854@emph{does} work recursively, so extreme care should be
8855used.
8856
8857@cindex cvsadmin
8858@cindex UserAdminOptions, in CVSROOT/config
8859On unix, if there is a group named @code{cvsadmin},
8860only members of that group can run @code{cvs admin}
8861commands, except for those specified using the
8862@code{UserAdminOptions} configuration option in the
8863@file{CVSROOT/config} file.  Options specified using
8864@code{UserAdminOptions} can be run by any user.  See
8865@ref{config} for more on @code{UserAdminOptions}.
8866
8867The @code{cvsadmin} group should exist on the server,
8868or any system running the non-client/server @sc{cvs}.
8869To disallow @code{cvs admin} for all users, create a
8870group with no users in it.  On NT, the @code{cvsadmin}
8871feature does not exist and all users
8872can run @code{cvs admin}.
8873
8874@menu
8875* admin options::               admin options
8876@end menu
8877
8878@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8879@node admin options
8880@appendixsubsec admin options
8881
8882Some of these options have questionable usefulness for
8883@sc{cvs} but exist for historical purposes.  Some even
8884make it impossible to use @sc{cvs} until you undo the
8885effect!
8886
8887@table @code
8888@item -A@var{oldfile}
8889Might not work together with @sc{cvs}.  Append the
8890access list of @var{oldfile} to the access list of the
8891@sc{rcs} file.
8892
8893@item -a@var{logins}
8894Might not work together with @sc{cvs}.  Append the
8895login names appearing in the comma-separated list
8896@var{logins} to the access list of the @sc{rcs} file.
8897
8898@item -b[@var{rev}]
8899Set the default branch to @var{rev}.  In @sc{cvs}, you
8900normally do not manipulate default branches; sticky
8901tags (@pxref{Sticky tags}) are a better way to decide
8902which branch you want to work on.  There is one reason
8903to run @code{cvs admin -b}: to revert to the vendor's
8904version when using vendor branches (@pxref{Reverting
8905local changes}).
8906There can be no space between @samp{-b} and its argument.
8907@c Hmm, we don't document the usage where rev is
8908@c omitted.  Maybe that usage can/should be deprecated
8909@c (and replaced with -bHEAD or something?) (so we can toss
8910@c the optional argument).  Note that -bHEAD does not
8911@c work, as of 17 Sep 1997, but probably will once "cvs
8912@c admin" is internal to CVS.
8913
8914@cindex Comment leader
8915@item -c@var{string}
8916Sets the comment leader to @var{string}.  The comment
8917leader is not used by current versions of @sc{cvs} or
8918@sc{rcs} 5.7.  Therefore, you can almost surely not
8919worry about it.  @xref{Keyword substitution}.
8920
8921@item -e[@var{logins}]
8922Might not work together with @sc{cvs}.  Erase the login
8923names appearing in the comma-separated list
8924@var{logins} from the access list of the RCS file.  If
8925@var{logins} is omitted, erase the entire access list.
8926There can be no space between @samp{-e} and its argument.
8927
8928@item -I
8929Run interactively, even if the standard input is not a
8930terminal.  This option does not work with the
8931client/server @sc{cvs} and is likely to disappear in
8932a future release of @sc{cvs}.
8933
8934@item -i
8935Useless with @sc{cvs}.  This creates and initializes a
8936new @sc{rcs} file, without depositing a revision.  With
8937@sc{cvs}, add files with the @code{cvs add} command
8938(@pxref{Adding files}).
8939
8940@item -k@var{subst}
8941Set the default keyword
8942substitution to @var{subst}.  @xref{Keyword
8943substitution}.  Giving an explicit @samp{-k} option to
8944@code{cvs update}, @code{cvs export}, or @code{cvs
8945checkout} overrides this default.
8946
8947@item -l[@var{rev}]
8948Lock the revision with number @var{rev}.  If a branch
8949is given, lock the latest revision on that branch.  If
8950@var{rev} is omitted, lock the latest revision on the
8951default branch.  There can be no space between
8952@samp{-l} and its argument.
8953
8954This can be used in conjunction with the
8955@file{rcslock.pl} script in the @file{contrib}
8956directory of the @sc{cvs} source distribution to
8957provide reserved checkouts (where only one user can be
8958editing a given file at a time).  See the comments in
8959that file for details (and see the @file{README} file
8960in that directory for disclaimers about the unsupported
8961nature of contrib).  According to comments in that
8962file, locking must set to strict (which is the default).
8963
8964@item -L
8965Set locking to strict.  Strict locking means that the
8966owner of an RCS file is not exempt from locking for
8967checkin.  For use with @sc{cvs}, strict locking must be
8968set; see the discussion under the @samp{-l} option above.
8969
8970@cindex Changing a log message
8971@cindex Replacing a log message
8972@cindex Correcting a log message
8973@cindex Fixing a log message
8974@cindex Log message, correcting
8975@item -m@var{rev}:@var{msg}
8976Replace the log message of revision @var{rev} with
8977@var{msg}.
8978
8979@c The rcs -M option, to suppress sending mail, has never been
8980@c documented as a cvs admin option.
8981
8982@item -N@var{name}[:[@var{rev}]]
8983Act like @samp{-n}, except override any previous
8984assignment of @var{name}.  For use with magic branches,
8985see @ref{Magic branch numbers}.
8986
8987@item -n@var{name}[:[@var{rev}]]
8988Associate the symbolic name @var{name} with the branch
8989or revision @var{rev}.  It is normally better to use
8990@samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8991symbolic name if both @samp{:} and @var{rev} are
8992omitted; otherwise, print an error message if
8993@var{name} is already associated with another number.
8994If @var{rev} is symbolic, it is expanded before
8995association.  A @var{rev} consisting of a branch number
8996followed by a @samp{.} stands for the current latest
8997revision in the branch.  A @samp{:} with an empty
8998@var{rev} stands for the current latest revision on the
8999default branch, normally the trunk.  For example,
9000@samp{cvs admin -n@var{name}:} associates @var{name} with the
9001current latest revision of all the RCS files;
9002this contrasts with @samp{cvs admin -n@var{name}:$} which
9003associates @var{name} with the revision numbers
9004extracted from keyword strings in the corresponding
9005working files.
9006
9007@cindex Deleting revisions
9008@cindex Outdating revisions
9009@cindex Saving space
9010@item -o@var{range}
9011Deletes (@dfn{outdates}) the revisions given by
9012@var{range}.
9013
9014Note that this command can be quite dangerous unless
9015you know @emph{exactly} what you are doing (for example
9016see the warnings below about how the
9017@var{rev1}:@var{rev2} syntax is confusing).
9018
9019If you are short on disc this option might help you.
9020But think twice before using it---there is no way short
9021of restoring the latest backup to undo this command!
9022If you delete different revisions than you planned,
9023either due to carelessness or (heaven forbid) a @sc{cvs}
9024bug, there is no opportunity to correct the error
9025before the revisions are deleted.  It probably would be
9026a good idea to experiment on a copy of the repository
9027first.
9028
9029Specify @var{range} in one of the following ways:
9030
9031@table @code
9032@item @var{rev1}::@var{rev2}
9033Collapse all revisions between rev1 and rev2, so that
9034@sc{cvs} only stores the differences associated with going
9035from rev1 to rev2, not intermediate steps.  For
9036example, after @samp{-o 1.3::1.5} one can retrieve
9037revision 1.3, revision 1.5, or the differences to get
9038from 1.3 to 1.5, but not the revision 1.4, or the
9039differences between 1.3 and 1.4.  Other examples:
9040@samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
9041effect, because there are no intermediate revisions to
9042remove.
9043
9044@item ::@var{rev}
9045Collapse revisions between the beginning of the branch
9046containing @var{rev} and @var{rev} itself.  The
9047branchpoint and @var{rev} are left intact.  For
9048example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
9049revision 1.3.2.5, and everything in between, but leaves
90501.3 and 1.3.2.6 intact.
9051
9052@item @var{rev}::
9053Collapse revisions between @var{rev} and the end of the
9054branch containing @var{rev}.  Revision @var{rev} is
9055left intact but the head revision is deleted.
9056
9057@item @var{rev}
9058Delete the revision @var{rev}.  For example, @samp{-o
90591.3} is equivalent to @samp{-o 1.2::1.4}.
9060
9061@item @var{rev1}:@var{rev2}
9062Delete the revisions from @var{rev1} to @var{rev2},
9063inclusive, on the same branch.  One will not be able to
9064retrieve @var{rev1} or @var{rev2} or any of the
9065revisions in between.  For example, the command
9066@samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
9067It means to delete revisions up to, and including, the
9068tag R_1_02.  But beware!  If there are files that have not
9069changed between R_1_02 and R_1_03 the file will have
9070@emph{the same} numerical revision number assigned to
9071the tags R_1_02 and R_1_03.  So not only will it be
9072impossible to retrieve R_1_02; R_1_03 will also have to
9073be restored from the tapes!  In most cases you want to
9074specify @var{rev1}::@var{rev2} instead.
9075
9076@item :@var{rev}
9077Delete revisions from the beginning of the
9078branch containing @var{rev} up to and including
9079@var{rev}.
9080
9081@item @var{rev}:
9082Delete revisions from revision @var{rev}, including
9083@var{rev} itself, to the end of the branch containing
9084@var{rev}.
9085@end table
9086
9087None of the revisions to be deleted may have
9088branches or locks.
9089
9090If any of the revisions to be deleted have symbolic
9091names, and one specifies one of the @samp{::} syntaxes,
9092then @sc{cvs} will give an error and not delete any
9093revisions.  If you really want to delete both the
9094symbolic names and the revisions, first delete the
9095symbolic names with @code{cvs tag -d}, then run
9096@code{cvs admin -o}.  If one specifies the
9097non-@samp{::} syntaxes, then @sc{cvs} will delete the
9098revisions but leave the symbolic names pointing to
9099nonexistent revisions.  This behavior is preserved for
9100compatibility with previous versions of @sc{cvs}, but
9101because it isn't very useful, in the future it may
9102change to be like the @samp{::} case.
9103
9104Due to the way @sc{cvs} handles branches @var{rev}
9105cannot be specified symbolically if it is a branch.
9106@xref{Magic branch numbers}, for an explanation.
9107@c FIXME: is this still true?  I suspect not.
9108
9109Make sure that no-one has checked out a copy of the
9110revision you outdate.  Strange things will happen if he
9111starts to edit it and tries to check it back in.  For
9112this reason, this option is not a good way to take back
9113a bogus commit; commit a new revision undoing the bogus
9114change instead (@pxref{Merging two revisions}).
9115
9116@item -q
9117Run quietly; do not print diagnostics.
9118
9119@item -s@var{state}[:@var{rev}]
9120Useful with @sc{cvs}.  Set the state attribute of the
9121revision @var{rev} to @var{state}.  If @var{rev} is a
9122branch number, assume the latest revision on that
9123branch.  If @var{rev} is omitted, assume the latest
9124revision on the default branch.  Any identifier is
9125acceptable for @var{state}.  A useful set of states is
9126@samp{Exp} (for experimental), @samp{Stab} (for
9127stable), and @samp{Rel} (for released).  By default,
9128the state of a new revision is set to @samp{Exp} when
9129it is created.  The state is visible in the output from
9130@var{cvs log} (@pxref{log}), and in the
9131@samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
9132(@pxref{Keyword substitution}).  Note that @sc{cvs}
9133uses the @code{dead} state for its own purposes (@pxref{Attic}); to
9134take a file to or from the @code{dead} state use
9135commands like @code{cvs remove} and @code{cvs add}
9136(@pxref{Adding and removing}), not @code{cvs admin -s}.
9137
9138@item -t[@var{file}]
9139Useful with @sc{cvs}.  Write descriptive text from the
9140contents of the named @var{file} into the RCS file,
9141deleting the existing text.  The @var{file} pathname
9142may not begin with @samp{-}.  The descriptive text can be seen in the
9143output from @samp{cvs log} (@pxref{log}).
9144There can be no space between @samp{-t} and its argument.
9145
9146If @var{file} is omitted,
9147obtain the text from standard input, terminated by
9148end-of-file or by a line containing @samp{.} by itself.
9149Prompt for the text if interaction is possible; see
9150@samp{-I}.
9151
9152@item -t-@var{string}
9153Similar to @samp{-t@var{file}}. Write descriptive text
9154from the @var{string} into the @sc{rcs} file, deleting
9155the existing text.
9156There can be no space between @samp{-t} and its argument.
9157
9158@c The rcs -T option, do not update last-mod time for
9159@c minor changes, has never been documented as a
9160@c cvs admin option.
9161
9162@item -U
9163Set locking to non-strict.  Non-strict locking means
9164that the owner of a file need not lock a revision for
9165checkin.  For use with @sc{cvs}, strict locking must be
9166set; see the discussion under the @samp{-l} option
9167above.
9168
9169@item -u[@var{rev}]
9170See the option @samp{-l} above, for a discussion of
9171using this option with @sc{cvs}.  Unlock the revision
9172with number @var{rev}.  If a branch is given, unlock
9173the latest revision on that branch.  If @var{rev} is
9174omitted, remove the latest lock held by the caller.
9175Normally, only the locker of a revision may unlock it;
9176somebody else unlocking a revision breaks the lock.
9177This causes the original locker to be sent a @code{commit}
9178notification (@pxref{Getting Notified}).
9179There can be no space between @samp{-u} and its argument.
9180
9181@item -V@var{n}
9182In previous versions of @sc{cvs}, this option meant to
9183write an @sc{rcs} file which would be acceptable to
9184@sc{rcs} version @var{n}, but it is now obsolete and
9185specifying it will produce an error.
9186@c Note that -V without an argument has never been
9187@c documented as a cvs admin option.
9188
9189@item -x@var{suffixes}
9190In previous versions of @sc{cvs}, this was documented
9191as a way of specifying the names of the @sc{rcs}
9192files.  However, @sc{cvs} has always required that the
9193@sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
9194this option has never done anything useful.
9195
9196@c The rcs -z option, to specify the timezone, has
9197@c never been documented as a cvs admin option.
9198@end table
9199
9200@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9201@node annotate
9202@appendixsec annotate---What revision modified each line of a file?
9203@cindex annotate (subcommand)
9204
9205@itemize @bullet
9206@item
9207Synopsis: annotate [options] files@dots{}
9208@item
9209Requires: repository.
9210@item
9211Changes: nothing.
9212@end itemize
9213
9214For each file in @var{files}, print the head revision
9215of the trunk, together with information on the last
9216modification for each line.  If backwards annotation
9217is requested, show the first modification after the
9218specified revision.  (Backwards annotation currently
9219appears to be broken.)
9220
9221@menu
9222* annotate options::            annotate options
9223* annotate example::            annotate example
9224@end menu
9225
9226@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9227@node annotate options
9228@appendixsubsec annotate options
9229
9230These standard options are supported by @code{annotate}
9231(@pxref{Common options}, for a complete description of
9232them):
9233
9234@table @code
9235@item -b
9236Backwards, show when a line was removed.
9237Currently appears to be broken.
9238
9239@item -l
9240Local directory only, no recursion.
9241
9242@item -R
9243Process directories recursively.
9244
9245@item -f
9246Use head revision if tag/date not found.
9247
9248@item -F
9249Annotate binary files.
9250
9251@item -r @var{tag}[:@var{date}]
9252Annotate file as of specified revision/tag or, when @var{date} is specified
9253and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9254existed on @var{date}.  See @ref{Common options}.
9255
9256@item -D @var{date}
9257Annotate file as of specified date.
9258@end table
9259
9260@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9261@node annotate example
9262@appendixsubsec annotate example
9263
9264For example:
9265
9266@example
9267$ cvs annotate ssfile
9268Annotations for ssfile
9269***************
92701.1          (mary     27-Mar-96): ssfile line 1
92711.2          (joe      28-Mar-96): ssfile line 2
9272@end example
9273
9274The file @file{ssfile} currently contains two lines.
9275The @code{ssfile line 1} line was checked in by
9276@code{mary} on March 27.  Then, on March 28, @code{joe}
9277added a line @code{ssfile line 2}, without modifying
9278the @code{ssfile line 1} line.  This report doesn't
9279tell you anything about lines which have been deleted
9280or replaced; you need to use @code{cvs diff} for that
9281(@pxref{diff}).
9282
9283The options to @code{cvs annotate} are listed in
9284@ref{Invoking CVS}, and can be used to select the files
9285and revisions to annotate.  The options are described
9286in more detail there and in @ref{Common options}.
9287
9288@c FIXME: maybe an example using the options?  Just
9289@c what it means to select a revision might be worth a
9290@c few words of explanation ("you want to see who
9291@c changed this line *before* 1.4"...).
9292
9293@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9294@node checkout
9295@appendixsec checkout---Check out sources for editing
9296@cindex checkout (subcommand)
9297@cindex co (subcommand)
9298
9299@itemize @bullet
9300@item
9301Synopsis: checkout [options] modules@dots{}
9302@item
9303Requires: repository.
9304@item
9305Changes: working directory.
9306@item
9307Synonyms: co, get
9308@end itemize
9309
9310Create or update a working directory containing copies of the
9311source files specified by @var{modules}.  You must execute
9312@code{checkout} before using most of the other @sc{cvs}
9313commands, since most of them operate on your working
9314directory.
9315
9316The @var{modules} are either
9317symbolic names for some
9318collection of source directories and files, or paths to
9319directories or files in the repository.  The symbolic
9320names are defined in the @samp{modules} file.
9321@xref{modules}.
9322@c Needs an example, particularly of the non-"modules"
9323@c case but probably of both.
9324
9325@c FIXME: this seems like a very odd place to introduce
9326@c people to how CVS works.  The bit about unreserved
9327@c checkouts is also misleading as it depends on how
9328@c things are set up.
9329Depending on the modules you specify, @code{checkout} may
9330recursively create directories and populate them with
9331the appropriate source files.  You can then edit these
9332source files at any time (regardless of whether other
9333software developers are editing their own copies of the
9334sources); update them to include new changes applied by
9335others to the source repository; or commit your work as
9336a permanent change to the source repository.
9337
9338Note that @code{checkout} is used to create
9339directories.  The top-level directory created is always
9340added to the directory where @code{checkout} is
9341invoked, and usually has the same name as the specified
9342module.  In the case of a module alias, the created
9343sub-directory may have a different name, but you can be
9344sure that it will be a sub-directory, and that
9345@code{checkout} will show the relative path leading to
9346each file as it is extracted into your private work
9347area (unless you specify the @samp{-Q} global option).
9348
9349The files created by @code{checkout} are created
9350read-write, unless the @samp{-r} option to @sc{cvs}
9351(@pxref{Global options}) is specified, the
9352@code{CVSREAD} environment variable is specified
9353(@pxref{Environment variables}), or a watch is in
9354effect for that file (@pxref{Watches}).
9355
9356Note that running @code{checkout} on a directory that was already
9357built by a prior @code{checkout} is also permitted.
9358This is similar to specifying the @samp{-d} option
9359to the @code{update} command in the sense that new
9360directories that have been created in the repository
9361will appear in your work area.
9362However, @code{checkout} takes a module name whereas
9363@code{update} takes a directory name.  Also
9364to use @code{checkout} this way it must be run from the
9365top level directory (where you originally ran
9366@code{checkout} from), so before you run
9367@code{checkout} to update an existing directory, don't
9368forget to change your directory to the top level
9369directory.
9370
9371For the output produced by the @code{checkout} command
9372see @ref{update output}.
9373
9374@menu
9375* checkout options::            checkout options
9376* checkout examples::           checkout examples
9377@end menu
9378
9379@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9380@node checkout options
9381@appendixsubsec checkout options
9382
9383These standard options are supported by @code{checkout}
9384(@pxref{Common options}, for a complete description of
9385them):
9386
9387@table @code
9388@item -D @var{date}
9389Use the most recent revision no later than @var{date}.
9390This option is sticky, and implies @samp{-P}.  See
9391@ref{Sticky tags}, for more information on sticky tags/dates.
9392
9393@item -f
9394Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision is
9395found, retrieve the most recent revision (instead of ignoring the file).
9396
9397@item -k @var{kflag}
9398Process keywords according to @var{kflag}.  See
9399@ref{Keyword substitution}.
9400This option is sticky; future updates of
9401this file in this working directory will use the same
9402@var{kflag}.  The @code{status} command can be viewed
9403to see the sticky options.  See @ref{Invoking CVS}, for
9404more information on the @code{status} command.
9405
9406@item -l
9407Local; run only in current working directory.
9408
9409@item -n
9410Do not run any checkout program (as specified
9411with the @samp{-o} option in the modules file;
9412@pxref{modules}).
9413
9414@item -P
9415Prune empty directories.  See @ref{Moving directories}.
9416
9417@item -p
9418Pipe files to the standard output.
9419
9420@item -R
9421Checkout directories recursively.  This option is on by default.
9422
9423@item -r @var{tag}[:@var{date}]
9424Checkout the revision specified by @var{tag} or, when @var{date} is specified
9425and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9426existed on @var{date}.  This option is sticky, and implies @samp{-P}.
9427See @ref{Sticky tags}, for more information on sticky tags/dates.  Also,
9428see @ref{Common options}.
9429@end table
9430
9431In addition to those, you can use these special command
9432options with @code{checkout}:
9433
9434@table @code
9435@item -A
9436Reset any sticky tags, dates, or @samp{-k} options.
9437See @ref{Sticky tags}, for more information on sticky tags/dates.
9438
9439@item -c
9440Copy the module file, sorted, to the standard output,
9441instead of creating or modifying any files or
9442directories in your working directory.
9443
9444@item -d @var{dir}
9445Create a directory called @var{dir} for the working
9446files, instead of using the module name.  In general,
9447using this flag is equivalent to using @samp{mkdir
9448@var{dir}; cd @var{dir}} followed by the checkout
9449command without the @samp{-d} flag.
9450
9451There is an important exception, however.  It is very
9452convenient when checking out a single item to have the
9453output appear in a directory that doesn't contain empty
9454intermediate directories.  In this case @emph{only},
9455@sc{cvs} tries to ``shorten'' pathnames to avoid those empty
9456directories.
9457
9458For example, given a module @samp{foo} that contains
9459the file @samp{bar.c}, the command @samp{cvs co -d dir
9460foo} will create directory @samp{dir} and place
9461@samp{bar.c} inside.  Similarly, given a module
9462@samp{bar} which has subdirectory @samp{baz} wherein
9463there is a file @samp{quux.c}, the command @samp{cvs co
9464-d dir bar/baz} will create directory @samp{dir} and
9465place @samp{quux.c} inside.
9466
9467Using the @samp{-N} flag will defeat this behavior.
9468Given the same module definitions above, @samp{cvs co
9469-N -d dir foo} will create directories @samp{dir/foo}
9470and place @samp{bar.c} inside, while @samp{cvs co -N -d
9471dir bar/baz} will create directories @samp{dir/bar/baz}
9472and place @samp{quux.c} inside.
9473
9474@item -j @var{tag}
9475With two @samp{-j} options, merge changes from the
9476revision specified with the first @samp{-j} option to
9477the revision specified with the second @samp{j} option,
9478into the working directory.
9479
9480With one @samp{-j} option, merge changes from the
9481ancestor revision to the revision specified with the
9482@samp{-j} option, into the working directory.  The
9483ancestor revision is the common ancestor of the
9484revision which the working directory is based on, and
9485the revision specified in the @samp{-j} option.
9486
9487In addition, each -j option can contain an optional
9488date specification which, when used with branches, can
9489limit the chosen revision to one within a specific
9490date.  An optional date is specified by adding a colon
9491(:) to the tag:
9492@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
9493
9494@xref{Branching and merging}.
9495
9496@item -N
9497Only useful together with @samp{-d @var{dir}}.  With
9498this option, @sc{cvs} will not ``shorten'' module paths
9499in your working directory when you check out a single
9500module.  See the @samp{-d} flag for examples and a
9501discussion.
9502
9503@item -s
9504Like @samp{-c}, but include the status of all modules,
9505and sort it by the status string.  @xref{modules}, for
9506info about the @samp{-s} option that is used inside the
9507modules file to set the module status.
9508@end table
9509
9510@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9511@node checkout examples
9512@appendixsubsec checkout examples
9513
9514Get a copy of the module @samp{tc}:
9515
9516@example
9517$ cvs checkout tc
9518@end example
9519
9520Get a copy of the module @samp{tc} as it looked one day
9521ago:
9522
9523@example
9524$ cvs checkout -D yesterday tc
9525@end example
9526
9527@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9528@node commit
9529@appendixsec commit---Check files into the repository
9530@cindex commit (subcommand)
9531
9532@itemize @bullet
9533@item
9534Synopsis: commit [-lnRf] [-m 'log_message' |
9535-F file] [-r revision] [files@dots{}]
9536@item
9537Requires: working directory, repository.
9538@item
9539Changes: repository.
9540@item
9541Synonym: ci
9542@end itemize
9543
9544Use @code{commit} when you want to incorporate changes
9545from your working source files into the source
9546repository.
9547
9548If you don't specify particular files to commit, all of
9549the files in your working current directory are
9550examined.  @code{commit} is careful to change in the
9551repository only those files that you have really
9552changed.  By default (or if you explicitly specify the
9553@samp{-R} option), files in subdirectories are also
9554examined and committed if they have changed; you can
9555use the @samp{-l} option to limit @code{commit} to the
9556current directory only.
9557
9558@code{commit} verifies that the selected files are up
9559to date with the current revisions in the source
9560repository; it will notify you, and exit without
9561committing, if any of the specified files must be made
9562current first with @code{update} (@pxref{update}).
9563@code{commit} does not call the @code{update} command
9564for you, but rather leaves that for you to do when the
9565time is right.
9566
9567When all is well, an editor is invoked to allow you to
9568enter a log message that will be written to one or more
9569logging programs (@pxref{modules}, and @pxref{loginfo})
9570and placed in the @sc{rcs} file inside the
9571repository.  This log message can be retrieved with the
9572@code{log} command; see @ref{log}.  You can specify the
9573log message on the command line with the @samp{-m
9574@var{message}} option, and thus avoid the editor invocation,
9575or use the @samp{-F @var{file}} option to specify
9576that the argument file contains the log message.
9577
9578At @code{commit}, a unique commitid is placed in the @sc{rcs}
9579file inside the repository. All files committed at once
9580get the same commitid, a string consisting only of hexadecimal
9581digits (usually 16 in GNU @sc{cvs}, 19 in MirBSD and MirDebian GNU @sc{cvs}).
9582FSF GNU @sc{cvs} 1.11, MirOS GNU @sc{cvs} 1.11, and OpenBSD OpenCVS do not
9583support commitids yet.
9584The commitid can be retrieved with
9585the @code{log} and @code{status} command; see @ref{log} and
9586@ref{File status}.
9587
9588@menu
9589* commit options::              commit options
9590* commit examples::             commit examples
9591@end menu
9592
9593@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9594@node commit options
9595@appendixsubsec commit options
9596
9597These standard options are supported by @code{commit}
9598(@pxref{Common options}, for a complete description of
9599them):
9600
9601@table @code
9602@item -l
9603Local; run only in current working directory.
9604
9605@item -R
9606Commit directories recursively.  This is on by default.
9607
9608@item -r @var{revision}
9609Commit to @var{revision}.  @var{revision} must be
9610either a branch, or a revision on the main trunk that
9611is higher than any existing revision number
9612(@pxref{Assigning revisions}).  You
9613cannot commit to a specific revision on a branch.
9614@c FIXME: Need xref for branch case.
9615@end table
9616
9617@code{commit} also supports these options:
9618
9619@table @code
9620@item -c
9621Refuse to commit files unless the user has registered a valid edit on the
9622file via @code{cvs edit}.  This is most useful when @samp{commit -c}
9623and @samp{edit -c} have been placed in all @file{.cvsrc} files.
9624A commit can be forced anyways by either regestering an edit retroactively
9625via @code{cvs edit} (no changes to the file will be lost) or using the
9626@code{-f} option to commit.  Support for @code{commit -c} requires both
9627client and a server versions 1.12.10 or greater.
9628
9629@item -F @var{file}
9630Read the log message from @var{file}, instead
9631of invoking an editor.
9632
9633@item -f
9634Note that this is not the standard behavior of
9635the @samp{-f} option as defined in @ref{Common options}.
9636
9637Force @sc{cvs} to commit a new revision even if you haven't
9638made any changes to the file.  As of @sc{cvs} version 1.12.10,
9639it also causes the @code{-c} option to be ignored.  If the current revision
9640of @var{file} is 1.7, then the following two commands
9641are equivalent:
9642
9643@example
9644$ cvs commit -f @var{file}
9645$ cvs commit -r 1.8 @var{file}
9646@end example
9647
9648@c This is odd, but it's how CVS has worked for some
9649@c time.
9650The @samp{-f} option disables recursion (i.e., it
9651implies @samp{-l}).  To force @sc{cvs} to commit a new
9652revision for all files in all subdirectories, you must
9653use @samp{-f -R}.
9654
9655@item -m @var{message}
9656Use @var{message} as the log message, instead of
9657invoking an editor.
9658@end table
9659
9660@need 2000
9661@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9662@node commit examples
9663@appendixsubsec commit examples
9664
9665@c FIXME: this material wants to be somewhere
9666@c in "Branching and merging".
9667
9668@appendixsubsubsec Committing to a branch
9669
9670You can commit to a branch revision (one that has an
9671even number of dots) with the @samp{-r} option.  To
9672create a branch revision, use the @samp{-b} option
9673of the @code{rtag} or @code{tag} commands
9674(@pxref{Branching and merging}).  Then, either @code{checkout} or
9675@code{update} can be used to base your sources on the
9676newly created branch.  From that point on, all
9677@code{commit} changes made within these working sources
9678will be automatically added to a branch revision,
9679thereby not disturbing main-line development in any
9680way.  For example, if you had to create a patch to the
96811.2 version of the product, even though the 2.0 version
9682is already under development, you might do:
9683
9684@example
9685$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9686$ cvs checkout -r FCS1_2_Patch product_module
9687$ cd product_module
9688[[ hack away ]]
9689$ cvs commit
9690@end example
9691
9692@noindent
9693This works automatically since the @samp{-r} option is
9694sticky.
9695
9696@appendixsubsubsec Creating the branch after editing
9697
9698Say you have been working on some extremely
9699experimental software, based on whatever revision you
9700happened to checkout last week.  If others in your
9701group would like to work on this software with you, but
9702without disturbing main-line development, you could
9703commit your change to a new branch.  Others can then
9704checkout your experimental stuff and utilize the full
9705benefit of @sc{cvs} conflict resolution.  The scenario might
9706look like:
9707
9708@c FIXME: Should we be recommending tagging the branchpoint?
9709@example
9710[[ hacked sources are present ]]
9711$ cvs tag -b EXPR1
9712$ cvs update -r EXPR1
9713$ cvs commit
9714@end example
9715
9716The @code{update} command will make the @samp{-r
9717EXPR1} option sticky on all files.  Note that your
9718changes to the files will never be removed by the
9719@code{update} command.  The @code{commit} will
9720automatically commit to the correct branch, because the
9721@samp{-r} is sticky.  You could also do like this:
9722
9723@c FIXME: Should we be recommending tagging the branchpoint?
9724@example
9725[[ hacked sources are present ]]
9726$ cvs tag -b EXPR1
9727$ cvs commit -r EXPR1
9728@end example
9729
9730@noindent
9731but then, only those files that were changed by you
9732will have the @samp{-r EXPR1} sticky flag.  If you hack
9733away, and commit without specifying the @samp{-r EXPR1}
9734flag, some files may accidentally end up on the main
9735trunk.
9736
9737To work with you on the experimental change, others
9738would simply do
9739
9740@example
9741$ cvs checkout -r EXPR1 whatever_module
9742@end example
9743
9744@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9745@node diff
9746@appendixsec diff---Show differences between revisions
9747@cindex diff (subcommand)
9748
9749@itemize @bullet
9750@item
9751Synopsis: diff [-lR] [-k kflag] [format_options] [(-r rev1[:date1] | -D date1) [-r rev2[:date2] | -D date2]] [files@dots{}]
9752@item
9753Requires: working directory, repository.
9754@item
9755Changes: nothing.
9756@end itemize
9757
9758The @code{diff} command is used to compare different
9759revisions of files.  The default action is to compare
9760your working files with the revisions they were based
9761on, and report any differences that are found.
9762
9763If any file names are given, only those files are
9764compared.  If any directories are given, all files
9765under them will be compared.
9766
9767The exit status for diff is different than for other
9768@sc{cvs} commands; for details @pxref{Exit status}.
9769
9770@menu
9771* diff options::                diff options
9772* diff examples::               diff examples
9773@end menu
9774
9775@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9776@node diff options
9777@appendixsubsec diff options
9778
9779These standard options are supported by @code{diff}
9780(@pxref{Common options}, for a complete description of
9781them):
9782
9783@table @code
9784@item -D @var{date}
9785Use the most recent revision no later than @var{date}.
9786See @samp{-r} for how this affects the comparison.
9787
9788@item -k @var{kflag}
9789Process keywords according to @var{kflag}.  See
9790@ref{Keyword substitution}.
9791
9792@item -l
9793Local; run only in current working directory.
9794
9795@item -R
9796Examine directories recursively.  This option is on by
9797default.
9798
9799@item -r @var{tag}[:@var{date}]
9800Compare with revision specified by @var{tag} or, when @var{date} is specified
9801and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9802existed on @var{date}.  Zero, one or two
9803@samp{-r} options can be present.  With no @samp{-r}
9804option, the working file will be compared with the
9805revision it was based on.  With one @samp{-r}, that
9806revision will be compared to your current working file.
9807With two @samp{-r} options those two revisions will be
9808compared (and your working file will not affect the
9809outcome in any way).
9810@c We should be a lot more explicit, with examples,
9811@c about the difference between "cvs diff" and "cvs
9812@c diff -r HEAD".  This often confuses new users.
9813
9814One or both @samp{-r} options can be replaced by a
9815@samp{-D @var{date}} option, described above.
9816@end table
9817
9818@c Conceptually, this is a disaster.  There are 3
9819@c zillion diff formats that we support via the diff
9820@c library.  It is not obvious to me that we should
9821@c document them all.  Maybe just the most common ones
9822@c like -c and -u, and think about phasing out the
9823@c obscure ones.
9824@c FIXCVS: also should be a way to specify an external
9825@c diff program (which can be different for different
9826@c file types) and pass through
9827@c arbitrary options, so that the user can do
9828@c "--pass=-Z --pass=foo" or something even if CVS
9829@c doesn't know about the "-Z foo" option to diff.
9830@c This would fit nicely with deprecating/eliminating
9831@c the obscure options of the diff library, because it
9832@c would let people specify an external GNU diff if
9833@c they are into that sort of thing.
9834The following options specify the format of the
9835output.  They have the same meaning as in GNU diff.
9836Most options have two equivalent names, one of which is a single letter
9837preceded by @samp{-}, and the other of which is a long name preceded by
9838@samp{--}.
9839
9840@table @samp
9841@item -@var{lines}
9842Show @var{lines} (an integer) lines of context.  This option does not
9843specify an output format by itself; it has no effect unless it is
9844combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9845operation, @code{patch} typically needs at least two lines of context.
9846
9847@item -a
9848Treat all files as text and compare them line-by-line, even if they
9849do not seem to be text.
9850
9851@item -b
9852Ignore trailing white space and consider all other sequences of one or
9853more white space characters to be equivalent.
9854
9855@item -B
9856Ignore changes that just insert or delete blank lines.
9857
9858@item --binary
9859Read and write data in binary mode.
9860
9861@item --brief
9862Report only whether the files differ, not the details of the
9863differences.
9864
9865@item -c
9866Use the context output format.
9867
9868@item -C @var{lines}
9869@itemx --context@r{[}=@var{lines}@r{]}
9870Use the context output format, showing @var{lines} (an integer) lines of
9871context, or three if @var{lines} is not given.
9872For proper operation, @code{patch} typically needs at least two lines of
9873context.
9874
9875@item --changed-group-format=@var{format}
9876Use @var{format} to output a line group containing differing lines from
9877both files in if-then-else format.  @xref{Line group formats}.
9878
9879@item -d
9880Change the algorithm to perhaps find a smaller set of changes.  This makes
9881@code{diff} slower (sometimes much slower).
9882
9883@item -e
9884@itemx --ed
9885Make output that is a valid @code{ed} script.
9886
9887@item --expand-tabs
9888Expand tabs to spaces in the output, to preserve the alignment of tabs
9889in the input files.
9890
9891@item -f
9892Make output that looks vaguely like an @code{ed} script but has changes
9893in the order they appear in the file.
9894
9895@item -F @var{regexp}
9896In context and unified format, for each hunk of differences, show some
9897of the last preceding line that matches @var{regexp}.
9898
9899@item --forward-ed
9900Make output that looks vaguely like an @code{ed} script but has changes
9901in the order they appear in the file.
9902
9903@item -H
9904Use heuristics to speed handling of large files that have numerous
9905scattered small changes.
9906
9907@item --horizon-lines=@var{lines}
9908Do not discard the last @var{lines} lines of the common prefix
9909and the first @var{lines} lines of the common suffix.
9910
9911@item -i
9912Ignore changes in case; consider upper- and lower-case letters
9913equivalent.
9914
9915@item -I @var{regexp}
9916Ignore changes that just insert or delete lines that match @var{regexp}.
9917
9918@item --ifdef=@var{name}
9919Make merged if-then-else output using @var{name}.
9920
9921@item --ignore-all-space
9922Ignore white space when comparing lines.
9923
9924@item --ignore-blank-lines
9925Ignore changes that just insert or delete blank lines.
9926
9927@item --ignore-case
9928Ignore changes in case; consider upper- and lower-case to be the same.
9929
9930@item --ignore-matching-lines=@var{regexp}
9931Ignore changes that just insert or delete lines that match @var{regexp}.
9932
9933@item --ignore-space-change
9934Ignore trailing white space and consider all other sequences of one or
9935more white space characters to be equivalent.
9936
9937@item --initial-tab
9938Output a tab rather than a space before the text of a line in normal or
9939context format.  This causes the alignment of tabs in the line to look
9940normal.
9941
9942@item -L @var{label}
9943Use @var{label} instead of the file name in the context format
9944and unified format headers.
9945
9946@item --label=@var{label}
9947Use @var{label} instead of the file name in the context format
9948and unified format headers.
9949
9950@item --left-column
9951Print only the left column of two common lines in side by side format.
9952
9953@item --line-format=@var{format}
9954Use @var{format} to output all input lines in if-then-else format.
9955@xref{Line formats}.
9956
9957@item --minimal
9958Change the algorithm to perhaps find a smaller set of changes.  This
9959makes @code{diff} slower (sometimes much slower).
9960
9961@item -n
9962Output RCS-format diffs; like @samp{-f} except that each command
9963specifies the number of lines affected.
9964
9965@item -N
9966@itemx --new-file
9967In directory comparison, if a file is found in only one directory,
9968treat it as present but empty in the other directory.
9969
9970@item --new-group-format=@var{format}
9971Use @var{format} to output a group of lines taken from just the second
9972file in if-then-else format.  @xref{Line group formats}.
9973
9974@item --new-line-format=@var{format}
9975Use @var{format} to output a line taken from just the second file in
9976if-then-else format.  @xref{Line formats}.
9977
9978@item --old-group-format=@var{format}
9979Use @var{format} to output a group of lines taken from just the first
9980file in if-then-else format.  @xref{Line group formats}.
9981
9982@item --old-line-format=@var{format}
9983Use @var{format} to output a line taken from just the first file in
9984if-then-else format.  @xref{Line formats}.
9985
9986@item -p
9987Show which C function each change is in.
9988
9989@item --rcs
9990Output RCS-format diffs; like @samp{-f} except that each command
9991specifies the number of lines affected.
9992
9993@item --report-identical-files
9994@itemx -s
9995Report when two files are the same.
9996
9997@item --show-c-function
9998Show which C function each change is in.
9999
10000@item --show-function-line=@var{regexp}
10001In context and unified format, for each hunk of differences, show some
10002of the last preceding line that matches @var{regexp}.
10003
10004@item --side-by-side
10005Use the side by side output format.
10006
10007@item --speed-large-files
10008Use heuristics to speed handling of large files that have numerous
10009scattered small changes.
10010
10011@item --suppress-common-lines
10012Do not print common lines in side by side format.
10013
10014@item -t
10015Expand tabs to spaces in the output, to preserve the alignment of tabs
10016in the input files.
10017
10018@item -T
10019Output a tab rather than a space before the text of a line in normal or
10020context format.  This causes the alignment of tabs in the line to look
10021normal.
10022
10023@item --text
10024Treat all files as text and compare them line-by-line, even if they
10025do not appear to be text.
10026
10027@item -u
10028Use the unified output format.
10029
10030@item --unchanged-group-format=@var{format}
10031Use @var{format} to output a group of common lines taken from both files
10032in if-then-else format.  @xref{Line group formats}.
10033
10034@item --unchanged-line-format=@var{format}
10035Use @var{format} to output a line common to both files in if-then-else
10036format.  @xref{Line formats}.
10037
10038@item -U @var{lines}
10039@itemx --unified@r{[}=@var{lines}@r{]}
10040Use the unified output format, showing @var{lines} (an integer) lines of
10041context, or three if @var{lines} is not given.
10042For proper operation, @code{patch} typically needs at least two lines of
10043context.
10044
10045@item -w
10046Ignore white space when comparing lines.
10047
10048@item -W @var{columns}
10049@itemx --width=@var{columns}
10050Use an output width of @var{columns} in side by side format.
10051
10052@item -y
10053Use the side by side output format.
10054@end table
10055
10056@menu
10057* Line group formats::          Line group formats
10058* Line formats::                Line formats
10059@end menu
10060
10061@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10062@node Line group formats
10063@appendixsubsubsec Line group formats
10064
10065Line group formats let you specify formats suitable for many
10066applications that allow if-then-else input, including programming
10067languages and text formatting languages.  A line group format specifies
10068the output format for a contiguous group of similar lines.
10069
10070For example, the following command compares the TeX file @file{myfile}
10071with the original version from the repository,
10072and outputs a merged file in which old regions are
10073surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
10074regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
10075
10076@example
10077cvs diff \
10078   --old-group-format='\begin@{em@}
10079%<\end@{em@}
10080' \
10081   --new-group-format='\begin@{bf@}
10082%>\end@{bf@}
10083' \
10084   myfile
10085@end example
10086
10087The following command is equivalent to the above example, but it is a
10088little more verbose, because it spells out the default line group formats.
10089
10090@example
10091cvs diff \
10092   --old-group-format='\begin@{em@}
10093%<\end@{em@}
10094' \
10095   --new-group-format='\begin@{bf@}
10096%>\end@{bf@}
10097' \
10098   --unchanged-group-format='%=' \
10099   --changed-group-format='\begin@{em@}
10100%<\end@{em@}
10101\begin@{bf@}
10102%>\end@{bf@}
10103' \
10104   myfile
10105@end example
10106
10107Here is a more advanced example, which outputs a diff listing with
10108headers containing line numbers in a ``plain English'' style.
10109
10110@example
10111cvs diff \
10112   --unchanged-group-format='' \
10113   --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
10114%<' \
10115   --new-group-format='-------- %dN line%(N=1?:s) added after %de:
10116%>' \
10117   --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
10118%<-------- to:
10119%>' \
10120   myfile
10121@end example
10122
10123To specify a line group format, use one of the options
10124listed below.  You can specify up to four line group formats, one for
10125each kind of line group.  You should quote @var{format}, because it
10126typically contains shell metacharacters.
10127
10128@table @samp
10129@item --old-group-format=@var{format}
10130These line groups are hunks containing only lines from the first file.
10131The default old group format is the same as the changed group format if
10132it is specified; otherwise it is a format that outputs the line group as-is.
10133
10134@item --new-group-format=@var{format}
10135These line groups are hunks containing only lines from the second
10136file.  The default new group format is same as the changed group
10137format if it is specified; otherwise it is a format that outputs the
10138line group as-is.
10139
10140@item --changed-group-format=@var{format}
10141These line groups are hunks containing lines from both files.  The
10142default changed group format is the concatenation of the old and new
10143group formats.
10144
10145@item --unchanged-group-format=@var{format}
10146These line groups contain lines common to both files.  The default
10147unchanged group format is a format that outputs the line group as-is.
10148@end table
10149
10150In a line group format, ordinary characters represent themselves;
10151conversion specifications start with @samp{%} and have one of the
10152following forms.
10153
10154@table @samp
10155@item %<
10156stands for the lines from the first file, including the trailing newline.
10157Each line is formatted according to the old line format (@pxref{Line formats}).
10158
10159@item %>
10160stands for the lines from the second file, including the trailing newline.
10161Each line is formatted according to the new line format.
10162
10163@item %=
10164stands for the lines common to both files, including the trailing newline.
10165Each line is formatted according to the unchanged line format.
10166
10167@item %%
10168stands for @samp{%}.
10169
10170@item %c'@var{C}'
10171where @var{C} is a single character, stands for @var{C}.
10172@var{C} may not be a backslash or an apostrophe.
10173For example, @samp{%c':'} stands for a colon, even inside
10174the then-part of an if-then-else format, which a colon would
10175normally terminate.
10176
10177@item %c'\@var{O}'
10178where @var{O} is a string of 1, 2, or 3 octal digits,
10179stands for the character with octal code @var{O}.
10180For example, @samp{%c'\0'} stands for a null character.
10181
10182@item @var{F}@var{n}
10183where @var{F} is a @code{printf} conversion specification and @var{n} is one
10184of the following letters, stands for @var{n}'s value formatted with @var{F}.
10185
10186@table @samp
10187@item e
10188The line number of the line just before the group in the old file.
10189
10190@item f
10191The line number of the first line in the group in the old file;
10192equals @var{e} + 1.
10193
10194@item l
10195The line number of the last line in the group in the old file.
10196
10197@item m
10198The line number of the line just after the group in the old file;
10199equals @var{l} + 1.
10200
10201@item n
10202The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
10203
10204@item E, F, L, M, N
10205Likewise, for lines in the new file.
10206
10207@end table
10208
10209The @code{printf} conversion specification can be @samp{%d},
10210@samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
10211lower case hexadecimal, or upper case hexadecimal output
10212respectively.  After the @samp{%} the following options can appear in
10213sequence: a @samp{-} specifying left-justification; an integer
10214specifying the minimum field width; and a period followed by an
10215optional integer specifying the minimum number of digits.
10216For example, @samp{%5dN} prints the number of new lines in the group
10217in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
10218
10219@item (@var{A}=@var{B}?@var{T}:@var{E})
10220If @var{A} equals @var{B} then @var{T} else @var{E}.
10221@var{A} and @var{B} are each either a decimal constant
10222or a single letter interpreted as above.
10223This format spec is equivalent to @var{T} if
10224@var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
10225
10226For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
10227@samp{no lines} if @var{N} (the number of lines in the group in the
10228new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
10229otherwise.
10230@end table
10231
10232@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10233@node Line formats
10234@appendixsubsubsec Line formats
10235
10236Line formats control how each line taken from an input file is
10237output as part of a line group in if-then-else format.
10238
10239For example, the following command outputs text with a one-column
10240change indicator to the left of the text.  The first column of output
10241is @samp{-} for deleted lines, @samp{|} for added lines, and a space
10242for unchanged lines.  The formats contain newline characters where
10243newlines are desired on output.
10244
10245@example
10246cvs diff \
10247   --old-line-format='-%l
10248' \
10249   --new-line-format='|%l
10250' \
10251   --unchanged-line-format=' %l
10252' \
10253   myfile
10254@end example
10255
10256To specify a line format, use one of the following options.  You should
10257quote @var{format}, since it often contains shell metacharacters.
10258
10259@table @samp
10260@item --old-line-format=@var{format}
10261formats lines just from the first file.
10262
10263@item --new-line-format=@var{format}
10264formats lines just from the second file.
10265
10266@item --unchanged-line-format=@var{format}
10267formats lines common to both files.
10268
10269@item --line-format=@var{format}
10270formats all lines; in effect, it sets all three above options simultaneously.
10271@end table
10272
10273In a line format, ordinary characters represent themselves;
10274conversion specifications start with @samp{%} and have one of the
10275following forms.
10276
10277@table @samp
10278@item %l
10279stands for the contents of the line, not counting its trailing
10280newline (if any).  This format ignores whether the line is incomplete.
10281
10282@item %L
10283stands for the contents of the line, including its trailing newline
10284(if any).  If a line is incomplete, this format preserves its
10285incompleteness.
10286
10287@item %%
10288stands for @samp{%}.
10289
10290@item %c'@var{C}'
10291where @var{C} is a single character, stands for @var{C}.
10292@var{C} may not be a backslash or an apostrophe.
10293For example, @samp{%c':'} stands for a colon.
10294
10295@item %c'\@var{O}'
10296where @var{O} is a string of 1, 2, or 3 octal digits,
10297stands for the character with octal code @var{O}.
10298For example, @samp{%c'\0'} stands for a null character.
10299
10300@item @var{F}n
10301where @var{F} is a @code{printf} conversion specification,
10302stands for the line number formatted with @var{F}.
10303For example, @samp{%.5dn} prints the line number using the
10304@code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
10305more about printf conversion specifications.
10306
10307@end table
10308
10309The default line format is @samp{%l} followed by a newline character.
10310
10311If the input contains tab characters and it is important that they line
10312up on output, you should ensure that @samp{%l} or @samp{%L} in a line
10313format is just after a tab stop (e.g.@: by preceding @samp{%l} or
10314@samp{%L} with a tab character), or you should use the @samp{-t} or
10315@samp{--expand-tabs} option.
10316
10317Taken together, the line and line group formats let you specify many
10318different formats.  For example, the following command uses a format
10319similar to @code{diff}'s normal format.  You can tailor this command
10320to get fine control over @code{diff}'s output.
10321
10322@example
10323cvs diff \
10324   --old-line-format='< %l
10325' \
10326   --new-line-format='> %l
10327' \
10328   --old-group-format='%df%(f=l?:,%dl)d%dE
10329%<' \
10330   --new-group-format='%dea%dF%(F=L?:,%dL)
10331%>' \
10332   --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
10333%<---
10334%>' \
10335   --unchanged-group-format='' \
10336   myfile
10337@end example
10338
10339@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10340@node diff examples
10341@appendixsubsec diff examples
10342
10343The following line produces a Unidiff (@samp{-u} flag)
10344between revision 1.14 and 1.19 of
10345@file{backend.c}.  Due to the @samp{-kk} flag no
10346keywords are substituted, so differences that only depend
10347on keyword substitution are ignored.
10348
10349@example
10350$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
10351@end example
10352
10353Suppose the experimental branch EXPR1 was based on a
10354set of files tagged RELEASE_1_0.  To see what has
10355happened on that branch, the following can be used:
10356
10357@example
10358$ cvs diff -r RELEASE_1_0 -r EXPR1
10359@end example
10360
10361A command like this can be used to produce a context
10362diff between two releases:
10363
10364@example
10365$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
10366@end example
10367
10368If you are maintaining ChangeLogs, a command like the following
10369just before you commit your changes may help you write
10370the ChangeLog entry.  All local modifications that have
10371not yet been committed will be printed.
10372
10373@example
10374$ cvs diff -u | less
10375@end example
10376
10377@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10378@node export
10379@appendixsec export---Export sources from CVS, similar to checkout
10380@cindex export (subcommand)
10381
10382@itemize @bullet
10383@item
10384Synopsis: export [-flNnR] (-r rev[:date] | -D date) [-k subst] [-d dir] module@dots{}
10385@item
10386Requires: repository.
10387@item
10388Changes: current directory.
10389@end itemize
10390
10391This command is a variant of @code{checkout}; use it
10392when you want a copy of the source for module without
10393the @sc{cvs} administrative directories.  For example, you
10394might use @code{export} to prepare source for shipment
10395off-site.  This command requires that you specify a
10396date or tag (with @samp{-D} or @samp{-r}), so that you
10397can count on reproducing the source you ship to others
10398(and thus it always prunes empty directories).
10399
10400One often would like to use @samp{-kv} with @code{cvs
10401export}.  This causes any keywords to be
10402expanded such that an import done at some other site
10403will not lose the keyword revision information.  But be
10404aware that doesn't handle an export containing binary
10405files correctly.  Also be aware that after having used
10406@samp{-kv}, one can no longer use the @code{ident}
10407command (which is part of the @sc{rcs} suite---see
10408ident(1)) which looks for keyword strings.  If
10409you want to be able to use @code{ident} you must not
10410use @samp{-kv}.
10411
10412@menu
10413* export options::              export options
10414@end menu
10415
10416@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10417@node export options
10418@appendixsubsec export options
10419
10420These standard options are supported by @code{export}
10421(@pxref{Common options}, for a complete description of
10422them):
10423
10424@table @code
10425@item -D @var{date}
10426Use the most recent revision no later than @var{date}.
10427
10428@item -f
10429If no matching revision is found, retrieve the most
10430recent revision (instead of ignoring the file).
10431
10432@item -l
10433Local; run only in current working directory.
10434
10435@item -n
10436Do not run any checkout program.
10437
10438@item -R
10439Export directories recursively.  This is on by default.
10440
10441@item -r @var{tag}[:@var{date}]
10442Export the revision specified by @var{tag} or, when @var{date} is specified
10443and @var{tag} is a branch tag, the version from the branch @var{tag} as it
10444existed on @var{date}.  See @ref{Common options}.
10445@end table
10446
10447In addition, these options (that are common to
10448@code{checkout} and @code{export}) are also supported:
10449
10450@table @code
10451@item -d @var{dir}
10452Create a directory called @var{dir} for the working
10453files, instead of using the module name.
10454@xref{checkout options}, for complete details on how
10455@sc{cvs} handles this flag.
10456
10457@item -k @var{subst}
10458Set keyword expansion mode (@pxref{Substitution modes}).
10459
10460@item -N
10461Only useful together with @samp{-d @var{dir}}.
10462@xref{checkout options}, for complete details on how
10463@sc{cvs} handles this flag.
10464@end table
10465
10466@ignore
10467@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10468@c @node export examples
10469@appendixsubsec export examples
10470
10471Contributed examples are gratefully accepted.
10472@c -- Examples here!!
10473@end ignore
10474
10475@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10476@node history
10477@appendixsec history---Show status of files and users
10478@cindex history (subcommand)
10479
10480@itemize @bullet
10481@item
10482Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
10483@item
10484Requires: the file @file{$CVSROOT/CVSROOT/history}
10485@item
10486Changes: nothing.
10487@end itemize
10488
10489@sc{cvs} can keep a history log that tracks each use of most @sc{cvs}
10490commands.  You can use @code{history} to display this information in
10491various formats.
10492
10493To enable logging, the @samp{LogHistory} config option must be set to
10494some value other than the empty string and the history file specified by
10495the @samp{HistoryLogPath} option must be writable by all users who may run
10496the @sc{cvs} executable (@pxref{config}).
10497
10498To enable the @code{history} command, logging must be enabled as above and
10499the @samp{HistorySearchPath} config option (@pxref{config}) must be set to
10500specify some number of the history logs created thereby and these files must
10501be readable by each user who might run the @code{history} command.
10502
10503Creating a repository via the @code{cvs init} command will enable logging of
10504all possible events to a single history log file
10505(@file{$CVSROOT/CVSROOT/history}) with read and write permissions for all
10506users (@pxref{Creating a repository}).
10507
10508@emph{Note: @code{history} uses @samp{-f}, @samp{-l},
10509@samp{-n}, and @samp{-p} in ways that conflict with the
10510normal use inside @sc{cvs} (@pxref{Common options}).}
10511
10512@menu
10513* history options::             history options
10514@end menu
10515
10516@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10517@node history options
10518@appendixsubsec history options
10519
10520Several options (shown above as @samp{-report})  control  what
10521kind of report is generated:
10522
10523@table @code
10524@item -c
10525Report on each time commit was used (i.e., each time
10526the repository was modified).
10527
10528@item -e
10529Everything (all record types).  Equivalent to
10530specifying @samp{-x} with all record types.  Of course,
10531@samp{-e} will also include record types which are
10532added in a future version of @sc{cvs}; if you are
10533writing a script which can only handle certain record
10534types, you'll want to specify @samp{-x}.
10535
10536@item -m @var{module}
10537Report on a particular module.  (You can meaningfully
10538use @samp{-m} more than once on the command line.)
10539
10540@item -o
10541Report on checked-out modules.  This is the default report type.
10542
10543@item -T
10544Report on all tags.
10545
10546@item -x @var{type}
10547Extract a particular set of record types @var{type} from the @sc{cvs}
10548history.  The types are indicated by single letters,
10549which you may specify in combination.
10550
10551Certain commands have a single record type:
10552
10553@table @code
10554@item F
10555release
10556@item O
10557checkout
10558@item E
10559export
10560@item T
10561rtag
10562@end table
10563
10564@noindent
10565One of five record types may result from an update:
10566
10567@table @code
10568@item C
10569A merge was necessary but collisions were
10570detected (requiring manual merging).
10571@item G
10572A merge was necessary and it succeeded.
10573@item U
10574A working file was copied from the repository.
10575@item P
10576A working file was patched to match the repository.
10577@item W
10578The working copy of a file was deleted during
10579update (because it was gone from the repository).
10580@end table
10581
10582@noindent
10583One of three record types results from commit:
10584
10585@table @code
10586@item A
10587A file was added for the first time.
10588@item M
10589A file was modified.
10590@item R
10591A file was removed.
10592@end table
10593@end table
10594
10595The options shown as @samp{-flags} constrain or expand
10596the report without requiring option arguments:
10597
10598@table @code
10599@item -a
10600Show data for all users (the default is to show data
10601only for the user executing @code{history}).
10602
10603@item -l
10604Show last modification only.
10605
10606@item -w
10607Show only the records for modifications done from the
10608same working directory where @code{history} is
10609executing.
10610@end table
10611
10612The options shown as @samp{-options @var{args}} constrain the report
10613based on an argument:
10614
10615@table @code
10616@item -b @var{str}
10617Show data back to a record containing  the  string
10618@var{str}  in  either the module name, the file name, or
10619the repository path.
10620
10621@item -D @var{date}
10622Show data since @var{date}.  This is slightly different
10623from the normal use of @samp{-D @var{date}}, which
10624selects the newest revision older than @var{date}.
10625
10626@item -f @var{file}
10627Show data for a particular file
10628(you can specify several @samp{-f} options on the same command line).
10629This is equivalent to specifying the file on the command line.
10630
10631@item -n @var{module}
10632Show data for a particular module
10633(you can specify several @samp{-n} options on the same command line).
10634
10635@item -p @var{repository}
10636Show data for a particular source repository  (you
10637can specify several @samp{-p} options on the same command
10638line).
10639
10640@item -r @var{rev}
10641Show records referring to revisions since the revision
10642or tag named @var{rev} appears in individual @sc{rcs}
10643files.  Each @sc{rcs} file is searched for the revision or
10644tag.
10645
10646@item -t @var{tag}
10647Show records since tag @var{tag} was last added to the
10648history file.  This differs from the @samp{-r} flag
10649above in that it reads only the history file, not the
10650@sc{rcs} files, and is much faster.
10651
10652@item -u @var{name}
10653Show records for user @var{name}.
10654
10655@item -z @var{timezone}
10656Show times in the selected records using the specified
10657time zone instead of UTC.
10658@end table
10659
10660@ignore
10661@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10662@c @node history examples
10663@appendixsubsec history examples
10664
10665Contributed examples will gratefully be accepted.
10666@c -- Examples here!
10667@end ignore
10668
10669@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10670@node import
10671@appendixsec import---Import sources into CVS, using vendor branches
10672@cindex import (subcommand)
10673
10674@c FIXME: This node is way too long for one which has subnodes.
10675
10676@itemize @bullet
10677@item
10678Synopsis: import [-options] repository vendortag releasetag@dots{}
10679@item
10680Requires: Repository, source distribution directory.
10681@item
10682Changes: repository.
10683@end itemize
10684
10685Use @code{import} to incorporate an entire source
10686distribution from an outside source (e.g., a source
10687vendor) into your source repository directory.  You can
10688use this command both for initial creation of a
10689repository, and for wholesale updates to the module
10690from the outside source.  @xref{Tracking sources}, for
10691a discussion on this subject.
10692
10693The @var{repository} argument gives a directory name
10694(or a path to a directory) under the @sc{cvs} root directory
10695for repositories; if the directory did not exist,
10696import creates it.
10697
10698When you use import for updates to source that has been
10699modified in your source repository (since a prior
10700import), it will notify you of any files that conflict
10701in the two branches of development; use @samp{checkout
10702-j} to reconcile the differences, as import instructs
10703you to do.
10704
10705If @sc{cvs} decides a file should be ignored
10706(@pxref{cvsignore}), it does not import it and prints
10707@samp{I } followed by the filename (@pxref{import output}, for a
10708complete description of the output).
10709
10710If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10711any file whose names match the specifications in that
10712file will be treated as packages and the appropriate
10713filtering will be performed on the file/directory
10714before being imported.  @xref{Wrappers}.
10715
10716The outside source is saved in a first-level
10717branch, by default 1.1.1.  Updates are leaves of this
10718branch; for example, files from the first imported
10719collection of source will be revision 1.1.1.1, then
10720files from the first imported update will be revision
107211.1.1.2, and so on.
10722
10723At least three arguments are required.
10724@var{repository} is needed to identify the collection
10725of source.  @var{vendortag} is a tag for the entire
10726branch (e.g., for 1.1.1).  You must also specify at
10727least one @var{releasetag} to uniquely identify the files at
10728the leaves created each time you execute @code{import}.  The
10729@var{releasetag} should be new, not previously existing in the
10730repository file, and uniquely identify the imported release,
10731
10732@c I'm not completely sure this belongs here.  But
10733@c we need to say it _somewhere_ reasonably obvious; it
10734@c is a common misconception among people first learning CVS
10735Note that @code{import} does @emph{not} change the
10736directory in which you invoke it.  In particular, it
10737does not set up that directory as a @sc{cvs} working
10738directory; if you want to work with the sources import
10739them first and then check them out into a different
10740directory (@pxref{Getting the source}).
10741
10742@menu
10743* import options::              import options
10744* import output::               import output
10745* import examples::             import examples
10746@end menu
10747
10748@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10749@node import options
10750@appendixsubsec import options
10751
10752This standard option is supported by @code{import}
10753(@pxref{Common options}, for a complete description):
10754
10755@table @code
10756@item -m @var{message}
10757Use @var{message} as log information, instead of
10758invoking an editor.
10759@end table
10760
10761There are the following additional special options.
10762
10763@table @code
10764@item -b @var{branch}
10765See @ref{Multiple vendor branches}.
10766
10767@item -k @var{subst}
10768Indicate the keyword expansion mode desired.  This
10769setting will apply to all files created during the
10770import, but not to any files that previously existed in
10771the repository.  See @ref{Substitution modes}, for a
10772list of valid @samp{-k} settings.
10773
10774@item -I @var{name}
10775Specify file names that should be ignored during
10776import.  You can use this option repeatedly.  To avoid
10777ignoring any files at all (even those ignored by
10778default), specify `-I !'.
10779
10780@var{name} can be a file name pattern of the same type
10781that you can specify in the @file{.cvsignore} file.
10782@xref{cvsignore}.
10783@c -- Is this really true?
10784
10785@item -W @var{spec}
10786Specify file names that should be filtered during
10787import.  You can use this option repeatedly.
10788
10789@var{spec} can be a file name pattern of the same type
10790that you can specify in the @file{.cvswrappers}
10791file. @xref{Wrappers}.
10792
10793@item -X
10794Modify the algorithm used by @sc{cvs} when importing new files
10795so that new files do not immediately appear on the main trunk.
10796
10797Specifically, this flag causes @sc{cvs} to mark new files as
10798if they were deleted on the main trunk, by taking the following
10799steps for each file in addition to those normally taken on import:
10800creating a new revision on the main trunk indicating that
10801the new file is @code{dead}, resetting the new file's default branch,
10802and placing the file in the Attic (@pxref{Attic}) directory.
10803
10804Use of this option can be forced on a repository-wide basis
10805by setting the @samp{ImportNewFilesToVendorBranchOnly} option in
10806CVSROOT/config (@pxref{config}).
10807@end table
10808
10809@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10810@node import output
10811@appendixsubsec import output
10812
10813@code{import} keeps you informed of its progress by printing a line
10814for each file, preceded by one character indicating the status of the file:
10815
10816@table @code
10817@item U @var{file}
10818The file already exists in the repository and has not been locally
10819modified; a new revision has been created (if necessary).
10820
10821@item N @var{file}
10822The file is a new file which has been added to the repository.
10823
10824@item C @var{file}
10825The file already exists in the repository but has been locally modified;
10826you will have to merge the changes.
10827
10828@item I @var{file}
10829The file is being ignored (@pxref{cvsignore}).
10830
10831@cindex Symbolic link, importing
10832@cindex Link, symbolic, importing
10833@c FIXME: also (somewhere else) probably
10834@c should be documenting what happens if you "cvs add"
10835@c a symbolic link.  Also maybe what happens if
10836@c you manually create symbolic links within the
10837@c repository (? - not sure why we'd want to suggest
10838@c doing that).
10839@item L @var{file}
10840The file is a symbolic link; @code{cvs import} ignores symbolic links.
10841People periodically suggest that this behavior should
10842be changed, but if there is a consensus on what it
10843should be changed to, it is not apparent.
10844(Various options in the @file{modules} file can be used
10845to recreate symbolic links on checkout, update, etc.;
10846@pxref{modules}.)
10847@end table
10848
10849@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10850@node import examples
10851@appendixsubsec import examples
10852
10853See @ref{Tracking sources}, and @ref{From files}.
10854
10855@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10856@node log
10857@appendixsec log---Print out log information for files
10858@cindex log (subcommand)
10859
10860@itemize @bullet
10861@item
10862Synopsis: log [options] [files@dots{}]
10863@item
10864Requires: repository, working directory.
10865@item
10866Changes: nothing.
10867@end itemize
10868
10869Display log information for files.  @code{log} used to
10870call the @sc{rcs} utility @code{rlog}.  Although this
10871is no longer true in the current sources, this history
10872determines the format of the output and the options,
10873which are not quite in the style of the other @sc{cvs}
10874commands.
10875
10876@cindex Timezone, in output
10877@cindex Zone, time, in output
10878The output includes the location of the @sc{rcs} file,
10879the @dfn{head} revision (the latest revision on the
10880trunk), all symbolic names (tags) and some other
10881things.  For each revision, the revision number, the
10882date, the author, the number of lines added/deleted, the commitid
10883and the log message are printed.  All dates are displayed
10884in local time at the client. This is typically specified in
10885the @code{$TZ} environment variable, which can be set to
10886govern how @code{log} displays dates.
10887
10888@emph{Note: @code{log} uses @samp{-R} in a way that conflicts
10889with the normal use inside @sc{cvs} (@pxref{Common options}).}
10890
10891@menu
10892* log options::                 log options
10893* log examples::                log examples
10894@end menu
10895
10896@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10897@node log options
10898@appendixsubsec log options
10899
10900By default, @code{log} prints all information that is
10901available.  All other options restrict the output.  Note that the revision
10902selection options (@code{-d}, @code{-r}, @code{-s}, and @code{-w}) have no
10903effect, other than possibly causing a search for files in Attic directories,
10904when used in conjunction with the options that restrict the output to only
10905@code{log} header fields (@code{-b}, @code{-h}, @code{-R}, and @code{-t})
10906unless the @code{-S} option is also specified.
10907
10908@table @code
10909@item -b
10910Print information about the revisions on the default
10911branch, normally the highest branch on the trunk.
10912
10913@item -d @var{dates}
10914Print information about revisions with a checkin
10915date/time in the range given by the
10916semicolon-separated list of dates.  The date formats
10917accepted are those accepted by the @samp{-D} option to
10918many other @sc{cvs} commands (@pxref{Common options}).
10919Dates can be combined into ranges as follows:
10920
10921@c Should we be thinking about accepting ISO8601
10922@c ranges?  For example "1972-09-10/1972-09-12".
10923@table @code
10924@item @var{d1}<@var{d2}
10925@itemx @var{d2}>@var{d1}
10926Select the revisions that were deposited between
10927@var{d1} and @var{d2}.
10928
10929@item <@var{d}
10930@itemx @var{d}>
10931Select all revisions dated @var{d} or earlier.
10932
10933@item @var{d}<
10934@itemx >@var{d}
10935Select all revisions dated @var{d} or later.
10936
10937@item @var{d}
10938Select the single, latest revision dated @var{d} or
10939earlier.
10940@end table
10941
10942The @samp{>} or @samp{<} characters may be followed by
10943@samp{=} to indicate an inclusive range rather than an
10944exclusive one.
10945
10946Note that the separator is a semicolon (;).
10947
10948@item -h
10949Print only the name of the @sc{rcs} file, name
10950of the file in the working directory, head,
10951default branch, access list, locks, symbolic names, and
10952suffix.
10953
10954@item -l
10955Local; run only in current working directory.  (Default
10956is to run recursively).
10957
10958@item -N
10959Do not print the list of tags for this file.  This
10960option can be very useful when your site uses a lot of
10961tags, so rather than "more"'ing over 3 pages of tag
10962information, the log information is presented without
10963tags at all.
10964
10965@item -R
10966Print only the name of the @sc{rcs} file.
10967
10968@c Note that using a bare revision (in addition to not
10969@c being explicitly documented here) is potentially
10970@c confusing; it shows the log message to get from the
10971@c previous revision to that revision.  "-r1.3 -r1.6"
10972@c (equivalent to "-r1.3,1.6") is even worse; it
10973@c prints the messages to get from 1.2 to 1.3 and 1.5
10974@c to 1.6.  By analogy with "cvs diff", users might
10975@c expect that it is more like specifying a range.
10976@c It is not 100% clear to me how much of this should
10977@c be documented (for example, multiple -r options
10978@c perhaps could/should be deprecated given the false
10979@c analogy with "cvs diff").
10980@c In general, this section should be rewritten to talk
10981@c about messages to get from revision rev1 to rev2,
10982@c rather than messages for revision rev2 (that is, the
10983@c messages are associated with a change not a static
10984@c revision and failing to make this distinction causes
10985@c much confusion).
10986@item -r@var{revisions}
10987Print information about revisions given in the
10988comma-separated list @var{revisions} of revisions and
10989ranges.  The following table explains the available
10990range formats:
10991
10992@table @code
10993@item @var{rev1}:@var{rev2}
10994Revisions @var{rev1} to @var{rev2} (which must be on
10995the same branch).
10996
10997@item @var{rev1}::@var{rev2}
10998The same, but excluding @var{rev1}.
10999
11000@item :@var{rev}
11001@itemx ::@var{rev}
11002Revisions from the beginning of the branch up to
11003and including @var{rev}.
11004
11005@item @var{rev}:
11006Revisions starting with @var{rev} to the end of the
11007branch containing @var{rev}.
11008
11009@item @var{rev}::
11010Revisions starting just after @var{rev} to the end of the
11011branch containing @var{rev}.
11012
11013@item @var{branch}
11014An argument that is a branch means all revisions on
11015that branch.
11016
11017@item @var{branch1}:@var{branch2}
11018@itemx @var{branch1}::@var{branch2}
11019A range of branches means all revisions
11020on the branches in that range.
11021
11022@item @var{branch}.
11023The latest revision in @var{branch}.
11024@end table
11025
11026A bare @samp{-r} with no revisions means the latest
11027revision on the default branch, normally the trunk.
11028There can be no space between the @samp{-r} option and
11029its argument.
11030
11031@item -S
11032Suppress the header if no revisions are selected.
11033
11034@item -s @var{states}
11035Print information about revisions whose state
11036attributes match one of the states given in the
11037comma-separated list @var{states}.  Individual states may
11038be any text string, though @sc{cvs} commonly only uses two
11039states, @samp{Exp} and @samp{dead}.  See @ref{admin options}
11040for more information.
11041
11042@item -t
11043Print the same as @samp{-h}, plus the descriptive text.
11044
11045@item -w@var{logins}
11046Print information about revisions checked in by users
11047with login names appearing in the comma-separated list
11048@var{logins}.  If @var{logins} is omitted, the user's
11049login is assumed.  There can be no space between the
11050@samp{-w} option and its argument.
11051@end table
11052
11053@code{log} prints the intersection of the revisions
11054selected with the options @samp{-d}, @samp{-s}, and
11055@samp{-w}, intersected with the union of the revisions
11056selected by @samp{-b} and @samp{-r}.
11057
11058@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11059@node log examples
11060@appendixsubsec log examples
11061
11062@cindex Timezone, in output
11063@cindex Zone, time, in output
11064Since @code{log} shows dates in local time,
11065you might want to see them in Coordinated Universal Time (UTC) or
11066some other timezone.
11067To do this you can set your @code{$TZ} environment
11068variable before invoking @sc{cvs}:
11069
11070@example
11071$ TZ=UTC cvs log foo.c
11072$ TZ=EST cvs log bar.c
11073@end example
11074
11075(If you are using a @code{csh}-style shell, like @code{tcsh},
11076you would need to prefix the examples above with @code{env}.)
11077
11078@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11079@node ls & rls
11080@appendixsec ls & rls
11081@cindex ls (subcommand)
11082@cindex rls (subcommand)
11083
11084@itemize @bullet
11085@item
11086ls [-e | -l] [-RP] [-r tag[:date]] [-D date] [path@dots{}]
11087@item
11088Requires: repository for @code{rls}, repository & working directory for
11089@code{ls}.
11090@item
11091Changes: nothing.
11092@item
11093Synonym: @code{dir} & @code{list} are synonyms for @code{ls} and @code{rdir}
11094& @code{rlist} are synonyms for @code{rls}.
11095@end itemize
11096
11097The @code{ls} and @code{rls} commands are used to list
11098files and directories in the repository.
11099
11100By default @code{ls} lists the files and directories
11101that belong in your working directory, what would be
11102there after an @code{update}.
11103
11104By default @code{rls} lists the files and directories
11105on the tip of the trunk in the topmost directory of the
11106repository.
11107
11108Both commands accept an optional list of file and
11109directory names, relative to the working directory for
11110@code{ls} and the topmost directory of the repository
11111for @code{rls}.  Neither is recursive by default.
11112
11113@menu
11114* ls & rls options::         ls & rls options
11115* rls examples:              rls examples
11116@end menu
11117
11118@node ls & rls options
11119@appendixsubsec ls & rls options
11120
11121These standard options are supported by @code{ls} & @code{rls}:
11122
11123@table @code
11124@item -d
11125Show dead revisions (with tag when specified).
11126
11127@item -e
11128Display in CVS/Entries format.  This format is meant to remain easily parsable
11129by automation.
11130
11131@item -l
11132Display all details.
11133
11134@item -P
11135Don't list contents of empty directories when recursing.
11136
11137@item -R
11138List recursively.
11139
11140@item -r @var{tag}[:@var{date}]
11141Show files specified by @var{tag} or, when @var{date} is specified
11142and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11143existed on @var{date}.  See @ref{Common options}.
11144
11145@item -D @var{date}
11146Show files from date.
11147@end table
11148
11149@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11150@node rls examples
11151@appendixsubsec rls examples
11152
11153@example
11154$ cvs rls
11155cvs rls: Listing module: `.'
11156CVSROOT
11157first-dir
11158@end example
11159
11160@example
11161$ cvs rls CVSROOT
11162cvs rls: Listing module: `CVSROOT'
11163checkoutlist
11164commitinfo
11165config
11166cvswrappers
11167loginfo
11168modules
11169notify
11170rcsinfo
11171taginfo
11172verifymsg
11173
11174@end example
11175
11176@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11177@node rdiff
11178@appendixsec rdiff---'patch' format diffs between releases
11179@cindex rdiff (subcommand)
11180
11181@itemize @bullet
11182@item
11183rdiff [-flags] [-V vn] (-r tag1[:date1] | -D date1) [-r tag2[:date2] | -D date2] modules@dots{}
11184@item
11185Requires: repository.
11186@item
11187Changes: nothing.
11188@item
11189Synonym: patch
11190@end itemize
11191
11192Builds a Larry Wall format patch(1) file between two
11193releases, that can be fed directly into the @code{patch}
11194program to bring an old release up-to-date with the new
11195release.  (This is one of the few @sc{cvs} commands that
11196operates directly from the repository, and doesn't
11197require a prior checkout.) The diff output is sent to
11198the standard output device.
11199
11200You can specify (using the standard @samp{-r} and
11201@samp{-D} options) any combination of one or two
11202revisions or dates.  If only one revision or date is
11203specified, the patch file reflects differences between
11204that revision or date and the current head revisions in
11205the @sc{rcs} file.
11206
11207Note that if the software release affected is contained
11208in more than one directory, then it may be necessary to
11209specify the @samp{-p} option to the @code{patch} command when
11210patching the old sources, so that @code{patch} is able to find
11211the files that are located in other directories.
11212
11213@menu
11214* rdiff options::               rdiff options
11215* rdiff examples::              rdiff examples
11216@end menu
11217
11218@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11219@node rdiff options
11220@appendixsubsec rdiff options
11221
11222These standard options are supported by @code{rdiff}
11223(@pxref{Common options}, for a complete description of
11224them):
11225
11226@table @code
11227@item -D @var{date}
11228Use the most recent revision no later than @var{date}.
11229
11230@item -f
11231If no matching revision is found, retrieve the most
11232recent revision (instead of ignoring the file).
11233
11234@item -k @var{kflag}
11235Process keywords according to @var{kflag}.  See
11236@ref{Keyword substitution}.
11237
11238@item -l
11239Local; don't descend subdirectories.
11240
11241@item -R
11242Examine directories recursively.  This option is on by default.
11243
11244@item -r @var{tag}
11245Use the revision specified by @var{tag}, or when @var{date} is specified
11246and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11247existed on @var{date}.  See @ref{Common options}.
11248@end table
11249
11250In addition to the above, these options are available:
11251
11252@table @code
11253@item -c
11254Use the context diff format.  This is the default format.
11255
11256@item -p
11257Show which C function each change is in.
11258
11259@item -s
11260Create a summary change report instead of a patch.  The
11261summary includes information about files that were
11262changed or added between the releases.  It is sent to
11263the standard output device.  This is useful for finding
11264out, for example, which files have changed between two
11265dates or revisions.
11266
11267@item -t
11268A diff of the top two revisions is sent to the standard
11269output device.  This is most useful for seeing what the
11270last change to a file was.
11271
11272@item -u
11273Use the unidiff format for the context diffs.
11274Remember that old versions
11275of the @code{patch} program can't handle the unidiff
11276format, so if you plan to post this patch to the net
11277you should probably not use @samp{-u}.
11278
11279@item -V @var{vn}
11280Expand keywords according to the rules current in
11281@sc{rcs} version @var{vn} (the expansion format changed with
11282@sc{rcs} version 5).  Note that this option is no
11283longer accepted.  @sc{cvs} will always expand keywords the
11284way that @sc{rcs} version 5 does.
11285@end table
11286
11287@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11288@node rdiff examples
11289@appendixsubsec rdiff examples
11290
11291Suppose you receive mail from @t{foo@@example.net} asking for an
11292update from release 1.2 to 1.4 of the tc compiler.  You
11293have no such patches on hand, but with @sc{cvs} that can
11294easily be fixed with a command such as this:
11295
11296@example
11297$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
11298$$ Mail -s 'The patches you asked for' foo@@example.net
11299@end example
11300
11301Suppose you have made release 1.3, and forked a branch
11302called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
11303corresponds to release 1.3.1, which was made some time
11304ago.  Now, you want to see how much development has been
11305done on the branch.  This command can be used:
11306
11307@example
11308$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
11309cvs rdiff: Diffing module-name
11310File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
11311File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
11312File bar.h,v changed from revision 1.29.2.1 to 1.2
11313@end example
11314
11315@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11316@node release
11317@appendixsec release---Indicate that a Module is no longer in use
11318@cindex release (subcommand)
11319
11320@itemize @bullet
11321@item
11322release [-d] directories@dots{}
11323@item
11324Requires: Working directory.
11325@item
11326Changes: Working directory, history log.
11327@end itemize
11328
11329This command is meant to safely cancel the effect of
11330@samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
11331isn't strictly necessary to use this command.  You can
11332always simply delete your working directory, if you
11333like; but you risk losing changes you may have
11334forgotten, and you leave no trace in the @sc{cvs} history
11335file (@pxref{history file}) that you've abandoned your
11336checkout.
11337
11338Use @samp{cvs release} to avoid these problems.  This
11339command checks that no uncommitted changes are
11340present; that you are executing it from immediately
11341above a @sc{cvs} working directory; and that the repository
11342recorded for your files is the same as the repository
11343defined in the module database.
11344
11345If all these conditions are true, @samp{cvs release}
11346leaves a record of its execution (attesting to your
11347intentionally abandoning your checkout) in the @sc{cvs}
11348history log.
11349
11350@menu
11351* release options::             release options
11352* release output::              release output
11353* release examples::            release examples
11354@end menu
11355
11356@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11357@node release options
11358@appendixsubsec release options
11359
11360The @code{release} command supports one command option:
11361
11362@table @code
11363@item -d
11364Delete your working copy of the file if the release
11365succeeds.  If this flag is not given your files will
11366remain in your working directory.
11367
11368@emph{WARNING:  The @code{release} command deletes
11369all directories and files recursively.  This
11370has the very serious side-effect that any directory
11371that you have created inside your checked-out sources,
11372and not added to the repository (using the @code{add}
11373command; @pxref{Adding files}) will be silently deleted---even
11374if it is non-empty!}
11375@end table
11376
11377@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11378@node release output
11379@appendixsubsec release output
11380
11381Before @code{release} releases your sources it will
11382print a one-line message for any file that is not
11383up-to-date.
11384
11385@table @code
11386@item U @var{file}
11387@itemx P @var{file}
11388There exists a newer revision of this file in the
11389repository, and you have not modified your local copy
11390of the file (@samp{U} and @samp{P} mean the same thing).
11391
11392@item A @var{file}
11393The file has been added to your private copy of the
11394sources, but has not yet been committed to the
11395repository.  If you delete your copy of the sources
11396this file will be lost.
11397
11398@item R @var{file}
11399The file has been removed from your private copy of the
11400sources, but has not yet been removed from the
11401repository, since you have not yet committed the
11402removal.  @xref{commit}.
11403
11404@item M @var{file}
11405The file is modified in your working directory.  There
11406might also be a newer revision inside the repository.
11407
11408@item ? @var{file}
11409@var{file} is in your working directory, but does not
11410correspond to anything in the source repository, and is
11411not in the list of files for @sc{cvs} to ignore (see the
11412description of the @samp{-I} option, and
11413@pxref{cvsignore}).  If you remove your working
11414sources, this file will be lost.
11415@end table
11416
11417@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11418@node release examples
11419@appendixsubsec release examples
11420
11421Release the @file{tc} directory, and delete your local working copy
11422of the files.
11423
11424@example
11425$ cd ..         # @r{You must stand immediately above the}
11426                # @r{sources when you issue @samp{cvs release}.}
11427$ cvs release -d tc
11428You have [0] altered files in this repository.
11429Are you sure you want to release (and delete) directory `tc': y
11430$
11431@end example
11432
11433@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11434@node server & pserver
11435@appendixsec server & pserver---Act as a server for a client on stdin/stdout
11436@cindex pserver (subcommand)
11437@cindex server (subcommand)
11438
11439@itemize @bullet
11440@item
11441pserver [-c path]
11442
11443server [-c path]
11444@item
11445Requires: repository, client conversation on stdin/stdout
11446@item
11447Changes: Repository or, indirectly, client working directory.
11448@end itemize
11449
11450The @sc{cvs} @code{server} and @code{pserver} commands are used to provide
11451repository access to remote clients and expect a client conversation on
11452stdin & stdout.  Typically these commands are launched from @code{inetd} or
11453via @code{ssh} (@pxref{Remote repositories}).
11454
11455@code{server} expects that the client has already been authenticated somehow,
11456typically via @sc{ssh}, and @code{pserver} attempts to authenticate the client
11457itself.
11458
11459Only one option is available with the @code{server} and @code{pserver}
11460commands:
11461
11462@cindex configuration file
11463@table @code
11464@item -c path
11465Load configuration from @var{path} rather than the default location
11466@file{$CVSROOT/CVSROOT/config} (@pxref{config}).  @var{path} must be
11467@file{/etc/cvs.conf} or prefixed by @file{/etc/cvs/}.  This option is
11468supported beginning with @sc{cvs} release 1.12.13.
11469@end table
11470
11471@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11472@node suck
11473@appendixsec suck---Download RCS ,v file raw
11474@cindex suck (subcommand)
11475
11476@itemize @bullet
11477@item
11478suck module/path
11479@item
11480Requires: repository
11481@end itemize
11482
11483Locates the file module/path,v or module/pa/Attic/th,v and downloads
11484it raw as RCS comma-v file.
11485
11486Output consists of the real pathname of the comma-v file, relative to
11487the CVS repository, followed by a newline and the binary file content
11488immediately thereafter.
11489
11490@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11491@node update
11492@appendixsec update---Bring work tree in sync with repository
11493@cindex update (subcommand)
11494
11495@itemize @bullet
11496@item
11497update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag[:date] | -D date] [-W spec] files@dots{}
11498@item
11499Requires: repository, working directory.
11500@item
11501Changes: working directory.
11502@end itemize
11503
11504After you've run checkout to create your private copy
11505of source from the common repository, other developers
11506will continue changing the central source.  From time
11507to time, when it is convenient in your development
11508process, you can use the @code{update} command from
11509within your working directory to reconcile your work
11510with any revisions applied to the source repository
11511since your last checkout or update.  Without the @code{-C}
11512option, @code{update} will also merge any differences
11513between the local copy of files and their base revisions
11514into any destination revisions specified with @code{-r},
11515@code{-D}, or @code{-A}.
11516
11517@menu
11518* update options::              update options
11519* update output::               update output
11520@end menu
11521
11522@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11523@node update options
11524@appendixsubsec update options
11525
11526These standard options are available with @code{update}
11527(@pxref{Common options}, for a complete description of
11528them):
11529
11530@table @code
11531@item -D date
11532Use the most recent revision no later than @var{date}.
11533This option is sticky, and implies @samp{-P}.
11534See @ref{Sticky tags}, for more information on sticky tags/dates.
11535
11536@item -f
11537Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision
11538is found, retrieve the most recent revision (instead of ignoring the file).
11539
11540@item -k @var{kflag}
11541Process keywords according to @var{kflag}.  See
11542@ref{Keyword substitution}.
11543This option is sticky; future updates of
11544this file in this working directory will use the same
11545@var{kflag}.  The @code{status} command can be viewed
11546to see the sticky options.  See @ref{Invoking CVS}, for
11547more information on the @code{status} command.
11548
11549@item -l
11550Local; run only in current working directory.  @xref{Recursive behavior}.
11551
11552@item -P
11553Prune empty directories.  See @ref{Moving directories}.
11554
11555@item -p
11556Pipe files to the standard output.
11557
11558@item -R
11559Update directories recursively (default).  @xref{Recursive
11560behavior}.
11561
11562@item -r @var{tag}[:@var{date}]
11563Retrieve the revisions specified by @var{tag} or, when @var{date} is specified
11564and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11565existed on @var{date}.  This option is sticky, and implies @samp{-P}.
11566See @ref{Sticky tags}, for more information on sticky tags/dates. Also
11567see @ref{Common options}.
11568@end table
11569
11570@need 800
11571These special options are also available with
11572@code{update}.
11573
11574@table @code
11575@item -A
11576Reset any sticky tags, dates, or @samp{-k} options.
11577See @ref{Sticky tags}, for more information on sticky tags/dates.
11578
11579@item -C
11580Overwrite locally modified files with clean copies from
11581the repository (the modified file is saved in
11582@file{.#@var{file}.@var{revision}}, however).
11583
11584@item -d
11585Create any directories that exist in the repository if
11586they're missing from the working directory.  Normally,
11587@code{update} acts only on directories and files that
11588were already enrolled in your working directory.
11589
11590This is useful for updating directories that were
11591created in the repository since the initial checkout;
11592but it has an unfortunate side effect.  If you
11593deliberately avoided certain directories in the
11594repository when you created your working directory
11595(either through use of a module name or by listing
11596explicitly the files and directories you wanted on the
11597command line), then updating with @samp{-d} will create
11598those directories, which may not be what you want.
11599
11600@item -I @var{name}
11601Ignore files whose names match @var{name} (in your
11602working directory) during the update.  You can specify
11603@samp{-I} more than once on the command line to specify
11604several files to ignore.  Use @samp{-I !} to avoid
11605ignoring any files at all.  @xref{cvsignore}, for other
11606ways to make @sc{cvs} ignore some files.
11607
11608@item -W@var{spec}
11609Specify file names that should be filtered during
11610update.  You can use this option repeatedly.
11611
11612@var{spec} can be a file name pattern of the same type
11613that you can specify in the @file{.cvswrappers}
11614file. @xref{Wrappers}.
11615
11616@item -j@var{revision}
11617With two @samp{-j} options, merge changes from the
11618revision specified with the first @samp{-j} option to
11619the revision specified with the second @samp{j} option,
11620into the working directory.
11621
11622With one @samp{-j} option, merge changes from the
11623ancestor revision to the revision specified with the
11624@samp{-j} option, into the working directory.  The
11625ancestor revision is the common ancestor of the
11626revision which the working directory is based on, and
11627the revision specified in the @samp{-j} option.
11628
11629Note that using a single @samp{-j @var{tagname}} option rather than
11630@samp{-j @var{branchname}} to merge changes from a branch will
11631often not remove files which were removed on the branch.
11632@xref{Merging adds and removals}, for more.
11633
11634In addition, each @samp{-j} option can contain an optional
11635date specification which, when used with branches, can
11636limit the chosen revision to one within a specific
11637date.  An optional date is specified by adding a colon
11638(:) to the tag:
11639@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
11640
11641@xref{Branching and merging}.
11642
11643@end table
11644
11645@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11646@node update output
11647@appendixsubsec update output
11648
11649@code{update} and @code{checkout} keep you informed of
11650their progress by printing a line for each file, preceded
11651by one character indicating the status of the file:
11652
11653@table @code
11654@item U @var{file}
11655The file was brought up to date with respect to the
11656repository.  This is done for any file that exists in
11657the repository but not in your working directory, and for files
11658that you haven't changed but are not the most recent
11659versions available in the repository.
11660
11661@item P @var{file}
11662Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
11663file.  This accomplishes the same thing as @samp{U} using less bandwidth.
11664
11665@item A @var{file}
11666The file has been added to your private copy of the
11667sources, and will be added to the source repository
11668when you run @code{commit} on the file.  This is a
11669reminder to you that the file needs to be committed.
11670
11671@item R @var{file}
11672The file has been removed from your private copy of the
11673sources, and will be removed from the source repository
11674when you run @code{commit} on the file.  This is a
11675reminder to you that the file needs to be committed.
11676
11677@item M @var{file}
11678The file is modified in  your  working  directory.
11679
11680@samp{M} can indicate one of two states for a file
11681you're working on: either there were no modifications
11682to the same file in the repository, so that your file
11683remains as you last saw it; or there were modifications
11684in the repository as well as in your copy, but they
11685were merged successfully, without conflict, in your
11686working directory.
11687
11688@sc{cvs} will print some messages if it merges your work,
11689and a backup copy of your working file (as it looked
11690before you ran @code{update}) will be made.  The exact
11691name of that file is printed while @code{update} runs.
11692
11693@item C @var{file}
11694@cindex .# files
11695@cindex __ files (VMS)
11696A conflict was detected while trying to merge your
11697changes to @var{file} with changes from the source
11698repository.  @var{file} (the copy in your working
11699directory) is now the result of attempting to merge
11700the two revisions; an unmodified copy of your file
11701is also in your working directory, with the name
11702@file{.#@var{file}.@var{revision}} where @var{revision}
11703is the revision that your modified file started
11704from.  Resolve the conflict as described in
11705@ref{Conflicts example}.
11706@c "some systems" as in out-of-the-box OSes?  Not as
11707@c far as I know.  We need to advise sysadmins as well
11708@c as users how to set up this kind of purge, if that is
11709@c what they want.
11710@c We also might want to think about cleaner solutions,
11711@c like having CVS remove the .# file once the conflict
11712@c has been resolved or something like that.
11713(Note that some systems automatically purge
11714files that begin with @file{.#} if they have not been
11715accessed for a few days.  If you intend to keep a copy
11716of your original file, it is a very good idea to rename
11717it.)  Under @sc{vms}, the file name starts with
11718@file{__} rather than @file{.#}.
11719
11720@item ? @var{file}
11721@var{file} is in your working directory, but does not
11722correspond to anything in the source repository, and is
11723not in the list of files for @sc{cvs} to ignore (see the
11724description of the @samp{-I} option, and
11725@pxref{cvsignore}).
11726@end table
11727
11728@c ----- END MAN 1 -----
11729@c ---------------------------------------------------------------------
11730@node Invoking CVS
11731@appendix Quick reference to CVS commands
11732@cindex Command reference
11733@cindex Reference, commands
11734@cindex Invoking CVS
11735
11736This appendix describes how to invoke @sc{cvs}, with
11737references to where each command or feature is
11738described in detail.  For other references run the
11739@code{cvs --help} command, or see @ref{Index}.
11740
11741A @sc{cvs} command looks like:
11742
11743@example
11744cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
11745@end example
11746
11747Global options:
11748
11749@table @code
11750@item --allow-root=@var{rootdir}
11751Specify legal @sc{cvsroot} directory (server only) (not
11752in @sc{cvs} 1.9 and older).  See @ref{Password
11753authentication server}.
11754
11755@item -a
11756Authenticate all communication (client only) (not in @sc{cvs}
117571.9 and older).  See @ref{Global options}.
11758
11759@item -b
11760Specify RCS location (@sc{cvs} 1.9 and older).  See
11761@ref{Global options}.
11762
11763@item -d @var{root}
11764Specify the @sc{cvsroot}.  See @ref{Repository}.
11765
11766@item -e @var{editor}
11767Edit messages with @var{editor}.  See @ref{Committing
11768your changes}.
11769
11770@item -f
11771Do not read the @file{~/.cvsrc} file.  See @ref{Global
11772options}.
11773
11774@item -g
11775Set the umask to allow group writable permissions in
11776the working copy.  See @ref{Global options}.
11777
11778@item -H
11779@itemx --help
11780Print a help message.  See @ref{Global options}.
11781
11782@item -n
11783Do not change any files.  See @ref{Global options}.
11784
11785@item -Q
11786Be really quiet.  See @ref{Global options}.
11787
11788@item -q
11789Be somewhat quiet.  See @ref{Global options}.
11790
11791@item -r
11792Make new working files read-only.  See @ref{Global options}.
11793
11794@item -s @var{variable}=@var{value}
11795Set a user variable.  See @ref{Variables}.
11796
11797@item -T @var{tempdir}
11798Put temporary files in @var{tempdir}.  See @ref{Global
11799options}.
11800
11801@item -t
11802Trace @sc{cvs} execution.  See @ref{Global options}.
11803
11804@item -v
11805@item --version
11806Display version and copyright information for @sc{cvs}.
11807
11808@item -w
11809Make new working files read-write.  See @ref{Global
11810options}.
11811
11812@item -x
11813Encrypt all communication (client only).
11814See @ref{Global options}.
11815
11816@item -z @var{gzip-level}
11817@cindex Compression
11818@cindex Gzip
11819Set the compression level (client only).
11820See @ref{Global options}.
11821@end table
11822
11823Keyword expansion modes (@pxref{Substitution modes}):
11824
11825@example
11826-kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11827-kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11828-kk   $@splitrcskeyword{Id}$
11829-kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
11830-ko   @i{no expansion}
11831-kb   @i{no expansion, file is binary}
11832@end example
11833
11834Keywords (@pxref{Keyword list}):
11835
11836@example
11837$@splitrcskeyword{Author}: joe $
11838$@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11839$@splitrcskeyword{Mdocdate}: December 9 1993 $
11840$@splitrcskeyword{CVSHeader}: files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11841$@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11842$@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11843$@splitrcskeyword{Locker}: harry $
11844$@splitrcskeyword{Name}: snapshot_1_14 $
11845$@splitrcskeyword{RCSfile}: file1,v $
11846$@splitrcskeyword{Revision}: 1.1 $
11847$@splitrcskeyword{Source}: /home/files/file1,v $
11848$@splitrcskeyword{State}: Exp $
11849$@splitrcskeyword{Log}: file1,v $
11850Revision 1.1  1993/12/09 03:30:17  joe
11851Initial revision
11852
11853@end example
11854
11855@c The idea behind this table is that we want each item
11856@c to be a sentence or two at most.  Preferably a
11857@c single line.
11858@c
11859@c In some cases refs to "foo options" are just to get
11860@c this thing written quickly, not because the "foo
11861@c options" node is really the best place to point.
11862Commands, command options, and command arguments:
11863
11864@table @code
11865@c ------------------------------------------------------------
11866@item add [@var{options}] [@var{files}@dots{}]
11867Add a new file/directory.  See @ref{Adding files}.
11868
11869@table @code
11870@item -k @var{kflag}
11871Set keyword expansion.
11872
11873@item -m @var{msg}
11874Set file description.
11875@end table
11876
11877@c ------------------------------------------------------------
11878@item admin [@var{options}] [@var{files}@dots{}]
11879Administration of history files in the repository.  See
11880@ref{admin}.
11881@c This list omits those options which are not
11882@c documented as being useful with CVS.  That might be
11883@c a mistake...
11884
11885@table @code
11886@item -b[@var{rev}]
11887Set default branch.  See @ref{Reverting local changes}.
11888
11889@item -c@var{string}
11890Set comment leader.
11891
11892@item -k@var{subst}
11893Set keyword substitution.  See @ref{Keyword
11894substitution}.
11895
11896@item -l[@var{rev}]
11897Lock revision @var{rev}, or latest revision.
11898
11899@item -m@var{rev}:@var{msg}
11900Replace the log message of revision @var{rev} with
11901@var{msg}.
11902
11903@item -o@var{range}
11904Delete revisions from the repository.  See
11905@ref{admin options}.
11906
11907@item -q
11908Run quietly; do not print diagnostics.
11909
11910@item -s@var{state}[:@var{rev}]
11911Set the state.  See @ref{admin options} for more information on possible
11912states.
11913
11914@c Does not work for client/server CVS
11915@item -t
11916Set file description from standard input.
11917
11918@item -t@var{file}
11919Set file description from @var{file}.
11920
11921@item -t-@var{string}
11922Set file description to @var{string}.
11923
11924@item -u[@var{rev}]
11925Unlock revision @var{rev}, or latest revision.
11926@end table
11927
11928@c ------------------------------------------------------------
11929@item annotate [@var{options}] [@var{files}@dots{}]
11930Show last revision where each line was modified.  See
11931@ref{annotate}.
11932
11933@table @code
11934@item -D @var{date}
11935Annotate the most recent revision no later than
11936@var{date}.  See @ref{Common options}.
11937
11938@item -F
11939Force annotation of binary files.  (Without this option,
11940binary files are skipped with a message.)
11941
11942@item -f
11943Use head revision if tag/date not found.  See
11944@ref{Common options}.
11945
11946@item -l
11947Local; run only in current working directory.  @xref{Recursive behavior}.
11948
11949@item -R
11950Operate recursively (default).  @xref{Recursive
11951behavior}.
11952
11953@item -r @var{tag}[:@var{date}]
11954Annotate revisions specified by @var{tag} or, when @var{date} is specified
11955and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11956existed on @var{date}.  See @ref{Common options}.
11957@end table
11958
11959@c ------------------------------------------------------------
11960@item checkout [@var{options}] @var{modules}@dots{}
11961Get a copy of the sources.  See @ref{checkout}.
11962
11963@table @code
11964@item -A
11965Reset any sticky tags/date/options.  See @ref{Sticky
11966tags} and @ref{Keyword substitution}.
11967
11968@item -c
11969Output the module database.  See @ref{checkout options}.
11970
11971@item -D @var{date}
11972Check out revisions as of @var{date} (is sticky).  See
11973@ref{Common options}.
11974
11975@item -d @var{dir}
11976Check out into @var{dir}.  See @ref{checkout options}.
11977
11978@item -f
11979Use head revision if tag/date not found.  See
11980@ref{Common options}.
11981
11982@c Probably want to use rev1/rev2 style like for diff
11983@c -r.  Here and in on-line help.
11984@item -j @var{tag}[:@var{date}]
11985Merge in the change specified by @var{tag}, or when @var{date} is specified
11986and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11987existed on @var{date}.  See @ref{checkout options}.  Also,
11988see @ref{Common options}.
11989
11990@item -k @var{kflag}
11991Use @var{kflag} keyword expansion.  See
11992@ref{Substitution modes}.
11993
11994@item -l
11995Local; run only in current working directory.  @xref{Recursive behavior}.
11996
11997@item -N
11998Don't ``shorten'' module paths if -d specified.  See
11999@ref{checkout options}.
12000
12001@item -n
12002Do not run module program (if any).  See @ref{checkout options}.
12003
12004@item -P
12005Prune empty directories.  See @ref{Moving directories}.
12006
12007@item -p
12008Check out files to standard output (avoids
12009stickiness).  See @ref{checkout options}.
12010
12011@item -R
12012Operate recursively (default).  @xref{Recursive
12013behavior}.
12014
12015@item -r @var{tag}[:@var{date}]
12016Checkout the revision already tagged with @var{tag} or, when @var{date} is
12017specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12018as it existed on @var{date}.  See @ref{Common options}.
12019
12020@item -s
12021Like -c, but include module status.  See @ref{checkout options}.
12022@end table
12023
12024@c ------------------------------------------------------------
12025@item commit [@var{options}] [@var{files}@dots{}]
12026Check changes into the repository.  See @ref{commit}.
12027
12028@table @code
12029@item -c
12030Check for valid edits before committing.  Requires a @sc{cvs} client and server
12031both version 1.12.10 or greater.
12032
12033@item -F @var{file}
12034Read log message from @var{file}.  See @ref{commit options}.
12035
12036@item -f
12037@c What is this "disables recursion"?  It is from the
12038@c on-line help; is it documented in this manual?
12039Force the file to be committed; disables recursion.
12040See @ref{commit options}.
12041
12042@item -l
12043Local; run only in current working directory.  See @ref{Recursive behavior}.
12044
12045@item -m @var{msg}
12046Use @var{msg} as log message.  See @ref{commit options}.
12047
12048@item -n
12049Do not run module program (if any).  See @ref{commit options}.
12050
12051@item -R
12052Operate recursively (default).  @xref{Recursive
12053behavior}.
12054
12055@item -r @var{rev}
12056Commit to @var{rev}.  See @ref{commit options}.
12057@c FIXME: should be dragging over text from
12058@c commit options, especially if it can be cleaned up
12059@c and made concise enough.
12060@end table
12061
12062@c ------------------------------------------------------------
12063@item diff [@var{options}] [@var{files}@dots{}]
12064Show differences between revisions.  See @ref{diff}.
12065In addition to the options shown below, accepts a wide
12066variety of options to control output style, for example
12067@samp{-c} for context diffs.
12068
12069@table @code
12070@item -D @var{date1}
12071Diff revision for date against working file.  See
12072@ref{diff options}.
12073
12074@item -D @var{date2}
12075Diff @var{rev1}/@var{date1} against @var{date2}.  See
12076@ref{diff options}.
12077
12078@item -l
12079Local; run only in current working directory.  See @ref{Recursive behavior}.
12080
12081@item -N
12082Include diffs for added and removed files.  See
12083@ref{diff options}.
12084
12085@item -R
12086Operate recursively (default).  @xref{Recursive
12087behavior}.
12088
12089@item -r @var{tag1}[:@var{date1}]
12090Diff the revisions specified by @var{tag1} or, when @var{date1} is specified
12091and @var{tag1} is a branch tag, the version from the branch @var{tag1} as it
12092existed on @var{date1}, against the working file.  See @ref{diff options}
12093and @ref{Common options}.
12094
12095@item -r @var{tag2}[:@var{date2}]
12096Diff the revisions specified by @var{tag2} or, when @var{date2} is specified
12097and @var{tag2} is a branch tag, the version from the branch @var{tag2} as it
12098existed on @var{date2}, against @var{rev1}/@var{date1}.  See @ref{diff options}
12099and @ref{Common options}.
12100@end table
12101
12102@c ------------------------------------------------------------
12103@item edit [@var{options}] [@var{files}@dots{}]
12104Get ready to edit a watched file.  See @ref{Editing files}.
12105
12106@table @code
12107@item -a @var{actions}
12108Specify actions for temporary watch, where
12109@var{actions} is @code{edit}, @code{unedit},
12110@code{commit}, @code{all}, or @code{none}.  See
12111@ref{Editing files}.
12112
12113@item -c
12114Check edits: Edit fails if someone else is already editing the file.
12115Requires a @sc{cvs} client and server both of version 1.12.10 or greater.
12116
12117@item -f
12118Force edit; ignore other edits.  Added in CVS 1.12.10.
12119
12120@item -l
12121Local; run only in current working directory.  See @ref{Recursive behavior}.
12122
12123@item -R
12124Operate recursively (default).  @xref{Recursive
12125behavior}.
12126@end table
12127
12128@c ------------------------------------------------------------
12129@item editors [@var{options}] [@var{files}@dots{}]
12130See who is editing a watched file.  See @ref{Watch information}.
12131
12132@table @code
12133@item -l
12134Local; run only in current working directory.  See @ref{Recursive behavior}.
12135
12136@item -R
12137Operate recursively (default).  @xref{Recursive
12138behavior}.
12139@end table
12140
12141@c ------------------------------------------------------------
12142@item export [@var{options}] @var{modules}@dots{}
12143Export files from @sc{cvs}.  See @ref{export}.
12144
12145@table @code
12146@item -D @var{date}
12147Check out revisions as of @var{date}.  See
12148@ref{Common options}.
12149
12150@item -d @var{dir}
12151Check out into @var{dir}.  See @ref{export options}.
12152
12153@item -f
12154Use head revision if tag/date not found.  See
12155@ref{Common options}.
12156
12157@item -k @var{kflag}
12158Use @var{kflag} keyword expansion.  See
12159@ref{Substitution modes}.
12160
12161@item -l
12162Local; run only in current working directory.  @xref{Recursive behavior}.
12163
12164@item -N
12165Don't ``shorten'' module paths if -d specified.  See
12166@ref{export options}.
12167
12168@item -n
12169Do not run module program (if any).  See @ref{export options}.
12170
12171@item -R
12172Operate recursively (default).  @xref{Recursive
12173behavior}.
12174
12175@item -r @var{tag}[:@var{date}]
12176Export the revisions specified by @var{tag} or, when @var{date} is specified
12177and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12178existed on @var{date}.  See @ref{Common options}.
12179@end table
12180
12181@c ------------------------------------------------------------
12182@item history [@var{options}] [@var{files}@dots{}]
12183Show repository access history.  See @ref{history}.
12184
12185@table @code
12186@item -a
12187All users (default is self).  See @ref{history options}.
12188
12189@item -b @var{str}
12190Back to record with @var{str} in module/file/repos
12191field.  See @ref{history options}.
12192
12193@item -c
12194Report on committed (modified) files.  See @ref{history options}.
12195
12196@item -D @var{date}
12197Since @var{date}.  See @ref{history options}.
12198
12199@item -e
12200Report on all record types.  See @ref{history options}.
12201
12202@item -l
12203Last modified (committed or modified report).  See @ref{history options}.
12204
12205@item -m @var{module}
12206Report on @var{module} (repeatable).  See @ref{history options}.
12207
12208@item -n @var{module}
12209In @var{module}.  See @ref{history options}.
12210
12211@item -o
12212Report on checked out modules.  See @ref{history options}.
12213
12214@item -p @var{repository}
12215In @var{repository}.  See @ref{history options}.
12216
12217@item -r @var{rev}
12218Since revision @var{rev}.  See @ref{history options}.
12219
12220@item -T
12221@c What the @#$@# is a TAG?  Same as a tag?  This
12222@c wording is also in the online-line help.
12223Produce report on all TAGs.  See @ref{history options}.
12224
12225@item -t @var{tag}
12226Since tag record placed in history file (by anyone).
12227See @ref{history options}.
12228
12229@item -u @var{user}
12230For user @var{user} (repeatable).  See @ref{history options}.
12231
12232@item -w
12233Working directory must match.  See @ref{history options}.
12234
12235@item -x @var{types}
12236Report on @var{types}, one or more of
12237@code{TOEFWUPCGMAR}.  See @ref{history options}.
12238
12239@item -z @var{zone}
12240Output for time zone @var{zone}.  See @ref{history options}.
12241@end table
12242
12243@c ------------------------------------------------------------
12244@item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
12245Import files into @sc{cvs}, using vendor branches.  See
12246@ref{import}.
12247
12248@table @code
12249@item -b @var{bra}
12250Import to vendor branch @var{bra}.  See
12251@ref{Multiple vendor branches}.
12252
12253@item -d
12254Use the file's modification time as the time of
12255import.  See @ref{import options}.
12256
12257@item -k @var{kflag}
12258Set default keyword substitution mode.  See
12259@ref{import options}.
12260
12261@item -m @var{msg}
12262Use @var{msg} for log message.  See
12263@ref{import options}.
12264
12265@item -I @var{ign}
12266More files to ignore (! to reset).  See
12267@ref{import options}.
12268
12269@item -W @var{spec}
12270More wrappers.  See @ref{import options}.
12271@end table
12272
12273@c ------------------------------------------------------------
12274@item init
12275Create a @sc{cvs} repository if it doesn't exist.  See
12276@ref{Creating a repository}.
12277
12278@c ------------------------------------------------------------
12279@item kserver
12280Kerberos authenticated server.
12281See @ref{Kerberos authenticated}.
12282
12283@c ------------------------------------------------------------
12284@item log [@var{options}] [@var{files}@dots{}]
12285Print out history information for files.  See @ref{log}.
12286
12287@table @code
12288@item -b
12289Only list revisions on the default branch.  See @ref{log options}.
12290
12291@item -d @var{dates}
12292Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12293latest before).  See @ref{log options}.
12294
12295@item -h
12296Only print header.  See @ref{log options}.
12297
12298@item -l
12299Local; run only in current working directory.  See @ref{Recursive behavior}.
12300
12301@item -N
12302Do not list tags.  See @ref{log options}.
12303
12304@item -R
12305Only print name of RCS file.  See @ref{log options}.
12306
12307@item -r@var{revs}
12308Only list revisions @var{revs}.  See @ref{log options}.
12309
12310@item -s @var{states}
12311Only list revisions with specified states.  See @ref{log options}.
12312
12313@item -t
12314Only print header and descriptive text.  See @ref{log
12315options}.
12316
12317@item -w@var{logins}
12318Only list revisions checked in by specified logins.  See @ref{log options}.
12319@end table
12320
12321@c ------------------------------------------------------------
12322@item login
12323Prompt for password for authenticating server.  See
12324@ref{Password authentication client}.
12325
12326@c ------------------------------------------------------------
12327@item logout
12328Remove stored password for authenticating server.  See
12329@ref{Password authentication client}.
12330
12331@c ------------------------------------------------------------
12332@item pserver
12333Password authenticated server.
12334See @ref{Password authentication server}.
12335
12336@c ------------------------------------------------------------
12337@item rannotate [@var{options}] [@var{modules}@dots{}]
12338Show last revision where each line was modified.  See
12339@ref{annotate}.
12340
12341@table @code
12342@item -D @var{date}
12343Annotate the most recent revision no later than
12344@var{date}.  See @ref{Common options}.
12345
12346@item -F
12347Force annotation of binary files.  (Without this option,
12348binary files are skipped with a message.)
12349
12350@item -f
12351Use head revision if tag/date not found.  See
12352@ref{Common options}.
12353
12354@item -l
12355Local; run only in current working directory.  @xref{Recursive behavior}.
12356
12357@item -R
12358Operate recursively (default).  @xref{Recursive behavior}.
12359
12360@item -r @var{tag}[:@var{date}]
12361Annotate the revision specified by @var{tag} or, when @var{date} is specified
12362and @var{tag} is a branch tag, the version from the branch @var{tag}
12363as it existed on @var{date}.  See @ref{Common options}.
12364@end table
12365
12366@c ------------------------------------------------------------
12367@item rdiff [@var{options}] @var{modules}@dots{}
12368Show differences between releases.  See @ref{rdiff}.
12369
12370@table @code
12371@item -c
12372Context diff output format (default).  See @ref{rdiff options}.
12373
12374@item -D @var{date}
12375Select revisions based on @var{date}.  See @ref{Common options}.
12376
12377@item -f
12378Use head revision if tag/date not found.  See
12379@ref{Common options}.
12380
12381@item -l
12382Local; run only in current working directory.  See @ref{Recursive behavior}.
12383
12384@item -R
12385Operate recursively (default).  @xref{Recursive
12386behavior}.
12387
12388@item -r @var{tag}[:@var{date}]
12389Select the revisions specified by @var{tag} or, when @var{date} is specified
12390and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12391existed on @var{date}.  See @ref{diff options} and @ref{Common options}.
12392
12393@item -s
12394Short patch - one liner per file.  See @ref{rdiff options}.
12395
12396@item -t
12397Top two diffs - last change made to the file.  See
12398@ref{diff options}.
12399
12400@item -u
12401Unidiff output format.  See @ref{rdiff options}.
12402
12403@item -V @var{vers}
12404Use RCS Version @var{vers} for keyword expansion (obsolete).  See
12405@ref{rdiff options}.
12406@end table
12407
12408@c ------------------------------------------------------------
12409@item release [@var{options}] @var{directory}
12410Indicate that a directory is no longer in use.  See
12411@ref{release}.
12412
12413@table @code
12414@item -d
12415Delete the given directory.  See @ref{release options}.
12416@end table
12417
12418@c ------------------------------------------------------------
12419@item remove [@var{options}] [@var{files}@dots{}]
12420Remove an entry from the repository.  See @ref{Removing files}.
12421
12422@table @code
12423@item -f
12424Delete the file before removing it.  See @ref{Removing files}.
12425
12426@item -l
12427Local; run only in current working directory.  See @ref{Recursive behavior}.
12428
12429@item -R
12430Operate recursively (default).  @xref{Recursive
12431behavior}.
12432@end table
12433
12434@c ------------------------------------------------------------
12435@item rlog [@var{options}] [@var{files}@dots{}]
12436Print out history information for modules.  See @ref{log}.
12437
12438@table @code
12439@item -b
12440Only list revisions on the default branch.  See @ref{log options}.
12441
12442@item -d @var{dates}
12443Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12444latest before).  See @ref{log options}.
12445
12446@item -h
12447Only print header.  See @ref{log options}.
12448
12449@item -l
12450Local; run only in current working directory.  See @ref{Recursive behavior}.
12451
12452@item -N
12453Do not list tags.  See @ref{log options}.
12454
12455@item -R
12456Only print name of RCS file.  See @ref{log options}.
12457
12458@item -r@var{revs}
12459Only list revisions @var{revs}.  See @ref{log options}.
12460
12461@item -s @var{states}
12462Only list revisions with specified states.  See @ref{log options}.
12463
12464@item -t
12465Only print header and descriptive text.  See @ref{log options}.
12466
12467@item -w@var{logins}
12468Only list revisions checked in by specified logins.  See @ref{log options}.
12469@end table
12470
12471@c ------------------------------------------------------------
12472@item rtag [@var{options}] @var{tag} @var{modules}@dots{}
12473Add a symbolic tag to a module.
12474See @ref{Revisions} and @ref{Branching and merging}.
12475
12476@table @code
12477@item -a
12478Clear tag from removed files that would not otherwise
12479be tagged.  See @ref{Tagging add/remove}.
12480
12481@item -b
12482Create a branch named @var{tag}.  See @ref{Branching and merging}.
12483
12484@item -B
12485Used in conjunction with -F or -d, enables movement and deletion of
12486branch tags.  Use with extreme caution.
12487
12488@item -D @var{date}
12489Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12490
12491@item -d
12492Delete @var{tag}.  See @ref{Modifying tags}.
12493
12494@item -F
12495Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12496
12497@item -f
12498Force a head revision match if tag/date not found.
12499See @ref{Tagging by date/tag}.
12500
12501@item -l
12502Local; run only in current working directory.  See @ref{Recursive behavior}.
12503
12504@item -n
12505No execution of tag program.  See @ref{Common options}.
12506
12507@item -R
12508Operate recursively (default).  @xref{Recursive
12509behavior}.
12510
12511@item -r @var{tag}[:@var{date}]
12512Tag the revision already tagged with @var{tag} or, when @var{date} is specified
12513and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12514existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12515@end table
12516
12517@c ------------------------------------------------------------
12518@item server
12519Rsh server.  See @ref{Connecting via rsh}.
12520
12521@c ------------------------------------------------------------
12522@item status [@var{options}] @var{files}@dots{}
12523Display status information in a working directory.  See
12524@ref{File status}.
12525
12526@table @code
12527@item -l
12528Local; run only in current working directory.  See @ref{Recursive behavior}.
12529
12530@item -R
12531Operate recursively (default).  @xref{Recursive behavior}.
12532
12533@item -v
12534Include tag information for file.  See @ref{Tags}.
12535@end table
12536
12537@c ------------------------------------------------------------
12538@item tag [@var{options}] @var{tag} [@var{files}@dots{}]
12539Add a symbolic tag to checked out version of files.
12540See @ref{Revisions} and @ref{Branching and merging}.
12541
12542@table @code
12543@item -b
12544Create a branch named @var{tag}.  See @ref{Branching and merging}.
12545
12546@item -c
12547Check that working files are unmodified.  See
12548@ref{Tagging the working directory}.
12549
12550@item -D @var{date}
12551Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12552
12553@item -d
12554Delete @var{tag}.  See @ref{Modifying tags}.
12555
12556@item -F
12557Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12558
12559@item -f
12560Force a head revision match if tag/date not found.
12561See @ref{Tagging by date/tag}.
12562
12563@item -l
12564Local; run only in current working directory.  See @ref{Recursive behavior}.
12565
12566@item -R
12567Operate recursively (default).  @xref{Recursive behavior}.
12568
12569@item -r @var{tag}[:@var{date}]
12570Tag the revision already tagged with @var{tag}, or when @var{date} is specified
12571and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12572existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12573@end table
12574
12575@c ------------------------------------------------------------
12576@item unedit [@var{options}] [@var{files}@dots{}]
12577Undo an edit command.  See @ref{Editing files}.
12578
12579@table @code
12580@item -l
12581Local; run only in current working directory.  See @ref{Recursive behavior}.
12582
12583@item -R
12584Operate recursively (default).  @xref{Recursive behavior}.
12585@end table
12586
12587@c ------------------------------------------------------------
12588@item update [@var{options}] [@var{files}@dots{}]
12589Bring work tree in sync with repository.  See
12590@ref{update}.
12591
12592@table @code
12593@item -A
12594Reset any sticky tags/date/options.  See @ref{Sticky
12595tags} and @ref{Keyword substitution}.
12596
12597@item -C
12598Overwrite locally modified files with clean copies from
12599the repository (the modified file is saved in
12600@file{.#@var{file}.@var{revision}}, however).
12601
12602@item -D @var{date}
12603Check out revisions as of @var{date} (is sticky).  See
12604@ref{Common options}.
12605
12606@item -d
12607Create directories.  See @ref{update options}.
12608
12609@item -f
12610Use head revision if tag/date not found.  See
12611@ref{Common options}.
12612
12613@item -I @var{ign}
12614More files to ignore (! to reset).  See
12615@ref{import options}.
12616
12617@c Probably want to use rev1/rev2 style like for diff
12618@c -r.  Here and in on-line help.
12619@item -j @var{tag}[:@var{date}]
12620Merge in changes from revisions specified by @var{tag} or, when @var{date} is
12621specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12622as it existed on @var{date}.  See @ref{update options}.
12623
12624@item -k @var{kflag}
12625Use @var{kflag} keyword expansion.  See
12626@ref{Substitution modes}.
12627
12628@item -l
12629Local; run only in current working directory.  @xref{Recursive behavior}.
12630
12631@item -P
12632Prune empty directories.  See @ref{Moving directories}.
12633
12634@item -p
12635Check out files to standard output (avoids
12636stickiness).  See @ref{update options}.
12637
12638@item -R
12639Operate recursively (default).  @xref{Recursive
12640behavior}.
12641
12642@item -r @var{tag}[:@var{date}]
12643Checkout the revisions specified by @var{tag} or, when @var{date} is specified
12644and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12645existed on @var{date}.  See @ref{Common options}.
12646
12647@item -W @var{spec}
12648More wrappers.  See @ref{import options}.
12649@end table
12650
12651@c ------------------------------------------------------------
12652@item version
12653@cindex version (subcommand)
12654
12655Display the version of @sc{cvs} being used.  If the repository
12656is remote, display both the client and server versions.
12657
12658@c ------------------------------------------------------------
12659@item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
12660
12661on/off: turn on/off read-only checkouts of files.  See
12662@ref{Setting a watch}.
12663
12664add/remove: add or remove notification on actions.  See
12665@ref{Getting Notified}.
12666
12667@table @code
12668@item -a @var{actions}
12669Specify actions for temporary watch, where
12670@var{actions} is @code{edit}, @code{unedit},
12671@code{commit}, @code{all}, or @code{none}.  See
12672@ref{Editing files}.
12673
12674@item -l
12675Local; run only in current working directory.  See @ref{Recursive behavior}.
12676
12677@item -R
12678Operate recursively (default).  @xref{Recursive
12679behavior}.
12680@end table
12681
12682@c ------------------------------------------------------------
12683@item watchers [@var{options}] [@var{files}@dots{}]
12684See who is watching a file.  See @ref{Watch information}.
12685
12686@table @code
12687@item -l
12688Local; run only in current working directory.  See @ref{Recursive behavior}.
12689
12690@item -R
12691Operate recursively (default).  @xref{Recursive
12692behavior}.
12693@end table
12694
12695@end table
12696
12697@c ---------------------------------------------------------------------
12698@node Administrative files
12699@appendix Reference manual for Administrative files
12700@cindex Administrative files (reference)
12701@cindex Files, reference manual
12702@cindex Reference manual (files)
12703@cindex CVSROOT (file)
12704
12705Inside the repository, in the directory
12706@file{$CVSROOT/CVSROOT}, there are a number of
12707supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
12708fashion without any of them, but if they are set up
12709properly they can help make life easier.  For a
12710discussion of how to edit them, see @ref{Intro
12711administrative files}.
12712
12713The most important of these files is the @file{modules}
12714file, which defines the modules inside the repository.
12715
12716@menu
12717* modules::                     Defining modules
12718* Wrappers::                    Specify binary-ness based on file name
12719* Trigger Scripts::		Launch scripts in response to server events
12720* rcsinfo::                     Templates for the log messages
12721* cvsignore::                   Ignoring files via cvsignore
12722* checkoutlist::                Adding your own administrative files
12723* history file::                History information
12724* Variables::                   Various variables are expanded
12725* config::                      Miscellaneous CVS configuration
12726@end menu
12727
12728@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12729@node modules
12730@appendixsec The modules file
12731@cindex Modules (admin file)
12732@cindex Defining modules (reference manual)
12733
12734The @file{modules} file records your definitions of
12735names for collections of source code.  @sc{cvs} will
12736use these definitions if you use @sc{cvs} to update the
12737modules file (use normal commands like @code{add},
12738@code{commit}, etc).
12739
12740The @file{modules} file may contain blank lines and
12741comments (lines beginning with @samp{#}) as well as
12742module definitions.  Long lines can be continued on the
12743next line by specifying a backslash (@samp{\}) as the
12744last character on the line.
12745
12746There are three basic types of modules: alias modules,
12747regular modules, and ampersand modules.  The difference
12748between them is the way that they map files in the
12749repository to files in the working directory.  In all
12750of the following examples, the top-level repository
12751contains a directory called @file{first-dir}, which
12752contains two files, @file{file1} and @file{file2}, and a
12753directory @file{sdir}.  @file{first-dir/sdir} contains
12754a file @file{sfile}.
12755
12756@c FIXME: should test all the examples in this section.
12757
12758@menu
12759* Alias modules::             The simplest kind of module
12760* Regular modules::
12761* Ampersand modules::
12762* Excluding directories::     Excluding directories from a module
12763* Module options::            Regular and ampersand modules can take options
12764* Module program options::    How the modules ``program options'' programs
12765                              are run.
12766@end menu
12767
12768@node Alias modules
12769@appendixsubsec Alias modules
12770@cindex Alias modules
12771@cindex -a, in modules file
12772
12773Alias modules are the simplest kind of module:
12774
12775@table @code
12776@item @var{mname} -a @var{aliases}@dots{}
12777This represents the simplest way of defining a module
12778@var{mname}.  The @samp{-a} flags the definition as a
12779simple alias: @sc{cvs} will treat any use of @var{mname} (as
12780a command argument) as if the list of names
12781@var{aliases} had been specified instead.
12782@var{aliases} may contain either other module names or
12783paths.  When you use paths in aliases, @code{checkout}
12784creates all intermediate directories in the working
12785directory, just as if the path had been specified
12786explicitly in the @sc{cvs} arguments.
12787@end table
12788
12789For example, if the modules file contains:
12790
12791@example
12792amodule -a first-dir
12793@end example
12794
12795@noindent
12796then the following two commands are equivalent:
12797
12798@example
12799$ cvs co amodule
12800$ cvs co first-dir
12801@end example
12802
12803@noindent
12804and they each would provide output such as:
12805
12806@example
12807cvs checkout: Updating first-dir
12808U first-dir/file1
12809U first-dir/file2
12810cvs checkout: Updating first-dir/sdir
12811U first-dir/sdir/sfile
12812@end example
12813
12814@node Regular modules
12815@appendixsubsec Regular modules
12816@cindex Regular modules
12817
12818@table @code
12819@item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12820In the simplest case, this form of module definition
12821reduces to @samp{@var{mname} @var{dir}}.  This defines
12822all the files in directory @var{dir} as module @var{mname}.
12823@var{dir} is a relative path (from @code{$CVSROOT}) to a
12824directory of source in the source repository.  In this
12825case, on checkout, a single directory called
12826@var{mname} is created as a working directory; no
12827intermediate directory levels are used by default, even
12828if @var{dir} was a path involving several directory
12829levels.
12830@end table
12831
12832For example, if a module is defined by:
12833
12834@example
12835regmodule first-dir
12836@end example
12837
12838@noindent
12839then regmodule will contain the files from first-dir:
12840
12841@example
12842$ cvs co regmodule
12843cvs checkout: Updating regmodule
12844U regmodule/file1
12845U regmodule/file2
12846cvs checkout: Updating regmodule/sdir
12847U regmodule/sdir/sfile
12848$
12849@end example
12850
12851By explicitly specifying files in the module definition
12852after @var{dir}, you can select particular files from
12853directory @var{dir}.  Here is
12854an example:
12855
12856@example
12857regfiles first-dir/sdir sfile
12858@end example
12859
12860@noindent
12861With this definition, getting the regfiles module
12862will create a single working directory
12863@file{regfiles} containing the file listed, which
12864comes from a directory deeper
12865in the @sc{cvs} source repository:
12866
12867@example
12868$ cvs co regfiles
12869U regfiles/sfile
12870$
12871@end example
12872
12873@node Ampersand modules
12874@appendixsubsec Ampersand modules
12875@cindex Ampersand modules
12876@cindex &, in modules file
12877
12878A module definition can refer to other modules by
12879including @samp{&@var{module}} in its definition.
12880@example
12881@var{mname} [ options ] @var{&module}@dots{}
12882@end example
12883
12884Then getting the module creates a subdirectory for each such
12885module, in the directory containing the module.  For
12886example, if modules contains
12887
12888@example
12889ampermod &first-dir
12890@end example
12891
12892@noindent
12893then a checkout will create an @code{ampermod} directory
12894which contains a directory called @code{first-dir},
12895which in turns contains all the directories and files
12896which live there.  For example, the command
12897
12898@example
12899$ cvs co ampermod
12900@end example
12901
12902@noindent
12903will create the following files:
12904
12905@example
12906ampermod/first-dir/file1
12907ampermod/first-dir/file2
12908ampermod/first-dir/sdir/sfile
12909@end example
12910
12911There is one quirk/bug: the messages that @sc{cvs}
12912prints omit the @file{ampermod}, and thus do not
12913correctly display the location to which it is checking
12914out the files:
12915
12916@example
12917$ cvs co ampermod
12918cvs checkout: Updating first-dir
12919U first-dir/file1
12920U first-dir/file2
12921cvs checkout: Updating first-dir/sdir
12922U first-dir/sdir/sfile
12923$
12924@end example
12925
12926Do not rely on this buggy behavior; it may get fixed in
12927a future release of @sc{cvs}.
12928
12929@c FIXCVS: What happens if regular and & modules are
12930@c combined, as in "ampermodule first-dir &second-dir"?
12931@c When I tried it, it seemed to just ignore the
12932@c "first-dir".  I think perhaps it should be an error
12933@c (but this needs further investigation).
12934@c In addition to discussing what each one does, we
12935@c should put in a few words about why you would use one or
12936@c the other in various situations.
12937
12938@node Excluding directories
12939@appendixsubsec Excluding directories
12940@cindex Excluding directories, in modules file
12941@cindex !, in modules file
12942
12943An alias module may exclude particular directories from
12944other modules by using an exclamation mark (@samp{!})
12945before the name of each directory to be excluded.
12946
12947For example, if the modules file contains:
12948
12949@example
12950exmodule -a !first-dir/sdir first-dir
12951@end example
12952
12953@noindent
12954then checking out the module @samp{exmodule} will check
12955out everything in @samp{first-dir} except any files in
12956the subdirectory @samp{first-dir/sdir}.
12957@c Note that the "!first-dir/sdir" sometimes must be listed
12958@c before "first-dir".  That seems like a probable bug, in which
12959@c case perhaps it should be fixed (to allow either
12960@c order) rather than documented.  See modules4 in testsuite.
12961
12962@node Module options
12963@appendixsubsec Module options
12964@cindex Options, in modules file
12965
12966Either regular modules or ampersand modules can contain
12967options, which supply additional information concerning
12968the module.
12969
12970@table @code
12971@cindex -d, in modules file
12972@item -d @var{name}
12973Name the working directory something other than the
12974module name.
12975@c FIXME: Needs a bunch of examples, analogous to the
12976@c examples for alias, regular, and ampersand modules
12977@c which show where the files go without -d.
12978
12979@cindex Export program
12980@cindex -e, in modules file
12981@item -e @var{prog}
12982Specify a program @var{prog} to run whenever files in a
12983module are exported.  @var{prog} runs with a single
12984argument, the module name.
12985@c FIXME: Is it run on server? client?
12986
12987@cindex Checkout program
12988@cindex -o, in modules file
12989@item -o @var{prog}
12990Specify a program @var{prog} to run whenever files in a
12991module are checked out.  @var{prog} runs with a single
12992argument, the module name.  See @ref{Module program options} for
12993information on how @var{prog} is called.
12994@c FIXME: Is it run on server? client?
12995
12996@cindex Status of a module
12997@cindex Module status
12998@cindex -s, in modules file
12999@item -s @var{status}
13000Assign a status to the module.  When the module file is
13001printed with @samp{cvs checkout -s} the modules are
13002sorted according to primarily module status, and
13003secondarily according to the module name.  This option
13004has no other meaning.  You can use this option for
13005several things besides status: for instance, list the
13006person that is responsible for this module.
13007
13008@cindex Tag program
13009@cindex -t, in modules file
13010@item -t @var{prog}
13011Specify a program @var{prog} to run whenever files in a
13012module are tagged with @code{rtag}.  @var{prog} runs
13013with two arguments: the module name and the symbolic
13014tag specified to @code{rtag}.  It is not run
13015when @code{tag} is executed.  Generally you will find
13016that the @file{taginfo} file is a better solution (@pxref{taginfo}).
13017@c FIXME: Is it run on server? client?
13018@c Problems with -t include:
13019@c * It is run after the tag not before
13020@c * It doesn't get passed all the information that
13021@c   taginfo does ("mov", &c).
13022@c * It only is run for rtag, not tag.
13023@end table
13024
13025You should also see @pxref{Module program options} about how the
13026``program options'' programs are run.
13027
13028@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13029
13030@node Module program options
13031@appendixsubsec How the modules file ``program options'' programs are run
13032@cindex Modules file program options
13033@cindex -t, in modules file
13034@cindex -o, in modules file
13035@cindex -e, in modules file
13036
13037@noindent
13038For checkout, rtag, and export, the program is server-based, and as such the
13039following applies:-
13040
13041If using remote access methods (pserver, ext, etc.),
13042@sc{cvs} will execute this program on the server from a temporary
13043directory. The path is searched for this program.
13044
13045If using ``local access'' (on a local or remote NFS file system, i.e.
13046repository set just to a path),
13047the program will be executed from the newly checked-out tree, if
13048found there, or alternatively searched for in the path if not.
13049
13050The programs are all run after the operation has effectively
13051completed.
13052
13053
13054@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13055@node Wrappers
13056@appendixsec The cvswrappers file
13057@cindex cvswrappers (admin file)
13058@cindex CVSWRAPPERS, environment variable
13059@cindex Wrappers
13060
13061@c FIXME: need some better way of separating this out
13062@c by functionality.  -m is
13063@c one feature, and -k is a another.  And this discussion
13064@c should be better motivated (e.g. start with the
13065@c problems, then explain how the feature solves it).
13066
13067Wrappers refers to a @sc{cvs} feature which lets you
13068control certain settings based on the name of the file
13069which is being operated on.  The settings are @samp{-k}
13070for binary files, and @samp{-m} for nonmergeable text
13071files.
13072
13073The @samp{-m} option
13074specifies the merge methodology that should be used when
13075a non-binary file is updated.  @code{MERGE} means the usual
13076@sc{cvs} behavior: try to merge the files.  @code{COPY}
13077means that @code{cvs update} will refuse to merge
13078files, as it also does for files specified as binary
13079with @samp{-kb} (but if the file is specified as
13080binary, there is no need to specify @samp{-m 'COPY'}).
13081@sc{cvs} will provide the user with the
13082two versions of the files, and require the user using
13083mechanisms outside @sc{cvs}, to insert any necessary
13084changes.
13085
13086@emph{WARNING: do not use @code{COPY} with
13087@sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
13088copy one version of your file over the other, wiping
13089out the previous contents.}
13090@c Ordinarily we don't document the behavior of old
13091@c versions.  But this one is so dangerous, I think we
13092@c must.  I almost renamed it to -m 'NOMERGE' so we
13093@c could say "never use -m 'COPY'".
13094The @samp{-m} wrapper option only affects behavior when
13095merging is done on update; it does not affect how files
13096are stored.  See @ref{Binary files}, for more on
13097binary files.
13098
13099The basic format of the file @file{cvswrappers} is:
13100
13101@c FIXME: @example is all wrong for this.  Use @deffn or
13102@c something more sensible.
13103@example
13104wildcard     [option value][option value]...
13105
13106where option is one of
13107-m           update methodology      value: MERGE or COPY
13108-k           keyword expansion       value: expansion mode
13109
13110and value is a single-quote delimited value.
13111@end example
13112
13113@ignore
13114@example
13115*.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
13116*.c      -t 'indent %s %s'
13117@end example
13118@c When does the filter need to be an absolute pathname
13119@c and when will something like the above work?  I
13120@c suspect it relates to the PATH of the server (which
13121@c in turn depends on all kinds of stuff, e.g. inetd
13122@c for pserver).  I'm not sure whether/where to discuss
13123@c this.
13124@c FIXME: What do the %s's stand for?
13125
13126@noindent
13127The above example of a @file{cvswrappers} file
13128states that all files/directories that end with a @code{.nib}
13129should be filtered with the @file{wrap} program before
13130checking the file into the repository. The file should
13131be filtered though the @file{unwrap} program when the
13132file is checked out of the repository. The
13133@file{cvswrappers} file also states that a @code{COPY}
13134methodology should be used when updating the files in
13135the repository (that is, no merging should be performed).
13136
13137@c What pitfalls arise when using indent this way?  Is
13138@c it a winning thing to do?  Would be nice to at least
13139@c hint at those issues; we want our examples to tell
13140@c how to solve problems, not just to say that cvs can
13141@c do certain things.
13142The last example line says that all files that end with
13143@code{.c} should be filtered with @file{indent}
13144before being checked into the repository. Unlike the previous
13145example, no filtering of the @code{.c} file is done when
13146it is checked out of the repository.
13147@noindent
13148The @code{-t} filter is called with two arguments,
13149the first is the name of the file/directory to filter
13150and the second is the pathname to where the resulting
13151filtered file should be placed.
13152
13153@noindent
13154The @code{-f} filter is called with one argument,
13155which is the name of the file to filter from. The end
13156result of this filter will be a file in the users directory
13157that they can work on as they normally would.
13158
13159Note that the @samp{-t}/@samp{-f} features do not
13160conveniently handle one portion of @sc{cvs}'s operation:
13161determining when files are modified.  @sc{cvs} will still
13162want a file (or directory) to exist, and it will use
13163its modification time to determine whether a file is
13164modified.  If @sc{cvs} erroneously thinks a file is
13165unmodified (for example, a directory is unchanged but
13166one of the files within it is changed), you can force
13167it to check in the file anyway by specifying the
13168@samp{-f} option to @code{cvs commit} (@pxref{commit
13169options}).
13170@c This is, of course, a serious design flaw in -t/-f.
13171@c Probably the whole functionality needs to be
13172@c redesigned (starting from requirements) to fix this.
13173@end ignore
13174
13175@c FIXME: We don't document -W or point to where it is
13176@c documented.  Or .cvswrappers.
13177For example, the following command imports a
13178directory, treating files whose name ends in
13179@samp{.exe} as binary:
13180
13181@example
13182cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
13183@end example
13184
13185@c Another good example, would be storing files
13186@c (e.g. binary files) compressed in the repository.
13187@c 	::::::::::::::::::
13188@c 	cvswrappers
13189@c 	::::::::::::::::::
13190@c 	*.t12 -m 'COPY'
13191@c 	*.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
13192@c
13193@c	::::::::::::::::::
13194@c	gunzipcp
13195@c	::::::::::::::::::
13196@c	:
13197@c	[ -f $1 ] || exit 1
13198@c	zcat $1 > /tmp/.#$1.$$
13199@c	mv /tmp/.#$1.$$ $1
13200@c
13201@c	::::::::::::::::::
13202@c	gzipcp
13203@c	::::::::::::::::::
13204@c	:
13205@c	DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
13206@c	if [ ! -d $DIRNAME ] ; then
13207@c	      DIRNAME=`echo $1 | sed -e "s|.*/||g"`
13208@c	fi
13209@c	gzip -c  $DIRNAME  > $2
13210@c One catch--"cvs diff" will not invoke the wrappers
13211@c (probably a CVS bug, although I haven't thought it out).
13212
13213@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13214@node Trigger Scripts
13215@appendixsec The Trigger Scripts
13216@cindex info files
13217@cindex trigger scripts
13218@cindex script hooks
13219
13220@c FIXME
13221@c Somewhere there needs to be a more "how-to" guide to writing these.
13222@c One particular issue that people sometimes are worried about is performance,
13223@c and the impact of writing in perl or sh or ____.  Performance comparisons
13224@c should probably remain outside the scope of this document, but at least
13225@c _that_ much could be referenced, perhaps with links to other sources.
13226
13227Several of the administrative files support triggers, or the launching external
13228scripts or programs at specific times before or after particular events, during
13229the execution of @sc{cvs} commands.  These hooks can be used to prevent certain
13230actions, log them, and/or maintain anything else you deem practical.
13231
13232All the trigger scripts are launched in a copy of the user sandbox being
13233committed, on the server, in client-server mode.  In local mode, the scripts
13234are actually launched directly from the user sandbox directory being committed.
13235For most intents and purposes, the same scripts can be run in both locations
13236without alteration.
13237
13238@menu
13239* syntax::                      The common syntax
13240* Trigger Script Security::	Trigger script security
13241
13242* commit files::                The commit support files (commitinfo,
13243                                verifymsg, loginfo)
13244*   commitinfo::                Pre-commit checking
13245*   verifymsg::                 How are log messages evaluated?
13246*   loginfo::                   Where should log messages be sent?
13247
13248* postadmin::			Logging admin commands
13249* taginfo::                     Verifying/Logging tags
13250* posttag::                     Logging tags
13251* postwatch::			Logging watch commands
13252
13253* preproxy::			Launch a script on a secondary server prior
13254				to becoming a write proxy
13255* postproxy::			Launch a script on a secondary server after
13256				completing proxy operations
13257@end menu
13258
13259@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13260@node syntax
13261@appendixsubsec The common syntax
13262@cindex info files, common syntax
13263@cindex script hooks, common syntax
13264@cindex trigger script hooks, common syntax
13265@cindex syntax of trigger script hooks
13266
13267@c FIXME: having this so totally separate from the
13268@c Variables node is rather bogus.
13269
13270The administrative files such as @file{commitinfo},
13271@file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
13272all have a common format.  The purpose of the files are
13273described later on.  The common syntax is described
13274here.
13275
13276@cindex Regular expression syntax
13277Each line contains the following:
13278
13279@itemize @bullet
13280@cindex @samp{ALL} keyword, in lieu of regular expressions in script hooks
13281@cindex @samp{DEFAULT} keyword, in lieu of regular expressions in script hooks
13282@item
13283A regular expression or the literal string @samp{DEFAULT}.  Some script hooks
13284also support the literal string @samp{ALL}.  Other than the @samp{ALL} and
13285@samp{DEFAULT} keywords, this is a basic regular expression in the syntax used
13286by GNU emacs.  See the descriptions of the individual script hooks for
13287information on whether the @samp{ALL} keyword is supported
13288(@pxref{Trigger Scripts}).
13289@c FIXME: What we probably should be saying is "POSIX Basic
13290@c Regular Expression with the following extensions (`\('
13291@c `\|' '+' etc)"
13292@c rather than define it with reference to emacs.
13293@c The reference to emacs is not strictly speaking
13294@c true, as we don't support \=, \s, or \S.  Also it isn't
13295@c clear we should document and/or promise to continue to
13296@c support all the obscure emacs extensions like \<.
13297@c Also need to better cite (or include) full
13298@c documentation for the syntax.
13299@c Also see comment in configure.in about what happens to the
13300@c syntax if we pick up a system-supplied regexp matcher.
13301
13302@item
13303A whitespace separator---one or more spaces and/or tabs.
13304
13305@item
13306A file name or command-line template.
13307@end itemize
13308
13309@noindent
13310Blank lines are ignored.  Lines that start with the
13311character @samp{#} are treated as comments.  Long lines
13312unfortunately can @emph{not} be broken in two parts in
13313any way.
13314
13315The first regular expression that matches the current
13316directory name in the repository or the first line containing @samp{DEFAULT}
13317in lieu of a regular expression is used and all lines containing @samp{ALL} is
13318used for the hooks which support the @samp{ALL} keyword.  The rest of the line
13319is used as a file name or command-line template as appropriate.  See the
13320descriptions of the individual script hooks for information on whether the
13321@samp{ALL} keyword is supported (@pxref{Trigger Scripts}).
13322
13323@cindex format strings
13324@cindex format strings, common syntax
13325@cindex info files, common syntax, format strings
13326@cindex Common syntax of info files, format strings
13327@noindent
13328@emph{Note:  The following information on format strings is valid
13329as long as the line @code{UseNewInfoFmtStrings=yes} appears in
13330your repository's config file (@pxref{config}).  Otherwise,
13331default format strings may be appended to the command line and
13332the @samp{loginfo} file, especially, can exhibit slightly
13333different behavior.  For more information,
13334@xref{Updating Commit Files}.}
13335
13336In the cases where the second segment of the matched line is a
13337command line template (e.g. @file{commitinfo}, @file{loginfo},
13338& @file{verifymsg}), the command line template may contain format
13339strings which will be replaced with specific values before the
13340script is run.
13341@c FIXCVS then FIXME - it really would make sense to allow %r & maybe even %p
13342@c to be used in rcsinfo to construct a path, but I haven't
13343@c coded this yet.
13344
13345Format strings can represent a single variable or one or more
13346attributes of a list variable.  An example of a list variable
13347would be the list available to scripts hung on the loginfo hooks
13348- the list of files which were just committed.  In the case of
13349loginfo, three attributes are available for each list item: file
13350name, precommit version, and postcommit version.
13351
13352Format strings consist of a @samp{%} character followed by an optional
13353@samp{@{} (required in the multiple list attribute case), a
13354single format character representing a variable or a single attribute of
13355list elements or multiple format characters representing attributes of
13356list elements, and a closing @samp{@}} when the open bracket was present.
13357
13358@emph{Flat format strings}, or single format characters which get replaced
13359with a single value, will generate a single argument
13360to the called script, regardless of whether the replacement variable contains
13361white space or other special characters.
13362
13363@emph{List attributes} will generate an argument for each attribute
13364requested for each list item.  For example, @samp{%@{sVv@}}
13365in a @file{loginfo} command template will generate three
13366arguments (file name, precommit version, postcommit version,
13367...) for each file committed.  As in the flat format string
13368case, each attribute will be passed in as a single argument
13369regardless of whether it contains white space or other
13370special characters.
13371
13372@samp{%%} will be replaced with a literal @samp{%}.
13373
13374The format strings available to all script hooks are:
13375
13376@table @t
13377@item c
13378The canonical name of the command being executed.  For instance, in the case of
13379a hook run from @code{cvs up}, @sc{cvs} would replace @samp{%c} with the string
13380@samp{update} and, in the case of a hook run from @code{cvs ci}, @sc{cvs} would
13381replace @samp{%c} with the string @samp{commit}.
13382@item n
13383The null, or empty, string.
13384@item p
13385The name of the directory being operated on within the repository.
13386@item r
13387The name of the repository (the path portion of @code{$CVSROOT}).
13388@item R
13389On a server, the name of the referrer, if any.  The referrer is the CVSROOT the
13390client reports it used to contact a server which then referred it to this
13391server.  Should usually be set on a primary server with a write proxy setup.
13392@end table
13393
13394Other format strings are file specific.  See the docs on the
13395particular script hooks for more information
13396(@pxref{Trigger Scripts}).
13397
13398As an example, the following line in a @file{loginfo} file would
13399match only the directory @file{module} and any subdirectories of
13400@file{module}:
13401
13402@example
13403^module\(/\|$\) (echo; echo %p; echo %@{sVv@}; cat) >>$CVSROOT/CVSROOT/commitlog
13404@end example
13405
13406Using this same line and assuming a commit of new revisions
134071.5.4.4 and 1.27.4.1 based on old revisions 1.5.4.3 and 1.27,
13408respectively, of file1 and file2 in module, something like the
13409following log message should be appended to commitlog:
13410
13411@example
13412
13413module
13414file1 1.5.4.3 1.5.4.4 file2 1.27 1.27.4.1
13415Update of /cvsroot/module
13416In directory localhost.localdomain:/home/jrandom/work/module
13417
13418Modified Files:
13419	file1 file2
13420Log Message:
13421A log message.
13422@end example
13423
13424@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13425@node Trigger Script Security
13426@appendixsubsec Security and the Trigger Scripts
13427@cindex info files, security
13428@cindex script hooks, security
13429@cindex trigger scripts, security
13430
13431Security is a huge subject, and implementing a secure system is a non-trivial
13432task.  This section will barely touch on all the issues involved, but it is
13433well to note that, as with any script you will be allowing an untrusted
13434user to run on your server, there are measures you can take to help prevent
13435your trigger scripts from being abused.
13436
13437For instance, since the CVS trigger scripts all run in a copy of the user's
13438sandbox on the server, a naively coded Perl trigger script which attempts to
13439use a Perl module that is not installed on the system can be hijacked by any
13440user with commit access who is checking in a file with the correct name.  Other
13441scripting languages may be vulnerable to similar hacks.
13442
13443One way to make a script more secure, at least with Perl, is to use scripts
13444which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
13445In the most basic terms, this causes Perl to avoid running code that may have
13446come from an external source.  Please run the @code{perldoc perlsec} command
13447for more on Perl security.  Again, other languages may implement other security
13448verification hooks which look more or less like Perl's "taint-check" mechanism.
13449
13450@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13451@node commit files
13452@appendixsubsec The commit support files
13453@cindex Commits, administrative support files
13454@cindex commit files, see Info files
13455
13456The @samp{-i} flag in the @file{modules} file can be
13457used to run a certain program whenever files are
13458committed (@pxref{modules}).  The files described in
13459this section provide other, more flexible, ways to run
13460programs whenever something is committed.
13461
13462There are three kinds of programs that can be run on
13463commit.  They are specified in files in the repository,
13464as described below.  The following table summarizes the
13465file names and the purpose of the corresponding
13466programs.
13467
13468@table @file
13469@item commitinfo
13470The program is responsible for checking that the commit
13471is allowed.  If it exits with a non-zero exit status
13472the commit will be aborted.  @xref{commitinfo}.
13473
13474@item verifymsg
13475The specified program is used to evaluate the log message,
13476and possibly verify that it contains all required
13477fields.  This is most useful in combination with the
13478@file{rcsinfo} file, which can hold a log message
13479template (@pxref{rcsinfo}).  @xref{verifymsg}.
13480
13481@item loginfo
13482The specified program is called when the commit is
13483complete.  It receives the log message and some
13484additional information and can store the log message in
13485a file, or mail it to appropriate persons, or maybe
13486post it to a local newsgroup, or@dots{}  Your
13487imagination is the limit!  @xref{loginfo}.
13488@end table
13489
13490@menu
13491* Updating Commit Files::       Updating legacy repositories to stop using
13492                                deprecated command line template formats
13493@end menu
13494
13495@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13496@node Updating Commit Files
13497@appendixsubsubsec  Updating legacy repositories to stop using deprecated command line template formats
13498@cindex info files, common syntax, updating legacy repositories
13499@cindex Syntax of info files, updating legacy repositories
13500@cindex Common syntax of info files, updating legacy repositories
13501New repositories are created set to use the new format strings by default, so
13502if you are creating a new repository, you shouldn't have to worry about this
13503section.
13504
13505If you are attempting to maintain a legacy repository which was
13506making use of the @file{commitinfo}, @file{editinfo}, @file{verifymsg},
13507@file{loginfo}, and/or @file{taginfo} script hooks, you should have no
13508immediate problems with using the current @sc{cvs} executable, but your users
13509will probably start to see deprecation warnings.
13510
13511The reason for this is that all of the script hooks have been updated to
13512use a new command line parser that extensibly supports multiple
13513@file{loginfo} & @file{notify} style format strings (@pxref{syntax})
13514and this support is not completely compatible with the old style format
13515strings.
13516
13517The quick upgrade method is to stick a @samp{1} after each format string
13518in your old @file{loginfo} file.  For example:
13519
13520@example
13521DEFAULT (echo ""; id; echo %@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13522@end example
13523
13524would become:
13525
13526@example
13527DEFAULT (echo ""; id; echo %1@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13528@end example
13529
13530If you were counting on the fact that only the first @samp{%} in the line was
13531replaced as a format string, you may also have to double up any further
13532percent signs on the line.
13533
13534If you did this all at once and checked it in, everything should still be
13535running properly.
13536
13537Now add the following line to your config file (@pxref{config}):
13538@example
13539UseNewInfoFmtStrings=yes
13540@end example
13541
13542Everything should still be running properly, but your users will probably
13543start seeing new deprecation warnings.
13544
13545Dealing with the deprecation warnings now generated by @file{commitinfo},
13546@file{editinfo}, @file{verifymsg}, and @file{taginfo} should be easy.  Simply
13547specify what are currently implicit arguments explicitly.  This means appending
13548the following strings to each active command line template in each file:
13549@table @code
13550@item commitinfo
13551@samp{ %r/%p %s}
13552@item editinfo
13553@samp{ %l}
13554@item taginfo
13555@samp{ %t %o %p %@{sv@}}
13556@item verifymsg
13557@samp{ %l}
13558@end table
13559
13560If you don't desire that any of the newly available information be passed to
13561the scripts hanging off of these hooks, no further modifications to these
13562files should be necessary to insure current and future compatibility with
13563@sc{cvs}'s format strings.
13564
13565Fixing @file{loginfo} could be a little tougher.  The old style
13566@file{loginfo} format strings caused a single space and comma separated
13567argument to be passed in in place of the format string.  This is what will
13568continue to be generated due to the deprecated @samp{1} you inserted into
13569the format strings.
13570
13571Since the new format separates each individual item and passes it into the
13572script as a separate argument (for a good reason - arguments containing commas
13573and/or white space are now parsable), to remove the deprecated @samp{1} from
13574your @file{loginfo} command line templates, you will most likely have to
13575rewrite any scripts called by the hook to handle the new argument format.
13576
13577Also note that the way @samp{%} followed by unrecognized characters and by
13578@samp{@{@}} was treated in past versions of CVS is not strictly adhered to as
13579there were bugs in the old versions.  Specifically, @samp{%@{@}} would eat the
13580next character and unrecognized strings resolved only to the empty string,
13581which was counter to what was stated in the documentation.  This version will
13582do what the documentation said it should have (if you were using only some
13583combination of @samp{%@{sVv@}}, e.g. @samp{%@{sVv@}}, @samp{%@{sV@}}, or
13584@samp{%v}, you should have no troubles).
13585
13586On the bright side, you should have plenty of time to do this before all
13587support for the old format strings is removed from @sc{cvs}, so you can just
13588put up with the deprecation warnings for awhile if you like.
13589
13590@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13591@node commitinfo
13592@appendixsubsec Commitinfo
13593@cindex @file{commitinfo}
13594@cindex Commits, precommit verification of
13595@cindex commitinfo (admin file)
13596@cindex info files, commitinfo
13597@cindex script hooks, commitinfo
13598@cindex trigger scripts, commitinfo
13599@cindex info files, precommit verification of commits
13600@cindex script hooks, precommit verification of commits
13601@cindex trigger scripts, precommit verification of commits
13602
13603The @file{commitinfo} file defines programs to execute
13604whenever @samp{cvs commit} is about to execute.  These
13605programs are used for pre-commit checking to verify
13606that the modified, added and removed files are really
13607ready to be committed.  This could be used, for
13608instance, to verify that the changed files conform to
13609to your site's standards for coding practice.
13610
13611The @file{commitinfo} file has the standard form for script hooks
13612(@pxref{Trigger Scripts}), where each line is a regular expression followed by
13613a command to execute.  It supports only the DEFAULT keywords.
13614
13615@cindex format strings, commitinfo admin file
13616In addition to the common format strings (@pxref{syntax}),
13617@file{commitinfo} supports:
13618
13619@table @t
13620@item @{s@}
13621a list of the names of files to be committed
13622@end table
13623
13624@cindex commitinfo (admin file), updating legacy repositories
13625@cindex compatibility notes, commitinfo admin file
13626Currently, if no format strings are specified, a default
13627string of @samp{ %r/%p %@{s@}} will be appended to the command
13628line template before replacement is performed, but this
13629feature is deprecated.  It is simply in place so that legacy
13630repositories will remain compatible with the new @sc{cvs} application.
13631For information on updating, @pxref{Updating Commit Files}.
13632
13633@cindex Exit status, of commitinfo
13634@cindex commitinfo (admin file), exit status
13635The first line with a regular expression matching the
13636directory within the repository will be used.  If the
13637command returns a non-zero exit status the commit will
13638be aborted.
13639@c FIXME: need example(s) of what "directory within the
13640@c repository" means.
13641
13642@cindex @file{commitinfo}, working directory
13643@cindex @file{commitinfo}, command environment
13644The command will be run in the root of the workspace
13645containing the new versions of any files the user would like
13646to modify (commit), @emph{or in a copy of the workspace on
13647the server (@pxref{Remote repositories})}.  If a file is
13648being removed, there will be no copy of the file under the
13649current directory.  If a file is being added, there will be
13650no corresponding archive file in the repository unless the
13651file is being resurrected.
13652
13653Note that both the repository directory and the corresponding
13654Attic (@pxref{Attic}) directory may need to be checked to
13655locate the archive file corresponding to any given file being
13656committed.  Much of the information about the specific commit
13657request being made, including the destination branch, commit
13658message, and command line options specified, is not available
13659to the command.
13660
13661@c FIXME: should discuss using commitinfo to control
13662@c who has checkin access to what (e.g. Joe can check into
13663@c directories a, b, and c, and Mary can check into
13664@c directories b, c, and d--note this case cannot be
13665@c conveniently handled with unix groups).  Of course,
13666@c adding a new set of features to CVS might be a more
13667@c natural way to fix this problem than telling people to
13668@c use commitinfo.
13669@c FIXME: Should make some reference, especially in
13670@c the context of controlling who has access, to the fact
13671@c that commitinfo can be circumvented.  Perhaps
13672@c mention SETXID (but has it been carefully examined
13673@c for holes?).  This fits in with the discussion of
13674@c general CVS security in "Password authentication
13675@c security" (the bit which is not pserver-specific).
13676
13677@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13678@node verifymsg
13679@appendixsubsec Verifying log messages
13680@cindex @file{verifymsg} (admin file)
13681@cindex Log message, verifying
13682@cindex logging, commits
13683
13684Once you have entered a log message, you can evaluate
13685that message to check for specific content, such as
13686a bug ID.  Use the @file{verifymsg} file to
13687specify a program that is used to verify the log message.
13688This program could be a simple script that checks
13689that the entered message contains the required fields.
13690
13691The @file{verifymsg} file is often most useful together
13692with the @file{rcsinfo} file, which can be used to
13693specify a log message template (@pxref{rcsinfo}).
13694
13695The @file{verifymsg} file has the standard form for script hooks
13696(@pxref{Trigger Scripts}), where each line is a regular expression followed by
13697a command to execute.  It supports only the DEFAULT keywords.
13698
13699@cindex format strings, verifymsg admin file
13700In addition to the common format strings (@pxref{syntax}),
13701@file{verifymsg} supports:
13702
13703@table @t
13704@item l
13705the full path to the file containing the log message to be verified
13706@item @{sV@}
13707File attributes, where:
13708@table @t
13709@item s
13710file name
13711@item V
13712old version number (pre-checkin)
13713@end table
13714@end table
13715
13716@cindex verifymsg (admin/commit file), updating legacy repositories
13717@cindex compatibility notes, verifymsg admin file
13718Currently, if no format strings are specified, a default
13719string of @samp{ %l} will be appended to the command
13720line template before replacement is performed, but this
13721feature is deprecated.  It is simply in place so that legacy
13722repositories will remain compatible with the new @sc{cvs} application.
13723For information on updating, @pxref{Updating Commit Files}.
13724
13725One thing that should be noted is that the @samp{ALL}
13726keyword is not supported.  If more than one matching
13727line is found, the first one is used.  This can be
13728useful for specifying a default verification script in a
13729directory, and then overriding it in a subdirectory.
13730
13731@cindex Exit status, of @file{verifymsg}
13732If the verification script exits with a non-zero exit status,
13733the commit is aborted.
13734
13735@cindex @file{verifymsg}, changing the log message
13736In the default configuration, CVS allows the
13737verification script to change the log message. This is
13738controlled via the RereadLogAfterVerify CVSROOT/config
13739option.
13740
13741When @samp{RereadLogAfterVerify=always} or
13742@samp{RereadLogAfterVerify=stat}, the log message will
13743either always be reread after the verification script
13744is run or reread only if the log message file status
13745has changed.
13746
13747@xref{config}, for more on CVSROOT/config options.
13748
13749It is NOT a good idea for a @file{verifymsg} script to
13750interact directly with the user in the various
13751client/server methods. For the @code{pserver} method,
13752there is no protocol support for communicating between
13753@file{verifymsg} and the client on the remote end. For the
13754@code{ext} and @code{server} methods, it is possible
13755for CVS to become confused by the characters going
13756along the same channel as the CVS protocol
13757messages. See @ref{Remote repositories}, for more
13758information on client/server setups.  In addition, at the time
13759the @file{verifymsg} script runs, the CVS
13760server has locks in place in the repository.  If control is
13761returned to the user here then other users may be stuck waiting
13762for access to the repository.
13763
13764This option can be useful if you find yourself using an
13765rcstemplate that needs to be modified to remove empty
13766elements or to fill in default values.  It can also be
13767useful if the rcstemplate has changed in the repository
13768and the CVS/Template was not updated, but is able to be
13769adapted to the new format by the verification script
13770that is run by @file{verifymsg}.
13771
13772An example of an update might be to change all
13773occurrences of 'BugId:' to be 'DefectId:' (which can be
13774useful if the rcstemplate has recently been changed and
13775there are still checked-out user trees with cached
13776copies in the CVS/Template file of the older version).
13777
13778Another example of an update might be to delete a line
13779that contains 'BugID: none' from the log message after
13780validation of that value as being allowed is made.
13781
13782@menu
13783* verifymsg example::            Verifymsg example
13784@end menu
13785
13786@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13787@node verifymsg example
13788@appendixsubsubsec Verifying log messages
13789@cindex verifymsg, example
13790The following is a little silly example of a
13791@file{verifymsg} file, together with the corresponding
13792@file{rcsinfo} file, the log message template and a
13793verification script.  We begin with the log message template.
13794We want to always record a bug-id number on the first
13795line of the log message.  The rest of log message is
13796free text.  The following template is found in the file
13797@file{/usr/cvssupport/tc.template}.
13798
13799@example
13800BugId:
13801@end example
13802
13803The script @file{/usr/cvssupport/bugid.verify} is used to
13804evaluate the log message.
13805
13806@example
13807#!/bin/sh
13808#
13809#       bugid.verify filename
13810#
13811#  Verify that the log message contains a valid bugid
13812#  on the first line.
13813#
13814if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
13815    exit 0
13816elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
13817    # It is okay to allow commits with 'BugId: none',
13818    # but do not put that text into the real log message.
13819    grep -v '^BugId:[ ]*none$' > $1.rewrite
13820    mv $1.rewrite $1
13821    exit 0
13822else
13823    echo "No BugId found."
13824    exit 1
13825fi
13826@end example
13827
13828The @file{verifymsg} file contains this line:
13829
13830@example
13831^tc     /usr/cvssupport/bugid.verify %l
13832@end example
13833
13834The @file{rcsinfo} file contains this line:
13835
13836@example
13837^tc     /usr/cvssupport/tc.template
13838@end example
13839
13840The @file{config} file contains this line:
13841
13842@example
13843RereadLogAfterVerify=always
13844@end example
13845
13846
13847
13848@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13849@node loginfo
13850@appendixsubsec Loginfo
13851@cindex loginfo (admin file)
13852@cindex logging, commits
13853@cindex Storing log messages
13854@cindex Mailing log messages
13855@cindex Distributing log messages
13856@cindex Log messages
13857
13858The @file{loginfo} file is used to control where log information is sent after
13859versioned changes are made to repository archive files and after directories
13860are added ot the repository.  @ref{posttag} for how to log tagging
13861information and @ref{postadmin} for how to log changes due to the @code{admin}
13862command.
13863
13864The @file{loginfo} file has the standard form for script hooks
13865(@pxref{Trigger Scripts}), where each line is a regular expression followed by
13866a command to execute.  It supports the ALL and DEFAULT keywords.
13867
13868Any specified scripts are called:
13869
13870@table @code
13871@item commit
13872Once per directory, immediately after a successfully completing the commit of
13873all files within that directory.
13874@item import
13875Once per import, immediately after completion of all write operations.
13876@item add
13877Immediately after the successful @code{add} of a directory.
13878@end table
13879
13880Any script called via @file{loginfo} will be fed the log information on its
13881standard input.  Note that the filter program @strong{must} read @strong{all}
13882of the log information from its standard input or @sc{cvs} may fail with a
13883broken pipe signal.
13884
13885@cindex format strings, loginfo admin file
13886In addition to the common format strings (@pxref{syntax}),
13887@file{loginfo} supports:
13888
13889@table @t
13890@item @{sVv@}
13891File attributes, where:
13892@table @t
13893@item s
13894file name
13895@item V
13896old version number (pre-checkin)
13897@item v
13898new version number (post-checkin)
13899@end table
13900@end table
13901
13902For example, some valid format strings are @samp{%%},
13903@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13904
13905@cindex loginfo (admin file), updating legacy repositories
13906@cindex compatibility notes, loginfo admin file
13907Currently, if @samp{UseNewInfoFmtStrings} is not set in the @file{config}
13908administration file (@pxref{config}), the format strings will be substituted
13909as they were in past versions of @sc{cvs}, but this feature is deprecated.
13910It is simply in place so that legacy repositories will remain compatible with
13911the new @sc{cvs} application.  For information on updating,
13912please see @ref{Updating Commit Files}.
13913
13914As an example, if @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%p}
13915and @samp{%@{sVv@}} are the format strings, and three files (@t{ChangeLog},
13916@t{Makefile}, @t{foo.c}) were modified, the output might be:
13917
13918@example
13919yoyodyne/tc ChangeLog 1.1 1.2 Makefile 1.3 1.4 foo.c 1.12 1.13
13920@end example
13921
13922Note: when @sc{cvs} is accessing a remote repository,
13923@file{loginfo} will be run on the @emph{remote}
13924(i.e., server) side, not the client side (@pxref{Remote
13925repositories}).
13926
13927@menu
13928* loginfo example::                          Loginfo example
13929* Keeping a checked out copy::               Updating a tree on every checkin
13930@end menu
13931
13932@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13933@node loginfo example
13934@appendixsubsubsec Loginfo example
13935
13936The following @file{loginfo} file, together with the
13937tiny shell-script below, appends all log messages
13938to the file @file{$CVSROOT/CVSROOT/commitlog},
13939and any commits to the administrative files (inside
13940the @file{CVSROOT} directory) are also logged in
13941@file{/usr/adm/cvsroot-log}.
13942Commits to the @file{prog1} directory are mailed to @t{ceder}.
13943
13944@c FIXME: is it a CVS feature or bug that only the
13945@c first matching line is used?  It is documented
13946@c above, but is it useful?  For example, if we wanted
13947@c to run both "cvs-log" and "Mail" for the CVSROOT
13948@c directory, it is kind of awkward if
13949@c only the first matching line is used.
13950@example
13951ALL                     /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
13952^CVSROOT\(/\|$\)        /usr/local/bin/cvs-log /usr/adm/cvsroot-log $USER
13953^prog1\(/\|$\)          Mail -s "%p %s" ceder
13954@end example
13955
13956The shell-script @file{/usr/local/bin/cvs-log} looks
13957like this:
13958
13959@example
13960#!/bin/sh
13961(echo "------------------------------------------------------";
13962 echo -n "$2  ";
13963 date;
13964 echo;
13965 cat) >> $1
13966@end example
13967
13968
13969
13970@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13971@node Keeping a checked out copy
13972@appendixsubsubsec Keeping a checked out copy
13973
13974@c What other index entries?  It seems like
13975@c people might want to use a lot of different
13976@c words for this functionality.
13977@cindex Keeping a checked out copy
13978@cindex Checked out copy, keeping
13979@cindex Web pages, maintaining with CVS
13980
13981It is often useful to maintain a directory tree which
13982contains files which correspond to the latest version
13983in the repository.  For example, other developers might
13984want to refer to the latest sources without having to
13985check them out, or you might be maintaining a web site
13986with @sc{cvs} and want every checkin to cause the files
13987used by the web server to be updated.
13988@c Can we offer more details on the web example?  Or
13989@c point the user at how to figure it out?  This text
13990@c strikes me as sufficient for someone who already has
13991@c some idea of what we mean but not enough for the naive
13992@c user/sysadmin to understand it and set it up.
13993
13994The way to do this is by having loginfo invoke
13995@code{cvs update}.  Doing so in the naive way will
13996cause a problem with locks, so the @code{cvs update}
13997must be run in the background.
13998@c Should we try to describe the problem with locks?
13999@c It seems like a digression for someone who just
14000@c wants to know how to make it work.
14001@c Another choice which might work for a single file
14002@c is to use "cvs -n update -p" which doesn't take
14003@c out locks (I think) but I don't see many advantages
14004@c of that and we might as well document something which
14005@c works for multiple files.
14006Here is an example for unix (this should all be on one line):
14007
14008@example
14009^cyclic-pages\(/\|$\)	(date; cat; (sleep 2; cd /u/www/local-docs;
14010 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
14011@end example
14012
14013This will cause checkins to repository directory @code{cyclic-pages}
14014and its subdirectories to update the checked
14015out tree in @file{/u/www/local-docs}.
14016@c More info on some of the details?  The "sleep 2" is
14017@c so if we are lucky the lock will be gone by the time
14018@c we start and we can wait 2 seconds instead of 30.
14019
14020
14021
14022@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14023@node postadmin
14024@appendixsubsec Logging admin commands
14025@cindex postadmin (admin file)
14026@cindex script hook, postadmin
14027@cindex Admin commands, logging
14028
14029The @file{postadmin} file defines programs to execute after an @code{admin}
14030command modifies files.  The @file{postadmin} file has the standard form
14031for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14032expression followed by a command to execute.  It supports the ALL and DEFAULT
14033keywords.
14034
14035@cindex format strings, postadmin admin file
14036The @file{postadmin} file supports no format strings other than the common
14037ones (@pxref{syntax}),
14038
14039
14040
14041@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14042@node taginfo
14043@appendixsubsec Taginfo
14044@cindex taginfo (admin file)
14045@cindex script hook, taginfo
14046@cindex Tags, logging
14047@cindex Tags, verifying
14048The @file{taginfo} file defines programs to execute
14049when someone executes a @code{tag} or @code{rtag}
14050command.  The @file{taginfo} file has the standard form
14051for script hooks (@pxref{Trigger Scripts}), where each line
14052is a regular expression followed by a command to execute.
14053It supports the ALL and DEFAULT keywords.
14054
14055@cindex format strings, taginfo admin file
14056In addition to the common format strings (@pxref{syntax}),
14057@file{taginfo} supports:
14058
14059@table @t
14060@item b
14061tag type (@code{T} for branch, @code{N} for not-branch, or @code{?} for
14062unknown, as during delete operations)
14063@item o
14064operation (@code{add} for @code{tag}, @code{mov} for @code{tag -F}, or
14065@code{del} for @code{tag -d})
14066@item t
14067new tag name
14068@item @{sTVv@}
14069file attributes, where:
14070@table @t
14071@item s
14072file name
14073@item T
14074tag name of destination, or the empty string when there is no associated
14075tag name (this usually means the trunk)
14076@item V
14077old version number (for a move or delete operation)
14078@item v
14079new version number (for an add or move operation)
14080@end table
14081@end table
14082
14083For example, some valid format strings are @samp{%%}, @samp{%p}, @samp{%t},
14084@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
14085
14086@cindex taginfo (admin file), updating legacy repositories
14087@cindex compatibility notes, taginfo admin file
14088Currently, if no format strings are specified, a default
14089string of @samp{ %t %o %p %@{sv@}} will be appended to the command
14090line template before replacement is performed, but this
14091feature is deprecated.  It is simply in place so that legacy
14092repositories will remain compatible with the new @sc{cvs} application.
14093For information on updating, @pxref{Updating Commit Files}.
14094
14095@cindex Exit status, of taginfo admin file
14096@cindex taginfo (admin file), exit status
14097A non-zero exit of the filter program will cause the tag to be
14098aborted.
14099
14100Here is an example of using @file{taginfo} to log @code{tag} and @code{rtag}
14101commands.  In the @file{taginfo} file put:
14102
14103@example
14104ALL /usr/local/cvsroot/CVSROOT/loggit %t %b %o %p %@{sVv@}
14105@end example
14106
14107@noindent
14108Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
14109following script:
14110
14111@example
14112#!/bin/sh
14113echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
14114@end example
14115
14116
14117
14118@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14119@node posttag
14120@appendixsubsec Logging tags
14121@cindex posttag (admin file)
14122@cindex script hook, posttag
14123@cindex Tags, logging
14124
14125The @file{posttag} file defines programs to execute after a @code{tag} or
14126@code{rtag} command modifies files.  The @file{posttag} file has the standard
14127form for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14128expression followed by a command to execute.  It supports the ALL and DEFAULT
14129keywords.
14130
14131@cindex format strings, posttag admin file
14132The @file{posttag} admin file supports the same format strings as the
14133@file{taginfo} file (@pxref{taginfo}),
14134
14135
14136
14137@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14138@node postwatch
14139@appendixsubsec Logging watch commands
14140@cindex postwatch (admin file)
14141@cindex script hook, postwatch
14142@cindex Watch family of commands, logging
14143
14144The @file{postwatch} file defines programs to execute after any command (for
14145instance, @code{watch}, @code{edit}, @code{unedit}, or @code{commit}) modifies
14146any @file{CVS/fileattr} file in the repository (@pxref{Watches}).  The
14147@file{postwatch} file has the standard form for script hooks
14148(@pxref{Trigger Scripts}), where each line is a regular expression followed by
14149a command to execute.  It supports the ALL and DEFAULT keywords.
14150
14151@cindex format strings, postwatch admin file
14152The @file{postwatch} file supports no format strings other than the common
14153ones (@pxref{syntax}), but it is worth noting that the @code{%c} format string
14154may not be replaced as you might expect.  Client runs of @code{edit} and
14155@code{unedit} can sometimes skip contacting the @sc{cvs} server and cache the
14156notification of the file attribute change to be sent the next time the client
14157contacts the server for whatever other reason,
14158
14159
14160
14161@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14162@node preproxy
14163@appendixsubsec Launch a Script before Proxying
14164@cindex preproxy (admin file)
14165@cindex script hook, preproxy
14166@cindex Write proxy, verifying
14167@cindex Write proxy, logging
14168
14169The @file{preproxy} file defines programs to execute after a secondary
14170server receives a write request from a client, just before it starts up the
14171primary server and becomes a write proxy.  This hook could be used to
14172dial a modem, launch an SSH tunnel, establish a VPN, or anything else that
14173might be necessary to do before contacting the primary server.
14174
14175@file{preproxy} scripts are called once, at the time of the write request, with
14176the repository argument (if requested) set from the topmost directory sent by
14177the client.
14178
14179The @file{preproxy} file has the standard form
14180for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14181expression followed by a command to execute.  It supports the ALL and DEFAULT
14182keywords.
14183
14184@cindex format strings, preproxy admin file
14185In addition to the common format strings, the @file{preproxy} file supports the
14186following format string:
14187
14188@table @t
14189@item P
14190the CVSROOT string which specifies the primary server
14191@end table
14192
14193
14194
14195@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14196@node postproxy
14197@appendixsubsec Launch a Script after Proxying
14198@cindex postproxy (admin file)
14199@cindex script hook, postproxy
14200@cindex Write proxy, logging
14201@cindex Write proxy, pull updates
14202@cindex secondary server, pull updates
14203
14204The @file{postproxy} file defines programs to execute after a secondary
14205server notes that the connection to the primary server has shut down and before
14206it releases the client by shutting down the connection to the client.
14207This could hook could be used to
14208disconnect a modem, an SSH tunnel, a VPN, or anything else that
14209might be necessary to do after contacting the primary server.  This hook should
14210also be used to pull updates from the primary server before allowing the client
14211which did the write to disconnect since otherwise the client's next read
14212request may generate error messages and fail upon encountering an out of date
14213repository on the secondary server.
14214
14215@file{postproxy} scripts are called once per directory.
14216
14217The @file{postproxy} file has the standard form
14218for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14219expression followed by a command to execute.  It supports the ALL and DEFAULT
14220keywords.
14221
14222@cindex format strings, postproxy admin file
14223In addition to the common format strings, the @file{postproxy} file supports
14224the following format string:
14225
14226@table @t
14227@item P
14228the CVSROOT string which specifies the primary server
14229@end table
14230
14231
14232
14233@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14234@node rcsinfo
14235@appendixsec Rcsinfo
14236@cindex rcsinfo (admin file)
14237@cindex Form for log message
14238@cindex Log message template
14239@cindex Template for log message
14240@cindex logging, commits
14241
14242The @file{rcsinfo} file can be used to specify a form to
14243edit when filling out the commit log.  The
14244@file{rcsinfo} file has a syntax similar to the
14245@file{verifymsg}, @file{commitinfo} and @file{loginfo}
14246files.  @xref{syntax}.  Unlike the other files the second
14247part is @emph{not} a command-line template.  Instead,
14248the part after the regular expression should be a full pathname to
14249a file containing the log message template.
14250
14251If the repository name does not match any of the
14252regular expressions in this file, the @samp{DEFAULT}
14253line is used, if it is specified.
14254
14255All occurrences of the name @samp{ALL} appearing as a
14256regular expression are used in addition to the first
14257matching regular expression or @samp{DEFAULT}.
14258
14259@c FIXME: should be offering advice, somewhere around
14260@c here, about where to put the template file.  The
14261@c verifymsg example uses /usr/cvssupport but doesn't
14262@c say anything about what that directory is for or
14263@c whether it is hardwired into CVS or who creates
14264@c it or anything.  In particular we should say
14265@c how to version control the template file.  A
14266@c probably better answer than the /usr/cvssupport
14267@c stuff is to use checkoutlist (with xref to the
14268@c checkoutlist doc).
14269@c Also I am starting to see a connection between
14270@c this and the Keeping a checked out copy node.
14271@c Probably want to say something about that.
14272The log message template will be used as a default log
14273message.  If you specify a log message with @samp{cvs
14274commit -m @var{message}} or @samp{cvs commit -f
14275@var{file}} that log message will override the
14276template.
14277
14278@xref{verifymsg}, for an example @file{rcsinfo}
14279file.
14280
14281When @sc{cvs} is accessing a remote repository,
14282the contents of @file{rcsinfo} at the time a directory
14283is first checked out will specify a template. This
14284template will be updated on all @samp{cvs update}
14285commands. It will also be added to new directories
14286added with a @samp{cvs add new-directory} command.
14287In versions of @sc{cvs} prior to version 1.12, the
14288@file{CVS/Template} file was not updated. If the
14289@sc{cvs} server is at version 1.12 or higher an older
14290client may be used and the @file{CVS/Template} will
14291be updated from the server.
14292
14293@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14294@node cvsignore
14295@appendixsec Ignoring files via cvsignore
14296@cindex cvsignore (admin file), global
14297@cindex Global cvsignore
14298@cindex Ignoring files
14299@c -- This chapter should maybe be moved to the
14300@c tutorial part of the manual?
14301
14302There are certain file names that frequently occur
14303inside your working copy, but that you don't want to
14304put under @sc{cvs} control.  Examples are all the object
14305files that you get while you compile your sources.
14306Normally, when you run @samp{cvs update}, it prints a
14307line for each file it encounters that it doesn't know
14308about (@pxref{update output}).
14309
14310@sc{cvs} has a list of files (or sh(1) file name patterns)
14311that it should ignore while running @code{update},
14312@code{import} and @code{release}.
14313@c -- Are those the only three commands affected?
14314This list is constructed in the following way.
14315
14316@itemize @bullet
14317@item
14318The list is initialized to include certain file name
14319patterns: names associated with @sc{cvs}
14320administration, or with other common source control
14321systems; common names for patch files, object files,
14322archive files, and editor backup files; and other names
14323that are usually artifacts of assorted utilities.
14324Currently, the default list of ignored file name
14325patterns is:
14326
14327@cindex Ignored files
14328@cindex Automatically ignored files
14329@example
14330    RCS     SCCS    CVS     CVS.adm
14331    RCSLOG  cvslog.*
14332    tags    TAGS
14333    .make.state     .nse_depinfo
14334    *~      #*      .#*     ,*      _$*     *$
14335    *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
14336    *.a     *.olb   *.o     *.obj   *.so    *.exe
14337    *.Z     *.elc   *.ln
14338    core
14339@end example
14340
14341@item
14342The per-repository list in
14343@file{$CVSROOT/CVSROOT/cvsignore} is appended to
14344the list, if that file exists.
14345
14346@item
14347The per-user list in @file{.cvsignore} in your home
14348directory is appended to the list, if it exists.
14349
14350@item
14351Any entries in the environment variable
14352@code{$CVSIGNORE} is appended to the list.
14353
14354@item
14355Any @samp{-I} options given to @sc{cvs} is appended.
14356
14357@item
14358As @sc{cvs} traverses through your directories, the contents
14359of any @file{.cvsignore} will be appended to the list.
14360The patterns found in @file{.cvsignore} are only valid
14361for the directory that contains them, not for
14362any sub-directories.
14363@end itemize
14364
14365In any of the 5 places listed above, a single
14366exclamation mark (@samp{!}) clears the ignore list.
14367This can be used if you want to store any file which
14368normally is ignored by @sc{cvs}.
14369
14370Specifying @samp{-I !} to @code{cvs import} will import
14371everything, which is generally what you want to do if
14372you are importing files from a pristine distribution or
14373any other source which is known to not contain any
14374extraneous files.  However, looking at the rules above
14375you will see there is a fly in the ointment; if the
14376distribution contains any @file{.cvsignore} files, then
14377the patterns from those files will be processed even if
14378@samp{-I !} is specified.  The only workaround is to
14379remove the @file{.cvsignore} files in order to do the
14380import.  Because this is awkward, in the future
14381@samp{-I !} might be modified to override
14382@file{.cvsignore} files in each directory.
14383
14384Note that the syntax of the ignore files consists of a
14385series of lines, each of which contains a space
14386separated list of filenames.  This offers no clean way
14387to specify filenames which contain spaces, but you can
14388use a workaround like @file{foo?bar} to match a file
14389named @file{foo bar} (it also matches @file{fooxbar}
14390and the like).  Also note that there is currently no
14391way to specify comments.
14392@c FIXCVS?  I don't _like_ this syntax at all, but
14393@c changing it raises all the usual compatibility
14394@c issues and I'm also not sure what to change it to.
14395
14396@node checkoutlist
14397@appendixsec The checkoutlist file
14398@cindex checkoutlist
14399
14400It may be helpful to use @sc{cvs} to maintain your own
14401files in the @file{CVSROOT} directory.  For example,
14402suppose that you have a script @file{logcommit.pl}
14403which you run by including the following line in the
14404@file{commitinfo} administrative file:
14405
14406@example
14407ALL   $CVSROOT/CVSROOT/logcommit.pl %r/%p %s
14408@end example
14409
14410To maintain @file{logcommit.pl} with @sc{cvs} you would
14411add the following line to the @file{checkoutlist}
14412administrative file:
14413
14414@example
14415logcommit.pl
14416@end example
14417
14418The format of @file{checkoutlist} is one line for each
14419file that you want to maintain using @sc{cvs}, giving
14420the name of the file, followed optionally by more whitespace
14421and any error message that should print if the file cannot be
14422checked out into CVSROOT after a commit:
14423
14424@example
14425logcommit.pl	Could not update CVSROOT/logcommit.pl.
14426@end example
14427
14428After setting up @file{checkoutlist} in this fashion,
14429the files listed there will function just like
14430@sc{cvs}'s built-in administrative files.  For example,
14431when checking in one of the files you should get a
14432message such as:
14433
14434@example
14435cvs commit: Rebuilding administrative file database
14436@end example
14437
14438@noindent
14439and the checked out copy in the @file{CVSROOT}
14440directory should be updated.
14441
14442Note that listing @file{passwd} (@pxref{Password
14443authentication server}) in @file{checkoutlist} is not
14444recommended for security reasons.
14445
14446For information about keeping a checkout out copy in a
14447more general context than the one provided by
14448@file{checkoutlist}, see @ref{Keeping a checked out
14449copy}.
14450
14451@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14452@node history file
14453@appendixsec The history file
14454@cindex History file
14455@cindex Log information, saving
14456
14457By default, the file @file{$CVSROOT/CVSROOT/history} is used
14458to log information for the @code{history} command (@pxref{history}).
14459This file name may be changed with the @samp{HistoryLogPath} and
14460@samp{HistorySearchPath} config options (@pxref{config}).
14461
14462The file format of the @file{history} file is
14463documented only in comments in the @sc{cvs} source
14464code, but generally programs should use the @code{cvs
14465history} command to access it anyway, in case the
14466format changes with future releases of @sc{cvs}.
14467
14468@node Variables
14469@appendixsec Expansions in administrative files
14470@cindex Internal variables
14471@cindex Variables
14472
14473Sometimes in writing an administrative file, you might
14474want the file to be able to know various things based
14475on environment @sc{cvs} is running in.  There are
14476several mechanisms to do that.
14477
14478To find the home directory of the user running @sc{cvs}
14479(from the @code{HOME} environment variable), use
14480@samp{~} followed by @samp{/} or the end of the line.
14481Likewise for the home directory of @var{user}, use
14482@samp{~@var{user}}.  These variables are expanded on
14483the server machine, and don't get any reasonable
14484expansion if pserver (@pxref{Password authenticated})
14485is in use; therefore user variables (see below) may be
14486a better choice to customize behavior based on the user
14487running @sc{cvs}.
14488@c Based on these limitations, should we deprecate ~?
14489@c What is it good for?  Are people using it?
14490
14491One may want to know about various pieces of
14492information internal to @sc{cvs}.  A @sc{cvs} internal
14493variable has the syntax @code{$@{@var{variable}@}},
14494where @var{variable} starts with a letter and consists
14495of alphanumeric characters and @samp{_}.  If the
14496character following @var{variable} is a
14497non-alphanumeric character other than @samp{_}, the
14498@samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
14499internal variables are:
14500
14501@table @code
14502@item CVSROOT
14503@cindex CVSROOT, internal variable
14504This is the absolute path to the current @sc{cvs} root directory.
14505@xref{Repository}, for a description of the various
14506ways to specify this, but note that the internal
14507variable contains just the directory and not any
14508of the access method information.
14509
14510@item RCSBIN
14511@cindex RCSBIN, internal variable
14512In @sc{cvs} 1.9.18 and older, this specified the
14513directory where @sc{cvs} was looking for @sc{rcs}
14514programs.  Because @sc{cvs} no longer runs @sc{rcs}
14515programs, specifying this internal variable is now an
14516error.
14517
14518@item CVSEDITOR
14519@cindex CVSEDITOR, internal variable
14520@itemx EDITOR
14521@cindex EDITOR, internal variable
14522@itemx VISUAL
14523@cindex VISUAL, internal variable
14524These all expand to the same value, which is the editor
14525that @sc{cvs} is using.  @xref{Global options}, for how
14526to specify this.
14527
14528@item USER
14529@cindex USER, internal variable
14530Username of the user running @sc{cvs} (on the @sc{cvs}
14531server machine).
14532When using pserver, this is the user specified in the repository
14533specification which need not be the same as the username the
14534server is running as (@pxref{Password authentication server}).
14535Do not confuse this with the environment variable of the same name.
14536
14537@item SESSIONID
14538@cindex COMMITID, internal variable
14539Unique Session ID of the @sc{cvs} process. This is a
14540random string of printable characters of at least 16
14541characters length. Users should assume that it may
14542someday grow to at most 256 characters in length.
14543
14544@item COMMITID
14545@cindex COMMITID, internal variable
14546Unique Session ID of the @sc{cvs} process. This is a
14547random string of printable characters of at least 16
14548characters length. Users should assume that it may
14549someday grow to at most 256 characters in length.
14550Currently, MirBSD/MirDebian/MirPorts GNU @sc{cvs} uses 19 characters.
14551@end table
14552
14553If you want to pass a value to the administrative files
14554which the user who is running @sc{cvs} can specify,
14555use a user variable.
14556@cindex User variables
14557To expand a user variable, the
14558administrative file contains
14559@code{$@{=@var{variable}@}}.  To set a user variable,
14560specify the global option @samp{-s} to @sc{cvs}, with
14561argument @code{@var{variable}=@var{value}}.  It may be
14562particularly useful to specify this option via
14563@file{.cvsrc} (@pxref{~/.cvsrc}).
14564
14565For example, if you want the administrative file to
14566refer to a test directory you might create a user
14567variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
14568as
14569
14570@example
14571cvs -s TESTDIR=/work/local/tests
14572@end example
14573
14574@noindent
14575and the
14576administrative file contains @code{sh
14577$@{=TESTDIR@}/runtests}, then that string is expanded
14578to @code{sh /work/local/tests/runtests}.
14579
14580All other strings containing @samp{$} are reserved;
14581there is no way to quote a @samp{$} character so that
14582@samp{$} represents itself.
14583
14584Environment variables passed to administrative files are:
14585
14586@table @code
14587@cindex environment variables, passed to administrative files
14588
14589@item CVS_USER
14590@cindex CVS_USER, environment variable
14591The @sc{cvs}-specific username provided by the user, if it
14592can be provided (currently just for the pserver access
14593method), and to the empty string otherwise.  (@code{CVS_USER}
14594and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
14595is used to map @sc{cvs} usernames to system usernames.)
14596
14597@item LOGNAME
14598@cindex LOGNAME, environment variable
14599The username of the system user.
14600
14601@item USER
14602@cindex USER, environment variable
14603Same as @code{LOGNAME}.
14604Do not confuse this with the internal variable of the same name.
14605@end table
14606
14607@node config
14608@appendixsec The CVSROOT/config configuration file
14609
14610@cindex configuration file
14611@cindex config, in CVSROOT
14612@cindex CVSROOT/config
14613
14614Usually, the @file{config} file is found at @file{$CVSROOT/CVSROOT/config},
14615but this may be overridden on the @code{pserver} and @code{server} command
14616lines (@pxref{server & pserver}).
14617
14618The administrative file @file{config} contains various
14619miscellaneous settings which affect the behavior of
14620@sc{cvs}.  The syntax is slightly different from the
14621other administrative files.
14622
14623Leading white space on any line is ignored, though the syntax is very strict
14624and will reject spaces and tabs almost anywhere else.
14625
14626Empty lines, lines containing nothing but white space, and lines which start
14627with @samp{#} (discounting any leading white space) are ignored.
14628
14629@c FIXME: where do we define comments for the other
14630@c administrative files.
14631Other lines consist of the optional leading white space, a keyword, @samp{=},
14632and a value.  Please note again that this syntax is very strict.
14633Extraneous spaces or tabs, other than the leading white space, are not
14634permitted on these lines.
14635@c See comments in parseinfo.c:parse_config for more
14636@c discussion of this strictness.
14637
14638As of CVS 1.12.13, lines of the form @samp{[@var{CVSROOT}]} mark the subsequent
14639section of the config file as applying only to certain repositories.  Multiple
14640@samp{[@var{CVSROOT}]} lines without intervening
14641@samp{@var{KEYWORD}=@var{VALUE}} pairs cause processing to fall through,
14642processing subsequent keywords for any root in the list.  Finally, keywords
14643and values which appear before any @samp{[@var{CVSROOT}]} lines are defaults,
14644and may to apply to any repository.  For example, consider the following file:
14645
14646@example
14647# Defaults
14648LogHistory=TMAR
14649
14650[/cvsroots/team1]
14651  LockDir=/locks/team1
14652
14653[/cvsroots/team2]
14654  LockDir=/locks/team2
14655
14656[/cvsroots/team3]
14657  LockDir=/locks/team3
14658
14659[/cvsroots/team4]
14660  LockDir=/locks/team4
14661
14662[/cvsroots/team3]
14663[/cvsroots/team4]
14664  # Override logged commands for teams 3 & 4.
14665  LogHistory=all
14666@end example
14667
14668This example file sets up separate lock directories for each project, as well
14669as a default set of logged commands overridden for the example's team 3 &
14670team 4. This syntax could be useful, for instance, if you wished to share a
14671single config file, for instance @file{/etc/cvs.conf}, among several
14672repositories.
14673
14674Currently defined keywords are:
14675
14676@table @code
14677@cindex HistoryLogPath, in CVSROOT/config
14678@item HistorySearchPath=@var{pattern}
14679Request that @sc{cvs} look for its history information in files matching
14680@var{pattern}, which is a standard UNIX file glob.  If @var{pattern} matches
14681multiple files, all will be searched in lexicographically sorted order.
14682@xref{history}, and @ref{history file}, for more.
14683
14684If no value is supplied for this option, it defaults to
14685@file{$CVSROOT/CVSROOT/history}.
14686
14687@cindex HistorySearchPath, in CVSROOT/config
14688@item HistoryLogPath=@var{path}
14689Control where @sc{cvs} logs its history.  If the file does not exist, @sc{cvs}
14690will attempt to create it.  Format strings, as available to the GNU C
14691@code{strftime} function and often the UNIX date command, and the string
14692@var{$CVSROOT} will be substituted in this path.  For example, consider the
14693line:
14694
14695@example
14696HistoryLogPath=$CVSROOT/CVSROOT/history/%Y-%m-%d
14697@end example
14698
14699This line would cause @sc{cvs} to attempt to create its history file in a
14700subdirectory (@file{history}) of the configuration directory (@file{CVSROOT})
14701with a name equal to the current date representation in the ISO8601 format (for
14702example, on May 11, 2005, @sc{cvs} would attempt to log its history under the
14703repository root directory in a file named @file{CVSROOT/history/2005-05-11}).
14704@xref{history}, and @ref{history file}, for more.
14705
14706If no value is supplied for this option, it defaults to
14707@file{$CVSROOT/CVSROOT/history}.
14708
14709@cindex ImportNewFilesToVendorBranchOnly, in CVSROOT/config
14710@cindex import, config admin file
14711@cindex config (admin file), import
14712@item ImportNewFilesToVendorBranchOnly=@var{value}
14713Specify whether @code{cvs import} should always behave as if the
14714@samp{-X} flag was specified on the command line.
14715@var{value} may be either @samp{yes} or @samp{no}.  If set to @samp{yes},
14716all uses of @code{cvs import} on the repository will behave as if the
14717@samp{-X} flag was set.  The default value is @samp{no}.
14718
14719@cindex KeywordExpand, in CVSROOT/config
14720@item KeywordExpand=@var{value}
14721Specify @samp{i} followed by a list of keywords to be expanded
14722(for example, @samp{KeywordExpand=iMYCVS,Name,Date,Mdocdate}),
14723or @samp{e} followed by a list of keywords not to be expanded
14724(for example, @samp{KeywordExpand=eCVSHeader}).
14725For more on keyword expansion, see @ref{Configuring keyword expansion}.
14726
14727@cindex LocalKeyword, in CVSROOT/config
14728@item LocalKeyword=@var{value}
14729Specify a local alias for a standard keyword.
14730For example, @samp{LocalKeyword=MYCVS=CVSHeader}.
14731For more on local keywords, see @ref{Keyword substitution}.
14732
14733@cindex LockDir, in CVSROOT/config
14734@item LockDir=@var{directory}
14735Put @sc{cvs} lock files in @var{directory} rather than
14736directly in the repository.  This is useful if you want
14737to let users read from the repository while giving them
14738write access only to @var{directory}, not to the
14739repository.
14740It can also be used to put the locks on a very fast
14741in-memory file system to speed up locking and unlocking
14742the repository.
14743You need to create @var{directory}, but
14744@sc{cvs} will create subdirectories of @var{directory} as it
14745needs them.  For information on @sc{cvs} locks, see
14746@ref{Concurrency}.
14747
14748@c Mention this in Compatibility section?
14749Before enabling the LockDir option, make sure that you
14750have tracked down and removed any copies of @sc{cvs} 1.9 or
14751older.  Such versions neither support LockDir, nor will
14752give an error indicating that they don't support it.
14753The result, if this is allowed to happen, is that some
14754@sc{cvs} users will put the locks one place, and others will
14755put them another place, and therefore the repository
14756could become corrupted.  @sc{cvs} 1.10 does not support
14757LockDir but it will print a warning if run on a
14758repository with LockDir enabled.
14759
14760@cindex LogHistory, in CVSROOT/config
14761@item LogHistory=@var{value}
14762Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
14763Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
14764all transactions.  Any subset of the default is
14765legal.  (For example, to only log transactions that modify the
14766@file{*,v} files, use @samp{LogHistory=TMAR}.)  To disable history logging
14767completely, use @samp{LogHistory=}.
14768
14769@cindex MaxCommentLeaderLength, in CVSROOT/config
14770@cindex Log keyword, configuring substitution behavior
14771@item MaxCommentLeaderLength=@var{length}
14772Set to some length, in bytes, where a trailing @samp{k}, @samp{M}, @samp{G},
14773or @samp{T} causes the preceding nubmer to be interpreted as kilobytes,
14774megabytes, gigabytes, or terrabytes, respectively, will cause
14775@code{$@splitrcskeyword{Log}$} keywords (@pxref{Keyword substitution}), with
14776more than @var{length} bytes preceding it on a line to be ignored (or to fall
14777back on the comment leader set in the RCS archive file - see
14778@code{UseArchiveCommentLeader} below).  Defaults to 20 bytes to allow checkouts
14779to proceed normally when they include binary files containing
14780@code{$@splitrcskeyword{Log}$} keywords and which users have neglected to mark
14781as binary.
14782
14783@cindex MinCompressionLevel, in CVSROOT/config
14784@cindex MaxCompressionLevel, in CVSROOT/config
14785@cindex Compression levels, restricting on server
14786@item MinCompressionLevel=@var{value}
14787@itemx MaxCompressionLevel=@var{value}
14788Restricts the level of compression used by the @sc{cvs} server to a @var{value}
14789between 0 and 9.  @var{value}s 1 through 9 are the same @sc{zlib} compression
14790levels accepted by the @samp{-z} option (@pxref{Global options}), and 0 means
14791no compression.  When one or both of these keys are set and a client requests a
14792level outside the specified range, the server will simply use the closest
14793permissable level.  Clients will continue compressing at the level requested by
14794the user.
14795
14796The exception is when level 0 (no compression) is not available and the client
14797fails to request any compression.  The @sc{cvs} server will then exit with an
14798error message when it becomes apparent that the client is not going to request
14799compression.  This will not happen with clients version 1.12.13 and later since
14800these client versions allow the server to notify them that they must request
14801some level of compression.
14802
14803@ignore
14804@cindex PreservePermissions, in CVSROOT/config
14805@item PreservePermissions=@var{value}
14806Enable support for saving special device files,
14807symbolic links, file permissions and ownerships in the
14808repository.  The default value is @samp{no}.
14809@xref{Special Files}, for the full implications of using
14810this keyword.
14811@end ignore
14812
14813@cindex PrimaryServer, in CVSROOT/config
14814@cindex Primary server
14815@cindex Secondary server
14816@cindex proxy, write
14817@cindex write proxy
14818@item PrimaryServer=@var{CVSROOT}
14819When specified, and the repository specified by @var{CVSROOT} is not the one
14820currently being accessed, then the server will turn itself into a transparent
14821proxy to @var{CVSROOT} for write requests.  The @var{hostname} configured as
14822part of @var{CVSROOT} must resolve to the same string returned by the
14823@command{uname} command on the primary server for this to work.  Host name
14824resolution is performed via some combination of @command{named}, a broken out
14825line from @file{/etc/hosts}, and the Network Information Service (NIS or YP),
14826depending on the configuration of the particular system.
14827
14828Only the @samp{:ext:} method is
14829currently supported for primaries (actually, @samp{:fork:} is supported as
14830well, but only for testing - if you find another use for accessing a primary
14831via the @samp{:fork:} method, please send a note to @email{bug-cvs@@nongnu.org}
14832about it).  See @ref{Write proxies} for more on configuring and using write
14833proxies.
14834
14835@cindex RCSBIN, in CVSROOT/config
14836@item RCSBIN=@var{bindir}
14837For @sc{cvs} 1.9.12 through 1.9.18, this setting told
14838@sc{cvs} to look for @sc{rcs} programs in the
14839@var{bindir} directory.  Current versions of @sc{cvs}
14840do not run @sc{rcs} programs; for compatibility this
14841setting is accepted, but it does nothing.
14842
14843@cindex RereadLogAfterVerify, in CVSROOT/config
14844@cindex @file{verifymsg}, changing the log message
14845@item RereadLogAfterVerify=@var{value}
14846Modify the @samp{commit} command such that CVS will reread the
14847log message after running the program specified by @file{verifymsg}.
14848@var{value} may be one of @samp{yes} or @samp{always}, indicating that
14849the log message should always be reread; @samp{no}
14850or @samp{never}, indicating that it should never be
14851reread; or @var{value} may be @samp{stat}, indicating
14852that the file should be checked with the file system
14853@samp{stat()} function to see if it has changed (see warning below)
14854before rereading.  The default value is @samp{always}.
14855
14856@emph{Note: the `stat' mode can cause CVS to pause for up to
14857one extra second per directory committed.  This can be less IO and
14858CPU intensive but is not recommended for use with large repositories}
14859
14860@xref{verifymsg}, for more information on how verifymsg
14861may be used.
14862
14863@cindex SystemAuth, in CVSROOT/config
14864@item SystemAuth=@var{value}
14865If @var{value} is @samp{yes}, then pserver should check
14866for users in the system's user database if not found in
14867@file{CVSROOT/passwd}.  If it is @samp{no}, then all
14868pserver users must exist in @file{CVSROOT/passwd}.
14869The default is @samp{yes}.  For more on pserver, see
14870@ref{Password authenticated}.
14871
14872@cindex TmpDir, in config
14873@cindex temporary files, location of
14874@cindex temporary directory, set in config
14875@item TmpDir=@var{path}
14876Specify @var{path} as the directory to create temporary files in.
14877@xref{Global options}, for more on setting the path to the temporary
14878directory.  This option first appeared with @sc{cvs} release 1.12.13.
14879
14880@cindex TopLevelAdmin, in CVSROOT/config
14881@item TopLevelAdmin=@var{value}
14882Modify the @samp{checkout} command to create a
14883@samp{CVS} directory at the top level of the new
14884working directory, in addition to @samp{CVS}
14885directories created within checked-out directories.
14886The default value is @samp{no}.
14887
14888This option is useful if you find yourself performing
14889many commands at the top level of your working
14890directory, rather than in one of the checked out
14891subdirectories.  The @file{CVS} directory created there
14892will mean you don't have to specify @code{CVSROOT} for
14893each command.  It also provides a place for the
14894@file{CVS/Template} file (@pxref{Working directory
14895storage}).
14896
14897@cindex UseArchiveCommentLeader, in CVSROOT/config
14898@cindex Log keyword, configuring substitution behavior
14899@item UseArchiveCommentLeader=@var{value}
14900Set to @code{true}, if the text preceding a @code{$@splitrcskeyword{Log}$}
14901keyword is found to exceed @code{MaxCommentLeaderLength} (above) bytes, then
14902the comment leader set in the RCS archive file (@pxref{admin}), if any, will
14903be used instead.  If there is no comment leader set in the archive file or
14904@var{value} is set to @samp{false}, then the keyword will not be expanded
14905(@pxref{Keyword list}).  To force the comment leader in the RCS archive file to
14906be used exclusively (and @code{$@splitrcskeyword{Log}$} expansion skipped in
14907files where the comment leader has not been set in the archive file), set
14908@var{value} and set @code{MaxCommentLeaderLength} to @code{0}.
14909
14910@cindex UseNewInfoFmtStrings, in CVSROOT/config
14911@cindex format strings, config admin file
14912@cindex config (admin file), updating legacy repositories
14913@cindex compatibility notes, config admin file
14914@item UseNewInfoFmtStrings=@var{value}
14915Specify whether @sc{cvs} should support the new or old command line
14916template model for the commit support files (@pxref{commit files}).
14917This configuration variable began life in deprecation and is only here
14918in order to give people time to update legacy repositories to use the new
14919format string syntax before support for the old syntax is removed.  For
14920information on updating your repository to support the new model,
14921please see @ref{Updating Commit Files}.
14922
14923@emph{Note that new repositories (created with the @code{cvs init} command)
14924will have this value set to @samp{yes}, but the default value is @samp{no}.}
14925
14926@cindex UserAdminOptions, in CVSROOT/config
14927@item UserAdminOptions=@var{value}
14928Control what options will be allowed with the @code{cvs admin}
14929command (@pxref{admin}) for users not in the @code{cvsadmin} group.
14930The @var{value} string is a list of single character options
14931which should be allowed.  If a user who is not a member of the
14932@code{cvsadmin} group tries to execute any @code{cvs admin}
14933option which is not listed they will will receive an error message
14934reporting that the option is restricted.
14935
14936If no @code{cvsadmin} group exists on the server, @sc{cvs} will
14937ignore the @code{UserAdminOptions} keyword (@pxref{admin}).
14938
14939When not specified, @code{UserAdminOptions} defaults to
14940@samp{k}.  In other words, it defaults to allowing
14941users outside of the @code{cvsadmin} group to use the
14942@code{cvs admin} command only to change the default keyword
14943expansion mode for files.
14944
14945As an example, to restrict users not in the @code{cvsadmin}
14946group to using @code{cvs admin} to change the default keyword
14947substitution mode, lock revisions, unlock revisions, and
14948replace the log message, use @samp{UserAdminOptions=klum}.
14949@end table
14950
14951
14952
14953@c ---------------------------------------------------------------------
14954@node Environment variables
14955@appendix All environment variables which affect CVS
14956@cindex Environment variables
14957@cindex Reference manual for variables
14958
14959This is a complete list of all environment variables
14960that affect @sc{cvs} (Windows users, please bear with this list;
14961$VAR is equivalent to %VAR% at the Windows command prompt).
14962
14963@table @code
14964@cindex CVSIGNORE, environment variable
14965@item $CVSIGNORE
14966A whitespace-separated list of file name patterns that
14967@sc{cvs} should ignore. @xref{cvsignore}.
14968
14969@cindex CVSWRAPPERS, environment variable
14970@item $CVSWRAPPERS
14971A whitespace-separated list of file name patterns that
14972@sc{cvs} should treat as wrappers. @xref{Wrappers}.
14973
14974@cindex CVSREAD, environment variable
14975@cindex Read-only files, and CVSREAD
14976@item $CVSREAD
14977If this is set, @code{checkout} and @code{update} will
14978try hard to make the files in your working directory
14979read-only.  When this is not set, the default behavior
14980is to permit modification of your working files.
14981
14982@cindex CVSREADONLYFS, environment variable
14983@item $CVSREADONLYFS
14984Turns on read-only repository mode. This allows one to
14985check out from a read-only repository, such as within
14986an anoncvs server, or from a @sc{cd-rom} repository.
14987
14988It has the same effect as if the @samp{-R} command-line
14989option is used. This can also allow the use of
14990read-only NFS repositories.
14991
14992@item $CVSUMASK
14993Controls permissions of files in the repository.  See
14994@ref{File permissions}.
14995
14996@item $CVSROOT
14997Should contain the full pathname to the root of the @sc{cvs}
14998source repository (where the @sc{rcs} files are
14999kept).  This information must be available to @sc{cvs} for
15000most commands to execute; if @code{$CVSROOT} is not set,
15001or if you wish to override it for one invocation, you
15002can supply it on the command line: @samp{cvs -d cvsroot
15003cvs_command@dots{}} Once you have checked out a working
15004directory, @sc{cvs} stores the appropriate root (in
15005the file @file{CVS/Root}), so normally you only need to
15006worry about this when initially checking out a working
15007directory.
15008
15009@item $CVSEDITOR
15010@cindex CVSEDITOR, environment variable
15011@itemx $EDITOR
15012@cindex EDITOR, environment variable
15013@itemx $VISUAL
15014@cindex VISUAL, environment variable
15015Specifies the program to use for recording log messages
15016during commit.  @code{$CVSEDITOR} overrides
15017@code{$EDITOR}, which overrides @code{$VISUAL}.
15018See @ref{Committing your changes} for more or
15019@ref{Global options} for alternative ways of specifying a
15020log editor.
15021
15022@cindex PATH, environment variable
15023@item $PATH
15024If @code{$RCSBIN} is not set, and no path is compiled
15025into @sc{cvs}, it will use @code{$PATH} to try to find all
15026programs it uses.
15027
15028@cindex HOME, environment variable
15029@item $HOME
15030@cindex HOMEPATH, environment variable
15031@item $HOMEPATH
15032@cindex HOMEDRIVE, environment variable
15033@item $HOMEDRIVE
15034Used to locate the directory where the @file{.cvsrc}
15035file, and other such files, are searched.  On Unix, @sc{cvs}
15036just checks for @code{HOME}.  On Windows NT, the system will
15037set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
15038for example to @file{\joe}.  On Windows 95, you'll
15039probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
15040@c We are being vague about whether HOME works on
15041@c Windows; see long comment in windows-NT/filesubr.c.
15042
15043@cindex CVS_RSH, environment variable
15044@item $CVS_RSH
15045Specifies the external program which @sc{cvs} connects with,
15046when @code{:ext:} access method is specified.
15047@pxref{Connecting via rsh}.
15048
15049@item $CVS_SERVER
15050Used in client-server mode when accessing a remote
15051repository using @sc{rsh}.  It specifies the name of
15052the program to start on the server side (and any
15053necessary arguments) when accessing a remote repository
15054using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
15055The default value for @code{:ext:} and @code{:server:} is @code{cvs};
15056the default value for @code{:fork:} is the name used to run the client.
15057@pxref{Connecting via rsh}
15058
15059@item $CVS_PASSFILE
15060Used in client-server mode when accessing the @code{cvs
15061login server}.  Default value is @file{$HOME/.cvspass}.
15062@pxref{Password authentication client}
15063
15064@cindex CVS_CLIENT_PORT
15065@item $CVS_CLIENT_PORT
15066Used in client-server mode to set the port to use when accessing the server
15067via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
15068if the port is not specified in the CVSROOT.
15069@pxref{Remote repositories}
15070
15071@cindex CVS_PROXY_PORT
15072@item $CVS_PROXY_PORT
15073Used in client-server mode to set the port to use when accessing a server
15074via a web proxy, if the port is not specified in the CVSROOT.  Works with
15075GSSAPI, and the password authentication protocol.
15076@pxref{Remote repositories}
15077
15078@cindex CVS_RCMD_PORT, environment variable
15079@item $CVS_RCMD_PORT
15080Used in client-server mode.  If set, specifies the port
15081number to be used when accessing the @sc{rcmd} demon on
15082the server side. (Currently not used for Unix clients).
15083
15084@cindex CVS_CLIENT_LOG, environment variable
15085@item $CVS_CLIENT_LOG
15086Used for debugging only in client-server
15087mode.  If set, everything sent to the server is logged
15088into @file{@code{$CVS_CLIENT_LOG}.in} and everything
15089sent from the server is logged into
15090@file{@code{$CVS_CLIENT_LOG}.out}.
15091
15092@cindex CVS_SERVER_SLEEP, environment variable
15093@item $CVS_SERVER_SLEEP
15094Used only for debugging the server side in
15095client-server mode.  If set, delays the start of the
15096server child process the specified amount of
15097seconds so that you can attach to it with a debugger.
15098
15099@cindex CVS_IGNORE_REMOTE_ROOT, environment variable
15100@item $CVS_IGNORE_REMOTE_ROOT
15101For @sc{cvs} 1.10 and older, setting this variable
15102prevents @sc{cvs} from overwriting the @file{CVS/Root}
15103file when the @samp{-d} global option is specified.
15104Later versions of @sc{cvs} do not rewrite
15105@file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
15106effect.
15107
15108@cindex CVS_LOCAL_BRANCH_NUM, environment variable
15109@item $CVS_LOCAL_BRANCH_NUM
15110Setting this variable allows some control over the
15111branch number that is assigned. This is specifically to
15112support the local commit feature of CVSup. If one sets
15113@code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
15114the local repository, the revision numbers will look
15115like 1.66.1000.xx. There is almost a dead-set certainty
15116that there will be no conflicts with version numbers.
15117
15118@cindex COMSPEC, environment variable
15119@item $COMSPEC
15120Used under OS/2 only.  It specifies the name of the
15121command interpreter and defaults to @sc{cmd.exe}.
15122
15123@cindex TMPDIR, environment variable
15124@cindex temporary file directory, set via environment variable
15125@cindex temporary files, location of
15126@item $TMPDIR
15127Directory in which temporary files are located.
15128@xref{Global options}, for more on setting the temporary directory.
15129
15130@cindex CVS_PID, environment variable
15131@item $CVS_PID
15132This is the process identification (aka pid) number of
15133the @sc{cvs} process. It is often useful in the
15134programs and/or scripts specified by the
15135@file{commitinfo}, @file{verifymsg}, @file{loginfo}
15136files.
15137@end table
15138
15139@node Compatibility
15140@appendix Compatibility between CVS Versions
15141
15142@cindex CVS, versions of
15143@cindex Versions, of CVS
15144@cindex Compatibility, between CVS versions
15145@c We don't mention versions older than CVS 1.3
15146@c on the theory that it would clutter it up for the vast
15147@c majority of people, who don't have anything that old.
15148@c
15149The repository format is compatible going back to
15150@sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
15151you have copies of @sc{cvs} 1.6 or older and you want
15152to use the optional developer communication features.
15153@c If you "cvs rm" and commit using 1.3, then you'll
15154@c want to run "rcs -sdead <file,v>" on each of the
15155@c files in the Attic if you then want 1.5 and
15156@c later to recognize those files as dead (I think the
15157@c symptom if this is not done is that files reappear
15158@c in joins).  (Wait: the above will work but really to
15159@c be strictly correct we should suggest checking
15160@c in a new revision rather than just changing the
15161@c state of the head revision, shouldn't we?).
15162@c The old convert.sh script was for this, but it never
15163@c did get updated to reflect use of the RCS "dead"
15164@c state.
15165@c Note: this is tricky to document without confusing
15166@c people--need to carefully say what CVS version we
15167@c are talking about and keep in mind the distinction
15168@c between a
15169@c repository created with 1.3 and on which one now
15170@c uses 1.5+, and a repository on which one wants to
15171@c use both versions side by side (e.g. during a
15172@c transition period).
15173@c Wait, can't CVS just detect the case in which a file
15174@c is in the Attic but the head revision is not dead?
15175@c Not sure whether this should produce a warning or
15176@c something, and probably needs further thought, but
15177@c it would appear that the situation can be detected.
15178@c
15179@c We might want to separate out the 1.3 compatibility
15180@c section (for repository & working directory) from the
15181@c rest--that might help avoid confusing people who
15182@c are upgrading (for example) from 1.6 to 1.8.
15183@c
15184@c A minor incompatibility is if a current version of CVS
15185@c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
15186@c see this as if there is no tag.  Seems to me this is
15187@c too obscure to mention.
15188
15189The working directory format is compatible going back
15190to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
15191and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
15192a working directory checked out with @sc{cvs} 1.3,
15193@sc{cvs} will convert it, but to go back to @sc{cvs}
151941.3 you need to check out a new working directory with
15195@sc{cvs} 1.3.
15196
15197The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
15198further (1.5 was the first official release with the remote protocol,
15199but some older versions might still be floating around).  In many
15200cases you need to upgrade both the client and the server to take
15201advantage of new features and bug fixes, however.
15202
15203@c Perhaps should be saying something here about the
15204@c "D" lines in Entries (written by CVS 1.9; 1.8 and
15205@c older don't use them).  These are supposed to be
15206@c compatible in both directions, but I'm not sure
15207@c they quite are 100%.  One common gripe is if you
15208@c "rm -r" a directory and 1.9 gets confused, as it
15209@c still sees it in Entries.  That one is fixed in
15210@c (say) 1.9.6.  Someone else reported problems with
15211@c starting with a directory which was checked out with
15212@c an old version, and then using a new version, and
15213@c some "D" lines appeared, but not for every
15214@c directory, causing some directories to be skipped.
15215@c They weren't sure how to reproduce this, though.
15216
15217@c ---------------------------------------------------------------------
15218@node Troubleshooting
15219@appendix Troubleshooting
15220
15221If you are having trouble with @sc{cvs}, this appendix
15222may help.  If there is a particular error message which
15223you are seeing, then you can look up the message
15224alphabetically.  If not, you can look through the
15225section on other problems to see if your problem is
15226mentioned there.
15227
15228@menu
15229* Error messages::              Partial list of CVS errors
15230* Connection::                  Trouble making a connection to a CVS server
15231* Other problems::              Problems not readily listed by error message
15232@end menu
15233
15234@ignore
15235@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15236@c @node Bad administrative files
15237@appendixsec Bad administrative files
15238
15239@c -- Give hints on how to fix them
15240@end ignore
15241
15242@node Error messages
15243@appendixsec Partial list of error messages
15244
15245Here is a partial list of error messages that you may
15246see from @sc{cvs}.  It is not a complete list---@sc{cvs}
15247is capable of printing many, many error messages, often
15248with parts of them supplied by the operating system,
15249but the intention is to list the common and/or
15250potentially confusing error messages.
15251
15252The messages are alphabetical, but introductory text
15253such as @samp{cvs update: } is not considered in
15254ordering them.
15255
15256In some cases the list includes messages printed by old
15257versions of @sc{cvs} (partly because users may not be
15258sure which version of @sc{cvs} they are using at any
15259particular moment).
15260@c If we want to start retiring messages, perhaps we
15261@c should pick a cutoff version (for example, no more
15262@c messages which are specific to versions before 1.9)
15263@c and then move the old messages to an "old messages"
15264@c node rather than deleting them completely.
15265
15266@table @code
15267@c FIXME: What is the correct way to format a multiline
15268@c error message here?  Maybe @table is the wrong
15269@c choice?  Texinfo gurus?
15270@item @var{file}:@var{line}: Assertion '@var{text}' failed
15271The exact format of this message may vary depending on
15272your system.  It indicates a bug in @sc{cvs}, which can
15273be handled as described in @ref{BUGS}.
15274
15275@item cvs @var{command}: authorization failed: server @var{host} rejected access
15276This is a generic response when trying to connect to a
15277pserver server which chooses not to provide a
15278specific reason for denying authorization.  Check that
15279the username and password specified are correct and
15280that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
15281in @file{inetd.conf}.  See @ref{Password authenticated}.
15282
15283@item cvs @var{command}: conflict: removed @var{file} was modified by second party
15284This message indicates that you removed a file, and
15285someone else modified it.  To resolve the conflict,
15286first run @samp{cvs add @var{file}}.  If desired, look
15287at the other party's modification to decide whether you
15288still want to remove it.  If you don't want to remove
15289it, stop here.  If you do want to remove it, proceed
15290with @samp{cvs remove @var{file}} and commit your
15291removal.
15292@c Tests conflicts2-142b* in sanity.sh test for this.
15293
15294@item cannot change permissions on temporary directory
15295@example
15296Operation not permitted
15297@end example
15298This message has been happening in a non-reproducible,
15299occasional way when we run the client/server testsuite,
15300both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
15301able to figure out what causes it, nor is it known
15302whether it is specific to Linux (or even to this
15303particular machine!).  If the problem does occur on
15304other unices, @samp{Operation not permitted} would be
15305likely to read @samp{Not owner} or whatever the system
15306in question uses for the unix @code{EPERM} error.  If
15307you have any information to add, please let us know as
15308described in @ref{BUGS}.  If you experience this error
15309while using @sc{cvs}, retrying the operation which
15310produced it should work fine.
15311@c This has been seen in a variety of tests, including
15312@c multibranch-2, multibranch-5, and basic1-24-rm-rm,
15313@c so it doesn't seem particularly specific to any one
15314@c test.
15315
15316@item cvs [server aborted]: Cannot check out files into the repository itself
15317The obvious cause for this message (especially for
15318non-client/server @sc{cvs}) is that the @sc{cvs} root
15319is, for example, @file{/usr/local/cvsroot} and you try
15320to check out files when you are in a subdirectory, such
15321as @file{/usr/local/cvsroot/test}.  However, there is a
15322more subtle cause, which is that the temporary
15323directory on the server is set to a subdirectory of the
15324root (which is also not allowed).  If this is the
15325problem, set the temporary directory to somewhere else,
15326for example @file{/var/tmp}; see @code{TMPDIR} in
15327@ref{Environment variables}, for how to set the
15328temporary directory.
15329
15330@item cannot commit files as 'root'
15331See @samp{'root' is not allowed to commit files}.
15332
15333@c For one example see basica-1a10 in the testsuite
15334@c For another example, "cvs co ." on NT; see comment
15335@c at windows-NT/filesubr.c (expand_wild).
15336@c For another example, "cvs co foo/bar" where foo exists.
15337@item cannot open CVS/Entries for reading: No such file or directory
15338This generally indicates a @sc{cvs} internal error, and
15339can be handled as with other @sc{cvs} bugs
15340(@pxref{BUGS}).  Usually there is a workaround---the
15341exact nature of which would depend on the situation but
15342which hopefully could be figured out.
15343
15344@c This is more obscure than it might sound; it only
15345@c happens if you run "cvs init" from a directory which
15346@c contains a CVS/Root file at the start.
15347@item cvs [init aborted]: cannot open CVS/Root: No such file or directory
15348This message is harmless.  Provided it is not
15349accompanied by other errors, the operation has
15350completed successfully.  This message should not occur
15351with current versions of @sc{cvs}, but it is documented
15352here for the benefit of @sc{cvs} 1.9 and older.
15353
15354@item cvs server: cannot open /root/.cvsignore: Permission denied
15355@itemx cvs [server aborted]: can't chdir(/root): Permission denied
15356See @ref{Connection}.
15357
15358@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
15359This message has been reported as intermittently
15360happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
15361unknown; if you know more about what causes it, let us
15362know as described in @ref{BUGS}.
15363
15364@item cvs [@var{command} aborted]: cannot start server via rcmd
15365This, unfortunately, is a rather nonspecific error
15366message which @sc{cvs} 1.9 will print if you are
15367running the @sc{cvs} client and it is having trouble
15368connecting to the server.  Current versions of @sc{cvs}
15369should print a much more specific error message.  If
15370you get this message when you didn't mean to run the
15371client at all, you probably forgot to specify
15372@code{:local:}, as described in @ref{Repository}.
15373
15374@item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
15375@sc{cvs} 1.9 and older will print this message
15376when trying to check in a binary file if
15377@sc{rcs} is not correctly installed.  Re-read the
15378instructions that came with your @sc{rcs} distribution
15379and the @sc{install} file in the @sc{cvs}
15380distribution.  Alternately, upgrade to a current
15381version of @sc{cvs}, which checks in files itself
15382rather than via @sc{rcs}.
15383
15384@item cvs checkout: could not check out @var{file}
15385With @sc{cvs} 1.9, this can mean that the @code{co} program
15386(part of @sc{rcs}) returned a failure.  It should be
15387preceded by another error message, however it has been
15388observed without another error message and the cause is
15389not well-understood.  With the current version of @sc{cvs},
15390which does not run @code{co}, if this message occurs
15391without another error message, it is definitely a @sc{cvs}
15392bug (@pxref{BUGS}).
15393@c My current suspicion is that the RCS in the rcs (not
15394@c cvs/winnt/rcs57nt.zip) directory on the _Practical_
15395@c CD is bad (remains to be confirmed).
15396@c There is also a report of something which looks
15397@c very similar on SGI, Irix 5.2, so I dunno.
15398
15399@item cvs [login aborted]: could not find out home directory
15400This means that you need to set the environment
15401variables that @sc{cvs} uses to locate your home directory.
15402See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
15403@ref{Environment variables}.
15404
15405@item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
15406@sc{cvs} 1.9 and older will print this message if there was
15407a problem finding the @code{rcsmerge} program.  Make
15408sure that it is in your @code{PATH}, or upgrade to a
15409current version of @sc{cvs}, which does not require
15410an external @code{rcsmerge} program.
15411
15412@item cvs [update aborted]: could not patch @var{file}: No such file or directory
15413This means that there was a problem finding the
15414@code{patch} program.  Make sure that it is in your
15415@code{PATH}.  Note that despite appearances the message
15416is @emph{not} referring to whether it can find @var{file}.
15417If both the client and the server are running a current
15418version of @sc{cvs}, then there is no need for an
15419external patch program and you should not see this
15420message.  But if either client or server is running
15421@sc{cvs} 1.9, then you need @code{patch}.
15422
15423@item cvs update: could not patch @var{file}; will refetch
15424This means that for whatever reason the client was
15425unable to apply a patch that the server sent.  The
15426message is nothing to be concerned about, because
15427inability to apply the patch only slows things down and
15428has no effect on what @sc{cvs} does.
15429@c xref to update output.  Or File status?
15430@c Or some place else that
15431@c explains this whole "patch"/P/Needs Patch thing?
15432
15433@item dying gasps from @var{server} unexpected
15434There is a known bug in the server for @sc{cvs} 1.9.18
15435and older which can cause this.  For me, this was
15436reproducible if I used the @samp{-t} global option.  It
15437was fixed by Andy Piper's 14 Nov 1997 change to
15438src/filesubr.c, if anyone is curious.
15439If you see the message,
15440you probably can just retry the operation which failed,
15441or if you have discovered information concerning its
15442cause, please let us know as described in @ref{BUGS}.
15443
15444@item end of file from server (consult above messages if any)
15445The most common cause for this message is if you are
15446using an external @code{rsh} program and it exited with
15447an error.  In this case the @code{rsh} program should
15448have printed a message, which will appear before the
15449above message.  For more information on setting up a
15450@sc{cvs} client and server, see @ref{Remote repositories}.
15451
15452@item cvs [update aborted]: EOF in key in RCS file @var{file},v
15453@itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
15454This means that there is a syntax error in the given
15455@sc{rcs} file.  Note that this might be true even if @sc{rcs} can
15456read the file OK; @sc{cvs} does more error checking of
15457errors in the RCS file.  That is why you may see this
15458message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
154591.10.  The likely cause for the original corruption is
15460hardware, the operating system, or the like.  Of
15461course, if you find a case in which @sc{cvs} seems to
15462corrupting the file, by all means report it,
15463(@pxref{BUGS}).
15464There are quite a few variations of this error message,
15465depending on exactly where in the @sc{rcs} file @sc{cvs}
15466finds the syntax error.
15467
15468@cindex mkmodules
15469@item cvs commit: Executing 'mkmodules'
15470This means that your repository is set up for a version
15471of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
154721.8 or later, the above message will be preceded by
15473
15474@example
15475cvs commit: Rebuilding administrative file database
15476@end example
15477
15478If you see both messages, the database is being rebuilt
15479twice, which is unnecessary but harmless.  If you wish
15480to avoid the duplication, and you have no versions of
15481@sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
15482every place it appears in your @code{modules}
15483file.  For more information on the @code{modules} file,
15484see @ref{modules}.
15485
15486@c This message comes from "co", and I believe is
15487@c possible only with older versions of CVS which call
15488@c co.  The problem with being able to create the bogus
15489@c RCS file still exists, though (and I think maybe
15490@c there is a different symptom(s) now).
15491@c FIXME: Would be nice to have a more exact wording
15492@c for this message.
15493@item missing author
15494Typically this can happen if you created an RCS file
15495with your username set to empty.  @sc{cvs} will, bogusly,
15496create an illegal RCS file with no value for the author
15497field.  The solution is to make sure your username is
15498set to a non-empty value and re-create the RCS file.
15499@c "make sure your username is set" is complicated in
15500@c and of itself, as there are the environment
15501@c variables the system login name, &c, and it depends
15502@c on the version of CVS.
15503
15504@item cvs [checkout aborted]: no such tag @var{tag}
15505This message means that @sc{cvs} isn't familiar with
15506the tag @var{tag}.  Usually the root cause is that you have
15507mistyped a tag name.  Ocassionally this can also occur because the
15508users creating tags do not have permissions to write to the
15509@file{CVSROOT/val-tags} file (@pxref{File permissions}, for more).
15510
15511Prior to @sc{cvs} version 1.12.10, there were a few relatively
15512obscure cases where a given tag could be created in an archive
15513file in the repository but @sc{cvs} would require the user to
15514@c Search sanity.sh for "no such tag" to see some of
15515@c the relatively obscure cases.
15516try a few other @sc{cvs} commands involving that tag
15517until one was found whch caused @sc{cvs} to update
15518@cindex CVSROOT/val-tags file, forcing tags into
15519@cindex val-tags file, forcing tags into
15520the @file{val-tags} file, at which point the originally failing command
15521would begin to work.  This same method can be used to repair a @file{val-tags}
15522file that becomes out of date due to the permissions problem mentioned above.
15523This updating is only required once per tag - once a tag is listed in
15524@file{val-tags}, it stays there.
15525
15526Note that using @samp{tag -f} to not require tag matches did not and
15527does not override this check (@pxref{Common options}).
15528
15529@item *PANIC* administration files missing
15530This typically means that there is a directory named
15531@sc{cvs} but it does not contain the administrative files
15532which @sc{cvs} puts in a CVS directory.  If the problem is
15533that you created a CVS directory via some mechanism
15534other than @sc{cvs}, then the answer is simple, use a name
15535other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
15536(@pxref{BUGS}).
15537
15538@item rcs error: Unknown option: -x,v/
15539This message will be followed by a usage message for
15540@sc{rcs}.  It means that you have an old version of
15541@sc{rcs} (probably supplied with your operating
15542system), as well as an old version of @sc{cvs}.
15543@sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
15544later; current versions of @sc{cvs} do not run @sc{rcs} programs.
15545@c For more information on installing @sc{cvs}, see
15546@c (FIXME: where?  it depends on whether you are
15547@c getting binaries or sources or what).
15548@c The message can also say "ci error" or something
15549@c instead of "rcs error", I suspect.
15550
15551@item cvs [server aborted]: received broken pipe signal
15552This message can be caused by a loginfo program that fails to
15553read all of the log information from its standard input.
15554If you find it happening in any other circumstances,
15555please let us know as described in @ref{BUGS}.
15556
15557@item 'root' is not allowed to commit files
15558When committing a permanent change, @sc{cvs} makes a log entry of
15559who committed the change.  If you are committing the change logged
15560in as "root" (not under "su" or other root-priv giving program),
15561@sc{cvs} cannot determine who is actually making the change.
15562As such, by default, @sc{cvs} disallows changes to be committed by users
15563logged in as "root".  (You can disable this option by passing the
15564@code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
15565On some systems this means editing the appropriate @file{config.h} file
15566before building @sc{cvs}.)
15567
15568@item cvs [server aborted]: Secondary out of sync with primary!
15569
15570This usually means that the version of @sc{cvs} running on a secondary
15571server is incompatible with the version running on the primary server
15572(@pxref{Write proxies}).
15573This will not occur if the client supports redirection.
15574
15575It is not the version number that is significant here, but the list of
15576supported requests that the servers provide to the client.
15577For example, even if both servers were the same version,
15578if the secondary was compiled with GSSAPI support and the primary was not,
15579the list of supported requests provided by the two servers
15580would be different and the secondary would not work as a transparent
15581proxy to the primary.
15582Conversely, even if the two servers were radically different versions
15583but both provided the same list of valid requests to the client,
15584the transparent proxy would succeed.
15585
15586@item Terminated with fatal signal 11
15587This message usually indicates that @sc{cvs} (the server, if you're
15588using client/server mode) has run out of (virtual) memory.
15589Although @sc{cvs} tries to catch the error and issue a more meaningful
15590message, there are many circumstances where that is not possible.
15591If you appear to have lots of memory available to the system,
15592the problem is most likely that you're running into a system-wide
15593limit on the amount of memory a single process can use or a
15594similar process-specific limit.
15595The mechanisms for displaying and setting such limits vary from
15596system to system, so you'll have to consult an expert for your
15597particular system if you don't know how to do that.
15598
15599@item Too many arguments!
15600This message is typically printed by the @file{log.pl}
15601script which is in the @file{contrib} directory in the
15602@sc{cvs} source distribution.  In some versions of
15603@sc{cvs}, @file{log.pl} has been part of the default
15604@sc{cvs} installation.  The @file{log.pl} script gets
15605called from the @file{loginfo} administrative file.
15606Check that the arguments passed in @file{loginfo} match
15607what your version of @file{log.pl} expects.  In
15608particular, the @file{log.pl} from @sc{cvs} 1.3 and
15609older expects the log file as an argument whereas the
15610@file{log.pl} from @sc{cvs} 1.5 and newer expects the
15611log file to be specified with a @samp{-f} option.  Of
15612course, if you don't need @file{log.pl} you can just
15613comment it out of @file{loginfo}.
15614
15615@item cvs [update aborted]: unexpected EOF reading @var{file},v
15616See @samp{EOF in key in RCS file}.
15617
15618@item cvs [login aborted]: unrecognized auth response from @var{server}
15619This message typically means that the server is not set
15620up properly.  For example, if @file{inetd.conf} points
15621to a nonexistent cvs executable.  To debug it further,
15622find the log file which inetd writes
15623(@file{/var/log/messages} or whatever inetd uses on
15624your system).  For details, see @ref{Connection}, and
15625@ref{Password authentication server}.
15626
15627@item cvs commit: Up-to-date check failed for `@var{file}'
15628This means that someone else has committed a change to
15629that file since the last time that you did a @code{cvs
15630update}.  So before proceeding with your @code{cvs
15631commit} you need to @code{cvs update}.  @sc{cvs} will merge
15632the changes that you made and the changes that the
15633other person made.  If it does not detect any conflicts
15634it will report @samp{M @var{file}} and you are ready
15635to @code{cvs commit}.  If it detects conflicts it will
15636print a message saying so, will report @samp{C @var{file}},
15637and you need to manually resolve the
15638conflict.  For more details on this process see
15639@ref{Conflicts example}.
15640
15641@item Usage:	diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
15642@example
15643Only one of [exEX3] allowed
15644@end example
15645This indicates a problem with the installation of
15646@code{diff3} and @code{rcsmerge}.  Specifically
15647@code{rcsmerge} was compiled to look for GNU diff3, but
15648it is finding unix diff3 instead.  The exact text of
15649the message will vary depending on the system.  The
15650simplest solution is to upgrade to a current version of
15651@sc{cvs}, which does not rely on external
15652@code{rcsmerge} or @code{diff3} programs.
15653
15654@item warning: unrecognized response `@var{text}' from cvs server
15655If @var{text} contains a valid response (such as
15656@samp{ok}) followed by an extra carriage return
15657character (on many systems this will cause the second
15658part of the message to overwrite the first part), then
15659it probably means that you are using the @samp{:ext:}
15660access method with a version of rsh, such as most
15661non-unix rsh versions, which does not by default
15662provide a transparent data stream.  In such cases you
15663probably want to try @samp{:server:} instead of
15664@samp{:ext:}.  If @var{text} is something else, this
15665may signify a problem with your @sc{cvs} server.
15666Double-check your installation against the instructions
15667for setting up the @sc{cvs} server.
15668@c FIXCVS: should be printing CR as \r or \015 or some
15669@c such, probably.
15670
15671@item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
15672This is a normal message, not an error.  See
15673@ref{Concurrency}, for more details.
15674
15675@item cvs commit: warning: editor session failed
15676@cindex Exit status, of editor
15677This means that the editor which @sc{cvs} is using exits with a nonzero
15678exit status.  Some versions of vi will do this even when there was not
15679a problem editing the file.  If so, point the
15680@code{CVSEDITOR} environment variable to a small script
15681such as:
15682
15683@example
15684#!/bin/sh
15685vi $*
15686exit 0
15687@end example
15688
15689@item cvs update: warning: @var{file} was lost
15690This means that the working copy of @var{file} has been deleted
15691but it has not been removed from @sc{cvs}.
15692This is nothing to be concerned about,
15693the update will just recreate the local file from the repository.
15694(This is a convenient way to discard local changes to a file:
15695just delete it and then run @code{cvs update}.)
15696
15697@item cvs update: warning: @var{file} is not (any longer) pertinent
15698This means that the working copy of @var{file} has been deleted,
15699it has not been removed from @sc{cvs} in the current working directory,
15700but it has been removed from @sc{cvs} in some other working directory.
15701This is nothing to be concerned about,
15702the update would have removed the local file anyway.
15703
15704@end table
15705
15706@node Connection
15707@appendixsec Trouble making a connection to a CVS server
15708
15709This section concerns what to do if you are having
15710trouble making a connection to a @sc{cvs} server.  If
15711you are running the @sc{cvs} command line client
15712running on Windows, first upgrade the client to
15713@sc{cvs} 1.9.12 or later.  The error reporting in
15714earlier versions provided much less information about
15715what the problem was.  If the client is non-Windows,
15716@sc{cvs} 1.9 should be fine.
15717
15718If the error messages are not sufficient to track down
15719the problem, the next steps depend largely on which
15720access method you are using.
15721
15722@table @code
15723@cindex ext method, troubleshooting
15724@item :ext:
15725Try running the rsh program from the command line.  For
15726example: "rsh servername cvs -v" should print @sc{cvs}
15727version information.  If this doesn't work, you need to
15728fix it before you can worry about @sc{cvs} problems.
15729
15730@cindex server method, troubleshooting
15731@item :server:
15732You don't need a command line rsh program to use this
15733access method, but if you have an rsh program around,
15734it may be useful as a debugging tool.  Follow the
15735directions given for :ext:.
15736
15737@cindex pserver method, troubleshooting
15738@item :pserver:
15739Errors along the lines of "connection refused" typically indicate
15740that inetd isn't even listening for connections on port 2401
15741whereas errors like "connection reset by peer",
15742"received broken pipe signal", "recv() from server: EOF",
15743or "end of file from server"
15744typically indicate that inetd is listening for
15745connections but is unable to start @sc{cvs} (this is frequently
15746caused by having an incorrect path in @file{inetd.conf}
15747or by firewall software rejecting the connection).
15748"unrecognized auth response" errors are caused by a bad command
15749line in @file{inetd.conf}, typically an invalid option or forgetting
15750to put the @samp{pserver} command at the end of the line.
15751Another less common problem is invisible control characters that
15752your editor "helpfully" added without you noticing.
15753
15754One good debugging tool is to "telnet servername
157552401".  After connecting, send any text (for example
15756"foo" followed by return).  If @sc{cvs} is working
15757correctly, it will respond with
15758
15759@example
15760cvs [pserver aborted]: bad auth protocol start: foo
15761@end example
15762
15763If instead you get:
15764
15765@example
15766Usage: cvs [cvs-options] command [command-options-and-arguments]
15767...
15768@end example
15769
15770@noindent
15771then you're missing the @samp{pserver} command at the end of the
15772line in @file{inetd.conf}; check to make sure that the entire command
15773is on one line and that it's complete.
15774
15775Likewise, if you get something like:
15776
15777@example
15778Unknown command: `pserved'
15779
15780CVS commands are:
15781        add          Add a new file/directory to the repository
15782...
15783@end example
15784
15785@noindent
15786then you've misspelled @samp{pserver} in some way.  If it isn't
15787obvious, check for invisible control characters (particularly
15788carriage returns) in @file{inetd.conf}.
15789
15790If it fails to work at all, then make sure inetd is working
15791right.  Change the invocation in @file{inetd.conf} to run the
15792echo program instead of cvs.  For example:
15793
15794@example
157952401  stream  tcp  nowait  root /bin/echo echo hello
15796@end example
15797
15798After making that change and instructing inetd to
15799re-read its configuration file, "telnet servername
158002401" should show you the text hello and then the
15801server should close the connection.  If this doesn't
15802work, you need to fix it before you can worry about
15803@sc{cvs} problems.
15804
15805On AIX systems, the system will often have its own
15806program trying to use port 2401.  This is AIX's problem
15807in the sense that port 2401 is registered for use with
15808@sc{cvs}.  I hear that there is an AIX patch available
15809to address this problem.
15810
15811Another good debugging tool is the @samp{-d}
15812(debugging) option to inetd.  Consult your system
15813documentation for more information.
15814
15815If you seem to be connecting but get errors like:
15816
15817@example
15818cvs server: cannot open /root/.cvsignore: Permission denied
15819cvs [server aborted]: can't chdir(/root): Permission denied
15820@end example
15821
15822@noindent
15823then you probably haven't specified @samp{-f} in @file{inetd.conf}.
15824(In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
15825your system setting the @code{$HOME} environment variable
15826for programs being run by inetd.  In this case, you can either
15827have inetd run a shell script that unsets @code{$HOME} and then runs
15828@sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
15829environment.)
15830
15831If you can connect successfully for a while but then can't,
15832you've probably hit inetd's rate limit.
15833(If inetd receives too many requests for the same service
15834in a short period of time, it assumes that something is wrong
15835and temporarily disables the service.)
15836Check your inetd documentation to find out how to adjust the
15837rate limit (some versions of inetd have a single rate limit,
15838others allow you to set the limit for each service separately.)
15839@end table
15840
15841@node Other problems
15842@appendixsec Other common problems
15843
15844Here is a list of problems which do not fit into the
15845above categories.  They are in no particular order.
15846
15847@itemize @bullet
15848@item
15849On Windows, if there is a 30 second or so delay when
15850you run a @sc{cvs} command, it may mean that you have
15851your home directory set to @file{C:/}, for example (see
15852@code{HOMEDRIVE} and @code{HOMEPATH} in
15853@ref{Environment variables}).  @sc{cvs} expects the home
15854directory to not end in a slash, for example @file{C:}
15855or @file{C:\cvs}.
15856@c FIXCVS: CVS should at least detect this and print an
15857@c error, presumably.
15858
15859@item
15860If you are running @sc{cvs} 1.9.18 or older, and
15861@code{cvs update} finds a conflict and tries to
15862merge, as described in @ref{Conflicts example}, but
15863doesn't tell you there were conflicts, then you may
15864have an old version of @sc{rcs}.  The easiest solution
15865probably is to upgrade to a current version of
15866@sc{cvs}, which does not rely on external @sc{rcs}
15867programs.
15868@end itemize
15869
15870@c ---------------------------------------------------------------------
15871@node Credits
15872@appendix Credits
15873
15874@cindex Contributors (manual)
15875@cindex Credits (manual)
15876Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
15877wrote the manual pages which were distributed with
15878@sc{cvs} 1.3.  Much of their text was copied into this
15879manual.  He also read an early draft
15880of this manual and contributed many ideas and
15881corrections.
15882
15883The mailing-list @code{info-cvs} is sometimes
15884informative. I have included information from postings
15885made by the following persons:
15886David G. Grubbs <@t{dgg@@think.com}>.
15887
15888Some text has been extracted from the man pages for
15889@sc{rcs}.
15890
15891The @sc{cvs} @sc{faq} by David G. Grubbs has provided
15892useful material.  The @sc{faq} is no longer maintained,
15893however, and this manual is about the closest thing there
15894is to a successor (with respect to documenting how to
15895use @sc{cvs}, at least).
15896
15897In addition, the following persons have helped by
15898telling me about mistakes I've made:
15899
15900@display
15901Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
15902Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
15903Karl Pingle <@t{pingle@@acuson.com}>,
15904Thomas A Peterson <@t{tap@@src.honeywell.com}>,
15905Inge Wallin <@t{ingwa@@signum.se}>,
15906Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
15907and Michael Brown <@t{brown@@wi.extrel.com}>.
15908@end display
15909
15910The list of contributors here is not comprehensive; for a more
15911complete list of who has contributed to this manual see
15912the file @file{doc/ChangeLog} in the @sc{cvs} source
15913distribution.
15914
15915The MirOS Project uses @sc{cvs} heavily in MirOS BSD and the
15916MirPorts Framework and has enhanced it as well as packaged it
15917for the MirDebian "WTF" repository. Responsible:
15918
15919@display
15920Thorsten Glaser <@t{tg@@mirbsd.org}>
15921@end display
15922
15923CVS Homepage: @url{http://www.nongnu.org/cvs/}
15924
15925@c ---------------------------------------------------------------------
15926@node BUGS
15927@appendix Dealing with bugs in CVS or this manual
15928
15929@cindex Bugs in this manual or CVS
15930Neither @sc{cvs} nor this manual is perfect, and they
15931probably never will be.  If you are having trouble
15932using @sc{cvs}, or think you have found a bug, there
15933are a number of things you can do about it.  Note that
15934if the manual is unclear, that can be considered a bug
15935in the manual, so these problems are often worth doing
15936something about as well as problems with @sc{cvs} itself.
15937
15938@cindex Reporting bugs
15939@cindex Bugs, reporting
15940@cindex Errors, reporting
15941@itemize @bullet
15942@item
15943If you want someone to help you and fix bugs that you
15944report, there are companies which will do that for a
15945fee.  One such company is:
15946
15947@cindex Ximbiot
15948@cindex Support, getting CVS support
15949@example
15950Ximbiot
15951319 S. River St.
15952Harrisburg, PA  17104-1657
15953USA
15954Email: info@@ximbiot.com
15955Phone: (717) 579-6168
15956Fax:   (717) 234-3125
15957@url{http://ximbiot.com/}
15958
15959@end example
15960
15961@item
15962If you got @sc{cvs} through a distributor, such as an
15963operating system vendor or a vendor of freeware
15964@sc{cd-rom}s, you may wish to see whether the
15965distributor provides support.  Often, they will provide
15966no support or minimal support, but this may vary from
15967distributor to distributor.
15968
15969@item
15970If you have the skills and time to do so, you may wish
15971to fix the bug yourself.  If you wish to submit your
15972fix for inclusion in future releases of @sc{cvs}, see
15973the file @sc{hacking} in the @sc{cvs} source
15974distribution.  It contains much more information on the
15975process of submitting fixes.
15976
15977@item
15978There may be resources on the net which can help.  A
15979good place to start is:
15980
15981@example
15982@url{http://cvs.nongnu.org/}
15983@end example
15984
15985If you are so inspired, increasing the information
15986available on the net is likely to be appreciated.  For
15987example, before the standard @sc{cvs} distribution
15988worked on Windows 95, there was a web page with some
15989explanation and patches for running @sc{cvs} on Windows
1599095, and various people helped out by mentioning this
15991page on mailing lists or newsgroups when the subject
15992came up.
15993
15994@item
15995It is also possible to report bugs to @email{bug-cvs@@nongnu.org}.
15996Note that someone may or may not want to do anything
15997with your bug report---if you need a solution consider
15998one of the options mentioned above.  People probably do
15999want to hear about bugs which are particularly severe
16000in consequences and/or easy to fix, however.  You can
16001also increase your odds by being as clear as possible
16002about the exact nature of the bug and any other
16003relevant information.  The way to report bugs is to
16004send email to @email{bug-cvs@@nongnu.org}.  Note
16005that submissions to @email{bug-cvs@@nongnu.org} may be distributed
16006under the terms of the @sc{gnu} Public License, so if
16007you don't like this, don't submit them.  There is
16008usually no justification for sending mail directly to
16009one of the @sc{cvs} maintainers rather than to
16010@email{bug-cvs@@nongnu.org}; those maintainers who want to hear
16011about such bug reports read @email{bug-cvs@@nongnu.org}.  Also note
16012that sending a bug report to other mailing lists or
16013newsgroups is @emph{not} a substitute for sending it to
16014@email{bug-cvs@@nongnu.org}.  It is fine to discuss @sc{cvs} bugs on
16015whatever forum you prefer, but there are not
16016necessarily any maintainers reading bug reports sent
16017anywhere except @email{bug-cvs@@nongnu.org}.
16018@end itemize
16019
16020@cindex Known bugs in this manual or CVS
16021People often ask if there is a list of known bugs or
16022whether a particular bug is a known one.  The file
16023@sc{bugs} in the @sc{cvs} source distribution is one
16024list of known bugs, but it doesn't necessarily try to
16025be comprehensive.  Perhaps there will never be a
16026comprehensive, detailed list of known bugs.
16027
16028@c ---------------------------------------------------------------------
16029@node Index
16030@unnumbered Index
16031@cindex Index
16032
16033@printindex cp
16034
16035@bye
16036
16037Local Variables:
16038fill-column: 55
16039End:
16040