123ab93ed144455f62add87d1e9055a25dffb547
[dragonfly.git] / contrib / cvs-1.12 / doc / cvs.texinfo
1 \input texinfo  @c -*-texinfo-*-
2 @comment Documentation for CVS.
3 @setfilename cvs.info
4 @macro copyleftnotice
5 @noindent
6 Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
7                        2001, 2002, 2003, 2004, 2005
8                        Free Software Foundation, Inc.
9
10 @multitable @columnfractions .12 .88
11 @item Portions
12 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005
13                                   Derek R. Price,
14 @item @tab Copyright @copyright{} 2002, 2003, 2004, 2005
15                                   Ximbiot @url{http://ximbiot.com},
16 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
17 @item @tab and Copyright @copyright{} others.
18 @end multitable
19
20 @ignore
21 Permission is granted to process this file through Tex and print the
22 results, provided the printed document carries copying permission
23 notice identical to this one except for the removal of this paragraph
24 (this paragraph not being relevant to the printed manual).
25
26 @end ignore
27 Permission is granted to make and distribute verbatim copies of
28 this manual provided the copyright notice and this permission notice
29 are preserved on all copies.
30
31 Permission is granted to copy and distribute modified versions of this
32 manual under the conditions for verbatim copying, provided also that the
33 entire resulting derived work is distributed under the terms of a
34 permission notice identical to this one.
35
36 Permission is granted to copy and distribute translations of this manual
37 into another language, under the above conditions for modified versions,
38 except that this permission notice may be stated in a translation
39 approved by the Free Software Foundation.
40 @end macro
41
42 @comment This file is part of the CVS distribution.
43
44 @comment CVS is free software; you can redistribute it and/or modify
45 @comment it under the terms of the GNU General Public License as published by
46 @comment the Free Software Foundation; either version 2, or (at your option)
47 @comment any later version.
48
49 @comment CVS is distributed in the hope that it will be useful,
50 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
51 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
52 @comment GNU General Public License for more details.
53
54 @c See ../README for A4 vs. US letter size.
55 @c When we provided A4 postscript, and people tried to
56 @c print it on US letter, the usual complaint was that the
57 @c page numbers would get cut off.
58 @c If one prints US letter on A4, reportedly there is
59 @c some extra space at the top and/or bottom, and the side
60 @c margins are a bit narrow, but no text is lost.
61 @c
62 @c See
63 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
64 @c for more on paper sizes.  Insuring that margins are
65 @c big enough to print on either A4 or US letter does
66 @c indeed seem to be the usual approach (RFC2346).
67
68 @c This document seems to get overfull hboxes with some
69 @c frequency (probably because the tendency is to
70 @c sanity-check it with "make info" and run TeX less
71 @c often).  The big ugly boxes just seem to add insult
72 @c to injury, and I'm not aware of them helping to fix
73 @c the overfull hboxes at all.
74 @finalout
75
76 @include version.texi
77 @settitle CVS---Concurrent Versions System v@value{VERSION}
78 @setchapternewpage odd
79
80 @c -- TODO list:
81 @c -- Fix all lines that match "^@c -- "
82 @c -- Also places marked with FIXME should be manual
83 @c problems (as opposed to FIXCVS for CVS problems).
84
85 @c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
86 @c @asis when generating info and dvi, and by <i></i> in the generated html,
87 @c such that keywords are not expanded in the generated html. 
88 @ifnothtml
89 @macro splitrcskeyword {arg}
90 @asis{}\arg\
91 @end macro
92 @end ifnothtml
93
94 @ifhtml
95 @macro splitrcskeyword {arg}
96 @i{}\arg\
97 @end macro
98 @end ifhtml
99
100 @dircategory GNU Packages
101 @direntry
102 * CVS: (cvs).                   Concurrent Versions System
103 @end direntry
104 @dircategory Individual utilities
105 @direntry
106 * cvs: (cvs)CVS commands.       Concurrent Versions System
107 @end direntry
108
109 @comment The titlepage section does not appear in the Info file.
110 @titlepage
111 @sp 4
112 @comment The title is printed in a large font.
113 @center @titlefont{Version Management}
114 @sp
115 @center @titlefont{with}
116 @sp
117 @center @titlefont{CVS}
118 @sp 2
119 @center for @sc{cvs} @value{VERSION}
120 @comment -release-
121 @sp 3
122 @center Per Cederqvist et al
123
124 @comment  The following two commands start the copyright page
125 @comment  for the printed manual.  This will not appear in the Info file.
126 @page
127 @vskip 0pt plus 1filll
128 @copyleftnotice
129 @end titlepage
130
131 @summarycontents
132
133 @contents
134
135 @comment ================================================================
136 @comment                   The real text starts here
137 @comment ================================================================
138
139 @ifnottex
140 @c ---------------------------------------------------------------------
141 @node    Top
142 @top
143
144 This info manual describes how to use and administer
145 @sc{cvs} version @value{VERSION}.
146 @end ifnottex
147
148 @ifinfo
149 @copyleftnotice
150 @end ifinfo
151
152 @c This menu is pretty long.  Not sure how easily that
153 @c can be fixed (no brilliant ideas right away)...
154 @menu
155 * Overview::                    An introduction to CVS
156 * Repository::                  Where all your sources are stored
157 * Starting a new project::      Starting a project with CVS
158 * Revisions::                   Numeric and symbolic names for revisions
159 * Branching and merging::       Diverging/rejoining branches of development
160 * Recursive behavior::          CVS descends directories
161 * Adding and removing::         Adding/removing/renaming files/directories
162 * History browsing::            Viewing the history of files in various ways
163
164 CVS and the Real World.
165 -----------------------
166 * Binary files::                CVS can handle binary files
167 * Multiple developers::         How CVS helps a group of developers
168 * Revision management::         Policy questions for revision management
169 * Keyword substitution::        CVS can include the revision inside the file
170 * Tracking sources::            Tracking third-party sources
171 * Builds::                      Issues related to CVS and builds
172 * Special Files::               Devices, links and other non-regular files
173
174 References.
175 -----------
176 * CVS commands::                CVS commands share some things
177 * Invoking CVS::                Quick reference to CVS commands
178 * Administrative files::        Reference manual for the Administrative files
179 * Environment variables::       All environment variables which affect CVS
180 * Compatibility::               Upgrading CVS versions
181 * Troubleshooting::             Some tips when nothing works
182 * Credits::                     Some of the contributors to this manual
183 * BUGS::                        Dealing with bugs in CVS or this manual
184 * Index::                       Index
185 @end menu
186
187 @c ---------------------------------------------------------------------
188 @node Overview
189 @chapter Overview
190 @cindex Overview
191
192 This chapter is for people who have never used
193 @sc{cvs}, and perhaps have never used version control
194 software before.
195
196 If you are already familiar with @sc{cvs} and are just
197 trying to learn a particular feature or remember a
198 certain command, you can probably skip everything here.
199
200 @menu
201 * What is CVS?::                What you can do with @sc{cvs}
202 * What is CVS not?::            Problems @sc{cvs} doesn't try to solve
203 * A sample session::            A tour of basic @sc{cvs} usage
204 @end menu
205
206 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
207 @node What is CVS?
208 @section What is CVS?
209 @cindex What is CVS?
210 @cindex Introduction to CVS
211 @cindex CVS, introduction to
212
213 @sc{cvs} is a version control system.  Using it, you can
214 record the history of your source files.
215
216 @c -- ///
217 @c -- ///Those who cannot remember the past are condemned to repeat it.
218 @c -- ///               -- George Santayana
219 @c -- //////
220
221 @c -- Insert history  quote here!
222 For example, bugs sometimes creep in when
223 software is modified, and you might not detect the bug
224 until a long time after you make the modification.
225 With @sc{cvs}, you can easily retrieve old versions to see
226 exactly which change caused the bug.  This can
227 sometimes be a big help.
228
229 You could of course save every version of every file
230 you have ever created.  This would
231 however waste an enormous amount of disk space.  @sc{cvs}
232 stores all the versions of a file in a single file in a
233 clever way that only stores the differences between
234 versions.
235
236 @sc{cvs} also helps you if you are part of a group of people working
237 on the same project.  It is all too easy to overwrite
238 each others' changes unless you are extremely careful.
239 Some editors, like @sc{gnu} Emacs, try to make sure that
240 two people never modify the same file at the
241 same time.  Unfortunately, if someone is using another
242 editor, that safeguard will not work.  @sc{cvs} solves this problem
243 by insulating the different developers from each other.  Every
244 developer works in his own directory, and @sc{cvs} merges
245 the work when each developer is done.
246
247 @cindex History of CVS
248 @cindex CVS, history of
249 @cindex Credits (CVS program)
250 @cindex Contributors (CVS program)
251 @sc{cvs} started out as a bunch of shell scripts written by
252 Dick Grune, posted to the newsgroup
253 @code{comp.sources.unix} in the volume 6
254 release of July, 1986.  While no actual code from
255 these shell scripts is present in the current version
256 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
257 come from them.
258
259 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
260 Jeff Polk later helped Brian with the design of the @sc{cvs}
261 module and vendor branch support.
262
263 @cindex Source, getting CVS source
264 You can get @sc{cvs} in a variety of ways, including
265 free download from the Internet.  For more information
266 on downloading @sc{cvs} and other @sc{cvs} topics, see:
267
268 @example
269 @url{http://cvs.nongnu.org/}
270 @end example
271
272 @cindex Mailing list
273 @cindex List, mailing list
274 @cindex Newsgroups
275 There is a mailing list, known as @email{info-cvs@@nongnu.org},
276 devoted to @sc{cvs}.  To subscribe or
277 unsubscribe
278 write to
279 @email{info-cvs-request@@nongnu.org}.
280 If you prefer a Usenet group, there is a one-way mirror (posts to the email
281 list are usually sent to the news group, but not visa versa) of
282 @email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}.  The right
283 Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
284 @sc{cvs} discussions (along with other configuration
285 management systems).  In the future, it might be
286 possible to create a
287 @code{comp.software.config-mgmt.cvs}, but probably only
288 if there is sufficient @sc{cvs} traffic on
289 @url{news:comp.software.config-mgmt}.
290 @c Other random data is that the tale was very
291 @c skeptical of comp.software.config-mgmt.cvs when the
292 @c subject came up around 1995 or so (for one
293 @c thing, because creating it would be a "reorg" which
294 @c would need to take a more comprehensive look at the
295 @c whole comp.software.config-mgmt.* hierarchy).
296
297 You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list,
298 described in more detail in @ref{BUGS}.  To subscribe
299 send mail to @email{bug-cvs-request@@nongnu.org}.  There is a two-way
300 Usenet mirror (posts to the Usenet group are usually sent to the email list and
301 visa versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}.
302
303 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
304 @node What is CVS not?
305 @section What is CVS not?
306 @cindex What is CVS not?
307
308 @sc{cvs} can do a lot of things for you, but it does
309 not try to be everything for everyone.
310
311 @table @asis
312 @item @sc{cvs} is not a build system.
313
314 Though the structure of your repository and modules
315 file interact with your build system
316 (e.g. @file{Makefile}s), they are essentially
317 independent.
318
319 @sc{cvs} does not dictate how you build anything.  It
320 merely stores files for retrieval in a tree structure
321 you devise.
322
323 @sc{cvs} does not dictate how to use disk space in the
324 checked out working directories.  If you write your
325 @file{Makefile}s or scripts in every directory so they
326 have to know the relative positions of everything else,
327 you wind up requiring the entire repository to be
328 checked out.
329
330 If you modularize your work, and construct a build
331 system that will share files (via links, mounts,
332 @code{VPATH} in @file{Makefile}s, etc.), you can
333 arrange your disk usage however you like.
334
335 But you have to remember that @emph{any} such system is
336 a lot of work to construct and maintain.  @sc{cvs} does
337 not address the issues involved.
338
339 Of course, you should place the tools created to
340 support such a build system (scripts, @file{Makefile}s,
341 etc) under @sc{cvs}.
342
343 Figuring out what files need to be rebuilt when
344 something changes is, again, something to be handled
345 outside the scope of @sc{cvs}.  One traditional
346 approach is to use @code{make} for building, and use
347 some automated tool for generating the dependencies which
348 @code{make} uses.
349
350 See @ref{Builds}, for more information on doing builds
351 in conjunction with @sc{cvs}.
352
353 @item @sc{cvs} is not a substitute for management.
354
355 Your managers and project leaders are expected to talk
356 to you frequently enough to make certain you are aware
357 of schedules, merge points, branch names and release
358 dates.  If they don't, @sc{cvs} can't help.
359
360 @sc{cvs} is an instrument for making sources dance to
361 your tune.  But you are the piper and the composer.  No
362 instrument plays itself or writes its own music.
363
364 @item @sc{cvs} is not a substitute for developer communication.
365
366 When faced with conflicts within a single file, most
367 developers manage to resolve them without too much
368 effort.  But a more general definition of ``conflict''
369 includes problems too difficult to solve without
370 communication between developers.
371
372 @sc{cvs} cannot determine when simultaneous changes
373 within a single file, or across a whole collection of
374 files, will logically conflict with one another.  Its
375 concept of a @dfn{conflict} is purely textual, arising
376 when two changes to the same base file are near enough
377 to spook the merge (i.e. @code{diff3}) command.
378
379 @sc{cvs} does not claim to help at all in figuring out
380 non-textual or distributed conflicts in program logic.
381
382 For example: Say you change the arguments to function
383 @code{X} defined in file @file{A}.  At the same time,
384 someone edits file @file{B}, adding new calls to
385 function @code{X} using the old arguments.  You are
386 outside the realm of @sc{cvs}'s competence.
387
388 Acquire the habit of reading specs and talking to your
389 peers.
390
391
392 @item @sc{cvs} does not have change control
393
394 Change control refers to a number of things.  First of
395 all it can mean @dfn{bug-tracking}, that is being able
396 to keep a database of reported bugs and the status of
397 each one (is it fixed?  in what release?  has the bug
398 submitter agreed that it is fixed?).  For interfacing
399 @sc{cvs} to an external bug-tracking system, see the
400 @file{rcsinfo} and @file{verifymsg} files
401 (@pxref{Administrative files}).
402
403 Another aspect of change control is keeping track of
404 the fact that changes to several files were in fact
405 changed together as one logical change.  If you check
406 in several files in a single @code{cvs commit}
407 operation, @sc{cvs} then forgets that those files were
408 checked in together, and the fact that they have the
409 same log message is the only thing tying them
410 together.  Keeping a @sc{gnu} style @file{ChangeLog}
411 can help somewhat.
412 @c FIXME: should have an xref to a section which talks
413 @c more about keeping ChangeLog's with CVS, but that
414 @c section hasn't been written yet.
415
416 Another aspect of change control, in some systems, is
417 the ability to keep track of the status of each
418 change.  Some changes have been written by a developer,
419 others have been reviewed by a second developer, and so
420 on.  Generally, the way to do this with @sc{cvs} is to
421 generate a diff (using @code{cvs diff} or @code{diff})
422 and email it to someone who can then apply it using the
423 @code{patch} utility.  This is very flexible, but
424 depends on mechanisms outside @sc{cvs} to make sure
425 nothing falls through the cracks.
426
427 @item @sc{cvs} is not an automated testing program
428
429 It should be possible to enforce mandatory use of a
430 test suite using the @code{commitinfo} file.  I haven't
431 heard a lot about projects trying to do that or whether
432 there are subtle gotchas, however.
433
434 @item @sc{cvs} does not have a built-in process model
435
436 Some systems provide ways to ensure that changes or
437 releases go through various steps, with various
438 approvals as needed.  Generally, one can accomplish
439 this with @sc{cvs} but it might be a little more work.
440 In some cases you'll want to use the @file{commitinfo},
441 @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
442 files, to require that certain steps be performed
443 before cvs will allow a checkin.  Also consider whether
444 features such as branches and tags can be used to
445 perform tasks such as doing work in a development tree
446 and then merging certain changes over to a stable tree
447 only once they have been proven.
448 @end table
449
450 @c ---------------------------------------------------------------------
451 @node A sample session
452 @section A sample session
453 @cindex Example of a work-session
454 @cindex Getting started
455 @cindex Work-session, example of
456 @cindex tc, Trivial Compiler (example)
457 @cindex Trivial Compiler (example)
458
459 @c I think an example is a pretty good way to start.  But
460 @c somewhere in here, maybe after the sample session,
461 @c we need something which is kind of
462 @c a "roadmap" which is more directed at sketching out
463 @c the functionality of CVS and pointing people to
464 @c various other parts of the manual.  As it stands now
465 @c people who read in order get dumped right into all
466 @c manner of hair regarding remote repositories,
467 @c creating a repository, etc.
468 @c
469 @c The following was in the old Basic concepts node.  I don't
470 @c know how good a job it does at introducing modules,
471 @c or whether they need to be introduced so soon, but
472 @c something of this sort might go into some
473 @c introductory material somewhere.
474 @ignore
475 @cindex Modules (intro)
476 The repository contains directories and files, in an
477 arbitrary tree.  The @dfn{modules} feature can be used
478 to group together a set of directories or files into a
479 single entity (@pxref{modules}).  A typical usage is to
480 define one module per project.
481 @end ignore
482
483 As a way of introducing @sc{cvs}, we'll go through a
484 typical work-session using @sc{cvs}.  The first thing
485 to understand is that @sc{cvs} stores all files in a
486 centralized @dfn{repository} (@pxref{Repository}); this
487 section assumes that a repository is set up.
488 @c I'm not sure that the sentence concerning the
489 @c repository quite tells the user what they need to
490 @c know at this point.  Might need to expand on "centralized"
491 @c slightly (maybe not here, maybe further down in the example?)
492
493 Suppose you are working on a simple compiler.  The source
494 consists of a handful of C files and a @file{Makefile}.
495 The compiler is called @samp{tc} (Trivial Compiler),
496 and the repository is set up so that there is a module
497 called @samp{tc}.
498
499 @menu
500 * Getting the source::          Creating a workspace
501 * Committing your changes::     Making your work available to others
502 * Cleaning up::                 Cleaning up
503 * Viewing differences::         Viewing differences
504 @end menu
505
506 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
507 @node Getting the source
508 @subsection Getting the source
509 @cindex Getting the source
510 @cindex Checking out source
511 @cindex Fetching source
512 @cindex Source, getting from CVS
513 @cindex Checkout, example
514
515 The first thing you must do is to get your own working copy of the
516 source for @samp{tc}.  For this, you use the @code{checkout} command:
517
518 @example
519 $ cvs checkout tc
520 @end example
521
522 @noindent
523 This will create a new directory called @file{tc} and populate it with
524 the source files.
525
526 @example
527 $ cd tc
528 $ ls
529 CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
530 @end example
531
532 The @file{CVS} directory is used internally by
533 @sc{cvs}.  Normally, you should not modify or remove
534 any of the files in it.
535
536 You start your favorite editor, hack away at @file{backend.c}, and a couple
537 of hours later you have added an optimization pass to the compiler.
538 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
539 you want to edit.  @xref{Multiple developers}, for an explanation.
540
541 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
542 @node Committing your changes
543 @subsection Committing your changes
544 @cindex Committing changes to files
545 @cindex Log message entry
546
547 When you have checked that the compiler is still compilable you decide
548 to make a new version of @file{backend.c}.  This will
549 store your new @file{backend.c} in the repository and
550 make it available to anyone else who is using that same
551 repository.
552
553 @example
554 $ cvs commit backend.c
555 @end example
556
557 @noindent
558 @sc{cvs} starts an editor, to allow you to enter a log
559 message.  You type in ``Added an optimization pass.'',
560 save the temporary file, and exit the editor.
561
562 @cindex CVSEDITOR, environment variable
563 @cindex EDITOR, environment variable
564 The environment variable @code{$CVSEDITOR} determines
565 which editor is started.  If @code{$CVSEDITOR} is not
566 set, then if the environment variable @code{$EDITOR} is
567 set, it will be used. If both @code{$CVSEDITOR} and
568 @code{$EDITOR} are not set then there is a default
569 which will vary with your operating system, for example
570 @code{vi} for unix or @code{notepad} for Windows
571 NT/95.
572
573 @cindex VISUAL, environment variable
574 In addition, @sc{cvs} checks the @code{$VISUAL} environment
575 variable.  Opinions vary on whether this behavior is desirable and
576 whether future releases of @sc{cvs} should check @code{$VISUAL} or
577 ignore it.  You will be OK either way if you make sure that
578 @code{$VISUAL} is either unset or set to the same thing as
579 @code{$EDITOR}.
580
581 @c This probably should go into some new node
582 @c containing detailed info on the editor, rather than
583 @c the intro.  In fact, perhaps some of the stuff with
584 @c CVSEDITOR and -m and so on should too.
585 When @sc{cvs} starts the editor, it includes a list of
586 files which are modified.  For the @sc{cvs} client,
587 this list is based on comparing the modification time
588 of the file against the modification time that the file
589 had when it was last gotten or updated.  Therefore, if
590 a file's modification time has changed but its contents
591 have not, it will show up as modified.  The simplest
592 way to handle this is simply not to worry about it---if
593 you proceed with the commit @sc{cvs} will detect that
594 the contents are not modified and treat it as an
595 unmodified file.  The next @code{update} will clue
596 @sc{cvs} in to the fact that the file is unmodified,
597 and it will reset its stored timestamp so that the file
598 will not show up in future editor sessions.
599 @c FIXCVS: Might be nice if "commit" and other commands
600 @c would reset that timestamp too, but currently commit
601 @c doesn't.
602 @c FIXME: Need to talk more about the process of
603 @c prompting for the log message.  Like show an example
604 @c of what it pops up in the editor, for example.  Also
605 @c a discussion of how to get the "a)bort, c)ontinue,
606 @c e)dit" prompt and what to do with it.  Might also
607 @c work in the suggestion that if you want a diff, you
608 @c should make it before running commit (someone
609 @c suggested that the diff pop up in the editor.  I'm
610 @c not sure that is better than telling people to run
611 @c "cvs diff" first if that is what they want, but if
612 @c we want to tell people that, the manual possibly
613 @c should say it).
614
615 If you want to avoid
616 starting an editor you can specify the log message on
617 the command line using the @samp{-m} flag instead, like
618 this:
619
620 @example
621 $ cvs commit -m "Added an optimization pass" backend.c
622 @end example
623
624 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
625 @node Cleaning up
626 @subsection Cleaning up
627 @cindex Cleaning up
628 @cindex Working copy, removing
629 @cindex Removing your working copy
630 @cindex Releasing your working copy
631
632 Before you turn to other tasks you decide to remove your working copy of
633 tc.  One acceptable way to do that is of course
634
635 @example
636 $ cd ..
637 $ rm -r tc
638 @end example
639
640 @noindent
641 but a better way is to use the @code{release} command (@pxref{release}):
642
643 @example
644 $ cd ..
645 $ cvs release -d tc
646 M driver.c
647 ? tc
648 You have [1] altered files in this repository.
649 Are you sure you want to release (and delete) directory `tc': n
650 ** `release' aborted by user choice.
651 @end example
652
653 The @code{release} command checks that all your modifications have been
654 committed.  If history logging is enabled it also makes a note in the
655 history file.  @xref{history file}.
656
657 When you use the @samp{-d} flag with @code{release}, it
658 also removes your working copy.
659
660 In the example above, the @code{release} command wrote a couple of lines
661 of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
662 That is nothing to worry about: @file{tc} is the executable compiler,
663 and it should not be stored in the repository.  @xref{cvsignore},
664 for information about how to make that warning go away.
665 @xref{release output}, for a complete explanation of
666 all possible output from @code{release}.
667
668 @samp{M driver.c} is more serious.  It means that the
669 file @file{driver.c} has been modified since it was
670 checked out.
671
672 The @code{release} command always finishes by telling
673 you how many modified files you have in your working
674 copy of the sources, and then asks you for confirmation
675 before deleting any files or making any note in the
676 history file.
677
678 You decide to play it safe and answer @kbd{n @key{RET}}
679 when @code{release} asks for confirmation.
680
681 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
682 @node Viewing differences
683 @subsection Viewing differences
684 @cindex Viewing differences
685 @cindex Diff
686
687 You do not remember modifying @file{driver.c}, so you want to see what
688 has happened to that file.
689
690 @example
691 $ cd tc
692 $ cvs diff driver.c
693 @end example
694
695 This command runs @code{diff} to compare the version of @file{driver.c}
696 that you checked out with your working copy.  When you see the output
697 you remember that you added a command line option that enabled the
698 optimization pass.  You check it in, and release the module.
699 @c FIXME: we haven't yet defined the term "check in".
700
701 @example
702 $ cvs commit -m "Added an optimization pass" driver.c
703 Checking in driver.c;
704 /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
705 new revision: 1.2; previous revision: 1.1
706 done
707 $ cd ..
708 $ cvs release -d tc
709 ? tc
710 You have [0] altered files in this repository.
711 Are you sure you want to release (and delete) directory `tc': y
712 @end example
713
714 @c ---------------------------------------------------------------------
715 @node Repository
716 @chapter The Repository
717 @cindex Repository (intro)
718 @cindex Repository, example
719 @cindex Layout of repository
720 @cindex Typical repository
721 @cindex /usr/local/cvsroot, as example repository
722 @cindex cvsroot
723
724 The @sc{cvs} @dfn{repository} stores a complete copy of
725 all the files and directories which are under version
726 control.
727
728 Normally, you never access any of the files in the
729 repository directly.  Instead, you use @sc{cvs}
730 commands to get your own copy of the files into a
731 @dfn{working directory}, and then
732 work on that copy.  When you've finished a set of
733 changes, you check (or @dfn{commit}) them back into the
734 repository.  The repository then contains the changes
735 which you have made, as well as recording exactly what
736 you changed, when you changed it, and other such
737 information.  Note that the repository is not a
738 subdirectory of the working directory, or vice versa;
739 they should be in separate locations.
740 @c Need some example, e.g. repository
741 @c /usr/local/cvsroot; working directory
742 @c /home/joe/sources.  But this node is too long
743 @c as it is; need a little reorganization...
744
745 @cindex :local:, setting up
746 @sc{cvs} can access a repository by a variety of
747 means.  It might be on the local computer, or it might
748 be on a computer across the room or across the world.
749 To distinguish various ways to access a repository, the
750 repository name can start with an @dfn{access method}.
751 For example, the access method @code{:local:} means to
752 access a repository directory, so the repository
753 @code{:local:/usr/local/cvsroot} means that the
754 repository is in @file{/usr/local/cvsroot} on the
755 computer running @sc{cvs}.  For information on other
756 access methods, see @ref{Remote repositories}.
757
758 @c Can se say this more concisely?  Like by passing
759 @c more of the buck to the Remote repositories node?
760 If the access method is omitted, then if the repository
761 starts with @samp{/}, then @code{:local:} is
762 assumed.  If it does not start with @samp{/} then either
763 @code{:ext:} or @code{:server:} is assumed.  For
764 example, if you have a local repository in
765 @file{/usr/local/cvsroot}, you can use
766 @code{/usr/local/cvsroot} instead of
767 @code{:local:/usr/local/cvsroot}.  But if (under
768 Windows NT, for example) your local repository is
769 @file{c:\src\cvsroot}, then you must specify the access
770 method, as in @code{:local:c:/src/cvsroot}.
771
772 @c This might appear to go in Repository storage, but
773 @c actually it is describing something which is quite
774 @c user-visible, when you do a "cvs co CVSROOT".  This
775 @c isn't necessary the perfect place for that, though.
776 The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
777 administrative files for @sc{cvs}.  The other directories contain the actual
778 user-defined modules.
779
780 @menu
781 * Specifying a repository::     Telling CVS where your repository is
782 * Repository storage::          The structure of the repository
783 * Working directory storage::   The structure of working directories
784 * Intro administrative files::  Defining modules
785 * Multiple repositories::       Multiple repositories
786 * Creating a repository::       Creating a repository
787 * Backing up::                  Backing up a repository
788 * Moving a repository::         Moving a repository
789 * Remote repositories::         Accessing repositories on remote machines
790 * Read-only access::            Granting read-only access to the repository
791 * Server temporary directory::  The server creates temporary directories
792 @end menu
793
794 @node Specifying a repository
795 @section Telling CVS where your repository is
796
797 There are several ways to tell @sc{cvs}
798 where to find the repository.  You can name the
799 repository on the command line explicitly, with the
800 @code{-d} (for "directory") option:
801
802 @example
803 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
804 @end example
805
806 @cindex .profile, setting CVSROOT in
807 @cindex .cshrc, setting CVSROOT in
808 @cindex .tcshrc, setting CVSROOT in
809 @cindex .bashrc, setting CVSROOT in
810 @cindex CVSROOT, environment variable
811         Or you can set the @code{$CVSROOT} environment
812 variable to an absolute path to the root of the
813 repository, @file{/usr/local/cvsroot} in this example.
814 To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
815 users should have this line in their @file{.cshrc} or
816 @file{.tcshrc} files:
817
818 @example
819 setenv CVSROOT /usr/local/cvsroot
820 @end example
821
822 @noindent
823 @code{sh} and @code{bash} users should instead have these lines in their
824 @file{.profile} or @file{.bashrc}:
825
826 @example
827 CVSROOT=/usr/local/cvsroot
828 export CVSROOT
829 @end example
830
831 @cindex Root file, in CVS directory
832 @cindex CVS/Root file
833         A repository specified with @code{-d} will
834 override the @code{$CVSROOT} environment variable.
835 Once you've checked a working copy out from the
836 repository, it will remember where its repository is
837 (the information is recorded in the
838 @file{CVS/Root} file in the working copy).
839
840 The @code{-d} option and the @file{CVS/Root} file both
841 override the @code{$CVSROOT} environment variable.  If
842 @code{-d} option differs from @file{CVS/Root}, the
843 former is used.  Of course, for proper operation they
844 should be two ways of referring to the same repository.
845
846 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
847 @node Repository storage
848 @section How data is stored in the repository
849 @cindex Repository, how data is stored
850
851 For most purposes it isn't important @emph{how}
852 @sc{cvs} stores information in the repository.  In
853 fact, the format has changed in the past, and is likely
854 to change in the future.  Since in almost all cases one
855 accesses the repository via @sc{cvs} commands, such
856 changes need not be disruptive.
857
858 However, in some cases it may be necessary to
859 understand how @sc{cvs} stores data in the repository,
860 for example you might need to track down @sc{cvs} locks
861 (@pxref{Concurrency}) or you might need to deal with
862 the file permissions appropriate for the repository.
863
864 @menu
865 * Repository files::            What files are stored in the repository
866 * File permissions::            File permissions
867 * Windows permissions::         Issues specific to Windows
868 * Attic::                       Some files are stored in the Attic
869 * CVS in repository::           Additional information in CVS directory
870 * Locks::                       CVS locks control concurrent accesses
871 * CVSROOT storage::             A few things about CVSROOT are different
872 @end menu
873
874 @node Repository files
875 @subsection Where files are stored within the repository
876
877 @c @cindex Filenames, legal
878 @c @cindex Legal filenames
879 @c Somewhere we need to say something about legitimate
880 @c characters in filenames in working directory and
881 @c repository.  Not "/" (not even on non-unix).  And
882 @c here is a specific set of issues:
883 @c      Files starting with a - are handled inconsistently. They can not
884 @c   be added to a repository with an add command, because it they are
885 @c   interpreted as a switch. They can appear in a repository if they are
886 @c   part of a tree that is imported. They can not be removed from the tree
887 @c   once they are there.
888 @c Note that "--" *is* supported (as a
889 @c consequence of using GNU getopt).  Should document
890 @c this somewhere ("Common options"?).  The other usual technique,
891 @c "./-foo", isn't as effective, at least for "cvs add"
892 @c which doesn't support pathnames containing "/".
893
894 The overall structure of the repository is a directory
895 tree corresponding to the directories in the working
896 directory.  For example, supposing the repository is in
897
898 @example
899 /usr/local/cvsroot
900 @end example
901
902 @noindent
903 here is a possible directory tree (showing only the
904 directories):
905
906 @example
907 @t{/usr}
908  |
909  +--@t{local}
910  |   |
911  |   +--@t{cvsroot}
912  |   |    |
913  |   |    +--@t{CVSROOT}
914           |      (administrative files)
915           |
916           +--@t{gnu}
917           |   |
918           |   +--@t{diff}
919           |   |   (source code to @sc{gnu} diff)
920           |   |
921           |   +--@t{rcs}
922           |   |   (source code to @sc{rcs})
923           |   |
924           |   +--@t{cvs}
925           |       (source code to @sc{cvs})
926           |
927           +--@t{yoyodyne}
928               |
929               +--@t{tc}
930               |    |
931               |    +--@t{man}
932               |    |
933               |    +--@t{testing}
934               |
935               +--(other Yoyodyne software)
936 @end example
937
938 With the directories are @dfn{history files} for each file
939 under version control.  The name of the history file is
940 the name of the corresponding file with @samp{,v}
941 appended to the end.  Here is what the repository for
942 the @file{yoyodyne/tc} directory might look like:
943 @c FIXME: Should also mention CVS (CVSREP)
944 @c FIXME? Should we introduce Attic with an xref to
945 @c Attic?  Not sure whether that is a good idea or not.
946 @example
947   @code{$CVSROOT}
948     |
949     +--@t{yoyodyne}
950     |   |
951     |   +--@t{tc}
952     |   |   |
953             +--@t{Makefile,v}
954             +--@t{backend.c,v}
955             +--@t{driver.c,v}
956             +--@t{frontend.c,v}
957             +--@t{parser.c,v}
958             +--@t{man}
959             |    |
960             |    +--@t{tc.1,v}
961             |
962             +--@t{testing}
963                  |
964                  +--@t{testpgm.t,v}
965                  +--@t{test2.t,v}
966 @end example
967
968 @cindex History files
969 @cindex RCS history files
970 @c The first sentence, about what history files
971 @c contain, is kind of redundant with our intro to what the
972 @c repository does in node Repository....
973 The history files contain, among other things, enough
974 information to recreate any revision of the file, a log
975 of all commit messages and the user-name of the person
976 who committed the revision.  The history files are
977 known as @dfn{RCS files}, because the first program to
978 store files in that format was a version control system
979 known as @sc{rcs}.  For a full
980 description of the file format, see the @code{man} page
981 @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
982 file @file{doc/RCSFILES} in the @sc{cvs} source
983 distribution.  This
984 file format has become very common---many systems other
985 than @sc{cvs} or @sc{rcs} can at least import history
986 files in this format.
987 @c FIXME: Think about including documentation for this
988 @c rather than citing it?  In the long run, getting
989 @c this to be a standard (not sure if we can cope with
990 @c a standards process as formal as IEEE/ANSI/ISO/etc,
991 @c though...) is the way to go, so maybe citing is
992 @c better.
993
994 The @sc{rcs} files used in @sc{cvs} differ in a few
995 ways from the standard format.  The biggest difference
996 is magic branches; for more information see @ref{Magic
997 branch numbers}.  Also in @sc{cvs} the valid tag names
998 are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
999 rules see @ref{Tags}.
1000
1001 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1002 @node File permissions
1003 @subsection File permissions
1004 @c -- Move this to @node Creating a repository or similar
1005 @cindex Security, file permissions in repository
1006 @cindex File permissions, general
1007 @cindex Permissions, general
1008 @c FIXME: we need to somehow reflect "permissions in
1009 @c repository" versus "permissions in working
1010 @c directory" in the index entries.
1011 @cindex Group, UNIX file permissions, in repository
1012 @cindex Read-only files, in repository
1013 All @samp{,v} files are created read-only, and you
1014 should not change the permission of those files.  The
1015 directories inside the repository should be writable by
1016 the persons that have permission to modify the files in
1017 each directory.  This normally means that you must
1018 create a UNIX group (see group(5)) consisting of the
1019 persons that are to edit the files in a project, and
1020 set up the repository so that it is that group that
1021 owns the directory.
1022 (On some systems, you also need to set the set-group-ID-on-execution bit
1023 on the repository directories (see chmod(1)) so that newly-created files
1024 and directories get the group-ID of the parent directory rather than
1025 that of the current process.)
1026
1027 @c See also comment in commitinfo node regarding cases
1028 @c which are really awkward with unix groups.
1029
1030 This means that you can only control access to files on
1031 a per-directory basis.
1032
1033 Note that users must also have write access to check
1034 out files, because @sc{cvs} needs to create lock files
1035 (@pxref{Concurrency}).  You can use LockDir in CVSROOT/config
1036 to put the lock files somewhere other than in the repository
1037 if you want to allow read-only access to some directories
1038 (@pxref{config}).
1039
1040 @c CVS seems to use CVSUMASK in picking permissions for
1041 @c val-tags, but maybe we should say more about this.
1042 @c Like val-tags gets created by someone who doesn't
1043 @c have CVSUMASK set right?
1044 @cindex CVSROOT/val-tags file, and read-only access to projects
1045 @cindex val-tags file, and read-only access to projects
1046 Also note that users must have write access to the
1047 @file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1048 track of what tags are valid tag names (it is sometimes
1049 updated when tags are used, as well as when they are
1050 created).
1051
1052 Each @sc{rcs} file will be owned by the user who last
1053 checked it in.  This has little significance; what
1054 really matters is who owns the directories.
1055
1056 @cindex CVSUMASK, environment variable
1057 @cindex Umask, for repository files
1058 @sc{cvs} tries to set up reasonable file permissions
1059 for new directories that are added inside the tree, but
1060 you must fix the permissions manually when a new
1061 directory should have different permissions than its
1062 parent directory.  If you set the @code{CVSUMASK}
1063 environment variable that will control the file
1064 permissions which @sc{cvs} uses in creating directories
1065 and/or files in the repository.  @code{CVSUMASK} does
1066 not affect the file permissions in the working
1067 directory; such files have the permissions which are
1068 typical for newly created files, except that sometimes
1069 @sc{cvs} creates them read-only (see the sections on
1070 watches, @ref{Setting a watch}; -r, @ref{Global
1071 options}; or @code{CVSREAD}, @ref{Environment variables}).
1072 @c FIXME: Need more discussion of which
1073 @c group should own the file in the repository.
1074 @c Include a somewhat detailed example of the usual
1075 @c case where CVSUMASK is 007, the developers are all
1076 @c in a group, and that group owns stuff in the
1077 @c repository.  Need to talk about group ownership of
1078 @c newly-created directories/files (on some unices,
1079 @c such as SunOS4, setting the setgid bit on the
1080 @c directories will make files inherit the directory's
1081 @c group.  On other unices, your mileage may vary.  I
1082 @c can't remember what POSIX says about this, if
1083 @c anything).
1084
1085 Note that using the client/server @sc{cvs}
1086 (@pxref{Remote repositories}), there is no good way to
1087 set @code{CVSUMASK}; the setting on the client machine
1088 has no effect.  If you are connecting with @code{rsh}, you
1089 can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1090 described in the documentation for your operating
1091 system.  This behavior might change in future versions
1092 of @sc{cvs}; do not rely on the setting of
1093 @code{CVSUMASK} on the client having no effect.
1094 @c FIXME: need to explain what a umask is or cite
1095 @c someplace which does.
1096 @c
1097 @c There is also a larger (largely separate) issue
1098 @c about the meaning of CVSUMASK in a non-unix context.
1099 @c For example, whether there is
1100 @c an equivalent which fits better into other
1101 @c protection schemes like POSIX.6, VMS, &c.
1102 @c
1103 @c FIXME: Need one place which discusses this
1104 @c read-only files thing.  Why would one use -r or
1105 @c CVSREAD?  Why would one use watches?  How do they
1106 @c interact?
1107 @c
1108 @c FIXME: We need to state
1109 @c whether using CVSUMASK removes the need for manually
1110 @c fixing permissions (in fact, if we are going to mention
1111 @c manually fixing permission, we better document a lot
1112 @c better just what we mean by "fix").
1113
1114 Using pserver, you will generally need stricter
1115 permissions on the @sc{cvsroot} directory and
1116 directories above it in the tree; see @ref{Password
1117 authentication security}.
1118
1119 @cindex Setuid
1120 @cindex Setgid
1121 @cindex Security, setuid
1122 @cindex Installed images (VMS)
1123 Some operating systems have features which allow a
1124 particular program to run with the ability to perform
1125 operations which the caller of the program could not.
1126 For example, the set user ID (setuid) or set group ID
1127 (setgid) features of unix or the installed image
1128 feature of VMS.  @sc{cvs} was not written to use such
1129 features and therefore attempting to install @sc{cvs} in
1130 this fashion will provide protection against only
1131 accidental lapses; anyone who is trying to circumvent
1132 the measure will be able to do so, and depending on how
1133 you have set it up may gain access to more than just
1134 @sc{cvs}.  You may wish to instead consider pserver.  It
1135 shares some of the same attributes, in terms of
1136 possibly providing a false sense of security or opening
1137 security holes wider than the ones you are trying to
1138 fix, so read the documentation on pserver security
1139 carefully if you are considering this option
1140 (@ref{Password authentication security}).
1141
1142 @node Windows permissions
1143 @subsection File Permission issues specific to Windows
1144 @cindex Windows, and permissions
1145 @cindex File permissions, Windows-specific
1146 @cindex Permissions, Windows-specific
1147
1148 Some file permission issues are specific to Windows
1149 operating systems (Windows 95, Windows NT, and
1150 presumably future operating systems in this family.
1151 Some of the following might apply to OS/2 but I'm not
1152 sure).
1153
1154 If you are using local @sc{cvs} and the repository is on a
1155 networked file system which is served by the Samba SMB
1156 server, some people have reported problems with
1157 permissions.  Enabling WRITE=YES in the samba
1158 configuration is said to fix/workaround it.
1159 Disclaimer: I haven't investigated enough to know the
1160 implications of enabling that option, nor do I know
1161 whether there is something which @sc{cvs} could be doing
1162 differently in order to avoid the problem.  If you find
1163 something out, please let us know as described in
1164 @ref{BUGS}.
1165
1166 @node Attic
1167 @subsection The attic
1168 @cindex Attic
1169
1170 You will notice that sometimes @sc{cvs} stores an
1171 @sc{rcs} file in the @code{Attic}.  For example, if the
1172 @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1173 talking about the file @file{backend.c} in the
1174 directory @file{yoyodyne/tc}, then the file normally
1175 would be in
1176
1177 @example
1178 /usr/local/cvsroot/yoyodyne/tc/backend.c,v
1179 @end example
1180
1181 @noindent
1182 but if it goes in the attic, it would be in
1183
1184 @example
1185 /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1186 @end example
1187
1188 @noindent
1189 @cindex Dead state
1190 instead.  It should not matter from a user point of
1191 view whether a file is in the attic; @sc{cvs} keeps
1192 track of this and looks in the attic when it needs to.
1193 But in case you want to know, the rule is that the RCS
1194 file is stored in the attic if and only if the head
1195 revision on the trunk has state @code{dead}.  A
1196 @code{dead} state means that file has been removed, or
1197 never added, for that revision.  For example, if you
1198 add a file on a branch, it will have a trunk revision
1199 in @code{dead} state, and a branch revision in a
1200 non-@code{dead} state.
1201 @c Probably should have some more concrete examples
1202 @c here, or somewhere (not sure exactly how we should
1203 @c arrange the discussion of the dead state, versus
1204 @c discussion of the attic).
1205
1206 @node CVS in repository
1207 @subsection The CVS directory in the repository
1208 @cindex CVS directory, in repository
1209
1210 The @file{CVS} directory in each repository directory
1211 contains information such as file attributes (in a file
1212 called @file{CVS/fileattr}.  In the
1213 future additional files may be added to this directory,
1214 so implementations should silently ignore additional
1215 files.
1216
1217 This behavior is implemented only by @sc{cvs} 1.7 and
1218 later; for details see @ref{Watches Compatibility}.
1219
1220 The format of the @file{fileattr} file is a series of entries
1221 of the following form (where @samp{@{} and @samp{@}}
1222 means the text between the braces can be repeated zero
1223 or more times):
1224
1225 @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1226   @{; @var{attrname} = @var{attrval}@} <linefeed>
1227
1228 @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1229 attributes for that file.
1230
1231 @var{ent-type} is @samp{D},
1232 and @var{filename} empty, to specify default attributes
1233 to be used for newly added files.
1234
1235 Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1236 will delete them any time it writes file attributes.
1237 @sc{cvs} 1.10 and later will preserve them.
1238
1239 Note that the order of the lines is not significant;
1240 a program writing the fileattr file may
1241 rearrange them at its convenience.
1242
1243 There is currently no way of quoting tabs or line feeds in the
1244 filename, @samp{=} in @var{attrname},
1245 @samp{;} in @var{attrval}, etc.  Note: some implementations also
1246 don't handle a NUL character in any of the fields, but
1247 implementations are encouraged to allow it.
1248
1249 By convention, @var{attrname} starting with @samp{_} is for an attribute given
1250 special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1251 (or will be, once implementations start supporting user-defined attributes).
1252
1253 Built-in attributes:
1254
1255 @table @code
1256 @item _watched
1257 Present means the file is watched and should be checked out
1258 read-only.
1259
1260 @item _watchers
1261 Users with watches for this file.  Value is
1262 @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1263 where @var{watcher} is a username, and @var{type}
1264 is zero or more of edit,unedit,commit separated by
1265 @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1266
1267 @item _editors
1268 Users editing this file.  Value is
1269 @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1270 where @var{editor} is a username, and @var{val} is
1271 @var{time}+@var{hostname}+@var{pathname}, where
1272 @var{time} is when the @code{cvs edit} command (or
1273 equivalent) happened,
1274 and @var{hostname} and @var{pathname} are for the working directory.
1275 @end table
1276
1277 Example:
1278
1279 @c FIXME: sanity.sh should contain a similar test case
1280 @c so we can compare this example from something from
1281 @c Real Life(TM).  See cvsclient.texi (under Notify) for more
1282 @c discussion of the date format of _editors.
1283 @example
1284 Ffile1 _watched=;_watchers=joe>edit,mary>commit
1285 Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1286 D _watched=
1287 @end example
1288
1289 @noindent
1290 means that the file @file{file1} should be checked out
1291 read-only.  Furthermore, joe is watching for edits and
1292 mary is watching for commits.  The file @file{file2}
1293 should be checked out read-only; sue started editing it
1294 on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1295 the machine @code{workstn1}.  Future files which are
1296 added should be checked out read-only.  To represent
1297 this example here, we have shown a space after
1298 @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1299 there must be a single tab character there and no spaces.
1300
1301 @node Locks
1302 @subsection CVS locks in the repository
1303
1304 @cindex #cvs.rfl, technical details
1305 @cindex #cvs.pfl, technical details
1306 @cindex #cvs.wfl, technical details
1307 @cindex #cvs.lock, technical details
1308 @cindex Locks, cvs, technical details
1309 For an introduction to @sc{cvs} locks focusing on
1310 user-visible behavior, see @ref{Concurrency}.  The
1311 following section is aimed at people who are writing
1312 tools which want to access a @sc{cvs} repository without
1313 interfering with other tools accessing the same
1314 repository.  If you find yourself confused by concepts
1315 described here, like @dfn{read lock}, @dfn{write lock},
1316 and @dfn{deadlock}, you might consult the literature on
1317 operating systems or databases.
1318
1319 @cindex #cvs.tfl
1320 Any file in the repository with a name starting
1321 with @file{#cvs.rfl.} is a read lock.  Any file in
1322 the repository with a name starting with
1323 @file{#cvs.pfl} is a promotable read lock.  Any file in
1324 the repository with a name starting with
1325 @file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1326 (before @sc{cvs} 1.5) also created files with names starting
1327 with @file{#cvs.tfl}, but they are not discussed here.
1328 The directory @file{#cvs.lock} serves as a master
1329 lock.  That is, one must obtain this lock first before
1330 creating any of the other locks.
1331
1332 To obtain a read lock, first create the @file{#cvs.lock}
1333 directory.  This operation must be atomic (which should
1334 be true for creating a directory under most operating
1335 systems).  If it fails because the directory already
1336 existed, wait for a while and try again.  After
1337 obtaining the @file{#cvs.lock} lock, create a file
1338 whose name is @file{#cvs.rfl.} followed by information
1339 of your choice (for example, hostname and process
1340 identification number).  Then remove the
1341 @file{#cvs.lock} directory to release the master lock.
1342 Then proceed with reading the repository.  When you are
1343 done, remove the @file{#cvs.rfl} file to release the
1344 read lock.
1345
1346 Promotable read locks are a concept you may not find in other literature on
1347 concurrency.  They are used to allow a two (or more) pass process to only lock
1348 a file for read on the first (read) pass(es), then upgrade its read locks to
1349 write locks if necessary for a final pass, still assured that the files have
1350 not changed since they were first read.  @sc{cvs} uses promotable read locks,
1351 for example, to prevent commit and tag verification passes from interfering
1352 with other reading processes.  It can then lock only a single directory at a
1353 time for write during the write pass.
1354
1355 To obtain a promotable read lock, first create the @file{#cvs.lock} directory,
1356 as with a non-promotable read lock.  Then check
1357 that there are no files that start with
1358 @file{#cvs.pfl}.  If there are, remove the master @file{#cvs.lock} directory,
1359 wait awhile (CVS waits 30 seconds between lock attempts), and try again.  If
1360 there are no other promotable locks, go ahead and create a file whose name is
1361 @file{#cvs.pfl} followed by information of your choice (for example, CVS uses
1362 its hostname and the process identification number of the CVS server process
1363 creating the lock).  If versions of @sc{cvs} older than version 1.12.4 access
1364 your repository directly (not via a @sc{cvs} server of version 1.12.4 or
1365 later), then you should also create a read lock since older versions of CVS
1366 will ignore the promotable lock when attempting to create their own write lock.
1367 Then remove the master @file{#cvs.lock} directory in order to allow other
1368 processes to obtain read locks.
1369
1370 To obtain a write lock, first create the
1371 @file{#cvs.lock} directory, as with read locks.  Then
1372 check that there are no files whose names start with
1373 @file{#cvs.rfl.} and no files whose names start with @file{#cvs.pfl} that are
1374 not owned by the process attempting to get the write lock.  If either exist,
1375 remove @file{#cvs.lock}, wait for a while, and try again.  If
1376 there are no readers or promotable locks from other processes, then create a
1377 file whose name is @file{#cvs.wfl} followed by information of your choice
1378 (again, CVS uses the hostname and server process identification
1379 number).  Remove your @file{#cvs.pfl} file if present.  Hang on to the
1380 @file{#cvs.lock} lock.  Proceed
1381 with writing the repository.  When you are done, first
1382 remove the @file{#cvs.wfl} file and then the
1383 @file{#cvs.lock} directory. Note that unlike the
1384 @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1385 informational; it has no effect on the locking operation
1386 beyond what is provided by holding on to the
1387 @file{#cvs.lock} lock itself.
1388
1389 Note that each lock (write lock or read lock) only locks
1390 a single directory in the repository, including
1391 @file{Attic} and @file{CVS} but not including
1392 subdirectories which represent other directories under
1393 version control.  To lock an entire tree, you need to
1394 lock each directory (note that if you fail to obtain
1395 any lock you need, you must release the whole tree
1396 before waiting and trying again, to avoid deadlocks).
1397
1398 Note also that @sc{cvs} expects write locks to control
1399 access to individual @file{foo,v} files.  @sc{rcs} has
1400 a scheme where the @file{,foo,} file serves as a lock,
1401 but @sc{cvs} does not implement it and so taking out a
1402 @sc{cvs} write lock is recommended.  See the comments at
1403 rcs_internal_lockfile in the @sc{cvs} source code for
1404 further discussion/rationale.
1405
1406 @node CVSROOT storage
1407 @subsection How files are stored in the CVSROOT directory
1408 @cindex CVSROOT, storage of files
1409
1410 The @file{$CVSROOT/CVSROOT} directory contains the
1411 various administrative files.  In some ways this
1412 directory is just like any other directory in the
1413 repository; it contains @sc{rcs} files whose names end
1414 in @samp{,v}, and many of the @sc{cvs} commands operate
1415 on it the same way.  However, there are a few
1416 differences.
1417
1418 For each administrative file, in addition to the
1419 @sc{rcs} file, there is also a checked out copy of the
1420 file.  For example, there is an @sc{rcs} file
1421 @file{loginfo,v} and a file @file{loginfo} which
1422 contains the latest revision contained in
1423 @file{loginfo,v}.  When you check in an administrative
1424 file, @sc{cvs} should print
1425
1426 @example
1427 cvs commit: Rebuilding administrative file database
1428 @end example
1429
1430 @noindent
1431 and update the checked out copy in
1432 @file{$CVSROOT/CVSROOT}.  If it does not, there is
1433 something wrong (@pxref{BUGS}).  To add your own files
1434 to the files to be updated in this fashion, you can add
1435 them to the @file{checkoutlist} administrative file
1436 (@pxref{checkoutlist}).
1437
1438 @cindex modules.db
1439 @cindex modules.pag
1440 @cindex modules.dir
1441 By default, the @file{modules} file behaves as
1442 described above.  If the modules file is very large,
1443 storing it as a flat text file may make looking up
1444 modules slow (I'm not sure whether this is as much of a
1445 concern now as when @sc{cvs} first evolved this
1446 feature; I haven't seen benchmarks).  Therefore, by
1447 making appropriate edits to the @sc{cvs} source code
1448 one can store the modules file in a database which
1449 implements the @code{ndbm} interface, such as Berkeley
1450 db or GDBM.  If this option is in use, then the modules
1451 database will be stored in the files @file{modules.db},
1452 @file{modules.pag}, and/or @file{modules.dir}.
1453 @c I think fileattr also will use the database stuff.
1454 @c Anything else?
1455
1456 For information on the meaning of the various
1457 administrative files, see @ref{Administrative files}.
1458
1459 @node Working directory storage
1460 @section How data is stored in the working directory
1461
1462 @c FIXME: Somewhere we should discuss timestamps (test
1463 @c case "stamps" in sanity.sh).  But not here.  Maybe
1464 @c in some kind of "working directory" chapter which
1465 @c would encompass the "Builds" one?  But I'm not sure
1466 @c whether that is a good organization (is it based on
1467 @c what the user wants to do?).
1468
1469 @cindex CVS directory, in working directory
1470 While we are discussing @sc{cvs} internals which may
1471 become visible from time to time, we might as well talk
1472 about what @sc{cvs} puts in the @file{CVS} directories
1473 in the working directories.  As with the repository,
1474 @sc{cvs} handles this information and one can usually
1475 access it via @sc{cvs} commands.  But in some cases it
1476 may be useful to look at it, and other programs, such
1477 as the @code{jCVS} graphical user interface or the
1478 @code{VC} package for emacs, may need to look at it.
1479 Such programs should follow the recommendations in this
1480 section if they hope to be able to work with other
1481 programs which use those files, including future
1482 versions of the programs just mentioned and the
1483 command-line @sc{cvs} client.
1484
1485 The @file{CVS} directory contains several files.
1486 Programs which are reading this directory should
1487 silently ignore files which are in the directory but
1488 which are not documented here, to allow for future
1489 expansion.
1490
1491 The files are stored according to the text file
1492 convention for the system in question.  This means that
1493 working directories are not portable between systems
1494 with differing conventions for storing text files.
1495 This is intentional, on the theory that the files being
1496 managed by @sc{cvs} probably will not be portable between
1497 such systems either.
1498
1499 @table @file
1500 @item Root
1501 This file contains the current @sc{cvs} root, as
1502 described in @ref{Specifying a repository}.
1503
1504 @cindex Repository file, in CVS directory
1505 @cindex CVS/Repository file
1506 @item Repository
1507 This file contains the directory within the repository
1508 which the current directory corresponds with.  It can
1509 be either an absolute pathname or a relative pathname;
1510 @sc{cvs} has had the ability to read either format
1511 since at least version 1.3 or so.  The relative
1512 pathname is relative to the root, and is the more
1513 sensible approach, but the absolute pathname is quite
1514 common and implementations should accept either.  For
1515 example, after the command
1516
1517 @example
1518 cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1519 @end example
1520
1521 @noindent
1522 @file{Root} will contain
1523
1524 @example
1525 :local:/usr/local/cvsroot
1526 @end example
1527
1528 @noindent
1529 and @file{Repository} will contain either
1530
1531 @example
1532 /usr/local/cvsroot/yoyodyne/tc
1533 @end example
1534
1535 @noindent
1536 or
1537
1538 @example
1539 yoyodyne/tc
1540 @end example
1541
1542 If the particular working directory does not correspond
1543 to a directory in the repository, then @file{Repository}
1544 should contain @file{CVSROOT/Emptydir}.
1545 @cindex Emptydir, in CVSROOT directory
1546 @cindex CVSROOT/Emptydir directory
1547
1548 @cindex Entries file, in CVS directory
1549 @cindex CVS/Entries file
1550 @item Entries
1551 This file lists the files and directories in the
1552 working directory.
1553 The first character of each line indicates what sort of
1554 line it is.  If the character is unrecognized, programs
1555 reading the file should silently skip that line, to
1556 allow for future expansion.
1557
1558 If the first character is @samp{/}, then the format is:
1559
1560 @example
1561 /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1562 @end example
1563
1564 @noindent
1565 where @samp{[} and @samp{]} are not part of the entry,
1566 but instead indicate that the @samp{+} and conflict
1567 marker are optional.  @var{name} is the name of the
1568 file within the directory.  @var{revision} is the
1569 revision that the file in the working derives from, or
1570 @samp{0} for an added file, or @samp{-} followed by a
1571 revision for a removed file.  @var{timestamp} is the
1572 timestamp of the file at the time that @sc{cvs} created
1573 it; if the timestamp differs with the actual
1574 modification time of the file it means the file has
1575 been modified.  It is stored in
1576 the format used by the ISO C asctime() function (for
1577 example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1578 write a string which is not in that format, for
1579 example, @samp{Result of merge}, to indicate that the
1580 file should always be considered to be modified.  This
1581 is not a special case; to see whether a file is
1582 modified a program should take the timestamp of the file
1583 and simply do a string compare with @var{timestamp}.
1584 If there was a conflict, @var{conflict} can be set to
1585 the modification time of the file after the file has been
1586 written with conflict markers (@pxref{Conflicts example}).
1587 Thus if @var{conflict} is subsequently the same as the actual
1588 modification time of the file it means that the user
1589 has obviously not resolved the conflict.  @var{options}
1590 contains sticky options (for example @samp{-kb} for a
1591 binary file).  @var{tagdate} contains @samp{T} followed
1592 by a tag name, or @samp{D} for a date, followed by a
1593 sticky tag or date.  Note that if @var{timestamp}
1594 contains a pair of timestamps separated by a space,
1595 rather than a single timestamp, you are dealing with a
1596 version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1597 documented here).
1598
1599 The timezone on the timestamp in CVS/Entries (local or
1600 universal) should be the same as the operating system
1601 stores for the timestamp of the file itself.  For
1602 example, on Unix the file's timestamp is in universal
1603 time (UT), so the timestamp in CVS/Entries should be
1604 too.  On @sc{vms}, the file's timestamp is in local
1605 time, so @sc{cvs} on @sc{vms} should use local time.
1606 This rule is so that files do not appear to be modified
1607 merely because the timezone changed (for example, to or
1608 from summer time).
1609 @c See comments and calls to gmtime() and friends in
1610 @c src/vers_ts.c (function time_stamp).
1611
1612 If the first character of a line in @file{Entries} is
1613 @samp{D}, then it indicates a subdirectory.  @samp{D}
1614 on a line all by itself indicates that the program
1615 which wrote the @file{Entries} file does record
1616 subdirectories (therefore, if there is such a line and
1617 no other lines beginning with @samp{D}, one knows there
1618 are no subdirectories).  Otherwise, the line looks
1619 like:
1620
1621 @example
1622 D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1623 @end example
1624
1625 @noindent
1626 where @var{name} is the name of the subdirectory, and
1627 all the @var{filler} fields should be silently ignored,
1628 for future expansion.  Programs which modify
1629 @code{Entries} files should preserve these fields.
1630
1631 The lines in the @file{Entries} file can be in any order.
1632
1633 @cindex Entries.Log file, in CVS directory
1634 @cindex CVS/Entries.Log file
1635 @item Entries.Log
1636 This file does not record any information beyond that
1637 in @file{Entries}, but it does provide a way to update
1638 the information without having to rewrite the entire
1639 @file{Entries} file, including the ability to preserve
1640 the information even if the program writing
1641 @file{Entries} and @file{Entries.Log} abruptly aborts.
1642 Programs which are reading the @file{Entries} file
1643 should also check for @file{Entries.Log}.  If the latter
1644 exists, they should read @file{Entries} and then apply
1645 the changes mentioned in @file{Entries.Log}.  After
1646 applying the changes, the recommended practice is to
1647 rewrite @file{Entries} and then delete @file{Entries.Log}.
1648 The format of a line in @file{Entries.Log} is a single
1649 character command followed by a space followed by a
1650 line in the format specified for a line in
1651 @file{Entries}.  The single character command is
1652 @samp{A} to indicate that the entry is being added,
1653 @samp{R} to indicate that the entry is being removed,
1654 or any other character to indicate that the entire line
1655 in @file{Entries.Log} should be silently ignored (for
1656 future expansion).  If the second character of the line
1657 in @file{Entries.Log} is not a space, then it was
1658 written by an older version of @sc{cvs} (not documented
1659 here).
1660
1661 Programs which are writing rather than reading can
1662 safely ignore @file{Entries.Log} if they so choose.
1663
1664 @cindex Entries.Backup file, in CVS directory
1665 @cindex CVS/Entries.Backup file
1666 @item Entries.Backup
1667 This is a temporary file.  Recommended usage is to
1668 write a new entries file to @file{Entries.Backup}, and
1669 then to rename it (atomically, where possible) to @file{Entries}.
1670
1671 @cindex Entries.Static file, in CVS directory
1672 @cindex CVS/Entries.Static file
1673 @item Entries.Static
1674 The only relevant thing about this file is whether it
1675 exists or not.  If it exists, then it means that only
1676 part of a directory was gotten and @sc{cvs} will
1677 not create additional files in that directory.  To
1678 clear it, use the @code{update} command with the
1679 @samp{-d} option, which will get the additional files
1680 and remove @file{Entries.Static}.
1681 @c FIXME: This needs to be better documented, in places
1682 @c other than Working Directory Storage.
1683 @c FIXCVS: The fact that this setting exists needs to
1684 @c be more visible to the user.  For example "cvs
1685 @c status foo", in the case where the file would be
1686 @c gotten except for Entries.Static, might say
1687 @c something to distinguish this from other cases.
1688 @c One thing that periodically gets suggested is to
1689 @c have "cvs update" print something when it skips
1690 @c files due to Entries.Static, but IMHO that kind of
1691 @c noise pretty much makes the Entries.Static feature
1692 @c useless.
1693
1694 @cindex Tag file, in CVS directory
1695 @cindex CVS/Tag file
1696 @cindex Sticky tags/dates, per-directory
1697 @cindex Per-directory sticky tags/dates
1698 @item Tag
1699 This file contains per-directory sticky tags or dates.
1700 The first character is @samp{T} for a branch tag,
1701 @samp{N} for a non-branch tag, or @samp{D} for a date,
1702 or another character to mean the file should be
1703 silently ignored, for future expansion.  This character
1704 is followed by the tag or date.  Note that
1705 per-directory sticky tags or dates are used for things
1706 like applying to files which are newly added; they
1707 might not be the same as the sticky tags or dates on
1708 individual files.  For general information on sticky
1709 tags and dates, see @ref{Sticky tags}.
1710 @c FIXME: This needs to be much better documented,
1711 @c preferably not in the context of "working directory
1712 @c storage".
1713 @c FIXME: The Sticky tags node needs to discuss, or xref to
1714 @c someplace which discusses, per-directory sticky
1715 @c tags and the distinction with per-file sticky tags.
1716
1717 @cindex Notify file, in CVS directory
1718 @cindex CVS/Notify file
1719 @item Notify
1720 This file stores notifications (for example, for
1721 @code{edit} or @code{unedit}) which have not yet been
1722 sent to the server.  Its format is not yet documented
1723 here.
1724
1725 @cindex Notify.tmp file, in CVS directory
1726 @cindex CVS/Notify.tmp file
1727 @item Notify.tmp
1728 This file is to @file{Notify} as @file{Entries.Backup}
1729 is to @file{Entries}.  That is, to write @file{Notify},
1730 first write the new contents to @file{Notify.tmp} and
1731 then (atomically where possible), rename it to
1732 @file{Notify}.
1733
1734 @cindex Base directory, in CVS directory
1735 @cindex CVS/Base directory
1736 @item Base
1737 If watches are in use, then an @code{edit} command
1738 stores the original copy of the file in the @file{Base}
1739 directory.  This allows the @code{unedit} command to
1740 operate even if it is unable to communicate with the
1741 server.
1742
1743 @cindex Baserev file, in CVS directory
1744 @cindex CVS/Baserev file
1745 @item Baserev
1746 The file lists the revision for each of the files in
1747 the @file{Base} directory.  The format is:
1748
1749 @example
1750 B@var{name}/@var{rev}/@var{expansion}
1751 @end example
1752
1753 @noindent
1754 where @var{expansion} should be ignored, to allow for
1755 future expansion.
1756
1757 @cindex Baserev.tmp file, in CVS directory
1758 @cindex CVS/Baserev.tmp file
1759 @item Baserev.tmp
1760 This file is to @file{Baserev} as @file{Entries.Backup}
1761 is to @file{Entries}.  That is, to write @file{Baserev},
1762 first write the new contents to @file{Baserev.tmp} and
1763 then (atomically where possible), rename it to
1764 @file{Baserev}.
1765
1766 @cindex Template file, in CVS directory
1767 @cindex CVS/Template file
1768 @item Template
1769 This file contains the template specified by the
1770 @file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1771 by the client; the non-client/server @sc{cvs} consults
1772 @file{rcsinfo} directly.
1773 @end table
1774
1775 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1776 @node Intro administrative files
1777 @section The administrative files
1778 @cindex Administrative files (intro)
1779 @cindex Modules file
1780 @cindex CVSROOT, module name
1781 @cindex Defining modules (intro)
1782
1783 @c FIXME: this node should be reorganized into "general
1784 @c information about admin files" and put the "editing
1785 @c admin files" stuff up front rather than jumping into
1786 @c the details of modules right away.  Then the
1787 @c Administrative files node can go away, the information
1788 @c on each admin file distributed to a place appropriate
1789 @c to its function, and this node can contain a table
1790 @c listing each file and a @ref to its detailed description.
1791
1792 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1793 files}.  @xref{Administrative files}, for a complete description.
1794 You can use @sc{cvs} without any of these files, but
1795 some commands work better when at least the
1796 @file{modules} file is properly set up.
1797
1798 The most important of these files is the @file{modules}
1799 file.  It defines all modules in the repository.  This
1800 is a sample @file{modules} file.
1801
1802 @c FIXME: The CVSROOT line is a goofy example now that
1803 @c mkmodules doesn't exist.
1804 @example
1805 CVSROOT         CVSROOT
1806 modules         CVSROOT modules
1807 cvs             gnu/cvs
1808 rcs             gnu/rcs
1809 diff            gnu/diff
1810 tc              yoyodyne/tc
1811 @end example
1812
1813 The @file{modules} file is line oriented.  In its
1814 simplest form each line contains the name of the
1815 module, whitespace, and the directory where the module
1816 resides.  The directory is a path relative to
1817 @code{$CVSROOT}.  The last four lines in the example
1818 above are examples of such lines.
1819
1820 @c FIXME: might want to introduce the concept of options in modules file
1821 @c (the old example which was here, -i mkmodules, is obsolete).
1822
1823 The line that defines the module called @samp{modules}
1824 uses features that are not explained here.
1825 @xref{modules}, for a full explanation of all the
1826 available features.
1827
1828 @c FIXME: subsection without node is bogus
1829 @subsection Editing administrative files
1830 @cindex Editing administrative files
1831 @cindex Administrative files, editing them
1832
1833 You edit the administrative files in the same way that you would edit
1834 any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1835 copy, edit it, and commit your changes in the normal way.
1836
1837 It is possible to commit an erroneous administrative
1838 file.  You can often fix the error and check in a new
1839 revision, but sometimes a particularly bad error in the
1840 administrative file makes it impossible to commit new
1841 revisions.
1842 @c @xref{Bad administrative files} for a hint
1843 @c about how to solve such situations.
1844 @c -- administrative file checking--
1845
1846 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1847 @node Multiple repositories
1848 @section Multiple repositories
1849 @cindex Multiple repositories
1850 @cindex Repositories, multiple
1851 @cindex Many repositories
1852 @cindex Parallel repositories
1853 @cindex Disjoint repositories
1854 @cindex CVSROOT, multiple repositories
1855
1856 In some situations it is a good idea to have more than
1857 one repository, for instance if you have two
1858 development groups that work on separate projects
1859 without sharing any code.  All you have to do to have
1860 several repositories is to specify the appropriate
1861 repository, using the @code{CVSROOT} environment
1862 variable, the @samp{-d} option to @sc{cvs}, or (once
1863 you have checked out a working directory) by simply
1864 allowing @sc{cvs} to use the repository that was used
1865 to check out the working directory
1866 (@pxref{Specifying a repository}).
1867
1868 The big advantage of having multiple repositories is
1869 that they can reside on different servers.  With @sc{cvs}
1870 version 1.10, a single command cannot recurse into
1871 directories from different repositories.  With development
1872 versions of @sc{cvs}, you can check out code from multiple
1873 servers into your working directory.  @sc{cvs} will
1874 recurse and handle all the details of making
1875 connections to as many server machines as necessary to
1876 perform the requested command.  Here is an example of
1877 how to set up a working directory:
1878
1879 @example
1880 cvs -d server1:/cvs co dir1
1881 cd dir1
1882 cvs -d server2:/root co sdir
1883 cvs update
1884 @end example
1885
1886 The @code{cvs co} commands set up the working
1887 directory, and then the @code{cvs update} command will
1888 contact server2, to update the dir1/sdir subdirectory,
1889 and server1, to update everything else.
1890
1891 @c FIXME: Does the FAQ have more about this?  I have a
1892 @c dim recollection, but I'm too lazy to check right now.
1893
1894 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1895 @node Creating a repository
1896 @section Creating a repository
1897
1898 @cindex Repository, setting up
1899 @cindex Creating a repository
1900 @cindex Setting up a repository
1901
1902 This section describes how to set up a @sc{cvs} repository for any
1903 sort of access method.  After completing the setup described in this
1904 section, you should be able to access your @sc{cvs} repository immediately
1905 via the local access method and several remote access methods.  For
1906 more information on setting up remote access to the repository you create
1907 in this section, please read the section on @xref{Remote repositories}.
1908
1909 To set up a @sc{cvs} repository, first choose the
1910 machine and disk on which you want to store the
1911 revision history of the source files.  CPU and memory
1912 requirements are modest, so most machines should be
1913 adequate.  For details see @ref{Server requirements}.
1914 @c Possible that we should be providing a quick rule of
1915 @c thumb, like the 32M memory for the server.  That
1916 @c might increase the number of people who are happy
1917 @c with the answer, without following the xref.
1918
1919 To estimate disk space
1920 requirements, if you are importing RCS files from
1921 another system, the size of those files is the
1922 approximate initial size of your repository, or if you
1923 are starting without any version history, a rule of
1924 thumb is to allow for the server approximately three
1925 times the size of the code to be under @sc{cvs} for the
1926 repository (you will eventually outgrow this, but not
1927 for a while).  On the machines on which the developers
1928 will be working, you'll want disk space for
1929 approximately one working directory for each developer
1930 (either the entire tree or a portion of it, depending
1931 on what each developer uses).
1932
1933 The repository should be accessible
1934 (directly or via a networked file system) from all
1935 machines which want to use @sc{cvs} in server or local
1936 mode; the client machines need not have any access to
1937 it other than via the @sc{cvs} protocol.  It is not
1938 possible to use @sc{cvs} to read from a repository
1939 which one only has read access to; @sc{cvs} needs to be
1940 able to create lock files (@pxref{Concurrency}).
1941
1942 @cindex init (subcommand)
1943 To create a repository, run the @code{cvs init}
1944 command.  It will set up an empty repository in the
1945 @sc{cvs} root specified in the usual way
1946 (@pxref{Repository}).  For example,
1947
1948 @example
1949 cvs -d /usr/local/cvsroot init
1950 @end example
1951
1952 @code{cvs init} is careful to never overwrite any
1953 existing files in the repository, so no harm is done if
1954 you run @code{cvs init} on an already set-up
1955 repository.
1956
1957 @code{cvs init} will enable history logging; if you
1958 don't want that, remove the history file after running
1959 @code{cvs init}.  @xref{history file}.
1960
1961 @node Backing up
1962 @section Backing up a repository
1963 @cindex Repository, backing up
1964 @cindex Backing up, repository
1965
1966 There is nothing particularly magical about the files
1967 in the repository; for the most part it is possible to
1968 back them up just like any other files.  However, there
1969 are a few issues to consider.
1970
1971 @cindex Locks, cvs, and backups
1972 @cindex #cvs.rfl, and backups
1973 The first is that to be paranoid, one should either not
1974 use @sc{cvs} during the backup, or have the backup
1975 program lock @sc{cvs} while doing the backup.  To not
1976 use @sc{cvs}, you might forbid logins to machines which
1977 can access the repository, turn off your @sc{cvs}
1978 server, or similar mechanisms.  The details would
1979 depend on your operating system and how you have
1980 @sc{cvs} set up.  To lock @sc{cvs}, you would create
1981 @file{#cvs.rfl} locks in each repository directory.
1982 See @ref{Concurrency}, for more on @sc{cvs} locks.
1983 Having said all this, if you just back up without any
1984 of these precautions, the results are unlikely to be
1985 particularly dire.  Restoring from backup, the
1986 repository might be in an inconsistent state, but this
1987 would not be particularly hard to fix manually.
1988
1989 When you restore a repository from backup, assuming
1990 that changes in the repository were made after the time
1991 of the backup, working directories which were not
1992 affected by the failure may refer to revisions which no
1993 longer exist in the repository.  Trying to run @sc{cvs}
1994 in such directories will typically produce an error
1995 message.  One way to get those changes back into the
1996 repository is as follows:
1997
1998 @itemize @bullet
1999 @item
2000 Get a new working directory.
2001
2002 @item
2003 Copy the files from the working directory from before
2004 the failure over to the new working directory (do not
2005 copy the contents of the @file{CVS} directories, of
2006 course).
2007
2008 @item
2009 Working in the new working directory, use commands such
2010 as @code{cvs update} and @code{cvs diff} to figure out
2011 what has changed, and then when you are ready, commit
2012 the changes into the repository.
2013 @end itemize
2014
2015 @node Moving a repository
2016 @section Moving a repository
2017 @cindex Repository, moving
2018 @cindex Moving a repository
2019 @cindex Copying a repository
2020
2021 Just as backing up the files in the repository is
2022 pretty much like backing up any other files, if you
2023 need to move a repository from one place to another it
2024 is also pretty much like just moving any other
2025 collection of files.
2026
2027 The main thing to consider is that working directories
2028 point to the repository.  The simplest way to deal with
2029 a moved repository is to just get a fresh working
2030 directory after the move.  Of course, you'll want to
2031 make sure that the old working directory had been
2032 checked in before the move, or you figured out some
2033 other way to make sure that you don't lose any
2034 changes.  If you really do want to reuse the existing
2035 working directory, it should be possible with manual
2036 surgery on the @file{CVS/Repository} files.  You can
2037 see @ref{Working directory storage}, for information on
2038 the @file{CVS/Repository} and @file{CVS/Root} files, but
2039 unless you are sure you want to bother, it probably
2040 isn't worth it.
2041 @c FIXME: Surgery on CVS/Repository should be avoided
2042 @c by making RELATIVE_REPOS the default.
2043 @c FIXME-maybe: might want some documented way to
2044 @c change the CVS/Root files in some particular tree.
2045 @c But then again, I don't know, maybe just having
2046 @c people do this in perl/shell/&c isn't so bad...
2047
2048 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2049 @node Remote repositories
2050 @section Remote repositories
2051 @cindex Repositories, remote
2052 @cindex Remote repositories
2053 @cindex Client/Server Operation
2054 @cindex Server, CVS
2055 @cindex Remote repositories, port specification
2056 @cindex Repositories, remote, port specification
2057 @cindex Client/Server Operation, port specification
2058 @cindex pserver (client/server connection method), port specification
2059 @cindex kserver (client/server connection method), port specification
2060 @cindex gserver (client/server connection method), port specification
2061 @cindex port, specifying for remote repositories
2062
2063         Your working copy of the sources can be on a
2064 different machine than the repository.  Using @sc{cvs}
2065 in this manner is known as @dfn{client/server}
2066 operation.  You run @sc{cvs} on a machine which can
2067 mount your working directory, known as the
2068 @dfn{client}, and tell it to communicate to a machine
2069 which can mount the repository, known as the
2070 @dfn{server}.  Generally, using a remote
2071 repository is just like using a local one, except that
2072 the format of the repository name is:
2073
2074 @example
2075 [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2076 @end example
2077
2078 Specifying a password in the repository name is not recommended during
2079 checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2080 password in each created directory.  @code{cvs login} first instead
2081 (@pxref{Password authentication client}).
2082
2083 The details of exactly what needs to be set up depend
2084 on how you are connecting to the server.
2085
2086 @c Should we try to explain which platforms are which?
2087 @c Platforms like unix and VMS, which only allow
2088 @c privileged programs to bind to sockets <1024 lose on
2089 @c :server:
2090 @c Platforms like Mac and VMS, whose rsh program is
2091 @c unusable or nonexistent, lose on :ext:
2092 @c Platforms like OS/2 and NT probably could plausibly
2093 @c default either way (modulo -b troubles).
2094
2095 @menu
2096 * Server requirements::         Memory and other resources for servers
2097 * The connection method::       Connection methods and method options
2098 * Connecting via rsh::          Using the @code{rsh} program to connect
2099 * Password authenticated::      Direct connections using passwords
2100 * GSSAPI authenticated::        Direct connections using GSSAPI
2101 * Kerberos authenticated::      Direct connections with Kerberos
2102 * Connecting via fork::         Using a forked @code{cvs server} to connect
2103 * Write proxies::               Distributing load across several CVS servers
2104 @end menu
2105
2106 @node Server requirements
2107 @subsection Server requirements
2108
2109 The quick answer to what sort of machine is suitable as
2110 a server is that requirements are modest---a server
2111 with 32M of memory or even less can handle a fairly
2112 large source tree with a fair amount of activity.
2113 @c Say something about CPU speed too?  I'm even less sure
2114 @c what to say on that subject...
2115
2116 The real answer, of course, is more complicated.
2117 Estimating the known areas of large memory consumption
2118 should be sufficient to estimate memory requirements.
2119 There are two such areas documented here; other memory
2120 consumption should be small by comparison (if you find
2121 that is not the case, let us know, as described in
2122 @ref{BUGS}, so we can update this documentation).
2123
2124 The first area of big memory consumption is large
2125 checkouts, when using the @sc{cvs} server.  The server
2126 consists of two processes for each client that it is
2127 serving.  Memory consumption on the child process
2128 should remain fairly small.  Memory consumption on the
2129 parent process, particularly if the network connection
2130 to the client is slow, can be expected to grow to
2131 slightly more than the size of the sources in a single
2132 directory, or two megabytes, whichever is larger.
2133 @c "two megabytes" of course is SERVER_HI_WATER.  But
2134 @c we don't mention that here because we are
2135 @c documenting the default configuration of CVS.  If it
2136 @c is a "standard" thing to change that value, it
2137 @c should be some kind of run-time configuration.
2138 @c
2139 @c See cvsclient.texi for more on the design decision
2140 @c to not have locks in place while waiting for the
2141 @c client, which is what results in memory consumption
2142 @c as high as this.
2143
2144 Multiplying the size of each @sc{cvs} server by the
2145 number of servers which you expect to have active at
2146 one time should give an idea of memory requirements for
2147 the server.  For the most part, the memory consumed by
2148 the parent process probably can be swap space rather
2149 than physical memory.
2150 @c Has anyone verified that notion about swap space?
2151 @c I say it based pretty much on guessing that the
2152 @c ->text of the struct buffer_data only gets accessed
2153 @c in a first in, first out fashion, but I haven't
2154 @c looked very closely.
2155
2156 @c What about disk usage in /tmp on the server?  I think that
2157 @c it can be substantial, but I haven't looked at this
2158 @c again and tried to figure it out ("cvs import" is
2159 @c probably the worst case...).
2160
2161 The second area of large memory consumption is
2162 @code{diff}, when checking in large files.  This is
2163 required even for binary files.  The rule of thumb is
2164 to allow about ten times the size of the largest file
2165 you will want to check in, although five times may be
2166 adequate.  For example, if you want to check in a file
2167 which is 10 megabytes, you should have 100 megabytes of
2168 memory on the machine doing the checkin (the server
2169 machine for client/server, or the machine running
2170 @sc{cvs} for non-client/server).  This can be swap
2171 space rather than physical memory.  Because the memory
2172 is only required briefly, there is no particular need
2173 to allow memory for more than one such checkin at a
2174 time.
2175 @c The 5-10 times rule of thumb is from Paul Eggert for
2176 @c GNU diff.  I don't think it is in the GNU diff
2177 @c manual or anyplace like that.
2178 @c
2179 @c Probably we could be saying more about
2180 @c non-client/server CVS.
2181 @c I would guess for non-client/server CVS in an NFS
2182 @c environment the biggest issues are the network and
2183 @c the NFS server.
2184
2185 Resource consumption for the client is even more
2186 modest---any machine with enough capacity to run the
2187 operating system in question should have little
2188 trouble.
2189 @c Is that true?  I think the client still wants to
2190 @c (bogusly) store entire files in memory at times.
2191
2192 For information on disk space requirements, see
2193 @ref{Creating a repository}.
2194
2195 @node The connection method
2196 @subsection The connection method
2197
2198 In its simplest form, the @var{method} portion of the repository string
2199 (@pxref{Remote repositories}) may be one of @samp{ext}, @samp{fork},
2200 @samp{gserver}, @samp{kserver}, @samp{local}, @samp{pserver}, and, on some
2201 platforms, @samp{server}.
2202
2203 If @var{method} is not specified, and the repository
2204 name starts with a @samp{/}, then the default is @code{local}.
2205 If @var{method} is not specified, and the repository
2206 name does not start with a @samp{/}, then the default is @code{ext}
2207 or @code{server}, depending on your platform; both the @samp{ext}
2208 and @samp{server} methods are described in @ref{Connecting via rsh}.
2209
2210 @cindex connection method options
2211 @cindex options, connection method
2212 The @code{ext}, @code{fork}, @code{gserver}, and @code{pserver} connection
2213 methods all accept optional method options, specified as part of the
2214 @var{method} string, like so:
2215
2216 @example
2217 :@var{method}[;@var{option}=@var{arg}...]:@var{other_connection_data}
2218 @end example
2219
2220 @sc{cvs} is not sensitive to the case of @var{method} or @var{option}, though
2221 it may sometimes be sensitive to the case of @var{arg}.  The possible method
2222 options are as follows:
2223
2224 @table @code
2225 @cindex CVS_PROXY_PORT
2226 @cindex proxy, method option
2227 @cindex proxyport, method option
2228 @cindex proxies, web, connecting via
2229 @cindex web proxies, connecting via
2230 @cindex proxies, HTTP, connecting via
2231 @cindex HTTP proxies, connecting via
2232 @item proxy=@var{hostname}
2233 @itemx proxyport=@var{port}
2234 These two method options can be used to connect via an HTTP tunnel style web
2235 proxy.  @var{hostname} should be the name of the HTTP proxy server to connect
2236 through and @var{port} is the port number on the HTTP proxy server to connect
2237 via.  @var{port} defaults to 8080.
2238
2239 @strong{NOTE: An HTTP proxy server is not the same as a @sc{cvs} write proxy
2240 server - please see @ref{Write proxies} for more on @sc{cvs} write proxies.}
2241
2242 For example, to connect pserver via a web proxy listening on port 8000 of
2243 www.myproxy.net, you would use a method of:
2244
2245 @example
2246 :pserver;proxy=www.myproxy.net;proxyport=8000:@var{pserver_connection_string}
2247 @end example
2248
2249 @strong{NOTE: In the above example, @var{pserver_connection_string} is still
2250 required to connect and authenticate to the CVS server, as noted in the
2251 upcoming sections on password authentication, @code{gserver}, and
2252 @code{kserver}.  The example above only demonstrates a modification to the
2253 @var{method} portion of the repository name.}
2254
2255 These options first appeared in @sc{cvs} version 1.12.7 and are valid as
2256 modifcations to the @code{gserver} and @code{pserver} connection methods.
2257
2258 @cindex CVS_RSH method option
2259 @item CVS_RSH=@var{path}
2260 This method option can be used with the @code{ext} method to specify the path
2261 the @sc{cvs} client will use to find the remote shell used to contact the
2262 @sc{cvs} server and takes precedence over any path specified in the
2263 @code{$CVS_RSH} environment variable (@pxref{Connecting via rsh}).  For
2264 example, to connect to a @sc{cvs} server via the local
2265 @file{/path/to/ssh/command} command, you could choose to specify the following
2266 @var{path} via the @code{CVS_RSH} method option:
2267
2268 @example
2269 :ext;CVS_RSH=/path/to/ssh/command:@var{ext_connection_string}
2270 @end example
2271
2272 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2273 as a modifcation to the @code{ext} connection method.
2274
2275 @cindex CVS_SERVER method option
2276 @item CVS_SERVER=@var{path}
2277 This method option can be used with the @code{ext} and @code{fork} methods to
2278 specify the path @sc{cvs} will use to find the @sc{cvs} executable on the
2279 @sc{cvs} server and takes precedence over any path specified in the
2280 @code{$CVS_SERVER} environment variable (@pxref{Connecting via rsh}).  For
2281 example, to select the remote @file{/path/to/cvs/command} executable as your
2282 @sc{cvs} server application on the @sc{cvs} server machine, you could choose to
2283 specify the following @var{path} via the @code{CVS_SERVER} method option:
2284
2285 @example
2286 :ext;CVS_SERVER=/path/to/cvs/command:@var{ext_connection_string}
2287 @end example
2288
2289 @noindent
2290 or, to select an executable named @samp{cvs-1.12.11}, assuming it is in your
2291 @code{$PATH} on the @sc{cvs} server:
2292
2293 @example
2294 :ext;CVS_SERVER=cvs-1.12.11:@var{ext_connection_string}
2295 @end example
2296
2297 This method option first appeared in @sc{cvs} version 1.12.11 and is valid
2298 as a modifcation to both the @code{ext} and @code{fork} connection methods.
2299
2300 @cindex Redirect, method option
2301 @item Redirect=@var{boolean-state}
2302 The @code{Redirect} method option determines whether the @sc{cvs} client will
2303 allow a @sc{cvs} server to redirect it to a different @sc{cvs} server, usually
2304 for write requests, as in a write proxy setup.
2305
2306 A @var{boolean-state} of any value acceptable for boolean @file{CVSROOT/config}
2307 file options is acceptable here (@pxref{config}).  For example, @samp{on},
2308 @samp{off}, @samp{true}, and @samp{false} are all valid values for
2309 @var{boolean-state}.  @var{boolean-state} for the @code{Redirect} method option
2310 defaults to @samp{on}.
2311
2312 This option will have no effect when talking to any non-secondary @sc{cvs}
2313 server.  For more on write proxies and secondary servers, please see
2314 @ref{Write proxies}.
2315
2316 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2317 as a modifcation to the @code{ext} connection method.
2318 @end table
2319
2320 As a further example, to combine both the @code{CVS_RSH} and @code{CVS_SERVER}
2321 options, a method specification like the following would work:
2322
2323 @example
2324 :ext;CVS_RSH=/path/to/ssh/command;CVS_SERVER=/path/to/cvs/command:
2325 @end example
2326
2327 This means that you would not need to have
2328 the @code{CVS_SERVER} or @code{CVS_RSH} environment
2329 variables set correctly.  See @ref{Connecting via rsh}, for more details on
2330 these environment variables.
2331
2332 @node Connecting via rsh
2333 @subsection Connecting with rsh
2334
2335 @cindex rsh
2336 @sc{cvs} uses the @samp{rsh} protocol to perform these
2337 operations, so the remote user host needs to have a
2338 @file{.rhosts} file which grants access to the local
2339 user. Note that the program that @sc{cvs} uses for this
2340 purpose may be specified using the @file{--with-rsh}
2341 flag to configure.
2342
2343 For example, suppose you are the user @samp{mozart} on
2344 the local machine @samp{toe.example.com}, and the
2345 server machine is @samp{faun.example.org}.  On
2346 faun, put the following line into the file
2347 @file{.rhosts} in @samp{bach}'s home directory:
2348
2349 @example
2350 toe.example.com  mozart
2351 @end example
2352
2353 @noindent
2354 Then test that @samp{rsh} is working with
2355
2356 @example
2357 rsh -l bach faun.example.org 'echo $PATH'
2358 @end example
2359
2360 @cindex CVS_SERVER, environment variable
2361 Next you have to make sure that @code{rsh} will be able
2362 to find the server.  Make sure that the path which
2363 @code{rsh} printed in the above example includes the
2364 directory containing a program named @code{cvs} which
2365 is the server.  You need to set the path in
2366 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2367 or @file{.profile}.  Alternately, you can set the
2368 environment variable @code{CVS_SERVER} on the client
2369 machine to the filename of the server you want to use,
2370 for example @file{/usr/local/bin/cvs-1.6}.
2371 For the @code{ext} and @code{fork} methods, you may
2372 also specify @var{CVS_SERVER} as an otpion in the
2373 @var{CVSROOT} so that you may use different servers for
2374 differnt roots. See @ref{Remote repositories} for more
2375 details.
2376
2377 There is no need to edit @file{inetd.conf} or start a
2378 @sc{cvs} server daemon.
2379
2380 @cindex :server:, setting up
2381 @cindex :ext:, setting up
2382 @cindex Kerberos, using kerberized rsh
2383 @cindex SSH (rsh replacement)
2384 @cindex rsh replacements (Kerberized, SSH, &c)
2385 There are two access methods that you use in @code{CVSROOT}
2386 for rsh.  @code{:server:} specifies an internal rsh
2387 client, which is supported only by some @sc{cvs} ports.
2388 @code{:ext:} specifies an external rsh program.  By
2389 default this is @code{rsh} (unless otherwise specified
2390 by the @file{--with-rsh} flag to configure) but you may set the
2391 @code{CVS_RSH} environment variable to invoke another
2392 program which can access the remote server (for
2393 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2394 something different).  It must be a program which can
2395 transmit data to and from the server without modifying
2396 it; for example the Windows NT @code{rsh} is not
2397 suitable since it by default translates between CRLF
2398 and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2399 to @code{rsh} to get around this, but since this could
2400 potentially cause problems for programs other than the
2401 standard @code{rsh}, it may change in the future.  If
2402 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2403 replacement, the instructions in the rest of this
2404 section concerning @file{.rhosts} and so on are likely
2405 to be inapplicable; consult the documentation for your rsh
2406 replacement.
2407
2408 You may choose to specify the @var{CVS_RSH} option as a method option
2409 in the @var{CVSROOT} string to allow you to use different connection tools
2410 for different roots (@pxref{The connection method}).  For example, allowing
2411 some roots to use @code{CVS_RSH=remsh} and some to use
2412 @code{CVS_RSH=ssh} for the @code{ext} method.  See also
2413 the @ref{Remote repositories} for more details.
2414 @c See also the comment in src/client.c for rationale
2415 @c concerning "rsh" being the default and never
2416 @c "remsh".
2417
2418 Continuing our example, supposing you want to access
2419 the module @file{foo} in the repository
2420 @file{/usr/local/cvsroot/}, on machine
2421 @file{faun.example.org}, you are ready to go:
2422
2423 @example
2424 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2425 @end example
2426
2427 @noindent
2428 (The @file{bach@@} can be omitted if the username is
2429 the same on both the local and remote hosts.)
2430
2431 @c Should we mention "rsh host echo hi" and "rsh host
2432 @c cat" (the latter followed by typing text and ^D)
2433 @c as troubleshooting techniques?  Probably yes
2434 @c (people tend to have trouble setting this up),
2435 @c but this kind of thing can be hard to spell out.
2436
2437 @node Password authenticated
2438 @subsection Direct connection with password authentication
2439
2440 The @sc{cvs} client can also connect to the server
2441 using a password protocol.  This is particularly useful
2442 if using @code{rsh} is not feasible (for example,
2443 the server is behind a firewall), and Kerberos also is
2444 not available.
2445
2446         To use this method, it is necessary to make
2447 some adjustments on both the server and client sides.
2448
2449 @menu
2450 * Password authentication server::     Setting up the server
2451 * Password authentication client::     Using the client
2452 * Password authentication security::   What this method does and does not do
2453 @end menu
2454
2455 @node Password authentication server
2456 @subsubsection Setting up the server for password authentication
2457
2458 First of all, you probably want to tighten the
2459 permissions on the @file{$CVSROOT} and
2460 @file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2461 authentication security}, for more details.
2462
2463 @cindex pserver (subcommand)
2464 @cindex Remote repositories, port specification
2465 @cindex Repositories, remote, port specification
2466 @cindex Client/Server Operation, port specification
2467 @cindex pserver (client/server connection method), port specification
2468 @cindex kserver (client/server connection method), port specification
2469 @cindex gserver (client/server connection method), port specification
2470 @cindex port, specifying for remote repositories
2471 @cindex Password server, setting up
2472 @cindex Authenticating server, setting up
2473 @cindex inetd, configuring for pserver
2474 @cindex xinetd, configuring for pserver
2475 @c FIXME: this isn't quite right regarding port
2476 @c numbers; CVS looks up "cvspserver" in
2477 @c /etc/services (on unix, but what about non-unix?).
2478 On the server side, the file @file{/etc/inetd.conf}
2479 needs to be edited so @code{inetd} knows to run the
2480 command @code{cvs pserver} when it receives a
2481 connection on the right port.  By default, the port
2482 number is 2401; it would be different if your client
2483 were compiled with @code{CVS_AUTH_PORT} defined to
2484 something else, though.  This can also be specified in the CVSROOT variable
2485 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2486 environment variable (@pxref{Environment variables}).
2487
2488         If your @code{inetd} allows raw port numbers in
2489 @file{/etc/inetd.conf}, then the following (all on a
2490 single line in @file{inetd.conf}) should be sufficient:
2491
2492 @example
2493 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
2494 cvs -f --allow-root=/usr/cvsroot pserver
2495 @end example
2496
2497 @noindent
2498 (You could also use the
2499 @samp{-T} option to specify a temporary directory.)
2500
2501 The @samp{--allow-root} option specifies the allowable
2502 @sc{cvsroot} directory.  Clients which attempt to use a
2503 different @sc{cvsroot} directory will not be allowed to
2504 connect.  If there is more than one @sc{cvsroot}
2505 directory which you want to allow, repeat the option.
2506 (Unfortunately, many versions of @code{inetd} have very small
2507 limits on the number of arguments and/or the total length
2508 of the command.  The usual solution to this problem is
2509 to have @code{inetd} run a shell script which then invokes
2510 @sc{cvs} with the necessary arguments.)
2511
2512         If your @code{inetd} wants a symbolic service
2513 name instead of a raw port number, then put this in
2514 @file{/etc/services}:
2515
2516 @example
2517 cvspserver      2401/tcp
2518 @end example
2519
2520 @noindent
2521 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2522
2523 If your system uses @code{xinetd} instead of @code{inetd},
2524 the procedure is slightly different.
2525 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2526
2527 @example
2528 service cvspserver
2529 @{
2530    port        = 2401
2531    socket_type = stream
2532    protocol    = tcp
2533    wait        = no
2534    user        = root
2535    passenv     = PATH
2536    server      = /usr/local/bin/cvs
2537    server_args = -f --allow-root=/usr/cvsroot pserver
2538 @}
2539 @end example
2540
2541 @noindent
2542 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2543 the @code{port} line.)
2544
2545         Once the above is taken care of, restart your
2546 @code{inetd}, or do whatever is necessary to force it
2547 to reread its initialization files.
2548
2549 If you are having trouble setting this up, see
2550 @ref{Connection}.
2551
2552 @cindex CVS passwd file
2553 @cindex passwd (admin file)
2554 Because the client stores and transmits passwords in
2555 cleartext (almost---see @ref{Password authentication
2556 security}, for details), a separate @sc{cvs} password
2557 file is generally used, so people don't compromise
2558 their regular passwords when they access the
2559 repository.  This file is
2560 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2561 administrative files}).  It uses a colon-separated
2562 format, similar to @file{/etc/passwd} on Unix systems,
2563 except that it has fewer fields: @sc{cvs} username,
2564 optional password, and an optional system username for
2565 @sc{cvs} to run as if authentication succeeds.  Here is
2566 an example @file{passwd} file with five entries:
2567
2568 @example
2569 anonymous:
2570 bach:ULtgRLXo7NRxs
2571 spwang:1sOp854gDF3DY
2572 melissa:tGX1fS8sun6rY:pubcvs
2573 qproj:XR4EZcEs0szik:pubcvs
2574 @end example
2575
2576 @noindent
2577 (The passwords are encrypted according to the standard
2578 Unix @code{crypt()} function, so it is possible to
2579 paste in passwords directly from regular Unix
2580 @file{/etc/passwd} files.)
2581
2582 The first line in the example will grant access to any
2583 @sc{cvs} client attempting to authenticate as user
2584 @code{anonymous}, no matter what password they use,
2585 including an empty password.  (This is typical for
2586 sites granting anonymous read-only access; for
2587 information on how to do the "read-only" part, see
2588 @ref{Read-only access}.)
2589
2590 The second and third lines will grant access to
2591 @code{bach} and @code{spwang} if they supply their
2592 respective plaintext passwords.
2593
2594 @cindex User aliases
2595 The fourth line will grant access to @code{melissa}, if
2596 she supplies the correct password, but her @sc{cvs}
2597 operations will actually run on the server side under
2598 the system user @code{pubcvs}.  Thus, there need not be
2599 any system user named @code{melissa}, but there
2600 @emph{must} be one named @code{pubcvs}.
2601
2602 The fifth line shows that system user identities can be
2603 shared: any client who successfully authenticates as
2604 @code{qproj} will actually run as @code{pubcvs}, just
2605 as @code{melissa} does.  That way you could create a
2606 single, shared system user for each project in your
2607 repository, and give each developer their own line in
2608 the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2609 username on each line would be different, but the
2610 system username would be the same.  The reason to have
2611 different @sc{cvs} usernames is that @sc{cvs} will log their
2612 actions under those names: when @code{melissa} commits
2613 a change to a project, the checkin is recorded in the
2614 project's history under the name @code{melissa}, not
2615 @code{pubcvs}.  And the reason to have them share a
2616 system username is so that you can arrange permissions
2617 in the relevant area of the repository such that only
2618 that account has write-permission there.
2619
2620 If the system-user field is present, all
2621 password-authenticated @sc{cvs} commands run as that
2622 user; if no system user is specified, @sc{cvs} simply
2623 takes the @sc{cvs} username as the system username and
2624 runs commands as that user.  In either case, if there
2625 is no such user on the system, then the @sc{cvs}
2626 operation will fail (regardless of whether the client
2627 supplied a valid password).
2628
2629 The password and system-user fields can both be omitted
2630 (and if the system-user field is omitted, then also
2631 omit the colon that would have separated it from the
2632 encrypted password).  For example, this would be a
2633 valid @file{$CVSROOT/CVSROOT/passwd} file:
2634
2635 @example
2636 anonymous::pubcvs
2637 fish:rKa5jzULzmhOo:kfogel
2638 sussman:1sOp854gDF3DY
2639 @end example
2640
2641 @noindent
2642 When the password field is omitted or empty, then the
2643 client's authentication attempt will succeed with any
2644 password, including the empty string.  However, the
2645 colon after the @sc{cvs} username is always necessary,
2646 even if the password is empty.
2647
2648 @sc{cvs} can also fall back to use system authentication.
2649 When authenticating a password, the server first checks
2650 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2651 file.  If it finds the user, it will use that entry for
2652 authentication as described above.  But if it does not
2653 find the user, or if the @sc{cvs} @file{passwd} file
2654 does not exist, then the server can try to authenticate
2655 the username and password using the operating system's
2656 user-lookup routines (this "fallback" behavior can be
2657 disabled by setting @code{SystemAuth=no} in the
2658 @sc{cvs} @file{config} file, @pxref{config}).
2659
2660 The default fallback behavior is to look in 
2661 @file{/etc/passwd} for this system user unless your
2662 system has PAM (Pluggable Authentication Modules)
2663 and your @sc{cvs} server executable was configured to
2664 use it at compile time (using @code{./configure --enable-pam} - see the
2665 INSTALL file for more).  In this case, PAM will be consulted instead.
2666 This means that @sc{cvs} can be configured to use any password
2667 authentication source PAM can be configured to use (possibilities
2668 include a simple UNIX password, NIS, LDAP, and others) in its
2669 global configuration file (usually @file{/etc/pam.conf}
2670 or possibly @file{/etc/pam.d/cvs}).  See your PAM documentation
2671 for more details on PAM configuration.
2672
2673 Note that PAM is an experimental feature in @sc{cvs} and feedback is
2674 encouraged.  Please send a mail to one of the @sc{cvs} mailing lists
2675 (@code{info-cvs@@nongnu.org} or @code{bug-cvs@@nongnu.org}) if you use the 
2676 @sc{cvs} PAM support.
2677
2678 @strong{WARNING: Using PAM gives the system administrator much more 
2679 flexibility about how @sc{cvs} users are authenticated but 
2680 no more security than other methods.  See below for more.} 
2681
2682 CVS needs an "auth", "account" and "session" module in the 
2683 PAM configuration file. A typical PAM configuration 
2684 would therefore have the following lines 
2685 in @file{/etc/pam.conf} to emulate the standard @sc{cvs} 
2686 system @file{/etc/passwd} authentication:
2687
2688 @example
2689 cvs     auth        required    pam_unix.so
2690 cvs     account     required    pam_unix.so
2691 cvs     session     required    pam_unix.so
2692 @end example
2693
2694 The the equivalent @file{/etc/pam.d/cvs} would contain
2695
2696 @example
2697 auth        required    pam_unix.so
2698 account     required    pam_unix.so
2699 session     required    pam_unix.so
2700 @end example
2701
2702 Some systems require a full path to the module so that
2703 @file{pam_unix.so} (Linux) would become something like 
2704 @file{/usr/lib/security/$ISA/pam_unix.so.1} (Sun Solaris).
2705 See the @file{contrib/pam} subdirectory of the @sc{cvs}
2706 source distribution for further example configurations.
2707
2708 The PAM service name given above as "cvs" is just
2709 the service name in the default configuration and can be
2710 set using
2711 @code{./configure --with-hardcoded-pam-service-name=<pam-service-name>}
2712 before compiling.  @sc{cvs} can also be configured to use whatever
2713 name it is invoked as as its PAM service name using
2714 @code{./configure --without-hardcoded-pam-service-name}, but this
2715 feature should not be used if you may not have control of the name
2716 @sc{cvs} will be invoked as.
2717
2718 Be aware, also, that falling back to system
2719 authentication might be a security risk: @sc{cvs}
2720 operations would then be authenticated with that user's
2721 regular login password, and the password flies across
2722 the network in plaintext.  See @ref{Password
2723 authentication security} for more on this.
2724 This may be more of a problem with PAM authentication
2725 because it is likely that the source of the system 
2726 password is some central authentication service like
2727 LDAP which is also used to authenticate other services.
2728
2729 On the other hand, PAM makes it very easy to change your password
2730 regularly.  If they are given the option of a one-password system for
2731 all of their activities, users are often more willing to change their
2732 password on a regular basis.
2733
2734 In the non-PAM configuration where the password is stored in the
2735 @file{CVSROOT/passwd} file, it is difficult to change passwords on a
2736 regular basis since only administrative users (or in some cases
2737 processes that act as an administrative user) are typically given
2738 access to modify this file.  Either there needs to be some
2739 hand-crafted web page or set-uid program to update the file, or the
2740 update needs to be done by submitting a request to an administrator to
2741 perform the duty by hand.  In the first case, having to remember to
2742 update a separate password on a periodic basis can be difficult.  In
2743 the second case, the manual nature of the change will typically mean
2744 that the password will not be changed unless it is absolutely
2745 necessary.
2746
2747 Note that PAM administrators should probably avoid configuring
2748 one-time-passwords (OTP) for @sc{cvs} authentication/authorization.  If
2749 OTPs are desired, the administrator may wish to encourage the use of
2750 one of the other Client/Server access methods.  See the section on
2751 @pxref{Remote repositories} for a list of other methods.
2752
2753 Right now, the only way to put a password in the
2754 @sc{cvs} @file{passwd} file is to paste it there from
2755 somewhere else.  Someday, there may be a @code{cvs
2756 passwd} command.
2757
2758 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2759 is normal to edit the @file{passwd} file in-place,
2760 rather than via @sc{cvs}.  This is because of the
2761 possible security risks of having the @file{passwd}
2762 file checked out to people's working copies.  If you do
2763 want to include the @file{passwd} file in checkouts of
2764 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2765
2766 @c We might also suggest using the @code{htpasswd} command
2767 @c from freely available web servers as well, but that
2768 @c would open up a can of worms in that the users next
2769 @c questions are likely to be "where do I get it?" and
2770 @c "how do I use it?"
2771 @c Also note that htpasswd, at least the version I had,
2772 @c likes to clobber the third field.
2773
2774 @node Password authentication client
2775 @subsubsection Using the client with password authentication
2776 @cindex Login (subcommand)
2777 @cindex Password client, using
2778 @cindex Authenticated client, using
2779 @cindex :pserver:, setting up
2780 To run a @sc{cvs} command on a remote repository via
2781 the password-authenticating server, one specifies the
2782 @code{pserver} protocol, optional username, repository host, an
2783 optional port number, and path to the repository.  For example:
2784
2785 @example
2786 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2787 @end example
2788
2789 @noindent
2790 or
2791
2792 @example
2793 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2794 cvs checkout someproj
2795 @end example
2796
2797 However, unless you're connecting to a public-access
2798 repository (i.e., one where that username doesn't
2799 require a password), you'll need to supply a password or @dfn{log in} first.
2800 Logging in verifies your password with the repository and stores it in a file.
2801 It's done with the @code{login} command, which will
2802 prompt you interactively for the password if you didn't supply one as part of
2803 @var{$CVSROOT}:
2804
2805 @example
2806 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2807 CVS password:
2808 @end example
2809
2810 @noindent
2811 or
2812
2813 @example
2814 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2815 @end example
2816
2817 After you enter the password, @sc{cvs} verifies it with
2818 the server.  If the verification succeeds, then that
2819 combination of username, host, repository, and password
2820 is permanently recorded, so future transactions with
2821 that repository won't require you to run @code{cvs
2822 login}.  (If verification fails, @sc{cvs} will exit
2823 complaining that the password was incorrect, and
2824 nothing will be recorded.)
2825
2826 The records are stored, by default, in the file
2827 @file{$HOME/.cvspass}.  That file's format is
2828 human-readable, and to a degree human-editable, but
2829 note that the passwords are not stored in
2830 cleartext---they are trivially encoded to protect them
2831 from "innocent" compromise (i.e., inadvertent viewing
2832 by a system administrator or other non-malicious
2833 person).
2834
2835 @cindex CVS_PASSFILE, environment variable
2836 You can change the default location of this file by
2837 setting the @code{CVS_PASSFILE} environment variable.
2838 If you use this variable, make sure you set it
2839 @emph{before} @code{cvs login} is run.  If you were to
2840 set it after running @code{cvs login}, then later
2841 @sc{cvs} commands would be unable to look up the
2842 password for transmission to the server.
2843   
2844 Once you have logged in, all @sc{cvs} commands using
2845 that remote repository and username will authenticate
2846 with the stored password.  So, for example
2847   
2848 @example
2849 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2850 @end example
2851
2852 @noindent
2853 should just work (unless the password changes on the
2854 server side, in which case you'll have to re-run
2855 @code{cvs login}).
2856
2857 Note that if the @samp{:pserver:} were not present in
2858 the repository specification, @sc{cvs} would assume it
2859 should use @code{rsh} to connect with the server
2860 instead (@pxref{Connecting via rsh}).
2861
2862 Of course, once you have a working copy checked out and
2863 are running @sc{cvs} commands from within it, there is
2864 no longer any need to specify the repository
2865 explicitly, because @sc{cvs} can deduce the repository
2866 from the working copy's @file{CVS} subdirectory.
2867
2868 @c FIXME: seems to me this needs somewhat more
2869 @c explanation.
2870 @cindex Logout (subcommand)
2871 The password for a given remote repository can be
2872 removed from the @code{CVS_PASSFILE} by using the
2873 @code{cvs logout} command.
2874
2875 @node Password authentication security
2876 @subsubsection Security considerations with password authentication
2877
2878 @cindex Security, of pserver
2879 The passwords are stored on the client side in a
2880 trivial encoding of the cleartext, and transmitted in
2881 the same encoding.  The encoding is done only to
2882 prevent inadvertent password compromises (i.e., a
2883 system administrator accidentally looking at the file),
2884 and will not prevent even a naive attacker from gaining
2885 the password.
2886
2887 @c FIXME: The bit about "access to the repository
2888 @c implies general access to the system is *not* specific
2889 @c to pserver; it applies to kerberos and SSH and
2890 @c everything else too.  Should reorganize the
2891 @c documentation to make this clear.
2892 The separate @sc{cvs} password file (@pxref{Password
2893 authentication server}) allows people
2894 to use a different password for repository access than
2895 for login access.  On the other hand, once a user has
2896 non-read-only
2897 access to the repository, she can execute programs on
2898 the server system through a variety of means.  Thus, repository
2899 access implies fairly broad system access as well.  It
2900 might be possible to modify @sc{cvs} to prevent that,
2901 but no one has done so as of this writing.
2902 @c OpenBSD uses chroot() and copies the repository to
2903 @c provide anonymous read-only access (for details see
2904 @c http://www.openbsd.org/anoncvs.shar).  While this
2905 @c closes the most obvious holes, I'm not sure it
2906 @c closes enough holes to recommend it (plus it is
2907 @c *very* easy to accidentally screw up a setup of this
2908 @c type).
2909
2910 Note that because the @file{$CVSROOT/CVSROOT} directory
2911 contains @file{passwd} and other files which are used
2912 to check security, you must control the permissions on
2913 this directory as tightly as the permissions on
2914 @file{/etc}.  The same applies to the @file{$CVSROOT}
2915 directory itself and any directory
2916 above it in the tree.  Anyone who has write access to
2917 such a directory will have the ability to become any
2918 user on the system.  Note that these permissions are
2919 typically tighter than you would use if you are not
2920 using pserver.
2921 @c TODO: Would be really nice to document/implement a
2922 @c scheme where the CVS server can run as some non-root
2923 @c user, e.g. "cvs".  CVSROOT/passwd would contain a
2924 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2925 @c would be implicit).  This would greatly reduce
2926 @c security risks such as those hinted at in the
2927 @c previous paragraph.  I think minor changes to CVS
2928 @c might be required but mostly this would just need
2929 @c someone who wants to play with it, document it, &c.
2930
2931 In summary, anyone who gets the password gets
2932 repository access (which may imply some measure of general system
2933 access as well).  The password is available to anyone
2934 who can sniff network packets or read a protected
2935 (i.e., user read-only) file.  If you want real
2936 security, get Kerberos.
2937
2938 @node GSSAPI authenticated
2939 @subsection Direct connection with GSSAPI
2940
2941 @cindex GSSAPI
2942 @cindex Security, GSSAPI
2943 @cindex :gserver:, setting up
2944 @cindex Kerberos, using :gserver:
2945 GSSAPI is a generic interface to network security
2946 systems such as Kerberos 5.
2947 If you have a working GSSAPI library, you can have
2948 @sc{cvs} connect via a direct @sc{tcp} connection,
2949 authenticating with GSSAPI.
2950
2951 To do this, @sc{cvs} needs to be compiled with GSSAPI
2952 support; when configuring @sc{cvs} it tries to detect
2953 whether GSSAPI libraries using Kerberos version 5 are
2954 present.  You can also use the @file{--with-gssapi}
2955 flag to configure.
2956
2957 The connection is authenticated using GSSAPI, but the
2958 message stream is @emph{not} authenticated by default.
2959 You must use the @code{-a} global option to request
2960 stream authentication.
2961
2962 The data transmitted is @emph{not} encrypted by
2963 default.  Encryption support must be compiled into both
2964 the client and the server; use the
2965 @file{--enable-encrypt} configure option to turn it on.
2966 You must then use the @code{-x} global option to
2967 request encryption.
2968
2969 GSSAPI connections are handled on the server side by
2970 the same server which handles the password
2971 authentication server; see @ref{Password authentication
2972 server}.  If you are using a GSSAPI mechanism such as
2973 Kerberos which provides for strong authentication, you
2974 will probably want to disable the ability to
2975 authenticate via cleartext passwords.  To do so, create
2976 an empty @file{CVSROOT/passwd} password file, and set
2977 @code{SystemAuth=no} in the config file
2978 (@pxref{config}).
2979
2980 The GSSAPI server uses a principal name of
2981 cvs/@var{hostname}, where @var{hostname} is the
2982 canonical name of the server host.  You will have to
2983 set this up as required by your GSSAPI mechanism.
2984
2985 To connect using GSSAPI, use the @samp{:gserver:} method.  For
2986 example,
2987
2988 @example
2989 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2990 @end example
2991
2992 @node Kerberos authenticated
2993 @subsection Direct connection with Kerberos
2994
2995 @cindex Kerberos, using :kserver:
2996 @cindex Security, Kerberos
2997 @cindex :kserver:, setting up
2998 The easiest way to use Kerberos is to use the Kerberos
2999 @code{rsh}, as described in @ref{Connecting via rsh}.
3000 The main disadvantage of using rsh is that all the data
3001 needs to pass through additional programs, so it may be
3002 slower.  So if you have Kerberos installed you can
3003 connect via a direct @sc{tcp} connection,
3004 authenticating with Kerberos.
3005
3006 This section concerns the Kerberos network security
3007 system, version 4.  Kerberos version 5 is supported via
3008 the GSSAPI generic network security interface, as
3009 described in the previous section.
3010
3011 To do this, @sc{cvs} needs to be compiled with Kerberos
3012 support; when configuring @sc{cvs} it tries to detect
3013 whether Kerberos is present or you can use the
3014 @file{--with-krb4} flag to configure.
3015
3016 The data transmitted is @emph{not} encrypted by
3017 default.  Encryption support must be compiled into both
3018 the client and server; use the
3019 @file{--enable-encryption} configure option to turn it
3020 on.  You must then use the @code{-x} global option to
3021 request encryption.
3022
3023 The CVS client will attempt to connect to port 1999 by default.
3024
3025 @cindex kinit
3026 When you want to use @sc{cvs}, get a ticket in the
3027 usual way (generally @code{kinit}); it must be a ticket
3028 which allows you to log into the server machine.  Then
3029 you are ready to go:
3030
3031 @example
3032 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
3033 @end example
3034
3035 Previous versions of @sc{cvs} would fall back to a
3036 connection via rsh; this version will not do so.
3037
3038 @node Connecting via fork
3039 @subsection Connecting with fork
3040
3041 @cindex fork, access method
3042 @cindex :fork:, setting up
3043 This access method allows you to connect to a
3044 repository on your local disk via the remote protocol.
3045 In other words it does pretty much the same thing as
3046 @code{:local:}, but various quirks, bugs and the like are
3047 those of the remote @sc{cvs} rather than the local
3048 @sc{cvs}.
3049
3050 For day-to-day operations you might prefer either
3051 @code{:local:} or @code{:fork:}, depending on your
3052 preferences.  Of course @code{:fork:} comes in
3053 particularly handy in testing or
3054 debugging @code{cvs} and the remote protocol.
3055 Specifically, we avoid all of the network-related
3056 setup/configuration, timeouts, and authentication
3057 inherent in the other remote access methods but still
3058 create a connection which uses the remote protocol.
3059
3060 To connect using the @code{fork} method, use
3061 @samp{:fork:} and the pathname to your local
3062 repository.  For example:
3063
3064 @example
3065 cvs -d :fork:/usr/local/cvsroot checkout foo
3066 @end example
3067
3068 @cindex CVS_SERVER, and :fork:
3069 As with @code{:ext:}, the server is called @samp{cvs}
3070 by default, or the value of the @code{CVS_SERVER}
3071 environment variable.
3072
3073
3074 @node Write proxies
3075 @subsection Distributing load across several CVS servers
3076
3077 @cindex PrimaryServer, in CVSROOT/config
3078 @cindex Primary server
3079 @cindex Secondary server
3080 @cindex proxy, write
3081 @cindex write proxy
3082 @sc{cvs} can be configured to distribute usage across several @sc{cvs}
3083 servers.  This is accomplished by means of one or more @dfn{write proxies}, or
3084 @dfn{secondary servers}, for a single @dfn{primary server}.
3085
3086 When a @sc{cvs} client accesses a secondary server and only sends read
3087 requests, then the secondary server handles the entire request.  If the client
3088 sends any write requests, however, the secondary server asks the client to
3089 redirect its write request to the primary server, if the client supports
3090 redirect requests, and otherwise becomes a transparent proxy for the primary
3091 server, which actually handles the write request.
3092
3093 In this manner, any number of read-only secondary servers may be configured as
3094 write proxies for the primary server, effectively distributing the load from
3095 all read operations between the secondary servers and restricting the load on
3096 the primary server to write operations and pushing changes to the secondaries.
3097
3098 Primary servers will not automatically push changes to secondaries.  This must
3099 be configured via @file{loginfo}, @file{postadmin}, @file{posttag}, &
3100 @file{postwatch} scripts (@pxref{Trigger Scripts}) like the following:
3101
3102 @example
3103 ALL     rsync -gopr -essh ./ secondary:/cvsroot/%p &
3104 @end example
3105
3106 You would probably actually want to lock directories for write on the secondary
3107 and for read on the primary before running the @samp{rsync} in the above
3108 example, but describing such a setup is beyond the scope of this document.
3109
3110 A secondary advantage of a write proxy setup is that users pointing at the
3111 secondary server can still execute fast read operations while on a network that
3112 connects to the primary over a slow link or even one where the link to the
3113 primary is periodically broken.  Only write operations will require the network
3114 link to the primary.
3115
3116 To configure write proxies, the primary must be specified with the
3117 @samp{PrimaryServer} option in @file{CVSROOT/config} (@pxref{config}).  For the
3118 transparent proxy mode to work, all secondary servers must also be running the
3119 same version of the @sc{cvs} server, or at least one that provides the same
3120 list of supported requests to the client as the primary server.  This is not
3121 necessary for redirection.
3122
3123 Once a primary server is configured, secondary servers may be configured by:
3124
3125 @enumerate
3126 @item
3127 Duplicating the primary repository at the new location.
3128 @item
3129 Setting up the @file{loginfo}, @file{postadmin}, @file{posttag}, and
3130 @file{postwatch} files on the primary to propagate writes to the new secondary.
3131 @item
3132 Configure remote access to the secondary(ies) as you would configure access
3133 to any other CVS server (@pxref{Remote repositories}).
3134 @item
3135 Ensuring that @code{--allow-root=@var{secondary-cvsroot}} is passed to
3136 @strong{all} incovations of the secondary server if the path to the @sc{cvs}
3137 repository directory is different on the two servers and you wish to support
3138 clients that do not handle the @samp{Redirect} resopnse (CVS 1.12.9 and earlier
3139 clients do not handle the @samp{Redirect} response).
3140
3141 Please note, again, that writethrough proxy suport requires
3142 @code{--allow-root=@var{secondary-cvsroot}} to be specified for @strong{all}
3143 incovations of the secondary server, not just @samp{pserver} invocations.
3144 This may require a wrapper script for the @sc{cvs} executable
3145 on your server machine.
3146 @end enumerate
3147
3148
3149 @c ---------------------------------------------------------------------
3150 @node Read-only access
3151 @section Read-only repository access
3152 @cindex Read-only repository access
3153 @cindex readers (admin file)
3154 @cindex writers (admin file)
3155
3156         It is possible to grant read-only repository
3157 access to people using the password-authenticated
3158 server (@pxref{Password authenticated}).  (The
3159 other access methods do not have explicit support for
3160 read-only users because those methods all assume login
3161 access to the repository machine anyway, and therefore
3162 the user can do whatever local file permissions allow
3163 her to do.)
3164
3165         A user who has read-only access can do only
3166 those @sc{cvs} operations which do not modify the
3167 repository, except for certain ``administrative'' files
3168 (such as lock files and the history file).  It may be
3169 desirable to use this feature in conjunction with
3170 user-aliasing (@pxref{Password authentication server}).
3171
3172 Unlike with previous versions of @sc{cvs}, read-only
3173 users should be able merely to read the repository, and
3174 not to execute programs on the server or otherwise gain
3175 unexpected levels of access.  Or to be more accurate,
3176 the @emph{known} holes have been plugged.  Because this
3177 feature is new and has not received a comprehensive
3178 security audit, you should use whatever level of
3179 caution seems warranted given your attitude concerning
3180 security.
3181
3182         There are two ways to specify read-only access
3183 for a user: by inclusion, and by exclusion.
3184
3185         "Inclusion" means listing that user
3186 specifically in the @file{$CVSROOT/CVSROOT/readers}
3187 file, which is simply a newline-separated list of
3188 users.  Here is a sample @file{readers} file:
3189
3190 @example
3191 melissa
3192 splotnik
3193 jrandom
3194 @end example
3195
3196 @noindent
3197         (Don't forget the newline after the last user.)
3198
3199         "Exclusion" means explicitly listing everyone
3200 who has @emph{write} access---if the file
3201
3202 @example
3203 $CVSROOT/CVSROOT/writers
3204 @end example
3205
3206 @noindent
3207 exists, then only
3208 those users listed in it have write access, and
3209 everyone else has read-only access (of course, even the
3210 read-only users still need to be listed in the
3211 @sc{cvs} @file{passwd} file).  The
3212 @file{writers} file has the same format as the
3213 @file{readers} file.
3214
3215         Note: if your @sc{cvs} @file{passwd}
3216 file maps cvs users onto system users (@pxref{Password
3217 authentication server}), make sure you deny or grant
3218 read-only access using the @emph{cvs} usernames, not
3219 the system usernames.  That is, the @file{readers} and
3220 @file{writers} files contain cvs usernames, which may
3221 or may not be the same as system usernames.
3222
3223         Here is a complete description of the server's
3224 behavior in deciding whether to grant read-only or
3225 read-write access:
3226
3227         If @file{readers} exists, and this user is
3228 listed in it, then she gets read-only access.  Or if
3229 @file{writers} exists, and this user is NOT listed in
3230 it, then she also gets read-only access (this is true
3231 even if @file{readers} exists but she is not listed
3232 there).  Otherwise, she gets full read-write access.
3233
3234         Of course there is a conflict if the user is
3235 listed in both files.  This is resolved in the more
3236 conservative way, it being better to protect the
3237 repository too much than too little: such a user gets
3238 read-only access.
3239
3240 @node Server temporary directory
3241 @section Temporary directories for the server
3242 @cindex Temporary directories, and server
3243 @cindex Server, temporary directories
3244
3245 While running, the @sc{cvs} server creates temporary
3246 directories.  They are named
3247
3248 @example
3249 cvs-serv@var{pid}
3250 @end example
3251
3252 @noindent
3253 where @var{pid} is the process identification number of
3254 the server.
3255 They are located in the directory specified by 
3256 the @samp{-T} global option (@pxref{Global options}), 
3257 the @code{TMPDIR} environment variable (@pxref{Environment variables}), 
3258 or, failing that, @file{/tmp}.
3259
3260 In most cases the server will remove the temporary
3261 directory when it is done, whether it finishes normally
3262 or abnormally.  However, there are a few cases in which
3263 the server does not or cannot remove the temporary
3264 directory, for example:
3265
3266 @itemize @bullet
3267 @item
3268 If the server aborts due to an internal server error,
3269 it may preserve the directory to aid in debugging
3270
3271 @item
3272 If the server is killed in a way that it has no way of
3273 cleaning up (most notably, @samp{kill -KILL} on unix).
3274
3275 @item
3276 If the system shuts down without an orderly shutdown,
3277 which tells the server to clean up.
3278 @end itemize
3279
3280 In cases such as this, you will need to manually remove
3281 the @file{cvs-serv@var{pid}} directories.  As long as
3282 there is no server running with process identification
3283 number @var{pid}, it is safe to do so.
3284
3285 @c ---------------------------------------------------------------------
3286 @node Starting a new project
3287 @chapter Starting a project with CVS
3288 @cindex Starting a project with CVS
3289 @cindex Creating a project
3290
3291 @comment --moduledb--
3292 Because renaming files and moving them between
3293 directories is somewhat inconvenient, the first thing
3294 you do when you start a new project should be to think
3295 through your file organization.  It is not impossible
3296 to rename or move files, but it does increase the
3297 potential for confusion and @sc{cvs} does have some
3298 quirks particularly in the area of renaming
3299 directories.  @xref{Moving files}.
3300
3301 What to do next depends on the situation at hand.
3302
3303 @menu
3304 * Setting up the files::        Getting the files into the repository
3305 * Defining the module::         How to make a module of the files
3306 @end menu
3307 @c -- File permissions!
3308
3309 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3310 @node Setting up the files
3311 @section Setting up the files
3312
3313 The first step is to create the files inside the repository.  This can
3314 be done in a couple of different ways.
3315
3316 @c -- The contributed scripts
3317 @menu
3318 * From files::                  This method is useful with old projects
3319                                 where files already exists.
3320 * From other version control systems::  Old projects where you want to
3321                                         preserve history from another system.
3322 * From scratch::                Creating a directory tree from scratch.
3323 @end menu
3324
3325 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3326 @node From files
3327 @subsection Creating a directory tree from a number of files
3328 @cindex Importing files
3329
3330 When you begin using @sc{cvs}, you will probably already have several
3331 projects that can be
3332 put under @sc{cvs} control.  In these cases the easiest way is to use the
3333 @code{import} command.  An example is probably the easiest way to
3334 explain how to use it.  If the files you want to install in
3335 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3336 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3337
3338 @example
3339 $ cd @var{wdir}
3340 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3341 @end example
3342
3343 Unless you supply a log message with the @samp{-m}
3344 flag, @sc{cvs} starts an editor and prompts for a
3345 message.  The string @samp{yoyo} is a @dfn{vendor tag},
3346 and @samp{start} is a @dfn{release tag}.  They may fill
3347 no purpose in this context, but since @sc{cvs} requires
3348 them they must be present.  @xref{Tracking sources}, for
3349 more information about them.
3350
3351 You can now verify that it worked, and remove your
3352 original source directory.
3353 @c FIXME: Need to say more about "verify that it
3354 @c worked".  What should the user look for in the output
3355 @c from "diff -r"?
3356
3357 @example
3358 $ cd ..
3359 $ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3360 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3361 $ rm -r @var{wdir}
3362 @end example
3363
3364 @noindent
3365 Erasing the original sources is a good idea, to make sure that you do
3366 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3367 Of course, it would be wise to make sure that you have
3368 a backup of the sources before you remove them.
3369
3370 The @code{checkout} command can either take a module
3371 name as argument (as it has done in all previous
3372 examples) or a path name relative to @code{$CVSROOT},
3373 as it did in the example above.
3374
3375 It is a good idea to check that the permissions
3376 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3377 are reasonable, and that they belong to the proper
3378 groups.  @xref{File permissions}.
3379
3380 If some of the files you want to import are binary, you
3381 may want to use the wrappers features to specify which
3382 files are binary and which are not.  @xref{Wrappers}.
3383
3384 @c The node name is too long, but I am having trouble
3385 @c thinking of something more concise.
3386 @node From other version control systems
3387 @subsection Creating Files From Other Version Control Systems
3388 @cindex Importing files, from other version control systems
3389
3390 If you have a project which you are maintaining with
3391 another version control system, such as @sc{rcs}, you
3392 may wish to put the files from that project into
3393 @sc{cvs}, and preserve the revision history of the
3394 files.
3395
3396 @table @asis
3397 @cindex RCS, importing files from
3398 @item From RCS
3399 If you have been using @sc{rcs}, find the @sc{rcs}
3400 files---usually a file named @file{foo.c} will have its
3401 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3402 other places; consult the @sc{rcs} documentation for
3403 details).  Then create the appropriate directories in
3404 @sc{cvs} if they do not already exist.  Then copy the
3405 files into the appropriate directories in the @sc{cvs}
3406 repository (the name in the repository must be the name
3407 of the source file with @samp{,v} added; the files go
3408 directly in the appropriate directory of the repository,
3409 not in an @file{RCS} subdirectory).  This is one of the
3410 few times when it is a good idea to access the @sc{cvs}
3411 repository directly, rather than using @sc{cvs}
3412 commands.  Then you are ready to check out a new
3413 working directory.
3414 @c Someday there probably should be a "cvs import -t
3415 @c rcs" or some such.  It could even create magic
3416 @c branches.  It could also do something about the case
3417 @c where the RCS file had a (non-magic) "0" branch.
3418
3419 The @sc{rcs} file should not be locked when you move it
3420 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3421 letting you operate on it.
3422 @c What is the easiest way to unlock your files if you
3423 @c have them locked?  Especially if you have a lot of them?
3424 @c This is a CVS bug/misfeature; importing RCS files
3425 @c should ignore whether they are locked and leave them in
3426 @c an unlocked state.  Yet another reason for a separate
3427 @c "import RCS file" command.
3428
3429 @c How many is "many"? Or do they just import RCS files?
3430 @item From another version control system
3431 Many version control systems have the ability to export
3432 @sc{rcs} files in the standard format.  If yours does,
3433 export the @sc{rcs} files and then follow the above
3434 instructions.
3435
3436 Failing that, probably your best bet is to write a
3437 script that will check out the files one revision at a
3438 time using the command line interface to the other
3439 system, and then check the revisions into @sc{cvs}.
3440 The @file{sccs2rcs} script mentioned below may be a
3441 useful example to follow.
3442
3443 @cindex SCCS, importing files from
3444 @item From SCCS
3445 There is a script in the @file{contrib} directory of
3446 the @sc{cvs} source distribution called @file{sccs2rcs}
3447 which converts @sc{sccs} files to @sc{rcs} files.
3448 Note: you must run it on a machine which has both
3449 @sc{sccs} and @sc{rcs} installed, and like everything
3450 else in contrib it is unsupported (your mileage may
3451 vary).
3452
3453 @cindex PVCS, importing files from
3454 @item From PVCS
3455 There is a script in the @file{contrib} directory of
3456 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3457 which converts @sc{pvcs} archives to @sc{rcs} files.
3458 You must run it on a machine which has both
3459 @sc{pvcs} and @sc{rcs} installed, and like everything
3460 else in contrib it is unsupported (your mileage may
3461 vary).  See the comments in the script for details.
3462 @end table
3463 @c CMZ and/or PATCHY were systems that were used in the
3464 @c high energy physics community (especially for
3465 @c CERNLIB).  CERN has replaced them with CVS, but the
3466 @c CAR format seems to live on as a way to submit
3467 @c changes.  There is a program car2cvs which converts
3468 @c but I'm not sure where one gets a copy.
3469 @c Not sure it is worth mentioning here, since it would
3470 @c appear to affect only one particular community.
3471 @c Best page for more information is:
3472 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3473 @c See also:
3474 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3475
3476 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3477 @node From scratch
3478 @subsection Creating a directory tree from scratch
3479
3480 @c Also/instead should be documenting
3481 @c $ cvs co -l .
3482 @c $ mkdir tc
3483 @c $ cvs add tc
3484 @c $ cd tc
3485 @c $ mkdir man
3486 @c $ cvs add man
3487 @c etc.
3488 @c Using import to create the directories only is
3489 @c probably a somewhat confusing concept.
3490 For a new project, the easiest thing to do is probably
3491 to create an empty directory structure, like this:
3492
3493 @example
3494 $ mkdir tc
3495 $ mkdir tc/man
3496 $ mkdir tc/testing
3497 @end example
3498
3499 After that, you use the @code{import} command to create
3500 the corresponding (empty) directory structure inside
3501 the repository:
3502
3503 @example
3504 $ cd tc
3505 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3506 @end example
3507
3508 This will add yoyodyne/@var{dir} as a directory under
3509 @code{$CVSROOT}.
3510
3511 Use @code{checkout} to get the new project.  Then, use @code{add}
3512 to add files (and new directories) as needed.
3513
3514 @example
3515 $ cd ..
3516 $ cvs co yoyodyne/@var{dir}
3517 @end example
3518
3519 Check that the permissions @sc{cvs} sets on the
3520 directories inside @code{$CVSROOT} are reasonable.
3521
3522 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3523 @node Defining the module
3524 @section Defining the module
3525 @cindex Defining a module
3526 @cindex Editing the modules file
3527 @cindex Module, defining
3528 @cindex Modules file, changing
3529
3530 The next step is to define the module in the
3531 @file{modules} file.  This is not strictly necessary,
3532 but modules can be convenient in grouping together
3533 related files and directories.
3534
3535 In simple cases these steps are sufficient to define a module.
3536
3537 @enumerate
3538 @item
3539 Get a working copy of the modules file.
3540
3541 @example
3542 $ cvs checkout CVSROOT/modules
3543 $ cd CVSROOT
3544 @end example
3545
3546 @item
3547 Edit the file and insert a line that defines the module.  @xref{Intro
3548 administrative files}, for an introduction.  @xref{modules}, for a full
3549 description of the modules file.  You can use the
3550 following line to define the module @samp{tc}:
3551
3552 @example
3553 tc   yoyodyne/tc
3554 @end example
3555
3556 @item
3557 Commit your changes to the modules file.
3558
3559 @example
3560 $ cvs commit -m "Added the tc module." modules
3561 @end example
3562
3563 @item
3564 Release the modules module.
3565
3566 @example
3567 $ cd ..
3568 $ cvs release -d CVSROOT
3569 @end example
3570 @end enumerate
3571
3572 @c ---------------------------------------------------------------------
3573 @node Revisions
3574 @chapter Revisions
3575
3576 For many uses of @sc{cvs}, one doesn't need to worry
3577 too much about revision numbers; @sc{cvs} assigns
3578 numbers such as @code{1.1}, @code{1.2}, and so on, and
3579 that is all one needs to know.  However, some people
3580 prefer to have more knowledge and control concerning
3581 how @sc{cvs} assigns revision numbers.
3582
3583 If one wants to keep track of a set of revisions
3584 involving more than one file, such as which revisions
3585 went into a particular release, one uses a @dfn{tag},
3586 which is a symbolic revision which can be assigned to a
3587 numeric revision in each file.
3588
3589 @menu
3590 * Revision numbers::            The meaning of a revision number
3591 * Versions revisions releases::  Terminology used in this manual
3592 * Assigning revisions::         Assigning revisions
3593 * Tags::                        Tags--Symbolic revisions
3594 * Tagging the working directory::  The cvs tag command
3595 * Tagging by date/tag::         The cvs rtag command
3596 * Modifying tags::              Adding, renaming, and deleting tags
3597 * Tagging add/remove::          Tags with adding and removing files
3598 * Sticky tags::                 Certain tags are persistent
3599 @end menu
3600
3601 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3602 @node Revision numbers
3603 @section Revision numbers
3604 @cindex Revision numbers
3605 @cindex Revision tree
3606 @cindex Linear development
3607 @cindex Number, revision-
3608 @cindex Decimal revision number
3609 @cindex Branch number
3610 @cindex Number, branch
3611
3612 Each version of a file has a unique @dfn{revision
3613 number}.  Revision numbers look like @samp{1.1},
3614 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3615 A revision number always has an even number of
3616 period-separated decimal integers.  By default revision
3617 1.1 is the first revision of a file.  Each successive
3618 revision is given a new number by increasing the
3619 rightmost number by one.  The following figure displays
3620 a few revisions, with newer revisions to the right.
3621
3622 @example
3623        +-----+    +-----+    +-----+    +-----+    +-----+
3624        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3625        +-----+    +-----+    +-----+    +-----+    +-----+
3626 @end example
3627
3628 It is also possible to end up with numbers containing
3629 more than one period, for example @samp{1.3.2.2}.  Such
3630 revisions represent revisions on branches
3631 (@pxref{Branching and merging}); such revision numbers
3632 are explained in detail in @ref{Branches and
3633 revisions}.
3634
3635 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3636 @node Versions revisions releases
3637 @section Versions, revisions and releases
3638 @cindex Revisions, versions and releases
3639 @cindex Versions, revisions and releases
3640 @cindex Releases, revisions and versions
3641
3642 A file can have several versions, as described above.
3643 Likewise, a software product can have several versions.
3644 A software product is often given a version number such
3645 as @samp{4.1.1}.
3646
3647 Versions in the first sense are called @dfn{revisions}
3648 in this document, and versions in the second sense are
3649 called @dfn{releases}.  To avoid confusion, the word
3650 @dfn{version} is almost never used in this document.
3651
3652 @node Assigning revisions
3653 @section Assigning revisions
3654
3655 @c We avoid the "major revision" terminology.  It seems
3656 @c like jargon.  Hopefully "first number" is clear enough.
3657 @c
3658 @c Well, in the context of software release numbers,
3659 @c "major" and "minor" release or version numbers are
3660 @c documented in at least the GNU Coding Standards, but I'm
3661 @c still not sure I find that a valid reason to apply the
3662 @c terminology to RCS revision numbers.  "First", "Second",
3663 @c "subsequent", and so on is almost surely clearer,
3664 @c especially to a novice reader. -DRP
3665 By default, @sc{cvs} will assign numeric revisions by
3666 leaving the first number the same and incrementing the
3667 second number.  For example, @code{1.1}, @code{1.2},
3668 @code{1.3}, etc.
3669
3670 When adding a new file, the second number will always
3671 be one and the first number will equal the highest
3672 first number of any file in that directory.  For
3673 example, the current directory contains files whose
3674 highest numbered revisions are @code{1.7}, @code{3.1},
3675 and @code{4.12}, then an added file will be given the
3676 numeric revision @code{4.1}.
3677 (When using client/server @sc{cvs},
3678 only files that are actually sent to the server are considered.)
3679
3680 @c This is sort of redundant with something we said a
3681 @c while ago.  Somewhere we need a better way of
3682 @c introducing how the first number can be anything
3683 @c except "1", perhaps.  Also I don't think this
3684 @c presentation is clear on why we are discussing releases
3685 @c and first numbers of numeric revisions in the same
3686 @c breath.
3687 Normally there is no reason to care
3688 about the revision numbers---it is easier to treat them
3689 as internal numbers that @sc{cvs} maintains, and tags
3690 provide a better way to distinguish between things like
3691 release 1 versus release 2 of your product
3692 (@pxref{Tags}).  However, if you want to set the
3693 numeric revisions, the @samp{-r} option to @code{cvs
3694 commit} can do that.  The @samp{-r} option implies the
3695 @samp{-f} option, in the sense that it causes the
3696 files to be committed even if they are not modified.
3697
3698 For example, to bring all your files up to
3699 revision 3.0 (including those that haven't changed),
3700 you might invoke:
3701
3702 @example
3703 $ cvs commit -r 3.0
3704 @end example
3705
3706 Note that the number you specify with @samp{-r} must be
3707 larger than any existing revision number.  That is, if
3708 revision 3.0 exists, you cannot @samp{cvs commit
3709 -r 1.3}.  If you want to maintain several releases in
3710 parallel, you need to use a branch (@pxref{Branching and merging}).
3711
3712 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3713 @node Tags
3714 @section Tags--Symbolic revisions
3715 @cindex Tags
3716
3717 The revision numbers live a life of their own.  They
3718 need not have anything at all to do with the release
3719 numbers of your software product.  Depending
3720 on how you use @sc{cvs} the revision numbers might change several times
3721 between two releases.  As an example, some of the
3722 source files that make up @sc{rcs} 5.6 have the following
3723 revision numbers:
3724 @cindex RCS revision numbers
3725
3726 @example
3727 ci.c            5.21
3728 co.c            5.9
3729 ident.c         5.3
3730 rcs.c           5.12
3731 rcsbase.h       5.11
3732 rcsdiff.c       5.10
3733 rcsedit.c       5.11
3734 rcsfcmp.c       5.9
3735 rcsgen.c        5.10
3736 rcslex.c        5.11
3737 rcsmap.c        5.2
3738 rcsutil.c       5.10
3739 @end example
3740
3741 @cindex tag (subcommand), introduction
3742 @cindex Tags, symbolic name
3743 @cindex Symbolic name (tag)
3744 @cindex Name, symbolic (tag)
3745 @cindex HEAD, as reserved tag name
3746 @cindex BASE, as reserved tag name
3747 You can use the @code{tag} command to give a symbolic name to a
3748 certain revision of a file.  You can use the @samp{-v} flag to the
3749 @code{status} command to see all tags that a file has, and
3750 which revision numbers they represent.  Tag names must
3751 start with an uppercase or lowercase letter and can
3752 contain uppercase and lowercase letters, digits,
3753 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
3754 and @code{HEAD} are reserved for use by @sc{cvs}.  It
3755 is expected that future names which are special to
3756 @sc{cvs} will be specially named, for example by
3757 starting with @samp{.}, rather than being named analogously to
3758 @code{BASE} and @code{HEAD}, to avoid conflicts with
3759 actual tag names.
3760 @c Including a character such as % or = has also been
3761 @c suggested as the naming convention for future
3762 @c special tag names.  Starting with . is nice because
3763 @c that is not a legal tag name as far as RCS is concerned.
3764 @c FIXME: CVS actually accepts quite a few characters
3765 @c in tag names, not just the ones documented above
3766 @c (see RCS_check_tag).  RCS
3767 @c defines legitimate tag names by listing illegal
3768 @c characters rather than legal ones.  CVS is said to lose its
3769 @c mind if you try to use "/" (try making such a tag sticky
3770 @c and using "cvs status" client/server--see remote
3771 @c protocol format for entries line for probable cause).
3772 @c TODO: The testsuite
3773 @c should test for whatever are documented above as
3774 @c officially-OK tag names, and CVS should at least reject
3775 @c characters that won't work, like "/".
3776
3777 You'll want to choose some convention for naming tags,
3778 based on information such as the name of the program
3779 and the version number of the release.  For example,
3780 one might take the name of the program, immediately
3781 followed by the version number with @samp{.} changed to
3782 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3783 @code{cvs1-9}.  If you choose a consistent convention,
3784 then you won't constantly be guessing whether a tag is
3785 @code{cvs-1-9} or @code{cvs1_9} or what.  You might
3786 even want to consider enforcing your convention in the
3787 @file{taginfo} file (@pxref{taginfo}).
3788 @c Might be nice to say more about using taginfo this
3789 @c way, like giving an example, or pointing out any particular
3790 @c issues which arise.
3791
3792 @cindex Adding a tag
3793 @cindex Tags, example
3794 The following example shows how you can add a tag to a
3795 file.  The commands must be issued inside your working
3796 directory.  That is, you should issue the
3797 command in the directory where @file{backend.c}
3798 resides.
3799
3800 @example
3801 $ cvs tag rel-0-4 backend.c
3802 T backend.c
3803 $ cvs status -v backend.c
3804 ===================================================================
3805 File: backend.c         Status: Up-to-date
3806
3807     Version:            1.4     Tue Dec  1 14:39:01 1992
3808     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3809     Sticky Tag:         (none)
3810     Sticky Date:        (none)
3811     Sticky Options:     (none)
3812
3813     Existing Tags:
3814         rel-0-4                     (revision: 1.4)
3815
3816 @end example
3817
3818 For a complete summary of the syntax of @code{cvs tag},
3819 including the various options, see @ref{Invoking CVS}.
3820
3821 There is seldom reason to tag a file in isolation.  A more common use is
3822 to tag all the files that constitute a module with the same tag at
3823 strategic points in the development life-cycle, such as when a release
3824 is made.
3825
3826 @example
3827 $ cvs tag rel-1-0 .
3828 cvs tag: Tagging .
3829 T Makefile
3830 T backend.c
3831 T driver.c
3832 T frontend.c
3833 T parser.c
3834 @end example
3835
3836 @noindent
3837 (When you give @sc{cvs} a directory as argument, it generally applies the
3838 operation to all the files in that directory, and (recursively), to any
3839 subdirectories that it may contain.  @xref{Recursive behavior}.)
3840
3841 @cindex Retrieving an old revision using tags
3842 @cindex Tags, retrieving old revisions
3843 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3844 a certain revision of a module.  This flag makes it easy to
3845 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3846 any time in the future:
3847
3848 @example
3849 $ cvs checkout -r rel-1-0 tc
3850 @end example
3851
3852 @noindent
3853 This is useful, for instance, if someone claims that there is a bug in
3854 that release, but you cannot find the bug in the current working copy.
3855
3856 You can also check out a module as it was on any branch at any given date.
3857 @xref{checkout options}.  When specifying @samp{-r} or @samp{-D} to
3858 any of these commands, you will need beware of sticky
3859 tags; see @ref{Sticky tags}.
3860
3861 When you tag more than one file with the same tag you
3862 can think about the tag as "a curve drawn through a
3863 matrix of filename vs. revision number."  Say we have 5
3864 files with the following revisions:
3865
3866 @example
3867 @group
3868         file1   file2   file3   file4   file5
3869
3870         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3871         1.2*-   1.2     1.2    -1.2*-
3872         1.3  \- 1.3*-   1.3   / 1.3
3873         1.4          \  1.4  /  1.4
3874                       \-1.5*-   1.5
3875                         1.6
3876 @end group
3877 @end example
3878
3879 At some time in the past, the @code{*} versions were tagged.
3880 You can think of the tag as a handle attached to the curve
3881 drawn through the tagged revisions.  When you pull on
3882 the handle, you get all the tagged revisions.  Another
3883 way to look at it is that you "sight" through a set of
3884 revisions that is "flat" along the tagged revisions,
3885 like this:
3886
3887 @example
3888 @group
3889         file1   file2   file3   file4   file5
3890
3891                         1.1
3892                         1.2
3893                 1.1     1.3                       _
3894         1.1     1.2     1.4     1.1              /
3895         1.2*----1.3*----1.5*----1.2*----1.1*    (--- <--- Look here
3896         1.3             1.6     1.3              \_
3897         1.4                     1.4
3898                                 1.5
3899 @end group
3900 @end example
3901
3902 @node Tagging the working directory
3903 @section Specifying what to tag from the working directory
3904
3905 @cindex tag (subcommand)
3906 The example in the previous section demonstrates one of
3907 the most common ways to choose which revisions to tag.
3908 Namely, running the @code{cvs tag} command without
3909 arguments causes @sc{cvs} to select the revisions which
3910 are checked out in the current working directory.  For
3911 example, if the copy of @file{backend.c} in working
3912 directory was checked out from revision 1.4, then
3913 @sc{cvs} will tag revision 1.4.  Note that the tag is
3914 applied immediately to revision 1.4 in the repository;
3915 tagging is not like modifying a file, or other
3916 operations in which one first modifies the working
3917 directory and then runs @code{cvs commit} to transfer
3918 that modification to the repository.
3919
3920 One potentially surprising aspect of the fact that
3921 @code{cvs tag} operates on the repository is that you
3922 are tagging the checked-in revisions, which may differ
3923 from locally modified files in your working directory.
3924 If you want to avoid doing this by mistake, specify the
3925 @samp{-c} option to @code{cvs tag}.  If there are any
3926 locally modified files, @sc{cvs} will abort with an
3927 error before it tags any files:
3928
3929 @example
3930 $ cvs tag -c rel-0-4
3931 cvs tag: backend.c is locally modified
3932 cvs [tag aborted]: correct the above errors first!
3933 @end example
3934
3935 @node Tagging by date/tag
3936 @section Specifying what to tag by date or revision
3937 @cindex rtag (subcommand)
3938
3939 The @code{cvs rtag} command tags the repository as of a
3940 certain date or time (or can be used to tag the latest
3941 revision).  @code{rtag} works directly on the
3942 repository contents (it requires no prior checkout and
3943 does not look for a working directory).
3944
3945 The following options specify which date or revision to
3946 tag.  See @ref{Common options}, for a complete
3947 description of them.
3948
3949 @table @code
3950 @item -D @var{date}
3951 Tag the most recent revision no later than @var{date}.
3952
3953 @item -f
3954 Only useful with the @samp{-D} or @samp{-r}
3955 flags.  If no matching revision is found, use the most
3956 recent revision (instead of ignoring the file).
3957
3958 @item -r @var{tag}[:@var{date}]
3959 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
3960 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
3961 existed on @var{date}.  See @ref{Common options}.
3962 @end table
3963
3964 The @code{cvs tag} command also allows one to specify
3965 files by revision or date, using the same @samp{-r},
3966 @samp{-D}, and @samp{-f} options.  However, this
3967 feature is probably not what you want.  The reason is
3968 that @code{cvs tag} chooses which files to tag based on
3969 the files that exist in the working directory, rather
3970 than the files which existed as of the given tag/date.
3971 Therefore, you are generally better off using @code{cvs
3972 rtag}.  The exceptions might be cases like:
3973
3974 @example
3975 cvs tag -r 1.4 stable backend.c
3976 @end example
3977
3978 @node Modifying tags
3979 @section Deleting, moving, and renaming tags
3980
3981 @c Also see:
3982 @c  "How do I move or rename a magic branch tag?"
3983 @c in the FAQ (I think the issues it talks about still
3984 @c apply, but this could use some sanity.sh work).
3985
3986 Normally one does not modify tags.  They exist in order
3987 to record the history of the repository and so deleting
3988 them or changing their meaning would, generally, not be
3989 what you want.
3990
3991 However, there might be cases in which one uses a tag
3992 temporarily or accidentally puts one in the wrong
3993 place.  Therefore, one might delete, move, or rename a
3994 tag.
3995
3996 @noindent
3997 @strong{WARNING: the commands in this section are
3998 dangerous; they permanently discard historical
3999 information and it can be difficult or impossible to
4000 recover from errors.  If you are a @sc{cvs}
4001 administrator, you may consider restricting these
4002 commands with the @file{taginfo} file (@pxref{taginfo}).}
4003
4004 @cindex Deleting tags
4005 @cindex Deleting branch tags
4006 @cindex Removing tags
4007 @cindex Removing branch tags
4008 @cindex Tags, deleting
4009 @cindex Branch tags, deleting
4010 To delete a tag, specify the @samp{-d} option to either
4011 @code{cvs tag} or @code{cvs rtag}.  For example:
4012
4013 @example
4014 cvs rtag -d rel-0-4 tc
4015 @end example
4016
4017 @noindent
4018 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
4019 In the event that branch tags are encountered within the repository
4020 with the given name, a warning message will be issued and the branch 
4021 tag will not be deleted.  If you are absolutely certain you know what
4022 you are doing, the @code{-B} option may be specified to allow deletion
4023 of branch tags.  In that case, any non-branch tags encountered will
4024 trigger warnings and will not be deleted.
4025
4026 @noindent
4027 @strong{WARNING: Moving branch tags is very dangerous!  If you think
4028 you need the @code{-B} option, think again and ask your @sc{cvs}
4029 administrator about it (if that isn't you).  There is almost certainly
4030 another way to accomplish what you want to accomplish.}
4031
4032 @cindex Moving tags
4033 @cindex Moving branch tags
4034 @cindex Tags, moving
4035 @cindex Branch tags, moving
4036 When we say @dfn{move} a tag, we mean to make the same
4037 name point to different revisions.  For example, the
4038 @code{stable} tag may currently point to revision 1.4
4039 of @file{backend.c} and perhaps we want to make it
4040 point to revision 1.6.  To move a non-branch tag, specify the
4041 @samp{-F} option to either @code{cvs tag} or @code{cvs
4042 rtag}.  For example, the task just mentioned might be
4043 accomplished as:
4044
4045 @example
4046 cvs tag -r 1.6 -F stable backend.c
4047 @end example
4048
4049 @noindent
4050 If any branch tags are encountered in the repository 
4051 with the given name, a warning is issued and the branch
4052 tag is not disturbed.  If you are absolutely certain you
4053 wish to move the branch tag, the @code{-B} option may be specified.
4054 In that case, non-branch tags encountered with the given
4055 name are ignored with a warning message.
4056
4057 @noindent
4058 @strong{WARNING: Moving branch tags is very dangerous!  If you think you
4059 need the @code{-B} option, think again and ask your @sc{cvs}
4060 administrator about it (if that isn't you).  There is almost certainly
4061 another way to accomplish what you want to accomplish.}
4062
4063 @cindex Renaming tags
4064 @cindex Tags, renaming
4065 When we say @dfn{rename} a tag, we mean to make a
4066 different name point to the same revisions as the old
4067 tag.  For example, one may have misspelled the tag name
4068 and want to correct it (hopefully before others are
4069 relying on the old spelling).  To rename a tag, first
4070 create a new tag using the @samp{-r} option to
4071 @code{cvs rtag}, and then delete the old name.  (Caution:
4072 this method will not work with branch tags.) 
4073 This leaves the new tag on exactly the 
4074 same files as the old tag.  For example:
4075
4076 @example
4077 cvs rtag -r old-name-0-4 rel-0-4 tc
4078 cvs rtag -d old-name-0-4 tc
4079 @end example
4080
4081 @node Tagging add/remove
4082 @section Tagging and adding and removing files
4083
4084 The subject of exactly how tagging interacts with
4085 adding and removing files is somewhat obscure; for the
4086 most part @sc{cvs} will keep track of whether files
4087 exist or not without too much fussing.  By default,
4088 tags are applied to only files which have a revision
4089 corresponding to what is being tagged.  Files which did
4090 not exist yet, or which were already removed, simply
4091 omit the tag, and @sc{cvs} knows to treat the absence
4092 of a tag as meaning that the file didn't exist as of
4093 that tag.
4094
4095 However, this can lose a small amount of information.
4096 For example, suppose a file was added and then removed.
4097 Then, if the tag is missing for that file, there is no
4098 way to know whether the tag refers to the time before
4099 the file was added, or the time after it was removed.
4100 If you specify the @samp{-r} option to @code{cvs rtag},
4101 then @sc{cvs} tags the files which have been removed,
4102 and thereby avoids this problem.  For example, one
4103 might specify @code{-r HEAD} to tag the head.
4104
4105 On the subject of adding and removing files, the
4106 @code{cvs rtag} command has a @samp{-a} option which
4107 means to clear the tag from removed files that would
4108 not otherwise be tagged.  For example, one might
4109 specify this option in conjunction with @samp{-F} when
4110 moving a tag.  If one moved a tag without @samp{-a},
4111 then the tag in the removed files might still refer to
4112 the old revision, rather than reflecting the fact that
4113 the file had been removed.  I don't think this is
4114 necessary if @samp{-r} is specified, as noted above.
4115
4116 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4117 @node Sticky tags
4118 @section Sticky tags
4119 @cindex Sticky tags
4120 @cindex Tags, sticky
4121
4122 @c A somewhat related issue is per-directory sticky
4123 @c tags (see comment at CVS/Tag in node Working
4124 @c directory storage); we probably want to say
4125 @c something like "you can set a sticky tag for only
4126 @c some files, but you don't want to" or some such.
4127
4128 Sometimes a working copy's revision has extra data
4129 associated with it, for example it might be on a branch
4130 (@pxref{Branching and merging}), or restricted to
4131 versions prior to a certain date by @samp{checkout -D}
4132 or @samp{update -D}.  Because this data persists --
4133 that is, it applies to subsequent commands in the
4134 working copy -- we refer to it as @dfn{sticky}.
4135
4136 Most of the time, stickiness is an obscure aspect of
4137 @sc{cvs} that you don't need to think about.  However,
4138 even if you don't want to use the feature, you may need
4139 to know @emph{something} about sticky tags (for
4140 example, how to avoid them!).
4141
4142 You can use the @code{status} command to see if any
4143 sticky tags or dates are set:
4144
4145 @example
4146 $ cvs status driver.c
4147 ===================================================================
4148 File: driver.c          Status: Up-to-date
4149
4150     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
4151     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
4152     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4153     Sticky Date:        (none)
4154     Sticky Options:     (none)
4155
4156 @end example
4157
4158 @cindex Resetting sticky tags
4159 @cindex Sticky tags, resetting
4160 @cindex Deleting sticky tags
4161 The sticky tags will remain on your working files until
4162 you delete them with @samp{cvs update -A}.  The
4163 @samp{-A} option merges local changes into the version of the
4164 file from the head of the trunk, removing any sticky tags,
4165 dates, or options.  See @ref{update} for more on the operation
4166 of @code{cvs update}.
4167
4168 @cindex Sticky date
4169 The most common use of sticky tags is to identify which
4170 branch one is working on, as described in
4171 @ref{Accessing branches}.  However, non-branch
4172 sticky tags have uses as well.  For example,
4173 suppose that you want to avoid updating your working
4174 directory, to isolate yourself from possibly
4175 destabilizing changes other people are making.  You
4176 can, of course, just refrain from running @code{cvs
4177 update}.  But if you want to avoid updating only a
4178 portion of a larger tree, then sticky tags can help.
4179 If you check out a certain revision (such as 1.4) it
4180 will become sticky.  Subsequent @code{cvs update}
4181 commands will
4182 not retrieve the latest revision until you reset the
4183 tag with @code{cvs update -A}.  Likewise, use of the
4184 @samp{-D} option to @code{update} or @code{checkout}
4185 sets a @dfn{sticky date}, which, similarly, causes that
4186 date to be used for future retrievals.
4187
4188 People often want to retrieve an old version of
4189 a file without setting a sticky tag.  This can
4190 be done with the @samp{-p} option to @code{checkout} or
4191 @code{update}, which sends the contents of the file to
4192 standard output.  For example:
4193 @example
4194 $ cvs update -p -r 1.1 file1 >file1
4195 ===================================================================
4196 Checking out file1
4197 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
4198 VERS: 1.1
4199 ***************
4200 $
4201 @end example
4202
4203 However, this isn't the easiest way, if you are asking
4204 how to undo a previous checkin (in this example, put
4205 @file{file1} back to the way it was as of revision
4206 1.1).  In that case you are better off using the
4207 @samp{-j} option to @code{update}; for further
4208 discussion see @ref{Merging two revisions}.
4209
4210 @c ---------------------------------------------------------------------
4211 @node Branching and merging
4212 @chapter Branching and merging
4213 @cindex Branching
4214 @cindex Merging
4215 @cindex Copying changes
4216 @cindex Main trunk and branches
4217 @cindex Revision tree, making branches
4218 @cindex Branches, copying changes between
4219 @cindex Changes, copying between branches
4220 @cindex Modifications, copying between branches
4221
4222 @sc{cvs} allows you to isolate changes onto a separate
4223 line of development, known as a @dfn{branch}.  When you
4224 change files on a branch, those changes do not appear
4225 on the main trunk or other branches.
4226
4227 Later you can move changes from one branch to another
4228 branch (or the main trunk) by @dfn{merging}.  Merging
4229 involves first running @code{cvs update -j}, to merge
4230 the changes into the working directory.
4231 You can then commit that revision, and thus effectively
4232 copy the changes onto another branch.
4233
4234 @menu
4235 * Branches motivation::         What branches are good for
4236 * Creating a branch::           Creating a branch
4237 * Accessing branches::          Checking out and updating branches
4238 * Branches and revisions::      Branches are reflected in revision numbers
4239 * Magic branch numbers::        Magic branch numbers
4240 * Merging a branch::            Merging an entire branch
4241 * Merging more than once::      Merging from a branch several times
4242 * Merging two revisions::       Merging differences between two revisions
4243 * Merging adds and removals::   What if files are added or removed?
4244 * Merging and keywords::        Avoiding conflicts due to keyword substitution
4245 @end menu
4246
4247 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4248 @node Branches motivation
4249 @section What branches are good for
4250 @cindex Branches motivation
4251 @cindex What branches are good for
4252 @cindex Motivation for branches
4253
4254 @c FIXME: this node mentions one way to use branches,
4255 @c but it is by no means the only way.  For example,
4256 @c the technique of committing a new feature on a branch,
4257 @c until it is ready for the main trunk.  The whole
4258 @c thing is generally speaking more akin to the
4259 @c "Revision management" node although it isn't clear to
4260 @c me whether policy matters should be centralized or
4261 @c distributed throughout the relevant sections.
4262 Suppose that release 1.0 of tc has been made.  You are continuing to
4263 develop tc, planning to create release 1.1 in a couple of months.  After a
4264 while your customers start to complain about a fatal bug.  You check
4265 out release 1.0 (@pxref{Tags}) and find the bug
4266 (which turns out to have a trivial fix).  However, the current revision
4267 of the sources are in a state of flux and are not expected to be stable
4268 for at least another month.  There is no way to make a
4269 bug fix release based on the newest sources.
4270
4271 The thing to do in a situation like this is to create a @dfn{branch} on
4272 the revision trees for all the files that make up
4273 release 1.0 of tc.  You can then make
4274 modifications to the branch without disturbing the main trunk.  When the
4275 modifications are finished you can elect to either incorporate them on
4276 the main trunk, or leave them on the branch.
4277
4278 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4279 @node Creating a branch
4280 @section Creating a branch
4281 @cindex Creating a branch
4282 @cindex Branch, creating a
4283 @cindex tag (subcommand), creating a branch using
4284 @cindex rtag (subcommand), creating a branch using
4285
4286 You can create a branch with @code{tag -b}; for
4287 example, assuming you're in a working copy:
4288
4289 @example
4290 $ cvs tag -b rel-1-0-patches
4291 @end example
4292
4293 @c FIXME: we should be more explicit about the value of
4294 @c having a tag on the branchpoint.  For example
4295 @c "cvs tag rel-1-0-patches-branchpoint" before
4296 @c the "cvs tag -b".  This points out that
4297 @c rel-1-0-patches is a pretty awkward name for
4298 @c this example (more so than for the rtag example
4299 @c below).
4300
4301 This splits off a branch based on the current revisions
4302 in the working copy, assigning that branch the name
4303 @samp{rel-1-0-patches}.
4304
4305 It is important to understand that branches get created
4306 in the repository, not in the working copy.  Creating a
4307 branch based on current revisions, as the above example
4308 does, will @emph{not} automatically switch the working
4309 copy to be on the new branch.  For information on how
4310 to do that, see @ref{Accessing branches}.
4311
4312 You can also create a branch without reference to any
4313 working copy, by using @code{rtag}:
4314
4315 @example
4316 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
4317 @end example
4318
4319 @samp{-r rel-1-0} says that this branch should be
4320 rooted at the revision that
4321 corresponds to the tag @samp{rel-1-0}.  It need not
4322 be the most recent revision -- it's often useful to
4323 split a branch off an old revision (for example, when
4324 fixing a bug in a past release otherwise known to be
4325 stable).
4326
4327 As with @samp{tag}, the @samp{-b} flag tells
4328 @code{rtag} to create a branch (rather than just a
4329 symbolic revision name).  Note that the numeric
4330 revision number that matches @samp{rel-1-0} will
4331 probably be different from file to file.
4332
4333 So, the full effect of the command is to create a new
4334 branch -- named @samp{rel-1-0-patches} -- in module
4335 @samp{tc}, rooted in the revision tree at the point tagged
4336 by @samp{rel-1-0}.
4337
4338 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4339 @node Accessing branches
4340 @section Accessing branches
4341 @cindex Check out a branch
4342 @cindex Retrieve a branch
4343 @cindex Access a branch
4344 @cindex Identifying a branch
4345 @cindex Branch, check out
4346 @cindex Branch, retrieving
4347 @cindex Branch, accessing
4348 @cindex Branch, identifying
4349
4350 You can retrieve a branch in one of two ways: by
4351 checking it out fresh from the repository, or by
4352 switching an existing working copy over to the branch.
4353
4354 To check out a branch from the repository, invoke
4355 @samp{checkout} with the @samp{-r} flag, followed by
4356 the tag name of the branch (@pxref{Creating a branch}):
4357
4358 @example
4359 $ cvs checkout -r rel-1-0-patches tc
4360 @end example
4361
4362 Or, if you already have a working copy, you can switch
4363 it to a given branch with @samp{update -r}:
4364
4365 @example
4366 $ cvs update -r rel-1-0-patches tc
4367 @end example
4368
4369 @noindent
4370 or equivalently:
4371
4372 @example
4373 $ cd tc
4374 $ cvs update -r rel-1-0-patches
4375 @end example
4376
4377 It does not matter if the working copy was originally
4378 on the main trunk or on some other branch -- the above
4379 command will switch it to the named branch.  And
4380 similarly to a regular @samp{update} command,
4381 @samp{update -r} merges any changes you have made,
4382 notifying you of conflicts where they occur.
4383
4384 Once you have a working copy tied to a particular
4385 branch, it remains there until you tell it otherwise.
4386 This means that changes checked in from the working
4387 copy will add new revisions on that branch, while
4388 leaving the main trunk and other branches unaffected.
4389
4390 @cindex Branches, sticky
4391 To find out what branch a working copy is on, you can
4392 use the @samp{status} command.  In its output, look for
4393 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4394 -- that's @sc{cvs}'s way of telling you the branch, if
4395 any, of the current working files:
4396
4397 @example
4398 $ cvs status -v driver.c backend.c
4399 ===================================================================
4400 File: driver.c          Status: Up-to-date
4401
4402     Version:            1.7     Sat Dec  5 18:25:54 1992
4403     RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4404     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4405     Sticky Date:        (none)
4406     Sticky Options:     (none)
4407
4408     Existing Tags:
4409         rel-1-0-patches             (branch: 1.7.2)
4410         rel-1-0                     (revision: 1.7)
4411
4412 ===================================================================
4413 File: backend.c         Status: Up-to-date
4414
4415     Version:            1.4     Tue Dec  1 14:39:01 1992
4416     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4417     Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4418     Sticky Date:        (none)
4419     Sticky Options:     (none)
4420
4421     Existing Tags:
4422         rel-1-0-patches             (branch: 1.4.2)
4423         rel-1-0                     (revision: 1.4)
4424         rel-0-4                     (revision: 1.4)
4425
4426 @end example
4427
4428 Don't be confused by the fact that the branch numbers
4429 for each file are different (@samp{1.7.2} and
4430 @samp{1.4.2} respectively).  The branch tag is the
4431 same, @samp{rel-1-0-patches}, and the files are
4432 indeed on the same branch.  The numbers simply reflect
4433 the point in each file's revision history at which the
4434 branch was made.  In the above example, one can deduce
4435 that @samp{driver.c} had been through more changes than
4436 @samp{backend.c} before this branch was created.
4437
4438 See @ref{Branches and revisions} for details about how
4439 branch numbers are constructed.
4440
4441 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4442 @node Branches and revisions
4443 @section Branches and revisions
4444 @cindex Branch number
4445 @cindex Number, branch
4446 @cindex Revision numbers (branches)
4447
4448 Ordinarily, a file's revision history is a linear
4449 series of increments (@pxref{Revision numbers}):
4450
4451 @example
4452        +-----+    +-----+    +-----+    +-----+    +-----+
4453        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4454        +-----+    +-----+    +-----+    +-----+    +-----+
4455 @end example
4456
4457 However, @sc{cvs} is not limited to linear development.  The
4458 @dfn{revision tree} can be split into @dfn{branches},
4459 where each branch is a self-maintained line of
4460 development.  Changes made on one branch can easily be
4461 moved back to the main trunk.
4462
4463 Each branch has a @dfn{branch number}, consisting of an
4464 odd number of period-separated decimal integers.  The
4465 branch number is created by appending an integer to the
4466 revision number where the corresponding branch forked
4467 off.  Having branch numbers allows more than one branch
4468 to be forked off from a certain revision.
4469
4470 @need 3500
4471 All revisions on a branch have revision numbers formed
4472 by appending an ordinal number to the branch number.
4473 The following figure illustrates branching with an
4474 example.
4475
4476 @example
4477 @c This example used to have a 1.2.2.4 revision, which
4478 @c might help clarify that development can continue on
4479 @c 1.2.2.  Might be worth reinstating if it can be done
4480 @c without overfull hboxes.
4481 @group
4482                                                       +-------------+
4483                            Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4484                                                     / +-------------+
4485                                                    /
4486                                                   /
4487                  +---------+    +---------+    +---------+
4488 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4489                / +---------+    +---------+    +---------+
4490               /
4491              /
4492 +-----+    +-----+    +-----+    +-----+    +-----+
4493 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4494 +-----+    +-----+    +-----+    +-----+    +-----+
4495                 !
4496                 !
4497                 !   +---------+    +---------+    +---------+
4498 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4499                     +---------+    +---------+    +---------+
4500
4501 @end group
4502 @end example
4503
4504 @c --   However, at least for me the figure is not enough.  I suggest more
4505 @c --   text to accompany it.  "A picture is worth a thousand words", so you
4506 @c --   have to make sure the reader notices the couple of hundred words
4507 @c --   *you* had in mind more than the others!
4508
4509 @c --   Why an even number of segments?  This section implies that this is
4510 @c --   how the main trunk is distinguished from branch roots, but you never
4511 @c --   explicitly say that this is the purpose of the [by itself rather
4512 @c --   surprising] restriction to an even number of segments.
4513
4514 The exact details of how the branch number is
4515 constructed is not something you normally need to be
4516 concerned about, but here is how it works: When
4517 @sc{cvs} creates a branch number it picks the first
4518 unused even integer, starting with 2.  So when you want
4519 to create a branch from revision 6.4 it will be
4520 numbered 6.4.2.  All branch numbers ending in a zero
4521 (such as 6.4.0) are used internally by @sc{cvs}
4522 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4523 special meaning.  @xref{Tracking sources}.
4524
4525 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4526 @node Magic branch numbers
4527 @section Magic branch numbers
4528
4529 @c Want xref to here from "log"?
4530
4531 This section describes a @sc{cvs} feature called
4532 @dfn{magic branches}.  For most purposes, you need not
4533 worry about magic branches; @sc{cvs} handles them for
4534 you.  However, they are visible to you in certain
4535 circumstances, so it may be useful to have some idea of
4536 how it works.
4537
4538 Externally, branch numbers consist of an odd number of
4539 dot-separated decimal integers.  @xref{Revision
4540 numbers}.  That is not the whole truth, however.  For
4541 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4542 in the second rightmost position (1.2.4 becomes
4543 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4544 on).
4545
4546 @sc{cvs} does a pretty good job at hiding these so
4547 called magic branches, but in a few places the hiding
4548 is incomplete:
4549
4550 @itemize @bullet
4551 @ignore
4552 @c This is in ignore as I'm taking their word for it,
4553 @c that this was fixed
4554 @c a long time ago.  But before deleting this
4555 @c entirely, I'd rather verify it (and add a test
4556 @c case to the testsuite).
4557 @item
4558 The magic branch can appear in the output from
4559 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4560 fixed in @sc{cvs} 1.3-s2.
4561
4562 @end ignore
4563 @item
4564 The magic branch number appears in the output from
4565 @code{cvs log}.
4566 @c What output should appear instead?
4567
4568 @item
4569 You cannot specify a symbolic branch name to @code{cvs
4570 admin}.
4571
4572 @end itemize
4573
4574 @c Can CVS do this automatically the first time
4575 @c you check something in to that branch?  Should
4576 @c it?
4577 You can use the @code{admin} command to reassign a
4578 symbolic name to a branch the way @sc{rcs} expects it
4579 to be.  If @code{R4patches} is assigned to the branch
4580 1.4.2 (magic branch number 1.4.0.2) in file
4581 @file{numbers.c} you can do this:
4582
4583 @example
4584 $ cvs admin -NR4patches:1.4.2 numbers.c
4585 @end example
4586
4587 It only works if at least one revision is already
4588 committed on the branch.  Be very careful so that you
4589 do not assign the tag to the wrong number.  (There is
4590 no way to see how the tag was assigned yesterday).
4591
4592 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4593 @node Merging a branch
4594 @section Merging an entire branch
4595 @cindex Merging a branch
4596 @cindex -j (merging branches)
4597
4598 You can merge changes made on a branch into your working copy by giving
4599 the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4600 @samp{-j @var{branchname}} option it merges the changes made between the
4601 greatest common ancestor (GCA) of the branch and the destination revision (in
4602 the simple case below the GCA is the point where the branch forked) and the
4603 newest revision on that branch into your working copy.
4604
4605 @cindex Join
4606 The @samp{-j} stands for ``join''.
4607
4608 @cindex Branch merge example
4609 @cindex Example, branch merge
4610 @cindex Merge, branch example
4611 Consider this revision tree:
4612
4613 @example
4614 +-----+    +-----+    +-----+    +-----+
4615 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4616 +-----+    +-----+    +-----+    +-----+
4617                 !
4618                 !
4619                 !   +---------+    +---------+
4620 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4621                     +---------+    +---------+
4622 @end example
4623
4624 @noindent
4625 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4626 following example assumes that the module @samp{mod} contains only one
4627 file, @file{m.c}.
4628
4629 @example
4630 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4631
4632 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4633                                  # @r{i.e. the changes between revision 1.2}
4634                                  # @r{and 1.2.2.2, into your working copy}
4635                                  # @r{of the file.}
4636
4637 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4638 @end example
4639
4640 A conflict can result from a merge operation.  If that
4641 happens, you should resolve it before committing the
4642 new revision.  @xref{Conflicts example}.
4643
4644 If your source files contain keywords (@pxref{Keyword substitution}),
4645 you might be getting more conflicts than strictly necessary.  See
4646 @ref{Merging and keywords}, for information on how to avoid this.
4647
4648 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4649 same effect as above could be achieved with this:
4650
4651 @example
4652 $ cvs checkout -j R1fix mod
4653 $ cvs commit -m "Included R1fix"
4654 @end example
4655
4656 It should be noted that @code{update -j @var{tagname}} will also work but may
4657 not produce the desired result.  @xref{Merging adds and removals}, for more.
4658
4659 @node Merging more than once
4660 @section Merging from a branch several times
4661
4662 Continuing our example, the revision tree now looks
4663 like this:
4664
4665 @example
4666 +-----+    +-----+    +-----+    +-----+    +-----+
4667 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4668 +-----+    +-----+    +-----+    +-----+    +-----+
4669                 !                           *
4670                 !                          *
4671                 !   +---------+    +---------+
4672 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4673                     +---------+    +---------+
4674 @end example
4675
4676 @noindent
4677 where the starred line represents the merge from the
4678 @samp{R1fix} branch to the main trunk, as just
4679 discussed.
4680
4681 Now suppose that development continues on the
4682 @samp{R1fix} branch:
4683
4684 @example
4685 +-----+    +-----+    +-----+    +-----+    +-----+
4686 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4687 +-----+    +-----+    +-----+    +-----+    +-----+
4688                 !                           *
4689                 !                          *
4690                 !   +---------+    +---------+    +---------+
4691 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4692                     +---------+    +---------+    +---------+
4693 @end example
4694
4695 @noindent
4696 and then you want to merge those new changes onto the
4697 main trunk.  If you just use the @code{cvs update -j
4698 R1fix m.c} command again, @sc{cvs} will attempt to
4699 merge again the changes which you have already merged,
4700 which can have undesirable side effects.
4701
4702 So instead you need to specify that you only want to
4703 merge the changes on the branch which have not yet been
4704 merged into the trunk.  To do that you specify two
4705 @samp{-j} options, and @sc{cvs} merges the changes from
4706 the first revision to the second revision.  For
4707 example, in this case the simplest way would be
4708
4709 @example
4710 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4711                                       # @r{head of the R1fix branch}
4712 @end example
4713
4714 The problem with this is that you need to specify the
4715 1.2.2.2 revision manually.  A slightly better approach
4716 might be to use the date the last merge was done:
4717
4718 @example
4719 cvs update -j R1fix:yesterday -j R1fix m.c
4720 @end example
4721
4722 Better yet, tag the R1fix branch after every merge into
4723 the trunk, and then use that tag for subsequent merges:
4724
4725 @example
4726 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4727 @end example
4728
4729 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4730 @node Merging two revisions
4731 @section Merging differences between any two revisions
4732 @cindex Merging two revisions
4733 @cindex Revisions, merging differences between
4734 @cindex Differences, merging
4735
4736 With two @samp{-j @var{revision}} flags, the @code{update}
4737 (and @code{checkout}) command can merge the differences
4738 between any two revisions into your working file.
4739
4740 @cindex Undoing a change
4741 @cindex Removing a change
4742 @example
4743 $ cvs update -j 1.5 -j 1.3 backend.c
4744 @end example
4745
4746 @noindent
4747 will undo all changes made between revision
4748 1.3 and 1.5.  Note the order of the revisions!
4749
4750 If you try to use this option when operating on
4751 multiple files, remember that the numeric revisions will
4752 probably be very different between the various files.
4753 You almost always use symbolic
4754 tags rather than revision numbers when operating on
4755 multiple files.
4756
4757 @cindex Restoring old version of removed file
4758 @cindex Resurrecting old version of dead file
4759 Specifying two @samp{-j} options can also undo file
4760 removals or additions.  For example, suppose you have
4761 a file
4762 named @file{file1} which existed as revision 1.1, and
4763 you then removed it (thus adding a dead revision 1.2).
4764 Now suppose you want to add it again, with the same
4765 contents it had previously.  Here is how to do it:
4766
4767 @example
4768 $ cvs update -j 1.2 -j 1.1 file1
4769 U file1
4770 $ cvs commit -m test
4771 Checking in file1;
4772 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4773 new revision: 1.3; previous revision: 1.2
4774 done
4775 $
4776 @end example
4777
4778 @node Merging adds and removals
4779 @section Merging can add or remove files
4780
4781 If the changes which you are merging involve removing
4782 or adding some files, @code{update -j} will reflect
4783 such additions or removals.
4784
4785 @c FIXME: This example needs a lot more explanation.
4786 @c We also need other examples for some of the other
4787 @c cases (not all--there are too many--as long as we present a
4788 @c coherent general principle).
4789 For example:
4790 @example
4791 cvs update -A
4792 touch a b c
4793 cvs add a b c ; cvs ci -m "added" a b c
4794 cvs tag -b branchtag
4795 cvs update -r branchtag
4796 touch d ; cvs add d
4797 rm a ; cvs rm a
4798 cvs ci -m "added d, removed a"
4799 cvs update -A
4800 cvs update -jbranchtag
4801 @end example
4802
4803 After these commands are executed and a @samp{cvs commit} is done,
4804 file @file{a} will be removed and file @file{d} added in the main branch.
4805 @c (which was determined by trying it)
4806
4807 Note that using a single static tag (@samp{-j @var{tagname}})
4808 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4809 changes from a branch will usually not remove files which were removed on the
4810 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4811 The exception to this rule occurs when
4812 a static tag has been attached to a dead revision manually.  Use the branch tag
4813 to merge all changes from the branch or use two static tags as merge endpoints
4814 to be sure that all intended changes are propagated in the merge.
4815
4816 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4817 @node Merging and keywords
4818 @section Merging and keywords
4819 @cindex Merging, and keyword substitution
4820 @cindex Keyword substitution, and merging
4821 @cindex -j (merging branches), and keyword substitution
4822 @cindex -kk, to avoid conflicts during a merge
4823
4824 If you merge files containing keywords (@pxref{Keyword
4825 substitution}), you will normally get numerous
4826 conflicts during the merge, because the keywords are
4827 expanded differently in the revisions which you are
4828 merging.
4829
4830 Therefore, you will often want to specify the
4831 @samp{-kk} (@pxref{Substitution modes}) switch to the
4832 merge command line.  By substituting just the name of
4833 the keyword, not the expanded value of that keyword,
4834 this option ensures that the revisions which you are
4835 merging will be the same as each other, and avoid
4836 spurious conflicts.
4837
4838 For example, suppose you have a file like this:
4839
4840 @example
4841        +---------+
4842       _! 1.1.2.1 !   <-  br1
4843      / +---------+
4844     /
4845    /
4846 +-----+    +-----+
4847 ! 1.1 !----! 1.2 !
4848 +-----+    +-----+
4849 @end example
4850
4851 @noindent
4852 and your working directory is currently on the trunk
4853 (revision 1.2).  Then you might get the following
4854 results from a merge:
4855
4856 @example
4857 $ cat file1
4858 key $@splitrcskeyword{Revision}: 1.2 $
4859 . . .
4860 $ cvs update -j br1
4861 U file1
4862 RCS file: /cvsroot/first-dir/file1,v
4863 retrieving revision 1.1
4864 retrieving revision 1.1.2.1
4865 Merging differences between 1.1 and 1.1.2.1 into file1
4866 rcsmerge: warning: conflicts during merge
4867 $ cat file1
4868 @asis{}<<<<<<< file1
4869 key $@splitrcskeyword{Revision}: 1.2 $
4870 @asis{}=======
4871 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4872 @asis{}>>>>>>> 1.1.2.1
4873 . . .
4874 @end example
4875
4876 What happened was that the merge tried to merge the
4877 differences between 1.1 and 1.1.2.1 into your working
4878 directory.  So, since the keyword changed from
4879 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4880 @sc{cvs} tried to merge that change into your working
4881 directory, which conflicted with the fact that your
4882 working directory had contained @code{Revision: 1.2}.
4883
4884 Here is what happens if you had used @samp{-kk}:
4885
4886 @example
4887 $ cat file1
4888 key $@splitrcskeyword{Revision}: 1.2 $
4889 . . .
4890 $ cvs update -kk -j br1
4891 U file1
4892 RCS file: /cvsroot/first-dir/file1,v
4893 retrieving revision 1.1
4894 retrieving revision 1.1.2.1
4895 Merging differences between 1.1 and 1.1.2.1 into file1
4896 $ cat file1
4897 key $@splitrcskeyword{Revision}$
4898 . . .
4899 @end example
4900
4901 What is going on here is that revision 1.1 and 1.1.2.1
4902 both expand as plain @code{Revision}, and therefore
4903 merging the changes between them into the working
4904 directory need not change anything.  Therefore, there
4905 is no conflict.
4906
4907 @strong{WARNING: In versions of @sc{cvs} prior to 1.12.2, there was a
4908 major problem with using @samp{-kk} on merges.  Namely, @samp{-kk}
4909 overrode any default keyword expansion mode set in the archive file in
4910 the repository.  This could, unfortunately for some users, cause data
4911 corruption in binary files (with a default keyword expansion mode set
4912 to @samp{-kb}).  Therefore, when a repository contained binary files,
4913 conflicts had to be dealt with manually rather than using @samp{-kk} in
4914 a merge command.}
4915
4916 In @sc{cvs} version 1.12.2 and later, the keyword expansion mode
4917 provided on the command line to any @sc{cvs} command no longer
4918 overrides the @samp{-kb} keyword expansion mode setting for binary
4919 files, though it will still override other default keyword expansion
4920 modes.  You can now safely merge using @samp{-kk} to avoid spurious conflicts
4921 on lines containing RCS keywords, even when your repository contains
4922 binary files.
4923
4924 @c ---------------------------------------------------------------------
4925 @node Recursive behavior
4926 @chapter Recursive behavior
4927 @cindex Recursive (directory descending)
4928 @cindex Directory, descending
4929 @cindex Descending directories
4930 @cindex Subdirectories
4931
4932 Almost all of the subcommands of @sc{cvs} work
4933 recursively when you specify a directory as an
4934 argument.  For instance, consider this directory
4935 structure:
4936
4937 @example
4938       @code{$HOME}
4939         |
4940         +--@t{tc}
4941         |   |
4942             +--@t{CVS}
4943             |      (internal @sc{cvs} files)
4944             +--@t{Makefile}
4945             +--@t{backend.c}
4946             +--@t{driver.c}
4947             +--@t{frontend.c}
4948             +--@t{parser.c}
4949             +--@t{man}
4950             |    |
4951             |    +--@t{CVS}
4952             |    |  (internal @sc{cvs} files)
4953             |    +--@t{tc.1}
4954             |
4955             +--@t{testing}
4956                  |
4957                  +--@t{CVS}
4958                  |  (internal @sc{cvs} files)
4959                  +--@t{testpgm.t}
4960                  +--@t{test2.t}
4961 @end example
4962
4963 @noindent
4964 If @file{tc} is the current working directory, the
4965 following is true:
4966
4967 @itemize @bullet
4968 @item
4969 @samp{cvs update testing} is equivalent to
4970
4971 @example
4972 cvs update testing/testpgm.t testing/test2.t
4973 @end example
4974
4975 @item
4976 @samp{cvs update testing man} updates all files in the
4977 subdirectories
4978
4979 @item
4980 @samp{cvs update .} or just @samp{cvs update} updates
4981 all files in the @code{tc} directory
4982 @end itemize
4983
4984 If no arguments are given to @code{update} it will
4985 update all files in the current working directory and
4986 all its subdirectories.  In other words, @file{.} is a
4987 default argument to @code{update}.  This is also true
4988 for most of the @sc{cvs} subcommands, not only the
4989 @code{update} command.
4990
4991 The recursive behavior of the @sc{cvs} subcommands can be
4992 turned off with the @samp{-l} option.
4993 Conversely, the @samp{-R} option can be used to force recursion if
4994 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4995
4996 @example
4997 $ cvs update -l         # @r{Don't update files in subdirectories}
4998 @end example
4999
5000 @c ---------------------------------------------------------------------
5001 @node Adding and removing
5002 @chapter Adding, removing, and renaming files and directories
5003
5004 In the course of a project, one will often add new
5005 files.  Likewise with removing or renaming, or with
5006 directories.  The general concept to keep in mind in
5007 all these cases is that instead of making an
5008 irreversible change you want @sc{cvs} to record the
5009 fact that a change has taken place, just as with
5010 modifying an existing file.  The exact mechanisms to do
5011 this in @sc{cvs} vary depending on the situation.
5012
5013 @menu
5014 * Adding files::                Adding files
5015 * Removing files::              Removing files
5016 * Removing directories::        Removing directories
5017 * Moving files::                Moving and renaming files
5018 * Moving directories::          Moving and renaming directories
5019 @end menu
5020
5021 @node Adding files
5022 @section Adding files to a directory
5023 @cindex Adding files
5024
5025 To add a new file to a directory, follow these steps.
5026
5027 @itemize @bullet
5028 @item
5029 You must have a working copy of the directory.
5030 @xref{Getting the source}.
5031
5032 @item
5033 Create the new file inside your working copy of the directory.
5034
5035 @item
5036 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
5037 want to version control the file.  If the file contains
5038 binary data, specify @samp{-kb} (@pxref{Binary files}).
5039
5040 @item
5041 Use @samp{cvs commit @var{filename}} to actually check
5042 in the file into the repository.  Other developers
5043 cannot see the file until you perform this step.
5044 @end itemize
5045
5046 You can also use the @code{add} command to add a new
5047 directory.
5048 @c FIXCVS and/or FIXME: Adding a directory doesn't
5049 @c require the commit step.  This probably can be
5050 @c considered a CVS bug, but it is possible we should
5051 @c warn people since this behavior probably won't be
5052 @c changing right away.
5053
5054 Unlike most other commands, the @code{add} command is
5055 not recursive.  You have to expcicitly name files and
5056 directories that you wish to add to the repository.
5057 However, each directory will need to be added
5058 separately before you will be able to add new files
5059 to those directories.
5060
5061 @example
5062 $ mkdir -p foo/bar
5063 $ cp ~/myfile foo/bar/myfile
5064 $ cvs add foo foo/bar
5065 $ cvs add foo/bar/myfile
5066 @end example
5067
5068 @cindex add (subcommand)
5069 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
5070
5071 Schedule @var{files} to be added to the repository.
5072 The files or directories specified with @code{add} must
5073 already exist in the current directory.  To add a whole
5074 new directory hierarchy to the source repository (for
5075 example, files received from a third-party vendor), use
5076 the @code{import} command instead.  @xref{import}.
5077
5078 The added files are not placed in the source repository
5079 until you use @code{commit} to make the change
5080 permanent.  Doing an @code{add} on a file that was
5081 removed with the @code{remove} command will undo the
5082 effect of the @code{remove}, unless a @code{commit}
5083 command intervened.  @xref{Removing files}, for an
5084 example.
5085
5086 The @samp{-k} option specifies the default way that
5087 this file will be checked out; for more information see
5088 @ref{Substitution modes}.
5089
5090 @c As noted in BUGS, -m is broken client/server (Nov
5091 @c 96).  Also see testsuite log2-* tests.
5092 The @samp{-m} option specifies a description for the
5093 file.  This description appears in the history log (if
5094 it is enabled, @pxref{history file}).  It will also be
5095 saved in the version history inside the repository when
5096 the file is committed.  The @code{log} command displays
5097 this description.  The description can be changed using
5098 @samp{admin -t}.  @xref{admin}.  If you omit the
5099 @samp{-m @var{description}} flag, an empty string will
5100 be used.  You will not be prompted for a description.
5101 @end deffn
5102
5103 For example, the following commands add the file
5104 @file{backend.c} to the repository:
5105
5106 @c This example used to specify
5107 @c     -m "Optimizer and code generation passes."
5108 @c to the cvs add command, but that doesn't work
5109 @c client/server (see log2 in sanity.sh).  Should fix CVS,
5110 @c but also seems strange to document things which
5111 @c don't work...
5112 @example
5113 $ cvs add backend.c
5114 $ cvs commit -m "Early version. Not yet compilable." backend.c
5115 @end example
5116
5117 When you add a file it is added only on the branch
5118 which you are working on (@pxref{Branching and merging}).  You can
5119 later merge the additions to another branch if you want
5120 (@pxref{Merging adds and removals}).
5121 @c Should we mention that earlier versions of CVS
5122 @c lacked this feature (1.3) or implemented it in a buggy
5123 @c way (well, 1.8 had many bugs in cvs update -j)?
5124 @c Should we mention the bug/limitation regarding a
5125 @c file being a regular file on one branch and a directory
5126 @c on another?
5127 @c FIXME: This needs an example, or several, here or
5128 @c elsewhere, for it to make much sense.
5129 @c Somewhere we need to discuss the aspects of death
5130 @c support which don't involve branching, I guess.
5131 @c Like the ability to re-create a release from a tag.
5132
5133 @c ---------------------------------------------------------------------
5134 @node Removing files
5135 @section Removing files
5136 @cindex Removing files
5137 @cindex Deleting files
5138
5139 @c FIXME: this node wants to be split into several
5140 @c smaller nodes.  Could make these children of
5141 @c "Adding and removing", probably (death support could
5142 @c be its own section, for example, as could the
5143 @c various bits about undoing mistakes in adding and
5144 @c removing).
5145 Directories change.  New files are added, and old files
5146 disappear.  Still, you want to be able to retrieve an
5147 exact copy of old releases.
5148
5149 Here is what you can do to remove a file,
5150 but remain able to retrieve old revisions:
5151
5152 @itemize @bullet
5153 @c FIXME: should probably be saying something about
5154 @c having a working directory in the first place.
5155 @item
5156 Make sure that you have not made any uncommitted
5157 modifications to the file.  @xref{Viewing differences},
5158 for one way to do that.  You can also use the
5159 @code{status} or @code{update} command.  If you remove
5160 the file without committing your changes, you will of
5161 course not be able to retrieve the file as it was
5162 immediately before you deleted it.
5163
5164 @item
5165 Remove the file from your working copy of the directory.
5166 You can for instance use @code{rm}.
5167
5168 @item
5169 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
5170 you really want to delete the file.
5171
5172 @item
5173 Use @samp{cvs commit @var{filename}} to actually
5174 perform the removal of the file from the repository.
5175 @end itemize
5176
5177 @c FIXME: Somehow this should be linked in with a more
5178 @c general discussion of death support.  I don't know
5179 @c whether we want to use the term "death support" or
5180 @c not (we can perhaps get by without it), but we do
5181 @c need to discuss the "dead" state in "cvs log" and
5182 @c related subjects.  The current discussion is
5183 @c scattered around, and not xref'd to each other.
5184 @c FIXME: I think this paragraph wants to be moved
5185 @c later down, at least after the first example.
5186 When you commit the removal of the file, @sc{cvs}
5187 records the fact that the file no longer exists.  It is
5188 possible for a file to exist on only some branches and
5189 not on others, or to re-add another file with the same
5190 name later.  @sc{cvs} will correctly create or not create
5191 the file, based on the @samp{-r} and @samp{-D} options
5192 specified to @code{checkout} or @code{update}.
5193
5194 @c FIXME: This style seems to clash with how we
5195 @c document things in general.
5196 @cindex Remove (subcommand)
5197 @deffn Command {cvs remove} [options] files @dots{}
5198
5199 Schedule file(s) to be removed from the repository
5200 (files which have not already been removed from the
5201 working directory are not processed).  This command
5202 does not actually remove the file from the repository
5203 until you commit the removal.  For a full list of
5204 options, see @ref{Invoking CVS}.
5205 @end deffn
5206
5207 Here is an example of removing several files:
5208
5209 @example
5210 $ cd test
5211 $ rm *.c
5212 $ cvs remove
5213 cvs remove: Removing .
5214 cvs remove: scheduling a.c for removal
5215 cvs remove: scheduling b.c for removal
5216 cvs remove: use 'cvs commit' to remove these files permanently
5217 $ cvs ci -m "Removed unneeded files"
5218 cvs commit: Examining .
5219 cvs commit: Committing .
5220 @end example
5221
5222 As a convenience you can remove the file and @code{cvs
5223 remove} it in one step, by specifying the @samp{-f}
5224 option.  For example, the above example could also be
5225 done like this:
5226
5227 @example
5228 $ cd test
5229 $ cvs remove -f *.c
5230 cvs remove: scheduling a.c for removal
5231 cvs remove: scheduling b.c for removal
5232 cvs remove: use 'cvs commit' to remove these files permanently
5233 $ cvs ci -m "Removed unneeded files"
5234 cvs commit: Examining .
5235 cvs commit: Committing .
5236 @end example
5237
5238 If you execute @code{remove} for a file, and then
5239 change your mind before you commit, you can undo the
5240 @code{remove} with an @code{add} command.
5241 @ignore
5242 @c is this worth saying or not?  Somehow it seems
5243 @c confusing to me.
5244 Of course,
5245 since you have removed your copy of file in the working
5246 directory, @sc{cvs} does not necessarily bring back the
5247 contents of the file from right before you executed
5248 @code{remove}; instead it gets the file from the
5249 repository again.
5250 @end ignore
5251
5252 @c FIXME: what if you change your mind after you commit
5253 @c it?  (answer is also "cvs add" but we don't say that...).
5254 @c We need some index entries for thinks like "undoing
5255 @c removal" too.
5256
5257 @example
5258 $ ls
5259 CVS   ja.h  oj.c
5260 $ rm oj.c
5261 $ cvs remove oj.c
5262 cvs remove: scheduling oj.c for removal
5263 cvs remove: use 'cvs commit' to remove this file permanently
5264 $ cvs add oj.c
5265 U oj.c
5266 cvs add: oj.c, version 1.1.1.1, resurrected
5267 @end example
5268
5269 If you realize your mistake before you run the
5270 @code{remove} command you can use @code{update} to
5271 resurrect the file:
5272
5273 @example
5274 $ rm oj.c
5275 $ cvs update oj.c
5276 cvs update: warning: oj.c was lost
5277 U oj.c
5278 @end example
5279
5280 When you remove a file it is removed only on the branch
5281 which you are working on (@pxref{Branching and merging}).  You can
5282 later merge the removals to another branch if you want
5283 (@pxref{Merging adds and removals}).
5284
5285 @node Removing directories
5286 @section Removing directories
5287 @cindex Removing directories
5288 @cindex Directories, removing
5289
5290 In concept, removing directories is somewhat similar to
5291 removing files---you want the directory to not exist in
5292 your current working directories, but you also want to
5293 be able to retrieve old releases in which the directory
5294 existed.
5295
5296 The way that you remove a directory is to remove all
5297 the files in it.  You don't remove the directory
5298 itself; there is no way to do that.
5299 Instead you specify the @samp{-P} option to
5300 @code{cvs update} or @code{cvs checkout},
5301 which will cause @sc{cvs} to remove empty
5302 directories from working directories.
5303 (Note that @code{cvs export} always removes empty directories.)
5304 Probably the
5305 best way to do this is to always specify @samp{-P}; if
5306 you want an empty directory then put a dummy file (for
5307 example @file{.keepme}) in it to prevent @samp{-P} from
5308 removing it.
5309
5310 @c I'd try to give a rationale for this, but I'm not
5311 @c sure there is a particularly convincing one.  What
5312 @c we would _like_ is for CVS to do a better job of version
5313 @c controlling whether directories exist, to eliminate the
5314 @c need for -P and so that a file can be a directory in
5315 @c one revision and a regular file in another.
5316 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5317 options of @code{checkout}.  This way,
5318 @sc{cvs} will be able to correctly create the directory
5319 or not depending on whether the particular version you
5320 are checking out contains any files in that directory.
5321
5322 @c ---------------------------------------------------------------------
5323 @node Moving files
5324 @section Moving and renaming files
5325 @cindex Moving files
5326 @cindex Renaming files
5327 @cindex Files, moving
5328
5329 Moving files to a different directory or renaming them
5330 is not difficult, but some of the ways in which this
5331 works may be non-obvious.  (Moving or renaming a
5332 directory is even harder.  @xref{Moving directories}.).
5333
5334 The examples below assume that the file @var{old} is renamed to
5335 @var{new}.
5336
5337 @menu
5338 * Outside::                     The normal way to Rename
5339 * Inside::                      A tricky, alternative way
5340 * Rename by copying::           Another tricky, alternative way
5341 @end menu
5342
5343 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5344 @node Outside
5345 @subsection The Normal way to Rename
5346
5347 @c More rename issues.  Not sure whether these are
5348 @c worth documenting; I'm putting them here because
5349 @c it seems to be as good a place as any to try to
5350 @c set down the issues.
5351 @c * "cvs annotate" will annotate either the new
5352 @c file or the old file; it cannot annotate _each
5353 @c line_ based on whether it was last changed in the
5354 @c new or old file.  Unlike "cvs log", where the
5355 @c consequences of having to select either the new
5356 @c or old name seem fairly benign, this may be a
5357 @c real advantage to having CVS know about renames
5358 @c other than as a deletion and an addition.
5359
5360 The normal way to move a file is to copy @var{old} to
5361 @var{new}, and then issue the normal @sc{cvs} commands
5362 to remove @var{old} from the repository, and add
5363 @var{new} to it.
5364 @c The following sentence is not true: one must cd into
5365 @c the directory to run "cvs add".
5366 @c  (Both @var{old} and @var{new} could
5367 @c contain relative paths, for example @file{foo/bar.c}).
5368
5369 @example
5370 $ mv @var{old} @var{new}
5371 $ cvs remove @var{old}
5372 $ cvs add @var{new}
5373 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5374 @end example
5375
5376 This is the simplest way to move a file, it is not
5377 error-prone, and it preserves the history of what was
5378 done.  Note that to access the history of the file you
5379 must specify the old or the new name, depending on what
5380 portion of the history you are accessing.  For example,
5381 @code{cvs log @var{old}} will give the log up until the
5382 time of the rename.
5383
5384 When @var{new} is committed its revision numbers will
5385 start again, usually at 1.1, so if that bothers you,
5386 use the @samp{-r @var{tag}} option to commit.  For more
5387 information see @ref{Assigning revisions}.
5388
5389 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5390 @node Inside
5391 @subsection Moving the history file
5392
5393 This method is more dangerous, since it involves moving
5394 files inside the repository.  Read this entire section
5395 before trying it out!
5396
5397 @example
5398 $ cd $CVSROOT/@var{dir}
5399 $ mv @var{old},v @var{new},v
5400 @end example
5401
5402 @noindent
5403 Advantages:
5404
5405 @itemize @bullet
5406 @item
5407 The log of changes is maintained intact.
5408
5409 @item
5410 The revision numbers are not affected.
5411 @end itemize
5412
5413 @noindent
5414 Disadvantages:
5415
5416 @itemize @bullet
5417 @item
5418 Old releases cannot easily be fetched from the
5419 repository.  (The file will show up as @var{new} even
5420 in revisions from the time before it was renamed).
5421
5422 @item
5423 There is no log information of when the file was renamed.
5424
5425 @item
5426 Nasty things might happen if someone accesses the history file
5427 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5428 commands while you move it.
5429 @end itemize
5430
5431 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5432 @node Rename by copying
5433 @subsection Copying the history file
5434
5435 This way also involves direct modifications to the
5436 repository.  It is safe, but not without drawbacks.
5437
5438 @example
5439 # @r{Copy the @sc{rcs} file inside the repository}
5440 $ cd $CVSROOT/@var{dir}
5441 $ cp @var{old},v @var{new},v
5442 # @r{Remove the old file}
5443 $ cd ~/@var{dir}
5444 $ rm @var{old}
5445 $ cvs remove @var{old}
5446 $ cvs commit @var{old}
5447 # @r{Remove all tags from @var{new}}
5448 $ cvs update @var{new}
5449 $ cvs log @var{new}             # @r{Remember the non-branch tag names}
5450 $ cvs tag -d @var{tag1} @var{new}
5451 $ cvs tag -d @var{tag2} @var{new}
5452 @dots{}
5453 @end example
5454
5455 By removing the tags you will be able to check out old
5456 revisions.
5457
5458 @noindent
5459 Advantages:
5460
5461 @itemize @bullet
5462 @item
5463 @c FIXME: Is this true about -D now that we have death
5464 @c support?  See 5B.3 in the FAQ.
5465 Checking out old revisions works correctly, as long as
5466 you use @samp{-r @var{tag}} and not @samp{-D @var{date}}
5467 to retrieve the revisions.
5468
5469 @item
5470 The log of changes is maintained intact.
5471
5472 @item
5473 The revision numbers are not affected.
5474 @end itemize
5475
5476 @noindent
5477 Disadvantages:
5478
5479 @itemize @bullet
5480 @item
5481 You cannot easily see the history of the file across the rename.
5482
5483 @ignore
5484 @c Is this true?  I don't see how the revision numbers
5485 @c _could_ start over, when new,v is just old,v with
5486 @c the tags deleted.
5487 @c If there is some need to reinstate this text,
5488 @c it is "usually 1.1", not "1.0" and it needs an
5489 @c xref to Assigning revisions
5490 @item
5491 Unless you use the @samp{-r @var{tag}} (@pxref{commit
5492 options}) flag when @var{new} is committed its revision
5493 numbers will start at 1.0 again.
5494 @end ignore
5495 @end itemize
5496
5497 @c ---------------------------------------------------------------------
5498 @node Moving directories
5499 @section Moving and renaming directories
5500 @cindex Moving directories
5501 @cindex Renaming directories
5502 @cindex Directories, moving
5503
5504 The normal way to rename or move a directory is to
5505 rename or move each file within it as described in
5506 @ref{Outside}.  Then check out with the @samp{-P}
5507 option, as described in @ref{Removing directories}.
5508
5509 If you really want to hack the repository to rename or
5510 delete a directory in the repository, you can do it
5511 like this:
5512
5513 @enumerate
5514 @item
5515 Inform everyone who has a checked out copy of the directory that the
5516 directory will be renamed.  They should commit all their changes in all their
5517 copies of the project containing the directory to be removed, and remove
5518 all their working copies of said project, before you take the steps below.
5519
5520 @item
5521 Rename the directory inside the repository.
5522
5523 @example
5524 $ cd $CVSROOT/@var{parent-dir}
5525 $ mv @var{old-dir} @var{new-dir}
5526 @end example
5527
5528 @item
5529 Fix the @sc{cvs} administrative files, if necessary (for
5530 instance if you renamed an entire module).
5531
5532 @item
5533 Tell everyone that they can check out again and continue
5534 working.
5535
5536 @end enumerate
5537
5538 If someone had a working copy the @sc{cvs} commands will
5539 cease to work for him, until he removes the directory
5540 that disappeared inside the repository.
5541
5542 It is almost always better to move the files in the
5543 directory instead of moving the directory.  If you move the
5544 directory you are unlikely to be able to retrieve old
5545 releases correctly, since they probably depend on the
5546 name of the directories.
5547
5548 @c ---------------------------------------------------------------------
5549 @node History browsing
5550 @chapter History browsing
5551 @cindex History browsing
5552 @cindex Traceability
5553 @cindex Isolation
5554
5555 @ignore
5556 @c This is too long for an introduction (goal is
5557 @c one 20x80 character screen), and also mixes up a
5558 @c variety of issues (parallel development, history,
5559 @c maybe even touches on process control).
5560
5561 @c -- @quote{To lose ones history is to lose ones soul.}
5562 @c -- ///
5563 @c -- ///Those who cannot remember the past are condemned to repeat it.
5564 @c -- ///               -- George Santayana
5565 @c -- ///
5566
5567 @sc{cvs} tries to make it easy for a group of people to work
5568 together.  This is done in two ways:
5569
5570 @itemize @bullet
5571 @item
5572 Isolation---You have your own working copy of the
5573 source.  You are not affected by modifications made by
5574 others until you decide to incorporate those changes
5575 (via the @code{update} command---@pxref{update}).
5576
5577 @item
5578 Traceability---When something has changed, you can
5579 always see @emph{exactly} what changed.
5580 @end itemize
5581
5582 There are several features of @sc{cvs} that together lead
5583 to traceability:
5584
5585 @itemize @bullet
5586 @item
5587 Each revision of a file has an accompanying log
5588 message.
5589
5590 @item
5591 All commits are optionally logged to a central history
5592 database.
5593
5594 @item
5595 Logging information can be sent to a user-defined
5596 program (@pxref{loginfo}).
5597 @end itemize
5598
5599 @c -- More text here.
5600
5601 This chapter should talk about the history file, the
5602 @code{log} command, the usefulness of ChangeLogs
5603 even when you run @sc{cvs}, and things like that.
5604
5605 @end ignore
5606
5607 @c kind of lame, in a lot of ways the above text inside
5608 @c the @ignore motivates this chapter better
5609 Once you have used @sc{cvs} to store a version control
5610 history---what files have changed when, how, and by
5611 whom, there are a variety of mechanisms for looking
5612 through the history.
5613
5614 @c FIXME: should also be talking about how you look at
5615 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5616 @menu
5617 * log messages::                Log messages
5618 * history database::            The history database
5619 * user-defined logging::        User-defined logging
5620 @end menu
5621
5622 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5623 @node log messages
5624 @section Log messages
5625
5626 @c FIXME: @xref to place where we talk about how to
5627 @c specify message to commit.
5628 Whenever you commit a file you specify a log message.
5629
5630 @c FIXME: bring the information here, and get rid of or
5631 @c greatly shrink the "log" node.
5632 To look through the log messages which have been
5633 specified for every revision which has been committed,
5634 use the @code{cvs log} command (@pxref{log}).
5635
5636 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5637 @node history database
5638 @section The history database
5639
5640 @c FIXME: bring the information from the history file
5641 @c and history nodes here.  Rewrite it to be motivated
5642 @c better (start out by clearly explaining what gets
5643 @c logged in history, for example).
5644 You can use the history file (@pxref{history file}) to
5645 log various @sc{cvs} actions.  To retrieve the
5646 information from the history file, use the @code{cvs
5647 history} command (@pxref{history}).
5648
5649 Note: you can control what is logged to this file by using the
5650 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5651 (@pxref{config}).
5652
5653 @c
5654 @c The history database has many problems:
5655 @c * It is very unclear what field means what.  This
5656 @c could be improved greatly by better documentation,
5657 @c but there are still non-orthogonalities (for
5658 @c example, tag does not record the "repository"
5659 @c field but most records do).
5660 @c * Confusion about files, directories, and modules.
5661 @c Some commands record one, some record others.
5662 @c * File removal is not logged.  There is an 'R'
5663 @c record type documented, but CVS never uses it.
5664 @c * Tags are only logged for the "cvs rtag" command,
5665 @c not "cvs tag".  The fix for this is not completely
5666 @c clear (see above about modules vs. files).
5667 @c * Are there other cases of operations that are not
5668 @c logged?  One would hope for all changes to the
5669 @c repository to be logged somehow (particularly
5670 @c operations like tagging, "cvs admin -k", and other
5671 @c operations which do not record a history that one
5672 @c can get with "cvs log").  Operations on the working
5673 @c directory, like export, get, and release, are a
5674 @c second category also covered by the current "cvs
5675 @c history".
5676 @c * The history file does not record the options given
5677 @c to a command.  The most serious manifestation of
5678 @c this is perhaps that it doesn't record whether a command
5679 @c was recursive.  It is not clear to me whether one
5680 @c wants to log at a level very close to the command
5681 @c line, as a sort of way of logging each command
5682 @c (more or less), or whether one wants
5683 @c to log more at the level of what was changed (or
5684 @c something in between), but either way the current
5685 @c information has pretty big gaps.
5686 @c * Further details about a tag--like whether it is a
5687 @c branch tag or, if a non-branch tag, which branch it
5688 @c is on.  One can find out this information about the
5689 @c tag as it exists _now_, but if the tag has been
5690 @c moved, one doesn't know what it was like at the time
5691 @c the history record was written.
5692 @c * Whether operating on a particular tag, date, or
5693 @c options was implicit (sticky) or explicit.
5694 @c
5695 @c Another item, only somewhat related to the above, is a
5696 @c way to control what is logged in the history file.
5697 @c This is probably the only good way to handle
5698 @c different people having different ideas about
5699 @c information/space tradeoffs.
5700 @c
5701 @c It isn't really clear that it makes sense to try to
5702 @c patch up the history file format as it exists now to
5703 @c include all that stuff.  It might be better to
5704 @c design a whole new CVSROOT/nhistory file and "cvs
5705 @c nhistory" command, or some such, or in some other
5706 @c way trying to come up with a clean break from the
5707 @c past, which can address the above concerns.  Another
5708 @c open question is how/whether this relates to
5709 @c taginfo/loginfo/etc.
5710
5711 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5712 @node user-defined logging
5713 @section User-defined logging
5714
5715 @c FIXME: probably should centralize this information
5716 @c here, at least to some extent.  Maybe by moving the
5717 @c loginfo, etc., nodes here and replacing
5718 @c the "user-defined logging" node with one node for
5719 @c each method.
5720 You can customize @sc{cvs} to log various kinds of
5721 actions, in whatever manner you choose.  These
5722 mechanisms operate by executing a script at various
5723 times.  The script might append a message to a file
5724 listing the information and the programmer who created
5725 it, or send mail to a group of developers, or, perhaps,
5726 post a message to a particular newsgroup.  To log
5727 commits, use the @file{loginfo} file (@pxref{loginfo}), and
5728 to log tagging operations, use the @file{taginfo} file
5729 (@pxref{taginfo}).
5730
5731 @c FIXME: What is difference between doing it in the
5732 @c modules file and using loginfo/taginfo?  Why should
5733 @c user use one or the other?
5734 To log commits, checkouts, exports, and tags,
5735 respectively, you can also use the @samp{-i},
5736 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5737 modules file.  For a more flexible way of giving
5738 notifications to various users, which requires less in
5739 the way of keeping centralized scripts up to date, use
5740 the @code{cvs watch add} command (@pxref{Getting
5741 Notified}); this command is useful even if you are not
5742 using @code{cvs watch on}.
5743
5744 @c ---------------------------------------------------------------------
5745 @node Binary files
5746 @chapter Handling binary files
5747 @cindex Binary files
5748
5749 The most common use for @sc{cvs} is to store text
5750 files.  With text files, @sc{cvs} can merge revisions,
5751 display the differences between revisions in a
5752 human-visible fashion, and other such operations.
5753 However, if you are willing to give up a few of these
5754 abilities, @sc{cvs} can store binary files.  For
5755 example, one might store a web site in @sc{cvs}
5756 including both text files and binary images.
5757
5758 @menu
5759 * Binary why::     More details on issues with binary files
5760 * Binary howto::   How to store them
5761 @end menu
5762
5763 @node Binary why
5764 @section The issues with binary files
5765
5766 While the need to manage binary files may seem obvious
5767 if the files that you customarily work with are binary,
5768 putting them into version control does present some
5769 additional issues.
5770
5771 One basic function of version control is to show the
5772 differences between two revisions.  For example, if
5773 someone else checked in a new version of a file, you
5774 may wish to look at what they changed and determine
5775 whether their changes are good.  For text files,
5776 @sc{cvs} provides this functionality via the @code{cvs
5777 diff} command.  For binary files, it may be possible to
5778 extract the two revisions and then compare them with a
5779 tool external to @sc{cvs} (for example, word processing
5780 software often has such a feature).  If there is no
5781 such tool, one must track changes via other mechanisms,
5782 such as urging people to write good log messages, and
5783 hoping that the changes they actually made were the
5784 changes that they intended to make.
5785
5786 Another ability of a version control system is the
5787 ability to merge two revisions.  For @sc{cvs} this
5788 happens in two contexts.  The first is when users make
5789 changes in separate working directories
5790 (@pxref{Multiple developers}).  The second is when one
5791 merges explicitly with the @samp{update -j} command
5792 (@pxref{Branching and merging}).
5793
5794 In the case of text
5795 files, @sc{cvs} can merge changes made independently,
5796 and signal a conflict if the changes conflict.  With
5797 binary files, the best that @sc{cvs} can do is present
5798 the two different copies of the file, and leave it to
5799 the user to resolve the conflict.  The user may choose
5800 one copy or the other, or may run an external merge
5801 tool which knows about that particular file format, if
5802 one exists.
5803 Note that having the user merge relies primarily on the
5804 user to not accidentally omit some changes, and thus is
5805 potentially error prone.
5806
5807 If this process is thought to be undesirable, the best
5808 choice may be to avoid merging.  To avoid the merges
5809 that result from separate working directories, see the
5810 discussion of reserved checkouts (file locking) in
5811 @ref{Multiple developers}.  To avoid the merges
5812 resulting from branches, restrict use of branches.
5813
5814 @node Binary howto
5815 @section How to store binary files
5816
5817 There are two issues with using @sc{cvs} to store
5818 binary files.  The first is that @sc{cvs} by default
5819 converts line endings between the canonical form in
5820 which they are stored in the repository (linefeed
5821 only), and the form appropriate to the operating system
5822 in use on the client (for example, carriage return
5823 followed by line feed for Windows NT).
5824
5825 The second is that a binary file might happen to
5826 contain data which looks like a keyword (@pxref{Keyword
5827 substitution}), so keyword expansion must be turned
5828 off.
5829
5830 @c FIXME: the third is that one can't do merges with
5831 @c binary files.  xref to Multiple Developers and the
5832 @c reserved checkout issues.
5833
5834 The @samp{-kb} option available with some @sc{cvs}
5835 commands insures that neither line ending conversion
5836 nor keyword expansion will be done.
5837
5838 Here is an example of how you can create a new file
5839 using the @samp{-kb} flag:
5840
5841 @example
5842 $ echo '$@splitrcskeyword{Id}$' > kotest
5843 $ cvs add -kb -m"A test file" kotest
5844 $ cvs ci -m"First checkin; contains a keyword" kotest
5845 @end example
5846
5847 If a file accidentally gets added without @samp{-kb},
5848 one can use the @code{cvs admin} command to recover.
5849 For example:
5850
5851 @example
5852 $ echo '$@splitrcskeyword{Id}$' > kotest
5853 $ cvs add -m"A test file" kotest
5854 $ cvs ci -m"First checkin; contains a keyword" kotest
5855 $ cvs admin -kb kotest
5856 $ cvs update -A kotest
5857 # @r{For non-unix systems:}
5858 # @r{Copy in a good copy of the file from outside CVS}
5859 $ cvs commit -m "make it binary" kotest
5860 @end example
5861
5862 @c Trying to describe this for both unix and non-unix
5863 @c in the same description is very confusing.  Might
5864 @c want to split the two, or just ditch the unix "shortcut"
5865 @c (unixheads don't do much with binary files, anyway).
5866 @c This used to say "(Try the above example, and do a
5867 @c @code{cat kotest} after every command)".  But that
5868 @c only really makes sense for the unix case.
5869 When you check in the file @file{kotest} the file is
5870 not preserved as a binary file, because you did not
5871 check it in as a binary file.  The @code{cvs
5872 admin -kb} command sets the default keyword
5873 substitution method for this file, but it does not
5874 alter the working copy of the file that you have.  If you need to
5875 cope with line endings (that is, you are using
5876 @sc{cvs} on a non-unix system), then you need to
5877 check in a new copy of the file, as shown by the
5878 @code{cvs commit} command above.
5879 On unix, the @code{cvs update -A} command suffices.
5880 @c FIXME: should also describe what the *other users*
5881 @c need to do, if they have checked out copies which
5882 @c have been corrupted by lack of -kb.  I think maybe
5883 @c "cvs update -kb" or "cvs
5884 @c update -A" would suffice, although the user who
5885 @c reported this suggested removing the file, manually
5886 @c removing it from CVS/Entries, and then "cvs update"
5887 (Note that you can use @code{cvs log} to determine the default keyword
5888 substitution method for a file and @code{cvs status} to determine
5889 the keyword substitution method for a working copy.)
5890
5891 However, in using @code{cvs admin -k} to change the
5892 keyword expansion, be aware that the keyword expansion
5893 mode is not version controlled.  This means that, for
5894 example, that if you have a text file in old releases,
5895 and a binary file with the same name in new releases,
5896 @sc{cvs} provides no way to check out the file in text
5897 or binary mode depending on what version you are
5898 checking out.  There is no good workaround for this
5899 problem.
5900
5901 You can also set a default for whether @code{cvs add}
5902 and @code{cvs import} treat a file as binary based on
5903 its name; for example you could say that files who
5904 names end in @samp{.exe} are binary.  @xref{Wrappers}.
5905 There is currently no way to have @sc{cvs} detect
5906 whether a file is binary based on its contents.  The
5907 main difficulty with designing such a feature is that
5908 it is not clear how to distinguish between binary and
5909 non-binary files, and the rules to apply would vary
5910 considerably with the operating system.
5911 @c For example, it would be good on MS-DOS-family OSes
5912 @c for anything containing ^Z to be binary.  Having
5913 @c characters with the 8th bit set imply binary is almost
5914 @c surely a bad idea in the context of ISO-8859-* and
5915 @c other such character sets.  On VMS or the Mac, we
5916 @c could use the OS's file typing.  This is a
5917 @c commonly-desired feature, and something of this sort
5918 @c may make sense.  But there are a lot of pitfalls here.
5919 @c
5920 @c Another, probably better, way to tell is to read the
5921 @c file in text mode, write it to a temp file in text
5922 @c mode, and then do a binary mode compare of the two
5923 @c files.  If they differ, it is a binary file.  This
5924 @c might have problems on VMS (or some other system
5925 @c with several different text modes), but in general
5926 @c should be relatively portable.  The only other
5927 @c downside I can think of is that it would be fairly
5928 @c slow, but that is perhaps a small price to pay for
5929 @c not having your files corrupted.  Another issue is
5930 @c what happens if you import a text file with bare
5931 @c linefeeds on Windows.  Such files will show up on
5932 @c Windows sometimes (I think some native windows
5933 @c programs even write them, on occasion).  Perhaps it
5934 @c is reasonable to treat such files as binary; after
5935 @c all it is something of a presumption to assume that
5936 @c the user would want the linefeeds converted to CRLF.
5937
5938 @c ---------------------------------------------------------------------
5939 @node Multiple developers
5940 @chapter Multiple developers
5941 @cindex Multiple developers
5942 @cindex Team of developers
5943 @cindex File locking
5944 @cindex Locking files
5945 @cindex Working copy
5946 @cindex Reserved checkouts
5947 @cindex Unreserved checkouts
5948 @cindex RCS-style locking
5949
5950 When more than one person works on a software project
5951 things often get complicated.  Often, two people try to
5952 edit the same file simultaneously.  One solution, known
5953 as @dfn{file locking} or @dfn{reserved checkouts}, is
5954 to allow only one person to edit each file at a time.
5955 This is the only solution with some version control
5956 systems, including @sc{rcs} and @sc{sccs}.  Currently
5957 the usual way to get reserved checkouts with @sc{cvs}
5958 is the @code{cvs admin -l} command (@pxref{admin
5959 options}).  This is not as nicely integrated into
5960 @sc{cvs} as the watch features, described below, but it
5961 seems that most people with a need for reserved
5962 checkouts find it adequate.
5963 @c Or "find it better than worrying about implementing
5964 @c nicely integrated reserved checkouts" or ...?
5965
5966 As of @sc{cvs} version 1.12.10, another technique for getting most of the
5967 effect of reserved checkouts is to enable advisory locks.  To enable advisory
5968 locks, have all developers put "edit -c", "commit -c" in their
5969 .cvsrc file, and turn on watches in the repository.  This
5970 prevents them from doing a @code{cvs edit} if anyone is
5971 already editting the file.  It also may
5972 be possible to use plain watches together with suitable
5973 procedures (not enforced by software), to avoid having
5974 two people edit at the same time.
5975
5976 @c Our unreserved checkout model might not
5977 @c be quite the same as others.  For example, I
5978 @c think that some systems will tend to create a branch
5979 @c in the case where CVS prints "up-to-date check failed".
5980 @c It isn't clear to me whether we should try to
5981 @c explore these subtleties; it could easily just
5982 @c confuse people.
5983 The default model with @sc{cvs} is known as
5984 @dfn{unreserved checkouts}.  In this model, developers
5985 can edit their own @dfn{working copy} of a file
5986 simultaneously.  The first person that commits his
5987 changes has no automatic way of knowing that another
5988 has started to edit it.  Others will get an error
5989 message when they try to commit the file.  They must
5990 then use @sc{cvs} commands to bring their working copy
5991 up to date with the repository revision.  This process
5992 is almost automatic.
5993
5994 @c FIXME? should probably use the word "watch" here, to
5995 @c tie this into the text below and above.
5996 @sc{cvs} also supports mechanisms which facilitate
5997 various kinds of communication, without actually
5998 enforcing rules like reserved checkouts do.
5999
6000 The rest of this chapter describes how these various
6001 models work, and some of the issues involved in
6002 choosing between them.
6003
6004 @ignore
6005 Here is a draft reserved checkout design or discussion
6006 of the issues.  This seems like as good a place as any
6007 for this.
6008
6009 Might want a cvs lock/cvs unlock--in which the names
6010 differ from edit/unedit because the network must be up
6011 for these to work.  unedit gives an error if there is a
6012 reserved checkout in place (so that people don't
6013 accidentally leave locks around); unlock gives an error
6014 if one is not in place (this is more arguable; perhaps
6015 it should act like unedit in that case).
6016
6017 On the other hand, might want it so that emacs,
6018 scripts, etc., can get ready to edit a file without
6019 having to know which model is in use.  In that case we
6020 would have a "cvs watch lock" (or .cvsrc?) (that is,
6021 three settings, "on", "off", and "lock").  Having cvs
6022 watch lock set would cause a get to record in the CVS
6023 directory which model is in use, and cause "cvs edit"
6024 to change behaviors.  We'd want a way to query which
6025 setting is in effect (this would be handy even if it is
6026 only "on" or "off" as presently).  If lock is in
6027 effect, then commit would require a lock before
6028 allowing a checkin; chmod wouldn't suffice (might be
6029 debatable--see chmod comment below, in watches--but it
6030 is the way people expect RCS to work and I can't think
6031 of any significant downside.  On the other hand, maybe
6032 it isn't worth bothering, because people who are used
6033 to RCS wouldn't think to use chmod anyway).
6034
6035 Implementation: use file attributes or use RCS
6036 locking.  The former avoids more dependence on RCS
6037 behaviors we will need to re-implement as we librarify
6038 RCS, and makes it easier to import/export RCS files (in
6039 that context, want to ignore the locker field).  But
6040 note that RCS locks are per-branch, which is the
6041 correct behavior (this is also an issue for the "watch
6042 on" features; they should be per-branch too).
6043
6044 Here are a few more random notes about implementation
6045 details, assuming "cvs watch lock" and
6046
6047 CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
6048 Cases: (1) file is checked out (unreserved or with watch on) by old
6049 version of @sc{cvs}, now we do something with new one, (2) file is checked
6050 out by new version, now we do something with old one.
6051
6052 Remote protocol would have a "Watched" analogous to "Mode".  Of course
6053 it would apply to all Updated-like requests.  How do we keep this
6054 setting up to date?  I guess that there wants to be a Watched request,
6055 and the server would send a new one if it isn't up to date? (Ugh--hard
6056 to implement and slows down "cvs -q update"--is there an easier way?)
6057
6058 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
6059 "edit-lock" request.  Which comes back with a Checked-in with
6060 appropriate Watched (off, on, lock, locked, or some such?), or error
6061 message if already locked.
6062
6063 "cvs commit"--only will commit if off/on/locked.  lock is not OK.
6064
6065 Doc:
6066 note that "cvs edit" must be connected to network if watch lock is in
6067 effect.
6068
6069 Talk about what to do if someone has locked a file and you want to
6070 edit that file.  (breaking locks, or lack thereof).
6071
6072
6073 One other idea (which could work along with the
6074 existing "cvs admin -l" reserved checkouts, as well as
6075 the above):
6076
6077 "cvs editors" could show who has the file locked, if
6078 someone does.
6079
6080 @end ignore
6081
6082 @menu
6083 * File status::                 A file can be in several states
6084 * Updating a file::             Bringing a file up-to-date
6085 * Conflicts example::           An informative example
6086 * Informing others::            To cooperate you must inform
6087 * Concurrency::                 Simultaneous repository access
6088 * Watches::                     Mechanisms to track who is editing files
6089 * Choosing a model::            Reserved or unreserved checkouts?
6090 @end menu
6091
6092 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6093 @node File status
6094 @section File status
6095 @cindex File status
6096 @cindex Status of a file
6097
6098 @c Shouldn't this start with an example or something,
6099 @c introducing the unreserved checkout model?  Before we
6100 @c dive into listing states?
6101 Based on what operations you have performed on a
6102 checked out file, and what operations others have
6103 performed to that file in the repository, one can
6104 classify a file in a number of states.  The states, as
6105 reported by the @code{status} command, are:
6106
6107 @c The order of items is chosen to group logically
6108 @c similar outputs together.
6109 @c People who want alphabetical can use the index...
6110 @table @asis
6111 @cindex Up-to-date
6112 @item Up-to-date
6113 The file is identical with the latest revision in the
6114 repository for the branch in use.
6115 @c FIXME: should we clarify "in use"?  The answer is
6116 @c sticky tags, and trying to distinguish branch sticky
6117 @c tags from non-branch sticky tags seems rather awkward
6118 @c here.
6119 @c FIXME: What happens with non-branch sticky tags?  Is
6120 @c a stuck file "Up-to-date" or "Needs checkout" or what?
6121
6122 @item Locally Modified
6123 @cindex Locally Modified
6124 You have edited the file, and not yet committed your changes.
6125
6126 @item Locally Added
6127 @cindex Locally Added
6128 You have added the file with @code{add}, and not yet
6129 committed your changes.
6130 @c There are many cases involving the file being
6131 @c added/removed/modified in the working directory, and
6132 @c added/removed/modified in the repository, which we
6133 @c don't try to describe here.  I'm not sure that "cvs
6134 @c status" produces a non-confusing output in most of
6135 @c those cases.
6136
6137 @item Locally Removed
6138 @cindex Locally Removed
6139 You have removed the file with @code{remove}, and not yet
6140 committed your changes.
6141
6142 @item Needs Checkout
6143 @cindex Needs Checkout
6144 Someone else has committed a newer revision to the
6145 repository.  The name is slightly misleading; you will
6146 ordinarily use @code{update} rather than
6147 @code{checkout} to get that newer revision.
6148
6149 @item Needs Patch
6150 @cindex Needs Patch
6151 @c See also newb-123j0 in sanity.sh (although that case
6152 @c should probably be changed rather than documented).
6153 Like Needs Checkout, but the @sc{cvs} server will send
6154 a patch rather than the entire file.  Sending a patch or
6155 sending an entire file accomplishes the same thing.
6156
6157 @item Needs Merge
6158 @cindex Needs Merge
6159 Someone else has committed a newer revision to the repository, and you
6160 have also made modifications to the file.
6161
6162 @item Unresolved Conflict
6163 @cindex Unresolved Conflict
6164 @c FIXCVS - This file status needs to be changed to some more informative
6165 @c text that distinguishes it more clearly from each of the Locally Added,
6166 @c File had conflicts on merge, and Unknown status types, but an exact and
6167 @c succinct wording escapes me at the moment.
6168 A file with the same name as this new file has been added to the repository
6169 from a second workspace.  This file will need to be moved out of the way
6170 to allow an @code{update} to complete.
6171
6172 @item File had conflicts on merge
6173 @cindex File had conflicts on merge
6174 @c is it worth saying that this message was "Unresolved
6175 @c Conflict" in CVS 1.9 and earlier?  I'm inclined to
6176 @c think that is unnecessarily confusing to new users.
6177 This is like Locally Modified, except that a previous
6178 @code{update} command gave a conflict.  If you have not
6179 already done so, you need to
6180 resolve the conflict as described in @ref{Conflicts example}.
6181
6182 @item Unknown
6183 @cindex Unknown
6184 @sc{cvs} doesn't know anything about this file.  For
6185 example, you have created a new file and have not run
6186 @code{add}.
6187 @c
6188 @c "Entry Invalid" and "Classify Error" are also in the
6189 @c status.c.  The latter definitely indicates a CVS bug
6190 @c (should it be worded more like "internal error" so
6191 @c people submit bug reports if they see it?).  The former
6192 @c I'm not as sure; I haven't tracked down whether/when it
6193 @c appears in "cvs status" output.
6194
6195 @end table
6196
6197 To help clarify the file status, @code{status} also
6198 reports the @code{Working revision} which is the
6199 revision that the file in the working directory derives
6200 from, and the @code{Repository revision} which is the
6201 latest revision in the repository for the branch in
6202 use.
6203 The @samp{Commit Identifier} reflects the unique commitid
6204 of the @code{commit}.
6205 @c FIXME: should we clarify "in use"?  The answer is
6206 @c sticky tags, and trying to distinguish branch sticky
6207 @c tags from non-branch sticky tags seems rather awkward
6208 @c here.
6209 @c FIXME: What happens with non-branch sticky tags?
6210 @c What is the Repository Revision there?  See the
6211 @c comment at vn_rcs in cvs.h, which is kind of
6212 @c confused--we really need to document better what this
6213 @c field contains.
6214 @c Q: Should we document "New file!" and other such
6215 @c outputs or are they self-explanatory?
6216 @c FIXME: what about the date to the right of "Working
6217 @c revision"?  It doesn't appear with client/server and
6218 @c seems unnecessary (redundant with "ls -l") so
6219 @c perhaps it should be removed for non-client/server too?
6220 @c FIXME: Need some examples.
6221 @c FIXME: Working revision can also be something like
6222 @c "-1.3" for a locally removed file.  Not at all
6223 @c self-explanatory (and it is possible that CVS should
6224 @c be changed rather than documenting this).
6225
6226 @c Would be nice to have an @example showing output
6227 @c from cvs status, with comments showing the xref
6228 @c where each part of the output is described.  This
6229 @c might fit in nicely if it is desirable to split this
6230 @c node in two; one to introduce "cvs status" and one
6231 @c to list each of the states.
6232 The options to @code{status} are listed in
6233 @ref{Invoking CVS}.  For information on its @code{Sticky tag}
6234 and @code{Sticky date} output, see @ref{Sticky tags}.
6235 For information on its @code{Sticky options} output,
6236 see the @samp{-k} option in @ref{update options}.
6237
6238 You can think of the @code{status} and @code{update}
6239 commands as somewhat complementary.  You use
6240 @code{update} to bring your files up to date, and you
6241 can use @code{status} to give you some idea of what an
6242 @code{update} would do (of course, the state of the
6243 repository might change before you actually run
6244 @code{update}).  In fact, if you want a command to
6245 display file status in a more brief format than is
6246 displayed by the @code{status} command, you can invoke
6247
6248 @cindex update, to display file status
6249 @example
6250 $ cvs -n -q update
6251 @end example
6252
6253 The @samp{-n} option means to not actually do the
6254 update, but merely to display statuses; the @samp{-q}
6255 option avoids printing the name of each directory.  For
6256 more information on the @code{update} command, and
6257 these options, see @ref{Invoking CVS}.
6258
6259 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6260 @node Updating a file
6261 @section Bringing a file up to date
6262 @cindex Bringing a file up to date
6263 @cindex Updating a file
6264 @cindex Merging a file
6265 @cindex Update, introduction
6266
6267 When you want to update or merge a file, use the @code{cvs update -d}
6268 command.  For files that are not up to date this is roughly equivalent
6269 to a @code{checkout} command: the newest revision of the file is
6270 extracted from the repository and put in your working directory.  The
6271 @code{-d} option, not necessary with @code{checkout}, tells @sc{cvs}
6272 that you wish it to create directories added by other developers.
6273
6274 Your modifications to a file are never lost when you
6275 use @code{update}.  If no newer revision exists,
6276 running @code{update} has no effect.  If you have
6277 edited the file, and a newer revision is available,
6278 @sc{cvs} will merge all changes into your working copy.
6279
6280 For instance, imagine that you checked out revision 1.4 and started
6281 editing it.  In the meantime someone else committed revision 1.5, and
6282 shortly after that revision 1.6.  If you run @code{update} on the file
6283 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
6284 your file.
6285
6286 @cindex Overlap
6287 If any of the changes between 1.4 and 1.6 were made too
6288 close to any of the changes you have made, an
6289 @dfn{overlap} occurs.  In such cases a warning is
6290 printed, and the resulting file includes both
6291 versions of the lines that overlap, delimited by
6292 special markers.
6293 @xref{update}, for a complete description of the
6294 @code{update} command.
6295
6296 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6297 @node Conflicts example
6298 @section Conflicts example
6299 @cindex Merge, an example
6300 @cindex Example of merge
6301 @cindex driver.c (merge example)
6302
6303 Suppose revision 1.4 of @file{driver.c} contains this:
6304
6305 @example
6306 #include <stdio.h>
6307
6308 void main()
6309 @{
6310     parse();
6311     if (nerr == 0)
6312         gencode();
6313     else
6314         fprintf(stderr, "No code generated.\n");
6315     exit(nerr == 0 ? 0 : 1);
6316 @}
6317 @end example
6318
6319 @noindent
6320 Revision 1.6 of @file{driver.c} contains this:
6321
6322 @example
6323 #include <stdio.h>
6324
6325 int main(int argc,
6326          char **argv)
6327 @{
6328     parse();
6329     if (argc != 1)
6330     @{
6331         fprintf(stderr, "tc: No args expected.\n");
6332         exit(1);
6333     @}
6334     if (nerr == 0)
6335         gencode();
6336     else
6337         fprintf(stderr, "No code generated.\n");
6338     exit(!!nerr);
6339 @}
6340 @end example
6341
6342 @noindent
6343 Your working copy of @file{driver.c}, based on revision
6344 1.4, contains this before you run @samp{cvs update}:
6345 @c -- Really include "cvs"?
6346
6347 @example
6348 #include <stdlib.h>
6349 #include <stdio.h>
6350
6351 void main()
6352 @{
6353     init_scanner();
6354     parse();
6355     if (nerr == 0)
6356         gencode();
6357     else
6358         fprintf(stderr, "No code generated.\n");
6359     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6360 @}
6361 @end example
6362
6363 @noindent
6364 You run @samp{cvs update}:
6365 @c -- Really include "cvs"?
6366
6367 @example
6368 $ cvs update driver.c
6369 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6370 retrieving revision 1.4
6371 retrieving revision 1.6
6372 Merging differences between 1.4 and 1.6 into driver.c
6373 rcsmerge warning: overlaps during merge
6374 cvs update: conflicts found in driver.c
6375 C driver.c
6376 @end example
6377
6378 @noindent
6379 @cindex Conflicts (merge example)
6380 @sc{cvs} tells you that there were some conflicts.
6381 Your original working file is saved unmodified in
6382 @file{.#driver.c.1.4}.  The new version of
6383 @file{driver.c} contains this:
6384
6385 @example
6386 #include <stdlib.h>
6387 #include <stdio.h>
6388
6389 int main(int argc,
6390          char **argv)
6391 @{
6392     init_scanner();
6393     parse();
6394     if (argc != 1)
6395     @{
6396         fprintf(stderr, "tc: No args expected.\n");
6397         exit(1);
6398     @}
6399     if (nerr == 0)
6400         gencode();
6401     else
6402         fprintf(stderr, "No code generated.\n");
6403 @asis{}<<<<<<< driver.c
6404     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6405 @asis{}=======
6406     exit(!!nerr);
6407 @asis{}>>>>>>> 1.6
6408 @}
6409 @end example
6410
6411 @noindent
6412 @cindex Markers, conflict
6413 @cindex Conflict markers
6414 @cindex <<<<<<<
6415 @cindex >>>>>>>
6416 @cindex =======
6417
6418 Note how all non-overlapping modifications are incorporated in your working
6419 copy, and that the overlapping section is clearly marked with
6420 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6421
6422 @cindex Resolving a conflict
6423 @cindex Conflict resolution
6424 You resolve the conflict by editing the file, removing the markers and
6425 the erroneous line.  Suppose you end up with this file:
6426 @c -- Add xref to the pcl-cvs manual when it talks
6427 @c -- about this.
6428 @example
6429 #include <stdlib.h>
6430 #include <stdio.h>
6431
6432 int main(int argc,
6433          char **argv)
6434 @{
6435     init_scanner();
6436     parse();
6437     if (argc != 1)
6438     @{
6439         fprintf(stderr, "tc: No args expected.\n");
6440         exit(1);
6441     @}
6442     if (nerr == 0)
6443         gencode();
6444     else
6445         fprintf(stderr, "No code generated.\n");
6446     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6447 @}
6448 @end example
6449
6450 @noindent
6451 You can now go ahead and commit this as revision 1.7.
6452
6453 @example
6454 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6455 Checking in driver.c;
6456 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6457 new revision: 1.7; previous revision: 1.6
6458 done
6459 @end example
6460
6461 For your protection, @sc{cvs} will refuse to check in a
6462 file if a conflict occurred and you have not resolved
6463 the conflict.  Currently to resolve a conflict, you
6464 must change the timestamp on the file.  In previous
6465 versions of @sc{cvs}, you also needed to
6466 insure that the file contains no conflict markers.
6467 Because
6468 your file may legitimately contain conflict markers (that
6469 is, occurrences of @samp{>>>>>>> } at the start of a
6470 line that don't mark a conflict), the current
6471 version of @sc{cvs} will print a warning and proceed to
6472 check in the file.
6473 @c The old behavior was really icky; the only way out
6474 @c was to start hacking on
6475 @c the @code{CVS/Entries} file or other such workarounds.
6476 @c
6477 @c If the timestamp thing isn't considered nice enough,
6478 @c maybe there should be a "cvs resolved" command
6479 @c which clears the conflict indication.  For a nice user
6480 @c interface, this should be invoked by an interactive
6481 @c merge tool like emerge rather than by the user
6482 @c directly--such a tool can verify that the user has
6483 @c really dealt with each conflict.
6484
6485 @cindex emerge
6486 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6487 Emacs front-end for @sc{cvs}) you can use an Emacs
6488 package called emerge to help you resolve conflicts.
6489 See the documentation for pcl-cvs.
6490
6491 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6492 @node Informing others
6493 @section Informing others about commits
6494 @cindex Informing others
6495 @cindex Spreading information
6496 @cindex Mail, automatic mail on commit
6497
6498 It is often useful to inform others when you commit a
6499 new revision of a file.  The @samp{-i} option of the
6500 @file{modules} file, or the @file{loginfo} file, can be
6501 used to automate this process.  @xref{modules}.
6502 @xref{loginfo}.  You can use these features of @sc{cvs}
6503 to, for instance, instruct @sc{cvs} to mail a
6504 message to all developers, or post a message to a local
6505 newsgroup.
6506 @c -- More text would be nice here.
6507
6508 @node Concurrency
6509 @section Several developers simultaneously attempting to run CVS
6510
6511 @cindex Locks, cvs, introduction
6512 @c For a discussion of *why* CVS creates locks, see
6513 @c the comment at the start of src/lock.c
6514 If several developers try to run @sc{cvs} at the same
6515 time, one may get the following message:
6516
6517 @example
6518 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6519 @end example
6520
6521 @cindex #cvs.rfl, removing
6522 @cindex #cvs.wfl, removing
6523 @cindex #cvs.lock, removing
6524 @sc{cvs} will try again every 30 seconds, and either
6525 continue with the operation or print the message again,
6526 if it still needs to wait.  If a lock seems to stick
6527 around for an undue amount of time, find the person
6528 holding the lock and ask them about the cvs command
6529 they are running.  If they aren't running a cvs
6530 command, look in the repository directory mentioned in
6531 the message and remove files which they own whose names
6532 start with @file{#cvs.rfl},
6533 @file{#cvs.wfl}, or @file{#cvs.lock}.
6534
6535 Note that these locks are to protect @sc{cvs}'s
6536 internal data structures and have no relationship to
6537 the word @dfn{lock} in the sense used by
6538 @sc{rcs}---which refers to reserved checkouts
6539 (@pxref{Multiple developers}).
6540
6541 Any number of people can be reading from a given
6542 repository at a time; only when someone is writing do
6543 the locks prevent other people from reading or writing.
6544
6545 @cindex Atomic transactions, lack of
6546 @cindex Transactions, atomic, lack of
6547 @c the following talks about what one might call commit/update
6548 @c atomicity.
6549 @c Probably also should say something about
6550 @c commit/commit atomicity, that is, "An update will
6551 @c not get partial versions of more than one commit".
6552 @c CVS currently has this property and I guess we can
6553 @c make it a documented feature.
6554 @c For example one person commits
6555 @c a/one.c and b/four.c and another commits a/two.c and
6556 @c b/three.c.  Then an update cannot get the new a/one.c
6557 @c and a/two.c and the old b/four.c and b/three.c.
6558 One might hope for the following property:
6559
6560 @quotation
6561 If someone commits some changes in one cvs command,
6562 then an update by someone else will either get all the
6563 changes, or none of them.
6564 @end quotation
6565
6566 @noindent
6567 but @sc{cvs} does @emph{not} have this property.  For
6568 example, given the files
6569
6570 @example
6571 a/one.c
6572 a/two.c
6573 b/three.c
6574 b/four.c
6575 @end example
6576
6577 @noindent
6578 if someone runs
6579
6580 @example
6581 cvs ci a/two.c b/three.c
6582 @end example
6583
6584 @noindent
6585 and someone else runs @code{cvs update} at the same
6586 time, the person running @code{update} might get only
6587 the change to @file{b/three.c} and not the change to
6588 @file{a/two.c}.
6589
6590 @node Watches
6591 @section Mechanisms to track who is editing files
6592 @cindex Watches
6593
6594 For many groups, use of @sc{cvs} in its default mode is
6595 perfectly satisfactory.  Users may sometimes go to
6596 check in a modification only to find that another
6597 modification has intervened, but they deal with it and
6598 proceed with their check in.  Other groups prefer to be
6599 able to know who is editing what files, so that if two
6600 people try to edit the same file they can choose to
6601 talk about who is doing what when rather than be
6602 surprised at check in time.  The features in this
6603 section allow such coordination, while retaining the
6604 ability of two developers to edit the same file at the
6605 same time.
6606
6607 @c Some people might ask why CVS does not enforce the
6608 @c rule on chmod, by requiring a cvs edit before a cvs
6609 @c commit.  The main reason is that it could always be
6610 @c circumvented--one could edit the file, and
6611 @c then when ready to check it in, do the cvs edit and put
6612 @c in the new contents and do the cvs commit.  One
6613 @c implementation note: if we _do_ want to have cvs commit
6614 @c require a cvs edit, we should store the state on
6615 @c whether the cvs edit has occurred in the working
6616 @c directory, rather than having the server try to keep
6617 @c track of what working directories exist.
6618 @c FIXME: should the above discussion be part of the
6619 @c manual proper, somewhere, not just in a comment?
6620 For maximum benefit developers should use @code{cvs
6621 edit} (not @code{chmod}) to make files read-write to
6622 edit them, and @code{cvs release} (not @code{rm}) to
6623 discard a working directory which is no longer in use,
6624 but @sc{cvs} is not able to enforce this behavior.
6625
6626 If a development team wants stronger enforcement of
6627 watches and all team members are using a @sc{cvs} client version 1.12.10 or
6628 greater to access a @sc{cvs} server version 1.12.10 or greater, they can
6629 enable advisory locks.  To enable advisory locks, have all developers
6630 put "edit -c" and "commit -c" into all .cvsrc files,
6631 and make files default to read only by turning on watches
6632 or putting "cvs -r" into all .cvsrc files.
6633 This prevents multiple people from editting a file at
6634 the same time (unless explicitly overriden with @samp{-f}).
6635
6636 @c I'm a little dissatisfied with this presentation,
6637 @c because "watch on"/"edit"/"editors" are one set of
6638 @c functionality, and "watch add"/"watchers" is another
6639 @c which is somewhat orthogonal even though they interact in
6640 @c various ways.  But I think it might be
6641 @c confusing to describe them separately (e.g. "watch
6642 @c add" with loginfo).  I don't know.
6643
6644 @menu
6645 * Setting a watch::             Telling CVS to watch certain files
6646 * Getting Notified::            Telling CVS to notify you
6647 * Editing files::               How to edit a file which is being watched
6648 * Watch information::           Information about who is watching and editing
6649 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6650 @end menu
6651
6652 @node Setting a watch
6653 @subsection Telling CVS to watch certain files
6654
6655 To enable the watch features, you first specify that
6656 certain files are to be watched.
6657
6658 @cindex watch on (subcommand)
6659 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6660
6661 @cindex Read-only files, and watches
6662 Specify that developers should run @code{cvs edit}
6663 before editing @var{files}.  @sc{cvs} will create working
6664 copies of @var{files} read-only, to remind developers
6665 to run the @code{cvs edit} command before working on
6666 them.
6667
6668 If @var{files} includes the name of a directory, @sc{cvs}
6669 arranges to watch all files added to the corresponding
6670 repository directory, and sets a default for files
6671 added in the future; this allows the user to set
6672 notification policies on a per-directory basis.  The
6673 contents of the directory are processed recursively,
6674 unless the @code{-l} option is given.
6675 The @code{-R} option can be used to force recursion if the @code{-l}
6676 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6677
6678 If @var{files} is omitted, it defaults to the current directory.
6679
6680 @cindex watch off (subcommand)
6681 @end deffn
6682
6683 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6684
6685 Do not create @var{files} read-only on checkout; thus,
6686 developers will not be reminded to use @code{cvs edit}
6687 and @code{cvs unedit}.
6688 @ignore
6689 @sc{cvs} will check out @var{files}
6690 read-write as usual, unless other permissions override
6691 due to the @code{PreservePermissions} option being
6692 enabled in the @file{config} administrative file
6693 (@pxref{Special Files}, @pxref{config})
6694 @end ignore
6695
6696 The @var{files} and options are processed as for @code{cvs
6697 watch on}.
6698
6699 @end deffn
6700
6701 @node Getting Notified
6702 @subsection Telling CVS to notify you
6703
6704 You can tell @sc{cvs} that you want to receive
6705 notifications about various actions taken on a file.
6706 You can do this without using @code{cvs watch on} for
6707 the file, but generally you will want to use @code{cvs
6708 watch on}, to remind developers to use the @code{cvs edit}
6709 command.
6710
6711 @cindex watch add (subcommand)
6712 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6713
6714 Add the current user to the list of people to receive notification of
6715 work done on @var{files}.
6716
6717 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6718 the user about.  @var{action} is one of the following:
6719
6720 @table @code
6721
6722 @item edit
6723 Another user has applied the @code{cvs edit} command (described
6724 below) to a watched file.
6725
6726 @item commit
6727 Another user has committed changes to one of the named @var{files}.
6728
6729 @item unedit
6730 Another user has abandoned editing a file (other than by committing changes).
6731 They can do this in several ways, by:
6732
6733 @itemize @bullet
6734
6735 @item
6736 applying the @code{cvs unedit} command (described below) to the file
6737
6738 @item
6739 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6740 (or recursively to a directory more than one level up)
6741
6742 @item
6743 deleting the file and allowing @code{cvs update} to recreate it
6744
6745 @end itemize
6746
6747 @item all
6748 All of the above.
6749
6750 @item none
6751 None of the above.  (This is useful with @code{cvs edit},
6752 described below.)
6753
6754 @end table
6755
6756 The @code{-a} option may appear more than once, or not at all.  If
6757 omitted, the action defaults to @code{all}.
6758
6759 The @var{files} and options are processed as for
6760 @code{cvs watch on}.
6761
6762 @end deffn
6763
6764
6765 @cindex watch remove (subcommand)
6766 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6767
6768 Remove a notification request established using @code{cvs watch add};
6769 the arguments are the same.  If the @code{-a} option is present, only
6770 watches for the specified actions are removed.
6771
6772 @end deffn
6773
6774 @cindex notify (admin file)
6775 When the conditions exist for notification, @sc{cvs}
6776 calls the @file{notify} administrative file.  Edit
6777 @file{notify} as one edits the other administrative
6778 files (@pxref{Intro administrative files}).  This
6779 file follows the usual conventions for administrative
6780 files (@pxref{syntax}), where each line is a regular
6781 expression followed by a command to execute.  The
6782 command should contain a single occurrence of @samp{%s}
6783 which will be replaced by the user to notify; the rest
6784 of the information regarding the notification will be
6785 supplied to the command on standard input.  The
6786 standard thing to put in the @code{notify} file is the
6787 single line:
6788
6789 @example
6790 ALL mail %s -s "CVS notification"
6791 @end example
6792
6793 @noindent
6794 This causes users to be notified by electronic mail.
6795 @c FIXME: should it be this hard to set up this
6796 @c behavior (and the result when one fails to do so,
6797 @c silent failure to notify, so non-obvious)?  Should
6798 @c CVS give a warning if no line in notify matches (and
6799 @c document the use of "DEFAULT :" for the case where
6800 @c skipping the notification is indeed desired)?
6801
6802 @cindex users (admin file)
6803 Note that if you set this up in the straightforward
6804 way, users receive notifications on the server machine.
6805 One could of course write a @file{notify} script which
6806 directed notifications elsewhere, but to make this
6807 easy, @sc{cvs} allows you to associate a notification
6808 address for each user.  To do so create a file
6809 @file{users} in @file{CVSROOT} with a line for each
6810 user in the format @var{user}:@var{value}.  Then
6811 instead of passing the name of the user to be notified
6812 to @file{notify}, @sc{cvs} will pass the @var{value}
6813 (normally an email address on some other machine).
6814
6815 @sc{cvs} does not notify you for your own changes.
6816 Currently this check is done based on whether the user
6817 name of the person taking the action which triggers
6818 notification matches the user name of the person
6819 getting notification.  In fact, in general, the watches
6820 features only track one edit by each user.  It probably
6821 would be more useful if watches tracked each working
6822 directory separately, so this behavior might be worth
6823 changing.
6824 @c "behavior might be worth changing" is an effort to
6825 @c point to future directions while also not promising
6826 @c that "they" (as in "why don't they fix CVS to....")
6827 @c will do this.
6828 @c one implementation issue is identifying whether a
6829 @c working directory is same or different.  Comparing
6830 @c pathnames/hostnames is hopeless, but having the server
6831 @c supply a serial number which the client stores in the
6832 @c CVS directory as a magic cookie should work.
6833
6834 @node Editing files
6835 @subsection How to edit a file which is being watched
6836
6837 @cindex Checkout, as term for getting ready to edit
6838 Since a file which is being watched is checked out
6839 read-only, you cannot simply edit it.  To make it
6840 read-write, and inform others that you are planning to
6841 edit it, use the @code{cvs edit} command.  Some systems
6842 call this a @dfn{checkout}, but @sc{cvs} uses that term
6843 for obtaining a copy of the sources (@pxref{Getting the
6844 source}), an operation which those systems call a
6845 @dfn{get} or a @dfn{fetch}.
6846 @c Issue to think about: should we transition CVS
6847 @c towards the "get" terminology?  "cvs get" is already a
6848 @c synonym for "cvs checkout" and that section of the
6849 @c manual refers to "Getting the source".  If this is
6850 @c done, needs to be done gingerly (for example, we should
6851 @c still accept "checkout" in .cvsrc files indefinitely
6852 @c even if the CVS's messages are changed from "cvs checkout: "
6853 @c to "cvs get: ").
6854 @c There is a concern about whether "get" is not as
6855 @c good for novices because it is a more general term
6856 @c than "checkout" (and thus arguably harder to assign
6857 @c a technical meaning for).
6858
6859 @cindex edit (subcommand)
6860 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6861
6862 Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6863 @var{files} read-write, and notifies users who have requested
6864 @code{edit} notification for any of @var{files}.
6865
6866 The @code{cvs edit} command accepts the same options as the
6867 @code{cvs watch add} command, and establishes a temporary watch for the
6868 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6869 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
6870 receive notifications, she should specify @code{-a none}.
6871
6872 The @var{files} and the options are processed as for the @code{cvs
6873 watch} commands.
6874
6875 There are two additional options that @code{cvs edit} understands as of
6876 @sc{cvs} client and server versions 1.12.10 but @code{cvs watch} does not.
6877 The first is @code{-c}, which causes @code{cvs edit} to fail if anyone else
6878 is editting the file.  This is probably only useful when @samp{edit -c} and
6879 @samp{commit -c} are specified in all developers' @file{.cvsrc} files.  This
6880 behavior may be overriden this via the @code{-f} option, which overrides
6881 @code{-c} and allows multiple edits to succeed.
6882
6883 @ignore
6884 @strong{Caution: If the @code{PreservePermissions}
6885 option is enabled in the repository (@pxref{config}),
6886 @sc{cvs} will not change the permissions on any of the
6887 @var{files}.  The reason for this change is to ensure
6888 that using @samp{cvs edit} does not interfere with the
6889 ability to store file permissions in the @sc{cvs}
6890 repository.}
6891 @end ignore
6892
6893 @end deffn
6894
6895 Normally when you are done with a set of changes, you
6896 use the @code{cvs commit} command, which checks in your
6897 changes and returns the watched files to their usual
6898 read-only state.  But if you instead decide to abandon
6899 your changes, or not to make any changes, you can use
6900 the @code{cvs unedit} command.
6901
6902 @cindex unedit (subcommand)
6903 @cindex Abandoning work
6904 @cindex Reverting to repository version
6905 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6906
6907 Abandon work on the working files @var{files}, and revert them to the
6908 repository versions on which they are based.  @sc{cvs} makes those
6909 @var{files} read-only for which users have requested notification using
6910 @code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6911 notification for any of @var{files}.
6912
6913 The @var{files} and options are processed as for the
6914 @code{cvs watch} commands.
6915
6916 If watches are not in use, the @code{unedit} command
6917 probably does not work, and the way to revert to the
6918 repository version is with the command @code{cvs update -C file}
6919 (@pxref{update}).
6920 The meaning is
6921 not precisely the same; the latter may also
6922 bring in some changes which have been made in the
6923 repository since the last time you updated.
6924 @c It would be a useful enhancement to CVS to make
6925 @c unedit work in the non-watch case as well.
6926 @end deffn
6927
6928 When using client/server @sc{cvs}, you can use the
6929 @code{cvs edit} and @code{cvs unedit} commands even if
6930 @sc{cvs} is unable to successfully communicate with the
6931 server; the notifications will be sent upon the next
6932 successful @sc{cvs} command.
6933
6934 @node Watch information
6935 @subsection Information about who is watching and editing
6936
6937 @cindex watchers (subcommand)
6938 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6939
6940 List the users currently watching changes to @var{files}.  The report
6941 includes the files being watched, and the mail address of each watcher.
6942
6943 The @var{files} and options are processed as for the
6944 @code{cvs watch} commands.
6945
6946 @end deffn
6947
6948
6949 @cindex editors (subcommand)
6950 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6951
6952 List the users currently working on @var{files}.  The report
6953 includes the mail address of each user, the time when the user began
6954 working with the file, and the host and path of the working directory
6955 containing the file.
6956
6957 The @var{files} and options are processed as for the
6958 @code{cvs watch} commands.
6959
6960 @end deffn
6961
6962 @node Watches Compatibility
6963 @subsection Using watches with old versions of CVS
6964
6965 @cindex CVS 1.6, and watches
6966 If you use the watch features on a repository, it
6967 creates @file{CVS} directories in the repository and
6968 stores the information about watches in that directory.
6969 If you attempt to use @sc{cvs} 1.6 or earlier with the
6970 repository, you get an error message such as the
6971 following (all on one line):
6972
6973 @example
6974 cvs update: cannot open CVS/Entries for reading:
6975 No such file or directory
6976 @end example
6977
6978 @noindent
6979 and your operation will likely be aborted.  To use the
6980 watch features, you must upgrade all copies of @sc{cvs}
6981 which use that repository in local or server mode.  If
6982 you cannot upgrade, use the @code{watch off} and
6983 @code{watch remove} commands to remove all watches, and
6984 that will restore the repository to a state which
6985 @sc{cvs} 1.6 can cope with.
6986
6987 @node Choosing a model
6988 @section Choosing between reserved or unreserved checkouts
6989 @cindex Choosing, reserved or unreserved checkouts
6990
6991 Reserved and unreserved checkouts each have pros and
6992 cons.  Let it be said that a lot of this is a matter of
6993 opinion or what works given different groups' working
6994 styles, but here is a brief description of some of the
6995 issues.  There are many ways to organize a team of
6996 developers.  @sc{cvs} does not try to enforce a certain
6997 organization.  It is a tool that can be used in several
6998 ways.
6999
7000 Reserved checkouts can be very counter-productive.  If
7001 two persons want to edit different parts of a file,
7002 there may be no reason to prevent either of them from
7003 doing so.  Also, it is common for someone to take out a
7004 lock on a file, because they are planning to edit it,
7005 but then forget to release the lock.
7006
7007 @c "many groups"?  specifics?  cites to papers on this?
7008 @c some way to weasel-word it a bit more so we don't
7009 @c need facts :-)?
7010 People, especially people who are familiar with
7011 reserved checkouts, often wonder how often conflicts
7012 occur if unreserved checkouts are used, and how
7013 difficult they are to resolve.  The experience with
7014 many groups is that they occur rarely and usually are
7015 relatively straightforward to resolve.
7016
7017 The rarity of serious conflicts may be surprising, until one realizes
7018 that they occur only when two developers disagree on the proper design
7019 for a given section of code; such a disagreement suggests that the
7020 team has not been communicating properly in the first place.  In order
7021 to collaborate under @emph{any} source management regimen, developers
7022 must agree on the general design of the system; given this agreement,
7023 overlapping changes are usually straightforward to merge.
7024
7025 In some cases unreserved checkouts are clearly
7026 inappropriate.  If no merge tool exists for the kind of
7027 file you are managing (for example word processor files
7028 or files edited by Computer Aided Design programs), and
7029 it is not desirable to change to a program which uses a
7030 mergeable data format, then resolving conflicts is
7031 going to be unpleasant enough that you generally will
7032 be better off to simply avoid the conflicts instead, by
7033 using reserved checkouts.
7034
7035 The watches features described above in @ref{Watches}
7036 can be considered to be an intermediate model between
7037 reserved checkouts and unreserved checkouts.  When you
7038 go to edit a file, it is possible to find out who else
7039 is editing it.  And rather than having the system
7040 simply forbid both people editing the file, it can tell
7041 you what the situation is and let you figure out
7042 whether it is a problem in that particular case or not.
7043 Therefore, for some groups watches can be
7044 considered the best of both the reserved checkout and unreserved
7045 checkout worlds.
7046
7047 As of @sc{cvs} client and server versions 1.12.10, you may also enable
7048 advisory locks by putting @samp{edit -c} and @samp{commit -c} in all
7049 developers' @file{.cvsrc} files.  After this is done, @code{cvs edit}
7050 will fail if there are any other editors, and @code{cvs commit} will
7051 fail if the committer has not registered to edit the file via @code{cvs edit}.
7052 This is most effective in conjunction with files checked out read-only by
7053 default, which may be enabled by turning on watches in the repository or by
7054 putting @samp{cvs -r} in all @file{.cvsrc} files.
7055
7056
7057 @c ---------------------------------------------------------------------
7058 @node Revision management
7059 @chapter Revision management
7060 @cindex Revision management
7061
7062 @c -- This chapter could be expanded a lot.
7063 @c -- Experiences are very welcome!
7064
7065 If you have read this far, you probably have a pretty
7066 good grasp on what @sc{cvs} can do for you.  This
7067 chapter talks a little about things that you still have
7068 to decide.
7069
7070 If you are doing development on your own using @sc{cvs}
7071 you could probably skip this chapter.  The questions
7072 this chapter takes up become more important when more
7073 than one person is working in a repository.
7074
7075 @menu
7076 * When to commit::              Some discussion on the subject
7077 @end menu
7078
7079 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7080 @node When to commit
7081 @section When to commit?
7082 @cindex When to commit
7083 @cindex Committing, when to
7084 @cindex Policy
7085
7086 Your group should decide which policy to use regarding
7087 commits.  Several policies are possible, and as your
7088 experience with @sc{cvs} grows you will probably find
7089 out what works for you.
7090
7091 If you commit files too quickly you might commit files
7092 that do not even compile.  If your partner updates his
7093 working sources to include your buggy file, he will be
7094 unable to compile the code.  On the other hand, other
7095 persons will not be able to benefit from the
7096 improvements you make to the code if you commit very
7097 seldom, and conflicts will probably be more common.
7098
7099 It is common to only commit files after making sure
7100 that they can be compiled.  Some sites require that the
7101 files pass a test suite.  Policies like this can be
7102 enforced using the commitinfo file
7103 (@pxref{commitinfo}), but you should think twice before
7104 you enforce such a convention.  By making the
7105 development environment too controlled it might become
7106 too regimented and thus counter-productive to the real
7107 goal, which is to get software written.
7108
7109 @c ---------------------------------------------------------------------
7110 @node Keyword substitution
7111 @chapter Keyword substitution
7112 @cindex Keyword substitution
7113 @cindex Keyword expansion
7114 @cindex Identifying files
7115
7116 @comment   Be careful when editing this chapter.
7117 @comment   Remember that this file is kept under
7118 @comment   version control, so we must not accidentally
7119 @comment   include a valid keyword in the running text.
7120
7121 As long as you edit source files inside a working
7122 directory you can always find out the state of
7123 your files via @samp{cvs status} and @samp{cvs log}.
7124 But as soon as you export the files from your
7125 development environment it becomes harder to identify
7126 which revisions they are.
7127
7128 @sc{cvs} can use a mechanism known as @dfn{keyword
7129 substitution} (or @dfn{keyword expansion}) to help
7130 identifying the files.  Embedded strings of the form
7131 @code{$@var{keyword}$} and
7132 @code{$@var{keyword}:@dots{}$} in a file are replaced
7133 with strings of the form
7134 @code{$@var{keyword}:@var{value}$} whenever you obtain
7135 a new revision of the file.
7136
7137 @menu
7138 * Keyword list::                   Keywords
7139 * Using keywords::                 Using keywords
7140 * Avoiding substitution::          Avoiding substitution
7141 * Substitution modes::             Substitution modes
7142 * Configuring keyword expansion::  Configuring keyword expansion
7143 * Log keyword::                    Problems with the $@splitrcskeyword{Log}$ keyword.
7144 @end menu
7145
7146 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7147 @node Keyword list
7148 @section Keyword List
7149 @cindex Keyword List
7150
7151 @c FIXME: need some kind of example here I think,
7152 @c perhaps in a
7153 @c "Keyword intro" node.  The intro in the "Keyword
7154 @c substitution" node itself seems OK, but to launch
7155 @c into a list of the keywords somehow seems too abrupt.
7156
7157 This is a list of the keywords:
7158
7159 @table @code
7160 @cindex Author keyword
7161 @item $@splitrcskeyword{Author}$
7162 The login name of the user who checked in the revision.
7163
7164 @cindex CVSHeader keyword
7165 @item $@splitrcskeyword{CVSHeader}$
7166 A standard header (similar to $@splitrcskeyword{Header}$, but with
7167 the CVS root stripped off). It contains the relative
7168 pathname of the @sc{rcs} file to the CVS root, the
7169 revision number, the date (UTC), the author, the state,
7170 and the locker (if locked). Files will normally never
7171 be locked when you use @sc{cvs}.
7172
7173 Note that this keyword has only been recently
7174 introduced to @sc{cvs} and may cause problems with
7175 existing installations if $@splitrcskeyword{CVSHeader}$ is already
7176 in the files for a different purpose. This keyword may
7177 be excluded using the @code{KeywordExpand=eCVSHeader}
7178 in the @file{CVSROOT/config} file. 
7179 See @ref{Configuring keyword expansion} for more details.
7180
7181 @cindex Date keyword
7182 @item $@splitrcskeyword{Date}$
7183 The date and time (UTC) the revision was checked in.
7184
7185 @cindex Header keyword
7186 @item $@splitrcskeyword{Header}$
7187 A standard header containing the full pathname of the
7188 @sc{rcs} file, the revision number, the date (UTC), the
7189 author, the state, and the locker (if locked).  Files
7190 will normally never be locked when you use @sc{cvs}.
7191
7192 @cindex Id keyword
7193 @item $@splitrcskeyword{Id}$
7194 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
7195 filename is without a path.
7196
7197 @cindex Name keyword
7198 @item $@splitrcskeyword{Name}$
7199 Tag name used to check out this file.  The keyword is
7200 expanded only if one checks out with an explicit tag
7201 name.  For example, when running the command @code{cvs
7202 co -r first}, the keyword expands to @samp{Name: first}.
7203
7204 @cindex Locker keyword
7205 @item $@splitrcskeyword{Locker}$
7206 The login name of the user who locked the revision
7207 (empty if not locked, which is the normal case unless
7208 @code{cvs admin -l} is in use).
7209
7210 @cindex Log keyword
7211 @cindex MaxCommentLeaderLength
7212 @cindex UseArchiveCommentLeader
7213 @cindex Log keyword, configuring substitution behavior
7214 @item $@splitrcskeyword{Log}$
7215 The log message supplied during commit, preceded by a
7216 header containing the @sc{rcs} filename, the revision
7217 number, the author, and the date (UTC).  Existing log
7218 messages are @emph{not} replaced.  Instead, the new log
7219 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
7220 By default, each new line is prefixed with the same string which
7221 precedes the @code{$@splitrcskeyword{Log}$} keyword, unless it exceeds the
7222 @code{MaxCommentLeaderLength} set in @file{CVSROOT/config}.
7223
7224 For example, if the file contains:
7225
7226 @example
7227   /* Here is what people have been up to:
7228    *
7229    * $@splitrcskeyword{Log}: frob.c,v $
7230    * Revision 1.1  1997/01/03 14:23:51  joe
7231    * Add the superfrobnicate option
7232    *
7233    */
7234 @end example
7235
7236 @noindent
7237 then additional lines which are added when expanding
7238 the @code{$@splitrcskeyword{Log}$} keyword will be preceded by @samp{   * }.
7239 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
7240 @dfn{comment leader} from the @sc{rcs} file is not used.
7241 The @code{$@splitrcskeyword{Log}$} keyword is useful for
7242 accumulating a complete change log in a source file,
7243 but for several reasons it can be problematic.
7244
7245 If the prefix of the @code{$@splitrcskeyword{Log}$} keyword turns out to be
7246 longer than @code{MaxCommentLeaderLength}, CVS will skip expansion of this
7247 keyword unless @code{UseArchiveCommentLeader} is also set in
7248 @file{CVSROOT/config} and a @samp{comment leader} is set in the RCS archive
7249 file, in which case the comment leader will be used instead.  For more on
7250 setting the comment leader in the RCS archive file, @xref{admin}.  For more
7251 on configuring the default @code{$@splitrcskeyword{Log}$} substitution
7252 behavior, @xref{config}.
7253
7254 @xref{Log keyword}.
7255
7256 @cindex RCSfile keyword
7257 @item $@splitrcskeyword{RCSfile}$
7258 The name of the RCS file without a path.
7259
7260 @cindex Revision keyword
7261 @item $@splitrcskeyword{Revision}$
7262 The revision number assigned to the revision.
7263
7264 @cindex Source keyword
7265 @item $@splitrcskeyword{Source}$
7266 The full pathname of the RCS file.
7267
7268 @cindex State keyword
7269 @item $@splitrcskeyword{State}$
7270 The state assigned to the revision.  States can be
7271 assigned with @code{cvs admin -s}---see @ref{admin options}.
7272
7273 @cindex Local keyword
7274 @item Local keyword
7275 The @code{LocalKeyword} option in the @file{CVSROOT/config} file
7276 may be used to specify a local keyword which is to be
7277 used as an alias for one of the keywords: $@splitrcskeyword{Id}$,
7278 $@splitrcskeyword{Header}$, or $@splitrcskeyword{CVSHeader}$. For
7279 example, if the @file{CVSROOT/config} file contains
7280 a line with @code{LocalKeyword=MYBSD=CVSHeader}, then a
7281 file with the local keyword $@splitrcskeyword{MYBSD}$ will be
7282 expanded as if it were a $@splitrcskeyword{CVSHeader}$ keyword. If
7283 the src/frob.c file contained this keyword, it might
7284 look something like this:
7285
7286 @example
7287   /*
7288    * $@splitrcskeyword{MYBSD}: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $ 
7289    */
7290 @end example
7291
7292 Many repositories make use of a such a ``local
7293 keyword'' feature. An old patch to @sc{cvs} provided
7294 the @code{LocalKeyword} feature using a @code{tag=}
7295 option and called this the ``custom tag'' or ``local
7296 tag'' feature. It was used in conjunction with the
7297 what they called the @code{tagexpand=} option. In
7298 @sc{cvs} this other option is known as the
7299 @code{KeywordExpand} option. 
7300 See @ref{Configuring keyword expansion} for more
7301 details.
7302
7303 Examples from popular projects include:
7304 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7305 $@splitrcskeyword{OpenBSD}$, $@splitrcskeyword{XFree86}$,
7306 $@splitrcskeyword{Xorg}$.
7307
7308 The advantage of this is that you can include your
7309 local version information in a file using this local
7310 keyword without disrupting the upstream version
7311 information (which may be a different local keyword or
7312 a standard keyword). Allowing bug reports and the like
7313 to more properly identify the source of the original
7314 bug to the third-party and reducing the number of
7315 conflicts that arise during an import of a new version.
7316
7317 All keyword expansion except the local keyword may be
7318 disabled using the @code{KeywordExpand} option in
7319 the @file{CVSROOT/config} file---see 
7320 @ref{Configuring keyword expansion} for more details.
7321
7322 @end table
7323
7324 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7325 @node Using keywords
7326 @section Using keywords
7327
7328 To include a keyword string you simply include the
7329 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
7330 file, and commit the file.  @sc{cvs} will automatically (Or,
7331 more accurately, as part of the update run that
7332 automatically happens after a commit.)
7333 expand the string as part of the commit operation.
7334
7335 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
7336 the source files so that it gets passed through to
7337 generated files.  For example, if you are managing
7338 computer program source code, you might include a
7339 variable which is initialized to contain that string.
7340 Or some C compilers may provide a @code{#pragma ident}
7341 directive.  Or a document management system might
7342 provide a way to pass a string through to generated
7343 files.
7344
7345 @c Would be nice to give an example, but doing this in
7346 @c portable C is not possible and the problem with
7347 @c picking any one language (VMS HELP files, Ada,
7348 @c troff, whatever) is that people use CVS for all
7349 @c kinds of files.
7350
7351 @cindex Ident (shell command)
7352 The @code{ident} command (which is part of the @sc{rcs}
7353 package) can be used to extract keywords and their
7354 values from a file.  This can be handy for text files,
7355 but it is even more useful for extracting keywords from
7356 binary files.
7357
7358 @example
7359 $ ident samp.c
7360 samp.c:
7361      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7362 $ gcc samp.c
7363 $ ident a.out
7364 a.out:
7365      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7366 @end example
7367
7368 @cindex What (shell command)
7369 S@sc{ccs} is another popular revision control system.
7370 It has a command, @code{what}, which is very similar to
7371 @code{ident} and used for the same purpose.  Many sites
7372 without @sc{rcs} have @sc{sccs}.  Since @code{what}
7373 looks for the character sequence @code{@@(#)} it is
7374 easy to include keywords that are detected by either
7375 command.  Simply prefix the keyword with the
7376 magic @sc{sccs} phrase, like this:
7377
7378 @example
7379 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
7380 @end example
7381
7382 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7383 @node Avoiding substitution
7384 @section Avoiding substitution
7385
7386 Keyword substitution has its disadvantages.  Sometimes
7387 you might want the literal text string
7388 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
7389 @sc{cvs} interpreting it as a keyword and expanding it
7390 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
7391
7392 There is unfortunately no way to selectively turn off
7393 keyword substitution.  You can use @samp{-ko}
7394 (@pxref{Substitution modes}) to turn off keyword
7395 substitution entirely.
7396
7397 In many cases you can avoid using keywords in
7398 the source, even though they appear in the final
7399 product.  For example, the source for this manual
7400 contains @samp{$@@asis@{@}Author$} whenever the text
7401 @samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
7402 and @code{troff} you can embed the null-character
7403 @code{\&} inside the keyword for a similar effect.
7404
7405 It is also possible to specify an explicit list of
7406 keywords to include or exclude using the
7407 @code{KeywordExpand} option in the
7408 @file{CVSROOT/config} file--see @ref{Configuring keyword expansion}
7409 for more details. This feature is intended primarily
7410 for use with the @code{LocalKeyword} option--see
7411 @ref{Keyword list}.
7412
7413 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7414 @node Substitution modes
7415 @section Substitution modes
7416 @cindex Keyword substitution, changing modes
7417 @cindex -k (keyword substitution)
7418 @cindex Kflag
7419
7420 @c FIXME: This could be made more coherent, by expanding it
7421 @c with more examples or something.
7422 Each file has a stored default substitution mode, and
7423 each working directory copy of a file also has a
7424 substitution mode.  The former is set by the @samp{-k}
7425 option to @code{cvs add} and @code{cvs admin}; the
7426 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7427 checkout} or @code{cvs update}.
7428 @code{cvs diff} and @code{cvs rdiff} also
7429 have @samp{-k} options.
7430 For some examples,
7431 see @ref{Binary files}, and @ref{Merging and keywords}.
7432 @c The fact that -A is overloaded to mean both reset
7433 @c sticky options and reset sticky tags/dates is
7434 @c somewhat questionable.  Perhaps there should be
7435 @c separate options to reset sticky options (e.g. -k
7436 @c A") and tags/dates (someone suggested -r HEAD could
7437 @c do this instead of setting a sticky tag of "HEAD"
7438 @c as in the status quo but I haven't thought much
7439 @c about that idea.  Of course -r .reset or something
7440 @c could be coined if this needs to be a new option).
7441 @c On the other hand, having -A mean "get things back
7442 @c into the state after a fresh checkout" has a certain
7443 @c appeal, and maybe there is no sufficient reason for
7444 @c creeping featurism in this area.
7445
7446 The modes available are:
7447
7448 @table @samp
7449 @item -kkv
7450 Generate keyword strings using the default form, e.g.
7451 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7452 keyword.
7453
7454 @item -kkvl
7455 Like @samp{-kkv}, except that a locker's name is always
7456 inserted if the given revision is currently locked.
7457 The locker's name is only relevant if @code{cvs admin
7458 -l} is in use.
7459
7460 @item -kk
7461 Generate only keyword names in keyword strings; omit
7462 their values.  For example, for the @code{Revision}
7463 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7464 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7465 is useful to ignore differences due to keyword
7466 substitution when comparing different revisions of a
7467 file (@pxref{Merging and keywords}).
7468
7469 @item -ko
7470 Generate the old keyword string, present in the working
7471 file just before it was checked in.  For example, for
7472 the @code{Revision} keyword, generate the string
7473 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7474 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7475 string appeared when the file was checked in.
7476
7477 @item -kb
7478 Like @samp{-ko}, but also inhibit conversion of line
7479 endings between the canonical form in which they are
7480 stored in the repository (linefeed only), and the form
7481 appropriate to the operating system in use on the
7482 client.  For systems, like unix, which use linefeed
7483 only to terminate lines, this is very similar to
7484 @samp{-ko}.  For more information on binary files, see
7485 @ref{Binary files}.  In @sc{cvs} version 1.12.2 and later
7486 @samp{-kb}, as set by @code{cvs add}, @code{cvs admin}, or
7487 @code{cvs import} may not be overridden by a @samp{-k} option
7488 specified on the command line.
7489
7490 @item -kv
7491 Generate only keyword values for keyword strings.  For
7492 example, for the @code{Revision} keyword, generate the string
7493 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7494 This can help generate files in programming languages
7495 where it is hard to strip keyword delimiters like
7496 @code{$@splitrcskeyword{Revision}: $} from a string.  However,
7497 further keyword substitution cannot be performed once
7498 the keyword names are removed, so this option should be
7499 used with care.
7500
7501 One often would like to use @samp{-kv} with @code{cvs
7502 export}---@pxref{export}.  But be aware that doesn't
7503 handle an export containing binary files correctly.
7504
7505 @end table
7506
7507 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7508 @node Configuring keyword expansion
7509 @section Configuring Keyword Expansion
7510 @cindex Configuring keyword expansion
7511
7512 In a repository that includes third-party software on
7513 vendor branches, it is sometimes helpful to configure
7514 CVS to use a local keyword instead of the standard
7515 $@splitrcskeyword{Id}$ or $@splitrcskeyword{Header}$ keywords. Examples from
7516 real projects include $@splitrcskeyword{Xorg}$, $@splitrcskeyword{XFree86}$,
7517 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7518 $@splitrcskeyword{OpenBSD}$, and even $@splitrcskeyword{dotat}$.
7519 The advantage of this is that
7520 you can include your local version information in a
7521 file using this local keyword (sometimes called a
7522 ``custom tag'' or a ``local tag'') without disrupting
7523 the upstream version information (which may be a
7524 different local keyword or a standard keyword). In
7525 these cases, it is typically desirable to disable the
7526 expansion of all keywords except the configured local
7527 keyword.
7528
7529 The @code{KeywordExpand} option in the
7530 @file{CVSROOT/config} file is intended to allow for the
7531 either the explicit exclusion of a keyword or list of
7532 keywords, or for the explicit inclusion of a keyword or
7533 a list of keywords. This list may include the
7534 @code{LocalKeyword} that has been configured.
7535
7536 The @code{KeywordExpand} option is followed by
7537 @code{=} and the next character may either be @code{i}
7538 to start an inclusion list or @code{e} to start an
7539 exclusion list. If the following lines were added to
7540 the @file{CVSROOT/config} file:
7541
7542 @example
7543         # Add a "MyBSD" keyword and restrict keyword
7544         # expansion
7545         LocalKeyword=MyBSD=CVSHeader
7546         KeywordExpand=iMyBSD
7547 @end example
7548
7549 then only the $@splitrcskeyword{MyBSD}$ keyword would be expanded.
7550 A list may be used. The this example:
7551
7552 @example
7553         # Add a "MyBSD" keyword and restrict keyword
7554         # expansion to the MyBSD, Name and Date keywords.
7555         LocalKeyword=MyBSD=CVSHeader
7556         KeywordExpand=iMyBSD,Name,Date
7557 @end example
7558
7559 would allow $@splitrcskeyword{MyBSD}$, $@splitrcskeyword{Name}$, and
7560 $@splitrcskeyword{Date}$ to be expanded.
7561
7562 It is also possible to configure an exclusion list
7563 using the following:
7564
7565 @example
7566         # Do not expand the non-RCS keyword CVSHeader
7567         KeywordExpand=eCVSHeader
7568 @end example
7569
7570 This allows @sc{cvs} to ignore the recently introduced
7571 $@splitrcskeyword{CVSHeader}$ keyword and retain all of the
7572 others. The exclusion entry could also contain the
7573 standard RCS keyword list, but this could be confusing
7574 to users that expect RCS keywords to be expanded, so
7575 care should be taken to properly set user expectations
7576 for a repository that is configured in that manner.
7577
7578 If there is a desire to not have any RCS keywords
7579 expanded and not use the @code{-ko} flags everywhere,
7580 an administrator may disable all keyword expansion
7581 using the @file{CVSROOT/config} line:
7582
7583 @example
7584         # Do not expand any RCS keywords
7585         KeywordExpand=i
7586 @end example
7587
7588 this could be confusing to users that expect RCS
7589 keywords like $@splitrcskeyword{Id}$ to be expanded properly,
7590 so care should be taken to properly set user
7591 expectations for a repository so configured.
7592
7593 It should be noted that a patch to provide both the
7594 @code{KeywordExpand} and @code{LocalKeyword} features
7595 has been around a long time. However, that patch
7596 implemented these features using @code{tag=} and
7597 @code{tagexpand=} keywords and those keywords are NOT
7598 recognized.
7599
7600 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7601 @node Log keyword
7602 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7603
7604 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7605 controversial.  As long as you are working on your
7606 development system the information is easily accessible
7607 even if you do not use the @code{$@splitrcskeyword{Log}$}
7608 keyword---just do a @code{cvs log}.  Once you export
7609 the file the history information might be useless
7610 anyhow.
7611
7612 A more serious concern is that @sc{cvs} is not good at
7613 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7614 merged onto the main trunk.  Conflicts often result
7615 from the merging operation.
7616 @c Might want to check whether the CVS implementation
7617 @c of RCS_merge has this problem the same way rcsmerge
7618 @c does.  I would assume so....
7619
7620 People also tend to "fix" the log entries in the file
7621 (correcting spelling mistakes and maybe even factual
7622 errors).  If that is done the information from
7623 @code{cvs log} will not be consistent with the
7624 information inside the file.  This may or may not be a
7625 problem in real life.
7626
7627 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7628 keyword should be inserted @emph{last} in the file, and
7629 not in the files header, if it is to be used at all.
7630 That way the long list of change messages will not
7631 interfere with everyday source file browsing.
7632
7633 @c ---------------------------------------------------------------------
7634 @node Tracking sources
7635 @chapter Tracking third-party sources
7636 @cindex Third-party sources
7637 @cindex Tracking sources
7638
7639 @c FIXME: Need discussion of added and removed files.
7640 @c FIXME: This doesn't really adequately introduce the
7641 @c concepts of "vendor" and "you".  They don't *have*
7642 @c to be separate organizations or separate people.
7643 @c We want a description which is somewhat more based on
7644 @c the technical issues of which sources go where, but
7645 @c also with enough examples of how this relates to
7646 @c relationships like customer-supplier, developer-QA,
7647 @c maintainer-contributor, or whatever, to make it
7648 @c seem concrete.
7649 If you modify a program to better fit your site, you
7650 probably want to include your modifications when the next
7651 release of the program arrives.  @sc{cvs} can help you with
7652 this task.
7653
7654 @cindex Vendor
7655 @cindex Vendor branch
7656 @cindex Branch, vendor-
7657 In the terminology used in @sc{cvs}, the supplier of the
7658 program is called a @dfn{vendor}.  The unmodified
7659 distribution from the vendor is checked in on its own
7660 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
7661 1.1.1 for this use.
7662
7663 When you modify the source and commit it, your revision
7664 will end up on the main trunk.  When a new release is
7665 made by the vendor, you commit it on the vendor branch
7666 and copy the modifications onto the main trunk.
7667
7668 Use the @code{import} command to create and update
7669 the vendor branch.  When you import a new file,
7670 (usually) the vendor branch is made the `head' revision, so
7671 anyone that checks out a copy of the file gets that
7672 revision.  When a local modification is committed it is
7673 placed on the main trunk, and made the `head'
7674 revision.
7675
7676 @menu
7677 * First import::                Importing for the first time
7678 * Update imports::              Updating with the import command
7679 * Reverting local changes::     Reverting to the latest vendor release
7680 * Binary files in imports::     Binary files require special handling
7681 * Keywords in imports::         Keyword substitution might be undesirable
7682 * Multiple vendor branches::    What if you get sources from several places?
7683 @end menu
7684
7685 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7686 @node First import
7687 @section Importing for the first time
7688 @cindex Importing modules
7689
7690 @c Should mention naming conventions for vendor tags,
7691 @c release tags, and perhaps directory names.
7692 Use the @code{import} command to check in the sources
7693 for the first time.  When you use the @code{import}
7694 command to track third-party sources, the @dfn{vendor
7695 tag} and @dfn{release tags} are useful.  The
7696 @dfn{vendor tag} is a symbolic name for the branch
7697 (which is always 1.1.1, unless you use the @samp{-b
7698 @var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7699 @dfn{release tags} are symbolic names for a particular
7700 release, such as @samp{FSF_0_04}.
7701
7702 @c I'm not completely sure this belongs here.  But
7703 @c we need to say it _somewhere_ reasonably obvious; it
7704 @c is a common misconception among people first learning CVS
7705 Note that @code{import} does @emph{not} change the
7706 directory in which you invoke it.  In particular, it
7707 does not set up that directory as a @sc{cvs} working
7708 directory; if you want to work with the sources import
7709 them first and then check them out into a different
7710 directory (@pxref{Getting the source}).
7711
7712 @cindex wdiff (import example)
7713 Suppose you have the sources to a program called
7714 @code{wdiff} in a directory @file{wdiff-0.04},
7715 and are going to make private modifications that you
7716 want to be able to use even when new releases are made
7717 in the future.  You start by importing the source to
7718 your repository:
7719
7720 @example
7721 $ cd wdiff-0.04
7722 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7723 @end example
7724
7725 The vendor tag is named @samp{FSF_DIST} in the above
7726 example, and the only release tag assigned is
7727 @samp{WDIFF_0_04}.
7728 @c FIXME: Need to say where fsf/wdiff comes from.
7729
7730 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7731 @node Update imports
7732 @section Updating with the import command
7733
7734 When a new release of the source arrives, you import it into the
7735 repository with the same @code{import} command that you used to set up
7736 the repository in the first place.  The only difference is that you
7737 specify a different release tag this time:
7738
7739 @example
7740 $ tar xfz wdiff-0.05.tar.gz
7741 $ cd wdiff-0.05
7742 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7743 @end example
7744
7745 @strong{WARNING: If you use a release tag that already exists in one of the
7746 repository archives, files removed by an import may not be detected.}
7747
7748 For files that have not been modified locally, the newly created
7749 revision becomes the head revision.  If you have made local
7750 changes, @code{import} will warn you that you must merge the changes
7751 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7752
7753 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7754 @c "import"?  I think the assumption is that one has
7755 @c "wdiff fsf/wdiff" or some such in modules, but it
7756 @c would be better to not use modules in this example.
7757 @example
7758 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7759 @end example
7760
7761 @noindent
7762 The above command will check out the latest revision of
7763 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7764 since yesterday into the working copy.  If any conflicts arise during
7765 the merge they should be resolved in the normal way (@pxref{Conflicts
7766 example}).  Then, the modified files may be committed.
7767
7768 However, it is much better to use the two release tags rather than using
7769 a date on the branch as suggested above:
7770
7771 @example
7772 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7773 @end example
7774
7775 @noindent
7776 The reason this is better is that
7777 using a date, as suggested above, assumes that you do
7778 not import more than one release of a product per day.
7779 More importantly, using the release tags allows @sc{cvs} to detect files
7780 that were removed between the two vendor releases and mark them for
7781 removal.  Since @code{import} has no way to detect removed files, you
7782 should do a merge like this even if @code{import} doesn't tell you to.
7783
7784 @node Reverting local changes
7785 @section Reverting to the latest vendor release
7786
7787 You can also revert local changes completely and return
7788 to the latest vendor release by changing the `head'
7789 revision back to the vendor branch on all files.  For
7790 example, if you have a checked-out copy of the sources
7791 in @file{~/work.d/wdiff}, and you want to revert to the
7792 vendor's version for all the files in that directory,
7793 you would type:
7794
7795 @example
7796 $ cd ~/work.d/wdiff
7797 $ cvs admin -bFSF_DIST .
7798 @end example
7799
7800 @noindent
7801 You must specify the @samp{-bFSF_DIST} without any space
7802 after the @samp{-b}.  @xref{admin options}.
7803
7804 @node Binary files in imports
7805 @section How to handle binary files with cvs import
7806
7807 Use the @samp{-k} wrapper option to tell import which
7808 files are binary.  @xref{Wrappers}.
7809
7810 @node Keywords in imports
7811 @section How to handle keyword substitution with cvs import
7812
7813 The sources which you are importing may contain
7814 keywords (@pxref{Keyword substitution}).  For example,
7815 the vendor may use @sc{cvs} or some other system
7816 which uses similar keyword expansion syntax.  If you
7817 just import the files in the default fashion, then
7818 the keyword expansions supplied by the vendor will
7819 be replaced by keyword expansions supplied by your
7820 own copy of @sc{cvs}.  It may be more convenient to
7821 maintain the expansions supplied by the vendor, so
7822 that this information can supply information about
7823 the sources that you imported from the vendor.
7824
7825 To maintain the keyword expansions supplied by the
7826 vendor, supply the @samp{-ko} option to @code{cvs
7827 import} the first time you import the file.
7828 This will turn off keyword expansion
7829 for that file entirely, so if you want to be more
7830 selective you'll have to think about what you want
7831 and use the @samp{-k} option to @code{cvs update} or
7832 @code{cvs admin} as appropriate.
7833 @c Supplying -ko to import if the file already existed
7834 @c has no effect.  Not clear to me whether it should
7835 @c or not.
7836
7837 @node Multiple vendor branches
7838 @section Multiple vendor branches
7839
7840 All the examples so far assume that there is only one
7841 vendor from which you are getting sources.  In some
7842 situations you might get sources from a variety of
7843 places.  For example, suppose that you are dealing with
7844 a project where many different people and teams are
7845 modifying the software.  There are a variety of ways to
7846 handle this, but in some cases you have a bunch of
7847 source trees lying around and what you want to do more
7848 than anything else is just to all put them in @sc{cvs} so
7849 that you at least have them in one place.
7850
7851 For handling situations in which there may be more than
7852 one vendor, you may specify the @samp{-b} option to
7853 @code{cvs import}.  It takes as an argument the vendor
7854 branch to import to.  The default is @samp{-b 1.1.1}.
7855
7856 For example, suppose that there are two teams, the red
7857 team and the blue team, that are sending you sources.
7858 You want to import the red team's efforts to branch
7859 1.1.1 and use the vendor tag RED.  You want to import
7860 the blue team's efforts to branch 1.1.3 and use the
7861 vendor tag BLUE.  So the commands you might use are:
7862
7863 @example
7864 $ cvs import dir RED RED_1-0
7865 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7866 @end example
7867
7868 Note that if your vendor tag does not match your
7869 @samp{-b} option, @sc{cvs} will not detect this case!  For
7870 example,
7871
7872 @example
7873 $ cvs import -b 1.1.3 dir RED RED_1-0
7874 @end example
7875
7876 @noindent
7877 Be careful; this kind of mismatch is sure to sow
7878 confusion or worse.  I can't think of a useful purpose
7879 for the ability to specify a mismatch here, but if you
7880 discover such a use, don't.  @sc{cvs} is likely to make this
7881 an error in some future release.
7882
7883 @c Probably should say more about the semantics of
7884 @c multiple branches.  What about the default branch?
7885 @c What about joining (perhaps not as useful with
7886 @c multiple branches, or perhaps it is.  Either way
7887 @c should be mentioned).
7888
7889 @c I'm not sure about the best location for this.  In
7890 @c one sense, it might belong right after we've introduced
7891 @c CVS's basic version control model, because people need
7892 @c to figure out builds right away.  The current location
7893 @c is based on the theory that it kind of akin to the
7894 @c "Revision management" section.
7895 @node Builds
7896 @chapter How your build system interacts with CVS
7897 @cindex Builds
7898 @cindex make
7899
7900 As mentioned in the introduction, @sc{cvs} does not
7901 contain software for building your software from source
7902 code.  This section describes how various aspects of
7903 your build system might interact with @sc{cvs}.
7904
7905 @c Is there a way to discuss this without reference to
7906 @c tools other than CVS?  I'm not sure there is; I
7907 @c wouldn't think that people who learn CVS first would
7908 @c even have this concern.
7909 One common question, especially from people who are
7910 accustomed to @sc{rcs}, is how to make their build get
7911 an up to date copy of the sources.  The answer to this
7912 with @sc{cvs} is two-fold.  First of all, since
7913 @sc{cvs} itself can recurse through directories, there
7914 is no need to modify your @file{Makefile} (or whatever
7915 configuration file your build tool uses) to make sure
7916 each file is up to date.  Instead, just use two
7917 commands, first @code{cvs -q update} and then
7918 @code{make} or whatever the command is to invoke your
7919 build tool.  Secondly, you do not necessarily
7920 @emph{want} to get a copy of a change someone else made
7921 until you have finished your own work.  One suggested
7922 approach is to first update your sources, then
7923 implement, build and
7924 test the change you were thinking of, and then commit
7925 your sources (updating first if necessary).  By
7926 periodically (in between changes, using the approach
7927 just described) updating your entire tree, you ensure
7928 that your sources are sufficiently up to date.
7929
7930 @cindex Bill of materials
7931 One common need is to record which versions of which
7932 source files went into a particular build.  This kind
7933 of functionality is sometimes called @dfn{bill of
7934 materials} or something similar.  The best way to do
7935 this with @sc{cvs} is to use the @code{tag} command to
7936 record which versions went into a given build
7937 (@pxref{Tags}).
7938
7939 Using @sc{cvs} in the most straightforward manner
7940 possible, each developer will have a copy of the entire
7941 source tree which is used in a particular build.  If
7942 the source tree is small, or if developers are
7943 geographically dispersed, this is the preferred
7944 solution.  In fact one approach for larger projects is
7945 to break a project down into smaller
7946 @c I say subsystem instead of module because they may or
7947 @c may not use the modules file.
7948 separately-compiled subsystems, and arrange a way of
7949 releasing them internally so that each developer need
7950 check out only those subsystems which they are
7951 actively working on.
7952
7953 Another approach is to set up a structure which allows
7954 developers to have their own copies of some files, and
7955 for other files to access source files from a central
7956 location.  Many people have come up with some such a
7957 @c two such people are paul@sander.cupertino.ca.us (for
7958 @c a previous employer)
7959 @c and gunnar.tornblom@se.abb.com (spicm and related tools),
7960 @c but as far as I know
7961 @c no one has nicely packaged or released such a system (or
7962 @c instructions for constructing one).
7963 system using features such as the symbolic link feature
7964 found in many operating systems, or the @code{VPATH}
7965 feature found in many versions of @code{make}.  One build
7966 tool which is designed to help with this kind of thing
7967 is Odin (see
7968 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7969 @c Should we be saying more about Odin?  Or how you use
7970 @c it with CVS?  Also, the Prime Time Freeware for Unix
7971 @c disk (see http://www.ptf.com/) has Odin (with a nice
7972 @c paragraph summarizing it on the web), so that might be a
7973 @c semi-"official" place to point people.
7974 @c
7975 @c Of course, many non-CVS systems have this kind of
7976 @c functionality, for example OSF's ODE
7977 @c (http://www.osf.org/ode/) or mk
7978 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7979 @c He has changed providers in the past; a search engine search
7980 @c for "Peter Ziobrzynski" probably won't get too many
7981 @c spurious hits :-).  A more stable URL might be
7982 @c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7983 @c there is any point in mentioning them here unless they
7984 @c can work with CVS.
7985
7986 @c ---------------------------------------------------------------------
7987 @node Special Files
7988 @chapter Special Files
7989
7990 @cindex Special files
7991 @cindex Device nodes
7992 @cindex Ownership, saving in CVS
7993 @cindex Permissions, saving in CVS
7994 @cindex Hard links
7995 @cindex Symbolic links
7996
7997 In normal circumstances, @sc{cvs} works only with regular
7998 files.  Every file in a project is assumed to be
7999 persistent; it must be possible to open, read and close
8000 them; and so on.  @sc{cvs} also ignores file permissions and
8001 ownerships, leaving such issues to be resolved by the
8002 developer at installation time.  In other words, it is
8003 not possible to "check in" a device into a repository;
8004 if the device file cannot be opened, @sc{cvs} will refuse to
8005 handle it.  Files also lose their ownerships and
8006 permissions during repository transactions.
8007
8008 @ignore
8009 If the configuration variable @code{PreservePermissions}
8010 (@pxref{config}) is set in the repository, @sc{cvs} will
8011 save the following file characteristics in the
8012 repository:
8013
8014 @itemize @bullet
8015 @item user and group ownership
8016 @item permissions
8017 @item major and minor device numbers
8018 @item symbolic links
8019 @item hard link structure
8020 @end itemize
8021
8022 Using the @code{PreservePermissions} option affects the
8023 behavior of @sc{cvs} in several ways.  First, some of the
8024 new operations supported by @sc{cvs} are not accessible to
8025 all users.  In particular, file ownership and special
8026 file characteristics may only be changed by the
8027 superuser.  When the @code{PreservePermissions}
8028 configuration variable is set, therefore, users will
8029 have to be `root' in order to perform @sc{cvs} operations.
8030
8031 When @code{PreservePermissions} is in use, some @sc{cvs}
8032 operations (such as @samp{cvs status}) will not
8033 recognize a file's hard link structure, and so will
8034 emit spurious warnings about mismatching hard links.
8035 The reason is that @sc{cvs}'s internal structure does not
8036 make it easy for these operations to collect all the
8037 necessary data about hard links, so they check for file
8038 conflicts with inaccurate data.
8039
8040 A more subtle difference is that @sc{cvs} considers a file
8041 to have changed only if its contents have changed
8042 (specifically, if the modification time of the working
8043 file does not match that of the repository's file).
8044 Therefore, if only the permissions, ownership or hard
8045 linkage have changed, or if a device's major or minor
8046 numbers have changed, @sc{cvs} will not notice.  In order to
8047 commit such a change to the repository, you must force
8048 the commit with @samp{cvs commit -f}.  This also means
8049 that if a file's permissions have changed and the
8050 repository file is newer than the working copy,
8051 performing @samp{cvs update} will silently change the
8052 permissions on the working copy.
8053
8054 Changing hard links in a @sc{cvs} repository is particularly
8055 delicate.  Suppose that file @file{foo} is linked to
8056 file @file{old}, but is later relinked to file
8057 @file{new}.  You can wind up in the unusual situation
8058 where, although @file{foo}, @file{old} and @file{new}
8059 have all had their underlying link patterns changed,
8060 only @file{foo} and @file{new} have been modified, so
8061 @file{old} is not considered a candidate for checking
8062 in.  It can be very easy to produce inconsistent
8063 results this way.  Therefore, we recommend that when it
8064 is important to save hard links in a repository, the
8065 prudent course of action is to @code{touch} any file
8066 whose linkage or status has changed since the last
8067 checkin.  Indeed, it may be wise to @code{touch *}
8068 before each commit in a directory with complex hard
8069 link structures.
8070
8071 It is worth noting that only regular files may
8072 be merged, for reasons that hopefully are obvious.  If
8073 @samp{cvs update} or @samp{cvs checkout -j} attempts to
8074 merge a symbolic link with a regular file, or two
8075 device files for different kinds of devices, @sc{cvs} will
8076 report a conflict and refuse to perform the merge.  At
8077 the same time, @samp{cvs diff} will not report any
8078 differences between these files, since no meaningful
8079 textual comparisons can be made on files which contain
8080 no text.
8081
8082 The @code{PreservePermissions} features do not work
8083 with client/server @sc{cvs}.  Another limitation is
8084 that hard links must be to other files within the same
8085 directory; hard links across directories are not
8086 supported.
8087 @end ignore
8088
8089 @c ---------------------------------------------------------------------
8090 @c ----- START MAN 1 -----
8091 @node CVS commands
8092 @appendix Guide to CVS commands
8093
8094 This appendix describes the overall structure of
8095 @sc{cvs} commands, and describes some commands in
8096 detail (others are described elsewhere; for a quick
8097 reference to @sc{cvs} commands, @pxref{Invoking CVS}).
8098 @c The idea is that we want to move the commands which
8099 @c are described here into the main body of the manual,
8100 @c in the process reorganizing the manual to be
8101 @c organized around what the user wants to do, not
8102 @c organized around CVS commands.
8103 @c
8104 @c Note that many users do expect a manual which is
8105 @c organized by command.  At least some users do.
8106 @c One good addition to the "organized by command"
8107 @c section (if any) would be "see also" links.
8108 @c The awk manual might be a good example; it has a
8109 @c reference manual which is more verbose than Invoking
8110 @c CVS but probably somewhat less verbose than CVS
8111 @c Commands.
8112
8113 @menu
8114 * Structure::                   Overall structure of CVS commands
8115 * Exit status::                 Indicating CVS's success or failure
8116 * ~/.cvsrc::                    Default options with the ~/.cvsrc file
8117 * Global options::              Options you give to the left of cvs_command
8118 * Common options::              Options you give to the right of cvs_command
8119 * Date input formats::          Acceptable formats for date specifications
8120 * admin::                       Administration
8121 * annotate::                    What revision modified each line of a file?
8122 * checkout::                    Checkout sources for editing
8123 * commit::                      Check files into the repository
8124 * diff::                        Show differences between revisions
8125 * export::                      Export sources from CVS, similar to checkout
8126 * history::                     Show status of files and users
8127 * import::                      Import sources into CVS, using vendor branches
8128 * log::                         Show log messages for files
8129 * ls & rls::                    List files in the repository
8130 * rdiff::                       'patch' format diffs between releases
8131 * release::                     Indicate that a directory is no longer in use
8132 * server & pserver::            Act as a server for a client on stdin/stdout
8133 * update::                      Bring work tree in sync with repository
8134 @end menu
8135
8136 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8137 @node Structure
8138 @appendixsec Overall structure of CVS commands
8139 @cindex Structure
8140 @cindex CVS command structure
8141 @cindex Command structure
8142 @cindex Format of CVS commands
8143
8144 The overall format of all @sc{cvs} commands is:
8145
8146 @example
8147 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
8148 @end example
8149
8150 @table @code
8151 @item cvs
8152 The name of the @sc{cvs} program.
8153
8154 @item cvs_options
8155 Some options that affect all sub-commands of @sc{cvs}.  These are
8156 described below.
8157
8158 @item cvs_command
8159 One of several different sub-commands.  Some of the commands have
8160 aliases that can be used instead; those aliases are noted in the
8161 reference manual for that command.  There are only two situations
8162 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
8163 list of available commands, and @samp{cvs -v} displays version
8164 information on @sc{cvs} itself.
8165
8166 @item command_options
8167 Options that are specific for the command.
8168
8169 @item command_args
8170 Arguments to the commands.
8171 @end table
8172
8173 There is unfortunately some confusion between
8174 @code{cvs_options} and @code{command_options}.
8175 When given as a @code{cvs_option}, some options only
8176 affect some of the commands.  When given as a
8177 @code{command_option} it may have a different meaning, and
8178 be accepted by more commands.  In other words, do not
8179 take the above categorization too seriously.  Look at
8180 the documentation instead.
8181
8182 @node Exit status
8183 @appendixsec CVS's exit status
8184 @cindex Exit status, of CVS
8185
8186 @sc{cvs} can indicate to the calling environment whether it
8187 succeeded or failed by setting its @dfn{exit status}.
8188 The exact way of testing the exit status will vary from
8189 one operating system to another.  For example in a unix
8190 shell script the @samp{$?} variable will be 0 if the
8191 last command returned a successful exit status, or
8192 greater than 0 if the exit status indicated failure.
8193
8194 If @sc{cvs} is successful, it returns a successful status;
8195 if there is an error, it prints an error message and
8196 returns a failure status.  The one exception to this is
8197 the @code{cvs diff} command.  It will return a
8198 successful status if it found no differences, or a
8199 failure status if there were differences or if there
8200 was an error.  Because this behavior provides no good
8201 way to detect errors, in the future it is possible that
8202 @code{cvs diff} will be changed to behave like the
8203 other @sc{cvs} commands.
8204 @c It might seem like checking whether cvs -q diff
8205 @c produces empty or non-empty output can tell whether
8206 @c there were differences or not.  But it seems like
8207 @c there are cases with output but no differences
8208 @c (testsuite basica-8b).  It is not clear to me how
8209 @c useful it is for a script to be able to check
8210 @c whether there were differences.
8211 @c FIXCVS? In previous versions of CVS, cvs diff
8212 @c returned 0 for no differences, 1 for differences, or
8213 @c 2 for errors.  Is this behavior worth trying to
8214 @c bring back (but what does it mean for VMS?)?
8215
8216 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8217 @node ~/.cvsrc
8218 @appendixsec Default options and the ~/.cvsrc file
8219 @cindex .cvsrc file
8220 @cindex Option defaults
8221
8222 There are some @code{command_options} that are used so
8223 often that you might have set up an alias or some other
8224 means to make sure you always specify that option.  One
8225 example (the one that drove the implementation of the
8226 @file{.cvsrc} support, actually) is that many people find the
8227 default output of the @samp{diff} command to be very
8228 hard to read, and that either context diffs or unidiffs
8229 are much easier to understand.
8230
8231 The @file{~/.cvsrc} file is a way that you can add
8232 default options to @code{cvs_commands} within cvs,
8233 instead of relying on aliases or other shell scripts.
8234
8235 The format of the @file{~/.cvsrc} file is simple.  The
8236 file is searched for a line that begins with the same
8237 name as the @code{cvs_command} being executed.  If a
8238 match is found, then the remainder of the line is split
8239 up (at whitespace characters) into separate options and
8240 added to the command arguments @emph{before} any
8241 options from the command line.
8242
8243 If a command has two names (e.g., @code{checkout} and
8244 @code{co}), the official name, not necessarily the one
8245 used on the command line, will be used to match against
8246 the file.  So if this is the contents of the user's
8247 @file{~/.cvsrc} file:
8248
8249 @example
8250 log -N
8251 diff -uN
8252 rdiff -u
8253 update -Pd
8254 checkout -P
8255 release -d
8256 @end example
8257
8258 @noindent
8259 the command @samp{cvs checkout foo} would have the
8260 @samp{-P} option added to the arguments, as well as
8261 @samp{cvs co foo}.
8262
8263 With the example file above, the output from @samp{cvs
8264 diff foobar} will be in unidiff format.  @samp{cvs diff
8265 -c foobar} will provide context diffs, as usual.
8266 Getting "old" format diffs would be slightly more
8267 complicated, because @code{diff} doesn't have an option
8268 to specify use of the "old" format, so you would need
8269 @samp{cvs -f diff foobar}.
8270
8271 In place of the command name you can use @code{cvs} to
8272 specify global options (@pxref{Global options}).  For
8273 example the following line in @file{.cvsrc}
8274
8275 @example
8276 cvs -z6
8277 @end example
8278
8279 @noindent
8280 causes @sc{cvs} to use compression level 6.
8281
8282 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8283 @node Global options
8284 @appendixsec Global options
8285 @cindex Options, global
8286 @cindex Global options
8287 @cindex Left-hand options
8288
8289 The available @samp{cvs_options} (that are given to the
8290 left of @samp{cvs_command}) are:
8291
8292 @table @code
8293 @item --allow-root=@var{rootdir}
8294 May be invoked multiple times to specify one legal @sc{cvsroot} directory with
8295 each invocation.  Also causes CVS to preparse the configuration file for each
8296 specified root, which can be useful when configuring write proxies,  See
8297 @ref{Password authentication server} & @ref{Write proxies}.
8298
8299 @cindex Authentication, stream
8300 @cindex Stream authentication
8301 @item -a
8302 Authenticate all communication between the client and
8303 the server.  Only has an effect on the @sc{cvs} client.
8304 As of this writing, this is only implemented when using
8305 a GSSAPI connection (@pxref{GSSAPI authenticated}).
8306 Authentication prevents certain sorts of attacks
8307 involving hijacking the active @sc{tcp} connection.
8308 Enabling authentication does not enable encryption.
8309
8310 @cindex RCSBIN, overriding
8311 @cindex Overriding RCSBIN
8312 @item -b @var{bindir}
8313 In @sc{cvs} 1.9.18 and older, this specified that
8314 @sc{rcs} programs are in the @var{bindir} directory.
8315 Current versions of @sc{cvs} do not run @sc{rcs}
8316 programs; for compatibility this option is accepted,
8317 but it does nothing.
8318
8319 @cindex TMPDIR, environment variable
8320 @cindex temporary file directory, set via command line
8321 @cindex temporary file directory, set via environment variable
8322 @cindex temporary file directory, set via config
8323 @cindex temporary files, location of
8324 @item -T @var{tempdir}
8325 Use @var{tempdir} as the directory where temporary files are
8326 located.
8327
8328 The @sc{cvs} client and server store temporary files in a temporary directory.
8329 The path to this temporary directory is set via, in order of precedence:
8330
8331 @itemize @bullet
8332 @item
8333 The argument to the global @samp{-T} option.
8334
8335 @item
8336 The value set for @code{TmpDir} in the config file (server only -
8337 @pxref{config}).
8338
8339 @item
8340 The contents of the @code{$TMPDIR} environment variable (@code{%TMPDIR%} on
8341 Windows - @pxref{Environment variables}).
8342
8343 @item
8344 /tmp
8345
8346 @end itemize
8347
8348 Temporary directories should always be specified as an absolute pathname.
8349 When running a CVS client, @samp{-T} affects only the local process;
8350 specifying @samp{-T} for the client has no effect on the server and
8351 vice versa.
8352
8353 @cindex CVSROOT, overriding
8354 @cindex Overriding CVSROOT
8355 @item -d @var{cvs_root_directory}
8356 Use @var{cvs_root_directory} as the root directory
8357 pathname of the repository.  Overrides the setting of
8358 the @code{$CVSROOT} environment variable.  @xref{Repository}.
8359
8360 @cindex EDITOR, overriding
8361 @cindex Overriding EDITOR
8362 @item -e @var{editor}
8363 Use @var{editor} to enter revision log information.  Overrides the
8364 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
8365 environment variables.  For more information, see
8366 @ref{Committing your changes}.
8367
8368 @item -f
8369 Do not read the @file{~/.cvsrc} file.  This
8370 option is most often used because of the
8371 non-orthogonality of the @sc{cvs} option set.  For
8372 example, the @samp{cvs log} option @samp{-N} (turn off
8373 display of tag names) does not have a corresponding
8374 option to turn the display on.  So if you have
8375 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
8376 you may need to use @samp{-f} to show the tag names.
8377
8378 @item -H
8379 @itemx --help
8380 Display usage information about the specified @samp{cvs_command}
8381 (but do not actually execute the command).  If you don't specify
8382 a command name, @samp{cvs -H} displays overall help for
8383 @sc{cvs}, including a list of other help options.
8384 @c It seems to me it is better to document it this way
8385 @c rather than trying to update this documentation
8386 @c every time that we add a --help-foo option.  But
8387 @c perhaps that is confusing...
8388
8389 @cindex Read-only repository mode
8390 @item -R
8391 Turns on read-only repository mode.  This allows one to check out from a
8392 read-only repository, such as within an anoncvs server, or from a @sc{cd-rom}
8393 repository.
8394
8395 Same effect as if the @code{CVSREADONLYFS} environment
8396 variable is set. Using @samp{-R} can also considerably
8397 speed up checkouts over NFS.
8398
8399 @cindex Read-only mode
8400 @item -n
8401 Do not change any files.  Attempt to execute the
8402 @samp{cvs_command}, but only to issue reports; do not remove,
8403 update, or merge any existing files, or create any new files.
8404
8405 Note that @sc{cvs} will not necessarily produce exactly
8406 the same output as without @samp{-n}.  In some cases
8407 the output will be the same, but in other cases
8408 @sc{cvs} will skip some of the processing that would
8409 have been required to produce the exact same output.
8410
8411 @item -Q
8412 Cause the command to be really quiet; the command will only
8413 generate output for serious problems.
8414
8415 @item -q
8416 Cause the command to be somewhat quiet; informational messages,
8417 such as reports of recursion through subdirectories, are
8418 suppressed.
8419
8420 @cindex Read-only files, and -r
8421 @item -r
8422 Make new working files read-only.  Same effect
8423 as if the @code{$CVSREAD} environment variable is set
8424 (@pxref{Environment variables}).  The default is to
8425 make working files writable, unless watches are on
8426 (@pxref{Watches}).
8427
8428 @item -s @var{variable}=@var{value}
8429 Set a user variable (@pxref{Variables}).
8430
8431 @cindex Trace
8432 @item -t
8433 Trace program execution; display messages showing the steps of
8434 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
8435 potential impact of an unfamiliar command.
8436
8437 @item -v
8438 @item --version
8439 Display version and copyright information for @sc{cvs}.
8440
8441 @cindex CVSREAD, overriding
8442 @cindex Overriding CVSREAD
8443 @item -w
8444 Make new working files read-write.  Overrides the
8445 setting of the @code{$CVSREAD} environment variable.
8446 Files are created read-write by default, unless @code{$CVSREAD} is
8447 set or @samp{-r} is given.
8448 @c Note that -w only overrides -r and CVSREAD; it has
8449 @c no effect on files which are readonly because of
8450 @c "cvs watch on".  My guess is that is the way it
8451 @c should be (or should "cvs -w get" on a watched file
8452 @c be the same as a get and a cvs edit?), but I'm not
8453 @c completely sure whether to document it this way.
8454
8455 @item -x
8456 @cindex Encryption
8457 Encrypt all communication between the client and the
8458 server.  Only has an effect on the @sc{cvs} client.  As
8459 of this writing, this is only implemented when using a
8460 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
8461 Kerberos connection (@pxref{Kerberos authenticated}).
8462 Enabling encryption implies that message traffic is
8463 also authenticated.  Encryption support is not
8464 available by default; it must be enabled using a
8465 special configure option, @file{--enable-encryption},
8466 when you build @sc{cvs}.
8467
8468 @item -z @var{level}
8469 @cindex Compression
8470 @cindex Gzip
8471 Request compression @var{level} for network traffic.
8472 @sc{cvs} interprets @var{level} identically to the @code{gzip} program.
8473 Valid levels are 1 (high speed, low compression) to
8474 9 (low speed, high compression), or 0 to disable
8475 compression (the default).  Data sent to the server will
8476 be compressed at the requested level and the client will request
8477 the server use the same compression level for data returned.  The
8478 server will use the closest level allowed by the server administrator to
8479 compress returned data.  This option only has an effect when passed to
8480 the @sc{cvs} client.
8481 @end table
8482
8483 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8484 @node Common options
8485 @appendixsec Common command options
8486 @cindex Common options
8487 @cindex Right-hand options
8488
8489 This section describes the @samp{command_options} that
8490 are available across several @sc{cvs} commands.  These
8491 options are always given to the right of
8492 @samp{cvs_command}. Not all
8493 commands support all of these options; each option is
8494 only supported for commands where it makes sense.
8495 However, when a command has one of these options you
8496 can almost always count on the same behavior of the
8497 option as in other commands.  (Other command options,
8498 which are listed with the individual commands, may have
8499 different behavior from one @sc{cvs} command to the other).
8500
8501 @strong{Note: the @samp{history} command is an exception; it supports
8502 many options that conflict even with these standard options.}
8503
8504 @table @code
8505 @cindex Dates
8506 @cindex Time
8507 @cindex Specifying dates
8508 @item -D @var{date_spec}
8509 Use the most recent revision no later than @var{date_spec}.
8510 @var{date_spec} is a single argument, a date description
8511 specifying a date in the past.
8512
8513 The specification is @dfn{sticky} when you use it to make a
8514 private copy of a source file; that is, when you get a working
8515 file using @samp{-D}, @sc{cvs} records the date you specified, so that
8516 further updates in the same directory will use the same date
8517 (for more information on sticky tags/dates, @pxref{Sticky tags}).
8518
8519 @samp{-D} is available with the @code{annotate}, @code{checkout},
8520 @code{diff}, @code{export}, @code{history}, @code{ls},
8521 @code{rdiff}, @code{rls}, @code{rtag}, @code{tag}, and @code{update} commands.
8522 (The @code{history} command uses this option in a
8523 slightly different way; @pxref{history options}).
8524
8525 For a complete description of the date formats accepted by @sc{cvs},
8526 @ref{Date input formats}.
8527 @c What other formats should we accept?  I don't want
8528 @c to start accepting a whole mess of non-standard
8529 @c new formats (there are a lot which are in wide use in
8530 @c one context or another), but practicality does
8531 @c dictate some level of flexibility.
8532 @c * POSIX.2 (e.g. touch, ls output, date) and other
8533 @c POSIX and/or de facto unix standards (e.g. at).  The
8534 @c practice here is too inconsistent to be of any use.
8535 @c * VMS dates.  This is not a formal standard, but
8536 @c there is a published specification (see SYS$ASCTIM
8537 @c and SYS$BINTIM in the _VMS System Services Reference
8538 @c Manual_), it is implemented consistently in VMS
8539 @c utilities, and VMS users will expect CVS running on
8540 @c VMS to support this format (and if we're going to do
8541 @c that, better to make CVS support it on all
8542 @c platforms.  Maybe).
8543 @c
8544 @c One more note: In output, CVS should consistently
8545 @c use one date format, and that format should be one that
8546 @c it accepts in input as well.  The former isn't
8547 @c really true (see survey below), and I'm not
8548 @c sure that either of those formats is accepted in
8549 @c input.
8550 @c
8551 @c cvs log
8552 @c   current 1996/01/02 13:45:31
8553 @c   Internet 02 Jan 1996 13:45:31 UT
8554 @c   ISO 1996-01-02 13:45:31
8555 @c cvs ann
8556 @c   current 02-Jan-96
8557 @c   Internet-like 02 Jan 96
8558 @c   ISO 96-01-02
8559 @c cvs status
8560 @c   current Tue Jun 11 02:54:53 1996
8561 @c   Internet [Tue,] 11 Jun 1996 02:54:53
8562 @c   ISO 1996-06-11 02:54:53
8563 @c   note: date possibly should be omitted entirely for
8564 @c   other reasons.
8565 @c cvs editors
8566 @c   current Tue Jun 11 02:54:53 1996 GMT
8567 @c cvs history
8568 @c   current 06/11 02:54 +0000
8569 @c any others?
8570 @c There is a good chance the proper solution has to
8571 @c involve at least some level of letting the user
8572 @c decide which format (with the default being the
8573 @c formats CVS has always used; changing these might be
8574 @c _very_ disruptive since scripts may very well be
8575 @c parsing them).
8576 @c
8577 @c Another random bit of prior art concerning dates is
8578 @c the strptime function which takes templates such as
8579 @c "%m/%d/%y", and apparent a variant of getdate()
8580 @c which also honors them.  See
8581 @c X/Open CAE Specification, System Interfaces and
8582 @c Headers Issue 4, Version 2 (September 1994), in the
8583 @c entry for getdate() on page 231
8584
8585 Remember to quote the argument to the @samp{-D}
8586 flag so that your shell doesn't interpret spaces as
8587 argument separators.  A command using the @samp{-D}
8588 flag can look like this:
8589
8590 @example
8591 $ cvs diff -D "1 hour ago" cvs.texinfo
8592 @end example
8593
8594 @cindex Forcing a tag match
8595 @item -f
8596 When you specify a particular date or tag to @sc{cvs} commands, they
8597 normally ignore files that do not contain the tag (or did not
8598 exist prior to the date) that you specified.  Use the @samp{-f} option
8599 if you want files retrieved even when there is no match for the
8600 tag or date.  (The most recent revision of the file
8601 will be used).
8602
8603 Note that even with @samp{-f}, a tag that you specify
8604 must exist (that is, in some file, not necessary in
8605 every file).  This is so that @sc{cvs} will continue to
8606 give an error if you mistype a tag name.
8607
8608 @need 800
8609 @samp{-f} is available with these commands:
8610 @code{annotate}, @code{checkout}, @code{export},
8611 @code{rdiff}, @code{rtag}, and @code{update}.
8612
8613 @strong{WARNING:  The @code{commit} and @code{remove}
8614 commands also have a
8615 @samp{-f} option, but it has a different behavior for
8616 those commands.  See @ref{commit options}, and
8617 @ref{Removing files}.}
8618
8619 @item -k @var{kflag}
8620 Override the default processing of RCS keywords other than
8621 @samp{-kb}.  @xref{Keyword substitution}, for the meaning of
8622 @var{kflag}.  Used with the @code{checkout} and @code{update}
8623 commands, your @var{kflag} specification is
8624 @dfn{sticky}; that is, when you use this option
8625 with a @code{checkout} or @code{update} command,
8626 @sc{cvs} associates your selected @var{kflag} with any files
8627 it operates on, and continues to use that @var{kflag} with future
8628 commands on the same files until you specify otherwise.
8629
8630 The @samp{-k} option is available with the @code{add},
8631 @code{checkout}, @code{diff}, @code{export}, @code{import},
8632 @code{rdiff}, and @code{update} commands.
8633
8634 @strong{WARNING: Prior to CVS version 1.12.2, the @samp{-k} flag
8635 overrode the @samp{-kb} indication for a binary file.  This could
8636 sometimes corrupt binary files.  @xref{Merging and keywords}, for
8637 more.}
8638
8639 @item -l
8640 Local; run only in current working directory, rather than
8641 recursing through subdirectories.
8642
8643 Available with the following commands: @code{annotate}, @code{checkout},
8644 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8645 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8646 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8647 and @code{watchers}.
8648
8649 @cindex Editor, avoiding invocation of
8650 @cindex Avoiding editor invocation
8651 @item -m @var{message}
8652 Use @var{message} as log information, instead of
8653 invoking an editor.
8654
8655 Available with the following commands: @code{add},
8656 @code{commit} and @code{import}.
8657
8658 @item -n
8659 Do not run any tag program.  (A program can be
8660 specified to run in the modules
8661 database (@pxref{modules}); this option bypasses it).
8662
8663 @strong{Note: this is not the same as the @samp{cvs -n}
8664 program option, which you can specify to the left of a cvs command!}
8665
8666 Available with the @code{checkout}, @code{commit}, @code{export},
8667 and @code{rtag} commands.
8668
8669 @item -P
8670 Prune empty directories.  See @ref{Removing directories}.
8671
8672 @item -p
8673 Pipe the files retrieved from the repository to standard output,
8674 rather than writing them in the current directory.  Available
8675 with the @code{checkout} and @code{update} commands.
8676
8677 @item -R
8678 Process directories recursively.  This is the default for all @sc{cvs}
8679 commands, with the exception of @code{ls} & @code{rls}.
8680
8681 Available with the following commands: @code{annotate}, @code{checkout},
8682 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8683 @code{ls}, @code{rdiff}, @code{remove}, @code{rls}, @code{rtag},
8684 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8685 and @code{watchers}.
8686
8687 @item -r @var{tag}
8688 @item -r @var{tag}[:@var{date}]
8689 @cindex HEAD, special tag
8690 @cindex BASE, special tag
8691 Use the revision specified by the @var{tag} argument (and the @var{date}
8692 argument for the commands which accept it) instead of the
8693 default @dfn{head} revision.  As well as arbitrary tags defined
8694 with the @code{tag} or @code{rtag} command, two special tags are
8695 always available: @samp{HEAD} refers to the most recent version
8696 available in the repository, and @samp{BASE} refers to the
8697 revision you last checked out into the current working directory.
8698
8699 @c FIXME: What does HEAD really mean?  I believe that
8700 @c the current answer is the head of the default branch
8701 @c for all cvs commands except diff.  For diff, it
8702 @c seems to be (a) the head of the trunk (or the default
8703 @c branch?) if there is no sticky tag, (b) the head of the
8704 @c branch for the sticky tag, if there is a sticky tag.
8705 @c (b) is ugly as it differs
8706 @c from what HEAD means for other commands, but people
8707 @c and/or scripts are quite possibly used to it.
8708 @c See "head" tests in sanity.sh.
8709 @c Probably the best fix is to introduce two new
8710 @c special tags, ".thead" for the head of the trunk,
8711 @c and ".bhead" for the head of the current branch.
8712 @c Then deprecate HEAD.  This has the advantage of
8713 @c not surprising people with a change to HEAD, and a
8714 @c side benefit of also phasing out the poorly-named
8715 @c HEAD (see discussion of reserved tag names in node
8716 @c "Tags").  Of course, .thead and .bhead should be
8717 @c carefully implemented (with the implementation the
8718 @c same for "diff" as for everyone else), test cases
8719 @c written (similar to the ones in "head"), new tests
8720 @c cases written for things like default branches, &c.
8721
8722 The tag specification is sticky when you use this
8723 with @code{checkout} or @code{update} to make your own
8724 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8725 future update commands, until you specify otherwise (for more information
8726 on sticky tags/dates, @pxref{Sticky tags}).
8727
8728 The tag can be either a symbolic or numeric tag, as
8729 described in @ref{Tags}, or the name of a branch, as
8730 described in @ref{Branching and merging}.
8731 When @var{tag} is the name of a
8732 branch, some commands accept the optional @var{date} argument to specify
8733 the revision as of the given date on the branch.
8734 When a command expects a specific revision,
8735 the name of a branch is interpreted as the most recent
8736 revision on that branch.
8737
8738 Specifying the @samp{-q} global option along with the
8739 @samp{-r} command option is often useful, to suppress
8740 the warning messages when the @sc{rcs} file
8741 does not contain the specified tag.
8742
8743 @strong{Note: this is not the same as the overall @samp{cvs -r} option,
8744 which you can specify to the left of a @sc{cvs} command!}
8745
8746 @samp{-r @var{tag}} is available with the @code{commit} and @code{history}
8747 commands.
8748
8749 @samp{-r @var{tag}[:@var{date}]} is available with the @code{annotate},
8750 @code{checkout}, @code{diff}, @code{export}, @code{rdiff}, @code{rtag},
8751 and @code{update} commands.
8752
8753 @item -W
8754 Specify file names that should be filtered.  You can
8755 use this option repeatedly.  The spec can be a file
8756 name pattern of the same type that you can specify in
8757 the @file{.cvswrappers} file.
8758 Available with the following commands: @code{import},
8759 and @code{update}.
8760
8761 @end table
8762
8763 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8764 @include getdate-cvs.texi
8765
8766 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8767 @node admin
8768 @appendixsec admin---Administration
8769 @cindex Admin (subcommand)
8770
8771 @itemize @bullet
8772 @item
8773 Requires: repository, working directory.
8774 @item
8775 Changes: repository.
8776 @item
8777 Synonym: rcs
8778 @end itemize
8779
8780 This is the @sc{cvs} interface to assorted
8781 administrative facilities.  Some of them have
8782 questionable usefulness for @sc{cvs} but exist for
8783 historical purposes.  Some of the questionable options
8784 are likely to disappear in the future.  This command
8785 @emph{does} work recursively, so extreme care should be
8786 used.
8787
8788 @cindex cvsadmin
8789 @cindex UserAdminOptions, in CVSROOT/config
8790 On unix, if there is a group named @code{cvsadmin},
8791 only members of that group can run @code{cvs admin}
8792 commands, except for those specified using the
8793 @code{UserAdminOptions} configuration option in the
8794 @file{CVSROOT/config} file.  Options specified using
8795 @code{UserAdminOptions} can be run by any user.  See
8796 @ref{config} for more on @code{UserAdminOptions}.
8797
8798 The @code{cvsadmin} group should exist on the server,
8799 or any system running the non-client/server @sc{cvs}.
8800 To disallow @code{cvs admin} for all users, create a
8801 group with no users in it.  On NT, the @code{cvsadmin}
8802 feature does not exist and all users
8803 can run @code{cvs admin}.
8804
8805 @menu
8806 * admin options::               admin options
8807 @end menu
8808
8809 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8810 @node admin options
8811 @appendixsubsec admin options
8812
8813 Some of these options have questionable usefulness for
8814 @sc{cvs} but exist for historical purposes.  Some even
8815 make it impossible to use @sc{cvs} until you undo the
8816 effect!
8817
8818 @table @code
8819 @item -A@var{oldfile}
8820 Might not work together with @sc{cvs}.  Append the
8821 access list of @var{oldfile} to the access list of the
8822 @sc{rcs} file.
8823
8824 @item -a@var{logins}
8825 Might not work together with @sc{cvs}.  Append the
8826 login names appearing in the comma-separated list
8827 @var{logins} to the access list of the @sc{rcs} file.
8828
8829 @item -b[@var{rev}]
8830 Set the default branch to @var{rev}.  In @sc{cvs}, you
8831 normally do not manipulate default branches; sticky
8832 tags (@pxref{Sticky tags}) are a better way to decide
8833 which branch you want to work on.  There is one reason
8834 to run @code{cvs admin -b}: to revert to the vendor's
8835 version when using vendor branches (@pxref{Reverting
8836 local changes}).
8837 There can be no space between @samp{-b} and its argument.
8838 @c Hmm, we don't document the usage where rev is
8839 @c omitted.  Maybe that usage can/should be deprecated
8840 @c (and replaced with -bHEAD or something?) (so we can toss
8841 @c the optional argument).  Note that -bHEAD does not
8842 @c work, as of 17 Sep 1997, but probably will once "cvs
8843 @c admin" is internal to CVS.
8844
8845 @cindex Comment leader
8846 @item -c@var{string}
8847 Sets the comment leader to @var{string}.  The comment
8848 leader is not used by current versions of @sc{cvs} or
8849 @sc{rcs} 5.7.  Therefore, you can almost surely not
8850 worry about it.  @xref{Keyword substitution}.
8851
8852 @item -e[@var{logins}]
8853 Might not work together with @sc{cvs}.  Erase the login
8854 names appearing in the comma-separated list
8855 @var{logins} from the access list of the RCS file.  If
8856 @var{logins} is omitted, erase the entire access list.
8857 There can be no space between @samp{-e} and its argument.
8858
8859 @item -I
8860 Run interactively, even if the standard input is not a
8861 terminal.  This option does not work with the
8862 client/server @sc{cvs} and is likely to disappear in
8863 a future release of @sc{cvs}.
8864
8865 @item -i
8866 Useless with @sc{cvs}.  This creates and initializes a
8867 new @sc{rcs} file, without depositing a revision.  With
8868 @sc{cvs}, add files with the @code{cvs add} command
8869 (@pxref{Adding files}).
8870
8871 @item -k@var{subst}
8872 Set the default keyword
8873 substitution to @var{subst}.  @xref{Keyword
8874 substitution}.  Giving an explicit @samp{-k} option to
8875 @code{cvs update}, @code{cvs export}, or @code{cvs
8876 checkout} overrides this default.
8877
8878 @item -l[@var{rev}]
8879 Lock the revision with number @var{rev}.  If a branch
8880 is given, lock the latest revision on that branch.  If
8881 @var{rev} is omitted, lock the latest revision on the
8882 default branch.  There can be no space between
8883 @samp{-l} and its argument.
8884
8885 This can be used in conjunction with the
8886 @file{rcslock.pl} script in the @file{contrib}
8887 directory of the @sc{cvs} source distribution to
8888 provide reserved checkouts (where only one user can be
8889 editing a given file at a time).  See the comments in
8890 that file for details (and see the @file{README} file
8891 in that directory for disclaimers about the unsupported
8892 nature of contrib).  According to comments in that
8893 file, locking must set to strict (which is the default).
8894
8895 @item -L
8896 Set locking to strict.  Strict locking means that the
8897 owner of an RCS file is not exempt from locking for
8898 checkin.  For use with @sc{cvs}, strict locking must be
8899 set; see the discussion under the @samp{-l} option above.
8900
8901 @cindex Changing a log message
8902 @cindex Replacing a log message
8903 @cindex Correcting a log message
8904 @cindex Fixing a log message
8905 @cindex Log message, correcting
8906 @item -m@var{rev}:@var{msg}
8907 Replace the log message of revision @var{rev} with
8908 @var{msg}.
8909
8910 @c The rcs -M option, to suppress sending mail, has never been
8911 @c documented as a cvs admin option.
8912
8913 @item -N@var{name}[:[@var{rev}]]
8914 Act like @samp{-n}, except override any previous
8915 assignment of @var{name}.  For use with magic branches,
8916 see @ref{Magic branch numbers}.
8917
8918 @item -n@var{name}[:[@var{rev}]]
8919 Associate the symbolic name @var{name} with the branch
8920 or revision @var{rev}.  It is normally better to use
8921 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8922 symbolic name if both @samp{:} and @var{rev} are
8923 omitted; otherwise, print an error message if
8924 @var{name} is already associated with another number.
8925 If @var{rev} is symbolic, it is expanded before
8926 association.  A @var{rev} consisting of a branch number
8927 followed by a @samp{.} stands for the current latest
8928 revision in the branch.  A @samp{:} with an empty
8929 @var{rev} stands for the current latest revision on the
8930 default branch, normally the trunk.  For example,
8931 @samp{cvs admin -n@var{name}:} associates @var{name} with the
8932 current latest revision of all the RCS files;
8933 this contrasts with @samp{cvs admin -n@var{name}:$} which
8934 associates @var{name} with the revision numbers
8935 extracted from keyword strings in the corresponding
8936 working files.
8937
8938 @cindex Deleting revisions
8939 @cindex Outdating revisions
8940 @cindex Saving space
8941 @item -o@var{range}
8942 Deletes (@dfn{outdates}) the revisions given by
8943 @var{range}.
8944
8945 Note that this command can be quite dangerous unless
8946 you know @emph{exactly} what you are doing (for example
8947 see the warnings below about how the
8948 @var{rev1}:@var{rev2} syntax is confusing).
8949
8950 If you are short on disc this option might help you.
8951 But think twice before using it---there is no way short
8952 of restoring the latest backup to undo this command!
8953 If you delete different revisions than you planned,
8954 either due to carelessness or (heaven forbid) a @sc{cvs}
8955 bug, there is no opportunity to correct the error
8956 before the revisions are deleted.  It probably would be
8957 a good idea to experiment on a copy of the repository
8958 first.
8959
8960 Specify @var{range} in one of the following ways:
8961
8962 @table @code
8963 @item @var{rev1}::@var{rev2}
8964 Collapse all revisions between rev1 and rev2, so that
8965 @sc{cvs} only stores the differences associated with going
8966 from rev1 to rev2, not intermediate steps.  For
8967 example, after @samp{-o 1.3::1.5} one can retrieve
8968 revision 1.3, revision 1.5, or the differences to get
8969 from 1.3 to 1.5, but not the revision 1.4, or the
8970 differences between 1.3 and 1.4.  Other examples:
8971 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8972 effect, because there are no intermediate revisions to
8973 remove.
8974
8975 @item ::@var{rev}
8976 Collapse revisions between the beginning of the branch
8977 containing @var{rev} and @var{rev} itself.  The
8978 branchpoint and @var{rev} are left intact.  For
8979 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8980 revision 1.3.2.5, and everything in between, but leaves
8981 1.3 and 1.3.2.6 intact.
8982
8983 @item @var{rev}::
8984 Collapse revisions between @var{rev} and the end of the
8985 branch containing @var{rev}.  Revision @var{rev} is
8986 left intact but the head revision is deleted.
8987
8988 @item @var{rev}
8989 Delete the revision @var{rev}.  For example, @samp{-o
8990 1.3} is equivalent to @samp{-o 1.2::1.4}.
8991
8992 @item @var{rev1}:@var{rev2}
8993 Delete the revisions from @var{rev1} to @var{rev2},
8994 inclusive, on the same branch.  One will not be able to
8995 retrieve @var{rev1} or @var{rev2} or any of the
8996 revisions in between.  For example, the command
8997 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8998 It means to delete revisions up to, and including, the
8999 tag R_1_02.  But beware!  If there are files that have not
9000 changed between R_1_02 and R_1_03 the file will have
9001 @emph{the same} numerical revision number assigned to
9002 the tags R_1_02 and R_1_03.  So not only will it be
9003 impossible to retrieve R_1_02; R_1_03 will also have to
9004 be restored from the tapes!  In most cases you want to
9005 specify @var{rev1}::@var{rev2} instead.
9006
9007 @item :@var{rev}
9008 Delete revisions from the beginning of the
9009 branch containing @var{rev} up to and including
9010 @var{rev}.
9011
9012 @item @var{rev}:
9013 Delete revisions from revision @var{rev}, including
9014 @var{rev} itself, to the end of the branch containing
9015 @var{rev}.
9016 @end table
9017
9018 None of the revisions to be deleted may have
9019 branches or locks.
9020
9021 If any of the revisions to be deleted have symbolic
9022 names, and one specifies one of the @samp{::} syntaxes,
9023 then @sc{cvs} will give an error and not delete any
9024 revisions.  If you really want to delete both the
9025 symbolic names and the revisions, first delete the
9026 symbolic names with @code{cvs tag -d}, then run
9027 @code{cvs admin -o}.  If one specifies the
9028 non-@samp{::} syntaxes, then @sc{cvs} will delete the
9029 revisions but leave the symbolic names pointing to
9030 nonexistent revisions.  This behavior is preserved for
9031 compatibility with previous versions of @sc{cvs}, but
9032 because it isn't very useful, in the future it may
9033 change to be like the @samp{::} case.
9034
9035 Due to the way @sc{cvs} handles branches @var{rev}
9036 cannot be specified symbolically if it is a branch.
9037 @xref{Magic branch numbers}, for an explanation.
9038 @c FIXME: is this still true?  I suspect not.
9039
9040 Make sure that no-one has checked out a copy of the
9041 revision you outdate.  Strange things will happen if he
9042 starts to edit it and tries to check it back in.  For
9043 this reason, this option is not a good way to take back
9044 a bogus commit; commit a new revision undoing the bogus
9045 change instead (@pxref{Merging two revisions}).
9046
9047 @item -q
9048 Run quietly; do not print diagnostics.
9049
9050 @item -s@var{state}[:@var{rev}]
9051 Useful with @sc{cvs}.  Set the state attribute of the
9052 revision @var{rev} to @var{state}.  If @var{rev} is a
9053 branch number, assume the latest revision on that
9054 branch.  If @var{rev} is omitted, assume the latest
9055 revision on the default branch.  Any identifier is
9056 acceptable for @var{state}.  A useful set of states is
9057 @samp{Exp} (for experimental), @samp{Stab} (for
9058 stable), and @samp{Rel} (for released).  By default,
9059 the state of a new revision is set to @samp{Exp} when
9060 it is created.  The state is visible in the output from
9061 @var{cvs log} (@pxref{log}), and in the
9062 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
9063 (@pxref{Keyword substitution}).  Note that @sc{cvs}
9064 uses the @code{dead} state for its own purposes (@pxref{Attic}); to
9065 take a file to or from the @code{dead} state use
9066 commands like @code{cvs remove} and @code{cvs add}
9067 (@pxref{Adding and removing}), not @code{cvs admin -s}.
9068
9069 @item -t[@var{file}]
9070 Useful with @sc{cvs}.  Write descriptive text from the
9071 contents of the named @var{file} into the RCS file,
9072 deleting the existing text.  The @var{file} pathname
9073 may not begin with @samp{-}.  The descriptive text can be seen in the
9074 output from @samp{cvs log} (@pxref{log}).
9075 There can be no space between @samp{-t} and its argument.
9076
9077 If @var{file} is omitted,
9078 obtain the text from standard input, terminated by
9079 end-of-file or by a line containing @samp{.} by itself.
9080 Prompt for the text if interaction is possible; see
9081 @samp{-I}.
9082
9083 @item -t-@var{string}
9084 Similar to @samp{-t@var{file}}. Write descriptive text
9085 from the @var{string} into the @sc{rcs} file, deleting
9086 the existing text.
9087 There can be no space between @samp{-t} and its argument.
9088
9089 @c The rcs -T option, do not update last-mod time for
9090 @c minor changes, has never been documented as a
9091 @c cvs admin option.
9092
9093 @item -U
9094 Set locking to non-strict.  Non-strict locking means
9095 that the owner of a file need not lock a revision for
9096 checkin.  For use with @sc{cvs}, strict locking must be
9097 set; see the discussion under the @samp{-l} option
9098 above.
9099
9100 @item -u[@var{rev}]
9101 See the option @samp{-l} above, for a discussion of
9102 using this option with @sc{cvs}.  Unlock the revision
9103 with number @var{rev}.  If a branch is given, unlock
9104 the latest revision on that branch.  If @var{rev} is
9105 omitted, remove the latest lock held by the caller.
9106 Normally, only the locker of a revision may unlock it;
9107 somebody else unlocking a revision breaks the lock.
9108 This causes the original locker to be sent a @code{commit}
9109 notification (@pxref{Getting Notified}).
9110 There can be no space between @samp{-u} and its argument.
9111
9112 @item -V@var{n}
9113 In previous versions of @sc{cvs}, this option meant to
9114 write an @sc{rcs} file which would be acceptable to
9115 @sc{rcs} version @var{n}, but it is now obsolete and
9116 specifying it will produce an error.
9117 @c Note that -V without an argument has never been
9118 @c documented as a cvs admin option.
9119
9120 @item -x@var{suffixes}
9121 In previous versions of @sc{cvs}, this was documented
9122 as a way of specifying the names of the @sc{rcs}
9123 files.  However, @sc{cvs} has always required that the
9124 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
9125 this option has never done anything useful.
9126
9127 @c The rcs -z option, to specify the timezone, has
9128 @c never been documented as a cvs admin option.
9129 @end table
9130
9131 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9132 @node annotate
9133 @appendixsec annotate---What revision modified each line of a file?
9134 @cindex annotate (subcommand)
9135
9136 @itemize @bullet
9137 @item
9138 Synopsis: annotate [options] files@dots{}
9139 @item
9140 Requires: repository.
9141 @item
9142 Changes: nothing.
9143 @end itemize
9144
9145 For each file in @var{files}, print the head revision
9146 of the trunk, together with information on the last
9147 modification for each line.  If @samp{-b} is specified,
9148 the first modification after the revision selected by
9149 @samp{-r} is shown.  
9150
9151 @menu
9152 * annotate options::            annotate options
9153 * annotate example::            annotate example
9154 @end menu
9155
9156 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9157 @node annotate options
9158 @appendixsubsec annotate options
9159
9160 These standard options are supported by @code{annotate}
9161 (@pxref{Common options}, for a complete description of
9162 them):
9163
9164 @table @code
9165 @item -b
9166 Backwards, show when a line was removed.
9167
9168 @item -l
9169 Local directory only, no recursion.
9170
9171 @item -R
9172 Process directories recursively.
9173
9174 @item -f
9175 Use head revision if tag/date not found.
9176
9177 @item -F
9178 Annotate binary files.
9179
9180 @item -r @var{tag}[:@var{date}]
9181 Annotate file as of specified revision/tag or, when @var{date} is specified
9182 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9183 existed on @var{date}.  See @ref{Common options}.
9184
9185 @item -D @var{date}
9186 Annotate file as of specified date.
9187 @end table
9188
9189 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9190 @node annotate example
9191 @appendixsubsec annotate example
9192
9193 For example:
9194
9195 @example
9196 $ cvs annotate ssfile
9197 Annotations for ssfile
9198 ***************
9199 1.1          (mary     27-Mar-96): ssfile line 1
9200 1.2          (joe      28-Mar-96): ssfile line 2
9201 @end example
9202
9203 The file @file{ssfile} currently contains two lines.
9204 The @code{ssfile line 1} line was checked in by
9205 @code{mary} on March 27.  Then, on March 28, @code{joe}
9206 added a line @code{ssfile line 2}, without modifying
9207 the @code{ssfile line 1} line.  This report doesn't
9208 tell you anything about lines which have been deleted
9209 or replaced; you need to use @code{cvs diff} for that
9210 (@pxref{diff}).
9211
9212 The options to @code{cvs annotate} are listed in
9213 @ref{Invoking CVS}, and can be used to select the files
9214 and revisions to annotate.  The options are described
9215 in more detail there and in @ref{Common options}.
9216
9217 @c FIXME: maybe an example using the options?  Just
9218 @c what it means to select a revision might be worth a
9219 @c few words of explanation ("you want to see who
9220 @c changed this line *before* 1.4"...).
9221
9222 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9223 @node checkout
9224 @appendixsec checkout---Check out sources for editing
9225 @cindex checkout (subcommand)
9226 @cindex co (subcommand)
9227
9228 @itemize @bullet
9229 @item
9230 Synopsis: checkout [options] modules@dots{}
9231 @item
9232 Requires: repository.
9233 @item
9234 Changes: working directory.
9235 @item
9236 Synonyms: co, get
9237 @end itemize
9238
9239 Create or update a working directory containing copies of the
9240 source files specified by @var{modules}.  You must execute
9241 @code{checkout} before using most of the other @sc{cvs}
9242 commands, since most of them operate on your working
9243 directory.
9244
9245 The @var{modules} are either
9246 symbolic names for some
9247 collection of source directories and files, or paths to
9248 directories or files in the repository.  The symbolic
9249 names are defined in the @samp{modules} file.
9250 @xref{modules}.
9251 @c Needs an example, particularly of the non-"modules"
9252 @c case but probably of both.
9253
9254 @c FIXME: this seems like a very odd place to introduce
9255 @c people to how CVS works.  The bit about unreserved
9256 @c checkouts is also misleading as it depends on how
9257 @c things are set up.
9258 Depending on the modules you specify, @code{checkout} may
9259 recursively create directories and populate them with
9260 the appropriate source files.  You can then edit these
9261 source files at any time (regardless of whether other
9262 software developers are editing their own copies of the
9263 sources); update them to include new changes applied by
9264 others to the source repository; or commit your work as
9265 a permanent change to the source repository.
9266
9267 Note that @code{checkout} is used to create
9268 directories.  The top-level directory created is always
9269 added to the directory where @code{checkout} is
9270 invoked, and usually has the same name as the specified
9271 module.  In the case of a module alias, the created
9272 sub-directory may have a different name, but you can be
9273 sure that it will be a sub-directory, and that
9274 @code{checkout} will show the relative path leading to
9275 each file as it is extracted into your private work
9276 area (unless you specify the @samp{-Q} global option).
9277
9278 The files created by @code{checkout} are created
9279 read-write, unless the @samp{-r} option to @sc{cvs}
9280 (@pxref{Global options}) is specified, the
9281 @code{CVSREAD} environment variable is specified
9282 (@pxref{Environment variables}), or a watch is in
9283 effect for that file (@pxref{Watches}).
9284
9285 Note that running @code{checkout} on a directory that was already
9286 built by a prior @code{checkout} is also permitted.
9287 This is similar to specifying the @samp{-d} option
9288 to the @code{update} command in the sense that new
9289 directories that have been created in the repository
9290 will appear in your work area.
9291 However, @code{checkout} takes a module name whereas
9292 @code{update} takes a directory name.  Also
9293 to use @code{checkout} this way it must be run from the
9294 top level directory (where you originally ran
9295 @code{checkout} from), so before you run
9296 @code{checkout} to update an existing directory, don't
9297 forget to change your directory to the top level
9298 directory.
9299
9300 For the output produced by the @code{checkout} command
9301 see @ref{update output}.
9302
9303 @menu
9304 * checkout options::            checkout options
9305 * checkout examples::           checkout examples
9306 @end menu
9307
9308 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9309 @node checkout options
9310 @appendixsubsec checkout options
9311
9312 These standard options are supported by @code{checkout}
9313 (@pxref{Common options}, for a complete description of
9314 them):
9315
9316 @table @code
9317 @item -D @var{date}
9318 Use the most recent revision no later than @var{date}.
9319 This option is sticky, and implies @samp{-P}.  See
9320 @ref{Sticky tags}, for more information on sticky tags/dates.
9321
9322 @item -f
9323 Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision is
9324 found, retrieve the most recent revision (instead of ignoring the file).
9325
9326 @item -k @var{kflag}
9327 Process keywords according to @var{kflag}.  See
9328 @ref{Keyword substitution}.
9329 This option is sticky; future updates of
9330 this file in this working directory will use the same
9331 @var{kflag}.  The @code{status} command can be viewed
9332 to see the sticky options.  See @ref{Invoking CVS}, for
9333 more information on the @code{status} command.
9334
9335 @item -l
9336 Local; run only in current working directory.
9337
9338 @item -n
9339 Do not run any checkout program (as specified
9340 with the @samp{-o} option in the modules file;
9341 @pxref{modules}).
9342
9343 @item -P
9344 Prune empty directories.  See @ref{Moving directories}.
9345
9346 @item -p
9347 Pipe files to the standard output.
9348
9349 @item -R
9350 Checkout directories recursively.  This option is on by default.
9351
9352 @item -r @var{tag}[:@var{date}]
9353 Checkout the revision specified by @var{tag} or, when @var{date} is specified
9354 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9355 existed on @var{date}.  This option is sticky, and implies @samp{-P}.
9356 See @ref{Sticky tags}, for more information on sticky tags/dates.  Also,
9357 see @ref{Common options}.
9358 @end table
9359
9360 In addition to those, you can use these special command
9361 options with @code{checkout}:
9362
9363 @table @code
9364 @item -A
9365 Reset any sticky tags, dates, or @samp{-k} options.
9366 See @ref{Sticky tags}, for more information on sticky tags/dates.
9367
9368 @item -c
9369 Copy the module file, sorted, to the standard output,
9370 instead of creating or modifying any files or
9371 directories in your working directory.
9372
9373 @item -d @var{dir}
9374 Create a directory called @var{dir} for the working
9375 files, instead of using the module name.  In general,
9376 using this flag is equivalent to using @samp{mkdir
9377 @var{dir}; cd @var{dir}} followed by the checkout
9378 command without the @samp{-d} flag.
9379
9380 There is an important exception, however.  It is very
9381 convenient when checking out a single item to have the
9382 output appear in a directory that doesn't contain empty
9383 intermediate directories.  In this case @emph{only},
9384 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
9385 directories.
9386
9387 For example, given a module @samp{foo} that contains
9388 the file @samp{bar.c}, the command @samp{cvs co -d dir
9389 foo} will create directory @samp{dir} and place
9390 @samp{bar.c} inside.  Similarly, given a module
9391 @samp{bar} which has subdirectory @samp{baz} wherein
9392 there is a file @samp{quux.c}, the command @samp{cvs co
9393 -d dir bar/baz} will create directory @samp{dir} and
9394 place @samp{quux.c} inside.
9395
9396 Using the @samp{-N} flag will defeat this behavior.
9397 Given the same module definitions above, @samp{cvs co
9398 -N -d dir foo} will create directories @samp{dir/foo}
9399 and place @samp{bar.c} inside, while @samp{cvs co -N -d
9400 dir bar/baz} will create directories @samp{dir/bar/baz}
9401 and place @samp{quux.c} inside.
9402
9403 @item -j @var{tag}
9404 With two @samp{-j} options, merge changes from the
9405 revision specified with the first @samp{-j} option to
9406 the revision specified with the second @samp{j} option,
9407 into the working directory.
9408
9409 With one @samp{-j} option, merge changes from the
9410 ancestor revision to the revision specified with the
9411 @samp{-j} option, into the working directory.  The
9412 ancestor revision is the common ancestor of the
9413 revision which the working directory is based on, and
9414 the revision specified in the @samp{-j} option.
9415
9416 In addition, each -j option can contain an optional
9417 date specification which, when used with branches, can
9418 limit the chosen revision to one within a specific
9419 date.  An optional date is specified by adding a colon
9420 (:) to the tag:
9421 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
9422
9423 @xref{Branching and merging}.
9424
9425 @item -N
9426 Only useful together with @samp{-d @var{dir}}.  With
9427 this option, @sc{cvs} will not ``shorten'' module paths
9428 in your working directory when you check out a single
9429 module.  See the @samp{-d} flag for examples and a
9430 discussion.
9431
9432 @item -s
9433 Like @samp{-c}, but include the status of all modules,
9434 and sort it by the status string.  @xref{modules}, for
9435 info about the @samp{-s} option that is used inside the
9436 modules file to set the module status.
9437 @end table
9438
9439 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9440 @node checkout examples
9441 @appendixsubsec checkout examples
9442
9443 Get a copy of the module @samp{tc}:
9444
9445 @example
9446 $ cvs checkout tc
9447 @end example
9448
9449 Get a copy of the module @samp{tc} as it looked one day
9450 ago:
9451
9452 @example
9453 $ cvs checkout -D yesterday tc
9454 @end example
9455
9456 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9457 @node commit
9458 @appendixsec commit---Check files into the repository
9459 @cindex commit (subcommand)
9460
9461 @itemize @bullet
9462 @item
9463 Synopsis: commit [-lnRf] [-m 'log_message' |
9464 -F file] [-r revision] [files@dots{}]
9465 @item
9466 Requires: working directory, repository.
9467 @item
9468 Changes: repository.
9469 @item
9470 Synonym: ci
9471 @end itemize
9472
9473 Use @code{commit} when you want to incorporate changes
9474 from your working source files into the source
9475 repository.
9476
9477 If you don't specify particular files to commit, all of
9478 the files in your working current directory are
9479 examined.  @code{commit} is careful to change in the
9480 repository only those files that you have really
9481 changed.  By default (or if you explicitly specify the
9482 @samp{-R} option), files in subdirectories are also
9483 examined and committed if they have changed; you can
9484 use the @samp{-l} option to limit @code{commit} to the
9485 current directory only.
9486
9487 @code{commit} verifies that the selected files are up
9488 to date with the current revisions in the source
9489 repository; it will notify you, and exit without
9490 committing, if any of the specified files must be made
9491 current first with @code{update} (@pxref{update}).
9492 @code{commit} does not call the @code{update} command
9493 for you, but rather leaves that for you to do when the
9494 time is right.
9495
9496 When all is well, an editor is invoked to allow you to
9497 enter a log message that will be written to one or more
9498 logging programs (@pxref{modules}, and @pxref{loginfo})
9499 and placed in the @sc{rcs} file inside the
9500 repository.  This log message can be retrieved with the
9501 @code{log} command; see @ref{log}.  You can specify the
9502 log message on the command line with the @samp{-m
9503 @var{message}} option, and thus avoid the editor invocation,
9504 or use the @samp{-F @var{file}} option to specify
9505 that the argument file contains the log message.
9506
9507 At @code{commit}, a unique commitid is placed in the @sc{rcs}
9508 file inside the repository. All files committed at once
9509 get the same commitid. The commitid can be retrieved with
9510 the @code{log} and @code{status} command; see @ref{log},
9511 @ref{File status}.
9512
9513 @menu
9514 * commit options::              commit options
9515 * commit examples::             commit examples
9516 @end menu
9517
9518 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9519 @node commit options
9520 @appendixsubsec commit options
9521
9522 These standard options are supported by @code{commit}
9523 (@pxref{Common options}, for a complete description of
9524 them):
9525
9526 @table @code
9527 @item -l
9528 Local; run only in current working directory.
9529
9530 @item -R
9531 Commit directories recursively.  This is on by default.
9532
9533 @item -r @var{revision}
9534 Commit to @var{revision}.  @var{revision} must be
9535 either a branch, or a revision on the main trunk that
9536 is higher than any existing revision number
9537 (@pxref{Assigning revisions}).  You
9538 cannot commit to a specific revision on a branch.
9539 @c FIXME: Need xref for branch case.
9540 @end table
9541
9542 @code{commit} also supports these options:
9543
9544 @table @code
9545 @item -c
9546 Refuse to commit files unless the user has registered a valid edit on the
9547 file via @code{cvs edit}.  This is most useful when @samp{commit -c}
9548 and @samp{edit -c} have been placed in all @file{.cvsrc} files.
9549 A commit can be forced anyways by either regestering an edit retroactively
9550 via @code{cvs edit} (no changes to the file will be lost) or using the
9551 @code{-f} option to commit.  Support for @code{commit -c} requires both
9552 client and a server versions 1.12.10 or greater.
9553
9554 @item -F @var{file}
9555 Read the log message from @var{file}, instead
9556 of invoking an editor.
9557
9558 @item -f
9559 Note that this is not the standard behavior of
9560 the @samp{-f} option as defined in @ref{Common options}.
9561
9562 Force @sc{cvs} to commit a new revision even if you haven't
9563 made any changes to the file.  As of @sc{cvs} version 1.12.10,
9564 it also causes the @code{-c} option to be ignored.  If the current revision
9565 of @var{file} is 1.7, then the following two commands
9566 are equivalent:
9567
9568 @example
9569 $ cvs commit -f @var{file}
9570 $ cvs commit -r 1.8 @var{file}
9571 @end example
9572
9573 @c This is odd, but it's how CVS has worked for some
9574 @c time.
9575 The @samp{-f} option disables recursion (i.e., it
9576 implies @samp{-l}).  To force @sc{cvs} to commit a new
9577 revision for all files in all subdirectories, you must
9578 use @samp{-f -R}.
9579
9580 @item -m @var{message}
9581 Use @var{message} as the log message, instead of
9582 invoking an editor.
9583 @end table
9584
9585 @need 2000
9586 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9587 @node commit examples
9588 @appendixsubsec commit examples
9589
9590 @c FIXME: this material wants to be somewhere
9591 @c in "Branching and merging".
9592
9593 @appendixsubsubsec Committing to a branch
9594
9595 You can commit to a branch revision (one that has an
9596 even number of dots) with the @samp{-r} option.  To
9597 create a branch revision, use the @samp{-b} option
9598 of the @code{rtag} or @code{tag} commands
9599 (@pxref{Branching and merging}).  Then, either @code{checkout} or
9600 @code{update} can be used to base your sources on the
9601 newly created branch.  From that point on, all
9602 @code{commit} changes made within these working sources
9603 will be automatically added to a branch revision,
9604 thereby not disturbing main-line development in any
9605 way.  For example, if you had to create a patch to the
9606 1.2 version of the product, even though the 2.0 version
9607 is already under development, you might do:
9608
9609 @example
9610 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9611 $ cvs checkout -r FCS1_2_Patch product_module
9612 $ cd product_module
9613 [[ hack away ]]
9614 $ cvs commit
9615 @end example
9616
9617 @noindent
9618 This works automatically since the @samp{-r} option is
9619 sticky.
9620
9621 @appendixsubsubsec Creating the branch after editing
9622
9623 Say you have been working on some extremely
9624 experimental software, based on whatever revision you
9625 happened to checkout last week.  If others in your
9626 group would like to work on this software with you, but
9627 without disturbing main-line development, you could
9628 commit your change to a new branch.  Others can then
9629 checkout your experimental stuff and utilize the full
9630 benefit of @sc{cvs} conflict resolution.  The scenario might
9631 look like:
9632
9633 @c FIXME: Should we be recommending tagging the branchpoint?
9634 @example
9635 [[ hacked sources are present ]]
9636 $ cvs tag -b EXPR1
9637 $ cvs update -r EXPR1
9638 $ cvs commit
9639 @end example
9640
9641 The @code{update} command will make the @samp{-r
9642 EXPR1} option sticky on all files.  Note that your
9643 changes to the files will never be removed by the
9644 @code{update} command.  The @code{commit} will
9645 automatically commit to the correct branch, because the
9646 @samp{-r} is sticky.  You could also do like this:
9647
9648 @c FIXME: Should we be recommending tagging the branchpoint?
9649 @example
9650 [[ hacked sources are present ]]
9651 $ cvs tag -b EXPR1
9652 $ cvs commit -r EXPR1
9653 @end example
9654
9655 @noindent
9656 but then, only those files that were changed by you
9657 will have the @samp{-r EXPR1} sticky flag.  If you hack
9658 away, and commit without specifying the @samp{-r EXPR1}
9659 flag, some files may accidentally end up on the main
9660 trunk.
9661
9662 To work with you on the experimental change, others
9663 would simply do
9664
9665 @example
9666 $ cvs checkout -r EXPR1 whatever_module
9667 @end example
9668
9669 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9670 @node diff
9671 @appendixsec diff---Show differences between revisions
9672 @cindex diff (subcommand)
9673
9674 @itemize @bullet
9675 @item
9676 Synopsis: diff [-lR] [-k kflag] [format_options] [(-r rev1[:date1] | -D date1) [-r rev2[:date2] | -D date2]] [files@dots{}]
9677 @item
9678 Requires: working directory, repository.
9679 @item
9680 Changes: nothing.
9681 @end itemize
9682
9683 The @code{diff} command is used to compare different
9684 revisions of files.  The default action is to compare
9685 your working files with the revisions they were based
9686 on, and report any differences that are found.
9687
9688 If any file names are given, only those files are
9689 compared.  If any directories are given, all files
9690 under them will be compared.
9691
9692 The exit status for diff is different than for other
9693 @sc{cvs} commands; for details @ref{Exit status}.
9694
9695 @menu
9696 * diff options::                diff options
9697 * diff examples::               diff examples
9698 @end menu
9699
9700 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9701 @node diff options
9702 @appendixsubsec diff options
9703
9704 These standard options are supported by @code{diff}
9705 (@pxref{Common options}, for a complete description of
9706 them):
9707
9708 @table @code
9709 @item -D @var{date}
9710 Use the most recent revision no later than @var{date}.
9711 See @samp{-r} for how this affects the comparison.
9712
9713 @item -k @var{kflag}
9714 Process keywords according to @var{kflag}.  See
9715 @ref{Keyword substitution}.
9716
9717 @item -l
9718 Local; run only in current working directory.
9719
9720 @item -R
9721 Examine directories recursively.  This option is on by
9722 default.
9723
9724 @item -r @var{tag}[:@var{date}]
9725 Compare with revision specified by @var{tag} or, when @var{date} is specified
9726 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9727 existed on @var{date}.  Zero, one or two
9728 @samp{-r} options can be present.  With no @samp{-r}
9729 option, the working file will be compared with the
9730 revision it was based on.  With one @samp{-r}, that
9731 revision will be compared to your current working file.
9732 With two @samp{-r} options those two revisions will be
9733 compared (and your working file will not affect the
9734 outcome in any way).
9735 @c We should be a lot more explicit, with examples,
9736 @c about the difference between "cvs diff" and "cvs
9737 @c diff -r HEAD".  This often confuses new users.
9738
9739 One or both @samp{-r} options can be replaced by a
9740 @samp{-D @var{date}} option, described above.
9741 @end table
9742
9743 @c Conceptually, this is a disaster.  There are 3
9744 @c zillion diff formats that we support via the diff
9745 @c library.  It is not obvious to me that we should
9746 @c document them all.  Maybe just the most common ones
9747 @c like -c and -u, and think about phasing out the
9748 @c obscure ones.
9749 @c FIXCVS: also should be a way to specify an external
9750 @c diff program (which can be different for different
9751 @c file types) and pass through
9752 @c arbitrary options, so that the user can do
9753 @c "--pass=-Z --pass=foo" or something even if CVS
9754 @c doesn't know about the "-Z foo" option to diff.
9755 @c This would fit nicely with deprecating/eliminating
9756 @c the obscure options of the diff library, because it
9757 @c would let people specify an external GNU diff if
9758 @c they are into that sort of thing.
9759 The following options specify the format of the
9760 output.  They have the same meaning as in GNU diff.
9761 Most options have two equivalent names, one of which is a single letter
9762 preceded by @samp{-}, and the other of which is a long name preceded by
9763 @samp{--}.
9764
9765 @table @samp
9766 @item -@var{lines}
9767 Show @var{lines} (an integer) lines of context.  This option does not
9768 specify an output format by itself; it has no effect unless it is
9769 combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9770 operation, @code{patch} typically needs at least two lines of context.
9771
9772 @item -a
9773 Treat all files as text and compare them line-by-line, even if they
9774 do not seem to be text.
9775
9776 @item -b
9777 Ignore trailing white space and consider all other sequences of one or
9778 more white space characters to be equivalent.
9779
9780 @item -B
9781 Ignore changes that just insert or delete blank lines.
9782
9783 @item --binary
9784 Read and write data in binary mode.
9785
9786 @item --brief
9787 Report only whether the files differ, not the details of the
9788 differences.
9789
9790 @item -c
9791 Use the context output format.
9792
9793 @item -C @var{lines}
9794 @itemx --context@r{[}=@var{lines}@r{]}
9795 Use the context output format, showing @var{lines} (an integer) lines of
9796 context, or three if @var{lines} is not given.
9797 For proper operation, @code{patch} typically needs at least two lines of
9798 context.
9799
9800 @item --changed-group-format=@var{format}
9801 Use @var{format} to output a line group containing differing lines from
9802 both files in if-then-else format.  @xref{Line group formats}.
9803
9804 @item -d
9805 Change the algorithm to perhaps find a smaller set of changes.  This makes
9806 @code{diff} slower (sometimes much slower).
9807
9808 @item -e
9809 @itemx --ed
9810 Make output that is a valid @code{ed} script.
9811
9812 @item --expand-tabs
9813 Expand tabs to spaces in the output, to preserve the alignment of tabs
9814 in the input files.
9815
9816 @item -f
9817 Make output that looks vaguely like an @code{ed} script but has changes
9818 in the order they appear in the file.
9819
9820 @item -F @var{regexp}
9821 In context and unified format, for each hunk of differences, show some
9822 of the last preceding line that matches @var{regexp}.
9823
9824 @item --forward-ed
9825 Make output that looks vaguely like an @code{ed} script but has changes
9826 in the order they appear in the file.
9827
9828 @item -H
9829 Use heuristics to speed handling of large files that have numerous
9830 scattered small changes.
9831
9832 @item --horizon-lines=@var{lines}
9833 Do not discard the last @var{lines} lines of the common prefix
9834 and the first @var{lines} lines of the common suffix.
9835
9836 @item -i
9837 Ignore changes in case; consider upper- and lower-case letters
9838 equivalent.
9839
9840 @item -I @var{regexp}
9841 Ignore changes that just insert or delete lines that match @var{regexp}.
9842
9843 @item --ifdef=@var{name}
9844 Make merged if-then-else output using @var{name}.
9845
9846 @item --ignore-all-space
9847 Ignore white space when comparing lines.
9848
9849 @item --ignore-blank-lines
9850 Ignore changes that just insert or delete blank lines.
9851
9852 @item --ignore-case
9853 Ignore changes in case; consider upper- and lower-case to be the same.
9854
9855 @item --ignore-matching-lines=@var{regexp}
9856 Ignore changes that just insert or delete lines that match @var{regexp}.
9857
9858 @item --ignore-space-change
9859 Ignore trailing white space and consider all other sequences of one or
9860 more white space characters to be equivalent.
9861
9862 @item --initial-tab
9863 Output a tab rather than a space before the text of a line in normal or
9864 context format.  This causes the alignment of tabs in the line to look
9865 normal.
9866
9867 @item -L @var{label}
9868 Use @var{label} instead of the file name in the context format
9869 and unified format headers.
9870
9871 @item --label=@var{label}
9872 Use @var{label} instead of the file name in the context format
9873 and unified format headers.
9874
9875 @item --left-column
9876 Print only the left column of two common lines in side by side format.
9877
9878 @item --line-format=@var{format}
9879 Use @var{format} to output all input lines in if-then-else format.
9880 @xref{Line formats}.
9881
9882 @item --minimal
9883 Change the algorithm to perhaps find a smaller set of changes.  This
9884 makes @code{diff} slower (sometimes much slower).
9885
9886 @item -n
9887 Output RCS-format diffs; like @samp{-f} except that each command
9888 specifies the number of lines affected.
9889
9890 @item -N
9891 @itemx --new-file
9892 In directory comparison, if a file is found in only one directory,
9893 treat it as present but empty in the other directory.
9894
9895 @item --new-group-format=@var{format}
9896 Use @var{format} to output a group of lines taken from just the second
9897 file in if-then-else format.  @xref{Line group formats}.
9898
9899 @item --new-line-format=@var{format}
9900 Use @var{format} to output a line taken from just the second file in
9901 if-then-else format.  @xref{Line formats}.
9902
9903 @item --old-group-format=@var{format}
9904 Use @var{format} to output a group of lines taken from just the first
9905 file in if-then-else format.  @xref{Line group formats}.
9906
9907 @item --old-line-format=@var{format}
9908 Use @var{format} to output a line taken from just the first file in
9909 if-then-else format.  @xref{Line formats}.
9910
9911 @item -p
9912 Show which C function each change is in.
9913
9914 @item --rcs
9915 Output RCS-format diffs; like @samp{-f} except that each command
9916 specifies the number of lines affected.
9917
9918 @item --report-identical-files
9919 @itemx -s
9920 Report when two files are the same.
9921
9922 @item --show-c-function
9923 Show which C function each change is in.
9924
9925 @item --show-function-line=@var{regexp}
9926 In context and unified format, for each hunk of differences, show some
9927 of the last preceding line that matches @var{regexp}.
9928
9929 @item --side-by-side
9930 Use the side by side output format.
9931
9932 @item --speed-large-files
9933 Use heuristics to speed handling of large files that have numerous
9934 scattered small changes.
9935
9936 @item --suppress-common-lines
9937 Do not print common lines in side by side format.
9938
9939 @item -t
9940 Expand tabs to spaces in the output, to preserve the alignment of tabs
9941 in the input files.
9942
9943 @item -T
9944 Output a tab rather than a space before the text of a line in normal or
9945 context format.  This causes the alignment of tabs in the line to look
9946 normal.
9947
9948 @item --text
9949 Treat all files as text and compare them line-by-line, even if they
9950 do not appear to be text.
9951
9952 @item -u
9953 Use the unified output format.
9954
9955 @item --unchanged-group-format=@var{format}
9956 Use @var{format} to output a group of common lines taken from both files
9957 in if-then-else format.  @xref{Line group formats}.
9958
9959 @item --unchanged-line-format=@var{format}
9960 Use @var{format} to output a line common to both files in if-then-else
9961 format.  @xref{Line formats}.
9962
9963 @item -U @var{lines}
9964 @itemx --unified@r{[}=@var{lines}@r{]}
9965 Use the unified output format, showing @var{lines} (an integer) lines of
9966 context, or three if @var{lines} is not given.
9967 For proper operation, @code{patch} typically needs at least two lines of
9968 context.
9969
9970 @item -w
9971 Ignore white space when comparing lines.
9972
9973 @item -W @var{columns}
9974 @itemx --width=@var{columns}
9975 Use an output width of @var{columns} in side by side format.
9976
9977 @item -y
9978 Use the side by side output format.
9979 @end table
9980
9981 @menu
9982 * Line group formats::          Line group formats
9983 * Line formats::                Line formats
9984 @end menu
9985
9986 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9987 @node Line group formats
9988 @appendixsubsubsec Line group formats
9989
9990 Line group formats let you specify formats suitable for many
9991 applications that allow if-then-else input, including programming
9992 languages and text formatting languages.  A line group format specifies
9993 the output format for a contiguous group of similar lines.
9994
9995 For example, the following command compares the TeX file @file{myfile}
9996 with the original version from the repository,
9997 and outputs a merged file in which old regions are
9998 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
9999 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
10000
10001 @example
10002 cvs diff \
10003    --old-group-format='\begin@{em@}
10004 %<\end@{em@}
10005 ' \
10006    --new-group-format='\begin@{bf@}
10007 %>\end@{bf@}
10008 ' \
10009    myfile
10010 @end example
10011
10012 The following command is equivalent to the above example, but it is a
10013 little more verbose, because it spells out the default line group formats.
10014
10015 @example
10016 cvs diff \
10017    --old-group-format='\begin@{em@}
10018 %<\end@{em@}
10019 ' \
10020    --new-group-format='\begin@{bf@}
10021 %>\end@{bf@}
10022 ' \
10023    --unchanged-group-format='%=' \
10024    --changed-group-format='\begin@{em@}
10025 %<\end@{em@}
10026 \begin@{bf@}
10027 %>\end@{bf@}
10028 ' \
10029    myfile
10030 @end example
10031
10032 Here is a more advanced example, which outputs a diff listing with
10033 headers containing line numbers in a ``plain English'' style.
10034
10035 @example
10036 cvs diff \
10037    --unchanged-group-format='' \
10038    --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
10039 %<' \
10040    --new-group-format='-------- %dN line%(N=1?:s) added after %de:
10041 %>' \
10042    --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
10043 %<-------- to:
10044 %>' \
10045    myfile
10046 @end example
10047
10048 To specify a line group format, use one of the options
10049 listed below.  You can specify up to four line group formats, one for
10050 each kind of line group.  You should quote @var{format}, because it
10051 typically contains shell metacharacters.
10052
10053 @table @samp
10054 @item --old-group-format=@var{format}
10055 These line groups are hunks containing only lines from the first file.
10056 The default old group format is the same as the changed group format if
10057 it is specified; otherwise it is a format that outputs the line group as-is.
10058
10059 @item --new-group-format=@var{format}
10060 These line groups are hunks containing only lines from the second
10061 file.  The default new group format is same as the changed group
10062 format if it is specified; otherwise it is a format that outputs the
10063 line group as-is.
10064
10065 @item --changed-group-format=@var{format}
10066 These line groups are hunks containing lines from both files.  The
10067 default changed group format is the concatenation of the old and new
10068 group formats.
10069
10070 @item --unchanged-group-format=@var{format}
10071 These line groups contain lines common to both files.  The default
10072 unchanged group format is a format that outputs the line group as-is.
10073 @end table
10074
10075 In a line group format, ordinary characters represent themselves;
10076 conversion specifications start with @samp{%} and have one of the
10077 following forms.
10078
10079 @table @samp
10080 @item %<
10081 stands for the lines from the first file, including the trailing newline.
10082 Each line is formatted according to the old line format (@pxref{Line formats}).
10083
10084 @item %>
10085 stands for the lines from the second file, including the trailing newline.
10086 Each line is formatted according to the new line format.
10087
10088 @item %=
10089 stands for the lines common to both files, including the trailing newline.
10090 Each line is formatted according to the unchanged line format.
10091
10092 @item %%
10093 stands for @samp{%}.
10094
10095 @item %c'@var{C}'
10096 where @var{C} is a single character, stands for @var{C}.
10097 @var{C} may not be a backslash or an apostrophe.
10098 For example, @samp{%c':'} stands for a colon, even inside
10099 the then-part of an if-then-else format, which a colon would
10100 normally terminate.
10101
10102 @item %c'\@var{O}'
10103 where @var{O} is a string of 1, 2, or 3 octal digits,
10104 stands for the character with octal code @var{O}.
10105 For example, @samp{%c'\0'} stands for a null character.
10106
10107 @item @var{F}@var{n}
10108 where @var{F} is a @code{printf} conversion specification and @var{n} is one
10109 of the following letters, stands for @var{n}'s value formatted with @var{F}.
10110
10111 @table @samp
10112 @item e
10113 The line number of the line just before the group in the old file.
10114
10115 @item f
10116 The line number of the first line in the group in the old file;
10117 equals @var{e} + 1.
10118
10119 @item l
10120 The line number of the last line in the group in the old file.
10121
10122 @item m
10123 The line number of the line just after the group in the old file;
10124 equals @var{l} + 1.
10125
10126 @item n
10127 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
10128
10129 @item E, F, L, M, N
10130 Likewise, for lines in the new file.
10131
10132 @end table
10133
10134 The @code{printf} conversion specification can be @samp{%d},
10135 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
10136 lower case hexadecimal, or upper case hexadecimal output
10137 respectively.  After the @samp{%} the following options can appear in
10138 sequence: a @samp{-} specifying left-justification; an integer
10139 specifying the minimum field width; and a period followed by an
10140 optional integer specifying the minimum number of digits.
10141 For example, @samp{%5dN} prints the number of new lines in the group
10142 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
10143
10144 @item (@var{A}=@var{B}?@var{T}:@var{E})
10145 If @var{A} equals @var{B} then @var{T} else @var{E}.
10146 @var{A} and @var{B} are each either a decimal constant
10147 or a single letter interpreted as above.
10148 This format spec is equivalent to @var{T} if
10149 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
10150
10151 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
10152 @samp{no lines} if @var{N} (the number of lines in the group in the
10153 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
10154 otherwise.
10155 @end table
10156
10157 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10158 @node Line formats
10159 @appendixsubsubsec Line formats
10160
10161 Line formats control how each line taken from an input file is
10162 output as part of a line group in if-then-else format.
10163
10164 For example, the following command outputs text with a one-column
10165 change indicator to the left of the text.  The first column of output
10166 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
10167 for unchanged lines.  The formats contain newline characters where
10168 newlines are desired on output.
10169
10170 @example
10171 cvs diff \
10172    --old-line-format='-%l
10173 ' \
10174    --new-line-format='|%l
10175 ' \
10176    --unchanged-line-format=' %l
10177 ' \
10178    myfile
10179 @end example
10180
10181 To specify a line format, use one of the following options.  You should
10182 quote @var{format}, since it often contains shell metacharacters.
10183
10184 @table @samp
10185 @item --old-line-format=@var{format}
10186 formats lines just from the first file.
10187
10188 @item --new-line-format=@var{format}
10189 formats lines just from the second file.
10190
10191 @item --unchanged-line-format=@var{format}
10192 formats lines common to both files.
10193
10194 @item --line-format=@var{format}
10195 formats all lines; in effect, it sets all three above options simultaneously.
10196 @end table
10197
10198 In a line format, ordinary characters represent themselves;
10199 conversion specifications start with @samp{%} and have one of the
10200 following forms.
10201
10202 @table @samp
10203 @item %l
10204 stands for the contents of the line, not counting its trailing
10205 newline (if any).  This format ignores whether the line is incomplete.
10206
10207 @item %L
10208 stands for the contents of the line, including its trailing newline
10209 (if any).  If a line is incomplete, this format preserves its
10210 incompleteness.
10211
10212 @item %%
10213 stands for @samp{%}.
10214
10215 @item %c'@var{C}'
10216 where @var{C} is a single character, stands for @var{C}.
10217 @var{C} may not be a backslash or an apostrophe.
10218 For example, @samp{%c':'} stands for a colon.
10219
10220 @item %c'\@var{O}'
10221 where @var{O} is a string of 1, 2, or 3 octal digits,
10222 stands for the character with octal code @var{O}.
10223 For example, @samp{%c'\0'} stands for a null character.
10224
10225 @item @var{F}n
10226 where @var{F} is a @code{printf} conversion specification,
10227 stands for the line number formatted with @var{F}.
10228 For example, @samp{%.5dn} prints the line number using the
10229 @code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
10230 more about printf conversion specifications.
10231
10232 @end table
10233
10234 The default line format is @samp{%l} followed by a newline character.
10235
10236 If the input contains tab characters and it is important that they line
10237 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
10238 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
10239 @samp{%L} with a tab character), or you should use the @samp{-t} or
10240 @samp{--expand-tabs} option.
10241
10242 Taken together, the line and line group formats let you specify many
10243 different formats.  For example, the following command uses a format
10244 similar to @code{diff}'s normal format.  You can tailor this command
10245 to get fine control over @code{diff}'s output.
10246
10247 @example
10248 cvs diff \
10249    --old-line-format='< %l
10250 ' \
10251    --new-line-format='> %l
10252 ' \
10253    --old-group-format='%df%(f=l?:,%dl)d%dE
10254 %<' \
10255    --new-group-format='%dea%dF%(F=L?:,%dL)
10256 %>' \
10257    --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
10258 %<---
10259 %>' \
10260    --unchanged-group-format='' \
10261    myfile
10262 @end example
10263
10264 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10265 @node diff examples
10266 @appendixsubsec diff examples
10267
10268 The following line produces a Unidiff (@samp{-u} flag)
10269 between revision 1.14 and 1.19 of
10270 @file{backend.c}.  Due to the @samp{-kk} flag no
10271 keywords are substituted, so differences that only depend
10272 on keyword substitution are ignored.
10273
10274 @example
10275 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
10276 @end example
10277
10278 Suppose the experimental branch EXPR1 was based on a
10279 set of files tagged RELEASE_1_0.  To see what has
10280 happened on that branch, the following can be used:
10281
10282 @example
10283 $ cvs diff -r RELEASE_1_0 -r EXPR1
10284 @end example
10285
10286 A command like this can be used to produce a context
10287 diff between two releases:
10288
10289 @example
10290 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
10291 @end example
10292
10293 If you are maintaining ChangeLogs, a command like the following
10294 just before you commit your changes may help you write
10295 the ChangeLog entry.  All local modifications that have
10296 not yet been committed will be printed.
10297
10298 @example
10299 $ cvs diff -u | less
10300 @end example
10301
10302 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10303 @node export
10304 @appendixsec export---Export sources from CVS, similar to checkout
10305 @cindex export (subcommand)
10306
10307 @itemize @bullet
10308 @item
10309 Synopsis: export [-flNnR] (-r rev[:date] | -D date) [-k subst] [-d dir] module@dots{}
10310 @item
10311 Requires: repository.
10312 @item
10313 Changes: current directory.
10314 @end itemize
10315
10316 This command is a variant of @code{checkout}; use it
10317 when you want a copy of the source for module without
10318 the @sc{cvs} administrative directories.  For example, you
10319 might use @code{export} to prepare source for shipment
10320 off-site.  This command requires that you specify a
10321 date or tag (with @samp{-D} or @samp{-r}), so that you
10322 can count on reproducing the source you ship to others
10323 (and thus it always prunes empty directories).
10324
10325 One often would like to use @samp{-kv} with @code{cvs
10326 export}.  This causes any keywords to be
10327 expanded such that an import done at some other site
10328 will not lose the keyword revision information.  But be
10329 aware that doesn't handle an export containing binary
10330 files correctly.  Also be aware that after having used
10331 @samp{-kv}, one can no longer use the @code{ident}
10332 command (which is part of the @sc{rcs} suite---see
10333 ident(1)) which looks for keyword strings.  If
10334 you want to be able to use @code{ident} you must not
10335 use @samp{-kv}.
10336
10337 @menu
10338 * export options::              export options
10339 @end menu
10340
10341 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10342 @node export options
10343 @appendixsubsec export options
10344
10345 These standard options are supported by @code{export}
10346 (@pxref{Common options}, for a complete description of
10347 them):
10348
10349 @table @code
10350 @item -D @var{date}
10351 Use the most recent revision no later than @var{date}.
10352
10353 @item -f
10354 If no matching revision is found, retrieve the most
10355 recent revision (instead of ignoring the file).
10356
10357 @item -l
10358 Local; run only in current working directory.
10359
10360 @item -n
10361 Do not run any checkout program.
10362
10363 @item -R
10364 Export directories recursively.  This is on by default.
10365
10366 @item -r @var{tag}[:@var{date}]
10367 Export the revision specified by @var{tag} or, when @var{date} is specified
10368 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
10369 existed on @var{date}.  See @ref{Common options}.
10370 @end table
10371
10372 In addition, these options (that are common to
10373 @code{checkout} and @code{export}) are also supported:
10374
10375 @table @code
10376 @item -d @var{dir}
10377 Create a directory called @var{dir} for the working
10378 files, instead of using the module name.
10379 @xref{checkout options}, for complete details on how
10380 @sc{cvs} handles this flag.
10381
10382 @item -k @var{subst}
10383 Set keyword expansion mode (@pxref{Substitution modes}).
10384
10385 @item -N
10386 Only useful together with @samp{-d @var{dir}}.
10387 @xref{checkout options}, for complete details on how
10388 @sc{cvs} handles this flag.
10389 @end table
10390
10391 @ignore
10392 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10393 @c @node export examples
10394 @appendixsubsec export examples
10395
10396 Contributed examples are gratefully accepted.
10397 @c -- Examples here!!
10398 @end ignore
10399
10400 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10401 @node history
10402 @appendixsec history---Show status of files and users
10403 @cindex history (subcommand)
10404
10405 @itemize @bullet
10406 @item
10407 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
10408 @item
10409 Requires: the file @file{$CVSROOT/CVSROOT/history}
10410 @item
10411 Changes: nothing.
10412 @end itemize
10413
10414 @sc{cvs} can keep a history log that tracks each use of most @sc{cvs}
10415 commands.  You can use @code{history} to display this information in
10416 various formats.
10417
10418 To enable logging, the @samp{LogHistory} config option must be set to
10419 some value other than the empty string and the history file specified by
10420 the @samp{HistoryLogPath} option must be writable by all users who may run
10421 the @sc{cvs} executable (@pxref{config}).
10422
10423 To enable the @code{history} command, logging must be enabled as above and
10424 the @samp{HistorySearchPath} config option (@pxref{config}) must be set to
10425 specify some number of the history logs created thereby and these files must
10426 be readable by each user who might run the @code{history} command.
10427
10428 Creating a repository via the @code{cvs init} command will enable logging of
10429 all possible events to a single history log file
10430 (@file{$CVSROOT/CVSROOT/history}) with read and write permissions for all
10431 users (@pxref{Creating a repository}).
10432
10433 @strong{Note: @code{history} uses @samp{-f}, @samp{-l},
10434 @samp{-n}, and @samp{-p} in ways that conflict with the
10435 normal use inside @sc{cvs} (@pxref{Common options}).}
10436
10437 @menu
10438 * history options::             history options
10439 @end menu
10440
10441 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10442 @node history options
10443 @appendixsubsec history options
10444
10445 Several options (shown above as @samp{-report})  control  what
10446 kind of report is generated:
10447
10448 @table @code
10449 @item -c
10450 Report on each time commit was used (i.e., each time
10451 the repository was modified).
10452
10453 @item -e
10454 Everything (all record types).  Equivalent to
10455 specifying @samp{-x} with all record types.  Of course,
10456 @samp{-e} will also include record types which are
10457 added in a future version of @sc{cvs}; if you are
10458 writing a script which can only handle certain record
10459 types, you'll want to specify @samp{-x}.
10460
10461 @item -m @var{module}
10462 Report on a particular module.  (You can meaningfully
10463 use @samp{-m} more than once on the command line.)
10464
10465 @item -o
10466 Report on checked-out modules.  This is the default report type.
10467
10468 @item -T
10469 Report on all tags.
10470
10471 @item -x @var{type}
10472 Extract a particular set of record types @var{type} from the @sc{cvs}
10473 history.  The types are indicated by single letters,
10474 which you may specify in combination.
10475
10476 Certain commands have a single record type:
10477
10478 @table @code
10479 @item F
10480 release
10481 @item O
10482 checkout
10483 @item E
10484 export
10485 @item T
10486 rtag
10487 @end table
10488
10489 @noindent
10490 One of five record types may result from an update:
10491
10492 @table @code
10493 @item C
10494 A merge was necessary but collisions were
10495 detected (requiring manual merging).
10496 @item G
10497 A merge was necessary and it succeeded.
10498 @item U
10499 A working file was copied from the repository.
10500 @item P
10501 A working file was patched to match the repository.
10502 @item W
10503 The working copy of a file was deleted during
10504 update (because it was gone from the repository).
10505 @end table
10506
10507 @noindent
10508 One of three record types results from commit:
10509
10510 @table @code
10511 @item A
10512 A file was added for the first time.
10513 @item M
10514 A file was modified.
10515 @item R
10516 A file was removed.
10517 @end table
10518 @end table
10519
10520 The options shown as @samp{-flags} constrain or expand
10521 the report without requiring option arguments:
10522
10523 @table @code
10524 @item -a
10525 Show data for all users (the default is to show data
10526 only for the user executing @code{history}).
10527
10528 @item -l
10529 Show last modification only.
10530
10531 @item -w
10532 Show only the records for modifications done from the
10533 same working directory where @code{history} is
10534 executing.
10535 @end table
10536
10537 The options shown as @samp{-options @var{args}} constrain the report
10538 based on an argument:
10539
10540 @table @code
10541 @item -b @var{str}
10542 Show data back to a record containing  the  string
10543 @var{str}  in  either the module name, the file name, or
10544 the repository path.
10545
10546 @item -D @var{date}
10547 Show data since @var{date}.  This is slightly different
10548 from the normal use of @samp{-D @var{date}}, which
10549 selects the newest revision older than @var{date}.
10550
10551 @item -f @var{file}
10552 Show data for a particular file
10553 (you can specify several @samp{-f} options on the same command line).
10554 This is equivalent to specifying the file on the command line.
10555
10556 @item -n @var{module}
10557 Show data for a particular module
10558 (you can specify several @samp{-n} options on the same command line).
10559
10560 @item -p @var{repository}
10561 Show data for a particular source repository  (you
10562 can specify several @samp{-p} options on the same command
10563 line).
10564
10565 @item -r @var{rev}
10566 Show records referring to revisions since the revision
10567 or tag named @var{rev} appears in individual @sc{rcs}
10568 files.  Each @sc{rcs} file is searched for the revision or
10569 tag.
10570
10571 @item -t @var{tag}
10572 Show records since tag @var{tag} was last added to the
10573 history file.  This differs from the @samp{-r} flag
10574 above in that it reads only the history file, not the
10575 @sc{rcs} files, and is much faster.
10576
10577 @item -u @var{name}
10578 Show records for user @var{name}.
10579
10580 @item -z @var{timezone}
10581 Show times in the selected records using the specified
10582 time zone instead of UTC.
10583 @end table
10584
10585 @ignore
10586 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10587 @c @node history examples
10588 @appendixsubsec history examples
10589
10590 Contributed examples will gratefully be accepted.
10591 @c -- Examples here!
10592 @end ignore
10593
10594 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10595 @node import
10596 @appendixsec import---Import sources into CVS, using vendor branches
10597 @cindex import (subcommand)
10598
10599 @c FIXME: This node is way too long for one which has subnodes.
10600
10601 @itemize @bullet
10602 @item
10603 Synopsis: import [-options] repository vendortag releasetag@dots{}
10604 @item
10605 Requires: Repository, source distribution directory.
10606 @item
10607 Changes: repository.
10608 @end itemize
10609
10610 Use @code{import} to incorporate an entire source
10611 distribution from an outside source (e.g., a source
10612 vendor) into your source repository directory.  You can
10613 use this command both for initial creation of a
10614 repository, and for wholesale updates to the module
10615 from the outside source.  @xref{Tracking sources}, for
10616 a discussion on this subject.
10617
10618 The @var{repository} argument gives a directory name
10619 (or a path to a directory) under the @sc{cvs} root directory
10620 for repositories; if the directory did not exist,
10621 import creates it.
10622
10623 When you use import for updates to source that has been
10624 modified in your source repository (since a prior
10625 import), it will notify you of any files that conflict
10626 in the two branches of development; use @samp{checkout
10627 -j} to reconcile the differences, as import instructs
10628 you to do.
10629
10630 If @sc{cvs} decides a file should be ignored
10631 (@pxref{cvsignore}), it does not import it and prints
10632 @samp{I } followed by the filename (@pxref{import output}, for a
10633 complete description of the output).
10634
10635 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10636 any file whose names match the specifications in that
10637 file will be treated as packages and the appropriate
10638 filtering will be performed on the file/directory
10639 before being imported.  @xref{Wrappers}.
10640
10641 The outside source is saved in a first-level
10642 branch, by default 1.1.1.  Updates are leaves of this
10643 branch; for example, files from the first imported
10644 collection of source will be revision 1.1.1.1, then
10645 files from the first imported update will be revision
10646 1.1.1.2, and so on.
10647
10648 At least three arguments are required.
10649 @var{repository} is needed to identify the collection
10650 of source.  @var{vendortag} is a tag for the entire
10651 branch (e.g., for 1.1.1).  You must also specify at
10652 least one @var{releasetag} to uniquely identify the files at
10653 the leaves created each time you execute @code{import}.  The
10654 @var{releasetag} should be new, not previously existing in the
10655 repository file, and uniquely identify the imported release,
10656
10657 @c I'm not completely sure this belongs here.  But
10658 @c we need to say it _somewhere_ reasonably obvious; it
10659 @c is a common misconception among people first learning CVS
10660 Note that @code{import} does @emph{not} change the
10661 directory in which you invoke it.  In particular, it
10662 does not set up that directory as a @sc{cvs} working
10663 directory; if you want to work with the sources import
10664 them first and then check them out into a different
10665 directory (@pxref{Getting the source}).
10666
10667 @menu
10668 * import options::              import options
10669 * import output::               import output
10670 * import examples::             import examples
10671 @end menu
10672
10673 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10674 @node import options
10675 @appendixsubsec import options
10676
10677 This standard option is supported by @code{import}
10678 (@pxref{Common options}, for a complete description):
10679
10680 @table @code
10681 @item -m @var{message}
10682 Use @var{message} as log information, instead of
10683 invoking an editor.
10684 @end table
10685
10686 There are the following additional special options.
10687
10688 @table @code
10689 @item -b @var{branch}
10690 See @ref{Multiple vendor branches}.
10691
10692 @item -k @var{subst}
10693 Indicate the keyword expansion mode desired.  This
10694 setting will apply to all files created during the
10695 import, but not to any files that previously existed in
10696 the repository.  See @ref{Substitution modes}, for a
10697 list of valid @samp{-k} settings.
10698
10699 @item -I @var{name}
10700 Specify file names that should be ignored during
10701 import.  You can use this option repeatedly.  To avoid
10702 ignoring any files at all (even those ignored by
10703 default), specify `-I !'.
10704
10705 @var{name} can be a file name pattern of the same type
10706 that you can specify in the @file{.cvsignore} file.
10707 @xref{cvsignore}.
10708 @c -- Is this really true?
10709
10710 @item -W @var{spec}
10711 Specify file names that should be filtered during
10712 import.  You can use this option repeatedly.
10713
10714 @var{spec} can be a file name pattern of the same type
10715 that you can specify in the @file{.cvswrappers}
10716 file. @xref{Wrappers}.
10717
10718 @item -X
10719 Modify the algorithm used by @sc{cvs} when importing new files
10720 so that new files do not immediately appear on the main trunk.
10721
10722 Specifically, this flag causes @sc{cvs} to mark new files as
10723 if they were deleted on the main trunk, by taking the following
10724 steps for each file in addition to those normally taken on import:
10725 creating a new revision on the main trunk indicating that
10726 the new file is @code{dead}, resetting the new file's default branch,
10727 and placing the file in the Attic (@pxref{Attic}) directory.
10728
10729 Use of this option can be forced on a repository-wide basis
10730 by setting the @samp{ImportNewFilesToVendorBranchOnly} option in
10731 CVSROOT/config (@pxref{config}).
10732 @end table
10733
10734 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10735 @node import output
10736 @appendixsubsec import output
10737
10738 @code{import} keeps you informed of its progress by printing a line
10739 for each file, preceded by one character indicating the status of the file:
10740
10741 @table @code
10742 @item U @var{file}
10743 The file already exists in the repository and has not been locally
10744 modified; a new revision has been created (if necessary).
10745
10746 @item N @var{file}
10747 The file is a new file which has been added to the repository.
10748
10749 @item C @var{file}
10750 The file already exists in the repository but has been locally modified;
10751 you will have to merge the changes.
10752
10753 @item I @var{file}
10754 The file is being ignored (@pxref{cvsignore}).
10755
10756 @cindex Symbolic link, importing
10757 @cindex Link, symbolic, importing
10758 @c FIXME: also (somewhere else) probably
10759 @c should be documenting what happens if you "cvs add"
10760 @c a symbolic link.  Also maybe what happens if
10761 @c you manually create symbolic links within the
10762 @c repository (? - not sure why we'd want to suggest
10763 @c doing that).
10764 @item L @var{file}
10765 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10766 People periodically suggest that this behavior should
10767 be changed, but if there is a consensus on what it
10768 should be changed to, it is not apparent.
10769 (Various options in the @file{modules} file can be used
10770 to recreate symbolic links on checkout, update, etc.;
10771 @pxref{modules}.)
10772 @end table
10773
10774 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10775 @node import examples
10776 @appendixsubsec import examples
10777
10778 See @ref{Tracking sources}, and @ref{From files}.
10779
10780 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10781 @node log
10782 @appendixsec log---Print out log information for files
10783 @cindex log (subcommand)
10784
10785 @itemize @bullet
10786 @item
10787 Synopsis: log [options] [files@dots{}]
10788 @item
10789 Requires: repository, working directory.
10790 @item
10791 Changes: nothing.
10792 @end itemize
10793
10794 Display log information for files.  @code{log} used to
10795 call the @sc{rcs} utility @code{rlog}.  Although this
10796 is no longer true in the current sources, this history
10797 determines the format of the output and the options,
10798 which are not quite in the style of the other @sc{cvs}
10799 commands.
10800
10801 @cindex Timezone, in output
10802 @cindex Zone, time, in output
10803 The output includes the location of the @sc{rcs} file,
10804 the @dfn{head} revision (the latest revision on the
10805 trunk), all symbolic names (tags) and some other
10806 things.  For each revision, the revision number, the
10807 date, the author, the number of lines added/deleted, the commitid
10808 and the log message are printed.  All dates are displayed
10809 in local time at the client. This is typically specified in
10810 the @code{$TZ} environment variable, which can be set to
10811 govern how @code{log} displays dates.
10812
10813 @strong{Note: @code{log} uses @samp{-R} in a way that conflicts
10814 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10815
10816 @menu
10817 * log options::                 log options
10818 * log examples::                log examples
10819 @end menu
10820
10821 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10822 @node log options
10823 @appendixsubsec log options
10824
10825 By default, @code{log} prints all information that is
10826 available.  All other options restrict the output.  Note that the revision
10827 selection options (@code{-d}, @code{-r}, @code{-s}, and @code{-w}) have no
10828 effect, other than possibly causing a search for files in Attic directories,
10829 when used in conjunction with the options that restrict the output to only
10830 @code{log} header fields (@code{-b}, @code{-h}, @code{-R}, and @code{-t})
10831 unless the @code{-S} option is also specified.
10832
10833 @table @code
10834 @item -b
10835 Print information about the revisions on the default
10836 branch, normally the highest branch on the trunk.
10837
10838 @item -d @var{dates}
10839 Print information about revisions with a checkin
10840 date/time in the range given by the
10841 semicolon-separated list of dates.  The date formats
10842 accepted are those accepted by the @samp{-D} option to
10843 many other @sc{cvs} commands (@pxref{Common options}).
10844 Dates can be combined into ranges as follows:
10845
10846 @c Should we be thinking about accepting ISO8601
10847 @c ranges?  For example "1972-09-10/1972-09-12".
10848 @table @code
10849 @item @var{d1}<@var{d2}
10850 @itemx @var{d2}>@var{d1}
10851 Select the revisions that were deposited between
10852 @var{d1} and @var{d2}.
10853
10854 @item <@var{d}
10855 @itemx @var{d}>
10856 Select all revisions dated @var{d} or earlier.
10857
10858 @item @var{d}<
10859 @itemx >@var{d}
10860 Select all revisions dated @var{d} or later.
10861
10862 @item @var{d}
10863 Select the single, latest revision dated @var{d} or
10864 earlier.
10865 @end table
10866
10867 The @samp{>} or @samp{<} characters may be followed by
10868 @samp{=} to indicate an inclusive range rather than an
10869 exclusive one.
10870
10871 Note that the separator is a semicolon (;).
10872
10873 @item -h
10874 Print only the name of the @sc{rcs} file, name
10875 of the file in the working directory, head,
10876 default branch, access list, locks, symbolic names, and
10877 suffix.
10878
10879 @item -l
10880 Local; run only in current working directory.  (Default
10881 is to run recursively).
10882
10883 @item -N
10884 Do not print the list of tags for this file.  This
10885 option can be very useful when your site uses a lot of
10886 tags, so rather than "more"'ing over 3 pages of tag
10887 information, the log information is presented without
10888 tags at all.
10889
10890 @item -R
10891 Print only the name of the @sc{rcs} file.
10892
10893 @c Note that using a bare revision (in addition to not
10894 @c being explicitly documented here) is potentially
10895 @c confusing; it shows the log message to get from the
10896 @c previous revision to that revision.  "-r1.3 -r1.6"
10897 @c (equivalent to "-r1.3,1.6") is even worse; it
10898 @c prints the messages to get from 1.2 to 1.3 and 1.5
10899 @c to 1.6.  By analogy with "cvs diff", users might
10900 @c expect that it is more like specifying a range.
10901 @c It is not 100% clear to me how much of this should
10902 @c be documented (for example, multiple -r options
10903 @c perhaps could/should be deprecated given the false
10904 @c analogy with "cvs diff").
10905 @c In general, this section should be rewritten to talk
10906 @c about messages to get from revision rev1 to rev2,
10907 @c rather than messages for revision rev2 (that is, the
10908 @c messages are associated with a change not a static
10909 @c revision and failing to make this distinction causes
10910 @c much confusion).
10911 @item -r@var{revisions}
10912 Print information about revisions given in the
10913 comma-separated list @var{revisions} of revisions and
10914 ranges.  The following table explains the available
10915 range formats:
10916
10917 @table @code
10918 @item @var{rev1}:@var{rev2}
10919 Revisions @var{rev1} to @var{rev2} (which must be on
10920 the same branch).
10921
10922 @item @var{rev1}::@var{rev2}
10923 The same, but excluding @var{rev1}.
10924
10925 @item :@var{rev}
10926 @itemx ::@var{rev}
10927 Revisions from the beginning of the branch up to
10928 and including @var{rev}.
10929
10930 @item @var{rev}:
10931 Revisions starting with @var{rev} to the end of the
10932 branch containing @var{rev}.
10933
10934 @item @var{rev}::
10935 Revisions starting just after @var{rev} to the end of the
10936 branch containing @var{rev}.
10937
10938 @item @var{branch}
10939 An argument that is a branch means all revisions on
10940 that branch.
10941
10942 @item @var{branch1}:@var{branch2}
10943 @itemx @var{branch1}::@var{branch2}
10944 A range of branches means all revisions
10945 on the branches in that range.
10946
10947 @item @var{branch}.
10948 The latest revision in @var{branch}.
10949 @end table
10950
10951 A bare @samp{-r} with no revisions means the latest
10952 revision on the default branch, normally the trunk.
10953 There can be no space between the @samp{-r} option and
10954 its argument.
10955
10956 @item -S
10957 Suppress the header if no revisions are selected.
10958
10959 @item -s @var{states}
10960 Print information about revisions whose state
10961 attributes match one of the states given in the
10962 comma-separated list @var{states}.  Individual states may
10963 be any text string, though @sc{cvs} commonly only uses two
10964 states, @samp{Exp} and @samp{dead}.  See @ref{admin options}
10965 for more information.
10966
10967 @item -t
10968 Print the same as @samp{-h}, plus the descriptive text.
10969
10970 @item -w@var{logins}
10971 Print information about revisions checked in by users
10972 with login names appearing in the comma-separated list
10973 @var{logins}.  If @var{logins} is omitted, the user's
10974 login is assumed.  There can be no space between the
10975 @samp{-w} option and its argument.
10976 @end table
10977
10978 @code{log} prints the intersection of the revisions
10979 selected with the options @samp{-d}, @samp{-s}, and
10980 @samp{-w}, intersected with the union of the revisions
10981 selected by @samp{-b} and @samp{-r}.
10982
10983 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10984 @node log examples
10985 @appendixsubsec log examples
10986
10987 @cindex Timezone, in output
10988 @cindex Zone, time, in output
10989 Since @code{log} shows dates in local time,
10990 you might want to see them in Coordinated Universal Time (UTC) or
10991 some other timezone.
10992 To do this you can set your @code{$TZ} environment
10993 variable before invoking @sc{cvs}:
10994
10995 @example
10996 $ TZ=UTC cvs log foo.c
10997 $ TZ=EST cvs log bar.c
10998 @end example
10999
11000 (If you are using a @code{csh}-style shell, like @code{tcsh},
11001 you would need to prefix the examples above with @code{env}.)
11002
11003 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11004 @node ls & rls
11005 @appendixsec ls & rls
11006 @cindex ls (subcommand)
11007 @cindex rls (subcommand)
11008
11009 @itemize @bullet
11010 @item
11011 ls [-e | -l] [-RP] [-r tag[:date]] [-D date] [path@dots{}]
11012 @item
11013 Requires: repository for @code{rls}, repository & working directory for
11014 @code{ls}.
11015 @item
11016 Changes: nothing.
11017 @item
11018 Synonym: @code{dir} & @code{list} are synonyms for @code{ls} and @code{rdir}
11019 & @code{rlist} are synonyms for @code{rls}.
11020 @end itemize
11021
11022 The @code{ls} and @code{rls} commands are used to list
11023 files and directories in the repository.
11024
11025 By default @code{ls} lists the files and directories
11026 that belong in your working directory, what would be
11027 there after an @code{update}.
11028
11029 By default @code{rls} lists the files and directories
11030 on the tip of the trunk in the topmost directory of the
11031 repository.
11032
11033 Both commands accept an optional list of file and
11034 directory names, relative to the working directory for
11035 @code{ls} and the topmost directory of the repository
11036 for @code{rls}.  Neither is recursive by default.
11037
11038 @menu
11039 * ls & rls options::         ls & rls options
11040 * rls examples:              rls examples
11041 @end menu
11042
11043 @node ls & rls options
11044 @appendixsubsec ls & rls options
11045
11046 These standard options are supported by @code{ls} & @code{rls}:
11047
11048 @table @code
11049 @item -d
11050 Show dead revisions (with tag when specified).
11051
11052 @item -e
11053 Display in CVS/Entries format.  This format is meant to remain easily parsable
11054 by automation.
11055
11056 @item -l
11057 Display all details.
11058
11059 @item -P
11060 Don't list contents of empty directories when recursing.
11061
11062 @item -R
11063 List recursively.
11064
11065 @item -r @var{tag}[:@var{date}]
11066 Show files specified by @var{tag} or, when @var{date} is specified
11067 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11068 existed on @var{date}.  See @ref{Common options}.
11069
11070 @item -D @var{date}
11071 Show files from date.
11072 @end table
11073
11074 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11075 @node rls examples
11076 @appendixsubsec rls examples
11077
11078 @example
11079 $ cvs rls
11080 cvs rls: Listing module: `.'
11081 CVSROOT
11082 first-dir
11083 @end example
11084
11085 @example
11086 $ cvs rls CVSROOT
11087 cvs rls: Listing module: `CVSROOT'
11088 checkoutlist
11089 commitinfo
11090 config
11091 cvswrappers
11092 loginfo
11093 modules
11094 notify
11095 rcsinfo
11096 taginfo
11097 verifymsg
11098
11099 @end example
11100
11101 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11102 @node rdiff
11103 @appendixsec rdiff---'patch' format diffs between releases
11104 @cindex rdiff (subcommand)
11105
11106 @itemize @bullet
11107 @item
11108 rdiff [-flags] [-V vn] (-r tag1[:date1] | -D date1) [-r tag2[:date2] | -D date2] modules@dots{}
11109 @item
11110 Requires: repository.
11111 @item
11112 Changes: nothing.
11113 @item
11114 Synonym: patch
11115 @end itemize
11116
11117 Builds a Larry Wall format patch(1) file between two
11118 releases, that can be fed directly into the @code{patch}
11119 program to bring an old release up-to-date with the new
11120 release.  (This is one of the few @sc{cvs} commands that
11121 operates directly from the repository, and doesn't
11122 require a prior checkout.) The diff output is sent to
11123 the standard output device.
11124
11125 You can specify (using the standard @samp{-r} and
11126 @samp{-D} options) any combination of one or two
11127 revisions or dates.  If only one revision or date is
11128 specified, the patch file reflects differences between
11129 that revision or date and the current head revisions in
11130 the @sc{rcs} file.
11131
11132 Note that if the software release affected is contained
11133 in more than one directory, then it may be necessary to
11134 specify the @samp{-p} option to the @code{patch} command when
11135 patching the old sources, so that @code{patch} is able to find
11136 the files that are located in other directories.
11137
11138 @menu
11139 * rdiff options::               rdiff options
11140 * rdiff examples::              rdiff examples
11141 @end menu
11142
11143 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11144 @node rdiff options
11145 @appendixsubsec rdiff options
11146
11147 These standard options are supported by @code{rdiff}
11148 (@pxref{Common options}, for a complete description of
11149 them):
11150
11151 @table @code
11152 @item -D @var{date}
11153 Use the most recent revision no later than @var{date}.
11154
11155 @item -f
11156 If no matching revision is found, retrieve the most
11157 recent revision (instead of ignoring the file).
11158
11159 @item -k @var{kflag}
11160 Process keywords according to @var{kflag}.  See
11161 @ref{Keyword substitution}.
11162
11163 @item -l
11164 Local; don't descend subdirectories.
11165
11166 @item -R
11167 Examine directories recursively.  This option is on by default.
11168
11169 @item -r @var{tag}
11170 Use the revision specified by @var{tag}, or when @var{date} is specified
11171 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11172 existed on @var{date}.  See @ref{Common options}.
11173 @end table
11174
11175 In addition to the above, these options are available:
11176
11177 @table @code
11178 @item -c
11179 Use the context diff format.  This is the default format.
11180
11181 @item -s
11182 Create a summary change report instead of a patch.  The
11183 summary includes information about files that were
11184 changed or added between the releases.  It is sent to
11185 the standard output device.  This is useful for finding
11186 out, for example, which files have changed between two
11187 dates or revisions.
11188
11189 @item -t
11190 A diff of the top two revisions is sent to the standard
11191 output device.  This is most useful for seeing what the
11192 last change to a file was.
11193
11194 @item -u
11195 Use the unidiff format for the context diffs.
11196 Remember that old versions
11197 of the @code{patch} program can't handle the unidiff
11198 format, so if you plan to post this patch to the net
11199 you should probably not use @samp{-u}.
11200
11201 @item -V @var{vn}
11202 Expand keywords according to the rules current in
11203 @sc{rcs} version @var{vn} (the expansion format changed with
11204 @sc{rcs} version 5).  Note that this option is no
11205 longer accepted.  @sc{cvs} will always expand keywords the
11206 way that @sc{rcs} version 5 does.
11207 @end table
11208
11209 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11210 @node rdiff examples
11211 @appendixsubsec rdiff examples
11212
11213 Suppose you receive mail from @t{foo@@example.net} asking for an
11214 update from release 1.2 to 1.4 of the tc compiler.  You
11215 have no such patches on hand, but with @sc{cvs} that can
11216 easily be fixed with a command such as this:
11217
11218 @example
11219 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
11220 $$ Mail -s 'The patches you asked for' foo@@example.net
11221 @end example
11222
11223 Suppose you have made release 1.3, and forked a branch
11224 called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
11225 corresponds to release 1.3.1, which was made some time
11226 ago.  Now, you want to see how much development has been
11227 done on the branch.  This command can be used:
11228
11229 @example
11230 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
11231 cvs rdiff: Diffing module-name
11232 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
11233 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
11234 File bar.h,v changed from revision 1.29.2.1 to 1.2
11235 @end example
11236
11237 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11238 @node release
11239 @appendixsec release---Indicate that a Module is no longer in use
11240 @cindex release (subcommand)
11241
11242 @itemize @bullet
11243 @item
11244 release [-d] directories@dots{}
11245 @item
11246 Requires: Working directory.
11247 @item
11248 Changes: Working directory, history log.
11249 @end itemize
11250
11251 This command is meant to safely cancel the effect of
11252 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
11253 isn't strictly necessary to use this command.  You can
11254 always simply delete your working directory, if you
11255 like; but you risk losing changes you may have
11256 forgotten, and you leave no trace in the @sc{cvs} history
11257 file (@pxref{history file}) that you've abandoned your
11258 checkout.
11259
11260 Use @samp{cvs release} to avoid these problems.  This
11261 command checks that no uncommitted changes are
11262 present; that you are executing it from immediately
11263 above a @sc{cvs} working directory; and that the repository
11264 recorded for your files is the same as the repository
11265 defined in the module database.
11266
11267 If all these conditions are true, @samp{cvs release}
11268 leaves a record of its execution (attesting to your
11269 intentionally abandoning your checkout) in the @sc{cvs}
11270 history log.
11271
11272 @menu
11273 * release options::             release options
11274 * release output::              release output
11275 * release examples::            release examples
11276 @end menu
11277
11278 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11279 @node release options
11280 @appendixsubsec release options
11281
11282 The @code{release} command supports one command option:
11283
11284 @table @code
11285 @item -d
11286 Delete your working copy of the file if the release
11287 succeeds.  If this flag is not given your files will
11288 remain in your working directory.
11289
11290 @strong{WARNING:  The @code{release} command deletes
11291 all directories and files recursively.  This
11292 has the very serious side-effect that any directory
11293 that you have created inside your checked-out sources,
11294 and not added to the repository (using the @code{add}
11295 command; @pxref{Adding files}) will be silently deleted---even
11296 if it is non-empty!}
11297 @end table
11298
11299 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11300 @node release output
11301 @appendixsubsec release output
11302
11303 Before @code{release} releases your sources it will
11304 print a one-line message for any file that is not
11305 up-to-date.
11306
11307 @table @code
11308 @item U @var{file}
11309 @itemx P @var{file}
11310 There exists a newer revision of this file in the
11311 repository, and you have not modified your local copy
11312 of the file (@samp{U} and @samp{P} mean the same thing).
11313
11314 @item A @var{file}
11315 The file has been added to your private copy of the
11316 sources, but has not yet been committed to the
11317 repository.  If you delete your copy of the sources
11318 this file will be lost.
11319
11320 @item R @var{file}
11321 The file has been removed from your private copy of the
11322 sources, but has not yet been removed from the
11323 repository, since you have not yet committed the
11324 removal.  @xref{commit}.
11325
11326 @item M @var{file}
11327 The file is modified in your working directory.  There
11328 might also be a newer revision inside the repository.
11329
11330 @item ? @var{file}
11331 @var{file} is in your working directory, but does not
11332 correspond to anything in the source repository, and is
11333 not in the list of files for @sc{cvs} to ignore (see the
11334 description of the @samp{-I} option, and
11335 @pxref{cvsignore}).  If you remove your working
11336 sources, this file will be lost.
11337 @end table
11338
11339 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11340 @node release examples
11341 @appendixsubsec release examples
11342
11343 Release the @file{tc} directory, and delete your local working copy
11344 of the files.
11345
11346 @example
11347 $ cd ..         # @r{You must stand immediately above the}
11348                 # @r{sources when you issue @samp{cvs release}.}
11349 $ cvs release -d tc
11350 You have [0] altered files in this repository.
11351 Are you sure you want to release (and delete) directory `tc': y
11352 $
11353 @end example
11354
11355 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11356 @node server & pserver
11357 @appendixsec server & pserver---Act as a server for a client on stdin/stdout
11358 @cindex pserver (subcommand)
11359 @cindex server (subcommand)
11360
11361 @itemize @bullet
11362 @item
11363 pserver [-c path]
11364
11365 server [-c path]
11366 @item
11367 Requires: repository, client conversation on stdin/stdout
11368 @item
11369 Changes: Repository or, indirectly, client working directory.
11370 @end itemize
11371
11372 The @sc{cvs} @code{server} and @code{pserver} commands are used to provide
11373 repository access to remote clients and expect a client conversation on
11374 stdin & stdout.  Typically these commands are launched from @code{inetd} or
11375 via @code{ssh} (@pxref{Remote repositories}).
11376
11377 @code{server} expects that the client has already been authenticated somehow,
11378 typically via @sc{ssh}, and @code{pserver} attempts to authenticate the client
11379 itself.
11380
11381 Only one option is available with the @code{server} and @code{pserver}
11382 commands:
11383
11384 @cindex configuration file
11385 @table @code
11386 @item -c path
11387 Load configuration from @var{path} rather than the default location 
11388 @file{$CVSROOT/CVSROOT/config} (@pxref{config}).  @var{path} must be
11389 @file{/etc/cvs.conf} or prefixed by @file{/etc/cvs/}.  This option is
11390 supported beginning with @sc{cvs} release 1.12.13.
11391 @end table
11392
11393 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11394 @node update
11395 @appendixsec update---Bring work tree in sync with repository
11396 @cindex update (subcommand)
11397
11398 @itemize @bullet
11399 @item
11400 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag[:date] | -D date] [-W spec] files@dots{}
11401 @item
11402 Requires: repository, working directory.
11403 @item
11404 Changes: working directory.
11405 @end itemize
11406
11407 After you've run checkout to create your private copy
11408 of source from the common repository, other developers
11409 will continue changing the central source.  From time
11410 to time, when it is convenient in your development
11411 process, you can use the @code{update} command from
11412 within your working directory to reconcile your work
11413 with any revisions applied to the source repository
11414 since your last checkout or update.  Without the @code{-C}
11415 option, @code{update} will also merge any differences
11416 between the local copy of files and their base revisions
11417 into any destination revisions specified with @code{-r},
11418 @code{-D}, or @code{-A}.
11419
11420 @menu
11421 * update options::              update options
11422 * update output::               update output
11423 @end menu
11424
11425 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11426 @node update options
11427 @appendixsubsec update options
11428
11429 These standard options are available with @code{update}
11430 (@pxref{Common options}, for a complete description of
11431 them):
11432
11433 @table @code
11434 @item -D date
11435 Use the most recent revision no later than @var{date}.
11436 This option is sticky, and implies @samp{-P}.
11437 See @ref{Sticky tags}, for more information on sticky tags/dates.
11438
11439 @item -f
11440 Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision
11441 is found, retrieve the most recent revision (instead of ignoring the file).
11442
11443 @item -k @var{kflag}
11444 Process keywords according to @var{kflag}.  See
11445 @ref{Keyword substitution}.
11446 This option is sticky; future updates of
11447 this file in this working directory will use the same
11448 @var{kflag}.  The @code{status} command can be viewed
11449 to see the sticky options.  See @ref{Invoking CVS}, for
11450 more information on the @code{status} command.
11451
11452 @item -l
11453 Local; run only in current working directory.  @xref{Recursive behavior}.
11454
11455 @item -P
11456 Prune empty directories.  See @ref{Moving directories}.
11457
11458 @item -p
11459 Pipe files to the standard output.
11460
11461 @item -R
11462 Update directories recursively (default).  @xref{Recursive
11463 behavior}.
11464
11465 @item -r @var{tag}[:@var{date}]
11466 Retrieve the revisions specified by @var{tag} or, when @var{date} is specified
11467 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11468 existed on @var{date}.  This option is sticky, and implies @samp{-P}.
11469 See @ref{Sticky tags}, for more information on sticky tags/dates. Also
11470 see @ref{Common options}.
11471 @end table
11472
11473 @need 800
11474 These special options are also available with
11475 @code{update}.
11476
11477 @table @code
11478 @item -A
11479 Reset any sticky tags, dates, or @samp{-k} options.
11480 See @ref{Sticky tags}, for more information on sticky tags/dates.
11481
11482 @item -C
11483 Overwrite locally modified files with clean copies from
11484 the repository (the modified file is saved in
11485 @file{.#@var{file}.@var{revision}}, however).
11486
11487 @item -d
11488 Create any directories that exist in the repository if
11489 they're missing from the working directory.  Normally,
11490 @code{update} acts only on directories and files that
11491 were already enrolled in your working directory.
11492
11493 This is useful for updating directories that were
11494 created in the repository since the initial checkout;
11495 but it has an unfortunate side effect.  If you
11496 deliberately avoided certain directories in the
11497 repository when you created your working directory
11498 (either through use of a module name or by listing
11499 explicitly the files and directories you wanted on the
11500 command line), then updating with @samp{-d} will create
11501 those directories, which may not be what you want.
11502
11503 @item -I @var{name}
11504 Ignore files whose names match @var{name} (in your
11505 working directory) during the update.  You can specify
11506 @samp{-I} more than once on the command line to specify
11507 several files to ignore.  Use @samp{-I !} to avoid
11508 ignoring any files at all.  @xref{cvsignore}, for other
11509 ways to make @sc{cvs} ignore some files.
11510
11511 @item -W@var{spec}
11512 Specify file names that should be filtered during
11513 update.  You can use this option repeatedly.
11514
11515 @var{spec} can be a file name pattern of the same type
11516 that you can specify in the @file{.cvswrappers}
11517 file. @xref{Wrappers}.
11518
11519 @item -j@var{revision}
11520 With two @samp{-j} options, merge changes from the
11521 revision specified with the first @samp{-j} option to
11522 the revision specified with the second @samp{j} option,
11523 into the working directory.
11524
11525 With one @samp{-j} option, merge changes from the
11526 ancestor revision to the revision specified with the
11527 @samp{-j} option, into the working directory.  The
11528 ancestor revision is the common ancestor of the
11529 revision which the working directory is based on, and
11530 the revision specified in the @samp{-j} option.
11531
11532 Note that using a single @samp{-j @var{tagname}} option rather than
11533 @samp{-j @var{branchname}} to merge changes from a branch will
11534 often not remove files which were removed on the branch.
11535 @xref{Merging adds and removals}, for more.
11536
11537 In addition, each @samp{-j} option can contain an optional
11538 date specification which, when used with branches, can
11539 limit the chosen revision to one within a specific
11540 date.  An optional date is specified by adding a colon
11541 (:) to the tag:
11542 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
11543
11544 @xref{Branching and merging}.
11545
11546 @end table
11547
11548 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11549 @node update output
11550 @appendixsubsec update output
11551
11552 @code{update} and @code{checkout} keep you informed of
11553 their progress by printing a line for each file, preceded
11554 by one character indicating the status of the file:
11555
11556 @table @code
11557 @item U @var{file}
11558 The file was brought up to date with respect to the
11559 repository.  This is done for any file that exists in
11560 the repository but not in your working directory, and for files
11561 that you haven't changed but are not the most recent
11562 versions available in the repository.
11563
11564 @item P @var{file}
11565 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
11566 file.  This accomplishes the same thing as @samp{U} using less bandwidth.
11567
11568 @item A @var{file}
11569 The file has been added to your private copy of the
11570 sources, and will be added to the source repository
11571 when you run @code{commit} on the file.  This is a
11572 reminder to you that the file needs to be committed.
11573
11574 @item R @var{file}
11575 The file has been removed from your private copy of the
11576 sources, and will be removed from the source repository
11577 when you run @code{commit} on the file.  This is a
11578 reminder to you that the file needs to be committed.
11579
11580 @item M @var{file}
11581 The file is modified in  your  working  directory.
11582
11583 @samp{M} can indicate one of two states for a file
11584 you're working on: either there were no modifications
11585 to the same file in the repository, so that your file
11586 remains as you last saw it; or there were modifications
11587 in the repository as well as in your copy, but they
11588 were merged successfully, without conflict, in your
11589 working directory.
11590
11591 @sc{cvs} will print some messages if it merges your work,
11592 and a backup copy of your working file (as it looked
11593 before you ran @code{update}) will be made.  The exact
11594 name of that file is printed while @code{update} runs.
11595
11596 @item C @var{file}
11597 @cindex .# files
11598 @cindex __ files (VMS)
11599 A conflict was detected while trying to merge your
11600 changes to @var{file} with changes from the source
11601 repository.  @var{file} (the copy in your working
11602 directory) is now the result of attempting to merge
11603 the two revisions; an unmodified copy of your file
11604 is also in your working directory, with the name
11605 @file{.#@var{file}.@var{revision}} where @var{revision}
11606 is the revision that your modified file started
11607 from.  Resolve the conflict as described in
11608 @ref{Conflicts example}.
11609 @c "some systems" as in out-of-the-box OSes?  Not as
11610 @c far as I know.  We need to advise sysadmins as well
11611 @c as users how to set up this kind of purge, if that is
11612 @c what they want.
11613 @c We also might want to think about cleaner solutions,
11614 @c like having CVS remove the .# file once the conflict
11615 @c has been resolved or something like that.
11616 (Note that some systems automatically purge
11617 files that begin with @file{.#} if they have not been
11618 accessed for a few days.  If you intend to keep a copy
11619 of your original file, it is a very good idea to rename
11620 it.)  Under @sc{vms}, the file name starts with
11621 @file{__} rather than @file{.#}.
11622
11623 @item ? @var{file}
11624 @var{file} is in your working directory, but does not
11625 correspond to anything in the source repository, and is
11626 not in the list of files for @sc{cvs} to ignore (see the
11627 description of the @samp{-I} option, and
11628 @pxref{cvsignore}).
11629 @end table
11630
11631 @c ----- END MAN 1 -----
11632 @c ---------------------------------------------------------------------
11633 @node Invoking CVS
11634 @appendix Quick reference to CVS commands
11635 @cindex Command reference
11636 @cindex Reference, commands
11637 @cindex Invoking CVS
11638
11639 This appendix describes how to invoke @sc{cvs}, with
11640 references to where each command or feature is
11641 described in detail.  For other references run the
11642 @code{cvs --help} command, or see @ref{Index}.
11643
11644 A @sc{cvs} command looks like:
11645
11646 @example
11647 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
11648 @end example
11649
11650 Global options:
11651
11652 @table @code
11653 @item --allow-root=@var{rootdir}
11654 Specify legal @sc{cvsroot} directory (server only) (not
11655 in @sc{cvs} 1.9 and older).  See @ref{Password
11656 authentication server}.
11657
11658 @item -a
11659 Authenticate all communication (client only) (not in @sc{cvs}
11660 1.9 and older).  See @ref{Global options}.
11661
11662 @item -b
11663 Specify RCS location (@sc{cvs} 1.9 and older).  See
11664 @ref{Global options}.
11665
11666 @item -d @var{root}
11667 Specify the @sc{cvsroot}.  See @ref{Repository}.
11668
11669 @item -e @var{editor}
11670 Edit messages with @var{editor}.  See @ref{Committing
11671 your changes}.
11672
11673 @item -f
11674 Do not read the @file{~/.cvsrc} file.  See @ref{Global
11675 options}.
11676
11677 @item -H
11678 @itemx --help
11679 Print a help message.  See @ref{Global options}.
11680
11681 @item -n
11682 Do not change any files.  See @ref{Global options}.
11683
11684 @item -Q
11685 Be really quiet.  See @ref{Global options}.
11686
11687 @item -q
11688 Be somewhat quiet.  See @ref{Global options}.
11689
11690 @item -r
11691 Make new working files read-only.  See @ref{Global options}.
11692
11693 @item -s @var{variable}=@var{value}
11694 Set a user variable.  See @ref{Variables}.
11695
11696 @item -T @var{tempdir}
11697 Put temporary files in @var{tempdir}.  See @ref{Global
11698 options}.
11699
11700 @item -t
11701 Trace @sc{cvs} execution.  See @ref{Global options}.
11702
11703 @item -v
11704 @item --version
11705 Display version and copyright information for @sc{cvs}.
11706
11707 @item -w
11708 Make new working files read-write.  See @ref{Global
11709 options}.
11710
11711 @item -x
11712 Encrypt all communication (client only).
11713 See @ref{Global options}.
11714
11715 @item -z @var{gzip-level}
11716 @cindex Compression
11717 @cindex Gzip
11718 Set the compression level (client only).
11719 See @ref{Global options}.
11720 @end table
11721
11722 Keyword expansion modes (@pxref{Substitution modes}):
11723
11724 @example
11725 -kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11726 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11727 -kk   $@splitrcskeyword{Id}$
11728 -kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
11729 -ko   @i{no expansion}
11730 -kb   @i{no expansion, file is binary}
11731 @end example
11732
11733 Keywords (@pxref{Keyword list}):
11734
11735 @example
11736 $@splitrcskeyword{Author}: joe $
11737 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11738 $@splitrcskeyword{CVSHeader}: files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11739 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11740 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11741 $@splitrcskeyword{Locker}: harry $
11742 $@splitrcskeyword{Name}: snapshot_1_14 $
11743 $@splitrcskeyword{RCSfile}: file1,v $
11744 $@splitrcskeyword{Revision}: 1.1 $
11745 $@splitrcskeyword{Source}: /home/files/file1,v $
11746 $@splitrcskeyword{State}: Exp $
11747 $@splitrcskeyword{Log}: file1,v $
11748 Revision 1.1  1993/12/09 03:30:17  joe
11749 Initial revision
11750
11751 @end example
11752
11753 @c The idea behind this table is that we want each item
11754 @c to be a sentence or two at most.  Preferably a
11755 @c single line.
11756 @c
11757 @c In some cases refs to "foo options" are just to get
11758 @c this thing written quickly, not because the "foo
11759 @c options" node is really the best place to point.
11760 Commands, command options, and command arguments:
11761
11762 @table @code
11763 @c ------------------------------------------------------------
11764 @item add [@var{options}] [@var{files}@dots{}]
11765 Add a new file/directory.  See @ref{Adding files}.
11766
11767 @table @code
11768 @item -k @var{kflag}
11769 Set keyword expansion.
11770
11771 @item -m @var{msg}
11772 Set file description.
11773 @end table
11774
11775 @c ------------------------------------------------------------
11776 @item admin [@var{options}] [@var{files}@dots{}]
11777 Administration of history files in the repository.  See
11778 @ref{admin}.
11779 @c This list omits those options which are not
11780 @c documented as being useful with CVS.  That might be
11781 @c a mistake...
11782
11783 @table @code
11784 @item -b[@var{rev}]
11785 Set default branch.  See @ref{Reverting local changes}.
11786
11787 @item -c@var{string}
11788 Set comment leader.
11789
11790 @item -k@var{subst}
11791 Set keyword substitution.  See @ref{Keyword
11792 substitution}.
11793
11794 @item -l[@var{rev}]
11795 Lock revision @var{rev}, or latest revision.
11796
11797 @item -m@var{rev}:@var{msg}
11798 Replace the log message of revision @var{rev} with
11799 @var{msg}.
11800
11801 @item -o@var{range}
11802 Delete revisions from the repository.  See
11803 @ref{admin options}.
11804
11805 @item -q
11806 Run quietly; do not print diagnostics.
11807
11808 @item -s@var{state}[:@var{rev}]
11809 Set the state.  See @ref{admin options} for more information on possible
11810 states.
11811
11812 @c Does not work for client/server CVS
11813 @item -t
11814 Set file description from standard input.
11815
11816 @item -t@var{file}
11817 Set file description from @var{file}.
11818
11819 @item -t-@var{string}
11820 Set file description to @var{string}.
11821
11822 @item -u[@var{rev}]
11823 Unlock revision @var{rev}, or latest revision.
11824 @end table
11825
11826 @c ------------------------------------------------------------
11827 @item annotate [@var{options}] [@var{files}@dots{}]
11828 Show last revision where each line was modified.  See
11829 @ref{annotate}.
11830
11831 @table @code
11832 @item -D @var{date}
11833 Annotate the most recent revision no later than
11834 @var{date}.  See @ref{Common options}.
11835
11836 @item -F
11837 Force annotation of binary files.  (Without this option,
11838 binary files are skipped with a message.)
11839
11840 @item -f
11841 Use head revision if tag/date not found.  See
11842 @ref{Common options}.
11843
11844 @item -l
11845 Local; run only in current working directory.  @xref{Recursive behavior}.
11846
11847 @item -R
11848 Operate recursively (default).  @xref{Recursive
11849 behavior}.
11850
11851 @item -r @var{tag}[:@var{date}]
11852 Annotate revisions specified by @var{tag} or, when @var{date} is specified
11853 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11854 existed on @var{date}.  See @ref{Common options}.
11855 @end table
11856
11857 @c ------------------------------------------------------------
11858 @item checkout [@var{options}] @var{modules}@dots{}
11859 Get a copy of the sources.  See @ref{checkout}.
11860
11861 @table @code
11862 @item -A
11863 Reset any sticky tags/date/options.  See @ref{Sticky
11864 tags} and @ref{Keyword substitution}.
11865
11866 @item -c
11867 Output the module database.  See @ref{checkout options}.
11868
11869 @item -D @var{date}
11870 Check out revisions as of @var{date} (is sticky).  See
11871 @ref{Common options}.
11872
11873 @item -d @var{dir}
11874 Check out into @var{dir}.  See @ref{checkout options}.
11875
11876 @item -f
11877 Use head revision if tag/date not found.  See
11878 @ref{Common options}.
11879
11880 @c Probably want to use rev1/rev2 style like for diff
11881 @c -r.  Here and in on-line help.
11882 @item -j @var{tag}[:@var{date}]
11883 Merge in the change specified by @var{tag}, or when @var{date} is specified
11884 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11885 existed on @var{date}.  See @ref{checkout options}.
11886
11887 @item -k @var{kflag}
11888 Use @var{kflag} keyword expansion.  See
11889 @ref{Substitution modes}.
11890
11891 @item -l
11892 Local; run only in current working directory.  @xref{Recursive behavior}.
11893
11894 @item -N
11895 Don't ``shorten'' module paths if -d specified.  See
11896 @ref{checkout options}.
11897
11898 @item -n
11899 Do not run module program (if any).  See @ref{checkout options}.
11900
11901 @item -P
11902 Prune empty directories.  See @ref{Moving directories}.
11903
11904 @item -p
11905 Check out files to standard output (avoids
11906 stickiness).  See @ref{checkout options}.
11907
11908 @item -R
11909 Operate recursively (default).  @xref{Recursive
11910 behavior}.
11911
11912 @item -r @var{tag}[:@var{date}]
11913 Checkout the revision already tagged with @var{tag} or, when @var{date} is
11914 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
11915 as it existed on @var{date}.  This .  See @ref{Common options}.
11916
11917 @item -s
11918 Like -c, but include module status.  See @ref{checkout options}.
11919 @end table
11920
11921 @c ------------------------------------------------------------
11922 @item commit [@var{options}] [@var{files}@dots{}]
11923 Check changes into the repository.  See @ref{commit}.
11924
11925 @table @code
11926 @item -c
11927 Check for valid edits before committing.  Requires a @sc{cvs} client and server
11928 both version 1.12.10 or greater.
11929
11930 @item -F @var{file}
11931 Read log message from @var{file}.  See @ref{commit options}.
11932
11933 @item -f
11934 @c What is this "disables recursion"?  It is from the
11935 @c on-line help; is it documented in this manual?
11936 Force the file to be committed; disables recursion.
11937 See @ref{commit options}.
11938
11939 @item -l
11940 Local; run only in current working directory.  See @ref{Recursive behavior}.
11941
11942 @item -m @var{msg}
11943 Use @var{msg} as log message.  See @ref{commit options}.
11944
11945 @item -n
11946 Do not run module program (if any).  See @ref{commit options}.
11947
11948 @item -R
11949 Operate recursively (default).  @xref{Recursive
11950 behavior}.
11951
11952 @item -r @var{rev}
11953 Commit to @var{rev}.  See @ref{commit options}.
11954 @c FIXME: should be dragging over text from
11955 @c commit options, especially if it can be cleaned up
11956 @c and made concise enough.
11957 @end table
11958
11959 @c ------------------------------------------------------------
11960 @item diff [@var{options}] [@var{files}@dots{}]
11961 Show differences between revisions.  See @ref{diff}.
11962 In addition to the options shown below, accepts a wide
11963 variety of options to control output style, for example
11964 @samp{-c} for context diffs.
11965
11966 @table @code
11967 @item -D @var{date1}
11968 Diff revision for date against working file.  See
11969 @ref{diff options}.
11970
11971 @item -D @var{date2}
11972 Diff @var{rev1}/@var{date1} against @var{date2}.  See
11973 @ref{diff options}.
11974
11975 @item -l
11976 Local; run only in current working directory.  See @ref{Recursive behavior}.
11977
11978 @item -N
11979 Include diffs for added and removed files.  See
11980 @ref{diff options}.
11981
11982 @item -R
11983 Operate recursively (default).  @xref{Recursive
11984 behavior}.
11985
11986 @item -r @var{tag1}[:@var{date1}]
11987 Diff the revisions specified by @var{tag1} or, when @var{date1} is specified
11988 and @var{tag1} is a branch tag, the version from the branch @var{tag1} as it
11989 existed on @var{date1}, against the working file.  See @ref{diff options}
11990 and @ref{Common options}.
11991
11992 @item -r @var{tag2}[:@var{date2}]
11993 Diff the revisions specified by @var{tag2} or, when @var{date2} is specified
11994 and @var{tag2} is a branch tag, the version from the branch @var{tag2} as it
11995 existed on @var{date2}, against @var{rev1}/@var{date1}.  See @ref{diff options}
11996 and @ref{Common options}.
11997 @end table
11998
11999 @c ------------------------------------------------------------
12000 @item edit [@var{options}] [@var{files}@dots{}]
12001 Get ready to edit a watched file.  See @ref{Editing files}.
12002
12003 @table @code
12004 @item -a @var{actions}
12005 Specify actions for temporary watch, where
12006 @var{actions} is @code{edit}, @code{unedit},
12007 @code{commit}, @code{all}, or @code{none}.  See
12008 @ref{Editing files}.
12009
12010 @item -c
12011 Check edits: Edit fails if someone else is already editting the file.
12012 Requires a @sc{cvs} client and server both of version 1.12.10 or greater.
12013
12014 @item -f
12015 Force edit; ignore other edits.  Added in CVS 1.12.10.
12016
12017 @item -l
12018 Local; run only in current working directory.  See @ref{Recursive behavior}.
12019
12020 @item -R
12021 Operate recursively (default).  @xref{Recursive
12022 behavior}.
12023 @end table
12024
12025 @c ------------------------------------------------------------
12026 @item editors [@var{options}] [@var{files}@dots{}]
12027 See who is editing a watched file.  See @ref{Watch information}.
12028
12029 @table @code
12030 @item -l
12031 Local; run only in current working directory.  See @ref{Recursive behavior}.
12032
12033 @item -R
12034 Operate recursively (default).  @xref{Recursive
12035 behavior}.
12036 @end table
12037
12038 @c ------------------------------------------------------------
12039 @item export [@var{options}] @var{modules}@dots{}
12040 Export files from @sc{cvs}.  See @ref{export}.
12041
12042 @table @code
12043 @item -D @var{date}
12044 Check out revisions as of @var{date}.  See
12045 @ref{Common options}.
12046
12047 @item -d @var{dir}
12048 Check out into @var{dir}.  See @ref{export options}.
12049
12050 @item -f
12051 Use head revision if tag/date not found.  See
12052 @ref{Common options}.
12053
12054 @item -k @var{kflag}
12055 Use @var{kflag} keyword expansion.  See
12056 @ref{Substitution modes}.
12057
12058 @item -l
12059 Local; run only in current working directory.  @xref{Recursive behavior}.
12060
12061 @item -N
12062 Don't ``shorten'' module paths if -d specified.  See
12063 @ref{export options}.
12064
12065 @item -n
12066 Do not run module program (if any).  See @ref{export options}.
12067
12068 @item -R
12069 Operate recursively (default).  @xref{Recursive
12070 behavior}.
12071
12072 @item -r @var{tag}[:@var{date}]
12073 Export the revisions specified by @var{tag} or, when @var{date} is specified
12074 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12075 existed on @var{date}.  See @ref{Common options}.
12076 @end table
12077
12078 @c ------------------------------------------------------------
12079 @item history [@var{options}] [@var{files}@dots{}]
12080 Show repository access history.  See @ref{history}.
12081
12082 @table @code
12083 @item -a
12084 All users (default is self).  See @ref{history options}.
12085
12086 @item -b @var{str}
12087 Back to record with @var{str} in module/file/repos
12088 field.  See @ref{history options}.
12089
12090 @item -c
12091 Report on committed (modified) files.  See @ref{history options}.
12092
12093 @item -D @var{date}
12094 Since @var{date}.  See @ref{history options}.
12095
12096 @item -e
12097 Report on all record types.  See @ref{history options}.
12098
12099 @item -l
12100 Last modified (committed or modified report).  See @ref{history options}.
12101
12102 @item -m @var{module}
12103 Report on @var{module} (repeatable).  See @ref{history options}.
12104
12105 @item -n @var{module}
12106 In @var{module}.  See @ref{history options}.
12107
12108 @item -o
12109 Report on checked out modules.  See @ref{history options}.
12110
12111 @item -p @var{repository}
12112 In @var{repository}.  See @ref{history options}.
12113
12114 @item -r @var{rev}
12115 Since revision @var{rev}.  See @ref{history options}.
12116
12117 @item -T
12118 @c What the @#$@# is a TAG?  Same as a tag?  This
12119 @c wording is also in the online-line help.
12120 Produce report on all TAGs.  See @ref{history options}.
12121
12122 @item -t @var{tag}
12123 Since tag record placed in history file (by anyone).
12124 See @ref{history options}.
12125
12126 @item -u @var{user}
12127 For user @var{user} (repeatable).  See @ref{history options}.
12128
12129 @item -w
12130 Working directory must match.  See @ref{history options}.
12131
12132 @item -x @var{types}
12133 Report on @var{types}, one or more of
12134 @code{TOEFWUPCGMAR}.  See @ref{history options}.
12135
12136 @item -z @var{zone}
12137 Output for time zone @var{zone}.  See @ref{history options}.
12138 @end table
12139
12140 @c ------------------------------------------------------------
12141 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
12142 Import files into @sc{cvs}, using vendor branches.  See
12143 @ref{import}.
12144
12145 @table @code
12146 @item -b @var{bra}
12147 Import to vendor branch @var{bra}.  See
12148 @ref{Multiple vendor branches}.
12149
12150 @item -d
12151 Use the file's modification time as the time of
12152 import.  See @ref{import options}.
12153
12154 @item -k @var{kflag}
12155 Set default keyword substitution mode.  See
12156 @ref{import options}.
12157
12158 @item -m @var{msg}
12159 Use @var{msg} for log message.  See
12160 @ref{import options}.
12161
12162 @item -I @var{ign}
12163 More files to ignore (! to reset).  See
12164 @ref{import options}.
12165
12166 @item -W @var{spec}
12167 More wrappers.  See @ref{import options}.
12168 @end table
12169
12170 @c ------------------------------------------------------------
12171 @item init
12172 Create a @sc{cvs} repository if it doesn't exist.  See
12173 @ref{Creating a repository}.
12174
12175 @c ------------------------------------------------------------
12176 @item kserver
12177 Kerberos authenticated server.
12178 See @ref{Kerberos authenticated}.
12179
12180 @c ------------------------------------------------------------
12181 @item log [@var{options}] [@var{files}@dots{}]
12182 Print out history information for files.  See @ref{log}.
12183
12184 @table @code
12185 @item -b
12186 Only list revisions on the default branch.  See @ref{log options}.
12187
12188 @item -d @var{dates}
12189 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12190 latest before).  See @ref{log options}.
12191
12192 @item -h
12193 Only print header.  See @ref{log options}.
12194
12195 @item -l
12196 Local; run only in current working directory.  See @ref{Recursive behavior}.
12197
12198 @item -N
12199 Do not list tags.  See @ref{log options}.
12200
12201 @item -R
12202 Only print name of RCS file.  See @ref{log options}.
12203
12204 @item -r@var{revs}
12205 Only list revisions @var{revs}.  See @ref{log options}.
12206
12207 @item -s @var{states}
12208 Only list revisions with specified states.  See @ref{log options}.
12209
12210 @item -t
12211 Only print header and descriptive text.  See @ref{log
12212 options}.
12213
12214 @item -w@var{logins}
12215 Only list revisions checked in by specified logins.  See @ref{log options}.
12216 @end table
12217
12218 @c ------------------------------------------------------------
12219 @item login
12220 Prompt for password for authenticating server.  See
12221 @ref{Password authentication client}.
12222
12223 @c ------------------------------------------------------------
12224 @item logout
12225 Remove stored password for authenticating server.  See
12226 @ref{Password authentication client}.
12227
12228 @c ------------------------------------------------------------
12229 @item pserver
12230 Password authenticated server.
12231 See @ref{Password authentication server}.
12232
12233 @c ------------------------------------------------------------
12234 @item rannotate [@var{options}] [@var{modules}@dots{}]
12235 Show last revision where each line was modified.  See
12236 @ref{annotate}.
12237
12238 @table @code
12239 @item -D @var{date}
12240 Annotate the most recent revision no later than
12241 @var{date}.  See @ref{Common options}.
12242
12243 @item -F
12244 Force annotation of binary files.  (Without this option,
12245 binary files are skipped with a message.)
12246
12247 @item -f
12248 Use head revision if tag/date not found.  See
12249 @ref{Common options}.
12250
12251 @item -l
12252 Local; run only in current working directory.  @xref{Recursive behavior}.
12253
12254 @item -R
12255 Operate recursively (default).  @xref{Recursive behavior}.
12256
12257 @item -r @var{tag}[:@var{date}]
12258 Annotate the revision specified by @var{tag} or, when @var{date} is specified
12259 and @var{tag} is a branch tag, the version from the branch @var{tag}
12260 as it existed on @var{date}.  See @ref{Common options}.
12261 @end table
12262
12263 @c ------------------------------------------------------------
12264 @item rdiff [@var{options}] @var{modules}@dots{}
12265 Show differences between releases.  See @ref{rdiff}.
12266
12267 @table @code
12268 @item -c
12269 Context diff output format (default).  See @ref{rdiff options}.
12270
12271 @item -D @var{date}
12272 Select revisions based on @var{date}.  See @ref{Common options}.
12273
12274 @item -f
12275 Use head revision if tag/date not found.  See
12276 @ref{Common options}.
12277
12278 @item -l
12279 Local; run only in current working directory.  See @ref{Recursive behavior}.
12280
12281 @item -R
12282 Operate recursively (default).  @xref{Recursive
12283 behavior}.
12284
12285 @item -r @var{tag}[:@var{date}]
12286 Select the revisions specified by @var{tag} or, when @var{date} is specified
12287 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12288 existed on @var{date}.  See @ref{diff options} and @ref{Common options}.
12289
12290 @item -s
12291 Short patch - one liner per file.  See @ref{rdiff options}.
12292
12293 @item -t
12294 Top two diffs - last change made to the file.  See
12295 @ref{diff options}.
12296
12297 @item -u
12298 Unidiff output format.  See @ref{rdiff options}.
12299
12300 @item -V @var{vers}
12301 Use RCS Version @var{vers} for keyword expansion (obsolete).  See
12302 @ref{rdiff options}.
12303 @end table
12304
12305 @c ------------------------------------------------------------
12306 @item release [@var{options}] @var{directory}
12307 Indicate that a directory is no longer in use.  See
12308 @ref{release}.
12309
12310 @table @code
12311 @item -d
12312 Delete the given directory.  See @ref{release options}.
12313 @end table
12314
12315 @c ------------------------------------------------------------
12316 @item remove [@var{options}] [@var{files}@dots{}]
12317 Remove an entry from the repository.  See @ref{Removing files}.
12318
12319 @table @code
12320 @item -f
12321 Delete the file before removing it.  See @ref{Removing files}.
12322
12323 @item -l
12324 Local; run only in current working directory.  See @ref{Recursive behavior}.
12325
12326 @item -R
12327 Operate recursively (default).  @xref{Recursive
12328 behavior}.
12329 @end table
12330
12331 @c ------------------------------------------------------------
12332 @item rlog [@var{options}] [@var{files}@dots{}]
12333 Print out history information for modules.  See @ref{log}.
12334
12335 @table @code
12336 @item -b
12337 Only list revisions on the default branch.  See @ref{log options}.
12338
12339 @item -d @var{dates}
12340 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12341 latest before).  See @ref{log options}.
12342
12343 @item -h
12344 Only print header.  See @ref{log options}.
12345
12346 @item -l
12347 Local; run only in current working directory.  See @ref{Recursive behavior}.
12348
12349 @item -N
12350 Do not list tags.  See @ref{log options}.
12351
12352 @item -R
12353 Only print name of RCS file.  See @ref{log options}.
12354
12355 @item -r@var{revs}
12356 Only list revisions @var{revs}.  See @ref{log options}.
12357
12358 @item -s @var{states}
12359 Only list revisions with specified states.  See @ref{log options}.
12360
12361 @item -t
12362 Only print header and descriptive text.  See @ref{log options}.
12363
12364 @item -w@var{logins}
12365 Only list revisions checked in by specified logins.  See @ref{log options}.
12366 @end table
12367
12368 @c ------------------------------------------------------------
12369 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
12370 Add a symbolic tag to a module.
12371 See @ref{Revisions} and @ref{Branching and merging}.
12372
12373 @table @code
12374 @item -a
12375 Clear tag from removed files that would not otherwise
12376 be tagged.  See @ref{Tagging add/remove}.
12377
12378 @item -b
12379 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12380
12381 @item -B
12382 Used in conjunction with -F or -d, enables movement and deletion of
12383 branch tags.  Use with extreme caution. 
12384
12385 @item -D @var{date}
12386 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12387
12388 @item -d
12389 Delete @var{tag}.  See @ref{Modifying tags}.
12390
12391 @item -F
12392 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12393
12394 @item -f
12395 Force a head revision match if tag/date not found.
12396 See @ref{Tagging by date/tag}.
12397
12398 @item -l
12399 Local; run only in current working directory.  See @ref{Recursive behavior}.
12400
12401 @item -n
12402 No execution of tag program.  See @ref{Common options}.
12403
12404 @item -R
12405 Operate recursively (default).  @xref{Recursive
12406 behavior}.
12407
12408 @item -r @var{tag}[:@var{date}]
12409 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
12410 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12411 existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12412 @end table
12413
12414 @c ------------------------------------------------------------
12415 @item server
12416 Rsh server.  See @ref{Connecting via rsh}.
12417
12418 @c ------------------------------------------------------------
12419 @item status [@var{options}] @var{files}@dots{}
12420 Display status information in a working directory.  See
12421 @ref{File status}.
12422
12423 @table @code
12424 @item -l
12425 Local; run only in current working directory.  See @ref{Recursive behavior}.
12426
12427 @item -R
12428 Operate recursively (default).  @xref{Recursive behavior}.
12429
12430 @item -v
12431 Include tag information for file.  See @ref{Tags}.
12432 @end table
12433
12434 @c ------------------------------------------------------------
12435 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
12436 Add a symbolic tag to checked out version of files.
12437 See @ref{Revisions} and @ref{Branching and merging}.
12438
12439 @table @code
12440 @item -b
12441 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12442
12443 @item -c
12444 Check that working files are unmodified.  See
12445 @ref{Tagging the working directory}.
12446
12447 @item -D @var{date}
12448 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12449
12450 @item -d
12451 Delete @var{tag}.  See @ref{Modifying tags}.
12452
12453 @item -F
12454 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12455
12456 @item -f
12457 Force a head revision match if tag/date not found.
12458 See @ref{Tagging by date/tag}.
12459
12460 @item -l
12461 Local; run only in current working directory.  See @ref{Recursive behavior}.
12462
12463 @item -R
12464 Operate recursively (default).  @xref{Recursive behavior}.
12465
12466 @item -r @var{tag}[:@var{date}]
12467 Tag the revision already tagged with @var{tag}, or when @var{date} is specified
12468 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12469 existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12470 @end table
12471
12472 @c ------------------------------------------------------------
12473 @item unedit [@var{options}] [@var{files}@dots{}]
12474 Undo an edit command.  See @ref{Editing files}.
12475
12476 @table @code
12477 @item -l
12478 Local; run only in current working directory.  See @ref{Recursive behavior}.
12479
12480 @item -R
12481 Operate recursively (default).  @xref{Recursive behavior}.
12482 @end table
12483
12484 @c ------------------------------------------------------------
12485 @item update [@var{options}] [@var{files}@dots{}]
12486 Bring work tree in sync with repository.  See
12487 @ref{update}.
12488
12489 @table @code
12490 @item -A
12491 Reset any sticky tags/date/options.  See @ref{Sticky
12492 tags} and @ref{Keyword substitution}.
12493
12494 @item -C
12495 Overwrite locally modified files with clean copies from
12496 the repository (the modified file is saved in
12497 @file{.#@var{file}.@var{revision}}, however).
12498
12499 @item -D @var{date}
12500 Check out revisions as of @var{date} (is sticky).  See
12501 @ref{Common options}.
12502
12503 @item -d
12504 Create directories.  See @ref{update options}.
12505
12506 @item -f
12507 Use head revision if tag/date not found.  See
12508 @ref{Common options}.
12509
12510 @item -I @var{ign}
12511 More files to ignore (! to reset).  See
12512 @ref{import options}.
12513
12514 @c Probably want to use rev1/rev2 style like for diff
12515 @c -r.  Here and in on-line help.
12516 @item -j @var{tag}[:@var{date}]
12517 Merge in changes from revisions specified by @var{tag} or, when @var{date} is
12518 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12519 as it existed on @var{date}.  See @ref{update options}.
12520
12521 @item -k @var{kflag}
12522 Use @var{kflag} keyword expansion.  See
12523 @ref{Substitution modes}.
12524
12525 @item -l
12526 Local; run only in current working directory.  @xref{Recursive behavior}.
12527
12528 @item -P
12529 Prune empty directories.  See @ref{Moving directories}.
12530
12531 @item -p
12532 Check out files to standard output (avoids
12533 stickiness).  See @ref{update options}.
12534
12535 @item -R
12536 Operate recursively (default).  @xref{Recursive
12537 behavior}.
12538
12539 @item -r @var{tag}[:@var{date}]
12540 Checkout the revisions specified by @var{tag} or, when @var{date} is specified
12541 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12542 existed on @var{date}.  See @ref{Common options}.
12543
12544 @item -W @var{spec}
12545 More wrappers.  See @ref{import options}.
12546 @end table
12547
12548 @c ------------------------------------------------------------
12549 @item version
12550 @cindex version (subcommand)
12551
12552 Display the version of @sc{cvs} being used.  If the repository
12553 is remote, display both the client and server versions.
12554
12555 @c ------------------------------------------------------------
12556 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
12557
12558 on/off: turn on/off read-only checkouts of files.  See
12559 @ref{Setting a watch}.
12560
12561 add/remove: add or remove notification on actions.  See
12562 @ref{Getting Notified}.
12563
12564 @table @code
12565 @item -a @var{actions}
12566 Specify actions for temporary watch, where
12567 @var{actions} is @code{edit}, @code{unedit},
12568 @code{commit}, @code{all}, or @code{none}.  See
12569 @ref{Editing files}.
12570
12571 @item -l
12572 Local; run only in current working directory.  See @ref{Recursive behavior}.
12573
12574 @item -R
12575 Operate recursively (default).  @xref{Recursive
12576 behavior}.
12577 @end table
12578
12579 @c ------------------------------------------------------------
12580 @item watchers [@var{options}] [@var{files}@dots{}]
12581 See who is watching a file.  See @ref{Watch information}.
12582
12583 @table @code
12584 @item -l
12585 Local; run only in current working directory.  See @ref{Recursive behavior}.
12586
12587 @item -R
12588 Operate recursively (default).  @xref{Recursive
12589 behavior}.
12590 @end table
12591
12592 @end table
12593
12594 @c ---------------------------------------------------------------------
12595 @node Administrative files
12596 @appendix Reference manual for Administrative files
12597 @cindex Administrative files (reference)
12598 @cindex Files, reference manual
12599 @cindex Reference manual (files)
12600 @cindex CVSROOT (file)
12601
12602 Inside the repository, in the directory
12603 @file{$CVSROOT/CVSROOT}, there are a number of
12604 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
12605 fashion without any of them, but if they are set up
12606 properly they can help make life easier.  For a
12607 discussion of how to edit them, see @ref{Intro
12608 administrative files}.
12609
12610 The most important of these files is the @file{modules}
12611 file, which defines the modules inside the repository.
12612
12613 @menu
12614 * modules::                     Defining modules
12615 * Wrappers::                    Specify binary-ness based on file name
12616 * Trigger Scripts::             Launch scripts in response to server events
12617 * rcsinfo::                     Templates for the log messages
12618 * cvsignore::                   Ignoring files via cvsignore
12619 * checkoutlist::                Adding your own administrative files
12620 * history file::                History information
12621 * Variables::                   Various variables are expanded
12622 * config::                      Miscellaneous CVS configuration
12623 @end menu
12624
12625 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12626 @node modules
12627 @appendixsec The modules file
12628 @cindex Modules (admin file)
12629 @cindex Defining modules (reference manual)
12630
12631 The @file{modules} file records your definitions of
12632 names for collections of source code.  @sc{cvs} will
12633 use these definitions if you use @sc{cvs} to update the
12634 modules file (use normal commands like @code{add},
12635 @code{commit}, etc).
12636
12637 The @file{modules} file may contain blank lines and
12638 comments (lines beginning with @samp{#}) as well as
12639 module definitions.  Long lines can be continued on the
12640 next line by specifying a backslash (@samp{\}) as the
12641 last character on the line.
12642
12643 There are three basic types of modules: alias modules,
12644 regular modules, and ampersand modules.  The difference
12645 between them is the way that they map files in the
12646 repository to files in the working directory.  In all
12647 of the following examples, the top-level repository
12648 contains a directory called @file{first-dir}, which
12649 contains two files, @file{file1} and @file{file2}, and a
12650 directory @file{sdir}.  @file{first-dir/sdir} contains
12651 a file @file{sfile}.
12652
12653 @c FIXME: should test all the examples in this section.
12654
12655 @menu
12656 * Alias modules::             The simplest kind of module
12657 * Regular modules::
12658 * Ampersand modules::
12659 * Excluding directories::     Excluding directories from a module
12660 * Module options::            Regular and ampersand modules can take options
12661 * Module program options::    How the modules ``program options'' programs
12662                               are run. 
12663 @end menu
12664
12665 @node Alias modules
12666 @appendixsubsec Alias modules
12667 @cindex Alias modules
12668 @cindex -a, in modules file
12669
12670 Alias modules are the simplest kind of module:
12671
12672 @table @code
12673 @item @var{mname} -a @var{aliases}@dots{}
12674 This represents the simplest way of defining a module
12675 @var{mname}.  The @samp{-a} flags the definition as a
12676 simple alias: @sc{cvs} will treat any use of @var{mname} (as
12677 a command argument) as if the list of names
12678 @var{aliases} had been specified instead.
12679 @var{aliases} may contain either other module names or
12680 paths.  When you use paths in aliases, @code{checkout}
12681 creates all intermediate directories in the working
12682 directory, just as if the path had been specified
12683 explicitly in the @sc{cvs} arguments.
12684 @end table
12685
12686 For example, if the modules file contains:
12687
12688 @example
12689 amodule -a first-dir
12690 @end example
12691
12692 @noindent
12693 then the following two commands are equivalent:
12694
12695 @example
12696 $ cvs co amodule
12697 $ cvs co first-dir
12698 @end example
12699
12700 @noindent
12701 and they each would provide output such as:
12702
12703 @example
12704 cvs checkout: Updating first-dir
12705 U first-dir/file1
12706 U first-dir/file2
12707 cvs checkout: Updating first-dir/sdir
12708 U first-dir/sdir/sfile
12709 @end example
12710
12711 @node Regular modules
12712 @appendixsubsec Regular modules
12713 @cindex Regular modules
12714
12715 @table @code
12716 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12717 In the simplest case, this form of module definition
12718 reduces to @samp{@var{mname} @var{dir}}.  This defines
12719 all the files in directory @var{dir} as module mname.
12720 @var{dir} is a relative path (from @code{$CVSROOT}) to a
12721 directory of source in the source repository.  In this
12722 case, on checkout, a single directory called
12723 @var{mname} is created as a working directory; no
12724 intermediate directory levels are used by default, even
12725 if @var{dir} was a path involving several directory
12726 levels.
12727 @end table
12728
12729 For example, if a module is defined by:
12730
12731 @example
12732 regmodule first-dir
12733 @end example
12734
12735 @noindent
12736 then regmodule will contain the files from first-dir:
12737
12738 @example
12739 $ cvs co regmodule
12740 cvs checkout: Updating regmodule
12741 U regmodule/file1
12742 U regmodule/file2
12743 cvs checkout: Updating regmodule/sdir
12744 U regmodule/sdir/sfile
12745 $
12746 @end example
12747
12748 By explicitly specifying files in the module definition
12749 after @var{dir}, you can select particular files from
12750 directory @var{dir}.  Here is
12751 an example:
12752
12753 @example
12754 regfiles first-dir/sdir sfile
12755 @end example
12756
12757 @noindent
12758 With this definition, getting the regfiles module
12759 will create a single working directory
12760 @file{regfiles} containing the file listed, which
12761 comes from a directory deeper
12762 in the @sc{cvs} source repository:
12763
12764 @example
12765 $ cvs co regfiles
12766 U regfiles/sfile
12767 $
12768 @end example
12769
12770 @node Ampersand modules
12771 @appendixsubsec Ampersand modules
12772 @cindex Ampersand modules
12773 @cindex &, in modules file
12774
12775 A module definition can refer to other modules by
12776 including @samp{&@var{module}} in its definition.
12777 @example
12778 @var{mname} [ options ] @var{&module}@dots{}
12779 @end example
12780
12781 Then getting the module creates a subdirectory for each such
12782 module, in the directory containing the module.  For
12783 example, if modules contains
12784
12785 @example
12786 ampermod &first-dir
12787 @end example
12788
12789 @noindent
12790 then a checkout will create an @code{ampermod} directory
12791 which contains a directory called @code{first-dir},
12792 which in turns contains all the directories and files
12793 which live there.  For example, the command
12794
12795 @example
12796 $ cvs co ampermod
12797 @end example
12798
12799 @noindent
12800 will create the following files:
12801
12802 @example
12803 ampermod/first-dir/file1
12804 ampermod/first-dir/file2
12805 ampermod/first-dir/sdir/sfile
12806 @end example
12807
12808 There is one quirk/bug: the messages that @sc{cvs}
12809 prints omit the @file{ampermod}, and thus do not
12810 correctly display the location to which it is checking
12811 out the files:
12812
12813 @example
12814 $ cvs co ampermod
12815 cvs checkout: Updating first-dir
12816 U first-dir/file1
12817 U first-dir/file2
12818 cvs checkout: Updating first-dir/sdir
12819 U first-dir/sdir/sfile
12820 $
12821 @end example
12822
12823 Do not rely on this buggy behavior; it may get fixed in
12824 a future release of @sc{cvs}.
12825
12826 @c FIXCVS: What happens if regular and & modules are
12827 @c combined, as in "ampermodule first-dir &second-dir"?
12828 @c When I tried it, it seemed to just ignore the
12829 @c "first-dir".  I think perhaps it should be an error
12830 @c (but this needs further investigation).
12831 @c In addition to discussing what each one does, we
12832 @c should put in a few words about why you would use one or
12833 @c the other in various situations.
12834
12835 @node Excluding directories
12836 @appendixsubsec Excluding directories
12837 @cindex Excluding directories, in modules file
12838 @cindex !, in modules file
12839
12840 An alias module may exclude particular directories from
12841 other modules by using an exclamation mark (@samp{!})
12842 before the name of each directory to be excluded.
12843
12844 For example, if the modules file contains:
12845
12846 @example
12847 exmodule -a !first-dir/sdir first-dir
12848 @end example
12849
12850 @noindent
12851 then checking out the module @samp{exmodule} will check
12852 out everything in @samp{first-dir} except any files in
12853 the subdirectory @samp{first-dir/sdir}.
12854 @c Note that the "!first-dir/sdir" sometimes must be listed
12855 @c before "first-dir".  That seems like a probable bug, in which
12856 @c case perhaps it should be fixed (to allow either
12857 @c order) rather than documented.  See modules4 in testsuite.
12858
12859 @node Module options
12860 @appendixsubsec Module options
12861 @cindex Options, in modules file
12862
12863 Either regular modules or ampersand modules can contain
12864 options, which supply additional information concerning
12865 the module.
12866
12867 @table @code
12868 @cindex -d, in modules file
12869 @item -d @var{name}
12870 Name the working directory something other than the
12871 module name.
12872 @c FIXME: Needs a bunch of examples, analogous to the
12873 @c examples for alias, regular, and ampersand modules
12874 @c which show where the files go without -d.
12875
12876 @cindex Export program
12877 @cindex -e, in modules file
12878 @item -e @var{prog}
12879 Specify a program @var{prog} to run whenever files in a
12880 module are exported.  @var{prog} runs with a single
12881 argument, the module name.
12882 @c FIXME: Is it run on server? client?
12883
12884 @cindex Checkout program
12885 @cindex -o, in modules file
12886 @item -o @var{prog}
12887 Specify a program @var{prog} to run whenever files in a
12888 module are checked out.  @var{prog} runs with a single
12889 argument, the module name.  See @ref{Module program options} for
12890 information on how @var{prog} is called.
12891 @c FIXME: Is it run on server? client?
12892
12893 @cindex Status of a module
12894 @cindex Module status
12895 @cindex -s, in modules file
12896 @item -s @var{status}
12897 Assign a status to the module.  When the module file is
12898 printed with @samp{cvs checkout -s} the modules are
12899 sorted according to primarily module status, and
12900 secondarily according to the module name.  This option
12901 has no other meaning.  You can use this option for
12902 several things besides status: for instance, list the
12903 person that is responsible for this module.
12904
12905 @cindex Tag program
12906 @cindex -t, in modules file
12907 @item -t @var{prog}
12908 Specify a program @var{prog} to run whenever files in a
12909 module are tagged with @code{rtag}.  @var{prog} runs
12910 with two arguments: the module name and the symbolic
12911 tag specified to @code{rtag}.  It is not run
12912 when @code{tag} is executed.  Generally you will find
12913 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
12914 @c FIXME: Is it run on server? client?
12915 @c Problems with -t include:
12916 @c * It is run after the tag not before
12917 @c * It doesn't get passed all the information that
12918 @c   taginfo does ("mov", &c).
12919 @c * It only is run for rtag, not tag.
12920 @end table
12921
12922 You should also see @pxref{Module program options} about how the
12923 ``program options'' programs are run.
12924
12925 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12926
12927 @node Module program options
12928 @appendixsubsec How the modules file ``program options'' programs are run
12929 @cindex Modules file program options
12930 @cindex -t, in modules file
12931 @cindex -o, in modules file
12932 @cindex -e, in modules file
12933
12934 @noindent
12935 For checkout, rtag, and export, the program is server-based, and as such the
12936 following applies:-
12937
12938 If using remote access methods (pserver, ext, etc.),
12939 @sc{cvs} will execute this program on the server from a temporary
12940 directory. The path is searched for this program.
12941
12942 If using ``local access'' (on a local or remote NFS file system, i.e.
12943 repository set just to a path),
12944 the program will be executed from the newly checked-out tree, if
12945 found there, or alternatively searched for in the path if not.
12946
12947 The programs are all run after the operation has effectively
12948 completed.
12949
12950
12951 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12952 @node Wrappers
12953 @appendixsec The cvswrappers file
12954 @cindex cvswrappers (admin file)
12955 @cindex CVSWRAPPERS, environment variable
12956 @cindex Wrappers
12957
12958 @c FIXME: need some better way of separating this out
12959 @c by functionality.  -m is
12960 @c one feature, and -k is a another.  And this discussion
12961 @c should be better motivated (e.g. start with the
12962 @c problems, then explain how the feature solves it).
12963
12964 Wrappers refers to a @sc{cvs} feature which lets you
12965 control certain settings based on the name of the file
12966 which is being operated on.  The settings are @samp{-k}
12967 for binary files, and @samp{-m} for nonmergeable text
12968 files.
12969
12970 The @samp{-m} option
12971 specifies the merge methodology that should be used when
12972 a non-binary file is updated.  @code{MERGE} means the usual
12973 @sc{cvs} behavior: try to merge the files.  @code{COPY}
12974 means that @code{cvs update} will refuse to merge
12975 files, as it also does for files specified as binary
12976 with @samp{-kb} (but if the file is specified as
12977 binary, there is no need to specify @samp{-m 'COPY'}).
12978 @sc{cvs} will provide the user with the
12979 two versions of the files, and require the user using
12980 mechanisms outside @sc{cvs}, to insert any necessary
12981 changes.
12982
12983 @strong{WARNING: do not use @code{COPY} with
12984 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
12985 copy one version of your file over the other, wiping
12986 out the previous contents.}
12987 @c Ordinarily we don't document the behavior of old
12988 @c versions.  But this one is so dangerous, I think we
12989 @c must.  I almost renamed it to -m 'NOMERGE' so we
12990 @c could say "never use -m 'COPY'".
12991 The @samp{-m} wrapper option only affects behavior when
12992 merging is done on update; it does not affect how files
12993 are stored.  See @ref{Binary files}, for more on
12994 binary files.
12995
12996 The basic format of the file @file{cvswrappers} is:
12997
12998 @c FIXME: @example is all wrong for this.  Use @deffn or
12999 @c something more sensible.
13000 @example
13001 wildcard     [option value][option value]...
13002
13003 where option is one of
13004 -m           update methodology      value: MERGE or COPY
13005 -k           keyword expansion       value: expansion mode
13006
13007 and value is a single-quote delimited value.
13008 @end example
13009
13010 @ignore
13011 @example
13012 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
13013 *.c      -t 'indent %s %s'
13014 @end example
13015 @c When does the filter need to be an absolute pathname
13016 @c and when will something like the above work?  I
13017 @c suspect it relates to the PATH of the server (which
13018 @c in turn depends on all kinds of stuff, e.g. inetd
13019 @c for pserver).  I'm not sure whether/where to discuss
13020 @c this.
13021 @c FIXME: What do the %s's stand for?
13022
13023 @noindent
13024 The above example of a @file{cvswrappers} file
13025 states that all files/directories that end with a @code{.nib}
13026 should be filtered with the @file{wrap} program before
13027 checking the file into the repository. The file should
13028 be filtered though the @file{unwrap} program when the
13029 file is checked out of the repository. The
13030 @file{cvswrappers} file also states that a @code{COPY}
13031 methodology should be used when updating the files in
13032 the repository (that is, no merging should be performed).
13033
13034 @c What pitfalls arise when using indent this way?  Is
13035 @c it a winning thing to do?  Would be nice to at least
13036 @c hint at those issues; we want our examples to tell
13037 @c how to solve problems, not just to say that cvs can
13038 @c do certain things.
13039 The last example line says that all files that end with
13040 @code{.c} should be filtered with @file{indent}
13041 before being checked into the repository. Unlike the previous
13042 example, no filtering of the @code{.c} file is done when
13043 it is checked out of the repository.
13044 @noindent
13045 The @code{-t} filter is called with two arguments,
13046 the first is the name of the file/directory to filter
13047 and the second is the pathname to where the resulting
13048 filtered file should be placed.
13049
13050 @noindent
13051 The @code{-f} filter is called with one argument,
13052 which is the name of the file to filter from. The end
13053 result of this filter will be a file in the users directory
13054 that they can work on as they normally would.
13055
13056 Note that the @samp{-t}/@samp{-f} features do not
13057 conveniently handle one portion of @sc{cvs}'s operation:
13058 determining when files are modified.  @sc{cvs} will still
13059 want a file (or directory) to exist, and it will use
13060 its modification time to determine whether a file is
13061 modified.  If @sc{cvs} erroneously thinks a file is
13062 unmodified (for example, a directory is unchanged but
13063 one of the files within it is changed), you can force
13064 it to check in the file anyway by specifying the
13065 @samp{-f} option to @code{cvs commit} (@pxref{commit
13066 options}).
13067 @c This is, of course, a serious design flaw in -t/-f.
13068 @c Probably the whole functionality needs to be
13069 @c redesigned (starting from requirements) to fix this.
13070 @end ignore
13071
13072 @c FIXME: We don't document -W or point to where it is
13073 @c documented.  Or .cvswrappers.
13074 For example, the following command imports a
13075 directory, treating files whose name ends in
13076 @samp{.exe} as binary:
13077
13078 @example
13079 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
13080 @end example
13081
13082 @c Another good example, would be storing files
13083 @c (e.g. binary files) compressed in the repository.
13084 @c      ::::::::::::::::::
13085 @c      cvswrappers
13086 @c      ::::::::::::::::::
13087 @c      *.t12 -m 'COPY'
13088 @c      *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
13089 @c
13090 @c      ::::::::::::::::::
13091 @c      gunzipcp
13092 @c      ::::::::::::::::::
13093 @c      :
13094 @c      [ -f $1 ] || exit 1
13095 @c      zcat $1 > /tmp/.#$1.$$
13096 @c      mv /tmp/.#$1.$$ $1
13097 @c
13098 @c      ::::::::::::::::::
13099 @c      gzipcp
13100 @c      ::::::::::::::::::
13101 @c      :
13102 @c      DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
13103 @c      if [ ! -d $DIRNAME ] ; then
13104 @c            DIRNAME=`echo $1 | sed -e "s|.*/||g"`
13105 @c      fi
13106 @c      gzip -c  $DIRNAME  > $2
13107 @c One catch--"cvs diff" will not invoke the wrappers
13108 @c (probably a CVS bug, although I haven't thought it out).
13109
13110 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13111 @node Trigger Scripts
13112 @appendixsec The Trigger Scripts
13113 @cindex info files
13114 @cindex trigger scripts
13115 @cindex script hooks
13116
13117 @c FIXME
13118 @c Somewhere there needs to be a more "how-to" guide to writing these.
13119 @c One particular issue that people sometimes are worried about is performance,
13120 @c and the impact of writing in perl or sh or ____.  Performance comparisons
13121 @c should probably remain outside the scope of this document, but at least
13122 @c _that_ much could be referenced, perhaps with links to other sources.
13123
13124 Several of the administrative files support triggers, or the launching external
13125 scripts or programs at specific times before or after particular events, during
13126 the execution of @sc{cvs} commands.  These hooks can be used to prevent certain
13127 actions, log them, and/or maintain anything else you deem practical.
13128
13129 All the trigger scripts are launched in a copy of the user sandbox being
13130 committed, on the server, in client-server mode.  In local mode, the scripts
13131 are actually launched directly from the user sandbox directory being committed.
13132 For most intents and purposes, the same scripts can be run in both locations
13133 without alteration.
13134
13135 @menu
13136 * syntax::                      The common syntax
13137 * Trigger Script Security::     Trigger script security
13138
13139 * commit files::                The commit support files (commitinfo,
13140                                 verifymsg, loginfo)
13141 *   commitinfo::                Pre-commit checking
13142 *   verifymsg::                 How are log messages evaluated?
13143 *   loginfo::                   Where should log messages be sent?
13144
13145 * postadmin::                   Logging admin commands
13146 * taginfo::                     Verifying/Logging tags
13147 * posttag::                     Logging tags
13148 * postwatch::                   Logging watch commands
13149
13150 * preproxy::                    Launch a script on a secondary server prior
13151                                 to becoming a write proxy
13152 * postproxy::                   Launch a script on a secondary server after
13153                                 completing proxy operations
13154 @end menu
13155
13156 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13157 @node syntax
13158 @appendixsubsec The common syntax
13159 @cindex info files, common syntax
13160 @cindex script hooks, common syntax
13161 @cindex trigger script hooks, common syntax
13162 @cindex syntax of trigger script hooks
13163
13164 @c FIXME: having this so totally separate from the
13165 @c Variables node is rather bogus.
13166
13167 The administrative files such as @file{commitinfo},
13168 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
13169 all have a common format.  The purpose of the files are
13170 described later on.  The common syntax is described
13171 here.
13172
13173 @cindex Regular expression syntax
13174 Each line contains the following:
13175
13176 @itemize @bullet
13177 @cindex @samp{ALL} keyword, in lieu of regular expressions in script hooks
13178 @cindex @samp{DEFAULT} keyword, in lieu of regular expressions in script hooks
13179 @item
13180 A regular expression or the literal string @samp{DEFAULT}.  Some script hooks
13181 also support the literal string @samp{ALL}.  Other than the @samp{ALL} and
13182 @samp{DEFAULT} keywords, this is a basic regular expression in the syntax used
13183 by GNU emacs.  See the descriptions of the individual script hooks for
13184 information on whether the @samp{ALL} keyword is supported
13185 (@pxref{Trigger Scripts}).
13186 @c FIXME: What we probably should be saying is "POSIX Basic
13187 @c Regular Expression with the following extensions (`\('
13188 @c `\|' '+' etc)"
13189 @c rather than define it with reference to emacs.
13190 @c The reference to emacs is not strictly speaking
13191 @c true, as we don't support \=, \s, or \S.  Also it isn't
13192 @c clear we should document and/or promise to continue to
13193 @c support all the obscure emacs extensions like \<.
13194 @c Also need to better cite (or include) full
13195 @c documentation for the syntax.
13196 @c Also see comment in configure.in about what happens to the
13197 @c syntax if we pick up a system-supplied regexp matcher.
13198
13199 @item
13200 A whitespace separator---one or more spaces and/or tabs.
13201
13202 @item
13203 A file name or command-line template.
13204 @end itemize
13205
13206 @noindent
13207 Blank lines are ignored.  Lines that start with the
13208 character @samp{#} are treated as comments.  Long lines
13209 unfortunately can @emph{not} be broken in two parts in
13210 any way.
13211
13212 The first regular expression that matches the current
13213 directory name in the repository or the first line containing @samp{DEFAULT}
13214 in lieu of a regular expression is used and all lines containing @samp{ALL} is
13215 used for the hooks which support the @samp{ALL} keyword.  The rest of the line
13216 is used as a file name or command-line template as appropriate.  See the
13217 descriptions of the individual script hooks for information on whether the
13218 @samp{ALL} keyword is supported (@pxref{Trigger Scripts}).
13219
13220 @cindex format strings
13221 @cindex format strings, common syntax
13222 @cindex info files, common syntax, format strings
13223 @cindex Common syntax of info files, format strings
13224 @noindent
13225 @emph{Note:  The following information on format strings is valid
13226 as long as the line @code{UseNewInfoFmtStrings=yes} appears in
13227 your repository's config file (@pxref{config}).  Otherwise,
13228 default format strings may be appended to the command line and
13229 the @samp{loginfo} file, especially, can exhibit slightly
13230 different behavior.  For more information,
13231 @xref{Updating Commit Files}.}
13232
13233 In the cases where the second segment of the matched line is a
13234 command line template (e.g. @file{commitinfo}, @file{loginfo},
13235 & @file{verifymsg}), the command line template may contain format
13236 strings which will be replaced with specific values before the
13237 script is run.
13238 @c FIXCVS then FIXME - it really would make sense to allow %r & maybe even %p
13239 @c to be used in rcsinfo to construct a path, but I haven't
13240 @c coded this yet.
13241
13242 Format strings can represent a single variable or one or more
13243 attributes of a list variable.  An example of a list variable
13244 would be the list available to scripts hung on the loginfo hooks
13245 - the list of files which were just committed.  In the case of
13246 loginfo, three attributes are available for each list item: file
13247 name, precommit version, and postcommit version.
13248
13249 Format strings consist of a @samp{%} character followed by an optional
13250 @samp{@{} (required in the multiple list attribute case), a
13251 single format character representing a variable or a single attribute of
13252 list elements or multiple format characters representing attributes of
13253 list elements, and a closing @samp{@}} when the open bracket was present.
13254
13255 @emph{Flat format strings}, or single format characters which get replaced
13256 with a single value, will generate a single argument
13257 to the called script, regardless of whether the replacement variable contains
13258 white space or other special characters.
13259
13260 @emph{List attributes} will generate an argument for each attribute
13261 requested for each list item.  For example, @samp{%@{sVv@}}
13262 in a @file{loginfo} command template will generate three
13263 arguments (file name, precommit version, postcommit version,
13264 ...) for each file committed.  As in the flat format string
13265 case, each attribute will be passed in as a single argument
13266 regardless of whether it contains white space or other
13267 special characters.
13268  
13269 @samp{%%} will be replaced with a literal @samp{%}.
13270
13271 The format strings available to all script hooks are:
13272
13273 @table @t
13274 @item c
13275 The canonical name of the command being executed.  For instance, in the case of
13276 a hook run from @code{cvs up}, @sc{cvs} would replace @samp{%c} with the string
13277 @samp{update} and, in the case of a hook run from @code{cvs ci}, @sc{cvs} would
13278 replace @samp{%c} with the string @samp{commit}.
13279 @item n
13280 The null, or empty, string.
13281 @item p
13282 The name of the directory being operated on within the repository.
13283 @item r
13284 The name of the repository (the path portion of @code{$CVSROOT}).
13285 @item R
13286 On a server, the name of the referrer, if any.  The referrer is the CVSROOT the
13287 client reports it used to contact a server which then referred it to this
13288 server.  Should usually be set on a primary server with a write proxy setup.
13289 @end table
13290
13291 Other format strings are file specific.  See the docs on the
13292 particular script hooks for more information
13293 (@pxref{Trigger Scripts}).
13294
13295 As an example, the following line in a @file{loginfo} file would
13296 match only the directory @file{module} and any subdirectories of
13297 @file{module}:
13298
13299 @example
13300 ^module\(/\|$\) (echo; echo %p; echo %@{sVv@}; cat) >>$CVSROOT/CVSROOT/commitlog
13301 @end example
13302
13303 Using this same line and assuming a commit of new revisions
13304 1.5.4.4 and 1.27.4.1 based on old revisions 1.5.4.3 and 1.27,
13305 respectively, of file1 and file2 in module, something like the
13306 following log message should be appended to commitlog:
13307
13308 @example
13309
13310 module
13311 file1 1.5.4.3 1.5.4.4 file2 1.27 1.27.4.1
13312 Update of /cvsroot/module
13313 In directory localhost.localdomain:/home/jrandom/work/module
13314
13315 Modified Files:
13316         file1 file2
13317 Log Message:
13318 A log message.
13319 @end example
13320
13321 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13322 @node Trigger Script Security
13323 @appendixsubsec Security and the Trigger Scripts
13324 @cindex info files, security
13325 @cindex script hooks, security
13326 @cindex trigger scripts, security
13327
13328 Security is a huge subject, and implementing a secure system is a non-trivial
13329 task.  This section will barely touch on all the issues involved, but it is
13330 well to note that, as with any script you will be allowing an untrusted
13331 user to run on your server, there are measures you can take to help prevent
13332 your trigger scripts from being abused.
13333
13334 For instance, since the CVS trigger scripts all run in a copy of the user's
13335 sandbox on the server, a naively coded Perl trigger script which attempts to
13336 use a Perl module that is not installed on the system can be hijacked by any
13337 user with commit access who is checking in a file with the correct name.  Other
13338 scripting languages may be vulnerable to similar hacks.
13339
13340 One way to make a script more secure, at least with Perl, is to use scripts
13341 which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
13342 In the most basic terms, this causes Perl to avoid running code that may have
13343 come from an external source.  Please run the @code{perldoc perlsec} command
13344 for more on Perl security.  Again, other languages may implement other security
13345 verification hooks which look more or less like Perl's "taint-check" mechanism.
13346
13347 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13348 @node commit files
13349 @appendixsubsec The commit support files
13350 @cindex Commits, administrative support files
13351 @cindex commit files, see Info files
13352
13353 The @samp{-i} flag in the @file{modules} file can be
13354 used to run a certain program whenever files are
13355 committed (@pxref{modules}).  The files described in
13356 this section provide other, more flexible, ways to run
13357 programs whenever something is committed.
13358
13359 There are three kinds of programs that can be run on
13360 commit.  They are specified in files in the repository,
13361 as described below.  The following table summarizes the
13362 file names and the purpose of the corresponding
13363 programs.
13364
13365 @table @file
13366 @item commitinfo
13367 The program is responsible for checking that the commit
13368 is allowed.  If it exits with a non-zero exit status
13369 the commit will be aborted.  @xref{commitinfo}.
13370
13371 @item verifymsg
13372 The specified program is used to evaluate the log message,
13373 and possibly verify that it contains all required
13374 fields.  This is most useful in combination with the
13375 @file{rcsinfo} file, which can hold a log message
13376 template (@pxref{rcsinfo}).  @xref{verifymsg}.
13377
13378 @item loginfo
13379 The specified program is called when the commit is
13380 complete.  It receives the log message and some
13381 additional information and can store the log message in
13382 a file, or mail it to appropriate persons, or maybe
13383 post it to a local newsgroup, or@dots{}  Your
13384 imagination is the limit!  @xref{loginfo}.
13385 @end table
13386
13387 @menu
13388 * Updating Commit Files::       Updating legacy repositories to stop using
13389                                 deprecated command line template formats
13390 @end menu
13391
13392 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13393 @node Updating Commit Files
13394 @appendixsubsubsec  Updating legacy repositories to stop using deprecated command line template formats
13395 @cindex info files, common syntax, updating legacy repositories
13396 @cindex Syntax of info files, updating legacy repositories
13397 @cindex Common syntax of info files, updating legacy repositories
13398 New repositories are created set to use the new format strings by default, so
13399 if you are creating a new repository, you shouldn't have to worry about this
13400 section.
13401
13402 If you are attempting to maintain a legacy repository which was
13403 making use of the @file{commitinfo}, @file{editinfo}, @file{verifymsg},
13404 @file{loginfo}, and/or @file{taginfo} script hooks, you should have no
13405 immediate problems with using the current @sc{cvs} executable, but your users
13406 will probably start to see deprecation warnings.
13407
13408 The reason for this is that all of the script hooks have been updated to
13409 use a new command line parser that extensibly supports multiple
13410 @file{loginfo} & @file{notify} style format strings (@pxref{syntax})
13411 and this support is not completely compatible with the old style format
13412 strings.
13413
13414 The quick upgrade method is to stick a @samp{1} after each format string
13415 in your old @file{loginfo} file.  For example:
13416
13417 @example
13418 DEFAULT (echo ""; id; echo %@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13419 @end example
13420
13421 would become:
13422
13423 @example
13424 DEFAULT (echo ""; id; echo %1@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13425 @end example
13426
13427 If you were counting on the fact that only the first @samp{%} in the line was
13428 replaced as a format string, you may also have to double up any further
13429 percent signs on the line.
13430
13431 If you did this all at once and checked it in, everything should still be
13432 running properly.
13433
13434 Now add the following line to your config file (@pxref{config}):
13435 @example
13436 UseNewInfoFmtStrings=yes
13437 @end example
13438
13439 Everything should still be running properly, but your users will probably
13440 start seeing new deprecation warnings.
13441   
13442 Dealing with the deprecation warnings now generated by @file{commitinfo},
13443 @file{editinfo}, @file{verifymsg}, and @file{taginfo} should be easy.  Simply
13444 specify what are currently implicit arguments explicitly.  This means appending
13445 the following strings to each active command line template in each file:
13446 @table @code
13447 @item commitinfo
13448 @samp{ %r/%p %s}
13449 @item editinfo
13450 @samp{ %l}
13451 @item taginfo
13452 @samp{ %t %o %p %@{sv@}}
13453 @item verifymsg
13454 @samp{ %l}
13455 @end table
13456
13457 If you don't desire that any of the newly available information be passed to
13458 the scripts hanging off of these hooks, no further modifications to these
13459 files should be necessary to insure current and future compatibility with
13460 @sc{cvs}'s format strings.
13461
13462 Fixing @file{loginfo} could be a little tougher.  The old style
13463 @file{loginfo} format strings caused a single space and comma separated
13464 argument to be passed in in place of the format string.  This is what will
13465 continue to be generated due to the deprecated @samp{1} you inserted into
13466 the format strings.
13467
13468 Since the new format separates each individual item and passes it into the
13469 script as a separate argument (for a good reason - arguments containing commas
13470 and/or white space are now parsable), to remove the deprecated @samp{1} from
13471 your @file{loginfo} command line templates, you will most likely have to
13472 rewrite any scripts called by the hook to handle the new argument format.
13473
13474 Also note that the way @samp{%} followed by unrecognized characters and by
13475 @samp{@{@}} was treated in past versions of CVS is not strictly adhered to as
13476 there were bugs in the old versions.  Specifically, @samp{%@{@}} would eat the
13477 next character and unrecognized strings resolved only to the empty string,
13478 which was counter to what was stated in the documentation.  This version will
13479 do what the documentation said it should have (if you were using only some
13480 combination of @samp{%@{sVv@}}, e.g. @samp{%@{sVv@}}, @samp{%@{sV@}}, or
13481 @samp{%v}, you should have no troubles).
13482
13483 On the bright side, you should have plenty of time to do this before all
13484 support for the old format strings is removed from @sc{cvs}, so you can just
13485 put up with the deprecation warnings for awhile if you like.
13486
13487 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13488 @node commitinfo
13489 @appendixsubsec Commitinfo
13490 @cindex @file{commitinfo}
13491 @cindex Commits, precommit verification of
13492 @cindex commitinfo (admin file)
13493 @cindex info files, commitinfo
13494 @cindex script hooks, commitinfo
13495 @cindex trigger scripts, commitinfo
13496 @cindex info files, precommit verification of commits
13497 @cindex script hooks, precommit verification of commits
13498 @cindex trigger scripts, precommit verification of commits
13499
13500 The @file{commitinfo} file defines programs to execute
13501 whenever @samp{cvs commit} is about to execute.  These
13502 programs are used for pre-commit checking to verify
13503 that the modified, added and removed files are really
13504 ready to be committed.  This could be used, for
13505 instance, to verify that the changed files conform to
13506 to your site's standards for coding practice.
13507
13508 The @file{commitinfo} file has the standard form for script hooks
13509 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13510 a command to execute.  It supports only the DEFAULT keywords.
13511
13512 @cindex format strings, commitinfo admin file
13513 In addition to the common format strings (@pxref{syntax}),
13514 @file{commitinfo} supports:
13515
13516 @table @t
13517 @item @{s@}
13518 a list of the names of files to be committed
13519 @end table
13520
13521 @cindex commitinfo (admin file), updating legacy repositories
13522 @cindex compatibility notes, commitinfo admin file
13523 Currently, if no format strings are specified, a default
13524 string of @samp{ %r/%p %@{s@}} will be appended to the command
13525 line template before replacement is performed, but this
13526 feature is deprecated.  It is simply in place so that legacy
13527 repositories will remain compatible with the new @sc{cvs} application.
13528 For information on updating, @pxref{Updating Commit Files}.
13529
13530 @cindex Exit status, of commitinfo
13531 @cindex commitinfo (admin file), exit status
13532 The first line with a regular expression matching the
13533 directory within the repository will be used.  If the
13534 command returns a non-zero exit status the commit will
13535 be aborted.
13536 @c FIXME: need example(s) of what "directory within the
13537 @c repository" means.
13538
13539 @cindex @file{commitinfo}, working directory
13540 @cindex @file{commitinfo}, command environment
13541 The command will be run in the root of the workspace
13542 containing the new versions of any files the user would like
13543 to modify (commit), @emph{or in a copy of the workspace on
13544 the server (@pxref{Remote repositories})}.  If a file is
13545 being removed, there will be no copy of the file under the
13546 current directory.  If a file is being added, there will be
13547 no corresponding archive file in the repository unless the
13548 file is being resurrected.
13549
13550 Note that both the repository directory and the corresponding
13551 Attic (@pxref{Attic}) directory may need to be checked to
13552 locate the archive file corresponding to any given file being
13553 committed.  Much of the information about the specific commit
13554 request being made, including the destination branch, commit
13555 message, and command line options specified, is not available
13556 to the command.
13557
13558 @c FIXME: should discuss using commitinfo to control
13559 @c who has checkin access to what (e.g. Joe can check into
13560 @c directories a, b, and c, and Mary can check into
13561 @c directories b, c, and d--note this case cannot be
13562 @c conveniently handled with unix groups).  Of course,
13563 @c adding a new set of features to CVS might be a more
13564 @c natural way to fix this problem than telling people to
13565 @c use commitinfo.
13566 @c FIXME: Should make some reference, especially in
13567 @c the context of controlling who has access, to the fact
13568 @c that commitinfo can be circumvented.  Perhaps
13569 @c mention SETXID (but has it been carefully examined
13570 @c for holes?).  This fits in with the discussion of
13571 @c general CVS security in "Password authentication
13572 @c security" (the bit which is not pserver-specific).
13573
13574 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13575 @node verifymsg
13576 @appendixsubsec Verifying log messages
13577 @cindex @file{verifymsg} (admin file)
13578 @cindex Log message, verifying
13579 @cindex logging, commits
13580
13581 Once you have entered a log message, you can evaluate
13582 that message to check for specific content, such as
13583 a bug ID.  Use the @file{verifymsg} file to
13584 specify a program that is used to verify the log message.
13585 This program could be a simple script that checks
13586 that the entered message contains the required fields.
13587
13588 The @file{verifymsg} file is often most useful together
13589 with the @file{rcsinfo} file, which can be used to
13590 specify a log message template (@pxref{rcsinfo}).
13591
13592 The @file{verifymsg} file has the standard form for script hooks
13593 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13594 a command to execute.  It supports only the DEFAULT keywords.
13595
13596 @cindex format strings, verifymsg admin file
13597 In addition to the common format strings (@pxref{syntax}),
13598 @file{verifymsg} supports:
13599
13600 @table @t
13601 @item l
13602 the full path to the file containing the log message to be verified
13603 @item @{sV@}
13604 File attributes, where:
13605 @table @t
13606 @item s
13607 file name
13608 @item V
13609 old version number (pre-checkin)
13610 @end table
13611 @end table
13612
13613 @cindex verifymsg (admin/commit file), updating legacy repositories
13614 @cindex compatibility notes, verifymsg admin file
13615 Currently, if no format strings are specified, a default
13616 string of @samp{ %l} will be appended to the command
13617 line template before replacement is performed, but this
13618 feature is deprecated.  It is simply in place so that legacy
13619 repositories will remain compatible with the new @sc{cvs} application.
13620 For information on updating, @pxref{Updating Commit Files}.
13621
13622 One thing that should be noted is that the @samp{ALL}
13623 keyword is not supported.  If more than one matching
13624 line is found, the first one is used.  This can be
13625 useful for specifying a default verification script in a
13626 directory, and then overriding it in a subdirectory.
13627
13628 @cindex Exit status, of @file{verifymsg}
13629 If the verification script exits with a non-zero exit status,
13630 the commit is aborted.
13631
13632 @cindex @file{verifymsg}, changing the log message
13633 In the default configuration, CVS allows the
13634 verification script to change the log message. This is
13635 controlled via the RereadLogAfterVerify CVSROOT/config
13636 option.
13637
13638 When @samp{RereadLogAfterVerify=always} or
13639 @samp{RereadLogAfterVerify=stat}, the log message will
13640 either always be reread after the verification script
13641 is run or reread only if the log message file status
13642 has changed.
13643
13644 @xref{config}, for more on CVSROOT/config options.
13645
13646 It is NOT a good idea for a @file{verifymsg} script to
13647 interact directly with the user in the various
13648 client/server methods. For the @code{pserver} method,
13649 there is no protocol support for communicating between
13650 @file{verifymsg} and the client on the remote end. For the
13651 @code{ext} and @code{server} methods, it is possible
13652 for CVS to become confused by the characters going
13653 along the same channel as the CVS protocol
13654 messages. See @ref{Remote repositories}, for more
13655 information on client/server setups.  In addition, at the time
13656 the @file{verifymsg} script runs, the CVS
13657 server has locks in place in the repository.  If control is
13658 returned to the user here then other users may be stuck waiting
13659 for access to the repository.
13660
13661 This option can be useful if you find yourself using an
13662 rcstemplate that needs to be modified to remove empty
13663 elements or to fill in default values.  It can also be
13664 useful if the rcstemplate has changed in the repository
13665 and the CVS/Template was not updated, but is able to be
13666 adapted to the new format by the verification script
13667 that is run by @file{verifymsg}.
13668
13669 An example of an update might be to change all
13670 occurrences of 'BugId:' to be 'DefectId:' (which can be
13671 useful if the rcstemplate has recently been changed and
13672 there are still checked-out user trees with cached
13673 copies in the CVS/Template file of the older version).
13674
13675 Another example of an update might be to delete a line
13676 that contains 'BugID: none' from the log message after
13677 validation of that value as being allowed is made.
13678
13679 @menu
13680 * verifymsg example::            Verifymsg example
13681 @end menu
13682
13683 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13684 @node verifymsg example
13685 @appendixsubsubsec Verifying log messages
13686 @cindex verifymsg, example
13687 The following is a little silly example of a
13688 @file{verifymsg} file, together with the corresponding
13689 @file{rcsinfo} file, the log message template and a
13690 verification script.  We begin with the log message template.
13691 We want to always record a bug-id number on the first
13692 line of the log message.  The rest of log message is
13693 free text.  The following template is found in the file
13694 @file{/usr/cvssupport/tc.template}.
13695
13696 @example
13697 BugId:
13698 @end example
13699
13700 The script @file{/usr/cvssupport/bugid.verify} is used to
13701 evaluate the log message.
13702
13703 @example
13704 #!/bin/sh
13705 #
13706 #       bugid.verify filename
13707 #
13708 #  Verify that the log message contains a valid bugid
13709 #  on the first line.
13710 #
13711 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
13712     exit 0
13713 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
13714     # It is okay to allow commits with 'BugId: none',
13715     # but do not put that text into the real log message.
13716     grep -v '^BugId:[ ]*none$' > $1.rewrite
13717     mv $1.rewrite $1
13718     exit 0
13719 else
13720     echo "No BugId found."
13721     exit 1
13722 fi
13723 @end example
13724
13725 The @file{verifymsg} file contains this line:
13726
13727 @example
13728 ^tc     /usr/cvssupport/bugid.verify %l
13729 @end example
13730
13731 The @file{rcsinfo} file contains this line:
13732
13733 @example
13734 ^tc     /usr/cvssupport/tc.template
13735 @end example
13736
13737 The @file{config} file contains this line:
13738
13739 @example
13740 RereadLogAfterVerify=always
13741 @end example
13742
13743
13744
13745 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13746 @node loginfo
13747 @appendixsubsec Loginfo
13748 @cindex loginfo (admin file)
13749 @cindex logging, commits
13750 @cindex Storing log messages
13751 @cindex Mailing log messages
13752 @cindex Distributing log messages
13753 @cindex Log messages
13754
13755 The @file{loginfo} file is used to control where log information is sent after
13756 versioned changes are made to repository archive files and after directories
13757 are added ot the repository.  @ref{posttag} for how to log tagging
13758 information and @ref{postadmin} for how to log changes due to the @code{admin}
13759 command.
13760
13761 The @file{loginfo} file has the standard form for script hooks
13762 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13763 a command to execute.  It supports the ALL and DEFAULT keywords.
13764
13765 Any specified scripts are called:
13766
13767 @table @code
13768 @item commit
13769 Once per directory, immediately after a successfully completing the commit of
13770 all files within that directory.
13771 @item import
13772 Once per import, immediately after completion of all write operations.
13773 @item add
13774 Immediately after the successful @code{add} of a directory.
13775 @end table
13776
13777 Any script called via @file{loginfo} will be fed the log information on its
13778 standard input.  Note that the filter program @strong{must} read @strong{all}
13779 of the log information from its standard input or @sc{cvs} may fail with a
13780 broken pipe signal.
13781
13782 @cindex format strings, loginfo admin file
13783 In addition to the common format strings (@pxref{syntax}),
13784 @file{loginfo} supports:
13785
13786 @table @t
13787 @item @{stVv@}
13788 File attributes, where:
13789 @table @t
13790 @item s
13791 file name
13792 @item T
13793 tag name of destination, or the empty string when there is no associated
13794 tag name (this usually means the trunk)
13795 @item V
13796 old version number (pre-checkin)
13797 @item v
13798 new version number (post-checkin)
13799 @end table
13800 @end table
13801
13802 For example, some valid format strings are @samp{%%},
13803 @samp{%s}, @samp{%@{s@}}, and @samp{%@{stVv@}}.
13804
13805 @cindex loginfo (admin file), updating legacy repositories
13806 @cindex compatibility notes, loginfo admin file
13807 Currently, if @samp{UseNewInfoFmtStrings} is not set in the @file{config}
13808 administration file (@pxref{config}), the format strings will be substituted
13809 as they were in past versions of @sc{cvs}, but this feature is deprecated.
13810 It is simply in place so that legacy repositories will remain compatible with
13811 the new @sc{cvs} application.  For information on updating,
13812 please see @ref{Updating Commit Files}.
13813
13814 As an example, if @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%p}
13815 and @samp{%@{sVv@}} are the format strings, and three files (@t{ChangeLog},
13816 @t{Makefile}, @t{foo.c}) were modified, the output might be:
13817
13818 @example
13819 yoyodyne/tc ChangeLog 1.1 1.2 Makefile 1.3 1.4 foo.c 1.12 1.13
13820 @end example
13821
13822 Note: when @sc{cvs} is accessing a remote repository,
13823 @file{loginfo} will be run on the @emph{remote}
13824 (i.e., server) side, not the client side (@pxref{Remote
13825 repositories}).
13826
13827 @menu
13828 * loginfo example::                          Loginfo example
13829 * Keeping a checked out copy::               Updating a tree on every checkin
13830 @end menu
13831
13832 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13833 @node loginfo example
13834 @appendixsubsubsec Loginfo example
13835
13836 The following @file{loginfo} file, together with the
13837 tiny shell-script below, appends all log messages
13838 to the file @file{$CVSROOT/CVSROOT/commitlog},
13839 and any commits to the administrative files (inside
13840 the @file{CVSROOT} directory) are also logged in
13841 @file{/usr/adm/cvsroot-log}.
13842 Commits to the @file{prog1} directory are mailed to @t{ceder}.
13843
13844 @c FIXME: is it a CVS feature or bug that only the
13845 @c first matching line is used?  It is documented
13846 @c above, but is it useful?  For example, if we wanted
13847 @c to run both "cvs-log" and "Mail" for the CVSROOT
13848 @c directory, it is kind of awkward if
13849 @c only the first matching line is used.
13850 @example
13851 ALL                     /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
13852 ^CVSROOT\(/\|$\)        /usr/local/bin/cvs-log /usr/adm/cvsroot-log $USER
13853 ^prog1\(/\|$\)          Mail -s "%p %s" ceder
13854 @end example
13855
13856 The shell-script @file{/usr/local/bin/cvs-log} looks
13857 like this:
13858
13859 @example
13860 #!/bin/sh
13861 (echo "------------------------------------------------------";
13862  echo -n "$2  ";
13863  date;
13864  echo;
13865  cat) >> $1
13866 @end example
13867
13868
13869
13870 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13871 @node Keeping a checked out copy
13872 @appendixsubsubsec Keeping a checked out copy
13873
13874 @c What other index entries?  It seems like
13875 @c people might want to use a lot of different
13876 @c words for this functionality.
13877 @cindex Keeping a checked out copy
13878 @cindex Checked out copy, keeping
13879 @cindex Web pages, maintaining with CVS
13880
13881 It is often useful to maintain a directory tree which
13882 contains files which correspond to the latest version
13883 in the repository.  For example, other developers might
13884 want to refer to the latest sources without having to
13885 check them out, or you might be maintaining a web site
13886 with @sc{cvs} and want every checkin to cause the files
13887 used by the web server to be updated.
13888 @c Can we offer more details on the web example?  Or
13889 @c point the user at how to figure it out?  This text
13890 @c strikes me as sufficient for someone who already has
13891 @c some idea of what we mean but not enough for the naive
13892 @c user/sysadmin to understand it and set it up.
13893
13894 The way to do this is by having loginfo invoke
13895 @code{cvs update}.  Doing so in the naive way will
13896 cause a problem with locks, so the @code{cvs update}
13897 must be run in the background.
13898 @c Should we try to describe the problem with locks?
13899 @c It seems like a digression for someone who just
13900 @c wants to know how to make it work.
13901 @c Another choice which might work for a single file
13902 @c is to use "cvs -n update -p" which doesn't take
13903 @c out locks (I think) but I don't see many advantages
13904 @c of that and we might as well document something which
13905 @c works for multiple files.
13906 Here is an example for unix (this should all be on one line):
13907
13908 @example
13909 ^cyclic-pages\(/\|$\)   (date; cat; (sleep 2; cd /u/www/local-docs;
13910  cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
13911 @end example
13912
13913 This will cause checkins to repository directory @code{cyclic-pages}
13914 and its subdirectories to update the checked
13915 out tree in @file{/u/www/local-docs}.
13916 @c More info on some of the details?  The "sleep 2" is
13917 @c so if we are lucky the lock will be gone by the time
13918 @c we start and we can wait 2 seconds instead of 30.
13919
13920
13921
13922 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13923 @node postadmin
13924 @appendixsubsec Logging admin commands
13925 @cindex postadmin (admin file)
13926 @cindex script hook, postadmin
13927 @cindex Admin commands, logging
13928
13929 The @file{postadmin} file defines programs to execute after an @code{admin}
13930 command modifies files.  The @file{postadmin} file has the standard form
13931 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
13932 expression followed by a command to execute.  It supports the ALL and DEFAULT
13933 keywords.
13934
13935 @cindex format strings, postadmin admin file
13936 The @file{postadmin} file supports no format strings other than the common
13937 ones (@pxref{syntax}),
13938
13939
13940
13941 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13942 @node taginfo
13943 @appendixsubsec Taginfo
13944 @cindex taginfo (admin file)
13945 @cindex script hook, taginfo
13946 @cindex Tags, logging
13947 @cindex Tags, verifying
13948 The @file{taginfo} file defines programs to execute
13949 when someone executes a @code{tag} or @code{rtag}
13950 command.  The @file{taginfo} file has the standard form
13951 for script hooks (@pxref{Trigger Scripts}), where each line
13952 is a regular expression followed by a command to execute.
13953 It supports the ALL and DEFAULT keywords.
13954
13955 @cindex format strings, taginfo admin file
13956 In addition to the common format strings (@pxref{syntax}),
13957 @file{taginfo} supports:
13958
13959 @table @t
13960 @item b
13961 tag type (@code{T} for branch, @code{N} for not-branch, or @code{?} for
13962 unknown, as during delete operations)
13963 @item o
13964 operation (@code{add} for @code{tag}, @code{mov} for @code{tag -F}, or
13965 @code{del} for @code{tag -d})
13966 @item t
13967 new tag name
13968 @item @{sTVv@}
13969 file attributes, where:
13970 @table @t
13971 @item s
13972 file name
13973 @item T
13974 tag name of destination, or the empty string when there is no associated
13975 tag name (this usually means the trunk)
13976 @item V
13977 old version number (for a move or delete operation)
13978 @item v
13979 new version number (for an add or move operation)
13980 @end table
13981 @end table
13982
13983 For example, some valid format strings are @samp{%%}, @samp{%p}, @samp{%t},
13984 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13985
13986 @cindex taginfo (admin file), updating legacy repositories
13987 @cindex compatibility notes, taginfo admin file
13988 Currently, if no format strings are specified, a default
13989 string of @samp{ %t %o %p %@{sv@}} will be appended to the command
13990 line template before replacement is performed, but this
13991 feature is deprecated.  It is simply in place so that legacy
13992 repositories will remain compatible with the new @sc{cvs} application.
13993 For information on updating, @pxref{Updating Commit Files}.
13994
13995 @cindex Exit status, of taginfo admin file
13996 @cindex taginfo (admin file), exit status
13997 A non-zero exit of the filter program will cause the tag to be
13998 aborted.
13999
14000 Here is an example of using @file{taginfo} to log @code{tag} and @code{rtag}
14001 commands.  In the @file{taginfo} file put:
14002
14003 @example
14004 ALL /usr/local/cvsroot/CVSROOT/loggit %t %b %o %p %@{sVv@}
14005 @end example
14006
14007 @noindent
14008 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
14009 following script:
14010
14011 @example
14012 #!/bin/sh
14013 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
14014 @end example
14015
14016
14017
14018 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14019 @node posttag
14020 @appendixsubsec Logging tags
14021 @cindex posttag (admin file)
14022 @cindex script hook, posttag
14023 @cindex Tags, logging
14024
14025 The @file{posttag} file defines programs to execute after a @code{tag} or
14026 @code{rtag} command modifies files.  The @file{posttag} file has the standard
14027 form for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14028 expression followed by a command to execute.  It supports the ALL and DEFAULT
14029 keywords.
14030
14031 @cindex format strings, posttag admin file
14032 The @file{posttag} admin file supports the same format strings as the
14033 @file{taginfo} file (@pxref{taginfo}),
14034
14035
14036
14037 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14038 @node postwatch
14039 @appendixsubsec Logging watch commands
14040 @cindex postwatch (admin file)
14041 @cindex script hook, postwatch
14042 @cindex Watch family of commands, logging
14043
14044 The @file{postwatch} file defines programs to execute after any command (for
14045 instance, @code{watch}, @code{edit}, @code{unedit}, or @code{commit}) modifies
14046 any @file{CVS/fileattr} file in the repository (@pxref{Watches}).  The
14047 @file{postwatch} file has the standard form for script hooks
14048 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
14049 a command to execute.  It supports the ALL and DEFAULT keywords.
14050
14051 @cindex format strings, postwatch admin file
14052 The @file{postwatch} file supports no format strings other than the common
14053 ones (@pxref{syntax}), but it is worth noting that the @code{%c} format string
14054 may not be replaced as you might expect.  Client runs of @code{edit} and
14055 @code{unedit} can sometimes skip contacting the @sc{cvs} server and cache the
14056 notification of the file attribute change to be sent the next time the client
14057 contacts the server for whatever other reason,
14058
14059
14060
14061 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14062 @node preproxy
14063 @appendixsubsec Launch a Script before Proxying
14064 @cindex preproxy (admin file)
14065 @cindex script hook, preproxy
14066 @cindex Write proxy, verifying
14067 @cindex Write proxy, logging
14068
14069 The @file{preproxy} file defines programs to execute after a secondary
14070 server receives a write request from a client, just before it starts up the
14071 primary server and becomes a write proxy.  This hook could be used to
14072 dial a modem, launch an SSH tunnel, establish a VPN, or anything else that
14073 might be necessary to do before contacting the primary server.
14074
14075 @file{preproxy} scripts are called once, at the time of the write request, with
14076 the repository argument (if requested) set from the topmost directory sent by
14077 the client.
14078
14079 The @file{preproxy} file has the standard form
14080 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14081 expression followed by a command to execute.  It supports the ALL and DEFAULT
14082 keywords.
14083
14084 @cindex format strings, preproxy admin file
14085 In addition to the common format strings, the @file{preproxy} file supports the
14086 following format string:
14087
14088 @table @t
14089 @item P
14090 the CVSROOT string which specifies the primary server
14091 @end table
14092
14093
14094
14095 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14096 @node postproxy
14097 @appendixsubsec Launch a Script after Proxying
14098 @cindex postproxy (admin file)
14099 @cindex script hook, postproxy
14100 @cindex Write proxy, logging
14101 @cindex Write proxy, pull updates
14102 @cindex secondary server, pull updates
14103
14104 The @file{postproxy} file defines programs to execute after a secondary
14105 server notes that the connection to the primary server has shut down and before
14106 it releases the client by shutting down the connection to the client.
14107 This could hook could be used to
14108 disconnect a modem, an SSH tunnel, a VPN, or anything else that
14109 might be necessary to do after contacting the primary server.  This hook should
14110 also be used to pull updates from the primary server before allowing the client
14111 which did the write to disconnect since otherwise the client's next read
14112 request may generate error messages and fail upon encountering an out of date
14113 repository on the secondary server.
14114
14115 @file{postproxy} scripts are called once per directory.
14116
14117 The @file{postproxy} file has the standard form
14118 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14119 expression followed by a command to execute.  It supports the ALL and DEFAULT
14120 keywords.
14121
14122 @cindex format strings, postproxy admin file
14123 In addition to the common format strings, the @file{postproxy} file supports
14124 the following format string:
14125
14126 @table @t
14127 @item P
14128 the CVSROOT string which specifies the primary server
14129 @end table
14130
14131
14132
14133 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14134 @node rcsinfo
14135 @appendixsec Rcsinfo
14136 @cindex rcsinfo (admin file)
14137 @cindex Form for log message
14138 @cindex Log message template
14139 @cindex Template for log message
14140 @cindex logging, commits
14141
14142 The @file{rcsinfo} file can be used to specify a form to
14143 edit when filling out the commit log.  The
14144 @file{rcsinfo} file has a syntax similar to the
14145 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
14146 files.  @xref{syntax}.  Unlike the other files the second
14147 part is @emph{not} a command-line template.  Instead,
14148 the part after the regular expression should be a full pathname to
14149 a file containing the log message template.
14150
14151 If the repository name does not match any of the
14152 regular expressions in this file, the @samp{DEFAULT}
14153 line is used, if it is specified.
14154
14155 All occurrences of the name @samp{ALL} appearing as a
14156 regular expression are used in addition to the first
14157 matching regular expression or @samp{DEFAULT}.
14158
14159 @c FIXME: should be offering advice, somewhere around
14160 @c here, about where to put the template file.  The
14161 @c verifymsg example uses /usr/cvssupport but doesn't
14162 @c say anything about what that directory is for or
14163 @c whether it is hardwired into CVS or who creates
14164 @c it or anything.  In particular we should say
14165 @c how to version control the template file.  A
14166 @c probably better answer than the /usr/cvssupport
14167 @c stuff is to use checkoutlist (with xref to the
14168 @c checkoutlist doc).
14169 @c Also I am starting to see a connection between
14170 @c this and the Keeping a checked out copy node.
14171 @c Probably want to say something about that.
14172 The log message template will be used as a default log
14173 message.  If you specify a log message with @samp{cvs
14174 commit -m @var{message}} or @samp{cvs commit -f
14175 @var{file}} that log message will override the
14176 template.
14177
14178 @xref{verifymsg}, for an example @file{rcsinfo}
14179 file.
14180
14181 When @sc{cvs} is accessing a remote repository,
14182 the contents of @file{rcsinfo} at the time a directory
14183 is first checked out will specify a template. This
14184 template will be updated on all @samp{cvs update}
14185 commands. It will also be added to new directories
14186 added with a @samp{cvs add new-directory} command.
14187 In versions of @sc{cvs} prior to version 1.12, the
14188 @file{CVS/Template} file was not updated. If the
14189 @sc{cvs} server is at version 1.12 or higher an older
14190 client may be used and the @file{CVS/Template} will
14191 be updated from the server.
14192
14193 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14194 @node cvsignore
14195 @appendixsec Ignoring files via cvsignore
14196 @cindex cvsignore (admin file), global
14197 @cindex Global cvsignore
14198 @cindex Ignoring files
14199 @c -- This chapter should maybe be moved to the
14200 @c tutorial part of the manual?
14201
14202 There are certain file names that frequently occur
14203 inside your working copy, but that you don't want to
14204 put under @sc{cvs} control.  Examples are all the object
14205 files that you get while you compile your sources.
14206 Normally, when you run @samp{cvs update}, it prints a
14207 line for each file it encounters that it doesn't know
14208 about (@pxref{update output}).
14209
14210 @sc{cvs} has a list of files (or sh(1) file name patterns)
14211 that it should ignore while running @code{update},
14212 @code{import} and @code{release}.
14213 @c -- Are those the only three commands affected?
14214 This list is constructed in the following way.
14215
14216 @itemize @bullet
14217 @item
14218 The list is initialized to include certain file name
14219 patterns: names associated with @sc{cvs}
14220 administration, or with other common source control
14221 systems; common names for patch files, object files,
14222 archive files, and editor backup files; and other names
14223 that are usually artifacts of assorted utilities.
14224 Currently, the default list of ignored file name
14225 patterns is:
14226
14227 @cindex Ignored files
14228 @cindex Automatically ignored files
14229 @example
14230     RCS     SCCS    CVS     CVS.adm
14231     RCSLOG  cvslog.*
14232     tags    TAGS
14233     .make.state     .nse_depinfo
14234     *~      #*      .#*     ,*      _$*     *$
14235     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
14236     *.a     *.olb   *.o     *.obj   *.so    *.exe
14237     *.Z     *.elc   *.ln
14238     core
14239 @end example
14240
14241 @item
14242 The per-repository list in
14243 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
14244 the list, if that file exists.
14245
14246 @item
14247 The per-user list in @file{.cvsignore} in your home
14248 directory is appended to the list, if it exists.
14249
14250 @item
14251 Any entries in the environment variable
14252 @code{$CVSIGNORE} is appended to the list.
14253
14254 @item
14255 Any @samp{-I} options given to @sc{cvs} is appended.
14256
14257 @item
14258 As @sc{cvs} traverses through your directories, the contents
14259 of any @file{.cvsignore} will be appended to the list.
14260 The patterns found in @file{.cvsignore} are only valid
14261 for the directory that contains them, not for
14262 any sub-directories.
14263 @end itemize
14264
14265 In any of the 5 places listed above, a single
14266 exclamation mark (@samp{!}) clears the ignore list.
14267 This can be used if you want to store any file which
14268 normally is ignored by @sc{cvs}.
14269
14270 Specifying @samp{-I !} to @code{cvs import} will import
14271 everything, which is generally what you want to do if
14272 you are importing files from a pristine distribution or
14273 any other source which is known to not contain any
14274 extraneous files.  However, looking at the rules above
14275 you will see there is a fly in the ointment; if the
14276 distribution contains any @file{.cvsignore} files, then
14277 the patterns from those files will be processed even if
14278 @samp{-I !} is specified.  The only workaround is to
14279 remove the @file{.cvsignore} files in order to do the
14280 import.  Because this is awkward, in the future
14281 @samp{-I !} might be modified to override
14282 @file{.cvsignore} files in each directory.
14283
14284 Note that the syntax of the ignore files consists of a
14285 series of lines, each of which contains a space
14286 separated list of filenames.  This offers no clean way
14287 to specify filenames which contain spaces, but you can
14288 use a workaround like @file{foo?bar} to match a file
14289 named @file{foo bar} (it also matches @file{fooxbar}
14290 and the like).  Also note that there is currently no
14291 way to specify comments.
14292 @c FIXCVS?  I don't _like_ this syntax at all, but
14293 @c changing it raises all the usual compatibility
14294 @c issues and I'm also not sure what to change it to.
14295
14296 @node checkoutlist
14297 @appendixsec The checkoutlist file
14298 @cindex checkoutlist
14299
14300 It may be helpful to use @sc{cvs} to maintain your own
14301 files in the @file{CVSROOT} directory.  For example,
14302 suppose that you have a script @file{logcommit.pl}
14303 which you run by including the following line in the
14304 @file{commitinfo} administrative file:
14305
14306 @example
14307 ALL   $CVSROOT/CVSROOT/logcommit.pl %r/%p %s
14308 @end example
14309
14310 To maintain @file{logcommit.pl} with @sc{cvs} you would
14311 add the following line to the @file{checkoutlist}
14312 administrative file:
14313
14314 @example
14315 logcommit.pl
14316 @end example
14317
14318 The format of @file{checkoutlist} is one line for each
14319 file that you want to maintain using @sc{cvs}, giving
14320 the name of the file, followed optionally by more whitespace
14321 and any error message that should print if the file cannot be
14322 checked out into CVSROOT after a commit:
14323
14324 @example
14325 logcommit.pl    Could not update CVSROOT/logcommit.pl.
14326 @end example
14327
14328 After setting up @file{checkoutlist} in this fashion,
14329 the files listed there will function just like
14330 @sc{cvs}'s built-in administrative files.  For example,
14331 when checking in one of the files you should get a
14332 message such as:
14333
14334 @example
14335 cvs commit: Rebuilding administrative file database
14336 @end example
14337
14338 @noindent
14339 and the checked out copy in the @file{CVSROOT}
14340 directory should be updated.
14341
14342 Note that listing @file{passwd} (@pxref{Password
14343 authentication server}) in @file{checkoutlist} is not
14344 recommended for security reasons.
14345
14346 For information about keeping a checkout out copy in a
14347 more general context than the one provided by
14348 @file{checkoutlist}, see @ref{Keeping a checked out
14349 copy}.
14350
14351 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14352 @node history file
14353 @appendixsec The history file
14354 @cindex History file
14355 @cindex Log information, saving
14356
14357 By default, the file @file{$CVSROOT/CVSROOT/history} is used
14358 to log information for the @code{history} command (@pxref{history}).
14359 This file name may be changed with the @samp{HistoryLogPath} and
14360 @samp{HistorySearchPath} config options (@pxref{config}).
14361
14362 The file format of the @file{history} file is
14363 documented only in comments in the @sc{cvs} source
14364 code, but generally programs should use the @code{cvs
14365 history} command to access it anyway, in case the
14366 format changes with future releases of @sc{cvs}.
14367
14368 @node Variables
14369 @appendixsec Expansions in administrative files
14370 @cindex Internal variables
14371 @cindex Variables
14372
14373 Sometimes in writing an administrative file, you might
14374 want the file to be able to know various things based
14375 on environment @sc{cvs} is running in.  There are
14376 several mechanisms to do that.
14377
14378 To find the home directory of the user running @sc{cvs}
14379 (from the @code{HOME} environment variable), use
14380 @samp{~} followed by @samp{/} or the end of the line.
14381 Likewise for the home directory of @var{user}, use
14382 @samp{~@var{user}}.  These variables are expanded on
14383 the server machine, and don't get any reasonable
14384 expansion if pserver (@pxref{Password authenticated})
14385 is in use; therefore user variables (see below) may be
14386 a better choice to customize behavior based on the user
14387 running @sc{cvs}.
14388 @c Based on these limitations, should we deprecate ~?
14389 @c What is it good for?  Are people using it?
14390
14391 One may want to know about various pieces of
14392 information internal to @sc{cvs}.  A @sc{cvs} internal
14393 variable has the syntax @code{$@{@var{variable}@}},
14394 where @var{variable} starts with a letter and consists
14395 of alphanumeric characters and @samp{_}.  If the
14396 character following @var{variable} is a
14397 non-alphanumeric character other than @samp{_}, the
14398 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
14399 internal variables are:
14400
14401 @table @code
14402 @item CVSROOT
14403 @cindex CVSROOT, internal variable
14404 This is the absolute path to the current @sc{cvs} root directory.
14405 @xref{Repository}, for a description of the various
14406 ways to specify this, but note that the internal
14407 variable contains just the directory and not any
14408 of the access method information.
14409
14410 @item RCSBIN
14411 @cindex RCSBIN, internal variable
14412 In @sc{cvs} 1.9.18 and older, this specified the
14413 directory where @sc{cvs} was looking for @sc{rcs}
14414 programs.  Because @sc{cvs} no longer runs @sc{rcs}
14415 programs, specifying this internal variable is now an
14416 error.
14417
14418 @item CVSEDITOR
14419 @cindex CVSEDITOR, internal variable
14420 @itemx EDITOR
14421 @cindex EDITOR, internal variable
14422 @itemx VISUAL
14423 @cindex VISUAL, internal variable
14424 These all expand to the same value, which is the editor
14425 that @sc{cvs} is using.  @xref{Global options}, for how
14426 to specify this.
14427
14428 @item USER
14429 @cindex USER, internal variable
14430 Username of the user running @sc{cvs} (on the @sc{cvs}
14431 server machine).
14432 When using pserver, this is the user specified in the repository
14433 specification which need not be the same as the username the
14434 server is running as (@pxref{Password authentication server}).
14435 Do not confuse this with the environment variable of the same name.
14436
14437 @item SESSIONID
14438 @cindex COMMITID, internal variable
14439 Unique Session ID of the @sc{cvs} process. This is a
14440 random string of printable characters of at least 16
14441 characters length. Users should assume that it may
14442 someday grow to at most 256 characters in length.
14443
14444 @item COMMITID
14445 @cindex COMMITID, internal variable
14446 Unique Session ID of the @sc{cvs} process. This is a
14447 random string of printable characters of at least 16
14448 characters length. Users should assume that it may
14449 someday grow to at most 256 characters in length.
14450 @end table
14451
14452 If you want to pass a value to the administrative files
14453 which the user who is running @sc{cvs} can specify,
14454 use a user variable.
14455 @cindex User variables
14456 To expand a user variable, the
14457 administrative file contains
14458 @code{$@{=@var{variable}@}}.  To set a user variable,
14459 specify the global option @samp{-s} to @sc{cvs}, with
14460 argument @code{@var{variable}=@var{value}}.  It may be
14461 particularly useful to specify this option via
14462 @file{.cvsrc} (@pxref{~/.cvsrc}).
14463
14464 For example, if you want the administrative file to
14465 refer to a test directory you might create a user
14466 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
14467 as
14468
14469 @example
14470 cvs -s TESTDIR=/work/local/tests
14471 @end example
14472
14473 @noindent
14474 and the
14475 administrative file contains @code{sh
14476 $@{=TESTDIR@}/runtests}, then that string is expanded
14477 to @code{sh /work/local/tests/runtests}.
14478
14479 All other strings containing @samp{$} are reserved;
14480 there is no way to quote a @samp{$} character so that
14481 @samp{$} represents itself.
14482
14483 Environment variables passed to administrative files are:
14484
14485 @table @code
14486 @cindex environment variables, passed to administrative files
14487
14488 @item CVS_USER
14489 @cindex CVS_USER, environment variable
14490 The @sc{cvs}-specific username provided by the user, if it
14491 can be provided (currently just for the pserver access
14492 method), and to the empty string otherwise.  (@code{CVS_USER}
14493 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
14494 is used to map @sc{cvs} usernames to system usernames.)
14495
14496 @item LOGNAME
14497 @cindex LOGNAME, environment variable
14498 The username of the system user.
14499
14500 @item USER
14501 @cindex USER, environment variable
14502 Same as @code{LOGNAME}.
14503 Do not confuse this with the internal variable of the same name.
14504 @end table
14505
14506 @node config
14507 @appendixsec The CVSROOT/config configuration file
14508
14509 @cindex configuration file
14510 @cindex config, in CVSROOT
14511 @cindex CVSROOT/config
14512
14513 Usually, the @file{config} file is found at @file{$CVSROOT/CVSROOT/config},
14514 but this may be overridden on the @code{pserver} and @code{server} command
14515 lines (@pxref{server & pserver}).
14516
14517 The administrative file @file{config} contains various
14518 miscellaneous settings which affect the behavior of
14519 @sc{cvs}.  The syntax is slightly different from the
14520 other administrative files.
14521
14522 Leading white space on any line is ignored, though the syntax is very strict
14523 and will reject spaces and tabs almost anywhere else.
14524
14525 Empty lines, lines containing nothing but white space, and lines which start
14526 with @samp{#} (discounting any leading white space) are ignored.
14527
14528 @c FIXME: where do we define comments for the other
14529 @c administrative files.
14530 Other lines consist of the optional leading white space, a keyword, @samp{=},
14531 and a value.  Please note again that this syntax is very strict.
14532 Extraneous spaces or tabs, other than the leading white space, are not
14533 permitted on these lines.
14534 @c See comments in parseinfo.c:parse_config for more
14535 @c discussion of this strictness.
14536
14537 As of CVS 1.12.13, lines of the form @samp{[@var{CVSROOT}]} mark the subsequent
14538 section of the config file as applying only to certain repositories.  Multiple
14539 @samp{[@var{CVSROOT}]} lines without intervening
14540 @samp{@var{KEYWORD}=@var{VALUE}} pairs cause processing to fall through,
14541 processing subsequent keywords for any root in the list.  Finally, keywords
14542 and values which appear before any @samp{[@var{CVSROOT}]} lines are defaults,
14543 and may to apply to any repository.  For example, consider the following file:
14544
14545 @example
14546 # Defaults
14547 LogHistory=TMAR
14548
14549 [/cvsroots/team1]
14550   LockDir=/locks/team1
14551
14552 [/cvsroots/team2]
14553   LockDir=/locks/team2
14554
14555 [/cvsroots/team3]
14556   LockDir=/locks/team3
14557
14558 [/cvsroots/team4]
14559   LockDir=/locks/team4
14560
14561 [/cvsroots/team3]
14562 [/cvsroots/team4]
14563   # Override logged commands for teams 3 & 4.
14564   LogHistory=all
14565 @end example
14566
14567 This example file sets up separate lock directories for each project, as well
14568 as a default set of logged commands overridden for the example's team 3 &
14569 team 4. This syntax could be useful, for instance, if you wished to share a
14570 single config file, for instance @file{/etc/cvs.conf}, among several
14571 repositories.
14572
14573 Currently defined keywords are:
14574
14575 @table @code
14576 @cindex HistoryLogPath, in CVSROOT/config
14577 @item HistorySearchPath=@var{pattern}
14578 Request that @sc{cvs} look for its history information in files matching
14579 @var{pattern}, which is a standard UNIX file glob.  If @var{pattern} matches
14580 multiple files, all will be searched in lexicographically sorted order.
14581 @xref{history}, and @ref{history file}, for more.
14582
14583 If no value is supplied for this option, it defaults to
14584 @file{$CVSROOT/CVSROOT/history}.
14585
14586 @cindex HistorySearchPath, in CVSROOT/config
14587 @item HistoryLogPath=@var{path}
14588 Control where @sc{cvs} logs its history.  If the file does not exist, @sc{cvs}
14589 will attempt to create it.  Format strings, as available to the GNU C
14590 @code{strftime} function and often the UNIX date command, and the string
14591 @var{$CVSROOT} will be substituted in this path.  For example, consider the
14592 line:
14593
14594 @example
14595 HistoryLogPath=$CVSROOT/CVSROOT/history/%Y-%m-%d
14596 @end example
14597
14598 This line would cause @sc{cvs} to attempt to create its history file in a
14599 subdirectory (@file{history}) of the configuration directory (@file{CVSROOT})
14600 with a name equal to the current date representation in the ISO8601 format (for
14601 example, on May 11, 2005, @sc{cvs} would attempt to log its history under the
14602 repository root directory in a file named @file{CVSROOT/history/2005-05-11}).
14603 @xref{history}, and @ref{history file}, for more.
14604
14605 If no value is supplied for this option, it defaults to
14606 @file{$CVSROOT/CVSROOT/history}.
14607
14608 @cindex ImportNewFilesToVendorBranchOnly, in CVSROOT/config
14609 @cindex import, config admin file
14610 @cindex config (admin file), import
14611 @item ImportNewFilesToVendorBranchOnly=@var{value}
14612 Specify whether @code{cvs import} should always behave as if the
14613 @samp{-X} flag was specified on the command line.  
14614 @var{value} may be either @samp{yes} or @samp{no}.  If set to @samp{yes},
14615 all uses of @code{cvs import} on the repository will behave as if the
14616 @samp{-X} flag was set.  The default value is @samp{no}.
14617
14618 @cindex KeywordExpand, in CVSROOT/config
14619 @item KeywordExpand=@var{value}
14620 Specify @samp{i} followed by a list of keywords to be expanded
14621 (for example, @samp{KeywordExpand=iMYCVS,Name,Date}),
14622 or @samp{e} followed by a list of keywords not to be expanded
14623 (for example, @samp{KeywordExpand=eCVSHeader}).
14624 For more on keyword expansion, see @ref{Configuring keyword expansion}.
14625
14626 @cindex LocalKeyword, in CVSROOT/config
14627 @item LocalKeyword=@var{value}
14628 Specify a local alias for a standard keyword.
14629 For example, @samp{LocalKeyword=MYCVS=CVSHeader}.
14630 For more on local keywords, see @ref{Keyword substitution}.
14631
14632 @cindex LockDir, in CVSROOT/config
14633 @item LockDir=@var{directory}
14634 Put @sc{cvs} lock files in @var{directory} rather than
14635 directly in the repository.  This is useful if you want
14636 to let users read from the repository while giving them
14637 write access only to @var{directory}, not to the
14638 repository.
14639 It can also be used to put the locks on a very fast
14640 in-memory file system to speed up locking and unlocking
14641 the repository.
14642 You need to create @var{directory}, but
14643 @sc{cvs} will create subdirectories of @var{directory} as it
14644 needs them.  For information on @sc{cvs} locks, see
14645 @ref{Concurrency}.
14646
14647 @c Mention this in Compatibility section?
14648 Before enabling the LockDir option, make sure that you
14649 have tracked down and removed any copies of @sc{cvs} 1.9 or
14650 older.  Such versions neither support LockDir, nor will
14651 give an error indicating that they don't support it.
14652 The result, if this is allowed to happen, is that some
14653 @sc{cvs} users will put the locks one place, and others will
14654 put them another place, and therefore the repository
14655 could become corrupted.  @sc{cvs} 1.10 does not support
14656 LockDir but it will print a warning if run on a
14657 repository with LockDir enabled.
14658
14659 @cindex LogHistory, in CVSROOT/config
14660 @item LogHistory=@var{value}
14661 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
14662 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
14663 all transactions.  Any subset of the default is
14664 legal.  (For example, to only log transactions that modify the
14665 @file{*,v} files, use @samp{LogHistory=TMAR}.)  To disable history logging
14666 completely, use @samp{LogHistory=}.
14667
14668 @cindex MaxCommentLeaderLength, in CVSROOT/config
14669 @cindex Log keyword, configuring substitution behavior
14670 @item MaxCommentLeaderLength=@var{length}
14671 Set to some length, in bytes, where a trailing @samp{k}, @samp{M}, @samp{G},
14672 or @samp{T} causes the preceding nubmer to be interpreted as kilobytes,
14673 megabytes, gigabytes, or terrabytes, respectively, will cause
14674 @code{$@splitrcskeyword{Log}$} keywords (@pxref{Keyword substitution}), with
14675 more than @var{length} bytes preceding it on a line to be ignored (or to fall
14676 back on the comment leader set in the RCS archive file - see
14677 @code{UseArchiveCommentLeader} below).  Defaults to 20 bytes to allow checkouts
14678 to proceed normally when they include binary files containing
14679 @code{$@splitrcskeyword{Log}$} keywords and which users have neglected to mark
14680 as binary.
14681
14682 @cindex MinCompressionLevel, in CVSROOT/config
14683 @cindex MaxCompressionLevel, in CVSROOT/config
14684 @cindex Compression levels, restricting on server
14685 @item MinCompressionLevel=@var{value}
14686 @itemx MaxCompressionLevel=@var{value}
14687 Restricts the level of compression used by the @sc{cvs} server to a @var{value}
14688 between 0 and 9.  @var{value}s 1 through 9 are the same @sc{zlib} compression
14689 levels accepted by the @samp{-z} option (@pxref{Global options}), and 0 means
14690 no compression.  When one or both of these keys are set and a client requests a
14691 level outside the specified range, the server will simply use the closest
14692 permissable level.  Clients will continue compressing at the level requested by
14693 the user.
14694
14695 The exception is when level 0 (no compression) is not available and the client
14696 fails to request any compression.  The @sc{cvs} server will then exit with an
14697 error message when it becomes apparent that the client is not going to request
14698 compression.  This will not happen with clients version 1.12.13 and later since
14699 these client versions allow the server to notify them that they must request
14700 some level of compression.
14701
14702 @ignore
14703 @cindex PreservePermissions, in CVSROOT/config
14704 @item PreservePermissions=@var{value}
14705 Enable support for saving special device files,
14706 symbolic links, file permissions and ownerships in the
14707 repository.  The default value is @samp{no}.
14708 @xref{Special Files}, for the full implications of using
14709 this keyword.
14710 @end ignore
14711
14712 @cindex PrimaryServer, in CVSROOT/config
14713 @cindex Primary server
14714 @cindex Secondary server
14715 @cindex proxy, write
14716 @cindex write proxy
14717 @item PrimaryServer=@var{CVSROOT}
14718 When specified, and the repository specified by @var{CVSROOT} is not the one
14719 currently being accessed, then the server will turn itself into a transparent
14720 proxy to @var{CVSROOT} for write requests.  The @var{hostname} configured as
14721 part of @var{CVSROOT} must resolve to the same string returned by the
14722 @command{uname} command on the primary server for this to work.  Host name
14723 resolution is performed via some combination of @command{named}, a broken out
14724 line from @file{/etc/hosts}, and the Network Information Service (NIS or YP),
14725 depending on the configuration of the particular system.
14726
14727 Only the @samp{:ext:} method is
14728 currently supported for primaries (actually, @samp{:fork:} is supported as
14729 well, but only for testing - if you find another use for accessing a primary
14730 via the @samp{:fork:} method, please send a note to @email{bug-cvs@@nongnu.org}
14731 about it).  See @ref{Write proxies} for more on configuring and using write
14732 proxies.
14733
14734 @cindex RCSBIN, in CVSROOT/config
14735 @item RCSBIN=@var{bindir}
14736 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
14737 @sc{cvs} to look for @sc{rcs} programs in the
14738 @var{bindir} directory.  Current versions of @sc{cvs}
14739 do not run @sc{rcs} programs; for compatibility this
14740 setting is accepted, but it does nothing.
14741
14742 @cindex RereadLogAfterVerify, in CVSROOT/config
14743 @cindex @file{verifymsg}, changing the log message
14744 @item RereadLogAfterVerify=@var{value}
14745 Modify the @samp{commit} command such that CVS will reread the
14746 log message after running the program specified by @file{verifymsg}.
14747 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
14748 the log message should always be reread; @samp{no}
14749 or @samp{never}, indicating that it should never be
14750 reread; or @var{value} may be @samp{stat}, indicating
14751 that the file should be checked with the file system
14752 @samp{stat()} function to see if it has changed (see warning below)
14753 before rereading.  The default value is @samp{always}.
14754
14755 @strong{Note: the `stat' mode can cause CVS to pause for up to
14756 one extra second per directory committed.  This can be less IO and
14757 CPU intensive but is not recommended for use with large repositories}
14758
14759 @xref{verifymsg}, for more information on how verifymsg
14760 may be used.
14761
14762 @cindex SystemAuth, in CVSROOT/config
14763 @item SystemAuth=@var{value}
14764 If @var{value} is @samp{yes}, then pserver should check
14765 for users in the system's user database if not found in
14766 @file{CVSROOT/passwd}.  If it is @samp{no}, then all
14767 pserver users must exist in @file{CVSROOT/passwd}.
14768 The default is @samp{yes}.  For more on pserver, see
14769 @ref{Password authenticated}.
14770
14771 @cindex TmpDir, in config
14772 @cindex temporary files, location of
14773 @cindex temporary directory, set in config
14774 @item TmpDir=@var{path}
14775 Specify @var{path} as the directory to create temporary files in.
14776 @xref{Global options}, for more on setting the path to the temporary
14777 directory.  This option first appeared with @sc{cvs} release 1.12.13.
14778
14779 @cindex TopLevelAdmin, in CVSROOT/config
14780 @item TopLevelAdmin=@var{value}
14781 Modify the @samp{checkout} command to create a
14782 @samp{CVS} directory at the top level of the new
14783 working directory, in addition to @samp{CVS}
14784 directories created within checked-out directories.
14785 The default value is @samp{no}.
14786
14787 This option is useful if you find yourself performing
14788 many commands at the top level of your working
14789 directory, rather than in one of the checked out
14790 subdirectories.  The @file{CVS} directory created there
14791 will mean you don't have to specify @code{CVSROOT} for
14792 each command.  It also provides a place for the
14793 @file{CVS/Template} file (@pxref{Working directory
14794 storage}).
14795
14796 @cindex UseArchiveCommentLeader, in CVSROOT/config
14797 @cindex Log keyword, configuring substitution behavior
14798 @item UseArchiveCommentLeader=@var{value}
14799 Set to @code{true}, if the text preceding a @code{$@splitrcskeyword{Log}$}
14800 keyword is found to exceed @code{MaxCommentLeaderLength} (above) bytes, then
14801 the comment leader set in the RCS archive file (@pxref{admin}), if any, will
14802 be used instead.  If there is no comment leader set in the archive file or
14803 @var{value} is set to @samp{false}, then the keyword will not be expanded
14804 (@pxref{Keyword list}).  To force the comment leader in the RCS archive file to
14805 be used exclusively (and @code{$@splitrcskeyword{Log}$} expansion skipped in
14806 files where the comment leader has not been set in the archive file), set
14807 @var{value} and set @code{MaxCommentLeaderLength} to @code{0}.
14808
14809 @cindex UseNewInfoFmtStrings, in CVSROOT/config
14810 @cindex format strings, config admin file
14811 @cindex config (admin file), updating legacy repositories
14812 @cindex compatibility notes, config admin file
14813 @item UseNewInfoFmtStrings=@var{value}
14814 Specify whether @sc{cvs} should support the new or old command line
14815 template model for the commit support files (@pxref{commit files}).
14816 This configuration variable began life in deprecation and is only here
14817 in order to give people time to update legacy repositories to use the new
14818 format string syntax before support for the old syntax is removed.  For
14819 information on updating your repository to support the new model,
14820 please see @ref{Updating Commit Files}.
14821
14822 @emph{Note that new repositories (created with the @code{cvs init} command)
14823 will have this value set to @samp{yes}, but the default value is @samp{no}.}
14824
14825 @cindex UserAdminOptions, in CVSROOT/config
14826 @item UserAdminOptions=@var{value}
14827 Control what options will be allowed with the @code{cvs admin}
14828 command (@pxref{admin}) for users not in the @code{cvsadmin} group.
14829 The @var{value} string is a list of single character options
14830 which should be allowed.  If a user who is not a member of the
14831 @code{cvsadmin} group tries to execute any @code{cvs admin}
14832 option which is not listed they will will receive an error message
14833 reporting that the option is restricted.
14834
14835 If no @code{cvsadmin} group exists on the server, @sc{cvs} will
14836 ignore the @code{UserAdminOptions} keyword (@pxref{admin}).
14837
14838 When not specified, @code{UserAdminOptions} defaults to
14839 @samp{k}.  In other words, it defaults to allowing
14840 users outside of the @code{cvsadmin} group to use the
14841 @code{cvs admin} command only to change the default keyword
14842 expansion mode for files.
14843
14844 As an example, to restrict users not in the @code{cvsadmin}
14845 group to using @code{cvs admin} to change the default keyword
14846 substitution mode, lock revisions, unlock revisions, and
14847 replace the log message, use @samp{UserAdminOptions=klum}.
14848 @end table
14849
14850
14851
14852 @c ---------------------------------------------------------------------
14853 @node Environment variables
14854 @appendix All environment variables which affect CVS
14855 @cindex Environment variables
14856 @cindex Reference manual for variables
14857
14858 This is a complete list of all environment variables
14859 that affect @sc{cvs} (Windows users, please bear with this list;
14860 $VAR is equivalent to %VAR% at the Windows command prompt).
14861
14862 @table @code
14863 @cindex CVSIGNORE, environment variable
14864 @item $CVSIGNORE
14865 A whitespace-separated list of file name patterns that
14866 @sc{cvs} should ignore. @xref{cvsignore}.
14867
14868 @cindex CVSWRAPPERS, environment variable
14869 @item $CVSWRAPPERS
14870 A whitespace-separated list of file name patterns that
14871 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
14872
14873 @cindex CVSREAD, environment variable
14874 @cindex Read-only files, and CVSREAD
14875 @item $CVSREAD
14876 If this is set, @code{checkout} and @code{update} will
14877 try hard to make the files in your working directory
14878 read-only.  When this is not set, the default behavior
14879 is to permit modification of your working files.
14880
14881 @cindex CVSREADONLYFS, environment variable
14882 @item $CVSREADONLYFS
14883 Turns on read-only repository mode. This allows one to
14884 check out from a read-only repository, such as within
14885 an anoncvs server, or from a @sc{cd-rom} repository.
14886
14887 It has the same effect as if the @samp{-R} command-line
14888 option is used. This can also allow the use of
14889 read-only NFS repositories.
14890
14891 @item $CVSUMASK
14892 Controls permissions of files in the repository.  See
14893 @ref{File permissions}.
14894
14895 @item $CVSROOT
14896 Should contain the full pathname to the root of the @sc{cvs}
14897 source repository (where the @sc{rcs} files are
14898 kept).  This information must be available to @sc{cvs} for
14899 most commands to execute; if @code{$CVSROOT} is not set,
14900 or if you wish to override it for one invocation, you
14901 can supply it on the command line: @samp{cvs -d cvsroot
14902 cvs_command@dots{}} Once you have checked out a working
14903 directory, @sc{cvs} stores the appropriate root (in
14904 the file @file{CVS/Root}), so normally you only need to
14905 worry about this when initially checking out a working
14906 directory.
14907
14908 @item $CVSEDITOR
14909 @cindex CVSEDITOR, environment variable
14910 @itemx $EDITOR
14911 @cindex EDITOR, environment variable
14912 @itemx $VISUAL
14913 @cindex VISUAL, environment variable
14914 Specifies the program to use for recording log messages
14915 during commit.  @code{$CVSEDITOR} overrides
14916 @code{$EDITOR}, which overrides @code{$VISUAL}.
14917 See @ref{Committing your changes} for more or
14918 @ref{Global options} for alternative ways of specifying a
14919 log editor.
14920
14921 @cindex PATH, environment variable
14922 @item $PATH
14923 If @code{$RCSBIN} is not set, and no path is compiled
14924 into @sc{cvs}, it will use @code{$PATH} to try to find all
14925 programs it uses.
14926
14927 @cindex HOME, environment variable
14928 @item $HOME
14929 @cindex HOMEPATH, environment variable
14930 @item $HOMEPATH
14931 @cindex HOMEDRIVE, environment variable
14932 @item $HOMEDRIVE
14933 Used to locate the directory where the @file{.cvsrc}
14934 file, and other such files, are searched.  On Unix, @sc{cvs}
14935 just checks for @code{HOME}.  On Windows NT, the system will
14936 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
14937 for example to @file{\joe}.  On Windows 95, you'll
14938 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
14939 @c We are being vague about whether HOME works on
14940 @c Windows; see long comment in windows-NT/filesubr.c.
14941
14942 @cindex CVS_RSH, environment variable
14943 @item $CVS_RSH
14944 Specifies the external program which @sc{cvs} connects with,
14945 when @code{:ext:} access method is specified.
14946 @pxref{Connecting via rsh}.
14947
14948 @item $CVS_SERVER
14949 Used in client-server mode when accessing a remote
14950 repository using @sc{rsh}.  It specifies the name of
14951 the program to start on the server side (and any
14952 necessary arguments) when accessing a remote repository
14953 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
14954 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
14955 the default value for @code{:fork:} is the name used to run the client.
14956 @pxref{Connecting via rsh}
14957
14958 @item $CVS_PASSFILE
14959 Used in client-server mode when accessing the @code{cvs
14960 login server}.  Default value is @file{$HOME/.cvspass}.
14961 @pxref{Password authentication client}
14962
14963 @cindex CVS_CLIENT_PORT
14964 @item $CVS_CLIENT_PORT
14965 Used in client-server mode to set the port to use when accessing the server
14966 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
14967 if the port is not specified in the CVSROOT.
14968 @pxref{Remote repositories}
14969
14970 @cindex CVS_PROXY_PORT
14971 @item $CVS_PROXY_PORT
14972 Used in client-server mode to set the port to use when accessing a server
14973 via a web proxy, if the port is not specified in the CVSROOT.  Works with
14974 GSSAPI, and the password authentication protocol.
14975 @pxref{Remote repositories}
14976
14977 @cindex CVS_RCMD_PORT, environment variable
14978 @item $CVS_RCMD_PORT
14979 Used in client-server mode.  If set, specifies the port
14980 number to be used when accessing the @sc{rcmd} demon on
14981 the server side. (Currently not used for Unix clients).
14982
14983 @cindex CVS_CLIENT_LOG, environment variable
14984 @item $CVS_CLIENT_LOG
14985 Used for debugging only in client-server
14986 mode.  If set, everything sent to the server is logged
14987 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
14988 sent from the server is logged into
14989 @file{@code{$CVS_CLIENT_LOG}.out}.
14990
14991 @cindex CVS_SERVER_SLEEP, environment variable
14992 @item $CVS_SERVER_SLEEP
14993 Used only for debugging the server side in
14994 client-server mode.  If set, delays the start of the
14995 server child process the specified amount of
14996 seconds so that you can attach to it with a debugger.
14997
14998 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
14999 @item $CVS_IGNORE_REMOTE_ROOT
15000 For @sc{cvs} 1.10 and older, setting this variable
15001 prevents @sc{cvs} from overwriting the @file{CVS/Root}
15002 file when the @samp{-d} global option is specified.
15003 Later versions of @sc{cvs} do not rewrite
15004 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
15005 effect.
15006
15007 @cindex CVS_LOCAL_BRANCH_NUM, environment variable
15008 @item $CVS_LOCAL_BRANCH_NUM
15009 Setting this variable allows some control over the
15010 branch number that is assigned. This is specifically to
15011 support the local commit feature of CVSup. If one sets
15012 @code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
15013 the local repository, the revision numbers will look
15014 like 1.66.1000.xx. There is almost a dead-set certainty
15015 that there will be no conflicts with version numbers.
15016
15017 @cindex COMSPEC, environment variable
15018 @item $COMSPEC
15019 Used under OS/2 only.  It specifies the name of the
15020 command interpreter and defaults to @sc{cmd.exe}.
15021
15022 @cindex TMPDIR, environment variable
15023 @cindex temporary file directory, set via environment variable
15024 @cindex temporary files, location of
15025 @item $TMPDIR
15026 Directory in which temporary files are located.
15027 @xref{Global options}, for more on setting the temporary directory.
15028
15029 @cindex CVS_PID, environment variable
15030 @item $CVS_PID
15031 This is the process identification (aka pid) number of
15032 the @sc{cvs} process. It is often useful in the
15033 programs and/or scripts specified by the
15034 @file{commitinfo}, @file{verifymsg}, @file{loginfo}
15035 files.
15036 @end table
15037
15038 @node Compatibility
15039 @appendix Compatibility between CVS Versions
15040
15041 @cindex CVS, versions of
15042 @cindex Versions, of CVS
15043 @cindex Compatibility, between CVS versions
15044 @c We don't mention versions older than CVS 1.3
15045 @c on the theory that it would clutter it up for the vast
15046 @c majority of people, who don't have anything that old.
15047 @c
15048 The repository format is compatible going back to
15049 @sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
15050 you have copies of @sc{cvs} 1.6 or older and you want
15051 to use the optional developer communication features.
15052 @c If you "cvs rm" and commit using 1.3, then you'll
15053 @c want to run "rcs -sdead <file,v>" on each of the
15054 @c files in the Attic if you then want 1.5 and
15055 @c later to recognize those files as dead (I think the
15056 @c symptom if this is not done is that files reappear
15057 @c in joins).  (Wait: the above will work but really to
15058 @c be strictly correct we should suggest checking
15059 @c in a new revision rather than just changing the
15060 @c state of the head revision, shouldn't we?).
15061 @c The old convert.sh script was for this, but it never
15062 @c did get updated to reflect use of the RCS "dead"
15063 @c state.
15064 @c Note: this is tricky to document without confusing
15065 @c people--need to carefully say what CVS version we
15066 @c are talking about and keep in mind the distinction
15067 @c between a
15068 @c repository created with 1.3 and on which one now
15069 @c uses 1.5+, and a repository on which one wants to
15070 @c use both versions side by side (e.g. during a
15071 @c transition period).
15072 @c Wait, can't CVS just detect the case in which a file
15073 @c is in the Attic but the head revision is not dead?
15074 @c Not sure whether this should produce a warning or
15075 @c something, and probably needs further thought, but
15076 @c it would appear that the situation can be detected.
15077 @c
15078 @c We might want to separate out the 1.3 compatibility
15079 @c section (for repository & working directory) from the
15080 @c rest--that might help avoid confusing people who
15081 @c are upgrading (for example) from 1.6 to 1.8.
15082 @c
15083 @c A minor incompatibility is if a current version of CVS
15084 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
15085 @c see this as if there is no tag.  Seems to me this is
15086 @c too obscure to mention.
15087
15088 The working directory format is compatible going back
15089 to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
15090 and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
15091 a working directory checked out with @sc{cvs} 1.3,
15092 @sc{cvs} will convert it, but to go back to @sc{cvs}
15093 1.3 you need to check out a new working directory with
15094 @sc{cvs} 1.3.
15095
15096 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
15097 further (1.5 was the first official release with the remote protocol,
15098 but some older versions might still be floating around).  In many
15099 cases you need to upgrade both the client and the server to take
15100 advantage of new features and bug fixes, however.
15101
15102 @c Perhaps should be saying something here about the
15103 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
15104 @c older don't use them).  These are supposed to be
15105 @c compatible in both directions, but I'm not sure
15106 @c they quite are 100%.  One common gripe is if you
15107 @c "rm -r" a directory and 1.9 gets confused, as it
15108 @c still sees it in Entries.  That one is fixed in
15109 @c (say) 1.9.6.  Someone else reported problems with
15110 @c starting with a directory which was checked out with
15111 @c an old version, and then using a new version, and
15112 @c some "D" lines appeared, but not for every
15113 @c directory, causing some directories to be skipped.
15114 @c They weren't sure how to reproduce this, though.
15115
15116 @c ---------------------------------------------------------------------
15117 @node Troubleshooting
15118 @appendix Troubleshooting
15119
15120 If you are having trouble with @sc{cvs}, this appendix
15121 may help.  If there is a particular error message which
15122 you are seeing, then you can look up the message
15123 alphabetically.  If not, you can look through the
15124 section on other problems to see if your problem is
15125 mentioned there.
15126
15127 @menu
15128 * Error messages::              Partial list of CVS errors
15129 * Connection::                  Trouble making a connection to a CVS server
15130 * Other problems::              Problems not readily listed by error message
15131 @end menu
15132
15133 @ignore
15134 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15135 @c @node Bad administrative files
15136 @appendixsec Bad administrative files
15137
15138 @c -- Give hints on how to fix them
15139 @end ignore
15140
15141 @node Error messages
15142 @appendixsec Partial list of error messages
15143
15144 Here is a partial list of error messages that you may
15145 see from @sc{cvs}.  It is not a complete list---@sc{cvs}
15146 is capable of printing many, many error messages, often
15147 with parts of them supplied by the operating system,
15148 but the intention is to list the common and/or
15149 potentially confusing error messages.
15150
15151 The messages are alphabetical, but introductory text
15152 such as @samp{cvs update: } is not considered in
15153 ordering them.
15154
15155 In some cases the list includes messages printed by old
15156 versions of @sc{cvs} (partly because users may not be
15157 sure which version of @sc{cvs} they are using at any
15158 particular moment).
15159 @c If we want to start retiring messages, perhaps we
15160 @c should pick a cutoff version (for example, no more
15161 @c messages which are specific to versions before 1.9)
15162 @c and then move the old messages to an "old messages"
15163 @c node rather than deleting them completely.
15164
15165 @table @code
15166 @c FIXME: What is the correct way to format a multiline
15167 @c error message here?  Maybe @table is the wrong
15168 @c choice?  Texinfo gurus?
15169 @item @var{file}:@var{line}: Assertion '@var{text}' failed
15170 The exact format of this message may vary depending on
15171 your system.  It indicates a bug in @sc{cvs}, which can
15172 be handled as described in @ref{BUGS}.
15173
15174 @item cvs @var{command}: authorization failed: server @var{host} rejected access
15175 This is a generic response when trying to connect to a
15176 pserver server which chooses not to provide a
15177 specific reason for denying authorization.  Check that
15178 the username and password specified are correct and
15179 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
15180 in @file{inetd.conf}.  See @ref{Password authenticated}.
15181
15182 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
15183 This message indicates that you removed a file, and
15184 someone else modified it.  To resolve the conflict,
15185 first run @samp{cvs add @var{file}}.  If desired, look
15186 at the other party's modification to decide whether you
15187 still want to remove it.  If you don't want to remove
15188 it, stop here.  If you do want to remove it, proceed
15189 with @samp{cvs remove @var{file}} and commit your
15190 removal.
15191 @c Tests conflicts2-142b* in sanity.sh test for this.
15192
15193 @item cannot change permissions on temporary directory
15194 @example
15195 Operation not permitted
15196 @end example
15197 This message has been happening in a non-reproducible,
15198 occasional way when we run the client/server testsuite,
15199 both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
15200 able to figure out what causes it, nor is it known
15201 whether it is specific to Linux (or even to this
15202 particular machine!).  If the problem does occur on
15203 other unices, @samp{Operation not permitted} would be
15204 likely to read @samp{Not owner} or whatever the system
15205 in question uses for the unix @code{EPERM} error.  If
15206 you have any information to add, please let us know as
15207 described in @ref{BUGS}.  If you experience this error
15208 while using @sc{cvs}, retrying the operation which
15209 produced it should work fine.
15210 @c This has been seen in a variety of tests, including
15211 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
15212 @c so it doesn't seem particularly specific to any one
15213 @c test.
15214
15215 @item cvs [server aborted]: Cannot check out files into the repository itself
15216 The obvious cause for this message (especially for
15217 non-client/server @sc{cvs}) is that the @sc{cvs} root
15218 is, for example, @file{/usr/local/cvsroot} and you try
15219 to check out files when you are in a subdirectory, such
15220 as @file{/usr/local/cvsroot/test}.  However, there is a
15221 more subtle cause, which is that the temporary
15222 directory on the server is set to a subdirectory of the
15223 root (which is also not allowed).  If this is the
15224 problem, set the temporary directory to somewhere else,
15225 for example @file{/var/tmp}; see @code{TMPDIR} in
15226 @ref{Environment variables}, for how to set the
15227 temporary directory.
15228
15229 @item cannot commit files as 'root'
15230 See @samp{'root' is not allowed to commit files}.
15231
15232 @c For one example see basica-1a10 in the testsuite
15233 @c For another example, "cvs co ." on NT; see comment
15234 @c at windows-NT/filesubr.c (expand_wild).
15235 @c For another example, "cvs co foo/bar" where foo exists.
15236 @item cannot open CVS/Entries for reading: No such file or directory
15237 This generally indicates a @sc{cvs} internal error, and
15238 can be handled as with other @sc{cvs} bugs
15239 (@pxref{BUGS}).  Usually there is a workaround---the
15240 exact nature of which would depend on the situation but
15241 which hopefully could be figured out.
15242
15243 @c This is more obscure than it might sound; it only
15244 @c happens if you run "cvs init" from a directory which
15245 @c contains a CVS/Root file at the start.
15246 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
15247 This message is harmless.  Provided it is not
15248 accompanied by other errors, the operation has
15249 completed successfully.  This message should not occur
15250 with current versions of @sc{cvs}, but it is documented
15251 here for the benefit of @sc{cvs} 1.9 and older.
15252
15253 @item cvs server: cannot open /root/.cvsignore: Permission denied
15254 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
15255 See @ref{Connection}.
15256
15257 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
15258 This message has been reported as intermittently
15259 happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
15260 unknown; if you know more about what causes it, let us
15261 know as described in @ref{BUGS}.
15262
15263 @item cvs [@var{command} aborted]: cannot start server via rcmd
15264 This, unfortunately, is a rather nonspecific error
15265 message which @sc{cvs} 1.9 will print if you are
15266 running the @sc{cvs} client and it is having trouble
15267 connecting to the server.  Current versions of @sc{cvs}
15268 should print a much more specific error message.  If
15269 you get this message when you didn't mean to run the
15270 client at all, you probably forgot to specify
15271 @code{:local:}, as described in @ref{Repository}.
15272
15273 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
15274 @sc{cvs} 1.9 and older will print this message
15275 when trying to check in a binary file if
15276 @sc{rcs} is not correctly installed.  Re-read the
15277 instructions that came with your @sc{rcs} distribution
15278 and the @sc{install} file in the @sc{cvs}
15279 distribution.  Alternately, upgrade to a current
15280 version of @sc{cvs}, which checks in files itself
15281 rather than via @sc{rcs}.
15282
15283 @item cvs checkout: could not check out @var{file}
15284 With @sc{cvs} 1.9, this can mean that the @code{co} program
15285 (part of @sc{rcs}) returned a failure.  It should be
15286 preceded by another error message, however it has been
15287 observed without another error message and the cause is
15288 not well-understood.  With the current version of @sc{cvs},
15289 which does not run @code{co}, if this message occurs
15290 without another error message, it is definitely a @sc{cvs}
15291 bug (@pxref{BUGS}).
15292 @c My current suspicion is that the RCS in the rcs (not
15293 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
15294 @c CD is bad (remains to be confirmed).
15295 @c There is also a report of something which looks
15296 @c very similar on SGI, Irix 5.2, so I dunno.
15297
15298 @item cvs [login aborted]: could not find out home directory
15299 This means that you need to set the environment
15300 variables that @sc{cvs} uses to locate your home directory.
15301 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
15302 @ref{Environment variables}.
15303
15304 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
15305 @sc{cvs} 1.9 and older will print this message if there was
15306 a problem finding the @code{rcsmerge} program.  Make
15307 sure that it is in your @code{PATH}, or upgrade to a
15308 current version of @sc{cvs}, which does not require
15309 an external @code{rcsmerge} program.
15310
15311 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
15312 This means that there was a problem finding the
15313 @code{patch} program.  Make sure that it is in your
15314 @code{PATH}.  Note that despite appearances the message
15315 is @emph{not} referring to whether it can find @var{file}.
15316 If both the client and the server are running a current
15317 version of @sc{cvs}, then there is no need for an
15318 external patch program and you should not see this
15319 message.  But if either client or server is running
15320 @sc{cvs} 1.9, then you need @code{patch}.
15321
15322 @item cvs update: could not patch @var{file}; will refetch
15323 This means that for whatever reason the client was
15324 unable to apply a patch that the server sent.  The
15325 message is nothing to be concerned about, because
15326 inability to apply the patch only slows things down and
15327 has no effect on what @sc{cvs} does.
15328 @c xref to update output.  Or File status?
15329 @c Or some place else that
15330 @c explains this whole "patch"/P/Needs Patch thing?
15331
15332 @item dying gasps from @var{server} unexpected
15333 There is a known bug in the server for @sc{cvs} 1.9.18
15334 and older which can cause this.  For me, this was
15335 reproducible if I used the @samp{-t} global option.  It
15336 was fixed by Andy Piper's 14 Nov 1997 change to
15337 src/filesubr.c, if anyone is curious.
15338 If you see the message,
15339 you probably can just retry the operation which failed,
15340 or if you have discovered information concerning its
15341 cause, please let us know as described in @ref{BUGS}.
15342
15343 @item end of file from server (consult above messages if any)
15344 The most common cause for this message is if you are
15345 using an external @code{rsh} program and it exited with
15346 an error.  In this case the @code{rsh} program should
15347 have printed a message, which will appear before the
15348 above message.  For more information on setting up a
15349 @sc{cvs} client and server, see @ref{Remote repositories}.
15350
15351 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
15352 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
15353 This means that there is a syntax error in the given
15354 @sc{rcs} file.  Note that this might be true even if @sc{rcs} can
15355 read the file OK; @sc{cvs} does more error checking of
15356 errors in the RCS file.  That is why you may see this
15357 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
15358 1.10.  The likely cause for the original corruption is
15359 hardware, the operating system, or the like.  Of
15360 course, if you find a case in which @sc{cvs} seems to
15361 corrupting the file, by all means report it,
15362 (@pxref{BUGS}).
15363 There are quite a few variations of this error message,
15364 depending on exactly where in the @sc{rcs} file @sc{cvs}
15365 finds the syntax error.
15366
15367 @cindex mkmodules
15368 @item cvs commit: Executing 'mkmodules'
15369 This means that your repository is set up for a version
15370 of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
15371 1.8 or later, the above message will be preceded by
15372
15373 @example
15374 cvs commit: Rebuilding administrative file database
15375 @end example
15376
15377 If you see both messages, the database is being rebuilt
15378 twice, which is unnecessary but harmless.  If you wish
15379 to avoid the duplication, and you have no versions of
15380 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
15381 every place it appears in your @code{modules}
15382 file.  For more information on the @code{modules} file,
15383 see @ref{modules}.
15384
15385 @c This message comes from "co", and I believe is
15386 @c possible only with older versions of CVS which call
15387 @c co.  The problem with being able to create the bogus
15388 @c RCS file still exists, though (and I think maybe
15389 @c there is a different symptom(s) now).
15390 @c FIXME: Would be nice to have a more exact wording
15391 @c for this message.
15392 @item missing author
15393 Typically this can happen if you created an RCS file
15394 with your username set to empty.  @sc{cvs} will, bogusly,
15395 create an illegal RCS file with no value for the author
15396 field.  The solution is to make sure your username is
15397 set to a non-empty value and re-create the RCS file.
15398 @c "make sure your username is set" is complicated in
15399 @c and of itself, as there are the environment
15400 @c variables the system login name, &c, and it depends
15401 @c on the version of CVS.
15402
15403 @item cvs [checkout aborted]: no such tag @var{tag}
15404 This message means that @sc{cvs} isn't familiar with
15405 the tag @var{tag}.  Usually the root cause is that you have
15406 mistyped a tag name.  Ocassionally this can also occur because the
15407 users creating tags do not have permissions to write to the
15408 @file{CVSROOT/val-tags} file (@pxref{File permissions}, for more).
15409
15410 Prior to @sc{cvs} version 1.12.10, there were a few relatively
15411 obscure cases where a given tag could be created in an archive
15412 file in the repository but @sc{cvs} would require the user to
15413 @c Search sanity.sh for "no such tag" to see some of
15414 @c the relatively obscure cases.
15415 try a few other @sc{cvs} commands involving that tag
15416 until one was found whch caused @sc{cvs} to update
15417 @cindex CVSROOT/val-tags file, forcing tags into
15418 @cindex val-tags file, forcing tags into
15419 the @file{val-tags} file, at which point the originally failing command
15420 would begin to work.  This same method can be used to repair a @file{val-tags}
15421 file that becomes out of date due to the permissions problem mentioned above.
15422 This updating is only required once per tag - once a tag is listed in
15423 @file{val-tags}, it stays there.
15424
15425 Note that using @samp{tag -f} to not require tag matches did not and
15426 does not override this check (@pxref{Common options}). 
15427  
15428 @item *PANIC* administration files missing
15429 This typically means that there is a directory named
15430 @sc{cvs} but it does not contain the administrative files
15431 which @sc{cvs} puts in a CVS directory.  If the problem is
15432 that you created a CVS directory via some mechanism
15433 other than @sc{cvs}, then the answer is simple, use a name
15434 other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
15435 (@pxref{BUGS}).
15436
15437 @item rcs error: Unknown option: -x,v/
15438 This message will be followed by a usage message for
15439 @sc{rcs}.  It means that you have an old version of
15440 @sc{rcs} (probably supplied with your operating
15441 system), as well as an old version of @sc{cvs}.
15442 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
15443 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
15444 @c For more information on installing @sc{cvs}, see
15445 @c (FIXME: where?  it depends on whether you are
15446 @c getting binaries or sources or what).
15447 @c The message can also say "ci error" or something
15448 @c instead of "rcs error", I suspect.
15449
15450 @item cvs [server aborted]: received broken pipe signal
15451 This message can be caused by a loginfo program that fails to
15452 read all of the log information from its standard input.
15453 If you find it happening in any other circumstances,
15454 please let us know as described in @ref{BUGS}.
15455
15456 @item 'root' is not allowed to commit files
15457 When committing a permanent change, @sc{cvs} makes a log entry of
15458 who committed the change.  If you are committing the change logged
15459 in as "root" (not under "su" or other root-priv giving program),
15460 @sc{cvs} cannot determine who is actually making the change.
15461 As such, by default, @sc{cvs} disallows changes to be committed by users
15462 logged in as "root".  (You can disable this option by passing the
15463 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
15464 On some systems this means editing the appropriate @file{config.h} file
15465 before building @sc{cvs}.)
15466
15467 @item cvs [server aborted]: Secondary out of sync with primary!
15468
15469 This usually means that the version of @sc{cvs} running on a secondary
15470 server is incompatible with the version running on the primary server
15471 (@pxref{Write proxies}).
15472 This will not occur if the client supports redirection.
15473
15474 It is not the version number that is significant here, but the list of
15475 supported requests that the servers provide to the client.
15476 For example, even if both servers were the same version,
15477 if the secondary was compiled with GSSAPI support and the primary was not,
15478 the list of supported requests provided by the two servers
15479 would be different and the secondary would not work as a transparent
15480 proxy to the primary.
15481 Conversely, even if the two servers were radically different versions
15482 but both provided the same list of valid requests to the client,
15483 the transparent proxy would succeed.
15484
15485 @item Terminated with fatal signal 11
15486 This message usually indicates that @sc{cvs} (the server, if you're
15487 using client/server mode) has run out of (virtual) memory.
15488 Although @sc{cvs} tries to catch the error and issue a more meaningful
15489 message, there are many circumstances where that is not possible.
15490 If you appear to have lots of memory available to the system,
15491 the problem is most likely that you're running into a system-wide
15492 limit on the amount of memory a single process can use or a
15493 similar process-specific limit.
15494 The mechanisms for displaying and setting such limits vary from
15495 system to system, so you'll have to consult an expert for your
15496 particular system if you don't know how to do that.
15497
15498 @item Too many arguments!
15499 This message is typically printed by the @file{log.pl}
15500 script which is in the @file{contrib} directory in the
15501 @sc{cvs} source distribution.  In some versions of
15502 @sc{cvs}, @file{log.pl} has been part of the default
15503 @sc{cvs} installation.  The @file{log.pl} script gets
15504 called from the @file{loginfo} administrative file.
15505 Check that the arguments passed in @file{loginfo} match
15506 what your version of @file{log.pl} expects.  In
15507 particular, the @file{log.pl} from @sc{cvs} 1.3 and
15508 older expects the log file as an argument whereas the
15509 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
15510 log file to be specified with a @samp{-f} option.  Of
15511 course, if you don't need @file{log.pl} you can just
15512 comment it out of @file{loginfo}.
15513
15514 @item cvs [update aborted]: unexpected EOF reading @var{file},v
15515 See @samp{EOF in key in RCS file}.
15516
15517 @item cvs [login aborted]: unrecognized auth response from @var{server}
15518 This message typically means that the server is not set
15519 up properly.  For example, if @file{inetd.conf} points
15520 to a nonexistent cvs executable.  To debug it further,
15521 find the log file which inetd writes
15522 (@file{/var/log/messages} or whatever inetd uses on
15523 your system).  For details, see @ref{Connection}, and
15524 @ref{Password authentication server}.
15525
15526 @item cvs commit: Up-to-date check failed for `@var{file}'
15527 This means that someone else has committed a change to
15528 that file since the last time that you did a @code{cvs
15529 update}.  So before proceeding with your @code{cvs
15530 commit} you need to @code{cvs update}.  @sc{cvs} will merge
15531 the changes that you made and the changes that the
15532 other person made.  If it does not detect any conflicts
15533 it will report @samp{M @var{file}} and you are ready
15534 to @code{cvs commit}.  If it detects conflicts it will
15535 print a message saying so, will report @samp{C @var{file}},
15536 and you need to manually resolve the
15537 conflict.  For more details on this process see
15538 @ref{Conflicts example}.
15539
15540 @item Usage:    diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
15541 @example
15542 Only one of [exEX3] allowed
15543 @end example
15544 This indicates a problem with the installation of
15545 @code{diff3} and @code{rcsmerge}.  Specifically
15546 @code{rcsmerge} was compiled to look for GNU diff3, but
15547 it is finding unix diff3 instead.  The exact text of
15548 the message will vary depending on the system.  The
15549 simplest solution is to upgrade to a current version of
15550 @sc{cvs}, which does not rely on external
15551 @code{rcsmerge} or @code{diff3} programs.
15552
15553 @item warning: unrecognized response `@var{text}' from cvs server
15554 If @var{text} contains a valid response (such as
15555 @samp{ok}) followed by an extra carriage return
15556 character (on many systems this will cause the second
15557 part of the message to overwrite the first part), then
15558 it probably means that you are using the @samp{:ext:}
15559 access method with a version of rsh, such as most
15560 non-unix rsh versions, which does not by default
15561 provide a transparent data stream.  In such cases you
15562 probably want to try @samp{:server:} instead of
15563 @samp{:ext:}.  If @var{text} is something else, this
15564 may signify a problem with your @sc{cvs} server.
15565 Double-check your installation against the instructions
15566 for setting up the @sc{cvs} server.
15567 @c FIXCVS: should be printing CR as \r or \015 or some
15568 @c such, probably.
15569
15570 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
15571 This is a normal message, not an error.  See
15572 @ref{Concurrency}, for more details.
15573
15574 @item cvs commit: warning: editor session failed
15575 @cindex Exit status, of editor
15576 This means that the editor which @sc{cvs} is using exits with a nonzero
15577 exit status.  Some versions of vi will do this even when there was not
15578 a problem editing the file.  If so, point the
15579 @code{CVSEDITOR} environment variable to a small script
15580 such as:
15581
15582 @example
15583 #!/bin/sh
15584 vi $*
15585 exit 0
15586 @end example
15587
15588 @item cvs update: warning: @var{file} was lost
15589 This means that the working copy of @var{file} has been deleted
15590 but it has not been removed from @sc{cvs}.
15591 This is nothing to be concerned about,
15592 the update will just recreate the local file from the repository.
15593 (This is a convenient way to discard local changes to a file:
15594 just delete it and then run @code{cvs update}.)
15595
15596 @item cvs update: warning: @var{file} is not (any longer) pertinent
15597 This means that the working copy of @var{file} has been deleted,
15598 it has not been removed from @sc{cvs} in the current working directory,
15599 but it has been removed from @sc{cvs} in some other working directory.
15600 This is nothing to be concerned about,
15601 the update would have removed the local file anyway.
15602
15603 @end table
15604
15605 @node Connection
15606 @appendixsec Trouble making a connection to a CVS server
15607
15608 This section concerns what to do if you are having
15609 trouble making a connection to a @sc{cvs} server.  If
15610 you are running the @sc{cvs} command line client
15611 running on Windows, first upgrade the client to
15612 @sc{cvs} 1.9.12 or later.  The error reporting in
15613 earlier versions provided much less information about
15614 what the problem was.  If the client is non-Windows,
15615 @sc{cvs} 1.9 should be fine.
15616
15617 If the error messages are not sufficient to track down
15618 the problem, the next steps depend largely on which
15619 access method you are using.
15620
15621 @table @code
15622 @cindex :ext:, troubleshooting
15623 @item :ext:
15624 Try running the rsh program from the command line.  For
15625 example: "rsh servername cvs -v" should print @sc{cvs}
15626 version information.  If this doesn't work, you need to
15627 fix it before you can worry about @sc{cvs} problems.
15628
15629 @cindex :server:, troubleshooting
15630 @item :server:
15631 You don't need a command line rsh program to use this
15632 access method, but if you have an rsh program around,
15633 it may be useful as a debugging tool.  Follow the
15634 directions given for :ext:.
15635
15636 @cindex :pserver:, troubleshooting
15637 @item :pserver:
15638 Errors along the lines of "connection refused" typically indicate
15639 that inetd isn't even listening for connections on port 2401
15640 whereas errors like "connection reset by peer",
15641 "received broken pipe signal", "recv() from server: EOF",
15642 or "end of file from server"
15643 typically indicate that inetd is listening for
15644 connections but is unable to start @sc{cvs} (this is frequently
15645 caused by having an incorrect path in @file{inetd.conf}
15646 or by firewall software rejecting the connection).
15647 "unrecognized auth response" errors are caused by a bad command
15648 line in @file{inetd.conf}, typically an invalid option or forgetting
15649 to put the @samp{pserver} command at the end of the line.
15650 Another less common problem is invisible control characters that
15651 your editor "helpfully" added without you noticing.
15652
15653 One good debugging tool is to "telnet servername
15654 2401".  After connecting, send any text (for example
15655 "foo" followed by return).  If @sc{cvs} is working
15656 correctly, it will respond with
15657
15658 @example
15659 cvs [pserver aborted]: bad auth protocol start: foo
15660 @end example
15661
15662 If instead you get:
15663
15664 @example
15665 Usage: cvs [cvs-options] command [command-options-and-arguments]
15666 ...
15667 @end example
15668
15669 @noindent
15670 then you're missing the @samp{pserver} command at the end of the
15671 line in @file{inetd.conf}; check to make sure that the entire command
15672 is on one line and that it's complete.
15673
15674 Likewise, if you get something like:
15675
15676 @example
15677 Unknown command: `pserved'
15678
15679 CVS commands are:
15680         add          Add a new file/directory to the repository
15681 ...
15682 @end example
15683
15684 @noindent
15685 then you've misspelled @samp{pserver} in some way.  If it isn't
15686 obvious, check for invisible control characters (particularly
15687 carriage returns) in @file{inetd.conf}.
15688
15689 If it fails to work at all, then make sure inetd is working
15690 right.  Change the invocation in @file{inetd.conf} to run the
15691 echo program instead of cvs.  For example:
15692
15693 @example
15694 2401  stream  tcp  nowait  root /bin/echo echo hello
15695 @end example
15696
15697 After making that change and instructing inetd to
15698 re-read its configuration file, "telnet servername
15699 2401" should show you the text hello and then the
15700 server should close the connection.  If this doesn't
15701 work, you need to fix it before you can worry about
15702 @sc{cvs} problems.
15703
15704 On AIX systems, the system will often have its own
15705 program trying to use port 2401.  This is AIX's problem
15706 in the sense that port 2401 is registered for use with
15707 @sc{cvs}.  I hear that there is an AIX patch available
15708 to address this problem.
15709
15710 Another good debugging tool is the @samp{-d}
15711 (debugging) option to inetd.  Consult your system
15712 documentation for more information.
15713
15714 If you seem to be connecting but get errors like:
15715
15716 @example
15717 cvs server: cannot open /root/.cvsignore: Permission denied
15718 cvs [server aborted]: can't chdir(/root): Permission denied
15719 @end example
15720
15721 @noindent
15722 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
15723 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
15724 your system setting the @code{$HOME} environment variable
15725 for programs being run by inetd.  In this case, you can either
15726 have inetd run a shell script that unsets @code{$HOME} and then runs
15727 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
15728 environment.)
15729
15730 If you can connect successfully for a while but then can't,
15731 you've probably hit inetd's rate limit.
15732 (If inetd receives too many requests for the same service
15733 in a short period of time, it assumes that something is wrong
15734 and temporarily disables the service.)
15735 Check your inetd documentation to find out how to adjust the
15736 rate limit (some versions of inetd have a single rate limit,
15737 others allow you to set the limit for each service separately.)
15738 @end table
15739
15740 @node Other problems
15741 @appendixsec Other common problems
15742
15743 Here is a list of problems which do not fit into the
15744 above categories.  They are in no particular order.
15745
15746 @itemize @bullet
15747 @item
15748 On Windows, if there is a 30 second or so delay when
15749 you run a @sc{cvs} command, it may mean that you have
15750 your home directory set to @file{C:/}, for example (see
15751 @code{HOMEDRIVE} and @code{HOMEPATH} in
15752 @ref{Environment variables}).  @sc{cvs} expects the home
15753 directory to not end in a slash, for example @file{C:}
15754 or @file{C:\cvs}.
15755 @c FIXCVS: CVS should at least detect this and print an
15756 @c error, presumably.
15757
15758 @item
15759 If you are running @sc{cvs} 1.9.18 or older, and
15760 @code{cvs update} finds a conflict and tries to
15761 merge, as described in @ref{Conflicts example}, but
15762 doesn't tell you there were conflicts, then you may
15763 have an old version of @sc{rcs}.  The easiest solution
15764 probably is to upgrade to a current version of
15765 @sc{cvs}, which does not rely on external @sc{rcs}
15766 programs.
15767 @end itemize
15768
15769 @c ---------------------------------------------------------------------
15770 @node Credits
15771 @appendix Credits
15772
15773 @cindex Contributors (manual)
15774 @cindex Credits (manual)
15775 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
15776 wrote the manual pages which were distributed with
15777 @sc{cvs} 1.3.  Much of their text was copied into this
15778 manual.  He also read an early draft
15779 of this manual and contributed many ideas and
15780 corrections.
15781
15782 The mailing-list @code{info-cvs} is sometimes
15783 informative. I have included information from postings
15784 made by the following persons:
15785 David G. Grubbs <@t{dgg@@think.com}>.
15786
15787 Some text has been extracted from the man pages for
15788 @sc{rcs}.
15789
15790 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
15791 useful material.  The @sc{faq} is no longer maintained,
15792 however, and this manual is about the closest thing there
15793 is to a successor (with respect to documenting how to
15794 use @sc{cvs}, at least).
15795
15796 In addition, the following persons have helped by
15797 telling me about mistakes I've made:
15798
15799 @display
15800 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
15801 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
15802 Karl Pingle <@t{pingle@@acuson.com}>,
15803 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
15804 Inge Wallin <@t{ingwa@@signum.se}>,
15805 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
15806 and Michael Brown <@t{brown@@wi.extrel.com}>.
15807 @end display
15808
15809 The list of contributors here is not comprehensive; for a more
15810 complete list of who has contributed to this manual see
15811 the file @file{doc/ChangeLog} in the @sc{cvs} source
15812 distribution.
15813
15814 @c ---------------------------------------------------------------------
15815 @node BUGS
15816 @appendix Dealing with bugs in CVS or this manual
15817
15818 @cindex Bugs in this manual or CVS
15819 Neither @sc{cvs} nor this manual is perfect, and they
15820 probably never will be.  If you are having trouble
15821 using @sc{cvs}, or think you have found a bug, there
15822 are a number of things you can do about it.  Note that
15823 if the manual is unclear, that can be considered a bug
15824 in the manual, so these problems are often worth doing
15825 something about as well as problems with @sc{cvs} itself.
15826
15827 @cindex Reporting bugs
15828 @cindex Bugs, reporting
15829 @cindex Errors, reporting
15830 @itemize @bullet
15831 @item
15832 If you want someone to help you and fix bugs that you
15833 report, there are companies which will do that for a
15834 fee.  One such company is:
15835
15836 @cindex Ximbiot
15837 @cindex Support, getting CVS support
15838 @example
15839 Ximbiot
15840 319 S. River St.
15841 Harrisburg, PA  17104-1657
15842 USA
15843 Email: info@@ximbiot.com
15844 Phone: (717) 579-6168
15845 Fax:   (717) 234-3125
15846 @url{http://ximbiot.com/}
15847
15848 @end example
15849
15850 @item
15851 If you got @sc{cvs} through a distributor, such as an
15852 operating system vendor or a vendor of freeware
15853 @sc{cd-rom}s, you may wish to see whether the
15854 distributor provides support.  Often, they will provide
15855 no support or minimal support, but this may vary from
15856 distributor to distributor.
15857
15858 @item
15859 If you have the skills and time to do so, you may wish
15860 to fix the bug yourself.  If you wish to submit your
15861 fix for inclusion in future releases of @sc{cvs}, see
15862 the file @sc{hacking} in the @sc{cvs} source
15863 distribution.  It contains much more information on the
15864 process of submitting fixes.
15865
15866 @item
15867 There may be resources on the net which can help.  A
15868 good place to start is:
15869
15870 @example
15871 @url{http://cvs.nongnu.org/}
15872 @end example
15873
15874 If you are so inspired, increasing the information
15875 available on the net is likely to be appreciated.  For
15876 example, before the standard @sc{cvs} distribution
15877 worked on Windows 95, there was a web page with some
15878 explanation and patches for running @sc{cvs} on Windows
15879 95, and various people helped out by mentioning this
15880 page on mailing lists or newsgroups when the subject
15881 came up.
15882
15883 @item
15884 It is also possible to report bugs to @email{bug-cvs@@nongnu.org}.
15885 Note that someone may or may not want to do anything
15886 with your bug report---if you need a solution consider
15887 one of the options mentioned above.  People probably do
15888 want to hear about bugs which are particularly severe
15889 in consequences and/or easy to fix, however.  You can
15890 also increase your odds by being as clear as possible
15891 about the exact nature of the bug and any other
15892 relevant information.  The way to report bugs is to
15893 send email to @email{bug-cvs@@nongnu.org}.  Note
15894 that submissions to @email{bug-cvs@@nongnu.org} may be distributed
15895 under the terms of the @sc{gnu} Public License, so if
15896 you don't like this, don't submit them.  There is
15897 usually no justification for sending mail directly to
15898 one of the @sc{cvs} maintainers rather than to
15899 @email{bug-cvs@@nongnu.org}; those maintainers who want to hear
15900 about such bug reports read @email{bug-cvs@@nongnu.org}.  Also note
15901 that sending a bug report to other mailing lists or
15902 newsgroups is @emph{not} a substitute for sending it to
15903 @email{bug-cvs@@nongnu.org}.  It is fine to discuss @sc{cvs} bugs on
15904 whatever forum you prefer, but there are not
15905 necessarily any maintainers reading bug reports sent
15906 anywhere except @email{bug-cvs@@nongnu.org}.
15907 @end itemize
15908
15909 @cindex Known bugs in this manual or CVS
15910 People often ask if there is a list of known bugs or
15911 whether a particular bug is a known one.  The file
15912 @sc{bugs} in the @sc{cvs} source distribution is one
15913 list of known bugs, but it doesn't necessarily try to
15914 be comprehensive.  Perhaps there will never be a
15915 comprehensive, detailed list of known bugs.
15916
15917 @c ---------------------------------------------------------------------
15918 @node Index
15919 @unnumbered Index
15920 @cindex Index
15921
15922 @printindex cp
15923
15924 @bye
15925 \f
15926 Local Variables:
15927 fill-column: 55
15928 End: