Implement CLOCK_MONOTONIC using getnanouptime(), which in DragonFly is
[dragonfly.git] / contrib / cvs-1.12.9 / 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 Free Software Foundation, Inc.
8
9 @multitable @columnfractions .12 .88
10 @item Portions
11 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004
12                                   Derek R. Price,
13 @item @tab Copyright @copyright{} 2002, 2003, 2004
14                                   Ximbiot @url{http://ximbiot.com},
15 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
16 @item @tab and Copyright @copyright{} others.
17 @end multitable
18
19 @ignore
20 Permission is granted to process this file through Tex and print the
21 results, provided the printed document carries copying permission
22 notice identical to this one except for the removal of this paragraph
23 (this paragraph not being relevant to the printed manual).
24
25 @end ignore
26 Permission is granted to make and distribute verbatim copies of
27 this manual provided the copyright notice and this permission notice
28 are preserved on all copies.
29
30 Permission is granted to copy and distribute modified versions of this
31 manual under the conditions for verbatim copying, provided also that the
32 entire resulting derived work is distributed under the terms of a
33 permission notice identical to this one.
34
35 Permission is granted to copy and distribute translations of this manual
36 into another language, under the above conditions for modified versions,
37 except that this permission notice may be stated in a translation
38 approved by the Free Software Foundation.
39 @end macro
40
41 @comment This file is part of the CVS distribution.
42
43 @comment CVS is free software; you can redistribute it and/or modify
44 @comment it under the terms of the GNU General Public License as published by
45 @comment the Free Software Foundation; either version 2, or (at your option)
46 @comment any later version.
47
48 @comment CVS is distributed in the hope that it will be useful,
49 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
50 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
51 @comment GNU General Public License for more details.
52
53 @c See ../README for A4 vs. US letter size.
54 @c When we provided A4 postscript, and people tried to
55 @c print it on US letter, the usual complaint was that the
56 @c page numbers would get cut off.
57 @c If one prints US letter on A4, reportedly there is
58 @c some extra space at the top and/or bottom, and the side
59 @c margins are a bit narrow, but no text is lost.
60 @c
61 @c See
62 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
63 @c for more on paper sizes.  Insuring that margins are
64 @c big enough to print on either A4 or US letter does
65 @c indeed seem to be the usual approach (RFC2346).
66
67 @c This document seems to get overfull hboxes with some
68 @c frequency (probably because the tendency is to
69 @c sanity-check it with "make info" and run TeX less
70 @c often).  The big ugly boxes just seem to add insult
71 @c to injury, and I'm not aware of them helping to fix
72 @c the overfull hboxes at all.
73 @finalout
74
75 @include version.texi
76 @settitle CVS---Concurrent Versions System v@value{VERSION}
77 @setchapternewpage odd
78
79 @c -- TODO list:
80 @c -- Fix all lines that match "^@c -- "
81 @c -- Also places marked with FIXME should be manual
82 @c problems (as opposed to FIXCVS for CVS problems).
83
84 @c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
85 @c @asis when generating info and dvi, and by <i></i> in the generated html,
86 @c such that keywords are not expanded in the generated html. 
87 @ifnothtml
88 @macro splitrcskeyword {arg}
89 @asis{}\arg\
90 @end macro
91 @end ifnothtml
92
93 @ifhtml
94 @macro splitrcskeyword {arg}
95 @i{}\arg\
96 @end macro
97 @end ifhtml
98
99 @dircategory GNU Packages
100 @direntry
101 * CVS: (cvs).                   Concurrent Versions System
102 @end direntry
103 @dircategory Individual utilities
104 @direntry
105 * cvs: (cvs)CVS commands.       Concurrent Versions System
106 @end direntry
107
108 @comment The titlepage section does not appear in the Info file.
109 @titlepage
110 @sp 4
111 @comment The title is printed in a large font.
112 @center @titlefont{Version Management}
113 @sp
114 @center @titlefont{with}
115 @sp
116 @center @titlefont{CVS}
117 @sp 2
118 @center for @sc{cvs} @value{VERSION}
119 @comment -release-
120 @sp 3
121 @center Per Cederqvist et al
122
123 @comment  The following two commands start the copyright page
124 @comment  for the printed manual.  This will not appear in the Info file.
125 @page
126 @vskip 0pt plus 1filll
127 @copyleftnotice
128 @end titlepage
129
130 @comment ================================================================
131 @comment                   The real text starts here
132 @comment ================================================================
133
134 @ifnottex
135 @c ---------------------------------------------------------------------
136 @node    Top
137 @top
138
139 This info manual describes how to use and administer
140 @sc{cvs} version @value{VERSION}.
141 @end ifnottex
142
143 @ifinfo
144 @copyleftnotice
145 @end ifinfo
146
147 @c This menu is pretty long.  Not sure how easily that
148 @c can be fixed (no brilliant ideas right away)...
149 @menu
150 * Overview::                    An introduction to CVS
151 * Repository::                  Where all your sources are stored
152 * Starting a new project::      Starting a project with CVS
153 * Revisions::                   Numeric and symbolic names for revisions
154 * Branching and merging::       Diverging/rejoining branches of development
155 * Recursive behavior::          CVS descends directories
156 * Adding and removing::         Adding/removing/renaming files/directories
157 * History browsing::            Viewing the history of files in various ways
158
159 CVS and the Real World.
160 -----------------------
161 * Binary files::                CVS can handle binary files
162 * Multiple developers::         How CVS helps a group of developers
163 * Revision management::         Policy questions for revision management
164 * Keyword substitution::        CVS can include the revision inside the file
165 * Tracking sources::            Tracking third-party sources
166 * Builds::                      Issues related to CVS and builds
167 * Special Files::               Devices, links and other non-regular files
168
169 References.
170 -----------
171 * CVS commands::                CVS commands share some things
172 * Invoking CVS::                Quick reference to CVS commands
173 * Administrative files::        Reference manual for the Administrative files
174 * Environment variables::       All environment variables which affect CVS
175 * Compatibility::               Upgrading CVS versions
176 * Troubleshooting::             Some tips when nothing works
177 * Credits::                     Some of the contributors to this manual
178 * BUGS::                        Dealing with bugs in CVS or this manual
179 * Index::                       Index
180 @end menu
181
182 @c ---------------------------------------------------------------------
183 @node Overview
184 @chapter Overview
185 @cindex Overview
186
187 This chapter is for people who have never used
188 @sc{cvs}, and perhaps have never used version control
189 software before.
190
191 If you are already familiar with @sc{cvs} and are just
192 trying to learn a particular feature or remember a
193 certain command, you can probably skip everything here.
194
195 @menu
196 * What is CVS?::                What you can do with @sc{cvs}
197 * What is CVS not?::            Problems @sc{cvs} doesn't try to solve
198 * A sample session::            A tour of basic @sc{cvs} usage
199 @end menu
200
201 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202 @node What is CVS?
203 @section What is CVS?
204 @cindex What is CVS?
205 @cindex Introduction to CVS
206 @cindex CVS, introduction to
207
208 @sc{cvs} is a version control system.  Using it, you can
209 record the history of your source files.
210
211 @c -- ///
212 @c -- ///Those who cannot remember the past are condemned to repeat it.
213 @c -- ///               -- George Santayana
214 @c -- //////
215
216 @c -- Insert history  quote here!
217 For example, bugs sometimes creep in when
218 software is modified, and you might not detect the bug
219 until a long time after you make the modification.
220 With @sc{cvs}, you can easily retrieve old versions to see
221 exactly which change caused the bug.  This can
222 sometimes be a big help.
223
224 You could of course save every version of every file
225 you have ever created.  This would
226 however waste an enormous amount of disk space.  @sc{cvs}
227 stores all the versions of a file in a single file in a
228 clever way that only stores the differences between
229 versions.
230
231 @sc{cvs} also helps you if you are part of a group of people working
232 on the same project.  It is all too easy to overwrite
233 each others' changes unless you are extremely careful.
234 Some editors, like @sc{gnu} Emacs, try to make sure that
235 the same file is never modified by two people at the
236 same time.  Unfortunately, if someone is using another
237 editor, that safeguard will not work.  @sc{cvs} solves this problem
238 by insulating the different developers from each other.  Every
239 developer works in his own directory, and @sc{cvs} merges
240 the work when each developer is done.
241
242 @cindex History of CVS
243 @cindex CVS, history of
244 @cindex Credits (CVS program)
245 @cindex Contributors (CVS program)
246 @sc{cvs} started out as a bunch of shell scripts written by
247 Dick Grune, posted to the newsgroup
248 @code{comp.sources.unix} in the volume 6
249 release of July, 1986.  While no actual code from
250 these shell scripts is present in the current version
251 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
252 come from them.
253
254 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
255 Jeff Polk later helped Brian with the design of the @sc{cvs}
256 module and vendor branch support.
257
258 @cindex Source, getting CVS source
259 You can get @sc{cvs} in a variety of ways, including
260 free download from the Internet.  For more information
261 on downloading @sc{cvs} and other @sc{cvs} topics, see:
262
263 @example
264 @url{http://www.cvshome.org/}
265 @url{http://www.loria.fr/~molli/cvs-index.html}
266 @end example
267
268 @cindex Mailing list
269 @cindex List, mailing list
270 @cindex Newsgroups
271 There is a mailing list, known as @email{info-cvs@@gnu.org},
272 devoted to @sc{cvs}.  To subscribe or
273 unsubscribe
274 write to
275 @email{info-cvs-request@@gnu.org}.
276 If you prefer a Usenet group, there is a one-way mirror (posts to the email
277 list are usually sent to the news group, but not visa versa) of
278 @email{info-cvs@@gnu.org} at @url{news:gnu.cvs.help}.  The right
279 Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
280 @sc{cvs} discussions (along with other configuration
281 management systems).  In the future, it might be
282 possible to create a
283 @code{comp.software.config-mgmt.cvs}, but probably only
284 if there is sufficient @sc{cvs} traffic on
285 @url{news:comp.software.config-mgmt}.
286 @c Other random data is that the tale was very
287 @c skeptical of comp.software.config-mgmt.cvs when the
288 @c subject came up around 1995 or so (for one
289 @c thing, because creating it would be a "reorg" which
290 @c would need to take a more comprehensive look at the
291 @c whole comp.software.config-mgmt.* hierarchy).
292
293 You can also subscribe to the @email{bug-cvs@@gnu.org} mailing list,
294 described in more detail in @ref{BUGS}.  To subscribe
295 send mail to @email{bug-cvs-request@@gnu.org}.  There is a two-way
296 Usenet mirror (posts to the Usenet group are usually sent to the email list and
297 visa versa) of @email{bug-cvs@@gnu.org} named @url{news:gnu.cvs.bug}.
298
299 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
300 @node What is CVS not?
301 @section What is CVS not?
302 @cindex What is CVS not?
303
304 @sc{cvs} can do a lot of things for you, but it does
305 not try to be everything for everyone.
306
307 @table @asis
308 @item @sc{cvs} is not a build system.
309
310 Though the structure of your repository and modules
311 file interact with your build system
312 (e.g. @file{Makefile}s), they are essentially
313 independent.
314
315 @sc{cvs} does not dictate how you build anything.  It
316 merely stores files for retrieval in a tree structure
317 you devise.
318
319 @sc{cvs} does not dictate how to use disk space in the
320 checked out working directories.  If you write your
321 @file{Makefile}s or scripts in every directory so they
322 have to know the relative positions of everything else,
323 you wind up requiring the entire repository to be
324 checked out.
325
326 If you modularize your work, and construct a build
327 system that will share files (via links, mounts,
328 @code{VPATH} in @file{Makefile}s, etc.), you can
329 arrange your disk usage however you like.
330
331 But you have to remember that @emph{any} such system is
332 a lot of work to construct and maintain.  @sc{cvs} does
333 not address the issues involved.
334
335 Of course, you should place the tools created to
336 support such a build system (scripts, @file{Makefile}s,
337 etc) under @sc{cvs}.
338
339 Figuring out what files need to be rebuilt when
340 something changes is, again, something to be handled
341 outside the scope of @sc{cvs}.  One traditional
342 approach is to use @code{make} for building, and use
343 some automated tool for generating the dependencies which
344 @code{make} uses.
345
346 See @ref{Builds}, for more information on doing builds
347 in conjunction with @sc{cvs}.
348
349 @item @sc{cvs} is not a substitute for management.
350
351 Your managers and project leaders are expected to talk
352 to you frequently enough to make certain you are aware
353 of schedules, merge points, branch names and release
354 dates.  If they don't, @sc{cvs} can't help.
355
356 @sc{cvs} is an instrument for making sources dance to
357 your tune.  But you are the piper and the composer.  No
358 instrument plays itself or writes its own music.
359
360 @item @sc{cvs} is not a substitute for developer communication.
361
362 When faced with conflicts within a single file, most
363 developers manage to resolve them without too much
364 effort.  But a more general definition of ``conflict''
365 includes problems too difficult to solve without
366 communication between developers.
367
368 @sc{cvs} cannot determine when simultaneous changes
369 within a single file, or across a whole collection of
370 files, will logically conflict with one another.  Its
371 concept of a @dfn{conflict} is purely textual, arising
372 when two changes to the same base file are near enough
373 to spook the merge (i.e. @code{diff3}) command.
374
375 @sc{cvs} does not claim to help at all in figuring out
376 non-textual or distributed conflicts in program logic.
377
378 For example: Say you change the arguments to function
379 @code{X} defined in file @file{A}.  At the same time,
380 someone edits file @file{B}, adding new calls to
381 function @code{X} using the old arguments.  You are
382 outside the realm of @sc{cvs}'s competence.
383
384 Acquire the habit of reading specs and talking to your
385 peers.
386
387
388 @item @sc{cvs} does not have change control
389
390 Change control refers to a number of things.  First of
391 all it can mean @dfn{bug-tracking}, that is being able
392 to keep a database of reported bugs and the status of
393 each one (is it fixed?  in what release?  has the bug
394 submitter agreed that it is fixed?).  For interfacing
395 @sc{cvs} to an external bug-tracking system, see the
396 @file{rcsinfo} and @file{verifymsg} files
397 (@pxref{Administrative files}).
398
399 Another aspect of change control is keeping track of
400 the fact that changes to several files were in fact
401 changed together as one logical change.  If you check
402 in several files in a single @code{cvs commit}
403 operation, @sc{cvs} then forgets that those files were
404 checked in together, and the fact that they have the
405 same log message is the only thing tying them
406 together.  Keeping a @sc{gnu} style @file{ChangeLog}
407 can help somewhat.
408 @c FIXME: should have an xref to a section which talks
409 @c more about keeping ChangeLog's with CVS, but that
410 @c section hasn't been written yet.
411
412 Another aspect of change control, in some systems, is
413 the ability to keep track of the status of each
414 change.  Some changes have been written by a developer,
415 others have been reviewed by a second developer, and so
416 on.  Generally, the way to do this with @sc{cvs} is to
417 generate a diff (using @code{cvs diff} or @code{diff})
418 and email it to someone who can then apply it using the
419 @code{patch} utility.  This is very flexible, but
420 depends on mechanisms outside @sc{cvs} to make sure
421 nothing falls through the cracks.
422
423 @item @sc{cvs} is not an automated testing program
424
425 It should be possible to enforce mandatory use of a
426 test suite using the @code{commitinfo} file.  I haven't
427 heard a lot about projects trying to do that or whether
428 there are subtle gotchas, however.
429
430 @item @sc{cvs} does not have a built-in process model
431
432 Some systems provide ways to ensure that changes or
433 releases go through various steps, with various
434 approvals as needed.  Generally, one can accomplish
435 this with @sc{cvs} but it might be a little more work.
436 In some cases you'll want to use the @file{commitinfo},
437 @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
438 files, to require that certain steps be performed
439 before cvs will allow a checkin.  Also consider whether
440 features such as branches and tags can be used to
441 perform tasks such as doing work in a development tree
442 and then merging certain changes over to a stable tree
443 only once they have been proven.
444 @end table
445
446 @c ---------------------------------------------------------------------
447 @node A sample session
448 @section A sample session
449 @cindex Example of a work-session
450 @cindex Getting started
451 @cindex Work-session, example of
452 @cindex tc, Trivial Compiler (example)
453 @cindex Trivial Compiler (example)
454
455 @c I think an example is a pretty good way to start.  But
456 @c somewhere in here, maybe after the sample session,
457 @c we need something which is kind of
458 @c a "roadmap" which is more directed at sketching out
459 @c the functionality of CVS and pointing people to
460 @c various other parts of the manual.  As it stands now
461 @c people who read in order get dumped right into all
462 @c manner of hair regarding remote repositories,
463 @c creating a repository, etc.
464 @c
465 @c The following was in the old Basic concepts node.  I don't
466 @c know how good a job it does at introducing modules,
467 @c or whether they need to be introduced so soon, but
468 @c something of this sort might go into some
469 @c introductory material somewhere.
470 @ignore
471 @cindex Modules (intro)
472 The repository contains directories and files, in an
473 arbitrary tree.  The @dfn{modules} feature can be used
474 to group together a set of directories or files into a
475 single entity (@pxref{modules}).  A typical usage is to
476 define one module per project.
477 @end ignore
478
479 As a way of introducing @sc{cvs}, we'll go through a
480 typical work-session using @sc{cvs}.  The first thing
481 to understand is that @sc{cvs} stores all files in a
482 centralized @dfn{repository} (@pxref{Repository}); this
483 section assumes that a repository is set up.
484 @c I'm not sure that the sentence concerning the
485 @c repository quite tells the user what they need to
486 @c know at this point.  Might need to expand on "centralized"
487 @c slightly (maybe not here, maybe further down in the example?)
488
489 Suppose you are working on a simple compiler.  The source
490 consists of a handful of C files and a @file{Makefile}.
491 The compiler is called @samp{tc} (Trivial Compiler),
492 and the repository is set up so that there is a module
493 called @samp{tc}.
494
495 @menu
496 * Getting the source::          Creating a workspace
497 * Committing your changes::     Making your work available to others
498 * Cleaning up::                 Cleaning up
499 * Viewing differences::         Viewing differences
500 @end menu
501
502 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
503 @node Getting the source
504 @subsection Getting the source
505 @cindex Getting the source
506 @cindex Checking out source
507 @cindex Fetching source
508 @cindex Source, getting from CVS
509 @cindex Checkout, example
510
511 The first thing you must do is to get your own working copy of the
512 source for @samp{tc}.  For this, you use the @code{checkout} command:
513
514 @example
515 $ cvs checkout tc
516 @end example
517
518 @noindent
519 This will create a new directory called @file{tc} and populate it with
520 the source files.
521
522 @example
523 $ cd tc
524 $ ls
525 CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
526 @end example
527
528 The @file{CVS} directory is used internally by
529 @sc{cvs}.  Normally, you should not modify or remove
530 any of the files in it.
531
532 You start your favorite editor, hack away at @file{backend.c}, and a couple
533 of hours later you have added an optimization pass to the compiler.
534 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
535 you want to edit.  @xref{Multiple developers}, for an explanation.
536
537 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
538 @node Committing your changes
539 @subsection Committing your changes
540 @cindex Committing changes to files
541 @cindex Log message entry
542
543 When you have checked that the compiler is still compilable you decide
544 to make a new version of @file{backend.c}.  This will
545 store your new @file{backend.c} in the repository and
546 make it available to anyone else who is using that same
547 repository.
548
549 @example
550 $ cvs commit backend.c
551 @end example
552
553 @noindent
554 @sc{cvs} starts an editor, to allow you to enter a log
555 message.  You type in ``Added an optimization pass.'',
556 save the temporary file, and exit the editor.
557
558 @cindex CVSEDITOR, environment variable
559 @cindex EDITOR, environment variable
560 The environment variable @code{$CVSEDITOR} determines
561 which editor is started.  If @code{$CVSEDITOR} is not
562 set, then if the environment variable @code{$EDITOR} is
563 set, it will be used. If both @code{$CVSEDITOR} and
564 @code{$EDITOR} are not set then there is a default
565 which will vary with your operating system, for example
566 @code{vi} for unix or @code{notepad} for Windows
567 NT/95.
568
569 @cindex VISUAL, environment variable
570 In addition, @sc{cvs} checks the @code{$VISUAL} environment
571 variable.  Opinions vary on whether this behavior is desirable and
572 whether future releases of @sc{cvs} should check @code{$VISUAL} or
573 ignore it.  You will be OK either way if you make sure that
574 @code{$VISUAL} is either unset or set to the same thing as
575 @code{$EDITOR}.
576
577 @c This probably should go into some new node
578 @c containing detailed info on the editor, rather than
579 @c the intro.  In fact, perhaps some of the stuff with
580 @c CVSEDITOR and -m and so on should too.
581 When @sc{cvs} starts the editor, it includes a list of
582 files which are modified.  For the @sc{cvs} client,
583 this list is based on comparing the modification time
584 of the file against the modification time that the file
585 had when it was last gotten or updated.  Therefore, if
586 a file's modification time has changed but its contents
587 have not, it will show up as modified.  The simplest
588 way to handle this is simply not to worry about it---if
589 you proceed with the commit @sc{cvs} will detect that
590 the contents are not modified and treat it as an
591 unmodified file.  The next @code{update} will clue
592 @sc{cvs} in to the fact that the file is unmodified,
593 and it will reset its stored timestamp so that the file
594 will not show up in future editor sessions.
595 @c FIXCVS: Might be nice if "commit" and other commands
596 @c would reset that timestamp too, but currently commit
597 @c doesn't.
598 @c FIXME: Need to talk more about the process of
599 @c prompting for the log message.  Like show an example
600 @c of what it pops up in the editor, for example.  Also
601 @c a discussion of how to get the "a)bort, c)ontinue,
602 @c e)dit" prompt and what to do with it.  Might also
603 @c work in the suggestion that if you want a diff, you
604 @c should make it before running commit (someone
605 @c suggested that the diff pop up in the editor.  I'm
606 @c not sure that is better than telling people to run
607 @c "cvs diff" first if that is what they want, but if
608 @c we want to tell people that, the manual possibly
609 @c should say it).
610
611 If you want to avoid
612 starting an editor you can specify the log message on
613 the command line using the @samp{-m} flag instead, like
614 this:
615
616 @example
617 $ cvs commit -m "Added an optimization pass" backend.c
618 @end example
619
620 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
621 @node Cleaning up
622 @subsection Cleaning up
623 @cindex Cleaning up
624 @cindex Working copy, removing
625 @cindex Removing your working copy
626 @cindex Releasing your working copy
627
628 Before you turn to other tasks you decide to remove your working copy of
629 tc.  One acceptable way to do that is of course
630
631 @example
632 $ cd ..
633 $ rm -r tc
634 @end example
635
636 @noindent
637 but a better way is to use the @code{release} command (@pxref{release}):
638
639 @example
640 $ cd ..
641 $ cvs release -d tc
642 M driver.c
643 ? tc
644 You have [1] altered files in this repository.
645 Are you sure you want to release (and delete) directory `tc': n
646 ** `release' aborted by user choice.
647 @end example
648
649 The @code{release} command checks that all your modifications have been
650 committed.  If history logging is enabled it also makes a note in the
651 history file.  @xref{history file}.
652
653 When you use the @samp{-d} flag with @code{release}, it
654 also removes your working copy.
655
656 In the example above, the @code{release} command wrote a couple of lines
657 of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
658 That is nothing to worry about: @file{tc} is the executable compiler,
659 and it should not be stored in the repository.  @xref{cvsignore},
660 for information about how to make that warning go away.
661 @xref{release output}, for a complete explanation of
662 all possible output from @code{release}.
663
664 @samp{M driver.c} is more serious.  It means that the
665 file @file{driver.c} has been modified since it was
666 checked out.
667
668 The @code{release} command always finishes by telling
669 you how many modified files you have in your working
670 copy of the sources, and then asks you for confirmation
671 before deleting any files or making any note in the
672 history file.
673
674 You decide to play it safe and answer @kbd{n @key{RET}}
675 when @code{release} asks for confirmation.
676
677 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
678 @node Viewing differences
679 @subsection Viewing differences
680 @cindex Viewing differences
681 @cindex Diff
682
683 You do not remember modifying @file{driver.c}, so you want to see what
684 has happened to that file.
685
686 @example
687 $ cd tc
688 $ cvs diff driver.c
689 @end example
690
691 This command runs @code{diff} to compare the version of @file{driver.c}
692 that you checked out with your working copy.  When you see the output
693 you remember that you added a command line option that enabled the
694 optimization pass.  You check it in, and release the module.
695 @c FIXME: we haven't yet defined the term "check in".
696
697 @example
698 $ cvs commit -m "Added an optimization pass" driver.c
699 Checking in driver.c;
700 /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
701 new revision: 1.2; previous revision: 1.1
702 done
703 $ cd ..
704 $ cvs release -d tc
705 ? tc
706 You have [0] altered files in this repository.
707 Are you sure you want to release (and delete) directory `tc': y
708 @end example
709
710 @c ---------------------------------------------------------------------
711 @node Repository
712 @chapter The Repository
713 @cindex Repository (intro)
714 @cindex Repository, example
715 @cindex Layout of repository
716 @cindex Typical repository
717 @cindex /usr/local/cvsroot, as example repository
718 @cindex cvsroot
719
720 The @sc{cvs} @dfn{repository} stores a complete copy of
721 all the files and directories which are under version
722 control.
723
724 Normally, you never access any of the files in the
725 repository directly.  Instead, you use @sc{cvs}
726 commands to get your own copy of the files into a
727 @dfn{working directory}, and then
728 work on that copy.  When you've finished a set of
729 changes, you check (or @dfn{commit}) them back into the
730 repository.  The repository then contains the changes
731 which you have made, as well as recording exactly what
732 you changed, when you changed it, and other such
733 information.  Note that the repository is not a
734 subdirectory of the working directory, or vice versa;
735 they should be in separate locations.
736 @c Need some example, e.g. repository
737 @c /usr/local/cvsroot; working directory
738 @c /home/joe/sources.  But this node is too long
739 @c as it is; need a little reorganization...
740
741 @cindex :local:, setting up
742 @sc{cvs} can access a repository by a variety of
743 means.  It might be on the local computer, or it might
744 be on a computer across the room or across the world.
745 To distinguish various ways to access a repository, the
746 repository name can start with an @dfn{access method}.
747 For example, the access method @code{:local:} means to
748 access a repository directory, so the repository
749 @code{:local:/usr/local/cvsroot} means that the
750 repository is in @file{/usr/local/cvsroot} on the
751 computer running @sc{cvs}.  For information on other
752 access methods, see @ref{Remote repositories}.
753
754 @c Can se say this more concisely?  Like by passing
755 @c more of the buck to the Remote repositories node?
756 If the access method is omitted, then if the repository
757 starts with @samp{/}, then @code{:local:} is
758 assumed.  If it does not start with @samp{/} then either
759 @code{:ext:} or @code{:server:} is assumed.  For
760 example, if you have a local repository in
761 @file{/usr/local/cvsroot}, you can use
762 @code{/usr/local/cvsroot} instead of
763 @code{:local:/usr/local/cvsroot}.  But if (under
764 Windows NT, for example) your local repository is
765 @file{c:\src\cvsroot}, then you must specify the access
766 method, as in @code{:local:c:/src/cvsroot}.
767
768 @c This might appear to go in Repository storage, but
769 @c actually it is describing something which is quite
770 @c user-visible, when you do a "cvs co CVSROOT".  This
771 @c isn't necessary the perfect place for that, though.
772 The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
773 administrative files for @sc{cvs}.  The other directories contain the actual
774 user-defined modules.
775
776 @menu
777 * Specifying a repository::     Telling CVS where your repository is
778 * Repository storage::          The structure of the repository
779 * Working directory storage::   The structure of working directories
780 * Intro administrative files::  Defining modules
781 * Multiple repositories::       Multiple repositories
782 * Creating a repository::       Creating a repository
783 * Backing up::                  Backing up a repository
784 * Moving a repository::         Moving a repository
785 * Remote repositories::         Accessing repositories on remote machines
786 * Read-only access::            Granting read-only access to the repository
787 * Server temporary directory::  The server creates temporary directories
788 @end menu
789
790 @node Specifying a repository
791 @section Telling CVS where your repository is
792
793 There are several ways to tell @sc{cvs}
794 where to find the repository.  You can name the
795 repository on the command line explicitly, with the
796 @code{-d} (for "directory") option:
797
798 @example
799 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
800 @end example
801
802 @cindex .profile, setting CVSROOT in
803 @cindex .cshrc, setting CVSROOT in
804 @cindex .tcshrc, setting CVSROOT in
805 @cindex .bashrc, setting CVSROOT in
806 @cindex CVSROOT, environment variable
807         Or you can set the @code{$CVSROOT} environment
808 variable to an absolute path to the root of the
809 repository, @file{/usr/local/cvsroot} in this example.
810 To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
811 users should have this line in their @file{.cshrc} or
812 @file{.tcshrc} files:
813
814 @example
815 setenv CVSROOT /usr/local/cvsroot
816 @end example
817
818 @noindent
819 @code{sh} and @code{bash} users should instead have these lines in their
820 @file{.profile} or @file{.bashrc}:
821
822 @example
823 CVSROOT=/usr/local/cvsroot
824 export CVSROOT
825 @end example
826
827 @cindex Root file, in CVS directory
828 @cindex CVS/Root file
829         A repository specified with @code{-d} will
830 override the @code{$CVSROOT} environment variable.
831 Once you've checked a working copy out from the
832 repository, it will remember where its repository is
833 (the information is recorded in the
834 @file{CVS/Root} file in the working copy).
835
836 The @code{-d} option and the @file{CVS/Root} file both
837 override the @code{$CVSROOT} environment variable.  If
838 @code{-d} option differs from @file{CVS/Root}, the
839 former is used.  Of course, for proper operation they
840 should be two ways of referring to the same repository.
841
842 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
843 @node Repository storage
844 @section How data is stored in the repository
845 @cindex Repository, how data is stored
846
847 For most purposes it isn't important @emph{how}
848 @sc{cvs} stores information in the repository.  In
849 fact, the format has changed in the past, and is likely
850 to change in the future.  Since in almost all cases one
851 accesses the repository via @sc{cvs} commands, such
852 changes need not be disruptive.
853
854 However, in some cases it may be necessary to
855 understand how @sc{cvs} stores data in the repository,
856 for example you might need to track down @sc{cvs} locks
857 (@pxref{Concurrency}) or you might need to deal with
858 the file permissions appropriate for the repository.
859
860 @menu
861 * Repository files::            What files are stored in the repository
862 * File permissions::            File permissions
863 * Windows permissions::         Issues specific to Windows
864 * Attic::                       Some files are stored in the Attic
865 * CVS in repository::           Additional information in CVS directory
866 * Locks::                       CVS locks control concurrent accesses
867 * CVSROOT storage::             A few things about CVSROOT are different
868 @end menu
869
870 @node Repository files
871 @subsection Where files are stored within the repository
872
873 @c @cindex Filenames, legal
874 @c @cindex Legal filenames
875 @c Somewhere we need to say something about legitimate
876 @c characters in filenames in working directory and
877 @c repository.  Not "/" (not even on non-unix).  And
878 @c here is a specific set of issues:
879 @c      Files starting with a - are handled inconsistently. They can not
880 @c   be added to a repository with an add command, because it they are
881 @c   interpreted as a switch. They can appear in a repository if they are
882 @c   part of a tree that is imported. They can not be removed from the tree
883 @c   once they are there.
884 @c Note that "--" *is* supported (as a
885 @c consequence of using GNU getopt).  Should document
886 @c this somewhere ("Common options"?).  The other usual technique,
887 @c "./-foo", isn't as effective, at least for "cvs add"
888 @c which doesn't support pathnames containing "/".
889
890 The overall structure of the repository is a directory
891 tree corresponding to the directories in the working
892 directory.  For example, supposing the repository is in
893
894 @example
895 /usr/local/cvsroot
896 @end example
897
898 @noindent
899 here is a possible directory tree (showing only the
900 directories):
901
902 @example
903 @t{/usr}
904  |
905  +--@t{local}
906  |   |
907  |   +--@t{cvsroot}
908  |   |    |
909  |   |    +--@t{CVSROOT}
910           |      (administrative files)
911           |
912           +--@t{gnu}
913           |   |
914           |   +--@t{diff}
915           |   |   (source code to @sc{gnu} diff)
916           |   |
917           |   +--@t{rcs}
918           |   |   (source code to @sc{rcs})
919           |   |
920           |   +--@t{cvs}
921           |       (source code to @sc{cvs})
922           |
923           +--@t{yoyodyne}
924               |
925               +--@t{tc}
926               |    |
927               |    +--@t{man}
928               |    |
929               |    +--@t{testing}
930               |
931               +--(other Yoyodyne software)
932 @end example
933
934 With the directories are @dfn{history files} for each file
935 under version control.  The name of the history file is
936 the name of the corresponding file with @samp{,v}
937 appended to the end.  Here is what the repository for
938 the @file{yoyodyne/tc} directory might look like:
939 @c FIXME: Should also mention CVS (CVSREP)
940 @c FIXME? Should we introduce Attic with an xref to
941 @c Attic?  Not sure whether that is a good idea or not.
942 @example
943   @code{$CVSROOT}
944     |
945     +--@t{yoyodyne}
946     |   |
947     |   +--@t{tc}
948     |   |   |
949             +--@t{Makefile,v}
950             +--@t{backend.c,v}
951             +--@t{driver.c,v}
952             +--@t{frontend.c,v}
953             +--@t{parser.c,v}
954             +--@t{man}
955             |    |
956             |    +--@t{tc.1,v}
957             |
958             +--@t{testing}
959                  |
960                  +--@t{testpgm.t,v}
961                  +--@t{test2.t,v}
962 @end example
963
964 @cindex History files
965 @cindex RCS history files
966 @c The first sentence, about what history files
967 @c contain, is kind of redundant with our intro to what the
968 @c repository does in node Repository....
969 The history files contain, among other things, enough
970 information to recreate any revision of the file, a log
971 of all commit messages and the user-name of the person
972 who committed the revision.  The history files are
973 known as @dfn{RCS files}, because the first program to
974 store files in that format was a version control system
975 known as @sc{rcs}.  For a full
976 description of the file format, see the @code{man} page
977 @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
978 file @file{doc/RCSFILES} in the @sc{cvs} source
979 distribution.  This
980 file format has become very common---many systems other
981 than @sc{cvs} or @sc{rcs} can at least import history
982 files in this format.
983 @c FIXME: Think about including documentation for this
984 @c rather than citing it?  In the long run, getting
985 @c this to be a standard (not sure if we can cope with
986 @c a standards process as formal as IEEE/ANSI/ISO/etc,
987 @c though...) is the way to go, so maybe citing is
988 @c better.
989
990 The @sc{rcs} files used in @sc{cvs} differ in a few
991 ways from the standard format.  The biggest difference
992 is magic branches; for more information see @ref{Magic
993 branch numbers}.  Also in @sc{cvs} the valid tag names
994 are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
995 rules see @ref{Tags}.
996
997 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
998 @node File permissions
999 @subsection File permissions
1000 @c -- Move this to @node Creating a repository or similar
1001 @cindex Security, file permissions in repository
1002 @cindex File permissions, general
1003 @cindex Permissions, general
1004 @c FIXME: we need to somehow reflect "permissions in
1005 @c repository" versus "permissions in working
1006 @c directory" in the index entries.
1007 @cindex Group, UNIX file permissions, in repository
1008 @cindex Read-only files, in repository
1009 All @samp{,v} files are created read-only, and you
1010 should not change the permission of those files.  The
1011 directories inside the repository should be writable by
1012 the persons that have permission to modify the files in
1013 each directory.  This normally means that you must
1014 create a UNIX group (see group(5)) consisting of the
1015 persons that are to edit the files in a project, and
1016 set up the repository so that it is that group that
1017 owns the directory.
1018 (On some systems, you also need to set the set-group-ID-on-execution bit
1019 on the repository directories (see chmod(1)) so that newly-created files
1020 and directories get the group-ID of the parent directory rather than
1021 that of the current process.)
1022
1023 @c See also comment in commitinfo node regarding cases
1024 @c which are really awkward with unix groups.
1025
1026 This means that you can only control access to files on
1027 a per-directory basis.
1028
1029 Note that users must also have write access to check
1030 out files, because @sc{cvs} needs to create lock files
1031 (@pxref{Concurrency}).  You can use LockDir in CVSROOT/config
1032 to put the lock files somewhere other than in the repository
1033 if you want to allow read-only access to some directories
1034 (@pxref{config}).
1035
1036 @c CVS seems to use CVSUMASK in picking permissions for
1037 @c val-tags, but maybe we should say more about this.
1038 @c Like val-tags gets created by someone who doesn't
1039 @c have CVSUMASK set right?
1040 @cindex CVSROOT/val-tags file, and read-only access to projects
1041 @cindex val-tags file, and read-only access to projects
1042 Also note that users must have write access to the
1043 @file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1044 track of what tags are valid tag names (it is sometimes
1045 updated when tags are used, as well as when they are
1046 created).
1047
1048 Each @sc{rcs} file will be owned by the user who last
1049 checked it in.  This has little significance; what
1050 really matters is who owns the directories.
1051
1052 @cindex CVSUMASK, environment variable
1053 @cindex Umask, for repository files
1054 @sc{cvs} tries to set up reasonable file permissions
1055 for new directories that are added inside the tree, but
1056 you must fix the permissions manually when a new
1057 directory should have different permissions than its
1058 parent directory.  If you set the @code{CVSUMASK}
1059 environment variable that will control the file
1060 permissions which @sc{cvs} uses in creating directories
1061 and/or files in the repository.  @code{CVSUMASK} does
1062 not affect the file permissions in the working
1063 directory; such files have the permissions which are
1064 typical for newly created files, except that sometimes
1065 @sc{cvs} creates them read-only (see the sections on
1066 watches, @ref{Setting a watch}; -r, @ref{Global
1067 options}; or @code{CVSREAD}, @ref{Environment variables}).
1068 @c FIXME: Need more discussion of which
1069 @c group should own the file in the repository.
1070 @c Include a somewhat detailed example of the usual
1071 @c case where CVSUMASK is 007, the developers are all
1072 @c in a group, and that group owns stuff in the
1073 @c repository.  Need to talk about group ownership of
1074 @c newly-created directories/files (on some unices,
1075 @c such as SunOS4, setting the setgid bit on the
1076 @c directories will make files inherit the directory's
1077 @c group.  On other unices, your mileage may vary.  I
1078 @c can't remember what POSIX says about this, if
1079 @c anything).
1080
1081 Note that using the client/server @sc{cvs}
1082 (@pxref{Remote repositories}), there is no good way to
1083 set @code{CVSUMASK}; the setting on the client machine
1084 has no effect.  If you are connecting with @code{rsh}, you
1085 can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1086 described in the documentation for your operating
1087 system.  This behavior might change in future versions
1088 of @sc{cvs}; do not rely on the setting of
1089 @code{CVSUMASK} on the client having no effect.
1090 @c FIXME: need to explain what a umask is or cite
1091 @c someplace which does.
1092 @c
1093 @c There is also a larger (largely separate) issue
1094 @c about the meaning of CVSUMASK in a non-unix context.
1095 @c For example, whether there is
1096 @c an equivalent which fits better into other
1097 @c protection schemes like POSIX.6, VMS, &c.
1098 @c
1099 @c FIXME: Need one place which discusses this
1100 @c read-only files thing.  Why would one use -r or
1101 @c CVSREAD?  Why would one use watches?  How do they
1102 @c interact?
1103 @c
1104 @c FIXME: We need to state
1105 @c whether using CVSUMASK removes the need for manually
1106 @c fixing permissions (in fact, if we are going to mention
1107 @c manually fixing permission, we better document a lot
1108 @c better just what we mean by "fix").
1109
1110 Using pserver, you will generally need stricter
1111 permissions on the @sc{cvsroot} directory and
1112 directories above it in the tree; see @ref{Password
1113 authentication security}.
1114
1115 @cindex Setuid
1116 @cindex Setgid
1117 @cindex Security, setuid
1118 @cindex Installed images (VMS)
1119 Some operating systems have features which allow a
1120 particular program to run with the ability to perform
1121 operations which the caller of the program could not.
1122 For example, the set user ID (setuid) or set group ID
1123 (setgid) features of unix or the installed image
1124 feature of VMS.  @sc{cvs} was not written to use such
1125 features and therefore attempting to install @sc{cvs} in
1126 this fashion will provide protection against only
1127 accidental lapses; anyone who is trying to circumvent
1128 the measure will be able to do so, and depending on how
1129 you have set it up may gain access to more than just
1130 @sc{cvs}.  You may wish to instead consider pserver.  It
1131 shares some of the same attributes, in terms of
1132 possibly providing a false sense of security or opening
1133 security holes wider than the ones you are trying to
1134 fix, so read the documentation on pserver security
1135 carefully if you are considering this option
1136 (@ref{Password authentication security}).
1137
1138 @node Windows permissions
1139 @subsection File Permission issues specific to Windows
1140 @cindex Windows, and permissions
1141 @cindex File permissions, Windows-specific
1142 @cindex Permissions, Windows-specific
1143
1144 Some file permission issues are specific to Windows
1145 operating systems (Windows 95, Windows NT, and
1146 presumably future operating systems in this family.
1147 Some of the following might apply to OS/2 but I'm not
1148 sure).
1149
1150 If you are using local @sc{cvs} and the repository is on a
1151 networked file system which is served by the Samba SMB
1152 server, some people have reported problems with
1153 permissions.  Enabling WRITE=YES in the samba
1154 configuration is said to fix/workaround it.
1155 Disclaimer: I haven't investigated enough to know the
1156 implications of enabling that option, nor do I know
1157 whether there is something which @sc{cvs} could be doing
1158 differently in order to avoid the problem.  If you find
1159 something out, please let us know as described in
1160 @ref{BUGS}.
1161
1162 @node Attic
1163 @subsection The attic
1164 @cindex Attic
1165
1166 You will notice that sometimes @sc{cvs} stores an
1167 @sc{rcs} file in the @code{Attic}.  For example, if the
1168 @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1169 talking about the file @file{backend.c} in the
1170 directory @file{yoyodyne/tc}, then the file normally
1171 would be in
1172
1173 @example
1174 /usr/local/cvsroot/yoyodyne/tc/backend.c,v
1175 @end example
1176
1177 @noindent
1178 but if it goes in the attic, it would be in
1179
1180 @example
1181 /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1182 @end example
1183
1184 @noindent
1185 @cindex Dead state
1186 instead.  It should not matter from a user point of
1187 view whether a file is in the attic; @sc{cvs} keeps
1188 track of this and looks in the attic when it needs to.
1189 But in case you want to know, the rule is that the RCS
1190 file is stored in the attic if and only if the head
1191 revision on the trunk has state @code{dead}.  A
1192 @code{dead} state means that file has been removed, or
1193 never added, for that revision.  For example, if you
1194 add a file on a branch, it will have a trunk revision
1195 in @code{dead} state, and a branch revision in a
1196 non-@code{dead} state.
1197 @c Probably should have some more concrete examples
1198 @c here, or somewhere (not sure exactly how we should
1199 @c arrange the discussion of the dead state, versus
1200 @c discussion of the attic).
1201
1202 @node CVS in repository
1203 @subsection The CVS directory in the repository
1204 @cindex CVS directory, in repository
1205
1206 The @file{CVS} directory in each repository directory
1207 contains information such as file attributes (in a file
1208 called @file{CVS/fileattr}.  In the
1209 future additional files may be added to this directory,
1210 so implementations should silently ignore additional
1211 files.
1212
1213 This behavior is implemented only by @sc{cvs} 1.7 and
1214 later; for details see @ref{Watches Compatibility}.
1215
1216 The format of the @file{fileattr} file is a series of entries
1217 of the following form (where @samp{@{} and @samp{@}}
1218 means the text between the braces can be repeated zero
1219 or more times):
1220
1221 @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1222   @{; @var{attrname} = @var{attrval}@} <linefeed>
1223
1224 @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1225 attributes for that file.
1226
1227 @var{ent-type} is @samp{D},
1228 and @var{filename} empty, to specify default attributes
1229 to be used for newly added files.
1230
1231 Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1232 will delete them any time it writes file attributes.
1233 @sc{cvs} 1.10 and later will preserve them.
1234
1235 Note that the order of the lines is not significant;
1236 a program writing the fileattr file may
1237 rearrange them at its convenience.
1238
1239 There is currently no way of quoting tabs or line feeds in the
1240 filename, @samp{=} in @var{attrname},
1241 @samp{;} in @var{attrval}, etc.  Note: some implementations also
1242 don't handle a NUL character in any of the fields, but
1243 implementations are encouraged to allow it.
1244
1245 By convention, @var{attrname} starting with @samp{_} is for an attribute given
1246 special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1247 (or will be, once implementations start supporting user-defined attributes).
1248
1249 Built-in attributes:
1250
1251 @table @code
1252 @item _watched
1253 Present means the file is watched and should be checked out
1254 read-only.
1255
1256 @item _watchers
1257 Users with watches for this file.  Value is
1258 @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1259 where @var{watcher} is a username, and @var{type}
1260 is zero or more of edit,unedit,commit separated by
1261 @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1262
1263 @item _editors
1264 Users editing this file.  Value is
1265 @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1266 where @var{editor} is a username, and @var{val} is
1267 @var{time}+@var{hostname}+@var{pathname}, where
1268 @var{time} is when the @code{cvs edit} command (or
1269 equivalent) happened,
1270 and @var{hostname} and @var{pathname} are for the working directory.
1271 @end table
1272
1273 Example:
1274
1275 @c FIXME: sanity.sh should contain a similar test case
1276 @c so we can compare this example from something from
1277 @c Real Life(TM).  See cvsclient.texi (under Notify) for more
1278 @c discussion of the date format of _editors.
1279 @example
1280 Ffile1 _watched=;_watchers=joe>edit,mary>commit
1281 Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1282 D _watched=
1283 @end example
1284
1285 @noindent
1286 means that the file @file{file1} should be checked out
1287 read-only.  Furthermore, joe is watching for edits and
1288 mary is watching for commits.  The file @file{file2}
1289 should be checked out read-only; sue started editing it
1290 on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1291 the machine @code{workstn1}.  Future files which are
1292 added should be checked out read-only.  To represent
1293 this example here, we have shown a space after
1294 @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1295 there must be a single tab character there and no spaces.
1296
1297 @node Locks
1298 @subsection CVS locks in the repository
1299
1300 @cindex #cvs.rfl, technical details
1301 @cindex #cvs.pfl, technical details
1302 @cindex #cvs.wfl, technical details
1303 @cindex #cvs.lock, technical details
1304 @cindex Locks, cvs, technical details
1305 For an introduction to @sc{cvs} locks focusing on
1306 user-visible behavior, see @ref{Concurrency}.  The
1307 following section is aimed at people who are writing
1308 tools which want to access a @sc{cvs} repository without
1309 interfering with other tools accessing the same
1310 repository.  If you find yourself confused by concepts
1311 described here, like @dfn{read lock}, @dfn{write lock},
1312 and @dfn{deadlock}, you might consult the literature on
1313 operating systems or databases.
1314
1315 @cindex #cvs.tfl
1316 Any file in the repository with a name starting
1317 with @file{#cvs.rfl.} is a read lock.  Any file in
1318 the repository with a name starting with
1319 @file{#cvs.pfl} is a promotable read lock.  Any file in
1320 the repository with a name starting with
1321 @file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1322 (before @sc{cvs} 1.5) also created files with names starting
1323 with @file{#cvs.tfl}, but they are not discussed here.
1324 The directory @file{#cvs.lock} serves as a master
1325 lock.  That is, one must obtain this lock first before
1326 creating any of the other locks.
1327
1328 To obtain a read lock, first create the @file{#cvs.lock}
1329 directory.  This operation must be atomic (which should
1330 be true for creating a directory under most operating
1331 systems).  If it fails because the directory already
1332 existed, wait for a while and try again.  After
1333 obtaining the @file{#cvs.lock} lock, create a file
1334 whose name is @file{#cvs.rfl.} followed by information
1335 of your choice (for example, hostname and process
1336 identification number).  Then remove the
1337 @file{#cvs.lock} directory to release the master lock.
1338 Then proceed with reading the repository.  When you are
1339 done, remove the @file{#cvs.rfl} file to release the
1340 read lock.
1341
1342 Promotable read locks are a concept you may not find in other literature on
1343 concurrency.  They are used to allow a two (or more) pass process to only lock
1344 a file for read on the first (read) pass(es), then upgrade its read locks to
1345 write locks if necessary for a final pass, still assured that the files have
1346 not changed since they were first read.  @sc{cvs} uses promotable read locks,
1347 for example, to prevent commit and tag verification passes from interfering
1348 with other reading processes.  It can then lock only a single directory at a
1349 time for write during the write pass.
1350
1351 To obtain a promotable read lock, first create the @file{#cvs.lock} directory,
1352 as with a non-promotable read lock.  Then check
1353 that there are no files that start with
1354 @file{#cvs.pfl}.  If there are, remove the master @file{#cvs.lock} directory,
1355 wait awhile (CVS waits 30 seconds between lock attempts), and try again.  If
1356 there are no other promotable locks, go ahead and create a file whose name is
1357 @file{#cvs.pfl} followed by information of your choice (for example, CVS uses
1358 its hostname and the process identification number of the CVS server process
1359 creating the lock).  If versions of @sc{cvs} older than version 1.12.4 access
1360 your repository directly (not via a @sc{cvs} server of version 1.12.4 or
1361 later), then you should also create a read lock since older versions of CVS
1362 will ignore the promotable lock when attempting to create their own write lock.
1363 Then remove the master @file{#cvs.lock} directory in order to allow other
1364 processes to obtain read locks.
1365
1366 To obtain a write lock, first create the
1367 @file{#cvs.lock} directory, as with read locks.  Then
1368 check that there are no files whose names start with
1369 @file{#cvs.rfl.} and no files whose names start with @file{#cvs.pfl} that are
1370 not owned by the process attempting to get the write lock.  If either exist,
1371 remove @file{#cvs.lock}, wait for a while, and try again.  If
1372 there are no readers or promotable locks from other processes, then create a
1373 file whose name is @file{#cvs.wfl} followed by information of your choice
1374 (again, CVS uses the hostname and server process identification
1375 number).  Remove your @file{#cvs.pfl} file if present.  Hang on to the
1376 @file{#cvs.lock} lock.  Proceed
1377 with writing the repository.  When you are done, first
1378 remove the @file{#cvs.wfl} file and then the
1379 @file{#cvs.lock} directory. Note that unlike the
1380 @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1381 informational; it has no effect on the locking operation
1382 beyond what is provided by holding on to the
1383 @file{#cvs.lock} lock itself.
1384
1385 Note that each lock (write lock or read lock) only locks
1386 a single directory in the repository, including
1387 @file{Attic} and @file{CVS} but not including
1388 subdirectories which represent other directories under
1389 version control.  To lock an entire tree, you need to
1390 lock each directory (note that if you fail to obtain
1391 any lock you need, you must release the whole tree
1392 before waiting and trying again, to avoid deadlocks).
1393
1394 Note also that @sc{cvs} expects write locks to control
1395 access to individual @file{foo,v} files.  @sc{rcs} has
1396 a scheme where the @file{,foo,} file serves as a lock,
1397 but @sc{cvs} does not implement it and so taking out a
1398 @sc{cvs} write lock is recommended.  See the comments at
1399 rcs_internal_lockfile in the @sc{cvs} source code for
1400 further discussion/rationale.
1401
1402 @node CVSROOT storage
1403 @subsection How files are stored in the CVSROOT directory
1404 @cindex CVSROOT, storage of files
1405
1406 The @file{$CVSROOT/CVSROOT} directory contains the
1407 various administrative files.  In some ways this
1408 directory is just like any other directory in the
1409 repository; it contains @sc{rcs} files whose names end
1410 in @samp{,v}, and many of the @sc{cvs} commands operate
1411 on it the same way.  However, there are a few
1412 differences.
1413
1414 For each administrative file, in addition to the
1415 @sc{rcs} file, there is also a checked out copy of the
1416 file.  For example, there is an @sc{rcs} file
1417 @file{loginfo,v} and a file @file{loginfo} which
1418 contains the latest revision contained in
1419 @file{loginfo,v}.  When you check in an administrative
1420 file, @sc{cvs} should print
1421
1422 @example
1423 cvs commit: Rebuilding administrative file database
1424 @end example
1425
1426 @noindent
1427 and update the checked out copy in
1428 @file{$CVSROOT/CVSROOT}.  If it does not, there is
1429 something wrong (@pxref{BUGS}).  To add your own files
1430 to the files to be updated in this fashion, you can add
1431 them to the @file{checkoutlist} administrative file
1432 (@pxref{checkoutlist}).
1433
1434 @cindex modules.db
1435 @cindex modules.pag
1436 @cindex modules.dir
1437 By default, the @file{modules} file behaves as
1438 described above.  If the modules file is very large,
1439 storing it as a flat text file may make looking up
1440 modules slow (I'm not sure whether this is as much of a
1441 concern now as when @sc{cvs} first evolved this
1442 feature; I haven't seen benchmarks).  Therefore, by
1443 making appropriate edits to the @sc{cvs} source code
1444 one can store the modules file in a database which
1445 implements the @code{ndbm} interface, such as Berkeley
1446 db or GDBM.  If this option is in use, then the modules
1447 database will be stored in the files @file{modules.db},
1448 @file{modules.pag}, and/or @file{modules.dir}.
1449 @c I think fileattr also will use the database stuff.
1450 @c Anything else?
1451
1452 For information on the meaning of the various
1453 administrative files, see @ref{Administrative files}.
1454
1455 @node Working directory storage
1456 @section How data is stored in the working directory
1457
1458 @c FIXME: Somewhere we should discuss timestamps (test
1459 @c case "stamps" in sanity.sh).  But not here.  Maybe
1460 @c in some kind of "working directory" chapter which
1461 @c would encompass the "Builds" one?  But I'm not sure
1462 @c whether that is a good organization (is it based on
1463 @c what the user wants to do?).
1464
1465 @cindex CVS directory, in working directory
1466 While we are discussing @sc{cvs} internals which may
1467 become visible from time to time, we might as well talk
1468 about what @sc{cvs} puts in the @file{CVS} directories
1469 in the working directories.  As with the repository,
1470 @sc{cvs} handles this information and one can usually
1471 access it via @sc{cvs} commands.  But in some cases it
1472 may be useful to look at it, and other programs, such
1473 as the @code{jCVS} graphical user interface or the
1474 @code{VC} package for emacs, may need to look at it.
1475 Such programs should follow the recommendations in this
1476 section if they hope to be able to work with other
1477 programs which use those files, including future
1478 versions of the programs just mentioned and the
1479 command-line @sc{cvs} client.
1480
1481 The @file{CVS} directory contains several files.
1482 Programs which are reading this directory should
1483 silently ignore files which are in the directory but
1484 which are not documented here, to allow for future
1485 expansion.
1486
1487 The files are stored according to the text file
1488 convention for the system in question.  This means that
1489 working directories are not portable between systems
1490 with differing conventions for storing text files.
1491 This is intentional, on the theory that the files being
1492 managed by @sc{cvs} probably will not be portable between
1493 such systems either.
1494
1495 @table @file
1496 @item Root
1497 This file contains the current @sc{cvs} root, as
1498 described in @ref{Specifying a repository}.
1499
1500 @cindex Repository file, in CVS directory
1501 @cindex CVS/Repository file
1502 @item Repository
1503 This file contains the directory within the repository
1504 which the current directory corresponds with.  It can
1505 be either an absolute pathname or a relative pathname;
1506 @sc{cvs} has had the ability to read either format
1507 since at least version 1.3 or so.  The relative
1508 pathname is relative to the root, and is the more
1509 sensible approach, but the absolute pathname is quite
1510 common and implementations should accept either.  For
1511 example, after the command
1512
1513 @example
1514 cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1515 @end example
1516
1517 @noindent
1518 @file{Root} will contain
1519
1520 @example
1521 :local:/usr/local/cvsroot
1522 @end example
1523
1524 @noindent
1525 and @file{Repository} will contain either
1526
1527 @example
1528 /usr/local/cvsroot/yoyodyne/tc
1529 @end example
1530
1531 @noindent
1532 or
1533
1534 @example
1535 yoyodyne/tc
1536 @end example
1537
1538 If the particular working directory does not correspond
1539 to a directory in the repository, then @file{Repository}
1540 should contain @file{CVSROOT/Emptydir}.
1541 @cindex Emptydir, in CVSROOT directory
1542 @cindex CVSROOT/Emptydir directory
1543
1544 @cindex Entries file, in CVS directory
1545 @cindex CVS/Entries file
1546 @item Entries
1547 This file lists the files and directories in the
1548 working directory.
1549 The first character of each line indicates what sort of
1550 line it is.  If the character is unrecognized, programs
1551 reading the file should silently skip that line, to
1552 allow for future expansion.
1553
1554 If the first character is @samp{/}, then the format is:
1555
1556 @example
1557 /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1558 @end example
1559
1560 @noindent
1561 where @samp{[} and @samp{]} are not part of the entry,
1562 but instead indicate that the @samp{+} and conflict
1563 marker are optional.  @var{name} is the name of the
1564 file within the directory.  @var{revision} is the
1565 revision that the file in the working derives from, or
1566 @samp{0} for an added file, or @samp{-} followed by a
1567 revision for a removed file.  @var{timestamp} is the
1568 timestamp of the file at the time that @sc{cvs} created
1569 it; if the timestamp differs with the actual
1570 modification time of the file it means the file has
1571 been modified.  It is stored in
1572 the format used by the ISO C asctime() function (for
1573 example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1574 write a string which is not in that format, for
1575 example, @samp{Result of merge}, to indicate that the
1576 file should always be considered to be modified.  This
1577 is not a special case; to see whether a file is
1578 modified a program should take the timestamp of the file
1579 and simply do a string compare with @var{timestamp}.
1580 If there was a conflict, @var{conflict} can be set to
1581 the modification time of the file after the file has been
1582 written with conflict markers (@pxref{Conflicts example}).
1583 Thus if @var{conflict} is subsequently the same as the actual
1584 modification time of the file it means that the user
1585 has obviously not resolved the conflict.  @var{options}
1586 contains sticky options (for example @samp{-kb} for a
1587 binary file).  @var{tagdate} contains @samp{T} followed
1588 by a tag name, or @samp{D} for a date, followed by a
1589 sticky tag or date.  Note that if @var{timestamp}
1590 contains a pair of timestamps separated by a space,
1591 rather than a single timestamp, you are dealing with a
1592 version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1593 documented here).
1594
1595 The timezone on the timestamp in CVS/Entries (local or
1596 universal) should be the same as the operating system
1597 stores for the timestamp of the file itself.  For
1598 example, on Unix the file's timestamp is in universal
1599 time (UT), so the timestamp in CVS/Entries should be
1600 too.  On @sc{vms}, the file's timestamp is in local
1601 time, so @sc{cvs} on @sc{vms} should use local time.
1602 This rule is so that files do not appear to be modified
1603 merely because the timezone changed (for example, to or
1604 from summer time).
1605 @c See comments and calls to gmtime() and friends in
1606 @c src/vers_ts.c (function time_stamp).
1607
1608 If the first character of a line in @file{Entries} is
1609 @samp{D}, then it indicates a subdirectory.  @samp{D}
1610 on a line all by itself indicates that the program
1611 which wrote the @file{Entries} file does record
1612 subdirectories (therefore, if there is such a line and
1613 no other lines beginning with @samp{D}, one knows there
1614 are no subdirectories).  Otherwise, the line looks
1615 like:
1616
1617 @example
1618 D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1619 @end example
1620
1621 @noindent
1622 where @var{name} is the name of the subdirectory, and
1623 all the @var{filler} fields should be silently ignored,
1624 for future expansion.  Programs which modify
1625 @code{Entries} files should preserve these fields.
1626
1627 The lines in the @file{Entries} file can be in any order.
1628
1629 @cindex Entries.Log file, in CVS directory
1630 @cindex CVS/Entries.Log file
1631 @item Entries.Log
1632 This file does not record any information beyond that
1633 in @file{Entries}, but it does provide a way to update
1634 the information without having to rewrite the entire
1635 @file{Entries} file, including the ability to preserve
1636 the information even if the program writing
1637 @file{Entries} and @file{Entries.Log} abruptly aborts.
1638 Programs which are reading the @file{Entries} file
1639 should also check for @file{Entries.Log}.  If the latter
1640 exists, they should read @file{Entries} and then apply
1641 the changes mentioned in @file{Entries.Log}.  After
1642 applying the changes, the recommended practice is to
1643 rewrite @file{Entries} and then delete @file{Entries.Log}.
1644 The format of a line in @file{Entries.Log} is a single
1645 character command followed by a space followed by a
1646 line in the format specified for a line in
1647 @file{Entries}.  The single character command is
1648 @samp{A} to indicate that the entry is being added,
1649 @samp{R} to indicate that the entry is being removed,
1650 or any other character to indicate that the entire line
1651 in @file{Entries.Log} should be silently ignored (for
1652 future expansion).  If the second character of the line
1653 in @file{Entries.Log} is not a space, then it was
1654 written by an older version of @sc{cvs} (not documented
1655 here).
1656
1657 Programs which are writing rather than reading can
1658 safely ignore @file{Entries.Log} if they so choose.
1659
1660 @cindex Entries.Backup file, in CVS directory
1661 @cindex CVS/Entries.Backup file
1662 @item Entries.Backup
1663 This is a temporary file.  Recommended usage is to
1664 write a new entries file to @file{Entries.Backup}, and
1665 then to rename it (atomically, where possible) to @file{Entries}.
1666
1667 @cindex Entries.Static file, in CVS directory
1668 @cindex CVS/Entries.Static file
1669 @item Entries.Static
1670 The only relevant thing about this file is whether it
1671 exists or not.  If it exists, then it means that only
1672 part of a directory was gotten and @sc{cvs} will
1673 not create additional files in that directory.  To
1674 clear it, use the @code{update} command with the
1675 @samp{-d} option, which will get the additional files
1676 and remove @file{Entries.Static}.
1677 @c FIXME: This needs to be better documented, in places
1678 @c other than Working Directory Storage.
1679 @c FIXCVS: The fact that this setting exists needs to
1680 @c be more visible to the user.  For example "cvs
1681 @c status foo", in the case where the file would be
1682 @c gotten except for Entries.Static, might say
1683 @c something to distinguish this from other cases.
1684 @c One thing that periodically gets suggested is to
1685 @c have "cvs update" print something when it skips
1686 @c files due to Entries.Static, but IMHO that kind of
1687 @c noise pretty much makes the Entries.Static feature
1688 @c useless.
1689
1690 @cindex Tag file, in CVS directory
1691 @cindex CVS/Tag file
1692 @cindex Sticky tags/dates, per-directory
1693 @cindex Per-directory sticky tags/dates
1694 @item Tag
1695 This file contains per-directory sticky tags or dates.
1696 The first character is @samp{T} for a branch tag,
1697 @samp{N} for a non-branch tag, or @samp{D} for a date,
1698 or another character to mean the file should be
1699 silently ignored, for future expansion.  This character
1700 is followed by the tag or date.  Note that
1701 per-directory sticky tags or dates are used for things
1702 like applying to files which are newly added; they
1703 might not be the same as the sticky tags or dates on
1704 individual files.  For general information on sticky
1705 tags and dates, see @ref{Sticky tags}.
1706 @c FIXME: This needs to be much better documented,
1707 @c preferably not in the context of "working directory
1708 @c storage".
1709 @c FIXME: The Sticky tags node needs to discuss, or xref to
1710 @c someplace which discusses, per-directory sticky
1711 @c tags and the distinction with per-file sticky tags.
1712
1713 @cindex Notify file, in CVS directory
1714 @cindex CVS/Notify file
1715 @item Notify
1716 This file stores notifications (for example, for
1717 @code{edit} or @code{unedit}) which have not yet been
1718 sent to the server.  Its format is not yet documented
1719 here.
1720
1721 @cindex Notify.tmp file, in CVS directory
1722 @cindex CVS/Notify.tmp file
1723 @item Notify.tmp
1724 This file is to @file{Notify} as @file{Entries.Backup}
1725 is to @file{Entries}.  That is, to write @file{Notify},
1726 first write the new contents to @file{Notify.tmp} and
1727 then (atomically where possible), rename it to
1728 @file{Notify}.
1729
1730 @cindex Base directory, in CVS directory
1731 @cindex CVS/Base directory
1732 @item Base
1733 If watches are in use, then an @code{edit} command
1734 stores the original copy of the file in the @file{Base}
1735 directory.  This allows the @code{unedit} command to
1736 operate even if it is unable to communicate with the
1737 server.
1738
1739 @cindex Baserev file, in CVS directory
1740 @cindex CVS/Baserev file
1741 @item Baserev
1742 The file lists the revision for each of the files in
1743 the @file{Base} directory.  The format is:
1744
1745 @example
1746 B@var{name}/@var{rev}/@var{expansion}
1747 @end example
1748
1749 @noindent
1750 where @var{expansion} should be ignored, to allow for
1751 future expansion.
1752
1753 @cindex Baserev.tmp file, in CVS directory
1754 @cindex CVS/Baserev.tmp file
1755 @item Baserev.tmp
1756 This file is to @file{Baserev} as @file{Entries.Backup}
1757 is to @file{Entries}.  That is, to write @file{Baserev},
1758 first write the new contents to @file{Baserev.tmp} and
1759 then (atomically where possible), rename it to
1760 @file{Baserev}.
1761
1762 @cindex Template file, in CVS directory
1763 @cindex CVS/Template file
1764 @item Template
1765 This file contains the template specified by the
1766 @file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1767 by the client; the non-client/server @sc{cvs} consults
1768 @file{rcsinfo} directly.
1769 @end table
1770
1771 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1772 @node Intro administrative files
1773 @section The administrative files
1774 @cindex Administrative files (intro)
1775 @cindex Modules file
1776 @cindex CVSROOT, module name
1777 @cindex Defining modules (intro)
1778
1779 @c FIXME: this node should be reorganized into "general
1780 @c information about admin files" and put the "editing
1781 @c admin files" stuff up front rather than jumping into
1782 @c the details of modules right away.  Then the
1783 @c Administrative files node can go away, the information
1784 @c on each admin file distributed to a place appropriate
1785 @c to its function, and this node can contain a table
1786 @c listing each file and a @ref to its detailed description.
1787
1788 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1789 files}.  @xref{Administrative files}, for a complete description.
1790 You can use @sc{cvs} without any of these files, but
1791 some commands work better when at least the
1792 @file{modules} file is properly set up.
1793
1794 The most important of these files is the @file{modules}
1795 file.  It defines all modules in the repository.  This
1796 is a sample @file{modules} file.
1797
1798 @c FIXME: The CVSROOT line is a goofy example now that
1799 @c mkmodules doesn't exist.
1800 @example
1801 CVSROOT         CVSROOT
1802 modules         CVSROOT modules
1803 cvs             gnu/cvs
1804 rcs             gnu/rcs
1805 diff            gnu/diff
1806 tc              yoyodyne/tc
1807 @end example
1808
1809 The @file{modules} file is line oriented.  In its
1810 simplest form each line contains the name of the
1811 module, whitespace, and the directory where the module
1812 resides.  The directory is a path relative to
1813 @code{$CVSROOT}.  The last four lines in the example
1814 above are examples of such lines.
1815
1816 @c FIXME: might want to introduce the concept of options in modules file
1817 @c (the old example which was here, -i mkmodules, is obsolete).
1818
1819 The line that defines the module called @samp{modules}
1820 uses features that are not explained here.
1821 @xref{modules}, for a full explanation of all the
1822 available features.
1823
1824 @c FIXME: subsection without node is bogus
1825 @subsection Editing administrative files
1826 @cindex Editing administrative files
1827 @cindex Administrative files, editing them
1828
1829 You edit the administrative files in the same way that you would edit
1830 any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1831 copy, edit it, and commit your changes in the normal way.
1832
1833 It is possible to commit an erroneous administrative
1834 file.  You can often fix the error and check in a new
1835 revision, but sometimes a particularly bad error in the
1836 administrative file makes it impossible to commit new
1837 revisions.
1838 @c @xref{Bad administrative files} for a hint
1839 @c about how to solve such situations.
1840 @c -- administrative file checking--
1841
1842 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1843 @node Multiple repositories
1844 @section Multiple repositories
1845 @cindex Multiple repositories
1846 @cindex Repositories, multiple
1847 @cindex Many repositories
1848 @cindex Parallel repositories
1849 @cindex Disjoint repositories
1850 @cindex CVSROOT, multiple repositories
1851
1852 In some situations it is a good idea to have more than
1853 one repository, for instance if you have two
1854 development groups that work on separate projects
1855 without sharing any code.  All you have to do to have
1856 several repositories is to specify the appropriate
1857 repository, using the @code{CVSROOT} environment
1858 variable, the @samp{-d} option to @sc{cvs}, or (once
1859 you have checked out a working directory) by simply
1860 allowing @sc{cvs} to use the repository that was used
1861 to check out the working directory
1862 (@pxref{Specifying a repository}).
1863
1864 The big advantage of having multiple repositories is
1865 that they can reside on different servers.  With @sc{cvs}
1866 version 1.10, a single command cannot recurse into
1867 directories from different repositories.  With development
1868 versions of @sc{cvs}, you can check out code from multiple
1869 servers into your working directory.  @sc{cvs} will
1870 recurse and handle all the details of making
1871 connections to as many server machines as necessary to
1872 perform the requested command.  Here is an example of
1873 how to set up a working directory:
1874
1875 @example
1876 cvs -d server1:/cvs co dir1
1877 cd dir1
1878 cvs -d server2:/root co sdir
1879 cvs update
1880 @end example
1881
1882 The @code{cvs co} commands set up the working
1883 directory, and then the @code{cvs update} command will
1884 contact server2, to update the dir1/sdir subdirectory,
1885 and server1, to update everything else.
1886
1887 @c FIXME: Does the FAQ have more about this?  I have a
1888 @c dim recollection, but I'm too lazy to check right now.
1889
1890 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1891 @node Creating a repository
1892 @section Creating a repository
1893
1894 @cindex Repository, setting up
1895 @cindex Creating a repository
1896 @cindex Setting up a repository
1897
1898 To set up a @sc{cvs} repository, first choose the
1899 machine and disk on which you want to store the
1900 revision history of the source files.  CPU and memory
1901 requirements are modest, so most machines should be
1902 adequate.  For details see @ref{Server requirements}.
1903 @c Possible that we should be providing a quick rule of
1904 @c thumb, like the 32M memory for the server.  That
1905 @c might increase the number of people who are happy
1906 @c with the answer, without following the xref.
1907
1908 To estimate disk space
1909 requirements, if you are importing RCS files from
1910 another system, the size of those files is the
1911 approximate initial size of your repository, or if you
1912 are starting without any version history, a rule of
1913 thumb is to allow for the server approximately three
1914 times the size of the code to be under @sc{cvs} for the
1915 repository (you will eventually outgrow this, but not
1916 for a while).  On the machines on which the developers
1917 will be working, you'll want disk space for
1918 approximately one working directory for each developer
1919 (either the entire tree or a portion of it, depending
1920 on what each developer uses).
1921
1922 The repository should be accessible
1923 (directly or via a networked file system) from all
1924 machines which want to use @sc{cvs} in server or local
1925 mode; the client machines need not have any access to
1926 it other than via the @sc{cvs} protocol.  It is not
1927 possible to use @sc{cvs} to read from a repository
1928 which one only has read access to; @sc{cvs} needs to be
1929 able to create lock files (@pxref{Concurrency}).
1930
1931 @cindex init (subcommand)
1932 To create a repository, run the @code{cvs init}
1933 command.  It will set up an empty repository in the
1934 @sc{cvs} root specified in the usual way
1935 (@pxref{Repository}).  For example,
1936
1937 @example
1938 cvs -d /usr/local/cvsroot init
1939 @end example
1940
1941 @code{cvs init} is careful to never overwrite any
1942 existing files in the repository, so no harm is done if
1943 you run @code{cvs init} on an already set-up
1944 repository.
1945
1946 @code{cvs init} will enable history logging; if you
1947 don't want that, remove the history file after running
1948 @code{cvs init}.  @xref{history file}.
1949
1950 @node Backing up
1951 @section Backing up a repository
1952 @cindex Repository, backing up
1953 @cindex Backing up, repository
1954
1955 There is nothing particularly magical about the files
1956 in the repository; for the most part it is possible to
1957 back them up just like any other files.  However, there
1958 are a few issues to consider.
1959
1960 @cindex Locks, cvs, and backups
1961 @cindex #cvs.rfl, and backups
1962 The first is that to be paranoid, one should either not
1963 use @sc{cvs} during the backup, or have the backup
1964 program lock @sc{cvs} while doing the backup.  To not
1965 use @sc{cvs}, you might forbid logins to machines which
1966 can access the repository, turn off your @sc{cvs}
1967 server, or similar mechanisms.  The details would
1968 depend on your operating system and how you have
1969 @sc{cvs} set up.  To lock @sc{cvs}, you would create
1970 @file{#cvs.rfl} locks in each repository directory.
1971 See @ref{Concurrency}, for more on @sc{cvs} locks.
1972 Having said all this, if you just back up without any
1973 of these precautions, the results are unlikely to be
1974 particularly dire.  Restoring from backup, the
1975 repository might be in an inconsistent state, but this
1976 would not be particularly hard to fix manually.
1977
1978 When you restore a repository from backup, assuming
1979 that changes in the repository were made after the time
1980 of the backup, working directories which were not
1981 affected by the failure may refer to revisions which no
1982 longer exist in the repository.  Trying to run @sc{cvs}
1983 in such directories will typically produce an error
1984 message.  One way to get those changes back into the
1985 repository is as follows:
1986
1987 @itemize @bullet
1988 @item
1989 Get a new working directory.
1990
1991 @item
1992 Copy the files from the working directory from before
1993 the failure over to the new working directory (do not
1994 copy the contents of the @file{CVS} directories, of
1995 course).
1996
1997 @item
1998 Working in the new working directory, use commands such
1999 as @code{cvs update} and @code{cvs diff} to figure out
2000 what has changed, and then when you are ready, commit
2001 the changes into the repository.
2002 @end itemize
2003
2004 @node Moving a repository
2005 @section Moving a repository
2006 @cindex Repository, moving
2007 @cindex Moving a repository
2008 @cindex Copying a repository
2009
2010 Just as backing up the files in the repository is
2011 pretty much like backing up any other files, if you
2012 need to move a repository from one place to another it
2013 is also pretty much like just moving any other
2014 collection of files.
2015
2016 The main thing to consider is that working directories
2017 point to the repository.  The simplest way to deal with
2018 a moved repository is to just get a fresh working
2019 directory after the move.  Of course, you'll want to
2020 make sure that the old working directory had been
2021 checked in before the move, or you figured out some
2022 other way to make sure that you don't lose any
2023 changes.  If you really do want to reuse the existing
2024 working directory, it should be possible with manual
2025 surgery on the @file{CVS/Repository} files.  You can
2026 see @ref{Working directory storage}, for information on
2027 the @file{CVS/Repository} and @file{CVS/Root} files, but
2028 unless you are sure you want to bother, it probably
2029 isn't worth it.
2030 @c FIXME: Surgery on CVS/Repository should be avoided
2031 @c by making RELATIVE_REPOS the default.
2032 @c FIXME-maybe: might want some documented way to
2033 @c change the CVS/Root files in some particular tree.
2034 @c But then again, I don't know, maybe just having
2035 @c people do this in perl/shell/&c isn't so bad...
2036
2037 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2038 @node Remote repositories
2039 @section Remote repositories
2040 @cindex Repositories, remote
2041 @cindex Remote repositories
2042 @cindex Client/Server Operation
2043 @cindex Server, CVS
2044 @cindex Remote repositories, port specification
2045 @cindex Repositories, remote, port specification
2046 @cindex Client/Server Operation, port specification
2047 @cindex pserver (client/server connection method), port specification
2048 @cindex kserver (client/server connection method), port specification
2049 @cindex gserver (client/server connection method), port specification
2050 @cindex port, specifying for remote repositories
2051
2052         Your working copy of the sources can be on a
2053 different machine than the repository.  Using @sc{cvs}
2054 in this manner is known as @dfn{client/server}
2055 operation.  You run @sc{cvs} on a machine which can
2056 mount your working directory, known as the
2057 @dfn{client}, and tell it to communicate to a machine
2058 which can mount the repository, known as the
2059 @dfn{server}.  Generally, using a remote
2060 repository is just like using a local one, except that
2061 the format of the repository name is:
2062
2063 @example
2064 [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2065 @end example
2066
2067 Specifying a password in the repository name is not recommended during
2068 checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2069 password in each created directory.  @code{cvs login} first instead
2070 (@pxref{Password authentication client}).
2071
2072 The details of exactly what needs to be set up depend
2073 on how you are connecting to the server.
2074
2075 If @var{method} is not specified, and the repository
2076 name does not start with a @samp{/}, then the default is @code{ext}
2077 or @code{server}, depending on your platform; both are
2078 described in @ref{Connecting via rsh}.
2079
2080 @cindex connection method options
2081 @cindex options, connection method
2082 @cindex proxies, web, using
2083 @cindex web proxies, using
2084 The @code{gserver} and @code{pserver} connection
2085 methods all accept optional method options, specified as part of the
2086 @var{method} string, like so:
2087
2088 @example
2089 :@var{method}[;@var{option}=@var{arg}...]:
2090 @end example
2091
2092 Currently, the only two valid connection options are @code{proxy}, which
2093 takes a hostname as an argument, and @code{proxyport}, which takes a port
2094 number as an argument.  These options can be used to connect via an HTTP
2095 tunnel style web proxy.  For example, to connect pserver via a web proxy
2096 at www.myproxy.net and port 8000, you would use a method of:
2097
2098 @example
2099 :pserver;proxy=www.myproxy.net;proxyport=8000:
2100 @end example
2101
2102 @strong{NOTE: The rest of the connection string is required to connect to
2103 the server as noted in the upcoming sections on password authentication,
2104 gserver and kserver.  The example above would only modify the @var{method}
2105 portion of the repository name.}
2106
2107 @cindex CVS_PROXY_PORT
2108 @var{proxy} must be supplied to connect to a CVS server via a
2109 proxy server, but @var{proxyport} will default to port 8080 if not supplied.
2110 @var{PROXYPORT} may also be set via the @var{CVS_PROXY_PORT} environment
2111 variable.
2112 @c Should we try to explain which platforms are which?
2113 @c Platforms like unix and VMS, which only allow
2114 @c privileged programs to bind to sockets <1024 lose on
2115 @c :server:
2116 @c Platforms like Mac and VMS, whose rsh program is
2117 @c unusable or nonexistent, lose on :ext:
2118 @c Platforms like OS/2 and NT probably could plausibly
2119 @c default either way (modulo -b troubles).
2120
2121 @c FIXME: We need to have a better way of explaining
2122 @c what method to use.  This presentation totally
2123 @c obscures the fact that :ext: and CVS_RSH is the way to
2124 @c use SSH, for example.  Plus it incorrectly implies
2125 @c that you need an @code{rsh} binary on the client to use
2126 @c :server:.
2127 @c Also note that rsh not pserver is the right choice if you want
2128 @c users to be able to create their own repositories
2129 @c (because of the --allow-root related issues).
2130 @menu
2131 * Server requirements::         Memory and other resources for servers
2132 * Connecting via rsh::          Using the @code{rsh} program to connect
2133 * Password authenticated::      Direct connections using passwords
2134 * GSSAPI authenticated::        Direct connections using GSSAPI
2135 * Kerberos authenticated::      Direct connections with Kerberos
2136 * Connecting via fork::         Using a forked @code{cvs server} to connect
2137 @end menu
2138
2139 @node Server requirements
2140 @subsection Server requirements
2141
2142 The quick answer to what sort of machine is suitable as
2143 a server is that requirements are modest---a server
2144 with 32M of memory or even less can handle a fairly
2145 large source tree with a fair amount of activity.
2146 @c Say something about CPU speed too?  I'm even less sure
2147 @c what to say on that subject...
2148
2149 The real answer, of course, is more complicated.
2150 Estimating the known areas of large memory consumption
2151 should be sufficient to estimate memory requirements.
2152 There are two such areas documented here; other memory
2153 consumption should be small by comparison (if you find
2154 that is not the case, let us know, as described in
2155 @ref{BUGS}, so we can update this documentation).
2156
2157 The first area of big memory consumption is large
2158 checkouts, when using the @sc{cvs} server.  The server
2159 consists of two processes for each client that it is
2160 serving.  Memory consumption on the child process
2161 should remain fairly small.  Memory consumption on the
2162 parent process, particularly if the network connection
2163 to the client is slow, can be expected to grow to
2164 slightly more than the size of the sources in a single
2165 directory, or two megabytes, whichever is larger.
2166 @c "two megabytes" of course is SERVER_HI_WATER.  But
2167 @c we don't mention that here because we are
2168 @c documenting the default configuration of CVS.  If it
2169 @c is a "standard" thing to change that value, it
2170 @c should be some kind of run-time configuration.
2171 @c
2172 @c See cvsclient.texi for more on the design decision
2173 @c to not have locks in place while waiting for the
2174 @c client, which is what results in memory consumption
2175 @c as high as this.
2176
2177 Multiplying the size of each @sc{cvs} server by the
2178 number of servers which you expect to have active at
2179 one time should give an idea of memory requirements for
2180 the server.  For the most part, the memory consumed by
2181 the parent process probably can be swap space rather
2182 than physical memory.
2183 @c Has anyone verified that notion about swap space?
2184 @c I say it based pretty much on guessing that the
2185 @c ->text of the struct buffer_data only gets accessed
2186 @c in a first in, first out fashion, but I haven't
2187 @c looked very closely.
2188
2189 @c What about disk usage in /tmp on the server?  I think that
2190 @c it can be substantial, but I haven't looked at this
2191 @c again and tried to figure it out ("cvs import" is
2192 @c probably the worst case...).
2193
2194 The second area of large memory consumption is
2195 @code{diff}, when checking in large files.  This is
2196 required even for binary files.  The rule of thumb is
2197 to allow about ten times the size of the largest file
2198 you will want to check in, although five times may be
2199 adequate.  For example, if you want to check in a file
2200 which is 10 megabytes, you should have 100 megabytes of
2201 memory on the machine doing the checkin (the server
2202 machine for client/server, or the machine running
2203 @sc{cvs} for non-client/server).  This can be swap
2204 space rather than physical memory.  Because the memory
2205 is only required briefly, there is no particular need
2206 to allow memory for more than one such checkin at a
2207 time.
2208 @c The 5-10 times rule of thumb is from Paul Eggert for
2209 @c GNU diff.  I don't think it is in the GNU diff
2210 @c manual or anyplace like that.
2211 @c
2212 @c Probably we could be saying more about
2213 @c non-client/server CVS.
2214 @c I would guess for non-client/server CVS in an NFS
2215 @c environment the biggest issues are the network and
2216 @c the NFS server.
2217
2218 Resource consumption for the client is even more
2219 modest---any machine with enough capacity to run the
2220 operating system in question should have little
2221 trouble.
2222 @c Is that true?  I think the client still wants to
2223 @c (bogusly) store entire files in memory at times.
2224
2225 For information on disk space requirements, see
2226 @ref{Creating a repository}.
2227
2228 @node Connecting via rsh
2229 @subsection Connecting with rsh
2230
2231 @cindex rsh
2232 @sc{cvs} uses the @samp{rsh} protocol to perform these
2233 operations, so the remote user host needs to have a
2234 @file{.rhosts} file which grants access to the local
2235 user. Note that the program that @sc{cvs} uses for this
2236 purpose may be specified using the @file{--with-rsh}
2237 flag to configure.
2238
2239 For example, suppose you are the user @samp{mozart} on
2240 the local machine @samp{toe.example.com}, and the
2241 server machine is @samp{faun.example.org}.  On
2242 faun, put the following line into the file
2243 @file{.rhosts} in @samp{bach}'s home directory:
2244
2245 @example
2246 toe.example.com  mozart
2247 @end example
2248
2249 @noindent
2250 Then test that @samp{rsh} is working with
2251
2252 @example
2253 rsh -l bach faun.example.org 'echo $PATH'
2254 @end example
2255
2256 @cindex CVS_SERVER, environment variable
2257 Next you have to make sure that @code{rsh} will be able
2258 to find the server.  Make sure that the path which
2259 @code{rsh} printed in the above example includes the
2260 directory containing a program named @code{cvs} which
2261 is the server.  You need to set the path in
2262 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2263 or @file{.profile}.  Alternately, you can set the
2264 environment variable @code{CVS_SERVER} on the client
2265 machine to the filename of the server you want to use,
2266 for example @file{/usr/local/bin/cvs-1.6}.
2267 @c FIXME: there should be a way to specify the
2268 @c program in CVSROOT, not CVS_SERVER, so that one can use
2269 @c different ones for different roots.  e.g. ":server;cvs=cvs-1.6:"
2270 @c instead of ":server:".
2271
2272 There is no need to edit @file{inetd.conf} or start a
2273 @sc{cvs} server daemon.
2274
2275 @cindex :server:, setting up
2276 @cindex :ext:, setting up
2277 @cindex Kerberos, using kerberized rsh
2278 @cindex SSH (rsh replacement)
2279 @cindex rsh replacements (Kerberized, SSH, &c)
2280 There are two access methods that you use in @code{CVSROOT}
2281 for rsh.  @code{:server:} specifies an internal rsh
2282 client, which is supported only by some @sc{cvs} ports.
2283 @code{:ext:} specifies an external rsh program.  By
2284 default this is @code{rsh} (unless otherwise specified
2285 by the @file{--with-rsh} flag to configure) but you may set the
2286 @code{CVS_RSH} environment variable to invoke another
2287 program which can access the remote server (for
2288 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2289 something different).  It must be a program which can
2290 transmit data to and from the server without modifying
2291 it; for example the Windows NT @code{rsh} is not
2292 suitable since it by default translates between CRLF
2293 and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2294 to @code{rsh} to get around this, but since this could
2295 potentially cause problems for programs other than the
2296 standard @code{rsh}, it may change in the future.  If
2297 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2298 replacement, the instructions in the rest of this
2299 section concerning @file{.rhosts} and so on are likely
2300 to be inapplicable; consult the documentation for your rsh
2301 replacement.
2302 @c FIXME: there should be a way to specify the
2303 @c program in CVSROOT, not CVS_RSH, so that one can use
2304 @c different ones for different roots.  e.g. ":ext;rsh=remsh:"
2305 @c instead of ":ext:".
2306 @c See also the comment in src/client.c for rationale
2307 @c concerning "rsh" being the default and never
2308 @c "remsh".
2309
2310 Continuing our example, supposing you want to access
2311 the module @file{foo} in the repository
2312 @file{/usr/local/cvsroot/}, on machine
2313 @file{faun.example.org}, you are ready to go:
2314
2315 @example
2316 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2317 @end example
2318
2319 @noindent
2320 (The @file{bach@@} can be omitted if the username is
2321 the same on both the local and remote hosts.)
2322
2323 @c Should we mention "rsh host echo hi" and "rsh host
2324 @c cat" (the latter followed by typing text and ^D)
2325 @c as troubleshooting techniques?  Probably yes
2326 @c (people tend to have trouble setting this up),
2327 @c but this kind of thing can be hard to spell out.
2328
2329 @node Password authenticated
2330 @subsection Direct connection with password authentication
2331
2332 The @sc{cvs} client can also connect to the server
2333 using a password protocol.  This is particularly useful
2334 if using @code{rsh} is not feasible (for example,
2335 the server is behind a firewall), and Kerberos also is
2336 not available.
2337
2338         To use this method, it is necessary to make
2339 some adjustments on both the server and client sides.
2340
2341 @menu
2342 * Password authentication server::     Setting up the server
2343 * Password authentication client::     Using the client
2344 * Password authentication security::   What this method does and does not do
2345 @end menu
2346
2347 @node Password authentication server
2348 @subsubsection Setting up the server for password authentication
2349
2350 First of all, you probably want to tighten the
2351 permissions on the @file{$CVSROOT} and
2352 @file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2353 authentication security}, for more details.
2354
2355 @cindex pserver (subcommand)
2356 @cindex Remote repositories, port specification
2357 @cindex Repositories, remote, port specification
2358 @cindex Client/Server Operation, port specification
2359 @cindex pserver (client/server connection method), port specification
2360 @cindex kserver (client/server connection method), port specification
2361 @cindex gserver (client/server connection method), port specification
2362 @cindex port, specifying for remote repositories
2363 @cindex Password server, setting up
2364 @cindex Authenticating server, setting up
2365 @cindex inetd, configuring for pserver
2366 @cindex xinetd, configuring for pserver
2367 @c FIXME: this isn't quite right regarding port
2368 @c numbers; CVS looks up "cvspserver" in
2369 @c /etc/services (on unix, but what about non-unix?).
2370 On the server side, the file @file{/etc/inetd.conf}
2371 needs to be edited so @code{inetd} knows to run the
2372 command @code{cvs pserver} when it receives a
2373 connection on the right port.  By default, the port
2374 number is 2401; it would be different if your client
2375 were compiled with @code{CVS_AUTH_PORT} defined to
2376 something else, though.  This can also be specified in the CVSROOT variable
2377 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2378 environment variable (@pxref{Environment variables}).
2379
2380         If your @code{inetd} allows raw port numbers in
2381 @file{/etc/inetd.conf}, then the following (all on a
2382 single line in @file{inetd.conf}) should be sufficient:
2383
2384 @example
2385 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
2386 cvs -f --allow-root=/usr/cvsroot pserver
2387 @end example
2388
2389 @noindent
2390 (You could also use the
2391 @samp{-T} option to specify a temporary directory.)
2392
2393 The @samp{--allow-root} option specifies the allowable
2394 @sc{cvsroot} directory.  Clients which attempt to use a
2395 different @sc{cvsroot} directory will not be allowed to
2396 connect.  If there is more than one @sc{cvsroot}
2397 directory which you want to allow, repeat the option.
2398 (Unfortunately, many versions of @code{inetd} have very small
2399 limits on the number of arguments and/or the total length
2400 of the command.  The usual solution to this problem is
2401 to have @code{inetd} run a shell script which then invokes
2402 @sc{cvs} with the necessary arguments.)
2403
2404         If your @code{inetd} wants a symbolic service
2405 name instead of a raw port number, then put this in
2406 @file{/etc/services}:
2407
2408 @example
2409 cvspserver      2401/tcp
2410 @end example
2411
2412 @noindent
2413 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2414
2415 If your system uses @code{xinetd} instead of @code{inetd},
2416 the procedure is slightly different.
2417 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2418
2419 @example
2420 service cvspserver
2421 @{
2422    port        = 2401
2423    socket_type = stream
2424    protocol    = tcp
2425    wait        = no
2426    user        = root
2427    passenv     = PATH
2428    server      = /usr/local/bin/cvs
2429    server_args = -f --allow-root=/usr/cvsroot pserver
2430 @}
2431 @end example
2432
2433 @noindent
2434 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2435 the @code{port} line.)
2436
2437         Once the above is taken care of, restart your
2438 @code{inetd}, or do whatever is necessary to force it
2439 to reread its initialization files.
2440
2441 If you are having trouble setting this up, see
2442 @ref{Connection}.
2443
2444 @cindex CVS passwd file
2445 @cindex passwd (admin file)
2446 Because the client stores and transmits passwords in
2447 cleartext (almost---see @ref{Password authentication
2448 security}, for details), a separate @sc{cvs} password
2449 file is generally used, so people don't compromise
2450 their regular passwords when they access the
2451 repository.  This file is
2452 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2453 administrative files}).  It uses a colon-separated
2454 format, similar to @file{/etc/passwd} on Unix systems,
2455 except that it has fewer fields: @sc{cvs} username,
2456 optional password, and an optional system username for
2457 @sc{cvs} to run as if authentication succeeds.  Here is
2458 an example @file{passwd} file with five entries:
2459
2460 @example
2461 anonymous:
2462 bach:ULtgRLXo7NRxs
2463 spwang:1sOp854gDF3DY
2464 melissa:tGX1fS8sun6rY:pubcvs
2465 qproj:XR4EZcEs0szik:pubcvs
2466 @end example
2467
2468 @noindent
2469 (The passwords are encrypted according to the standard
2470 Unix @code{crypt()} function, so it is possible to
2471 paste in passwords directly from regular Unix
2472 @file{/etc/passwd} files.)
2473
2474 The first line in the example will grant access to any
2475 @sc{cvs} client attempting to authenticate as user
2476 @code{anonymous}, no matter what password they use,
2477 including an empty password.  (This is typical for
2478 sites granting anonymous read-only access; for
2479 information on how to do the "read-only" part, see
2480 @ref{Read-only access}.)
2481
2482 The second and third lines will grant access to
2483 @code{bach} and @code{spwang} if they supply their
2484 respective plaintext passwords.
2485
2486 @cindex User aliases
2487 The fourth line will grant access to @code{melissa}, if
2488 she supplies the correct password, but her @sc{cvs}
2489 operations will actually run on the server side under
2490 the system user @code{pubcvs}.  Thus, there need not be
2491 any system user named @code{melissa}, but there
2492 @emph{must} be one named @code{pubcvs}.
2493
2494 The fifth line shows that system user identities can be
2495 shared: any client who successfully authenticates as
2496 @code{qproj} will actually run as @code{pubcvs}, just
2497 as @code{melissa} does.  That way you could create a
2498 single, shared system user for each project in your
2499 repository, and give each developer their own line in
2500 the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2501 username on each line would be different, but the
2502 system username would be the same.  The reason to have
2503 different @sc{cvs} usernames is that @sc{cvs} will log their
2504 actions under those names: when @code{melissa} commits
2505 a change to a project, the checkin is recorded in the
2506 project's history under the name @code{melissa}, not
2507 @code{pubcvs}.  And the reason to have them share a
2508 system username is so that you can arrange permissions
2509 in the relevant area of the repository such that only
2510 that account has write-permission there.
2511
2512 If the system-user field is present, all
2513 password-authenticated @sc{cvs} commands run as that
2514 user; if no system user is specified, @sc{cvs} simply
2515 takes the @sc{cvs} username as the system username and
2516 runs commands as that user.  In either case, if there
2517 is no such user on the system, then the @sc{cvs}
2518 operation will fail (regardless of whether the client
2519 supplied a valid password).
2520
2521 The password and system-user fields can both be omitted
2522 (and if the system-user field is omitted, then also
2523 omit the colon that would have separated it from the
2524 encrypted password).  For example, this would be a
2525 valid @file{$CVSROOT/CVSROOT/passwd} file:
2526
2527 @example
2528 anonymous::pubcvs
2529 fish:rKa5jzULzmhOo:kfogel
2530 sussman:1sOp854gDF3DY
2531 @end example
2532
2533 @noindent
2534 When the password field is omitted or empty, then the
2535 client's authentication attempt will succeed with any
2536 password, including the empty string.  However, the
2537 colon after the @sc{cvs} username is always necessary,
2538 even if the password is empty.
2539
2540 @sc{cvs} can also fall back to use system authentication.
2541 When authenticating a password, the server first checks
2542 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2543 file.  If it finds the user, it will use that entry for
2544 authentication as described above.  But if it does not
2545 find the user, or if the @sc{cvs} @file{passwd} file
2546 does not exist, then the server can try to authenticate
2547 the username and password using the operating system's
2548 user-lookup routines (this "fallback" behavior can be
2549 disabled by setting @code{SystemAuth=no} in the
2550 @sc{cvs} @file{config} file, @pxref{config}).
2551
2552 The default fallback behavior is to look in 
2553 @file{/etc/passwd} for this system password unless your
2554 system has PAM (Pluggable Authentication Modules)
2555 and your @sc{cvs} server executable was configured to
2556 use it at compile time (using @code{./configure --enable-pam} - see the
2557 INSTALL file for more).  In this case, PAM will be consulted instead.
2558 This means that @sc{cvs} can be configured to use any password
2559 authentication source PAM can be configured to use (possibilities
2560 include a simple UNIX password, NIS, LDAP, and others) in its
2561 global configuration file (usually @file{/etc/pam.conf}
2562 or possibly @file{/etc/pam.d/cvs}).  See your PAM documentation
2563 for more details on PAM configuration.
2564
2565 Note that PAM is an experimental feature in @sc{cvs} and feedback is
2566 encouraged.  Please send a mail to one of the @sc{cvs} mailing lists
2567 (@code{info-cvs@@gnu.org} or @code{bug-cvs@@gnu.org}) if you use the 
2568 @sc{cvs} PAM support.
2569
2570 @strong{WARNING: Using PAM gives the system administrator much more 
2571 flexibility about how @sc{cvs} users are authenticated but 
2572 no more security than other methods.  See below for more.} 
2573
2574 CVS needs an "auth" and "account" module in the 
2575 PAM configuration file. A typical PAM configuration 
2576 would therefore have the following lines 
2577 in @file{/etc/pam.conf} to emulate the standard @sc{cvs} 
2578 system @file{/etc/passwd} authentication:
2579
2580 @example
2581 cvs     auth        required    pam_unix.so
2582 cvs     account     required    pam_unix.so
2583 @end example
2584
2585 The the equivalent @file{/etc/pam.d/cvs} would contain
2586
2587 @example
2588 auth        required    pam_unix.so
2589 account     required    pam_unix.so
2590 @end example
2591
2592 Some systems require a full path to the module so that
2593 @file{pam_unix.so} (Linux) would become something like 
2594 @file{/usr/lib/security/$ISA/pam_unix.so.1} (Sun Solaris).
2595 See the @file{contrib/pam} subdirectory of the @sc{cvs}
2596 source distribution for further example configurations.
2597
2598 The PAM service name given above as "cvs" is just
2599 the service name in the default configuration and can be
2600 set using
2601 @code{./configure --with-hardcoded-pam-service-name=<pam-service-name>}
2602 before compiling.  @sc{cvs} can also be configured to use whatever
2603 name it is invoked as as its PAM service name using
2604 @code{./configure --without-hardcoded-pam-service-name}, but this
2605 feature should not be used if you may not have control of the name
2606 @sc{cvs} will be invoked as.
2607
2608 Be aware, also, that falling back to system
2609 authentication might be a security risk: @sc{cvs}
2610 operations would then be authenticated with that user's
2611 regular login password, and the password flies across
2612 the network in plaintext.  See @ref{Password
2613 authentication security} for more on this.
2614 This may be more of a problem with PAM authentication
2615 because it is likely that the source of the system 
2616 password is some central authentication service like
2617 LDAP which is also used to authenticate other services.
2618
2619 On the other hand, PAM makes it very easy to change your password
2620 regularly.  If they are given the option of a one-password system for
2621 all of their activities, users are often more willing to change their
2622 password on a regular basis.
2623
2624 In the non-PAM configuration where the password is stored in the
2625 @file{CVSROOT/passwd} file, it is difficult to change passwords on a
2626 regular basis since only administrative users (or in some cases
2627 processes that act as an administrative user) are typically given
2628 access to modify this file.  Either there needs to be some
2629 hand-crafted web page or set-uid program to update the file, or the
2630 update needs to be done by submitting a request to an administrator to
2631 perform the duty by hand.  In the first case, having to remember to
2632 update a separate password on a periodic basis can be difficult.  In
2633 the second case, the manual nature of the change will typically mean
2634 that the password will not be changed unless it is absolutely
2635 necessary.
2636
2637 Note that PAM administrators should probably avoid configuring
2638 one-time-passwords (OTP) for @sc{cvs} authentication/authorization.  If
2639 OTPs are desired, the administrator may wish to encourage the use of
2640 one of the other Client/Server access methods.  See the section on
2641 @pxref{Remote repositories} for a list of other methods.
2642
2643 Right now, the only way to put a password in the
2644 @sc{cvs} @file{passwd} file is to paste it there from
2645 somewhere else.  Someday, there may be a @code{cvs
2646 passwd} command.
2647
2648 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2649 is normal to edit the @file{passwd} file in-place,
2650 rather than via @sc{cvs}.  This is because of the
2651 possible security risks of having the @file{passwd}
2652 file checked out to people's working copies.  If you do
2653 want to include the @file{passwd} file in checkouts of
2654 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2655
2656 @c We might also suggest using the @code{htpasswd} command
2657 @c from freely available web servers as well, but that
2658 @c would open up a can of worms in that the users next
2659 @c questions are likely to be "where do I get it?" and
2660 @c "how do I use it?"
2661 @c Also note that htpasswd, at least the version I had,
2662 @c likes to clobber the third field.
2663
2664 @node Password authentication client
2665 @subsubsection Using the client with password authentication
2666 @cindex Login (subcommand)
2667 @cindex Password client, using
2668 @cindex Authenticated client, using
2669 @cindex :pserver:, setting up
2670 To run a @sc{cvs} command on a remote repository via
2671 the password-authenticating server, one specifies the
2672 @code{pserver} protocol, optional username, repository host, an
2673 optional port number, and path to the repository.  For example:
2674
2675 @example
2676 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2677 @end example
2678
2679 @noindent
2680 or
2681
2682 @example
2683 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2684 cvs checkout someproj
2685 @end example
2686
2687 However, unless you're connecting to a public-access
2688 repository (i.e., one where that username doesn't
2689 require a password), you'll need to supply a password or @dfn{log in} first.
2690 Logging in verifies your password with the repository and stores it in a file.
2691 It's done with the @code{login} command, which will
2692 prompt you interactively for the password if you didn't supply one as part of
2693 @var{$CVSROOT}:
2694
2695 @example
2696 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2697 CVS password:
2698 @end example
2699
2700 @noindent
2701 or
2702
2703 @example
2704 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2705 @end example
2706
2707 After you enter the password, @sc{cvs} verifies it with
2708 the server.  If the verification succeeds, then that
2709 combination of username, host, repository, and password
2710 is permanently recorded, so future transactions with
2711 that repository won't require you to run @code{cvs
2712 login}.  (If verification fails, @sc{cvs} will exit
2713 complaining that the password was incorrect, and
2714 nothing will be recorded.)
2715
2716 The records are stored, by default, in the file
2717 @file{$HOME/.cvspass}.  That file's format is
2718 human-readable, and to a degree human-editable, but
2719 note that the passwords are not stored in
2720 cleartext---they are trivially encoded to protect them
2721 from "innocent" compromise (i.e., inadvertent viewing
2722 by a system administrator or other non-malicious
2723 person).
2724
2725 @cindex CVS_PASSFILE, environment variable
2726 You can change the default location of this file by
2727 setting the @code{CVS_PASSFILE} environment variable.
2728 If you use this variable, make sure you set it
2729 @emph{before} @code{cvs login} is run.  If you were to
2730 set it after running @code{cvs login}, then later
2731 @sc{cvs} commands would be unable to look up the
2732 password for transmission to the server.
2733   
2734 Once you have logged in, all @sc{cvs} commands using
2735 that remote repository and username will authenticate
2736 with the stored password.  So, for example
2737   
2738 @example
2739 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2740 @end example
2741
2742 @noindent
2743 should just work (unless the password changes on the
2744 server side, in which case you'll have to re-run
2745 @code{cvs login}).
2746
2747 Note that if the @samp{:pserver:} were not present in
2748 the repository specification, @sc{cvs} would assume it
2749 should use @code{rsh} to connect with the server
2750 instead (@pxref{Connecting via rsh}).
2751
2752 Of course, once you have a working copy checked out and
2753 are running @sc{cvs} commands from within it, there is
2754 no longer any need to specify the repository
2755 explicitly, because @sc{cvs} can deduce the repository
2756 from the working copy's @file{CVS} subdirectory.
2757
2758 @c FIXME: seems to me this needs somewhat more
2759 @c explanation.
2760 @cindex Logout (subcommand)
2761 The password for a given remote repository can be
2762 removed from the @code{CVS_PASSFILE} by using the
2763 @code{cvs logout} command.
2764
2765 @node Password authentication security
2766 @subsubsection Security considerations with password authentication
2767
2768 @cindex Security, of pserver
2769 The passwords are stored on the client side in a
2770 trivial encoding of the cleartext, and transmitted in
2771 the same encoding.  The encoding is done only to
2772 prevent inadvertent password compromises (i.e., a
2773 system administrator accidentally looking at the file),
2774 and will not prevent even a naive attacker from gaining
2775 the password.
2776
2777 @c FIXME: The bit about "access to the repository
2778 @c implies general access to the system is *not* specific
2779 @c to pserver; it applies to kerberos and SSH and
2780 @c everything else too.  Should reorganize the
2781 @c documentation to make this clear.
2782 The separate @sc{cvs} password file (@pxref{Password
2783 authentication server}) allows people
2784 to use a different password for repository access than
2785 for login access.  On the other hand, once a user has
2786 non-read-only
2787 access to the repository, she can execute programs on
2788 the server system through a variety of means.  Thus, repository
2789 access implies fairly broad system access as well.  It
2790 might be possible to modify @sc{cvs} to prevent that,
2791 but no one has done so as of this writing.
2792 @c OpenBSD uses chroot() and copies the repository to
2793 @c provide anonymous read-only access (for details see
2794 @c http://www.openbsd.org/anoncvs.shar).  While this
2795 @c closes the most obvious holes, I'm not sure it
2796 @c closes enough holes to recommend it (plus it is
2797 @c *very* easy to accidentally screw up a setup of this
2798 @c type).
2799
2800 Note that because the @file{$CVSROOT/CVSROOT} directory
2801 contains @file{passwd} and other files which are used
2802 to check security, you must control the permissions on
2803 this directory as tightly as the permissions on
2804 @file{/etc}.  The same applies to the @file{$CVSROOT}
2805 directory itself and any directory
2806 above it in the tree.  Anyone who has write access to
2807 such a directory will have the ability to become any
2808 user on the system.  Note that these permissions are
2809 typically tighter than you would use if you are not
2810 using pserver.
2811 @c TODO: Would be really nice to document/implement a
2812 @c scheme where the CVS server can run as some non-root
2813 @c user, e.g. "cvs".  CVSROOT/passwd would contain a
2814 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2815 @c would be implicit).  This would greatly reduce
2816 @c security risks such as those hinted at in the
2817 @c previous paragraph.  I think minor changes to CVS
2818 @c might be required but mostly this would just need
2819 @c someone who wants to play with it, document it, &c.
2820
2821 In summary, anyone who gets the password gets
2822 repository access (which may imply some measure of general system
2823 access as well).  The password is available to anyone
2824 who can sniff network packets or read a protected
2825 (i.e., user read-only) file.  If you want real
2826 security, get Kerberos.
2827
2828 @node GSSAPI authenticated
2829 @subsection Direct connection with GSSAPI
2830
2831 @cindex GSSAPI
2832 @cindex Security, GSSAPI
2833 @cindex :gserver:, setting up
2834 @cindex Kerberos, using :gserver:
2835 GSSAPI is a generic interface to network security
2836 systems such as Kerberos 5.
2837 If you have a working GSSAPI library, you can have
2838 @sc{cvs} connect via a direct @sc{tcp} connection,
2839 authenticating with GSSAPI.
2840
2841 To do this, @sc{cvs} needs to be compiled with GSSAPI
2842 support; when configuring @sc{cvs} it tries to detect
2843 whether GSSAPI libraries using Kerberos version 5 are
2844 present.  You can also use the @file{--with-gssapi}
2845 flag to configure.
2846
2847 The connection is authenticated using GSSAPI, but the
2848 message stream is @emph{not} authenticated by default.
2849 You must use the @code{-a} global option to request
2850 stream authentication.
2851
2852 The data transmitted is @emph{not} encrypted by
2853 default.  Encryption support must be compiled into both
2854 the client and the server; use the
2855 @file{--enable-encrypt} configure option to turn it on.
2856 You must then use the @code{-x} global option to
2857 request encryption.
2858
2859 GSSAPI connections are handled on the server side by
2860 the same server which handles the password
2861 authentication server; see @ref{Password authentication
2862 server}.  If you are using a GSSAPI mechanism such as
2863 Kerberos which provides for strong authentication, you
2864 will probably want to disable the ability to
2865 authenticate via cleartext passwords.  To do so, create
2866 an empty @file{CVSROOT/passwd} password file, and set
2867 @code{SystemAuth=no} in the config file
2868 (@pxref{config}).
2869
2870 The GSSAPI server uses a principal name of
2871 cvs/@var{hostname}, where @var{hostname} is the
2872 canonical name of the server host.  You will have to
2873 set this up as required by your GSSAPI mechanism.
2874
2875 To connect using GSSAPI, use the @samp{:gserver:} method.  For
2876 example,
2877
2878 @example
2879 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2880 @end example
2881
2882 @node Kerberos authenticated
2883 @subsection Direct connection with Kerberos
2884
2885 @cindex Kerberos, using :kserver:
2886 @cindex Security, Kerberos
2887 @cindex :kserver:, setting up
2888 The easiest way to use Kerberos is to use the Kerberos
2889 @code{rsh}, as described in @ref{Connecting via rsh}.
2890 The main disadvantage of using rsh is that all the data
2891 needs to pass through additional programs, so it may be
2892 slower.  So if you have Kerberos installed you can
2893 connect via a direct @sc{tcp} connection,
2894 authenticating with Kerberos.
2895
2896 This section concerns the Kerberos network security
2897 system, version 4.  Kerberos version 5 is supported via
2898 the GSSAPI generic network security interface, as
2899 described in the previous section.
2900
2901 To do this, @sc{cvs} needs to be compiled with Kerberos
2902 support; when configuring @sc{cvs} it tries to detect
2903 whether Kerberos is present or you can use the
2904 @file{--with-krb4} flag to configure.
2905
2906 The data transmitted is @emph{not} encrypted by
2907 default.  Encryption support must be compiled into both
2908 the client and server; use the
2909 @file{--enable-encryption} configure option to turn it
2910 on.  You must then use the @code{-x} global option to
2911 request encryption.
2912
2913 The CVS client will attempt to connect to port 1999 by default.
2914
2915 @cindex kinit
2916 When you want to use @sc{cvs}, get a ticket in the
2917 usual way (generally @code{kinit}); it must be a ticket
2918 which allows you to log into the server machine.  Then
2919 you are ready to go:
2920
2921 @example
2922 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
2923 @end example
2924
2925 Previous versions of @sc{cvs} would fall back to a
2926 connection via rsh; this version will not do so.
2927
2928 @node Connecting via fork
2929 @subsection Connecting with fork
2930
2931 @cindex fork, access method
2932 @cindex :fork:, setting up
2933 This access method allows you to connect to a
2934 repository on your local disk via the remote protocol.
2935 In other words it does pretty much the same thing as
2936 @code{:local:}, but various quirks, bugs and the like are
2937 those of the remote @sc{cvs} rather than the local
2938 @sc{cvs}.
2939
2940 For day-to-day operations you might prefer either
2941 @code{:local:} or @code{:fork:}, depending on your
2942 preferences.  Of course @code{:fork:} comes in
2943 particularly handy in testing or
2944 debugging @code{cvs} and the remote protocol.
2945 Specifically, we avoid all of the network-related
2946 setup/configuration, timeouts, and authentication
2947 inherent in the other remote access methods but still
2948 create a connection which uses the remote protocol.
2949
2950 To connect using the @code{fork} method, use
2951 @samp{:fork:} and the pathname to your local
2952 repository.  For example:
2953
2954 @example
2955 cvs -d :fork:/usr/local/cvsroot checkout foo
2956 @end example
2957
2958 @cindex CVS_SERVER, and :fork:
2959 As with @code{:ext:}, the server is called @samp{cvs}
2960 by default, or the value of the @code{CVS_SERVER}
2961 environment variable.
2962
2963 @c ---------------------------------------------------------------------
2964 @node Read-only access
2965 @section Read-only repository access
2966 @cindex Read-only repository access
2967 @cindex readers (admin file)
2968 @cindex writers (admin file)
2969
2970         It is possible to grant read-only repository
2971 access to people using the password-authenticated
2972 server (@pxref{Password authenticated}).  (The
2973 other access methods do not have explicit support for
2974 read-only users because those methods all assume login
2975 access to the repository machine anyway, and therefore
2976 the user can do whatever local file permissions allow
2977 her to do.)
2978
2979         A user who has read-only access can do only
2980 those @sc{cvs} operations which do not modify the
2981 repository, except for certain ``administrative'' files
2982 (such as lock files and the history file).  It may be
2983 desirable to use this feature in conjunction with
2984 user-aliasing (@pxref{Password authentication server}).
2985
2986 Unlike with previous versions of @sc{cvs}, read-only
2987 users should be able merely to read the repository, and
2988 not to execute programs on the server or otherwise gain
2989 unexpected levels of access.  Or to be more accurate,
2990 the @emph{known} holes have been plugged.  Because this
2991 feature is new and has not received a comprehensive
2992 security audit, you should use whatever level of
2993 caution seems warranted given your attitude concerning
2994 security.
2995
2996         There are two ways to specify read-only access
2997 for a user: by inclusion, and by exclusion.
2998
2999         "Inclusion" means listing that user
3000 specifically in the @file{$CVSROOT/CVSROOT/readers}
3001 file, which is simply a newline-separated list of
3002 users.  Here is a sample @file{readers} file:
3003
3004 @example
3005 melissa
3006 splotnik
3007 jrandom
3008 @end example
3009
3010 @noindent
3011         (Don't forget the newline after the last user.)
3012
3013         "Exclusion" means explicitly listing everyone
3014 who has @emph{write} access---if the file
3015
3016 @example
3017 $CVSROOT/CVSROOT/writers
3018 @end example
3019
3020 @noindent
3021 exists, then only
3022 those users listed in it have write access, and
3023 everyone else has read-only access (of course, even the
3024 read-only users still need to be listed in the
3025 @sc{cvs} @file{passwd} file).  The
3026 @file{writers} file has the same format as the
3027 @file{readers} file.
3028
3029         Note: if your @sc{cvs} @file{passwd}
3030 file maps cvs users onto system users (@pxref{Password
3031 authentication server}), make sure you deny or grant
3032 read-only access using the @emph{cvs} usernames, not
3033 the system usernames.  That is, the @file{readers} and
3034 @file{writers} files contain cvs usernames, which may
3035 or may not be the same as system usernames.
3036
3037         Here is a complete description of the server's
3038 behavior in deciding whether to grant read-only or
3039 read-write access:
3040
3041         If @file{readers} exists, and this user is
3042 listed in it, then she gets read-only access.  Or if
3043 @file{writers} exists, and this user is NOT listed in
3044 it, then she also gets read-only access (this is true
3045 even if @file{readers} exists but she is not listed
3046 there).  Otherwise, she gets full read-write access.
3047
3048         Of course there is a conflict if the user is
3049 listed in both files.  This is resolved in the more
3050 conservative way, it being better to protect the
3051 repository too much than too little: such a user gets
3052 read-only access.
3053
3054 @node Server temporary directory
3055 @section Temporary directories for the server
3056 @cindex Temporary directories, and server
3057 @cindex Server, temporary directories
3058
3059 While running, the @sc{cvs} server creates temporary
3060 directories.  They are named
3061
3062 @example
3063 cvs-serv@var{pid}
3064 @end example
3065
3066 @noindent
3067 where @var{pid} is the process identification number of
3068 the server.
3069 They are located in the directory specified by 
3070 the @samp{-T} global option (@pxref{Global options}), 
3071 the @code{TMPDIR} environment variable (@pxref{Environment variables}), 
3072 or, failing that, @file{/tmp}.
3073
3074 In most cases the server will remove the temporary
3075 directory when it is done, whether it finishes normally
3076 or abnormally.  However, there are a few cases in which
3077 the server does not or cannot remove the temporary
3078 directory, for example:
3079
3080 @itemize @bullet
3081 @item
3082 If the server aborts due to an internal server error,
3083 it may preserve the directory to aid in debugging
3084
3085 @item
3086 If the server is killed in a way that it has no way of
3087 cleaning up (most notably, @samp{kill -KILL} on unix).
3088
3089 @item
3090 If the system shuts down without an orderly shutdown,
3091 which tells the server to clean up.
3092 @end itemize
3093
3094 In cases such as this, you will need to manually remove
3095 the @file{cvs-serv@var{pid}} directories.  As long as
3096 there is no server running with process identification
3097 number @var{pid}, it is safe to do so.
3098
3099 @c ---------------------------------------------------------------------
3100 @node Starting a new project
3101 @chapter Starting a project with CVS
3102 @cindex Starting a project with CVS
3103 @cindex Creating a project
3104
3105 @comment --moduledb--
3106 Because renaming files and moving them between
3107 directories is somewhat inconvenient, the first thing
3108 you do when you start a new project should be to think
3109 through your file organization.  It is not impossible
3110 to rename or move files, but it does increase the
3111 potential for confusion and @sc{cvs} does have some
3112 quirks particularly in the area of renaming
3113 directories.  @xref{Moving files}.
3114
3115 What to do next depends on the situation at hand.
3116
3117 @menu
3118 * Setting up the files::        Getting the files into the repository
3119 * Defining the module::         How to make a module of the files
3120 @end menu
3121 @c -- File permissions!
3122
3123 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3124 @node Setting up the files
3125 @section Setting up the files
3126
3127 The first step is to create the files inside the repository.  This can
3128 be done in a couple of different ways.
3129
3130 @c -- The contributed scripts
3131 @menu
3132 * From files::                  This method is useful with old projects
3133                                 where files already exists.
3134 * From other version control systems::  Old projects where you want to
3135                                         preserve history from another system.
3136 * From scratch::                Creating a directory tree from scratch.
3137 @end menu
3138
3139 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3140 @node From files
3141 @subsection Creating a directory tree from a number of files
3142 @cindex Importing files
3143
3144 When you begin using @sc{cvs}, you will probably already have several
3145 projects that can be
3146 put under @sc{cvs} control.  In these cases the easiest way is to use the
3147 @code{import} command.  An example is probably the easiest way to
3148 explain how to use it.  If the files you want to install in
3149 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3150 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3151
3152 @example
3153 $ cd @var{wdir}
3154 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3155 @end example
3156
3157 Unless you supply a log message with the @samp{-m}
3158 flag, @sc{cvs} starts an editor and prompts for a
3159 message.  The string @samp{yoyo} is a @dfn{vendor tag},
3160 and @samp{start} is a @dfn{release tag}.  They may fill
3161 no purpose in this context, but since @sc{cvs} requires
3162 them they must be present.  @xref{Tracking sources}, for
3163 more information about them.
3164
3165 You can now verify that it worked, and remove your
3166 original source directory.
3167 @c FIXME: Need to say more about "verify that it
3168 @c worked".  What should the user look for in the output
3169 @c from "diff -r"?
3170
3171 @example
3172 $ cd ..
3173 $ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3174 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3175 $ rm -r @var{wdir}
3176 @end example
3177
3178 @noindent
3179 Erasing the original sources is a good idea, to make sure that you do
3180 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3181 Of course, it would be wise to make sure that you have
3182 a backup of the sources before you remove them.
3183
3184 The @code{checkout} command can either take a module
3185 name as argument (as it has done in all previous
3186 examples) or a path name relative to @code{$CVSROOT},
3187 as it did in the example above.
3188
3189 It is a good idea to check that the permissions
3190 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3191 are reasonable, and that they belong to the proper
3192 groups.  @xref{File permissions}.
3193
3194 If some of the files you want to import are binary, you
3195 may want to use the wrappers features to specify which
3196 files are binary and which are not.  @xref{Wrappers}.
3197
3198 @c The node name is too long, but I am having trouble
3199 @c thinking of something more concise.
3200 @node From other version control systems
3201 @subsection Creating Files From Other Version Control Systems
3202 @cindex Importing files, from other version control systems
3203
3204 If you have a project which you are maintaining with
3205 another version control system, such as @sc{rcs}, you
3206 may wish to put the files from that project into
3207 @sc{cvs}, and preserve the revision history of the
3208 files.
3209
3210 @table @asis
3211 @cindex RCS, importing files from
3212 @item From RCS
3213 If you have been using @sc{rcs}, find the @sc{rcs}
3214 files---usually a file named @file{foo.c} will have its
3215 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3216 other places; consult the @sc{rcs} documentation for
3217 details).  Then create the appropriate directories in
3218 @sc{cvs} if they do not already exist.  Then copy the
3219 files into the appropriate directories in the @sc{cvs}
3220 repository (the name in the repository must be the name
3221 of the source file with @samp{,v} added; the files go
3222 directly in the appropriate directory of the repository,
3223 not in an @file{RCS} subdirectory).  This is one of the
3224 few times when it is a good idea to access the @sc{cvs}
3225 repository directly, rather than using @sc{cvs}
3226 commands.  Then you are ready to check out a new
3227 working directory.
3228 @c Someday there probably should be a "cvs import -t
3229 @c rcs" or some such.  It could even create magic
3230 @c branches.  It could also do something about the case
3231 @c where the RCS file had a (non-magic) "0" branch.
3232
3233 The @sc{rcs} file should not be locked when you move it
3234 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3235 letting you operate on it.
3236 @c What is the easiest way to unlock your files if you
3237 @c have them locked?  Especially if you have a lot of them?
3238 @c This is a CVS bug/misfeature; importing RCS files
3239 @c should ignore whether they are locked and leave them in
3240 @c an unlocked state.  Yet another reason for a separate
3241 @c "import RCS file" command.
3242
3243 @c How many is "many"? Or do they just import RCS files?
3244 @item From another version control system
3245 Many version control systems have the ability to export
3246 @sc{rcs} files in the standard format.  If yours does,
3247 export the @sc{rcs} files and then follow the above
3248 instructions.
3249
3250 Failing that, probably your best bet is to write a
3251 script that will check out the files one revision at a
3252 time using the command line interface to the other
3253 system, and then check the revisions into @sc{cvs}.
3254 The @file{sccs2rcs} script mentioned below may be a
3255 useful example to follow.
3256
3257 @cindex SCCS, importing files from
3258 @item From SCCS
3259 There is a script in the @file{contrib} directory of
3260 the @sc{cvs} source distribution called @file{sccs2rcs}
3261 which converts @sc{sccs} files to @sc{rcs} files.
3262 Note: you must run it on a machine which has both
3263 @sc{sccs} and @sc{rcs} installed, and like everything
3264 else in contrib it is unsupported (your mileage may
3265 vary).
3266
3267 @cindex PVCS, importing files from
3268 @item From PVCS
3269 There is a script in the @file{contrib} directory of
3270 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3271 which converts @sc{pvcs} archives to @sc{rcs} files.
3272 You must run it on a machine which has both
3273 @sc{pvcs} and @sc{rcs} installed, and like everything
3274 else in contrib it is unsupported (your mileage may
3275 vary).  See the comments in the script for details.
3276 @end table
3277 @c CMZ and/or PATCHY were systems that were used in the
3278 @c high energy physics community (especially for
3279 @c CERNLIB).  CERN has replaced them with CVS, but the
3280 @c CAR format seems to live on as a way to submit
3281 @c changes.  There is a program car2cvs which converts
3282 @c but I'm not sure where one gets a copy.
3283 @c Not sure it is worth mentioning here, since it would
3284 @c appear to affect only one particular community.
3285 @c Best page for more information is:
3286 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3287 @c See also:
3288 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3289
3290 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3291 @node From scratch
3292 @subsection Creating a directory tree from scratch
3293
3294 @c Also/instead should be documenting
3295 @c $ cvs co -l .
3296 @c $ mkdir tc
3297 @c $ cvs add tc
3298 @c $ cd tc
3299 @c $ mkdir man
3300 @c $ cvs add man
3301 @c etc.
3302 @c Using import to create the directories only is
3303 @c probably a somewhat confusing concept.
3304 For a new project, the easiest thing to do is probably
3305 to create an empty directory structure, like this:
3306
3307 @example
3308 $ mkdir tc
3309 $ mkdir tc/man
3310 $ mkdir tc/testing
3311 @end example
3312
3313 After that, you use the @code{import} command to create
3314 the corresponding (empty) directory structure inside
3315 the repository:
3316
3317 @example
3318 $ cd tc
3319 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3320 @end example
3321
3322 This will add yoyodyne/@var{dir} as a directory under
3323 @code{$CVSROOT}.
3324
3325 Then, use @code{add} to add files (and new directories)
3326 as they appear.
3327
3328 Check that the permissions @sc{cvs} sets on the
3329 directories inside @code{$CVSROOT} are reasonable.
3330
3331 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3332 @node Defining the module
3333 @section Defining the module
3334 @cindex Defining a module
3335 @cindex Editing the modules file
3336 @cindex Module, defining
3337 @cindex Modules file, changing
3338
3339 The next step is to define the module in the
3340 @file{modules} file.  This is not strictly necessary,
3341 but modules can be convenient in grouping together
3342 related files and directories.
3343
3344 In simple cases these steps are sufficient to define a module.
3345
3346 @enumerate
3347 @item
3348 Get a working copy of the modules file.
3349
3350 @example
3351 $ cvs checkout CVSROOT/modules
3352 $ cd CVSROOT
3353 @end example
3354
3355 @item
3356 Edit the file and insert a line that defines the module.  @xref{Intro
3357 administrative files}, for an introduction.  @xref{modules}, for a full
3358 description of the modules file.  You can use the
3359 following line to define the module @samp{tc}:
3360
3361 @example
3362 tc   yoyodyne/tc
3363 @end example
3364
3365 @item
3366 Commit your changes to the modules file.
3367
3368 @example
3369 $ cvs commit -m "Added the tc module." modules
3370 @end example
3371
3372 @item
3373 Release the modules module.
3374
3375 @example
3376 $ cd ..
3377 $ cvs release -d CVSROOT
3378 @end example
3379 @end enumerate
3380
3381 @c ---------------------------------------------------------------------
3382 @node Revisions
3383 @chapter Revisions
3384
3385 For many uses of @sc{cvs}, one doesn't need to worry
3386 too much about revision numbers; @sc{cvs} assigns
3387 numbers such as @code{1.1}, @code{1.2}, and so on, and
3388 that is all one needs to know.  However, some people
3389 prefer to have more knowledge and control concerning
3390 how @sc{cvs} assigns revision numbers.
3391
3392 If one wants to keep track of a set of revisions
3393 involving more than one file, such as which revisions
3394 went into a particular release, one uses a @dfn{tag},
3395 which is a symbolic revision which can be assigned to a
3396 numeric revision in each file.
3397
3398 @menu
3399 * Revision numbers::            The meaning of a revision number
3400 * Versions revisions releases::  Terminology used in this manual
3401 * Assigning revisions::         Assigning revisions
3402 * Tags::                        Tags--Symbolic revisions
3403 * Tagging the working directory::  The cvs tag command
3404 * Tagging by date/tag::         The cvs rtag command
3405 * Modifying tags::              Adding, renaming, and deleting tags
3406 * Tagging add/remove::          Tags with adding and removing files
3407 * Sticky tags::                 Certain tags are persistent
3408 @end menu
3409
3410 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3411 @node Revision numbers
3412 @section Revision numbers
3413 @cindex Revision numbers
3414 @cindex Revision tree
3415 @cindex Linear development
3416 @cindex Number, revision-
3417 @cindex Decimal revision number
3418 @cindex Branch number
3419 @cindex Number, branch
3420
3421 Each version of a file has a unique @dfn{revision
3422 number}.  Revision numbers look like @samp{1.1},
3423 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3424 A revision number always has an even number of
3425 period-separated decimal integers.  By default revision
3426 1.1 is the first revision of a file.  Each successive
3427 revision is given a new number by increasing the
3428 rightmost number by one.  The following figure displays
3429 a few revisions, with newer revisions to the right.
3430
3431 @example
3432        +-----+    +-----+    +-----+    +-----+    +-----+
3433        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3434        +-----+    +-----+    +-----+    +-----+    +-----+
3435 @end example
3436
3437 It is also possible to end up with numbers containing
3438 more than one period, for example @samp{1.3.2.2}.  Such
3439 revisions represent revisions on branches
3440 (@pxref{Branching and merging}); such revision numbers
3441 are explained in detail in @ref{Branches and
3442 revisions}.
3443
3444 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3445 @node Versions revisions releases
3446 @section Versions, revisions and releases
3447 @cindex Revisions, versions and releases
3448 @cindex Versions, revisions and releases
3449 @cindex Releases, revisions and versions
3450
3451 A file can have several versions, as described above.
3452 Likewise, a software product can have several versions.
3453 A software product is often given a version number such
3454 as @samp{4.1.1}.
3455
3456 Versions in the first sense are called @dfn{revisions}
3457 in this document, and versions in the second sense are
3458 called @dfn{releases}.  To avoid confusion, the word
3459 @dfn{version} is almost never used in this document.
3460
3461 @node Assigning revisions
3462 @section Assigning revisions
3463
3464 @c We avoid the "major revision" terminology.  It seems
3465 @c like jargon.  Hopefully "first number" is clear enough.
3466 @c
3467 @c Well, in the context of software release numbers,
3468 @c "major" and "minor" release or version numbers are
3469 @c documented in at least the GNU Coding Standards, but I'm
3470 @c still not sure I find that a valid reason to apply the
3471 @c terminology to RCS revision numbers.  "First", "Second",
3472 @c "subsequent", and so on is almost surely clearer,
3473 @c especially to a novice reader. -DRP
3474 By default, @sc{cvs} will assign numeric revisions by
3475 leaving the first number the same and incrementing the
3476 second number.  For example, @code{1.1}, @code{1.2},
3477 @code{1.3}, etc.
3478
3479 When adding a new file, the second number will always
3480 be one and the first number will equal the highest
3481 first number of any file in that directory.  For
3482 example, the current directory contains files whose
3483 highest numbered revisions are @code{1.7}, @code{3.1},
3484 and @code{4.12}, then an added file will be given the
3485 numeric revision @code{4.1}.
3486 (When using client/server @sc{cvs},
3487 only files that are actually sent to the server are considered.)
3488
3489 @c This is sort of redundant with something we said a
3490 @c while ago.  Somewhere we need a better way of
3491 @c introducing how the first number can be anything
3492 @c except "1", perhaps.  Also I don't think this
3493 @c presentation is clear on why we are discussing releases
3494 @c and first numbers of numeric revisions in the same
3495 @c breath.
3496 Normally there is no reason to care
3497 about the revision numbers---it is easier to treat them
3498 as internal numbers that @sc{cvs} maintains, and tags
3499 provide a better way to distinguish between things like
3500 release 1 versus release 2 of your product
3501 (@pxref{Tags}).  However, if you want to set the
3502 numeric revisions, the @samp{-r} option to @code{cvs
3503 commit} can do that.  The @samp{-r} option implies the
3504 @samp{-f} option, in the sense that it causes the
3505 files to be committed even if they are not modified.
3506
3507 For example, to bring all your files up to
3508 revision 3.0 (including those that haven't changed),
3509 you might invoke:
3510
3511 @example
3512 $ cvs commit -r 3.0
3513 @end example
3514
3515 Note that the number you specify with @samp{-r} must be
3516 larger than any existing revision number.  That is, if
3517 revision 3.0 exists, you cannot @samp{cvs commit
3518 -r 1.3}.  If you want to maintain several releases in
3519 parallel, you need to use a branch (@pxref{Branching and merging}).
3520
3521 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3522 @node Tags
3523 @section Tags--Symbolic revisions
3524 @cindex Tags
3525
3526 The revision numbers live a life of their own.  They
3527 need not have anything at all to do with the release
3528 numbers of your software product.  Depending
3529 on how you use @sc{cvs} the revision numbers might change several times
3530 between two releases.  As an example, some of the
3531 source files that make up @sc{rcs} 5.6 have the following
3532 revision numbers:
3533 @cindex RCS revision numbers
3534
3535 @example
3536 ci.c            5.21
3537 co.c            5.9
3538 ident.c         5.3
3539 rcs.c           5.12
3540 rcsbase.h       5.11
3541 rcsdiff.c       5.10
3542 rcsedit.c       5.11
3543 rcsfcmp.c       5.9
3544 rcsgen.c        5.10
3545 rcslex.c        5.11
3546 rcsmap.c        5.2
3547 rcsutil.c       5.10
3548 @end example
3549
3550 @cindex tag (subcommand), introduction
3551 @cindex Tags, symbolic name
3552 @cindex Symbolic name (tag)
3553 @cindex Name, symbolic (tag)
3554 @cindex HEAD, as reserved tag name
3555 @cindex BASE, as reserved tag name
3556 You can use the @code{tag} command to give a symbolic name to a
3557 certain revision of a file.  You can use the @samp{-v} flag to the
3558 @code{status} command to see all tags that a file has, and
3559 which revision numbers they represent.  Tag names must
3560 start with an uppercase or lowercase letter and can
3561 contain uppercase and lowercase letters, digits,
3562 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
3563 and @code{HEAD} are reserved for use by @sc{cvs}.  It
3564 is expected that future names which are special to
3565 @sc{cvs} will be specially named, for example by
3566 starting with @samp{.}, rather than being named analogously to
3567 @code{BASE} and @code{HEAD}, to avoid conflicts with
3568 actual tag names.
3569 @c Including a character such as % or = has also been
3570 @c suggested as the naming convention for future
3571 @c special tag names.  Starting with . is nice because
3572 @c that is not a legal tag name as far as RCS is concerned.
3573 @c FIXME: CVS actually accepts quite a few characters
3574 @c in tag names, not just the ones documented above
3575 @c (see RCS_check_tag).  RCS
3576 @c defines legitimate tag names by listing illegal
3577 @c characters rather than legal ones.  CVS is said to lose its
3578 @c mind if you try to use "/" (try making such a tag sticky
3579 @c and using "cvs status" client/server--see remote
3580 @c protocol format for entries line for probable cause).
3581 @c TODO: The testsuite
3582 @c should test for whatever are documented above as
3583 @c officially-OK tag names, and CVS should at least reject
3584 @c characters that won't work, like "/".
3585
3586 You'll want to choose some convention for naming tags,
3587 based on information such as the name of the program
3588 and the version number of the release.  For example,
3589 one might take the name of the program, immediately
3590 followed by the version number with @samp{.} changed to
3591 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3592 @code{cvs1-9}.  If you choose a consistent convention,
3593 then you won't constantly be guessing whether a tag is
3594 @code{cvs-1-9} or @code{cvs1_9} or what.  You might
3595 even want to consider enforcing your convention in the
3596 @file{taginfo} file (@pxref{taginfo}).
3597 @c Might be nice to say more about using taginfo this
3598 @c way, like giving an example, or pointing out any particular
3599 @c issues which arise.
3600
3601 @cindex Adding a tag
3602 @cindex Tags, example
3603 The following example shows how you can add a tag to a
3604 file.  The commands must be issued inside your working
3605 directory.  That is, you should issue the
3606 command in the directory where @file{backend.c}
3607 resides.
3608
3609 @example
3610 $ cvs tag rel-0-4 backend.c
3611 T backend.c
3612 $ cvs status -v backend.c
3613 ===================================================================
3614 File: backend.c         Status: Up-to-date
3615
3616     Version:            1.4     Tue Dec  1 14:39:01 1992
3617     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3618     Sticky Tag:         (none)
3619     Sticky Date:        (none)
3620     Sticky Options:     (none)
3621
3622     Existing Tags:
3623         rel-0-4                     (revision: 1.4)
3624
3625 @end example
3626
3627 For a complete summary of the syntax of @code{cvs tag},
3628 including the various options, see @ref{Invoking CVS}.
3629
3630 There is seldom reason to tag a file in isolation.  A more common use is
3631 to tag all the files that constitute a module with the same tag at
3632 strategic points in the development life-cycle, such as when a release
3633 is made.
3634
3635 @example
3636 $ cvs tag rel-1-0 .
3637 cvs tag: Tagging .
3638 T Makefile
3639 T backend.c
3640 T driver.c
3641 T frontend.c
3642 T parser.c
3643 @end example
3644
3645 @noindent
3646 (When you give @sc{cvs} a directory as argument, it generally applies the
3647 operation to all the files in that directory, and (recursively), to any
3648 subdirectories that it may contain.  @xref{Recursive behavior}.)
3649
3650 @cindex Retrieving an old revision using tags
3651 @cindex Tags, retrieving old revisions
3652 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3653 a certain revision of a module.  This flag makes it easy to
3654 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3655 any time in the future:
3656
3657 @example
3658 $ cvs checkout -r rel-1-0 tc
3659 @end example
3660
3661 @noindent
3662 This is useful, for instance, if someone claims that there is a bug in
3663 that release, but you cannot find the bug in the current working copy.
3664
3665 You can also check out a module as it was at any given date.
3666 @xref{checkout options}.  When specifying @samp{-r} to
3667 any of these commands, you will need beware of sticky
3668 tags; see @ref{Sticky tags}.
3669
3670 When you tag more than one file with the same tag you
3671 can think about the tag as "a curve drawn through a
3672 matrix of filename vs. revision number."  Say we have 5
3673 files with the following revisions:
3674
3675 @example
3676 @group
3677         file1   file2   file3   file4   file5
3678
3679         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3680         1.2*-   1.2     1.2    -1.2*-
3681         1.3  \- 1.3*-   1.3   / 1.3
3682         1.4          \  1.4  /  1.4
3683                       \-1.5*-   1.5
3684                         1.6
3685 @end group
3686 @end example
3687
3688 At some time in the past, the @code{*} versions were tagged.
3689 You can think of the tag as a handle attached to the curve
3690 drawn through the tagged revisions.  When you pull on
3691 the handle, you get all the tagged revisions.  Another
3692 way to look at it is that you "sight" through a set of
3693 revisions that is "flat" along the tagged revisions,
3694 like this:
3695
3696 @example
3697 @group
3698         file1   file2   file3   file4   file5
3699
3700                         1.1
3701                         1.2
3702                 1.1     1.3                       _
3703         1.1     1.2     1.4     1.1              /
3704         1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
3705         1.3             1.6     1.3              \_
3706         1.4                     1.4
3707                                 1.5
3708 @end group
3709 @end example
3710
3711 @node Tagging the working directory
3712 @section Specifying what to tag from the working directory
3713
3714 @cindex tag (subcommand)
3715 The example in the previous section demonstrates one of
3716 the most common ways to choose which revisions to tag.
3717 Namely, running the @code{cvs tag} command without
3718 arguments causes @sc{cvs} to select the revisions which
3719 are checked out in the current working directory.  For
3720 example, if the copy of @file{backend.c} in working
3721 directory was checked out from revision 1.4, then
3722 @sc{cvs} will tag revision 1.4.  Note that the tag is
3723 applied immediately to revision 1.4 in the repository;
3724 tagging is not like modifying a file, or other
3725 operations in which one first modifies the working
3726 directory and then runs @code{cvs commit} to transfer
3727 that modification to the repository.
3728
3729 One potentially surprising aspect of the fact that
3730 @code{cvs tag} operates on the repository is that you
3731 are tagging the checked-in revisions, which may differ
3732 from locally modified files in your working directory.
3733 If you want to avoid doing this by mistake, specify the
3734 @samp{-c} option to @code{cvs tag}.  If there are any
3735 locally modified files, @sc{cvs} will abort with an
3736 error before it tags any files:
3737
3738 @example
3739 $ cvs tag -c rel-0-4
3740 cvs tag: backend.c is locally modified
3741 cvs [tag aborted]: correct the above errors first!
3742 @end example
3743
3744 @node Tagging by date/tag
3745 @section Specifying what to tag by date or revision
3746 @cindex rtag (subcommand)
3747
3748 The @code{cvs rtag} command tags the repository as of a
3749 certain date or time (or can be used to tag the latest
3750 revision).  @code{rtag} works directly on the
3751 repository contents (it requires no prior checkout and
3752 does not look for a working directory).
3753
3754 The following options specify which date or revision to
3755 tag.  See @ref{Common options}, for a complete
3756 description of them.
3757
3758 @table @code
3759 @item -D @var{date}
3760 Tag the most recent revision no later than @var{date}.
3761
3762 @item -f
3763 Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
3764 flags.  If no matching revision is found, use the most
3765 recent revision (instead of ignoring the file).
3766
3767 @item -r @var{tag}
3768 Only tag those files that contain existing tag @var{tag}.
3769 @end table
3770
3771 The @code{cvs tag} command also allows one to specify
3772 files by revision or date, using the same @samp{-r},
3773 @samp{-D}, and @samp{-f} options.  However, this
3774 feature is probably not what you want.  The reason is
3775 that @code{cvs tag} chooses which files to tag based on
3776 the files that exist in the working directory, rather
3777 than the files which existed as of the given tag/date.
3778 Therefore, you are generally better off using @code{cvs
3779 rtag}.  The exceptions might be cases like:
3780
3781 @example
3782 cvs tag -r 1.4 stable backend.c
3783 @end example
3784
3785 @node Modifying tags
3786 @section Deleting, moving, and renaming tags
3787
3788 @c Also see:
3789 @c  "How do I move or rename a magic branch tag?"
3790 @c in the FAQ (I think the issues it talks about still
3791 @c apply, but this could use some sanity.sh work).
3792
3793 Normally one does not modify tags.  They exist in order
3794 to record the history of the repository and so deleting
3795 them or changing their meaning would, generally, not be
3796 what you want.
3797
3798 However, there might be cases in which one uses a tag
3799 temporarily or accidentally puts one in the wrong
3800 place.  Therefore, one might delete, move, or rename a
3801 tag.
3802
3803 @noindent
3804 @strong{WARNING: the commands in this section are
3805 dangerous; they permanently discard historical
3806 information and it can be difficult or impossible to
3807 recover from errors.  If you are a @sc{cvs}
3808 administrator, you may consider restricting these
3809 commands with the @file{taginfo} file (@pxref{taginfo}).}
3810
3811 @cindex Deleting tags
3812 @cindex Deleting branch tags
3813 @cindex Removing tags
3814 @cindex Removing branch tags
3815 @cindex Tags, deleting
3816 @cindex Branch tags, deleting
3817 To delete a tag, specify the @samp{-d} option to either
3818 @code{cvs tag} or @code{cvs rtag}.  For example:
3819
3820 @example
3821 cvs rtag -d rel-0-4 tc
3822 @end example
3823
3824 @noindent
3825 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
3826 In the event that branch tags are encountered within the repository
3827 with the given name, a warning message will be issued and the branch 
3828 tag will not be deleted.  If you are absolutely certain you know what
3829 you are doing, the @code{-B} option may be specified to allow deletion
3830 of branch tags.  In that case, any non-branch tags encountered will
3831 trigger warnings and will not be deleted.
3832
3833 @noindent
3834 @strong{WARNING: Moving branch tags is very dangerous!  If you think
3835 you need the @code{-B} option, think again and ask your @sc{cvs}
3836 administrator about it (if that isn't you).  There is almost certainly
3837 another way to accomplish what you want to accomplish.}
3838
3839 @cindex Moving tags
3840 @cindex Moving branch tags
3841 @cindex Tags, moving
3842 @cindex Branch tags, moving
3843 When we say @dfn{move} a tag, we mean to make the same
3844 name point to different revisions.  For example, the
3845 @code{stable} tag may currently point to revision 1.4
3846 of @file{backend.c} and perhaps we want to make it
3847 point to revision 1.6.  To move a non-branch tag, specify the
3848 @samp{-F} option to either @code{cvs tag} or @code{cvs
3849 rtag}.  For example, the task just mentioned might be
3850 accomplished as:
3851
3852 @example
3853 cvs tag -r 1.6 -F stable backend.c
3854 @end example
3855
3856 @noindent
3857 If any branch tags are encountered in the repository 
3858 with the given name, a warning is issued and the branch
3859 tag is not disturbed.  If you are absolutely certain you
3860 wish to move the branch tag, the @code{-B} option may be specified.
3861 In that case, non-branch tags encountered with the given
3862 name are ignored with a warning message.
3863
3864 @noindent
3865 @strong{WARNING: Moving branch tags is very dangerous!  If you think you
3866 need the @code{-B} option, think again and ask your @sc{cvs}
3867 administrator about it (if that isn't you).  There is almost certainly
3868 another way to accomplish what you want to accomplish.}
3869
3870 @cindex Renaming tags
3871 @cindex Tags, renaming
3872 When we say @dfn{rename} a tag, we mean to make a
3873 different name point to the same revisions as the old
3874 tag.  For example, one may have misspelled the tag name
3875 and want to correct it (hopefully before others are
3876 relying on the old spelling).  To rename a tag, first
3877 create a new tag using the @samp{-r} option to
3878 @code{cvs rtag}, and then delete the old name.  (Caution:
3879 this method will not work with branch tags.) 
3880 This leaves the new tag on exactly the 
3881 same files as the old tag.  For example:
3882
3883 @example
3884 cvs rtag -r old-name-0-4 rel-0-4 tc
3885 cvs rtag -d old-name-0-4 tc
3886 @end example
3887
3888 @node Tagging add/remove
3889 @section Tagging and adding and removing files
3890
3891 The subject of exactly how tagging interacts with
3892 adding and removing files is somewhat obscure; for the
3893 most part @sc{cvs} will keep track of whether files
3894 exist or not without too much fussing.  By default,
3895 tags are applied to only files which have a revision
3896 corresponding to what is being tagged.  Files which did
3897 not exist yet, or which were already removed, simply
3898 omit the tag, and @sc{cvs} knows to treat the absence
3899 of a tag as meaning that the file didn't exist as of
3900 that tag.
3901
3902 However, this can lose a small amount of information.
3903 For example, suppose a file was added and then removed.
3904 Then, if the tag is missing for that file, there is no
3905 way to know whether the tag refers to the time before
3906 the file was added, or the time after it was removed.
3907 If you specify the @samp{-r} option to @code{cvs rtag},
3908 then @sc{cvs} tags the files which have been removed,
3909 and thereby avoids this problem.  For example, one
3910 might specify @code{-r HEAD} to tag the head.
3911
3912 On the subject of adding and removing files, the
3913 @code{cvs rtag} command has a @samp{-a} option which
3914 means to clear the tag from removed files that would
3915 not otherwise be tagged.  For example, one might
3916 specify this option in conjunction with @samp{-F} when
3917 moving a tag.  If one moved a tag without @samp{-a},
3918 then the tag in the removed files might still refer to
3919 the old revision, rather than reflecting the fact that
3920 the file had been removed.  I don't think this is
3921 necessary if @samp{-r} is specified, as noted above.
3922
3923 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3924 @node Sticky tags
3925 @section Sticky tags
3926 @cindex Sticky tags
3927 @cindex Tags, sticky
3928
3929 @c A somewhat related issue is per-directory sticky
3930 @c tags (see comment at CVS/Tag in node Working
3931 @c directory storage); we probably want to say
3932 @c something like "you can set a sticky tag for only
3933 @c some files, but you don't want to" or some such.
3934
3935 Sometimes a working copy's revision has extra data
3936 associated with it, for example it might be on a branch
3937 (@pxref{Branching and merging}), or restricted to
3938 versions prior to a certain date by @samp{checkout -D}
3939 or @samp{update -D}.  Because this data persists --
3940 that is, it applies to subsequent commands in the
3941 working copy -- we refer to it as @dfn{sticky}.
3942
3943 Most of the time, stickiness is an obscure aspect of
3944 @sc{cvs} that you don't need to think about.  However,
3945 even if you don't want to use the feature, you may need
3946 to know @emph{something} about sticky tags (for
3947 example, how to avoid them!).
3948
3949 You can use the @code{status} command to see if any
3950 sticky tags or dates are set:
3951
3952 @example
3953 $ cvs status driver.c
3954 ===================================================================
3955 File: driver.c          Status: Up-to-date
3956
3957     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
3958     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
3959     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
3960     Sticky Date:        (none)
3961     Sticky Options:     (none)
3962
3963 @end example
3964
3965 @cindex Resetting sticky tags
3966 @cindex Sticky tags, resetting
3967 @cindex Deleting sticky tags
3968 The sticky tags will remain on your working files until
3969 you delete them with @samp{cvs update -A}.  The
3970 @samp{-A} option merges local changes into the version of the
3971 file from the head of the trunk, removing any sticky tags,
3972 dates, or options.  See @ref{update} for more on the operation
3973 of @code{cvs update}.
3974
3975 @cindex Sticky date
3976 The most common use of sticky tags is to identify which
3977 branch one is working on, as described in
3978 @ref{Accessing branches}.  However, non-branch
3979 sticky tags have uses as well.  For example,
3980 suppose that you want to avoid updating your working
3981 directory, to isolate yourself from possibly
3982 destabilizing changes other people are making.  You
3983 can, of course, just refrain from running @code{cvs
3984 update}.  But if you want to avoid updating only a
3985 portion of a larger tree, then sticky tags can help.
3986 If you check out a certain revision (such as 1.4) it
3987 will become sticky.  Subsequent @code{cvs update}
3988 commands will
3989 not retrieve the latest revision until you reset the
3990 tag with @code{cvs update -A}.  Likewise, use of the
3991 @samp{-D} option to @code{update} or @code{checkout}
3992 sets a @dfn{sticky date}, which, similarly, causes that
3993 date to be used for future retrievals.
3994
3995 People often want to retrieve an old version of
3996 a file without setting a sticky tag.  This can
3997 be done with the @samp{-p} option to @code{checkout} or
3998 @code{update}, which sends the contents of the file to
3999 standard output.  For example:
4000 @example
4001 $ cvs update -p -r 1.1 file1 >file1
4002 ===================================================================
4003 Checking out file1
4004 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
4005 VERS: 1.1
4006 ***************
4007 $
4008 @end example
4009
4010 However, this isn't the easiest way, if you are asking
4011 how to undo a previous checkin (in this example, put
4012 @file{file1} back to the way it was as of revision
4013 1.1).  In that case you are better off using the
4014 @samp{-j} option to @code{update}; for further
4015 discussion see @ref{Merging two revisions}.
4016
4017 @c ---------------------------------------------------------------------
4018 @node Branching and merging
4019 @chapter Branching and merging
4020 @cindex Branching
4021 @cindex Merging
4022 @cindex Copying changes
4023 @cindex Main trunk and branches
4024 @cindex Revision tree, making branches
4025 @cindex Branches, copying changes between
4026 @cindex Changes, copying between branches
4027 @cindex Modifications, copying between branches
4028
4029 @sc{cvs} allows you to isolate changes onto a separate
4030 line of development, known as a @dfn{branch}.  When you
4031 change files on a branch, those changes do not appear
4032 on the main trunk or other branches.
4033
4034 Later you can move changes from one branch to another
4035 branch (or the main trunk) by @dfn{merging}.  Merging
4036 involves first running @code{cvs update -j}, to merge
4037 the changes into the working directory.
4038 You can then commit that revision, and thus effectively
4039 copy the changes onto another branch.
4040
4041 @menu
4042 * Branches motivation::         What branches are good for
4043 * Creating a branch::           Creating a branch
4044 * Accessing branches::          Checking out and updating branches
4045 * Branches and revisions::      Branches are reflected in revision numbers
4046 * Magic branch numbers::        Magic branch numbers
4047 * Merging a branch::            Merging an entire branch
4048 * Merging more than once::      Merging from a branch several times
4049 * Merging two revisions::       Merging differences between two revisions
4050 * Merging adds and removals::   What if files are added or removed?
4051 * Merging and keywords::        Avoiding conflicts due to keyword substitution
4052 @end menu
4053
4054 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4055 @node Branches motivation
4056 @section What branches are good for
4057 @cindex Branches motivation
4058 @cindex What branches are good for
4059 @cindex Motivation for branches
4060
4061 @c FIXME: this node mentions one way to use branches,
4062 @c but it is by no means the only way.  For example,
4063 @c the technique of committing a new feature on a branch,
4064 @c until it is ready for the main trunk.  The whole
4065 @c thing is generally speaking more akin to the
4066 @c "Revision management" node although it isn't clear to
4067 @c me whether policy matters should be centralized or
4068 @c distributed throughout the relevant sections.
4069 Suppose that release 1.0 of tc has been made.  You are continuing to
4070 develop tc, planning to create release 1.1 in a couple of months.  After a
4071 while your customers start to complain about a fatal bug.  You check
4072 out release 1.0 (@pxref{Tags}) and find the bug
4073 (which turns out to have a trivial fix).  However, the current revision
4074 of the sources are in a state of flux and are not expected to be stable
4075 for at least another month.  There is no way to make a
4076 bug fix release based on the newest sources.
4077
4078 The thing to do in a situation like this is to create a @dfn{branch} on
4079 the revision trees for all the files that make up
4080 release 1.0 of tc.  You can then make
4081 modifications to the branch without disturbing the main trunk.  When the
4082 modifications are finished you can elect to either incorporate them on
4083 the main trunk, or leave them on the branch.
4084
4085 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4086 @node Creating a branch
4087 @section Creating a branch
4088 @cindex Creating a branch
4089 @cindex Branch, creating a
4090 @cindex tag (subcommand), creating a branch using
4091 @cindex rtag (subcommand), creating a branch using
4092
4093 You can create a branch with @code{tag -b}; for
4094 example, assuming you're in a working copy:
4095
4096 @example
4097 $ cvs tag -b rel-1-0-patches
4098 @end example
4099
4100 @c FIXME: we should be more explicit about the value of
4101 @c having a tag on the branchpoint.  For example
4102 @c "cvs tag rel-1-0-patches-branchpoint" before
4103 @c the "cvs tag -b".  This points out that
4104 @c rel-1-0-patches is a pretty awkward name for
4105 @c this example (more so than for the rtag example
4106 @c below).
4107
4108 This splits off a branch based on the current revisions
4109 in the working copy, assigning that branch the name
4110 @samp{rel-1-0-patches}.
4111
4112 It is important to understand that branches get created
4113 in the repository, not in the working copy.  Creating a
4114 branch based on current revisions, as the above example
4115 does, will @emph{not} automatically switch the working
4116 copy to be on the new branch.  For information on how
4117 to do that, see @ref{Accessing branches}.
4118
4119 You can also create a branch without reference to any
4120 working copy, by using @code{rtag}:
4121
4122 @example
4123 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
4124 @end example
4125
4126 @samp{-r rel-1-0} says that this branch should be
4127 rooted at the revision that
4128 corresponds to the tag @samp{rel-1-0}.  It need not
4129 be the most recent revision -- it's often useful to
4130 split a branch off an old revision (for example, when
4131 fixing a bug in a past release otherwise known to be
4132 stable).
4133
4134 As with @samp{tag}, the @samp{-b} flag tells
4135 @code{rtag} to create a branch (rather than just a
4136 symbolic revision name).  Note that the numeric
4137 revision number that matches @samp{rel-1-0} will
4138 probably be different from file to file.
4139
4140 So, the full effect of the command is to create a new
4141 branch -- named @samp{rel-1-0-patches} -- in module
4142 @samp{tc}, rooted in the revision tree at the point tagged
4143 by @samp{rel-1-0}.
4144
4145 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4146 @node Accessing branches
4147 @section Accessing branches
4148 @cindex Check out a branch
4149 @cindex Retrieve a branch
4150 @cindex Access a branch
4151 @cindex Identifying a branch
4152 @cindex Branch, check out
4153 @cindex Branch, retrieving
4154 @cindex Branch, accessing
4155 @cindex Branch, identifying
4156
4157 You can retrieve a branch in one of two ways: by
4158 checking it out fresh from the repository, or by
4159 switching an existing working copy over to the branch.
4160
4161 To check out a branch from the repository, invoke
4162 @samp{checkout} with the @samp{-r} flag, followed by
4163 the tag name of the branch (@pxref{Creating a branch}):
4164
4165 @example
4166 $ cvs checkout -r rel-1-0-patches tc
4167 @end example
4168
4169 Or, if you already have a working copy, you can switch
4170 it to a given branch with @samp{update -r}:
4171
4172 @example
4173 $ cvs update -r rel-1-0-patches tc
4174 @end example
4175
4176 @noindent
4177 or equivalently:
4178
4179 @example
4180 $ cd tc
4181 $ cvs update -r rel-1-0-patches
4182 @end example
4183
4184 It does not matter if the working copy was originally
4185 on the main trunk or on some other branch -- the above
4186 command will switch it to the named branch.  And
4187 similarly to a regular @samp{update} command,
4188 @samp{update -r} merges any changes you have made,
4189 notifying you of conflicts where they occur.
4190
4191 Once you have a working copy tied to a particular
4192 branch, it remains there until you tell it otherwise.
4193 This means that changes checked in from the working
4194 copy will add new revisions on that branch, while
4195 leaving the main trunk and other branches unaffected.
4196
4197 @cindex Branches, sticky
4198 To find out what branch a working copy is on, you can
4199 use the @samp{status} command.  In its output, look for
4200 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4201 -- that's @sc{cvs}'s way of telling you the branch, if
4202 any, of the current working files:
4203
4204 @example
4205 $ cvs status -v driver.c backend.c
4206 ===================================================================
4207 File: driver.c          Status: Up-to-date
4208
4209     Version:            1.7     Sat Dec  5 18:25:54 1992
4210     RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4211     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4212     Sticky Date:        (none)
4213     Sticky Options:     (none)
4214
4215     Existing Tags:
4216         rel-1-0-patches             (branch: 1.7.2)
4217         rel-1-0                     (revision: 1.7)
4218
4219 ===================================================================
4220 File: backend.c         Status: Up-to-date
4221
4222     Version:            1.4     Tue Dec  1 14:39:01 1992
4223     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4224     Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4225     Sticky Date:        (none)
4226     Sticky Options:     (none)
4227
4228     Existing Tags:
4229         rel-1-0-patches             (branch: 1.4.2)
4230         rel-1-0                     (revision: 1.4)
4231         rel-0-4                     (revision: 1.4)
4232
4233 @end example
4234
4235 Don't be confused by the fact that the branch numbers
4236 for each file are different (@samp{1.7.2} and
4237 @samp{1.4.2} respectively).  The branch tag is the
4238 same, @samp{rel-1-0-patches}, and the files are
4239 indeed on the same branch.  The numbers simply reflect
4240 the point in each file's revision history at which the
4241 branch was made.  In the above example, one can deduce
4242 that @samp{driver.c} had been through more changes than
4243 @samp{backend.c} before this branch was created.
4244
4245 See @ref{Branches and revisions} for details about how
4246 branch numbers are constructed.
4247
4248 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4249 @node Branches and revisions
4250 @section Branches and revisions
4251 @cindex Branch number
4252 @cindex Number, branch
4253 @cindex Revision numbers (branches)
4254
4255 Ordinarily, a file's revision history is a linear
4256 series of increments (@pxref{Revision numbers}):
4257
4258 @example
4259        +-----+    +-----+    +-----+    +-----+    +-----+
4260        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4261        +-----+    +-----+    +-----+    +-----+    +-----+
4262 @end example
4263
4264 However, @sc{cvs} is not limited to linear development.  The
4265 @dfn{revision tree} can be split into @dfn{branches},
4266 where each branch is a self-maintained line of
4267 development.  Changes made on one branch can easily be
4268 moved back to the main trunk.
4269
4270 Each branch has a @dfn{branch number}, consisting of an
4271 odd number of period-separated decimal integers.  The
4272 branch number is created by appending an integer to the
4273 revision number where the corresponding branch forked
4274 off.  Having branch numbers allows more than one branch
4275 to be forked off from a certain revision.
4276
4277 @need 3500
4278 All revisions on a branch have revision numbers formed
4279 by appending an ordinal number to the branch number.
4280 The following figure illustrates branching with an
4281 example.
4282
4283 @example
4284 @c This example used to have a 1.2.2.4 revision, which
4285 @c might help clarify that development can continue on
4286 @c 1.2.2.  Might be worth reinstating if it can be done
4287 @c without overfull hboxes.
4288 @group
4289                                                       +-------------+
4290                            Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4291                                                     / +-------------+
4292                                                    /
4293                                                   /
4294                  +---------+    +---------+    +---------+
4295 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4296                / +---------+    +---------+    +---------+
4297               /
4298              /
4299 +-----+    +-----+    +-----+    +-----+    +-----+
4300 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4301 +-----+    +-----+    +-----+    +-----+    +-----+
4302                 !
4303                 !
4304                 !   +---------+    +---------+    +---------+
4305 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4306                     +---------+    +---------+    +---------+
4307
4308 @end group
4309 @end example
4310
4311 @c --   However, at least for me the figure is not enough.  I suggest more
4312 @c --   text to accompany it.  "A picture is worth a thousand words", so you
4313 @c --   have to make sure the reader notices the couple of hundred words
4314 @c --   *you* had in mind more than the others!
4315
4316 @c --   Why an even number of segments?  This section implies that this is
4317 @c --   how the main trunk is distinguished from branch roots, but you never
4318 @c --   explicitly say that this is the purpose of the [by itself rather
4319 @c --   surprising] restriction to an even number of segments.
4320
4321 The exact details of how the branch number is
4322 constructed is not something you normally need to be
4323 concerned about, but here is how it works: When
4324 @sc{cvs} creates a branch number it picks the first
4325 unused even integer, starting with 2.  So when you want
4326 to create a branch from revision 6.4 it will be
4327 numbered 6.4.2.  All branch numbers ending in a zero
4328 (such as 6.4.0) are used internally by @sc{cvs}
4329 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4330 special meaning.  @xref{Tracking sources}.
4331
4332 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4333 @node Magic branch numbers
4334 @section Magic branch numbers
4335
4336 @c Want xref to here from "log"?
4337
4338 This section describes a @sc{cvs} feature called
4339 @dfn{magic branches}.  For most purposes, you need not
4340 worry about magic branches; @sc{cvs} handles them for
4341 you.  However, they are visible to you in certain
4342 circumstances, so it may be useful to have some idea of
4343 how it works.
4344
4345 Externally, branch numbers consist of an odd number of
4346 dot-separated decimal integers.  @xref{Revision
4347 numbers}.  That is not the whole truth, however.  For
4348 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4349 in the second rightmost position (1.2.4 becomes
4350 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4351 on).
4352
4353 @sc{cvs} does a pretty good job at hiding these so
4354 called magic branches, but in a few places the hiding
4355 is incomplete:
4356
4357 @itemize @bullet
4358 @ignore
4359 @c This is in ignore as I'm taking their word for it,
4360 @c that this was fixed
4361 @c a long time ago.  But before deleting this
4362 @c entirely, I'd rather verify it (and add a test
4363 @c case to the testsuite).
4364 @item
4365 The magic branch can appear in the output from
4366 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4367 fixed in @sc{cvs} 1.3-s2.
4368
4369 @end ignore
4370 @item
4371 The magic branch number appears in the output from
4372 @code{cvs log}.
4373 @c What output should appear instead?
4374
4375 @item
4376 You cannot specify a symbolic branch name to @code{cvs
4377 admin}.
4378
4379 @end itemize
4380
4381 @c Can CVS do this automatically the first time
4382 @c you check something in to that branch?  Should
4383 @c it?
4384 You can use the @code{admin} command to reassign a
4385 symbolic name to a branch the way @sc{rcs} expects it
4386 to be.  If @code{R4patches} is assigned to the branch
4387 1.4.2 (magic branch number 1.4.0.2) in file
4388 @file{numbers.c} you can do this:
4389
4390 @example
4391 $ cvs admin -NR4patches:1.4.2 numbers.c
4392 @end example
4393
4394 It only works if at least one revision is already
4395 committed on the branch.  Be very careful so that you
4396 do not assign the tag to the wrong number.  (There is
4397 no way to see how the tag was assigned yesterday).
4398
4399 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4400 @node Merging a branch
4401 @section Merging an entire branch
4402 @cindex Merging a branch
4403 @cindex -j (merging branches)
4404
4405 You can merge changes made on a branch into your working copy by giving
4406 the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4407 @samp{-j @var{branchname}} option it merges the changes made between the
4408 greatest common ancestor (GCA) of the branch and the destination revision (in
4409 the simple case below the GCA is the point where the branch forked) and the
4410 newest revision on that branch into your working copy.
4411
4412 @cindex Join
4413 The @samp{-j} stands for ``join''.
4414
4415 @cindex Branch merge example
4416 @cindex Example, branch merge
4417 @cindex Merge, branch example
4418 Consider this revision tree:
4419
4420 @example
4421 +-----+    +-----+    +-----+    +-----+
4422 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4423 +-----+    +-----+    +-----+    +-----+
4424                 !
4425                 !
4426                 !   +---------+    +---------+
4427 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4428                     +---------+    +---------+
4429 @end example
4430
4431 @noindent
4432 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4433 following example assumes that the module @samp{mod} contains only one
4434 file, @file{m.c}.
4435
4436 @example
4437 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4438
4439 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4440                                  # @r{i.e. the changes between revision 1.2}
4441                                  # @r{and 1.2.2.2, into your working copy}
4442                                  # @r{of the file.}
4443
4444 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4445 @end example
4446
4447 A conflict can result from a merge operation.  If that
4448 happens, you should resolve it before committing the
4449 new revision.  @xref{Conflicts example}.
4450
4451 If your source files contain keywords (@pxref{Keyword substitution}),
4452 you might be getting more conflicts than strictly necessary.  See
4453 @ref{Merging and keywords}, for information on how to avoid this.
4454
4455 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4456 same effect as above could be achieved with this:
4457
4458 @example
4459 $ cvs checkout -j R1fix mod
4460 $ cvs commit -m "Included R1fix"
4461 @end example
4462
4463 It should be noted that @code{update -j @var{tagname}} will also work but may
4464 not produce the desired result.  @xref{Merging adds and removals}, for more.
4465
4466 @node Merging more than once
4467 @section Merging from a branch several times
4468
4469 Continuing our example, the revision tree now looks
4470 like this:
4471
4472 @example
4473 +-----+    +-----+    +-----+    +-----+    +-----+
4474 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4475 +-----+    +-----+    +-----+    +-----+    +-----+
4476                 !                           *
4477                 !                          *
4478                 !   +---------+    +---------+
4479 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4480                     +---------+    +---------+
4481 @end example
4482
4483 @noindent
4484 where the starred line represents the merge from the
4485 @samp{R1fix} branch to the main trunk, as just
4486 discussed.
4487
4488 Now suppose that development continues on the
4489 @samp{R1fix} branch:
4490
4491 @example
4492 +-----+    +-----+    +-----+    +-----+    +-----+
4493 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4494 +-----+    +-----+    +-----+    +-----+    +-----+
4495                 !                           *
4496                 !                          *
4497                 !   +---------+    +---------+    +---------+
4498 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4499                     +---------+    +---------+    +---------+
4500 @end example
4501
4502 @noindent
4503 and then you want to merge those new changes onto the
4504 main trunk.  If you just use the @code{cvs update -j
4505 R1fix m.c} command again, @sc{cvs} will attempt to
4506 merge again the changes which you have already merged,
4507 which can have undesirable side effects.
4508
4509 So instead you need to specify that you only want to
4510 merge the changes on the branch which have not yet been
4511 merged into the trunk.  To do that you specify two
4512 @samp{-j} options, and @sc{cvs} merges the changes from
4513 the first revision to the second revision.  For
4514 example, in this case the simplest way would be
4515
4516 @example
4517 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4518                                       # @r{head of the R1fix branch}
4519 @end example
4520
4521 The problem with this is that you need to specify the
4522 1.2.2.2 revision manually.  A slightly better approach
4523 might be to use the date the last merge was done:
4524
4525 @example
4526 cvs update -j R1fix:yesterday -j R1fix m.c
4527 @end example
4528
4529 Better yet, tag the R1fix branch after every merge into
4530 the trunk, and then use that tag for subsequent merges:
4531
4532 @example
4533 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4534 @end example
4535
4536 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4537 @node Merging two revisions
4538 @section Merging differences between any two revisions
4539 @cindex Merging two revisions
4540 @cindex Revisions, merging differences between
4541 @cindex Differences, merging
4542
4543 With two @samp{-j @var{revision}} flags, the @code{update}
4544 (and @code{checkout}) command can merge the differences
4545 between any two revisions into your working file.
4546
4547 @cindex Undoing a change
4548 @cindex Removing a change
4549 @example
4550 $ cvs update -j 1.5 -j 1.3 backend.c
4551 @end example
4552
4553 @noindent
4554 will undo all changes made between revision
4555 1.3 and 1.5.  Note the order of the revisions!
4556
4557 If you try to use this option when operating on
4558 multiple files, remember that the numeric revisions will
4559 probably be very different between the various files.
4560 You almost always use symbolic
4561 tags rather than revision numbers when operating on
4562 multiple files.
4563
4564 @cindex Restoring old version of removed file
4565 @cindex Resurrecting old version of dead file
4566 Specifying two @samp{-j} options can also undo file
4567 removals or additions.  For example, suppose you have
4568 a file
4569 named @file{file1} which existed as revision 1.1, and
4570 you then removed it (thus adding a dead revision 1.2).
4571 Now suppose you want to add it again, with the same
4572 contents it had previously.  Here is how to do it:
4573
4574 @example
4575 $ cvs update -j 1.2 -j 1.1 file1
4576 U file1
4577 $ cvs commit -m test
4578 Checking in file1;
4579 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4580 new revision: 1.3; previous revision: 1.2
4581 done
4582 $
4583 @end example
4584
4585 @node Merging adds and removals
4586 @section Merging can add or remove files
4587
4588 If the changes which you are merging involve removing
4589 or adding some files, @code{update -j} will reflect
4590 such additions or removals.
4591
4592 @c FIXME: This example needs a lot more explanation.
4593 @c We also need other examples for some of the other
4594 @c cases (not all--there are too many--as long as we present a
4595 @c coherent general principle).
4596 For example:
4597 @example
4598 cvs update -A
4599 touch a b c
4600 cvs add a b c ; cvs ci -m "added" a b c
4601 cvs tag -b branchtag
4602 cvs update -r branchtag
4603 touch d ; cvs add d
4604 rm a ; cvs rm a
4605 cvs ci -m "added d, removed a"
4606 cvs update -A
4607 cvs update -jbranchtag
4608 @end example
4609
4610 After these commands are executed and a @samp{cvs commit} is done,
4611 file @file{a} will be removed and file @file{d} added in the main branch.
4612 @c (which was determined by trying it)
4613
4614 Note that using a single static tag (@samp{-j @var{tagname}})
4615 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4616 changes from a branch will usually not remove files which were removed on the
4617 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4618 The exception to this rule occurs when
4619 a static tag has been attached to a dead revision manually.  Use the branch tag
4620 to merge all changes from the branch or use two static tags as merge endpoints
4621 to be sure that all intended changes are propagated in the merge.
4622
4623 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4624 @node Merging and keywords
4625 @section Merging and keywords
4626 @cindex Merging, and keyword substitution
4627 @cindex Keyword substitution, and merging
4628 @cindex -j (merging branches), and keyword substitution
4629 @cindex -kk, to avoid conflicts during a merge
4630
4631 If you merge files containing keywords (@pxref{Keyword
4632 substitution}), you will normally get numerous
4633 conflicts during the merge, because the keywords are
4634 expanded differently in the revisions which you are
4635 merging.
4636
4637 Therefore, you will often want to specify the
4638 @samp{-kk} (@pxref{Substitution modes}) switch to the
4639 merge command line.  By substituting just the name of
4640 the keyword, not the expanded value of that keyword,
4641 this option ensures that the revisions which you are
4642 merging will be the same as each other, and avoid
4643 spurious conflicts.
4644
4645 For example, suppose you have a file like this:
4646
4647 @example
4648        +---------+
4649       _! 1.1.2.1 !   <-  br1
4650      / +---------+
4651     /
4652    /
4653 +-----+    +-----+
4654 ! 1.1 !----! 1.2 !
4655 +-----+    +-----+
4656 @end example
4657
4658 @noindent
4659 and your working directory is currently on the trunk
4660 (revision 1.2).  Then you might get the following
4661 results from a merge:
4662
4663 @example
4664 $ cat file1
4665 key $@splitrcskeyword{Revision}: 1.2 $
4666 . . .
4667 $ cvs update -j br1
4668 U file1
4669 RCS file: /cvsroot/first-dir/file1,v
4670 retrieving revision 1.1
4671 retrieving revision 1.1.2.1
4672 Merging differences between 1.1 and 1.1.2.1 into file1
4673 rcsmerge: warning: conflicts during merge
4674 $ cat file1
4675 @asis{}<<<<<<< file1
4676 key $@splitrcskeyword{Revision}: 1.2 $
4677 @asis{}=======
4678 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4679 @asis{}>>>>>>> 1.1.2.1
4680 . . .
4681 @end example
4682
4683 What happened was that the merge tried to merge the
4684 differences between 1.1 and 1.1.2.1 into your working
4685 directory.  So, since the keyword changed from
4686 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4687 @sc{cvs} tried to merge that change into your working
4688 directory, which conflicted with the fact that your
4689 working directory had contained @code{Revision: 1.2}.
4690
4691 Here is what happens if you had used @samp{-kk}:
4692
4693 @example
4694 $ cat file1
4695 key $@splitrcskeyword{Revision}: 1.2 $
4696 . . .
4697 $ cvs update -kk -j br1
4698 U file1
4699 RCS file: /cvsroot/first-dir/file1,v
4700 retrieving revision 1.1
4701 retrieving revision 1.1.2.1
4702 Merging differences between 1.1 and 1.1.2.1 into file1
4703 $ cat file1
4704 key $@splitrcskeyword{Revision}$
4705 . . .
4706 @end example
4707
4708 What is going on here is that revision 1.1 and 1.1.2.1
4709 both expand as plain @code{Revision}, and therefore
4710 merging the changes between them into the working
4711 directory need not change anything.  Therefore, there
4712 is no conflict.
4713
4714 @strong{WARNING: In versions of @sc{cvs} prior to 1.12.2, there was a
4715 major problem with using @samp{-kk} on merges.  Namely, @samp{-kk}
4716 overrode any default keyword expansion mode set in the archive file in
4717 the repository.  This could, unfortunately for some users, cause data
4718 corruption in binary files (with a default keyword expansion mode set
4719 to @samp{-kb}).  Therefore, when a repository contained binary files,
4720 conflicts had to be dealt with manually rather than using @samp{-kk} in
4721 a merge command.}
4722
4723 In @sc{cvs} version 1.12.2 and later, the keyword expansion mode
4724 provided on the command line to any @sc{cvs} command no longer
4725 overrides the @samp{-kb} keyword expansion mode setting for binary
4726 files, though it will still override other default keyword expansion
4727 modes.  You can now safely merge using @samp{-kk} to avoid spurious conflicts
4728 on lines containing RCS keywords, even when your repository contains
4729 binary files.
4730
4731 @c ---------------------------------------------------------------------
4732 @node Recursive behavior
4733 @chapter Recursive behavior
4734 @cindex Recursive (directory descending)
4735 @cindex Directory, descending
4736 @cindex Descending directories
4737 @cindex Subdirectories
4738
4739 Almost all of the subcommands of @sc{cvs} work
4740 recursively when you specify a directory as an
4741 argument.  For instance, consider this directory
4742 structure:
4743
4744 @example
4745       @code{$HOME}
4746         |
4747         +--@t{tc}
4748         |   |
4749             +--@t{CVS}
4750             |      (internal @sc{cvs} files)
4751             +--@t{Makefile}
4752             +--@t{backend.c}
4753             +--@t{driver.c}
4754             +--@t{frontend.c}
4755             +--@t{parser.c}
4756             +--@t{man}
4757             |    |
4758             |    +--@t{CVS}
4759             |    |  (internal @sc{cvs} files)
4760             |    +--@t{tc.1}
4761             |
4762             +--@t{testing}
4763                  |
4764                  +--@t{CVS}
4765                  |  (internal @sc{cvs} files)
4766                  +--@t{testpgm.t}
4767                  +--@t{test2.t}
4768 @end example
4769
4770 @noindent
4771 If @file{tc} is the current working directory, the
4772 following is true:
4773
4774 @itemize @bullet
4775 @item
4776 @samp{cvs update testing} is equivalent to
4777
4778 @example
4779 cvs update testing/testpgm.t testing/test2.t
4780 @end example
4781
4782 @item
4783 @samp{cvs update testing man} updates all files in the
4784 subdirectories
4785
4786 @item
4787 @samp{cvs update .} or just @samp{cvs update} updates
4788 all files in the @code{tc} directory
4789 @end itemize
4790
4791 If no arguments are given to @code{update} it will
4792 update all files in the current working directory and
4793 all its subdirectories.  In other words, @file{.} is a
4794 default argument to @code{update}.  This is also true
4795 for most of the @sc{cvs} subcommands, not only the
4796 @code{update} command.
4797
4798 The recursive behavior of the @sc{cvs} subcommands can be
4799 turned off with the @samp{-l} option.
4800 Conversely, the @samp{-R} option can be used to force recursion if
4801 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4802
4803 @example
4804 $ cvs update -l         # @r{Don't update files in subdirectories}
4805 @end example
4806
4807 @c ---------------------------------------------------------------------
4808 @node Adding and removing
4809 @chapter Adding, removing, and renaming files and directories
4810
4811 In the course of a project, one will often add new
4812 files.  Likewise with removing or renaming, or with
4813 directories.  The general concept to keep in mind in
4814 all these cases is that instead of making an
4815 irreversible change you want @sc{cvs} to record the
4816 fact that a change has taken place, just as with
4817 modifying an existing file.  The exact mechanisms to do
4818 this in @sc{cvs} vary depending on the situation.
4819
4820 @menu
4821 * Adding files::                Adding files
4822 * Removing files::              Removing files
4823 * Removing directories::        Removing directories
4824 * Moving files::                Moving and renaming files
4825 * Moving directories::          Moving and renaming directories
4826 @end menu
4827
4828 @node Adding files
4829 @section Adding files to a directory
4830 @cindex Adding files
4831
4832 To add a new file to a directory, follow these steps.
4833
4834 @itemize @bullet
4835 @item
4836 You must have a working copy of the directory.
4837 @xref{Getting the source}.
4838
4839 @item
4840 Create the new file inside your working copy of the directory.
4841
4842 @item
4843 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
4844 want to version control the file.  If the file contains
4845 binary data, specify @samp{-kb} (@pxref{Binary files}).
4846
4847 @item
4848 Use @samp{cvs commit @var{filename}} to actually check
4849 in the file into the repository.  Other developers
4850 cannot see the file until you perform this step.
4851 @end itemize
4852
4853 You can also use the @code{add} command to add a new
4854 directory.
4855 @c FIXCVS and/or FIXME: Adding a directory doesn't
4856 @c require the commit step.  This probably can be
4857 @c considered a CVS bug, but it is possible we should
4858 @c warn people since this behavior probably won't be
4859 @c changing right away.
4860
4861 Unlike most other commands, the @code{add} command is
4862 not recursive.  You have to expcicitly name files and
4863 directories that you wish to add to the repository.
4864 However, each directory will need to be added
4865 separately before you will be able to add new files
4866 to those directories.
4867
4868 @example
4869 $ mkdir -p foo/bar
4870 $ cp ~/myfile foo/bar/myfile
4871 $ cvs add foo foo/bar
4872 $ cvs add foo/bar/myfile
4873 @end example
4874
4875 @cindex add (subcommand)
4876 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
4877
4878 Schedule @var{files} to be added to the repository.
4879 The files or directories specified with @code{add} must
4880 already exist in the current directory.  To add a whole
4881 new directory hierarchy to the source repository (for
4882 example, files received from a third-party vendor), use
4883 the @code{import} command instead.  @xref{import}.
4884
4885 The added files are not placed in the source repository
4886 until you use @code{commit} to make the change
4887 permanent.  Doing an @code{add} on a file that was
4888 removed with the @code{remove} command will undo the
4889 effect of the @code{remove}, unless a @code{commit}
4890 command intervened.  @xref{Removing files}, for an
4891 example.
4892
4893 The @samp{-k} option specifies the default way that
4894 this file will be checked out; for more information see
4895 @ref{Substitution modes}.
4896
4897 @c As noted in BUGS, -m is broken client/server (Nov
4898 @c 96).  Also see testsuite log2-* tests.
4899 The @samp{-m} option specifies a description for the
4900 file.  This description appears in the history log (if
4901 it is enabled, @pxref{history file}).  It will also be
4902 saved in the version history inside the repository when
4903 the file is committed.  The @code{log} command displays
4904 this description.  The description can be changed using
4905 @samp{admin -t}.  @xref{admin}.  If you omit the
4906 @samp{-m @var{description}} flag, an empty string will
4907 be used.  You will not be prompted for a description.
4908 @end deffn
4909
4910 For example, the following commands add the file
4911 @file{backend.c} to the repository:
4912
4913 @c This example used to specify
4914 @c     -m "Optimizer and code generation passes."
4915 @c to the cvs add command, but that doesn't work
4916 @c client/server (see log2 in sanity.sh).  Should fix CVS,
4917 @c but also seems strange to document things which
4918 @c don't work...
4919 @example
4920 $ cvs add backend.c
4921 $ cvs commit -m "Early version. Not yet compilable." backend.c
4922 @end example
4923
4924 When you add a file it is added only on the branch
4925 which you are working on (@pxref{Branching and merging}).  You can
4926 later merge the additions to another branch if you want
4927 (@pxref{Merging adds and removals}).
4928 @c Should we mention that earlier versions of CVS
4929 @c lacked this feature (1.3) or implemented it in a buggy
4930 @c way (well, 1.8 had many bugs in cvs update -j)?
4931 @c Should we mention the bug/limitation regarding a
4932 @c file being a regular file on one branch and a directory
4933 @c on another?
4934 @c FIXME: This needs an example, or several, here or
4935 @c elsewhere, for it to make much sense.
4936 @c Somewhere we need to discuss the aspects of death
4937 @c support which don't involve branching, I guess.
4938 @c Like the ability to re-create a release from a tag.
4939
4940 @c ---------------------------------------------------------------------
4941 @node Removing files
4942 @section Removing files
4943 @cindex Removing files
4944 @cindex Deleting files
4945
4946 @c FIXME: this node wants to be split into several
4947 @c smaller nodes.  Could make these children of
4948 @c "Adding and removing", probably (death support could
4949 @c be its own section, for example, as could the
4950 @c various bits about undoing mistakes in adding and
4951 @c removing).
4952 Directories change.  New files are added, and old files
4953 disappear.  Still, you want to be able to retrieve an
4954 exact copy of old releases.
4955
4956 Here is what you can do to remove a file,
4957 but remain able to retrieve old revisions:
4958
4959 @itemize @bullet
4960 @c FIXME: should probably be saying something about
4961 @c having a working directory in the first place.
4962 @item
4963 Make sure that you have not made any uncommitted
4964 modifications to the file.  @xref{Viewing differences},
4965 for one way to do that.  You can also use the
4966 @code{status} or @code{update} command.  If you remove
4967 the file without committing your changes, you will of
4968 course not be able to retrieve the file as it was
4969 immediately before you deleted it.
4970
4971 @item
4972 Remove the file from your working copy of the directory.
4973 You can for instance use @code{rm}.
4974
4975 @item
4976 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
4977 you really want to delete the file.
4978
4979 @item
4980 Use @samp{cvs commit @var{filename}} to actually
4981 perform the removal of the file from the repository.
4982 @end itemize
4983
4984 @c FIXME: Somehow this should be linked in with a more
4985 @c general discussion of death support.  I don't know
4986 @c whether we want to use the term "death support" or
4987 @c not (we can perhaps get by without it), but we do
4988 @c need to discuss the "dead" state in "cvs log" and
4989 @c related subjects.  The current discussion is
4990 @c scattered around, and not xref'd to each other.
4991 @c FIXME: I think this paragraph wants to be moved
4992 @c later down, at least after the first example.
4993 When you commit the removal of the file, @sc{cvs}
4994 records the fact that the file no longer exists.  It is
4995 possible for a file to exist on only some branches and
4996 not on others, or to re-add another file with the same
4997 name later.  @sc{cvs} will correctly create or not create
4998 the file, based on the @samp{-r} and @samp{-D} options
4999 specified to @code{checkout} or @code{update}.
5000
5001 @c FIXME: This style seems to clash with how we
5002 @c document things in general.
5003 @cindex Remove (subcommand)
5004 @deffn Command {cvs remove} [options] files @dots{}
5005
5006 Schedule file(s) to be removed from the repository
5007 (files which have not already been removed from the
5008 working directory are not processed).  This command
5009 does not actually remove the file from the repository
5010 until you commit the removal.  For a full list of
5011 options, see @ref{Invoking CVS}.
5012 @end deffn
5013
5014 Here is an example of removing several files:
5015
5016 @example
5017 $ cd test
5018 $ rm *.c
5019 $ cvs remove
5020 cvs remove: Removing .
5021 cvs remove: scheduling a.c for removal
5022 cvs remove: scheduling b.c for removal
5023 cvs remove: use 'cvs commit' to remove these files permanently
5024 $ cvs ci -m "Removed unneeded files"
5025 cvs commit: Examining .
5026 cvs commit: Committing .
5027 @end example
5028
5029 As a convenience you can remove the file and @code{cvs
5030 remove} it in one step, by specifying the @samp{-f}
5031 option.  For example, the above example could also be
5032 done like this:
5033
5034 @example
5035 $ cd test
5036 $ cvs remove -f *.c
5037 cvs remove: scheduling a.c for removal
5038 cvs remove: scheduling b.c for removal
5039 cvs remove: use 'cvs commit' to remove these files permanently
5040 $ cvs ci -m "Removed unneeded files"
5041 cvs commit: Examining .
5042 cvs commit: Committing .
5043 @end example
5044
5045 If you execute @code{remove} for a file, and then
5046 change your mind before you commit, you can undo the
5047 @code{remove} with an @code{add} command.
5048 @ignore
5049 @c is this worth saying or not?  Somehow it seems
5050 @c confusing to me.
5051 Of course,
5052 since you have removed your copy of file in the working
5053 directory, @sc{cvs} does not necessarily bring back the
5054 contents of the file from right before you executed
5055 @code{remove}; instead it gets the file from the
5056 repository again.
5057 @end ignore
5058
5059 @c FIXME: what if you change your mind after you commit
5060 @c it?  (answer is also "cvs add" but we don't say that...).
5061 @c We need some index entries for thinks like "undoing
5062 @c removal" too.
5063
5064 @example
5065 $ ls
5066 CVS   ja.h  oj.c
5067 $ rm oj.c
5068 $ cvs remove oj.c
5069 cvs remove: scheduling oj.c for removal
5070 cvs remove: use 'cvs commit' to remove this file permanently
5071 $ cvs add oj.c
5072 U oj.c
5073 cvs add: oj.c, version 1.1.1.1, resurrected
5074 @end example
5075
5076 If you realize your mistake before you run the
5077 @code{remove} command you can use @code{update} to
5078 resurrect the file:
5079
5080 @example
5081 $ rm oj.c
5082 $ cvs update oj.c
5083 cvs update: warning: oj.c was lost
5084 U oj.c
5085 @end example
5086
5087 When you remove a file it is removed only on the branch
5088 which you are working on (@pxref{Branching and merging}).  You can
5089 later merge the removals to another branch if you want
5090 (@pxref{Merging adds and removals}).
5091
5092 @node Removing directories
5093 @section Removing directories
5094 @cindex Removing directories
5095 @cindex Directories, removing
5096
5097 In concept removing directories is somewhat similar to
5098 removing files---you want the directory to not exist in
5099 your current working directories, but you also want to
5100 be able to retrieve old releases in which the directory
5101 existed.
5102
5103 The way that you remove a directory is to remove all
5104 the files in it.  You don't remove the directory
5105 itself; there is no way to do that.
5106 Instead you specify the @samp{-P} option to
5107 @code{cvs update} or @code{cvs checkout},
5108 which will cause @sc{cvs} to remove empty
5109 directories from working directories.
5110 (Note that @code{cvs export} always removes empty directories.)
5111 Probably the
5112 best way to do this is to always specify @samp{-P}; if
5113 you want an empty directory then put a dummy file (for
5114 example @file{.keepme}) in it to prevent @samp{-P} from
5115 removing it.
5116
5117 @c I'd try to give a rationale for this, but I'm not
5118 @c sure there is a particularly convincing one.  What
5119 @c we would _like_ is for CVS to do a better job of version
5120 @c controlling whether directories exist, to eliminate the
5121 @c need for -P and so that a file can be a directory in
5122 @c one revision and a regular file in another.
5123 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5124 options of @code{checkout}.  This way
5125 @sc{cvs} will be able to correctly create the directory
5126 or not depending on whether the particular version you
5127 are checking out contains any files in that directory.
5128
5129 @c ---------------------------------------------------------------------
5130 @node Moving files
5131 @section Moving and renaming files
5132 @cindex Moving files
5133 @cindex Renaming files
5134 @cindex Files, moving
5135
5136 Moving files to a different directory or renaming them
5137 is not difficult, but some of the ways in which this
5138 works may be non-obvious.  (Moving or renaming a
5139 directory is even harder.  @xref{Moving directories}.).
5140
5141 The examples below assume that the file @var{old} is renamed to
5142 @var{new}.
5143
5144 @menu
5145 * Outside::                     The normal way to Rename
5146 * Inside::                      A tricky, alternative way
5147 * Rename by copying::           Another tricky, alternative way
5148 @end menu
5149
5150 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5151 @node Outside
5152 @subsection The Normal way to Rename
5153
5154 @c More rename issues.  Not sure whether these are
5155 @c worth documenting; I'm putting them here because
5156 @c it seems to be as good a place as any to try to
5157 @c set down the issues.
5158 @c * "cvs annotate" will annotate either the new
5159 @c file or the old file; it cannot annotate _each
5160 @c line_ based on whether it was last changed in the
5161 @c new or old file.  Unlike "cvs log", where the
5162 @c consequences of having to select either the new
5163 @c or old name seem fairly benign, this may be a
5164 @c real advantage to having CVS know about renames
5165 @c other than as a deletion and an addition.
5166
5167 The normal way to move a file is to copy @var{old} to
5168 @var{new}, and then issue the normal @sc{cvs} commands
5169 to remove @var{old} from the repository, and add
5170 @var{new} to it.
5171 @c The following sentence is not true: one must cd into
5172 @c the directory to run "cvs add".
5173 @c  (Both @var{old} and @var{new} could
5174 @c contain relative paths, for example @file{foo/bar.c}).
5175
5176 @example
5177 $ mv @var{old} @var{new}
5178 $ cvs remove @var{old}
5179 $ cvs add @var{new}
5180 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5181 @end example
5182
5183 This is the simplest way to move a file, it is not
5184 error-prone, and it preserves the history of what was
5185 done.  Note that to access the history of the file you
5186 must specify the old or the new name, depending on what
5187 portion of the history you are accessing.  For example,
5188 @code{cvs log @var{old}} will give the log up until the
5189 time of the rename.
5190
5191 When @var{new} is committed its revision numbers will
5192 start again, usually at 1.1, so if that bothers you,
5193 use the @samp{-r rev} option to commit.  For more
5194 information see @ref{Assigning revisions}.
5195
5196 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5197 @node Inside
5198 @subsection Moving the history file
5199
5200 This method is more dangerous, since it involves moving
5201 files inside the repository.  Read this entire section
5202 before trying it out!
5203
5204 @example
5205 $ cd $CVSROOT/@var{dir}
5206 $ mv @var{old},v @var{new},v
5207 @end example
5208
5209 @noindent
5210 Advantages:
5211
5212 @itemize @bullet
5213 @item
5214 The log of changes is maintained intact.
5215
5216 @item
5217 The revision numbers are not affected.
5218 @end itemize
5219
5220 @noindent
5221 Disadvantages:
5222
5223 @itemize @bullet
5224 @item
5225 Old releases cannot easily be fetched from the
5226 repository.  (The file will show up as @var{new} even
5227 in revisions from the time before it was renamed).
5228
5229 @item
5230 There is no log information of when the file was renamed.
5231
5232 @item
5233 Nasty things might happen if someone accesses the history file
5234 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5235 commands while you move it.
5236 @end itemize
5237
5238 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5239 @node Rename by copying
5240 @subsection Copying the history file
5241
5242 This way also involves direct modifications to the
5243 repository.  It is safe, but not without drawbacks.
5244
5245 @example
5246 # @r{Copy the @sc{rcs} file inside the repository}
5247 $ cd $CVSROOT/@var{dir}
5248 $ cp @var{old},v @var{new},v
5249 # @r{Remove the old file}
5250 $ cd ~/@var{dir}
5251 $ rm @var{old}
5252 $ cvs remove @var{old}
5253 $ cvs commit @var{old}
5254 # @r{Remove all tags from @var{new}}
5255 $ cvs update @var{new}
5256 $ cvs log @var{new}             # @r{Remember the non-branch tag names}
5257 $ cvs tag -d @var{tag1} @var{new}
5258 $ cvs tag -d @var{tag2} @var{new}
5259 @dots{}
5260 @end example
5261
5262 By removing the tags you will be able to check out old
5263 revisions.
5264
5265 @noindent
5266 Advantages:
5267
5268 @itemize @bullet
5269 @item
5270 @c FIXME: Is this true about -D now that we have death
5271 @c support?  See 5B.3 in the FAQ.
5272 Checking out old revisions works correctly, as long as
5273 you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
5274 to retrieve the revisions.
5275
5276 @item
5277 The log of changes is maintained intact.
5278
5279 @item
5280 The revision numbers are not affected.
5281 @end itemize
5282
5283 @noindent
5284 Disadvantages:
5285
5286 @itemize @bullet
5287 @item
5288 You cannot easily see the history of the file across the rename.
5289
5290 @ignore
5291 @c Is this true?  I don't see how the revision numbers
5292 @c _could_ start over, when new,v is just old,v with
5293 @c the tags deleted.
5294 @c If there is some need to reinstate this text,
5295 @c it is "usually 1.1", not "1.0" and it needs an
5296 @c xref to Assigning revisions
5297 @item
5298 Unless you use the @samp{-r rev} (@pxref{commit
5299 options}) flag when @var{new} is committed its revision
5300 numbers will start at 1.0 again.
5301 @end ignore
5302 @end itemize
5303
5304 @c ---------------------------------------------------------------------
5305 @node Moving directories
5306 @section Moving and renaming directories
5307 @cindex Moving directories
5308 @cindex Renaming directories
5309 @cindex Directories, moving
5310
5311 The normal way to rename or move a directory is to
5312 rename or move each file within it as described in
5313 @ref{Outside}.  Then check out with the @samp{-P}
5314 option, as described in @ref{Removing directories}.
5315
5316 If you really want to hack the repository to rename or
5317 delete a directory in the repository, you can do it
5318 like this:
5319
5320 @enumerate
5321 @item
5322 Inform everyone who has a checked out copy of the directory that the
5323 directory will be renamed.  They should commit all
5324 their changes, and remove their working copies,
5325 before you take the steps below.
5326
5327 @item
5328 Rename the directory inside the repository.
5329
5330 @example
5331 $ cd $CVSROOT/@var{parent-dir}
5332 $ mv @var{old-dir} @var{new-dir}
5333 @end example
5334
5335 @item
5336 Fix the @sc{cvs} administrative files, if necessary (for
5337 instance if you renamed an entire module).
5338
5339 @item
5340 Tell everyone that they can check out again and continue
5341 working.
5342
5343 @end enumerate
5344
5345 If someone had a working copy the @sc{cvs} commands will
5346 cease to work for him, until he removes the directory
5347 that disappeared inside the repository.
5348
5349 It is almost always better to move the files in the
5350 directory instead of moving the directory.  If you move the
5351 directory you are unlikely to be able to retrieve old
5352 releases correctly, since they probably depend on the
5353 name of the directories.
5354
5355 @c ---------------------------------------------------------------------
5356 @node History browsing
5357 @chapter History browsing
5358 @cindex History browsing
5359 @cindex Traceability
5360 @cindex Isolation
5361
5362 @ignore
5363 @c This is too long for an introduction (goal is
5364 @c one 20x80 character screen), and also mixes up a
5365 @c variety of issues (parallel development, history,
5366 @c maybe even touches on process control).
5367
5368 @c -- @quote{To lose ones history is to lose ones soul.}
5369 @c -- ///
5370 @c -- ///Those who cannot remember the past are condemned to repeat it.
5371 @c -- ///               -- George Santayana
5372 @c -- ///
5373
5374 @sc{cvs} tries to make it easy for a group of people to work
5375 together.  This is done in two ways:
5376
5377 @itemize @bullet
5378 @item
5379 Isolation---You have your own working copy of the
5380 source.  You are not affected by modifications made by
5381 others until you decide to incorporate those changes
5382 (via the @code{update} command---@pxref{update}).
5383
5384 @item
5385 Traceability---When something has changed, you can
5386 always see @emph{exactly} what changed.
5387 @end itemize
5388
5389 There are several features of @sc{cvs} that together lead
5390 to traceability:
5391
5392 @itemize @bullet
5393 @item
5394 Each revision of a file has an accompanying log
5395 message.
5396
5397 @item
5398 All commits are optionally logged to a central history
5399 database.
5400
5401 @item
5402 Logging information can be sent to a user-defined
5403 program (@pxref{loginfo}).
5404 @end itemize
5405
5406 @c -- More text here.
5407
5408 This chapter should talk about the history file, the
5409 @code{log} command, the usefulness of ChangeLogs
5410 even when you run @sc{cvs}, and things like that.
5411
5412 @end ignore
5413
5414 @c kind of lame, in a lot of ways the above text inside
5415 @c the @ignore motivates this chapter better
5416 Once you have used @sc{cvs} to store a version control
5417 history---what files have changed when, how, and by
5418 whom, there are a variety of mechanisms for looking
5419 through the history.
5420
5421 @c FIXME: should also be talking about how you look at
5422 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5423 @menu
5424 * log messages::                Log messages
5425 * history database::            The history database
5426 * user-defined logging::        User-defined logging
5427 @end menu
5428
5429 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5430 @node log messages
5431 @section Log messages
5432
5433 @c FIXME: @xref to place where we talk about how to
5434 @c specify message to commit.
5435 Whenever you commit a file you specify a log message.
5436
5437 @c FIXME: bring the information here, and get rid of or
5438 @c greatly shrink the "log" node.
5439 To look through the log messages which have been
5440 specified for every revision which has been committed,
5441 use the @code{cvs log} command (@pxref{log}).
5442
5443 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5444 @node history database
5445 @section The history database
5446
5447 @c FIXME: bring the information from the history file
5448 @c and history nodes here.  Rewrite it to be motivated
5449 @c better (start out by clearly explaining what gets
5450 @c logged in history, for example).
5451 You can use the history file (@pxref{history file}) to
5452 log various @sc{cvs} actions.  To retrieve the
5453 information from the history file, use the @code{cvs
5454 history} command (@pxref{history}).
5455
5456 Note: you can control what is logged to this file by using the
5457 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5458 (@pxref{config}).
5459
5460 @c
5461 @c The history database has many problems:
5462 @c * It is very unclear what field means what.  This
5463 @c could be improved greatly by better documentation,
5464 @c but there are still non-orthogonalities (for
5465 @c example, tag does not record the "repository"
5466 @c field but most records do).
5467 @c * Confusion about files, directories, and modules.
5468 @c Some commands record one, some record others.
5469 @c * File removal is not logged.  There is an 'R'
5470 @c record type documented, but CVS never uses it.
5471 @c * Tags are only logged for the "cvs rtag" command,
5472 @c not "cvs tag".  The fix for this is not completely
5473 @c clear (see above about modules vs. files).
5474 @c * Are there other cases of operations that are not
5475 @c logged?  One would hope for all changes to the
5476 @c repository to be logged somehow (particularly
5477 @c operations like tagging, "cvs admin -k", and other
5478 @c operations which do not record a history that one
5479 @c can get with "cvs log").  Operations on the working
5480 @c directory, like export, get, and release, are a
5481 @c second category also covered by the current "cvs
5482 @c history".
5483 @c * The history file does not record the options given
5484 @c to a command.  The most serious manifestation of
5485 @c this is perhaps that it doesn't record whether a command
5486 @c was recursive.  It is not clear to me whether one
5487 @c wants to log at a level very close to the command
5488 @c line, as a sort of way of logging each command
5489 @c (more or less), or whether one wants
5490 @c to log more at the level of what was changed (or
5491 @c something in between), but either way the current
5492 @c information has pretty big gaps.
5493 @c * Further details about a tag--like whether it is a
5494 @c branch tag or, if a non-branch tag, which branch it
5495 @c is on.  One can find out this information about the
5496 @c tag as it exists _now_, but if the tag has been
5497 @c moved, one doesn't know what it was like at the time
5498 @c the history record was written.
5499 @c * Whether operating on a particular tag, date, or
5500 @c options was implicit (sticky) or explicit.
5501 @c
5502 @c Another item, only somewhat related to the above, is a
5503 @c way to control what is logged in the history file.
5504 @c This is probably the only good way to handle
5505 @c different people having different ideas about
5506 @c information/space tradeoffs.
5507 @c
5508 @c It isn't really clear that it makes sense to try to
5509 @c patch up the history file format as it exists now to
5510 @c include all that stuff.  It might be better to
5511 @c design a whole new CVSROOT/nhistory file and "cvs
5512 @c nhistory" command, or some such, or in some other
5513 @c way trying to come up with a clean break from the
5514 @c past, which can address the above concerns.  Another
5515 @c open question is how/whether this relates to
5516 @c taginfo/loginfo/etc.
5517
5518 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5519 @node user-defined logging
5520 @section User-defined logging
5521
5522 @c FIXME: probably should centralize this information
5523 @c here, at least to some extent.  Maybe by moving the
5524 @c loginfo, etc., nodes here and replacing
5525 @c the "user-defined logging" node with one node for
5526 @c each method.
5527 You can customize @sc{cvs} to log various kinds of
5528 actions, in whatever manner you choose.  These
5529 mechanisms operate by executing a script at various
5530 times.  The script might append a message to a file
5531 listing the information and the programmer who created
5532 it, or send mail to a group of developers, or, perhaps,
5533 post a message to a particular newsgroup.  To log
5534 commits, use the @file{loginfo} file (@pxref{loginfo}), and
5535 to log tagging operations, use the @file{taginfo} file
5536 (@pxref{taginfo}).
5537
5538 @c FIXME: What is difference between doing it in the
5539 @c modules file and using loginfo/taginfo?  Why should
5540 @c user use one or the other?
5541 To log commits, checkouts, exports, and tags,
5542 respectively, you can also use the @samp{-i},
5543 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5544 modules file.  For a more flexible way of giving
5545 notifications to various users, which requires less in
5546 the way of keeping centralized scripts up to date, use
5547 the @code{cvs watch add} command (@pxref{Getting
5548 Notified}); this command is useful even if you are not
5549 using @code{cvs watch on}.
5550
5551 @c ---------------------------------------------------------------------
5552 @node Binary files
5553 @chapter Handling binary files
5554 @cindex Binary files
5555
5556 The most common use for @sc{cvs} is to store text
5557 files.  With text files, @sc{cvs} can merge revisions,
5558 display the differences between revisions in a
5559 human-visible fashion, and other such operations.
5560 However, if you are willing to give up a few of these
5561 abilities, @sc{cvs} can store binary files.  For
5562 example, one might store a web site in @sc{cvs}
5563 including both text files and binary images.
5564
5565 @menu
5566 * Binary why::     More details on issues with binary files
5567 * Binary howto::   How to store them
5568 @end menu
5569
5570 @node Binary why
5571 @section The issues with binary files
5572
5573 While the need to manage binary files may seem obvious
5574 if the files that you customarily work with are binary,
5575 putting them into version control does present some
5576 additional issues.
5577
5578 One basic function of version control is to show the
5579 differences between two revisions.  For example, if
5580 someone else checked in a new version of a file, you
5581 may wish to look at what they changed and determine
5582 whether their changes are good.  For text files,
5583 @sc{cvs} provides this functionality via the @code{cvs
5584 diff} command.  For binary files, it may be possible to
5585 extract the two revisions and then compare them with a
5586 tool external to @sc{cvs} (for example, word processing
5587 software often has such a feature).  If there is no
5588 such tool, one must track changes via other mechanisms,
5589 such as urging people to write good log messages, and
5590 hoping that the changes they actually made were the
5591 changes that they intended to make.
5592
5593 Another ability of a version control system is the
5594 ability to merge two revisions.  For @sc{cvs} this
5595 happens in two contexts.  The first is when users make
5596 changes in separate working directories
5597 (@pxref{Multiple developers}).  The second is when one
5598 merges explicitly with the @samp{update -j} command
5599 (@pxref{Branching and merging}).
5600
5601 In the case of text
5602 files, @sc{cvs} can merge changes made independently,
5603 and signal a conflict if the changes conflict.  With
5604 binary files, the best that @sc{cvs} can do is present
5605 the two different copies of the file, and leave it to
5606 the user to resolve the conflict.  The user may choose
5607 one copy or the other, or may run an external merge
5608 tool which knows about that particular file format, if
5609 one exists.
5610 Note that having the user merge relies primarily on the
5611 user to not accidentally omit some changes, and thus is
5612 potentially error prone.
5613
5614 If this process is thought to be undesirable, the best
5615 choice may be to avoid merging.  To avoid the merges
5616 that result from separate working directories, see the
5617 discussion of reserved checkouts (file locking) in
5618 @ref{Multiple developers}.  To avoid the merges
5619 resulting from branches, restrict use of branches.
5620
5621 @node Binary howto
5622 @section How to store binary files
5623
5624 There are two issues with using @sc{cvs} to store
5625 binary files.  The first is that @sc{cvs} by default
5626 converts line endings between the canonical form in
5627 which they are stored in the repository (linefeed
5628 only), and the form appropriate to the operating system
5629 in use on the client (for example, carriage return
5630 followed by line feed for Windows NT).
5631
5632 The second is that a binary file might happen to
5633 contain data which looks like a keyword (@pxref{Keyword
5634 substitution}), so keyword expansion must be turned
5635 off.
5636
5637 @c FIXME: the third is that one can't do merges with
5638 @c binary files.  xref to Multiple Developers and the
5639 @c reserved checkout issues.
5640
5641 The @samp{-kb} option available with some @sc{cvs}
5642 commands insures that neither line ending conversion
5643 nor keyword expansion will be done.
5644
5645 Here is an example of how you can create a new file
5646 using the @samp{-kb} flag:
5647
5648 @example
5649 $ echo '$@splitrcskeyword{Id}$' > kotest
5650 $ cvs add -kb -m"A test file" kotest
5651 $ cvs ci -m"First checkin; contains a keyword" kotest
5652 @end example
5653
5654 If a file accidentally gets added without @samp{-kb},
5655 one can use the @code{cvs admin} command to recover.
5656 For example:
5657
5658 @example
5659 $ echo '$@splitrcskeyword{Id}$' > kotest
5660 $ cvs add -m"A test file" kotest
5661 $ cvs ci -m"First checkin; contains a keyword" kotest
5662 $ cvs admin -kb kotest
5663 $ cvs update -A kotest
5664 # @r{For non-unix systems:}
5665 # @r{Copy in a good copy of the file from outside CVS}
5666 $ cvs commit -m "make it binary" kotest
5667 @end example
5668
5669 @c Trying to describe this for both unix and non-unix
5670 @c in the same description is very confusing.  Might
5671 @c want to split the two, or just ditch the unix "shortcut"
5672 @c (unixheads don't do much with binary files, anyway).
5673 @c This used to say "(Try the above example, and do a
5674 @c @code{cat kotest} after every command)".  But that
5675 @c only really makes sense for the unix case.
5676 When you check in the file @file{kotest} the file is
5677 not preserved as a binary file, because you did not
5678 check it in as a binary file.  The @code{cvs
5679 admin -kb} command sets the default keyword
5680 substitution method for this file, but it does not
5681 alter the working copy of the file that you have.  If you need to
5682 cope with line endings (that is, you are using
5683 @sc{cvs} on a non-unix system), then you need to
5684 check in a new copy of the file, as shown by the
5685 @code{cvs commit} command above.
5686 On unix, the @code{cvs update -A} command suffices.
5687 @c FIXME: should also describe what the *other users*
5688 @c need to do, if they have checked out copies which
5689 @c have been corrupted by lack of -kb.  I think maybe
5690 @c "cvs update -kb" or "cvs
5691 @c update -A" would suffice, although the user who
5692 @c reported this suggested removing the file, manually
5693 @c removing it from CVS/Entries, and then "cvs update"
5694 (Note that you can use @code{cvs log} to determine the default keyword
5695 substitution method for a file and @code{cvs status} to determine
5696 the keyword substitution method for a working copy.)
5697
5698 However, in using @code{cvs admin -k} to change the
5699 keyword expansion, be aware that the keyword expansion
5700 mode is not version controlled.  This means that, for
5701 example, that if you have a text file in old releases,
5702 and a binary file with the same name in new releases,
5703 @sc{cvs} provides no way to check out the file in text
5704 or binary mode depending on what version you are
5705 checking out.  There is no good workaround for this
5706 problem.
5707
5708 You can also set a default for whether @code{cvs add}
5709 and @code{cvs import} treat a file as binary based on
5710 its name; for example you could say that files who
5711 names end in @samp{.exe} are binary.  @xref{Wrappers}.
5712 There is currently no way to have @sc{cvs} detect
5713 whether a file is binary based on its contents.  The
5714 main difficulty with designing such a feature is that
5715 it is not clear how to distinguish between binary and
5716 non-binary files, and the rules to apply would vary
5717 considerably with the operating system.
5718 @c For example, it would be good on MS-DOS-family OSes
5719 @c for anything containing ^Z to be binary.  Having
5720 @c characters with the 8th bit set imply binary is almost
5721 @c surely a bad idea in the context of ISO-8859-* and
5722 @c other such character sets.  On VMS or the Mac, we
5723 @c could use the OS's file typing.  This is a
5724 @c commonly-desired feature, and something of this sort
5725 @c may make sense.  But there are a lot of pitfalls here.
5726 @c
5727 @c Another, probably better, way to tell is to read the
5728 @c file in text mode, write it to a temp file in text
5729 @c mode, and then do a binary mode compare of the two
5730 @c files.  If they differ, it is a binary file.  This
5731 @c might have problems on VMS (or some other system
5732 @c with several different text modes), but in general
5733 @c should be relatively portable.  The only other
5734 @c downside I can think of is that it would be fairly
5735 @c slow, but that is perhaps a small price to pay for
5736 @c not having your files corrupted.  Another issue is
5737 @c what happens if you import a text file with bare
5738 @c linefeeds on Windows.  Such files will show up on
5739 @c Windows sometimes (I think some native windows
5740 @c programs even write them, on occasion).  Perhaps it
5741 @c is reasonable to treat such files as binary; after
5742 @c all it is something of a presumption to assume that
5743 @c the user would want the linefeeds converted to CRLF.
5744
5745 @c ---------------------------------------------------------------------
5746 @node Multiple developers
5747 @chapter Multiple developers
5748 @cindex Multiple developers
5749 @cindex Team of developers
5750 @cindex File locking
5751 @cindex Locking files
5752 @cindex Working copy
5753 @cindex Reserved checkouts
5754 @cindex Unreserved checkouts
5755 @cindex RCS-style locking
5756
5757 When more than one person works on a software project
5758 things often get complicated.  Often, two people try to
5759 edit the same file simultaneously.  One solution, known
5760 as @dfn{file locking} or @dfn{reserved checkouts}, is
5761 to allow only one person to edit each file at a time.
5762 This is the only solution with some version control
5763 systems, including @sc{rcs} and @sc{sccs}.  Currently
5764 the usual way to get reserved checkouts with @sc{cvs}
5765 is the @code{cvs admin -l} command (@pxref{admin
5766 options}).  This is not as nicely integrated into
5767 @sc{cvs} as the watch features, described below, but it
5768 seems that most people with a need for reserved
5769 checkouts find it adequate.
5770 @c Or "find it better than worrying about implementing
5771 @c nicely integrated reserved checkouts" or ...?
5772 It also may be possible to use the watches
5773 features described below, together with suitable
5774 procedures (not enforced by software), to avoid having
5775 two people edit at the same time.
5776
5777 @c Our unreserved checkout model might not
5778 @c be quite the same as others.  For example, I
5779 @c think that some systems will tend to create a branch
5780 @c in the case where CVS prints "up-to-date check failed".
5781 @c It isn't clear to me whether we should try to
5782 @c explore these subtleties; it could easily just
5783 @c confuse people.
5784 The default model with @sc{cvs} is known as
5785 @dfn{unreserved checkouts}.  In this model, developers
5786 can edit their own @dfn{working copy} of a file
5787 simultaneously.  The first person that commits his
5788 changes has no automatic way of knowing that another
5789 has started to edit it.  Others will get an error
5790 message when they try to commit the file.  They must
5791 then use @sc{cvs} commands to bring their working copy
5792 up to date with the repository revision.  This process
5793 is almost automatic.
5794
5795 @c FIXME? should probably use the word "watch" here, to
5796 @c tie this into the text below and above.
5797 @sc{cvs} also supports mechanisms which facilitate
5798 various kinds of communication, without actually
5799 enforcing rules like reserved checkouts do.
5800
5801 The rest of this chapter describes how these various
5802 models work, and some of the issues involved in
5803 choosing between them.
5804
5805 @ignore
5806 Here is a draft reserved checkout design or discussion
5807 of the issues.  This seems like as good a place as any
5808 for this.
5809
5810 Might want a cvs lock/cvs unlock--in which the names
5811 differ from edit/unedit because the network must be up
5812 for these to work.  unedit gives an error if there is a
5813 reserved checkout in place (so that people don't
5814 accidentally leave locks around); unlock gives an error
5815 if one is not in place (this is more arguable; perhaps
5816 it should act like unedit in that case).
5817
5818 On the other hand, might want it so that emacs,
5819 scripts, etc., can get ready to edit a file without
5820 having to know which model is in use.  In that case we
5821 would have a "cvs watch lock" (or .cvsrc?) (that is,
5822 three settings, "on", "off", and "lock").  Having cvs
5823 watch lock set would cause a get to record in the CVS
5824 directory which model is in use, and cause "cvs edit"
5825 to change behaviors.  We'd want a way to query which
5826 setting is in effect (this would be handy even if it is
5827 only "on" or "off" as presently).  If lock is in
5828 effect, then commit would require a lock before
5829 allowing a checkin; chmod wouldn't suffice (might be
5830 debatable--see chmod comment below, in watches--but it
5831 is the way people expect RCS to work and I can't think
5832 of any significant downside.  On the other hand, maybe
5833 it isn't worth bothering, because people who are used
5834 to RCS wouldn't think to use chmod anyway).
5835
5836 Implementation: use file attributes or use RCS
5837 locking.  The former avoids more dependence on RCS
5838 behaviors we will need to re-implement as we librarify
5839 RCS, and makes it easier to import/export RCS files (in
5840 that context, want to ignore the locker field).  But
5841 note that RCS locks are per-branch, which is the
5842 correct behavior (this is also an issue for the "watch
5843 on" features; they should be per-branch too).
5844
5845 Here are a few more random notes about implementation
5846 details, assuming "cvs watch lock" and
5847
5848 CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
5849 Cases: (1) file is checked out (unreserved or with watch on) by old
5850 version of @sc{cvs}, now we do something with new one, (2) file is checked
5851 out by new version, now we do something with old one.
5852
5853 Remote protocol would have a "Watched" analogous to "Mode".  Of course
5854 it would apply to all Updated-like requests.  How do we keep this
5855 setting up to date?  I guess that there wants to be a Watched request,
5856 and the server would send a new one if it isn't up to date? (Ugh--hard
5857 to implement and slows down "cvs -q update"--is there an easier way?)
5858
5859 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
5860 "edit-lock" request.  Which comes back with a Checked-in with
5861 appropriate Watched (off, on, lock, locked, or some such?), or error
5862 message if already locked.
5863
5864 "cvs commit"--only will commit if off/on/locked.  lock is not OK.
5865
5866 Doc:
5867 note that "cvs edit" must be connected to network if watch lock is in
5868 effect.
5869
5870 Talk about what to do if someone has locked a file and you want to
5871 edit that file.  (breaking locks, or lack thereof).
5872
5873
5874 One other idea (which could work along with the
5875 existing "cvs admin -l" reserved checkouts, as well as
5876 the above):
5877
5878 "cvs editors" could show who has the file locked, if
5879 someone does.
5880
5881 @end ignore
5882
5883 @menu
5884 * File status::                 A file can be in several states
5885 * Updating a file::             Bringing a file up-to-date
5886 * Conflicts example::           An informative example
5887 * Informing others::            To cooperate you must inform
5888 * Concurrency::                 Simultaneous repository access
5889 * Watches::                     Mechanisms to track who is editing files
5890 * Choosing a model::            Reserved or unreserved checkouts?
5891 @end menu
5892
5893 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5894 @node File status
5895 @section File status
5896 @cindex File status
5897 @cindex Status of a file
5898
5899 @c Shouldn't this start with an example or something,
5900 @c introducing the unreserved checkout model?  Before we
5901 @c dive into listing states?
5902 Based on what operations you have performed on a
5903 checked out file, and what operations others have
5904 performed to that file in the repository, one can
5905 classify a file in a number of states.  The states, as
5906 reported by the @code{status} command, are:
5907
5908 @c The order of items is chosen to group logically
5909 @c similar outputs together.
5910 @c People who want alphabetical can use the index...
5911 @table @asis
5912 @cindex Up-to-date
5913 @item Up-to-date
5914 The file is identical with the latest revision in the
5915 repository for the branch in use.
5916 @c FIXME: should we clarify "in use"?  The answer is
5917 @c sticky tags, and trying to distinguish branch sticky
5918 @c tags from non-branch sticky tags seems rather awkward
5919 @c here.
5920 @c FIXME: What happens with non-branch sticky tags?  Is
5921 @c a stuck file "Up-to-date" or "Needs checkout" or what?
5922
5923 @item Locally Modified
5924 @cindex Locally Modified
5925 You have edited the file, and not yet committed your changes.
5926
5927 @item Locally Added
5928 @cindex Locally Added
5929 You have added the file with @code{add}, and not yet
5930 committed your changes.
5931 @c There are many cases involving the file being
5932 @c added/removed/modified in the working directory, and
5933 @c added/removed/modified in the repository, which we
5934 @c don't try to describe here.  I'm not sure that "cvs
5935 @c status" produces a non-confusing output in most of
5936 @c those cases.
5937
5938 @item Locally Removed
5939 @cindex Locally Removed
5940 You have removed the file with @code{remove}, and not yet
5941 committed your changes.
5942
5943 @item Needs Checkout
5944 @cindex Needs Checkout
5945 Someone else has committed a newer revision to the
5946 repository.  The name is slightly misleading; you will
5947 ordinarily use @code{update} rather than
5948 @code{checkout} to get that newer revision.
5949
5950 @item Needs Patch
5951 @cindex Needs Patch
5952 @c See also newb-123j0 in sanity.sh (although that case
5953 @c should probably be changed rather than documented).
5954 Like Needs Checkout, but the @sc{cvs} server will send
5955 a patch rather than the entire file.  Sending a patch or
5956 sending an entire file accomplishes the same thing.
5957
5958 @item Needs Merge
5959 @cindex Needs Merge
5960 Someone else has committed a newer revision to the repository, and you
5961 have also made modifications to the file.
5962
5963 @item Unresolved Conflict
5964 @cindex Unresolved Conflict
5965 @c FIXCVS - This file status needs to be changed to some more informative
5966 @c text that distinguishes it more clearly from each of the Locally Added,
5967 @c File had conflicts on merge, and Unknown status types, but an exact and
5968 @c succinct wording escapes me at the moment.
5969 A file with the same name as this new file has been added to the repository
5970 from a second workspace.  This file will need to be moved out of the way
5971 to allow an @code{update} to complete.
5972
5973 @item File had conflicts on merge
5974 @cindex File had conflicts on merge
5975 @c is it worth saying that this message was "Unresolved
5976 @c Conflict" in CVS 1.9 and earlier?  I'm inclined to
5977 @c think that is unnecessarily confusing to new users.
5978 This is like Locally Modified, except that a previous
5979 @code{update} command gave a conflict.  If you have not
5980 already done so, you need to
5981 resolve the conflict as described in @ref{Conflicts example}.
5982
5983 @item Unknown
5984 @cindex Unknown
5985 @sc{cvs} doesn't know anything about this file.  For
5986 example, you have created a new file and have not run
5987 @code{add}.
5988 @c
5989 @c "Entry Invalid" and "Classify Error" are also in the
5990 @c status.c.  The latter definitely indicates a CVS bug
5991 @c (should it be worded more like "internal error" so
5992 @c people submit bug reports if they see it?).  The former
5993 @c I'm not as sure; I haven't tracked down whether/when it
5994 @c appears in "cvs status" output.
5995
5996 @end table
5997
5998 To help clarify the file status, @code{status} also
5999 reports the @code{Working revision} which is the
6000 revision that the file in the working directory derives
6001 from, and the @code{Repository revision} which is the
6002 latest revision in the repository for the branch in
6003 use.
6004 @c FIXME: should we clarify "in use"?  The answer is
6005 @c sticky tags, and trying to distinguish branch sticky
6006 @c tags from non-branch sticky tags seems rather awkward
6007 @c here.
6008 @c FIXME: What happens with non-branch sticky tags?
6009 @c What is the Repository Revision there?  See the
6010 @c comment at vn_rcs in cvs.h, which is kind of
6011 @c confused--we really need to document better what this
6012 @c field contains.
6013 @c Q: Should we document "New file!" and other such
6014 @c outputs or are they self-explanatory?
6015 @c FIXME: what about the date to the right of "Working
6016 @c revision"?  It doesn't appear with client/server and
6017 @c seems unnecessary (redundant with "ls -l") so
6018 @c perhaps it should be removed for non-client/server too?
6019 @c FIXME: Need some examples.
6020 @c FIXME: Working revision can also be something like
6021 @c "-1.3" for a locally removed file.  Not at all
6022 @c self-explanatory (and it is possible that CVS should
6023 @c be changed rather than documenting this).
6024
6025 @c Would be nice to have an @example showing output
6026 @c from cvs status, with comments showing the xref
6027 @c where each part of the output is described.  This
6028 @c might fit in nicely if it is desirable to split this
6029 @c node in two; one to introduce "cvs status" and one
6030 @c to list each of the states.
6031 The options to @code{status} are listed in
6032 @ref{Invoking CVS}.  For information on its @code{Sticky tag}
6033 and @code{Sticky date} output, see @ref{Sticky tags}.
6034 For information on its @code{Sticky options} output,
6035 see the @samp{-k} option in @ref{update options}.
6036
6037 You can think of the @code{status} and @code{update}
6038 commands as somewhat complementary.  You use
6039 @code{update} to bring your files up to date, and you
6040 can use @code{status} to give you some idea of what an
6041 @code{update} would do (of course, the state of the
6042 repository might change before you actually run
6043 @code{update}).  In fact, if you want a command to
6044 display file status in a more brief format than is
6045 displayed by the @code{status} command, you can invoke
6046
6047 @cindex update, to display file status
6048 @example
6049 $ cvs -n -q update
6050 @end example
6051
6052 The @samp{-n} option means to not actually do the
6053 update, but merely to display statuses; the @samp{-q}
6054 option avoids printing the name of each directory.  For
6055 more information on the @code{update} command, and
6056 these options, see @ref{Invoking CVS}.
6057
6058 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6059 @node Updating a file
6060 @section Bringing a file up to date
6061 @cindex Bringing a file up to date
6062 @cindex Updating a file
6063 @cindex Merging a file
6064 @cindex Update, introduction
6065
6066 When you want to update or merge a file, use the @code{update}
6067 command.  For files that are not up to date this is roughly equivalent
6068 to a @code{checkout} command: the newest revision of the file is
6069 extracted from the repository and put in your working directory.
6070
6071 Your modifications to a file are never lost when you
6072 use @code{update}.  If no newer revision exists,
6073 running @code{update} has no effect.  If you have
6074 edited the file, and a newer revision is available,
6075 @sc{cvs} will merge all changes into your working copy.
6076
6077 For instance, imagine that you checked out revision 1.4 and started
6078 editing it.  In the meantime someone else committed revision 1.5, and
6079 shortly after that revision 1.6.  If you run @code{update} on the file
6080 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
6081 your file.
6082
6083 @cindex Overlap
6084 If any of the changes between 1.4 and 1.6 were made too
6085 close to any of the changes you have made, an
6086 @dfn{overlap} occurs.  In such cases a warning is
6087 printed, and the resulting file includes both
6088 versions of the lines that overlap, delimited by
6089 special markers.
6090 @xref{update}, for a complete description of the
6091 @code{update} command.
6092
6093 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6094 @node Conflicts example
6095 @section Conflicts example
6096 @cindex Merge, an example
6097 @cindex Example of merge
6098 @cindex driver.c (merge example)
6099
6100 Suppose revision 1.4 of @file{driver.c} contains this:
6101
6102 @example
6103 #include <stdio.h>
6104
6105 void main()
6106 @{
6107     parse();
6108     if (nerr == 0)
6109         gencode();
6110     else
6111         fprintf(stderr, "No code generated.\n");
6112     exit(nerr == 0 ? 0 : 1);
6113 @}
6114 @end example
6115
6116 @noindent
6117 Revision 1.6 of @file{driver.c} contains this:
6118
6119 @example
6120 #include <stdio.h>
6121
6122 int main(int argc,
6123          char **argv)
6124 @{
6125     parse();
6126     if (argc != 1)
6127     @{
6128         fprintf(stderr, "tc: No args expected.\n");
6129         exit(1);
6130     @}
6131     if (nerr == 0)
6132         gencode();
6133     else
6134         fprintf(stderr, "No code generated.\n");
6135     exit(!!nerr);
6136 @}
6137 @end example
6138
6139 @noindent
6140 Your working copy of @file{driver.c}, based on revision
6141 1.4, contains this before you run @samp{cvs update}:
6142 @c -- Really include "cvs"?
6143
6144 @example
6145 #include <stdlib.h>
6146 #include <stdio.h>
6147
6148 void main()
6149 @{
6150     init_scanner();
6151     parse();
6152     if (nerr == 0)
6153         gencode();
6154     else
6155         fprintf(stderr, "No code generated.\n");
6156     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6157 @}
6158 @end example
6159
6160 @noindent
6161 You run @samp{cvs update}:
6162 @c -- Really include "cvs"?
6163
6164 @example
6165 $ cvs update driver.c
6166 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6167 retrieving revision 1.4
6168 retrieving revision 1.6
6169 Merging differences between 1.4 and 1.6 into driver.c
6170 rcsmerge warning: overlaps during merge
6171 cvs update: conflicts found in driver.c
6172 C driver.c
6173 @end example
6174
6175 @noindent
6176 @cindex Conflicts (merge example)
6177 @sc{cvs} tells you that there were some conflicts.
6178 Your original working file is saved unmodified in
6179 @file{.#driver.c.1.4}.  The new version of
6180 @file{driver.c} contains this:
6181
6182 @example
6183 #include <stdlib.h>
6184 #include <stdio.h>
6185
6186 int main(int argc,
6187          char **argv)
6188 @{
6189     init_scanner();
6190     parse();
6191     if (argc != 1)
6192     @{
6193         fprintf(stderr, "tc: No args expected.\n");
6194         exit(1);
6195     @}
6196     if (nerr == 0)
6197         gencode();
6198     else
6199         fprintf(stderr, "No code generated.\n");
6200 @asis{}<<<<<<< driver.c
6201     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6202 @asis{}=======
6203     exit(!!nerr);
6204 @asis{}>>>>>>> 1.6
6205 @}
6206 @end example
6207
6208 @noindent
6209 @cindex Markers, conflict
6210 @cindex Conflict markers
6211 @cindex <<<<<<<
6212 @cindex >>>>>>>
6213 @cindex =======
6214
6215 Note how all non-overlapping modifications are incorporated in your working
6216 copy, and that the overlapping section is clearly marked with
6217 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6218
6219 @cindex Resolving a conflict
6220 @cindex Conflict resolution
6221 You resolve the conflict by editing the file, removing the markers and
6222 the erroneous line.  Suppose you end up with this file:
6223 @c -- Add xref to the pcl-cvs manual when it talks
6224 @c -- about this.
6225 @example
6226 #include <stdlib.h>
6227 #include <stdio.h>
6228
6229 int main(int argc,
6230          char **argv)
6231 @{
6232     init_scanner();
6233     parse();
6234     if (argc != 1)
6235     @{
6236         fprintf(stderr, "tc: No args expected.\n");
6237         exit(1);
6238     @}
6239     if (nerr == 0)
6240         gencode();
6241     else
6242         fprintf(stderr, "No code generated.\n");
6243     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6244 @}
6245 @end example
6246
6247 @noindent
6248 You can now go ahead and commit this as revision 1.7.
6249
6250 @example
6251 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6252 Checking in driver.c;
6253 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6254 new revision: 1.7; previous revision: 1.6
6255 done
6256 @end example
6257
6258 For your protection, @sc{cvs} will refuse to check in a
6259 file if a conflict occurred and you have not resolved
6260 the conflict.  Currently to resolve a conflict, you
6261 must change the timestamp on the file.  In previous
6262 versions of @sc{cvs}, you also needed to
6263 insure that the file contains no conflict markers.
6264 Because
6265 your file may legitimately contain conflict markers (that
6266 is, occurrences of @samp{>>>>>>> } at the start of a
6267 line that don't mark a conflict), the current
6268 version of @sc{cvs} will print a warning and proceed to
6269 check in the file.
6270 @c The old behavior was really icky; the only way out
6271 @c was to start hacking on
6272 @c the @code{CVS/Entries} file or other such workarounds.
6273 @c
6274 @c If the timestamp thing isn't considered nice enough,
6275 @c maybe there should be a "cvs resolved" command
6276 @c which clears the conflict indication.  For a nice user
6277 @c interface, this should be invoked by an interactive
6278 @c merge tool like emerge rather than by the user
6279 @c directly--such a tool can verify that the user has
6280 @c really dealt with each conflict.
6281
6282 @cindex emerge
6283 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6284 Emacs front-end for @sc{cvs}) you can use an Emacs
6285 package called emerge to help you resolve conflicts.
6286 See the documentation for pcl-cvs.
6287
6288 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6289 @node Informing others
6290 @section Informing others about commits
6291 @cindex Informing others
6292 @cindex Spreading information
6293 @cindex Mail, automatic mail on commit
6294
6295 It is often useful to inform others when you commit a
6296 new revision of a file.  The @samp{-i} option of the
6297 @file{modules} file, or the @file{loginfo} file, can be
6298 used to automate this process.  @xref{modules}.
6299 @xref{loginfo}.  You can use these features of @sc{cvs}
6300 to, for instance, instruct @sc{cvs} to mail a
6301 message to all developers, or post a message to a local
6302 newsgroup.
6303 @c -- More text would be nice here.
6304
6305 @node Concurrency
6306 @section Several developers simultaneously attempting to run CVS
6307
6308 @cindex Locks, cvs, introduction
6309 @c For a discussion of *why* CVS creates locks, see
6310 @c the comment at the start of src/lock.c
6311 If several developers try to run @sc{cvs} at the same
6312 time, one may get the following message:
6313
6314 @example
6315 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6316 @end example
6317
6318 @cindex #cvs.rfl, removing
6319 @cindex #cvs.wfl, removing
6320 @cindex #cvs.lock, removing
6321 @sc{cvs} will try again every 30 seconds, and either
6322 continue with the operation or print the message again,
6323 if it still needs to wait.  If a lock seems to stick
6324 around for an undue amount of time, find the person
6325 holding the lock and ask them about the cvs command
6326 they are running.  If they aren't running a cvs
6327 command, look in the repository directory mentioned in
6328 the message and remove files which they own whose names
6329 start with @file{#cvs.rfl},
6330 @file{#cvs.wfl}, or @file{#cvs.lock}.
6331
6332 Note that these locks are to protect @sc{cvs}'s
6333 internal data structures and have no relationship to
6334 the word @dfn{lock} in the sense used by
6335 @sc{rcs}---which refers to reserved checkouts
6336 (@pxref{Multiple developers}).
6337
6338 Any number of people can be reading from a given
6339 repository at a time; only when someone is writing do
6340 the locks prevent other people from reading or writing.
6341
6342 @cindex Atomic transactions, lack of
6343 @cindex Transactions, atomic, lack of
6344 @c the following talks about what one might call commit/update
6345 @c atomicity.
6346 @c Probably also should say something about
6347 @c commit/commit atomicity, that is, "An update will
6348 @c not get partial versions of more than one commit".
6349 @c CVS currently has this property and I guess we can
6350 @c make it a documented feature.
6351 @c For example one person commits
6352 @c a/one.c and b/four.c and another commits a/two.c and
6353 @c b/three.c.  Then an update cannot get the new a/one.c
6354 @c and a/two.c and the old b/four.c and b/three.c.
6355 One might hope for the following property:
6356
6357 @quotation
6358 If someone commits some changes in one cvs command,
6359 then an update by someone else will either get all the
6360 changes, or none of them.
6361 @end quotation
6362
6363 @noindent
6364 but @sc{cvs} does @emph{not} have this property.  For
6365 example, given the files
6366
6367 @example
6368 a/one.c
6369 a/two.c
6370 b/three.c
6371 b/four.c
6372 @end example
6373
6374 @noindent
6375 if someone runs
6376
6377 @example
6378 cvs ci a/two.c b/three.c
6379 @end example
6380
6381 @noindent
6382 and someone else runs @code{cvs update} at the same
6383 time, the person running @code{update} might get only
6384 the change to @file{b/three.c} and not the change to
6385 @file{a/two.c}.
6386
6387 @node Watches
6388 @section Mechanisms to track who is editing files
6389 @cindex Watches
6390
6391 For many groups, use of @sc{cvs} in its default mode is
6392 perfectly satisfactory.  Users may sometimes go to
6393 check in a modification only to find that another
6394 modification has intervened, but they deal with it and
6395 proceed with their check in.  Other groups prefer to be
6396 able to know who is editing what files, so that if two
6397 people try to edit the same file they can choose to
6398 talk about who is doing what when rather than be
6399 surprised at check in time.  The features in this
6400 section allow such coordination, while retaining the
6401 ability of two developers to edit the same file at the
6402 same time.
6403
6404 @c Some people might ask why CVS does not enforce the
6405 @c rule on chmod, by requiring a cvs edit before a cvs
6406 @c commit.  The main reason is that it could always be
6407 @c circumvented--one could edit the file, and
6408 @c then when ready to check it in, do the cvs edit and put
6409 @c in the new contents and do the cvs commit.  One
6410 @c implementation note: if we _do_ want to have cvs commit
6411 @c require a cvs edit, we should store the state on
6412 @c whether the cvs edit has occurred in the working
6413 @c directory, rather than having the server try to keep
6414 @c track of what working directories exist.
6415 @c FIXME: should the above discussion be part of the
6416 @c manual proper, somewhere, not just in a comment?
6417 For maximum benefit developers should use @code{cvs
6418 edit} (not @code{chmod}) to make files read-write to
6419 edit them, and @code{cvs release} (not @code{rm}) to
6420 discard a working directory which is no longer in use,
6421 but @sc{cvs} is not able to enforce this behavior.
6422
6423 @c I'm a little dissatisfied with this presentation,
6424 @c because "watch on"/"edit"/"editors" are one set of
6425 @c functionality, and "watch add"/"watchers" is another
6426 @c which is somewhat orthogonal even though they interact in
6427 @c various ways.  But I think it might be
6428 @c confusing to describe them separately (e.g. "watch
6429 @c add" with loginfo).  I don't know.
6430
6431 @menu
6432 * Setting a watch::             Telling CVS to watch certain files
6433 * Getting Notified::            Telling CVS to notify you
6434 * Editing files::               How to edit a file which is being watched
6435 * Watch information::           Information about who is watching and editing
6436 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6437 @end menu
6438
6439 @node Setting a watch
6440 @subsection Telling CVS to watch certain files
6441
6442 To enable the watch features, you first specify that
6443 certain files are to be watched.
6444
6445 @cindex watch on (subcommand)
6446 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6447
6448 @cindex Read-only files, and watches
6449 Specify that developers should run @code{cvs edit}
6450 before editing @var{files}.  @sc{cvs} will create working
6451 copies of @var{files} read-only, to remind developers
6452 to run the @code{cvs edit} command before working on
6453 them.
6454
6455 If @var{files} includes the name of a directory, @sc{cvs}
6456 arranges to watch all files added to the corresponding
6457 repository directory, and sets a default for files
6458 added in the future; this allows the user to set
6459 notification policies on a per-directory basis.  The
6460 contents of the directory are processed recursively,
6461 unless the @code{-l} option is given.
6462 The @code{-R} option can be used to force recursion if the @code{-l}
6463 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6464
6465 If @var{files} is omitted, it defaults to the current directory.
6466
6467 @cindex watch off (subcommand)
6468 @end deffn
6469
6470 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6471
6472 Do not create @var{files} read-only on checkout; thus,
6473 developers will not be reminded to use @code{cvs edit}
6474 and @code{cvs unedit}.
6475 @ignore
6476 @sc{cvs} will check out @var{files}
6477 read-write as usual, unless other permissions override
6478 due to the @code{PreservePermissions} option being
6479 enabled in the @file{config} administrative file
6480 (@pxref{Special Files}, @pxref{config})
6481 @end ignore
6482
6483 The @var{files} and options are processed as for @code{cvs
6484 watch on}.
6485
6486 @end deffn
6487
6488 @node Getting Notified
6489 @subsection Telling CVS to notify you
6490
6491 You can tell @sc{cvs} that you want to receive
6492 notifications about various actions taken on a file.
6493 You can do this without using @code{cvs watch on} for
6494 the file, but generally you will want to use @code{cvs
6495 watch on}, to remind developers to use the @code{cvs edit}
6496 command.
6497
6498 @cindex watch add (subcommand)
6499 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6500
6501 Add the current user to the list of people to receive notification of
6502 work done on @var{files}.
6503
6504 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6505 the user about.  @var{action} is one of the following:
6506
6507 @table @code
6508
6509 @item edit
6510 Another user has applied the @code{cvs edit} command (described
6511 below) to a watched file.
6512
6513 @item commit
6514 Another user has committed changes to one of the named @var{files}.
6515
6516 @item unedit
6517 Another user has abandoned editing a file (other than by committing changes).
6518 They can do this in several ways, by:
6519
6520 @itemize @bullet
6521
6522 @item
6523 applying the @code{cvs unedit} command (described below) to the file
6524
6525 @item
6526 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6527 (or recursively to a directory more than one level up)
6528
6529 @item
6530 deleting the file and allowing @code{cvs update} to recreate it
6531
6532 @end itemize
6533
6534 @item all
6535 All of the above.
6536
6537 @item none
6538 None of the above.  (This is useful with @code{cvs edit},
6539 described below.)
6540
6541 @end table
6542
6543 The @code{-a} option may appear more than once, or not at all.  If
6544 omitted, the action defaults to @code{all}.
6545
6546 The @var{files} and options are processed as for
6547 @code{cvs watch on}.
6548
6549 @end deffn
6550
6551
6552 @cindex watch remove (subcommand)
6553 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6554
6555 Remove a notification request established using @code{cvs watch add};
6556 the arguments are the same.  If the @code{-a} option is present, only
6557 watches for the specified actions are removed.
6558
6559 @end deffn
6560
6561 @cindex notify (admin file)
6562 When the conditions exist for notification, @sc{cvs}
6563 calls the @file{notify} administrative file.  Edit
6564 @file{notify} as one edits the other administrative
6565 files (@pxref{Intro administrative files}).  This
6566 file follows the usual conventions for administrative
6567 files (@pxref{syntax}), where each line is a regular
6568 expression followed by a command to execute.  The
6569 command should contain a single occurrence of @samp{%s}
6570 which will be replaced by the user to notify; the rest
6571 of the information regarding the notification will be
6572 supplied to the command on standard input.  The
6573 standard thing to put in the @code{notify} file is the
6574 single line:
6575
6576 @example
6577 ALL mail %s -s "CVS notification"
6578 @end example
6579
6580 @noindent
6581 This causes users to be notified by electronic mail.
6582 @c FIXME: should it be this hard to set up this
6583 @c behavior (and the result when one fails to do so,
6584 @c silent failure to notify, so non-obvious)?  Should
6585 @c CVS give a warning if no line in notify matches (and
6586 @c document the use of "DEFAULT :" for the case where
6587 @c skipping the notification is indeed desired)?
6588
6589 @cindex users (admin file)
6590 Note that if you set this up in the straightforward
6591 way, users receive notifications on the server machine.
6592 One could of course write a @file{notify} script which
6593 directed notifications elsewhere, but to make this
6594 easy, @sc{cvs} allows you to associate a notification
6595 address for each user.  To do so create a file
6596 @file{users} in @file{CVSROOT} with a line for each
6597 user in the format @var{user}:@var{value}.  Then
6598 instead of passing the name of the user to be notified
6599 to @file{notify}, @sc{cvs} will pass the @var{value}
6600 (normally an email address on some other machine).
6601
6602 @sc{cvs} does not notify you for your own changes.
6603 Currently this check is done based on whether the user
6604 name of the person taking the action which triggers
6605 notification matches the user name of the person
6606 getting notification.  In fact, in general, the watches
6607 features only track one edit by each user.  It probably
6608 would be more useful if watches tracked each working
6609 directory separately, so this behavior might be worth
6610 changing.
6611 @c "behavior might be worth changing" is an effort to
6612 @c point to future directions while also not promising
6613 @c that "they" (as in "why don't they fix CVS to....")
6614 @c will do this.
6615 @c one implementation issue is identifying whether a
6616 @c working directory is same or different.  Comparing
6617 @c pathnames/hostnames is hopeless, but having the server
6618 @c supply a serial number which the client stores in the
6619 @c CVS directory as a magic cookie should work.
6620
6621 @node Editing files
6622 @subsection How to edit a file which is being watched
6623
6624 @cindex Checkout, as term for getting ready to edit
6625 Since a file which is being watched is checked out
6626 read-only, you cannot simply edit it.  To make it
6627 read-write, and inform others that you are planning to
6628 edit it, use the @code{cvs edit} command.  Some systems
6629 call this a @dfn{checkout}, but @sc{cvs} uses that term
6630 for obtaining a copy of the sources (@pxref{Getting the
6631 source}), an operation which those systems call a
6632 @dfn{get} or a @dfn{fetch}.
6633 @c Issue to think about: should we transition CVS
6634 @c towards the "get" terminology?  "cvs get" is already a
6635 @c synonym for "cvs checkout" and that section of the
6636 @c manual refers to "Getting the source".  If this is
6637 @c done, needs to be done gingerly (for example, we should
6638 @c still accept "checkout" in .cvsrc files indefinitely
6639 @c even if the CVS's messages are changed from "cvs checkout: "
6640 @c to "cvs get: ").
6641 @c There is a concern about whether "get" is not as
6642 @c good for novices because it is a more general term
6643 @c than "checkout" (and thus arguably harder to assign
6644 @c a technical meaning for).
6645
6646 @cindex edit (subcommand)
6647 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6648
6649 Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6650 @var{files} read-write, and notifies users who have requested
6651 @code{edit} notification for any of @var{files}.
6652
6653 The @code{cvs edit} command accepts the same options as the
6654 @code{cvs watch add} command, and establishes a temporary watch for the
6655 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6656 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
6657 receive notifications, she should specify @code{-a none}.
6658
6659 The @var{files} and the options are processed as for the @code{cvs
6660 watch} commands.
6661
6662 @ignore
6663 @strong{Caution: If the @code{PreservePermissions}
6664 option is enabled in the repository (@pxref{config}),
6665 @sc{cvs} will not change the permissions on any of the
6666 @var{files}.  The reason for this change is to ensure
6667 that using @samp{cvs edit} does not interfere with the
6668 ability to store file permissions in the @sc{cvs}
6669 repository.}
6670 @end ignore
6671
6672 @end deffn
6673
6674 Normally when you are done with a set of changes, you
6675 use the @code{cvs commit} command, which checks in your
6676 changes and returns the watched files to their usual
6677 read-only state.  But if you instead decide to abandon
6678 your changes, or not to make any changes, you can use
6679 the @code{cvs unedit} command.
6680
6681 @cindex unedit (subcommand)
6682 @cindex Abandoning work
6683 @cindex Reverting to repository version
6684 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6685
6686 Abandon work on the working files @var{files}, and revert them to the
6687 repository versions on which they are based.  @sc{cvs} makes those
6688 @var{files} read-only for which users have requested notification using
6689 @code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6690 notification for any of @var{files}.
6691
6692 The @var{files} and options are processed as for the
6693 @code{cvs watch} commands.
6694
6695 If watches are not in use, the @code{unedit} command
6696 probably does not work, and the way to revert to the
6697 repository version is with the command @code{cvs update -C file}
6698 (@pxref{update}).
6699 The meaning is
6700 not precisely the same; the latter may also
6701 bring in some changes which have been made in the
6702 repository since the last time you updated.
6703 @c It would be a useful enhancement to CVS to make
6704 @c unedit work in the non-watch case as well.
6705 @end deffn
6706
6707 When using client/server @sc{cvs}, you can use the
6708 @code{cvs edit} and @code{cvs unedit} commands even if
6709 @sc{cvs} is unable to successfully communicate with the
6710 server; the notifications will be sent upon the next
6711 successful @sc{cvs} command.
6712
6713 @node Watch information
6714 @subsection Information about who is watching and editing
6715
6716 @cindex watchers (subcommand)
6717 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6718
6719 List the users currently watching changes to @var{files}.  The report
6720 includes the files being watched, and the mail address of each watcher.
6721
6722 The @var{files} and options are processed as for the
6723 @code{cvs watch} commands.
6724
6725 @end deffn
6726
6727
6728 @cindex editors (subcommand)
6729 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6730
6731 List the users currently working on @var{files}.  The report
6732 includes the mail address of each user, the time when the user began
6733 working with the file, and the host and path of the working directory
6734 containing the file.
6735
6736 The @var{files} and options are processed as for the
6737 @code{cvs watch} commands.
6738
6739 @end deffn
6740
6741 @node Watches Compatibility
6742 @subsection Using watches with old versions of CVS
6743
6744 @cindex CVS 1.6, and watches
6745 If you use the watch features on a repository, it
6746 creates @file{CVS} directories in the repository and
6747 stores the information about watches in that directory.
6748 If you attempt to use @sc{cvs} 1.6 or earlier with the
6749 repository, you get an error message such as the
6750 following (all on one line):
6751
6752 @example
6753 cvs update: cannot open CVS/Entries for reading:
6754 No such file or directory
6755 @end example
6756
6757 @noindent
6758 and your operation will likely be aborted.  To use the
6759 watch features, you must upgrade all copies of @sc{cvs}
6760 which use that repository in local or server mode.  If
6761 you cannot upgrade, use the @code{watch off} and
6762 @code{watch remove} commands to remove all watches, and
6763 that will restore the repository to a state which
6764 @sc{cvs} 1.6 can cope with.
6765
6766 @node Choosing a model
6767 @section Choosing between reserved or unreserved checkouts
6768 @cindex Choosing, reserved or unreserved checkouts
6769
6770 Reserved and unreserved checkouts each have pros and
6771 cons.  Let it be said that a lot of this is a matter of
6772 opinion or what works given different groups' working
6773 styles, but here is a brief description of some of the
6774 issues.  There are many ways to organize a team of
6775 developers.  @sc{cvs} does not try to enforce a certain
6776 organization.  It is a tool that can be used in several
6777 ways.
6778
6779 Reserved checkouts can be very counter-productive.  If
6780 two persons want to edit different parts of a file,
6781 there may be no reason to prevent either of them from
6782 doing so.  Also, it is common for someone to take out a
6783 lock on a file, because they are planning to edit it,
6784 but then forget to release the lock.
6785
6786 @c "many groups"?  specifics?  cites to papers on this?
6787 @c some way to weasel-word it a bit more so we don't
6788 @c need facts :-)?
6789 People, especially people who are familiar with
6790 reserved checkouts, often wonder how often conflicts
6791 occur if unreserved checkouts are used, and how
6792 difficult they are to resolve.  The experience with
6793 many groups is that they occur rarely and usually are
6794 relatively straightforward to resolve.
6795
6796 The rarity of serious conflicts may be surprising, until one realizes
6797 that they occur only when two developers disagree on the proper design
6798 for a given section of code; such a disagreement suggests that the
6799 team has not been communicating properly in the first place.  In order
6800 to collaborate under @emph{any} source management regimen, developers
6801 must agree on the general design of the system; given this agreement,
6802 overlapping changes are usually straightforward to merge.
6803
6804 In some cases unreserved checkouts are clearly
6805 inappropriate.  If no merge tool exists for the kind of
6806 file you are managing (for example word processor files
6807 or files edited by Computer Aided Design programs), and
6808 it is not desirable to change to a program which uses a
6809 mergeable data format, then resolving conflicts is
6810 going to be unpleasant enough that you generally will
6811 be better off to simply avoid the conflicts instead, by
6812 using reserved checkouts.
6813
6814 The watches features described above in @ref{Watches}
6815 can be considered to be an intermediate model between
6816 reserved checkouts and unreserved checkouts.  When you
6817 go to edit a file, it is possible to find out who else
6818 is editing it.  And rather than having the system
6819 simply forbid both people editing the file, it can tell
6820 you what the situation is and let you figure out
6821 whether it is a problem in that particular case or not.
6822 Therefore, for some groups it can be considered the
6823 best of both the reserved checkout and unreserved
6824 checkout worlds.
6825
6826 @c ---------------------------------------------------------------------
6827 @node Revision management
6828 @chapter Revision management
6829 @cindex Revision management
6830
6831 @c -- This chapter could be expanded a lot.
6832 @c -- Experiences are very welcome!
6833
6834 If you have read this far, you probably have a pretty
6835 good grasp on what @sc{cvs} can do for you.  This
6836 chapter talks a little about things that you still have
6837 to decide.
6838
6839 If you are doing development on your own using @sc{cvs}
6840 you could probably skip this chapter.  The questions
6841 this chapter takes up become more important when more
6842 than one person is working in a repository.
6843
6844 @menu
6845 * When to commit::              Some discussion on the subject
6846 @end menu
6847
6848 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6849 @node When to commit
6850 @section When to commit?
6851 @cindex When to commit
6852 @cindex Committing, when to
6853 @cindex Policy
6854
6855 Your group should decide which policy to use regarding
6856 commits.  Several policies are possible, and as your
6857 experience with @sc{cvs} grows you will probably find
6858 out what works for you.
6859
6860 If you commit files too quickly you might commit files
6861 that do not even compile.  If your partner updates his
6862 working sources to include your buggy file, he will be
6863 unable to compile the code.  On the other hand, other
6864 persons will not be able to benefit from the
6865 improvements you make to the code if you commit very
6866 seldom, and conflicts will probably be more common.
6867
6868 It is common to only commit files after making sure
6869 that they can be compiled.  Some sites require that the
6870 files pass a test suite.  Policies like this can be
6871 enforced using the commitinfo file
6872 (@pxref{commitinfo}), but you should think twice before
6873 you enforce such a convention.  By making the
6874 development environment too controlled it might become
6875 too regimented and thus counter-productive to the real
6876 goal, which is to get software written.
6877
6878 @c ---------------------------------------------------------------------
6879 @node Keyword substitution
6880 @chapter Keyword substitution
6881 @cindex Keyword substitution
6882 @cindex Keyword expansion
6883 @cindex Identifying files
6884
6885 @comment   Be careful when editing this chapter.
6886 @comment   Remember that this file is kept under
6887 @comment   version control, so we must not accidentally
6888 @comment   include a valid keyword in the running text.
6889
6890 As long as you edit source files inside a working
6891 directory you can always find out the state of
6892 your files via @samp{cvs status} and @samp{cvs log}.
6893 But as soon as you export the files from your
6894 development environment it becomes harder to identify
6895 which revisions they are.
6896
6897 @sc{cvs} can use a mechanism known as @dfn{keyword
6898 substitution} (or @dfn{keyword expansion}) to help
6899 identifying the files.  Embedded strings of the form
6900 @code{$@var{keyword}$} and
6901 @code{$@var{keyword}:@dots{}$} in a file are replaced
6902 with strings of the form
6903 @code{$@var{keyword}:@var{value}$} whenever you obtain
6904 a new revision of the file.
6905
6906 @menu
6907 * Keyword list::                   Keywords
6908 * Using keywords::                 Using keywords
6909 * Avoiding substitution::          Avoiding substitution
6910 * Substitution modes::             Substitution modes
6911 * Configuring keyword expansion::  Configuring keyword expansion
6912 * Log keyword::                    Problems with the $@splitrcskeyword{Log}$ keyword.
6913 @end menu
6914
6915 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6916 @node Keyword list
6917 @section Keyword List
6918 @cindex Keyword List
6919
6920 @c FIXME: need some kind of example here I think,
6921 @c perhaps in a
6922 @c "Keyword intro" node.  The intro in the "Keyword
6923 @c substitution" node itself seems OK, but to launch
6924 @c into a list of the keywords somehow seems too abrupt.
6925
6926 This is a list of the keywords:
6927
6928 @table @code
6929 @cindex Author keyword
6930 @item $@splitrcskeyword{Author}$
6931 The login name of the user who checked in the revision.
6932
6933 @cindex CVSHeader keyword
6934 @item $@splitrcskeyword{CVSHeader}
6935 A standard header (similar to $@splitrcskeyword{Header}$, but with
6936 the CVS root stripped off). It contains the relative
6937 pathname of the @sc{rcs} file to the CVS root, the
6938 revision number, the date (UTC), the author, the state,
6939 and the locker (if locked). Files will normally never
6940 be locked when you use @sc{cvs}.
6941
6942 Note that this keyword has only been recently
6943 introduced to @sc{cvs} and may cause problems with
6944 existing installations if $@splitrcskeyword{CVSHeader}$ is already
6945 in the files for a different purpose. This keyword may
6946 be excluded using the @code{KeywordExpansion=eCVSHeader}
6947 in the @file{CVSROOT/config} file. 
6948 See @ref{Configuring keyword expansion} for more details.
6949
6950 @cindex Date keyword
6951 @item $@splitrcskeyword{Date}$
6952 The date and time (UTC) the revision was checked in.
6953
6954 @cindex Header keyword
6955 @item $@splitrcskeyword{Header}$
6956 A standard header containing the full pathname of the
6957 @sc{rcs} file, the revision number, the date (UTC), the
6958 author, the state, and the locker (if locked).  Files
6959 will normally never be locked when you use @sc{cvs}.
6960
6961 @cindex Id keyword
6962 @item $@splitrcskeyword{Id}$
6963 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
6964 filename is without a path.
6965
6966 @cindex Name keyword
6967 @item $@splitrcskeyword{Name}$
6968 Tag name used to check out this file.  The keyword is
6969 expanded only if one checks out with an explicit tag
6970 name.  For example, when running the command @code{cvs
6971 co -r first}, the keyword expands to @samp{Name: first}.
6972
6973 @cindex Locker keyword
6974 @item $@splitrcskeyword{Locker}$
6975 The login name of the user who locked the revision
6976 (empty if not locked, which is the normal case unless
6977 @code{cvs admin -l} is in use).
6978
6979 @cindex Log keyword
6980 @item $@splitrcskeyword{Log}$
6981 The log message supplied during commit, preceded by a
6982 header containing the @sc{rcs} filename, the revision
6983 number, the author, and the date (UTC).  Existing log
6984 messages are @emph{not} replaced.  Instead, the new log
6985 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
6986 Each new line is prefixed with the same string which
6987 precedes the @code{$Log} keyword.  For example, if the
6988 file contains:
6989
6990 @example
6991   /* Here is what people have been up to:
6992    *
6993    * $@splitrcskeyword{Log}: frob.c,v $
6994    * Revision 1.1  1997/01/03 14:23:51  joe
6995    * Add the superfrobnicate option
6996    *
6997    */
6998 @end example
6999
7000 @noindent
7001 then additional lines which are added when expanding
7002 the @code{$Log} keyword will be preceded by @samp{   * }.
7003 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
7004 @dfn{comment leader} from the @sc{rcs} file is not used.
7005 The @code{$Log} keyword is useful for
7006 accumulating a complete change log in a source file,
7007 but for several reasons it can be problematic.
7008 @xref{Log keyword}.
7009
7010 @cindex RCSfile keyword
7011 @item $@splitrcskeyword{RCSfile}$
7012 The name of the RCS file without a path.
7013
7014 @cindex Revision keyword
7015 @item $@splitrcskeyword{Revision}$
7016 The revision number assigned to the revision.
7017
7018 @cindex Source keyword
7019 @item $@splitrcskeyword{Source}$
7020 The full pathname of the RCS file.
7021
7022 @cindex State keyword
7023 @item $@splitrcskeyword{State}$
7024 The state assigned to the revision.  States can be
7025 assigned with @code{cvs admin -s}---see @ref{admin options}.
7026
7027 @cindex Local keyword
7028 @item Local keyword
7029 The @code{LocalKeyword} option in the @file{CVSROOT/config} file
7030 may be used to specify a local keyword which is to be
7031 used as an alias for one of the other keywords. For
7032 example, if the @file{CVSROOT/config} file contains
7033 a line with @code{LocalKeyword=MYBSD=CVSHeader}, then a
7034 file with the local keyword $@splitrcskeyword{MYBSD}$ will be
7035 expanded as if it were a $@splitrcskeyword{CVSHeader}$ keyword. If
7036 the src/frob.c file contained this keyword, it might
7037 look something like this:
7038
7039 @example
7040   /*
7041    * $@splitrcskeyword{MYBSD}: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $ 
7042    */
7043 @end example
7044
7045 Many repositories make use of a such a ``local
7046 keyword'' feature. An old patch to @sc{cvs} provided
7047 the @code{LocalKeyword} feature using a @code{tag=}
7048 option and called this the ``custom tag'' or ``local
7049 tag'' feature. It was used in conjunction with the
7050 what they called the @code{tagexpand=} option. In
7051 @sc{cvs} this other option is known as the
7052 @code{KeywordExpand} option. 
7053 See @ref{Configuring keyword expansion} for more
7054 details.
7055
7056 Examples from popular projects include:
7057 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7058 $@splitrcskeyword{OpenBSD}$, $@splitrcskeyword{XFree86}$,
7059 $@splitrcskeyword{Xorg}$.
7060
7061 The advantage of this is that you can include your
7062 local version information in a file using this local
7063 keyword without disrupting the upstream version
7064 information (which may be a different local keyword or
7065 a standard keyword). Allowing bug reports and the like
7066 to more properly identify the source of the original
7067 bug to the third-party and reducing the number of
7068 conflicts that arise during an import of a new version.
7069
7070 All keyword expansion except the local keyword may be
7071 disabled using the @code{KeywordExpansion} option in
7072 the @file{CVSROOT/config} file---see 
7073 @ref{Configuring keyword expansion} for more details.
7074
7075 @end table
7076
7077 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7078 @node Using keywords
7079 @section Using keywords
7080
7081 To include a keyword string you simply include the
7082 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
7083 file, and commit the file.  @sc{cvs} will automatically (Or,
7084 more accurately, as part of the update run that
7085 automatically happens after a commit.)
7086 expand the string as part of the commit operation.
7087
7088 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
7089 the source files so that it gets passed through to
7090 generated files.  For example, if you are managing
7091 computer program source code, you might include a
7092 variable which is initialized to contain that string.
7093 Or some C compilers may provide a @code{#pragma ident}
7094 directive.  Or a document management system might
7095 provide a way to pass a string through to generated
7096 files.
7097
7098 @c Would be nice to give an example, but doing this in
7099 @c portable C is not possible and the problem with
7100 @c picking any one language (VMS HELP files, Ada,
7101 @c troff, whatever) is that people use CVS for all
7102 @c kinds of files.
7103
7104 @cindex Ident (shell command)
7105 The @code{ident} command (which is part of the @sc{rcs}
7106 package) can be used to extract keywords and their
7107 values from a file.  This can be handy for text files,
7108 but it is even more useful for extracting keywords from
7109 binary files.
7110
7111 @example
7112 $ ident samp.c
7113 samp.c:
7114      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7115 $ gcc samp.c
7116 $ ident a.out
7117 a.out:
7118      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7119 @end example
7120
7121 @cindex What (shell command)
7122 S@sc{ccs} is another popular revision control system.
7123 It has a command, @code{what}, which is very similar to
7124 @code{ident} and used for the same purpose.  Many sites
7125 without @sc{rcs} have @sc{sccs}.  Since @code{what}
7126 looks for the character sequence @code{@@(#)} it is
7127 easy to include keywords that are detected by either
7128 command.  Simply prefix the keyword with the
7129 magic @sc{sccs} phrase, like this:
7130
7131 @example
7132 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
7133 @end example
7134
7135 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7136 @node Avoiding substitution
7137 @section Avoiding substitution
7138
7139 Keyword substitution has its disadvantages.  Sometimes
7140 you might want the literal text string
7141 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
7142 @sc{cvs} interpreting it as a keyword and expanding it
7143 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
7144
7145 There is unfortunately no way to selectively turn off
7146 keyword substitution.  You can use @samp{-ko}
7147 (@pxref{Substitution modes}) to turn off keyword
7148 substitution entirely.
7149
7150 In many cases you can avoid using keywords in
7151 the source, even though they appear in the final
7152 product.  For example, the source for this manual
7153 contains @samp{$@@asis@{@}Author$} whenever the text
7154 @samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
7155 and @code{troff} you can embed the null-character
7156 @code{\&} inside the keyword for a similar effect.
7157
7158 It is also possible to specify an explicit list of
7159 keywords to include or exclude using the
7160 @code{KeywordExpand} option in the
7161 @file{CVSROOT/config} file--see @ref{Configuring keyword expansion}
7162 for more details. This feature is intended primarily
7163 for use with the @code{LocalKeyword} option--see
7164 @ref{Keyword list}.
7165
7166 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7167 @node Substitution modes
7168 @section Substitution modes
7169 @cindex Keyword substitution, changing modes
7170 @cindex -k (keyword substitution)
7171 @cindex Kflag
7172
7173 @c FIXME: This could be made more coherent, by expanding it
7174 @c with more examples or something.
7175 Each file has a stored default substitution mode, and
7176 each working directory copy of a file also has a
7177 substitution mode.  The former is set by the @samp{-k}
7178 option to @code{cvs add} and @code{cvs admin}; the
7179 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7180 checkout} or @code{cvs update}.  @code{cvs diff} also
7181 has a @samp{-k} option.  For some examples,
7182 see @ref{Binary files}, and @ref{Merging and keywords}.
7183 @c The fact that -A is overloaded to mean both reset
7184 @c sticky options and reset sticky tags/dates is
7185 @c somewhat questionable.  Perhaps there should be
7186 @c separate options to reset sticky options (e.g. -k
7187 @c A") and tags/dates (someone suggested -r HEAD could
7188 @c do this instead of setting a sticky tag of "HEAD"
7189 @c as in the status quo but I haven't thought much
7190 @c about that idea.  Of course -r .reset or something
7191 @c could be coined if this needs to be a new option).
7192 @c On the other hand, having -A mean "get things back
7193 @c into the state after a fresh checkout" has a certain
7194 @c appeal, and maybe there is no sufficient reason for
7195 @c creeping featurism in this area.
7196
7197 The modes available are:
7198
7199 @table @samp
7200 @item -kkv
7201 Generate keyword strings using the default form, e.g.
7202 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7203 keyword.
7204
7205 @item -kkvl
7206 Like @samp{-kkv}, except that a locker's name is always
7207 inserted if the given revision is currently locked.
7208 The locker's name is only relevant if @code{cvs admin
7209 -l} is in use.
7210
7211 @item -kk
7212 Generate only keyword names in keyword strings; omit
7213 their values.  For example, for the @code{Revision}
7214 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7215 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7216 is useful to ignore differences due to keyword
7217 substitution when comparing different revisions of a
7218 file (@pxref{Merging and keywords}).
7219
7220 @item -ko
7221 Generate the old keyword string, present in the working
7222 file just before it was checked in.  For example, for
7223 the @code{Revision} keyword, generate the string
7224 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7225 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7226 string appeared when the file was checked in.
7227
7228 @item -kb
7229 Like @samp{-ko}, but also inhibit conversion of line
7230 endings between the canonical form in which they are
7231 stored in the repository (linefeed only), and the form
7232 appropriate to the operating system in use on the
7233 client.  For systems, like unix, which use linefeed
7234 only to terminate lines, this is very similar to
7235 @samp{-ko}.  For more information on binary files, see
7236 @ref{Binary files}.  In @sc{cvs} version 1.12.2 and later
7237 @samp{-kb}, as set by @code{cvs add}, @code{cvs admin}, or
7238 @code{cvs import} may not be overridden by a @samp{-k} option
7239 specified on the command line.
7240
7241 @item -kv
7242 Generate only keyword values for keyword strings.  For
7243 example, for the @code{Revision} keyword, generate the string
7244 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7245 This can help generate files in programming languages
7246 where it is hard to strip keyword delimiters like
7247 @code{$@splitrcskeyword{Revision}: $} from a string.  However,
7248 further keyword substitution cannot be performed once
7249 the keyword names are removed, so this option should be
7250 used with care.
7251
7252 One often would like to use @samp{-kv} with @code{cvs
7253 export}---@pxref{export}.  But be aware that doesn't
7254 handle an export containing binary files correctly.
7255
7256 @end table
7257
7258 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7259 @node Configuring keyword expansion
7260 @section Configuring Keyword Expansion
7261 @cindex Configuring keyword expansion
7262
7263 In a repository that includes third-party software on
7264 vendor branches, it is sometimes helpful to configure
7265 CVS to use a local keyword instead of the standard
7266 $@splitrcskeyword{Id}$ or $@splitrcskeyword{Header}$ keywords. Examples from
7267 real projects include $@splitrcskeyword{Xorg}$, $@splitrcskeyword{XFree86}$,
7268 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7269 $@splitrcskeyword{OpenBSD}$, and even $@splitrcskeyword{dotat}$.
7270 The advantage of this is that
7271 you can include your local version information in a
7272 file using this local keyword (sometimes called a
7273 ``custom tag'' or a ``local tag'') without disrupting
7274 the upstream version information (which may be a
7275 different local keyword or a standard keyword). In
7276 these cases, it is typically desirable to disable the
7277 expansion of all keywords except the configured local
7278 keyword.
7279
7280 The @code{KeywordExpansion} option in the
7281 @file{CVSROOT/config} file is intended to allow for the
7282 either the explicit exclusion of a keyword or list of
7283 keywords, or for the explicit inclusion of a keyword or
7284 a list of keywords. This list may include the
7285 @code{LocalKeyword} that has been configured.
7286
7287 The @code{KeywordExpansion} option is followed by
7288 @code{=} and the next character may either be @code{i}
7289 to start an inclusion list or @code{e} to start an
7290 exclusion list. If the following lines were added to
7291 the @file{CVSROOT/config} file:
7292
7293 @example
7294         # Add a "MyBSD" keyword and restrict keyword
7295         # expansion
7296         LocalKeyword=MyBSD=CVSHeader
7297         KeywordExpand=iMyBSD
7298 @end example
7299
7300 then only the $@splitrcskeyword{MyBSD}$ keyword would be expanded.
7301 A list may be used. The this example:
7302
7303 @example
7304         # Add a "MyBSD" keyword and restrict keyword
7305         # expansion to the MyBSD, Name and Date keywords.
7306         LocalKeyword=MyBSD=CVSHeader
7307         KeywordExpand=iMyBSD,Name,Date
7308 @end example
7309
7310 would allow $@splitrcskeyword{MyBSD}$, $@splitrcskeyword{Name}$, and
7311 $@splitrcskeyword{Date}$ to be expanded.
7312
7313 It is also possible to configure an exclusion list
7314 using the following:
7315
7316 @example
7317         # Do not expand the non-RCS keyword CVSHeader
7318         KeywordExpand=eCVSHeader
7319 @end example
7320
7321 This allows @sc{cvs} to ignore the recently introduced
7322 $@splitrcskeyword{CVSHeader}$ keyword and retain all of the
7323 others. The exclusion entry could also contain the
7324 standard RCS keyword list, but this could be confusing
7325 to users that expect RCS keywords to be expanded, so
7326 care should be taken to properly set user expectations
7327 for a repository that is configured in that manner.
7328
7329 If there is a desire to not have any RCS keywords
7330 expanded and not use the @code{-ko} flags everywhere,
7331 an administrator may disable all keyword expansion
7332 using the @file{CVSROOT/config} line:
7333
7334 @example
7335         # Do not expand any RCS keywords
7336         KeywordExpand=i
7337 @end example
7338
7339 this could be confusing to users that expect RCS
7340 keywords like $@splitrcskeyword{Id}$ to be expanded properly,
7341 so care should be taken to properly set user
7342 expectations for a repository so configured.
7343
7344 It should be noted that a patch to provide both the
7345 @code{KeywordExpand} and @code{LocalKeyword} features
7346 has been around a long time. However, that patch
7347 implemented these features using @code{tag=} and
7348 @code{tagexpand=} keywords and those keywords are NOT
7349 recognized.
7350
7351 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7352 @node Log keyword
7353 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7354
7355 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7356 controversial.  As long as you are working on your
7357 development system the information is easily accessible
7358 even if you do not use the @code{$@splitrcskeyword{Log}$}
7359 keyword---just do a @code{cvs log}.  Once you export
7360 the file the history information might be useless
7361 anyhow.
7362
7363 A more serious concern is that @sc{cvs} is not good at
7364 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7365 merged onto the main trunk.  Conflicts often result
7366 from the merging operation.
7367 @c Might want to check whether the CVS implementation
7368 @c of RCS_merge has this problem the same way rcsmerge
7369 @c does.  I would assume so....
7370
7371 People also tend to "fix" the log entries in the file
7372 (correcting spelling mistakes and maybe even factual
7373 errors).  If that is done the information from
7374 @code{cvs log} will not be consistent with the
7375 information inside the file.  This may or may not be a
7376 problem in real life.
7377
7378 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7379 keyword should be inserted @emph{last} in the file, and
7380 not in the files header, if it is to be used at all.
7381 That way the long list of change messages will not
7382 interfere with everyday source file browsing.
7383
7384 @c ---------------------------------------------------------------------
7385 @node Tracking sources
7386 @chapter Tracking third-party sources
7387 @cindex Third-party sources
7388 @cindex Tracking sources
7389
7390 @c FIXME: Need discussion of added and removed files.
7391 @c FIXME: This doesn't really adequately introduce the
7392 @c concepts of "vendor" and "you".  They don't *have*
7393 @c to be separate organizations or separate people.
7394 @c We want a description which is somewhat more based on
7395 @c the technical issues of which sources go where, but
7396 @c also with enough examples of how this relates to
7397 @c relationships like customer-supplier, developer-QA,
7398 @c maintainer-contributor, or whatever, to make it
7399 @c seem concrete.
7400 If you modify a program to better fit your site, you
7401 probably want to include your modifications when the next
7402 release of the program arrives.  @sc{cvs} can help you with
7403 this task.
7404
7405 @cindex Vendor
7406 @cindex Vendor branch
7407 @cindex Branch, vendor-
7408 In the terminology used in @sc{cvs}, the supplier of the
7409 program is called a @dfn{vendor}.  The unmodified
7410 distribution from the vendor is checked in on its own
7411 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
7412 1.1.1 for this use.
7413
7414 When you modify the source and commit it, your revision
7415 will end up on the main trunk.  When a new release is
7416 made by the vendor, you commit it on the vendor branch
7417 and copy the modifications onto the main trunk.
7418
7419 Use the @code{import} command to create and update
7420 the vendor branch.  When you import a new file,
7421 the vendor branch is made the `head' revision, so
7422 anyone that checks out a copy of the file gets that
7423 revision.  When a local modification is committed it is
7424 placed on the main trunk, and made the `head'
7425 revision.
7426
7427 @menu
7428 * First import::                Importing for the first time
7429 * Update imports::              Updating with the import command
7430 * Reverting local changes::     Reverting to the latest vendor release
7431 * Binary files in imports::     Binary files require special handling
7432 * Keywords in imports::         Keyword substitution might be undesirable
7433 * Multiple vendor branches::    What if you get sources from several places?
7434 @end menu
7435
7436 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7437 @node First import
7438 @section Importing for the first time
7439 @cindex Importing modules
7440
7441 @c Should mention naming conventions for vendor tags,
7442 @c release tags, and perhaps directory names.
7443 Use the @code{import} command to check in the sources
7444 for the first time.  When you use the @code{import}
7445 command to track third-party sources, the @dfn{vendor
7446 tag} and @dfn{release tags} are useful.  The
7447 @dfn{vendor tag} is a symbolic name for the branch
7448 (which is always 1.1.1, unless you use the @samp{-b
7449 @var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7450 @dfn{release tags} are symbolic names for a particular
7451 release, such as @samp{FSF_0_04}.
7452
7453 @c I'm not completely sure this belongs here.  But
7454 @c we need to say it _somewhere_ reasonably obvious; it
7455 @c is a common misconception among people first learning CVS
7456 Note that @code{import} does @emph{not} change the
7457 directory in which you invoke it.  In particular, it
7458 does not set up that directory as a @sc{cvs} working
7459 directory; if you want to work with the sources import
7460 them first and then check them out into a different
7461 directory (@pxref{Getting the source}).
7462
7463 @cindex wdiff (import example)
7464 Suppose you have the sources to a program called
7465 @code{wdiff} in a directory @file{wdiff-0.04},
7466 and are going to make private modifications that you
7467 want to be able to use even when new releases are made
7468 in the future.  You start by importing the source to
7469 your repository:
7470
7471 @example
7472 $ cd wdiff-0.04
7473 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7474 @end example
7475
7476 The vendor tag is named @samp{FSF_DIST} in the above
7477 example, and the only release tag assigned is
7478 @samp{WDIFF_0_04}.
7479 @c FIXME: Need to say where fsf/wdiff comes from.
7480
7481 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7482 @node Update imports
7483 @section Updating with the import command
7484
7485 When a new release of the source arrives, you import it into the
7486 repository with the same @code{import} command that you used to set up
7487 the repository in the first place.  The only difference is that you
7488 specify a different release tag this time:
7489
7490 @example
7491 $ tar xfz wdiff-0.05.tar.gz
7492 $ cd wdiff-0.05
7493 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7494 @end example
7495
7496 For files that have not been modified locally, the newly created
7497 revision becomes the head revision.  If you have made local
7498 changes, @code{import} will warn you that you must merge the changes
7499 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7500
7501 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7502 @c "import"?  I think the assumption is that one has
7503 @c "wdiff fsf/wdiff" or some such in modules, but it
7504 @c would be better to not use modules in this example.
7505 @example
7506 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7507 @end example
7508
7509 @noindent
7510 The above command will check out the latest revision of
7511 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7512 since yesterday into the working copy.  If any conflicts arise during
7513 the merge they should be resolved in the normal way (@pxref{Conflicts
7514 example}).  Then, the modified files may be committed.
7515
7516 However, it is much better to use the two release tags rather than using
7517 a date on the branch as suggested above:
7518
7519 @example
7520 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7521 @end example
7522
7523 @noindent
7524 The reason this is better is that
7525 using a date, as suggested above, assumes that you do
7526 not import more than one release of a product per day.
7527 More importantly, using the release tags allows @sc{cvs} to detect files
7528 that were removed between the two vendor releases and mark them for
7529 removal.  Since @code{import} has no way to detect removed files, you
7530 should do a merge like this even if @code{import} doesn't tell you to.
7531
7532 @node Reverting local changes
7533 @section Reverting to the latest vendor release
7534
7535 You can also revert local changes completely and return
7536 to the latest vendor release by changing the `head'
7537 revision back to the vendor branch on all files.  For
7538 example, if you have a checked-out copy of the sources
7539 in @file{~/work.d/wdiff}, and you want to revert to the
7540 vendor's version for all the files in that directory,
7541 you would type:
7542
7543 @example
7544 $ cd ~/work.d/wdiff
7545 $ cvs admin -bFSF_DIST .
7546 @end example
7547
7548 @noindent
7549 You must specify the @samp{-bFSF_DIST} without any space
7550 after the @samp{-b}.  @xref{admin options}.
7551
7552 @node Binary files in imports
7553 @section How to handle binary files with cvs import
7554
7555 Use the @samp{-k} wrapper option to tell import which
7556 files are binary.  @xref{Wrappers}.
7557
7558 @node Keywords in imports
7559 @section How to handle keyword substitution with cvs import
7560
7561 The sources which you are importing may contain
7562 keywords (@pxref{Keyword substitution}).  For example,
7563 the vendor may use @sc{cvs} or some other system
7564 which uses similar keyword expansion syntax.  If you
7565 just import the files in the default fashion, then
7566 the keyword expansions supplied by the vendor will
7567 be replaced by keyword expansions supplied by your
7568 own copy of @sc{cvs}.  It may be more convenient to
7569 maintain the expansions supplied by the vendor, so
7570 that this information can supply information about
7571 the sources that you imported from the vendor.
7572
7573 To maintain the keyword expansions supplied by the
7574 vendor, supply the @samp{-ko} option to @code{cvs
7575 import} the first time you import the file.
7576 This will turn off keyword expansion
7577 for that file entirely, so if you want to be more
7578 selective you'll have to think about what you want
7579 and use the @samp{-k} option to @code{cvs update} or
7580 @code{cvs admin} as appropriate.
7581 @c Supplying -ko to import if the file already existed
7582 @c has no effect.  Not clear to me whether it should
7583 @c or not.
7584
7585 @node Multiple vendor branches
7586 @section Multiple vendor branches
7587
7588 All the examples so far assume that there is only one
7589 vendor from which you are getting sources.  In some
7590 situations you might get sources from a variety of
7591 places.  For example, suppose that you are dealing with
7592 a project where many different people and teams are
7593 modifying the software.  There are a variety of ways to
7594 handle this, but in some cases you have a bunch of
7595 source trees lying around and what you want to do more
7596 than anything else is just to all put them in @sc{cvs} so
7597 that you at least have them in one place.
7598
7599 For handling situations in which there may be more than
7600 one vendor, you may specify the @samp{-b} option to
7601 @code{cvs import}.  It takes as an argument the vendor
7602 branch to import to.  The default is @samp{-b 1.1.1}.
7603
7604 For example, suppose that there are two teams, the red
7605 team and the blue team, that are sending you sources.
7606 You want to import the red team's efforts to branch
7607 1.1.1 and use the vendor tag RED.  You want to import
7608 the blue team's efforts to branch 1.1.3 and use the
7609 vendor tag BLUE.  So the commands you might use are:
7610
7611 @example
7612 $ cvs import dir RED RED_1-0
7613 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7614 @end example
7615
7616 Note that if your vendor tag does not match your
7617 @samp{-b} option, @sc{cvs} will not detect this case!  For
7618 example,
7619
7620 @example
7621 $ cvs import -b 1.1.3 dir RED RED_1-0
7622 @end example
7623
7624 @noindent
7625 Be careful; this kind of mismatch is sure to sow
7626 confusion or worse.  I can't think of a useful purpose
7627 for the ability to specify a mismatch here, but if you
7628 discover such a use, don't.  @sc{cvs} is likely to make this
7629 an error in some future release.
7630
7631 @c Probably should say more about the semantics of
7632 @c multiple branches.  What about the default branch?
7633 @c What about joining (perhaps not as useful with
7634 @c multiple branches, or perhaps it is.  Either way
7635 @c should be mentioned).
7636
7637 @c I'm not sure about the best location for this.  In
7638 @c one sense, it might belong right after we've introduced
7639 @c CVS's basic version control model, because people need
7640 @c to figure out builds right away.  The current location
7641 @c is based on the theory that it kind of akin to the
7642 @c "Revision management" section.
7643 @node Builds
7644 @chapter How your build system interacts with CVS
7645 @cindex Builds
7646 @cindex make
7647
7648 As mentioned in the introduction, @sc{cvs} does not
7649 contain software for building your software from source
7650 code.  This section describes how various aspects of
7651 your build system might interact with @sc{cvs}.
7652
7653 @c Is there a way to discuss this without reference to
7654 @c tools other than CVS?  I'm not sure there is; I
7655 @c wouldn't think that people who learn CVS first would
7656 @c even have this concern.
7657 One common question, especially from people who are
7658 accustomed to @sc{rcs}, is how to make their build get
7659 an up to date copy of the sources.  The answer to this
7660 with @sc{cvs} is two-fold.  First of all, since
7661 @sc{cvs} itself can recurse through directories, there
7662 is no need to modify your @file{Makefile} (or whatever
7663 configuration file your build tool uses) to make sure
7664 each file is up to date.  Instead, just use two
7665 commands, first @code{cvs -q update} and then
7666 @code{make} or whatever the command is to invoke your
7667 build tool.  Secondly, you do not necessarily
7668 @emph{want} to get a copy of a change someone else made
7669 until you have finished your own work.  One suggested
7670 approach is to first update your sources, then
7671 implement, build and
7672 test the change you were thinking of, and then commit
7673 your sources (updating first if necessary).  By
7674 periodically (in between changes, using the approach
7675 just described) updating your entire tree, you ensure
7676 that your sources are sufficiently up to date.
7677
7678 @cindex Bill of materials
7679 One common need is to record which versions of which
7680 source files went into a particular build.  This kind
7681 of functionality is sometimes called @dfn{bill of
7682 materials} or something similar.  The best way to do
7683 this with @sc{cvs} is to use the @code{tag} command to
7684 record which versions went into a given build
7685 (@pxref{Tags}).
7686
7687 Using @sc{cvs} in the most straightforward manner
7688 possible, each developer will have a copy of the entire
7689 source tree which is used in a particular build.  If
7690 the source tree is small, or if developers are
7691 geographically dispersed, this is the preferred
7692 solution.  In fact one approach for larger projects is
7693 to break a project down into smaller
7694 @c I say subsystem instead of module because they may or
7695 @c may not use the modules file.
7696 separately-compiled subsystems, and arrange a way of
7697 releasing them internally so that each developer need
7698 check out only those subsystems which they are
7699 actively working on.
7700
7701 Another approach is to set up a structure which allows
7702 developers to have their own copies of some files, and
7703 for other files to access source files from a central
7704 location.  Many people have come up with some such a
7705 @c two such people are paul@sander.cupertino.ca.us (for
7706 @c a previous employer)
7707 @c and gtornblo@senet.abb.se (spicm and related tools),
7708 @c but as far as I know
7709 @c no one has nicely packaged or released such a system (or
7710 @c instructions for constructing one).
7711 system using features such as the symbolic link feature
7712 found in many operating systems, or the @code{VPATH}
7713 feature found in many versions of @code{make}.  One build
7714 tool which is designed to help with this kind of thing
7715 is Odin (see
7716 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7717 @c Should we be saying more about Odin?  Or how you use
7718 @c it with CVS?  Also, the Prime Time Freeware for Unix
7719 @c disk (see http://www.ptf.com/) has Odin (with a nice
7720 @c paragraph summarizing it on the web), so that might be a
7721 @c semi-"official" place to point people.
7722 @c
7723 @c Of course, many non-CVS systems have this kind of
7724 @c functionality, for example OSF's ODE
7725 @c (http://www.osf.org/ode/) or mk
7726 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7727 @c He has changed providers in the past; a search engine search
7728 @c for "Peter Ziobrzynski" probably won't get too many
7729 @c spurious hits :-).  A more stable URL might be
7730 @c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7731 @c there is any point in mentioning them here unless they
7732 @c can work with CVS.
7733
7734 @c ---------------------------------------------------------------------
7735 @node Special Files
7736 @chapter Special Files
7737
7738 @cindex Special files
7739 @cindex Device nodes
7740 @cindex Ownership, saving in CVS
7741 @cindex Permissions, saving in CVS
7742 @cindex Hard links
7743 @cindex Symbolic links
7744
7745 In normal circumstances, @sc{cvs} works only with regular
7746 files.  Every file in a project is assumed to be
7747 persistent; it must be possible to open, read and close
7748 them; and so on.  @sc{cvs} also ignores file permissions and
7749 ownerships, leaving such issues to be resolved by the
7750 developer at installation time.  In other words, it is
7751 not possible to "check in" a device into a repository;
7752 if the device file cannot be opened, @sc{cvs} will refuse to
7753 handle it.  Files also lose their ownerships and
7754 permissions during repository transactions.
7755
7756 @ignore
7757 If the configuration variable @code{PreservePermissions}
7758 (@pxref{config}) is set in the repository, @sc{cvs} will
7759 save the following file characteristics in the
7760 repository:
7761
7762 @itemize @bullet
7763 @item user and group ownership
7764 @item permissions
7765 @item major and minor device numbers
7766 @item symbolic links
7767 @item hard link structure
7768 @end itemize
7769
7770 Using the @code{PreservePermissions} option affects the
7771 behavior of @sc{cvs} in several ways.  First, some of the
7772 new operations supported by @sc{cvs} are not accessible to
7773 all users.  In particular, file ownership and special
7774 file characteristics may only be changed by the
7775 superuser.  When the @code{PreservePermissions}
7776 configuration variable is set, therefore, users will
7777 have to be `root' in order to perform @sc{cvs} operations.
7778
7779 When @code{PreservePermissions} is in use, some @sc{cvs}
7780 operations (such as @samp{cvs status}) will not
7781 recognize a file's hard link structure, and so will
7782 emit spurious warnings about mismatching hard links.
7783 The reason is that @sc{cvs}'s internal structure does not
7784 make it easy for these operations to collect all the
7785 necessary data about hard links, so they check for file
7786 conflicts with inaccurate data.
7787
7788 A more subtle difference is that @sc{cvs} considers a file
7789 to have changed only if its contents have changed
7790 (specifically, if the modification time of the working
7791 file does not match that of the repository's file).
7792 Therefore, if only the permissions, ownership or hard
7793 linkage have changed, or if a device's major or minor
7794 numbers have changed, @sc{cvs} will not notice.  In order to
7795 commit such a change to the repository, you must force
7796 the commit with @samp{cvs commit -f}.  This also means
7797 that if a file's permissions have changed and the
7798 repository file is newer than the working copy,
7799 performing @samp{cvs update} will silently change the
7800 permissions on the working copy.
7801
7802 Changing hard links in a @sc{cvs} repository is particularly
7803 delicate.  Suppose that file @file{foo} is linked to
7804 file @file{old}, but is later relinked to file
7805 @file{new}.  You can wind up in the unusual situation
7806 where, although @file{foo}, @file{old} and @file{new}
7807 have all had their underlying link patterns changed,
7808 only @file{foo} and @file{new} have been modified, so
7809 @file{old} is not considered a candidate for checking
7810 in.  It can be very easy to produce inconsistent
7811 results this way.  Therefore, we recommend that when it
7812 is important to save hard links in a repository, the
7813 prudent course of action is to @code{touch} any file
7814 whose linkage or status has changed since the last
7815 checkin.  Indeed, it may be wise to @code{touch *}
7816 before each commit in a directory with complex hard
7817 link structures.
7818
7819 It is worth noting that only regular files may
7820 be merged, for reasons that hopefully are obvious.  If
7821 @samp{cvs update} or @samp{cvs checkout -j} attempts to
7822 merge a symbolic link with a regular file, or two
7823 device files for different kinds of devices, @sc{cvs} will
7824 report a conflict and refuse to perform the merge.  At
7825 the same time, @samp{cvs diff} will not report any
7826 differences between these files, since no meaningful
7827 textual comparisons can be made on files which contain
7828 no text.
7829
7830 The @code{PreservePermissions} features do not work
7831 with client/server @sc{cvs}.  Another limitation is
7832 that hard links must be to other files within the same
7833 directory; hard links across directories are not
7834 supported.
7835 @end ignore
7836
7837 @c ---------------------------------------------------------------------
7838 @c ----- START MAN 1 -----
7839 @node CVS commands
7840 @appendix Guide to CVS commands
7841
7842 This appendix describes the overall structure of
7843 @sc{cvs} commands, and describes some commands in
7844 detail (others are described elsewhere; for a quick
7845 reference to @sc{cvs} commands, @pxref{Invoking CVS}).
7846 @c The idea is that we want to move the commands which
7847 @c are described here into the main body of the manual,
7848 @c in the process reorganizing the manual to be
7849 @c organized around what the user wants to do, not
7850 @c organized around CVS commands.
7851 @c
7852 @c Note that many users do expect a manual which is
7853 @c organized by command.  At least some users do.
7854 @c One good addition to the "organized by command"
7855 @c section (if any) would be "see also" links.
7856 @c The awk manual might be a good example; it has a
7857 @c reference manual which is more verbose than Invoking
7858 @c CVS but probably somewhat less verbose than CVS
7859 @c Commands.
7860
7861 @menu
7862 * Structure::                   Overall structure of CVS commands
7863 * Exit status::                 Indicating CVS's success or failure
7864 * ~/.cvsrc::                    Default options with the ~/.cvsrc file
7865 * Global options::              Options you give to the left of cvs_command
7866 * Common options::              Options you give to the right of cvs_command
7867 * admin::                       Administration
7868 * annotate::                    What revision modified each line of a file?
7869 * checkout::                    Checkout sources for editing
7870 * commit::                      Check files into the repository
7871 * diff::                        Show differences between revisions
7872 * export::                      Export sources from CVS, similar to checkout
7873 * history::                     Show status of files and users
7874 * import::                      Import sources into CVS, using vendor branches
7875 * log::                         Show log messages for files
7876 * ls & rls::                    List files in the repository
7877 * rdiff::                       'patch' format diffs between releases
7878 * release::                     Indicate that a directory is no longer in use
7879 * update::                      Bring work tree in sync with repository
7880 @end menu
7881
7882 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7883 @node Structure
7884 @appendixsec Overall structure of CVS commands
7885 @cindex Structure
7886 @cindex CVS command structure
7887 @cindex Command structure
7888 @cindex Format of CVS commands
7889
7890 The overall format of all @sc{cvs} commands is:
7891
7892 @example
7893 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
7894 @end example
7895
7896 @table @code
7897 @item cvs
7898 The name of the @sc{cvs} program.
7899
7900 @item cvs_options
7901 Some options that affect all sub-commands of @sc{cvs}.  These are
7902 described below.
7903
7904 @item cvs_command
7905 One of several different sub-commands.  Some of the commands have
7906 aliases that can be used instead; those aliases are noted in the
7907 reference manual for that command.  There are only two situations
7908 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
7909 list of available commands, and @samp{cvs -v} displays version
7910 information on @sc{cvs} itself.
7911
7912 @item command_options
7913 Options that are specific for the command.
7914
7915 @item command_args
7916 Arguments to the commands.
7917 @end table
7918
7919 There is unfortunately some confusion between
7920 @code{cvs_options} and @code{command_options}.
7921 When given as a @code{cvs_option}, some options only
7922 affect some of the commands.  When given as a
7923 @code{command_option} it may have a different meaning, and
7924 be accepted by more commands.  In other words, do not
7925 take the above categorization too seriously.  Look at
7926 the documentation instead.
7927
7928 @node Exit status
7929 @appendixsec CVS's exit status
7930 @cindex Exit status, of CVS
7931
7932 @sc{cvs} can indicate to the calling environment whether it
7933 succeeded or failed by setting its @dfn{exit status}.
7934 The exact way of testing the exit status will vary from
7935 one operating system to another.  For example in a unix
7936 shell script the @samp{$?} variable will be 0 if the
7937 last command returned a successful exit status, or
7938 greater than 0 if the exit status indicated failure.
7939
7940 If @sc{cvs} is successful, it returns a successful status;
7941 if there is an error, it prints an error message and
7942 returns a failure status.  The one exception to this is
7943 the @code{cvs diff} command.  It will return a
7944 successful status if it found no differences, or a
7945 failure status if there were differences or if there
7946 was an error.  Because this behavior provides no good
7947 way to detect errors, in the future it is possible that
7948 @code{cvs diff} will be changed to behave like the
7949 other @sc{cvs} commands.
7950 @c It might seem like checking whether cvs -q diff
7951 @c produces empty or non-empty output can tell whether
7952 @c there were differences or not.  But it seems like
7953 @c there are cases with output but no differences
7954 @c (testsuite basica-8b).  It is not clear to me how
7955 @c useful it is for a script to be able to check
7956 @c whether there were differences.
7957 @c FIXCVS? In previous versions of CVS, cvs diff
7958 @c returned 0 for no differences, 1 for differences, or
7959 @c 2 for errors.  Is this behavior worth trying to
7960 @c bring back (but what does it mean for VMS?)?
7961
7962 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7963 @node ~/.cvsrc
7964 @appendixsec Default options and the ~/.cvsrc file
7965 @cindex .cvsrc file
7966 @cindex Option defaults
7967
7968 There are some @code{command_options} that are used so
7969 often that you might have set up an alias or some other
7970 means to make sure you always specify that option.  One
7971 example (the one that drove the implementation of the
7972 @file{.cvsrc} support, actually) is that many people find the
7973 default output of the @samp{diff} command to be very
7974 hard to read, and that either context diffs or unidiffs
7975 are much easier to understand.
7976
7977 The @file{~/.cvsrc} file is a way that you can add
7978 default options to @code{cvs_commands} within cvs,
7979 instead of relying on aliases or other shell scripts.
7980
7981 The format of the @file{~/.cvsrc} file is simple.  The
7982 file is searched for a line that begins with the same
7983 name as the @code{cvs_command} being executed.  If a
7984 match is found, then the remainder of the line is split
7985 up (at whitespace characters) into separate options and
7986 added to the command arguments @emph{before} any
7987 options from the command line.
7988
7989 If a command has two names (e.g., @code{checkout} and
7990 @code{co}), the official name, not necessarily the one
7991 used on the command line, will be used to match against
7992 the file.  So if this is the contents of the user's
7993 @file{~/.cvsrc} file:
7994
7995 @example
7996 log -N
7997 diff -uN
7998 rdiff -u
7999 update -Pd
8000 checkout -P
8001 release -d
8002 @end example
8003
8004 @noindent
8005 the command @samp{cvs checkout foo} would have the
8006 @samp{-P} option added to the arguments, as well as
8007 @samp{cvs co foo}.
8008
8009 With the example file above, the output from @samp{cvs
8010 diff foobar} will be in unidiff format.  @samp{cvs diff
8011 -c foobar} will provide context diffs, as usual.
8012 Getting "old" format diffs would be slightly more
8013 complicated, because @code{diff} doesn't have an option
8014 to specify use of the "old" format, so you would need
8015 @samp{cvs -f diff foobar}.
8016
8017 In place of the command name you can use @code{cvs} to
8018 specify global options (@pxref{Global options}).  For
8019 example the following line in @file{.cvsrc}
8020
8021 @example
8022 cvs -z6
8023 @end example
8024
8025 @noindent
8026 causes @sc{cvs} to use compression level 6.
8027
8028 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8029 @node Global options
8030 @appendixsec Global options
8031 @cindex Options, global
8032 @cindex Global options
8033 @cindex Left-hand options
8034
8035 The available @samp{cvs_options} (that are given to the
8036 left of @samp{cvs_command}) are:
8037
8038 @table @code
8039 @item --allow-root=@var{rootdir}
8040 Specify legal @sc{cvsroot} directory.  See
8041 @ref{Password authentication server}.
8042
8043 @cindex Authentication, stream
8044 @cindex Stream authentication
8045 @item -a
8046 Authenticate all communication between the client and
8047 the server.  Only has an effect on the @sc{cvs} client.
8048 As of this writing, this is only implemented when using
8049 a GSSAPI connection (@pxref{GSSAPI authenticated}).
8050 Authentication prevents certain sorts of attacks
8051 involving hijacking the active @sc{tcp} connection.
8052 Enabling authentication does not enable encryption.
8053
8054 @cindex RCSBIN, overriding
8055 @cindex Overriding RCSBIN
8056 @item -b @var{bindir}
8057 In @sc{cvs} 1.9.18 and older, this specified that
8058 @sc{rcs} programs are in the @var{bindir} directory.
8059 Current versions of @sc{cvs} do not run @sc{rcs}
8060 programs; for compatibility this option is accepted,
8061 but it does nothing.
8062
8063 @cindex TMPDIR, overriding
8064 @cindex Overriding TMPDIR
8065 @item -T @var{tempdir}
8066 Use @var{tempdir} as the directory where temporary files are
8067 located.  Overrides the setting of the @code{$TMPDIR} environment
8068 variable and any precompiled directory.  This parameter should be
8069 specified as an absolute pathname.
8070 (When running client/server, @samp{-T} affects only the local process;
8071 specifying @samp{-T} for the client has no effect on the server and
8072 vice versa.)
8073
8074 @cindex CVSROOT, overriding
8075 @cindex Overriding CVSROOT
8076 @item -d @var{cvs_root_directory}
8077 Use @var{cvs_root_directory} as the root directory
8078 pathname of the repository.  Overrides the setting of
8079 the @code{$CVSROOT} environment variable.  @xref{Repository}.
8080
8081 @cindex EDITOR, overriding
8082 @cindex Overriding EDITOR
8083 @item -e @var{editor}
8084 Use @var{editor} to enter revision log information.  Overrides the
8085 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
8086 environment variables.  For more information, see
8087 @ref{Committing your changes}.
8088
8089 @item -f
8090 Do not read the @file{~/.cvsrc} file.  This
8091 option is most often used because of the
8092 non-orthogonality of the @sc{cvs} option set.  For
8093 example, the @samp{cvs log} option @samp{-N} (turn off
8094 display of tag names) does not have a corresponding
8095 option to turn the display on.  So if you have
8096 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
8097 you may need to use @samp{-f} to show the tag names.
8098
8099 @item -H
8100 @itemx --help
8101 Display usage information about the specified @samp{cvs_command}
8102 (but do not actually execute the command).  If you don't specify
8103 a command name, @samp{cvs -H} displays overall help for
8104 @sc{cvs}, including a list of other help options.
8105 @c It seems to me it is better to document it this way
8106 @c rather than trying to update this documentation
8107 @c every time that we add a --help-foo option.  But
8108 @c perhaps that is confusing...
8109
8110 @cindex Read-only repository mode
8111 @item -R
8112 Turns on read-only repository mode.  This allows one to check out from a
8113 read-only repository, such as within an anoncvs server, or from a @sc{cd-rom}
8114 repository.
8115
8116 Same effect as if the @code{CVSREADONLYFS} environment
8117 variable is set. Using @samp{-R} can also considerably
8118 speed up checkouts over NFS.
8119
8120 @cindex Read-only mode
8121 @item -n
8122 Do not change any files.  Attempt to execute the
8123 @samp{cvs_command}, but only to issue reports; do not remove,
8124 update, or merge any existing files, or create any new files.
8125
8126 Note that @sc{cvs} will not necessarily produce exactly
8127 the same output as without @samp{-n}.  In some cases
8128 the output will be the same, but in other cases
8129 @sc{cvs} will skip some of the processing that would
8130 have been required to produce the exact same output.
8131
8132 @item -Q
8133 Cause the command to be really quiet; the command will only
8134 generate output for serious problems.
8135
8136 @item -q
8137 Cause the command to be somewhat quiet; informational messages,
8138 such as reports of recursion through subdirectories, are
8139 suppressed.
8140
8141 @cindex Read-only files, and -r
8142 @item -r
8143 Make new working files read-only.  Same effect
8144 as if the @code{$CVSREAD} environment variable is set
8145 (@pxref{Environment variables}).  The default is to
8146 make working files writable, unless watches are on
8147 (@pxref{Watches}).
8148
8149 @item -s @var{variable}=@var{value}
8150 Set a user variable (@pxref{Variables}).
8151
8152 @cindex Trace
8153 @item -t
8154 Trace program execution; display messages showing the steps of
8155 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
8156 potential impact of an unfamiliar command.
8157
8158 @item -v
8159 @item --version
8160 Display version and copyright information for @sc{cvs}.
8161
8162 @cindex CVSREAD, overriding
8163 @cindex Overriding CVSREAD
8164 @item -w
8165 Make new working files read-write.  Overrides the
8166 setting of the @code{$CVSREAD} environment variable.
8167 Files are created read-write by default, unless @code{$CVSREAD} is
8168 set or @samp{-r} is given.
8169 @c Note that -w only overrides -r and CVSREAD; it has
8170 @c no effect on files which are readonly because of
8171 @c "cvs watch on".  My guess is that is the way it
8172 @c should be (or should "cvs -w get" on a watched file
8173 @c be the same as a get and a cvs edit?), but I'm not
8174 @c completely sure whether to document it this way.
8175
8176 @item -x
8177 @cindex Encryption
8178 Encrypt all communication between the client and the
8179 server.  Only has an effect on the @sc{cvs} client.  As
8180 of this writing, this is only implemented when using a
8181 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
8182 Kerberos connection (@pxref{Kerberos authenticated}).
8183 Enabling encryption implies that message traffic is
8184 also authenticated.  Encryption support is not
8185 available by default; it must be enabled using a
8186 special configure option, @file{--enable-encryption},
8187 when you build @sc{cvs}.
8188
8189 @item -z @var{gzip-level}
8190 @cindex Compression
8191 @cindex Gzip
8192 Set the compression level.
8193 Valid levels are 1 (high speed, low compression) to
8194 9 (low speed, high compression), or 0 to disable
8195 compression (the default).
8196 Only has an effect on the @sc{cvs} client.
8197
8198 @end table
8199
8200 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8201 @node Common options
8202 @appendixsec Common command options
8203 @cindex Common options
8204 @cindex Right-hand options
8205
8206 This section describes the @samp{command_options} that
8207 are available across several @sc{cvs} commands.  These
8208 options are always given to the right of
8209 @samp{cvs_command}. Not all
8210 commands support all of these options; each option is
8211 only supported for commands where it makes sense.
8212 However, when a command has one of these options you
8213 can almost always count on the same behavior of the
8214 option as in other commands.  (Other command options,
8215 which are listed with the individual commands, may have
8216 different behavior from one @sc{cvs} command to the other).
8217
8218 @strong{Note: the @samp{history} command is an exception; it supports
8219 many options that conflict even with these standard options.}
8220
8221 @table @code
8222 @cindex Dates
8223 @cindex Time
8224 @cindex Specifying dates
8225 @item -D @var{date_spec}
8226 Use the most recent revision no later than @var{date_spec}.
8227 @var{date_spec} is a single argument, a date description
8228 specifying a date in the past.
8229
8230 The specification is @dfn{sticky} when you use it to make a
8231 private copy of a source file; that is, when you get a working
8232 file using @samp{-D}, @sc{cvs} records the date you specified, so that
8233 further updates in the same directory will use the same date
8234 (for more information on sticky tags/dates, @pxref{Sticky tags}).
8235
8236 @samp{-D} is available with the @code{annotate}, @code{checkout},
8237 @code{diff}, @code{export}, @code{history}, @code{ls},
8238 @code{rdiff}, @code{rls}, @code{rtag}, @code{tag}, and @code{update} commands.
8239 (The @code{history} command uses this option in a
8240 slightly different way; @pxref{history options}).
8241
8242 @c What other formats should we accept?  I don't want
8243 @c to start accepting a whole mess of non-standard
8244 @c new formats (there are a lot which are in wide use in
8245 @c one context or another), but practicality does
8246 @c dictate some level of flexibility.
8247 @c * POSIX.2 (e.g. touch, ls output, date) and other
8248 @c POSIX and/or de facto unix standards (e.g. at).  The
8249 @c practice here is too inconsistent to be of any use.
8250 @c * VMS dates.  This is not a formal standard, but
8251 @c there is a published specification (see SYS$ASCTIM
8252 @c and SYS$BINTIM in the _VMS System Services Reference
8253 @c Manual_), it is implemented consistently in VMS
8254 @c utilities, and VMS users will expect CVS running on
8255 @c VMS to support this format (and if we're going to do
8256 @c that, better to make CVS support it on all
8257 @c platforms.  Maybe).
8258 @c
8259 @c NOTE: The tar manual has some documentation for
8260 @c getdate.y (just for our info; we don't want to
8261 @c attempt to document all the formats accepted by
8262 @c getdate.y).
8263 @c
8264 @c One more note: In output, CVS should consistently
8265 @c use one date format, and that format should be one that
8266 @c it accepts in input as well.  The former isn't
8267 @c really true (see survey below), and I'm not
8268 @c sure that either of those formats is accepted in
8269 @c input.
8270 @c
8271 @c cvs log
8272 @c   current 1996/01/02 13:45:31
8273 @c   Internet 02 Jan 1996 13:45:31 UT
8274 @c   ISO 1996-01-02 13:45:31
8275 @c cvs ann
8276 @c   current 02-Jan-96
8277 @c   Internet-like 02 Jan 96
8278 @c   ISO 96-01-02
8279 @c cvs status
8280 @c   current Tue Jun 11 02:54:53 1996
8281 @c   Internet [Tue,] 11 Jun 1996 02:54:53
8282 @c   ISO 1996-06-11 02:54:53
8283 @c   note: date possibly should be omitted entirely for
8284 @c   other reasons.
8285 @c cvs editors
8286 @c   current Tue Jun 11 02:54:53 1996 GMT
8287 @c cvs history
8288 @c   current 06/11 02:54 +0000
8289 @c any others?
8290 @c There is a good chance the proper solution has to
8291 @c involve at least some level of letting the user
8292 @c decide which format (with the default being the
8293 @c formats CVS has always used; changing these might be
8294 @c _very_ disruptive since scripts may very well be
8295 @c parsing them).
8296 @c
8297 @c Another random bit of prior art concerning dates is
8298 @c the strptime function which takes templates such as
8299 @c "%m/%d/%y", and apparent a variant of getdate()
8300 @c which also honors them.  See
8301 @c X/Open CAE Specification, System Interfaces and
8302 @c Headers Issue 4, Version 2 (September 1994), in the
8303 @c entry for getdate() on page 231
8304
8305 @cindex Timezone, in input
8306 @cindex Zone, time, in input
8307 A wide variety of date formats are supported by
8308 @sc{cvs}.  The most standard ones are ISO8601 (from the
8309 International Standards Organization) and the Internet
8310 e-mail standard (specified in RFC822 as amended by
8311 RFC1123).
8312
8313 @c Probably should be doing more to spell out just what
8314 @c the rules are, rather than just giving examples.
8315 @c But I want to keep this simple too.
8316 @c So I don't know....
8317 @c A few specific issues: (1) Maybe should reassure
8318 @c people that years after 2000
8319 @c work (they are in the testsuite, so they do indeed
8320 @c work).  (2) What do two digit years
8321 @c mean?  Where do we accept them?  (3) Local times can
8322 @c be ambiguous or nonexistent if they fall during the
8323 @c hour when daylight savings time goes into or out of
8324 @c effect.  Pretty obscure, so I'm not at all sure we
8325 @c should be documenting the behavior in that case.
8326 ISO8601 dates have many variants but a few examples
8327 are:
8328
8329 @example
8330 1972-09-24
8331 1972-09-24 20:05
8332 @end example
8333 @c I doubt we really accept all ISO8601 format dates
8334 @c (for example, decimal hours like 1972-09-24 20,2)
8335 @c I'm not sure we should, many of them are pretty
8336 @c bizarre and it has lots of gratuitous multiple ways
8337 @c to specify the same thing.
8338
8339 There are a lot more ISO8601 date formats, and @sc{cvs}
8340 accepts many of them, but you probably don't want to
8341 hear the @emph{whole} long story :-).
8342
8343 @c Citing a URL here is kind of problematic given how
8344 @c much they change and people who have old versions of
8345 @c this manual, but in case we want to reinstate an
8346 @c ISO8601 URL, a few are:
8347 @c http://www.saqqara.demon.co.uk/datefmt.htm
8348 @c http://www.cl.cam.ac.uk/~mgk25/iso-time.html
8349 @c Citing some other ISO8601 source is probably even
8350 @c worse :-).
8351
8352 In addition to the dates allowed in Internet e-mail
8353 itself, @sc{cvs} also allows some of the fields to be
8354 omitted.  For example:
8355 @c FIXME: Need to figure out better, and document,
8356 @c what we want to allow the user to omit.
8357 @c NOTE: "omit" does not imply "reorder".
8358 @c FIXME: Need to cite a web page describing how to get
8359 @c RFC's.
8360
8361 @example
8362 24 Sep 1972 20:05
8363 24 Sep
8364 @end example
8365
8366 The date is interpreted as being in the
8367 local timezone, unless a specific timezone is
8368 specified.
8369
8370 These two date formats are preferred.  However,
8371 @sc{cvs} currently accepts a wide variety of other date
8372 formats.  They are intentionally not documented here in
8373 any detail, and future versions of @sc{cvs} might not
8374 accept all of them.
8375 @c We should document and testsuite "now" and
8376 @c "yesterday".  "now" is mentioned in the FAQ and
8377 @c "yesterday" is mentioned in this document (and the
8378 @c message from "cvs import" suggesting a merge
8379 @c command).  What else?  Probably some/all of the "3
8380 @c weeks ago" family.
8381 @c
8382 @c Maybe at
8383 @c some point have CVS start give warnings on "unofficial"
8384 @c formats (many of which might be typos or user
8385 @c misunderstandings, and/or formats people never/rarely
8386 @c use to specify dates)?
8387
8388 One such format is
8389 @code{@var{month}/@var{day}/@var{year}}.  This may
8390 confuse people who are accustomed to having the month
8391 and day in the other order; @samp{1/4/96} is January 4,
8392 not April 1.
8393
8394 Remember to quote the argument to the @samp{-D}
8395 flag so that your shell doesn't interpret spaces as
8396 argument separators.  A command using the @samp{-D}
8397 flag can look like this:
8398
8399 @example
8400 $ cvs diff -D "1 hour ago" cvs.texinfo
8401 @end example
8402
8403 @cindex Forcing a tag match
8404 @item -f
8405 When you specify a particular date or tag to @sc{cvs} commands, they
8406 normally ignore files that do not contain the tag (or did not
8407 exist prior to the date) that you specified.  Use the @samp{-f} option
8408 if you want files retrieved even when there is no match for the
8409 tag or date.  (The most recent revision of the file
8410 will be used).
8411
8412 Note that even with @samp{-f}, a tag that you specify
8413 must exist (that is, in some file, not necessary in
8414 every file).  This is so that @sc{cvs} will continue to
8415 give an error if you mistype a tag name.
8416
8417 @need 800
8418 @samp{-f} is available with these commands:
8419 @code{annotate}, @code{checkout}, @code{export},
8420 @code{rdiff}, @code{rtag}, and @code{update}.
8421
8422 @strong{WARNING:  The @code{commit} and @code{remove}
8423 commands also have a
8424 @samp{-f} option, but it has a different behavior for
8425 those commands.  See @ref{commit options}, and
8426 @ref{Removing files}.}
8427
8428 @item -k @var{kflag}
8429 Override the default processing of RCS keywords other than
8430 @samp{-kb}.  @xref{Keyword substitution}, for the meaning of
8431 @var{kflag}.  Used with the @code{checkout} and @code{update}
8432 commands, your @var{kflag} specification is
8433 @dfn{sticky}; that is, when you use this option
8434 with a @code{checkout} or @code{update} command,
8435 @sc{cvs} associates your selected @var{kflag} with any files
8436 it operates on, and continues to use that @var{kflag} with future
8437 commands on the same files until you specify otherwise.
8438
8439 The @samp{-k} option is available with the @code{add},
8440 @code{checkout}, @code{diff}, @code{export}, @code{import} and
8441 @code{update} commands.
8442
8443 @strong{WARNING: Prior to CVS version 1.12.2, the @samp{-k} flag
8444 overrode the @samp{-kb} indication for a binary file.  This could
8445 sometimes corrupt binary files.  @xref{Merging and keywords}, for
8446 more.}
8447
8448 @item -l
8449 Local; run only in current working directory, rather than
8450 recursing through subdirectories.
8451
8452 Available with the following commands: @code{annotate}, @code{checkout},
8453 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8454 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8455 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8456 and @code{watchers}.
8457
8458 @cindex Editor, avoiding invocation of
8459 @cindex Avoiding editor invocation
8460 @item -m @var{message}
8461 Use @var{message} as log information, instead of
8462 invoking an editor.
8463
8464 Available with the following commands: @code{add},
8465 @code{commit} and @code{import}.
8466
8467 @item -n
8468 Do not run any tag program.  (A program can be
8469 specified to run in the modules
8470 database (@pxref{modules}); this option bypasses it).
8471
8472 @strong{Note: this is not the same as the @samp{cvs -n}
8473 program option, which you can specify to the left of a cvs command!}
8474
8475 Available with the @code{checkout}, @code{commit}, @code{export},
8476 and @code{rtag} commands.
8477
8478 @item -P
8479 Prune empty directories.  See @ref{Removing directories}.
8480
8481 @item -p
8482 Pipe the files retrieved from the repository to standard output,
8483 rather than writing them in the current directory.  Available
8484 with the @code{checkout} and @code{update} commands.
8485
8486 @item -R
8487 Process directories recursively.  This is the default for all @sc{cvs}
8488 commands, with the exception of @code{ls} & @code{rls}.
8489
8490 Available with the following commands: @code{annotate}, @code{checkout},
8491 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8492 @code{ls}, @code{rdiff}, @code{remove}, @code{rls}, @code{rtag},
8493 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8494 and @code{watchers}.
8495
8496 @item -r @var{tag}
8497 @cindex HEAD, special tag
8498 @cindex BASE, special tag
8499 Use the revision specified by the @var{tag} argument instead of the
8500 default @dfn{head} revision.  As well as arbitrary tags defined
8501 with the @code{tag} or @code{rtag} command, two special tags are
8502 always available: @samp{HEAD} refers to the most recent version
8503 available in the repository, and @samp{BASE} refers to the
8504 revision you last checked out into the current working directory.
8505
8506 @c FIXME: What does HEAD really mean?  I believe that
8507 @c the current answer is the head of the default branch
8508 @c for all cvs commands except diff.  For diff, it
8509 @c seems to be (a) the head of the trunk (or the default
8510 @c branch?) if there is no sticky tag, (b) the head of the
8511 @c branch for the sticky tag, if there is a sticky tag.
8512 @c (b) is ugly as it differs
8513 @c from what HEAD means for other commands, but people
8514 @c and/or scripts are quite possibly used to it.
8515 @c See "head" tests in sanity.sh.
8516 @c Probably the best fix is to introduce two new
8517 @c special tags, ".thead" for the head of the trunk,
8518 @c and ".bhead" for the head of the current branch.
8519 @c Then deprecate HEAD.  This has the advantage of
8520 @c not surprising people with a change to HEAD, and a
8521 @c side benefit of also phasing out the poorly-named
8522 @c HEAD (see discussion of reserved tag names in node
8523 @c "Tags").  Of course, .thead and .bhead should be
8524 @c carefully implemented (with the implementation the
8525 @c same for "diff" as for everyone else), test cases
8526 @c written (similar to the ones in "head"), new tests
8527 @c cases written for things like default branches, &c.
8528
8529 The tag specification is sticky when you use this
8530 @c option
8531 with @code{checkout} or @code{update} to make your own
8532 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8533 future update commands, until you specify otherwise (for more information
8534 on sticky tags/dates, @pxref{Sticky tags}).
8535
8536 The tag can be either a symbolic or numeric tag, as
8537 described in @ref{Tags}, or the name of a branch, as
8538 described in @ref{Branching and merging}.
8539
8540 Specifying the @samp{-q} global option along with the
8541 @samp{-r} command option is often useful, to suppress
8542 the warning messages when the @sc{rcs} file
8543 does not contain the specified tag.
8544
8545 @strong{Note: this is not the same as the overall @samp{cvs -r} option,
8546 which you can specify to the left of a @sc{cvs} command!}
8547
8548 @samp{-r} is available with the @code{checkout}, @code{commit},
8549 @code{diff}, @code{history}, @code{export}, @code{rdiff},
8550 @code{rtag}, and @code{update} commands.
8551
8552 @item -W
8553 Specify file names that should be filtered.  You can
8554 use this option repeatedly.  The spec can be a file
8555 name pattern of the same type that you can specify in
8556 the @file{.cvswrappers} file.
8557 Available with the following commands: @code{import},
8558 and @code{update}.
8559
8560 @end table
8561
8562 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8563 @node admin
8564 @appendixsec admin---Administration
8565 @cindex Admin (subcommand)
8566
8567 @itemize @bullet
8568 @item
8569 Requires: repository, working directory.
8570 @item
8571 Changes: repository.
8572 @item
8573 Synonym: rcs
8574 @end itemize
8575
8576 This is the @sc{cvs} interface to assorted
8577 administrative facilities.  Some of them have
8578 questionable usefulness for @sc{cvs} but exist for
8579 historical purposes.  Some of the questionable options
8580 are likely to disappear in the future.  This command
8581 @emph{does} work recursively, so extreme care should be
8582 used.
8583
8584 @cindex cvsadmin
8585 @cindex UserAdminOptions, in CVSROOT/config
8586 On unix, if there is a group named @code{cvsadmin},
8587 only members of that group can run @code{cvs admin}
8588 commands, except for those specified using the
8589 @code{UserAdminOptions} configuration option in the
8590 @file{CVSROOT/config} file.  Options specified using
8591 @code{UserAdminOptions} can be run by any user.  See
8592 @ref{config} for more on @code{UserAdminOptions}.
8593
8594 The @code{cvsadmin} group should exist on the server,
8595 or any system running the non-client/server @sc{cvs}.
8596 To disallow @code{cvs admin} for all users, create a
8597 group with no users in it.  On NT, the @code{cvsadmin}
8598 feature does not exist and all users
8599 can run @code{cvs admin}.
8600
8601 @menu
8602 * admin options::               admin options
8603 @end menu
8604
8605 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8606 @node admin options
8607 @appendixsubsec admin options
8608
8609 Some of these options have questionable usefulness for
8610 @sc{cvs} but exist for historical purposes.  Some even
8611 make it impossible to use @sc{cvs} until you undo the
8612 effect!
8613
8614 @table @code
8615 @item -A@var{oldfile}
8616 Might not work together with @sc{cvs}.  Append the
8617 access list of @var{oldfile} to the access list of the
8618 @sc{rcs} file.
8619
8620 @item -a@var{logins}
8621 Might not work together with @sc{cvs}.  Append the
8622 login names appearing in the comma-separated list
8623 @var{logins} to the access list of the @sc{rcs} file.
8624
8625 @item -b[@var{rev}]
8626 Set the default branch to @var{rev}.  In @sc{cvs}, you
8627 normally do not manipulate default branches; sticky
8628 tags (@pxref{Sticky tags}) are a better way to decide
8629 which branch you want to work on.  There is one reason
8630 to run @code{cvs admin -b}: to revert to the vendor's
8631 version when using vendor branches (@pxref{Reverting
8632 local changes}).
8633 There can be no space between @samp{-b} and its argument.
8634 @c Hmm, we don't document the usage where rev is
8635 @c omitted.  Maybe that usage can/should be deprecated
8636 @c (and replaced with -bHEAD or something?) (so we can toss
8637 @c the optional argument).  Note that -bHEAD does not
8638 @c work, as of 17 Sep 1997, but probably will once "cvs
8639 @c admin" is internal to CVS.
8640
8641 @cindex Comment leader
8642 @item -c@var{string}
8643 Sets the comment leader to @var{string}.  The comment
8644 leader is not used by current versions of @sc{cvs} or
8645 @sc{rcs} 5.7.  Therefore, you can almost surely not
8646 worry about it.  @xref{Keyword substitution}.
8647
8648 @item -e[@var{logins}]
8649 Might not work together with @sc{cvs}.  Erase the login
8650 names appearing in the comma-separated list
8651 @var{logins} from the access list of the RCS file.  If
8652 @var{logins} is omitted, erase the entire access list.
8653 There can be no space between @samp{-e} and its argument.
8654
8655 @item -I
8656 Run interactively, even if the standard input is not a
8657 terminal.  This option does not work with the
8658 client/server @sc{cvs} and is likely to disappear in
8659 a future release of @sc{cvs}.
8660
8661 @item -i
8662 Useless with @sc{cvs}.  This creates and initializes a
8663 new @sc{rcs} file, without depositing a revision.  With
8664 @sc{cvs}, add files with the @code{cvs add} command
8665 (@pxref{Adding files}).
8666
8667 @item -k@var{subst}
8668 Set the default keyword
8669 substitution to @var{subst}.  @xref{Keyword
8670 substitution}.  Giving an explicit @samp{-k} option to
8671 @code{cvs update}, @code{cvs export}, or @code{cvs
8672 checkout} overrides this default.
8673
8674 @item -l[@var{rev}]
8675 Lock the revision with number @var{rev}.  If a branch
8676 is given, lock the latest revision on that branch.  If
8677 @var{rev} is omitted, lock the latest revision on the
8678 default branch.  There can be no space between
8679 @samp{-l} and its argument.
8680
8681 This can be used in conjunction with the
8682 @file{rcslock.pl} script in the @file{contrib}
8683 directory of the @sc{cvs} source distribution to
8684 provide reserved checkouts (where only one user can be
8685 editing a given file at a time).  See the comments in
8686 that file for details (and see the @file{README} file
8687 in that directory for disclaimers about the unsupported
8688 nature of contrib).  According to comments in that
8689 file, locking must set to strict (which is the default).
8690
8691 @item -L
8692 Set locking to strict.  Strict locking means that the
8693 owner of an RCS file is not exempt from locking for
8694 checkin.  For use with @sc{cvs}, strict locking must be
8695 set; see the discussion under the @samp{-l} option above.
8696
8697 @cindex Changing a log message
8698 @cindex Replacing a log message
8699 @cindex Correcting a log message
8700 @cindex Fixing a log message
8701 @cindex Log message, correcting
8702 @item -m@var{rev}:@var{msg}
8703 Replace the log message of revision @var{rev} with
8704 @var{msg}.
8705
8706 @c The rcs -M option, to suppress sending mail, has never been
8707 @c documented as a cvs admin option.
8708
8709 @item -N@var{name}[:[@var{rev}]]
8710 Act like @samp{-n}, except override any previous
8711 assignment of @var{name}.  For use with magic branches,
8712 see @ref{Magic branch numbers}.
8713
8714 @item -n@var{name}[:[@var{rev}]]
8715 Associate the symbolic name @var{name} with the branch
8716 or revision @var{rev}.  It is normally better to use
8717 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8718 symbolic name if both @samp{:} and @var{rev} are
8719 omitted; otherwise, print an error message if
8720 @var{name} is already associated with another number.
8721 If @var{rev} is symbolic, it is expanded before
8722 association.  A @var{rev} consisting of a branch number
8723 followed by a @samp{.} stands for the current latest
8724 revision in the branch.  A @samp{:} with an empty
8725 @var{rev} stands for the current latest revision on the
8726 default branch, normally the trunk.  For example,
8727 @samp{cvs admin -n@var{name}:} associates @var{name} with the
8728 current latest revision of all the RCS files;
8729 this contrasts with @samp{cvs admin -n@var{name}:$} which
8730 associates @var{name} with the revision numbers
8731 extracted from keyword strings in the corresponding
8732 working files.
8733
8734 @cindex Deleting revisions
8735 @cindex Outdating revisions
8736 @cindex Saving space
8737 @item -o@var{range}
8738 Deletes (@dfn{outdates}) the revisions given by
8739 @var{range}.
8740
8741 Note that this command can be quite dangerous unless
8742 you know @emph{exactly} what you are doing (for example
8743 see the warnings below about how the
8744 @var{rev1}:@var{rev2} syntax is confusing).
8745
8746 If you are short on disc this option might help you.
8747 But think twice before using it---there is no way short
8748 of restoring the latest backup to undo this command!
8749 If you delete different revisions than you planned,
8750 either due to carelessness or (heaven forbid) a @sc{cvs}
8751 bug, there is no opportunity to correct the error
8752 before the revisions are deleted.  It probably would be
8753 a good idea to experiment on a copy of the repository
8754 first.
8755
8756 Specify @var{range} in one of the following ways:
8757
8758 @table @code
8759 @item @var{rev1}::@var{rev2}
8760 Collapse all revisions between rev1 and rev2, so that
8761 @sc{cvs} only stores the differences associated with going
8762 from rev1 to rev2, not intermediate steps.  For
8763 example, after @samp{-o 1.3::1.5} one can retrieve
8764 revision 1.3, revision 1.5, or the differences to get
8765 from 1.3 to 1.5, but not the revision 1.4, or the
8766 differences between 1.3 and 1.4.  Other examples:
8767 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8768 effect, because there are no intermediate revisions to
8769 remove.
8770
8771 @item ::@var{rev}
8772 Collapse revisions between the beginning of the branch
8773 containing @var{rev} and @var{rev} itself.  The
8774 branchpoint and @var{rev} are left intact.  For
8775 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8776 revision 1.3.2.5, and everything in between, but leaves
8777 1.3 and 1.3.2.6 intact.
8778
8779 @item @var{rev}::
8780 Collapse revisions between @var{rev} and the end of the
8781 branch containing @var{rev}.  Revision @var{rev} is
8782 left intact but the head revision is deleted.
8783
8784 @item @var{rev}
8785 Delete the revision @var{rev}.  For example, @samp{-o
8786 1.3} is equivalent to @samp{-o 1.2::1.4}.
8787
8788 @item @var{rev1}:@var{rev2}
8789 Delete the revisions from @var{rev1} to @var{rev2},
8790 inclusive, on the same branch.  One will not be able to
8791 retrieve @var{rev1} or @var{rev2} or any of the
8792 revisions in between.  For example, the command
8793 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8794 It means to delete revisions up to, and including, the
8795 tag R_1_02.  But beware!  If there are files that have not
8796 changed between R_1_02 and R_1_03 the file will have
8797 @emph{the same} numerical revision number assigned to
8798 the tags R_1_02 and R_1_03.  So not only will it be
8799 impossible to retrieve R_1_02; R_1_03 will also have to
8800 be restored from the tapes!  In most cases you want to
8801 specify @var{rev1}::@var{rev2} instead.
8802
8803 @item :@var{rev}
8804 Delete revisions from the beginning of the
8805 branch containing @var{rev} up to and including
8806 @var{rev}.
8807
8808 @item @var{rev}:
8809 Delete revisions from revision @var{rev}, including
8810 @var{rev} itself, to the end of the branch containing
8811 @var{rev}.
8812 @end table
8813
8814 None of the revisions to be deleted may have
8815 branches or locks.
8816
8817 If any of the revisions to be deleted have symbolic
8818 names, and one specifies one of the @samp{::} syntaxes,
8819 then @sc{cvs} will give an error and not delete any
8820 revisions.  If you really want to delete both the
8821 symbolic names and the revisions, first delete the
8822 symbolic names with @code{cvs tag -d}, then run
8823 @code{cvs admin -o}.  If one specifies the
8824 non-@samp{::} syntaxes, then @sc{cvs} will delete the
8825 revisions but leave the symbolic names pointing to
8826 nonexistent revisions.  This behavior is preserved for
8827 compatibility with previous versions of @sc{cvs}, but
8828 because it isn't very useful, in the future it may
8829 change to be like the @samp{::} case.
8830
8831 Due to the way @sc{cvs} handles branches @var{rev}
8832 cannot be specified symbolically if it is a branch.
8833 @xref{Magic branch numbers}, for an explanation.
8834 @c FIXME: is this still true?  I suspect not.
8835
8836 Make sure that no-one has checked out a copy of the
8837 revision you outdate.  Strange things will happen if he
8838 starts to edit it and tries to check it back in.  For
8839 this reason, this option is not a good way to take back
8840 a bogus commit; commit a new revision undoing the bogus
8841 change instead (@pxref{Merging two revisions}).
8842
8843 @item -q
8844 Run quietly; do not print diagnostics.
8845
8846 @item -s@var{state}[:@var{rev}]
8847 Useful with @sc{cvs}.  Set the state attribute of the
8848 revision @var{rev} to @var{state}.  If @var{rev} is a
8849 branch number, assume the latest revision on that
8850 branch.  If @var{rev} is omitted, assume the latest
8851 revision on the default branch.  Any identifier is
8852 acceptable for @var{state}.  A useful set of states is
8853 @samp{Exp} (for experimental), @samp{Stab} (for
8854 stable), and @samp{Rel} (for released).  By default,
8855 the state of a new revision is set to @samp{Exp} when
8856 it is created.  The state is visible in the output from
8857 @var{cvs log} (@pxref{log}), and in the
8858 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
8859 (@pxref{Keyword substitution}).  Note that @sc{cvs}
8860 uses the @code{dead} state for its own purposes; to
8861 take a file to or from the @code{dead} state use
8862 commands like @code{cvs remove} and @code{cvs add}, not
8863 @code{cvs admin -s}.
8864
8865 @item -t[@var{file}]
8866 Useful with @sc{cvs}.  Write descriptive text from the
8867 contents of the named @var{file} into the RCS file,
8868 deleting the existing text.  The @var{file} pathname
8869 may not begin with @samp{-}.  The descriptive text can be seen in the
8870 output from @samp{cvs log} (@pxref{log}).
8871 There can be no space between @samp{-t} and its argument.
8872
8873 If @var{file} is omitted,
8874 obtain the text from standard input, terminated by
8875 end-of-file or by a line containing @samp{.} by itself.
8876 Prompt for the text if interaction is possible; see
8877 @samp{-I}.
8878
8879 @item -t-@var{string}
8880 Similar to @samp{-t@var{file}}. Write descriptive text
8881 from the @var{string} into the @sc{rcs} file, deleting
8882 the existing text.
8883 There can be no space between @samp{-t} and its argument.
8884
8885 @c The rcs -T option, do not update last-mod time for
8886 @c minor changes, has never been documented as a
8887 @c cvs admin option.
8888
8889 @item -U
8890 Set locking to non-strict.  Non-strict locking means
8891 that the owner of a file need not lock a revision for
8892 checkin.  For use with @sc{cvs}, strict locking must be
8893 set; see the discussion under the @samp{-l} option
8894 above.
8895
8896 @item -u[@var{rev}]
8897 See the option @samp{-l} above, for a discussion of
8898 using this option with @sc{cvs}.  Unlock the revision
8899 with number @var{rev}.  If a branch is given, unlock
8900 the latest revision on that branch.  If @var{rev} is
8901 omitted, remove the latest lock held by the caller.
8902 Normally, only the locker of a revision may unlock it;
8903 somebody else unlocking a revision breaks the lock.
8904 This causes the original locker to be sent a @code{commit}
8905 notification (@pxref{Getting Notified}).
8906 There can be no space between @samp{-u} and its argument.
8907
8908 @item -V@var{n}
8909 In previous versions of @sc{cvs}, this option meant to
8910 write an @sc{rcs} file which would be acceptable to
8911 @sc{rcs} version @var{n}, but it is now obsolete and
8912 specifying it will produce an error.
8913 @c Note that -V without an argument has never been
8914 @c documented as a cvs admin option.
8915
8916 @item -x@var{suffixes}
8917 In previous versions of @sc{cvs}, this was documented
8918 as a way of specifying the names of the @sc{rcs}
8919 files.  However, @sc{cvs} has always required that the
8920 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
8921 this option has never done anything useful.
8922
8923 @c The rcs -z option, to specify the timezone, has
8924 @c never been documented as a cvs admin option.
8925 @end table
8926
8927 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8928 @node annotate
8929 @appendixsec annotate---What revision modified each line of a file?
8930 @cindex annotate (subcommand)
8931
8932 @itemize @bullet
8933 @item
8934 Synopsis: annotate [options] files@dots{}
8935 @item
8936 Requires: repository.
8937 @item
8938 Changes: nothing.
8939 @end itemize
8940
8941 For each file in @var{files}, print the head revision
8942 of the trunk, together with information on the last
8943 modification for each line.  
8944
8945 @menu
8946 * annotate options::            annotate options
8947 * annotate example::            annotate example
8948 @end menu
8949
8950 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8951 @node annotate options
8952 @appendixsubsec annotate options
8953
8954 These standard options are supported by @code{annotate}
8955 (@pxref{Common options}, for a complete description of
8956 them):
8957
8958 @table @code
8959 @item -l
8960 Local directory only, no recursion.
8961
8962 @item -R
8963 Process directories recursively.
8964
8965 @item -f
8966 Use head revision if tag/date not found.
8967
8968 @item -F
8969 Annotate binary files.
8970
8971 @item -r @var{revision}
8972 Annotate file as of specified revision/tag.
8973
8974 @item -D @var{date}
8975 Annotate file as of specified date.
8976 @end table
8977
8978 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8979 @node annotate example
8980 @appendixsubsec annotate example
8981
8982 For example:
8983
8984 @example
8985 $ cvs annotate ssfile
8986 Annotations for ssfile
8987 ***************
8988 1.1          (mary     27-Mar-96): ssfile line 1
8989 1.2          (joe      28-Mar-96): ssfile line 2
8990 @end example
8991
8992 The file @file{ssfile} currently contains two lines.
8993 The @code{ssfile line 1} line was checked in by
8994 @code{mary} on March 27.  Then, on March 28, @code{joe}
8995 added a line @code{ssfile line 2}, without modifying
8996 the @code{ssfile line 1} line.  This report doesn't
8997 tell you anything about lines which have been deleted
8998 or replaced; you need to use @code{cvs diff} for that
8999 (@pxref{diff}).
9000
9001 The options to @code{cvs annotate} are listed in
9002 @ref{Invoking CVS}, and can be used to select the files
9003 and revisions to annotate.  The options are described
9004 in more detail there and in @ref{Common options}.
9005
9006 @c FIXME: maybe an example using the options?  Just
9007 @c what it means to select a revision might be worth a
9008 @c few words of explanation ("you want to see who
9009 @c changed this line *before* 1.4"...).
9010
9011 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9012 @node checkout
9013 @appendixsec checkout---Check out sources for editing
9014 @cindex checkout (subcommand)
9015 @cindex co (subcommand)
9016
9017 @itemize @bullet
9018 @item
9019 Synopsis: checkout [options] modules@dots{}
9020 @item
9021 Requires: repository.
9022 @item
9023 Changes: working directory.
9024 @item
9025 Synonyms: co, get
9026 @end itemize
9027
9028 Create or update a working directory containing copies of the
9029 source files specified by @var{modules}.  You must execute
9030 @code{checkout} before using most of the other @sc{cvs}
9031 commands, since most of them operate on your working
9032 directory.
9033
9034 The @var{modules} are either
9035 symbolic names for some
9036 collection of source directories and files, or paths to
9037 directories or files in the repository.  The symbolic
9038 names are defined in the @samp{modules} file.
9039 @xref{modules}.
9040 @c Needs an example, particularly of the non-"modules"
9041 @c case but probably of both.
9042
9043 @c FIXME: this seems like a very odd place to introduce
9044 @c people to how CVS works.  The bit about unreserved
9045 @c checkouts is also misleading as it depends on how
9046 @c things are set up.
9047 Depending on the modules you specify, @code{checkout} may
9048 recursively create directories and populate them with
9049 the appropriate source files.  You can then edit these
9050 source files at any time (regardless of whether other
9051 software developers are editing their own copies of the
9052 sources); update them to include new changes applied by
9053 others to the source repository; or commit your work as
9054 a permanent change to the source repository.
9055
9056 Note that @code{checkout} is used to create
9057 directories.  The top-level directory created is always
9058 added to the directory where @code{checkout} is
9059 invoked, and usually has the same name as the specified
9060 module.  In the case of a module alias, the created
9061 sub-directory may have a different name, but you can be
9062 sure that it will be a sub-directory, and that
9063 @code{checkout} will show the relative path leading to
9064 each file as it is extracted into your private work
9065 area (unless you specify the @samp{-Q} global option).
9066
9067 The files created by @code{checkout} are created
9068 read-write, unless the @samp{-r} option to @sc{cvs}
9069 (@pxref{Global options}) is specified, the
9070 @code{CVSREAD} environment variable is specified
9071 (@pxref{Environment variables}), or a watch is in
9072 effect for that file (@pxref{Watches}).
9073
9074 Note that running @code{checkout} on a directory that was already
9075 built by a prior @code{checkout} is also permitted.
9076 This is similar to specifying the @samp{-d} option
9077 to the @code{update} command in the sense that new
9078 directories that have been created in the repository
9079 will appear in your work area.
9080 However, @code{checkout} takes a module name whereas
9081 @code{update} takes a directory name.  Also
9082 to use @code{checkout} this way it must be run from the
9083 top level directory (where you originally ran
9084 @code{checkout} from), so before you run
9085 @code{checkout} to update an existing directory, don't
9086 forget to change your directory to the top level
9087 directory.
9088
9089 For the output produced by the @code{checkout} command
9090 see @ref{update output}.
9091
9092 @menu
9093 * checkout options::            checkout options
9094 * checkout examples::           checkout examples
9095 @end menu
9096
9097 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9098 @node checkout options
9099 @appendixsubsec checkout options
9100
9101 These standard options are supported by @code{checkout}
9102 (@pxref{Common options}, for a complete description of
9103 them):
9104
9105 @table @code
9106 @item -D @var{date}
9107 Use the most recent revision no later than @var{date}.
9108 This option is sticky, and implies @samp{-P}.  See
9109 @ref{Sticky tags}, for more information on sticky tags/dates.
9110
9111 @item -f
9112 Only useful with the @samp{-D @var{date}} or @samp{-r
9113 @var{tag}} flags.  If no matching revision is found,
9114 retrieve the most recent revision (instead of ignoring
9115 the file).
9116
9117 @item -k @var{kflag}
9118 Process keywords according to @var{kflag}.  See
9119 @ref{Keyword substitution}.
9120 This option is sticky; future updates of
9121 this file in this working directory will use the same
9122 @var{kflag}.  The @code{status} command can be viewed
9123 to see the sticky options.  See @ref{Invoking CVS}, for
9124 more information on the @code{status} command.
9125
9126 @item -l
9127 Local; run only in current working directory.
9128
9129 @item -n
9130 Do not run any checkout program (as specified
9131 with the @samp{-o} option in the modules file;
9132 @pxref{modules}).
9133
9134 @item -P
9135 Prune empty directories.  See @ref{Moving directories}.
9136
9137 @item -p
9138 Pipe files to the standard output.
9139
9140 @item -R
9141 Checkout directories recursively.  This option is on by default.
9142
9143 @item -r @var{tag}
9144 Use revision @var{tag}.  This option is sticky, and implies @samp{-P}.
9145 See @ref{Sticky tags}, for more information on sticky tags/dates.
9146 @end table
9147
9148 In addition to those, you can use these special command
9149 options with @code{checkout}:
9150
9151 @table @code
9152 @item -A
9153 Reset any sticky tags, dates, or @samp{-k} options.
9154 See @ref{Sticky tags}, for more information on sticky tags/dates.
9155
9156 @item -c
9157 Copy the module file, sorted, to the standard output,
9158 instead of creating or modifying any files or
9159 directories in your working directory.
9160
9161 @item -d @var{dir}
9162 Create a directory called @var{dir} for the working
9163 files, instead of using the module name.  In general,
9164 using this flag is equivalent to using @samp{mkdir
9165 @var{dir}; cd @var{dir}} followed by the checkout
9166 command without the @samp{-d} flag.
9167
9168 There is an important exception, however.  It is very
9169 convenient when checking out a single item to have the
9170 output appear in a directory that doesn't contain empty
9171 intermediate directories.  In this case @emph{only},
9172 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
9173 directories.
9174
9175 For example, given a module @samp{foo} that contains
9176 the file @samp{bar.c}, the command @samp{cvs co -d dir
9177 foo} will create directory @samp{dir} and place
9178 @samp{bar.c} inside.  Similarly, given a module
9179 @samp{bar} which has subdirectory @samp{baz} wherein
9180 there is a file @samp{quux.c}, the command @samp{cvs co
9181 -d dir bar/baz} will create directory @samp{dir} and
9182 place @samp{quux.c} inside.
9183
9184 Using the @samp{-N} flag will defeat this behavior.
9185 Given the same module definitions above, @samp{cvs co
9186 -N -d dir foo} will create directories @samp{dir/foo}
9187 and place @samp{bar.c} inside, while @samp{cvs co -N -d
9188 dir bar/baz} will create directories @samp{dir/bar/baz}
9189 and place @samp{quux.c} inside.
9190
9191 @item -j @var{tag}
9192 With two @samp{-j} options, merge changes from the
9193 revision specified with the first @samp{-j} option to
9194 the revision specified with the second @samp{j} option,
9195 into the working directory.
9196
9197 With one @samp{-j} option, merge changes from the
9198 ancestor revision to the revision specified with the
9199 @samp{-j} option, into the working directory.  The
9200 ancestor revision is the common ancestor of the
9201 revision which the working directory is based on, and
9202 the revision specified in the @samp{-j} option.
9203
9204 In addition, each -j option can contain an optional
9205 date specification which, when used with branches, can
9206 limit the chosen revision to one within a specific
9207 date.  An optional date is specified by adding a colon
9208 (:) to the tag:
9209 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
9210
9211 @xref{Branching and merging}.
9212
9213 @item -N
9214 Only useful together with @samp{-d @var{dir}}.  With
9215 this option, @sc{cvs} will not ``shorten'' module paths
9216 in your working directory when you check out a single
9217 module.  See the @samp{-d} flag for examples and a
9218 discussion.
9219
9220 @item -s
9221 Like @samp{-c}, but include the status of all modules,
9222 and sort it by the status string.  @xref{modules}, for
9223 info about the @samp{-s} option that is used inside the
9224 modules file to set the module status.
9225 @end table
9226
9227 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9228 @node checkout examples
9229 @appendixsubsec checkout examples
9230
9231 Get a copy of the module @samp{tc}:
9232
9233 @example
9234 $ cvs checkout tc
9235 @end example
9236
9237 Get a copy of the module @samp{tc} as it looked one day
9238 ago:
9239
9240 @example
9241 $ cvs checkout -D yesterday tc
9242 @end example
9243
9244 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9245 @node commit
9246 @appendixsec commit---Check files into the repository
9247 @cindex commit (subcommand)
9248
9249 @itemize @bullet
9250 @item
9251 Synopsis: commit [-lnRf] [-m 'log_message' |
9252 -F file] [-r revision] [files@dots{}]
9253 @item
9254 Requires: working directory, repository.
9255 @item
9256 Changes: repository.
9257 @item
9258 Synonym: ci
9259 @end itemize
9260
9261 Use @code{commit} when you want to incorporate changes
9262 from your working source files into the source
9263 repository.
9264
9265 If you don't specify particular files to commit, all of
9266 the files in your working current directory are
9267 examined.  @code{commit} is careful to change in the
9268 repository only those files that you have really
9269 changed.  By default (or if you explicitly specify the
9270 @samp{-R} option), files in subdirectories are also
9271 examined and committed if they have changed; you can
9272 use the @samp{-l} option to limit @code{commit} to the
9273 current directory only.
9274
9275 @code{commit} verifies that the selected files are up
9276 to date with the current revisions in the source
9277 repository; it will notify you, and exit without
9278 committing, if any of the specified files must be made
9279 current first with @code{update} (@pxref{update}).
9280 @code{commit} does not call the @code{update} command
9281 for you, but rather leaves that for you to do when the
9282 time is right.
9283
9284 When all is well, an editor is invoked to allow you to
9285 enter a log message that will be written to one or more
9286 logging programs (@pxref{modules}, and @pxref{loginfo})
9287 and placed in the @sc{rcs} file inside the
9288 repository.  This log message can be retrieved with the
9289 @code{log} command; see @ref{log}.  You can specify the
9290 log message on the command line with the @samp{-m
9291 @var{message}} option, and thus avoid the editor invocation,
9292 or use the @samp{-F @var{file}} option to specify
9293 that the argument file contains the log message.
9294
9295 @menu
9296 * commit options::              commit options
9297 * commit examples::             commit examples
9298 @end menu
9299
9300 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9301 @node commit options
9302 @appendixsubsec commit options
9303
9304 These standard options are supported by @code{commit}
9305 (@pxref{Common options}, for a complete description of
9306 them):
9307
9308 @table @code
9309 @item -l
9310 Local; run only in current working directory.
9311
9312 @item -R
9313 Commit directories recursively.  This is on by default.
9314
9315 @item -r @var{revision}
9316 Commit to @var{revision}.  @var{revision} must be
9317 either a branch, or a revision on the main trunk that
9318 is higher than any existing revision number
9319 (@pxref{Assigning revisions}).  You
9320 cannot commit to a specific revision on a branch.
9321 @c FIXME: Need xref for branch case.
9322 @end table
9323
9324 @code{commit} also supports these options:
9325
9326 @table @code
9327 @item -F @var{file}
9328 Read the log message from @var{file}, instead
9329 of invoking an editor.
9330
9331 @item -f
9332 Note that this is not the standard behavior of
9333 the @samp{-f} option as defined in @ref{Common options}.
9334
9335 Force @sc{cvs} to commit a new revision even if you haven't
9336 made any changes to the file.  If the current revision
9337 of @var{file} is 1.7, then the following two commands
9338 are equivalent:
9339
9340 @example
9341 $ cvs commit -f @var{file}
9342 $ cvs commit -r 1.8 @var{file}
9343 @end example
9344
9345 @c This is odd, but it's how CVS has worked for some
9346 @c time.
9347 The @samp{-f} option disables recursion (i.e., it
9348 implies @samp{-l}).  To force @sc{cvs} to commit a new
9349 revision for all files in all subdirectories, you must
9350 use @samp{-f -R}.
9351
9352 @item -m @var{message}
9353 Use @var{message} as the log message, instead of
9354 invoking an editor.
9355 @end table
9356
9357 @need 2000
9358 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9359 @node commit examples
9360 @appendixsubsec commit examples
9361
9362 @c FIXME: this material wants to be somewhere
9363 @c in "Branching and merging".
9364
9365 @appendixsubsubsec Committing to a branch
9366
9367 You can commit to a branch revision (one that has an
9368 even number of dots) with the @samp{-r} option.  To
9369 create a branch revision, use the @samp{-b} option
9370 of the @code{rtag} or @code{tag} commands
9371 (@pxref{Branching and merging}).  Then, either @code{checkout} or
9372 @code{update} can be used to base your sources on the
9373 newly created branch.  From that point on, all
9374 @code{commit} changes made within these working sources
9375 will be automatically added to a branch revision,
9376 thereby not disturbing main-line development in any
9377 way.  For example, if you had to create a patch to the
9378 1.2 version of the product, even though the 2.0 version
9379 is already under development, you might do:
9380
9381 @example
9382 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9383 $ cvs checkout -r FCS1_2_Patch product_module
9384 $ cd product_module
9385 [[ hack away ]]
9386 $ cvs commit
9387 @end example
9388
9389 @noindent
9390 This works automatically since the @samp{-r} option is
9391 sticky.
9392
9393 @appendixsubsubsec Creating the branch after editing
9394
9395 Say you have been working on some extremely
9396 experimental software, based on whatever revision you
9397 happened to checkout last week.  If others in your
9398 group would like to work on this software with you, but
9399 without disturbing main-line development, you could
9400 commit your change to a new branch.  Others can then
9401 checkout your experimental stuff and utilize the full
9402 benefit of @sc{cvs} conflict resolution.  The scenario might
9403 look like:
9404
9405 @c FIXME: Should we be recommending tagging the branchpoint?
9406 @example
9407 [[ hacked sources are present ]]
9408 $ cvs tag -b EXPR1
9409 $ cvs update -r EXPR1
9410 $ cvs commit
9411 @end example
9412
9413 The @code{update} command will make the @samp{-r
9414 EXPR1} option sticky on all files.  Note that your
9415 changes to the files will never be removed by the
9416 @code{update} command.  The @code{commit} will
9417 automatically commit to the correct branch, because the
9418 @samp{-r} is sticky.  You could also do like this:
9419
9420 @c FIXME: Should we be recommending tagging the branchpoint?
9421 @example
9422 [[ hacked sources are present ]]
9423 $ cvs tag -b EXPR1
9424 $ cvs commit -r EXPR1
9425 @end example
9426
9427 @noindent
9428 but then, only those files that were changed by you
9429 will have the @samp{-r EXPR1} sticky flag.  If you hack
9430 away, and commit without specifying the @samp{-r EXPR1}
9431 flag, some files may accidentally end up on the main
9432 trunk.
9433
9434 To work with you on the experimental change, others
9435 would simply do
9436
9437 @example
9438 $ cvs checkout -r EXPR1 whatever_module
9439 @end example
9440
9441 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9442 @node diff
9443 @appendixsec diff---Show differences between revisions
9444 @cindex diff (subcommand)
9445
9446 @itemize @bullet
9447 @item
9448 Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 |  -D date2]] [files@dots{}]
9449 @item
9450 Requires: working directory, repository.
9451 @item
9452 Changes: nothing.
9453 @end itemize
9454
9455 The @code{diff} command is used to compare different
9456 revisions of files.  The default action is to compare
9457 your working files with the revisions they were based
9458 on, and report any differences that are found.
9459
9460 If any file names are given, only those files are
9461 compared.  If any directories are given, all files
9462 under them will be compared.
9463
9464 The exit status for diff is different than for other
9465 @sc{cvs} commands; for details @ref{Exit status}.
9466
9467 @menu
9468 * diff options::                diff options
9469 * diff examples::               diff examples
9470 @end menu
9471
9472 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9473 @node diff options
9474 @appendixsubsec diff options
9475
9476 These standard options are supported by @code{diff}
9477 (@pxref{Common options}, for a complete description of
9478 them):
9479
9480 @table @code
9481 @item -D @var{date}
9482 Use the most recent revision no later than @var{date}.
9483 See @samp{-r} for how this affects the comparison.
9484
9485 @item -k @var{kflag}
9486 Process keywords according to @var{kflag}.  See
9487 @ref{Keyword substitution}.
9488
9489 @item -l
9490 Local; run only in current working directory.
9491
9492 @item -R
9493 Examine directories recursively.  This option is on by
9494 default.
9495
9496 @item -r @var{tag}
9497 Compare with revision @var{tag}.  Zero, one or two
9498 @samp{-r} options can be present.  With no @samp{-r}
9499 option, the working file will be compared with the
9500 revision it was based on.  With one @samp{-r}, that
9501 revision will be compared to your current working file.
9502 With two @samp{-r} options those two revisions will be
9503 compared (and your working file will not affect the
9504 outcome in any way).
9505 @c We should be a lot more explicit, with examples,
9506 @c about the difference between "cvs diff" and "cvs
9507 @c diff -r HEAD".  This often confuses new users.
9508
9509 One or both @samp{-r} options can be replaced by a
9510 @samp{-D @var{date}} option, described above.
9511 @end table
9512
9513 @c Conceptually, this is a disaster.  There are 3
9514 @c zillion diff formats that we support via the diff
9515 @c library.  It is not obvious to me that we should
9516 @c document them all.  Maybe just the most common ones
9517 @c like -c and -u, and think about phasing out the
9518 @c obscure ones.
9519 @c FIXCVS: also should be a way to specify an external
9520 @c diff program (which can be different for different
9521 @c file types) and pass through
9522 @c arbitrary options, so that the user can do
9523 @c "--pass=-Z --pass=foo" or something even if CVS
9524 @c doesn't know about the "-Z foo" option to diff.
9525 @c This would fit nicely with deprecating/eliminating
9526 @c the obscure options of the diff library, because it
9527 @c would let people specify an external GNU diff if
9528 @c they are into that sort of thing.
9529 The following options specify the format of the
9530 output.  They have the same meaning as in GNU diff.
9531 Most options have two equivalent names, one of which is a single letter
9532 preceded by @samp{-}, and the other of which is a long name preceded by
9533 @samp{--}.
9534
9535 @table @samp
9536 @item -@var{lines}
9537 Show @var{lines} (an integer) lines of context.  This option does not
9538 specify an output format by itself; it has no effect unless it is
9539 combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9540 operation, @code{patch} typically needs at least two lines of context.
9541
9542 @item -a
9543 Treat all files as text and compare them line-by-line, even if they
9544 do not seem to be text.
9545
9546 @item -b
9547 Ignore trailing white space and consider all other sequences of one or
9548 more white space characters to be equivalent.
9549
9550 @item -B
9551 Ignore changes that just insert or delete blank lines.
9552
9553 @item --binary
9554 Read and write data in binary mode.
9555
9556 @item --brief
9557 Report only whether the files differ, not the details of the
9558 differences.
9559
9560 @item -c
9561 Use the context output format.
9562
9563 @item -C @var{lines}
9564 @itemx --context@r{[}=@var{lines}@r{]}
9565 Use the context output format, showing @var{lines} (an integer) lines of
9566 context, or three if @var{lines} is not given.
9567 For proper operation, @code{patch} typically needs at least two lines of
9568 context.
9569
9570 @item --changed-group-format=@var{format}
9571 Use @var{format} to output a line group containing differing lines from
9572 both files in if-then-else format.  @xref{Line group formats}.
9573
9574 @item -d
9575 Change the algorithm to perhaps find a smaller set of changes.  This makes
9576 @code{diff} slower (sometimes much slower).
9577
9578 @item -e
9579 @itemx --ed
9580 Make output that is a valid @code{ed} script.
9581
9582 @item --expand-tabs
9583 Expand tabs to spaces in the output, to preserve the alignment of tabs
9584 in the input files.
9585
9586 @item -f
9587 Make output that looks vaguely like an @code{ed} script but has changes
9588 in the order they appear in the file.
9589
9590 @item -F @var{regexp}
9591 In context and unified format, for each hunk of differences, show some
9592 of the last preceding line that matches @var{regexp}.
9593
9594 @item --forward-ed
9595 Make output that looks vaguely like an @code{ed} script but has changes
9596 in the order they appear in the file.
9597
9598 @item -H
9599 Use heuristics to speed handling of large files that have numerous
9600 scattered small changes.
9601
9602 @item --horizon-lines=@var{lines}
9603 Do not discard the last @var{lines} lines of the common prefix
9604 and the first @var{lines} lines of the common suffix.
9605
9606 @item -i
9607 Ignore changes in case; consider upper- and lower-case letters
9608 equivalent.
9609
9610 @item -I @var{regexp}
9611 Ignore changes that just insert or delete lines that match @var{regexp}.
9612
9613 @item --ifdef=@var{name}
9614 Make merged if-then-else output using @var{name}.
9615
9616 @item --ignore-all-space
9617 Ignore white space when comparing lines.
9618
9619 @item --ignore-blank-lines
9620 Ignore changes that just insert or delete blank lines.
9621
9622 @item --ignore-case
9623 Ignore changes in case; consider upper- and lower-case to be the same.
9624
9625 @item --ignore-matching-lines=@var{regexp}
9626 Ignore changes that just insert or delete lines that match @var{regexp}.
9627
9628 @item --ignore-space-change
9629 Ignore trailing white space and consider all other sequences of one or
9630 more white space characters to be equivalent.
9631
9632 @item --initial-tab
9633 Output a tab rather than a space before the text of a line in normal or
9634 context format.  This causes the alignment of tabs in the line to look
9635 normal.
9636
9637 @item -L @var{label}
9638 Use @var{label} instead of the file name in the context format
9639 and unified format headers.
9640
9641 @item --label=@var{label}
9642 Use @var{label} instead of the file name in the context format
9643 and unified format headers.
9644
9645 @item --left-column
9646 Print only the left column of two common lines in side by side format.
9647
9648 @item --line-format=@var{format}
9649 Use @var{format} to output all input lines in if-then-else format.
9650 @xref{Line formats}.
9651
9652 @item --minimal
9653 Change the algorithm to perhaps find a smaller set of changes.  This
9654 makes @code{diff} slower (sometimes much slower).
9655
9656 @item -n
9657 Output RCS-format diffs; like @samp{-f} except that each command
9658 specifies the number of lines affected.
9659
9660 @item -N
9661 @itemx --new-file
9662 In directory comparison, if a file is found in only one directory,
9663 treat it as present but empty in the other directory.
9664
9665 @item --new-group-format=@var{format}
9666 Use @var{format} to output a group of lines taken from just the second
9667 file in if-then-else format.  @xref{Line group formats}.
9668
9669 @item --new-line-format=@var{format}
9670 Use @var{format} to output a line taken from just the second file in
9671 if-then-else format.  @xref{Line formats}.
9672
9673 @item --old-group-format=@var{format}
9674 Use @var{format} to output a group of lines taken from just the first
9675 file in if-then-else format.  @xref{Line group formats}.
9676
9677 @item --old-line-format=@var{format}
9678 Use @var{format} to output a line taken from just the first file in
9679 if-then-else format.  @xref{Line formats}.
9680
9681 @item -p
9682 Show which C function each change is in.
9683
9684 @item --rcs
9685 Output RCS-format diffs; like @samp{-f} except that each command
9686 specifies the number of lines affected.
9687
9688 @item --report-identical-files
9689 @itemx -s
9690 Report when two files are the same.
9691
9692 @item --show-c-function
9693 Show which C function each change is in.
9694
9695 @item --show-function-line=@var{regexp}
9696 In context and unified format, for each hunk of differences, show some
9697 of the last preceding line that matches @var{regexp}.
9698
9699 @item --side-by-side
9700 Use the side by side output format.
9701
9702 @item --speed-large-files
9703 Use heuristics to speed handling of large files that have numerous
9704 scattered small changes.
9705
9706 @item --suppress-common-lines
9707 Do not print common lines in side by side format.
9708
9709 @item -t
9710 Expand tabs to spaces in the output, to preserve the alignment of tabs
9711 in the input files.
9712
9713 @item -T
9714 Output a tab rather than a space before the text of a line in normal or
9715 context format.  This causes the alignment of tabs in the line to look
9716 normal.
9717
9718 @item --text
9719 Treat all files as text and compare them line-by-line, even if they
9720 do not appear to be text.
9721
9722 @item -u
9723 Use the unified output format.
9724
9725 @item --unchanged-group-format=@var{format}
9726 Use @var{format} to output a group of common lines taken from both files
9727 in if-then-else format.  @xref{Line group formats}.
9728
9729 @item --unchanged-line-format=@var{format}
9730 Use @var{format} to output a line common to both files in if-then-else
9731 format.  @xref{Line formats}.
9732
9733 @item -U @var{lines}
9734 @itemx --unified@r{[}=@var{lines}@r{]}
9735 Use the unified output format, showing @var{lines} (an integer) lines of
9736 context, or three if @var{lines} is not given.
9737 For proper operation, @code{patch} typically needs at least two lines of
9738 context.
9739
9740 @item -w
9741 Ignore white space when comparing lines.
9742
9743 @item -W @var{columns}
9744 @itemx --width=@var{columns}
9745 Use an output width of @var{columns} in side by side format.
9746
9747 @item -y
9748 Use the side by side output format.
9749 @end table
9750
9751 @menu
9752 * Line group formats::          Line group formats
9753 * Line formats::                Line formats
9754 @end menu
9755
9756 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9757 @node Line group formats
9758 @appendixsubsubsec Line group formats
9759
9760 Line group formats let you specify formats suitable for many
9761 applications that allow if-then-else input, including programming
9762 languages and text formatting languages.  A line group format specifies
9763 the output format for a contiguous group of similar lines.
9764
9765 For example, the following command compares the TeX file @file{myfile}
9766 with the original version from the repository,
9767 and outputs a merged file in which old regions are
9768 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
9769 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
9770
9771 @example
9772 cvs diff \
9773    --old-group-format='\begin@{em@}
9774 %<\end@{em@}
9775 ' \
9776    --new-group-format='\begin@{bf@}
9777 %>\end@{bf@}
9778 ' \
9779    myfile
9780 @end example
9781
9782 The following command is equivalent to the above example, but it is a
9783 little more verbose, because it spells out the default line group formats.
9784
9785 @example
9786 cvs diff \
9787    --old-group-format='\begin@{em@}
9788 %<\end@{em@}
9789 ' \
9790    --new-group-format='\begin@{bf@}
9791 %>\end@{bf@}
9792 ' \
9793    --unchanged-group-format='%=' \
9794    --changed-group-format='\begin@{em@}
9795 %<\end@{em@}
9796 \begin@{bf@}
9797 %>\end@{bf@}
9798 ' \
9799    myfile
9800 @end example
9801
9802 Here is a more advanced example, which outputs a diff listing with
9803 headers containing line numbers in a ``plain English'' style.
9804
9805 @example
9806 cvs diff \
9807    --unchanged-group-format='' \
9808    --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
9809 %<' \
9810    --new-group-format='-------- %dN line%(N=1?:s) added after %de:
9811 %>' \
9812    --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
9813 %<-------- to:
9814 %>' \
9815    myfile
9816 @end example
9817
9818 To specify a line group format, use one of the options
9819 listed below.  You can specify up to four line group formats, one for
9820 each kind of line group.  You should quote @var{format}, because it
9821 typically contains shell metacharacters.
9822
9823 @table @samp
9824 @item --old-group-format=@var{format}
9825 These line groups are hunks containing only lines from the first file.
9826 The default old group format is the same as the changed group format if
9827 it is specified; otherwise it is a format that outputs the line group as-is.
9828
9829 @item --new-group-format=@var{format}
9830 These line groups are hunks containing only lines from the second
9831 file.  The default new group format is same as the changed group
9832 format if it is specified; otherwise it is a format that outputs the
9833 line group as-is.
9834
9835 @item --changed-group-format=@var{format}
9836 These line groups are hunks containing lines from both files.  The
9837 default changed group format is the concatenation of the old and new
9838 group formats.
9839
9840 @item --unchanged-group-format=@var{format}
9841 These line groups contain lines common to both files.  The default
9842 unchanged group format is a format that outputs the line group as-is.
9843 @end table
9844
9845 In a line group format, ordinary characters represent themselves;
9846 conversion specifications start with @samp{%} and have one of the
9847 following forms.
9848
9849 @table @samp
9850 @item %<
9851 stands for the lines from the first file, including the trailing newline.
9852 Each line is formatted according to the old line format (@pxref{Line formats}).
9853
9854 @item %>
9855 stands for the lines from the second file, including the trailing newline.
9856 Each line is formatted according to the new line format.
9857
9858 @item %=
9859 stands for the lines common to both files, including the trailing newline.
9860 Each line is formatted according to the unchanged line format.
9861
9862 @item %%
9863 stands for @samp{%}.
9864
9865 @item %c'@var{C}'
9866 where @var{C} is a single character, stands for @var{C}.
9867 @var{C} may not be a backslash or an apostrophe.
9868 For example, @samp{%c':'} stands for a colon, even inside
9869 the then-part of an if-then-else format, which a colon would
9870 normally terminate.
9871
9872 @item %c'\@var{O}'
9873 where @var{O} is a string of 1, 2, or 3 octal digits,
9874 stands for the character with octal code @var{O}.
9875 For example, @samp{%c'\0'} stands for a null character.
9876
9877 @item @var{F}@var{n}
9878 where @var{F} is a @code{printf} conversion specification and @var{n} is one
9879 of the following letters, stands for @var{n}'s value formatted with @var{F}.
9880
9881 @table @samp
9882 @item e
9883 The line number of the line just before the group in the old file.
9884
9885 @item f
9886 The line number of the first line in the group in the old file;
9887 equals @var{e} + 1.
9888
9889 @item l
9890 The line number of the last line in the group in the old file.
9891
9892 @item m
9893 The line number of the line just after the group in the old file;
9894 equals @var{l} + 1.
9895
9896 @item n
9897 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
9898
9899 @item E, F, L, M, N
9900 Likewise, for lines in the new file.
9901
9902 @end table
9903
9904 The @code{printf} conversion specification can be @samp{%d},
9905 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
9906 lower case hexadecimal, or upper case hexadecimal output
9907 respectively.  After the @samp{%} the following options can appear in
9908 sequence: a @samp{-} specifying left-justification; an integer
9909 specifying the minimum field width; and a period followed by an
9910 optional integer specifying the minimum number of digits.
9911 For example, @samp{%5dN} prints the number of new lines in the group
9912 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
9913
9914 @item (@var{A}=@var{B}?@var{T}:@var{E})
9915 If @var{A} equals @var{B} then @var{T} else @var{E}.
9916 @var{A} and @var{B} are each either a decimal constant
9917 or a single letter interpreted as above.
9918 This format spec is equivalent to @var{T} if
9919 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
9920
9921 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
9922 @samp{no lines} if @var{N} (the number of lines in the group in the
9923 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
9924 otherwise.
9925 @end table
9926
9927 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9928 @node Line formats
9929 @appendixsubsubsec Line formats
9930
9931 Line formats control how each line taken from an input file is
9932 output as part of a line group in if-then-else format.
9933
9934 For example, the following command outputs text with a one-column
9935 change indicator to the left of the text.  The first column of output
9936 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
9937 for unchanged lines.  The formats contain newline characters where
9938 newlines are desired on output.
9939
9940 @example
9941 cvs diff \
9942    --old-line-format='-%l
9943 ' \
9944    --new-line-format='|%l
9945 ' \
9946    --unchanged-line-format=' %l
9947 ' \
9948    myfile
9949 @end example
9950
9951 To specify a line format, use one of the following options.  You should
9952 quote @var{format}, since it often contains shell metacharacters.
9953
9954 @table @samp
9955 @item --old-line-format=@var{format}
9956 formats lines just from the first file.
9957
9958 @item --new-line-format=@var{format}
9959 formats lines just from the second file.
9960
9961 @item --unchanged-line-format=@var{format}
9962 formats lines common to both files.
9963
9964 @item --line-format=@var{format}
9965 formats all lines; in effect, it sets all three above options simultaneously.
9966 @end table
9967
9968 In a line format, ordinary characters represent themselves;
9969 conversion specifications start with @samp{%} and have one of the
9970 following forms.
9971
9972 @table @samp
9973 @item %l
9974 stands for the contents of the line, not counting its trailing
9975 newline (if any).  This format ignores whether the line is incomplete.
9976
9977 @item %L
9978 stands for the contents of the line, including its trailing newline
9979 (if any).  If a line is incomplete, this format preserves its
9980 incompleteness.
9981
9982 @item %%
9983 stands for @samp{%}.
9984
9985 @item %c'@var{C}'
9986 where @var{C} is a single character, stands for @var{C}.
9987 @var{C} may not be a backslash or an apostrophe.
9988 For example, @samp{%c':'} stands for a colon.
9989
9990 @item %c'\@var{O}'
9991 where @var{O} is a string of 1, 2, or 3 octal digits,
9992 stands for the character with octal code @var{O}.
9993 For example, @samp{%c'\0'} stands for a null character.
9994
9995 @item @var{F}n
9996 where @var{F} is a @code{printf} conversion specification,
9997 stands for the line number formatted with @var{F}.
9998 For example, @samp{%.5dn} prints the line number using the
9999 @code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
10000 more about printf conversion specifications.
10001
10002 @end table
10003
10004 The default line format is @samp{%l} followed by a newline character.
10005
10006 If the input contains tab characters and it is important that they line
10007 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
10008 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
10009 @samp{%L} with a tab character), or you should use the @samp{-t} or
10010 @samp{--expand-tabs} option.
10011
10012 Taken together, the line and line group formats let you specify many
10013 different formats.  For example, the following command uses a format
10014 similar to @code{diff}'s normal format.  You can tailor this command
10015 to get fine control over @code{diff}'s output.
10016
10017 @example
10018 cvs diff \
10019    --old-line-format='< %l
10020 ' \
10021    --new-line-format='> %l
10022 ' \
10023    --old-group-format='%df%(f=l?:,%dl)d%dE
10024 %<' \
10025    --new-group-format='%dea%dF%(F=L?:,%dL)
10026 %>' \
10027    --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
10028 %<---
10029 %>' \
10030    --unchanged-group-format='' \
10031    myfile
10032 @end example
10033
10034 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10035 @node diff examples
10036 @appendixsubsec diff examples
10037
10038 The following line produces a Unidiff (@samp{-u} flag)
10039 between revision 1.14 and 1.19 of
10040 @file{backend.c}.  Due to the @samp{-kk} flag no
10041 keywords are substituted, so differences that only depend
10042 on keyword substitution are ignored.
10043
10044 @example
10045 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
10046 @end example
10047
10048 Suppose the experimental branch EXPR1 was based on a
10049 set of files tagged RELEASE_1_0.  To see what has
10050 happened on that branch, the following can be used:
10051
10052 @example
10053 $ cvs diff -r RELEASE_1_0 -r EXPR1
10054 @end example
10055
10056 A command like this can be used to produce a context
10057 diff between two releases:
10058
10059 @example
10060 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
10061 @end example
10062
10063 If you are maintaining ChangeLogs, a command like the following
10064 just before you commit your changes may help you write
10065 the ChangeLog entry.  All local modifications that have
10066 not yet been committed will be printed.
10067
10068 @example
10069 $ cvs diff -u | less
10070 @end example
10071
10072 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10073 @node export
10074 @appendixsec export---Export sources from CVS, similar to checkout
10075 @cindex export (subcommand)
10076
10077 @itemize @bullet
10078 @item
10079 Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
10080 @item
10081 Requires: repository.
10082 @item
10083 Changes: current directory.
10084 @end itemize
10085
10086 This command is a variant of @code{checkout}; use it
10087 when you want a copy of the source for module without
10088 the @sc{cvs} administrative directories.  For example, you
10089 might use @code{export} to prepare source for shipment
10090 off-site.  This command requires that you specify a
10091 date or tag (with @samp{-D} or @samp{-r}), so that you
10092 can count on reproducing the source you ship to others
10093 (and thus it always prunes empty directories).
10094
10095 One often would like to use @samp{-kv} with @code{cvs
10096 export}.  This causes any keywords to be
10097 expanded such that an import done at some other site
10098 will not lose the keyword revision information.  But be
10099 aware that doesn't handle an export containing binary
10100 files correctly.  Also be aware that after having used
10101 @samp{-kv}, one can no longer use the @code{ident}
10102 command (which is part of the @sc{rcs} suite---see
10103 ident(1)) which looks for keyword strings.  If
10104 you want to be able to use @code{ident} you must not
10105 use @samp{-kv}.
10106
10107 @menu
10108 * export options::              export options
10109 @end menu
10110
10111 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10112 @node export options
10113 @appendixsubsec export options
10114
10115 These standard options are supported by @code{export}
10116 (@pxref{Common options}, for a complete description of
10117 them):
10118
10119 @table @code
10120 @item -D @var{date}
10121 Use the most recent revision no later than @var{date}.
10122
10123 @item -f
10124 If no matching revision is found, retrieve the most
10125 recent revision (instead of ignoring the file).
10126
10127 @item -l
10128 Local; run only in current working directory.
10129
10130 @item -n
10131 Do not run any checkout program.
10132
10133 @item -R
10134 Export directories recursively.  This is on by default.
10135
10136 @item -r @var{tag}
10137 Use revision @var{tag}.
10138 @end table
10139
10140 In addition, these options (that are common to
10141 @code{checkout} and @code{export}) are also supported:
10142
10143 @table @code
10144 @item -d @var{dir}
10145 Create a directory called @var{dir} for the working
10146 files, instead of using the module name.
10147 @xref{checkout options}, for complete details on how
10148 @sc{cvs} handles this flag.
10149
10150 @item -k @var{subst}
10151 Set keyword expansion mode (@pxref{Substitution modes}).
10152
10153 @item -N
10154 Only useful together with @samp{-d @var{dir}}.
10155 @xref{checkout options}, for complete details on how
10156 @sc{cvs} handles this flag.
10157 @end table
10158
10159 @ignore
10160 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10161 @c @node export examples
10162 @appendixsubsec export examples
10163
10164 Contributed examples are gratefully accepted.
10165 @c -- Examples here!!
10166 @end ignore
10167
10168 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10169 @node history
10170 @appendixsec history---Show status of files and users
10171 @cindex history (subcommand)
10172
10173 @itemize @bullet
10174 @item
10175 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
10176 @item
10177 Requires: the file @file{$CVSROOT/CVSROOT/history}
10178 @item
10179 Changes: nothing.
10180 @end itemize
10181
10182 @sc{cvs} can keep a history file that tracks each use of the
10183 @code{checkout}, @code{commit}, @code{rtag},
10184 @code{update}, and @code{release} commands.  You can
10185 use @code{history} to display this information in
10186 various formats.
10187
10188 Logging must be enabled by creating the file
10189 @file{$CVSROOT/CVSROOT/history}.
10190
10191 @strong{Note: @code{history} uses @samp{-f}, @samp{-l},
10192 @samp{-n}, and @samp{-p} in ways that conflict with the
10193 normal use inside @sc{cvs} (@pxref{Common options}).}
10194
10195 @menu
10196 * history options::             history options
10197 @end menu
10198
10199 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10200 @node history options
10201 @appendixsubsec history options
10202
10203 Several options (shown above as @samp{-report})  control  what
10204 kind of report is generated:
10205
10206 @table @code
10207 @item -c
10208 Report on each time commit was used (i.e., each time
10209 the repository was modified).
10210
10211 @item -e
10212 Everything (all record types).  Equivalent to
10213 specifying @samp{-x} with all record types.  Of course,
10214 @samp{-e} will also include record types which are
10215 added in a future version of @sc{cvs}; if you are
10216 writing a script which can only handle certain record
10217 types, you'll want to specify @samp{-x}.
10218
10219 @item -m @var{module}
10220 Report on a particular module.  (You can meaningfully
10221 use @samp{-m} more than once on the command line.)
10222
10223 @item -o
10224 Report on checked-out modules.  This is the default report type.
10225
10226 @item -T
10227 Report on all tags.
10228
10229 @item -x @var{type}
10230 Extract a particular set of record types @var{type} from the @sc{cvs}
10231 history.  The types are indicated by single letters,
10232 which you may specify in combination.
10233
10234 Certain commands have a single record type:
10235
10236 @table @code
10237 @item F
10238 release
10239 @item O
10240 checkout
10241 @item E
10242 export
10243 @item T
10244 rtag
10245 @end table
10246
10247 @noindent
10248 One of five record types may result from an update:
10249
10250 @table @code
10251 @item C
10252 A merge was necessary but collisions were
10253 detected (requiring manual merging).
10254 @item G
10255 A merge was necessary and it succeeded.
10256 @item U
10257 A working file was copied from the repository.
10258 @item P
10259 A working file was patched to match the repository.
10260 @item W
10261 The working copy of a file was deleted during
10262 update (because it was gone from the repository).
10263 @end table
10264
10265 @noindent
10266 One of three record types results from commit:
10267
10268 @table @code
10269 @item A
10270 A file was added for the first time.
10271 @item M
10272 A file was modified.
10273 @item R
10274 A file was removed.
10275 @end table
10276 @end table
10277
10278 The options shown as @samp{-flags} constrain or expand
10279 the report without requiring option arguments:
10280
10281 @table @code
10282 @item -a
10283 Show data for all users (the default is to show data
10284 only for the user executing @code{history}).
10285
10286 @item -l
10287 Show last modification only.
10288
10289 @item -w
10290 Show only the records for modifications done from the
10291 same working directory where @code{history} is
10292 executing.
10293 @end table
10294
10295 The options shown as @samp{-options @var{args}} constrain the report
10296 based on an argument:
10297
10298 @table @code
10299 @item -b @var{str}
10300 Show data back to a record containing  the  string
10301 @var{str}  in  either the module name, the file name, or
10302 the repository path.
10303
10304 @item -D @var{date}
10305 Show data since @var{date}.  This is slightly different
10306 from the normal use of @samp{-D @var{date}}, which
10307 selects the newest revision older than @var{date}.
10308
10309 @item -f @var{file}
10310 Show data for a particular file
10311 (you can specify several @samp{-f} options on the same command line).
10312 This is equivalent to specifying the file on the command line.
10313
10314 @item -n @var{module}
10315 Show data for a particular module
10316 (you can specify several @samp{-n} options on the same command line).
10317
10318 @item -p @var{repository}
10319 Show data for a particular source repository  (you
10320 can specify several @samp{-p} options on the same command
10321 line).
10322
10323 @item -r @var{rev}
10324 Show records referring to revisions since the revision
10325 or tag named @var{rev} appears in individual @sc{rcs}
10326 files.  Each @sc{rcs} file is searched for the revision or
10327 tag.
10328
10329 @item -t @var{tag}
10330 Show records since tag @var{tag} was last added to the
10331 history file.  This differs from the @samp{-r} flag
10332 above in that it reads only the history file, not the
10333 @sc{rcs} files, and is much faster.
10334
10335 @item -u @var{name}
10336 Show records for user @var{name}.
10337
10338 @item -z @var{timezone}
10339 Show times in the selected records using the specified
10340 time zone instead of UTC.
10341 @end table
10342
10343 @ignore
10344 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10345 @c @node history examples
10346 @appendixsubsec history examples
10347
10348 Contributed examples will gratefully be accepted.
10349 @c -- Examples here!
10350 @end ignore
10351
10352 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10353 @node import
10354 @appendixsec import---Import sources into CVS, using vendor branches
10355 @cindex import (subcommand)
10356
10357 @c FIXME: This node is way too long for one which has subnodes.
10358
10359 @itemize @bullet
10360 @item
10361 Synopsis: import [-options] repository vendortag releasetag@dots{}
10362 @item
10363 Requires: Repository, source distribution directory.
10364 @item
10365 Changes: repository.
10366 @end itemize
10367
10368 Use @code{import} to incorporate an entire source
10369 distribution from an outside source (e.g., a source
10370 vendor) into your source repository directory.  You can
10371 use this command both for initial creation of a
10372 repository, and for wholesale updates to the module
10373 from the outside source.  @xref{Tracking sources}, for
10374 a discussion on this subject.
10375
10376 The @var{repository} argument gives a directory name
10377 (or a path to a directory) under the @sc{cvs} root directory
10378 for repositories; if the directory did not exist,
10379 import creates it.
10380
10381 When you use import for updates to source that has been
10382 modified in your source repository (since a prior
10383 import), it will notify you of any files that conflict
10384 in the two branches of development; use @samp{checkout
10385 -j} to reconcile the differences, as import instructs
10386 you to do.
10387
10388 If @sc{cvs} decides a file should be ignored
10389 (@pxref{cvsignore}), it does not import it and prints
10390 @samp{I } followed by the filename (@pxref{import output}, for a
10391 complete description of the output).
10392
10393 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10394 any file whose names match the specifications in that
10395 file will be treated as packages and the appropriate
10396 filtering will be performed on the file/directory
10397 before being imported.  @xref{Wrappers}.
10398
10399 The outside source is saved in a first-level
10400 branch, by default 1.1.1.  Updates are leaves of this
10401 branch; for example, files from the first imported
10402 collection of source will be revision 1.1.1.1, then
10403 files from the first imported update will be revision
10404 1.1.1.2, and so on.
10405
10406 At least three arguments are required.
10407 @var{repository} is needed to identify the collection
10408 of source.  @var{vendortag} is a tag for the entire
10409 branch (e.g., for 1.1.1).  You must also specify at
10410 least one @var{releasetag} to identify the files at
10411 the leaves created each time you execute @code{import}.
10412
10413 @c I'm not completely sure this belongs here.  But
10414 @c we need to say it _somewhere_ reasonably obvious; it
10415 @c is a common misconception among people first learning CVS
10416 Note that @code{import} does @emph{not} change the
10417 directory in which you invoke it.  In particular, it
10418 does not set up that directory as a @sc{cvs} working
10419 directory; if you want to work with the sources import
10420 them first and then check them out into a different
10421 directory (@pxref{Getting the source}).
10422
10423 @menu
10424 * import options::              import options
10425 * import output::               import output
10426 * import examples::             import examples
10427 @end menu
10428
10429 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10430 @node import options
10431 @appendixsubsec import options
10432
10433 This standard option is supported by @code{import}
10434 (@pxref{Common options}, for a complete description):
10435
10436 @table @code
10437 @item -m @var{message}
10438 Use @var{message} as log information, instead of
10439 invoking an editor.
10440 @end table
10441
10442 There are the following additional special options.
10443
10444 @table @code
10445 @item -b @var{branch}
10446 See @ref{Multiple vendor branches}.
10447
10448 @item -k @var{subst}
10449 Indicate the keyword expansion mode desired.  This
10450 setting will apply to all files created during the
10451 import, but not to any files that previously existed in
10452 the repository.  See @ref{Substitution modes}, for a
10453 list of valid @samp{-k} settings.
10454
10455 @item -I @var{name}
10456 Specify file names that should be ignored during
10457 import.  You can use this option repeatedly.  To avoid
10458 ignoring any files at all (even those ignored by
10459 default), specify `-I !'.
10460
10461 @var{name} can be a file name pattern of the same type
10462 that you can specify in the @file{.cvsignore} file.
10463 @xref{cvsignore}.
10464 @c -- Is this really true?
10465
10466 @item -W @var{spec}
10467 Specify file names that should be filtered during
10468 import.  You can use this option repeatedly.
10469
10470 @var{spec} can be a file name pattern of the same type
10471 that you can specify in the @file{.cvswrappers}
10472 file. @xref{Wrappers}.
10473 @end table
10474
10475 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10476 @node import output
10477 @appendixsubsec import output
10478
10479 @code{import} keeps you informed of its progress by printing a line
10480 for each file, preceded by one character indicating the status of the file:
10481
10482 @table @code
10483 @item U @var{file}
10484 The file already exists in the repository and has not been locally
10485 modified; a new revision has been created (if necessary).
10486
10487 @item N @var{file}
10488 The file is a new file which has been added to the repository.
10489
10490 @item C @var{file}
10491 The file already exists in the repository but has been locally modified;
10492 you will have to merge the changes.
10493
10494 @item I @var{file}
10495 The file is being ignored (@pxref{cvsignore}).
10496
10497 @cindex Symbolic link, importing
10498 @cindex Link, symbolic, importing
10499 @c FIXME: also (somewhere else) probably
10500 @c should be documenting what happens if you "cvs add"
10501 @c a symbolic link.  Also maybe what happens if
10502 @c you manually create symbolic links within the
10503 @c repository (? - not sure why we'd want to suggest
10504 @c doing that).
10505 @item L @var{file}
10506 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10507 People periodically suggest that this behavior should
10508 be changed, but if there is a consensus on what it
10509 should be changed to, it is not apparent.
10510 (Various options in the @file{modules} file can be used
10511 to recreate symbolic links on checkout, update, etc.;
10512 @pxref{modules}.)
10513 @end table
10514
10515 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10516 @node import examples
10517 @appendixsubsec import examples
10518
10519 See @ref{Tracking sources}, and @ref{From files}.
10520
10521 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10522 @node log
10523 @appendixsec log---Print out log information for files
10524 @cindex log (subcommand)
10525
10526 @itemize @bullet
10527 @item
10528 Synopsis: log [options] [files@dots{}]
10529 @item
10530 Requires: repository, working directory.
10531 @item
10532 Changes: nothing.
10533 @end itemize
10534
10535 Display log information for files.  @code{log} used to
10536 call the @sc{rcs} utility @code{rlog}.  Although this
10537 is no longer true in the current sources, this history
10538 determines the format of the output and the options,
10539 which are not quite in the style of the other @sc{cvs}
10540 commands.
10541
10542 @cindex Timezone, in output
10543 @cindex Zone, time, in output
10544 The output includes the location of the @sc{rcs} file,
10545 the @dfn{head} revision (the latest revision on the
10546 trunk), all symbolic names (tags) and some other
10547 things.  For each revision, the revision number, the
10548 date, the
10549 author, the number of lines added/deleted and the log
10550 message are printed.  All dates are displayed in local
10551 time at the client.  This is typically specified in the
10552 @code{$TZ} environment variable, which can be set to
10553 govern how @code{log} displays dates.
10554
10555 @strong{Note: @code{log} uses @samp{-R} in a way that conflicts
10556 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10557
10558 @menu
10559 * log options::                 log options
10560 * log examples::                log examples
10561 @end menu
10562
10563 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10564 @node log options
10565 @appendixsubsec log options
10566
10567 By default, @code{log} prints all information that is
10568 available.  All other options restrict the output.
10569
10570 @table @code
10571 @item -b
10572 Print information about the revisions on the default
10573 branch, normally the highest branch on the trunk.
10574
10575 @item -d @var{dates}
10576 Print information about revisions with a checkin
10577 date/time in the range given by the
10578 semicolon-separated list of dates.  The date formats
10579 accepted are those accepted by the @samp{-D} option to
10580 many other @sc{cvs} commands (@pxref{Common options}).
10581 Dates can be combined into ranges as follows:
10582
10583 @c Should we be thinking about accepting ISO8601
10584 @c ranges?  For example "1972-09-10/1972-09-12".
10585 @table @code
10586 @item @var{d1}<@var{d2}
10587 @itemx @var{d2}>@var{d1}
10588 Select the revisions that were deposited between
10589 @var{d1} and @var{d2}.
10590
10591 @item <@var{d}
10592 @itemx @var{d}>
10593 Select all revisions dated @var{d} or earlier.
10594
10595 @item @var{d}<
10596 @itemx >@var{d}
10597 Select all revisions dated @var{d} or later.
10598
10599 @item @var{d}
10600 Select the single, latest revision dated @var{d} or
10601 earlier.
10602 @end table
10603
10604 The @samp{>} or @samp{<} characters may be followed by
10605 @samp{=} to indicate an inclusive range rather than an
10606 exclusive one.
10607
10608 Note that the separator is a semicolon (;).
10609
10610 @item -h
10611 Print only the name of the @sc{rcs} file, name
10612 of the file in the working directory, head,
10613 default branch, access list, locks, symbolic names, and
10614 suffix.
10615
10616 @item -l
10617 Local; run only in current working directory.  (Default
10618 is to run recursively).
10619
10620 @item -N
10621 Do not print the list of tags for this file.  This
10622 option can be very useful when your site uses a lot of
10623 tags, so rather than "more"'ing over 3 pages of tag
10624 information, the log information is presented without
10625 tags at all.
10626
10627 @item -R
10628 Print only the name of the @sc{rcs} file.
10629
10630 @c Note that using a bare revision (in addition to not
10631 @c being explicitly documented here) is potentially
10632 @c confusing; it shows the log message to get from the
10633 @c previous revision to that revision.  "-r1.3 -r1.6"
10634 @c (equivalent to "-r1.3,1.6") is even worse; it
10635 @c prints the messages to get from 1.2 to 1.3 and 1.5
10636 @c to 1.6.  By analogy with "cvs diff", users might
10637 @c expect that it is more like specifying a range.
10638 @c It is not 100% clear to me how much of this should
10639 @c be documented (for example, multiple -r options
10640 @c perhaps could/should be deprecated given the false
10641 @c analogy with "cvs diff").
10642 @c In general, this section should be rewritten to talk
10643 @c about messages to get from revision rev1 to rev2,
10644 @c rather than messages for revision rev2 (that is, the
10645 @c messages are associated with a change not a static
10646 @c revision and failing to make this distinction causes
10647 @c much confusion).
10648 @item -r@var{revisions}
10649 Print information about revisions given in the
10650 comma-separated list @var{revisions} of revisions and
10651 ranges.  The following table explains the available
10652 range formats:
10653
10654 @table @code
10655 @item @var{rev1}:@var{rev2}
10656 Revisions @var{rev1} to @var{rev2} (which must be on
10657 the same branch).
10658
10659 @item @var{rev1}::@var{rev2}
10660 The same, but excluding @var{rev1}.
10661
10662 @item :@var{rev}
10663 @itemx ::@var{rev}
10664 Revisions from the beginning of the branch up to
10665 and including @var{rev}.
10666
10667 @item @var{rev}:
10668 Revisions starting with @var{rev} to the end of the
10669 branch containing @var{rev}.
10670
10671 @item @var{rev}::
10672 Revisions starting just after @var{rev} to the end of the
10673 branch containing @var{rev}.
10674
10675 @item @var{branch}
10676 An argument that is a branch means all revisions on
10677 that branch.
10678
10679 @item @var{branch1}:@var{branch2}
10680 @itemx @var{branch1}::@var{branch2}
10681 A range of branches means all revisions
10682 on the branches in that range.
10683
10684 @item @var{branch}.
10685 The latest revision in @var{branch}.
10686 @end table
10687
10688 A bare @samp{-r} with no revisions means the latest
10689 revision on the default branch, normally the trunk.
10690 There can be no space between the @samp{-r} option and
10691 its argument.
10692
10693 @item -S
10694 Suppress the header if no revisions are selected.
10695
10696 @item -s @var{states}
10697 Print information about revisions whose state
10698 attributes match one of the states given in the
10699 comma-separated list @var{states}.
10700
10701 @item -t
10702 Print the same as @samp{-h}, plus the descriptive text.
10703
10704 @item -w@var{logins}
10705 Print information about revisions checked in by users
10706 with login names appearing in the comma-separated list
10707 @var{logins}.  If @var{logins} is omitted, the user's
10708 login is assumed.  There can be no space between the
10709 @samp{-w} option and its argument.
10710 @end table
10711
10712 @code{log} prints the intersection of the revisions
10713 selected with the options @samp{-d}, @samp{-s}, and
10714 @samp{-w}, intersected with the union of the revisions
10715 selected by @samp{-b} and @samp{-r}.
10716
10717 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10718 @node log examples
10719 @appendixsubsec log examples
10720
10721 @cindex Timezone, in output
10722 @cindex Zone, time, in output
10723 Since @code{log} shows dates in local time,
10724 you might want to see them in Coordinated Universal Time (UTC) or
10725 some other timezone.
10726 To do this you can set your @code{$TZ} environment
10727 variable before invoking @sc{cvs}:
10728
10729 @example
10730 $ TZ=UTC cvs log foo.c
10731 $ TZ=EST cvs log bar.c
10732 @end example
10733
10734 (If you are using a @code{csh}-style shell, like @code{tcsh},
10735 you would need to prefix the examples above with @code{env}.)
10736
10737 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10738 @node ls & rls
10739 @appendixsec ls & rls
10740 @cindex ls (subcommand)
10741 @cindex rls (subcommand)
10742
10743 @itemize @bullet
10744 @item
10745 ls [-e | -l] [-RP] [-r revision] [-D date] [path@dots{}]
10746 @item
10747 Requires: repository for @code{rls}, repository & working directory for
10748 @code{ls}.
10749 @item
10750 Changes: nothing.
10751 @item
10752 Synonym: @code{dir} & @code{list} are synonyms for @code{ls} and @code{rdir}
10753 & @code{rlist} are synonyms for @code{rls}.
10754 @end itemize
10755
10756 The @code{ls} and @code{rls} commands are used to list
10757 files and directories in the repository.
10758
10759 By default @code{ls} lists the files and directories
10760 that belong in your working directory, what would be
10761 there after an @code{update}.
10762
10763 By default @code{rls} lists the files and directories
10764 on the tip of the trunk in the topmost directory of the
10765 repository.
10766
10767 Both commands accept an optional list of file and
10768 directory names, relative to the working directory for
10769 @code{ls} and the topmost directory of the repository
10770 for @code{rls}.  Neither is recursive by default.
10771
10772 @menu
10773 * ls & rls options::         ls & rls options
10774 * rls examples:              rls examples
10775 @end menu
10776
10777 @node ls & rls options
10778 @appendixsubsec ls & rls options
10779
10780 These standard options are supported by @code{ls} & @code{rls}:
10781
10782 @table @code
10783 @item -d
10784 Show dead revisions (with tag when specified).
10785
10786 @item -e
10787 Display in CVS/Entries format.  This format is meant to remain easily parsable
10788 by automation.
10789
10790 @item -l
10791 Display all details.
10792
10793 @item -P
10794 Don't list contents of empty directories when recursing.
10795
10796 @item -R
10797 List recursively.
10798
10799 @item -r @var{revision}
10800 Show files with revision or tag.
10801
10802 @item -D @var{date}
10803 Show files from date.
10804 @end table
10805
10806 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10807 @node rls examples
10808 @appendixsubsec rls examples
10809
10810 @example
10811 $ cvs rls
10812 cvs rls: Listing module: `.'
10813 CVSROOT
10814 first-dir
10815 @end example
10816
10817 @example
10818 $ cvs rls CVSROOT
10819 cvs rls: Listing module: `CVSROOT'
10820 checkoutlist
10821 commitinfo
10822 config
10823 cvswrappers
10824 loginfo
10825 modules
10826 notify
10827 rcsinfo
10828 taginfo
10829 verifymsg
10830
10831 @end example
10832
10833 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10834 @node rdiff
10835 @appendixsec rdiff---'patch' format diffs between releases
10836 @cindex rdiff (subcommand)
10837
10838 @itemize @bullet
10839 @item
10840 rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
10841 @item
10842 Requires: repository.
10843 @item
10844 Changes: nothing.
10845 @item
10846 Synonym: patch
10847 @end itemize
10848
10849 Builds a Larry Wall format patch(1) file between two
10850 releases, that can be fed directly into the @code{patch}
10851 program to bring an old release up-to-date with the new
10852 release.  (This is one of the few @sc{cvs} commands that
10853 operates directly from the repository, and doesn't
10854 require a prior checkout.) The diff output is sent to
10855 the standard output device.
10856
10857 You can specify (using the standard @samp{-r} and
10858 @samp{-D} options) any combination of one or two
10859 revisions or dates.  If only one revision or date is
10860 specified, the patch file reflects differences between
10861 that revision or date and the current head revisions in
10862 the @sc{rcs} file.
10863
10864 Note that if the software release affected is contained
10865 in more than one directory, then it may be necessary to
10866 specify the @samp{-p} option to the @code{patch} command when
10867 patching the old sources, so that @code{patch} is able to find
10868 the files that are located in other directories.
10869
10870 @menu
10871 * rdiff options::               rdiff options
10872 * rdiff examples::              rdiff examples
10873 @end menu
10874
10875 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10876 @node rdiff options
10877 @appendixsubsec rdiff options
10878
10879 These standard options are supported by @code{rdiff}
10880 (@pxref{Common options}, for a complete description of
10881 them):
10882
10883 @table @code
10884 @item -D @var{date}
10885 Use the most recent revision no later than @var{date}.
10886
10887 @item -f
10888 If no matching revision is found, retrieve the most
10889 recent revision (instead of ignoring the file).
10890
10891 @item -l
10892 Local; don't descend subdirectories.
10893
10894 @item -R
10895 Examine directories recursively.  This option is on by default.
10896
10897 @item -r @var{tag}
10898 Use revision @var{tag}.
10899 @end table
10900
10901 In addition to the above, these options are available:
10902
10903 @table @code
10904 @item -c
10905 Use the context diff format.  This is the default format.
10906
10907 @item -s
10908 Create a summary change report instead of a patch.  The
10909 summary includes information about files that were
10910 changed or added between the releases.  It is sent to
10911 the standard output device.  This is useful for finding
10912 out, for example, which files have changed between two
10913 dates or revisions.
10914
10915 @item -t
10916 A diff of the top two revisions is sent to the standard
10917 output device.  This is most useful for seeing what the
10918 last change to a file was.
10919
10920 @item -u
10921 Use the unidiff format for the context diffs.
10922 Remember that old versions
10923 of the @code{patch} program can't handle the unidiff
10924 format, so if you plan to post this patch to the net
10925 you should probably not use @samp{-u}.
10926
10927 @item -V @var{vn}
10928 Expand keywords according to the rules current in
10929 @sc{rcs} version @var{vn} (the expansion format changed with
10930 @sc{rcs} version 5).  Note that this option is no
10931 longer accepted.  @sc{cvs} will always expand keywords the
10932 way that @sc{rcs} version 5 does.
10933 @end table
10934
10935 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10936 @node rdiff examples
10937 @appendixsubsec rdiff examples
10938
10939 Suppose you receive mail from @t{foo@@example.net} asking for an
10940 update from release 1.2 to 1.4 of the tc compiler.  You
10941 have no such patches on hand, but with @sc{cvs} that can
10942 easily be fixed with a command such as this:
10943
10944 @example
10945 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
10946 $$ Mail -s 'The patches you asked for' foo@@example.net
10947 @end example
10948
10949 Suppose you have made release 1.3, and forked a branch
10950 called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
10951 corresponds to release 1.3.1, which was made some time
10952 ago.  Now, you want to see how much development has been
10953 done on the branch.  This command can be used:
10954
10955 @example
10956 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
10957 cvs rdiff: Diffing module-name
10958 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
10959 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
10960 File bar.h,v changed from revision 1.29.2.1 to 1.2
10961 @end example
10962
10963 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10964 @node release
10965 @appendixsec release---Indicate that a Module is no longer in use
10966 @cindex release (subcommand)
10967
10968 @itemize @bullet
10969 @item
10970 release [-d] directories@dots{}
10971 @item
10972 Requires: Working directory.
10973 @item
10974 Changes: Working directory, history log.
10975 @end itemize
10976
10977 This command is meant to safely cancel the effect of
10978 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
10979 isn't strictly necessary to use this command.  You can
10980 always simply delete your working directory, if you
10981 like; but you risk losing changes you may have
10982 forgotten, and you leave no trace in the @sc{cvs} history
10983 file (@pxref{history file}) that you've abandoned your
10984 checkout.
10985
10986 Use @samp{cvs release} to avoid these problems.  This
10987 command checks that no uncommitted changes are
10988 present; that you are executing it from immediately
10989 above a @sc{cvs} working directory; and that the repository
10990 recorded for your files is the same as the repository
10991 defined in the module database.
10992
10993 If all these conditions are true, @samp{cvs release}
10994 leaves a record of its execution (attesting to your
10995 intentionally abandoning your checkout) in the @sc{cvs}
10996 history log.
10997
10998 @menu
10999 * release options::             release options
11000 * release output::              release output
11001 * release examples::            release examples
11002 @end menu
11003
11004 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11005 @node release options
11006 @appendixsubsec release options
11007
11008 The @code{release} command supports one command option:
11009
11010 @table @code
11011 @item -d
11012 Delete your working copy of the file if the release
11013 succeeds.  If this flag is not given your files will
11014 remain in your working directory.
11015
11016 @strong{WARNING:  The @code{release} command deletes
11017 all directories and files recursively.  This
11018 has the very serious side-effect that any directory
11019 that you have created inside your checked-out sources,
11020 and not added to the repository (using the @code{add}
11021 command; @pxref{Adding files}) will be silently deleted---even
11022 if it is non-empty!}
11023 @end table
11024
11025 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11026 @node release output
11027 @appendixsubsec release output
11028
11029 Before @code{release} releases your sources it will
11030 print a one-line message for any file that is not
11031 up-to-date.
11032
11033 @table @code
11034 @item U @var{file}
11035 @itemx P @var{file}
11036 There exists a newer revision of this file in the
11037 repository, and you have not modified your local copy
11038 of the file (@samp{U} and @samp{P} mean the same thing).
11039
11040 @item A @var{file}
11041 The file has been added to your private copy of the
11042 sources, but has not yet been committed to the
11043 repository.  If you delete your copy of the sources
11044 this file will be lost.
11045
11046 @item R @var{file}
11047 The file has been removed from your private copy of the
11048 sources, but has not yet been removed from the
11049 repository, since you have not yet committed the
11050 removal.  @xref{commit}.
11051
11052 @item M @var{file}
11053 The file is modified in your working directory.  There
11054 might also be a newer revision inside the repository.
11055
11056 @item ? @var{file}
11057 @var{file} is in your working directory, but does not
11058 correspond to anything in the source repository, and is
11059 not in the list of files for @sc{cvs} to ignore (see the
11060 description of the @samp{-I} option, and
11061 @pxref{cvsignore}).  If you remove your working
11062 sources, this file will be lost.
11063 @end table
11064
11065 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11066 @node release examples
11067 @appendixsubsec release examples
11068
11069 Release the @file{tc} directory, and delete your local working copy
11070 of the files.
11071
11072 @example
11073 $ cd ..         # @r{You must stand immediately above the}
11074                 # @r{sources when you issue @samp{cvs release}.}
11075 $ cvs release -d tc
11076 You have [0] altered files in this repository.
11077 Are you sure you want to release (and delete) directory `tc': y
11078 $
11079 @end example
11080
11081 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11082 @node update
11083 @appendixsec update---Bring work tree in sync with repository
11084 @cindex update (subcommand)
11085
11086 @itemize @bullet
11087 @item
11088 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files@dots{}
11089 @item
11090 Requires: repository, working directory.
11091 @item
11092 Changes: working directory.
11093 @end itemize
11094
11095 After you've run checkout to create your private copy
11096 of source from the common repository, other developers
11097 will continue changing the central source.  From time
11098 to time, when it is convenient in your development
11099 process, you can use the @code{update} command from
11100 within your working directory to reconcile your work
11101 with any revisions applied to the source repository
11102 since your last checkout or update.  Without the @code{-C}
11103 option, @code{update} will also merge any differences
11104 between the local copy of files and their base revisions
11105 into any destination revisions specified with @code{-r},
11106 @code{-D}, or @code{-A}.
11107
11108 @menu
11109 * update options::              update options
11110 * update output::               update output
11111 @end menu
11112
11113 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11114 @node update options
11115 @appendixsubsec update options
11116
11117 These standard options are available with @code{update}
11118 (@pxref{Common options}, for a complete description of
11119 them):
11120
11121 @table @code
11122 @item -D date
11123 Use the most recent revision no later than @var{date}.
11124 This option is sticky, and implies @samp{-P}.
11125 See @ref{Sticky tags}, for more information on sticky tags/dates.
11126
11127 @item -f
11128 Only useful with the @samp{-D @var{date}} or @samp{-r
11129 @var{tag}} flags.  If no matching revision is found,
11130 retrieve the most recent revision (instead of ignoring
11131 the file).
11132
11133 @item -k @var{kflag}
11134 Process keywords according to @var{kflag}.  See
11135 @ref{Keyword substitution}.
11136 This option is sticky; future updates of
11137 this file in this working directory will use the same
11138 @var{kflag}.  The @code{status} command can be viewed
11139 to see the sticky options.  See @ref{Invoking CVS}, for
11140 more information on the @code{status} command.
11141
11142 @item -l
11143 Local; run only in current working directory.  @xref{Recursive behavior}.
11144
11145 @item -P
11146 Prune empty directories.  See @ref{Moving directories}.
11147
11148 @item -p
11149 Pipe files to the standard output.
11150
11151 @item -R
11152 Update directories recursively (default).  @xref{Recursive
11153 behavior}.
11154
11155 @item -r rev
11156 Retrieve revision/tag @var{rev}.  This option is sticky,
11157 and implies @samp{-P}.
11158 See @ref{Sticky tags}, for more information on sticky tags/dates.
11159 @end table
11160
11161 @need 800
11162 These special options are also available with
11163 @code{update}.
11164
11165 @table @code
11166 @item -A
11167 Reset any sticky tags, dates, or @samp{-k} options.
11168 See @ref{Sticky tags}, for more information on sticky tags/dates.
11169
11170 @item -C
11171 Overwrite locally modified files with clean copies from
11172 the repository (the modified file is saved in
11173 @file{.#@var{file}.@var{revision}}, however).
11174
11175 @item -d
11176 Create any directories that exist in the repository if
11177 they're missing from the working directory.  Normally,
11178 @code{update} acts only on directories and files that
11179 were already enrolled in your working directory.
11180
11181 This is useful for updating directories that were
11182 created in the repository since the initial checkout;
11183 but it has an unfortunate side effect.  If you
11184 deliberately avoided certain directories in the
11185 repository when you created your working directory
11186 (either through use of a module name or by listing
11187 explicitly the files and directories you wanted on the
11188 command line), then updating with @samp{-d} will create
11189 those directories, which may not be what you want.
11190
11191 @item -I @var{name}
11192 Ignore files whose names match @var{name} (in your
11193 working directory) during the update.  You can specify
11194 @samp{-I} more than once on the command line to specify
11195 several files to ignore.  Use @samp{-I !} to avoid
11196 ignoring any files at all.  @xref{cvsignore}, for other
11197 ways to make @sc{cvs} ignore some files.
11198
11199 @item -W@var{spec}
11200 Specify file names that should be filtered during
11201 update.  You can use this option repeatedly.
11202
11203 @var{spec} can be a file name pattern of the same type
11204 that you can specify in the @file{.cvswrappers}
11205 file. @xref{Wrappers}.
11206
11207 @item -j@var{revision}
11208 With two @samp{-j} options, merge changes from the
11209 revision specified with the first @samp{-j} option to
11210 the revision specified with the second @samp{j} option,
11211 into the working directory.
11212
11213 With one @samp{-j} option, merge changes from the
11214 ancestor revision to the revision specified with the
11215 @samp{-j} option, into the working directory.  The
11216 ancestor revision is the common ancestor of the
11217 revision which the working directory is based on, and
11218 the revision specified in the @samp{-j} option.
11219
11220 Note that using a single @samp{-j @var{tagname}} option rather than
11221 @samp{-j @var{branchname}} to merge changes from a branch will
11222 often not remove files which were removed on the branch.
11223 @xref{Merging adds and removals}, for more.
11224
11225 In addition, each @samp{-j} option can contain an optional
11226 date specification which, when used with branches, can
11227 limit the chosen revision to one within a specific
11228 date.  An optional date is specified by adding a colon
11229 (:) to the tag:
11230 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
11231
11232 @xref{Branching and merging}.
11233
11234 @end table
11235
11236 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11237 @node update output
11238 @appendixsubsec update output
11239
11240 @code{update} and @code{checkout} keep you informed of
11241 their progress by printing a line for each file, preceded
11242 by one character indicating the status of the file:
11243
11244 @table @code
11245 @item U @var{file}
11246 The file was brought up to date with respect to the
11247 repository.  This is done for any file that exists in
11248 the repository but not in your source, and for files
11249 that you haven't changed but are not the most recent
11250 versions available in the repository.
11251
11252 @item P @var{file}
11253 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
11254 file.  This accomplishes the same thing as @samp{U} using less bandwidth.
11255
11256 @item A @var{file}
11257 The file has been added to your private copy of the
11258 sources, and will be added to the source repository
11259 when you run @code{commit} on the file.  This is a
11260 reminder to you that the file needs to be committed.
11261
11262 @item R @var{file}
11263 The file has been removed from your private copy of the
11264 sources, and will be removed from the source repository
11265 when you run @code{commit} on the file.  This is a
11266 reminder to you that the file needs to be committed.
11267
11268 @item M @var{file}
11269 The file is modified in  your  working  directory.
11270
11271 @samp{M} can indicate one of two states for a file
11272 you're working on: either there were no modifications
11273 to the same file in the repository, so that your file
11274 remains as you last saw it; or there were modifications
11275 in the repository as well as in your copy, but they
11276 were merged successfully, without conflict, in your
11277 working directory.
11278
11279 @sc{cvs} will print some messages if it merges your work,
11280 and a backup copy of your working file (as it looked
11281 before you ran @code{update}) will be made.  The exact
11282 name of that file is printed while @code{update} runs.
11283
11284 @item C @var{file}
11285 @cindex .# files
11286 @cindex __ files (VMS)
11287 A conflict was detected while trying to merge your
11288 changes to @var{file} with changes from the source
11289 repository.  @var{file} (the copy in your working
11290 directory) is now the result of attempting to merge
11291 the two revisions; an unmodified copy of your file
11292 is also in your working directory, with the name
11293 @file{.#@var{file}.@var{revision}} where @var{revision}
11294 is the revision that your modified file started
11295 from.  Resolve the conflict as described in
11296 @ref{Conflicts example}.
11297 @c "some systems" as in out-of-the-box OSes?  Not as
11298 @c far as I know.  We need to advise sysadmins as well
11299 @c as users how to set up this kind of purge, if that is
11300 @c what they want.
11301 @c We also might want to think about cleaner solutions,
11302 @c like having CVS remove the .# file once the conflict
11303 @c has been resolved or something like that.
11304 (Note that some systems automatically purge
11305 files that begin with @file{.#} if they have not been
11306 accessed for a few days.  If you intend to keep a copy
11307 of your original file, it is a very good idea to rename
11308 it.)  Under @sc{vms}, the file name starts with
11309 @file{__} rather than @file{.#}.
11310
11311 @item ? @var{file}
11312 @var{file} is in your working directory, but does not
11313 correspond to anything in the source repository, and is
11314 not in the list of files for @sc{cvs} to ignore (see the
11315 description of the @samp{-I} option, and
11316 @pxref{cvsignore}).
11317 @end table
11318
11319 @c ----- END MAN 1 -----
11320 @c ---------------------------------------------------------------------
11321 @node Invoking CVS
11322 @appendix Quick reference to CVS commands
11323 @cindex Command reference
11324 @cindex Reference, commands
11325 @cindex Invoking CVS
11326
11327 This appendix describes how to invoke @sc{cvs}, with
11328 references to where each command or feature is
11329 described in detail.  For other references run the
11330 @code{cvs --help} command, or see @ref{Index}.
11331
11332 A @sc{cvs} command looks like:
11333
11334 @example
11335 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
11336 @end example
11337
11338 Global options:
11339
11340 @table @code
11341 @item --allow-root=@var{rootdir}
11342 Specify legal @sc{cvsroot} directory (server only) (not
11343 in @sc{cvs} 1.9 and older).  See @ref{Password
11344 authentication server}.
11345
11346 @item -a
11347 Authenticate all communication (client only) (not in @sc{cvs}
11348 1.9 and older).  See @ref{Global options}.
11349
11350 @item -b
11351 Specify RCS location (@sc{cvs} 1.9 and older).  See
11352 @ref{Global options}.
11353
11354 @item -d @var{root}
11355 Specify the @sc{cvsroot}.  See @ref{Repository}.
11356
11357 @item -e @var{editor}
11358 Edit messages with @var{editor}.  See @ref{Committing
11359 your changes}.
11360
11361 @item -f
11362 Do not read the @file{~/.cvsrc} file.  See @ref{Global
11363 options}.
11364
11365 @item -H
11366 @itemx --help
11367 Print a help message.  See @ref{Global options}.
11368
11369 @item -n
11370 Do not change any files.  See @ref{Global options}.
11371
11372 @item -Q
11373 Be really quiet.  See @ref{Global options}.
11374
11375 @item -q
11376 Be somewhat quiet.  See @ref{Global options}.
11377
11378 @item -r
11379 Make new working files read-only.  See @ref{Global options}.
11380
11381 @item -s @var{variable}=@var{value}
11382 Set a user variable.  See @ref{Variables}.
11383
11384 @item -T @var{tempdir}
11385 Put temporary files in @var{tempdir}.  See @ref{Global
11386 options}.
11387
11388 @item -t
11389 Trace @sc{cvs} execution.  See @ref{Global options}.
11390
11391 @item -v
11392 @item --version
11393 Display version and copyright information for @sc{cvs}.
11394
11395 @item -w
11396 Make new working files read-write.  See @ref{Global
11397 options}.
11398
11399 @item -x
11400 Encrypt all communication (client only).
11401 See @ref{Global options}.
11402
11403 @item -z @var{gzip-level}
11404 @cindex Compression
11405 @cindex Gzip
11406 Set the compression level (client only).
11407 See @ref{Global options}.
11408 @end table
11409
11410 Keyword expansion modes (@pxref{Substitution modes}):
11411
11412 @example
11413 -kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11414 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11415 -kk   $@splitrcskeyword{Id}$
11416 -kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
11417 -ko   @i{no expansion}
11418 -kb   @i{no expansion, file is binary}
11419 @end example
11420
11421 Keywords (@pxref{Keyword list}):
11422
11423 @example
11424 $@splitrcskeyword{Author}: joe $
11425 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11426 $@splitrcskeyword{CVSHeader}: files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11427 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11428 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11429 $@splitrcskeyword{Locker}: harry $
11430 $@splitrcskeyword{Name}: snapshot_1_14 $
11431 $@splitrcskeyword{RCSfile}: file1,v $
11432 $@splitrcskeyword{Revision}: 1.1 $
11433 $@splitrcskeyword{Source}: /home/files/file1,v $
11434 $@splitrcskeyword{State}: Exp $
11435 $@splitrcskeyword{Log}: file1,v $
11436 Revision 1.1  1993/12/09 03:30:17  joe
11437 Initial revision
11438
11439 @end example
11440
11441 @c The idea behind this table is that we want each item
11442 @c to be a sentence or two at most.  Preferably a
11443 @c single line.
11444 @c
11445 @c In some cases refs to "foo options" are just to get
11446 @c this thing written quickly, not because the "foo
11447 @c options" node is really the best place to point.
11448 Commands, command options, and command arguments:
11449
11450 @table @code
11451 @c ------------------------------------------------------------
11452 @item add [@var{options}] [@var{files}@dots{}]
11453 Add a new file/directory.  See @ref{Adding files}.
11454
11455 @table @code
11456 @item -k @var{kflag}
11457 Set keyword expansion.
11458
11459 @item -m @var{msg}
11460 Set file description.
11461 @end table
11462
11463 @c ------------------------------------------------------------
11464 @item admin [@var{options}] [@var{files}@dots{}]
11465 Administration of history files in the repository.  See
11466 @ref{admin}.
11467 @c This list omits those options which are not
11468 @c documented as being useful with CVS.  That might be
11469 @c a mistake...
11470
11471 @table @code
11472 @item -b[@var{rev}]
11473 Set default branch.  See @ref{Reverting local changes}.
11474
11475 @item -c@var{string}
11476 Set comment leader.
11477
11478 @item -k@var{subst}
11479 Set keyword substitution.  See @ref{Keyword
11480 substitution}.
11481
11482 @item -l[@var{rev}]
11483 Lock revision @var{rev}, or latest revision.
11484
11485 @item -m@var{rev}:@var{msg}
11486 Replace the log message of revision @var{rev} with
11487 @var{msg}.
11488
11489 @item -o@var{range}
11490 Delete revisions from the repository.  See
11491 @ref{admin options}.
11492
11493 @item -q
11494 Run quietly; do not print diagnostics.
11495
11496 @item -s@var{state}[:@var{rev}]
11497 Set the state.
11498
11499 @c Does not work for client/server CVS
11500 @item -t
11501 Set file description from standard input.
11502
11503 @item -t@var{file}
11504 Set file description from @var{file}.
11505
11506 @item -t-@var{string}
11507 Set file description to @var{string}.
11508
11509 @item -u[@var{rev}]
11510 Unlock revision @var{rev}, or latest revision.
11511 @end table
11512
11513 @c ------------------------------------------------------------
11514 @item annotate [@var{options}] [@var{files}@dots{}]
11515 Show last revision where each line was modified.  See
11516 @ref{annotate}.
11517
11518 @table @code
11519 @item -D @var{date}
11520 Annotate the most recent revision no later than
11521 @var{date}.  See @ref{Common options}.
11522
11523 @item -F
11524 Force annotation of binary files.  (Without this option,
11525 binary files are skipped with a message.)
11526
11527 @item -f
11528 Use head revision if tag/date not found.  See
11529 @ref{Common options}.
11530
11531 @item -l
11532 Local; run only in current working directory.  @xref{Recursive behavior}.
11533
11534 @item -R
11535 Operate recursively (default).  @xref{Recursive
11536 behavior}.
11537
11538 @item -r @var{tag}
11539 Annotate revision @var{tag}.  See @ref{Common options}.
11540 @end table
11541
11542 @c ------------------------------------------------------------
11543 @item checkout [@var{options}] @var{modules}@dots{}
11544 Get a copy of the sources.  See @ref{checkout}.
11545
11546 @table @code
11547 @item -A
11548 Reset any sticky tags/date/options.  See @ref{Sticky
11549 tags} and @ref{Keyword substitution}.
11550
11551 @item -c
11552 Output the module database.  See @ref{checkout options}.
11553
11554 @item -D @var{date}
11555 Check out revisions as of @var{date} (is sticky).  See
11556 @ref{Common options}.
11557
11558 @item -d @var{dir}
11559 Check out into @var{dir}.  See @ref{checkout options}.
11560
11561 @item -f
11562 Use head revision if tag/date not found.  See
11563 @ref{Common options}.
11564
11565 @c Probably want to use rev1/rev2 style like for diff
11566 @c -r.  Here and in on-line help.
11567 @item -j @var{rev}
11568 Merge in changes.  See @ref{checkout options}.
11569
11570 @item -k @var{kflag}
11571 Use @var{kflag} keyword expansion.  See
11572 @ref{Substitution modes}.
11573
11574 @item -l
11575 Local; run only in current working directory.  @xref{Recursive behavior}.
11576
11577 @item -N
11578 Don't ``shorten'' module paths if -d specified.  See
11579 @ref{checkout options}.
11580
11581 @item -n
11582 Do not run module program (if any).  See @ref{checkout options}.
11583
11584 @item -P
11585 Prune empty directories.  See @ref{Moving directories}.
11586
11587 @item -p
11588 Check out files to standard output (avoids
11589 stickiness).  See @ref{checkout options}.
11590
11591 @item -R
11592 Operate recursively (default).  @xref{Recursive
11593 behavior}.
11594
11595 @item -r @var{tag}
11596 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11597
11598 @item -s
11599 Like -c, but include module status.  See @ref{checkout options}.
11600 @end table
11601
11602 @c ------------------------------------------------------------
11603 @item commit [@var{options}] [@var{files}@dots{}]
11604 Check changes into the repository.  See @ref{commit}.
11605
11606 @table @code
11607 @item -F @var{file}
11608 Read log message from @var{file}.  See @ref{commit options}.
11609
11610 @item -f
11611 @c What is this "disables recursion"?  It is from the
11612 @c on-line help; is it documented in this manual?
11613 Force the file to be committed; disables recursion.
11614 See @ref{commit options}.
11615
11616 @item -l
11617 Local; run only in current working directory.  See @ref{Recursive behavior}.
11618
11619 @item -m @var{msg}
11620 Use @var{msg} as log message.  See @ref{commit options}.
11621
11622 @item -n
11623 Do not run module program (if any).  See @ref{commit options}.
11624
11625 @item -R
11626 Operate recursively (default).  @xref{Recursive
11627 behavior}.
11628
11629 @item -r @var{rev}
11630 Commit to @var{rev}.  See @ref{commit options}.
11631 @c FIXME: should be dragging over text from
11632 @c commit options, especially if it can be cleaned up
11633 @c and made concise enough.
11634 @end table
11635
11636 @c ------------------------------------------------------------
11637 @item diff [@var{options}] [@var{files}@dots{}]
11638 Show differences between revisions.  See @ref{diff}.
11639 In addition to the options shown below, accepts a wide
11640 variety of options to control output style, for example
11641 @samp{-c} for context diffs.
11642
11643 @table @code
11644 @item -D @var{date1}
11645 Diff revision for date against working file.  See
11646 @ref{diff options}.
11647
11648 @item -D @var{date2}
11649 Diff @var{rev1}/@var{date1} against @var{date2}.  See
11650 @ref{diff options}.
11651
11652 @item -l
11653 Local; run only in current working directory.  See @ref{Recursive behavior}.
11654
11655 @item -N
11656 Include diffs for added and removed files.  See
11657 @ref{diff options}.
11658
11659 @item -R
11660 Operate recursively (default).  @xref{Recursive
11661 behavior}.
11662
11663 @item -r @var{rev1}
11664 Diff revision for @var{rev1} against working file.  See
11665 @ref{diff options}.
11666
11667 @item -r @var{rev2}
11668 Diff @var{rev1}/@var{date1} against @var{rev2}.  See @ref{diff options}.
11669 @end table
11670
11671 @c ------------------------------------------------------------
11672 @item edit [@var{options}] [@var{files}@dots{}]
11673 Get ready to edit a watched file.  See @ref{Editing files}.
11674
11675 @table @code
11676 @item -a @var{actions}
11677 Specify actions for temporary watch, where
11678 @var{actions} is @code{edit}, @code{unedit},
11679 @code{commit}, @code{all}, or @code{none}.  See
11680 @ref{Editing files}.
11681
11682 @item -l
11683 Local; run only in current working directory.  See @ref{Recursive behavior}.
11684
11685 @item -R
11686 Operate recursively (default).  @xref{Recursive
11687 behavior}.
11688 @end table
11689
11690 @c ------------------------------------------------------------
11691 @item editors [@var{options}] [@var{files}@dots{}]
11692 See who is editing a watched file.  See @ref{Watch information}.
11693
11694 @table @code
11695 @item -l
11696 Local; run only in current working directory.  See @ref{Recursive behavior}.
11697
11698 @item -R
11699 Operate recursively (default).  @xref{Recursive
11700 behavior}.
11701 @end table
11702
11703 @c ------------------------------------------------------------
11704 @item export [@var{options}] @var{modules}@dots{}
11705 Export files from @sc{cvs}.  See @ref{export}.
11706
11707 @table @code
11708 @item -D @var{date}
11709 Check out revisions as of @var{date}.  See
11710 @ref{Common options}.
11711
11712 @item -d @var{dir}
11713 Check out into @var{dir}.  See @ref{export options}.
11714
11715 @item -f
11716 Use head revision if tag/date not found.  See
11717 @ref{Common options}.
11718
11719 @item -k @var{kflag}
11720 Use @var{kflag} keyword expansion.  See
11721 @ref{Substitution modes}.
11722
11723 @item -l
11724 Local; run only in current working directory.  @xref{Recursive behavior}.
11725
11726 @item -N
11727 Don't ``shorten'' module paths if -d specified.  See
11728 @ref{export options}.
11729
11730 @item -n
11731 Do not run module program (if any).  See @ref{export options}.
11732
11733 @item -R
11734 Operate recursively (default).  @xref{Recursive
11735 behavior}.
11736
11737 @item -r @var{tag}
11738 Checkout revision @var{tag}.  See @ref{Common options}.
11739 @end table
11740
11741 @c ------------------------------------------------------------
11742 @item history [@var{options}] [@var{files}@dots{}]
11743 Show repository access history.  See @ref{history}.
11744
11745 @table @code
11746 @item -a
11747 All users (default is self).  See @ref{history options}.
11748
11749 @item -b @var{str}
11750 Back to record with @var{str} in module/file/repos
11751 field.  See @ref{history options}.
11752
11753 @item -c
11754 Report on committed (modified) files.  See @ref{history options}.
11755
11756 @item -D @var{date}
11757 Since @var{date}.  See @ref{history options}.
11758
11759 @item -e
11760 Report on all record types.  See @ref{history options}.
11761
11762 @item -l
11763 Last modified (committed or modified report).  See @ref{history options}.
11764
11765 @item -m @var{module}
11766 Report on @var{module} (repeatable).  See @ref{history options}.
11767
11768 @item -n @var{module}
11769 In @var{module}.  See @ref{history options}.
11770
11771 @item -o
11772 Report on checked out modules.  See @ref{history options}.
11773
11774 @item -p @var{repository}
11775 In @var{repository}.  See @ref{history options}.
11776
11777 @item -r @var{rev}
11778 Since revision @var{rev}.  See @ref{history options}.
11779
11780 @item -T
11781 @c What the @#$@# is a TAG?  Same as a tag?  This
11782 @c wording is also in the online-line help.
11783 Produce report on all TAGs.  See @ref{history options}.
11784
11785 @item -t @var{tag}
11786 Since tag record placed in history file (by anyone).
11787 See @ref{history options}.
11788
11789 @item -u @var{user}
11790 For user @var{user} (repeatable).  See @ref{history options}.
11791
11792 @item -w
11793 Working directory must match.  See @ref{history options}.
11794
11795 @item -x @var{types}
11796 Report on @var{types}, one or more of
11797 @code{TOEFWUPCGMAR}.  See @ref{history options}.
11798
11799 @item -z @var{zone}
11800 Output for time zone @var{zone}.  See @ref{history options}.
11801 @end table
11802
11803 @c ------------------------------------------------------------
11804 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
11805 Import files into @sc{cvs}, using vendor branches.  See
11806 @ref{import}.
11807
11808 @table @code
11809 @item -b @var{bra}
11810 Import to vendor branch @var{bra}.  See
11811 @ref{Multiple vendor branches}.
11812
11813 @item -d
11814 Use the file's modification time as the time of
11815 import.  See @ref{import options}.
11816
11817 @item -k @var{kflag}
11818 Set default keyword substitution mode.  See
11819 @ref{import options}.
11820
11821 @item -m @var{msg}
11822 Use @var{msg} for log message.  See
11823 @ref{import options}.
11824
11825 @item -I @var{ign}
11826 More files to ignore (! to reset).  See
11827 @ref{import options}.
11828
11829 @item -W @var{spec}
11830 More wrappers.  See @ref{import options}.
11831 @end table
11832
11833 @c ------------------------------------------------------------
11834 @item init
11835 Create a @sc{cvs} repository if it doesn't exist.  See
11836 @ref{Creating a repository}.
11837
11838 @c ------------------------------------------------------------
11839 @item kserver
11840 Kerberos authenticated server.
11841 See @ref{Kerberos authenticated}.
11842
11843 @c ------------------------------------------------------------
11844 @item log [@var{options}] [@var{files}@dots{}]
11845 Print out history information for files.  See @ref{log}.
11846
11847 @table @code
11848 @item -b
11849 Only list revisions on the default branch.  See @ref{log options}.
11850
11851 @item -d @var{dates}
11852 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
11853 latest before).  See @ref{log options}.
11854
11855 @item -h
11856 Only print header.  See @ref{log options}.
11857
11858 @item -l
11859 Local; run only in current working directory.  See @ref{Recursive behavior}.
11860
11861 @item -N
11862 Do not list tags.  See @ref{log options}.
11863
11864 @item -R
11865 Only print name of RCS file.  See @ref{log options}.
11866
11867 @item -r@var{revs}
11868 Only list revisions @var{revs}.  See @ref{log options}.
11869
11870 @item -s @var{states}
11871 Only list revisions with specified states.  See @ref{log options}.
11872
11873 @item -t
11874 Only print header and descriptive text.  See @ref{log
11875 options}.
11876
11877 @item -w@var{logins}
11878 Only list revisions checked in by specified logins.  See @ref{log options}.
11879 @end table
11880
11881 @c ------------------------------------------------------------
11882 @item login
11883 Prompt for password for authenticating server.  See
11884 @ref{Password authentication client}.
11885
11886 @c ------------------------------------------------------------
11887 @item logout
11888 Remove stored password for authenticating server.  See
11889 @ref{Password authentication client}.
11890
11891 @c ------------------------------------------------------------
11892 @item pserver
11893 Password authenticated server.
11894 See @ref{Password authentication server}.
11895
11896 @c ------------------------------------------------------------
11897 @item rannotate [@var{options}] [@var{modules}@dots{}]
11898 Show last revision where each line was modified.  See
11899 @ref{annotate}.
11900
11901 @table @code
11902 @item -D @var{date}
11903 Annotate the most recent revision no later than
11904 @var{date}.  See @ref{Common options}.
11905
11906 @item -F
11907 Force annotation of binary files.  (Without this option,
11908 binary files are skipped with a message.)
11909
11910 @item -f
11911 Use head revision if tag/date not found.  See
11912 @ref{Common options}.
11913
11914 @item -l
11915 Local; run only in current working directory.  @xref{Recursive behavior}.
11916
11917 @item -R
11918 Operate recursively (default).  @xref{Recursive behavior}.
11919
11920 @item -r @var{tag}
11921 Annotate revision @var{tag}.  See @ref{Common options}.
11922 @end table
11923
11924 @c ------------------------------------------------------------
11925 @item rdiff [@var{options}] @var{modules}@dots{}
11926 Show differences between releases.  See @ref{rdiff}.
11927
11928 @table @code
11929 @item -c
11930 Context diff output format (default).  See @ref{rdiff options}.
11931
11932 @item -D @var{date}
11933 Select revisions based on @var{date}.  See @ref{Common options}.
11934
11935 @item -f
11936 Use head revision if tag/date not found.  See
11937 @ref{Common options}.
11938
11939 @item -l
11940 Local; run only in current working directory.  See @ref{Recursive behavior}.
11941
11942 @item -R
11943 Operate recursively (default).  @xref{Recursive
11944 behavior}.
11945
11946 @item -r @var{rev}
11947 Select revisions based on @var{rev}.  See @ref{Common options}.
11948
11949 @item -s
11950 Short patch - one liner per file.  See @ref{rdiff options}.
11951
11952 @item -t
11953 Top two diffs - last change made to the file.  See
11954 @ref{diff options}.
11955
11956 @item -u
11957 Unidiff output format.  See @ref{rdiff options}.
11958
11959 @item -V @var{vers}
11960 Use RCS Version @var{vers} for keyword expansion (obsolete).  See
11961 @ref{rdiff options}.
11962 @end table
11963
11964 @c ------------------------------------------------------------
11965 @item release [@var{options}] @var{directory}
11966 Indicate that a directory is no longer in use.  See
11967 @ref{release}.
11968
11969 @table @code
11970 @item -d
11971 Delete the given directory.  See @ref{release options}.
11972 @end table
11973
11974 @c ------------------------------------------------------------
11975 @item remove [@var{options}] [@var{files}@dots{}]
11976 Remove an entry from the repository.  See @ref{Removing files}.
11977
11978 @table @code
11979 @item -f
11980 Delete the file before removing it.  See @ref{Removing files}.
11981
11982 @item -l
11983 Local; run only in current working directory.  See @ref{Recursive behavior}.
11984
11985 @item -R
11986 Operate recursively (default).  @xref{Recursive
11987 behavior}.
11988 @end table
11989
11990 @c ------------------------------------------------------------
11991 @item rlog [@var{options}] [@var{files}@dots{}]
11992 Print out history information for modules.  See @ref{log}.
11993
11994 @table @code
11995 @item -b
11996 Only list revisions on the default branch.  See @ref{log options}.
11997
11998 @item -d @var{dates}
11999 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12000 latest before).  See @ref{log options}.
12001
12002 @item -h
12003 Only print header.  See @ref{log options}.
12004
12005 @item -l
12006 Local; run only in current working directory.  See @ref{Recursive behavior}.
12007
12008 @item -N
12009 Do not list tags.  See @ref{log options}.
12010
12011 @item -R
12012 Only print name of RCS file.  See @ref{log options}.
12013
12014 @item -r@var{revs}
12015 Only list revisions @var{revs}.  See @ref{log options}.
12016
12017 @item -s @var{states}
12018 Only list revisions with specified states.  See @ref{log options}.
12019
12020 @item -t
12021 Only print header and descriptive text.  See @ref{log options}.
12022
12023 @item -w@var{logins}
12024 Only list revisions checked in by specified logins.  See @ref{log options}.
12025 @end table
12026
12027 @c ------------------------------------------------------------
12028 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
12029 Add a symbolic tag to a module.
12030 See @ref{Revisions} and @ref{Branching and merging}.
12031
12032 @table @code
12033 @item -a
12034 Clear tag from removed files that would not otherwise
12035 be tagged.  See @ref{Tagging add/remove}.
12036
12037 @item -b
12038 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12039
12040 @item -B
12041 Used in conjunction with -F or -d, enables movement and deletion of
12042 branch tags.  Use with extreme caution. 
12043
12044 @item -D @var{date}
12045 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12046
12047 @item -d
12048 Delete @var{tag}.  See @ref{Modifying tags}.
12049
12050 @item -F
12051 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12052
12053 @item -f
12054 Force a head revision match if tag/date not found.
12055 See @ref{Tagging by date/tag}.
12056
12057 @item -l
12058 Local; run only in current working directory.  See @ref{Recursive behavior}.
12059
12060 @item -n
12061 No execution of tag program.  See @ref{Common options}.
12062
12063 @item -R
12064 Operate recursively (default).  @xref{Recursive
12065 behavior}.
12066
12067 @item -r @var{rev}
12068 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
12069 @end table
12070
12071 @c ------------------------------------------------------------
12072 @item server
12073 Rsh server.  See @ref{Connecting via rsh}.
12074
12075 @c ------------------------------------------------------------
12076 @item status [@var{options}] @var{files}@dots{}
12077 Display status information in a working directory.  See
12078 @ref{File status}.
12079
12080 @table @code
12081 @item -l
12082 Local; run only in current working directory.  See @ref{Recursive behavior}.
12083
12084 @item -R
12085 Operate recursively (default).  @xref{Recursive
12086 behavior}.
12087
12088 @item -v
12089 Include tag information for file.  See @ref{Tags}.
12090 @end table
12091
12092 @c ------------------------------------------------------------
12093 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
12094 Add a symbolic tag to checked out version of files.
12095 See @ref{Revisions} and @ref{Branching and merging}.
12096
12097 @table @code
12098 @item -b
12099 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12100
12101 @item -c
12102 Check that working files are unmodified.  See
12103 @ref{Tagging the working directory}.
12104
12105 @item -D @var{date}
12106 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12107
12108 @item -d
12109 Delete @var{tag}.  See @ref{Modifying tags}.
12110
12111 @item -F
12112 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12113
12114 @item -f
12115 Force a head revision match if tag/date not found.
12116 See @ref{Tagging by date/tag}.
12117
12118 @item -l
12119 Local; run only in current working directory.  See @ref{Recursive behavior}.
12120
12121 @item -R
12122 Operate recursively (default).  @xref{Recursive
12123 behavior}.
12124
12125 @item -r @var{rev}
12126 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
12127 @end table
12128
12129 @c ------------------------------------------------------------
12130 @item unedit [@var{options}] [@var{files}@dots{}]
12131 Undo an edit command.  See @ref{Editing files}.
12132
12133 @table @code
12134 @item -l
12135 Local; run only in current working directory.  See @ref{Recursive behavior}.
12136
12137 @item -R
12138 Operate recursively (default).  @xref{Recursive behavior}.
12139 @end table
12140
12141 @c ------------------------------------------------------------
12142 @item update [@var{options}] [@var{files}@dots{}]
12143 Bring work tree in sync with repository.  See
12144 @ref{update}.
12145
12146 @table @code
12147 @item -A
12148 Reset any sticky tags/date/options.  See @ref{Sticky
12149 tags} and @ref{Keyword substitution}.
12150
12151 @item -C
12152 Overwrite locally modified files with clean copies from
12153 the repository (the modified file is saved in
12154 @file{.#@var{file}.@var{revision}}, however).
12155
12156 @item -D @var{date}
12157 Check out revisions as of @var{date} (is sticky).  See
12158 @ref{Common options}.
12159
12160 @item -d
12161 Create directories.  See @ref{update options}.
12162
12163 @item -f
12164 Use head revision if tag/date not found.  See
12165 @ref{Common options}.
12166
12167 @item -I @var{ign}
12168 More files to ignore (! to reset).  See
12169 @ref{import options}.
12170
12171 @c Probably want to use rev1/rev2 style like for diff
12172 @c -r.  Here and in on-line help.
12173 @item -j @var{rev}
12174 Merge in changes.  See @ref{update options}.
12175
12176 @item -k @var{kflag}
12177 Use @var{kflag} keyword expansion.  See
12178 @ref{Substitution modes}.
12179
12180 @item -l
12181 Local; run only in current working directory.  @xref{Recursive behavior}.
12182
12183 @item -P
12184 Prune empty directories.  See @ref{Moving directories}.
12185
12186 @item -p
12187 Check out files to standard output (avoids
12188 stickiness).  See @ref{update options}.
12189
12190 @item -R
12191 Operate recursively (default).  @xref{Recursive
12192 behavior}.
12193
12194 @item -r @var{tag}
12195 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
12196
12197 @item -W @var{spec}
12198 More wrappers.  See @ref{import options}.
12199 @end table
12200
12201 @c ------------------------------------------------------------
12202 @item version
12203 @cindex version (subcommand)
12204
12205 Display the version of @sc{cvs} being used.  If the repository
12206 is remote, display both the client and server versions.
12207
12208 @c ------------------------------------------------------------
12209 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
12210
12211 on/off: turn on/off read-only checkouts of files.  See
12212 @ref{Setting a watch}.
12213
12214 add/remove: add or remove notification on actions.  See
12215 @ref{Getting Notified}.
12216
12217 @table @code
12218 @item -a @var{actions}
12219 Specify actions for temporary watch, where
12220 @var{actions} is @code{edit}, @code{unedit},
12221 @code{commit}, @code{all}, or @code{none}.  See
12222 @ref{Editing files}.
12223
12224 @item -l
12225 Local; run only in current working directory.  See @ref{Recursive behavior}.
12226
12227 @item -R
12228 Operate recursively (default).  @xref{Recursive
12229 behavior}.
12230 @end table
12231
12232 @c ------------------------------------------------------------
12233 @item watchers [@var{options}] [@var{files}@dots{}]
12234 See who is watching a file.  See @ref{Watch information}.
12235
12236 @table @code
12237 @item -l
12238 Local; run only in current working directory.  See @ref{Recursive behavior}.
12239
12240 @item -R
12241 Operate recursively (default).  @xref{Recursive
12242 behavior}.
12243 @end table
12244
12245 @end table
12246
12247 @c ---------------------------------------------------------------------
12248 @node Administrative files
12249 @appendix Reference manual for Administrative files
12250 @cindex Administrative files (reference)
12251 @cindex Files, reference manual
12252 @cindex Reference manual (files)
12253 @cindex CVSROOT (file)
12254
12255 @c FIXME?  Somewhere there needs to be a more "how-to"
12256 @c guide to writing these.  I think the triggers
12257 @c (commitinfo, loginfo, taginfo, &c) are perhaps a
12258 @c different case than files like modules.  One
12259 @c particular issue that people sometimes are
12260 @c (unnecessarily?) worried about is performance, and
12261 @c the impact of writing in perl or sh or ____.
12262 Inside the repository, in the directory
12263 @file{$CVSROOT/CVSROOT}, there are a number of
12264 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
12265 fashion without any of them, but if they are set up
12266 properly they can help make life easier.  For a
12267 discussion of how to edit them, see @ref{Intro
12268 administrative files}.
12269
12270 The most important of these files is the @file{modules}
12271 file, which defines the modules inside the repository.
12272
12273 @menu
12274 * modules::                     Defining modules
12275 * Wrappers::                    Specify binary-ness based on file name
12276 * commit files::                The commit support files (commitinfo,
12277                                 verifymsg, loginfo)
12278 * taginfo::                     Verifying/Logging tags
12279 * rcsinfo::                     Templates for the log messages
12280 * cvsignore::                   Ignoring files via cvsignore
12281 * checkoutlist::                Adding your own administrative files
12282 * history file::                History information
12283 * Variables::                   Various variables are expanded
12284 * config::                      Miscellaneous CVS configuration
12285 @end menu
12286
12287 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12288 @node modules
12289 @appendixsec The modules file
12290 @cindex Modules (admin file)
12291 @cindex Defining modules (reference manual)
12292
12293 The @file{modules} file records your definitions of
12294 names for collections of source code.  @sc{cvs} will
12295 use these definitions if you use @sc{cvs} to update the
12296 modules file (use normal commands like @code{add},
12297 @code{commit}, etc).
12298
12299 The @file{modules} file may contain blank lines and
12300 comments (lines beginning with @samp{#}) as well as
12301 module definitions.  Long lines can be continued on the
12302 next line by specifying a backslash (@samp{\}) as the
12303 last character on the line.
12304
12305 There are three basic types of modules: alias modules,
12306 regular modules, and ampersand modules.  The difference
12307 between them is the way that they map files in the
12308 repository to files in the working directory.  In all
12309 of the following examples, the top-level repository
12310 contains a directory called @file{first-dir}, which
12311 contains two files, @file{file1} and @file{file2}, and a
12312 directory @file{sdir}.  @file{first-dir/sdir} contains
12313 a file @file{sfile}.
12314
12315 @c FIXME: should test all the examples in this section.
12316
12317 @menu
12318 * Alias modules::             The simplest kind of module
12319 * Regular modules::
12320 * Ampersand modules::
12321 * Excluding directories::     Excluding directories from a module
12322 * Module options::            Regular and ampersand modules can take options
12323 * Module program options::    How the modules ``program options'' programs
12324                               are run. 
12325 @end menu
12326
12327 @node Alias modules
12328 @appendixsubsec Alias modules
12329 @cindex Alias modules
12330 @cindex -a, in modules file
12331
12332 Alias modules are the simplest kind of module:
12333
12334 @table @code
12335 @item @var{mname} -a @var{aliases}@dots{}
12336 This represents the simplest way of defining a module
12337 @var{mname}.  The @samp{-a} flags the definition as a
12338 simple alias: @sc{cvs} will treat any use of @var{mname} (as
12339 a command argument) as if the list of names
12340 @var{aliases} had been specified instead.
12341 @var{aliases} may contain either other module names or
12342 paths.  When you use paths in aliases, @code{checkout}
12343 creates all intermediate directories in the working
12344 directory, just as if the path had been specified
12345 explicitly in the @sc{cvs} arguments.
12346 @end table
12347
12348 For example, if the modules file contains:
12349
12350 @example
12351 amodule -a first-dir
12352 @end example
12353
12354 @noindent
12355 then the following two commands are equivalent:
12356
12357 @example
12358 $ cvs co amodule
12359 $ cvs co first-dir
12360 @end example
12361
12362 @noindent
12363 and they each would provide output such as:
12364
12365 @example
12366 cvs checkout: Updating first-dir
12367 U first-dir/file1
12368 U first-dir/file2
12369 cvs checkout: Updating first-dir/sdir
12370 U first-dir/sdir/sfile
12371 @end example
12372
12373 @node Regular modules
12374 @appendixsubsec Regular modules
12375 @cindex Regular modules
12376
12377 @table @code
12378 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12379 In the simplest case, this form of module definition
12380 reduces to @samp{@var{mname} @var{dir}}.  This defines
12381 all the files in directory @var{dir} as module mname.
12382 @var{dir} is a relative path (from @code{$CVSROOT}) to a
12383 directory of source in the source repository.  In this
12384 case, on checkout, a single directory called
12385 @var{mname} is created as a working directory; no
12386 intermediate directory levels are used by default, even
12387 if @var{dir} was a path involving several directory
12388 levels.
12389 @end table
12390
12391 For example, if a module is defined by:
12392
12393 @example
12394 regmodule first-dir
12395 @end example
12396
12397 @noindent
12398 then regmodule will contain the files from first-dir:
12399
12400 @example
12401 $ cvs co regmodule
12402 cvs checkout: Updating regmodule
12403 U regmodule/file1
12404 U regmodule/file2
12405 cvs checkout: Updating regmodule/sdir
12406 U regmodule/sdir/sfile
12407 $
12408 @end example
12409
12410 By explicitly specifying files in the module definition
12411 after @var{dir}, you can select particular files from
12412 directory @var{dir}.  Here is
12413 an example:
12414
12415 @example
12416 regfiles first-dir/sdir sfile
12417 @end example
12418
12419 @noindent
12420 With this definition, getting the regfiles module
12421 will create a single working directory
12422 @file{regfiles} containing the file listed, which
12423 comes from a directory deeper
12424 in the @sc{cvs} source repository:
12425
12426 @example
12427 $ cvs co regfiles
12428 U regfiles/sfile
12429 $
12430 @end example
12431
12432 @node Ampersand modules
12433 @appendixsubsec Ampersand modules
12434 @cindex Ampersand modules
12435 @cindex &, in modules file
12436
12437 A module definition can refer to other modules by
12438 including @samp{&@var{module}} in its definition.
12439 @example
12440 @var{mname} [ options ] @var{&module}@dots{}
12441 @end example
12442
12443 Then getting the module creates a subdirectory for each such
12444 module, in the directory containing the module.  For
12445 example, if modules contains
12446
12447 @example
12448 ampermod &first-dir
12449 @end example
12450
12451 @noindent
12452 then a checkout will create an @code{ampermod} directory
12453 which contains a directory called @code{first-dir},
12454 which in turns contains all the directories and files
12455 which live there.  For example, the command
12456
12457 @example
12458 $ cvs co ampermod
12459 @end example
12460
12461 @noindent
12462 will create the following files:
12463
12464 @example
12465 ampermod/first-dir/file1
12466 ampermod/first-dir/file2
12467 ampermod/first-dir/sdir/sfile
12468 @end example
12469
12470 There is one quirk/bug: the messages that @sc{cvs}
12471 prints omit the @file{ampermod}, and thus do not
12472 correctly display the location to which it is checking
12473 out the files:
12474
12475 @example
12476 $ cvs co ampermod
12477 cvs checkout: Updating first-dir
12478 U first-dir/file1
12479 U first-dir/file2
12480 cvs checkout: Updating first-dir/sdir
12481 U first-dir/sdir/sfile
12482 $
12483 @end example
12484
12485 Do not rely on this buggy behavior; it may get fixed in
12486 a future release of @sc{cvs}.
12487
12488 @c FIXCVS: What happens if regular and & modules are
12489 @c combined, as in "ampermodule first-dir &second-dir"?
12490 @c When I tried it, it seemed to just ignore the
12491 @c "first-dir".  I think perhaps it should be an error
12492 @c (but this needs further investigation).
12493 @c In addition to discussing what each one does, we
12494 @c should put in a few words about why you would use one or
12495 @c the other in various situations.
12496
12497 @node Excluding directories
12498 @appendixsubsec Excluding directories
12499 @cindex Excluding directories, in modules file
12500 @cindex !, in modules file
12501
12502 An alias module may exclude particular directories from
12503 other modules by using an exclamation mark (@samp{!})
12504 before the name of each directory to be excluded.
12505
12506 For example, if the modules file contains:
12507
12508 @example
12509 exmodule -a !first-dir/sdir first-dir
12510 @end example
12511
12512 @noindent
12513 then checking out the module @samp{exmodule} will check
12514 out everything in @samp{first-dir} except any files in
12515 the subdirectory @samp{first-dir/sdir}.
12516 @c Note that the "!first-dir/sdir" sometimes must be listed
12517 @c before "first-dir".  That seems like a probable bug, in which
12518 @c case perhaps it should be fixed (to allow either
12519 @c order) rather than documented.  See modules4 in testsuite.
12520
12521 @node Module options
12522 @appendixsubsec Module options
12523 @cindex Options, in modules file
12524
12525 Either regular modules or ampersand modules can contain
12526 options, which supply additional information concerning
12527 the module.
12528
12529 @table @code
12530 @cindex -d, in modules file
12531 @item -d @var{name}
12532 Name the working directory something other than the
12533 module name.
12534 @c FIXME: Needs a bunch of examples, analogous to the
12535 @c examples for alias, regular, and ampersand modules
12536 @c which show where the files go without -d.
12537
12538 @cindex Export program
12539 @cindex -e, in modules file
12540 @item -e @var{prog}
12541 Specify a program @var{prog} to run whenever files in a
12542 module are exported.  @var{prog} runs with a single
12543 argument, the module name.
12544 @c FIXME: Is it run on server? client?
12545
12546 @cindex Checkout program
12547 @cindex -o, in modules file
12548 @item -o @var{prog}
12549 Specify a program @var{prog} to run whenever files in a
12550 module are checked out.  @var{prog} runs with a single
12551 argument, the module name.  See @ref{Module program options} for
12552 information on how @var{prog} is called.
12553 @c FIXME: Is it run on server? client?
12554
12555 @cindex Status of a module
12556 @cindex Module status
12557 @cindex -s, in modules file
12558 @item -s @var{status}
12559 Assign a status to the module.  When the module file is
12560 printed with @samp{cvs checkout -s} the modules are
12561 sorted according to primarily module status, and
12562 secondarily according to the module name.  This option
12563 has no other meaning.  You can use this option for
12564 several things besides status: for instance, list the
12565 person that is responsible for this module.
12566
12567 @cindex Tag program
12568 @cindex -t, in modules file
12569 @item -t @var{prog}
12570 Specify a program @var{prog} to run whenever files in a
12571 module are tagged with @code{rtag}.  @var{prog} runs
12572 with two arguments: the module name and the symbolic
12573 tag specified to @code{rtag}.  It is not run
12574 when @code{tag} is executed.  Generally you will find
12575 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
12576 @c FIXME: Is it run on server? client?
12577 @c Problems with -t include:
12578 @c * It is run after the tag not before
12579 @c * It doesn't get passed all the information that
12580 @c   taginfo does ("mov", &c).
12581 @c * It only is run for rtag, not tag.
12582 @end table
12583
12584 You should also see @pxref{Module program options} about how the
12585 ``program options'' programs are run.
12586
12587 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12588
12589 @node Module program options
12590 @appendixsubsec How the modules file ``program options'' programs are run
12591 @cindex Modules file program options
12592 @cindex -t, in modules file
12593 @cindex -o, in modules file
12594 @cindex -e, in modules file
12595
12596 @noindent
12597 For checkout, rtag, and export, the program is server-based, and as such the
12598 following applies:-
12599
12600 If using remote access methods (pserver, ext, etc.),
12601 @sc{cvs} will execute this program on the server from a temporary
12602 directory. The path is searched for this program.
12603
12604 If using ``local access'' (on a local or remote NFS file system, i.e.
12605 repository set just to a path),
12606 the program will be executed from the newly checked-out tree, if
12607 found there, or alternatively searched for in the path if not.
12608
12609 The programs are all run after the operation has effectively
12610 completed.
12611
12612
12613 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12614 @node Wrappers
12615 @appendixsec The cvswrappers file
12616 @cindex cvswrappers (admin file)
12617 @cindex CVSWRAPPERS, environment variable
12618 @cindex Wrappers
12619
12620 @c FIXME: need some better way of separating this out
12621 @c by functionality.  -m is
12622 @c one feature, and -k is a another.  And this discussion
12623 @c should be better motivated (e.g. start with the
12624 @c problems, then explain how the feature solves it).
12625
12626 Wrappers refers to a @sc{cvs} feature which lets you
12627 control certain settings based on the name of the file
12628 which is being operated on.  The settings are @samp{-k}
12629 for binary files, and @samp{-m} for nonmergeable text
12630 files.
12631
12632 The @samp{-m} option
12633 specifies the merge methodology that should be used when
12634 a non-binary file is updated.  @code{MERGE} means the usual
12635 @sc{cvs} behavior: try to merge the files.  @code{COPY}
12636 means that @code{cvs update} will refuse to merge
12637 files, as it also does for files specified as binary
12638 with @samp{-kb} (but if the file is specified as
12639 binary, there is no need to specify @samp{-m 'COPY'}).
12640 @sc{cvs} will provide the user with the
12641 two versions of the files, and require the user using
12642 mechanisms outside @sc{cvs}, to insert any necessary
12643 changes.
12644
12645 @strong{WARNING: do not use @code{COPY} with
12646 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
12647 copy one version of your file over the other, wiping
12648 out the previous contents.}
12649 @c Ordinarily we don't document the behavior of old
12650 @c versions.  But this one is so dangerous, I think we
12651 @c must.  I almost renamed it to -m 'NOMERGE' so we
12652 @c could say "never use -m 'COPY'".
12653 The @samp{-m} wrapper option only affects behavior when
12654 merging is done on update; it does not affect how files
12655 are stored.  See @ref{Binary files}, for more on
12656 binary files.
12657
12658 The basic format of the file @file{cvswrappers} is:
12659
12660 @c FIXME: @example is all wrong for this.  Use @deffn or
12661 @c something more sensible.
12662 @example
12663 wildcard     [option value][option value]...
12664
12665 where option is one of
12666 -m           update methodology      value: MERGE or COPY
12667 -k           keyword expansion       value: expansion mode
12668
12669 and value is a single-quote delimited value.
12670 @end example
12671
12672 @ignore
12673 @example
12674 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
12675 *.c      -t 'indent %s %s'
12676 @end example
12677 @c When does the filter need to be an absolute pathname
12678 @c and when will something like the above work?  I
12679 @c suspect it relates to the PATH of the server (which
12680 @c in turn depends on all kinds of stuff, e.g. inetd
12681 @c for pserver).  I'm not sure whether/where to discuss
12682 @c this.
12683 @c FIXME: What do the %s's stand for?
12684
12685 @noindent
12686 The above example of a @file{cvswrappers} file
12687 states that all files/directories that end with a @code{.nib}
12688 should be filtered with the @file{wrap} program before
12689 checking the file into the repository. The file should
12690 be filtered though the @file{unwrap} program when the
12691 file is checked out of the repository. The
12692 @file{cvswrappers} file also states that a @code{COPY}
12693 methodology should be used when updating the files in
12694 the repository (that is, no merging should be performed).
12695
12696 @c What pitfalls arise when using indent this way?  Is
12697 @c it a winning thing to do?  Would be nice to at least
12698 @c hint at those issues; we want our examples to tell
12699 @c how to solve problems, not just to say that cvs can
12700 @c do certain things.
12701 The last example line says that all files that end with
12702 @code{.c} should be filtered with @file{indent}
12703 before being checked into the repository. Unlike the previous
12704 example, no filtering of the @code{.c} file is done when
12705 it is checked out of the repository.
12706 @noindent
12707 The @code{-t} filter is called with two arguments,
12708 the first is the name of the file/directory to filter
12709 and the second is the pathname to where the resulting
12710 filtered file should be placed.
12711
12712 @noindent
12713 The @code{-f} filter is called with one argument,
12714 which is the name of the file to filter from. The end
12715 result of this filter will be a file in the users directory
12716 that they can work on as they normally would.
12717
12718 Note that the @samp{-t}/@samp{-f} features do not
12719 conveniently handle one portion of @sc{cvs}'s operation:
12720 determining when files are modified.  @sc{cvs} will still
12721 want a file (or directory) to exist, and it will use
12722 its modification time to determine whether a file is
12723 modified.  If @sc{cvs} erroneously thinks a file is
12724 unmodified (for example, a directory is unchanged but
12725 one of the files within it is changed), you can force
12726 it to check in the file anyway by specifying the
12727 @samp{-f} option to @code{cvs commit} (@pxref{commit
12728 options}).
12729 @c This is, of course, a serious design flaw in -t/-f.
12730 @c Probably the whole functionality needs to be
12731 @c redesigned (starting from requirements) to fix this.
12732 @end ignore
12733
12734 @c FIXME: We don't document -W or point to where it is
12735 @c documented.  Or .cvswrappers.
12736 For example, the following command imports a
12737 directory, treating files whose name ends in
12738 @samp{.exe} as binary:
12739
12740 @example
12741 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
12742 @end example
12743
12744 @c Another good example, would be storing files
12745 @c (e.g. binary files) compressed in the repository.
12746 @c      ::::::::::::::::::
12747 @c      cvswrappers
12748 @c      ::::::::::::::::::
12749 @c      *.t12 -m 'COPY'
12750 @c      *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
12751 @c
12752 @c      ::::::::::::::::::
12753 @c      gunzipcp
12754 @c      ::::::::::::::::::
12755 @c      :
12756 @c      [ -f $1 ] || exit 1
12757 @c      zcat $1 > /tmp/.#$1.$$
12758 @c      mv /tmp/.#$1.$$ $1
12759 @c
12760 @c      ::::::::::::::::::
12761 @c      gzipcp
12762 @c      ::::::::::::::::::
12763 @c      :
12764 @c      DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
12765 @c      if [ ! -d $DIRNAME ] ; then
12766 @c            DIRNAME=`echo $1 | sed -e "s|.*/||g"`
12767 @c      fi
12768 @c      gzip -c  $DIRNAME  > $2
12769 @c One catch--"cvs diff" will not invoke the wrappers
12770 @c (probably a CVS bug, although I haven't thought it out).
12771
12772 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12773 @node commit files
12774 @appendixsec The commit support files
12775 @cindex Commits, administrative support files
12776 @cindex commit files, see Info files
12777
12778 The @samp{-i} flag in the @file{modules} file can be
12779 used to run a certain program whenever files are
12780 committed (@pxref{modules}).  The files described in
12781 this section provide other, more flexible, ways to run
12782 programs whenever something is committed.
12783
12784 There are three kinds of programs that can be run on
12785 commit.  They are specified in files in the repository,
12786 as described below.  The following table summarizes the
12787 file names and the purpose of the corresponding
12788 programs.
12789
12790 @table @file
12791 @item commitinfo
12792 The program is responsible for checking that the commit
12793 is allowed.  If it exits with a non-zero exit status
12794 the commit will be aborted.
12795
12796 @item verifymsg
12797 The specified program is used to evaluate the log message,
12798 and possibly verify that it contains all required
12799 fields.  This is most useful in combination with the
12800 @file{rcsinfo} file, which can hold a log message
12801 template (@pxref{rcsinfo}).
12802
12803 @item loginfo
12804 The specified program is called when the commit is
12805 complete.  It receives the log message and some
12806 additional information and can store the log message in
12807 a file, or mail it to appropriate persons, or maybe
12808 post it to a local newsgroup, or@dots{}  Your
12809 imagination is the limit!
12810 @end table
12811
12812 @menu
12813 * syntax::                      The common syntax
12814 * commitinfo::                  Pre-commit checking
12815 * verifymsg::                   How are log messages evaluated?
12816 * loginfo::                     Where should log messages be sent?
12817
12818 * Updating Commit Files::       Updating legacy repositories to stop using
12819                                 deprecated command line template formats
12820 @end menu
12821
12822 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12823 @node syntax
12824 @appendixsubsec The common syntax
12825 @cindex Info files (syntax)
12826 @cindex Syntax of info files
12827 @cindex Common syntax of info files
12828
12829 @c FIXME: having this so totally separate from the
12830 @c Variables node is rather bogus.
12831
12832 The administrative files such as @file{commitinfo},
12833 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
12834 all have a common format.  The purpose of the files are
12835 described later on.  The common syntax is described
12836 here.
12837
12838 @cindex Regular expression syntax
12839 Each line contains the following:
12840 @itemize @bullet
12841 @item
12842 @c Say anything about DEFAULT and ALL?  Right now we
12843 @c leave that to the description of each file (and in fact
12844 @c the practice is inconsistent which is really annoying).
12845 A regular expression.  This is a basic regular
12846 expression in the syntax used by GNU emacs.
12847 @c FIXME: What we probably should be saying is "POSIX Basic
12848 @c Regular Expression with the following extensions (`\('
12849 @c `\|' '+' etc)"
12850 @c rather than define it with reference to emacs.
12851 @c The reference to emacs is not strictly speaking
12852 @c true, as we don't support \=, \s, or \S.  Also it isn't
12853 @c clear we should document and/or promise to continue to
12854 @c support all the obscure emacs extensions like \<.
12855 @c Also need to better cite (or include) full
12856 @c documentation for the syntax.
12857 @c Also see comment in configure.in about what happens to the
12858 @c syntax if we pick up a system-supplied regexp matcher.
12859
12860 @item
12861 A whitespace separator---one or more spaces and/or tabs.
12862
12863 @item
12864 A file name or command-line template.
12865 @end itemize
12866
12867 @noindent
12868 Blank lines are ignored.  Lines that start with the
12869 character @samp{#} are treated as comments.  Long lines
12870 unfortunately can @emph{not} be broken in two parts in
12871 any way.
12872
12873 The first regular expression that matches the current
12874 directory name in the repository is used.  The rest of the line
12875 is used as a file name or command-line as appropriate.
12876
12877 @cindex format strings
12878 @cindex format strings, common syntax
12879 @cindex Info files, common syntax, format strings
12880 @cindex Common syntax of info files, format strings
12881 @noindent
12882 @emph{Note:  The following information on format strings is valid
12883 as long as the line @code{UseNewInfoFmtStrings=yes} appears in
12884 your repository's config file (@pxref{config}).  Otherwise,
12885 default format strings may be appended to the command line and
12886 the @samp{loginfo} file, especially, can exhibit slightly
12887 different behavior.  For more information,
12888 @xref{Updating Commit Files}.}
12889
12890 In the cases where the second segment of the matched line is a
12891 command line template (e.g. @file{commitinfo}, @file{loginfo},
12892 & @file{verifymsg}), the command line template may contain format
12893 strings which will be replaced with specific values before the
12894 script is run.
12895 @c FIXCVS then FIXME - it really would make sense to allow %r & maybe even %p
12896 @c to be used in rcsinfo to construct a path, but I haven't
12897 @c coded this yet.
12898
12899 Format strings can represent a single variable or one or more
12900 attributes of a list variable.  An example of a list variable
12901 would be the list available to scripts hung on the loginfo hooks
12902 - the list of files which were just committed.  In the case of
12903 loginfo, three attributes are available for each list item: file
12904 name, precommit version, and postcommit version.
12905
12906 Format strings consist of a @samp{%} character followed by an optional
12907 @samp{@{} (required in the multiple list attribute case), a
12908 single format character representing a variable or a single attribute of
12909 list elements or multiple format characters representing attributes of
12910 list elements, and a closing @samp{@}} when the open bracket was present.
12911
12912 @emph{Flat} format strings (single format characters which get replaced
12913 with a single value) will generate a single argument
12914 to the called script, regardless of whether the replacement variable contains
12915 white space or other special characters.
12916
12917 List attributes will generate an argument for each attribute
12918 requested for each list item.  For example, @samp{%@{sVv@}}
12919 in a @file{loginfo} command template will generate three
12920 arguments (file name, precommit version, postcommit version,
12921 ...) for each file committed.  As in the flat format string
12922 case, each attribute will be passed in as a single argument
12923 regardless of whether it contains white space or other
12924 special characters.
12925  
12926 @samp{%%} will be replaced with a literal @samp{%}.
12927
12928 The format strings available to all script hooks are:
12929
12930 @table @t
12931 @item n
12932 the null, or empty, string
12933 @item p
12934 the name of the directory being operated on within the repository
12935 @item r
12936 the name of the repository (the path portion of @code{$CVSROOT})
12937 @end table
12938
12939 Other format strings are file specific.  See the docs on the
12940 particular administration files for more information
12941 (@pxref{Administrative files}).
12942
12943 As an example, the following line in a @file{loginfo} file would
12944 match only the directory @file{module} and any subdirectories of
12945 @file{module}:
12946
12947 @example
12948 ^module\(/\|$\) (echo; echo %p; echo %@{sVv@}; cat) >>$CVSROOT/CVSROOT/commitlog
12949 @end example
12950
12951 Using this same line and assuming a commit of new revisions
12952 1.5.4.4 and 1.27.4.1 based on old revisions 1.5.4.3 and 1.27,
12953 respectively, of file1 and file2 in module, something like the
12954 following log message should be appended to commitlog:
12955
12956 @example
12957
12958 module
12959 file1 1.5.4.3 1.5.4.4 file2 1.27 1.27.4.1
12960 Update of /cvsroot/module
12961 In directory localhost.localdomain:/home/jrandom/work/module
12962
12963 Modified Files:
12964         file1 file2
12965 Log Message:
12966 A log message.
12967 @end example
12968 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12969 @node Updating Commit Files
12970 @appendixsubsec  Updating legacy repositories to stop using deprecated command line template formats
12971 @cindex Info files (syntax), updating legacy repositories
12972 @cindex Syntax of info files, updating legacy repositories
12973 @cindex Common syntax of info files, updating legacy repositories
12974 New repositories are created set to use the new format strings by default, so
12975 if you are creating a new repository, you shouldn't have to worry about this
12976 section.
12977
12978 If you are attempting to maintain a legacy repository which was
12979 making use of the @file{commitinfo}, @file{editinfo}, @file{verifymsg},
12980 @file{loginfo}, and/or @file{taginfo} script hooks, you should have no
12981 immediate problems with using the current @sc{cvs} executable, but your users
12982 will probably start to see deprecation warnings.
12983
12984 The reason for this is that all of the script hooks have been updated to
12985 use a new command line parser that extensibly supports multiple
12986 @file{loginfo} & @file{notify} style format strings (@pxref{syntax})
12987 and this support is not completely compatible with the old style format
12988 strings.
12989
12990 The quick upgrade method is to stick a @samp{1} after each format string
12991 in your old @file{loginfo} file.  For example:
12992
12993 @example
12994 DEFAULT (echo ""; id; echo %@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
12995 @end example
12996
12997 would become:
12998
12999 @example
13000 DEFAULT (echo ""; id; echo %1@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13001 @end example
13002
13003 If you were counting on the fact that only the first @samp{%} in the line was
13004 replaced as a format string, you may also have to double up any further
13005 percent signs on the line.
13006
13007 If you did this all at once and checked it in, everything should still be
13008 running properly.
13009
13010 Now add the following line to your config file (@pxref{config}):
13011 @example
13012 UseNewInfoFmtStrings=yes
13013 @end example
13014
13015 Everything should still be running properly, but your users will probably
13016 start seeing new deprecation warnings.
13017   
13018 Dealing with the deprecation warnings now generated by @file{commitinfo},
13019 @file{editinfo}, @file{verifymsg}, and @file{taginfo} should be easy.  Simply
13020 specify what are currently implicit arguments explicitly.  This means appending
13021 the following strings to each active command line template in each file:
13022 @table @code
13023 @item commitinfo
13024 @samp{ %r/%p %s}
13025 @item editinfo
13026 @samp{ %l}
13027 @item taginfo
13028 @samp{ %t %o %p %@{sv@}}
13029 @item verifymsg
13030 @samp{ %l}
13031 @end table
13032
13033 If you don't desire that any of the newly available information be passed to
13034 the scripts hanging off of these hooks, no further modifications to these
13035 files should be necessary to insure current and future compatibility with
13036 @sc{cvs}'s format strings.
13037
13038 Fixing @file{loginfo} could be a little tougher.  The old style
13039 @file{loginfo} format strings caused a single space and comma separated
13040 argument to be passed in in place of the format string.  This is what will
13041 continue to be generated due to the deprecated @samp{1} you inserted into
13042 the format strings.
13043
13044 Since the new format separates each individual item and passes it into the
13045 script as a separate argument (for a good reason - arguments containing commas
13046 and/or white space are now parsable), to remove the deprecated @samp{1} from
13047 your @file{loginfo} command line templates, you will most likely have to
13048 rewrite any scripts called by the hook to handle the new argument format.
13049
13050 Also note that the way @samp{%} followed by unrecognized characters and by
13051 @samp{@{@}} was treated in past versions of CVS is not strictly adhered to as
13052 there were bugs in the old versions.  Specifically, @samp{%@{@}} would eat the
13053 next character and unrecognized strings resolved only to the empty string,
13054 which was counter to what was stated in the documentation.  This version will
13055 do what the documentation said it should have (if you were using only some
13056 combination of @samp{%@{sVv@}}, e.g. @samp{%@{sVv@}}, @samp{%@{sV@}}, or
13057 @samp{%v}, you should have no troubles).
13058
13059 On the bright side, you should have plenty of time to do this before all
13060 support for the old format strings is removed from @sc{cvs}, so you can just
13061 put up with the deprecation warnings for awhile if you like.
13062
13063 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13064 @node commitinfo
13065 @appendixsubsec Commitinfo
13066 @cindex @file{commitinfo}
13067 @cindex Commits, precommit verification of
13068 @cindex commitinfo (admin file)
13069 @cindex Info files, commitinfo
13070 @cindex Info files, precommit verification of commits
13071
13072 The @file{commitinfo} file defines programs to execute
13073 whenever @samp{cvs commit} is about to execute.  These
13074 programs are used for pre-commit checking to verify
13075 that the modified, added and removed files are really
13076 ready to be committed.  This could be used, for
13077 instance, to verify that the changed files conform to
13078 to your site's standards for coding practice.
13079
13080 As mentioned earlier, each line in the
13081 @file{commitinfo} file consists of a regular expression
13082 and a command-line template.  The template can include
13083 a program name and any number of arguments you wish to
13084 supply to it, as well as format strings.  For more info,
13085 @pxref{syntax}.
13086
13087 @cindex format strings, commitinfo admin file
13088 In addition to the common format strings (@pxref{syntax}),
13089 @file{commitinfo} supports:
13090
13091 @table @t
13092 @item @{s@}
13093 a list of the names of files to be committed
13094 @end table
13095
13096 @cindex commitinfo (admin file), updating legacy repositories
13097 @cindex compatibility notes, commitinfo admin file
13098 Currently, if no format strings are specified, a default
13099 string of @samp{ %r/%p %@{s@}} will be appended to the command
13100 line template before replacement is performed, but this
13101 feature is deprecated.  It is simply in place so that legacy
13102 repositories will remain compatible with the new @sc{cvs} application.
13103 For information on updating, @pxref{Updating Commit Files}.
13104
13105 @cindex Exit status, of commitinfo
13106 @cindex commitinfo (admin file), exit status
13107 The first line with a regular expression matching the
13108 directory within the repository will be used.  If the
13109 command returns a non-zero exit status the commit will
13110 be aborted.
13111 @c FIXME: need example(s) of what "directory within the
13112 @c repository" means.
13113
13114 @cindex DEFAULT in commitinfo
13115 If the repository name does not match any of the
13116 regular expressions in this file, the @samp{DEFAULT}
13117 line is used, if it is specified.
13118
13119 @cindex ALL in commitinfo
13120 All occurrences of the name @samp{ALL} appearing as a
13121 regular expression are used in addition to the first
13122 matching regular expression or the name @samp{DEFAULT}.
13123
13124 @cindex @file{commitinfo}, working directory
13125 @cindex @file{commitinfo}, command environment
13126 The command will be run in the root of the workspace
13127 containing the new versions of any files the user would like
13128 to modify (commit), @emph{or in a copy of the workspace on
13129 the server (@pxref{Remote repositories})}.  If a file is
13130 being removed, there will be no copy of the file under the
13131 current directory.  If a file is being added, there will be
13132 no corresponding archive file in the repository unless the
13133 file is being resurrected.
13134
13135 Note that both the repository directory and the corresponding
13136 Attic (@pxref{Attic}) directory may need to be checked to
13137 locate the archive file corresponding to any given file being
13138 committed.  Much of the information about the specific commit
13139 request being made, including the destination branch, commit
13140 message, and command line options specified, is not available
13141 to the command.
13142
13143 @c FIXME: should discuss using commitinfo to control
13144 @c who has checkin access to what (e.g. Joe can check into
13145 @c directories a, b, and c, and Mary can check into
13146 @c directories b, c, and d--note this case cannot be
13147 @c conveniently handled with unix groups).  Of course,
13148 @c adding a new set of features to CVS might be a more
13149 @c natural way to fix this problem than telling people to
13150 @c use commitinfo.
13151 @c FIXME: Should make some reference, especially in
13152 @c the context of controlling who has access, to the fact
13153 @c that commitinfo can be circumvented.  Perhaps
13154 @c mention SETXID (but has it been carefully examined
13155 @c for holes?).  This fits in with the discussion of
13156 @c general CVS security in "Password authentication
13157 @c security" (the bit which is not pserver-specific).
13158
13159 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13160 @node verifymsg
13161 @appendixsubsec Verifying log messages
13162 @cindex @file{verifymsg} (admin file)
13163 @cindex Log message, verifying
13164 @cindex logging, commits
13165
13166 Once you have entered a log message, you can evaluate
13167 that message to check for specific content, such as
13168 a bug ID.  Use the @file{verifymsg} file to
13169 specify a program that is used to verify the log message.
13170 This program could be a simple script that checks
13171 that the entered message contains the required fields.
13172
13173 The @file{verifymsg} file is often most useful together
13174 with the @file{rcsinfo} file, which can be used to
13175 specify a log message template.
13176
13177 Each line in the @file{verifymsg} file consists of a
13178 regular expression and a command-line template.  The
13179 template must include a program name, and can include
13180 any number of arguments.
13181
13182 @cindex format strings, verifymsg admin file
13183 In addition to the common format strings (@pxref{syntax}),
13184 @file{verifymsg} supports:
13185
13186 @table @t
13187 @item l
13188 the full path to the file containing the log message to be verified
13189 @end table
13190
13191 @cindex verifymsg (admin/commit file), updating legacy repositories
13192 @cindex compatibility notes, verifymsg admin file
13193 Currently, if no format strings are specified, a default
13194 string of @samp{ %l} will be appended to the command
13195 line template before replacement is performed, but this
13196 feature is deprecated.  It is simply in place so that legacy
13197 repositories will remain compatible with the new @sc{cvs} application.
13198 For information on updating, @pxref{Updating Commit Files}.
13199
13200 One thing that should be noted is that the @samp{ALL}
13201 keyword is not supported.  If more than one matching
13202 line is found, the first one is used.  This can be
13203 useful for specifying a default verification script in a
13204 directory, and then overriding it in a subdirectory.
13205
13206 @cindex DEFAULT in @file{verifymsg}
13207 If the repository name does not match any of the
13208 regular expressions in this file, the @samp{DEFAULT}
13209 line is used, if it is specified.
13210
13211 @cindex Exit status, of @file{verifymsg}
13212 If the verification script exits with a non-zero exit status,
13213 the commit is aborted.
13214
13215 @cindex @file{verifymsg}, changing the log message
13216 In the default configuration, CVS allows the
13217 verification script to change the log message. This is
13218 controlled via the RereadLogAfterVerify CVSROOT/config
13219 option.
13220
13221 When @samp{RereadLogAfterVerify=always} or
13222 @samp{RereadLogAfterVerify=stat}, the log message will
13223 either always be reread after the verification script
13224 is run or reread only if the log message file status
13225 has changed.
13226
13227 @xref{config}, for more on CVSROOT/config options.
13228
13229 It is NOT a good idea for a @file{verifymsg} script to
13230 interact directly with the user in the various
13231 client/server methods. For the @code{pserver} method,
13232 there is no protocol support for communicating between
13233 @file{verifymsg} and the client on the remote end. For the
13234 @code{ext} and @code{server} methods, it is possible
13235 for CVS to become confused by the characters going
13236 along the same channel as the CVS protocol
13237 messages. See @ref{Remote repositories}, for more
13238 information on client/server setups.  In addition, at the time
13239 the @file{verifymsg} script runs, the CVS
13240 server has locks in place in the repository.  If control is
13241 returned to the user here then other users may be stuck waiting
13242 for access to the repository.
13243
13244 This option can be useful if you find yourself using an
13245 rcstemplate that needs to be modified to remove empty
13246 elements or to fill in default values.  It can also be
13247 useful if the rcstemplate has changed in the repository
13248 and the CVS/Template was not updated, but is able to be
13249 adapted to the new format by the verification script
13250 that is run by @file{verifymsg}.
13251
13252 An example of an update might be to change all
13253 occurrences of 'BugId:' to be 'DefectId:' (which can be
13254 useful if the rcstemplate has recently been changed and
13255 there are still checked-out user trees with cached
13256 copies in the CVS/Template file of the older version).
13257
13258 Another example of an update might be to delete a line
13259 that contains 'BugID: none' from the log message after
13260 validation of that value as being allowed is made.
13261
13262 @menu
13263 * verifymsg example::            Verifymsg example
13264 @end menu
13265
13266 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13267 @node verifymsg example
13268 @appendixsubsubsec Verifying log messages
13269 @cindex verifymsg, example
13270 The following is a little silly example of a
13271 @file{verifymsg} file, together with the corresponding
13272 @file{rcsinfo} file, the log message template and a
13273 verification script.  We begin with the log message template.
13274 We want to always record a bug-id number on the first
13275 line of the log message.  The rest of log message is
13276 free text.  The following template is found in the file
13277 @file{/usr/cvssupport/tc.template}.
13278
13279 @example
13280 BugId:
13281 @end example
13282
13283 The script @file{/usr/cvssupport/bugid.verify} is used to
13284 evaluate the log message.
13285
13286 @example
13287 #!/bin/sh
13288 #
13289 #       bugid.verify filename
13290 #
13291 #  Verify that the log message contains a valid bugid
13292 #  on the first line.
13293 #
13294 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
13295     exit 0
13296 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
13297     # It is okay to allow commits with 'BugId: none',
13298     # but do not put that text into the real log message.
13299     grep -v '^BugId:[ ]*none$' > $1.rewrite
13300     mv $1.rewrite $1
13301     exit 0
13302 else
13303     echo "No BugId found."
13304     exit 1
13305 fi
13306 @end example
13307
13308 The @file{verifymsg} file contains this line:
13309
13310 @example
13311 ^tc     /usr/cvssupport/bugid.verify %l
13312 @end example
13313
13314 The @file{rcsinfo} file contains this line:
13315
13316 @example
13317 ^tc     /usr/cvssupport/tc.template
13318 @end example
13319
13320 The @file{config} file contains this line:
13321
13322 @example
13323 RereadLogAfterVerify=always
13324 @end example
13325
13326
13327
13328 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13329 @node loginfo
13330 @appendixsubsec Loginfo
13331 @cindex loginfo (admin file)
13332 @cindex logging, commits
13333 @cindex Storing log messages
13334 @cindex Mailing log messages
13335 @cindex Distributing log messages
13336 @cindex Log messages
13337
13338 @c "cvs commit" is not quite right.  What we
13339 @c mean is "when the repository gets changed" which
13340 @c also includes "cvs import" and "cvs add" on a directory.
13341 The @file{loginfo} file is used to control where
13342 @samp{cvs commit} log information is sent.  @xref{taginfo}, for
13343 how to log tagging information.
13344
13345 The first entry on a line is a regular expression which is tested
13346 against the directory that the change is being made to,
13347 relative to the @code{$CVSROOT}.  If a match is found, then
13348 the remainder of the line is a filter program that
13349 should expect log information on its standard input.
13350 Note that the filter program @strong{must} read @strong{all}
13351 of the log information or @sc{cvs} may fail with a broken pipe signal.
13352
13353 If the repository name does not match any of the
13354 regular expressions in this file, the @samp{DEFAULT}
13355 line is used, if it is specified.
13356
13357 All occurrences of the name @samp{ALL} appearing as a
13358 regular expression are used in addition to the first
13359 matching regular expression or @samp{DEFAULT}.
13360
13361 The first matching regular expression is used.
13362
13363 @cindex format strings, loginfo admin file
13364 In addition to the common format strings (@pxref{syntax}),
13365 @file{loginfo} supports:
13366
13367 @table @t
13368 @item @{sVv@}
13369 File attributes, where:
13370 @table @t
13371 @item s
13372 file name
13373 @item V
13374 old version number (pre-checkin)
13375 @item v
13376 new version number (post-checkin)
13377 @end table
13378 @end table
13379
13380 For example, some valid format strings are @samp{%%},
13381 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13382
13383 @cindex loginfo (admin file), updating legacy repositories
13384 @cindex compatibility notes, loginfo admin file
13385 Currently, if @samp{UseNewInfoFmtStrings} is not set in the @file{config}
13386 administration file (@pxref{config}), the format strings will be substituted
13387 as they were in past versions of @sc{cvs}, but this feature is deprecated.
13388 It is simply in place so that legacy repositories will remain compatible with
13389 the new @sc{cvs} application.  For information on updating,
13390 please see @ref{Updating Commit Files}.
13391
13392 @xref{commit files}, for a description of the syntax of the @file{loginfo}
13393 file.
13394
13395 As an example, if @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%p}
13396 and @samp{%@{sVv@}} are the format strings, and three files (@t{ChangeLog},
13397 @t{Makefile}, @t{foo.c}) were modified, the output might be:
13398
13399 @example
13400 yoyodyne/tc ChangeLog 1.1 1.2 Makefile 1.3 1.4 foo.c 1.12 1.13
13401 @end example
13402
13403 Note: when @sc{cvs} is accessing a remote repository,
13404 @file{loginfo} will be run on the @emph{remote}
13405 (i.e., server) side, not the client side (@pxref{Remote
13406 repositories}).
13407
13408 @menu
13409 * loginfo example::                          Loginfo example
13410 * Keeping a checked out copy::               Updating a tree on every checkin
13411 @end menu
13412
13413 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13414 @node loginfo example
13415 @appendixsubsubsec Loginfo example
13416
13417 The following @file{loginfo} file, together with the
13418 tiny shell-script below, appends all log messages
13419 to the file @file{$CVSROOT/CVSROOT/commitlog},
13420 and any commits to the administrative files (inside
13421 the @file{CVSROOT} directory) are also logged in
13422 @file{/usr/adm/cvsroot-log}.
13423 Commits to the @file{prog1} directory are mailed to @t{ceder}.
13424
13425 @c FIXME: is it a CVS feature or bug that only the
13426 @c first matching line is used?  It is documented
13427 @c above, but is it useful?  For example, if we wanted
13428 @c to run both "cvs-log" and "Mail" for the CVSROOT
13429 @c directory, it is kind of awkward if
13430 @c only the first matching line is used.
13431 @example
13432 ALL                     /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
13433 ^CVSROOT\(/\|$\)        /usr/local/bin/cvs-log /usr/adm/cvsroot-log $USER
13434 ^prog1\(/\|$\)          Mail -s "%p %s" ceder
13435 @end example
13436
13437 The shell-script @file{/usr/local/bin/cvs-log} looks
13438 like this:
13439
13440 @example
13441 #!/bin/sh
13442 (echo "------------------------------------------------------";
13443  echo -n "$2  ";
13444  date;
13445  echo;
13446  cat) >> $1
13447 @end example
13448
13449 @node Keeping a checked out copy
13450 @appendixsubsubsec Keeping a checked out copy
13451
13452 @c What other index entries?  It seems like
13453 @c people might want to use a lot of different
13454 @c words for this functionality.
13455 @cindex Keeping a checked out copy
13456 @cindex Checked out copy, keeping
13457 @cindex Web pages, maintaining with CVS
13458
13459 It is often useful to maintain a directory tree which
13460 contains files which correspond to the latest version
13461 in the repository.  For example, other developers might
13462 want to refer to the latest sources without having to
13463 check them out, or you might be maintaining a web site
13464 with @sc{cvs} and want every checkin to cause the files
13465 used by the web server to be updated.
13466 @c Can we offer more details on the web example?  Or
13467 @c point the user at how to figure it out?  This text
13468 @c strikes me as sufficient for someone who already has
13469 @c some idea of what we mean but not enough for the naive
13470 @c user/sysadmin to understand it and set it up.
13471
13472 The way to do this is by having loginfo invoke
13473 @code{cvs update}.  Doing so in the naive way will
13474 cause a problem with locks, so the @code{cvs update}
13475 must be run in the background.
13476 @c Should we try to describe the problem with locks?
13477 @c It seems like a digression for someone who just
13478 @c wants to know how to make it work.
13479 @c Another choice which might work for a single file
13480 @c is to use "cvs -n update -p" which doesn't take
13481 @c out locks (I think) but I don't see many advantages
13482 @c of that and we might as well document something which
13483 @c works for multiple files.
13484 Here is an example for unix (this should all be on one line):
13485
13486 @example
13487 ^cyclic-pages\(/\|$\)   (date; cat; (sleep 2; cd /u/www/local-docs;
13488  cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
13489 @end example
13490
13491 This will cause checkins to repository directory @code{cyclic-pages}
13492 and its subdirectories to update the checked
13493 out tree in @file{/u/www/local-docs}.
13494 @c More info on some of the details?  The "sleep 2" is
13495 @c so if we are lucky the lock will be gone by the time
13496 @c we start and we can wait 2 seconds instead of 30.
13497
13498 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13499 @node rcsinfo
13500 @appendixsec Rcsinfo
13501 @cindex rcsinfo (admin file)
13502 @cindex Form for log message
13503 @cindex Log message template
13504 @cindex Template for log message
13505 @cindex logging, commits
13506
13507 The @file{rcsinfo} file can be used to specify a form to
13508 edit when filling out the commit log.  The
13509 @file{rcsinfo} file has a syntax similar to the
13510 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
13511 files.  @xref{syntax}.  Unlike the other files the second
13512 part is @emph{not} a command-line template.  Instead,
13513 the part after the regular expression should be a full pathname to
13514 a file containing the log message template.
13515
13516 If the repository name does not match any of the
13517 regular expressions in this file, the @samp{DEFAULT}
13518 line is used, if it is specified.
13519
13520 All occurrences of the name @samp{ALL} appearing as a
13521 regular expression are used in addition to the first
13522 matching regular expression or @samp{DEFAULT}.
13523
13524 @c FIXME: should be offering advice, somewhere around
13525 @c here, about where to put the template file.  The
13526 @c verifymsg example uses /usr/cvssupport but doesn't
13527 @c say anything about what that directory is for or
13528 @c whether it is hardwired into CVS or who creates
13529 @c it or anything.  In particular we should say
13530 @c how to version control the template file.  A
13531 @c probably better answer than the /usr/cvssupport
13532 @c stuff is to use checkoutlist (with xref to the
13533 @c checkoutlist doc).
13534 @c Also I am starting to see a connection between
13535 @c this and the Keeping a checked out copy node.
13536 @c Probably want to say something about that.
13537 The log message template will be used as a default log
13538 message.  If you specify a log message with @samp{cvs
13539 commit -m @var{message}} or @samp{cvs commit -f
13540 @var{file}} that log message will override the
13541 template.
13542
13543 @xref{verifymsg}, for an example @file{rcsinfo}
13544 file.
13545
13546 When @sc{cvs} is accessing a remote repository,
13547 the contents of @file{rcsinfo} at the time a directory
13548 is first checked out will specify a template. This
13549 template will be updated on all @samp{cvs update}
13550 commands. It will also be added to new directories
13551 added with a @samp{cvs add new-directory} command.
13552 In versions of @sc{cvs} prior to version 1.12, the
13553 @file{CVS/Template} file was not updated. If the
13554 @sc{cvs} server is at version 1.12 or higher an older
13555 client may be used and the @file{CVS/Template} will
13556 be updated from the server.
13557
13558 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13559 @node taginfo
13560 @appendixsec Taginfo
13561 @cindex taginfo (admin file)
13562 @cindex Tags, logging
13563 @cindex Tags, verifying
13564 The @file{taginfo} file defines programs to execute
13565 when someone executes a @code{tag} or @code{rtag}
13566 command.  The @file{taginfo} file has the standard form
13567 for administrative files (@pxref{Administrative
13568 files}), where each line is a regular expression
13569 followed by a command to execute.
13570
13571 @cindex format strings, taginfo admin file
13572 In addition to the common format strings (@pxref{syntax}),
13573 @file{taginfo} supports:
13574
13575 @table @t
13576 @item b
13577 tag type (@code{T} for branch, @code{N} for not-branch, or @code{?} for
13578 unknown, as during delete operations)
13579 @item o
13580 operation (@code{add} for @code{tag}, @code{mov} for @code{tag -F}, or
13581 @code{del} for @code{tag -d})
13582 @item t
13583 tag name
13584 @item @{sVv@}
13585 file attributes, where:
13586 @table @t
13587 @item s
13588 file name
13589 @item V
13590 old version number (for a move or delete operation)
13591 @item v
13592 new version number (for an add or move operation)
13593 @end table
13594 @end table
13595
13596 For example, some valid format strings are @samp{%%}, @samp{%p}, @samp{%t},
13597 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13598
13599 @cindex taginfo (admin file), updating legacy repositories
13600 @cindex compatibility notes, taginfo admin file
13601 Currently, if no format strings are specified, a default
13602 string of @samp{ %t %o %p %@{sv@}} will be appended to the command
13603 line template before replacement is performed, but this
13604 feature is deprecated.  It is simply in place so that legacy
13605 repositories will remain compatible with the new @sc{cvs} application.
13606 For information on updating, @pxref{Updating Commit Files}.
13607
13608 @cindex Exit status, of taginfo admin file
13609 @cindex taginfo (admin file), exit status
13610 A non-zero exit of the filter program will cause the tag to be
13611 aborted.
13612
13613 Here is an example of using @file{taginfo} to log @code{tag} and @code{rtag}
13614 commands.  In the @file{taginfo} file put:
13615
13616 @example
13617 ALL /usr/local/cvsroot/CVSROOT/loggit %t %b %o %p %@{sVv@}
13618 @end example
13619
13620 @noindent
13621 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
13622 following script:
13623
13624 @example
13625 #!/bin/sh
13626 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
13627 @end example
13628 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13629 @node cvsignore
13630 @appendixsec Ignoring files via cvsignore
13631 @cindex cvsignore (admin file), global
13632 @cindex Global cvsignore
13633 @cindex Ignoring files
13634 @c -- This chapter should maybe be moved to the
13635 @c tutorial part of the manual?
13636
13637 There are certain file names that frequently occur
13638 inside your working copy, but that you don't want to
13639 put under @sc{cvs} control.  Examples are all the object
13640 files that you get while you compile your sources.
13641 Normally, when you run @samp{cvs update}, it prints a
13642 line for each file it encounters that it doesn't know
13643 about (@pxref{update output}).
13644
13645 @sc{cvs} has a list of files (or sh(1) file name patterns)
13646 that it should ignore while running @code{update},
13647 @code{import} and @code{release}.
13648 @c -- Are those the only three commands affected?
13649 This list is constructed in the following way.
13650
13651 @itemize @bullet
13652 @item
13653 The list is initialized to include certain file name
13654 patterns: names associated with @sc{cvs}
13655 administration, or with other common source control
13656 systems; common names for patch files, object files,
13657 archive files, and editor backup files; and other names
13658 that are usually artifacts of assorted utilities.
13659 Currently, the default list of ignored file name
13660 patterns is:
13661
13662 @cindex Ignored files
13663 @cindex Automatically ignored files
13664 @example
13665     RCS     SCCS    CVS     CVS.adm
13666     RCSLOG  cvslog.*
13667     tags    TAGS
13668     .make.state     .nse_depinfo
13669     *~      #*      .#*     ,*      _$*     *$
13670     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
13671     *.a     *.olb   *.o     *.obj   *.so    *.exe
13672     *.Z     *.elc   *.ln
13673     core
13674 @end example
13675
13676 @item
13677 The per-repository list in
13678 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
13679 the list, if that file exists.
13680
13681 @item
13682 The per-user list in @file{.cvsignore} in your home
13683 directory is appended to the list, if it exists.
13684
13685 @item
13686 Any entries in the environment variable
13687 @code{$CVSIGNORE} is appended to the list.
13688
13689 @item
13690 Any @samp{-I} options given to @sc{cvs} is appended.
13691
13692 @item
13693 As @sc{cvs} traverses through your directories, the contents
13694 of any @file{.cvsignore} will be appended to the list.
13695 The patterns found in @file{.cvsignore} are only valid
13696 for the directory that contains them, not for
13697 any sub-directories.
13698 @end itemize
13699
13700 In any of the 5 places listed above, a single
13701 exclamation mark (@samp{!}) clears the ignore list.
13702 This can be used if you want to store any file which
13703 normally is ignored by @sc{cvs}.
13704
13705 Specifying @samp{-I !} to @code{cvs import} will import
13706 everything, which is generally what you want to do if
13707 you are importing files from a pristine distribution or
13708 any other source which is known to not contain any
13709 extraneous files.  However, looking at the rules above
13710 you will see there is a fly in the ointment; if the
13711 distribution contains any @file{.cvsignore} files, then
13712 the patterns from those files will be processed even if
13713 @samp{-I !} is specified.  The only workaround is to
13714 remove the @file{.cvsignore} files in order to do the
13715 import.  Because this is awkward, in the future
13716 @samp{-I !} might be modified to override
13717 @file{.cvsignore} files in each directory.
13718
13719 Note that the syntax of the ignore files consists of a
13720 series of lines, each of which contains a space
13721 separated list of filenames.  This offers no clean way
13722 to specify filenames which contain spaces, but you can
13723 use a workaround like @file{foo?bar} to match a file
13724 named @file{foo bar} (it also matches @file{fooxbar}
13725 and the like).  Also note that there is currently no
13726 way to specify comments.
13727 @c FIXCVS?  I don't _like_ this syntax at all, but
13728 @c changing it raises all the usual compatibility
13729 @c issues and I'm also not sure what to change it to.
13730
13731 @node checkoutlist
13732 @appendixsec The checkoutlist file
13733 @cindex checkoutlist
13734
13735 It may be helpful to use @sc{cvs} to maintain your own
13736 files in the @file{CVSROOT} directory.  For example,
13737 suppose that you have a script @file{logcommit.pl}
13738 which you run by including the following line in the
13739 @file{commitinfo} administrative file:
13740
13741 @example
13742 ALL   $CVSROOT/CVSROOT/logcommit.pl %r/%p %s
13743 @end example
13744
13745 To maintain @file{logcommit.pl} with @sc{cvs} you would
13746 add the following line to the @file{checkoutlist}
13747 administrative file:
13748
13749 @example
13750 logcommit.pl
13751 @end example
13752
13753 The format of @file{checkoutlist} is one line for each
13754 file that you want to maintain using @sc{cvs}, giving
13755 the name of the file, followed optionally by more whitespace
13756 and any error message that should print if the file cannot be
13757 checked out into CVSROOT after a commit:
13758
13759 @example
13760 logcommit.pl    Could not update CVSROOT/logcommit.pl.
13761 @end example
13762
13763 After setting up @file{checkoutlist} in this fashion,
13764 the files listed there will function just like
13765 @sc{cvs}'s built-in administrative files.  For example,
13766 when checking in one of the files you should get a
13767 message such as:
13768
13769 @example
13770 cvs commit: Rebuilding administrative file database
13771 @end example
13772
13773 @noindent
13774 and the checked out copy in the @file{CVSROOT}
13775 directory should be updated.
13776
13777 Note that listing @file{passwd} (@pxref{Password
13778 authentication server}) in @file{checkoutlist} is not
13779 recommended for security reasons.
13780
13781 For information about keeping a checkout out copy in a
13782 more general context than the one provided by
13783 @file{checkoutlist}, see @ref{Keeping a checked out
13784 copy}.
13785
13786 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13787 @node history file
13788 @appendixsec The history file
13789 @cindex History file
13790 @cindex Log information, saving
13791
13792 The file @file{$CVSROOT/CVSROOT/history} is used
13793 to log information for the @code{history} command
13794 (@pxref{history}).  This file must be created to turn
13795 on logging.  This is done automatically if the
13796 @code{cvs init} command is used to set up the
13797 repository (@pxref{Creating a repository}).
13798
13799 The file format of the @file{history} file is
13800 documented only in comments in the @sc{cvs} source
13801 code, but generally programs should use the @code{cvs
13802 history} command to access it anyway, in case the
13803 format changes with future releases of @sc{cvs}.
13804
13805 @node Variables
13806 @appendixsec Expansions in administrative files
13807 @cindex Internal variables
13808 @cindex Variables
13809
13810 Sometimes in writing an administrative file, you might
13811 want the file to be able to know various things based
13812 on environment @sc{cvs} is running in.  There are
13813 several mechanisms to do that.
13814
13815 To find the home directory of the user running @sc{cvs}
13816 (from the @code{HOME} environment variable), use
13817 @samp{~} followed by @samp{/} or the end of the line.
13818 Likewise for the home directory of @var{user}, use
13819 @samp{~@var{user}}.  These variables are expanded on
13820 the server machine, and don't get any reasonable
13821 expansion if pserver (@pxref{Password authenticated})
13822 is in use; therefore user variables (see below) may be
13823 a better choice to customize behavior based on the user
13824 running @sc{cvs}.
13825 @c Based on these limitations, should we deprecate ~?
13826 @c What is it good for?  Are people using it?
13827
13828 One may want to know about various pieces of
13829 information internal to @sc{cvs}.  A @sc{cvs} internal
13830 variable has the syntax @code{$@{@var{variable}@}},
13831 where @var{variable} starts with a letter and consists
13832 of alphanumeric characters and @samp{_}.  If the
13833 character following @var{variable} is a
13834 non-alphanumeric character other than @samp{_}, the
13835 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
13836 internal variables are:
13837
13838 @table @code
13839 @item CVSROOT
13840 @cindex CVSROOT, internal variable
13841 This is the absolute path to the current @sc{cvs} root directory.
13842 @xref{Repository}, for a description of the various
13843 ways to specify this, but note that the internal
13844 variable contains just the directory and not any
13845 of the access method information.
13846
13847 @item RCSBIN
13848 @cindex RCSBIN, internal variable
13849 In @sc{cvs} 1.9.18 and older, this specified the
13850 directory where @sc{cvs} was looking for @sc{rcs}
13851 programs.  Because @sc{cvs} no longer runs @sc{rcs}
13852 programs, specifying this internal variable is now an
13853 error.
13854
13855 @item CVSEDITOR
13856 @cindex CVSEDITOR, internal variable
13857 @itemx EDITOR
13858 @cindex EDITOR, internal variable
13859 @itemx VISUAL
13860 @cindex VISUAL, internal variable
13861 These all expand to the same value, which is the editor
13862 that @sc{cvs} is using.  @xref{Global options}, for how
13863 to specify this.
13864
13865 @item USER
13866 @cindex USER, internal variable
13867 Username of the user running @sc{cvs} (on the @sc{cvs}
13868 server machine).
13869 When using pserver, this is the user specified in the repository
13870 specification which need not be the same as the username the
13871 server is running as (@pxref{Password authentication server}).
13872 Do not confuse this with the environment variable of the same name.
13873 @end table
13874
13875 If you want to pass a value to the administrative files
13876 which the user who is running @sc{cvs} can specify,
13877 use a user variable.
13878 @cindex User variables
13879 To expand a user variable, the
13880 administrative file contains
13881 @code{$@{=@var{variable}@}}.  To set a user variable,
13882 specify the global option @samp{-s} to @sc{cvs}, with
13883 argument @code{@var{variable}=@var{value}}.  It may be
13884 particularly useful to specify this option via
13885 @file{.cvsrc} (@pxref{~/.cvsrc}).
13886
13887 For example, if you want the administrative file to
13888 refer to a test directory you might create a user
13889 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
13890 as
13891
13892 @example
13893 cvs -s TESTDIR=/work/local/tests
13894 @end example
13895
13896 @noindent
13897 and the
13898 administrative file contains @code{sh
13899 $@{=TESTDIR@}/runtests}, then that string is expanded
13900 to @code{sh /work/local/tests/runtests}.
13901
13902 All other strings containing @samp{$} are reserved;
13903 there is no way to quote a @samp{$} character so that
13904 @samp{$} represents itself.
13905
13906 Environment variables passed to administrative files are:
13907
13908 @table @code
13909 @cindex environment variables, passed to administrative files
13910
13911 @item CVS_USER
13912 @cindex CVS_USER, environment variable
13913 The @sc{cvs}-specific username provided by the user, if it
13914 can be provided (currently just for the pserver access
13915 method), and to the empty string otherwise.  (@code{CVS_USER}
13916 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
13917 is used to map @sc{cvs} usernames to system usernames.)
13918
13919 @item LOGNAME
13920 @cindex LOGNAME, environment variable
13921 The username of the system user.
13922
13923 @item USER
13924 @cindex USER, environment variable
13925 Same as @code{LOGNAME}.
13926 Do not confuse this with the internal variable of the same name.
13927 @end table
13928
13929 @node config
13930 @appendixsec The CVSROOT/config configuration file
13931
13932 @cindex config, in CVSROOT
13933 @cindex CVSROOT/config
13934
13935 The administrative file @file{config} contains various
13936 miscellaneous settings which affect the behavior of
13937 @sc{cvs}.  The syntax is slightly different from the
13938 other administrative files.  Variables are not
13939 expanded.  Lines which start with @samp{#} are
13940 considered comments.
13941 @c FIXME: where do we define comments for the other
13942 @c administrative files.
13943 Other lines consist of a keyword, @samp{=}, and a
13944 value.  Note that this syntax is very strict.
13945 Extraneous spaces or tabs are not permitted.
13946 @c See comments in parseinfo.c:parse_config for more
13947 @c discussion of this strictness.
13948
13949 Currently defined keywords are:
13950
13951 @table @code
13952 @cindex RCSBIN, in CVSROOT/config
13953 @item RCSBIN=@var{bindir}
13954 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
13955 @sc{cvs} to look for @sc{rcs} programs in the
13956 @var{bindir} directory.  Current versions of @sc{cvs}
13957 do not run @sc{rcs} programs; for compatibility this
13958 setting is accepted, but it does nothing.
13959
13960 @cindex SystemAuth, in CVSROOT/config
13961 @item SystemAuth=@var{value}
13962 If @var{value} is @samp{yes}, then pserver should check
13963 for users in the system's user database if not found in
13964 @file{CVSROOT/passwd}.  If it is @samp{no}, then all
13965 pserver users must exist in @file{CVSROOT/passwd}.
13966 The default is @samp{yes}.  For more on pserver, see
13967 @ref{Password authenticated}.
13968
13969 @ignore
13970 @cindex PreservePermissions, in CVSROOT/config
13971 @item PreservePermissions=@var{value}
13972 Enable support for saving special device files,
13973 symbolic links, file permissions and ownerships in the
13974 repository.  The default value is @samp{no}.
13975 @xref{Special Files}, for the full implications of using
13976 this keyword.
13977 @end ignore
13978
13979 @cindex TopLevelAdmin, in CVSROOT/config
13980 @item TopLevelAdmin=@var{value}
13981 Modify the @samp{checkout} command to create a
13982 @samp{CVS} directory at the top level of the new
13983 working directory, in addition to @samp{CVS}
13984 directories created within checked-out directories.
13985 The default value is @samp{no}.
13986
13987 This option is useful if you find yourself performing
13988 many commands at the top level of your working
13989 directory, rather than in one of the checked out
13990 subdirectories.  The @file{CVS} directory created there
13991 will mean you don't have to specify @code{CVSROOT} for
13992 each command.  It also provides a place for the
13993 @file{CVS/Template} file (@pxref{Working directory
13994 storage}).
13995
13996 @cindex LockDir, in CVSROOT/config
13997 @item LockDir=@var{directory}
13998 Put @sc{cvs} lock files in @var{directory} rather than
13999 directly in the repository.  This is useful if you want
14000 to let users read from the repository while giving them
14001 write access only to @var{directory}, not to the
14002 repository.
14003 It can also be used to put the locks on a very fast
14004 in-memory file system to speed up locking and unlocking
14005 the repository.
14006 You need to create @var{directory}, but
14007 @sc{cvs} will create subdirectories of @var{directory} as it
14008 needs them.  For information on @sc{cvs} locks, see
14009 @ref{Concurrency}.
14010
14011 @c Mention this in Compatibility section?
14012 Before enabling the LockDir option, make sure that you
14013 have tracked down and removed any copies of @sc{cvs} 1.9 or
14014 older.  Such versions neither support LockDir, nor will
14015 give an error indicating that they don't support it.
14016 The result, if this is allowed to happen, is that some
14017 @sc{cvs} users will put the locks one place, and others will
14018 put them another place, and therefore the repository
14019 could become corrupted.  @sc{cvs} 1.10 does not support
14020 LockDir but it will print a warning if run on a
14021 repository with LockDir enabled.
14022
14023 @cindex LogHistory, in CVSROOT/config
14024 @item LogHistory=@var{value}
14025 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
14026 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
14027 all transactions.  Any subset of the default is
14028 legal.  (For example, to only log transactions that modify the
14029 @file{*,v} files, use @samp{LogHistory=TMAR}.)
14030
14031 @cindex RereadLogAfterVerify, in CVSROOT/config
14032 @cindex @file{verifymsg}, changing the log message
14033 @item RereadLogAfterVerify=@var{value}
14034 Modify the @samp{commit} command such that CVS will reread the
14035 log message after running the program specified by @file{verifymsg}.
14036 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
14037 the log message should always be reread; @samp{no}
14038 or @samp{never}, indicating that it should never be
14039 reread; or @var{value} may be @samp{stat}, indicating
14040 that the file should be checked with the file system
14041 @samp{stat()} function to see if it has changed (see warning below)
14042 before rereading.  The default value is @samp{always}.
14043
14044 @strong{Note: the `stat' mode can cause CVS to pause for up to
14045 one extra second per directory committed.  This can be less IO and
14046 CPU intensive but is not recommended for use with large repositories}
14047
14048 @xref{verifymsg}, for more information on how verifymsg
14049 may be used.
14050
14051 @cindex UserAdminOptions, in CVSROOT/config
14052 @item UserAdminOptions=@var{value}
14053 Control what options will be allowed with the @code{cvs admin}
14054 command (@pxref{admin}) for users not in the @code{cvsadmin} group.
14055 The @var{value} string is a list of single character options
14056 which should be allowed.  If a user who is not a member of the
14057 @code{cvsadmin} group tries to execute any @code{cvs admin}
14058 option which is not listed they will will receive an error message
14059 reporting that the option is restricted.
14060
14061 If no @code{cvsadmin} group exists on the server, @sc{cvs} will
14062 ignore the @code{UserAdminOptions} keyword (@pxref{admin}).
14063
14064 When not specified, @code{UserAdminOptions} defaults to
14065 @samp{k}.  In other words, it defaults to allowing
14066 users outside of the @code{cvsadmin} group to use the
14067 @code{cvs admin} command only to change the default keyword
14068 expansion mode for files.
14069
14070 As an example, to restrict users not in the @code{cvsadmin}
14071 group to using @code{cvs admin} to change the default keyword
14072 substitution mode, lock revisions, unlock revisions, and
14073 replace the log message, use @samp{UserAdminOptions=klum}.
14074
14075 @cindex format strings, config admin file
14076 @cindex config (admin file), updating legacy repositories
14077 @cindex compatibility notes, config admin file
14078 @cindex UseNewInfoFmtStrings, in CVSROOT/config
14079 @item UseNewInfoFmtStrings=@var{value}
14080 Specify whether @sc{cvs} should support the new or old command line
14081 template model for the commit support files (@pxref{commit files}).
14082 This configuration variable began life in deprecation and is only here
14083 in order to give people time to update legacy repositories to use the new
14084 format string syntax before support for the old syntax is removed.  For
14085 information on updating your repository to support the new model,
14086 please see @ref{Updating Commit Files}.
14087
14088 @emph{Note that new repositories (created with the @code{cvs init} command)
14089 will have this value set to @samp{yes}, but the default value is @samp{no}.}
14090 @end table
14091
14092 @c ---------------------------------------------------------------------
14093 @node Environment variables
14094 @appendix All environment variables which affect CVS
14095 @cindex Environment variables
14096 @cindex Reference manual for variables
14097
14098 This is a complete list of all environment variables
14099 that affect @sc{cvs}.
14100
14101 @table @code
14102 @cindex CVSIGNORE, environment variable
14103 @item $CVSIGNORE
14104 A whitespace-separated list of file name patterns that
14105 @sc{cvs} should ignore. @xref{cvsignore}.
14106
14107 @cindex CVSWRAPPERS, environment variable
14108 @item $CVSWRAPPERS
14109 A whitespace-separated list of file name patterns that
14110 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
14111
14112 @cindex CVSREAD, environment variable
14113 @cindex Read-only files, and CVSREAD
14114 @item $CVSREAD
14115 If this is set, @code{checkout} and @code{update} will
14116 try hard to make the files in your working directory
14117 read-only.  When this is not set, the default behavior
14118 is to permit modification of your working files.
14119
14120 @cindex CVSREADONLYFS, environment variable
14121 @item $CVSREADONLYFS
14122 Turns on read-only repository mode. This allows one to
14123 check out from a read-only repository, such as within
14124 an anoncvs server, or from a @sc{cd-rom} repository.
14125
14126 It has the same effect as if the @samp{-R} command-line
14127 option is used. This can also allow the use of
14128 read-only NFS repositories.
14129
14130 @item $CVSUMASK
14131 Controls permissions of files in the repository.  See
14132 @ref{File permissions}.
14133
14134 @item $CVSROOT
14135 Should contain the full pathname to the root of the @sc{cvs}
14136 source repository (where the @sc{rcs} files are
14137 kept).  This information must be available to @sc{cvs} for
14138 most commands to execute; if @code{$CVSROOT} is not set,
14139 or if you wish to override it for one invocation, you
14140 can supply it on the command line: @samp{cvs -d cvsroot
14141 cvs_command@dots{}} Once you have checked out a working
14142 directory, @sc{cvs} stores the appropriate root (in
14143 the file @file{CVS/Root}), so normally you only need to
14144 worry about this when initially checking out a working
14145 directory.
14146
14147 @item $CVSEDITOR
14148 @cindex CVSEDITOR, environment variable
14149 @itemx $EDITOR
14150 @cindex EDITOR, environment variable
14151 @itemx $VISUAL
14152 @cindex VISUAL, environment variable
14153 Specifies the program to use for recording log messages
14154 during commit.  @code{$CVSEDITOR} overrides
14155 @code{$EDITOR}, which overrides @code{$VISUAL}.
14156 See @ref{Committing your changes} for more or
14157 @ref{Global options} for alternative ways of specifying a
14158 log editor.
14159
14160 @cindex PATH, environment variable
14161 @item $PATH
14162 If @code{$RCSBIN} is not set, and no path is compiled
14163 into @sc{cvs}, it will use @code{$PATH} to try to find all
14164 programs it uses.
14165
14166 @cindex HOME, environment variable
14167 @item $HOME
14168 @cindex HOMEPATH, environment variable
14169 @item $HOMEPATH
14170 @cindex HOMEDRIVE, environment variable
14171 @item $HOMEDRIVE
14172 Used to locate the directory where the @file{.cvsrc}
14173 file, and other such files, are searched.  On Unix, @sc{cvs}
14174 just checks for @code{HOME}.  On Windows NT, the system will
14175 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
14176 for example to @file{\joe}.  On Windows 95, you'll
14177 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
14178 @c We are being vague about whether HOME works on
14179 @c Windows; see long comment in windows-NT/filesubr.c.
14180
14181 @cindex CVS_RSH, environment variable
14182 @item $CVS_RSH
14183 Specifies the external program which @sc{cvs} connects with,
14184 when @code{:ext:} access method is specified.
14185 @pxref{Connecting via rsh}.
14186
14187 @item $CVS_SERVER
14188 Used in client-server mode when accessing a remote
14189 repository using @sc{rsh}.  It specifies the name of
14190 the program to start on the server side (and any
14191 necessary arguments) when accessing a remote repository
14192 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
14193 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
14194 the default value for @code{:fork:} is the name used to run the client.
14195 @pxref{Connecting via rsh}
14196
14197 @item $CVS_PASSFILE
14198 Used in client-server mode when accessing the @code{cvs
14199 login server}.  Default value is @file{$HOME/.cvspass}.
14200 @pxref{Password authentication client}
14201
14202 @cindex CVS_CLIENT_PORT
14203 @item $CVS_CLIENT_PORT
14204 Used in client-server mode to set the port to use when accessing the server
14205 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
14206 if the port is not specified in the CVSROOT.
14207 @pxref{Remote repositories}
14208
14209 @cindex CVS_PROXY_PORT
14210 @item $CVS_PROXY_PORT
14211 Used in client-server mode to set the port to use when accessing a server
14212 via a web proxy, if the port is not specified in the CVSROOT.  Works with
14213 GSSAPI, and the password authentication protocol.
14214 @pxref{Remote repositories}
14215
14216 @cindex CVS_RCMD_PORT, environment variable
14217 @item $CVS_RCMD_PORT
14218 Used in client-server mode.  If set, specifies the port
14219 number to be used when accessing the @sc{rcmd} demon on
14220 the server side. (Currently not used for Unix clients).
14221
14222 @cindex CVS_CLIENT_LOG, environment variable
14223 @item $CVS_CLIENT_LOG
14224 Used for debugging only in client-server
14225 mode.  If set, everything sent to the server is logged
14226 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
14227 sent from the server is logged into
14228 @file{@code{$CVS_CLIENT_LOG}.out}.
14229
14230 @cindex CVS_SERVER_SLEEP, environment variable
14231 @item $CVS_SERVER_SLEEP
14232 Used only for debugging the server side in
14233 client-server mode.  If set, delays the start of the
14234 server child process the specified amount of
14235 seconds so that you can attach to it with a debugger.
14236
14237 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
14238 @item $CVS_IGNORE_REMOTE_ROOT
14239 For @sc{cvs} 1.10 and older, setting this variable
14240 prevents @sc{cvs} from overwriting the @file{CVS/Root}
14241 file when the @samp{-d} global option is specified.
14242 Later versions of @sc{cvs} do not rewrite
14243 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
14244 effect.
14245
14246 @cindex CVS_LOCAL_BRANCH_NUM, environment variable
14247 @item $CVS_LOCAL_BRANCH_NUM
14248 Setting this variable allows some control over the
14249 branch number that is assigned. This is specifically to
14250 support the local commit feature of CVSup. If one sets
14251 @code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
14252 the local repository, the revision numbers will look
14253 like 1.66.1000.xx. There is almost a dead-set certainty
14254 that there will be no conflicts with version numbers.
14255
14256 @cindex COMSPEC, environment variable
14257 @item $COMSPEC
14258 Used under OS/2 only.  It specifies the name of the
14259 command interpreter and defaults to @sc{cmd.exe}.
14260
14261 @cindex TMPDIR, environment variable
14262 @item $TMPDIR
14263 @cindex TMP, environment variable
14264 @itemx $TMP
14265 @cindex TEMP, environment variable
14266 @itemx $TEMP
14267 @cindex Temporary files, location of
14268 @c This is quite nuts.  We don't talk about tempnam
14269 @c or mkstemp which we sometimes use.  The discussion
14270 @c of "Global options" is semi-incoherent.
14271 @c I'm not even sure those are the only inaccuracies.
14272 @c Furthermore, the conventions are
14273 @c pretty crazy and they should be simplified.
14274 Directory in which temporary files are located.
14275 The @sc{cvs} server uses
14276 @code{TMPDIR}.  @xref{Global options}, for a
14277 description of how to specify this.
14278 Some parts of @sc{cvs} will always use @file{/tmp} (via
14279 the @code{tmpnam} function provided by the system).
14280
14281 On Windows NT, @code{TMP} is used (via the @code{_tempnam}
14282 function provided by the system).
14283
14284 The @code{patch} program which is used by the @sc{cvs}
14285 client uses @code{TMPDIR}, and if it is not set, uses
14286 @file{/tmp} (at least with GNU patch 2.1).  Note that
14287 if your server and client are both running @sc{cvs}
14288 1.9.10 or later, @sc{cvs} will not invoke an external
14289 @code{patch} program.
14290
14291 @cindex CVS_PID, environment variable
14292 @item $CVS_PID
14293 This is the process identification (aka pid) number of
14294 the @sc{cvs} process. It is often useful in the
14295 programs and/or scripts specified by the
14296 @file{commitinfo}, @file{verifymsg}, @file{loginfo}
14297 files.
14298 @end table
14299
14300 @node Compatibility
14301 @appendix Compatibility between CVS Versions
14302
14303 @cindex CVS, versions of
14304 @cindex Versions, of CVS
14305 @cindex Compatibility, between CVS versions
14306 @c We don't mention versions older than CVS 1.3
14307 @c on the theory that it would clutter it up for the vast
14308 @c majority of people, who don't have anything that old.
14309 @c
14310 The repository format is compatible going back to
14311 @sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
14312 you have copies of @sc{cvs} 1.6 or older and you want
14313 to use the optional developer communication features.
14314 @c If you "cvs rm" and commit using 1.3, then you'll
14315 @c want to run "rcs -sdead <file,v>" on each of the
14316 @c files in the Attic if you then want 1.5 and
14317 @c later to recognize those files as dead (I think the
14318 @c symptom if this is not done is that files reappear
14319 @c in joins).  (Wait: the above will work but really to
14320 @c be strictly correct we should suggest checking
14321 @c in a new revision rather than just changing the
14322 @c state of the head revision, shouldn't we?).
14323 @c The old convert.sh script was for this, but it never
14324 @c did get updated to reflect use of the RCS "dead"
14325 @c state.
14326 @c Note: this is tricky to document without confusing
14327 @c people--need to carefully say what CVS version we
14328 @c are talking about and keep in mind the distinction
14329 @c between a
14330 @c repository created with 1.3 and on which one now
14331 @c uses 1.5+, and a repository on which one wants to
14332 @c use both versions side by side (e.g. during a
14333 @c transition period).
14334 @c Wait, can't CVS just detect the case in which a file
14335 @c is in the Attic but the head revision is not dead?
14336 @c Not sure whether this should produce a warning or
14337 @c something, and probably needs further thought, but
14338 @c it would appear that the situation can be detected.
14339 @c
14340 @c We might want to separate out the 1.3 compatibility
14341 @c section (for repository & working directory) from the
14342 @c rest--that might help avoid confusing people who
14343 @c are upgrading (for example) from 1.6 to 1.8.
14344 @c
14345 @c A minor incompatibility is if a current version of CVS
14346 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
14347 @c see this as if there is no tag.  Seems to me this is
14348 @c too obscure to mention.
14349
14350 The working directory format is compatible going back
14351 to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
14352 and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
14353 a working directory checked out with @sc{cvs} 1.3,
14354 @sc{cvs} will convert it, but to go back to @sc{cvs}
14355 1.3 you need to check out a new working directory with
14356 @sc{cvs} 1.3.
14357
14358 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
14359 further (1.5 was the first official release with the remote protocol,
14360 but some older versions might still be floating around).  In many
14361 cases you need to upgrade both the client and the server to take
14362 advantage of new features and bug fixes, however.
14363
14364 @c Perhaps should be saying something here about the
14365 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
14366 @c older don't use them).  These are supposed to be
14367 @c compatible in both directions, but I'm not sure
14368 @c they quite are 100%.  One common gripe is if you
14369 @c "rm -r" a directory and 1.9 gets confused, as it
14370 @c still sees it in Entries.  That one is fixed in
14371 @c (say) 1.9.6.  Someone else reported problems with
14372 @c starting with a directory which was checked out with
14373 @c an old version, and then using a new version, and
14374 @c some "D" lines appeared, but not for every
14375 @c directory, causing some directories to be skipped.
14376 @c They weren't sure how to reproduce this, though.
14377
14378 @c ---------------------------------------------------------------------
14379 @node Troubleshooting
14380 @appendix Troubleshooting
14381
14382 If you are having trouble with @sc{cvs}, this appendix
14383 may help.  If there is a particular error message which
14384 you are seeing, then you can look up the message
14385 alphabetically.  If not, you can look through the
14386 section on other problems to see if your problem is
14387 mentioned there.
14388
14389 @menu
14390 * Error messages::              Partial list of CVS errors
14391 * Connection::                  Trouble making a connection to a CVS server
14392 * Other problems::              Problems not readily listed by error message
14393 @end menu
14394
14395 @ignore
14396 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14397 @c @node Bad administrative files
14398 @appendixsec Bad administrative files
14399
14400 @c -- Give hints on how to fix them
14401 @end ignore
14402
14403 @node Error messages
14404 @appendixsec Partial list of error messages
14405
14406 Here is a partial list of error messages that you may
14407 see from @sc{cvs}.  It is not a complete list---@sc{cvs}
14408 is capable of printing many, many error messages, often
14409 with parts of them supplied by the operating system,
14410 but the intention is to list the common and/or
14411 potentially confusing error messages.
14412
14413 The messages are alphabetical, but introductory text
14414 such as @samp{cvs update: } is not considered in
14415 ordering them.
14416
14417 In some cases the list includes messages printed by old
14418 versions of @sc{cvs} (partly because users may not be
14419 sure which version of @sc{cvs} they are using at any
14420 particular moment).
14421 @c If we want to start retiring messages, perhaps we
14422 @c should pick a cutoff version (for example, no more
14423 @c messages which are specific to versions before 1.9)
14424 @c and then move the old messages to an "old messages"
14425 @c node rather than deleting them completely.
14426
14427 @table @code
14428 @c FIXME: What is the correct way to format a multiline
14429 @c error message here?  Maybe @table is the wrong
14430 @c choice?  Texinfo gurus?
14431 @item @var{file}:@var{line}: Assertion '@var{text}' failed
14432 The exact format of this message may vary depending on
14433 your system.  It indicates a bug in @sc{cvs}, which can
14434 be handled as described in @ref{BUGS}.
14435
14436 @item cvs @var{command}: authorization failed: server @var{host} rejected access
14437 This is a generic response when trying to connect to a
14438 pserver server which chooses not to provide a
14439 specific reason for denying authorization.  Check that
14440 the username and password specified are correct and
14441 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
14442 in @file{inetd.conf}.  See @ref{Password authenticated}.
14443
14444 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
14445 This message indicates that you removed a file, and
14446 someone else modified it.  To resolve the conflict,
14447 first run @samp{cvs add @var{file}}.  If desired, look
14448 at the other party's modification to decide whether you
14449 still want to remove it.  If you don't want to remove
14450 it, stop here.  If you do want to remove it, proceed
14451 with @samp{cvs remove @var{file}} and commit your
14452 removal.
14453 @c Tests conflicts2-142b* in sanity.sh test for this.
14454
14455 @item cannot change permissions on temporary directory
14456 @example
14457 Operation not permitted
14458 @end example
14459 This message has been happening in a non-reproducible,
14460 occasional way when we run the client/server testsuite,
14461 both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
14462 able to figure out what causes it, nor is it known
14463 whether it is specific to Linux (or even to this
14464 particular machine!).  If the problem does occur on
14465 other unices, @samp{Operation not permitted} would be
14466 likely to read @samp{Not owner} or whatever the system
14467 in question uses for the unix @code{EPERM} error.  If
14468 you have any information to add, please let us know as
14469 described in @ref{BUGS}.  If you experience this error
14470 while using @sc{cvs}, retrying the operation which
14471 produced it should work fine.
14472 @c This has been seen in a variety of tests, including
14473 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
14474 @c so it doesn't seem particularly specific to any one
14475 @c test.
14476
14477 @item cvs [server aborted]: Cannot check out files into the repository itself
14478 The obvious cause for this message (especially for
14479 non-client/server @sc{cvs}) is that the @sc{cvs} root
14480 is, for example, @file{/usr/local/cvsroot} and you try
14481 to check out files when you are in a subdirectory, such
14482 as @file{/usr/local/cvsroot/test}.  However, there is a
14483 more subtle cause, which is that the temporary
14484 directory on the server is set to a subdirectory of the
14485 root (which is also not allowed).  If this is the
14486 problem, set the temporary directory to somewhere else,
14487 for example @file{/var/tmp}; see @code{TMPDIR} in
14488 @ref{Environment variables}, for how to set the
14489 temporary directory.
14490
14491 @item cannot commit files as 'root'
14492 See @samp{'root' is not allowed to commit files}.
14493
14494 @c For one example see basica-1a10 in the testsuite
14495 @c For another example, "cvs co ." on NT; see comment
14496 @c at windows-NT/filesubr.c (expand_wild).
14497 @c For another example, "cvs co foo/bar" where foo exists.
14498 @item cannot open CVS/Entries for reading: No such file or directory
14499 This generally indicates a @sc{cvs} internal error, and
14500 can be handled as with other @sc{cvs} bugs
14501 (@pxref{BUGS}).  Usually there is a workaround---the
14502 exact nature of which would depend on the situation but
14503 which hopefully could be figured out.
14504
14505 @c This is more obscure than it might sound; it only
14506 @c happens if you run "cvs init" from a directory which
14507 @c contains a CVS/Root file at the start.
14508 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
14509 This message is harmless.  Provided it is not
14510 accompanied by other errors, the operation has
14511 completed successfully.  This message should not occur
14512 with current versions of @sc{cvs}, but it is documented
14513 here for the benefit of @sc{cvs} 1.9 and older.
14514
14515 @item cvs server: cannot open /root/.cvsignore: Permission denied
14516 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
14517 See @ref{Connection}.
14518
14519 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
14520 This message has been reported as intermittently
14521 happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
14522 unknown; if you know more about what causes it, let us
14523 know as described in @ref{BUGS}.
14524
14525 @item cvs [@var{command} aborted]: cannot start server via rcmd
14526 This, unfortunately, is a rather nonspecific error
14527 message which @sc{cvs} 1.9 will print if you are
14528 running the @sc{cvs} client and it is having trouble
14529 connecting to the server.  Current versions of @sc{cvs}
14530 should print a much more specific error message.  If
14531 you get this message when you didn't mean to run the
14532 client at all, you probably forgot to specify
14533 @code{:local:}, as described in @ref{Repository}.
14534
14535 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
14536 @sc{cvs} 1.9 and older will print this message
14537 when trying to check in a binary file if
14538 @sc{rcs} is not correctly installed.  Re-read the
14539 instructions that came with your @sc{rcs} distribution
14540 and the @sc{install} file in the @sc{cvs}
14541 distribution.  Alternately, upgrade to a current
14542 version of @sc{cvs}, which checks in files itself
14543 rather than via @sc{rcs}.
14544
14545 @item cvs checkout: could not check out @var{file}
14546 With @sc{cvs} 1.9, this can mean that the @code{co} program
14547 (part of @sc{rcs}) returned a failure.  It should be
14548 preceded by another error message, however it has been
14549 observed without another error message and the cause is
14550 not well-understood.  With the current version of @sc{cvs},
14551 which does not run @code{co}, if this message occurs
14552 without another error message, it is definitely a @sc{cvs}
14553 bug (@pxref{BUGS}).
14554 @c My current suspicion is that the RCS in the rcs (not
14555 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
14556 @c CD is bad (remains to be confirmed).
14557 @c There is also a report of something which looks
14558 @c very similar on SGI, Irix 5.2, so I dunno.
14559
14560 @item cvs [login aborted]: could not find out home directory
14561 This means that you need to set the environment
14562 variables that @sc{cvs} uses to locate your home directory.
14563 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
14564 @ref{Environment variables}.
14565
14566 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
14567 @sc{cvs} 1.9 and older will print this message if there was
14568 a problem finding the @code{rcsmerge} program.  Make
14569 sure that it is in your @code{PATH}, or upgrade to a
14570 current version of @sc{cvs}, which does not require
14571 an external @code{rcsmerge} program.
14572
14573 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
14574 This means that there was a problem finding the
14575 @code{patch} program.  Make sure that it is in your
14576 @code{PATH}.  Note that despite appearances the message
14577 is @emph{not} referring to whether it can find @var{file}.
14578 If both the client and the server are running a current
14579 version of @sc{cvs}, then there is no need for an
14580 external patch program and you should not see this
14581 message.  But if either client or server is running
14582 @sc{cvs} 1.9, then you need @code{patch}.
14583
14584 @item cvs update: could not patch @var{file}; will refetch
14585 This means that for whatever reason the client was
14586 unable to apply a patch that the server sent.  The
14587 message is nothing to be concerned about, because
14588 inability to apply the patch only slows things down and
14589 has no effect on what @sc{cvs} does.
14590 @c xref to update output.  Or File status?
14591 @c Or some place else that
14592 @c explains this whole "patch"/P/Needs Patch thing?
14593
14594 @item dying gasps from @var{server} unexpected
14595 There is a known bug in the server for @sc{cvs} 1.9.18
14596 and older which can cause this.  For me, this was
14597 reproducible if I used the @samp{-t} global option.  It
14598 was fixed by Andy Piper's 14 Nov 1997 change to
14599 src/filesubr.c, if anyone is curious.
14600 If you see the message,
14601 you probably can just retry the operation which failed,
14602 or if you have discovered information concerning its
14603 cause, please let us know as described in @ref{BUGS}.
14604
14605 @item end of file from server (consult above messages if any)
14606 The most common cause for this message is if you are
14607 using an external @code{rsh} program and it exited with
14608 an error.  In this case the @code{rsh} program should
14609 have printed a message, which will appear before the
14610 above message.  For more information on setting up a
14611 @sc{cvs} client and server, see @ref{Remote repositories}.
14612
14613 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
14614 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
14615 This means that there is a syntax error in the given
14616 @sc{rcs} file.  Note that this might be true even if @sc{rcs} can
14617 read the file OK; @sc{cvs} does more error checking of
14618 errors in the RCS file.  That is why you may see this
14619 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
14620 1.10.  The likely cause for the original corruption is
14621 hardware, the operating system, or the like.  Of
14622 course, if you find a case in which @sc{cvs} seems to
14623 corrupting the file, by all means report it,
14624 (@pxref{BUGS}).
14625 There are quite a few variations of this error message,
14626 depending on exactly where in the @sc{rcs} file @sc{cvs}
14627 finds the syntax error.
14628
14629 @cindex mkmodules
14630 @item cvs commit: Executing 'mkmodules'
14631 This means that your repository is set up for a version
14632 of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
14633 1.8 or later, the above message will be preceded by
14634
14635 @example
14636 cvs commit: Rebuilding administrative file database
14637 @end example
14638
14639 If you see both messages, the database is being rebuilt
14640 twice, which is unnecessary but harmless.  If you wish
14641 to avoid the duplication, and you have no versions of
14642 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
14643 every place it appears in your @code{modules}
14644 file.  For more information on the @code{modules} file,
14645 see @ref{modules}.
14646
14647 @c This message comes from "co", and I believe is
14648 @c possible only with older versions of CVS which call
14649 @c co.  The problem with being able to create the bogus
14650 @c RCS file still exists, though (and I think maybe
14651 @c there is a different symptom(s) now).
14652 @c FIXME: Would be nice to have a more exact wording
14653 @c for this message.
14654 @item missing author
14655 Typically this can happen if you created an RCS file
14656 with your username set to empty.  @sc{cvs} will, bogusly,
14657 create an illegal RCS file with no value for the author
14658 field.  The solution is to make sure your username is
14659 set to a non-empty value and re-create the RCS file.
14660 @c "make sure your username is set" is complicated in
14661 @c and of itself, as there are the environment
14662 @c variables the system login name, &c, and it depends
14663 @c on the version of CVS.
14664
14665 @item cvs [checkout aborted]: no such tag @var{tag}
14666 This message means that @sc{cvs} isn't familiar with
14667 the tag @var{tag}.  Usually this means that you have
14668 mistyped a tag name; however there are (relatively
14669 obscure) cases in which @sc{cvs} will require you to
14670 @c Search sanity.sh for "no such tag" to see some of
14671 @c the relatively obscure cases.
14672 try a few other @sc{cvs} commands involving that tag,
14673 before you find one which will cause @sc{cvs} to update
14674 @cindex CVSROOT/val-tags file, forcing tags into
14675 @cindex val-tags file, forcing tags into
14676 the @file{val-tags} file; see discussion of val-tags in
14677 @ref{File permissions}.  You only need to worry about
14678 this once for a given tag; when a tag is listed in
14679 @file{val-tags}, it stays there.  Note that using
14680 @samp{-f} to not require tag matches does not override
14681 this check; see @ref{Common options}.
14682
14683 @item *PANIC* administration files missing
14684 This typically means that there is a directory named
14685 @sc{cvs} but it does not contain the administrative files
14686 which @sc{cvs} puts in a CVS directory.  If the problem is
14687 that you created a CVS directory via some mechanism
14688 other than @sc{cvs}, then the answer is simple, use a name
14689 other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
14690 (@pxref{BUGS}).
14691
14692 @item rcs error: Unknown option: -x,v/
14693 This message will be followed by a usage message for
14694 @sc{rcs}.  It means that you have an old version of
14695 @sc{rcs} (probably supplied with your operating
14696 system), as well as an old version of @sc{cvs}.
14697 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
14698 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
14699 @c For more information on installing @sc{cvs}, see
14700 @c (FIXME: where?  it depends on whether you are
14701 @c getting binaries or sources or what).
14702 @c The message can also say "ci error" or something
14703 @c instead of "rcs error", I suspect.
14704
14705 @item cvs [server aborted]: received broken pipe signal
14706 This message can be caused by a loginfo program that fails to
14707 read all of the log information from its standard input.
14708 If you find it happening in any other circumstances,
14709 please let us know as described in @ref{BUGS}.
14710
14711 @item 'root' is not allowed to commit files
14712 When committing a permanent change, @sc{cvs} makes a log entry of
14713 who committed the change.  If you are committing the change logged
14714 in as "root" (not under "su" or other root-priv giving program),
14715 @sc{cvs} cannot determine who is actually making the change.
14716 As such, by default, @sc{cvs} disallows changes to be committed by users
14717 logged in as "root".  (You can disable this option by passing the
14718 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
14719 On some systems this means editing the appropriate @file{config.h} file
14720 before building @sc{cvs}.)
14721
14722 @item Too many arguments!
14723 This message is typically printed by the @file{log.pl}
14724 script which is in the @file{contrib} directory in the
14725 @sc{cvs} source distribution.  In some versions of
14726 @sc{cvs}, @file{log.pl} has been part of the default
14727 @sc{cvs} installation.  The @file{log.pl} script gets
14728 called from the @file{loginfo} administrative file.
14729 Check that the arguments passed in @file{loginfo} match
14730 what your version of @file{log.pl} expects.  In
14731 particular, the @file{log.pl} from @sc{cvs} 1.3 and
14732 older expects the log file as an argument whereas the
14733 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
14734 log file to be specified with a @samp{-f} option.  Of
14735 course, if you don't need @file{log.pl} you can just
14736 comment it out of @file{loginfo}.
14737
14738 @item cvs [update aborted]: unexpected EOF reading @var{file},v
14739 See @samp{EOF in key in RCS file}.
14740
14741 @item cvs [login aborted]: unrecognized auth response from @var{server}
14742 This message typically means that the server is not set
14743 up properly.  For example, if @file{inetd.conf} points
14744 to a nonexistent cvs executable.  To debug it further,
14745 find the log file which inetd writes
14746 (@file{/var/log/messages} or whatever inetd uses on
14747 your system).  For details, see @ref{Connection}, and
14748 @ref{Password authentication server}.
14749
14750 @item cvs commit: Up-to-date check failed for `@var{file}'
14751 This means that someone else has committed a change to
14752 that file since the last time that you did a @code{cvs
14753 update}.  So before proceeding with your @code{cvs
14754 commit} you need to @code{cvs update}.  @sc{cvs} will merge
14755 the changes that you made and the changes that the
14756 other person made.  If it does not detect any conflicts
14757 it will report @samp{M @var{file}} and you are ready
14758 to @code{cvs commit}.  If it detects conflicts it will
14759 print a message saying so, will report @samp{C @var{file}},
14760 and you need to manually resolve the
14761 conflict.  For more details on this process see
14762 @ref{Conflicts example}.
14763
14764 @item Usage:    diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
14765 @example
14766 Only one of [exEX3] allowed
14767 @end example
14768 This indicates a problem with the installation of
14769 @code{diff3} and @code{rcsmerge}.  Specifically
14770 @code{rcsmerge} was compiled to look for GNU diff3, but
14771 it is finding unix diff3 instead.  The exact text of
14772 the message will vary depending on the system.  The
14773 simplest solution is to upgrade to a current version of
14774 @sc{cvs}, which does not rely on external
14775 @code{rcsmerge} or @code{diff3} programs.
14776
14777 @item warning: unrecognized response `@var{text}' from cvs server
14778 If @var{text} contains a valid response (such as
14779 @samp{ok}) followed by an extra carriage return
14780 character (on many systems this will cause the second
14781 part of the message to overwrite the first part), then
14782 it probably means that you are using the @samp{:ext:}
14783 access method with a version of rsh, such as most
14784 non-unix rsh versions, which does not by default
14785 provide a transparent data stream.  In such cases you
14786 probably want to try @samp{:server:} instead of
14787 @samp{:ext:}.  If @var{text} is something else, this
14788 may signify a problem with your @sc{cvs} server.
14789 Double-check your installation against the instructions
14790 for setting up the @sc{cvs} server.
14791 @c FIXCVS: should be printing CR as \r or \015 or some
14792 @c such, probably.
14793
14794 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
14795 This is a normal message, not an error.  See
14796 @ref{Concurrency}, for more details.
14797
14798 @item cvs commit: warning: editor session failed
14799 @cindex Exit status, of editor
14800 This means that the editor which @sc{cvs} is using exits with a nonzero
14801 exit status.  Some versions of vi will do this even when there was not
14802 a problem editing the file.  If so, point the
14803 @code{CVSEDITOR} environment variable to a small script
14804 such as:
14805
14806 @example
14807 #!/bin/sh
14808 vi $*
14809 exit 0
14810 @end example
14811
14812 @c "warning: foo was lost" and "no longer pertinent" (both normal).
14813 @c Would be nice to write these up--they are
14814 @c potentially confusing for the new user.
14815 @end table
14816
14817 @node Connection
14818 @appendixsec Trouble making a connection to a CVS server
14819
14820 This section concerns what to do if you are having
14821 trouble making a connection to a @sc{cvs} server.  If
14822 you are running the @sc{cvs} command line client
14823 running on Windows, first upgrade the client to
14824 @sc{cvs} 1.9.12 or later.  The error reporting in
14825 earlier versions provided much less information about
14826 what the problem was.  If the client is non-Windows,
14827 @sc{cvs} 1.9 should be fine.
14828
14829 If the error messages are not sufficient to track down
14830 the problem, the next steps depend largely on which
14831 access method you are using.
14832
14833 @table @code
14834 @cindex :ext:, troubleshooting
14835 @item :ext:
14836 Try running the rsh program from the command line.  For
14837 example: "rsh servername cvs -v" should print @sc{cvs}
14838 version information.  If this doesn't work, you need to
14839 fix it before you can worry about @sc{cvs} problems.
14840
14841 @cindex :server:, troubleshooting
14842 @item :server:
14843 You don't need a command line rsh program to use this
14844 access method, but if you have an rsh program around,
14845 it may be useful as a debugging tool.  Follow the
14846 directions given for :ext:.
14847
14848 @cindex :pserver:, troubleshooting
14849 @item :pserver:
14850 Errors along the lines of "connection refused" typically indicate
14851 that inetd isn't even listening for connections on port 2401
14852 whereas errors like "connection reset by peer",
14853 "received broken pipe signal", "recv() from server: EOF",
14854 or "end of file from server"
14855 typically indicate that inetd is listening for
14856 connections but is unable to start @sc{cvs} (this is frequently
14857 caused by having an incorrect path in @file{inetd.conf}
14858 or by firewall software rejecting the connection).
14859 "unrecognized auth response" errors are caused by a bad command
14860 line in @file{inetd.conf}, typically an invalid option or forgetting
14861 to put the @samp{pserver} command at the end of the line.
14862 Another less common problem is invisible control characters that
14863 your editor "helpfully" added without you noticing.
14864
14865 One good debugging tool is to "telnet servername
14866 2401".  After connecting, send any text (for example
14867 "foo" followed by return).  If @sc{cvs} is working
14868 correctly, it will respond with
14869
14870 @example
14871 cvs [pserver aborted]: bad auth protocol start: foo
14872 @end example
14873
14874 If instead you get:
14875
14876 @example
14877 Usage: cvs [cvs-options] command [command-options-and-arguments]
14878 ...
14879 @end example
14880
14881 @noindent
14882 then you're missing the @samp{pserver} command at the end of the
14883 line in @file{inetd.conf}; check to make sure that the entire command
14884 is on one line and that it's complete.
14885
14886 Likewise, if you get something like:
14887
14888 @example
14889 Unknown command: `pserved'
14890
14891 CVS commands are:
14892         add          Add a new file/directory to the repository
14893 ...
14894 @end example
14895
14896 @noindent
14897 then you've misspelled @samp{pserver} in some way.  If it isn't
14898 obvious, check for invisible control characters (particularly
14899 carriage returns) in @file{inetd.conf}.
14900
14901 If it fails to work at all, then make sure inetd is working
14902 right.  Change the invocation in @file{inetd.conf} to run the
14903 echo program instead of cvs.  For example:
14904
14905 @example
14906 2401  stream  tcp  nowait  root /bin/echo echo hello
14907 @end example
14908
14909 After making that change and instructing inetd to
14910 re-read its configuration file, "telnet servername
14911 2401" should show you the text hello and then the
14912 server should close the connection.  If this doesn't
14913 work, you need to fix it before you can worry about
14914 @sc{cvs} problems.
14915
14916 On AIX systems, the system will often have its own
14917 program trying to use port 2401.  This is AIX's problem
14918 in the sense that port 2401 is registered for use with
14919 @sc{cvs}.  I hear that there is an AIX patch available
14920 to address this problem.
14921
14922 Another good debugging tool is the @samp{-d}
14923 (debugging) option to inetd.  Consult your system
14924 documentation for more information.
14925
14926 If you seem to be connecting but get errors like:
14927
14928 @example
14929 cvs server: cannot open /root/.cvsignore: Permission denied
14930 cvs [server aborted]: can't chdir(/root): Permission denied
14931 @end example
14932
14933 @noindent
14934 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
14935 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
14936 your system setting the @code{$HOME} environment variable
14937 for programs being run by inetd.  In this case, you can either
14938 have inetd run a shell script that unsets @code{$HOME} and then runs
14939 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
14940 environment.)
14941
14942 If you can connect successfully for a while but then can't,
14943 you've probably hit inetd's rate limit.
14944 (If inetd receives too many requests for the same service
14945 in a short period of time, it assumes that something is wrong
14946 and temporarily disables the service.)
14947 Check your inetd documentation to find out how to adjust the
14948 rate limit (some versions of inetd have a single rate limit,
14949 others allow you to set the limit for each service separately.)
14950 @end table
14951
14952 @node Other problems
14953 @appendixsec Other common problems
14954
14955 Here is a list of problems which do not fit into the
14956 above categories.  They are in no particular order.
14957
14958 @itemize @bullet
14959 @item
14960 On Windows, if there is a 30 second or so delay when
14961 you run a @sc{cvs} command, it may mean that you have
14962 your home directory set to @file{C:/}, for example (see
14963 @code{HOMEDRIVE} and @code{HOMEPATH} in
14964 @ref{Environment variables}).  @sc{cvs} expects the home
14965 directory to not end in a slash, for example @file{C:}
14966 or @file{C:\cvs}.
14967 @c FIXCVS: CVS should at least detect this and print an
14968 @c error, presumably.
14969
14970 @item
14971 If you are running @sc{cvs} 1.9.18 or older, and
14972 @code{cvs update} finds a conflict and tries to
14973 merge, as described in @ref{Conflicts example}, but
14974 doesn't tell you there were conflicts, then you may
14975 have an old version of @sc{rcs}.  The easiest solution
14976 probably is to upgrade to a current version of
14977 @sc{cvs}, which does not rely on external @sc{rcs}
14978 programs.
14979 @end itemize
14980
14981 @c ---------------------------------------------------------------------
14982 @node Credits
14983 @appendix Credits
14984
14985 @cindex Contributors (manual)
14986 @cindex Credits (manual)
14987 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
14988 wrote the manual pages which were distributed with
14989 @sc{cvs} 1.3.  Much of their text was copied into this
14990 manual.  He also read an early draft
14991 of this manual and contributed many ideas and
14992 corrections.
14993
14994 The mailing-list @code{info-cvs} is sometimes
14995 informative. I have included information from postings
14996 made by the following persons:
14997 David G. Grubbs <@t{dgg@@think.com}>.
14998
14999 Some text has been extracted from the man pages for
15000 @sc{rcs}.
15001
15002 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
15003 useful material.  The @sc{faq} is no longer maintained,
15004 however, and this manual is about the closest thing there
15005 is to a successor (with respect to documenting how to
15006 use @sc{cvs}, at least).
15007
15008 In addition, the following persons have helped by
15009 telling me about mistakes I've made:
15010
15011 @display
15012 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
15013 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
15014 Karl Pingle <@t{pingle@@acuson.com}>,
15015 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
15016 Inge Wallin <@t{ingwa@@signum.se}>,
15017 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
15018 and Michael Brown <@t{brown@@wi.extrel.com}>.
15019 @end display
15020
15021 The list of contributors here is not comprehensive; for a more
15022 complete list of who has contributed to this manual see
15023 the file @file{doc/ChangeLog} in the @sc{cvs} source
15024 distribution.
15025
15026 @c ---------------------------------------------------------------------
15027 @node BUGS
15028 @appendix Dealing with bugs in CVS or this manual
15029
15030 @cindex Bugs in this manual or CVS
15031 Neither @sc{cvs} nor this manual is perfect, and they
15032 probably never will be.  If you are having trouble
15033 using @sc{cvs}, or think you have found a bug, there
15034 are a number of things you can do about it.  Note that
15035 if the manual is unclear, that can be considered a bug
15036 in the manual, so these problems are often worth doing
15037 something about as well as problems with @sc{cvs} itself.
15038
15039 @cindex Reporting bugs
15040 @cindex Bugs, reporting
15041 @cindex Errors, reporting
15042 @itemize @bullet
15043 @item
15044 If you want someone to help you and fix bugs that you
15045 report, there are companies which will do that for a
15046 fee.  One such company is:
15047
15048 @cindex Ximbiot
15049 @cindex Support, getting CVS support
15050 @example
15051 Ximbiot
15052 319 S. River St.
15053 Harrisburg, PA  17104-1657
15054 USA
15055 Email: info@@ximbiot.com
15056 Phone: (717) 579-6168
15057 Fax:   (717) 234-3125
15058 @url{http://ximbiot.com/}
15059
15060 @end example
15061
15062 @item
15063 If you got @sc{cvs} through a distributor, such as an
15064 operating system vendor or a vendor of freeware
15065 @sc{cd-rom}s, you may wish to see whether the
15066 distributor provides support.  Often, they will provide
15067 no support or minimal support, but this may vary from
15068 distributor to distributor.
15069
15070 @item
15071 If you have the skills and time to do so, you may wish
15072 to fix the bug yourself.  If you wish to submit your
15073 fix for inclusion in future releases of @sc{cvs}, see
15074 the file @sc{hacking} in the @sc{cvs} source
15075 distribution.  It contains much more information on the
15076 process of submitting fixes.
15077
15078 @item
15079 There may be resources on the net which can help.  Two
15080 good places to start are:
15081
15082 @example
15083 @url{http://www.cvshome.org}
15084 @url{http://www.loria.fr/~molli/cvs-index.html}
15085 @end example
15086
15087 If you are so inspired, increasing the information
15088 available on the net is likely to be appreciated.  For
15089 example, before the standard @sc{cvs} distribution
15090 worked on Windows 95, there was a web page with some
15091 explanation and patches for running @sc{cvs} on Windows
15092 95, and various people helped out by mentioning this
15093 page on mailing lists or newsgroups when the subject
15094 came up.
15095
15096 @item
15097 It is also possible to report bugs to @email{bug-cvs@@gnu.org}.
15098 Note that someone may or may not want to do anything
15099 with your bug report---if you need a solution consider
15100 one of the options mentioned above.  People probably do
15101 want to hear about bugs which are particularly severe
15102 in consequences and/or easy to fix, however.  You can
15103 also increase your odds by being as clear as possible
15104 about the exact nature of the bug and any other
15105 relevant information.  The way to report bugs is to
15106 send email to @email{bug-cvs@@gnu.org}.  Note
15107 that submissions to @email{bug-cvs@@gnu.org} may be distributed
15108 under the terms of the @sc{gnu} Public License, so if
15109 you don't like this, don't submit them.  There is
15110 usually no justification for sending mail directly to
15111 one of the @sc{cvs} maintainers rather than to
15112 @email{bug-cvs@@gnu.org}; those maintainers who want to hear
15113 about such bug reports read @email{bug-cvs@@gnu.org}.  Also note
15114 that sending a bug report to other mailing lists or
15115 newsgroups is @emph{not} a substitute for sending it to
15116 @email{bug-cvs@@gnu.org}.  It is fine to discuss @sc{cvs} bugs on
15117 whatever forum you prefer, but there are not
15118 necessarily any maintainers reading bug reports sent
15119 anywhere except @email{bug-cvs@@gnu.org}.
15120 @end itemize
15121
15122 @cindex Known bugs in this manual or CVS
15123 People often ask if there is a list of known bugs or
15124 whether a particular bug is a known one.  The file
15125 @sc{bugs} in the @sc{cvs} source distribution is one
15126 list of known bugs, but it doesn't necessarily try to
15127 be comprehensive.  Perhaps there will never be a
15128 comprehensive, detailed list of known bugs.
15129
15130 @c ---------------------------------------------------------------------
15131 @node Index
15132 @unnumbered Index
15133 @cindex Index
15134
15135 @printindex cp
15136
15137 @summarycontents
15138
15139 @contents
15140
15141 @bye
15142 \f
15143 Local Variables:
15144 fill-column: 55
15145 End: