Merge from vendor branch SENDMAIL:
[dragonfly.git] / contrib / cvs-1.12.12 / doc / cvs.texinfo
1 \input texinfo  @c -*-texinfo-*-
2 @comment Documentation for CVS.
3 @setfilename cvs.info
4 @macro copyleftnotice
5 @noindent
6 Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
7                        2001, 2002, 2003, 2004, 2005
8                        Free Software Foundation, Inc.
9
10 @multitable @columnfractions .12 .88
11 @item Portions
12 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005
13                                   Derek R. Price,
14 @item @tab Copyright @copyright{} 2002, 2003, 2004, 2005
15                                   Ximbiot @url{http://ximbiot.com},
16 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
17 @item @tab and Copyright @copyright{} others.
18 @end multitable
19
20 @ignore
21 Permission is granted to process this file through Tex and print the
22 results, provided the printed document carries copying permission
23 notice identical to this one except for the removal of this paragraph
24 (this paragraph not being relevant to the printed manual).
25
26 @end ignore
27 Permission is granted to make and distribute verbatim copies of
28 this manual provided the copyright notice and this permission notice
29 are preserved on all copies.
30
31 Permission is granted to copy and distribute modified versions of this
32 manual under the conditions for verbatim copying, provided also that the
33 entire resulting derived work is distributed under the terms of a
34 permission notice identical to this one.
35
36 Permission is granted to copy and distribute translations of this manual
37 into another language, under the above conditions for modified versions,
38 except that this permission notice may be stated in a translation
39 approved by the Free Software Foundation.
40 @end macro
41
42 @comment This file is part of the CVS distribution.
43
44 @comment CVS is free software; you can redistribute it and/or modify
45 @comment it under the terms of the GNU General Public License as published by
46 @comment the Free Software Foundation; either version 2, or (at your option)
47 @comment any later version.
48
49 @comment CVS is distributed in the hope that it will be useful,
50 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
51 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
52 @comment GNU General Public License for more details.
53
54 @c See ../README for A4 vs. US letter size.
55 @c When we provided A4 postscript, and people tried to
56 @c print it on US letter, the usual complaint was that the
57 @c page numbers would get cut off.
58 @c If one prints US letter on A4, reportedly there is
59 @c some extra space at the top and/or bottom, and the side
60 @c margins are a bit narrow, but no text is lost.
61 @c
62 @c See
63 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
64 @c for more on paper sizes.  Insuring that margins are
65 @c big enough to print on either A4 or US letter does
66 @c indeed seem to be the usual approach (RFC2346).
67
68 @c This document seems to get overfull hboxes with some
69 @c frequency (probably because the tendency is to
70 @c sanity-check it with "make info" and run TeX less
71 @c often).  The big ugly boxes just seem to add insult
72 @c to injury, and I'm not aware of them helping to fix
73 @c the overfull hboxes at all.
74 @finalout
75
76 @include version.texi
77 @settitle CVS---Concurrent Versions System v@value{VERSION}
78 @setchapternewpage odd
79
80 @c -- TODO list:
81 @c -- Fix all lines that match "^@c -- "
82 @c -- Also places marked with FIXME should be manual
83 @c problems (as opposed to FIXCVS for CVS problems).
84
85 @c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
86 @c @asis when generating info and dvi, and by <i></i> in the generated html,
87 @c such that keywords are not expanded in the generated html. 
88 @ifnothtml
89 @macro splitrcskeyword {arg}
90 @asis{}\arg\
91 @end macro
92 @end ifnothtml
93
94 @ifhtml
95 @macro splitrcskeyword {arg}
96 @i{}\arg\
97 @end macro
98 @end ifhtml
99
100 @dircategory GNU Packages
101 @direntry
102 * CVS: (cvs).                   Concurrent Versions System
103 @end direntry
104 @dircategory Individual utilities
105 @direntry
106 * cvs: (cvs)CVS commands.       Concurrent Versions System
107 @end direntry
108
109 @comment The titlepage section does not appear in the Info file.
110 @titlepage
111 @sp 4
112 @comment The title is printed in a large font.
113 @center @titlefont{Version Management}
114 @sp
115 @center @titlefont{with}
116 @sp
117 @center @titlefont{CVS}
118 @sp 2
119 @center for @sc{cvs} @value{VERSION}
120 @comment -release-
121 @sp 3
122 @center Per Cederqvist et al
123
124 @comment  The following two commands start the copyright page
125 @comment  for the printed manual.  This will not appear in the Info file.
126 @page
127 @vskip 0pt plus 1filll
128 @copyleftnotice
129 @end titlepage
130
131 @comment ================================================================
132 @comment                   The real text starts here
133 @comment ================================================================
134
135 @ifnottex
136 @c ---------------------------------------------------------------------
137 @node    Top
138 @top
139
140 This info manual describes how to use and administer
141 @sc{cvs} version @value{VERSION}.
142 @end ifnottex
143
144 @ifinfo
145 @copyleftnotice
146 @end ifinfo
147
148 @c This menu is pretty long.  Not sure how easily that
149 @c can be fixed (no brilliant ideas right away)...
150 @menu
151 * Overview::                    An introduction to CVS
152 * Repository::                  Where all your sources are stored
153 * Starting a new project::      Starting a project with CVS
154 * Revisions::                   Numeric and symbolic names for revisions
155 * Branching and merging::       Diverging/rejoining branches of development
156 * Recursive behavior::          CVS descends directories
157 * Adding and removing::         Adding/removing/renaming files/directories
158 * History browsing::            Viewing the history of files in various ways
159
160 CVS and the Real World.
161 -----------------------
162 * Binary files::                CVS can handle binary files
163 * Multiple developers::         How CVS helps a group of developers
164 * Revision management::         Policy questions for revision management
165 * Keyword substitution::        CVS can include the revision inside the file
166 * Tracking sources::            Tracking third-party sources
167 * Builds::                      Issues related to CVS and builds
168 * Special Files::               Devices, links and other non-regular files
169
170 References.
171 -----------
172 * CVS commands::                CVS commands share some things
173 * Invoking CVS::                Quick reference to CVS commands
174 * Administrative files::        Reference manual for the Administrative files
175 * Environment variables::       All environment variables which affect CVS
176 * Compatibility::               Upgrading CVS versions
177 * Troubleshooting::             Some tips when nothing works
178 * Credits::                     Some of the contributors to this manual
179 * BUGS::                        Dealing with bugs in CVS or this manual
180 * Index::                       Index
181 @end menu
182
183 @c ---------------------------------------------------------------------
184 @node Overview
185 @chapter Overview
186 @cindex Overview
187
188 This chapter is for people who have never used
189 @sc{cvs}, and perhaps have never used version control
190 software before.
191
192 If you are already familiar with @sc{cvs} and are just
193 trying to learn a particular feature or remember a
194 certain command, you can probably skip everything here.
195
196 @menu
197 * What is CVS?::                What you can do with @sc{cvs}
198 * What is CVS not?::            Problems @sc{cvs} doesn't try to solve
199 * A sample session::            A tour of basic @sc{cvs} usage
200 @end menu
201
202 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
203 @node What is CVS?
204 @section What is CVS?
205 @cindex What is CVS?
206 @cindex Introduction to CVS
207 @cindex CVS, introduction to
208
209 @sc{cvs} is a version control system.  Using it, you can
210 record the history of your source files.
211
212 @c -- ///
213 @c -- ///Those who cannot remember the past are condemned to repeat it.
214 @c -- ///               -- George Santayana
215 @c -- //////
216
217 @c -- Insert history  quote here!
218 For example, bugs sometimes creep in when
219 software is modified, and you might not detect the bug
220 until a long time after you make the modification.
221 With @sc{cvs}, you can easily retrieve old versions to see
222 exactly which change caused the bug.  This can
223 sometimes be a big help.
224
225 You could of course save every version of every file
226 you have ever created.  This would
227 however waste an enormous amount of disk space.  @sc{cvs}
228 stores all the versions of a file in a single file in a
229 clever way that only stores the differences between
230 versions.
231
232 @sc{cvs} also helps you if you are part of a group of people working
233 on the same project.  It is all too easy to overwrite
234 each others' changes unless you are extremely careful.
235 Some editors, like @sc{gnu} Emacs, try to make sure that
236 the same file is never modified by two people at the
237 same time.  Unfortunately, if someone is using another
238 editor, that safeguard will not work.  @sc{cvs} solves this problem
239 by insulating the different developers from each other.  Every
240 developer works in his own directory, and @sc{cvs} merges
241 the work when each developer is done.
242
243 @cindex History of CVS
244 @cindex CVS, history of
245 @cindex Credits (CVS program)
246 @cindex Contributors (CVS program)
247 @sc{cvs} started out as a bunch of shell scripts written by
248 Dick Grune, posted to the newsgroup
249 @code{comp.sources.unix} in the volume 6
250 release of July, 1986.  While no actual code from
251 these shell scripts is present in the current version
252 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
253 come from them.
254
255 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
256 Jeff Polk later helped Brian with the design of the @sc{cvs}
257 module and vendor branch support.
258
259 @cindex Source, getting CVS source
260 You can get @sc{cvs} in a variety of ways, including
261 free download from the Internet.  For more information
262 on downloading @sc{cvs} and other @sc{cvs} topics, see:
263
264 @example
265 @url{http://www.cvshome.org/}
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 @c Should we try to explain which platforms are which?
2076 @c Platforms like unix and VMS, which only allow
2077 @c privileged programs to bind to sockets <1024 lose on
2078 @c :server:
2079 @c Platforms like Mac and VMS, whose rsh program is
2080 @c unusable or nonexistent, lose on :ext:
2081 @c Platforms like OS/2 and NT probably could plausibly
2082 @c default either way (modulo -b troubles).
2083
2084 @menu
2085 * Server requirements::         Memory and other resources for servers
2086 * The connection method::       Connection methods and method options
2087 * Connecting via rsh::          Using the @code{rsh} program to connect
2088 * Password authenticated::      Direct connections using passwords
2089 * GSSAPI authenticated::        Direct connections using GSSAPI
2090 * Kerberos authenticated::      Direct connections with Kerberos
2091 * Connecting via fork::         Using a forked @code{cvs server} to connect
2092 * Write proxies::               Distributing load across several CVS servers
2093 @end menu
2094
2095 @node Server requirements
2096 @subsection Server requirements
2097
2098 The quick answer to what sort of machine is suitable as
2099 a server is that requirements are modest---a server
2100 with 32M of memory or even less can handle a fairly
2101 large source tree with a fair amount of activity.
2102 @c Say something about CPU speed too?  I'm even less sure
2103 @c what to say on that subject...
2104
2105 The real answer, of course, is more complicated.
2106 Estimating the known areas of large memory consumption
2107 should be sufficient to estimate memory requirements.
2108 There are two such areas documented here; other memory
2109 consumption should be small by comparison (if you find
2110 that is not the case, let us know, as described in
2111 @ref{BUGS}, so we can update this documentation).
2112
2113 The first area of big memory consumption is large
2114 checkouts, when using the @sc{cvs} server.  The server
2115 consists of two processes for each client that it is
2116 serving.  Memory consumption on the child process
2117 should remain fairly small.  Memory consumption on the
2118 parent process, particularly if the network connection
2119 to the client is slow, can be expected to grow to
2120 slightly more than the size of the sources in a single
2121 directory, or two megabytes, whichever is larger.
2122 @c "two megabytes" of course is SERVER_HI_WATER.  But
2123 @c we don't mention that here because we are
2124 @c documenting the default configuration of CVS.  If it
2125 @c is a "standard" thing to change that value, it
2126 @c should be some kind of run-time configuration.
2127 @c
2128 @c See cvsclient.texi for more on the design decision
2129 @c to not have locks in place while waiting for the
2130 @c client, which is what results in memory consumption
2131 @c as high as this.
2132
2133 Multiplying the size of each @sc{cvs} server by the
2134 number of servers which you expect to have active at
2135 one time should give an idea of memory requirements for
2136 the server.  For the most part, the memory consumed by
2137 the parent process probably can be swap space rather
2138 than physical memory.
2139 @c Has anyone verified that notion about swap space?
2140 @c I say it based pretty much on guessing that the
2141 @c ->text of the struct buffer_data only gets accessed
2142 @c in a first in, first out fashion, but I haven't
2143 @c looked very closely.
2144
2145 @c What about disk usage in /tmp on the server?  I think that
2146 @c it can be substantial, but I haven't looked at this
2147 @c again and tried to figure it out ("cvs import" is
2148 @c probably the worst case...).
2149
2150 The second area of large memory consumption is
2151 @code{diff}, when checking in large files.  This is
2152 required even for binary files.  The rule of thumb is
2153 to allow about ten times the size of the largest file
2154 you will want to check in, although five times may be
2155 adequate.  For example, if you want to check in a file
2156 which is 10 megabytes, you should have 100 megabytes of
2157 memory on the machine doing the checkin (the server
2158 machine for client/server, or the machine running
2159 @sc{cvs} for non-client/server).  This can be swap
2160 space rather than physical memory.  Because the memory
2161 is only required briefly, there is no particular need
2162 to allow memory for more than one such checkin at a
2163 time.
2164 @c The 5-10 times rule of thumb is from Paul Eggert for
2165 @c GNU diff.  I don't think it is in the GNU diff
2166 @c manual or anyplace like that.
2167 @c
2168 @c Probably we could be saying more about
2169 @c non-client/server CVS.
2170 @c I would guess for non-client/server CVS in an NFS
2171 @c environment the biggest issues are the network and
2172 @c the NFS server.
2173
2174 Resource consumption for the client is even more
2175 modest---any machine with enough capacity to run the
2176 operating system in question should have little
2177 trouble.
2178 @c Is that true?  I think the client still wants to
2179 @c (bogusly) store entire files in memory at times.
2180
2181 For information on disk space requirements, see
2182 @ref{Creating a repository}.
2183
2184 @node The connection method
2185 @subsection The connection method
2186
2187 In its simplest form, the @var{method} portion of the repository string
2188 (@pxref{Remote repositories}) may be one of @samp{ext}, @samp{fork},
2189 @samp{gserver}, @samp{kserver}, @samp{local}, @samp{pserver}, and, on some
2190 platforms, @samp{server}.
2191
2192 If @var{method} is not specified, and the repository
2193 name starts with a @samp{/}, then the default is @code{local}.
2194 If @var{method} is not specified, and the repository
2195 name does not start with a @samp{/}, then the default is @code{ext}
2196 or @code{server}, depending on your platform; both the @samp{ext}
2197 and @samp{server} methods are described in @ref{Connecting via rsh}.
2198
2199 @cindex connection method options
2200 @cindex options, connection method
2201 The @code{ext}, @code{fork}, @code{gserver}, and @code{pserver} connection
2202 methods all accept optional method options, specified as part of the
2203 @var{method} string, like so:
2204
2205 @example
2206 :@var{method}[;@var{option}=@var{arg}...]:@var{other_connection_data}
2207 @end example
2208
2209 @sc{cvs} is not sensitive to the case of @var{method} or @var{option}, though
2210 it may sometimes be sensitive to the case of @var{arg}.  The possible method
2211 options are as follows:
2212
2213 @table @code
2214 @cindex CVS_PROXY_PORT
2215 @cindex proxy, method option
2216 @cindex proxyport, method option
2217 @cindex proxies, web, connecting via
2218 @cindex web proxies, connecting via
2219 @cindex proxies, HTTP, connecting via
2220 @cindex HTTP proxies, connecting via
2221 @item proxy=@var{hostname}
2222 @itemx proxyport=@var{port}
2223 These two method options can be used to connect via an HTTP tunnel style web
2224 proxy.  @var{hostname} should be the name of the HTTP proxy server to connect
2225 through and @var{port} is the port number on the HTTP proxy server to connect
2226 via.  @var{port} defaults to 8080.
2227
2228 @strong{NOTE: An HTTP proxy server is not the same as a @sc{cvs} write proxy
2229 server - please see @ref{Write proxies} for more on @sc{cvs} write proxies.}
2230
2231 For example, to connect pserver via a web proxy listening on port 8000 of
2232 www.myproxy.net, you would use a method of:
2233
2234 @example
2235 :pserver;proxy=www.myproxy.net;proxyport=8000:@var{pserver_connection_string}
2236 @end example
2237
2238 @strong{NOTE: In the above example, @var{pserver_connection_string} is still
2239 required to connect and authenticate to the CVS server, as noted in the
2240 upcoming sections on password authentication, @code{gserver}, and
2241 @code{kserver}.  The example above only demonstrates a modification to the
2242 @var{method} portion of the repository name.}
2243
2244 These options first appeared in @sc{cvs} version 1.12.7 and are valid as
2245 modifcations to the @code{gserver} and @code{pserver} connection methods.
2246
2247 @cindex CVS_RSH method option
2248 @item CVS_RSH=@var{path}
2249 This method option can be used with the @code{ext} method to specify the path
2250 the @sc{cvs} client will use to find the remote shell used to contact the
2251 @sc{cvs} server and takes precedence over any path specified in the
2252 @code{$CVS_RSH} environment variable (@pxref{Connecting via rsh}).  For
2253 example, to connect to a @sc{cvs} server via the local
2254 @file{/path/to/ssh/command} command, you could choose to specify the following
2255 @var{path} via the @code{CVS_RSH} method option:
2256
2257 @example
2258 :ext;CVS_RSH=/path/to/ssh/command:@var{ext_connection_string}
2259 @end example
2260
2261 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2262 as a modifcation to the @code{ext} connection method.
2263
2264 @cindex CVS_SERVER method option
2265 @item CVS_SERVER=@var{path}
2266 This method option can be used with the @code{ext} and @code{fork} methods to
2267 specify the path @sc{cvs} will use to find the @sc{cvs} executable on the
2268 @sc{cvs} server and takes precedence over any path specified in the
2269 @code{$CVS_SERVER} environment variable (@pxref{Connecting via rsh}).  For
2270 example, to select the remote @file{/path/to/cvs/command} executable as your
2271 @sc{cvs} server application on the @sc{cvs} server machine, you could choose to
2272 specify the following @var{path} via the @code{CVS_SERVER} method option:
2273
2274 @example
2275 :ext;CVS_SERVER=/path/to/cvs/command:@var{ext_connection_string}
2276 @end example
2277
2278 @noindent
2279 or, to select an executable named @samp{cvs-1.12.11}, assuming it is in your
2280 @code{$PATH} on the @sc{cvs} server:
2281
2282 @example
2283 :ext;CVS_SERVER=cvs-1.12.11:@var{ext_connection_string}
2284 @end example
2285
2286 This method option first appeared in @sc{cvs} version 1.12.11 and is valid
2287 as a modifcation to both the @code{ext} and @code{fork} connection methods.
2288
2289 @cindex Redirect, method option
2290 @item Redirect=@var{boolean-state}
2291 The @code{Redirect} method option determines whether the @sc{cvs} client will
2292 allow a @sc{cvs} server to redirect it to a different @sc{cvs} server, usually
2293 for write requests, as in a write proxy setup.
2294
2295 A @var{boolean-state} of any value acceptable for boolean @file{CVSROOT/config}
2296 file options is acceptable here (@pxref{config}).  For example, @samp{on},
2297 @samp{off}, @samp{true}, and @samp{false} are all valid values for
2298 @var{boolean-state}.  @var{boolean-state} for the @code{Redirect} method option
2299 defaults to @samp{on}.
2300
2301 This option will have no effect when talking to any non-secondary @sc{cvs}
2302 server.  For more on write proxies and secondary servers, please see
2303 @ref{Write proxies}.
2304
2305 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2306 as a modifcation to the @code{ext} connection method.
2307 @end table
2308
2309 As a further example, to combine both the @code{CVS_RSH} and @code{CVS_SERVER}
2310 options, a method specification like the following would work:
2311
2312 @example
2313 :ext;CVS_RSH=/path/to/ssh/command;CVS_SERVER=/path/to/cvs/command:
2314 @end example
2315
2316 This means that you would not need to have
2317 the @code{CVS_SERVER} or @code{CVS_RSH} environment
2318 variables set correctly.  See @ref{Connecting via rsh}, for more details on
2319 these environment variables.
2320
2321 @node Connecting via rsh
2322 @subsection Connecting with rsh
2323
2324 @cindex rsh
2325 @sc{cvs} uses the @samp{rsh} protocol to perform these
2326 operations, so the remote user host needs to have a
2327 @file{.rhosts} file which grants access to the local
2328 user. Note that the program that @sc{cvs} uses for this
2329 purpose may be specified using the @file{--with-rsh}
2330 flag to configure.
2331
2332 For example, suppose you are the user @samp{mozart} on
2333 the local machine @samp{toe.example.com}, and the
2334 server machine is @samp{faun.example.org}.  On
2335 faun, put the following line into the file
2336 @file{.rhosts} in @samp{bach}'s home directory:
2337
2338 @example
2339 toe.example.com  mozart
2340 @end example
2341
2342 @noindent
2343 Then test that @samp{rsh} is working with
2344
2345 @example
2346 rsh -l bach faun.example.org 'echo $PATH'
2347 @end example
2348
2349 @cindex CVS_SERVER, environment variable
2350 Next you have to make sure that @code{rsh} will be able
2351 to find the server.  Make sure that the path which
2352 @code{rsh} printed in the above example includes the
2353 directory containing a program named @code{cvs} which
2354 is the server.  You need to set the path in
2355 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2356 or @file{.profile}.  Alternately, you can set the
2357 environment variable @code{CVS_SERVER} on the client
2358 machine to the filename of the server you want to use,
2359 for example @file{/usr/local/bin/cvs-1.6}.
2360 For the @code{ext} and @code{fork} methods, you may
2361 also specify @var{CVS_SERVER} as an otpion in the
2362 @var{CVSROOT} so that you may use different servers for
2363 differnt roots. See @ref{Remote repositories} for more
2364 details.
2365
2366 There is no need to edit @file{inetd.conf} or start a
2367 @sc{cvs} server daemon.
2368
2369 @cindex :server:, setting up
2370 @cindex :ext:, setting up
2371 @cindex Kerberos, using kerberized rsh
2372 @cindex SSH (rsh replacement)
2373 @cindex rsh replacements (Kerberized, SSH, &c)
2374 There are two access methods that you use in @code{CVSROOT}
2375 for rsh.  @code{:server:} specifies an internal rsh
2376 client, which is supported only by some @sc{cvs} ports.
2377 @code{:ext:} specifies an external rsh program.  By
2378 default this is @code{rsh} (unless otherwise specified
2379 by the @file{--with-rsh} flag to configure) but you may set the
2380 @code{CVS_RSH} environment variable to invoke another
2381 program which can access the remote server (for
2382 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2383 something different).  It must be a program which can
2384 transmit data to and from the server without modifying
2385 it; for example the Windows NT @code{rsh} is not
2386 suitable since it by default translates between CRLF
2387 and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2388 to @code{rsh} to get around this, but since this could
2389 potentially cause problems for programs other than the
2390 standard @code{rsh}, it may change in the future.  If
2391 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2392 replacement, the instructions in the rest of this
2393 section concerning @file{.rhosts} and so on are likely
2394 to be inapplicable; consult the documentation for your rsh
2395 replacement.
2396
2397 You may choose to specify the @var{CVS_RSH} option in
2398 the @var{CVSROOT} to allow you to use different ones
2399 for different roots. For example, allowing some roots
2400 to use @var{CVS_RSH=remsh} and some to use
2401 @var{CVS_RSH=ssh} for the @code{ext} method. See also
2402 the @ref{Remote repositories} for more details.
2403 @c See also the comment in src/client.c for rationale
2404 @c concerning "rsh" being the default and never
2405 @c "remsh".
2406
2407 Continuing our example, supposing you want to access
2408 the module @file{foo} in the repository
2409 @file{/usr/local/cvsroot/}, on machine
2410 @file{faun.example.org}, you are ready to go:
2411
2412 @example
2413 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2414 @end example
2415
2416 @noindent
2417 (The @file{bach@@} can be omitted if the username is
2418 the same on both the local and remote hosts.)
2419
2420 @c Should we mention "rsh host echo hi" and "rsh host
2421 @c cat" (the latter followed by typing text and ^D)
2422 @c as troubleshooting techniques?  Probably yes
2423 @c (people tend to have trouble setting this up),
2424 @c but this kind of thing can be hard to spell out.
2425
2426 @node Password authenticated
2427 @subsection Direct connection with password authentication
2428
2429 The @sc{cvs} client can also connect to the server
2430 using a password protocol.  This is particularly useful
2431 if using @code{rsh} is not feasible (for example,
2432 the server is behind a firewall), and Kerberos also is
2433 not available.
2434
2435         To use this method, it is necessary to make
2436 some adjustments on both the server and client sides.
2437
2438 @menu
2439 * Password authentication server::     Setting up the server
2440 * Password authentication client::     Using the client
2441 * Password authentication security::   What this method does and does not do
2442 @end menu
2443
2444 @node Password authentication server
2445 @subsubsection Setting up the server for password authentication
2446
2447 First of all, you probably want to tighten the
2448 permissions on the @file{$CVSROOT} and
2449 @file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2450 authentication security}, for more details.
2451
2452 @cindex pserver (subcommand)
2453 @cindex Remote repositories, port specification
2454 @cindex Repositories, remote, port specification
2455 @cindex Client/Server Operation, port specification
2456 @cindex pserver (client/server connection method), port specification
2457 @cindex kserver (client/server connection method), port specification
2458 @cindex gserver (client/server connection method), port specification
2459 @cindex port, specifying for remote repositories
2460 @cindex Password server, setting up
2461 @cindex Authenticating server, setting up
2462 @cindex inetd, configuring for pserver
2463 @cindex xinetd, configuring for pserver
2464 @c FIXME: this isn't quite right regarding port
2465 @c numbers; CVS looks up "cvspserver" in
2466 @c /etc/services (on unix, but what about non-unix?).
2467 On the server side, the file @file{/etc/inetd.conf}
2468 needs to be edited so @code{inetd} knows to run the
2469 command @code{cvs pserver} when it receives a
2470 connection on the right port.  By default, the port
2471 number is 2401; it would be different if your client
2472 were compiled with @code{CVS_AUTH_PORT} defined to
2473 something else, though.  This can also be specified in the CVSROOT variable
2474 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2475 environment variable (@pxref{Environment variables}).
2476
2477         If your @code{inetd} allows raw port numbers in
2478 @file{/etc/inetd.conf}, then the following (all on a
2479 single line in @file{inetd.conf}) should be sufficient:
2480
2481 @example
2482 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
2483 cvs -f --allow-root=/usr/cvsroot pserver
2484 @end example
2485
2486 @noindent
2487 (You could also use the
2488 @samp{-T} option to specify a temporary directory.)
2489
2490 The @samp{--allow-root} option specifies the allowable
2491 @sc{cvsroot} directory.  Clients which attempt to use a
2492 different @sc{cvsroot} directory will not be allowed to
2493 connect.  If there is more than one @sc{cvsroot}
2494 directory which you want to allow, repeat the option.
2495 (Unfortunately, many versions of @code{inetd} have very small
2496 limits on the number of arguments and/or the total length
2497 of the command.  The usual solution to this problem is
2498 to have @code{inetd} run a shell script which then invokes
2499 @sc{cvs} with the necessary arguments.)
2500
2501         If your @code{inetd} wants a symbolic service
2502 name instead of a raw port number, then put this in
2503 @file{/etc/services}:
2504
2505 @example
2506 cvspserver      2401/tcp
2507 @end example
2508
2509 @noindent
2510 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2511
2512 If your system uses @code{xinetd} instead of @code{inetd},
2513 the procedure is slightly different.
2514 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2515
2516 @example
2517 service cvspserver
2518 @{
2519    port        = 2401
2520    socket_type = stream
2521    protocol    = tcp
2522    wait        = no
2523    user        = root
2524    passenv     = PATH
2525    server      = /usr/local/bin/cvs
2526    server_args = -f --allow-root=/usr/cvsroot pserver
2527 @}
2528 @end example
2529
2530 @noindent
2531 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2532 the @code{port} line.)
2533
2534         Once the above is taken care of, restart your
2535 @code{inetd}, or do whatever is necessary to force it
2536 to reread its initialization files.
2537
2538 If you are having trouble setting this up, see
2539 @ref{Connection}.
2540
2541 @cindex CVS passwd file
2542 @cindex passwd (admin file)
2543 Because the client stores and transmits passwords in
2544 cleartext (almost---see @ref{Password authentication
2545 security}, for details), a separate @sc{cvs} password
2546 file is generally used, so people don't compromise
2547 their regular passwords when they access the
2548 repository.  This file is
2549 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2550 administrative files}).  It uses a colon-separated
2551 format, similar to @file{/etc/passwd} on Unix systems,
2552 except that it has fewer fields: @sc{cvs} username,
2553 optional password, and an optional system username for
2554 @sc{cvs} to run as if authentication succeeds.  Here is
2555 an example @file{passwd} file with five entries:
2556
2557 @example
2558 anonymous:
2559 bach:ULtgRLXo7NRxs
2560 spwang:1sOp854gDF3DY
2561 melissa:tGX1fS8sun6rY:pubcvs
2562 qproj:XR4EZcEs0szik:pubcvs
2563 @end example
2564
2565 @noindent
2566 (The passwords are encrypted according to the standard
2567 Unix @code{crypt()} function, so it is possible to
2568 paste in passwords directly from regular Unix
2569 @file{/etc/passwd} files.)
2570
2571 The first line in the example will grant access to any
2572 @sc{cvs} client attempting to authenticate as user
2573 @code{anonymous}, no matter what password they use,
2574 including an empty password.  (This is typical for
2575 sites granting anonymous read-only access; for
2576 information on how to do the "read-only" part, see
2577 @ref{Read-only access}.)
2578
2579 The second and third lines will grant access to
2580 @code{bach} and @code{spwang} if they supply their
2581 respective plaintext passwords.
2582
2583 @cindex User aliases
2584 The fourth line will grant access to @code{melissa}, if
2585 she supplies the correct password, but her @sc{cvs}
2586 operations will actually run on the server side under
2587 the system user @code{pubcvs}.  Thus, there need not be
2588 any system user named @code{melissa}, but there
2589 @emph{must} be one named @code{pubcvs}.
2590
2591 The fifth line shows that system user identities can be
2592 shared: any client who successfully authenticates as
2593 @code{qproj} will actually run as @code{pubcvs}, just
2594 as @code{melissa} does.  That way you could create a
2595 single, shared system user for each project in your
2596 repository, and give each developer their own line in
2597 the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2598 username on each line would be different, but the
2599 system username would be the same.  The reason to have
2600 different @sc{cvs} usernames is that @sc{cvs} will log their
2601 actions under those names: when @code{melissa} commits
2602 a change to a project, the checkin is recorded in the
2603 project's history under the name @code{melissa}, not
2604 @code{pubcvs}.  And the reason to have them share a
2605 system username is so that you can arrange permissions
2606 in the relevant area of the repository such that only
2607 that account has write-permission there.
2608
2609 If the system-user field is present, all
2610 password-authenticated @sc{cvs} commands run as that
2611 user; if no system user is specified, @sc{cvs} simply
2612 takes the @sc{cvs} username as the system username and
2613 runs commands as that user.  In either case, if there
2614 is no such user on the system, then the @sc{cvs}
2615 operation will fail (regardless of whether the client
2616 supplied a valid password).
2617
2618 The password and system-user fields can both be omitted
2619 (and if the system-user field is omitted, then also
2620 omit the colon that would have separated it from the
2621 encrypted password).  For example, this would be a
2622 valid @file{$CVSROOT/CVSROOT/passwd} file:
2623
2624 @example
2625 anonymous::pubcvs
2626 fish:rKa5jzULzmhOo:kfogel
2627 sussman:1sOp854gDF3DY
2628 @end example
2629
2630 @noindent
2631 When the password field is omitted or empty, then the
2632 client's authentication attempt will succeed with any
2633 password, including the empty string.  However, the
2634 colon after the @sc{cvs} username is always necessary,
2635 even if the password is empty.
2636
2637 @sc{cvs} can also fall back to use system authentication.
2638 When authenticating a password, the server first checks
2639 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2640 file.  If it finds the user, it will use that entry for
2641 authentication as described above.  But if it does not
2642 find the user, or if the @sc{cvs} @file{passwd} file
2643 does not exist, then the server can try to authenticate
2644 the username and password using the operating system's
2645 user-lookup routines (this "fallback" behavior can be
2646 disabled by setting @code{SystemAuth=no} in the
2647 @sc{cvs} @file{config} file, @pxref{config}).
2648
2649 The default fallback behavior is to look in 
2650 @file{/etc/passwd} for this system user unless your
2651 system has PAM (Pluggable Authentication Modules)
2652 and your @sc{cvs} server executable was configured to
2653 use it at compile time (using @code{./configure --enable-pam} - see the
2654 INSTALL file for more).  In this case, PAM will be consulted instead.
2655 This means that @sc{cvs} can be configured to use any password
2656 authentication source PAM can be configured to use (possibilities
2657 include a simple UNIX password, NIS, LDAP, and others) in its
2658 global configuration file (usually @file{/etc/pam.conf}
2659 or possibly @file{/etc/pam.d/cvs}).  See your PAM documentation
2660 for more details on PAM configuration.
2661
2662 Note that PAM is an experimental feature in @sc{cvs} and feedback is
2663 encouraged.  Please send a mail to one of the @sc{cvs} mailing lists
2664 (@code{info-cvs@@gnu.org} or @code{bug-cvs@@gnu.org}) if you use the 
2665 @sc{cvs} PAM support.
2666
2667 @strong{WARNING: Using PAM gives the system administrator much more 
2668 flexibility about how @sc{cvs} users are authenticated but 
2669 no more security than other methods.  See below for more.} 
2670
2671 CVS needs an "auth", "account" and "session" module in the 
2672 PAM configuration file. A typical PAM configuration 
2673 would therefore have the following lines 
2674 in @file{/etc/pam.conf} to emulate the standard @sc{cvs} 
2675 system @file{/etc/passwd} authentication:
2676
2677 @example
2678 cvs     auth        required    pam_unix.so
2679 cvs     account     required    pam_unix.so
2680 cvs     session     required    pam_unix.so
2681 @end example
2682
2683 The the equivalent @file{/etc/pam.d/cvs} would contain
2684
2685 @example
2686 auth        required    pam_unix.so
2687 account     required    pam_unix.so
2688 session     required    pam_unix.so
2689 @end example
2690
2691 Some systems require a full path to the module so that
2692 @file{pam_unix.so} (Linux) would become something like 
2693 @file{/usr/lib/security/$ISA/pam_unix.so.1} (Sun Solaris).
2694 See the @file{contrib/pam} subdirectory of the @sc{cvs}
2695 source distribution for further example configurations.
2696
2697 The PAM service name given above as "cvs" is just
2698 the service name in the default configuration and can be
2699 set using
2700 @code{./configure --with-hardcoded-pam-service-name=<pam-service-name>}
2701 before compiling.  @sc{cvs} can also be configured to use whatever
2702 name it is invoked as as its PAM service name using
2703 @code{./configure --without-hardcoded-pam-service-name}, but this
2704 feature should not be used if you may not have control of the name
2705 @sc{cvs} will be invoked as.
2706
2707 Be aware, also, that falling back to system
2708 authentication might be a security risk: @sc{cvs}
2709 operations would then be authenticated with that user's
2710 regular login password, and the password flies across
2711 the network in plaintext.  See @ref{Password
2712 authentication security} for more on this.
2713 This may be more of a problem with PAM authentication
2714 because it is likely that the source of the system 
2715 password is some central authentication service like
2716 LDAP which is also used to authenticate other services.
2717
2718 On the other hand, PAM makes it very easy to change your password
2719 regularly.  If they are given the option of a one-password system for
2720 all of their activities, users are often more willing to change their
2721 password on a regular basis.
2722
2723 In the non-PAM configuration where the password is stored in the
2724 @file{CVSROOT/passwd} file, it is difficult to change passwords on a
2725 regular basis since only administrative users (or in some cases
2726 processes that act as an administrative user) are typically given
2727 access to modify this file.  Either there needs to be some
2728 hand-crafted web page or set-uid program to update the file, or the
2729 update needs to be done by submitting a request to an administrator to
2730 perform the duty by hand.  In the first case, having to remember to
2731 update a separate password on a periodic basis can be difficult.  In
2732 the second case, the manual nature of the change will typically mean
2733 that the password will not be changed unless it is absolutely
2734 necessary.
2735
2736 Note that PAM administrators should probably avoid configuring
2737 one-time-passwords (OTP) for @sc{cvs} authentication/authorization.  If
2738 OTPs are desired, the administrator may wish to encourage the use of
2739 one of the other Client/Server access methods.  See the section on
2740 @pxref{Remote repositories} for a list of other methods.
2741
2742 Right now, the only way to put a password in the
2743 @sc{cvs} @file{passwd} file is to paste it there from
2744 somewhere else.  Someday, there may be a @code{cvs
2745 passwd} command.
2746
2747 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2748 is normal to edit the @file{passwd} file in-place,
2749 rather than via @sc{cvs}.  This is because of the
2750 possible security risks of having the @file{passwd}
2751 file checked out to people's working copies.  If you do
2752 want to include the @file{passwd} file in checkouts of
2753 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2754
2755 @c We might also suggest using the @code{htpasswd} command
2756 @c from freely available web servers as well, but that
2757 @c would open up a can of worms in that the users next
2758 @c questions are likely to be "where do I get it?" and
2759 @c "how do I use it?"
2760 @c Also note that htpasswd, at least the version I had,
2761 @c likes to clobber the third field.
2762
2763 @node Password authentication client
2764 @subsubsection Using the client with password authentication
2765 @cindex Login (subcommand)
2766 @cindex Password client, using
2767 @cindex Authenticated client, using
2768 @cindex :pserver:, setting up
2769 To run a @sc{cvs} command on a remote repository via
2770 the password-authenticating server, one specifies the
2771 @code{pserver} protocol, optional username, repository host, an
2772 optional port number, and path to the repository.  For example:
2773
2774 @example
2775 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2776 @end example
2777
2778 @noindent
2779 or
2780
2781 @example
2782 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2783 cvs checkout someproj
2784 @end example
2785
2786 However, unless you're connecting to a public-access
2787 repository (i.e., one where that username doesn't
2788 require a password), you'll need to supply a password or @dfn{log in} first.
2789 Logging in verifies your password with the repository and stores it in a file.
2790 It's done with the @code{login} command, which will
2791 prompt you interactively for the password if you didn't supply one as part of
2792 @var{$CVSROOT}:
2793
2794 @example
2795 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2796 CVS password:
2797 @end example
2798
2799 @noindent
2800 or
2801
2802 @example
2803 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2804 @end example
2805
2806 After you enter the password, @sc{cvs} verifies it with
2807 the server.  If the verification succeeds, then that
2808 combination of username, host, repository, and password
2809 is permanently recorded, so future transactions with
2810 that repository won't require you to run @code{cvs
2811 login}.  (If verification fails, @sc{cvs} will exit
2812 complaining that the password was incorrect, and
2813 nothing will be recorded.)
2814
2815 The records are stored, by default, in the file
2816 @file{$HOME/.cvspass}.  That file's format is
2817 human-readable, and to a degree human-editable, but
2818 note that the passwords are not stored in
2819 cleartext---they are trivially encoded to protect them
2820 from "innocent" compromise (i.e., inadvertent viewing
2821 by a system administrator or other non-malicious
2822 person).
2823
2824 @cindex CVS_PASSFILE, environment variable
2825 You can change the default location of this file by
2826 setting the @code{CVS_PASSFILE} environment variable.
2827 If you use this variable, make sure you set it
2828 @emph{before} @code{cvs login} is run.  If you were to
2829 set it after running @code{cvs login}, then later
2830 @sc{cvs} commands would be unable to look up the
2831 password for transmission to the server.
2832   
2833 Once you have logged in, all @sc{cvs} commands using
2834 that remote repository and username will authenticate
2835 with the stored password.  So, for example
2836   
2837 @example
2838 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2839 @end example
2840
2841 @noindent
2842 should just work (unless the password changes on the
2843 server side, in which case you'll have to re-run
2844 @code{cvs login}).
2845
2846 Note that if the @samp{:pserver:} were not present in
2847 the repository specification, @sc{cvs} would assume it
2848 should use @code{rsh} to connect with the server
2849 instead (@pxref{Connecting via rsh}).
2850
2851 Of course, once you have a working copy checked out and
2852 are running @sc{cvs} commands from within it, there is
2853 no longer any need to specify the repository
2854 explicitly, because @sc{cvs} can deduce the repository
2855 from the working copy's @file{CVS} subdirectory.
2856
2857 @c FIXME: seems to me this needs somewhat more
2858 @c explanation.
2859 @cindex Logout (subcommand)
2860 The password for a given remote repository can be
2861 removed from the @code{CVS_PASSFILE} by using the
2862 @code{cvs logout} command.
2863
2864 @node Password authentication security
2865 @subsubsection Security considerations with password authentication
2866
2867 @cindex Security, of pserver
2868 The passwords are stored on the client side in a
2869 trivial encoding of the cleartext, and transmitted in
2870 the same encoding.  The encoding is done only to
2871 prevent inadvertent password compromises (i.e., a
2872 system administrator accidentally looking at the file),
2873 and will not prevent even a naive attacker from gaining
2874 the password.
2875
2876 @c FIXME: The bit about "access to the repository
2877 @c implies general access to the system is *not* specific
2878 @c to pserver; it applies to kerberos and SSH and
2879 @c everything else too.  Should reorganize the
2880 @c documentation to make this clear.
2881 The separate @sc{cvs} password file (@pxref{Password
2882 authentication server}) allows people
2883 to use a different password for repository access than
2884 for login access.  On the other hand, once a user has
2885 non-read-only
2886 access to the repository, she can execute programs on
2887 the server system through a variety of means.  Thus, repository
2888 access implies fairly broad system access as well.  It
2889 might be possible to modify @sc{cvs} to prevent that,
2890 but no one has done so as of this writing.
2891 @c OpenBSD uses chroot() and copies the repository to
2892 @c provide anonymous read-only access (for details see
2893 @c http://www.openbsd.org/anoncvs.shar).  While this
2894 @c closes the most obvious holes, I'm not sure it
2895 @c closes enough holes to recommend it (plus it is
2896 @c *very* easy to accidentally screw up a setup of this
2897 @c type).
2898
2899 Note that because the @file{$CVSROOT/CVSROOT} directory
2900 contains @file{passwd} and other files which are used
2901 to check security, you must control the permissions on
2902 this directory as tightly as the permissions on
2903 @file{/etc}.  The same applies to the @file{$CVSROOT}
2904 directory itself and any directory
2905 above it in the tree.  Anyone who has write access to
2906 such a directory will have the ability to become any
2907 user on the system.  Note that these permissions are
2908 typically tighter than you would use if you are not
2909 using pserver.
2910 @c TODO: Would be really nice to document/implement a
2911 @c scheme where the CVS server can run as some non-root
2912 @c user, e.g. "cvs".  CVSROOT/passwd would contain a
2913 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2914 @c would be implicit).  This would greatly reduce
2915 @c security risks such as those hinted at in the
2916 @c previous paragraph.  I think minor changes to CVS
2917 @c might be required but mostly this would just need
2918 @c someone who wants to play with it, document it, &c.
2919
2920 In summary, anyone who gets the password gets
2921 repository access (which may imply some measure of general system
2922 access as well).  The password is available to anyone
2923 who can sniff network packets or read a protected
2924 (i.e., user read-only) file.  If you want real
2925 security, get Kerberos.
2926
2927 @node GSSAPI authenticated
2928 @subsection Direct connection with GSSAPI
2929
2930 @cindex GSSAPI
2931 @cindex Security, GSSAPI
2932 @cindex :gserver:, setting up
2933 @cindex Kerberos, using :gserver:
2934 GSSAPI is a generic interface to network security
2935 systems such as Kerberos 5.
2936 If you have a working GSSAPI library, you can have
2937 @sc{cvs} connect via a direct @sc{tcp} connection,
2938 authenticating with GSSAPI.
2939
2940 To do this, @sc{cvs} needs to be compiled with GSSAPI
2941 support; when configuring @sc{cvs} it tries to detect
2942 whether GSSAPI libraries using Kerberos version 5 are
2943 present.  You can also use the @file{--with-gssapi}
2944 flag to configure.
2945
2946 The connection is authenticated using GSSAPI, but the
2947 message stream is @emph{not} authenticated by default.
2948 You must use the @code{-a} global option to request
2949 stream authentication.
2950
2951 The data transmitted is @emph{not} encrypted by
2952 default.  Encryption support must be compiled into both
2953 the client and the server; use the
2954 @file{--enable-encrypt} configure option to turn it on.
2955 You must then use the @code{-x} global option to
2956 request encryption.
2957
2958 GSSAPI connections are handled on the server side by
2959 the same server which handles the password
2960 authentication server; see @ref{Password authentication
2961 server}.  If you are using a GSSAPI mechanism such as
2962 Kerberos which provides for strong authentication, you
2963 will probably want to disable the ability to
2964 authenticate via cleartext passwords.  To do so, create
2965 an empty @file{CVSROOT/passwd} password file, and set
2966 @code{SystemAuth=no} in the config file
2967 (@pxref{config}).
2968
2969 The GSSAPI server uses a principal name of
2970 cvs/@var{hostname}, where @var{hostname} is the
2971 canonical name of the server host.  You will have to
2972 set this up as required by your GSSAPI mechanism.
2973
2974 To connect using GSSAPI, use the @samp{:gserver:} method.  For
2975 example,
2976
2977 @example
2978 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2979 @end example
2980
2981 @node Kerberos authenticated
2982 @subsection Direct connection with Kerberos
2983
2984 @cindex Kerberos, using :kserver:
2985 @cindex Security, Kerberos
2986 @cindex :kserver:, setting up
2987 The easiest way to use Kerberos is to use the Kerberos
2988 @code{rsh}, as described in @ref{Connecting via rsh}.
2989 The main disadvantage of using rsh is that all the data
2990 needs to pass through additional programs, so it may be
2991 slower.  So if you have Kerberos installed you can
2992 connect via a direct @sc{tcp} connection,
2993 authenticating with Kerberos.
2994
2995 This section concerns the Kerberos network security
2996 system, version 4.  Kerberos version 5 is supported via
2997 the GSSAPI generic network security interface, as
2998 described in the previous section.
2999
3000 To do this, @sc{cvs} needs to be compiled with Kerberos
3001 support; when configuring @sc{cvs} it tries to detect
3002 whether Kerberos is present or you can use the
3003 @file{--with-krb4} flag to configure.
3004
3005 The data transmitted is @emph{not} encrypted by
3006 default.  Encryption support must be compiled into both
3007 the client and server; use the
3008 @file{--enable-encryption} configure option to turn it
3009 on.  You must then use the @code{-x} global option to
3010 request encryption.
3011
3012 The CVS client will attempt to connect to port 1999 by default.
3013
3014 @cindex kinit
3015 When you want to use @sc{cvs}, get a ticket in the
3016 usual way (generally @code{kinit}); it must be a ticket
3017 which allows you to log into the server machine.  Then
3018 you are ready to go:
3019
3020 @example
3021 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
3022 @end example
3023
3024 Previous versions of @sc{cvs} would fall back to a
3025 connection via rsh; this version will not do so.
3026
3027 @node Connecting via fork
3028 @subsection Connecting with fork
3029
3030 @cindex fork, access method
3031 @cindex :fork:, setting up
3032 This access method allows you to connect to a
3033 repository on your local disk via the remote protocol.
3034 In other words it does pretty much the same thing as
3035 @code{:local:}, but various quirks, bugs and the like are
3036 those of the remote @sc{cvs} rather than the local
3037 @sc{cvs}.
3038
3039 For day-to-day operations you might prefer either
3040 @code{:local:} or @code{:fork:}, depending on your
3041 preferences.  Of course @code{:fork:} comes in
3042 particularly handy in testing or
3043 debugging @code{cvs} and the remote protocol.
3044 Specifically, we avoid all of the network-related
3045 setup/configuration, timeouts, and authentication
3046 inherent in the other remote access methods but still
3047 create a connection which uses the remote protocol.
3048
3049 To connect using the @code{fork} method, use
3050 @samp{:fork:} and the pathname to your local
3051 repository.  For example:
3052
3053 @example
3054 cvs -d :fork:/usr/local/cvsroot checkout foo
3055 @end example
3056
3057 @cindex CVS_SERVER, and :fork:
3058 As with @code{:ext:}, the server is called @samp{cvs}
3059 by default, or the value of the @code{CVS_SERVER}
3060 environment variable.
3061
3062
3063 @node Write proxies
3064 @subsection Distributing load across several CVS servers
3065
3066 @cindex PrimaryServer, in CVSROOT/config
3067 @cindex Primary server
3068 @cindex Secondary server
3069 @cindex proxy, write
3070 @cindex write proxy
3071 @sc{cvs} can be configured to distribute usage across several @sc{cvs}
3072 servers.  This is accomplished by means of one or more @dfn{write proxies}, or
3073 @dfn{secondary servers}, for a single @dfn{primary server}.
3074
3075 When a @sc{cvs} client accesses a secondary server and only sends read
3076 requests, then the secondary server handles the entire request.  If the client
3077 sends any write requests, however, the secondary server asks the client to
3078 redirect its write request to the primary server, if the client supports
3079 redirect requests, and otherwise becomes a transparent proxy for the primary
3080 server, which actually handles the write request.
3081
3082 In this manner, any number of read-only secondary servers may be configured as
3083 write proxies for the primary server, effectively distributing the load from
3084 all read operations between the secondary servers and restricting the load on
3085 the primary server to write operations and pushing changes to the secondaries.
3086
3087 Primary servers will not automatically push changes to secondaries.  This must
3088 be configured via @file{loginfo}, @file{postadmin}, @file{posttag}, &
3089 @file{postwatch} scripts (@pxref{Trigger Scripts}) like the following:
3090
3091 @example
3092 ALL     rsync -gopr -essh ./ secondary:/cvsroot/%p &
3093 @end example
3094
3095 You would probably actually want to lock directories for write on the secondary
3096 and for read on the primary before running the @samp{rsync} in the above
3097 example, but describing such a setup is beyond the scope of this document.
3098
3099 A secondary advantage of a write proxy setup is that users pointing at the
3100 secondary server can still execute fast read operations while on a network that
3101 connects to the primary over a slow link or even one where the link to the
3102 primary is periodically broken.  Only write operations will require the network
3103 link to the primary.
3104
3105 To configure write proxies, the primary must be specified with the
3106 @samp{PrimaryServer} option in @file{CVSROOT/config} (@pxref{config}).  For the
3107 transparent proxy mode to work, all secondary servers must also be running the
3108 same version of the @sc{cvs} server, or at least one that provides the same
3109 list of supported requests to the client as the primary server.  This is not
3110 necessary for redirection.
3111
3112 Once a primary server is configured, secondary servers may be configured by:
3113
3114 @enumerate
3115 @item
3116 Duplicating the primary repository at the new location.
3117 @item
3118 Setting up the @file{loginfo}, @file{postadmin}, @file{posttag}, and
3119 @file{postwatch} files on the primary to propagate writes to the new secondary.
3120 @item
3121 Configure remote access to the secondary(ies) as you would configure access
3122 to any other CVS server (@pxref{Remote repositories}).
3123 @item
3124 Ensuring that @code{--allow-root=@var{secondary-cvsroot}} is passed to
3125 @strong{all} incovations of the secondary server if the path to the @sc{cvs}
3126 repository directory is different on the two servers and you wish to support
3127 clients that do not handle the @samp{Redirect} resopnse (CVS 1.12.9 and earlier
3128 clients do not handle the @samp{Redirect} response).
3129
3130 Please note, again, that writethrough proxy suport requires
3131 @code{--allow-root=@var{secondary-cvsroot}} to be specified for @strong{all}
3132 incovations of the secondary server, not just @samp{pserver} invocations.
3133 This may require a wrapper script for the @sc{cvs} executable
3134 on your server machine.
3135 @end enumerate
3136
3137
3138 @c ---------------------------------------------------------------------
3139 @node Read-only access
3140 @section Read-only repository access
3141 @cindex Read-only repository access
3142 @cindex readers (admin file)
3143 @cindex writers (admin file)
3144
3145         It is possible to grant read-only repository
3146 access to people using the password-authenticated
3147 server (@pxref{Password authenticated}).  (The
3148 other access methods do not have explicit support for
3149 read-only users because those methods all assume login
3150 access to the repository machine anyway, and therefore
3151 the user can do whatever local file permissions allow
3152 her to do.)
3153
3154         A user who has read-only access can do only
3155 those @sc{cvs} operations which do not modify the
3156 repository, except for certain ``administrative'' files
3157 (such as lock files and the history file).  It may be
3158 desirable to use this feature in conjunction with
3159 user-aliasing (@pxref{Password authentication server}).
3160
3161 Unlike with previous versions of @sc{cvs}, read-only
3162 users should be able merely to read the repository, and
3163 not to execute programs on the server or otherwise gain
3164 unexpected levels of access.  Or to be more accurate,
3165 the @emph{known} holes have been plugged.  Because this
3166 feature is new and has not received a comprehensive
3167 security audit, you should use whatever level of
3168 caution seems warranted given your attitude concerning
3169 security.
3170
3171         There are two ways to specify read-only access
3172 for a user: by inclusion, and by exclusion.
3173
3174         "Inclusion" means listing that user
3175 specifically in the @file{$CVSROOT/CVSROOT/readers}
3176 file, which is simply a newline-separated list of
3177 users.  Here is a sample @file{readers} file:
3178
3179 @example
3180 melissa
3181 splotnik
3182 jrandom
3183 @end example
3184
3185 @noindent
3186         (Don't forget the newline after the last user.)
3187
3188         "Exclusion" means explicitly listing everyone
3189 who has @emph{write} access---if the file
3190
3191 @example
3192 $CVSROOT/CVSROOT/writers
3193 @end example
3194
3195 @noindent
3196 exists, then only
3197 those users listed in it have write access, and
3198 everyone else has read-only access (of course, even the
3199 read-only users still need to be listed in the
3200 @sc{cvs} @file{passwd} file).  The
3201 @file{writers} file has the same format as the
3202 @file{readers} file.
3203
3204         Note: if your @sc{cvs} @file{passwd}
3205 file maps cvs users onto system users (@pxref{Password
3206 authentication server}), make sure you deny or grant
3207 read-only access using the @emph{cvs} usernames, not
3208 the system usernames.  That is, the @file{readers} and
3209 @file{writers} files contain cvs usernames, which may
3210 or may not be the same as system usernames.
3211
3212         Here is a complete description of the server's
3213 behavior in deciding whether to grant read-only or
3214 read-write access:
3215
3216         If @file{readers} exists, and this user is
3217 listed in it, then she gets read-only access.  Or if
3218 @file{writers} exists, and this user is NOT listed in
3219 it, then she also gets read-only access (this is true
3220 even if @file{readers} exists but she is not listed
3221 there).  Otherwise, she gets full read-write access.
3222
3223         Of course there is a conflict if the user is
3224 listed in both files.  This is resolved in the more
3225 conservative way, it being better to protect the
3226 repository too much than too little: such a user gets
3227 read-only access.
3228
3229 @node Server temporary directory
3230 @section Temporary directories for the server
3231 @cindex Temporary directories, and server
3232 @cindex Server, temporary directories
3233
3234 While running, the @sc{cvs} server creates temporary
3235 directories.  They are named
3236
3237 @example
3238 cvs-serv@var{pid}
3239 @end example
3240
3241 @noindent
3242 where @var{pid} is the process identification number of
3243 the server.
3244 They are located in the directory specified by 
3245 the @samp{-T} global option (@pxref{Global options}), 
3246 the @code{TMPDIR} environment variable (@pxref{Environment variables}), 
3247 or, failing that, @file{/tmp}.
3248
3249 In most cases the server will remove the temporary
3250 directory when it is done, whether it finishes normally
3251 or abnormally.  However, there are a few cases in which
3252 the server does not or cannot remove the temporary
3253 directory, for example:
3254
3255 @itemize @bullet
3256 @item
3257 If the server aborts due to an internal server error,
3258 it may preserve the directory to aid in debugging
3259
3260 @item
3261 If the server is killed in a way that it has no way of
3262 cleaning up (most notably, @samp{kill -KILL} on unix).
3263
3264 @item
3265 If the system shuts down without an orderly shutdown,
3266 which tells the server to clean up.
3267 @end itemize
3268
3269 In cases such as this, you will need to manually remove
3270 the @file{cvs-serv@var{pid}} directories.  As long as
3271 there is no server running with process identification
3272 number @var{pid}, it is safe to do so.
3273
3274 @c ---------------------------------------------------------------------
3275 @node Starting a new project
3276 @chapter Starting a project with CVS
3277 @cindex Starting a project with CVS
3278 @cindex Creating a project
3279
3280 @comment --moduledb--
3281 Because renaming files and moving them between
3282 directories is somewhat inconvenient, the first thing
3283 you do when you start a new project should be to think
3284 through your file organization.  It is not impossible
3285 to rename or move files, but it does increase the
3286 potential for confusion and @sc{cvs} does have some
3287 quirks particularly in the area of renaming
3288 directories.  @xref{Moving files}.
3289
3290 What to do next depends on the situation at hand.
3291
3292 @menu
3293 * Setting up the files::        Getting the files into the repository
3294 * Defining the module::         How to make a module of the files
3295 @end menu
3296 @c -- File permissions!
3297
3298 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3299 @node Setting up the files
3300 @section Setting up the files
3301
3302 The first step is to create the files inside the repository.  This can
3303 be done in a couple of different ways.
3304
3305 @c -- The contributed scripts
3306 @menu
3307 * From files::                  This method is useful with old projects
3308                                 where files already exists.
3309 * From other version control systems::  Old projects where you want to
3310                                         preserve history from another system.
3311 * From scratch::                Creating a directory tree from scratch.
3312 @end menu
3313
3314 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3315 @node From files
3316 @subsection Creating a directory tree from a number of files
3317 @cindex Importing files
3318
3319 When you begin using @sc{cvs}, you will probably already have several
3320 projects that can be
3321 put under @sc{cvs} control.  In these cases the easiest way is to use the
3322 @code{import} command.  An example is probably the easiest way to
3323 explain how to use it.  If the files you want to install in
3324 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3325 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3326
3327 @example
3328 $ cd @var{wdir}
3329 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3330 @end example
3331
3332 Unless you supply a log message with the @samp{-m}
3333 flag, @sc{cvs} starts an editor and prompts for a
3334 message.  The string @samp{yoyo} is a @dfn{vendor tag},
3335 and @samp{start} is a @dfn{release tag}.  They may fill
3336 no purpose in this context, but since @sc{cvs} requires
3337 them they must be present.  @xref{Tracking sources}, for
3338 more information about them.
3339
3340 You can now verify that it worked, and remove your
3341 original source directory.
3342 @c FIXME: Need to say more about "verify that it
3343 @c worked".  What should the user look for in the output
3344 @c from "diff -r"?
3345
3346 @example
3347 $ cd ..
3348 $ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3349 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3350 $ rm -r @var{wdir}
3351 @end example
3352
3353 @noindent
3354 Erasing the original sources is a good idea, to make sure that you do
3355 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3356 Of course, it would be wise to make sure that you have
3357 a backup of the sources before you remove them.
3358
3359 The @code{checkout} command can either take a module
3360 name as argument (as it has done in all previous
3361 examples) or a path name relative to @code{$CVSROOT},
3362 as it did in the example above.
3363
3364 It is a good idea to check that the permissions
3365 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3366 are reasonable, and that they belong to the proper
3367 groups.  @xref{File permissions}.
3368
3369 If some of the files you want to import are binary, you
3370 may want to use the wrappers features to specify which
3371 files are binary and which are not.  @xref{Wrappers}.
3372
3373 @c The node name is too long, but I am having trouble
3374 @c thinking of something more concise.
3375 @node From other version control systems
3376 @subsection Creating Files From Other Version Control Systems
3377 @cindex Importing files, from other version control systems
3378
3379 If you have a project which you are maintaining with
3380 another version control system, such as @sc{rcs}, you
3381 may wish to put the files from that project into
3382 @sc{cvs}, and preserve the revision history of the
3383 files.
3384
3385 @table @asis
3386 @cindex RCS, importing files from
3387 @item From RCS
3388 If you have been using @sc{rcs}, find the @sc{rcs}
3389 files---usually a file named @file{foo.c} will have its
3390 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3391 other places; consult the @sc{rcs} documentation for
3392 details).  Then create the appropriate directories in
3393 @sc{cvs} if they do not already exist.  Then copy the
3394 files into the appropriate directories in the @sc{cvs}
3395 repository (the name in the repository must be the name
3396 of the source file with @samp{,v} added; the files go
3397 directly in the appropriate directory of the repository,
3398 not in an @file{RCS} subdirectory).  This is one of the
3399 few times when it is a good idea to access the @sc{cvs}
3400 repository directly, rather than using @sc{cvs}
3401 commands.  Then you are ready to check out a new
3402 working directory.
3403 @c Someday there probably should be a "cvs import -t
3404 @c rcs" or some such.  It could even create magic
3405 @c branches.  It could also do something about the case
3406 @c where the RCS file had a (non-magic) "0" branch.
3407
3408 The @sc{rcs} file should not be locked when you move it
3409 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3410 letting you operate on it.
3411 @c What is the easiest way to unlock your files if you
3412 @c have them locked?  Especially if you have a lot of them?
3413 @c This is a CVS bug/misfeature; importing RCS files
3414 @c should ignore whether they are locked and leave them in
3415 @c an unlocked state.  Yet another reason for a separate
3416 @c "import RCS file" command.
3417
3418 @c How many is "many"? Or do they just import RCS files?
3419 @item From another version control system
3420 Many version control systems have the ability to export
3421 @sc{rcs} files in the standard format.  If yours does,
3422 export the @sc{rcs} files and then follow the above
3423 instructions.
3424
3425 Failing that, probably your best bet is to write a
3426 script that will check out the files one revision at a
3427 time using the command line interface to the other
3428 system, and then check the revisions into @sc{cvs}.
3429 The @file{sccs2rcs} script mentioned below may be a
3430 useful example to follow.
3431
3432 @cindex SCCS, importing files from
3433 @item From SCCS
3434 There is a script in the @file{contrib} directory of
3435 the @sc{cvs} source distribution called @file{sccs2rcs}
3436 which converts @sc{sccs} files to @sc{rcs} files.
3437 Note: you must run it on a machine which has both
3438 @sc{sccs} and @sc{rcs} installed, and like everything
3439 else in contrib it is unsupported (your mileage may
3440 vary).
3441
3442 @cindex PVCS, importing files from
3443 @item From PVCS
3444 There is a script in the @file{contrib} directory of
3445 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3446 which converts @sc{pvcs} archives to @sc{rcs} files.
3447 You must run it on a machine which has both
3448 @sc{pvcs} and @sc{rcs} installed, and like everything
3449 else in contrib it is unsupported (your mileage may
3450 vary).  See the comments in the script for details.
3451 @end table
3452 @c CMZ and/or PATCHY were systems that were used in the
3453 @c high energy physics community (especially for
3454 @c CERNLIB).  CERN has replaced them with CVS, but the
3455 @c CAR format seems to live on as a way to submit
3456 @c changes.  There is a program car2cvs which converts
3457 @c but I'm not sure where one gets a copy.
3458 @c Not sure it is worth mentioning here, since it would
3459 @c appear to affect only one particular community.
3460 @c Best page for more information is:
3461 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3462 @c See also:
3463 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3464
3465 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3466 @node From scratch
3467 @subsection Creating a directory tree from scratch
3468
3469 @c Also/instead should be documenting
3470 @c $ cvs co -l .
3471 @c $ mkdir tc
3472 @c $ cvs add tc
3473 @c $ cd tc
3474 @c $ mkdir man
3475 @c $ cvs add man
3476 @c etc.
3477 @c Using import to create the directories only is
3478 @c probably a somewhat confusing concept.
3479 For a new project, the easiest thing to do is probably
3480 to create an empty directory structure, like this:
3481
3482 @example
3483 $ mkdir tc
3484 $ mkdir tc/man
3485 $ mkdir tc/testing
3486 @end example
3487
3488 After that, you use the @code{import} command to create
3489 the corresponding (empty) directory structure inside
3490 the repository:
3491
3492 @example
3493 $ cd tc
3494 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3495 @end example
3496
3497 This will add yoyodyne/@var{dir} as a directory under
3498 @code{$CVSROOT}.
3499
3500 Then, use @code{add} to add files (and new directories)
3501 as they appear.
3502
3503 Check that the permissions @sc{cvs} sets on the
3504 directories inside @code{$CVSROOT} are reasonable.
3505
3506 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3507 @node Defining the module
3508 @section Defining the module
3509 @cindex Defining a module
3510 @cindex Editing the modules file
3511 @cindex Module, defining
3512 @cindex Modules file, changing
3513
3514 The next step is to define the module in the
3515 @file{modules} file.  This is not strictly necessary,
3516 but modules can be convenient in grouping together
3517 related files and directories.
3518
3519 In simple cases these steps are sufficient to define a module.
3520
3521 @enumerate
3522 @item
3523 Get a working copy of the modules file.
3524
3525 @example
3526 $ cvs checkout CVSROOT/modules
3527 $ cd CVSROOT
3528 @end example
3529
3530 @item
3531 Edit the file and insert a line that defines the module.  @xref{Intro
3532 administrative files}, for an introduction.  @xref{modules}, for a full
3533 description of the modules file.  You can use the
3534 following line to define the module @samp{tc}:
3535
3536 @example
3537 tc   yoyodyne/tc
3538 @end example
3539
3540 @item
3541 Commit your changes to the modules file.
3542
3543 @example
3544 $ cvs commit -m "Added the tc module." modules
3545 @end example
3546
3547 @item
3548 Release the modules module.
3549
3550 @example
3551 $ cd ..
3552 $ cvs release -d CVSROOT
3553 @end example
3554 @end enumerate
3555
3556 @c ---------------------------------------------------------------------
3557 @node Revisions
3558 @chapter Revisions
3559
3560 For many uses of @sc{cvs}, one doesn't need to worry
3561 too much about revision numbers; @sc{cvs} assigns
3562 numbers such as @code{1.1}, @code{1.2}, and so on, and
3563 that is all one needs to know.  However, some people
3564 prefer to have more knowledge and control concerning
3565 how @sc{cvs} assigns revision numbers.
3566
3567 If one wants to keep track of a set of revisions
3568 involving more than one file, such as which revisions
3569 went into a particular release, one uses a @dfn{tag},
3570 which is a symbolic revision which can be assigned to a
3571 numeric revision in each file.
3572
3573 @menu
3574 * Revision numbers::            The meaning of a revision number
3575 * Versions revisions releases::  Terminology used in this manual
3576 * Assigning revisions::         Assigning revisions
3577 * Tags::                        Tags--Symbolic revisions
3578 * Tagging the working directory::  The cvs tag command
3579 * Tagging by date/tag::         The cvs rtag command
3580 * Modifying tags::              Adding, renaming, and deleting tags
3581 * Tagging add/remove::          Tags with adding and removing files
3582 * Sticky tags::                 Certain tags are persistent
3583 @end menu
3584
3585 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3586 @node Revision numbers
3587 @section Revision numbers
3588 @cindex Revision numbers
3589 @cindex Revision tree
3590 @cindex Linear development
3591 @cindex Number, revision-
3592 @cindex Decimal revision number
3593 @cindex Branch number
3594 @cindex Number, branch
3595
3596 Each version of a file has a unique @dfn{revision
3597 number}.  Revision numbers look like @samp{1.1},
3598 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3599 A revision number always has an even number of
3600 period-separated decimal integers.  By default revision
3601 1.1 is the first revision of a file.  Each successive
3602 revision is given a new number by increasing the
3603 rightmost number by one.  The following figure displays
3604 a few revisions, with newer revisions to the right.
3605
3606 @example
3607        +-----+    +-----+    +-----+    +-----+    +-----+
3608        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3609        +-----+    +-----+    +-----+    +-----+    +-----+
3610 @end example
3611
3612 It is also possible to end up with numbers containing
3613 more than one period, for example @samp{1.3.2.2}.  Such
3614 revisions represent revisions on branches
3615 (@pxref{Branching and merging}); such revision numbers
3616 are explained in detail in @ref{Branches and
3617 revisions}.
3618
3619 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3620 @node Versions revisions releases
3621 @section Versions, revisions and releases
3622 @cindex Revisions, versions and releases
3623 @cindex Versions, revisions and releases
3624 @cindex Releases, revisions and versions
3625
3626 A file can have several versions, as described above.
3627 Likewise, a software product can have several versions.
3628 A software product is often given a version number such
3629 as @samp{4.1.1}.
3630
3631 Versions in the first sense are called @dfn{revisions}
3632 in this document, and versions in the second sense are
3633 called @dfn{releases}.  To avoid confusion, the word
3634 @dfn{version} is almost never used in this document.
3635
3636 @node Assigning revisions
3637 @section Assigning revisions
3638
3639 @c We avoid the "major revision" terminology.  It seems
3640 @c like jargon.  Hopefully "first number" is clear enough.
3641 @c
3642 @c Well, in the context of software release numbers,
3643 @c "major" and "minor" release or version numbers are
3644 @c documented in at least the GNU Coding Standards, but I'm
3645 @c still not sure I find that a valid reason to apply the
3646 @c terminology to RCS revision numbers.  "First", "Second",
3647 @c "subsequent", and so on is almost surely clearer,
3648 @c especially to a novice reader. -DRP
3649 By default, @sc{cvs} will assign numeric revisions by
3650 leaving the first number the same and incrementing the
3651 second number.  For example, @code{1.1}, @code{1.2},
3652 @code{1.3}, etc.
3653
3654 When adding a new file, the second number will always
3655 be one and the first number will equal the highest
3656 first number of any file in that directory.  For
3657 example, the current directory contains files whose
3658 highest numbered revisions are @code{1.7}, @code{3.1},
3659 and @code{4.12}, then an added file will be given the
3660 numeric revision @code{4.1}.
3661 (When using client/server @sc{cvs},
3662 only files that are actually sent to the server are considered.)
3663
3664 @c This is sort of redundant with something we said a
3665 @c while ago.  Somewhere we need a better way of
3666 @c introducing how the first number can be anything
3667 @c except "1", perhaps.  Also I don't think this
3668 @c presentation is clear on why we are discussing releases
3669 @c and first numbers of numeric revisions in the same
3670 @c breath.
3671 Normally there is no reason to care
3672 about the revision numbers---it is easier to treat them
3673 as internal numbers that @sc{cvs} maintains, and tags
3674 provide a better way to distinguish between things like
3675 release 1 versus release 2 of your product
3676 (@pxref{Tags}).  However, if you want to set the
3677 numeric revisions, the @samp{-r} option to @code{cvs
3678 commit} can do that.  The @samp{-r} option implies the
3679 @samp{-f} option, in the sense that it causes the
3680 files to be committed even if they are not modified.
3681
3682 For example, to bring all your files up to
3683 revision 3.0 (including those that haven't changed),
3684 you might invoke:
3685
3686 @example
3687 $ cvs commit -r 3.0
3688 @end example
3689
3690 Note that the number you specify with @samp{-r} must be
3691 larger than any existing revision number.  That is, if
3692 revision 3.0 exists, you cannot @samp{cvs commit
3693 -r 1.3}.  If you want to maintain several releases in
3694 parallel, you need to use a branch (@pxref{Branching and merging}).
3695
3696 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3697 @node Tags
3698 @section Tags--Symbolic revisions
3699 @cindex Tags
3700
3701 The revision numbers live a life of their own.  They
3702 need not have anything at all to do with the release
3703 numbers of your software product.  Depending
3704 on how you use @sc{cvs} the revision numbers might change several times
3705 between two releases.  As an example, some of the
3706 source files that make up @sc{rcs} 5.6 have the following
3707 revision numbers:
3708 @cindex RCS revision numbers
3709
3710 @example
3711 ci.c            5.21
3712 co.c            5.9
3713 ident.c         5.3
3714 rcs.c           5.12
3715 rcsbase.h       5.11
3716 rcsdiff.c       5.10
3717 rcsedit.c       5.11
3718 rcsfcmp.c       5.9
3719 rcsgen.c        5.10
3720 rcslex.c        5.11
3721 rcsmap.c        5.2
3722 rcsutil.c       5.10
3723 @end example
3724
3725 @cindex tag (subcommand), introduction
3726 @cindex Tags, symbolic name
3727 @cindex Symbolic name (tag)
3728 @cindex Name, symbolic (tag)
3729 @cindex HEAD, as reserved tag name
3730 @cindex BASE, as reserved tag name
3731 You can use the @code{tag} command to give a symbolic name to a
3732 certain revision of a file.  You can use the @samp{-v} flag to the
3733 @code{status} command to see all tags that a file has, and
3734 which revision numbers they represent.  Tag names must
3735 start with an uppercase or lowercase letter and can
3736 contain uppercase and lowercase letters, digits,
3737 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
3738 and @code{HEAD} are reserved for use by @sc{cvs}.  It
3739 is expected that future names which are special to
3740 @sc{cvs} will be specially named, for example by
3741 starting with @samp{.}, rather than being named analogously to
3742 @code{BASE} and @code{HEAD}, to avoid conflicts with
3743 actual tag names.
3744 @c Including a character such as % or = has also been
3745 @c suggested as the naming convention for future
3746 @c special tag names.  Starting with . is nice because
3747 @c that is not a legal tag name as far as RCS is concerned.
3748 @c FIXME: CVS actually accepts quite a few characters
3749 @c in tag names, not just the ones documented above
3750 @c (see RCS_check_tag).  RCS
3751 @c defines legitimate tag names by listing illegal
3752 @c characters rather than legal ones.  CVS is said to lose its
3753 @c mind if you try to use "/" (try making such a tag sticky
3754 @c and using "cvs status" client/server--see remote
3755 @c protocol format for entries line for probable cause).
3756 @c TODO: The testsuite
3757 @c should test for whatever are documented above as
3758 @c officially-OK tag names, and CVS should at least reject
3759 @c characters that won't work, like "/".
3760
3761 You'll want to choose some convention for naming tags,
3762 based on information such as the name of the program
3763 and the version number of the release.  For example,
3764 one might take the name of the program, immediately
3765 followed by the version number with @samp{.} changed to
3766 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3767 @code{cvs1-9}.  If you choose a consistent convention,
3768 then you won't constantly be guessing whether a tag is
3769 @code{cvs-1-9} or @code{cvs1_9} or what.  You might
3770 even want to consider enforcing your convention in the
3771 @file{taginfo} file (@pxref{taginfo}).
3772 @c Might be nice to say more about using taginfo this
3773 @c way, like giving an example, or pointing out any particular
3774 @c issues which arise.
3775
3776 @cindex Adding a tag
3777 @cindex Tags, example
3778 The following example shows how you can add a tag to a
3779 file.  The commands must be issued inside your working
3780 directory.  That is, you should issue the
3781 command in the directory where @file{backend.c}
3782 resides.
3783
3784 @example
3785 $ cvs tag rel-0-4 backend.c
3786 T backend.c
3787 $ cvs status -v backend.c
3788 ===================================================================
3789 File: backend.c         Status: Up-to-date
3790
3791     Version:            1.4     Tue Dec  1 14:39:01 1992
3792     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3793     Sticky Tag:         (none)
3794     Sticky Date:        (none)
3795     Sticky Options:     (none)
3796
3797     Existing Tags:
3798         rel-0-4                     (revision: 1.4)
3799
3800 @end example
3801
3802 For a complete summary of the syntax of @code{cvs tag},
3803 including the various options, see @ref{Invoking CVS}.
3804
3805 There is seldom reason to tag a file in isolation.  A more common use is
3806 to tag all the files that constitute a module with the same tag at
3807 strategic points in the development life-cycle, such as when a release
3808 is made.
3809
3810 @example
3811 $ cvs tag rel-1-0 .
3812 cvs tag: Tagging .
3813 T Makefile
3814 T backend.c
3815 T driver.c
3816 T frontend.c
3817 T parser.c
3818 @end example
3819
3820 @noindent
3821 (When you give @sc{cvs} a directory as argument, it generally applies the
3822 operation to all the files in that directory, and (recursively), to any
3823 subdirectories that it may contain.  @xref{Recursive behavior}.)
3824
3825 @cindex Retrieving an old revision using tags
3826 @cindex Tags, retrieving old revisions
3827 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3828 a certain revision of a module.  This flag makes it easy to
3829 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3830 any time in the future:
3831
3832 @example
3833 $ cvs checkout -r rel-1-0 tc
3834 @end example
3835
3836 @noindent
3837 This is useful, for instance, if someone claims that there is a bug in
3838 that release, but you cannot find the bug in the current working copy.
3839
3840 You can also check out a module as it was on any branch at any given date.
3841 @xref{checkout options}.  When specifying @samp{-r} or @samp{-D} to
3842 any of these commands, you will need beware of sticky
3843 tags; see @ref{Sticky tags}.
3844
3845 When you tag more than one file with the same tag you
3846 can think about the tag as "a curve drawn through a
3847 matrix of filename vs. revision number."  Say we have 5
3848 files with the following revisions:
3849
3850 @example
3851 @group
3852         file1   file2   file3   file4   file5
3853
3854         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3855         1.2*-   1.2     1.2    -1.2*-
3856         1.3  \- 1.3*-   1.3   / 1.3
3857         1.4          \  1.4  /  1.4
3858                       \-1.5*-   1.5
3859                         1.6
3860 @end group
3861 @end example
3862
3863 At some time in the past, the @code{*} versions were tagged.
3864 You can think of the tag as a handle attached to the curve
3865 drawn through the tagged revisions.  When you pull on
3866 the handle, you get all the tagged revisions.  Another
3867 way to look at it is that you "sight" through a set of
3868 revisions that is "flat" along the tagged revisions,
3869 like this:
3870
3871 @example
3872 @group
3873         file1   file2   file3   file4   file5
3874
3875                         1.1
3876                         1.2
3877                 1.1     1.3                       _
3878         1.1     1.2     1.4     1.1              /
3879         1.2*----1.3*----1.5*----1.2*----1.1*    (--- <--- Look here
3880         1.3             1.6     1.3              \_
3881         1.4                     1.4
3882                                 1.5
3883 @end group
3884 @end example
3885
3886 @node Tagging the working directory
3887 @section Specifying what to tag from the working directory
3888
3889 @cindex tag (subcommand)
3890 The example in the previous section demonstrates one of
3891 the most common ways to choose which revisions to tag.
3892 Namely, running the @code{cvs tag} command without
3893 arguments causes @sc{cvs} to select the revisions which
3894 are checked out in the current working directory.  For
3895 example, if the copy of @file{backend.c} in working
3896 directory was checked out from revision 1.4, then
3897 @sc{cvs} will tag revision 1.4.  Note that the tag is
3898 applied immediately to revision 1.4 in the repository;
3899 tagging is not like modifying a file, or other
3900 operations in which one first modifies the working
3901 directory and then runs @code{cvs commit} to transfer
3902 that modification to the repository.
3903
3904 One potentially surprising aspect of the fact that
3905 @code{cvs tag} operates on the repository is that you
3906 are tagging the checked-in revisions, which may differ
3907 from locally modified files in your working directory.
3908 If you want to avoid doing this by mistake, specify the
3909 @samp{-c} option to @code{cvs tag}.  If there are any
3910 locally modified files, @sc{cvs} will abort with an
3911 error before it tags any files:
3912
3913 @example
3914 $ cvs tag -c rel-0-4
3915 cvs tag: backend.c is locally modified
3916 cvs [tag aborted]: correct the above errors first!
3917 @end example
3918
3919 @node Tagging by date/tag
3920 @section Specifying what to tag by date or revision
3921 @cindex rtag (subcommand)
3922
3923 The @code{cvs rtag} command tags the repository as of a
3924 certain date or time (or can be used to tag the latest
3925 revision).  @code{rtag} works directly on the
3926 repository contents (it requires no prior checkout and
3927 does not look for a working directory).
3928
3929 The following options specify which date or revision to
3930 tag.  See @ref{Common options}, for a complete
3931 description of them.
3932
3933 @table @code
3934 @item -D @var{date}
3935 Tag the most recent revision no later than @var{date}.
3936
3937 @item -f
3938 Only useful with the @samp{-D} or @samp{-r}
3939 flags.  If no matching revision is found, use the most
3940 recent revision (instead of ignoring the file).
3941
3942 @item -r @var{tag}[:@var{date}]
3943 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
3944 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
3945 existed on @var{date}.  See @ref{Common options}.
3946 @end table
3947
3948 The @code{cvs tag} command also allows one to specify
3949 files by revision or date, using the same @samp{-r},
3950 @samp{-D}, and @samp{-f} options.  However, this
3951 feature is probably not what you want.  The reason is
3952 that @code{cvs tag} chooses which files to tag based on
3953 the files that exist in the working directory, rather
3954 than the files which existed as of the given tag/date.
3955 Therefore, you are generally better off using @code{cvs
3956 rtag}.  The exceptions might be cases like:
3957
3958 @example
3959 cvs tag -r 1.4 stable backend.c
3960 @end example
3961
3962 @node Modifying tags
3963 @section Deleting, moving, and renaming tags
3964
3965 @c Also see:
3966 @c  "How do I move or rename a magic branch tag?"
3967 @c in the FAQ (I think the issues it talks about still
3968 @c apply, but this could use some sanity.sh work).
3969
3970 Normally one does not modify tags.  They exist in order
3971 to record the history of the repository and so deleting
3972 them or changing their meaning would, generally, not be
3973 what you want.
3974
3975 However, there might be cases in which one uses a tag
3976 temporarily or accidentally puts one in the wrong
3977 place.  Therefore, one might delete, move, or rename a
3978 tag.
3979
3980 @noindent
3981 @strong{WARNING: the commands in this section are
3982 dangerous; they permanently discard historical
3983 information and it can be difficult or impossible to
3984 recover from errors.  If you are a @sc{cvs}
3985 administrator, you may consider restricting these
3986 commands with the @file{taginfo} file (@pxref{taginfo}).}
3987
3988 @cindex Deleting tags
3989 @cindex Deleting branch tags
3990 @cindex Removing tags
3991 @cindex Removing branch tags
3992 @cindex Tags, deleting
3993 @cindex Branch tags, deleting
3994 To delete a tag, specify the @samp{-d} option to either
3995 @code{cvs tag} or @code{cvs rtag}.  For example:
3996
3997 @example
3998 cvs rtag -d rel-0-4 tc
3999 @end example
4000
4001 @noindent
4002 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
4003 In the event that branch tags are encountered within the repository
4004 with the given name, a warning message will be issued and the branch 
4005 tag will not be deleted.  If you are absolutely certain you know what
4006 you are doing, the @code{-B} option may be specified to allow deletion
4007 of branch tags.  In that case, any non-branch tags encountered will
4008 trigger warnings and will not be deleted.
4009
4010 @noindent
4011 @strong{WARNING: Moving branch tags is very dangerous!  If you think
4012 you need the @code{-B} option, think again and ask your @sc{cvs}
4013 administrator about it (if that isn't you).  There is almost certainly
4014 another way to accomplish what you want to accomplish.}
4015
4016 @cindex Moving tags
4017 @cindex Moving branch tags
4018 @cindex Tags, moving
4019 @cindex Branch tags, moving
4020 When we say @dfn{move} a tag, we mean to make the same
4021 name point to different revisions.  For example, the
4022 @code{stable} tag may currently point to revision 1.4
4023 of @file{backend.c} and perhaps we want to make it
4024 point to revision 1.6.  To move a non-branch tag, specify the
4025 @samp{-F} option to either @code{cvs tag} or @code{cvs
4026 rtag}.  For example, the task just mentioned might be
4027 accomplished as:
4028
4029 @example
4030 cvs tag -r 1.6 -F stable backend.c
4031 @end example
4032
4033 @noindent
4034 If any branch tags are encountered in the repository 
4035 with the given name, a warning is issued and the branch
4036 tag is not disturbed.  If you are absolutely certain you
4037 wish to move the branch tag, the @code{-B} option may be specified.
4038 In that case, non-branch tags encountered with the given
4039 name are ignored with a warning message.
4040
4041 @noindent
4042 @strong{WARNING: Moving branch tags is very dangerous!  If you think you
4043 need the @code{-B} option, think again and ask your @sc{cvs}
4044 administrator about it (if that isn't you).  There is almost certainly
4045 another way to accomplish what you want to accomplish.}
4046
4047 @cindex Renaming tags
4048 @cindex Tags, renaming
4049 When we say @dfn{rename} a tag, we mean to make a
4050 different name point to the same revisions as the old
4051 tag.  For example, one may have misspelled the tag name
4052 and want to correct it (hopefully before others are
4053 relying on the old spelling).  To rename a tag, first
4054 create a new tag using the @samp{-r} option to
4055 @code{cvs rtag}, and then delete the old name.  (Caution:
4056 this method will not work with branch tags.) 
4057 This leaves the new tag on exactly the 
4058 same files as the old tag.  For example:
4059
4060 @example
4061 cvs rtag -r old-name-0-4 rel-0-4 tc
4062 cvs rtag -d old-name-0-4 tc
4063 @end example
4064
4065 @node Tagging add/remove
4066 @section Tagging and adding and removing files
4067
4068 The subject of exactly how tagging interacts with
4069 adding and removing files is somewhat obscure; for the
4070 most part @sc{cvs} will keep track of whether files
4071 exist or not without too much fussing.  By default,
4072 tags are applied to only files which have a revision
4073 corresponding to what is being tagged.  Files which did
4074 not exist yet, or which were already removed, simply
4075 omit the tag, and @sc{cvs} knows to treat the absence
4076 of a tag as meaning that the file didn't exist as of
4077 that tag.
4078
4079 However, this can lose a small amount of information.
4080 For example, suppose a file was added and then removed.
4081 Then, if the tag is missing for that file, there is no
4082 way to know whether the tag refers to the time before
4083 the file was added, or the time after it was removed.
4084 If you specify the @samp{-r} option to @code{cvs rtag},
4085 then @sc{cvs} tags the files which have been removed,
4086 and thereby avoids this problem.  For example, one
4087 might specify @code{-r HEAD} to tag the head.
4088
4089 On the subject of adding and removing files, the
4090 @code{cvs rtag} command has a @samp{-a} option which
4091 means to clear the tag from removed files that would
4092 not otherwise be tagged.  For example, one might
4093 specify this option in conjunction with @samp{-F} when
4094 moving a tag.  If one moved a tag without @samp{-a},
4095 then the tag in the removed files might still refer to
4096 the old revision, rather than reflecting the fact that
4097 the file had been removed.  I don't think this is
4098 necessary if @samp{-r} is specified, as noted above.
4099
4100 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4101 @node Sticky tags
4102 @section Sticky tags
4103 @cindex Sticky tags
4104 @cindex Tags, sticky
4105
4106 @c A somewhat related issue is per-directory sticky
4107 @c tags (see comment at CVS/Tag in node Working
4108 @c directory storage); we probably want to say
4109 @c something like "you can set a sticky tag for only
4110 @c some files, but you don't want to" or some such.
4111
4112 Sometimes a working copy's revision has extra data
4113 associated with it, for example it might be on a branch
4114 (@pxref{Branching and merging}), or restricted to
4115 versions prior to a certain date by @samp{checkout -D}
4116 or @samp{update -D}.  Because this data persists --
4117 that is, it applies to subsequent commands in the
4118 working copy -- we refer to it as @dfn{sticky}.
4119
4120 Most of the time, stickiness is an obscure aspect of
4121 @sc{cvs} that you don't need to think about.  However,
4122 even if you don't want to use the feature, you may need
4123 to know @emph{something} about sticky tags (for
4124 example, how to avoid them!).
4125
4126 You can use the @code{status} command to see if any
4127 sticky tags or dates are set:
4128
4129 @example
4130 $ cvs status driver.c
4131 ===================================================================
4132 File: driver.c          Status: Up-to-date
4133
4134     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
4135     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
4136     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4137     Sticky Date:        (none)
4138     Sticky Options:     (none)
4139
4140 @end example
4141
4142 @cindex Resetting sticky tags
4143 @cindex Sticky tags, resetting
4144 @cindex Deleting sticky tags
4145 The sticky tags will remain on your working files until
4146 you delete them with @samp{cvs update -A}.  The
4147 @samp{-A} option merges local changes into the version of the
4148 file from the head of the trunk, removing any sticky tags,
4149 dates, or options.  See @ref{update} for more on the operation
4150 of @code{cvs update}.
4151
4152 @cindex Sticky date
4153 The most common use of sticky tags is to identify which
4154 branch one is working on, as described in
4155 @ref{Accessing branches}.  However, non-branch
4156 sticky tags have uses as well.  For example,
4157 suppose that you want to avoid updating your working
4158 directory, to isolate yourself from possibly
4159 destabilizing changes other people are making.  You
4160 can, of course, just refrain from running @code{cvs
4161 update}.  But if you want to avoid updating only a
4162 portion of a larger tree, then sticky tags can help.
4163 If you check out a certain revision (such as 1.4) it
4164 will become sticky.  Subsequent @code{cvs update}
4165 commands will
4166 not retrieve the latest revision until you reset the
4167 tag with @code{cvs update -A}.  Likewise, use of the
4168 @samp{-D} option to @code{update} or @code{checkout}
4169 sets a @dfn{sticky date}, which, similarly, causes that
4170 date to be used for future retrievals.
4171
4172 People often want to retrieve an old version of
4173 a file without setting a sticky tag.  This can
4174 be done with the @samp{-p} option to @code{checkout} or
4175 @code{update}, which sends the contents of the file to
4176 standard output.  For example:
4177 @example
4178 $ cvs update -p -r 1.1 file1 >file1
4179 ===================================================================
4180 Checking out file1
4181 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
4182 VERS: 1.1
4183 ***************
4184 $
4185 @end example
4186
4187 However, this isn't the easiest way, if you are asking
4188 how to undo a previous checkin (in this example, put
4189 @file{file1} back to the way it was as of revision
4190 1.1).  In that case you are better off using the
4191 @samp{-j} option to @code{update}; for further
4192 discussion see @ref{Merging two revisions}.
4193
4194 @c ---------------------------------------------------------------------
4195 @node Branching and merging
4196 @chapter Branching and merging
4197 @cindex Branching
4198 @cindex Merging
4199 @cindex Copying changes
4200 @cindex Main trunk and branches
4201 @cindex Revision tree, making branches
4202 @cindex Branches, copying changes between
4203 @cindex Changes, copying between branches
4204 @cindex Modifications, copying between branches
4205
4206 @sc{cvs} allows you to isolate changes onto a separate
4207 line of development, known as a @dfn{branch}.  When you
4208 change files on a branch, those changes do not appear
4209 on the main trunk or other branches.
4210
4211 Later you can move changes from one branch to another
4212 branch (or the main trunk) by @dfn{merging}.  Merging
4213 involves first running @code{cvs update -j}, to merge
4214 the changes into the working directory.
4215 You can then commit that revision, and thus effectively
4216 copy the changes onto another branch.
4217
4218 @menu
4219 * Branches motivation::         What branches are good for
4220 * Creating a branch::           Creating a branch
4221 * Accessing branches::          Checking out and updating branches
4222 * Branches and revisions::      Branches are reflected in revision numbers
4223 * Magic branch numbers::        Magic branch numbers
4224 * Merging a branch::            Merging an entire branch
4225 * Merging more than once::      Merging from a branch several times
4226 * Merging two revisions::       Merging differences between two revisions
4227 * Merging adds and removals::   What if files are added or removed?
4228 * Merging and keywords::        Avoiding conflicts due to keyword substitution
4229 @end menu
4230
4231 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4232 @node Branches motivation
4233 @section What branches are good for
4234 @cindex Branches motivation
4235 @cindex What branches are good for
4236 @cindex Motivation for branches
4237
4238 @c FIXME: this node mentions one way to use branches,
4239 @c but it is by no means the only way.  For example,
4240 @c the technique of committing a new feature on a branch,
4241 @c until it is ready for the main trunk.  The whole
4242 @c thing is generally speaking more akin to the
4243 @c "Revision management" node although it isn't clear to
4244 @c me whether policy matters should be centralized or
4245 @c distributed throughout the relevant sections.
4246 Suppose that release 1.0 of tc has been made.  You are continuing to
4247 develop tc, planning to create release 1.1 in a couple of months.  After a
4248 while your customers start to complain about a fatal bug.  You check
4249 out release 1.0 (@pxref{Tags}) and find the bug
4250 (which turns out to have a trivial fix).  However, the current revision
4251 of the sources are in a state of flux and are not expected to be stable
4252 for at least another month.  There is no way to make a
4253 bug fix release based on the newest sources.
4254
4255 The thing to do in a situation like this is to create a @dfn{branch} on
4256 the revision trees for all the files that make up
4257 release 1.0 of tc.  You can then make
4258 modifications to the branch without disturbing the main trunk.  When the
4259 modifications are finished you can elect to either incorporate them on
4260 the main trunk, or leave them on the branch.
4261
4262 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4263 @node Creating a branch
4264 @section Creating a branch
4265 @cindex Creating a branch
4266 @cindex Branch, creating a
4267 @cindex tag (subcommand), creating a branch using
4268 @cindex rtag (subcommand), creating a branch using
4269
4270 You can create a branch with @code{tag -b}; for
4271 example, assuming you're in a working copy:
4272
4273 @example
4274 $ cvs tag -b rel-1-0-patches
4275 @end example
4276
4277 @c FIXME: we should be more explicit about the value of
4278 @c having a tag on the branchpoint.  For example
4279 @c "cvs tag rel-1-0-patches-branchpoint" before
4280 @c the "cvs tag -b".  This points out that
4281 @c rel-1-0-patches is a pretty awkward name for
4282 @c this example (more so than for the rtag example
4283 @c below).
4284
4285 This splits off a branch based on the current revisions
4286 in the working copy, assigning that branch the name
4287 @samp{rel-1-0-patches}.
4288
4289 It is important to understand that branches get created
4290 in the repository, not in the working copy.  Creating a
4291 branch based on current revisions, as the above example
4292 does, will @emph{not} automatically switch the working
4293 copy to be on the new branch.  For information on how
4294 to do that, see @ref{Accessing branches}.
4295
4296 You can also create a branch without reference to any
4297 working copy, by using @code{rtag}:
4298
4299 @example
4300 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
4301 @end example
4302
4303 @samp{-r rel-1-0} says that this branch should be
4304 rooted at the revision that
4305 corresponds to the tag @samp{rel-1-0}.  It need not
4306 be the most recent revision -- it's often useful to
4307 split a branch off an old revision (for example, when
4308 fixing a bug in a past release otherwise known to be
4309 stable).
4310
4311 As with @samp{tag}, the @samp{-b} flag tells
4312 @code{rtag} to create a branch (rather than just a
4313 symbolic revision name).  Note that the numeric
4314 revision number that matches @samp{rel-1-0} will
4315 probably be different from file to file.
4316
4317 So, the full effect of the command is to create a new
4318 branch -- named @samp{rel-1-0-patches} -- in module
4319 @samp{tc}, rooted in the revision tree at the point tagged
4320 by @samp{rel-1-0}.
4321
4322 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4323 @node Accessing branches
4324 @section Accessing branches
4325 @cindex Check out a branch
4326 @cindex Retrieve a branch
4327 @cindex Access a branch
4328 @cindex Identifying a branch
4329 @cindex Branch, check out
4330 @cindex Branch, retrieving
4331 @cindex Branch, accessing
4332 @cindex Branch, identifying
4333
4334 You can retrieve a branch in one of two ways: by
4335 checking it out fresh from the repository, or by
4336 switching an existing working copy over to the branch.
4337
4338 To check out a branch from the repository, invoke
4339 @samp{checkout} with the @samp{-r} flag, followed by
4340 the tag name of the branch (@pxref{Creating a branch}):
4341
4342 @example
4343 $ cvs checkout -r rel-1-0-patches tc
4344 @end example
4345
4346 Or, if you already have a working copy, you can switch
4347 it to a given branch with @samp{update -r}:
4348
4349 @example
4350 $ cvs update -r rel-1-0-patches tc
4351 @end example
4352
4353 @noindent
4354 or equivalently:
4355
4356 @example
4357 $ cd tc
4358 $ cvs update -r rel-1-0-patches
4359 @end example
4360
4361 It does not matter if the working copy was originally
4362 on the main trunk or on some other branch -- the above
4363 command will switch it to the named branch.  And
4364 similarly to a regular @samp{update} command,
4365 @samp{update -r} merges any changes you have made,
4366 notifying you of conflicts where they occur.
4367
4368 Once you have a working copy tied to a particular
4369 branch, it remains there until you tell it otherwise.
4370 This means that changes checked in from the working
4371 copy will add new revisions on that branch, while
4372 leaving the main trunk and other branches unaffected.
4373
4374 @cindex Branches, sticky
4375 To find out what branch a working copy is on, you can
4376 use the @samp{status} command.  In its output, look for
4377 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4378 -- that's @sc{cvs}'s way of telling you the branch, if
4379 any, of the current working files:
4380
4381 @example
4382 $ cvs status -v driver.c backend.c
4383 ===================================================================
4384 File: driver.c          Status: Up-to-date
4385
4386     Version:            1.7     Sat Dec  5 18:25:54 1992
4387     RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4388     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4389     Sticky Date:        (none)
4390     Sticky Options:     (none)
4391
4392     Existing Tags:
4393         rel-1-0-patches             (branch: 1.7.2)
4394         rel-1-0                     (revision: 1.7)
4395
4396 ===================================================================
4397 File: backend.c         Status: Up-to-date
4398
4399     Version:            1.4     Tue Dec  1 14:39:01 1992
4400     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4401     Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4402     Sticky Date:        (none)
4403     Sticky Options:     (none)
4404
4405     Existing Tags:
4406         rel-1-0-patches             (branch: 1.4.2)
4407         rel-1-0                     (revision: 1.4)
4408         rel-0-4                     (revision: 1.4)
4409
4410 @end example
4411
4412 Don't be confused by the fact that the branch numbers
4413 for each file are different (@samp{1.7.2} and
4414 @samp{1.4.2} respectively).  The branch tag is the
4415 same, @samp{rel-1-0-patches}, and the files are
4416 indeed on the same branch.  The numbers simply reflect
4417 the point in each file's revision history at which the
4418 branch was made.  In the above example, one can deduce
4419 that @samp{driver.c} had been through more changes than
4420 @samp{backend.c} before this branch was created.
4421
4422 See @ref{Branches and revisions} for details about how
4423 branch numbers are constructed.
4424
4425 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4426 @node Branches and revisions
4427 @section Branches and revisions
4428 @cindex Branch number
4429 @cindex Number, branch
4430 @cindex Revision numbers (branches)
4431
4432 Ordinarily, a file's revision history is a linear
4433 series of increments (@pxref{Revision numbers}):
4434
4435 @example
4436        +-----+    +-----+    +-----+    +-----+    +-----+
4437        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4438        +-----+    +-----+    +-----+    +-----+    +-----+
4439 @end example
4440
4441 However, @sc{cvs} is not limited to linear development.  The
4442 @dfn{revision tree} can be split into @dfn{branches},
4443 where each branch is a self-maintained line of
4444 development.  Changes made on one branch can easily be
4445 moved back to the main trunk.
4446
4447 Each branch has a @dfn{branch number}, consisting of an
4448 odd number of period-separated decimal integers.  The
4449 branch number is created by appending an integer to the
4450 revision number where the corresponding branch forked
4451 off.  Having branch numbers allows more than one branch
4452 to be forked off from a certain revision.
4453
4454 @need 3500
4455 All revisions on a branch have revision numbers formed
4456 by appending an ordinal number to the branch number.
4457 The following figure illustrates branching with an
4458 example.
4459
4460 @example
4461 @c This example used to have a 1.2.2.4 revision, which
4462 @c might help clarify that development can continue on
4463 @c 1.2.2.  Might be worth reinstating if it can be done
4464 @c without overfull hboxes.
4465 @group
4466                                                       +-------------+
4467                            Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4468                                                     / +-------------+
4469                                                    /
4470                                                   /
4471                  +---------+    +---------+    +---------+
4472 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4473                / +---------+    +---------+    +---------+
4474               /
4475              /
4476 +-----+    +-----+    +-----+    +-----+    +-----+
4477 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4478 +-----+    +-----+    +-----+    +-----+    +-----+
4479                 !
4480                 !
4481                 !   +---------+    +---------+    +---------+
4482 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4483                     +---------+    +---------+    +---------+
4484
4485 @end group
4486 @end example
4487
4488 @c --   However, at least for me the figure is not enough.  I suggest more
4489 @c --   text to accompany it.  "A picture is worth a thousand words", so you
4490 @c --   have to make sure the reader notices the couple of hundred words
4491 @c --   *you* had in mind more than the others!
4492
4493 @c --   Why an even number of segments?  This section implies that this is
4494 @c --   how the main trunk is distinguished from branch roots, but you never
4495 @c --   explicitly say that this is the purpose of the [by itself rather
4496 @c --   surprising] restriction to an even number of segments.
4497
4498 The exact details of how the branch number is
4499 constructed is not something you normally need to be
4500 concerned about, but here is how it works: When
4501 @sc{cvs} creates a branch number it picks the first
4502 unused even integer, starting with 2.  So when you want
4503 to create a branch from revision 6.4 it will be
4504 numbered 6.4.2.  All branch numbers ending in a zero
4505 (such as 6.4.0) are used internally by @sc{cvs}
4506 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4507 special meaning.  @xref{Tracking sources}.
4508
4509 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4510 @node Magic branch numbers
4511 @section Magic branch numbers
4512
4513 @c Want xref to here from "log"?
4514
4515 This section describes a @sc{cvs} feature called
4516 @dfn{magic branches}.  For most purposes, you need not
4517 worry about magic branches; @sc{cvs} handles them for
4518 you.  However, they are visible to you in certain
4519 circumstances, so it may be useful to have some idea of
4520 how it works.
4521
4522 Externally, branch numbers consist of an odd number of
4523 dot-separated decimal integers.  @xref{Revision
4524 numbers}.  That is not the whole truth, however.  For
4525 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4526 in the second rightmost position (1.2.4 becomes
4527 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4528 on).
4529
4530 @sc{cvs} does a pretty good job at hiding these so
4531 called magic branches, but in a few places the hiding
4532 is incomplete:
4533
4534 @itemize @bullet
4535 @ignore
4536 @c This is in ignore as I'm taking their word for it,
4537 @c that this was fixed
4538 @c a long time ago.  But before deleting this
4539 @c entirely, I'd rather verify it (and add a test
4540 @c case to the testsuite).
4541 @item
4542 The magic branch can appear in the output from
4543 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4544 fixed in @sc{cvs} 1.3-s2.
4545
4546 @end ignore
4547 @item
4548 The magic branch number appears in the output from
4549 @code{cvs log}.
4550 @c What output should appear instead?
4551
4552 @item
4553 You cannot specify a symbolic branch name to @code{cvs
4554 admin}.
4555
4556 @end itemize
4557
4558 @c Can CVS do this automatically the first time
4559 @c you check something in to that branch?  Should
4560 @c it?
4561 You can use the @code{admin} command to reassign a
4562 symbolic name to a branch the way @sc{rcs} expects it
4563 to be.  If @code{R4patches} is assigned to the branch
4564 1.4.2 (magic branch number 1.4.0.2) in file
4565 @file{numbers.c} you can do this:
4566
4567 @example
4568 $ cvs admin -NR4patches:1.4.2 numbers.c
4569 @end example
4570
4571 It only works if at least one revision is already
4572 committed on the branch.  Be very careful so that you
4573 do not assign the tag to the wrong number.  (There is
4574 no way to see how the tag was assigned yesterday).
4575
4576 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4577 @node Merging a branch
4578 @section Merging an entire branch
4579 @cindex Merging a branch
4580 @cindex -j (merging branches)
4581
4582 You can merge changes made on a branch into your working copy by giving
4583 the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4584 @samp{-j @var{branchname}} option it merges the changes made between the
4585 greatest common ancestor (GCA) of the branch and the destination revision (in
4586 the simple case below the GCA is the point where the branch forked) and the
4587 newest revision on that branch into your working copy.
4588
4589 @cindex Join
4590 The @samp{-j} stands for ``join''.
4591
4592 @cindex Branch merge example
4593 @cindex Example, branch merge
4594 @cindex Merge, branch example
4595 Consider this revision tree:
4596
4597 @example
4598 +-----+    +-----+    +-----+    +-----+
4599 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4600 +-----+    +-----+    +-----+    +-----+
4601                 !
4602                 !
4603                 !   +---------+    +---------+
4604 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4605                     +---------+    +---------+
4606 @end example
4607
4608 @noindent
4609 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4610 following example assumes that the module @samp{mod} contains only one
4611 file, @file{m.c}.
4612
4613 @example
4614 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4615
4616 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4617                                  # @r{i.e. the changes between revision 1.2}
4618                                  # @r{and 1.2.2.2, into your working copy}
4619                                  # @r{of the file.}
4620
4621 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4622 @end example
4623
4624 A conflict can result from a merge operation.  If that
4625 happens, you should resolve it before committing the
4626 new revision.  @xref{Conflicts example}.
4627
4628 If your source files contain keywords (@pxref{Keyword substitution}),
4629 you might be getting more conflicts than strictly necessary.  See
4630 @ref{Merging and keywords}, for information on how to avoid this.
4631
4632 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4633 same effect as above could be achieved with this:
4634
4635 @example
4636 $ cvs checkout -j R1fix mod
4637 $ cvs commit -m "Included R1fix"
4638 @end example
4639
4640 It should be noted that @code{update -j @var{tagname}} will also work but may
4641 not produce the desired result.  @xref{Merging adds and removals}, for more.
4642
4643 @node Merging more than once
4644 @section Merging from a branch several times
4645
4646 Continuing our example, the revision tree now looks
4647 like this:
4648
4649 @example
4650 +-----+    +-----+    +-----+    +-----+    +-----+
4651 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4652 +-----+    +-----+    +-----+    +-----+    +-----+
4653                 !                           *
4654                 !                          *
4655                 !   +---------+    +---------+
4656 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4657                     +---------+    +---------+
4658 @end example
4659
4660 @noindent
4661 where the starred line represents the merge from the
4662 @samp{R1fix} branch to the main trunk, as just
4663 discussed.
4664
4665 Now suppose that development continues on the
4666 @samp{R1fix} branch:
4667
4668 @example
4669 +-----+    +-----+    +-----+    +-----+    +-----+
4670 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4671 +-----+    +-----+    +-----+    +-----+    +-----+
4672                 !                           *
4673                 !                          *
4674                 !   +---------+    +---------+    +---------+
4675 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4676                     +---------+    +---------+    +---------+
4677 @end example
4678
4679 @noindent
4680 and then you want to merge those new changes onto the
4681 main trunk.  If you just use the @code{cvs update -j
4682 R1fix m.c} command again, @sc{cvs} will attempt to
4683 merge again the changes which you have already merged,
4684 which can have undesirable side effects.
4685
4686 So instead you need to specify that you only want to
4687 merge the changes on the branch which have not yet been
4688 merged into the trunk.  To do that you specify two
4689 @samp{-j} options, and @sc{cvs} merges the changes from
4690 the first revision to the second revision.  For
4691 example, in this case the simplest way would be
4692
4693 @example
4694 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4695                                       # @r{head of the R1fix branch}
4696 @end example
4697
4698 The problem with this is that you need to specify the
4699 1.2.2.2 revision manually.  A slightly better approach
4700 might be to use the date the last merge was done:
4701
4702 @example
4703 cvs update -j R1fix:yesterday -j R1fix m.c
4704 @end example
4705
4706 Better yet, tag the R1fix branch after every merge into
4707 the trunk, and then use that tag for subsequent merges:
4708
4709 @example
4710 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4711 @end example
4712
4713 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4714 @node Merging two revisions
4715 @section Merging differences between any two revisions
4716 @cindex Merging two revisions
4717 @cindex Revisions, merging differences between
4718 @cindex Differences, merging
4719
4720 With two @samp{-j @var{revision}} flags, the @code{update}
4721 (and @code{checkout}) command can merge the differences
4722 between any two revisions into your working file.
4723
4724 @cindex Undoing a change
4725 @cindex Removing a change
4726 @example
4727 $ cvs update -j 1.5 -j 1.3 backend.c
4728 @end example
4729
4730 @noindent
4731 will undo all changes made between revision
4732 1.3 and 1.5.  Note the order of the revisions!
4733
4734 If you try to use this option when operating on
4735 multiple files, remember that the numeric revisions will
4736 probably be very different between the various files.
4737 You almost always use symbolic
4738 tags rather than revision numbers when operating on
4739 multiple files.
4740
4741 @cindex Restoring old version of removed file
4742 @cindex Resurrecting old version of dead file
4743 Specifying two @samp{-j} options can also undo file
4744 removals or additions.  For example, suppose you have
4745 a file
4746 named @file{file1} which existed as revision 1.1, and
4747 you then removed it (thus adding a dead revision 1.2).
4748 Now suppose you want to add it again, with the same
4749 contents it had previously.  Here is how to do it:
4750
4751 @example
4752 $ cvs update -j 1.2 -j 1.1 file1
4753 U file1
4754 $ cvs commit -m test
4755 Checking in file1;
4756 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4757 new revision: 1.3; previous revision: 1.2
4758 done
4759 $
4760 @end example
4761
4762 @node Merging adds and removals
4763 @section Merging can add or remove files
4764
4765 If the changes which you are merging involve removing
4766 or adding some files, @code{update -j} will reflect
4767 such additions or removals.
4768
4769 @c FIXME: This example needs a lot more explanation.
4770 @c We also need other examples for some of the other
4771 @c cases (not all--there are too many--as long as we present a
4772 @c coherent general principle).
4773 For example:
4774 @example
4775 cvs update -A
4776 touch a b c
4777 cvs add a b c ; cvs ci -m "added" a b c
4778 cvs tag -b branchtag
4779 cvs update -r branchtag
4780 touch d ; cvs add d
4781 rm a ; cvs rm a
4782 cvs ci -m "added d, removed a"
4783 cvs update -A
4784 cvs update -jbranchtag
4785 @end example
4786
4787 After these commands are executed and a @samp{cvs commit} is done,
4788 file @file{a} will be removed and file @file{d} added in the main branch.
4789 @c (which was determined by trying it)
4790
4791 Note that using a single static tag (@samp{-j @var{tagname}})
4792 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4793 changes from a branch will usually not remove files which were removed on the
4794 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4795 The exception to this rule occurs when
4796 a static tag has been attached to a dead revision manually.  Use the branch tag
4797 to merge all changes from the branch or use two static tags as merge endpoints
4798 to be sure that all intended changes are propagated in the merge.
4799
4800 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4801 @node Merging and keywords
4802 @section Merging and keywords
4803 @cindex Merging, and keyword substitution
4804 @cindex Keyword substitution, and merging
4805 @cindex -j (merging branches), and keyword substitution
4806 @cindex -kk, to avoid conflicts during a merge
4807
4808 If you merge files containing keywords (@pxref{Keyword
4809 substitution}), you will normally get numerous
4810 conflicts during the merge, because the keywords are
4811 expanded differently in the revisions which you are
4812 merging.
4813
4814 Therefore, you will often want to specify the
4815 @samp{-kk} (@pxref{Substitution modes}) switch to the
4816 merge command line.  By substituting just the name of
4817 the keyword, not the expanded value of that keyword,
4818 this option ensures that the revisions which you are
4819 merging will be the same as each other, and avoid
4820 spurious conflicts.
4821
4822 For example, suppose you have a file like this:
4823
4824 @example
4825        +---------+
4826       _! 1.1.2.1 !   <-  br1
4827      / +---------+
4828     /
4829    /
4830 +-----+    +-----+
4831 ! 1.1 !----! 1.2 !
4832 +-----+    +-----+
4833 @end example
4834
4835 @noindent
4836 and your working directory is currently on the trunk
4837 (revision 1.2).  Then you might get the following
4838 results from a merge:
4839
4840 @example
4841 $ cat file1
4842 key $@splitrcskeyword{Revision}: 1.2 $
4843 . . .
4844 $ cvs update -j br1
4845 U file1
4846 RCS file: /cvsroot/first-dir/file1,v
4847 retrieving revision 1.1
4848 retrieving revision 1.1.2.1
4849 Merging differences between 1.1 and 1.1.2.1 into file1
4850 rcsmerge: warning: conflicts during merge
4851 $ cat file1
4852 @asis{}<<<<<<< file1
4853 key $@splitrcskeyword{Revision}: 1.2 $
4854 @asis{}=======
4855 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4856 @asis{}>>>>>>> 1.1.2.1
4857 . . .
4858 @end example
4859
4860 What happened was that the merge tried to merge the
4861 differences between 1.1 and 1.1.2.1 into your working
4862 directory.  So, since the keyword changed from
4863 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4864 @sc{cvs} tried to merge that change into your working
4865 directory, which conflicted with the fact that your
4866 working directory had contained @code{Revision: 1.2}.
4867
4868 Here is what happens if you had used @samp{-kk}:
4869
4870 @example
4871 $ cat file1
4872 key $@splitrcskeyword{Revision}: 1.2 $
4873 . . .
4874 $ cvs update -kk -j br1
4875 U file1
4876 RCS file: /cvsroot/first-dir/file1,v
4877 retrieving revision 1.1
4878 retrieving revision 1.1.2.1
4879 Merging differences between 1.1 and 1.1.2.1 into file1
4880 $ cat file1
4881 key $@splitrcskeyword{Revision}$
4882 . . .
4883 @end example
4884
4885 What is going on here is that revision 1.1 and 1.1.2.1
4886 both expand as plain @code{Revision}, and therefore
4887 merging the changes between them into the working
4888 directory need not change anything.  Therefore, there
4889 is no conflict.
4890
4891 @strong{WARNING: In versions of @sc{cvs} prior to 1.12.2, there was a
4892 major problem with using @samp{-kk} on merges.  Namely, @samp{-kk}
4893 overrode any default keyword expansion mode set in the archive file in
4894 the repository.  This could, unfortunately for some users, cause data
4895 corruption in binary files (with a default keyword expansion mode set
4896 to @samp{-kb}).  Therefore, when a repository contained binary files,
4897 conflicts had to be dealt with manually rather than using @samp{-kk} in
4898 a merge command.}
4899
4900 In @sc{cvs} version 1.12.2 and later, the keyword expansion mode
4901 provided on the command line to any @sc{cvs} command no longer
4902 overrides the @samp{-kb} keyword expansion mode setting for binary
4903 files, though it will still override other default keyword expansion
4904 modes.  You can now safely merge using @samp{-kk} to avoid spurious conflicts
4905 on lines containing RCS keywords, even when your repository contains
4906 binary files.
4907
4908 @c ---------------------------------------------------------------------
4909 @node Recursive behavior
4910 @chapter Recursive behavior
4911 @cindex Recursive (directory descending)
4912 @cindex Directory, descending
4913 @cindex Descending directories
4914 @cindex Subdirectories
4915
4916 Almost all of the subcommands of @sc{cvs} work
4917 recursively when you specify a directory as an
4918 argument.  For instance, consider this directory
4919 structure:
4920
4921 @example
4922       @code{$HOME}
4923         |
4924         +--@t{tc}
4925         |   |
4926             +--@t{CVS}
4927             |      (internal @sc{cvs} files)
4928             +--@t{Makefile}
4929             +--@t{backend.c}
4930             +--@t{driver.c}
4931             +--@t{frontend.c}
4932             +--@t{parser.c}
4933             +--@t{man}
4934             |    |
4935             |    +--@t{CVS}
4936             |    |  (internal @sc{cvs} files)
4937             |    +--@t{tc.1}
4938             |
4939             +--@t{testing}
4940                  |
4941                  +--@t{CVS}
4942                  |  (internal @sc{cvs} files)
4943                  +--@t{testpgm.t}
4944                  +--@t{test2.t}
4945 @end example
4946
4947 @noindent
4948 If @file{tc} is the current working directory, the
4949 following is true:
4950
4951 @itemize @bullet
4952 @item
4953 @samp{cvs update testing} is equivalent to
4954
4955 @example
4956 cvs update testing/testpgm.t testing/test2.t
4957 @end example
4958
4959 @item
4960 @samp{cvs update testing man} updates all files in the
4961 subdirectories
4962
4963 @item
4964 @samp{cvs update .} or just @samp{cvs update} updates
4965 all files in the @code{tc} directory
4966 @end itemize
4967
4968 If no arguments are given to @code{update} it will
4969 update all files in the current working directory and
4970 all its subdirectories.  In other words, @file{.} is a
4971 default argument to @code{update}.  This is also true
4972 for most of the @sc{cvs} subcommands, not only the
4973 @code{update} command.
4974
4975 The recursive behavior of the @sc{cvs} subcommands can be
4976 turned off with the @samp{-l} option.
4977 Conversely, the @samp{-R} option can be used to force recursion if
4978 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4979
4980 @example
4981 $ cvs update -l         # @r{Don't update files in subdirectories}
4982 @end example
4983
4984 @c ---------------------------------------------------------------------
4985 @node Adding and removing
4986 @chapter Adding, removing, and renaming files and directories
4987
4988 In the course of a project, one will often add new
4989 files.  Likewise with removing or renaming, or with
4990 directories.  The general concept to keep in mind in
4991 all these cases is that instead of making an
4992 irreversible change you want @sc{cvs} to record the
4993 fact that a change has taken place, just as with
4994 modifying an existing file.  The exact mechanisms to do
4995 this in @sc{cvs} vary depending on the situation.
4996
4997 @menu
4998 * Adding files::                Adding files
4999 * Removing files::              Removing files
5000 * Removing directories::        Removing directories
5001 * Moving files::                Moving and renaming files
5002 * Moving directories::          Moving and renaming directories
5003 @end menu
5004
5005 @node Adding files
5006 @section Adding files to a directory
5007 @cindex Adding files
5008
5009 To add a new file to a directory, follow these steps.
5010
5011 @itemize @bullet
5012 @item
5013 You must have a working copy of the directory.
5014 @xref{Getting the source}.
5015
5016 @item
5017 Create the new file inside your working copy of the directory.
5018
5019 @item
5020 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
5021 want to version control the file.  If the file contains
5022 binary data, specify @samp{-kb} (@pxref{Binary files}).
5023
5024 @item
5025 Use @samp{cvs commit @var{filename}} to actually check
5026 in the file into the repository.  Other developers
5027 cannot see the file until you perform this step.
5028 @end itemize
5029
5030 You can also use the @code{add} command to add a new
5031 directory.
5032 @c FIXCVS and/or FIXME: Adding a directory doesn't
5033 @c require the commit step.  This probably can be
5034 @c considered a CVS bug, but it is possible we should
5035 @c warn people since this behavior probably won't be
5036 @c changing right away.
5037
5038 Unlike most other commands, the @code{add} command is
5039 not recursive.  You have to expcicitly name files and
5040 directories that you wish to add to the repository.
5041 However, each directory will need to be added
5042 separately before you will be able to add new files
5043 to those directories.
5044
5045 @example
5046 $ mkdir -p foo/bar
5047 $ cp ~/myfile foo/bar/myfile
5048 $ cvs add foo foo/bar
5049 $ cvs add foo/bar/myfile
5050 @end example
5051
5052 @cindex add (subcommand)
5053 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
5054
5055 Schedule @var{files} to be added to the repository.
5056 The files or directories specified with @code{add} must
5057 already exist in the current directory.  To add a whole
5058 new directory hierarchy to the source repository (for
5059 example, files received from a third-party vendor), use
5060 the @code{import} command instead.  @xref{import}.
5061
5062 The added files are not placed in the source repository
5063 until you use @code{commit} to make the change
5064 permanent.  Doing an @code{add} on a file that was
5065 removed with the @code{remove} command will undo the
5066 effect of the @code{remove}, unless a @code{commit}
5067 command intervened.  @xref{Removing files}, for an
5068 example.
5069
5070 The @samp{-k} option specifies the default way that
5071 this file will be checked out; for more information see
5072 @ref{Substitution modes}.
5073
5074 @c As noted in BUGS, -m is broken client/server (Nov
5075 @c 96).  Also see testsuite log2-* tests.
5076 The @samp{-m} option specifies a description for the
5077 file.  This description appears in the history log (if
5078 it is enabled, @pxref{history file}).  It will also be
5079 saved in the version history inside the repository when
5080 the file is committed.  The @code{log} command displays
5081 this description.  The description can be changed using
5082 @samp{admin -t}.  @xref{admin}.  If you omit the
5083 @samp{-m @var{description}} flag, an empty string will
5084 be used.  You will not be prompted for a description.
5085 @end deffn
5086
5087 For example, the following commands add the file
5088 @file{backend.c} to the repository:
5089
5090 @c This example used to specify
5091 @c     -m "Optimizer and code generation passes."
5092 @c to the cvs add command, but that doesn't work
5093 @c client/server (see log2 in sanity.sh).  Should fix CVS,
5094 @c but also seems strange to document things which
5095 @c don't work...
5096 @example
5097 $ cvs add backend.c
5098 $ cvs commit -m "Early version. Not yet compilable." backend.c
5099 @end example
5100
5101 When you add a file it is added only on the branch
5102 which you are working on (@pxref{Branching and merging}).  You can
5103 later merge the additions to another branch if you want
5104 (@pxref{Merging adds and removals}).
5105 @c Should we mention that earlier versions of CVS
5106 @c lacked this feature (1.3) or implemented it in a buggy
5107 @c way (well, 1.8 had many bugs in cvs update -j)?
5108 @c Should we mention the bug/limitation regarding a
5109 @c file being a regular file on one branch and a directory
5110 @c on another?
5111 @c FIXME: This needs an example, or several, here or
5112 @c elsewhere, for it to make much sense.
5113 @c Somewhere we need to discuss the aspects of death
5114 @c support which don't involve branching, I guess.
5115 @c Like the ability to re-create a release from a tag.
5116
5117 @c ---------------------------------------------------------------------
5118 @node Removing files
5119 @section Removing files
5120 @cindex Removing files
5121 @cindex Deleting files
5122
5123 @c FIXME: this node wants to be split into several
5124 @c smaller nodes.  Could make these children of
5125 @c "Adding and removing", probably (death support could
5126 @c be its own section, for example, as could the
5127 @c various bits about undoing mistakes in adding and
5128 @c removing).
5129 Directories change.  New files are added, and old files
5130 disappear.  Still, you want to be able to retrieve an
5131 exact copy of old releases.
5132
5133 Here is what you can do to remove a file,
5134 but remain able to retrieve old revisions:
5135
5136 @itemize @bullet
5137 @c FIXME: should probably be saying something about
5138 @c having a working directory in the first place.
5139 @item
5140 Make sure that you have not made any uncommitted
5141 modifications to the file.  @xref{Viewing differences},
5142 for one way to do that.  You can also use the
5143 @code{status} or @code{update} command.  If you remove
5144 the file without committing your changes, you will of
5145 course not be able to retrieve the file as it was
5146 immediately before you deleted it.
5147
5148 @item
5149 Remove the file from your working copy of the directory.
5150 You can for instance use @code{rm}.
5151
5152 @item
5153 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
5154 you really want to delete the file.
5155
5156 @item
5157 Use @samp{cvs commit @var{filename}} to actually
5158 perform the removal of the file from the repository.
5159 @end itemize
5160
5161 @c FIXME: Somehow this should be linked in with a more
5162 @c general discussion of death support.  I don't know
5163 @c whether we want to use the term "death support" or
5164 @c not (we can perhaps get by without it), but we do
5165 @c need to discuss the "dead" state in "cvs log" and
5166 @c related subjects.  The current discussion is
5167 @c scattered around, and not xref'd to each other.
5168 @c FIXME: I think this paragraph wants to be moved
5169 @c later down, at least after the first example.
5170 When you commit the removal of the file, @sc{cvs}
5171 records the fact that the file no longer exists.  It is
5172 possible for a file to exist on only some branches and
5173 not on others, or to re-add another file with the same
5174 name later.  @sc{cvs} will correctly create or not create
5175 the file, based on the @samp{-r} and @samp{-D} options
5176 specified to @code{checkout} or @code{update}.
5177
5178 @c FIXME: This style seems to clash with how we
5179 @c document things in general.
5180 @cindex Remove (subcommand)
5181 @deffn Command {cvs remove} [options] files @dots{}
5182
5183 Schedule file(s) to be removed from the repository
5184 (files which have not already been removed from the
5185 working directory are not processed).  This command
5186 does not actually remove the file from the repository
5187 until you commit the removal.  For a full list of
5188 options, see @ref{Invoking CVS}.
5189 @end deffn
5190
5191 Here is an example of removing several files:
5192
5193 @example
5194 $ cd test
5195 $ rm *.c
5196 $ cvs remove
5197 cvs remove: Removing .
5198 cvs remove: scheduling a.c for removal
5199 cvs remove: scheduling b.c for removal
5200 cvs remove: use 'cvs commit' to remove these files permanently
5201 $ cvs ci -m "Removed unneeded files"
5202 cvs commit: Examining .
5203 cvs commit: Committing .
5204 @end example
5205
5206 As a convenience you can remove the file and @code{cvs
5207 remove} it in one step, by specifying the @samp{-f}
5208 option.  For example, the above example could also be
5209 done like this:
5210
5211 @example
5212 $ cd test
5213 $ cvs remove -f *.c
5214 cvs remove: scheduling a.c for removal
5215 cvs remove: scheduling b.c for removal
5216 cvs remove: use 'cvs commit' to remove these files permanently
5217 $ cvs ci -m "Removed unneeded files"
5218 cvs commit: Examining .
5219 cvs commit: Committing .
5220 @end example
5221
5222 If you execute @code{remove} for a file, and then
5223 change your mind before you commit, you can undo the
5224 @code{remove} with an @code{add} command.
5225 @ignore
5226 @c is this worth saying or not?  Somehow it seems
5227 @c confusing to me.
5228 Of course,
5229 since you have removed your copy of file in the working
5230 directory, @sc{cvs} does not necessarily bring back the
5231 contents of the file from right before you executed
5232 @code{remove}; instead it gets the file from the
5233 repository again.
5234 @end ignore
5235
5236 @c FIXME: what if you change your mind after you commit
5237 @c it?  (answer is also "cvs add" but we don't say that...).
5238 @c We need some index entries for thinks like "undoing
5239 @c removal" too.
5240
5241 @example
5242 $ ls
5243 CVS   ja.h  oj.c
5244 $ rm oj.c
5245 $ cvs remove oj.c
5246 cvs remove: scheduling oj.c for removal
5247 cvs remove: use 'cvs commit' to remove this file permanently
5248 $ cvs add oj.c
5249 U oj.c
5250 cvs add: oj.c, version 1.1.1.1, resurrected
5251 @end example
5252
5253 If you realize your mistake before you run the
5254 @code{remove} command you can use @code{update} to
5255 resurrect the file:
5256
5257 @example
5258 $ rm oj.c
5259 $ cvs update oj.c
5260 cvs update: warning: oj.c was lost
5261 U oj.c
5262 @end example
5263
5264 When you remove a file it is removed only on the branch
5265 which you are working on (@pxref{Branching and merging}).  You can
5266 later merge the removals to another branch if you want
5267 (@pxref{Merging adds and removals}).
5268
5269 @node Removing directories
5270 @section Removing directories
5271 @cindex Removing directories
5272 @cindex Directories, removing
5273
5274 In concept removing directories is somewhat similar to
5275 removing files---you want the directory to not exist in
5276 your current working directories, but you also want to
5277 be able to retrieve old releases in which the directory
5278 existed.
5279
5280 The way that you remove a directory is to remove all
5281 the files in it.  You don't remove the directory
5282 itself; there is no way to do that.
5283 Instead you specify the @samp{-P} option to
5284 @code{cvs update} or @code{cvs checkout},
5285 which will cause @sc{cvs} to remove empty
5286 directories from working directories.
5287 (Note that @code{cvs export} always removes empty directories.)
5288 Probably the
5289 best way to do this is to always specify @samp{-P}; if
5290 you want an empty directory then put a dummy file (for
5291 example @file{.keepme}) in it to prevent @samp{-P} from
5292 removing it.
5293
5294 @c I'd try to give a rationale for this, but I'm not
5295 @c sure there is a particularly convincing one.  What
5296 @c we would _like_ is for CVS to do a better job of version
5297 @c controlling whether directories exist, to eliminate the
5298 @c need for -P and so that a file can be a directory in
5299 @c one revision and a regular file in another.
5300 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5301 options of @code{checkout}.  This way
5302 @sc{cvs} will be able to correctly create the directory
5303 or not depending on whether the particular version you
5304 are checking out contains any files in that directory.
5305
5306 @c ---------------------------------------------------------------------
5307 @node Moving files
5308 @section Moving and renaming files
5309 @cindex Moving files
5310 @cindex Renaming files
5311 @cindex Files, moving
5312
5313 Moving files to a different directory or renaming them
5314 is not difficult, but some of the ways in which this
5315 works may be non-obvious.  (Moving or renaming a
5316 directory is even harder.  @xref{Moving directories}.).
5317
5318 The examples below assume that the file @var{old} is renamed to
5319 @var{new}.
5320
5321 @menu
5322 * Outside::                     The normal way to Rename
5323 * Inside::                      A tricky, alternative way
5324 * Rename by copying::           Another tricky, alternative way
5325 @end menu
5326
5327 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5328 @node Outside
5329 @subsection The Normal way to Rename
5330
5331 @c More rename issues.  Not sure whether these are
5332 @c worth documenting; I'm putting them here because
5333 @c it seems to be as good a place as any to try to
5334 @c set down the issues.
5335 @c * "cvs annotate" will annotate either the new
5336 @c file or the old file; it cannot annotate _each
5337 @c line_ based on whether it was last changed in the
5338 @c new or old file.  Unlike "cvs log", where the
5339 @c consequences of having to select either the new
5340 @c or old name seem fairly benign, this may be a
5341 @c real advantage to having CVS know about renames
5342 @c other than as a deletion and an addition.
5343
5344 The normal way to move a file is to copy @var{old} to
5345 @var{new}, and then issue the normal @sc{cvs} commands
5346 to remove @var{old} from the repository, and add
5347 @var{new} to it.
5348 @c The following sentence is not true: one must cd into
5349 @c the directory to run "cvs add".
5350 @c  (Both @var{old} and @var{new} could
5351 @c contain relative paths, for example @file{foo/bar.c}).
5352
5353 @example
5354 $ mv @var{old} @var{new}
5355 $ cvs remove @var{old}
5356 $ cvs add @var{new}
5357 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5358 @end example
5359
5360 This is the simplest way to move a file, it is not
5361 error-prone, and it preserves the history of what was
5362 done.  Note that to access the history of the file you
5363 must specify the old or the new name, depending on what
5364 portion of the history you are accessing.  For example,
5365 @code{cvs log @var{old}} will give the log up until the
5366 time of the rename.
5367
5368 When @var{new} is committed its revision numbers will
5369 start again, usually at 1.1, so if that bothers you,
5370 use the @samp{-r @var{tag}} option to commit.  For more
5371 information see @ref{Assigning revisions}.
5372
5373 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5374 @node Inside
5375 @subsection Moving the history file
5376
5377 This method is more dangerous, since it involves moving
5378 files inside the repository.  Read this entire section
5379 before trying it out!
5380
5381 @example
5382 $ cd $CVSROOT/@var{dir}
5383 $ mv @var{old},v @var{new},v
5384 @end example
5385
5386 @noindent
5387 Advantages:
5388
5389 @itemize @bullet
5390 @item
5391 The log of changes is maintained intact.
5392
5393 @item
5394 The revision numbers are not affected.
5395 @end itemize
5396
5397 @noindent
5398 Disadvantages:
5399
5400 @itemize @bullet
5401 @item
5402 Old releases cannot easily be fetched from the
5403 repository.  (The file will show up as @var{new} even
5404 in revisions from the time before it was renamed).
5405
5406 @item
5407 There is no log information of when the file was renamed.
5408
5409 @item
5410 Nasty things might happen if someone accesses the history file
5411 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5412 commands while you move it.
5413 @end itemize
5414
5415 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5416 @node Rename by copying
5417 @subsection Copying the history file
5418
5419 This way also involves direct modifications to the
5420 repository.  It is safe, but not without drawbacks.
5421
5422 @example
5423 # @r{Copy the @sc{rcs} file inside the repository}
5424 $ cd $CVSROOT/@var{dir}
5425 $ cp @var{old},v @var{new},v
5426 # @r{Remove the old file}
5427 $ cd ~/@var{dir}
5428 $ rm @var{old}
5429 $ cvs remove @var{old}
5430 $ cvs commit @var{old}
5431 # @r{Remove all tags from @var{new}}
5432 $ cvs update @var{new}
5433 $ cvs log @var{new}             # @r{Remember the non-branch tag names}
5434 $ cvs tag -d @var{tag1} @var{new}
5435 $ cvs tag -d @var{tag2} @var{new}
5436 @dots{}
5437 @end example
5438
5439 By removing the tags you will be able to check out old
5440 revisions.
5441
5442 @noindent
5443 Advantages:
5444
5445 @itemize @bullet
5446 @item
5447 @c FIXME: Is this true about -D now that we have death
5448 @c support?  See 5B.3 in the FAQ.
5449 Checking out old revisions works correctly, as long as
5450 you use @samp{-r @var{tag}} and not @samp{-D @var{date}}
5451 to retrieve the revisions.
5452
5453 @item
5454 The log of changes is maintained intact.
5455
5456 @item
5457 The revision numbers are not affected.
5458 @end itemize
5459
5460 @noindent
5461 Disadvantages:
5462
5463 @itemize @bullet
5464 @item
5465 You cannot easily see the history of the file across the rename.
5466
5467 @ignore
5468 @c Is this true?  I don't see how the revision numbers
5469 @c _could_ start over, when new,v is just old,v with
5470 @c the tags deleted.
5471 @c If there is some need to reinstate this text,
5472 @c it is "usually 1.1", not "1.0" and it needs an
5473 @c xref to Assigning revisions
5474 @item
5475 Unless you use the @samp{-r @var{tag}} (@pxref{commit
5476 options}) flag when @var{new} is committed its revision
5477 numbers will start at 1.0 again.
5478 @end ignore
5479 @end itemize
5480
5481 @c ---------------------------------------------------------------------
5482 @node Moving directories
5483 @section Moving and renaming directories
5484 @cindex Moving directories
5485 @cindex Renaming directories
5486 @cindex Directories, moving
5487
5488 The normal way to rename or move a directory is to
5489 rename or move each file within it as described in
5490 @ref{Outside}.  Then check out with the @samp{-P}
5491 option, as described in @ref{Removing directories}.
5492
5493 If you really want to hack the repository to rename or
5494 delete a directory in the repository, you can do it
5495 like this:
5496
5497 @enumerate
5498 @item
5499 Inform everyone who has a checked out copy of the directory that the
5500 directory will be renamed.  They should commit all
5501 their changes, and remove their working copies,
5502 before you take the steps below.
5503
5504 @item
5505 Rename the directory inside the repository.
5506
5507 @example
5508 $ cd $CVSROOT/@var{parent-dir}
5509 $ mv @var{old-dir} @var{new-dir}
5510 @end example
5511
5512 @item
5513 Fix the @sc{cvs} administrative files, if necessary (for
5514 instance if you renamed an entire module).
5515
5516 @item
5517 Tell everyone that they can check out again and continue
5518 working.
5519
5520 @end enumerate
5521
5522 If someone had a working copy the @sc{cvs} commands will
5523 cease to work for him, until he removes the directory
5524 that disappeared inside the repository.
5525
5526 It is almost always better to move the files in the
5527 directory instead of moving the directory.  If you move the
5528 directory you are unlikely to be able to retrieve old
5529 releases correctly, since they probably depend on the
5530 name of the directories.
5531
5532 @c ---------------------------------------------------------------------
5533 @node History browsing
5534 @chapter History browsing
5535 @cindex History browsing
5536 @cindex Traceability
5537 @cindex Isolation
5538
5539 @ignore
5540 @c This is too long for an introduction (goal is
5541 @c one 20x80 character screen), and also mixes up a
5542 @c variety of issues (parallel development, history,
5543 @c maybe even touches on process control).
5544
5545 @c -- @quote{To lose ones history is to lose ones soul.}
5546 @c -- ///
5547 @c -- ///Those who cannot remember the past are condemned to repeat it.
5548 @c -- ///               -- George Santayana
5549 @c -- ///
5550
5551 @sc{cvs} tries to make it easy for a group of people to work
5552 together.  This is done in two ways:
5553
5554 @itemize @bullet
5555 @item
5556 Isolation---You have your own working copy of the
5557 source.  You are not affected by modifications made by
5558 others until you decide to incorporate those changes
5559 (via the @code{update} command---@pxref{update}).
5560
5561 @item
5562 Traceability---When something has changed, you can
5563 always see @emph{exactly} what changed.
5564 @end itemize
5565
5566 There are several features of @sc{cvs} that together lead
5567 to traceability:
5568
5569 @itemize @bullet
5570 @item
5571 Each revision of a file has an accompanying log
5572 message.
5573
5574 @item
5575 All commits are optionally logged to a central history
5576 database.
5577
5578 @item
5579 Logging information can be sent to a user-defined
5580 program (@pxref{loginfo}).
5581 @end itemize
5582
5583 @c -- More text here.
5584
5585 This chapter should talk about the history file, the
5586 @code{log} command, the usefulness of ChangeLogs
5587 even when you run @sc{cvs}, and things like that.
5588
5589 @end ignore
5590
5591 @c kind of lame, in a lot of ways the above text inside
5592 @c the @ignore motivates this chapter better
5593 Once you have used @sc{cvs} to store a version control
5594 history---what files have changed when, how, and by
5595 whom, there are a variety of mechanisms for looking
5596 through the history.
5597
5598 @c FIXME: should also be talking about how you look at
5599 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5600 @menu
5601 * log messages::                Log messages
5602 * history database::            The history database
5603 * user-defined logging::        User-defined logging
5604 @end menu
5605
5606 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5607 @node log messages
5608 @section Log messages
5609
5610 @c FIXME: @xref to place where we talk about how to
5611 @c specify message to commit.
5612 Whenever you commit a file you specify a log message.
5613
5614 @c FIXME: bring the information here, and get rid of or
5615 @c greatly shrink the "log" node.
5616 To look through the log messages which have been
5617 specified for every revision which has been committed,
5618 use the @code{cvs log} command (@pxref{log}).
5619
5620 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5621 @node history database
5622 @section The history database
5623
5624 @c FIXME: bring the information from the history file
5625 @c and history nodes here.  Rewrite it to be motivated
5626 @c better (start out by clearly explaining what gets
5627 @c logged in history, for example).
5628 You can use the history file (@pxref{history file}) to
5629 log various @sc{cvs} actions.  To retrieve the
5630 information from the history file, use the @code{cvs
5631 history} command (@pxref{history}).
5632
5633 Note: you can control what is logged to this file by using the
5634 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5635 (@pxref{config}).
5636
5637 @c
5638 @c The history database has many problems:
5639 @c * It is very unclear what field means what.  This
5640 @c could be improved greatly by better documentation,
5641 @c but there are still non-orthogonalities (for
5642 @c example, tag does not record the "repository"
5643 @c field but most records do).
5644 @c * Confusion about files, directories, and modules.
5645 @c Some commands record one, some record others.
5646 @c * File removal is not logged.  There is an 'R'
5647 @c record type documented, but CVS never uses it.
5648 @c * Tags are only logged for the "cvs rtag" command,
5649 @c not "cvs tag".  The fix for this is not completely
5650 @c clear (see above about modules vs. files).
5651 @c * Are there other cases of operations that are not
5652 @c logged?  One would hope for all changes to the
5653 @c repository to be logged somehow (particularly
5654 @c operations like tagging, "cvs admin -k", and other
5655 @c operations which do not record a history that one
5656 @c can get with "cvs log").  Operations on the working
5657 @c directory, like export, get, and release, are a
5658 @c second category also covered by the current "cvs
5659 @c history".
5660 @c * The history file does not record the options given
5661 @c to a command.  The most serious manifestation of
5662 @c this is perhaps that it doesn't record whether a command
5663 @c was recursive.  It is not clear to me whether one
5664 @c wants to log at a level very close to the command
5665 @c line, as a sort of way of logging each command
5666 @c (more or less), or whether one wants
5667 @c to log more at the level of what was changed (or
5668 @c something in between), but either way the current
5669 @c information has pretty big gaps.
5670 @c * Further details about a tag--like whether it is a
5671 @c branch tag or, if a non-branch tag, which branch it
5672 @c is on.  One can find out this information about the
5673 @c tag as it exists _now_, but if the tag has been
5674 @c moved, one doesn't know what it was like at the time
5675 @c the history record was written.
5676 @c * Whether operating on a particular tag, date, or
5677 @c options was implicit (sticky) or explicit.
5678 @c
5679 @c Another item, only somewhat related to the above, is a
5680 @c way to control what is logged in the history file.
5681 @c This is probably the only good way to handle
5682 @c different people having different ideas about
5683 @c information/space tradeoffs.
5684 @c
5685 @c It isn't really clear that it makes sense to try to
5686 @c patch up the history file format as it exists now to
5687 @c include all that stuff.  It might be better to
5688 @c design a whole new CVSROOT/nhistory file and "cvs
5689 @c nhistory" command, or some such, or in some other
5690 @c way trying to come up with a clean break from the
5691 @c past, which can address the above concerns.  Another
5692 @c open question is how/whether this relates to
5693 @c taginfo/loginfo/etc.
5694
5695 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5696 @node user-defined logging
5697 @section User-defined logging
5698
5699 @c FIXME: probably should centralize this information
5700 @c here, at least to some extent.  Maybe by moving the
5701 @c loginfo, etc., nodes here and replacing
5702 @c the "user-defined logging" node with one node for
5703 @c each method.
5704 You can customize @sc{cvs} to log various kinds of
5705 actions, in whatever manner you choose.  These
5706 mechanisms operate by executing a script at various
5707 times.  The script might append a message to a file
5708 listing the information and the programmer who created
5709 it, or send mail to a group of developers, or, perhaps,
5710 post a message to a particular newsgroup.  To log
5711 commits, use the @file{loginfo} file (@pxref{loginfo}), and
5712 to log tagging operations, use the @file{taginfo} file
5713 (@pxref{taginfo}).
5714
5715 @c FIXME: What is difference between doing it in the
5716 @c modules file and using loginfo/taginfo?  Why should
5717 @c user use one or the other?
5718 To log commits, checkouts, exports, and tags,
5719 respectively, you can also use the @samp{-i},
5720 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5721 modules file.  For a more flexible way of giving
5722 notifications to various users, which requires less in
5723 the way of keeping centralized scripts up to date, use
5724 the @code{cvs watch add} command (@pxref{Getting
5725 Notified}); this command is useful even if you are not
5726 using @code{cvs watch on}.
5727
5728 @c ---------------------------------------------------------------------
5729 @node Binary files
5730 @chapter Handling binary files
5731 @cindex Binary files
5732
5733 The most common use for @sc{cvs} is to store text
5734 files.  With text files, @sc{cvs} can merge revisions,
5735 display the differences between revisions in a
5736 human-visible fashion, and other such operations.
5737 However, if you are willing to give up a few of these
5738 abilities, @sc{cvs} can store binary files.  For
5739 example, one might store a web site in @sc{cvs}
5740 including both text files and binary images.
5741
5742 @menu
5743 * Binary why::     More details on issues with binary files
5744 * Binary howto::   How to store them
5745 @end menu
5746
5747 @node Binary why
5748 @section The issues with binary files
5749
5750 While the need to manage binary files may seem obvious
5751 if the files that you customarily work with are binary,
5752 putting them into version control does present some
5753 additional issues.
5754
5755 One basic function of version control is to show the
5756 differences between two revisions.  For example, if
5757 someone else checked in a new version of a file, you
5758 may wish to look at what they changed and determine
5759 whether their changes are good.  For text files,
5760 @sc{cvs} provides this functionality via the @code{cvs
5761 diff} command.  For binary files, it may be possible to
5762 extract the two revisions and then compare them with a
5763 tool external to @sc{cvs} (for example, word processing
5764 software often has such a feature).  If there is no
5765 such tool, one must track changes via other mechanisms,
5766 such as urging people to write good log messages, and
5767 hoping that the changes they actually made were the
5768 changes that they intended to make.
5769
5770 Another ability of a version control system is the
5771 ability to merge two revisions.  For @sc{cvs} this
5772 happens in two contexts.  The first is when users make
5773 changes in separate working directories
5774 (@pxref{Multiple developers}).  The second is when one
5775 merges explicitly with the @samp{update -j} command
5776 (@pxref{Branching and merging}).
5777
5778 In the case of text
5779 files, @sc{cvs} can merge changes made independently,
5780 and signal a conflict if the changes conflict.  With
5781 binary files, the best that @sc{cvs} can do is present
5782 the two different copies of the file, and leave it to
5783 the user to resolve the conflict.  The user may choose
5784 one copy or the other, or may run an external merge
5785 tool which knows about that particular file format, if
5786 one exists.
5787 Note that having the user merge relies primarily on the
5788 user to not accidentally omit some changes, and thus is
5789 potentially error prone.
5790
5791 If this process is thought to be undesirable, the best
5792 choice may be to avoid merging.  To avoid the merges
5793 that result from separate working directories, see the
5794 discussion of reserved checkouts (file locking) in
5795 @ref{Multiple developers}.  To avoid the merges
5796 resulting from branches, restrict use of branches.
5797
5798 @node Binary howto
5799 @section How to store binary files
5800
5801 There are two issues with using @sc{cvs} to store
5802 binary files.  The first is that @sc{cvs} by default
5803 converts line endings between the canonical form in
5804 which they are stored in the repository (linefeed
5805 only), and the form appropriate to the operating system
5806 in use on the client (for example, carriage return
5807 followed by line feed for Windows NT).
5808
5809 The second is that a binary file might happen to
5810 contain data which looks like a keyword (@pxref{Keyword
5811 substitution}), so keyword expansion must be turned
5812 off.
5813
5814 @c FIXME: the third is that one can't do merges with
5815 @c binary files.  xref to Multiple Developers and the
5816 @c reserved checkout issues.
5817
5818 The @samp{-kb} option available with some @sc{cvs}
5819 commands insures that neither line ending conversion
5820 nor keyword expansion will be done.
5821
5822 Here is an example of how you can create a new file
5823 using the @samp{-kb} flag:
5824
5825 @example
5826 $ echo '$@splitrcskeyword{Id}$' > kotest
5827 $ cvs add -kb -m"A test file" kotest
5828 $ cvs ci -m"First checkin; contains a keyword" kotest
5829 @end example
5830
5831 If a file accidentally gets added without @samp{-kb},
5832 one can use the @code{cvs admin} command to recover.
5833 For example:
5834
5835 @example
5836 $ echo '$@splitrcskeyword{Id}$' > kotest
5837 $ cvs add -m"A test file" kotest
5838 $ cvs ci -m"First checkin; contains a keyword" kotest
5839 $ cvs admin -kb kotest
5840 $ cvs update -A kotest
5841 # @r{For non-unix systems:}
5842 # @r{Copy in a good copy of the file from outside CVS}
5843 $ cvs commit -m "make it binary" kotest
5844 @end example
5845
5846 @c Trying to describe this for both unix and non-unix
5847 @c in the same description is very confusing.  Might
5848 @c want to split the two, or just ditch the unix "shortcut"
5849 @c (unixheads don't do much with binary files, anyway).
5850 @c This used to say "(Try the above example, and do a
5851 @c @code{cat kotest} after every command)".  But that
5852 @c only really makes sense for the unix case.
5853 When you check in the file @file{kotest} the file is
5854 not preserved as a binary file, because you did not
5855 check it in as a binary file.  The @code{cvs
5856 admin -kb} command sets the default keyword
5857 substitution method for this file, but it does not
5858 alter the working copy of the file that you have.  If you need to
5859 cope with line endings (that is, you are using
5860 @sc{cvs} on a non-unix system), then you need to
5861 check in a new copy of the file, as shown by the
5862 @code{cvs commit} command above.
5863 On unix, the @code{cvs update -A} command suffices.
5864 @c FIXME: should also describe what the *other users*
5865 @c need to do, if they have checked out copies which
5866 @c have been corrupted by lack of -kb.  I think maybe
5867 @c "cvs update -kb" or "cvs
5868 @c update -A" would suffice, although the user who
5869 @c reported this suggested removing the file, manually
5870 @c removing it from CVS/Entries, and then "cvs update"
5871 (Note that you can use @code{cvs log} to determine the default keyword
5872 substitution method for a file and @code{cvs status} to determine
5873 the keyword substitution method for a working copy.)
5874
5875 However, in using @code{cvs admin -k} to change the
5876 keyword expansion, be aware that the keyword expansion
5877 mode is not version controlled.  This means that, for
5878 example, that if you have a text file in old releases,
5879 and a binary file with the same name in new releases,
5880 @sc{cvs} provides no way to check out the file in text
5881 or binary mode depending on what version you are
5882 checking out.  There is no good workaround for this
5883 problem.
5884
5885 You can also set a default for whether @code{cvs add}
5886 and @code{cvs import} treat a file as binary based on
5887 its name; for example you could say that files who
5888 names end in @samp{.exe} are binary.  @xref{Wrappers}.
5889 There is currently no way to have @sc{cvs} detect
5890 whether a file is binary based on its contents.  The
5891 main difficulty with designing such a feature is that
5892 it is not clear how to distinguish between binary and
5893 non-binary files, and the rules to apply would vary
5894 considerably with the operating system.
5895 @c For example, it would be good on MS-DOS-family OSes
5896 @c for anything containing ^Z to be binary.  Having
5897 @c characters with the 8th bit set imply binary is almost
5898 @c surely a bad idea in the context of ISO-8859-* and
5899 @c other such character sets.  On VMS or the Mac, we
5900 @c could use the OS's file typing.  This is a
5901 @c commonly-desired feature, and something of this sort
5902 @c may make sense.  But there are a lot of pitfalls here.
5903 @c
5904 @c Another, probably better, way to tell is to read the
5905 @c file in text mode, write it to a temp file in text
5906 @c mode, and then do a binary mode compare of the two
5907 @c files.  If they differ, it is a binary file.  This
5908 @c might have problems on VMS (or some other system
5909 @c with several different text modes), but in general
5910 @c should be relatively portable.  The only other
5911 @c downside I can think of is that it would be fairly
5912 @c slow, but that is perhaps a small price to pay for
5913 @c not having your files corrupted.  Another issue is
5914 @c what happens if you import a text file with bare
5915 @c linefeeds on Windows.  Such files will show up on
5916 @c Windows sometimes (I think some native windows
5917 @c programs even write them, on occasion).  Perhaps it
5918 @c is reasonable to treat such files as binary; after
5919 @c all it is something of a presumption to assume that
5920 @c the user would want the linefeeds converted to CRLF.
5921
5922 @c ---------------------------------------------------------------------
5923 @node Multiple developers
5924 @chapter Multiple developers
5925 @cindex Multiple developers
5926 @cindex Team of developers
5927 @cindex File locking
5928 @cindex Locking files
5929 @cindex Working copy
5930 @cindex Reserved checkouts
5931 @cindex Unreserved checkouts
5932 @cindex RCS-style locking
5933
5934 When more than one person works on a software project
5935 things often get complicated.  Often, two people try to
5936 edit the same file simultaneously.  One solution, known
5937 as @dfn{file locking} or @dfn{reserved checkouts}, is
5938 to allow only one person to edit each file at a time.
5939 This is the only solution with some version control
5940 systems, including @sc{rcs} and @sc{sccs}.  Currently
5941 the usual way to get reserved checkouts with @sc{cvs}
5942 is the @code{cvs admin -l} command (@pxref{admin
5943 options}).  This is not as nicely integrated into
5944 @sc{cvs} as the watch features, described below, but it
5945 seems that most people with a need for reserved
5946 checkouts find it adequate.
5947 @c Or "find it better than worrying about implementing
5948 @c nicely integrated reserved checkouts" or ...?
5949
5950 As of @sc{cvs} version 1.12.10, another technique for getting most of the
5951 effect of reserved checkouts is to enable advisory locks.  To enable advisory
5952 locks, have all developers put "edit -c", "commit -c" in their
5953 .cvsrc file, and turn on watches in the repository.  This
5954 prevents them from doing a @code{cvs edit} if anyone is
5955 already editting the file.  It also may
5956 be possible to use plain watches together with suitable
5957 procedures (not enforced by software), to avoid having
5958 two people edit at the same time.
5959
5960 @c Our unreserved checkout model might not
5961 @c be quite the same as others.  For example, I
5962 @c think that some systems will tend to create a branch
5963 @c in the case where CVS prints "up-to-date check failed".
5964 @c It isn't clear to me whether we should try to
5965 @c explore these subtleties; it could easily just
5966 @c confuse people.
5967 The default model with @sc{cvs} is known as
5968 @dfn{unreserved checkouts}.  In this model, developers
5969 can edit their own @dfn{working copy} of a file
5970 simultaneously.  The first person that commits his
5971 changes has no automatic way of knowing that another
5972 has started to edit it.  Others will get an error
5973 message when they try to commit the file.  They must
5974 then use @sc{cvs} commands to bring their working copy
5975 up to date with the repository revision.  This process
5976 is almost automatic.
5977
5978 @c FIXME? should probably use the word "watch" here, to
5979 @c tie this into the text below and above.
5980 @sc{cvs} also supports mechanisms which facilitate
5981 various kinds of communication, without actually
5982 enforcing rules like reserved checkouts do.
5983
5984 The rest of this chapter describes how these various
5985 models work, and some of the issues involved in
5986 choosing between them.
5987
5988 @ignore
5989 Here is a draft reserved checkout design or discussion
5990 of the issues.  This seems like as good a place as any
5991 for this.
5992
5993 Might want a cvs lock/cvs unlock--in which the names
5994 differ from edit/unedit because the network must be up
5995 for these to work.  unedit gives an error if there is a
5996 reserved checkout in place (so that people don't
5997 accidentally leave locks around); unlock gives an error
5998 if one is not in place (this is more arguable; perhaps
5999 it should act like unedit in that case).
6000
6001 On the other hand, might want it so that emacs,
6002 scripts, etc., can get ready to edit a file without
6003 having to know which model is in use.  In that case we
6004 would have a "cvs watch lock" (or .cvsrc?) (that is,
6005 three settings, "on", "off", and "lock").  Having cvs
6006 watch lock set would cause a get to record in the CVS
6007 directory which model is in use, and cause "cvs edit"
6008 to change behaviors.  We'd want a way to query which
6009 setting is in effect (this would be handy even if it is
6010 only "on" or "off" as presently).  If lock is in
6011 effect, then commit would require a lock before
6012 allowing a checkin; chmod wouldn't suffice (might be
6013 debatable--see chmod comment below, in watches--but it
6014 is the way people expect RCS to work and I can't think
6015 of any significant downside.  On the other hand, maybe
6016 it isn't worth bothering, because people who are used
6017 to RCS wouldn't think to use chmod anyway).
6018
6019 Implementation: use file attributes or use RCS
6020 locking.  The former avoids more dependence on RCS
6021 behaviors we will need to re-implement as we librarify
6022 RCS, and makes it easier to import/export RCS files (in
6023 that context, want to ignore the locker field).  But
6024 note that RCS locks are per-branch, which is the
6025 correct behavior (this is also an issue for the "watch
6026 on" features; they should be per-branch too).
6027
6028 Here are a few more random notes about implementation
6029 details, assuming "cvs watch lock" and
6030
6031 CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
6032 Cases: (1) file is checked out (unreserved or with watch on) by old
6033 version of @sc{cvs}, now we do something with new one, (2) file is checked
6034 out by new version, now we do something with old one.
6035
6036 Remote protocol would have a "Watched" analogous to "Mode".  Of course
6037 it would apply to all Updated-like requests.  How do we keep this
6038 setting up to date?  I guess that there wants to be a Watched request,
6039 and the server would send a new one if it isn't up to date? (Ugh--hard
6040 to implement and slows down "cvs -q update"--is there an easier way?)
6041
6042 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
6043 "edit-lock" request.  Which comes back with a Checked-in with
6044 appropriate Watched (off, on, lock, locked, or some such?), or error
6045 message if already locked.
6046
6047 "cvs commit"--only will commit if off/on/locked.  lock is not OK.
6048
6049 Doc:
6050 note that "cvs edit" must be connected to network if watch lock is in
6051 effect.
6052
6053 Talk about what to do if someone has locked a file and you want to
6054 edit that file.  (breaking locks, or lack thereof).
6055
6056
6057 One other idea (which could work along with the
6058 existing "cvs admin -l" reserved checkouts, as well as
6059 the above):
6060
6061 "cvs editors" could show who has the file locked, if
6062 someone does.
6063
6064 @end ignore
6065
6066 @menu
6067 * File status::                 A file can be in several states
6068 * Updating a file::             Bringing a file up-to-date
6069 * Conflicts example::           An informative example
6070 * Informing others::            To cooperate you must inform
6071 * Concurrency::                 Simultaneous repository access
6072 * Watches::                     Mechanisms to track who is editing files
6073 * Choosing a model::            Reserved or unreserved checkouts?
6074 @end menu
6075
6076 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6077 @node File status
6078 @section File status
6079 @cindex File status
6080 @cindex Status of a file
6081
6082 @c Shouldn't this start with an example or something,
6083 @c introducing the unreserved checkout model?  Before we
6084 @c dive into listing states?
6085 Based on what operations you have performed on a
6086 checked out file, and what operations others have
6087 performed to that file in the repository, one can
6088 classify a file in a number of states.  The states, as
6089 reported by the @code{status} command, are:
6090
6091 @c The order of items is chosen to group logically
6092 @c similar outputs together.
6093 @c People who want alphabetical can use the index...
6094 @table @asis
6095 @cindex Up-to-date
6096 @item Up-to-date
6097 The file is identical with the latest revision in the
6098 repository for the branch in use.
6099 @c FIXME: should we clarify "in use"?  The answer is
6100 @c sticky tags, and trying to distinguish branch sticky
6101 @c tags from non-branch sticky tags seems rather awkward
6102 @c here.
6103 @c FIXME: What happens with non-branch sticky tags?  Is
6104 @c a stuck file "Up-to-date" or "Needs checkout" or what?
6105
6106 @item Locally Modified
6107 @cindex Locally Modified
6108 You have edited the file, and not yet committed your changes.
6109
6110 @item Locally Added
6111 @cindex Locally Added
6112 You have added the file with @code{add}, and not yet
6113 committed your changes.
6114 @c There are many cases involving the file being
6115 @c added/removed/modified in the working directory, and
6116 @c added/removed/modified in the repository, which we
6117 @c don't try to describe here.  I'm not sure that "cvs
6118 @c status" produces a non-confusing output in most of
6119 @c those cases.
6120
6121 @item Locally Removed
6122 @cindex Locally Removed
6123 You have removed the file with @code{remove}, and not yet
6124 committed your changes.
6125
6126 @item Needs Checkout
6127 @cindex Needs Checkout
6128 Someone else has committed a newer revision to the
6129 repository.  The name is slightly misleading; you will
6130 ordinarily use @code{update} rather than
6131 @code{checkout} to get that newer revision.
6132
6133 @item Needs Patch
6134 @cindex Needs Patch
6135 @c See also newb-123j0 in sanity.sh (although that case
6136 @c should probably be changed rather than documented).
6137 Like Needs Checkout, but the @sc{cvs} server will send
6138 a patch rather than the entire file.  Sending a patch or
6139 sending an entire file accomplishes the same thing.
6140
6141 @item Needs Merge
6142 @cindex Needs Merge
6143 Someone else has committed a newer revision to the repository, and you
6144 have also made modifications to the file.
6145
6146 @item Unresolved Conflict
6147 @cindex Unresolved Conflict
6148 @c FIXCVS - This file status needs to be changed to some more informative
6149 @c text that distinguishes it more clearly from each of the Locally Added,
6150 @c File had conflicts on merge, and Unknown status types, but an exact and
6151 @c succinct wording escapes me at the moment.
6152 A file with the same name as this new file has been added to the repository
6153 from a second workspace.  This file will need to be moved out of the way
6154 to allow an @code{update} to complete.
6155
6156 @item File had conflicts on merge
6157 @cindex File had conflicts on merge
6158 @c is it worth saying that this message was "Unresolved
6159 @c Conflict" in CVS 1.9 and earlier?  I'm inclined to
6160 @c think that is unnecessarily confusing to new users.
6161 This is like Locally Modified, except that a previous
6162 @code{update} command gave a conflict.  If you have not
6163 already done so, you need to
6164 resolve the conflict as described in @ref{Conflicts example}.
6165
6166 @item Unknown
6167 @cindex Unknown
6168 @sc{cvs} doesn't know anything about this file.  For
6169 example, you have created a new file and have not run
6170 @code{add}.
6171 @c
6172 @c "Entry Invalid" and "Classify Error" are also in the
6173 @c status.c.  The latter definitely indicates a CVS bug
6174 @c (should it be worded more like "internal error" so
6175 @c people submit bug reports if they see it?).  The former
6176 @c I'm not as sure; I haven't tracked down whether/when it
6177 @c appears in "cvs status" output.
6178
6179 @end table
6180
6181 To help clarify the file status, @code{status} also
6182 reports the @code{Working revision} which is the
6183 revision that the file in the working directory derives
6184 from, and the @code{Repository revision} which is the
6185 latest revision in the repository for the branch in
6186 use.
6187 The @samp{Commit Identifier} reflects the unique commitid
6188 of the @code{commit}.
6189 @c FIXME: should we clarify "in use"?  The answer is
6190 @c sticky tags, and trying to distinguish branch sticky
6191 @c tags from non-branch sticky tags seems rather awkward
6192 @c here.
6193 @c FIXME: What happens with non-branch sticky tags?
6194 @c What is the Repository Revision there?  See the
6195 @c comment at vn_rcs in cvs.h, which is kind of
6196 @c confused--we really need to document better what this
6197 @c field contains.
6198 @c Q: Should we document "New file!" and other such
6199 @c outputs or are they self-explanatory?
6200 @c FIXME: what about the date to the right of "Working
6201 @c revision"?  It doesn't appear with client/server and
6202 @c seems unnecessary (redundant with "ls -l") so
6203 @c perhaps it should be removed for non-client/server too?
6204 @c FIXME: Need some examples.
6205 @c FIXME: Working revision can also be something like
6206 @c "-1.3" for a locally removed file.  Not at all
6207 @c self-explanatory (and it is possible that CVS should
6208 @c be changed rather than documenting this).
6209
6210 @c Would be nice to have an @example showing output
6211 @c from cvs status, with comments showing the xref
6212 @c where each part of the output is described.  This
6213 @c might fit in nicely if it is desirable to split this
6214 @c node in two; one to introduce "cvs status" and one
6215 @c to list each of the states.
6216 The options to @code{status} are listed in
6217 @ref{Invoking CVS}.  For information on its @code{Sticky tag}
6218 and @code{Sticky date} output, see @ref{Sticky tags}.
6219 For information on its @code{Sticky options} output,
6220 see the @samp{-k} option in @ref{update options}.
6221
6222 You can think of the @code{status} and @code{update}
6223 commands as somewhat complementary.  You use
6224 @code{update} to bring your files up to date, and you
6225 can use @code{status} to give you some idea of what an
6226 @code{update} would do (of course, the state of the
6227 repository might change before you actually run
6228 @code{update}).  In fact, if you want a command to
6229 display file status in a more brief format than is
6230 displayed by the @code{status} command, you can invoke
6231
6232 @cindex update, to display file status
6233 @example
6234 $ cvs -n -q update
6235 @end example
6236
6237 The @samp{-n} option means to not actually do the
6238 update, but merely to display statuses; the @samp{-q}
6239 option avoids printing the name of each directory.  For
6240 more information on the @code{update} command, and
6241 these options, see @ref{Invoking CVS}.
6242
6243 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6244 @node Updating a file
6245 @section Bringing a file up to date
6246 @cindex Bringing a file up to date
6247 @cindex Updating a file
6248 @cindex Merging a file
6249 @cindex Update, introduction
6250
6251 When you want to update or merge a file, use the @code{update}
6252 command.  For files that are not up to date this is roughly equivalent
6253 to a @code{checkout} command: the newest revision of the file is
6254 extracted from the repository and put in your working directory.
6255
6256 Your modifications to a file are never lost when you
6257 use @code{update}.  If no newer revision exists,
6258 running @code{update} has no effect.  If you have
6259 edited the file, and a newer revision is available,
6260 @sc{cvs} will merge all changes into your working copy.
6261
6262 For instance, imagine that you checked out revision 1.4 and started
6263 editing it.  In the meantime someone else committed revision 1.5, and
6264 shortly after that revision 1.6.  If you run @code{update} on the file
6265 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
6266 your file.
6267
6268 @cindex Overlap
6269 If any of the changes between 1.4 and 1.6 were made too
6270 close to any of the changes you have made, an
6271 @dfn{overlap} occurs.  In such cases a warning is
6272 printed, and the resulting file includes both
6273 versions of the lines that overlap, delimited by
6274 special markers.
6275 @xref{update}, for a complete description of the
6276 @code{update} command.
6277
6278 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6279 @node Conflicts example
6280 @section Conflicts example
6281 @cindex Merge, an example
6282 @cindex Example of merge
6283 @cindex driver.c (merge example)
6284
6285 Suppose revision 1.4 of @file{driver.c} contains this:
6286
6287 @example
6288 #include <stdio.h>
6289
6290 void main()
6291 @{
6292     parse();
6293     if (nerr == 0)
6294         gencode();
6295     else
6296         fprintf(stderr, "No code generated.\n");
6297     exit(nerr == 0 ? 0 : 1);
6298 @}
6299 @end example
6300
6301 @noindent
6302 Revision 1.6 of @file{driver.c} contains this:
6303
6304 @example
6305 #include <stdio.h>
6306
6307 int main(int argc,
6308          char **argv)
6309 @{
6310     parse();
6311     if (argc != 1)
6312     @{
6313         fprintf(stderr, "tc: No args expected.\n");
6314         exit(1);
6315     @}
6316     if (nerr == 0)
6317         gencode();
6318     else
6319         fprintf(stderr, "No code generated.\n");
6320     exit(!!nerr);
6321 @}
6322 @end example
6323
6324 @noindent
6325 Your working copy of @file{driver.c}, based on revision
6326 1.4, contains this before you run @samp{cvs update}:
6327 @c -- Really include "cvs"?
6328
6329 @example
6330 #include <stdlib.h>
6331 #include <stdio.h>
6332
6333 void main()
6334 @{
6335     init_scanner();
6336     parse();
6337     if (nerr == 0)
6338         gencode();
6339     else
6340         fprintf(stderr, "No code generated.\n");
6341     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6342 @}
6343 @end example
6344
6345 @noindent
6346 You run @samp{cvs update}:
6347 @c -- Really include "cvs"?
6348
6349 @example
6350 $ cvs update driver.c
6351 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6352 retrieving revision 1.4
6353 retrieving revision 1.6
6354 Merging differences between 1.4 and 1.6 into driver.c
6355 rcsmerge warning: overlaps during merge
6356 cvs update: conflicts found in driver.c
6357 C driver.c
6358 @end example
6359
6360 @noindent
6361 @cindex Conflicts (merge example)
6362 @sc{cvs} tells you that there were some conflicts.
6363 Your original working file is saved unmodified in
6364 @file{.#driver.c.1.4}.  The new version of
6365 @file{driver.c} contains this:
6366
6367 @example
6368 #include <stdlib.h>
6369 #include <stdio.h>
6370
6371 int main(int argc,
6372          char **argv)
6373 @{
6374     init_scanner();
6375     parse();
6376     if (argc != 1)
6377     @{
6378         fprintf(stderr, "tc: No args expected.\n");
6379         exit(1);
6380     @}
6381     if (nerr == 0)
6382         gencode();
6383     else
6384         fprintf(stderr, "No code generated.\n");
6385 @asis{}<<<<<<< driver.c
6386     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6387 @asis{}=======
6388     exit(!!nerr);
6389 @asis{}>>>>>>> 1.6
6390 @}
6391 @end example
6392
6393 @noindent
6394 @cindex Markers, conflict
6395 @cindex Conflict markers
6396 @cindex <<<<<<<
6397 @cindex >>>>>>>
6398 @cindex =======
6399
6400 Note how all non-overlapping modifications are incorporated in your working
6401 copy, and that the overlapping section is clearly marked with
6402 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6403
6404 @cindex Resolving a conflict
6405 @cindex Conflict resolution
6406 You resolve the conflict by editing the file, removing the markers and
6407 the erroneous line.  Suppose you end up with this file:
6408 @c -- Add xref to the pcl-cvs manual when it talks
6409 @c -- about this.
6410 @example
6411 #include <stdlib.h>
6412 #include <stdio.h>
6413
6414 int main(int argc,
6415          char **argv)
6416 @{
6417     init_scanner();
6418     parse();
6419     if (argc != 1)
6420     @{
6421         fprintf(stderr, "tc: No args expected.\n");
6422         exit(1);
6423     @}
6424     if (nerr == 0)
6425         gencode();
6426     else
6427         fprintf(stderr, "No code generated.\n");
6428     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6429 @}
6430 @end example
6431
6432 @noindent
6433 You can now go ahead and commit this as revision 1.7.
6434
6435 @example
6436 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6437 Checking in driver.c;
6438 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6439 new revision: 1.7; previous revision: 1.6
6440 done
6441 @end example
6442
6443 For your protection, @sc{cvs} will refuse to check in a
6444 file if a conflict occurred and you have not resolved
6445 the conflict.  Currently to resolve a conflict, you
6446 must change the timestamp on the file.  In previous
6447 versions of @sc{cvs}, you also needed to
6448 insure that the file contains no conflict markers.
6449 Because
6450 your file may legitimately contain conflict markers (that
6451 is, occurrences of @samp{>>>>>>> } at the start of a
6452 line that don't mark a conflict), the current
6453 version of @sc{cvs} will print a warning and proceed to
6454 check in the file.
6455 @c The old behavior was really icky; the only way out
6456 @c was to start hacking on
6457 @c the @code{CVS/Entries} file or other such workarounds.
6458 @c
6459 @c If the timestamp thing isn't considered nice enough,
6460 @c maybe there should be a "cvs resolved" command
6461 @c which clears the conflict indication.  For a nice user
6462 @c interface, this should be invoked by an interactive
6463 @c merge tool like emerge rather than by the user
6464 @c directly--such a tool can verify that the user has
6465 @c really dealt with each conflict.
6466
6467 @cindex emerge
6468 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6469 Emacs front-end for @sc{cvs}) you can use an Emacs
6470 package called emerge to help you resolve conflicts.
6471 See the documentation for pcl-cvs.
6472
6473 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6474 @node Informing others
6475 @section Informing others about commits
6476 @cindex Informing others
6477 @cindex Spreading information
6478 @cindex Mail, automatic mail on commit
6479
6480 It is often useful to inform others when you commit a
6481 new revision of a file.  The @samp{-i} option of the
6482 @file{modules} file, or the @file{loginfo} file, can be
6483 used to automate this process.  @xref{modules}.
6484 @xref{loginfo}.  You can use these features of @sc{cvs}
6485 to, for instance, instruct @sc{cvs} to mail a
6486 message to all developers, or post a message to a local
6487 newsgroup.
6488 @c -- More text would be nice here.
6489
6490 @node Concurrency
6491 @section Several developers simultaneously attempting to run CVS
6492
6493 @cindex Locks, cvs, introduction
6494 @c For a discussion of *why* CVS creates locks, see
6495 @c the comment at the start of src/lock.c
6496 If several developers try to run @sc{cvs} at the same
6497 time, one may get the following message:
6498
6499 @example
6500 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6501 @end example
6502
6503 @cindex #cvs.rfl, removing
6504 @cindex #cvs.wfl, removing
6505 @cindex #cvs.lock, removing
6506 @sc{cvs} will try again every 30 seconds, and either
6507 continue with the operation or print the message again,
6508 if it still needs to wait.  If a lock seems to stick
6509 around for an undue amount of time, find the person
6510 holding the lock and ask them about the cvs command
6511 they are running.  If they aren't running a cvs
6512 command, look in the repository directory mentioned in
6513 the message and remove files which they own whose names
6514 start with @file{#cvs.rfl},
6515 @file{#cvs.wfl}, or @file{#cvs.lock}.
6516
6517 Note that these locks are to protect @sc{cvs}'s
6518 internal data structures and have no relationship to
6519 the word @dfn{lock} in the sense used by
6520 @sc{rcs}---which refers to reserved checkouts
6521 (@pxref{Multiple developers}).
6522
6523 Any number of people can be reading from a given
6524 repository at a time; only when someone is writing do
6525 the locks prevent other people from reading or writing.
6526
6527 @cindex Atomic transactions, lack of
6528 @cindex Transactions, atomic, lack of
6529 @c the following talks about what one might call commit/update
6530 @c atomicity.
6531 @c Probably also should say something about
6532 @c commit/commit atomicity, that is, "An update will
6533 @c not get partial versions of more than one commit".
6534 @c CVS currently has this property and I guess we can
6535 @c make it a documented feature.
6536 @c For example one person commits
6537 @c a/one.c and b/four.c and another commits a/two.c and
6538 @c b/three.c.  Then an update cannot get the new a/one.c
6539 @c and a/two.c and the old b/four.c and b/three.c.
6540 One might hope for the following property:
6541
6542 @quotation
6543 If someone commits some changes in one cvs command,
6544 then an update by someone else will either get all the
6545 changes, or none of them.
6546 @end quotation
6547
6548 @noindent
6549 but @sc{cvs} does @emph{not} have this property.  For
6550 example, given the files
6551
6552 @example
6553 a/one.c
6554 a/two.c
6555 b/three.c
6556 b/four.c
6557 @end example
6558
6559 @noindent
6560 if someone runs
6561
6562 @example
6563 cvs ci a/two.c b/three.c
6564 @end example
6565
6566 @noindent
6567 and someone else runs @code{cvs update} at the same
6568 time, the person running @code{update} might get only
6569 the change to @file{b/three.c} and not the change to
6570 @file{a/two.c}.
6571
6572 @node Watches
6573 @section Mechanisms to track who is editing files
6574 @cindex Watches
6575
6576 For many groups, use of @sc{cvs} in its default mode is
6577 perfectly satisfactory.  Users may sometimes go to
6578 check in a modification only to find that another
6579 modification has intervened, but they deal with it and
6580 proceed with their check in.  Other groups prefer to be
6581 able to know who is editing what files, so that if two
6582 people try to edit the same file they can choose to
6583 talk about who is doing what when rather than be
6584 surprised at check in time.  The features in this
6585 section allow such coordination, while retaining the
6586 ability of two developers to edit the same file at the
6587 same time.
6588
6589 @c Some people might ask why CVS does not enforce the
6590 @c rule on chmod, by requiring a cvs edit before a cvs
6591 @c commit.  The main reason is that it could always be
6592 @c circumvented--one could edit the file, and
6593 @c then when ready to check it in, do the cvs edit and put
6594 @c in the new contents and do the cvs commit.  One
6595 @c implementation note: if we _do_ want to have cvs commit
6596 @c require a cvs edit, we should store the state on
6597 @c whether the cvs edit has occurred in the working
6598 @c directory, rather than having the server try to keep
6599 @c track of what working directories exist.
6600 @c FIXME: should the above discussion be part of the
6601 @c manual proper, somewhere, not just in a comment?
6602 For maximum benefit developers should use @code{cvs
6603 edit} (not @code{chmod}) to make files read-write to
6604 edit them, and @code{cvs release} (not @code{rm}) to
6605 discard a working directory which is no longer in use,
6606 but @sc{cvs} is not able to enforce this behavior.
6607
6608 If a development team wants stronger enforcement of
6609 watches and all team members are using a @sc{cvs} client version 1.12.10 or
6610 greater to access a @sc{cvs} server version 1.12.10 or greater, they can
6611 enable advisory locks.  To enable advisory locks, have all developers
6612 put "edit -c" and "commit -c" into all .cvsrc files,
6613 and make files default to read only by turning on watches
6614 or putting "cvs -r" into all .cvsrc files.
6615 This prevents multiple people from editting a file at
6616 the same time (unless explicitly overriden with @samp{-f}).
6617
6618 @c I'm a little dissatisfied with this presentation,
6619 @c because "watch on"/"edit"/"editors" are one set of
6620 @c functionality, and "watch add"/"watchers" is another
6621 @c which is somewhat orthogonal even though they interact in
6622 @c various ways.  But I think it might be
6623 @c confusing to describe them separately (e.g. "watch
6624 @c add" with loginfo).  I don't know.
6625
6626 @menu
6627 * Setting a watch::             Telling CVS to watch certain files
6628 * Getting Notified::            Telling CVS to notify you
6629 * Editing files::               How to edit a file which is being watched
6630 * Watch information::           Information about who is watching and editing
6631 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6632 @end menu
6633
6634 @node Setting a watch
6635 @subsection Telling CVS to watch certain files
6636
6637 To enable the watch features, you first specify that
6638 certain files are to be watched.
6639
6640 @cindex watch on (subcommand)
6641 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6642
6643 @cindex Read-only files, and watches
6644 Specify that developers should run @code{cvs edit}
6645 before editing @var{files}.  @sc{cvs} will create working
6646 copies of @var{files} read-only, to remind developers
6647 to run the @code{cvs edit} command before working on
6648 them.
6649
6650 If @var{files} includes the name of a directory, @sc{cvs}
6651 arranges to watch all files added to the corresponding
6652 repository directory, and sets a default for files
6653 added in the future; this allows the user to set
6654 notification policies on a per-directory basis.  The
6655 contents of the directory are processed recursively,
6656 unless the @code{-l} option is given.
6657 The @code{-R} option can be used to force recursion if the @code{-l}
6658 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6659
6660 If @var{files} is omitted, it defaults to the current directory.
6661
6662 @cindex watch off (subcommand)
6663 @end deffn
6664
6665 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6666
6667 Do not create @var{files} read-only on checkout; thus,
6668 developers will not be reminded to use @code{cvs edit}
6669 and @code{cvs unedit}.
6670 @ignore
6671 @sc{cvs} will check out @var{files}
6672 read-write as usual, unless other permissions override
6673 due to the @code{PreservePermissions} option being
6674 enabled in the @file{config} administrative file
6675 (@pxref{Special Files}, @pxref{config})
6676 @end ignore
6677
6678 The @var{files} and options are processed as for @code{cvs
6679 watch on}.
6680
6681 @end deffn
6682
6683 @node Getting Notified
6684 @subsection Telling CVS to notify you
6685
6686 You can tell @sc{cvs} that you want to receive
6687 notifications about various actions taken on a file.
6688 You can do this without using @code{cvs watch on} for
6689 the file, but generally you will want to use @code{cvs
6690 watch on}, to remind developers to use the @code{cvs edit}
6691 command.
6692
6693 @cindex watch add (subcommand)
6694 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6695
6696 Add the current user to the list of people to receive notification of
6697 work done on @var{files}.
6698
6699 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6700 the user about.  @var{action} is one of the following:
6701
6702 @table @code
6703
6704 @item edit
6705 Another user has applied the @code{cvs edit} command (described
6706 below) to a watched file.
6707
6708 @item commit
6709 Another user has committed changes to one of the named @var{files}.
6710
6711 @item unedit
6712 Another user has abandoned editing a file (other than by committing changes).
6713 They can do this in several ways, by:
6714
6715 @itemize @bullet
6716
6717 @item
6718 applying the @code{cvs unedit} command (described below) to the file
6719
6720 @item
6721 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6722 (or recursively to a directory more than one level up)
6723
6724 @item
6725 deleting the file and allowing @code{cvs update} to recreate it
6726
6727 @end itemize
6728
6729 @item all
6730 All of the above.
6731
6732 @item none
6733 None of the above.  (This is useful with @code{cvs edit},
6734 described below.)
6735
6736 @end table
6737
6738 The @code{-a} option may appear more than once, or not at all.  If
6739 omitted, the action defaults to @code{all}.
6740
6741 The @var{files} and options are processed as for
6742 @code{cvs watch on}.
6743
6744 @end deffn
6745
6746
6747 @cindex watch remove (subcommand)
6748 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6749
6750 Remove a notification request established using @code{cvs watch add};
6751 the arguments are the same.  If the @code{-a} option is present, only
6752 watches for the specified actions are removed.
6753
6754 @end deffn
6755
6756 @cindex notify (admin file)
6757 When the conditions exist for notification, @sc{cvs}
6758 calls the @file{notify} administrative file.  Edit
6759 @file{notify} as one edits the other administrative
6760 files (@pxref{Intro administrative files}).  This
6761 file follows the usual conventions for administrative
6762 files (@pxref{syntax}), where each line is a regular
6763 expression followed by a command to execute.  The
6764 command should contain a single occurrence of @samp{%s}
6765 which will be replaced by the user to notify; the rest
6766 of the information regarding the notification will be
6767 supplied to the command on standard input.  The
6768 standard thing to put in the @code{notify} file is the
6769 single line:
6770
6771 @example
6772 ALL mail %s -s "CVS notification"
6773 @end example
6774
6775 @noindent
6776 This causes users to be notified by electronic mail.
6777 @c FIXME: should it be this hard to set up this
6778 @c behavior (and the result when one fails to do so,
6779 @c silent failure to notify, so non-obvious)?  Should
6780 @c CVS give a warning if no line in notify matches (and
6781 @c document the use of "DEFAULT :" for the case where
6782 @c skipping the notification is indeed desired)?
6783
6784 @cindex users (admin file)
6785 Note that if you set this up in the straightforward
6786 way, users receive notifications on the server machine.
6787 One could of course write a @file{notify} script which
6788 directed notifications elsewhere, but to make this
6789 easy, @sc{cvs} allows you to associate a notification
6790 address for each user.  To do so create a file
6791 @file{users} in @file{CVSROOT} with a line for each
6792 user in the format @var{user}:@var{value}.  Then
6793 instead of passing the name of the user to be notified
6794 to @file{notify}, @sc{cvs} will pass the @var{value}
6795 (normally an email address on some other machine).
6796
6797 @sc{cvs} does not notify you for your own changes.
6798 Currently this check is done based on whether the user
6799 name of the person taking the action which triggers
6800 notification matches the user name of the person
6801 getting notification.  In fact, in general, the watches
6802 features only track one edit by each user.  It probably
6803 would be more useful if watches tracked each working
6804 directory separately, so this behavior might be worth
6805 changing.
6806 @c "behavior might be worth changing" is an effort to
6807 @c point to future directions while also not promising
6808 @c that "they" (as in "why don't they fix CVS to....")
6809 @c will do this.
6810 @c one implementation issue is identifying whether a
6811 @c working directory is same or different.  Comparing
6812 @c pathnames/hostnames is hopeless, but having the server
6813 @c supply a serial number which the client stores in the
6814 @c CVS directory as a magic cookie should work.
6815
6816 @node Editing files
6817 @subsection How to edit a file which is being watched
6818
6819 @cindex Checkout, as term for getting ready to edit
6820 Since a file which is being watched is checked out
6821 read-only, you cannot simply edit it.  To make it
6822 read-write, and inform others that you are planning to
6823 edit it, use the @code{cvs edit} command.  Some systems
6824 call this a @dfn{checkout}, but @sc{cvs} uses that term
6825 for obtaining a copy of the sources (@pxref{Getting the
6826 source}), an operation which those systems call a
6827 @dfn{get} or a @dfn{fetch}.
6828 @c Issue to think about: should we transition CVS
6829 @c towards the "get" terminology?  "cvs get" is already a
6830 @c synonym for "cvs checkout" and that section of the
6831 @c manual refers to "Getting the source".  If this is
6832 @c done, needs to be done gingerly (for example, we should
6833 @c still accept "checkout" in .cvsrc files indefinitely
6834 @c even if the CVS's messages are changed from "cvs checkout: "
6835 @c to "cvs get: ").
6836 @c There is a concern about whether "get" is not as
6837 @c good for novices because it is a more general term
6838 @c than "checkout" (and thus arguably harder to assign
6839 @c a technical meaning for).
6840
6841 @cindex edit (subcommand)
6842 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6843
6844 Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6845 @var{files} read-write, and notifies users who have requested
6846 @code{edit} notification for any of @var{files}.
6847
6848 The @code{cvs edit} command accepts the same options as the
6849 @code{cvs watch add} command, and establishes a temporary watch for the
6850 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6851 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
6852 receive notifications, she should specify @code{-a none}.
6853
6854 The @var{files} and the options are processed as for the @code{cvs
6855 watch} commands.
6856
6857 There are two additional options that @code{cvs edit} understands as of
6858 @sc{cvs} client and server versions 1.12.10 but @code{cvs watch} does not.
6859 The first is @code{-c}, which causes @code{cvs edit} to fail if anyone else
6860 is editting the file.  This is probably only useful when @samp{edit -c} and
6861 @samp{commit -c} are specified in all developers' @file{.cvsrc} files.  This
6862 behavior may be overriden this via the @code{-f} option, which overrides
6863 @code{-c} and allows multiple edits to succeed.
6864
6865 @ignore
6866 @strong{Caution: If the @code{PreservePermissions}
6867 option is enabled in the repository (@pxref{config}),
6868 @sc{cvs} will not change the permissions on any of the
6869 @var{files}.  The reason for this change is to ensure
6870 that using @samp{cvs edit} does not interfere with the
6871 ability to store file permissions in the @sc{cvs}
6872 repository.}
6873 @end ignore
6874
6875 @end deffn
6876
6877 Normally when you are done with a set of changes, you
6878 use the @code{cvs commit} command, which checks in your
6879 changes and returns the watched files to their usual
6880 read-only state.  But if you instead decide to abandon
6881 your changes, or not to make any changes, you can use
6882 the @code{cvs unedit} command.
6883
6884 @cindex unedit (subcommand)
6885 @cindex Abandoning work
6886 @cindex Reverting to repository version
6887 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6888
6889 Abandon work on the working files @var{files}, and revert them to the
6890 repository versions on which they are based.  @sc{cvs} makes those
6891 @var{files} read-only for which users have requested notification using
6892 @code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6893 notification for any of @var{files}.
6894
6895 The @var{files} and options are processed as for the
6896 @code{cvs watch} commands.
6897
6898 If watches are not in use, the @code{unedit} command
6899 probably does not work, and the way to revert to the
6900 repository version is with the command @code{cvs update -C file}
6901 (@pxref{update}).
6902 The meaning is
6903 not precisely the same; the latter may also
6904 bring in some changes which have been made in the
6905 repository since the last time you updated.
6906 @c It would be a useful enhancement to CVS to make
6907 @c unedit work in the non-watch case as well.
6908 @end deffn
6909
6910 When using client/server @sc{cvs}, you can use the
6911 @code{cvs edit} and @code{cvs unedit} commands even if
6912 @sc{cvs} is unable to successfully communicate with the
6913 server; the notifications will be sent upon the next
6914 successful @sc{cvs} command.
6915
6916 @node Watch information
6917 @subsection Information about who is watching and editing
6918
6919 @cindex watchers (subcommand)
6920 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6921
6922 List the users currently watching changes to @var{files}.  The report
6923 includes the files being watched, and the mail address of each watcher.
6924
6925 The @var{files} and options are processed as for the
6926 @code{cvs watch} commands.
6927
6928 @end deffn
6929
6930
6931 @cindex editors (subcommand)
6932 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6933
6934 List the users currently working on @var{files}.  The report
6935 includes the mail address of each user, the time when the user began
6936 working with the file, and the host and path of the working directory
6937 containing the file.
6938
6939 The @var{files} and options are processed as for the
6940 @code{cvs watch} commands.
6941
6942 @end deffn
6943
6944 @node Watches Compatibility
6945 @subsection Using watches with old versions of CVS
6946
6947 @cindex CVS 1.6, and watches
6948 If you use the watch features on a repository, it
6949 creates @file{CVS} directories in the repository and
6950 stores the information about watches in that directory.
6951 If you attempt to use @sc{cvs} 1.6 or earlier with the
6952 repository, you get an error message such as the
6953 following (all on one line):
6954
6955 @example
6956 cvs update: cannot open CVS/Entries for reading:
6957 No such file or directory
6958 @end example
6959
6960 @noindent
6961 and your operation will likely be aborted.  To use the
6962 watch features, you must upgrade all copies of @sc{cvs}
6963 which use that repository in local or server mode.  If
6964 you cannot upgrade, use the @code{watch off} and
6965 @code{watch remove} commands to remove all watches, and
6966 that will restore the repository to a state which
6967 @sc{cvs} 1.6 can cope with.
6968
6969 @node Choosing a model
6970 @section Choosing between reserved or unreserved checkouts
6971 @cindex Choosing, reserved or unreserved checkouts
6972
6973 Reserved and unreserved checkouts each have pros and
6974 cons.  Let it be said that a lot of this is a matter of
6975 opinion or what works given different groups' working
6976 styles, but here is a brief description of some of the
6977 issues.  There are many ways to organize a team of
6978 developers.  @sc{cvs} does not try to enforce a certain
6979 organization.  It is a tool that can be used in several
6980 ways.
6981
6982 Reserved checkouts can be very counter-productive.  If
6983 two persons want to edit different parts of a file,
6984 there may be no reason to prevent either of them from
6985 doing so.  Also, it is common for someone to take out a
6986 lock on a file, because they are planning to edit it,
6987 but then forget to release the lock.
6988
6989 @c "many groups"?  specifics?  cites to papers on this?
6990 @c some way to weasel-word it a bit more so we don't
6991 @c need facts :-)?
6992 People, especially people who are familiar with
6993 reserved checkouts, often wonder how often conflicts
6994 occur if unreserved checkouts are used, and how
6995 difficult they are to resolve.  The experience with
6996 many groups is that they occur rarely and usually are
6997 relatively straightforward to resolve.
6998
6999 The rarity of serious conflicts may be surprising, until one realizes
7000 that they occur only when two developers disagree on the proper design
7001 for a given section of code; such a disagreement suggests that the
7002 team has not been communicating properly in the first place.  In order
7003 to collaborate under @emph{any} source management regimen, developers
7004 must agree on the general design of the system; given this agreement,
7005 overlapping changes are usually straightforward to merge.
7006
7007 In some cases unreserved checkouts are clearly
7008 inappropriate.  If no merge tool exists for the kind of
7009 file you are managing (for example word processor files
7010 or files edited by Computer Aided Design programs), and
7011 it is not desirable to change to a program which uses a
7012 mergeable data format, then resolving conflicts is
7013 going to be unpleasant enough that you generally will
7014 be better off to simply avoid the conflicts instead, by
7015 using reserved checkouts.
7016
7017 The watches features described above in @ref{Watches}
7018 can be considered to be an intermediate model between
7019 reserved checkouts and unreserved checkouts.  When you
7020 go to edit a file, it is possible to find out who else
7021 is editing it.  And rather than having the system
7022 simply forbid both people editing the file, it can tell
7023 you what the situation is and let you figure out
7024 whether it is a problem in that particular case or not.
7025 Therefore, for some groups watches can be
7026 considered the best of both the reserved checkout and unreserved
7027 checkout worlds.
7028
7029 As of @sc{cvs} client and server versions 1.12.10, you may also enable
7030 advisory locks by putting @samp{edit -c} and @samp{commit -c} in all
7031 developers' @file{.cvsrc} files.  After this is done, @code{cvs edit}
7032 will fail if there are any other editors, and @code{cvs commit} will
7033 fail if the committer has not registered to edit the file via @code{cvs edit}.
7034 This is most effective in conjunction with files checked out read-only by
7035 default, which may be enabled by turning on watches in the repository or by
7036 putting @samp{cvs -r} in all @file{.cvsrc} files.
7037
7038
7039 @c ---------------------------------------------------------------------
7040 @node Revision management
7041 @chapter Revision management
7042 @cindex Revision management
7043
7044 @c -- This chapter could be expanded a lot.
7045 @c -- Experiences are very welcome!
7046
7047 If you have read this far, you probably have a pretty
7048 good grasp on what @sc{cvs} can do for you.  This
7049 chapter talks a little about things that you still have
7050 to decide.
7051
7052 If you are doing development on your own using @sc{cvs}
7053 you could probably skip this chapter.  The questions
7054 this chapter takes up become more important when more
7055 than one person is working in a repository.
7056
7057 @menu
7058 * When to commit::              Some discussion on the subject
7059 @end menu
7060
7061 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7062 @node When to commit
7063 @section When to commit?
7064 @cindex When to commit
7065 @cindex Committing, when to
7066 @cindex Policy
7067
7068 Your group should decide which policy to use regarding
7069 commits.  Several policies are possible, and as your
7070 experience with @sc{cvs} grows you will probably find
7071 out what works for you.
7072
7073 If you commit files too quickly you might commit files
7074 that do not even compile.  If your partner updates his
7075 working sources to include your buggy file, he will be
7076 unable to compile the code.  On the other hand, other
7077 persons will not be able to benefit from the
7078 improvements you make to the code if you commit very
7079 seldom, and conflicts will probably be more common.
7080
7081 It is common to only commit files after making sure
7082 that they can be compiled.  Some sites require that the
7083 files pass a test suite.  Policies like this can be
7084 enforced using the commitinfo file
7085 (@pxref{commitinfo}), but you should think twice before
7086 you enforce such a convention.  By making the
7087 development environment too controlled it might become
7088 too regimented and thus counter-productive to the real
7089 goal, which is to get software written.
7090
7091 @c ---------------------------------------------------------------------
7092 @node Keyword substitution
7093 @chapter Keyword substitution
7094 @cindex Keyword substitution
7095 @cindex Keyword expansion
7096 @cindex Identifying files
7097
7098 @comment   Be careful when editing this chapter.
7099 @comment   Remember that this file is kept under
7100 @comment   version control, so we must not accidentally
7101 @comment   include a valid keyword in the running text.
7102
7103 As long as you edit source files inside a working
7104 directory you can always find out the state of
7105 your files via @samp{cvs status} and @samp{cvs log}.
7106 But as soon as you export the files from your
7107 development environment it becomes harder to identify
7108 which revisions they are.
7109
7110 @sc{cvs} can use a mechanism known as @dfn{keyword
7111 substitution} (or @dfn{keyword expansion}) to help
7112 identifying the files.  Embedded strings of the form
7113 @code{$@var{keyword}$} and
7114 @code{$@var{keyword}:@dots{}$} in a file are replaced
7115 with strings of the form
7116 @code{$@var{keyword}:@var{value}$} whenever you obtain
7117 a new revision of the file.
7118
7119 @menu
7120 * Keyword list::                   Keywords
7121 * Using keywords::                 Using keywords
7122 * Avoiding substitution::          Avoiding substitution
7123 * Substitution modes::             Substitution modes
7124 * Configuring keyword expansion::  Configuring keyword expansion
7125 * Log keyword::                    Problems with the $@splitrcskeyword{Log}$ keyword.
7126 @end menu
7127
7128 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7129 @node Keyword list
7130 @section Keyword List
7131 @cindex Keyword List
7132
7133 @c FIXME: need some kind of example here I think,
7134 @c perhaps in a
7135 @c "Keyword intro" node.  The intro in the "Keyword
7136 @c substitution" node itself seems OK, but to launch
7137 @c into a list of the keywords somehow seems too abrupt.
7138
7139 This is a list of the keywords:
7140
7141 @table @code
7142 @cindex Author keyword
7143 @item $@splitrcskeyword{Author}$
7144 The login name of the user who checked in the revision.
7145
7146 @cindex CVSHeader keyword
7147 @item $@splitrcskeyword{CVSHeader}$
7148 A standard header (similar to $@splitrcskeyword{Header}$, but with
7149 the CVS root stripped off). It contains the relative
7150 pathname of the @sc{rcs} file to the CVS root, the
7151 revision number, the date (UTC), the author, the state,
7152 and the locker (if locked). Files will normally never
7153 be locked when you use @sc{cvs}.
7154
7155 Note that this keyword has only been recently
7156 introduced to @sc{cvs} and may cause problems with
7157 existing installations if $@splitrcskeyword{CVSHeader}$ is already
7158 in the files for a different purpose. This keyword may
7159 be excluded using the @code{KeywordExpand=eCVSHeader}
7160 in the @file{CVSROOT/config} file. 
7161 See @ref{Configuring keyword expansion} for more details.
7162
7163 @cindex Date keyword
7164 @item $@splitrcskeyword{Date}$
7165 The date and time (UTC) the revision was checked in.
7166
7167 @cindex Header keyword
7168 @item $@splitrcskeyword{Header}$
7169 A standard header containing the full pathname of the
7170 @sc{rcs} file, the revision number, the date (UTC), the
7171 author, the state, and the locker (if locked).  Files
7172 will normally never be locked when you use @sc{cvs}.
7173
7174 @cindex Id keyword
7175 @item $@splitrcskeyword{Id}$
7176 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
7177 filename is without a path.
7178
7179 @cindex Name keyword
7180 @item $@splitrcskeyword{Name}$
7181 Tag name used to check out this file.  The keyword is
7182 expanded only if one checks out with an explicit tag
7183 name.  For example, when running the command @code{cvs
7184 co -r first}, the keyword expands to @samp{Name: first}.
7185
7186 @cindex Locker keyword
7187 @item $@splitrcskeyword{Locker}$
7188 The login name of the user who locked the revision
7189 (empty if not locked, which is the normal case unless
7190 @code{cvs admin -l} is in use).
7191
7192 @cindex Log keyword
7193 @cindex MaxCommentLeaderLength
7194 @cindex UseArchiveCommentLeader
7195 @cindex Log keyword, configuring substitution behavior
7196 @item $@splitrcskeyword{Log}$
7197 The log message supplied during commit, preceded by a
7198 header containing the @sc{rcs} filename, the revision
7199 number, the author, and the date (UTC).  Existing log
7200 messages are @emph{not} replaced.  Instead, the new log
7201 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
7202 By default, each new line is prefixed with the same string which
7203 precedes the @code{$@splitrcskeyword{Log}$} keyword, unless it exceeds the
7204 @code{MaxCommentLeaderLength} set in @file{CVSROOT/config}.
7205
7206 For example, if the file contains:
7207
7208 @example
7209   /* Here is what people have been up to:
7210    *
7211    * $@splitrcskeyword{Log}: frob.c,v $
7212    * Revision 1.1  1997/01/03 14:23:51  joe
7213    * Add the superfrobnicate option
7214    *
7215    */
7216 @end example
7217
7218 @noindent
7219 then additional lines which are added when expanding
7220 the @code{$@splitrcskeyword{Log}$} keyword will be preceded by @samp{   * }.
7221 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
7222 @dfn{comment leader} from the @sc{rcs} file is not used.
7223 The @code{$@splitrcskeyword{Log}$} keyword is useful for
7224 accumulating a complete change log in a source file,
7225 but for several reasons it can be problematic.
7226
7227 If the prefix of the @code{$@splitrcskeyword{Log}$} keyword turns out to be
7228 longer than @code{MaxCommentLeaderLength}, CVS will skip expansion of this
7229 keyword unless @code{UseArchiveCommentLeader} is also set in
7230 @file{CVSROOT/config} and a @samp{comment leader} is set in the RCS archive
7231 file, in which case the comment leader will be used instead.  For more on
7232 setting the comment leader in the RCS archive file, @xref{admin}.  For more
7233 on configuring the default @code{$@splitrcskeyword{Log}$} substitution
7234 behavior, @xref{config}.
7235
7236 @xref{Log keyword}.
7237
7238 @cindex RCSfile keyword
7239 @item $@splitrcskeyword{RCSfile}$
7240 The name of the RCS file without a path.
7241
7242 @cindex Revision keyword
7243 @item $@splitrcskeyword{Revision}$
7244 The revision number assigned to the revision.
7245
7246 @cindex Source keyword
7247 @item $@splitrcskeyword{Source}$
7248 The full pathname of the RCS file.
7249
7250 @cindex State keyword
7251 @item $@splitrcskeyword{State}$
7252 The state assigned to the revision.  States can be
7253 assigned with @code{cvs admin -s}---see @ref{admin options}.
7254
7255 @cindex Local keyword
7256 @item Local keyword
7257 The @code{LocalKeyword} option in the @file{CVSROOT/config} file
7258 may be used to specify a local keyword which is to be
7259 used as an alias for one of the keywords: $@splitrcskeyword{Id}$,
7260 $@splitrcskeyword{Header}$, or $@splitrcskeyword{CVSHeader}$. For
7261 example, if the @file{CVSROOT/config} file contains
7262 a line with @code{LocalKeyword=MYBSD=CVSHeader}, then a
7263 file with the local keyword $@splitrcskeyword{MYBSD}$ will be
7264 expanded as if it were a $@splitrcskeyword{CVSHeader}$ keyword. If
7265 the src/frob.c file contained this keyword, it might
7266 look something like this:
7267
7268 @example
7269   /*
7270    * $@splitrcskeyword{MYBSD}: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $ 
7271    */
7272 @end example
7273
7274 Many repositories make use of a such a ``local
7275 keyword'' feature. An old patch to @sc{cvs} provided
7276 the @code{LocalKeyword} feature using a @code{tag=}
7277 option and called this the ``custom tag'' or ``local
7278 tag'' feature. It was used in conjunction with the
7279 what they called the @code{tagexpand=} option. In
7280 @sc{cvs} this other option is known as the
7281 @code{KeywordExpand} option. 
7282 See @ref{Configuring keyword expansion} for more
7283 details.
7284
7285 Examples from popular projects include:
7286 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7287 $@splitrcskeyword{OpenBSD}$, $@splitrcskeyword{XFree86}$,
7288 $@splitrcskeyword{Xorg}$.
7289
7290 The advantage of this is that you can include your
7291 local version information in a file using this local
7292 keyword without disrupting the upstream version
7293 information (which may be a different local keyword or
7294 a standard keyword). Allowing bug reports and the like
7295 to more properly identify the source of the original
7296 bug to the third-party and reducing the number of
7297 conflicts that arise during an import of a new version.
7298
7299 All keyword expansion except the local keyword may be
7300 disabled using the @code{KeywordExpand} option in
7301 the @file{CVSROOT/config} file---see 
7302 @ref{Configuring keyword expansion} for more details.
7303
7304 @end table
7305
7306 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7307 @node Using keywords
7308 @section Using keywords
7309
7310 To include a keyword string you simply include the
7311 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
7312 file, and commit the file.  @sc{cvs} will automatically (Or,
7313 more accurately, as part of the update run that
7314 automatically happens after a commit.)
7315 expand the string as part of the commit operation.
7316
7317 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
7318 the source files so that it gets passed through to
7319 generated files.  For example, if you are managing
7320 computer program source code, you might include a
7321 variable which is initialized to contain that string.
7322 Or some C compilers may provide a @code{#pragma ident}
7323 directive.  Or a document management system might
7324 provide a way to pass a string through to generated
7325 files.
7326
7327 @c Would be nice to give an example, but doing this in
7328 @c portable C is not possible and the problem with
7329 @c picking any one language (VMS HELP files, Ada,
7330 @c troff, whatever) is that people use CVS for all
7331 @c kinds of files.
7332
7333 @cindex Ident (shell command)
7334 The @code{ident} command (which is part of the @sc{rcs}
7335 package) can be used to extract keywords and their
7336 values from a file.  This can be handy for text files,
7337 but it is even more useful for extracting keywords from
7338 binary files.
7339
7340 @example
7341 $ ident samp.c
7342 samp.c:
7343      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7344 $ gcc samp.c
7345 $ ident a.out
7346 a.out:
7347      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7348 @end example
7349
7350 @cindex What (shell command)
7351 S@sc{ccs} is another popular revision control system.
7352 It has a command, @code{what}, which is very similar to
7353 @code{ident} and used for the same purpose.  Many sites
7354 without @sc{rcs} have @sc{sccs}.  Since @code{what}
7355 looks for the character sequence @code{@@(#)} it is
7356 easy to include keywords that are detected by either
7357 command.  Simply prefix the keyword with the
7358 magic @sc{sccs} phrase, like this:
7359
7360 @example
7361 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
7362 @end example
7363
7364 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7365 @node Avoiding substitution
7366 @section Avoiding substitution
7367
7368 Keyword substitution has its disadvantages.  Sometimes
7369 you might want the literal text string
7370 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
7371 @sc{cvs} interpreting it as a keyword and expanding it
7372 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
7373
7374 There is unfortunately no way to selectively turn off
7375 keyword substitution.  You can use @samp{-ko}
7376 (@pxref{Substitution modes}) to turn off keyword
7377 substitution entirely.
7378
7379 In many cases you can avoid using keywords in
7380 the source, even though they appear in the final
7381 product.  For example, the source for this manual
7382 contains @samp{$@@asis@{@}Author$} whenever the text
7383 @samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
7384 and @code{troff} you can embed the null-character
7385 @code{\&} inside the keyword for a similar effect.
7386
7387 It is also possible to specify an explicit list of
7388 keywords to include or exclude using the
7389 @code{KeywordExpand} option in the
7390 @file{CVSROOT/config} file--see @ref{Configuring keyword expansion}
7391 for more details. This feature is intended primarily
7392 for use with the @code{LocalKeyword} option--see
7393 @ref{Keyword list}.
7394
7395 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7396 @node Substitution modes
7397 @section Substitution modes
7398 @cindex Keyword substitution, changing modes
7399 @cindex -k (keyword substitution)
7400 @cindex Kflag
7401
7402 @c FIXME: This could be made more coherent, by expanding it
7403 @c with more examples or something.
7404 Each file has a stored default substitution mode, and
7405 each working directory copy of a file also has a
7406 substitution mode.  The former is set by the @samp{-k}
7407 option to @code{cvs add} and @code{cvs admin}; the
7408 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7409 checkout} or @code{cvs update}.  @code{cvs diff} also
7410 has a @samp{-k} option.  For some examples,
7411 see @ref{Binary files}, and @ref{Merging and keywords}.
7412 @c The fact that -A is overloaded to mean both reset
7413 @c sticky options and reset sticky tags/dates is
7414 @c somewhat questionable.  Perhaps there should be
7415 @c separate options to reset sticky options (e.g. -k
7416 @c A") and tags/dates (someone suggested -r HEAD could
7417 @c do this instead of setting a sticky tag of "HEAD"
7418 @c as in the status quo but I haven't thought much
7419 @c about that idea.  Of course -r .reset or something
7420 @c could be coined if this needs to be a new option).
7421 @c On the other hand, having -A mean "get things back
7422 @c into the state after a fresh checkout" has a certain
7423 @c appeal, and maybe there is no sufficient reason for
7424 @c creeping featurism in this area.
7425
7426 The modes available are:
7427
7428 @table @samp
7429 @item -kkv
7430 Generate keyword strings using the default form, e.g.
7431 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7432 keyword.
7433
7434 @item -kkvl
7435 Like @samp{-kkv}, except that a locker's name is always
7436 inserted if the given revision is currently locked.
7437 The locker's name is only relevant if @code{cvs admin
7438 -l} is in use.
7439
7440 @item -kk
7441 Generate only keyword names in keyword strings; omit
7442 their values.  For example, for the @code{Revision}
7443 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7444 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7445 is useful to ignore differences due to keyword
7446 substitution when comparing different revisions of a
7447 file (@pxref{Merging and keywords}).
7448
7449 @item -ko
7450 Generate the old keyword string, present in the working
7451 file just before it was checked in.  For example, for
7452 the @code{Revision} keyword, generate the string
7453 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7454 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7455 string appeared when the file was checked in.
7456
7457 @item -kb
7458 Like @samp{-ko}, but also inhibit conversion of line
7459 endings between the canonical form in which they are
7460 stored in the repository (linefeed only), and the form
7461 appropriate to the operating system in use on the
7462 client.  For systems, like unix, which use linefeed
7463 only to terminate lines, this is very similar to
7464 @samp{-ko}.  For more information on binary files, see
7465 @ref{Binary files}.  In @sc{cvs} version 1.12.2 and later
7466 @samp{-kb}, as set by @code{cvs add}, @code{cvs admin}, or
7467 @code{cvs import} may not be overridden by a @samp{-k} option
7468 specified on the command line.
7469
7470 @item -kv
7471 Generate only keyword values for keyword strings.  For
7472 example, for the @code{Revision} keyword, generate the string
7473 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7474 This can help generate files in programming languages
7475 where it is hard to strip keyword delimiters like
7476 @code{$@splitrcskeyword{Revision}: $} from a string.  However,
7477 further keyword substitution cannot be performed once
7478 the keyword names are removed, so this option should be
7479 used with care.
7480
7481 One often would like to use @samp{-kv} with @code{cvs
7482 export}---@pxref{export}.  But be aware that doesn't
7483 handle an export containing binary files correctly.
7484
7485 @end table
7486
7487 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7488 @node Configuring keyword expansion
7489 @section Configuring Keyword Expansion
7490 @cindex Configuring keyword expansion
7491
7492 In a repository that includes third-party software on
7493 vendor branches, it is sometimes helpful to configure
7494 CVS to use a local keyword instead of the standard
7495 $@splitrcskeyword{Id}$ or $@splitrcskeyword{Header}$ keywords. Examples from
7496 real projects include $@splitrcskeyword{Xorg}$, $@splitrcskeyword{XFree86}$,
7497 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7498 $@splitrcskeyword{OpenBSD}$, and even $@splitrcskeyword{dotat}$.
7499 The advantage of this is that
7500 you can include your local version information in a
7501 file using this local keyword (sometimes called a
7502 ``custom tag'' or a ``local tag'') without disrupting
7503 the upstream version information (which may be a
7504 different local keyword or a standard keyword). In
7505 these cases, it is typically desirable to disable the
7506 expansion of all keywords except the configured local
7507 keyword.
7508
7509 The @code{KeywordExpand} option in the
7510 @file{CVSROOT/config} file is intended to allow for the
7511 either the explicit exclusion of a keyword or list of
7512 keywords, or for the explicit inclusion of a keyword or
7513 a list of keywords. This list may include the
7514 @code{LocalKeyword} that has been configured.
7515
7516 The @code{KeywordExpand} option is followed by
7517 @code{=} and the next character may either be @code{i}
7518 to start an inclusion list or @code{e} to start an
7519 exclusion list. If the following lines were added to
7520 the @file{CVSROOT/config} file:
7521
7522 @example
7523         # Add a "MyBSD" keyword and restrict keyword
7524         # expansion
7525         LocalKeyword=MyBSD=CVSHeader
7526         KeywordExpand=iMyBSD
7527 @end example
7528
7529 then only the $@splitrcskeyword{MyBSD}$ keyword would be expanded.
7530 A list may be used. The this example:
7531
7532 @example
7533         # Add a "MyBSD" keyword and restrict keyword
7534         # expansion to the MyBSD, Name and Date keywords.
7535         LocalKeyword=MyBSD=CVSHeader
7536         KeywordExpand=iMyBSD,Name,Date
7537 @end example
7538
7539 would allow $@splitrcskeyword{MyBSD}$, $@splitrcskeyword{Name}$, and
7540 $@splitrcskeyword{Date}$ to be expanded.
7541
7542 It is also possible to configure an exclusion list
7543 using the following:
7544
7545 @example
7546         # Do not expand the non-RCS keyword CVSHeader
7547         KeywordExpand=eCVSHeader
7548 @end example
7549
7550 This allows @sc{cvs} to ignore the recently introduced
7551 $@splitrcskeyword{CVSHeader}$ keyword and retain all of the
7552 others. The exclusion entry could also contain the
7553 standard RCS keyword list, but this could be confusing
7554 to users that expect RCS keywords to be expanded, so
7555 care should be taken to properly set user expectations
7556 for a repository that is configured in that manner.
7557
7558 If there is a desire to not have any RCS keywords
7559 expanded and not use the @code{-ko} flags everywhere,
7560 an administrator may disable all keyword expansion
7561 using the @file{CVSROOT/config} line:
7562
7563 @example
7564         # Do not expand any RCS keywords
7565         KeywordExpand=i
7566 @end example
7567
7568 this could be confusing to users that expect RCS
7569 keywords like $@splitrcskeyword{Id}$ to be expanded properly,
7570 so care should be taken to properly set user
7571 expectations for a repository so configured.
7572
7573 It should be noted that a patch to provide both the
7574 @code{KeywordExpand} and @code{LocalKeyword} features
7575 has been around a long time. However, that patch
7576 implemented these features using @code{tag=} and
7577 @code{tagexpand=} keywords and those keywords are NOT
7578 recognized.
7579
7580 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7581 @node Log keyword
7582 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7583
7584 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7585 controversial.  As long as you are working on your
7586 development system the information is easily accessible
7587 even if you do not use the @code{$@splitrcskeyword{Log}$}
7588 keyword---just do a @code{cvs log}.  Once you export
7589 the file the history information might be useless
7590 anyhow.
7591
7592 A more serious concern is that @sc{cvs} is not good at
7593 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7594 merged onto the main trunk.  Conflicts often result
7595 from the merging operation.
7596 @c Might want to check whether the CVS implementation
7597 @c of RCS_merge has this problem the same way rcsmerge
7598 @c does.  I would assume so....
7599
7600 People also tend to "fix" the log entries in the file
7601 (correcting spelling mistakes and maybe even factual
7602 errors).  If that is done the information from
7603 @code{cvs log} will not be consistent with the
7604 information inside the file.  This may or may not be a
7605 problem in real life.
7606
7607 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7608 keyword should be inserted @emph{last} in the file, and
7609 not in the files header, if it is to be used at all.
7610 That way the long list of change messages will not
7611 interfere with everyday source file browsing.
7612
7613 @c ---------------------------------------------------------------------
7614 @node Tracking sources
7615 @chapter Tracking third-party sources
7616 @cindex Third-party sources
7617 @cindex Tracking sources
7618
7619 @c FIXME: Need discussion of added and removed files.
7620 @c FIXME: This doesn't really adequately introduce the
7621 @c concepts of "vendor" and "you".  They don't *have*
7622 @c to be separate organizations or separate people.
7623 @c We want a description which is somewhat more based on
7624 @c the technical issues of which sources go where, but
7625 @c also with enough examples of how this relates to
7626 @c relationships like customer-supplier, developer-QA,
7627 @c maintainer-contributor, or whatever, to make it
7628 @c seem concrete.
7629 If you modify a program to better fit your site, you
7630 probably want to include your modifications when the next
7631 release of the program arrives.  @sc{cvs} can help you with
7632 this task.
7633
7634 @cindex Vendor
7635 @cindex Vendor branch
7636 @cindex Branch, vendor-
7637 In the terminology used in @sc{cvs}, the supplier of the
7638 program is called a @dfn{vendor}.  The unmodified
7639 distribution from the vendor is checked in on its own
7640 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
7641 1.1.1 for this use.
7642
7643 When you modify the source and commit it, your revision
7644 will end up on the main trunk.  When a new release is
7645 made by the vendor, you commit it on the vendor branch
7646 and copy the modifications onto the main trunk.
7647
7648 Use the @code{import} command to create and update
7649 the vendor branch.  When you import a new file,
7650 (usually) the vendor branch is made the `head' revision, so
7651 anyone that checks out a copy of the file gets that
7652 revision.  When a local modification is committed it is
7653 placed on the main trunk, and made the `head'
7654 revision.
7655
7656 @menu
7657 * First import::                Importing for the first time
7658 * Update imports::              Updating with the import command
7659 * Reverting local changes::     Reverting to the latest vendor release
7660 * Binary files in imports::     Binary files require special handling
7661 * Keywords in imports::         Keyword substitution might be undesirable
7662 * Multiple vendor branches::    What if you get sources from several places?
7663 @end menu
7664
7665 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7666 @node First import
7667 @section Importing for the first time
7668 @cindex Importing modules
7669
7670 @c Should mention naming conventions for vendor tags,
7671 @c release tags, and perhaps directory names.
7672 Use the @code{import} command to check in the sources
7673 for the first time.  When you use the @code{import}
7674 command to track third-party sources, the @dfn{vendor
7675 tag} and @dfn{release tags} are useful.  The
7676 @dfn{vendor tag} is a symbolic name for the branch
7677 (which is always 1.1.1, unless you use the @samp{-b
7678 @var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7679 @dfn{release tags} are symbolic names for a particular
7680 release, such as @samp{FSF_0_04}.
7681
7682 @c I'm not completely sure this belongs here.  But
7683 @c we need to say it _somewhere_ reasonably obvious; it
7684 @c is a common misconception among people first learning CVS
7685 Note that @code{import} does @emph{not} change the
7686 directory in which you invoke it.  In particular, it
7687 does not set up that directory as a @sc{cvs} working
7688 directory; if you want to work with the sources import
7689 them first and then check them out into a different
7690 directory (@pxref{Getting the source}).
7691
7692 @cindex wdiff (import example)
7693 Suppose you have the sources to a program called
7694 @code{wdiff} in a directory @file{wdiff-0.04},
7695 and are going to make private modifications that you
7696 want to be able to use even when new releases are made
7697 in the future.  You start by importing the source to
7698 your repository:
7699
7700 @example
7701 $ cd wdiff-0.04
7702 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7703 @end example
7704
7705 The vendor tag is named @samp{FSF_DIST} in the above
7706 example, and the only release tag assigned is
7707 @samp{WDIFF_0_04}.
7708 @c FIXME: Need to say where fsf/wdiff comes from.
7709
7710 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7711 @node Update imports
7712 @section Updating with the import command
7713
7714 When a new release of the source arrives, you import it into the
7715 repository with the same @code{import} command that you used to set up
7716 the repository in the first place.  The only difference is that you
7717 specify a different release tag this time:
7718
7719 @example
7720 $ tar xfz wdiff-0.05.tar.gz
7721 $ cd wdiff-0.05
7722 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7723 @end example
7724
7725 @strong{WARNING: If you use a release tag that already exists in one of the
7726 repository archives, files removed by an import may not be detected.}
7727
7728 For files that have not been modified locally, the newly created
7729 revision becomes the head revision.  If you have made local
7730 changes, @code{import} will warn you that you must merge the changes
7731 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7732
7733 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7734 @c "import"?  I think the assumption is that one has
7735 @c "wdiff fsf/wdiff" or some such in modules, but it
7736 @c would be better to not use modules in this example.
7737 @example
7738 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7739 @end example
7740
7741 @noindent
7742 The above command will check out the latest revision of
7743 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7744 since yesterday into the working copy.  If any conflicts arise during
7745 the merge they should be resolved in the normal way (@pxref{Conflicts
7746 example}).  Then, the modified files may be committed.
7747
7748 However, it is much better to use the two release tags rather than using
7749 a date on the branch as suggested above:
7750
7751 @example
7752 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7753 @end example
7754
7755 @noindent
7756 The reason this is better is that
7757 using a date, as suggested above, assumes that you do
7758 not import more than one release of a product per day.
7759 More importantly, using the release tags allows @sc{cvs} to detect files
7760 that were removed between the two vendor releases and mark them for
7761 removal.  Since @code{import} has no way to detect removed files, you
7762 should do a merge like this even if @code{import} doesn't tell you to.
7763
7764 @node Reverting local changes
7765 @section Reverting to the latest vendor release
7766
7767 You can also revert local changes completely and return
7768 to the latest vendor release by changing the `head'
7769 revision back to the vendor branch on all files.  For
7770 example, if you have a checked-out copy of the sources
7771 in @file{~/work.d/wdiff}, and you want to revert to the
7772 vendor's version for all the files in that directory,
7773 you would type:
7774
7775 @example
7776 $ cd ~/work.d/wdiff
7777 $ cvs admin -bFSF_DIST .
7778 @end example
7779
7780 @noindent
7781 You must specify the @samp{-bFSF_DIST} without any space
7782 after the @samp{-b}.  @xref{admin options}.
7783
7784 @node Binary files in imports
7785 @section How to handle binary files with cvs import
7786
7787 Use the @samp{-k} wrapper option to tell import which
7788 files are binary.  @xref{Wrappers}.
7789
7790 @node Keywords in imports
7791 @section How to handle keyword substitution with cvs import
7792
7793 The sources which you are importing may contain
7794 keywords (@pxref{Keyword substitution}).  For example,
7795 the vendor may use @sc{cvs} or some other system
7796 which uses similar keyword expansion syntax.  If you
7797 just import the files in the default fashion, then
7798 the keyword expansions supplied by the vendor will
7799 be replaced by keyword expansions supplied by your
7800 own copy of @sc{cvs}.  It may be more convenient to
7801 maintain the expansions supplied by the vendor, so
7802 that this information can supply information about
7803 the sources that you imported from the vendor.
7804
7805 To maintain the keyword expansions supplied by the
7806 vendor, supply the @samp{-ko} option to @code{cvs
7807 import} the first time you import the file.
7808 This will turn off keyword expansion
7809 for that file entirely, so if you want to be more
7810 selective you'll have to think about what you want
7811 and use the @samp{-k} option to @code{cvs update} or
7812 @code{cvs admin} as appropriate.
7813 @c Supplying -ko to import if the file already existed
7814 @c has no effect.  Not clear to me whether it should
7815 @c or not.
7816
7817 @node Multiple vendor branches
7818 @section Multiple vendor branches
7819
7820 All the examples so far assume that there is only one
7821 vendor from which you are getting sources.  In some
7822 situations you might get sources from a variety of
7823 places.  For example, suppose that you are dealing with
7824 a project where many different people and teams are
7825 modifying the software.  There are a variety of ways to
7826 handle this, but in some cases you have a bunch of
7827 source trees lying around and what you want to do more
7828 than anything else is just to all put them in @sc{cvs} so
7829 that you at least have them in one place.
7830
7831 For handling situations in which there may be more than
7832 one vendor, you may specify the @samp{-b} option to
7833 @code{cvs import}.  It takes as an argument the vendor
7834 branch to import to.  The default is @samp{-b 1.1.1}.
7835
7836 For example, suppose that there are two teams, the red
7837 team and the blue team, that are sending you sources.
7838 You want to import the red team's efforts to branch
7839 1.1.1 and use the vendor tag RED.  You want to import
7840 the blue team's efforts to branch 1.1.3 and use the
7841 vendor tag BLUE.  So the commands you might use are:
7842
7843 @example
7844 $ cvs import dir RED RED_1-0
7845 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7846 @end example
7847
7848 Note that if your vendor tag does not match your
7849 @samp{-b} option, @sc{cvs} will not detect this case!  For
7850 example,
7851
7852 @example
7853 $ cvs import -b 1.1.3 dir RED RED_1-0
7854 @end example
7855
7856 @noindent
7857 Be careful; this kind of mismatch is sure to sow
7858 confusion or worse.  I can't think of a useful purpose
7859 for the ability to specify a mismatch here, but if you
7860 discover such a use, don't.  @sc{cvs} is likely to make this
7861 an error in some future release.
7862
7863 @c Probably should say more about the semantics of
7864 @c multiple branches.  What about the default branch?
7865 @c What about joining (perhaps not as useful with
7866 @c multiple branches, or perhaps it is.  Either way
7867 @c should be mentioned).
7868
7869 @c I'm not sure about the best location for this.  In
7870 @c one sense, it might belong right after we've introduced
7871 @c CVS's basic version control model, because people need
7872 @c to figure out builds right away.  The current location
7873 @c is based on the theory that it kind of akin to the
7874 @c "Revision management" section.
7875 @node Builds
7876 @chapter How your build system interacts with CVS
7877 @cindex Builds
7878 @cindex make
7879
7880 As mentioned in the introduction, @sc{cvs} does not
7881 contain software for building your software from source
7882 code.  This section describes how various aspects of
7883 your build system might interact with @sc{cvs}.
7884
7885 @c Is there a way to discuss this without reference to
7886 @c tools other than CVS?  I'm not sure there is; I
7887 @c wouldn't think that people who learn CVS first would
7888 @c even have this concern.
7889 One common question, especially from people who are
7890 accustomed to @sc{rcs}, is how to make their build get
7891 an up to date copy of the sources.  The answer to this
7892 with @sc{cvs} is two-fold.  First of all, since
7893 @sc{cvs} itself can recurse through directories, there
7894 is no need to modify your @file{Makefile} (or whatever
7895 configuration file your build tool uses) to make sure
7896 each file is up to date.  Instead, just use two
7897 commands, first @code{cvs -q update} and then
7898 @code{make} or whatever the command is to invoke your
7899 build tool.  Secondly, you do not necessarily
7900 @emph{want} to get a copy of a change someone else made
7901 until you have finished your own work.  One suggested
7902 approach is to first update your sources, then
7903 implement, build and
7904 test the change you were thinking of, and then commit
7905 your sources (updating first if necessary).  By
7906 periodically (in between changes, using the approach
7907 just described) updating your entire tree, you ensure
7908 that your sources are sufficiently up to date.
7909
7910 @cindex Bill of materials
7911 One common need is to record which versions of which
7912 source files went into a particular build.  This kind
7913 of functionality is sometimes called @dfn{bill of
7914 materials} or something similar.  The best way to do
7915 this with @sc{cvs} is to use the @code{tag} command to
7916 record which versions went into a given build
7917 (@pxref{Tags}).
7918
7919 Using @sc{cvs} in the most straightforward manner
7920 possible, each developer will have a copy of the entire
7921 source tree which is used in a particular build.  If
7922 the source tree is small, or if developers are
7923 geographically dispersed, this is the preferred
7924 solution.  In fact one approach for larger projects is
7925 to break a project down into smaller
7926 @c I say subsystem instead of module because they may or
7927 @c may not use the modules file.
7928 separately-compiled subsystems, and arrange a way of
7929 releasing them internally so that each developer need
7930 check out only those subsystems which they are
7931 actively working on.
7932
7933 Another approach is to set up a structure which allows
7934 developers to have their own copies of some files, and
7935 for other files to access source files from a central
7936 location.  Many people have come up with some such a
7937 @c two such people are paul@sander.cupertino.ca.us (for
7938 @c a previous employer)
7939 @c and gtornblo@senet.abb.se (spicm and related tools),
7940 @c but as far as I know
7941 @c no one has nicely packaged or released such a system (or
7942 @c instructions for constructing one).
7943 system using features such as the symbolic link feature
7944 found in many operating systems, or the @code{VPATH}
7945 feature found in many versions of @code{make}.  One build
7946 tool which is designed to help with this kind of thing
7947 is Odin (see
7948 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7949 @c Should we be saying more about Odin?  Or how you use
7950 @c it with CVS?  Also, the Prime Time Freeware for Unix
7951 @c disk (see http://www.ptf.com/) has Odin (with a nice
7952 @c paragraph summarizing it on the web), so that might be a
7953 @c semi-"official" place to point people.
7954 @c
7955 @c Of course, many non-CVS systems have this kind of
7956 @c functionality, for example OSF's ODE
7957 @c (http://www.osf.org/ode/) or mk
7958 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7959 @c He has changed providers in the past; a search engine search
7960 @c for "Peter Ziobrzynski" probably won't get too many
7961 @c spurious hits :-).  A more stable URL might be
7962 @c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7963 @c there is any point in mentioning them here unless they
7964 @c can work with CVS.
7965
7966 @c ---------------------------------------------------------------------
7967 @node Special Files
7968 @chapter Special Files
7969
7970 @cindex Special files
7971 @cindex Device nodes
7972 @cindex Ownership, saving in CVS
7973 @cindex Permissions, saving in CVS
7974 @cindex Hard links
7975 @cindex Symbolic links
7976
7977 In normal circumstances, @sc{cvs} works only with regular
7978 files.  Every file in a project is assumed to be
7979 persistent; it must be possible to open, read and close
7980 them; and so on.  @sc{cvs} also ignores file permissions and
7981 ownerships, leaving such issues to be resolved by the
7982 developer at installation time.  In other words, it is
7983 not possible to "check in" a device into a repository;
7984 if the device file cannot be opened, @sc{cvs} will refuse to
7985 handle it.  Files also lose their ownerships and
7986 permissions during repository transactions.
7987
7988 @ignore
7989 If the configuration variable @code{PreservePermissions}
7990 (@pxref{config}) is set in the repository, @sc{cvs} will
7991 save the following file characteristics in the
7992 repository:
7993
7994 @itemize @bullet
7995 @item user and group ownership
7996 @item permissions
7997 @item major and minor device numbers
7998 @item symbolic links
7999 @item hard link structure
8000 @end itemize
8001
8002 Using the @code{PreservePermissions} option affects the
8003 behavior of @sc{cvs} in several ways.  First, some of the
8004 new operations supported by @sc{cvs} are not accessible to
8005 all users.  In particular, file ownership and special
8006 file characteristics may only be changed by the
8007 superuser.  When the @code{PreservePermissions}
8008 configuration variable is set, therefore, users will
8009 have to be `root' in order to perform @sc{cvs} operations.
8010
8011 When @code{PreservePermissions} is in use, some @sc{cvs}
8012 operations (such as @samp{cvs status}) will not
8013 recognize a file's hard link structure, and so will
8014 emit spurious warnings about mismatching hard links.
8015 The reason is that @sc{cvs}'s internal structure does not
8016 make it easy for these operations to collect all the
8017 necessary data about hard links, so they check for file
8018 conflicts with inaccurate data.
8019
8020 A more subtle difference is that @sc{cvs} considers a file
8021 to have changed only if its contents have changed
8022 (specifically, if the modification time of the working
8023 file does not match that of the repository's file).
8024 Therefore, if only the permissions, ownership or hard
8025 linkage have changed, or if a device's major or minor
8026 numbers have changed, @sc{cvs} will not notice.  In order to
8027 commit such a change to the repository, you must force
8028 the commit with @samp{cvs commit -f}.  This also means
8029 that if a file's permissions have changed and the
8030 repository file is newer than the working copy,
8031 performing @samp{cvs update} will silently change the
8032 permissions on the working copy.
8033
8034 Changing hard links in a @sc{cvs} repository is particularly
8035 delicate.  Suppose that file @file{foo} is linked to
8036 file @file{old}, but is later relinked to file
8037 @file{new}.  You can wind up in the unusual situation
8038 where, although @file{foo}, @file{old} and @file{new}
8039 have all had their underlying link patterns changed,
8040 only @file{foo} and @file{new} have been modified, so
8041 @file{old} is not considered a candidate for checking
8042 in.  It can be very easy to produce inconsistent
8043 results this way.  Therefore, we recommend that when it
8044 is important to save hard links in a repository, the
8045 prudent course of action is to @code{touch} any file
8046 whose linkage or status has changed since the last
8047 checkin.  Indeed, it may be wise to @code{touch *}
8048 before each commit in a directory with complex hard
8049 link structures.
8050
8051 It is worth noting that only regular files may
8052 be merged, for reasons that hopefully are obvious.  If
8053 @samp{cvs update} or @samp{cvs checkout -j} attempts to
8054 merge a symbolic link with a regular file, or two
8055 device files for different kinds of devices, @sc{cvs} will
8056 report a conflict and refuse to perform the merge.  At
8057 the same time, @samp{cvs diff} will not report any
8058 differences between these files, since no meaningful
8059 textual comparisons can be made on files which contain
8060 no text.
8061
8062 The @code{PreservePermissions} features do not work
8063 with client/server @sc{cvs}.  Another limitation is
8064 that hard links must be to other files within the same
8065 directory; hard links across directories are not
8066 supported.
8067 @end ignore
8068
8069 @c ---------------------------------------------------------------------
8070 @c ----- START MAN 1 -----
8071 @node CVS commands
8072 @appendix Guide to CVS commands
8073
8074 This appendix describes the overall structure of
8075 @sc{cvs} commands, and describes some commands in
8076 detail (others are described elsewhere; for a quick
8077 reference to @sc{cvs} commands, @pxref{Invoking CVS}).
8078 @c The idea is that we want to move the commands which
8079 @c are described here into the main body of the manual,
8080 @c in the process reorganizing the manual to be
8081 @c organized around what the user wants to do, not
8082 @c organized around CVS commands.
8083 @c
8084 @c Note that many users do expect a manual which is
8085 @c organized by command.  At least some users do.
8086 @c One good addition to the "organized by command"
8087 @c section (if any) would be "see also" links.
8088 @c The awk manual might be a good example; it has a
8089 @c reference manual which is more verbose than Invoking
8090 @c CVS but probably somewhat less verbose than CVS
8091 @c Commands.
8092
8093 @menu
8094 * Structure::                   Overall structure of CVS commands
8095 * Exit status::                 Indicating CVS's success or failure
8096 * ~/.cvsrc::                    Default options with the ~/.cvsrc file
8097 * Global options::              Options you give to the left of cvs_command
8098 * Common options::              Options you give to the right of cvs_command
8099 * Date input formats::          Acceptable formats for date specifications
8100 * admin::                       Administration
8101 * annotate::                    What revision modified each line of a file?
8102 * checkout::                    Checkout sources for editing
8103 * commit::                      Check files into the repository
8104 * diff::                        Show differences between revisions
8105 * export::                      Export sources from CVS, similar to checkout
8106 * history::                     Show status of files and users
8107 * import::                      Import sources into CVS, using vendor branches
8108 * log::                         Show log messages for files
8109 * ls & rls::                    List files in the repository
8110 * rdiff::                       'patch' format diffs between releases
8111 * release::                     Indicate that a directory is no longer in use
8112 * update::                      Bring work tree in sync with repository
8113 @end menu
8114
8115 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8116 @node Structure
8117 @appendixsec Overall structure of CVS commands
8118 @cindex Structure
8119 @cindex CVS command structure
8120 @cindex Command structure
8121 @cindex Format of CVS commands
8122
8123 The overall format of all @sc{cvs} commands is:
8124
8125 @example
8126 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
8127 @end example
8128
8129 @table @code
8130 @item cvs
8131 The name of the @sc{cvs} program.
8132
8133 @item cvs_options
8134 Some options that affect all sub-commands of @sc{cvs}.  These are
8135 described below.
8136
8137 @item cvs_command
8138 One of several different sub-commands.  Some of the commands have
8139 aliases that can be used instead; those aliases are noted in the
8140 reference manual for that command.  There are only two situations
8141 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
8142 list of available commands, and @samp{cvs -v} displays version
8143 information on @sc{cvs} itself.
8144
8145 @item command_options
8146 Options that are specific for the command.
8147
8148 @item command_args
8149 Arguments to the commands.
8150 @end table
8151
8152 There is unfortunately some confusion between
8153 @code{cvs_options} and @code{command_options}.
8154 When given as a @code{cvs_option}, some options only
8155 affect some of the commands.  When given as a
8156 @code{command_option} it may have a different meaning, and
8157 be accepted by more commands.  In other words, do not
8158 take the above categorization too seriously.  Look at
8159 the documentation instead.
8160
8161 @node Exit status
8162 @appendixsec CVS's exit status
8163 @cindex Exit status, of CVS
8164
8165 @sc{cvs} can indicate to the calling environment whether it
8166 succeeded or failed by setting its @dfn{exit status}.
8167 The exact way of testing the exit status will vary from
8168 one operating system to another.  For example in a unix
8169 shell script the @samp{$?} variable will be 0 if the
8170 last command returned a successful exit status, or
8171 greater than 0 if the exit status indicated failure.
8172
8173 If @sc{cvs} is successful, it returns a successful status;
8174 if there is an error, it prints an error message and
8175 returns a failure status.  The one exception to this is
8176 the @code{cvs diff} command.  It will return a
8177 successful status if it found no differences, or a
8178 failure status if there were differences or if there
8179 was an error.  Because this behavior provides no good
8180 way to detect errors, in the future it is possible that
8181 @code{cvs diff} will be changed to behave like the
8182 other @sc{cvs} commands.
8183 @c It might seem like checking whether cvs -q diff
8184 @c produces empty or non-empty output can tell whether
8185 @c there were differences or not.  But it seems like
8186 @c there are cases with output but no differences
8187 @c (testsuite basica-8b).  It is not clear to me how
8188 @c useful it is for a script to be able to check
8189 @c whether there were differences.
8190 @c FIXCVS? In previous versions of CVS, cvs diff
8191 @c returned 0 for no differences, 1 for differences, or
8192 @c 2 for errors.  Is this behavior worth trying to
8193 @c bring back (but what does it mean for VMS?)?
8194
8195 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8196 @node ~/.cvsrc
8197 @appendixsec Default options and the ~/.cvsrc file
8198 @cindex .cvsrc file
8199 @cindex Option defaults
8200
8201 There are some @code{command_options} that are used so
8202 often that you might have set up an alias or some other
8203 means to make sure you always specify that option.  One
8204 example (the one that drove the implementation of the
8205 @file{.cvsrc} support, actually) is that many people find the
8206 default output of the @samp{diff} command to be very
8207 hard to read, and that either context diffs or unidiffs
8208 are much easier to understand.
8209
8210 The @file{~/.cvsrc} file is a way that you can add
8211 default options to @code{cvs_commands} within cvs,
8212 instead of relying on aliases or other shell scripts.
8213
8214 The format of the @file{~/.cvsrc} file is simple.  The
8215 file is searched for a line that begins with the same
8216 name as the @code{cvs_command} being executed.  If a
8217 match is found, then the remainder of the line is split
8218 up (at whitespace characters) into separate options and
8219 added to the command arguments @emph{before} any
8220 options from the command line.
8221
8222 If a command has two names (e.g., @code{checkout} and
8223 @code{co}), the official name, not necessarily the one
8224 used on the command line, will be used to match against
8225 the file.  So if this is the contents of the user's
8226 @file{~/.cvsrc} file:
8227
8228 @example
8229 log -N
8230 diff -uN
8231 rdiff -u
8232 update -Pd
8233 checkout -P
8234 release -d
8235 @end example
8236
8237 @noindent
8238 the command @samp{cvs checkout foo} would have the
8239 @samp{-P} option added to the arguments, as well as
8240 @samp{cvs co foo}.
8241
8242 With the example file above, the output from @samp{cvs
8243 diff foobar} will be in unidiff format.  @samp{cvs diff
8244 -c foobar} will provide context diffs, as usual.
8245 Getting "old" format diffs would be slightly more
8246 complicated, because @code{diff} doesn't have an option
8247 to specify use of the "old" format, so you would need
8248 @samp{cvs -f diff foobar}.
8249
8250 In place of the command name you can use @code{cvs} to
8251 specify global options (@pxref{Global options}).  For
8252 example the following line in @file{.cvsrc}
8253
8254 @example
8255 cvs -z6
8256 @end example
8257
8258 @noindent
8259 causes @sc{cvs} to use compression level 6.
8260
8261 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8262 @node Global options
8263 @appendixsec Global options
8264 @cindex Options, global
8265 @cindex Global options
8266 @cindex Left-hand options
8267
8268 The available @samp{cvs_options} (that are given to the
8269 left of @samp{cvs_command}) are:
8270
8271 @table @code
8272 @item --allow-root=@var{rootdir}
8273 May be invoked multiple times to specify one legal @sc{cvsroot} directory with
8274 each invocation.  Also causes CVS to preparse the configuration file for each
8275 specified root, which can be useful when configuring write proxies,  See
8276 @ref{Password authentication server} & @ref{Write proxies}.
8277
8278 @cindex Authentication, stream
8279 @cindex Stream authentication
8280 @item -a
8281 Authenticate all communication between the client and
8282 the server.  Only has an effect on the @sc{cvs} client.
8283 As of this writing, this is only implemented when using
8284 a GSSAPI connection (@pxref{GSSAPI authenticated}).
8285 Authentication prevents certain sorts of attacks
8286 involving hijacking the active @sc{tcp} connection.
8287 Enabling authentication does not enable encryption.
8288
8289 @cindex RCSBIN, overriding
8290 @cindex Overriding RCSBIN
8291 @item -b @var{bindir}
8292 In @sc{cvs} 1.9.18 and older, this specified that
8293 @sc{rcs} programs are in the @var{bindir} directory.
8294 Current versions of @sc{cvs} do not run @sc{rcs}
8295 programs; for compatibility this option is accepted,
8296 but it does nothing.
8297
8298 @cindex TMPDIR, overriding
8299 @cindex Overriding TMPDIR
8300 @item -T @var{tempdir}
8301 Use @var{tempdir} as the directory where temporary files are
8302 located.  Overrides the setting of the @code{$TMPDIR} environment
8303 variable and any precompiled directory.  This parameter should be
8304 specified as an absolute pathname.
8305 (When running client/server, @samp{-T} affects only the local process;
8306 specifying @samp{-T} for the client has no effect on the server and
8307 vice versa.)
8308
8309 @cindex CVSROOT, overriding
8310 @cindex Overriding CVSROOT
8311 @item -d @var{cvs_root_directory}
8312 Use @var{cvs_root_directory} as the root directory
8313 pathname of the repository.  Overrides the setting of
8314 the @code{$CVSROOT} environment variable.  @xref{Repository}.
8315
8316 @cindex EDITOR, overriding
8317 @cindex Overriding EDITOR
8318 @item -e @var{editor}
8319 Use @var{editor} to enter revision log information.  Overrides the
8320 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
8321 environment variables.  For more information, see
8322 @ref{Committing your changes}.
8323
8324 @item -f
8325 Do not read the @file{~/.cvsrc} file.  This
8326 option is most often used because of the
8327 non-orthogonality of the @sc{cvs} option set.  For
8328 example, the @samp{cvs log} option @samp{-N} (turn off
8329 display of tag names) does not have a corresponding
8330 option to turn the display on.  So if you have
8331 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
8332 you may need to use @samp{-f} to show the tag names.
8333
8334 @item -H
8335 @itemx --help
8336 Display usage information about the specified @samp{cvs_command}
8337 (but do not actually execute the command).  If you don't specify
8338 a command name, @samp{cvs -H} displays overall help for
8339 @sc{cvs}, including a list of other help options.
8340 @c It seems to me it is better to document it this way
8341 @c rather than trying to update this documentation
8342 @c every time that we add a --help-foo option.  But
8343 @c perhaps that is confusing...
8344
8345 @cindex Read-only repository mode
8346 @item -R
8347 Turns on read-only repository mode.  This allows one to check out from a
8348 read-only repository, such as within an anoncvs server, or from a @sc{cd-rom}
8349 repository.
8350
8351 Same effect as if the @code{CVSREADONLYFS} environment
8352 variable is set. Using @samp{-R} can also considerably
8353 speed up checkouts over NFS.
8354
8355 @cindex Read-only mode
8356 @item -n
8357 Do not change any files.  Attempt to execute the
8358 @samp{cvs_command}, but only to issue reports; do not remove,
8359 update, or merge any existing files, or create any new files.
8360
8361 Note that @sc{cvs} will not necessarily produce exactly
8362 the same output as without @samp{-n}.  In some cases
8363 the output will be the same, but in other cases
8364 @sc{cvs} will skip some of the processing that would
8365 have been required to produce the exact same output.
8366
8367 @item -Q
8368 Cause the command to be really quiet; the command will only
8369 generate output for serious problems.
8370
8371 @item -q
8372 Cause the command to be somewhat quiet; informational messages,
8373 such as reports of recursion through subdirectories, are
8374 suppressed.
8375
8376 @cindex Read-only files, and -r
8377 @item -r
8378 Make new working files read-only.  Same effect
8379 as if the @code{$CVSREAD} environment variable is set
8380 (@pxref{Environment variables}).  The default is to
8381 make working files writable, unless watches are on
8382 (@pxref{Watches}).
8383
8384 @item -s @var{variable}=@var{value}
8385 Set a user variable (@pxref{Variables}).
8386
8387 @cindex Trace
8388 @item -t
8389 Trace program execution; display messages showing the steps of
8390 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
8391 potential impact of an unfamiliar command.
8392
8393 @item -v
8394 @item --version
8395 Display version and copyright information for @sc{cvs}.
8396
8397 @cindex CVSREAD, overriding
8398 @cindex Overriding CVSREAD
8399 @item -w
8400 Make new working files read-write.  Overrides the
8401 setting of the @code{$CVSREAD} environment variable.
8402 Files are created read-write by default, unless @code{$CVSREAD} is
8403 set or @samp{-r} is given.
8404 @c Note that -w only overrides -r and CVSREAD; it has
8405 @c no effect on files which are readonly because of
8406 @c "cvs watch on".  My guess is that is the way it
8407 @c should be (or should "cvs -w get" on a watched file
8408 @c be the same as a get and a cvs edit?), but I'm not
8409 @c completely sure whether to document it this way.
8410
8411 @item -x
8412 @cindex Encryption
8413 Encrypt all communication between the client and the
8414 server.  Only has an effect on the @sc{cvs} client.  As
8415 of this writing, this is only implemented when using a
8416 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
8417 Kerberos connection (@pxref{Kerberos authenticated}).
8418 Enabling encryption implies that message traffic is
8419 also authenticated.  Encryption support is not
8420 available by default; it must be enabled using a
8421 special configure option, @file{--enable-encryption},
8422 when you build @sc{cvs}.
8423
8424 @item -z @var{gzip-level}
8425 @cindex Compression
8426 @cindex Gzip
8427 Set the compression level.
8428 Valid levels are 1 (high speed, low compression) to
8429 9 (low speed, high compression), or 0 to disable
8430 compression (the default).
8431 Only has an effect on the @sc{cvs} client.
8432
8433 @end table
8434
8435 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8436 @node Common options
8437 @appendixsec Common command options
8438 @cindex Common options
8439 @cindex Right-hand options
8440
8441 This section describes the @samp{command_options} that
8442 are available across several @sc{cvs} commands.  These
8443 options are always given to the right of
8444 @samp{cvs_command}. Not all
8445 commands support all of these options; each option is
8446 only supported for commands where it makes sense.
8447 However, when a command has one of these options you
8448 can almost always count on the same behavior of the
8449 option as in other commands.  (Other command options,
8450 which are listed with the individual commands, may have
8451 different behavior from one @sc{cvs} command to the other).
8452
8453 @strong{Note: the @samp{history} command is an exception; it supports
8454 many options that conflict even with these standard options.}
8455
8456 @table @code
8457 @cindex Dates
8458 @cindex Time
8459 @cindex Specifying dates
8460 @item -D @var{date_spec}
8461 Use the most recent revision no later than @var{date_spec}.
8462 @var{date_spec} is a single argument, a date description
8463 specifying a date in the past.
8464
8465 The specification is @dfn{sticky} when you use it to make a
8466 private copy of a source file; that is, when you get a working
8467 file using @samp{-D}, @sc{cvs} records the date you specified, so that
8468 further updates in the same directory will use the same date
8469 (for more information on sticky tags/dates, @pxref{Sticky tags}).
8470
8471 @samp{-D} is available with the @code{annotate}, @code{checkout},
8472 @code{diff}, @code{export}, @code{history}, @code{ls},
8473 @code{rdiff}, @code{rls}, @code{rtag}, @code{tag}, and @code{update} commands.
8474 (The @code{history} command uses this option in a
8475 slightly different way; @pxref{history options}).
8476
8477 For a complete description of the date formats accepted by @sc{cvs},
8478 @ref{Date input formats}.
8479 @c What other formats should we accept?  I don't want
8480 @c to start accepting a whole mess of non-standard
8481 @c new formats (there are a lot which are in wide use in
8482 @c one context or another), but practicality does
8483 @c dictate some level of flexibility.
8484 @c * POSIX.2 (e.g. touch, ls output, date) and other
8485 @c POSIX and/or de facto unix standards (e.g. at).  The
8486 @c practice here is too inconsistent to be of any use.
8487 @c * VMS dates.  This is not a formal standard, but
8488 @c there is a published specification (see SYS$ASCTIM
8489 @c and SYS$BINTIM in the _VMS System Services Reference
8490 @c Manual_), it is implemented consistently in VMS
8491 @c utilities, and VMS users will expect CVS running on
8492 @c VMS to support this format (and if we're going to do
8493 @c that, better to make CVS support it on all
8494 @c platforms.  Maybe).
8495 @c
8496 @c One more note: In output, CVS should consistently
8497 @c use one date format, and that format should be one that
8498 @c it accepts in input as well.  The former isn't
8499 @c really true (see survey below), and I'm not
8500 @c sure that either of those formats is accepted in
8501 @c input.
8502 @c
8503 @c cvs log
8504 @c   current 1996/01/02 13:45:31
8505 @c   Internet 02 Jan 1996 13:45:31 UT
8506 @c   ISO 1996-01-02 13:45:31
8507 @c cvs ann
8508 @c   current 02-Jan-96
8509 @c   Internet-like 02 Jan 96
8510 @c   ISO 96-01-02
8511 @c cvs status
8512 @c   current Tue Jun 11 02:54:53 1996
8513 @c   Internet [Tue,] 11 Jun 1996 02:54:53
8514 @c   ISO 1996-06-11 02:54:53
8515 @c   note: date possibly should be omitted entirely for
8516 @c   other reasons.
8517 @c cvs editors
8518 @c   current Tue Jun 11 02:54:53 1996 GMT
8519 @c cvs history
8520 @c   current 06/11 02:54 +0000
8521 @c any others?
8522 @c There is a good chance the proper solution has to
8523 @c involve at least some level of letting the user
8524 @c decide which format (with the default being the
8525 @c formats CVS has always used; changing these might be
8526 @c _very_ disruptive since scripts may very well be
8527 @c parsing them).
8528 @c
8529 @c Another random bit of prior art concerning dates is
8530 @c the strptime function which takes templates such as
8531 @c "%m/%d/%y", and apparent a variant of getdate()
8532 @c which also honors them.  See
8533 @c X/Open CAE Specification, System Interfaces and
8534 @c Headers Issue 4, Version 2 (September 1994), in the
8535 @c entry for getdate() on page 231
8536
8537 Remember to quote the argument to the @samp{-D}
8538 flag so that your shell doesn't interpret spaces as
8539 argument separators.  A command using the @samp{-D}
8540 flag can look like this:
8541
8542 @example
8543 $ cvs diff -D "1 hour ago" cvs.texinfo
8544 @end example
8545
8546 @cindex Forcing a tag match
8547 @item -f
8548 When you specify a particular date or tag to @sc{cvs} commands, they
8549 normally ignore files that do not contain the tag (or did not
8550 exist prior to the date) that you specified.  Use the @samp{-f} option
8551 if you want files retrieved even when there is no match for the
8552 tag or date.  (The most recent revision of the file
8553 will be used).
8554
8555 Note that even with @samp{-f}, a tag that you specify
8556 must exist (that is, in some file, not necessary in
8557 every file).  This is so that @sc{cvs} will continue to
8558 give an error if you mistype a tag name.
8559
8560 @need 800
8561 @samp{-f} is available with these commands:
8562 @code{annotate}, @code{checkout}, @code{export},
8563 @code{rdiff}, @code{rtag}, and @code{update}.
8564
8565 @strong{WARNING:  The @code{commit} and @code{remove}
8566 commands also have a
8567 @samp{-f} option, but it has a different behavior for
8568 those commands.  See @ref{commit options}, and
8569 @ref{Removing files}.}
8570
8571 @item -k @var{kflag}
8572 Override the default processing of RCS keywords other than
8573 @samp{-kb}.  @xref{Keyword substitution}, for the meaning of
8574 @var{kflag}.  Used with the @code{checkout} and @code{update}
8575 commands, your @var{kflag} specification is
8576 @dfn{sticky}; that is, when you use this option
8577 with a @code{checkout} or @code{update} command,
8578 @sc{cvs} associates your selected @var{kflag} with any files
8579 it operates on, and continues to use that @var{kflag} with future
8580 commands on the same files until you specify otherwise.
8581
8582 The @samp{-k} option is available with the @code{add},
8583 @code{checkout}, @code{diff}, @code{export}, @code{import} and
8584 @code{update} commands.
8585
8586 @strong{WARNING: Prior to CVS version 1.12.2, the @samp{-k} flag
8587 overrode the @samp{-kb} indication for a binary file.  This could
8588 sometimes corrupt binary files.  @xref{Merging and keywords}, for
8589 more.}
8590
8591 @item -l
8592 Local; run only in current working directory, rather than
8593 recursing through subdirectories.
8594
8595 Available with the following commands: @code{annotate}, @code{checkout},
8596 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8597 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8598 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8599 and @code{watchers}.
8600
8601 @cindex Editor, avoiding invocation of
8602 @cindex Avoiding editor invocation
8603 @item -m @var{message}
8604 Use @var{message} as log information, instead of
8605 invoking an editor.
8606
8607 Available with the following commands: @code{add},
8608 @code{commit} and @code{import}.
8609
8610 @item -n
8611 Do not run any tag program.  (A program can be
8612 specified to run in the modules
8613 database (@pxref{modules}); this option bypasses it).
8614
8615 @strong{Note: this is not the same as the @samp{cvs -n}
8616 program option, which you can specify to the left of a cvs command!}
8617
8618 Available with the @code{checkout}, @code{commit}, @code{export},
8619 and @code{rtag} commands.
8620
8621 @item -P
8622 Prune empty directories.  See @ref{Removing directories}.
8623
8624 @item -p
8625 Pipe the files retrieved from the repository to standard output,
8626 rather than writing them in the current directory.  Available
8627 with the @code{checkout} and @code{update} commands.
8628
8629 @item -R
8630 Process directories recursively.  This is the default for all @sc{cvs}
8631 commands, with the exception of @code{ls} & @code{rls}.
8632
8633 Available with the following commands: @code{annotate}, @code{checkout},
8634 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8635 @code{ls}, @code{rdiff}, @code{remove}, @code{rls}, @code{rtag},
8636 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8637 and @code{watchers}.
8638
8639 @item -r @var{tag}
8640 @item -r @var{tag}[:@var{date}]
8641 @cindex HEAD, special tag
8642 @cindex BASE, special tag
8643 Use the revision specified by the @var{tag} argument (and the @var{date}
8644 argument for the commands which accept it) instead of the
8645 default @dfn{head} revision.  As well as arbitrary tags defined
8646 with the @code{tag} or @code{rtag} command, two special tags are
8647 always available: @samp{HEAD} refers to the most recent version
8648 available in the repository, and @samp{BASE} refers to the
8649 revision you last checked out into the current working directory.
8650
8651 @c FIXME: What does HEAD really mean?  I believe that
8652 @c the current answer is the head of the default branch
8653 @c for all cvs commands except diff.  For diff, it
8654 @c seems to be (a) the head of the trunk (or the default
8655 @c branch?) if there is no sticky tag, (b) the head of the
8656 @c branch for the sticky tag, if there is a sticky tag.
8657 @c (b) is ugly as it differs
8658 @c from what HEAD means for other commands, but people
8659 @c and/or scripts are quite possibly used to it.
8660 @c See "head" tests in sanity.sh.
8661 @c Probably the best fix is to introduce two new
8662 @c special tags, ".thead" for the head of the trunk,
8663 @c and ".bhead" for the head of the current branch.
8664 @c Then deprecate HEAD.  This has the advantage of
8665 @c not surprising people with a change to HEAD, and a
8666 @c side benefit of also phasing out the poorly-named
8667 @c HEAD (see discussion of reserved tag names in node
8668 @c "Tags").  Of course, .thead and .bhead should be
8669 @c carefully implemented (with the implementation the
8670 @c same for "diff" as for everyone else), test cases
8671 @c written (similar to the ones in "head"), new tests
8672 @c cases written for things like default branches, &c.
8673
8674 The tag specification is sticky when you use this
8675 with @code{checkout} or @code{update} to make your own
8676 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8677 future update commands, until you specify otherwise (for more information
8678 on sticky tags/dates, @pxref{Sticky tags}).
8679
8680 The tag can be either a symbolic or numeric tag, as
8681 described in @ref{Tags}, or the name of a branch, as
8682 described in @ref{Branching and merging}.  When @var{tag} is the name of a
8683 branch, some commands accept the optional @var{date} argument to specify
8684 the revisions as of the given date on the branch.
8685
8686 Specifying the @samp{-q} global option along with the
8687 @samp{-r} command option is often useful, to suppress
8688 the warning messages when the @sc{rcs} file
8689 does not contain the specified tag.
8690
8691 @strong{Note: this is not the same as the overall @samp{cvs -r} option,
8692 which you can specify to the left of a @sc{cvs} command!}
8693
8694 @samp{-r @var{tag}} is available with the @code{commit} and @code{history}
8695 commands.
8696
8697 @samp{-r @var{tag}[:@var{date}]} is available with the @code{annotate},
8698 @code{checkout}, @code{diff}, @code{export}, @code{rdiff}, @code{rtag},
8699 and @code{update} commands.
8700
8701 @item -W
8702 Specify file names that should be filtered.  You can
8703 use this option repeatedly.  The spec can be a file
8704 name pattern of the same type that you can specify in
8705 the @file{.cvswrappers} file.
8706 Available with the following commands: @code{import},
8707 and @code{update}.
8708
8709 @end table
8710
8711 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8712 @include getdate-cvs.texi
8713
8714 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8715 @node admin
8716 @appendixsec admin---Administration
8717 @cindex Admin (subcommand)
8718
8719 @itemize @bullet
8720 @item
8721 Requires: repository, working directory.
8722 @item
8723 Changes: repository.
8724 @item
8725 Synonym: rcs
8726 @end itemize
8727
8728 This is the @sc{cvs} interface to assorted
8729 administrative facilities.  Some of them have
8730 questionable usefulness for @sc{cvs} but exist for
8731 historical purposes.  Some of the questionable options
8732 are likely to disappear in the future.  This command
8733 @emph{does} work recursively, so extreme care should be
8734 used.
8735
8736 @cindex cvsadmin
8737 @cindex UserAdminOptions, in CVSROOT/config
8738 On unix, if there is a group named @code{cvsadmin},
8739 only members of that group can run @code{cvs admin}
8740 commands, except for those specified using the
8741 @code{UserAdminOptions} configuration option in the
8742 @file{CVSROOT/config} file.  Options specified using
8743 @code{UserAdminOptions} can be run by any user.  See
8744 @ref{config} for more on @code{UserAdminOptions}.
8745
8746 The @code{cvsadmin} group should exist on the server,
8747 or any system running the non-client/server @sc{cvs}.
8748 To disallow @code{cvs admin} for all users, create a
8749 group with no users in it.  On NT, the @code{cvsadmin}
8750 feature does not exist and all users
8751 can run @code{cvs admin}.
8752
8753 @menu
8754 * admin options::               admin options
8755 @end menu
8756
8757 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8758 @node admin options
8759 @appendixsubsec admin options
8760
8761 Some of these options have questionable usefulness for
8762 @sc{cvs} but exist for historical purposes.  Some even
8763 make it impossible to use @sc{cvs} until you undo the
8764 effect!
8765
8766 @table @code
8767 @item -A@var{oldfile}
8768 Might not work together with @sc{cvs}.  Append the
8769 access list of @var{oldfile} to the access list of the
8770 @sc{rcs} file.
8771
8772 @item -a@var{logins}
8773 Might not work together with @sc{cvs}.  Append the
8774 login names appearing in the comma-separated list
8775 @var{logins} to the access list of the @sc{rcs} file.
8776
8777 @item -b[@var{rev}]
8778 Set the default branch to @var{rev}.  In @sc{cvs}, you
8779 normally do not manipulate default branches; sticky
8780 tags (@pxref{Sticky tags}) are a better way to decide
8781 which branch you want to work on.  There is one reason
8782 to run @code{cvs admin -b}: to revert to the vendor's
8783 version when using vendor branches (@pxref{Reverting
8784 local changes}).
8785 There can be no space between @samp{-b} and its argument.
8786 @c Hmm, we don't document the usage where rev is
8787 @c omitted.  Maybe that usage can/should be deprecated
8788 @c (and replaced with -bHEAD or something?) (so we can toss
8789 @c the optional argument).  Note that -bHEAD does not
8790 @c work, as of 17 Sep 1997, but probably will once "cvs
8791 @c admin" is internal to CVS.
8792
8793 @cindex Comment leader
8794 @item -c@var{string}
8795 Sets the comment leader to @var{string}.  The comment
8796 leader is not used by current versions of @sc{cvs} or
8797 @sc{rcs} 5.7.  Therefore, you can almost surely not
8798 worry about it.  @xref{Keyword substitution}.
8799
8800 @item -e[@var{logins}]
8801 Might not work together with @sc{cvs}.  Erase the login
8802 names appearing in the comma-separated list
8803 @var{logins} from the access list of the RCS file.  If
8804 @var{logins} is omitted, erase the entire access list.
8805 There can be no space between @samp{-e} and its argument.
8806
8807 @item -I
8808 Run interactively, even if the standard input is not a
8809 terminal.  This option does not work with the
8810 client/server @sc{cvs} and is likely to disappear in
8811 a future release of @sc{cvs}.
8812
8813 @item -i
8814 Useless with @sc{cvs}.  This creates and initializes a
8815 new @sc{rcs} file, without depositing a revision.  With
8816 @sc{cvs}, add files with the @code{cvs add} command
8817 (@pxref{Adding files}).
8818
8819 @item -k@var{subst}
8820 Set the default keyword
8821 substitution to @var{subst}.  @xref{Keyword
8822 substitution}.  Giving an explicit @samp{-k} option to
8823 @code{cvs update}, @code{cvs export}, or @code{cvs
8824 checkout} overrides this default.
8825
8826 @item -l[@var{rev}]
8827 Lock the revision with number @var{rev}.  If a branch
8828 is given, lock the latest revision on that branch.  If
8829 @var{rev} is omitted, lock the latest revision on the
8830 default branch.  There can be no space between
8831 @samp{-l} and its argument.
8832
8833 This can be used in conjunction with the
8834 @file{rcslock.pl} script in the @file{contrib}
8835 directory of the @sc{cvs} source distribution to
8836 provide reserved checkouts (where only one user can be
8837 editing a given file at a time).  See the comments in
8838 that file for details (and see the @file{README} file
8839 in that directory for disclaimers about the unsupported
8840 nature of contrib).  According to comments in that
8841 file, locking must set to strict (which is the default).
8842
8843 @item -L
8844 Set locking to strict.  Strict locking means that the
8845 owner of an RCS file is not exempt from locking for
8846 checkin.  For use with @sc{cvs}, strict locking must be
8847 set; see the discussion under the @samp{-l} option above.
8848
8849 @cindex Changing a log message
8850 @cindex Replacing a log message
8851 @cindex Correcting a log message
8852 @cindex Fixing a log message
8853 @cindex Log message, correcting
8854 @item -m@var{rev}:@var{msg}
8855 Replace the log message of revision @var{rev} with
8856 @var{msg}.
8857
8858 @c The rcs -M option, to suppress sending mail, has never been
8859 @c documented as a cvs admin option.
8860
8861 @item -N@var{name}[:[@var{rev}]]
8862 Act like @samp{-n}, except override any previous
8863 assignment of @var{name}.  For use with magic branches,
8864 see @ref{Magic branch numbers}.
8865
8866 @item -n@var{name}[:[@var{rev}]]
8867 Associate the symbolic name @var{name} with the branch
8868 or revision @var{rev}.  It is normally better to use
8869 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8870 symbolic name if both @samp{:} and @var{rev} are
8871 omitted; otherwise, print an error message if
8872 @var{name} is already associated with another number.
8873 If @var{rev} is symbolic, it is expanded before
8874 association.  A @var{rev} consisting of a branch number
8875 followed by a @samp{.} stands for the current latest
8876 revision in the branch.  A @samp{:} with an empty
8877 @var{rev} stands for the current latest revision on the
8878 default branch, normally the trunk.  For example,
8879 @samp{cvs admin -n@var{name}:} associates @var{name} with the
8880 current latest revision of all the RCS files;
8881 this contrasts with @samp{cvs admin -n@var{name}:$} which
8882 associates @var{name} with the revision numbers
8883 extracted from keyword strings in the corresponding
8884 working files.
8885
8886 @cindex Deleting revisions
8887 @cindex Outdating revisions
8888 @cindex Saving space
8889 @item -o@var{range}
8890 Deletes (@dfn{outdates}) the revisions given by
8891 @var{range}.
8892
8893 Note that this command can be quite dangerous unless
8894 you know @emph{exactly} what you are doing (for example
8895 see the warnings below about how the
8896 @var{rev1}:@var{rev2} syntax is confusing).
8897
8898 If you are short on disc this option might help you.
8899 But think twice before using it---there is no way short
8900 of restoring the latest backup to undo this command!
8901 If you delete different revisions than you planned,
8902 either due to carelessness or (heaven forbid) a @sc{cvs}
8903 bug, there is no opportunity to correct the error
8904 before the revisions are deleted.  It probably would be
8905 a good idea to experiment on a copy of the repository
8906 first.
8907
8908 Specify @var{range} in one of the following ways:
8909
8910 @table @code
8911 @item @var{rev1}::@var{rev2}
8912 Collapse all revisions between rev1 and rev2, so that
8913 @sc{cvs} only stores the differences associated with going
8914 from rev1 to rev2, not intermediate steps.  For
8915 example, after @samp{-o 1.3::1.5} one can retrieve
8916 revision 1.3, revision 1.5, or the differences to get
8917 from 1.3 to 1.5, but not the revision 1.4, or the
8918 differences between 1.3 and 1.4.  Other examples:
8919 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8920 effect, because there are no intermediate revisions to
8921 remove.
8922
8923 @item ::@var{rev}
8924 Collapse revisions between the beginning of the branch
8925 containing @var{rev} and @var{rev} itself.  The
8926 branchpoint and @var{rev} are left intact.  For
8927 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8928 revision 1.3.2.5, and everything in between, but leaves
8929 1.3 and 1.3.2.6 intact.
8930
8931 @item @var{rev}::
8932 Collapse revisions between @var{rev} and the end of the
8933 branch containing @var{rev}.  Revision @var{rev} is
8934 left intact but the head revision is deleted.
8935
8936 @item @var{rev}
8937 Delete the revision @var{rev}.  For example, @samp{-o
8938 1.3} is equivalent to @samp{-o 1.2::1.4}.
8939
8940 @item @var{rev1}:@var{rev2}
8941 Delete the revisions from @var{rev1} to @var{rev2},
8942 inclusive, on the same branch.  One will not be able to
8943 retrieve @var{rev1} or @var{rev2} or any of the
8944 revisions in between.  For example, the command
8945 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8946 It means to delete revisions up to, and including, the
8947 tag R_1_02.  But beware!  If there are files that have not
8948 changed between R_1_02 and R_1_03 the file will have
8949 @emph{the same} numerical revision number assigned to
8950 the tags R_1_02 and R_1_03.  So not only will it be
8951 impossible to retrieve R_1_02; R_1_03 will also have to
8952 be restored from the tapes!  In most cases you want to
8953 specify @var{rev1}::@var{rev2} instead.
8954
8955 @item :@var{rev}
8956 Delete revisions from the beginning of the
8957 branch containing @var{rev} up to and including
8958 @var{rev}.
8959
8960 @item @var{rev}:
8961 Delete revisions from revision @var{rev}, including
8962 @var{rev} itself, to the end of the branch containing
8963 @var{rev}.
8964 @end table
8965
8966 None of the revisions to be deleted may have
8967 branches or locks.
8968
8969 If any of the revisions to be deleted have symbolic
8970 names, and one specifies one of the @samp{::} syntaxes,
8971 then @sc{cvs} will give an error and not delete any
8972 revisions.  If you really want to delete both the
8973 symbolic names and the revisions, first delete the
8974 symbolic names with @code{cvs tag -d}, then run
8975 @code{cvs admin -o}.  If one specifies the
8976 non-@samp{::} syntaxes, then @sc{cvs} will delete the
8977 revisions but leave the symbolic names pointing to
8978 nonexistent revisions.  This behavior is preserved for
8979 compatibility with previous versions of @sc{cvs}, but
8980 because it isn't very useful, in the future it may
8981 change to be like the @samp{::} case.
8982
8983 Due to the way @sc{cvs} handles branches @var{rev}
8984 cannot be specified symbolically if it is a branch.
8985 @xref{Magic branch numbers}, for an explanation.
8986 @c FIXME: is this still true?  I suspect not.
8987
8988 Make sure that no-one has checked out a copy of the
8989 revision you outdate.  Strange things will happen if he
8990 starts to edit it and tries to check it back in.  For
8991 this reason, this option is not a good way to take back
8992 a bogus commit; commit a new revision undoing the bogus
8993 change instead (@pxref{Merging two revisions}).
8994
8995 @item -q
8996 Run quietly; do not print diagnostics.
8997
8998 @item -s@var{state}[:@var{rev}]
8999 Useful with @sc{cvs}.  Set the state attribute of the
9000 revision @var{rev} to @var{state}.  If @var{rev} is a
9001 branch number, assume the latest revision on that
9002 branch.  If @var{rev} is omitted, assume the latest
9003 revision on the default branch.  Any identifier is
9004 acceptable for @var{state}.  A useful set of states is
9005 @samp{Exp} (for experimental), @samp{Stab} (for
9006 stable), and @samp{Rel} (for released).  By default,
9007 the state of a new revision is set to @samp{Exp} when
9008 it is created.  The state is visible in the output from
9009 @var{cvs log} (@pxref{log}), and in the
9010 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
9011 (@pxref{Keyword substitution}).  Note that @sc{cvs}
9012 uses the @code{dead} state for its own purposes; to
9013 take a file to or from the @code{dead} state use
9014 commands like @code{cvs remove} and @code{cvs add}, not
9015 @code{cvs admin -s}.
9016
9017 @item -t[@var{file}]
9018 Useful with @sc{cvs}.  Write descriptive text from the
9019 contents of the named @var{file} into the RCS file,
9020 deleting the existing text.  The @var{file} pathname
9021 may not begin with @samp{-}.  The descriptive text can be seen in the
9022 output from @samp{cvs log} (@pxref{log}).
9023 There can be no space between @samp{-t} and its argument.
9024
9025 If @var{file} is omitted,
9026 obtain the text from standard input, terminated by
9027 end-of-file or by a line containing @samp{.} by itself.
9028 Prompt for the text if interaction is possible; see
9029 @samp{-I}.
9030
9031 @item -t-@var{string}
9032 Similar to @samp{-t@var{file}}. Write descriptive text
9033 from the @var{string} into the @sc{rcs} file, deleting
9034 the existing text.
9035 There can be no space between @samp{-t} and its argument.
9036
9037 @c The rcs -T option, do not update last-mod time for
9038 @c minor changes, has never been documented as a
9039 @c cvs admin option.
9040
9041 @item -U
9042 Set locking to non-strict.  Non-strict locking means
9043 that the owner of a file need not lock a revision for
9044 checkin.  For use with @sc{cvs}, strict locking must be
9045 set; see the discussion under the @samp{-l} option
9046 above.
9047
9048 @item -u[@var{rev}]
9049 See the option @samp{-l} above, for a discussion of
9050 using this option with @sc{cvs}.  Unlock the revision
9051 with number @var{rev}.  If a branch is given, unlock
9052 the latest revision on that branch.  If @var{rev} is
9053 omitted, remove the latest lock held by the caller.
9054 Normally, only the locker of a revision may unlock it;
9055 somebody else unlocking a revision breaks the lock.
9056 This causes the original locker to be sent a @code{commit}
9057 notification (@pxref{Getting Notified}).
9058 There can be no space between @samp{-u} and its argument.
9059
9060 @item -V@var{n}
9061 In previous versions of @sc{cvs}, this option meant to
9062 write an @sc{rcs} file which would be acceptable to
9063 @sc{rcs} version @var{n}, but it is now obsolete and
9064 specifying it will produce an error.
9065 @c Note that -V without an argument has never been
9066 @c documented as a cvs admin option.
9067
9068 @item -x@var{suffixes}
9069 In previous versions of @sc{cvs}, this was documented
9070 as a way of specifying the names of the @sc{rcs}
9071 files.  However, @sc{cvs} has always required that the
9072 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
9073 this option has never done anything useful.
9074
9075 @c The rcs -z option, to specify the timezone, has
9076 @c never been documented as a cvs admin option.
9077 @end table
9078
9079 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9080 @node annotate
9081 @appendixsec annotate---What revision modified each line of a file?
9082 @cindex annotate (subcommand)
9083
9084 @itemize @bullet
9085 @item
9086 Synopsis: annotate [options] files@dots{}
9087 @item
9088 Requires: repository.
9089 @item
9090 Changes: nothing.
9091 @end itemize
9092
9093 For each file in @var{files}, print the head revision
9094 of the trunk, together with information on the last
9095 modification for each line.  
9096
9097 @menu
9098 * annotate options::            annotate options
9099 * annotate example::            annotate example
9100 @end menu
9101
9102 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9103 @node annotate options
9104 @appendixsubsec annotate options
9105
9106 These standard options are supported by @code{annotate}
9107 (@pxref{Common options}, for a complete description of
9108 them):
9109
9110 @table @code
9111 @item -l
9112 Local directory only, no recursion.
9113
9114 @item -R
9115 Process directories recursively.
9116
9117 @item -f
9118 Use head revision if tag/date not found.
9119
9120 @item -F
9121 Annotate binary files.
9122
9123 @item -r @var{tag}[:@var{date}]
9124 Annotate file as of specified revision/tag or, when @var{date} is specified
9125 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9126 existed on @var{date}.  See @ref{Common options}.
9127
9128 @item -D @var{date}
9129 Annotate file as of specified date.
9130 @end table
9131
9132 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9133 @node annotate example
9134 @appendixsubsec annotate example
9135
9136 For example:
9137
9138 @example
9139 $ cvs annotate ssfile
9140 Annotations for ssfile
9141 ***************
9142 1.1          (mary     27-Mar-96): ssfile line 1
9143 1.2          (joe      28-Mar-96): ssfile line 2
9144 @end example
9145
9146 The file @file{ssfile} currently contains two lines.
9147 The @code{ssfile line 1} line was checked in by
9148 @code{mary} on March 27.  Then, on March 28, @code{joe}
9149 added a line @code{ssfile line 2}, without modifying
9150 the @code{ssfile line 1} line.  This report doesn't
9151 tell you anything about lines which have been deleted
9152 or replaced; you need to use @code{cvs diff} for that
9153 (@pxref{diff}).
9154
9155 The options to @code{cvs annotate} are listed in
9156 @ref{Invoking CVS}, and can be used to select the files
9157 and revisions to annotate.  The options are described
9158 in more detail there and in @ref{Common options}.
9159
9160 @c FIXME: maybe an example using the options?  Just
9161 @c what it means to select a revision might be worth a
9162 @c few words of explanation ("you want to see who
9163 @c changed this line *before* 1.4"...).
9164
9165 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9166 @node checkout
9167 @appendixsec checkout---Check out sources for editing
9168 @cindex checkout (subcommand)
9169 @cindex co (subcommand)
9170
9171 @itemize @bullet
9172 @item
9173 Synopsis: checkout [options] modules@dots{}
9174 @item
9175 Requires: repository.
9176 @item
9177 Changes: working directory.
9178 @item
9179 Synonyms: co, get
9180 @end itemize
9181
9182 Create or update a working directory containing copies of the
9183 source files specified by @var{modules}.  You must execute
9184 @code{checkout} before using most of the other @sc{cvs}
9185 commands, since most of them operate on your working
9186 directory.
9187
9188 The @var{modules} are either
9189 symbolic names for some
9190 collection of source directories and files, or paths to
9191 directories or files in the repository.  The symbolic
9192 names are defined in the @samp{modules} file.
9193 @xref{modules}.
9194 @c Needs an example, particularly of the non-"modules"
9195 @c case but probably of both.
9196
9197 @c FIXME: this seems like a very odd place to introduce
9198 @c people to how CVS works.  The bit about unreserved
9199 @c checkouts is also misleading as it depends on how
9200 @c things are set up.
9201 Depending on the modules you specify, @code{checkout} may
9202 recursively create directories and populate them with
9203 the appropriate source files.  You can then edit these
9204 source files at any time (regardless of whether other
9205 software developers are editing their own copies of the
9206 sources); update them to include new changes applied by
9207 others to the source repository; or commit your work as
9208 a permanent change to the source repository.
9209
9210 Note that @code{checkout} is used to create
9211 directories.  The top-level directory created is always
9212 added to the directory where @code{checkout} is
9213 invoked, and usually has the same name as the specified
9214 module.  In the case of a module alias, the created
9215 sub-directory may have a different name, but you can be
9216 sure that it will be a sub-directory, and that
9217 @code{checkout} will show the relative path leading to
9218 each file as it is extracted into your private work
9219 area (unless you specify the @samp{-Q} global option).
9220
9221 The files created by @code{checkout} are created
9222 read-write, unless the @samp{-r} option to @sc{cvs}
9223 (@pxref{Global options}) is specified, the
9224 @code{CVSREAD} environment variable is specified
9225 (@pxref{Environment variables}), or a watch is in
9226 effect for that file (@pxref{Watches}).
9227
9228 Note that running @code{checkout} on a directory that was already
9229 built by a prior @code{checkout} is also permitted.
9230 This is similar to specifying the @samp{-d} option
9231 to the @code{update} command in the sense that new
9232 directories that have been created in the repository
9233 will appear in your work area.
9234 However, @code{checkout} takes a module name whereas
9235 @code{update} takes a directory name.  Also
9236 to use @code{checkout} this way it must be run from the
9237 top level directory (where you originally ran
9238 @code{checkout} from), so before you run
9239 @code{checkout} to update an existing directory, don't
9240 forget to change your directory to the top level
9241 directory.
9242
9243 For the output produced by the @code{checkout} command
9244 see @ref{update output}.
9245
9246 @menu
9247 * checkout options::            checkout options
9248 * checkout examples::           checkout examples
9249 @end menu
9250
9251 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9252 @node checkout options
9253 @appendixsubsec checkout options
9254
9255 These standard options are supported by @code{checkout}
9256 (@pxref{Common options}, for a complete description of
9257 them):
9258
9259 @table @code
9260 @item -D @var{date}
9261 Use the most recent revision no later than @var{date}.
9262 This option is sticky, and implies @samp{-P}.  See
9263 @ref{Sticky tags}, for more information on sticky tags/dates.
9264
9265 @item -f
9266 Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision is
9267 found, retrieve the most recent revision (instead of ignoring the file).
9268
9269 @item -k @var{kflag}
9270 Process keywords according to @var{kflag}.  See
9271 @ref{Keyword substitution}.
9272 This option is sticky; future updates of
9273 this file in this working directory will use the same
9274 @var{kflag}.  The @code{status} command can be viewed
9275 to see the sticky options.  See @ref{Invoking CVS}, for
9276 more information on the @code{status} command.
9277
9278 @item -l
9279 Local; run only in current working directory.
9280
9281 @item -n
9282 Do not run any checkout program (as specified
9283 with the @samp{-o} option in the modules file;
9284 @pxref{modules}).
9285
9286 @item -P
9287 Prune empty directories.  See @ref{Moving directories}.
9288
9289 @item -p
9290 Pipe files to the standard output.
9291
9292 @item -R
9293 Checkout directories recursively.  This option is on by default.
9294
9295 @item -r @var{tag}[:@var{date}]
9296 Checkout the revision specified by @var{tag} or, when @var{date} is specified
9297 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9298 existed on @var{date}.  This option is sticky, and implies @samp{-P}.
9299 See @ref{Sticky tags}, for more information on sticky tags/dates.  Also,
9300 see @ref{Common options}.
9301 @end table
9302
9303 In addition to those, you can use these special command
9304 options with @code{checkout}:
9305
9306 @table @code
9307 @item -A
9308 Reset any sticky tags, dates, or @samp{-k} options.
9309 See @ref{Sticky tags}, for more information on sticky tags/dates.
9310
9311 @item -c
9312 Copy the module file, sorted, to the standard output,
9313 instead of creating or modifying any files or
9314 directories in your working directory.
9315
9316 @item -d @var{dir}
9317 Create a directory called @var{dir} for the working
9318 files, instead of using the module name.  In general,
9319 using this flag is equivalent to using @samp{mkdir
9320 @var{dir}; cd @var{dir}} followed by the checkout
9321 command without the @samp{-d} flag.
9322
9323 There is an important exception, however.  It is very
9324 convenient when checking out a single item to have the
9325 output appear in a directory that doesn't contain empty
9326 intermediate directories.  In this case @emph{only},
9327 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
9328 directories.
9329
9330 For example, given a module @samp{foo} that contains
9331 the file @samp{bar.c}, the command @samp{cvs co -d dir
9332 foo} will create directory @samp{dir} and place
9333 @samp{bar.c} inside.  Similarly, given a module
9334 @samp{bar} which has subdirectory @samp{baz} wherein
9335 there is a file @samp{quux.c}, the command @samp{cvs co
9336 -d dir bar/baz} will create directory @samp{dir} and
9337 place @samp{quux.c} inside.
9338
9339 Using the @samp{-N} flag will defeat this behavior.
9340 Given the same module definitions above, @samp{cvs co
9341 -N -d dir foo} will create directories @samp{dir/foo}
9342 and place @samp{bar.c} inside, while @samp{cvs co -N -d
9343 dir bar/baz} will create directories @samp{dir/bar/baz}
9344 and place @samp{quux.c} inside.
9345
9346 @item -j @var{tag}
9347 With two @samp{-j} options, merge changes from the
9348 revision specified with the first @samp{-j} option to
9349 the revision specified with the second @samp{j} option,
9350 into the working directory.
9351
9352 With one @samp{-j} option, merge changes from the
9353 ancestor revision to the revision specified with the
9354 @samp{-j} option, into the working directory.  The
9355 ancestor revision is the common ancestor of the
9356 revision which the working directory is based on, and
9357 the revision specified in the @samp{-j} option.
9358
9359 In addition, each -j option can contain an optional
9360 date specification which, when used with branches, can
9361 limit the chosen revision to one within a specific
9362 date.  An optional date is specified by adding a colon
9363 (:) to the tag:
9364 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
9365
9366 @xref{Branching and merging}.
9367
9368 @item -N
9369 Only useful together with @samp{-d @var{dir}}.  With
9370 this option, @sc{cvs} will not ``shorten'' module paths
9371 in your working directory when you check out a single
9372 module.  See the @samp{-d} flag for examples and a
9373 discussion.
9374
9375 @item -s
9376 Like @samp{-c}, but include the status of all modules,
9377 and sort it by the status string.  @xref{modules}, for
9378 info about the @samp{-s} option that is used inside the
9379 modules file to set the module status.
9380 @end table
9381
9382 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9383 @node checkout examples
9384 @appendixsubsec checkout examples
9385
9386 Get a copy of the module @samp{tc}:
9387
9388 @example
9389 $ cvs checkout tc
9390 @end example
9391
9392 Get a copy of the module @samp{tc} as it looked one day
9393 ago:
9394
9395 @example
9396 $ cvs checkout -D yesterday tc
9397 @end example
9398
9399 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9400 @node commit
9401 @appendixsec commit---Check files into the repository
9402 @cindex commit (subcommand)
9403
9404 @itemize @bullet
9405 @item
9406 Synopsis: commit [-lnRf] [-m 'log_message' |
9407 -F file] [-r revision] [files@dots{}]
9408 @item
9409 Requires: working directory, repository.
9410 @item
9411 Changes: repository.
9412 @item
9413 Synonym: ci
9414 @end itemize
9415
9416 Use @code{commit} when you want to incorporate changes
9417 from your working source files into the source
9418 repository.
9419
9420 If you don't specify particular files to commit, all of
9421 the files in your working current directory are
9422 examined.  @code{commit} is careful to change in the
9423 repository only those files that you have really
9424 changed.  By default (or if you explicitly specify the
9425 @samp{-R} option), files in subdirectories are also
9426 examined and committed if they have changed; you can
9427 use the @samp{-l} option to limit @code{commit} to the
9428 current directory only.
9429
9430 @code{commit} verifies that the selected files are up
9431 to date with the current revisions in the source
9432 repository; it will notify you, and exit without
9433 committing, if any of the specified files must be made
9434 current first with @code{update} (@pxref{update}).
9435 @code{commit} does not call the @code{update} command
9436 for you, but rather leaves that for you to do when the
9437 time is right.
9438
9439 When all is well, an editor is invoked to allow you to
9440 enter a log message that will be written to one or more
9441 logging programs (@pxref{modules}, and @pxref{loginfo})
9442 and placed in the @sc{rcs} file inside the
9443 repository.  This log message can be retrieved with the
9444 @code{log} command; see @ref{log}.  You can specify the
9445 log message on the command line with the @samp{-m
9446 @var{message}} option, and thus avoid the editor invocation,
9447 or use the @samp{-F @var{file}} option to specify
9448 that the argument file contains the log message.
9449
9450 At @code{commit}, a unique commitid is placed in the @sc{rcs}
9451 file inside the repository. All files committed at once
9452 get the same commitid. The commitid can be retrieved with
9453 the @code{log} and @code{status} command; see @ref{log},
9454 @ref{File status}.
9455
9456 @menu
9457 * commit options::              commit options
9458 * commit examples::             commit examples
9459 @end menu
9460
9461 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9462 @node commit options
9463 @appendixsubsec commit options
9464
9465 These standard options are supported by @code{commit}
9466 (@pxref{Common options}, for a complete description of
9467 them):
9468
9469 @table @code
9470 @item -l
9471 Local; run only in current working directory.
9472
9473 @item -R
9474 Commit directories recursively.  This is on by default.
9475
9476 @item -r @var{revision}
9477 Commit to @var{revision}.  @var{revision} must be
9478 either a branch, or a revision on the main trunk that
9479 is higher than any existing revision number
9480 (@pxref{Assigning revisions}).  You
9481 cannot commit to a specific revision on a branch.
9482 @c FIXME: Need xref for branch case.
9483 @end table
9484
9485 @code{commit} also supports these options:
9486
9487 @table @code
9488 @item -c
9489 Refuse to commit files unless the user has registered a valid edit on the
9490 file via @code{cvs edit}.  This is most useful when @samp{commit -c}
9491 and @samp{edit -c} have been placed in all @file{.cvsrc} files.
9492 A commit can be forced anyways by either regestering an edit retroactively
9493 via @code{cvs edit} (no changes to the file will be lost) or using the
9494 @code{-f} option to commit.  Support for @code{commit -c} requires both
9495 client and a server versions 1.12.10 or greater.
9496
9497 @item -F @var{file}
9498 Read the log message from @var{file}, instead
9499 of invoking an editor.
9500
9501 @item -f
9502 Note that this is not the standard behavior of
9503 the @samp{-f} option as defined in @ref{Common options}.
9504
9505 Force @sc{cvs} to commit a new revision even if you haven't
9506 made any changes to the file.  As of @sc{cvs} version 1.12.10,
9507 it also causes the @code{-c} option to be ignored.  If the current revision
9508 of @var{file} is 1.7, then the following two commands
9509 are equivalent:
9510
9511 @example
9512 $ cvs commit -f @var{file}
9513 $ cvs commit -r 1.8 @var{file}
9514 @end example
9515
9516 @c This is odd, but it's how CVS has worked for some
9517 @c time.
9518 The @samp{-f} option disables recursion (i.e., it
9519 implies @samp{-l}).  To force @sc{cvs} to commit a new
9520 revision for all files in all subdirectories, you must
9521 use @samp{-f -R}.
9522
9523 @item -m @var{message}
9524 Use @var{message} as the log message, instead of
9525 invoking an editor.
9526 @end table
9527
9528 @need 2000
9529 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9530 @node commit examples
9531 @appendixsubsec commit examples
9532
9533 @c FIXME: this material wants to be somewhere
9534 @c in "Branching and merging".
9535
9536 @appendixsubsubsec Committing to a branch
9537
9538 You can commit to a branch revision (one that has an
9539 even number of dots) with the @samp{-r} option.  To
9540 create a branch revision, use the @samp{-b} option
9541 of the @code{rtag} or @code{tag} commands
9542 (@pxref{Branching and merging}).  Then, either @code{checkout} or
9543 @code{update} can be used to base your sources on the
9544 newly created branch.  From that point on, all
9545 @code{commit} changes made within these working sources
9546 will be automatically added to a branch revision,
9547 thereby not disturbing main-line development in any
9548 way.  For example, if you had to create a patch to the
9549 1.2 version of the product, even though the 2.0 version
9550 is already under development, you might do:
9551
9552 @example
9553 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9554 $ cvs checkout -r FCS1_2_Patch product_module
9555 $ cd product_module
9556 [[ hack away ]]
9557 $ cvs commit
9558 @end example
9559
9560 @noindent
9561 This works automatically since the @samp{-r} option is
9562 sticky.
9563
9564 @appendixsubsubsec Creating the branch after editing
9565
9566 Say you have been working on some extremely
9567 experimental software, based on whatever revision you
9568 happened to checkout last week.  If others in your
9569 group would like to work on this software with you, but
9570 without disturbing main-line development, you could
9571 commit your change to a new branch.  Others can then
9572 checkout your experimental stuff and utilize the full
9573 benefit of @sc{cvs} conflict resolution.  The scenario might
9574 look like:
9575
9576 @c FIXME: Should we be recommending tagging the branchpoint?
9577 @example
9578 [[ hacked sources are present ]]
9579 $ cvs tag -b EXPR1
9580 $ cvs update -r EXPR1
9581 $ cvs commit
9582 @end example
9583
9584 The @code{update} command will make the @samp{-r
9585 EXPR1} option sticky on all files.  Note that your
9586 changes to the files will never be removed by the
9587 @code{update} command.  The @code{commit} will
9588 automatically commit to the correct branch, because the
9589 @samp{-r} is sticky.  You could also do like this:
9590
9591 @c FIXME: Should we be recommending tagging the branchpoint?
9592 @example
9593 [[ hacked sources are present ]]
9594 $ cvs tag -b EXPR1
9595 $ cvs commit -r EXPR1
9596 @end example
9597
9598 @noindent
9599 but then, only those files that were changed by you
9600 will have the @samp{-r EXPR1} sticky flag.  If you hack
9601 away, and commit without specifying the @samp{-r EXPR1}
9602 flag, some files may accidentally end up on the main
9603 trunk.
9604
9605 To work with you on the experimental change, others
9606 would simply do
9607
9608 @example
9609 $ cvs checkout -r EXPR1 whatever_module
9610 @end example
9611
9612 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9613 @node diff
9614 @appendixsec diff---Show differences between revisions
9615 @cindex diff (subcommand)
9616
9617 @itemize @bullet
9618 @item
9619 Synopsis: diff [-lR] [-k kflag] [format_options] [(-r rev1[:date1] | -D date1) [-r rev2[:date2] | -D date2]] [files@dots{}]
9620 @item
9621 Requires: working directory, repository.
9622 @item
9623 Changes: nothing.
9624 @end itemize
9625
9626 The @code{diff} command is used to compare different
9627 revisions of files.  The default action is to compare
9628 your working files with the revisions they were based
9629 on, and report any differences that are found.
9630
9631 If any file names are given, only those files are
9632 compared.  If any directories are given, all files
9633 under them will be compared.
9634
9635 The exit status for diff is different than for other
9636 @sc{cvs} commands; for details @ref{Exit status}.
9637
9638 @menu
9639 * diff options::                diff options
9640 * diff examples::               diff examples
9641 @end menu
9642
9643 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9644 @node diff options
9645 @appendixsubsec diff options
9646
9647 These standard options are supported by @code{diff}
9648 (@pxref{Common options}, for a complete description of
9649 them):
9650
9651 @table @code
9652 @item -D @var{date}
9653 Use the most recent revision no later than @var{date}.
9654 See @samp{-r} for how this affects the comparison.
9655
9656 @item -k @var{kflag}
9657 Process keywords according to @var{kflag}.  See
9658 @ref{Keyword substitution}.
9659
9660 @item -l
9661 Local; run only in current working directory.
9662
9663 @item -R
9664 Examine directories recursively.  This option is on by
9665 default.
9666
9667 @item -r @var{tag}[:@var{date}]
9668 Compare with revision specified by @var{tag} or, when @var{date} is specified
9669 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9670 existed on @var{date}.  Zero, one or two
9671 @samp{-r} options can be present.  With no @samp{-r}
9672 option, the working file will be compared with the
9673 revision it was based on.  With one @samp{-r}, that
9674 revision will be compared to your current working file.
9675 With two @samp{-r} options those two revisions will be
9676 compared (and your working file will not affect the
9677 outcome in any way).
9678 @c We should be a lot more explicit, with examples,
9679 @c about the difference between "cvs diff" and "cvs
9680 @c diff -r HEAD".  This often confuses new users.
9681
9682 One or both @samp{-r} options can be replaced by a
9683 @samp{-D @var{date}} option, described above.
9684 @end table
9685
9686 @c Conceptually, this is a disaster.  There are 3
9687 @c zillion diff formats that we support via the diff
9688 @c library.  It is not obvious to me that we should
9689 @c document them all.  Maybe just the most common ones
9690 @c like -c and -u, and think about phasing out the
9691 @c obscure ones.
9692 @c FIXCVS: also should be a way to specify an external
9693 @c diff program (which can be different for different
9694 @c file types) and pass through
9695 @c arbitrary options, so that the user can do
9696 @c "--pass=-Z --pass=foo" or something even if CVS
9697 @c doesn't know about the "-Z foo" option to diff.
9698 @c This would fit nicely with deprecating/eliminating
9699 @c the obscure options of the diff library, because it
9700 @c would let people specify an external GNU diff if
9701 @c they are into that sort of thing.
9702 The following options specify the format of the
9703 output.  They have the same meaning as in GNU diff.
9704 Most options have two equivalent names, one of which is a single letter
9705 preceded by @samp{-}, and the other of which is a long name preceded by
9706 @samp{--}.
9707
9708 @table @samp
9709 @item -@var{lines}
9710 Show @var{lines} (an integer) lines of context.  This option does not
9711 specify an output format by itself; it has no effect unless it is
9712 combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9713 operation, @code{patch} typically needs at least two lines of context.
9714
9715 @item -a
9716 Treat all files as text and compare them line-by-line, even if they
9717 do not seem to be text.
9718
9719 @item -b
9720 Ignore trailing white space and consider all other sequences of one or
9721 more white space characters to be equivalent.
9722
9723 @item -B
9724 Ignore changes that just insert or delete blank lines.
9725
9726 @item --binary
9727 Read and write data in binary mode.
9728
9729 @item --brief
9730 Report only whether the files differ, not the details of the
9731 differences.
9732
9733 @item -c
9734 Use the context output format.
9735
9736 @item -C @var{lines}
9737 @itemx --context@r{[}=@var{lines}@r{]}
9738 Use the context output format, showing @var{lines} (an integer) lines of
9739 context, or three if @var{lines} is not given.
9740 For proper operation, @code{patch} typically needs at least two lines of
9741 context.
9742
9743 @item --changed-group-format=@var{format}
9744 Use @var{format} to output a line group containing differing lines from
9745 both files in if-then-else format.  @xref{Line group formats}.
9746
9747 @item -d
9748 Change the algorithm to perhaps find a smaller set of changes.  This makes
9749 @code{diff} slower (sometimes much slower).
9750
9751 @item -e
9752 @itemx --ed
9753 Make output that is a valid @code{ed} script.
9754
9755 @item --expand-tabs
9756 Expand tabs to spaces in the output, to preserve the alignment of tabs
9757 in the input files.
9758
9759 @item -f
9760 Make output that looks vaguely like an @code{ed} script but has changes
9761 in the order they appear in the file.
9762
9763 @item -F @var{regexp}
9764 In context and unified format, for each hunk of differences, show some
9765 of the last preceding line that matches @var{regexp}.
9766
9767 @item --forward-ed
9768 Make output that looks vaguely like an @code{ed} script but has changes
9769 in the order they appear in the file.
9770
9771 @item -H
9772 Use heuristics to speed handling of large files that have numerous
9773 scattered small changes.
9774
9775 @item --horizon-lines=@var{lines}
9776 Do not discard the last @var{lines} lines of the common prefix
9777 and the first @var{lines} lines of the common suffix.
9778
9779 @item -i
9780 Ignore changes in case; consider upper- and lower-case letters
9781 equivalent.
9782
9783 @item -I @var{regexp}
9784 Ignore changes that just insert or delete lines that match @var{regexp}.
9785
9786 @item --ifdef=@var{name}
9787 Make merged if-then-else output using @var{name}.
9788
9789 @item --ignore-all-space
9790 Ignore white space when comparing lines.
9791
9792 @item --ignore-blank-lines
9793 Ignore changes that just insert or delete blank lines.
9794
9795 @item --ignore-case
9796 Ignore changes in case; consider upper- and lower-case to be the same.
9797
9798 @item --ignore-matching-lines=@var{regexp}
9799 Ignore changes that just insert or delete lines that match @var{regexp}.
9800
9801 @item --ignore-space-change
9802 Ignore trailing white space and consider all other sequences of one or
9803 more white space characters to be equivalent.
9804
9805 @item --initial-tab
9806 Output a tab rather than a space before the text of a line in normal or
9807 context format.  This causes the alignment of tabs in the line to look
9808 normal.
9809
9810 @item -L @var{label}
9811 Use @var{label} instead of the file name in the context format
9812 and unified format headers.
9813
9814 @item --label=@var{label}
9815 Use @var{label} instead of the file name in the context format
9816 and unified format headers.
9817
9818 @item --left-column
9819 Print only the left column of two common lines in side by side format.
9820
9821 @item --line-format=@var{format}
9822 Use @var{format} to output all input lines in if-then-else format.
9823 @xref{Line formats}.
9824
9825 @item --minimal
9826 Change the algorithm to perhaps find a smaller set of changes.  This
9827 makes @code{diff} slower (sometimes much slower).
9828
9829 @item -n
9830 Output RCS-format diffs; like @samp{-f} except that each command
9831 specifies the number of lines affected.
9832
9833 @item -N
9834 @itemx --new-file
9835 In directory comparison, if a file is found in only one directory,
9836 treat it as present but empty in the other directory.
9837
9838 @item --new-group-format=@var{format}
9839 Use @var{format} to output a group of lines taken from just the second
9840 file in if-then-else format.  @xref{Line group formats}.
9841
9842 @item --new-line-format=@var{format}
9843 Use @var{format} to output a line taken from just the second file in
9844 if-then-else format.  @xref{Line formats}.
9845
9846 @item --old-group-format=@var{format}
9847 Use @var{format} to output a group of lines taken from just the first
9848 file in if-then-else format.  @xref{Line group formats}.
9849
9850 @item --old-line-format=@var{format}
9851 Use @var{format} to output a line taken from just the first file in
9852 if-then-else format.  @xref{Line formats}.
9853
9854 @item -p
9855 Show which C function each change is in.
9856
9857 @item --rcs
9858 Output RCS-format diffs; like @samp{-f} except that each command
9859 specifies the number of lines affected.
9860
9861 @item --report-identical-files
9862 @itemx -s
9863 Report when two files are the same.
9864
9865 @item --show-c-function
9866 Show which C function each change is in.
9867
9868 @item --show-function-line=@var{regexp}
9869 In context and unified format, for each hunk of differences, show some
9870 of the last preceding line that matches @var{regexp}.
9871
9872 @item --side-by-side
9873 Use the side by side output format.
9874
9875 @item --speed-large-files
9876 Use heuristics to speed handling of large files that have numerous
9877 scattered small changes.
9878
9879 @item --suppress-common-lines
9880 Do not print common lines in side by side format.
9881
9882 @item -t
9883 Expand tabs to spaces in the output, to preserve the alignment of tabs
9884 in the input files.
9885
9886 @item -T
9887 Output a tab rather than a space before the text of a line in normal or
9888 context format.  This causes the alignment of tabs in the line to look
9889 normal.
9890
9891 @item --text
9892 Treat all files as text and compare them line-by-line, even if they
9893 do not appear to be text.
9894
9895 @item -u
9896 Use the unified output format.
9897
9898 @item --unchanged-group-format=@var{format}
9899 Use @var{format} to output a group of common lines taken from both files
9900 in if-then-else format.  @xref{Line group formats}.
9901
9902 @item --unchanged-line-format=@var{format}
9903 Use @var{format} to output a line common to both files in if-then-else
9904 format.  @xref{Line formats}.
9905
9906 @item -U @var{lines}
9907 @itemx --unified@r{[}=@var{lines}@r{]}
9908 Use the unified output format, showing @var{lines} (an integer) lines of
9909 context, or three if @var{lines} is not given.
9910 For proper operation, @code{patch} typically needs at least two lines of
9911 context.
9912
9913 @item -w
9914 Ignore white space when comparing lines.
9915
9916 @item -W @var{columns}
9917 @itemx --width=@var{columns}
9918 Use an output width of @var{columns} in side by side format.
9919
9920 @item -y
9921 Use the side by side output format.
9922 @end table
9923
9924 @menu
9925 * Line group formats::          Line group formats
9926 * Line formats::                Line formats
9927 @end menu
9928
9929 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9930 @node Line group formats
9931 @appendixsubsubsec Line group formats
9932
9933 Line group formats let you specify formats suitable for many
9934 applications that allow if-then-else input, including programming
9935 languages and text formatting languages.  A line group format specifies
9936 the output format for a contiguous group of similar lines.
9937
9938 For example, the following command compares the TeX file @file{myfile}
9939 with the original version from the repository,
9940 and outputs a merged file in which old regions are
9941 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
9942 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
9943
9944 @example
9945 cvs diff \
9946    --old-group-format='\begin@{em@}
9947 %<\end@{em@}
9948 ' \
9949    --new-group-format='\begin@{bf@}
9950 %>\end@{bf@}
9951 ' \
9952    myfile
9953 @end example
9954
9955 The following command is equivalent to the above example, but it is a
9956 little more verbose, because it spells out the default line group formats.
9957
9958 @example
9959 cvs diff \
9960    --old-group-format='\begin@{em@}
9961 %<\end@{em@}
9962 ' \
9963    --new-group-format='\begin@{bf@}
9964 %>\end@{bf@}
9965 ' \
9966    --unchanged-group-format='%=' \
9967    --changed-group-format='\begin@{em@}
9968 %<\end@{em@}
9969 \begin@{bf@}
9970 %>\end@{bf@}
9971 ' \
9972    myfile
9973 @end example
9974
9975 Here is a more advanced example, which outputs a diff listing with
9976 headers containing line numbers in a ``plain English'' style.
9977
9978 @example
9979 cvs diff \
9980    --unchanged-group-format='' \
9981    --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
9982 %<' \
9983    --new-group-format='-------- %dN line%(N=1?:s) added after %de:
9984 %>' \
9985    --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
9986 %<-------- to:
9987 %>' \
9988    myfile
9989 @end example
9990
9991 To specify a line group format, use one of the options
9992 listed below.  You can specify up to four line group formats, one for
9993 each kind of line group.  You should quote @var{format}, because it
9994 typically contains shell metacharacters.
9995
9996 @table @samp
9997 @item --old-group-format=@var{format}
9998 These line groups are hunks containing only lines from the first file.
9999 The default old group format is the same as the changed group format if
10000 it is specified; otherwise it is a format that outputs the line group as-is.
10001
10002 @item --new-group-format=@var{format}
10003 These line groups are hunks containing only lines from the second
10004 file.  The default new group format is same as the changed group
10005 format if it is specified; otherwise it is a format that outputs the
10006 line group as-is.
10007
10008 @item --changed-group-format=@var{format}
10009 These line groups are hunks containing lines from both files.  The
10010 default changed group format is the concatenation of the old and new
10011 group formats.
10012
10013 @item --unchanged-group-format=@var{format}
10014 These line groups contain lines common to both files.  The default
10015 unchanged group format is a format that outputs the line group as-is.
10016 @end table
10017
10018 In a line group format, ordinary characters represent themselves;
10019 conversion specifications start with @samp{%} and have one of the
10020 following forms.
10021
10022 @table @samp
10023 @item %<
10024 stands for the lines from the first file, including the trailing newline.
10025 Each line is formatted according to the old line format (@pxref{Line formats}).
10026
10027 @item %>
10028 stands for the lines from the second file, including the trailing newline.
10029 Each line is formatted according to the new line format.
10030
10031 @item %=
10032 stands for the lines common to both files, including the trailing newline.
10033 Each line is formatted according to the unchanged line format.
10034
10035 @item %%
10036 stands for @samp{%}.
10037
10038 @item %c'@var{C}'
10039 where @var{C} is a single character, stands for @var{C}.
10040 @var{C} may not be a backslash or an apostrophe.
10041 For example, @samp{%c':'} stands for a colon, even inside
10042 the then-part of an if-then-else format, which a colon would
10043 normally terminate.
10044
10045 @item %c'\@var{O}'
10046 where @var{O} is a string of 1, 2, or 3 octal digits,
10047 stands for the character with octal code @var{O}.
10048 For example, @samp{%c'\0'} stands for a null character.
10049
10050 @item @var{F}@var{n}
10051 where @var{F} is a @code{printf} conversion specification and @var{n} is one
10052 of the following letters, stands for @var{n}'s value formatted with @var{F}.
10053
10054 @table @samp
10055 @item e
10056 The line number of the line just before the group in the old file.
10057
10058 @item f
10059 The line number of the first line in the group in the old file;
10060 equals @var{e} + 1.
10061
10062 @item l
10063 The line number of the last line in the group in the old file.
10064
10065 @item m
10066 The line number of the line just after the group in the old file;
10067 equals @var{l} + 1.
10068
10069 @item n
10070 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
10071
10072 @item E, F, L, M, N
10073 Likewise, for lines in the new file.
10074
10075 @end table
10076
10077 The @code{printf} conversion specification can be @samp{%d},
10078 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
10079 lower case hexadecimal, or upper case hexadecimal output
10080 respectively.  After the @samp{%} the following options can appear in
10081 sequence: a @samp{-} specifying left-justification; an integer
10082 specifying the minimum field width; and a period followed by an
10083 optional integer specifying the minimum number of digits.
10084 For example, @samp{%5dN} prints the number of new lines in the group
10085 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
10086
10087 @item (@var{A}=@var{B}?@var{T}:@var{E})
10088 If @var{A} equals @var{B} then @var{T} else @var{E}.
10089 @var{A} and @var{B} are each either a decimal constant
10090 or a single letter interpreted as above.
10091 This format spec is equivalent to @var{T} if
10092 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
10093
10094 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
10095 @samp{no lines} if @var{N} (the number of lines in the group in the
10096 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
10097 otherwise.
10098 @end table
10099
10100 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10101 @node Line formats
10102 @appendixsubsubsec Line formats
10103
10104 Line formats control how each line taken from an input file is
10105 output as part of a line group in if-then-else format.
10106
10107 For example, the following command outputs text with a one-column
10108 change indicator to the left of the text.  The first column of output
10109 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
10110 for unchanged lines.  The formats contain newline characters where
10111 newlines are desired on output.
10112
10113 @example
10114 cvs diff \
10115    --old-line-format='-%l
10116 ' \
10117    --new-line-format='|%l
10118 ' \
10119    --unchanged-line-format=' %l
10120 ' \
10121    myfile
10122 @end example
10123
10124 To specify a line format, use one of the following options.  You should
10125 quote @var{format}, since it often contains shell metacharacters.
10126
10127 @table @samp
10128 @item --old-line-format=@var{format}
10129 formats lines just from the first file.
10130
10131 @item --new-line-format=@var{format}
10132 formats lines just from the second file.
10133
10134 @item --unchanged-line-format=@var{format}
10135 formats lines common to both files.
10136
10137 @item --line-format=@var{format}
10138 formats all lines; in effect, it sets all three above options simultaneously.
10139 @end table
10140
10141 In a line format, ordinary characters represent themselves;
10142 conversion specifications start with @samp{%} and have one of the
10143 following forms.
10144
10145 @table @samp
10146 @item %l
10147 stands for the contents of the line, not counting its trailing
10148 newline (if any).  This format ignores whether the line is incomplete.
10149
10150 @item %L
10151 stands for the contents of the line, including its trailing newline
10152 (if any).  If a line is incomplete, this format preserves its
10153 incompleteness.
10154
10155 @item %%
10156 stands for @samp{%}.
10157
10158 @item %c'@var{C}'
10159 where @var{C} is a single character, stands for @var{C}.
10160 @var{C} may not be a backslash or an apostrophe.
10161 For example, @samp{%c':'} stands for a colon.
10162
10163 @item %c'\@var{O}'
10164 where @var{O} is a string of 1, 2, or 3 octal digits,
10165 stands for the character with octal code @var{O}.
10166 For example, @samp{%c'\0'} stands for a null character.
10167
10168 @item @var{F}n
10169 where @var{F} is a @code{printf} conversion specification,
10170 stands for the line number formatted with @var{F}.
10171 For example, @samp{%.5dn} prints the line number using the
10172 @code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
10173 more about printf conversion specifications.
10174
10175 @end table
10176
10177 The default line format is @samp{%l} followed by a newline character.
10178
10179 If the input contains tab characters and it is important that they line
10180 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
10181 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
10182 @samp{%L} with a tab character), or you should use the @samp{-t} or
10183 @samp{--expand-tabs} option.
10184
10185 Taken together, the line and line group formats let you specify many
10186 different formats.  For example, the following command uses a format
10187 similar to @code{diff}'s normal format.  You can tailor this command
10188 to get fine control over @code{diff}'s output.
10189
10190 @example
10191 cvs diff \
10192    --old-line-format='< %l
10193 ' \
10194    --new-line-format='> %l
10195 ' \
10196    --old-group-format='%df%(f=l?:,%dl)d%dE
10197 %<' \
10198    --new-group-format='%dea%dF%(F=L?:,%dL)
10199 %>' \
10200    --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
10201 %<---
10202 %>' \
10203    --unchanged-group-format='' \
10204    myfile
10205 @end example
10206
10207 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10208 @node diff examples
10209 @appendixsubsec diff examples
10210
10211 The following line produces a Unidiff (@samp{-u} flag)
10212 between revision 1.14 and 1.19 of
10213 @file{backend.c}.  Due to the @samp{-kk} flag no
10214 keywords are substituted, so differences that only depend
10215 on keyword substitution are ignored.
10216
10217 @example
10218 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
10219 @end example
10220
10221 Suppose the experimental branch EXPR1 was based on a
10222 set of files tagged RELEASE_1_0.  To see what has
10223 happened on that branch, the following can be used:
10224
10225 @example
10226 $ cvs diff -r RELEASE_1_0 -r EXPR1
10227 @end example
10228
10229 A command like this can be used to produce a context
10230 diff between two releases:
10231
10232 @example
10233 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
10234 @end example
10235
10236 If you are maintaining ChangeLogs, a command like the following
10237 just before you commit your changes may help you write
10238 the ChangeLog entry.  All local modifications that have
10239 not yet been committed will be printed.
10240
10241 @example
10242 $ cvs diff -u | less
10243 @end example
10244
10245 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10246 @node export
10247 @appendixsec export---Export sources from CVS, similar to checkout
10248 @cindex export (subcommand)
10249
10250 @itemize @bullet
10251 @item
10252 Synopsis: export [-flNnR] (-r rev[:date] | -D date) [-k subst] [-d dir] module@dots{}
10253 @item
10254 Requires: repository.
10255 @item
10256 Changes: current directory.
10257 @end itemize
10258
10259 This command is a variant of @code{checkout}; use it
10260 when you want a copy of the source for module without
10261 the @sc{cvs} administrative directories.  For example, you
10262 might use @code{export} to prepare source for shipment
10263 off-site.  This command requires that you specify a
10264 date or tag (with @samp{-D} or @samp{-r}), so that you
10265 can count on reproducing the source you ship to others
10266 (and thus it always prunes empty directories).
10267
10268 One often would like to use @samp{-kv} with @code{cvs
10269 export}.  This causes any keywords to be
10270 expanded such that an import done at some other site
10271 will not lose the keyword revision information.  But be
10272 aware that doesn't handle an export containing binary
10273 files correctly.  Also be aware that after having used
10274 @samp{-kv}, one can no longer use the @code{ident}
10275 command (which is part of the @sc{rcs} suite---see
10276 ident(1)) which looks for keyword strings.  If
10277 you want to be able to use @code{ident} you must not
10278 use @samp{-kv}.
10279
10280 @menu
10281 * export options::              export options
10282 @end menu
10283
10284 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10285 @node export options
10286 @appendixsubsec export options
10287
10288 These standard options are supported by @code{export}
10289 (@pxref{Common options}, for a complete description of
10290 them):
10291
10292 @table @code
10293 @item -D @var{date}
10294 Use the most recent revision no later than @var{date}.
10295
10296 @item -f
10297 If no matching revision is found, retrieve the most
10298 recent revision (instead of ignoring the file).
10299
10300 @item -l
10301 Local; run only in current working directory.
10302
10303 @item -n
10304 Do not run any checkout program.
10305
10306 @item -R
10307 Export directories recursively.  This is on by default.
10308
10309 @item -r @var{tag}[:@var{date}]
10310 Export the revision specified by @var{tag} or, when @var{date} is specified
10311 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
10312 existed on @var{date}.  See @ref{Common options}.
10313 @end table
10314
10315 In addition, these options (that are common to
10316 @code{checkout} and @code{export}) are also supported:
10317
10318 @table @code
10319 @item -d @var{dir}
10320 Create a directory called @var{dir} for the working
10321 files, instead of using the module name.
10322 @xref{checkout options}, for complete details on how
10323 @sc{cvs} handles this flag.
10324
10325 @item -k @var{subst}
10326 Set keyword expansion mode (@pxref{Substitution modes}).
10327
10328 @item -N
10329 Only useful together with @samp{-d @var{dir}}.
10330 @xref{checkout options}, for complete details on how
10331 @sc{cvs} handles this flag.
10332 @end table
10333
10334 @ignore
10335 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10336 @c @node export examples
10337 @appendixsubsec export examples
10338
10339 Contributed examples are gratefully accepted.
10340 @c -- Examples here!!
10341 @end ignore
10342
10343 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10344 @node history
10345 @appendixsec history---Show status of files and users
10346 @cindex history (subcommand)
10347
10348 @itemize @bullet
10349 @item
10350 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
10351 @item
10352 Requires: the file @file{$CVSROOT/CVSROOT/history}
10353 @item
10354 Changes: nothing.
10355 @end itemize
10356
10357 @sc{cvs} can keep a history file that tracks each use of the
10358 @code{checkout}, @code{commit}, @code{rtag},
10359 @code{update}, and @code{release} commands.  You can
10360 use @code{history} to display this information in
10361 various formats.
10362
10363 Logging must be enabled by creating the file
10364 @file{$CVSROOT/CVSROOT/history}.
10365
10366 @strong{Note: @code{history} uses @samp{-f}, @samp{-l},
10367 @samp{-n}, and @samp{-p} in ways that conflict with the
10368 normal use inside @sc{cvs} (@pxref{Common options}).}
10369
10370 @menu
10371 * history options::             history options
10372 @end menu
10373
10374 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10375 @node history options
10376 @appendixsubsec history options
10377
10378 Several options (shown above as @samp{-report})  control  what
10379 kind of report is generated:
10380
10381 @table @code
10382 @item -c
10383 Report on each time commit was used (i.e., each time
10384 the repository was modified).
10385
10386 @item -e
10387 Everything (all record types).  Equivalent to
10388 specifying @samp{-x} with all record types.  Of course,
10389 @samp{-e} will also include record types which are
10390 added in a future version of @sc{cvs}; if you are
10391 writing a script which can only handle certain record
10392 types, you'll want to specify @samp{-x}.
10393
10394 @item -m @var{module}
10395 Report on a particular module.  (You can meaningfully
10396 use @samp{-m} more than once on the command line.)
10397
10398 @item -o
10399 Report on checked-out modules.  This is the default report type.
10400
10401 @item -T
10402 Report on all tags.
10403
10404 @item -x @var{type}
10405 Extract a particular set of record types @var{type} from the @sc{cvs}
10406 history.  The types are indicated by single letters,
10407 which you may specify in combination.
10408
10409 Certain commands have a single record type:
10410
10411 @table @code
10412 @item F
10413 release
10414 @item O
10415 checkout
10416 @item E
10417 export
10418 @item T
10419 rtag
10420 @end table
10421
10422 @noindent
10423 One of five record types may result from an update:
10424
10425 @table @code
10426 @item C
10427 A merge was necessary but collisions were
10428 detected (requiring manual merging).
10429 @item G
10430 A merge was necessary and it succeeded.
10431 @item U
10432 A working file was copied from the repository.
10433 @item P
10434 A working file was patched to match the repository.
10435 @item W
10436 The working copy of a file was deleted during
10437 update (because it was gone from the repository).
10438 @end table
10439
10440 @noindent
10441 One of three record types results from commit:
10442
10443 @table @code
10444 @item A
10445 A file was added for the first time.
10446 @item M
10447 A file was modified.
10448 @item R
10449 A file was removed.
10450 @end table
10451 @end table
10452
10453 The options shown as @samp{-flags} constrain or expand
10454 the report without requiring option arguments:
10455
10456 @table @code
10457 @item -a
10458 Show data for all users (the default is to show data
10459 only for the user executing @code{history}).
10460
10461 @item -l
10462 Show last modification only.
10463
10464 @item -w
10465 Show only the records for modifications done from the
10466 same working directory where @code{history} is
10467 executing.
10468 @end table
10469
10470 The options shown as @samp{-options @var{args}} constrain the report
10471 based on an argument:
10472
10473 @table @code
10474 @item -b @var{str}
10475 Show data back to a record containing  the  string
10476 @var{str}  in  either the module name, the file name, or
10477 the repository path.
10478
10479 @item -D @var{date}
10480 Show data since @var{date}.  This is slightly different
10481 from the normal use of @samp{-D @var{date}}, which
10482 selects the newest revision older than @var{date}.
10483
10484 @item -f @var{file}
10485 Show data for a particular file
10486 (you can specify several @samp{-f} options on the same command line).
10487 This is equivalent to specifying the file on the command line.
10488
10489 @item -n @var{module}
10490 Show data for a particular module
10491 (you can specify several @samp{-n} options on the same command line).
10492
10493 @item -p @var{repository}
10494 Show data for a particular source repository  (you
10495 can specify several @samp{-p} options on the same command
10496 line).
10497
10498 @item -r @var{rev}
10499 Show records referring to revisions since the revision
10500 or tag named @var{rev} appears in individual @sc{rcs}
10501 files.  Each @sc{rcs} file is searched for the revision or
10502 tag.
10503
10504 @item -t @var{tag}
10505 Show records since tag @var{tag} was last added to the
10506 history file.  This differs from the @samp{-r} flag
10507 above in that it reads only the history file, not the
10508 @sc{rcs} files, and is much faster.
10509
10510 @item -u @var{name}
10511 Show records for user @var{name}.
10512
10513 @item -z @var{timezone}
10514 Show times in the selected records using the specified
10515 time zone instead of UTC.
10516 @end table
10517
10518 @ignore
10519 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10520 @c @node history examples
10521 @appendixsubsec history examples
10522
10523 Contributed examples will gratefully be accepted.
10524 @c -- Examples here!
10525 @end ignore
10526
10527 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10528 @node import
10529 @appendixsec import---Import sources into CVS, using vendor branches
10530 @cindex import (subcommand)
10531
10532 @c FIXME: This node is way too long for one which has subnodes.
10533
10534 @itemize @bullet
10535 @item
10536 Synopsis: import [-options] repository vendortag releasetag@dots{}
10537 @item
10538 Requires: Repository, source distribution directory.
10539 @item
10540 Changes: repository.
10541 @end itemize
10542
10543 Use @code{import} to incorporate an entire source
10544 distribution from an outside source (e.g., a source
10545 vendor) into your source repository directory.  You can
10546 use this command both for initial creation of a
10547 repository, and for wholesale updates to the module
10548 from the outside source.  @xref{Tracking sources}, for
10549 a discussion on this subject.
10550
10551 The @var{repository} argument gives a directory name
10552 (or a path to a directory) under the @sc{cvs} root directory
10553 for repositories; if the directory did not exist,
10554 import creates it.
10555
10556 When you use import for updates to source that has been
10557 modified in your source repository (since a prior
10558 import), it will notify you of any files that conflict
10559 in the two branches of development; use @samp{checkout
10560 -j} to reconcile the differences, as import instructs
10561 you to do.
10562
10563 If @sc{cvs} decides a file should be ignored
10564 (@pxref{cvsignore}), it does not import it and prints
10565 @samp{I } followed by the filename (@pxref{import output}, for a
10566 complete description of the output).
10567
10568 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10569 any file whose names match the specifications in that
10570 file will be treated as packages and the appropriate
10571 filtering will be performed on the file/directory
10572 before being imported.  @xref{Wrappers}.
10573
10574 The outside source is saved in a first-level
10575 branch, by default 1.1.1.  Updates are leaves of this
10576 branch; for example, files from the first imported
10577 collection of source will be revision 1.1.1.1, then
10578 files from the first imported update will be revision
10579 1.1.1.2, and so on.
10580
10581 At least three arguments are required.
10582 @var{repository} is needed to identify the collection
10583 of source.  @var{vendortag} is a tag for the entire
10584 branch (e.g., for 1.1.1).  You must also specify at
10585 least one @var{releasetag} to uniquely identify the files at
10586 the leaves created each time you execute @code{import}.  The
10587 @var{releasetag} should be new, not previously existing in the
10588 repository file, and uniquely identify the imported release,
10589
10590 @c I'm not completely sure this belongs here.  But
10591 @c we need to say it _somewhere_ reasonably obvious; it
10592 @c is a common misconception among people first learning CVS
10593 Note that @code{import} does @emph{not} change the
10594 directory in which you invoke it.  In particular, it
10595 does not set up that directory as a @sc{cvs} working
10596 directory; if you want to work with the sources import
10597 them first and then check them out into a different
10598 directory (@pxref{Getting the source}).
10599
10600 @menu
10601 * import options::              import options
10602 * import output::               import output
10603 * import examples::             import examples
10604 @end menu
10605
10606 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10607 @node import options
10608 @appendixsubsec import options
10609
10610 This standard option is supported by @code{import}
10611 (@pxref{Common options}, for a complete description):
10612
10613 @table @code
10614 @item -m @var{message}
10615 Use @var{message} as log information, instead of
10616 invoking an editor.
10617 @end table
10618
10619 There are the following additional special options.
10620
10621 @table @code
10622 @item -b @var{branch}
10623 See @ref{Multiple vendor branches}.
10624
10625 @item -k @var{subst}
10626 Indicate the keyword expansion mode desired.  This
10627 setting will apply to all files created during the
10628 import, but not to any files that previously existed in
10629 the repository.  See @ref{Substitution modes}, for a
10630 list of valid @samp{-k} settings.
10631
10632 @item -I @var{name}
10633 Specify file names that should be ignored during
10634 import.  You can use this option repeatedly.  To avoid
10635 ignoring any files at all (even those ignored by
10636 default), specify `-I !'.
10637
10638 @var{name} can be a file name pattern of the same type
10639 that you can specify in the @file{.cvsignore} file.
10640 @xref{cvsignore}.
10641 @c -- Is this really true?
10642
10643 @item -W @var{spec}
10644 Specify file names that should be filtered during
10645 import.  You can use this option repeatedly.
10646
10647 @var{spec} can be a file name pattern of the same type
10648 that you can specify in the @file{.cvswrappers}
10649 file. @xref{Wrappers}.
10650
10651 @item -X
10652 Modify the algorithm used by @sc{cvs} when importing new files
10653 so that new files do not immediately appear on the main trunk.
10654
10655 Specifically, this flag causes @sc{cvs} to mark new files as
10656 if they were deleted on the main trunk, by taking the following
10657 steps for each file in addition to those normally taken on import:
10658 creating a new revision on the main trunk indicating that
10659 the new file is @code{dead}, resetting the new file's default branch,
10660 and placing the file in the Attic (@pxref{Attic}) directory.
10661
10662 Use of this option can be forced on a repository-wide basis
10663 by setting the @samp{ImportNewFilesToVendorBranchOnly} option in
10664 CVSROOT/config (@pxref{config}).
10665 @end table
10666
10667 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10668 @node import output
10669 @appendixsubsec import output
10670
10671 @code{import} keeps you informed of its progress by printing a line
10672 for each file, preceded by one character indicating the status of the file:
10673
10674 @table @code
10675 @item U @var{file}
10676 The file already exists in the repository and has not been locally
10677 modified; a new revision has been created (if necessary).
10678
10679 @item N @var{file}
10680 The file is a new file which has been added to the repository.
10681
10682 @item C @var{file}
10683 The file already exists in the repository but has been locally modified;
10684 you will have to merge the changes.
10685
10686 @item I @var{file}
10687 The file is being ignored (@pxref{cvsignore}).
10688
10689 @cindex Symbolic link, importing
10690 @cindex Link, symbolic, importing
10691 @c FIXME: also (somewhere else) probably
10692 @c should be documenting what happens if you "cvs add"
10693 @c a symbolic link.  Also maybe what happens if
10694 @c you manually create symbolic links within the
10695 @c repository (? - not sure why we'd want to suggest
10696 @c doing that).
10697 @item L @var{file}
10698 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10699 People periodically suggest that this behavior should
10700 be changed, but if there is a consensus on what it
10701 should be changed to, it is not apparent.
10702 (Various options in the @file{modules} file can be used
10703 to recreate symbolic links on checkout, update, etc.;
10704 @pxref{modules}.)
10705 @end table
10706
10707 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10708 @node import examples
10709 @appendixsubsec import examples
10710
10711 See @ref{Tracking sources}, and @ref{From files}.
10712
10713 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10714 @node log
10715 @appendixsec log---Print out log information for files
10716 @cindex log (subcommand)
10717
10718 @itemize @bullet
10719 @item
10720 Synopsis: log [options] [files@dots{}]
10721 @item
10722 Requires: repository, working directory.
10723 @item
10724 Changes: nothing.
10725 @end itemize
10726
10727 Display log information for files.  @code{log} used to
10728 call the @sc{rcs} utility @code{rlog}.  Although this
10729 is no longer true in the current sources, this history
10730 determines the format of the output and the options,
10731 which are not quite in the style of the other @sc{cvs}
10732 commands.
10733
10734 @cindex Timezone, in output
10735 @cindex Zone, time, in output
10736 The output includes the location of the @sc{rcs} file,
10737 the @dfn{head} revision (the latest revision on the
10738 trunk), all symbolic names (tags) and some other
10739 things.  For each revision, the revision number, the
10740 date, the author, the number of lines added/deleted, the commitid
10741 and the log message are printed.  All dates are displayed
10742 in local time at the client. This is typically specified in
10743 the @code{$TZ} environment variable, which can be set to
10744 govern how @code{log} displays dates.
10745
10746 @strong{Note: @code{log} uses @samp{-R} in a way that conflicts
10747 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10748
10749 @menu
10750 * log options::                 log options
10751 * log examples::                log examples
10752 @end menu
10753
10754 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10755 @node log options
10756 @appendixsubsec log options
10757
10758 By default, @code{log} prints all information that is
10759 available.  All other options restrict the output.  Note that the revision
10760 selection options (@code{-d}, @code{-r}, @code{-s}, and @code{-w}) have no
10761 effect, other than possibly causing a search for files in Attic directories,
10762 when used in conjunction with the options that restrict the output to only
10763 @code{log} header fields (@code{-b}, @code{-h}, @code{-R}, and @code{-t})
10764 unless the @code{-S} option is also specified.
10765
10766 @table @code
10767 @item -b
10768 Print information about the revisions on the default
10769 branch, normally the highest branch on the trunk.
10770
10771 @item -d @var{dates}
10772 Print information about revisions with a checkin
10773 date/time in the range given by the
10774 semicolon-separated list of dates.  The date formats
10775 accepted are those accepted by the @samp{-D} option to
10776 many other @sc{cvs} commands (@pxref{Common options}).
10777 Dates can be combined into ranges as follows:
10778
10779 @c Should we be thinking about accepting ISO8601
10780 @c ranges?  For example "1972-09-10/1972-09-12".
10781 @table @code
10782 @item @var{d1}<@var{d2}
10783 @itemx @var{d2}>@var{d1}
10784 Select the revisions that were deposited between
10785 @var{d1} and @var{d2}.
10786
10787 @item <@var{d}
10788 @itemx @var{d}>
10789 Select all revisions dated @var{d} or earlier.
10790
10791 @item @var{d}<
10792 @itemx >@var{d}
10793 Select all revisions dated @var{d} or later.
10794
10795 @item @var{d}
10796 Select the single, latest revision dated @var{d} or
10797 earlier.
10798 @end table
10799
10800 The @samp{>} or @samp{<} characters may be followed by
10801 @samp{=} to indicate an inclusive range rather than an
10802 exclusive one.
10803
10804 Note that the separator is a semicolon (;).
10805
10806 @item -h
10807 Print only the name of the @sc{rcs} file, name
10808 of the file in the working directory, head,
10809 default branch, access list, locks, symbolic names, and
10810 suffix.
10811
10812 @item -l
10813 Local; run only in current working directory.  (Default
10814 is to run recursively).
10815
10816 @item -N
10817 Do not print the list of tags for this file.  This
10818 option can be very useful when your site uses a lot of
10819 tags, so rather than "more"'ing over 3 pages of tag
10820 information, the log information is presented without
10821 tags at all.
10822
10823 @item -R
10824 Print only the name of the @sc{rcs} file.
10825
10826 @c Note that using a bare revision (in addition to not
10827 @c being explicitly documented here) is potentially
10828 @c confusing; it shows the log message to get from the
10829 @c previous revision to that revision.  "-r1.3 -r1.6"
10830 @c (equivalent to "-r1.3,1.6") is even worse; it
10831 @c prints the messages to get from 1.2 to 1.3 and 1.5
10832 @c to 1.6.  By analogy with "cvs diff", users might
10833 @c expect that it is more like specifying a range.
10834 @c It is not 100% clear to me how much of this should
10835 @c be documented (for example, multiple -r options
10836 @c perhaps could/should be deprecated given the false
10837 @c analogy with "cvs diff").
10838 @c In general, this section should be rewritten to talk
10839 @c about messages to get from revision rev1 to rev2,
10840 @c rather than messages for revision rev2 (that is, the
10841 @c messages are associated with a change not a static
10842 @c revision and failing to make this distinction causes
10843 @c much confusion).
10844 @item -r@var{revisions}
10845 Print information about revisions given in the
10846 comma-separated list @var{revisions} of revisions and
10847 ranges.  The following table explains the available
10848 range formats:
10849
10850 @table @code
10851 @item @var{rev1}:@var{rev2}
10852 Revisions @var{rev1} to @var{rev2} (which must be on
10853 the same branch).
10854
10855 @item @var{rev1}::@var{rev2}
10856 The same, but excluding @var{rev1}.
10857
10858 @item :@var{rev}
10859 @itemx ::@var{rev}
10860 Revisions from the beginning of the branch up to
10861 and including @var{rev}.
10862
10863 @item @var{rev}:
10864 Revisions starting with @var{rev} to the end of the
10865 branch containing @var{rev}.
10866
10867 @item @var{rev}::
10868 Revisions starting just after @var{rev} to the end of the
10869 branch containing @var{rev}.
10870
10871 @item @var{branch}
10872 An argument that is a branch means all revisions on
10873 that branch.
10874
10875 @item @var{branch1}:@var{branch2}
10876 @itemx @var{branch1}::@var{branch2}
10877 A range of branches means all revisions
10878 on the branches in that range.
10879
10880 @item @var{branch}.
10881 The latest revision in @var{branch}.
10882 @end table
10883
10884 A bare @samp{-r} with no revisions means the latest
10885 revision on the default branch, normally the trunk.
10886 There can be no space between the @samp{-r} option and
10887 its argument.
10888
10889 @item -S
10890 Suppress the header if no revisions are selected.
10891
10892 @item -s @var{states}
10893 Print information about revisions whose state
10894 attributes match one of the states given in the
10895 comma-separated list @var{states}.
10896
10897 @item -t
10898 Print the same as @samp{-h}, plus the descriptive text.
10899
10900 @item -w@var{logins}
10901 Print information about revisions checked in by users
10902 with login names appearing in the comma-separated list
10903 @var{logins}.  If @var{logins} is omitted, the user's
10904 login is assumed.  There can be no space between the
10905 @samp{-w} option and its argument.
10906 @end table
10907
10908 @code{log} prints the intersection of the revisions
10909 selected with the options @samp{-d}, @samp{-s}, and
10910 @samp{-w}, intersected with the union of the revisions
10911 selected by @samp{-b} and @samp{-r}.
10912
10913 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10914 @node log examples
10915 @appendixsubsec log examples
10916
10917 @cindex Timezone, in output
10918 @cindex Zone, time, in output
10919 Since @code{log} shows dates in local time,
10920 you might want to see them in Coordinated Universal Time (UTC) or
10921 some other timezone.
10922 To do this you can set your @code{$TZ} environment
10923 variable before invoking @sc{cvs}:
10924
10925 @example
10926 $ TZ=UTC cvs log foo.c
10927 $ TZ=EST cvs log bar.c
10928 @end example
10929
10930 (If you are using a @code{csh}-style shell, like @code{tcsh},
10931 you would need to prefix the examples above with @code{env}.)
10932
10933 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10934 @node ls & rls
10935 @appendixsec ls & rls
10936 @cindex ls (subcommand)
10937 @cindex rls (subcommand)
10938
10939 @itemize @bullet
10940 @item
10941 ls [-e | -l] [-RP] [-r tag[:date]] [-D date] [path@dots{}]
10942 @item
10943 Requires: repository for @code{rls}, repository & working directory for
10944 @code{ls}.
10945 @item
10946 Changes: nothing.
10947 @item
10948 Synonym: @code{dir} & @code{list} are synonyms for @code{ls} and @code{rdir}
10949 & @code{rlist} are synonyms for @code{rls}.
10950 @end itemize
10951
10952 The @code{ls} and @code{rls} commands are used to list
10953 files and directories in the repository.
10954
10955 By default @code{ls} lists the files and directories
10956 that belong in your working directory, what would be
10957 there after an @code{update}.
10958
10959 By default @code{rls} lists the files and directories
10960 on the tip of the trunk in the topmost directory of the
10961 repository.
10962
10963 Both commands accept an optional list of file and
10964 directory names, relative to the working directory for
10965 @code{ls} and the topmost directory of the repository
10966 for @code{rls}.  Neither is recursive by default.
10967
10968 @menu
10969 * ls & rls options::         ls & rls options
10970 * rls examples:              rls examples
10971 @end menu
10972
10973 @node ls & rls options
10974 @appendixsubsec ls & rls options
10975
10976 These standard options are supported by @code{ls} & @code{rls}:
10977
10978 @table @code
10979 @item -d
10980 Show dead revisions (with tag when specified).
10981
10982 @item -e
10983 Display in CVS/Entries format.  This format is meant to remain easily parsable
10984 by automation.
10985
10986 @item -l
10987 Display all details.
10988
10989 @item -P
10990 Don't list contents of empty directories when recursing.
10991
10992 @item -R
10993 List recursively.
10994
10995 @item -r @var{tag}[:@var{date}]
10996 Show files specified by @var{tag} or, when @var{date} is specified
10997 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
10998 existed on @var{date}.  See @ref{Common options}.
10999
11000 @item -D @var{date}
11001 Show files from date.
11002 @end table
11003
11004 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11005 @node rls examples
11006 @appendixsubsec rls examples
11007
11008 @example
11009 $ cvs rls
11010 cvs rls: Listing module: `.'
11011 CVSROOT
11012 first-dir
11013 @end example
11014
11015 @example
11016 $ cvs rls CVSROOT
11017 cvs rls: Listing module: `CVSROOT'
11018 checkoutlist
11019 commitinfo
11020 config
11021 cvswrappers
11022 loginfo
11023 modules
11024 notify
11025 rcsinfo
11026 taginfo
11027 verifymsg
11028
11029 @end example
11030
11031 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11032 @node rdiff
11033 @appendixsec rdiff---'patch' format diffs between releases
11034 @cindex rdiff (subcommand)
11035
11036 @itemize @bullet
11037 @item
11038 rdiff [-flags] [-V vn] (-r tag1[:date1] | -D date1) [-r tag2[:date2] | -D date2] modules@dots{}
11039 @item
11040 Requires: repository.
11041 @item
11042 Changes: nothing.
11043 @item
11044 Synonym: patch
11045 @end itemize
11046
11047 Builds a Larry Wall format patch(1) file between two
11048 releases, that can be fed directly into the @code{patch}
11049 program to bring an old release up-to-date with the new
11050 release.  (This is one of the few @sc{cvs} commands that
11051 operates directly from the repository, and doesn't
11052 require a prior checkout.) The diff output is sent to
11053 the standard output device.
11054
11055 You can specify (using the standard @samp{-r} and
11056 @samp{-D} options) any combination of one or two
11057 revisions or dates.  If only one revision or date is
11058 specified, the patch file reflects differences between
11059 that revision or date and the current head revisions in
11060 the @sc{rcs} file.
11061
11062 Note that if the software release affected is contained
11063 in more than one directory, then it may be necessary to
11064 specify the @samp{-p} option to the @code{patch} command when
11065 patching the old sources, so that @code{patch} is able to find
11066 the files that are located in other directories.
11067
11068 @menu
11069 * rdiff options::               rdiff options
11070 * rdiff examples::              rdiff examples
11071 @end menu
11072
11073 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11074 @node rdiff options
11075 @appendixsubsec rdiff options
11076
11077 These standard options are supported by @code{rdiff}
11078 (@pxref{Common options}, for a complete description of
11079 them):
11080
11081 @table @code
11082 @item -D @var{date}
11083 Use the most recent revision no later than @var{date}.
11084
11085 @item -f
11086 If no matching revision is found, retrieve the most
11087 recent revision (instead of ignoring the file).
11088
11089 @item -l
11090 Local; don't descend subdirectories.
11091
11092 @item -R
11093 Examine directories recursively.  This option is on by default.
11094
11095 @item -r @var{tag}
11096 Use the revision specified by @var{tag}, or when @var{date} is specified
11097 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11098 existed on @var{date}.  See @ref{Common options}.
11099 @end table
11100
11101 In addition to the above, these options are available:
11102
11103 @table @code
11104 @item -c
11105 Use the context diff format.  This is the default format.
11106
11107 @item -s
11108 Create a summary change report instead of a patch.  The
11109 summary includes information about files that were
11110 changed or added between the releases.  It is sent to
11111 the standard output device.  This is useful for finding
11112 out, for example, which files have changed between two
11113 dates or revisions.
11114
11115 @item -t
11116 A diff of the top two revisions is sent to the standard
11117 output device.  This is most useful for seeing what the
11118 last change to a file was.
11119
11120 @item -u
11121 Use the unidiff format for the context diffs.
11122 Remember that old versions
11123 of the @code{patch} program can't handle the unidiff
11124 format, so if you plan to post this patch to the net
11125 you should probably not use @samp{-u}.
11126
11127 @item -V @var{vn}
11128 Expand keywords according to the rules current in
11129 @sc{rcs} version @var{vn} (the expansion format changed with
11130 @sc{rcs} version 5).  Note that this option is no
11131 longer accepted.  @sc{cvs} will always expand keywords the
11132 way that @sc{rcs} version 5 does.
11133 @end table
11134
11135 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11136 @node rdiff examples
11137 @appendixsubsec rdiff examples
11138
11139 Suppose you receive mail from @t{foo@@example.net} asking for an
11140 update from release 1.2 to 1.4 of the tc compiler.  You
11141 have no such patches on hand, but with @sc{cvs} that can
11142 easily be fixed with a command such as this:
11143
11144 @example
11145 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
11146 $$ Mail -s 'The patches you asked for' foo@@example.net
11147 @end example
11148
11149 Suppose you have made release 1.3, and forked a branch
11150 called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
11151 corresponds to release 1.3.1, which was made some time
11152 ago.  Now, you want to see how much development has been
11153 done on the branch.  This command can be used:
11154
11155 @example
11156 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
11157 cvs rdiff: Diffing module-name
11158 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
11159 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
11160 File bar.h,v changed from revision 1.29.2.1 to 1.2
11161 @end example
11162
11163 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11164 @node release
11165 @appendixsec release---Indicate that a Module is no longer in use
11166 @cindex release (subcommand)
11167
11168 @itemize @bullet
11169 @item
11170 release [-d] directories@dots{}
11171 @item
11172 Requires: Working directory.
11173 @item
11174 Changes: Working directory, history log.
11175 @end itemize
11176
11177 This command is meant to safely cancel the effect of
11178 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
11179 isn't strictly necessary to use this command.  You can
11180 always simply delete your working directory, if you
11181 like; but you risk losing changes you may have
11182 forgotten, and you leave no trace in the @sc{cvs} history
11183 file (@pxref{history file}) that you've abandoned your
11184 checkout.
11185
11186 Use @samp{cvs release} to avoid these problems.  This
11187 command checks that no uncommitted changes are
11188 present; that you are executing it from immediately
11189 above a @sc{cvs} working directory; and that the repository
11190 recorded for your files is the same as the repository
11191 defined in the module database.
11192
11193 If all these conditions are true, @samp{cvs release}
11194 leaves a record of its execution (attesting to your
11195 intentionally abandoning your checkout) in the @sc{cvs}
11196 history log.
11197
11198 @menu
11199 * release options::             release options
11200 * release output::              release output
11201 * release examples::            release examples
11202 @end menu
11203
11204 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11205 @node release options
11206 @appendixsubsec release options
11207
11208 The @code{release} command supports one command option:
11209
11210 @table @code
11211 @item -d
11212 Delete your working copy of the file if the release
11213 succeeds.  If this flag is not given your files will
11214 remain in your working directory.
11215
11216 @strong{WARNING:  The @code{release} command deletes
11217 all directories and files recursively.  This
11218 has the very serious side-effect that any directory
11219 that you have created inside your checked-out sources,
11220 and not added to the repository (using the @code{add}
11221 command; @pxref{Adding files}) will be silently deleted---even
11222 if it is non-empty!}
11223 @end table
11224
11225 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11226 @node release output
11227 @appendixsubsec release output
11228
11229 Before @code{release} releases your sources it will
11230 print a one-line message for any file that is not
11231 up-to-date.
11232
11233 @table @code
11234 @item U @var{file}
11235 @itemx P @var{file}
11236 There exists a newer revision of this file in the
11237 repository, and you have not modified your local copy
11238 of the file (@samp{U} and @samp{P} mean the same thing).
11239
11240 @item A @var{file}
11241 The file has been added to your private copy of the
11242 sources, but has not yet been committed to the
11243 repository.  If you delete your copy of the sources
11244 this file will be lost.
11245
11246 @item R @var{file}
11247 The file has been removed from your private copy of the
11248 sources, but has not yet been removed from the
11249 repository, since you have not yet committed the
11250 removal.  @xref{commit}.
11251
11252 @item M @var{file}
11253 The file is modified in your working directory.  There
11254 might also be a newer revision inside the repository.
11255
11256 @item ? @var{file}
11257 @var{file} is in your working directory, but does not
11258 correspond to anything in the source repository, and is
11259 not in the list of files for @sc{cvs} to ignore (see the
11260 description of the @samp{-I} option, and
11261 @pxref{cvsignore}).  If you remove your working
11262 sources, this file will be lost.
11263 @end table
11264
11265 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11266 @node release examples
11267 @appendixsubsec release examples
11268
11269 Release the @file{tc} directory, and delete your local working copy
11270 of the files.
11271
11272 @example
11273 $ cd ..         # @r{You must stand immediately above the}
11274                 # @r{sources when you issue @samp{cvs release}.}
11275 $ cvs release -d tc
11276 You have [0] altered files in this repository.
11277 Are you sure you want to release (and delete) directory `tc': y
11278 $
11279 @end example
11280
11281 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11282 @node update
11283 @appendixsec update---Bring work tree in sync with repository
11284 @cindex update (subcommand)
11285
11286 @itemize @bullet
11287 @item
11288 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag[:date] | -D date] [-W spec] files@dots{}
11289 @item
11290 Requires: repository, working directory.
11291 @item
11292 Changes: working directory.
11293 @end itemize
11294
11295 After you've run checkout to create your private copy
11296 of source from the common repository, other developers
11297 will continue changing the central source.  From time
11298 to time, when it is convenient in your development
11299 process, you can use the @code{update} command from
11300 within your working directory to reconcile your work
11301 with any revisions applied to the source repository
11302 since your last checkout or update.  Without the @code{-C}
11303 option, @code{update} will also merge any differences
11304 between the local copy of files and their base revisions
11305 into any destination revisions specified with @code{-r},
11306 @code{-D}, or @code{-A}.
11307
11308 @menu
11309 * update options::              update options
11310 * update output::               update output
11311 @end menu
11312
11313 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11314 @node update options
11315 @appendixsubsec update options
11316
11317 These standard options are available with @code{update}
11318 (@pxref{Common options}, for a complete description of
11319 them):
11320
11321 @table @code
11322 @item -D date
11323 Use the most recent revision no later than @var{date}.
11324 This option is sticky, and implies @samp{-P}.
11325 See @ref{Sticky tags}, for more information on sticky tags/dates.
11326
11327 @item -f
11328 Only useful with the @samp{-D} or @samp{-r} flags.  If no matching revision
11329 is found, retrieve the most recent revision (instead of ignoring the file).
11330
11331 @item -k @var{kflag}
11332 Process keywords according to @var{kflag}.  See
11333 @ref{Keyword substitution}.
11334 This option is sticky; future updates of
11335 this file in this working directory will use the same
11336 @var{kflag}.  The @code{status} command can be viewed
11337 to see the sticky options.  See @ref{Invoking CVS}, for
11338 more information on the @code{status} command.
11339
11340 @item -l
11341 Local; run only in current working directory.  @xref{Recursive behavior}.
11342
11343 @item -P
11344 Prune empty directories.  See @ref{Moving directories}.
11345
11346 @item -p
11347 Pipe files to the standard output.
11348
11349 @item -R
11350 Update directories recursively (default).  @xref{Recursive
11351 behavior}.
11352
11353 @item -r @var{tag}[:@var{date}]
11354 Retrieve the revisions specified by @var{tag} or, when @var{date} is specified
11355 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11356 existed on @var{date}.  This option is sticky, and implies @samp{-P}.
11357 See @ref{Sticky tags}, for more information on sticky tags/dates. Also
11358 see @ref{Common options}.
11359 @end table
11360
11361 @need 800
11362 These special options are also available with
11363 @code{update}.
11364
11365 @table @code
11366 @item -A
11367 Reset any sticky tags, dates, or @samp{-k} options.
11368 See @ref{Sticky tags}, for more information on sticky tags/dates.
11369
11370 @item -C
11371 Overwrite locally modified files with clean copies from
11372 the repository (the modified file is saved in
11373 @file{.#@var{file}.@var{revision}}, however).
11374
11375 @item -d
11376 Create any directories that exist in the repository if
11377 they're missing from the working directory.  Normally,
11378 @code{update} acts only on directories and files that
11379 were already enrolled in your working directory.
11380
11381 This is useful for updating directories that were
11382 created in the repository since the initial checkout;
11383 but it has an unfortunate side effect.  If you
11384 deliberately avoided certain directories in the
11385 repository when you created your working directory
11386 (either through use of a module name or by listing
11387 explicitly the files and directories you wanted on the
11388 command line), then updating with @samp{-d} will create
11389 those directories, which may not be what you want.
11390
11391 @item -I @var{name}
11392 Ignore files whose names match @var{name} (in your
11393 working directory) during the update.  You can specify
11394 @samp{-I} more than once on the command line to specify
11395 several files to ignore.  Use @samp{-I !} to avoid
11396 ignoring any files at all.  @xref{cvsignore}, for other
11397 ways to make @sc{cvs} ignore some files.
11398
11399 @item -W@var{spec}
11400 Specify file names that should be filtered during
11401 update.  You can use this option repeatedly.
11402
11403 @var{spec} can be a file name pattern of the same type
11404 that you can specify in the @file{.cvswrappers}
11405 file. @xref{Wrappers}.
11406
11407 @item -j@var{revision}
11408 With two @samp{-j} options, merge changes from the
11409 revision specified with the first @samp{-j} option to
11410 the revision specified with the second @samp{j} option,
11411 into the working directory.
11412
11413 With one @samp{-j} option, merge changes from the
11414 ancestor revision to the revision specified with the
11415 @samp{-j} option, into the working directory.  The
11416 ancestor revision is the common ancestor of the
11417 revision which the working directory is based on, and
11418 the revision specified in the @samp{-j} option.
11419
11420 Note that using a single @samp{-j @var{tagname}} option rather than
11421 @samp{-j @var{branchname}} to merge changes from a branch will
11422 often not remove files which were removed on the branch.
11423 @xref{Merging adds and removals}, for more.
11424
11425 In addition, each @samp{-j} option can contain an optional
11426 date specification which, when used with branches, can
11427 limit the chosen revision to one within a specific
11428 date.  An optional date is specified by adding a colon
11429 (:) to the tag:
11430 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
11431
11432 @xref{Branching and merging}.
11433
11434 @end table
11435
11436 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11437 @node update output
11438 @appendixsubsec update output
11439
11440 @code{update} and @code{checkout} keep you informed of
11441 their progress by printing a line for each file, preceded
11442 by one character indicating the status of the file:
11443
11444 @table @code
11445 @item U @var{file}
11446 The file was brought up to date with respect to the
11447 repository.  This is done for any file that exists in
11448 the repository but not in your source, and for files
11449 that you haven't changed but are not the most recent
11450 versions available in the repository.
11451
11452 @item P @var{file}
11453 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
11454 file.  This accomplishes the same thing as @samp{U} using less bandwidth.
11455
11456 @item A @var{file}
11457 The file has been added to your private copy of the
11458 sources, and will be added to the source repository
11459 when you run @code{commit} on the file.  This is a
11460 reminder to you that the file needs to be committed.
11461
11462 @item R @var{file}
11463 The file has been removed from your private copy of the
11464 sources, and will be removed from the source repository
11465 when you run @code{commit} on the file.  This is a
11466 reminder to you that the file needs to be committed.
11467
11468 @item M @var{file}
11469 The file is modified in  your  working  directory.
11470
11471 @samp{M} can indicate one of two states for a file
11472 you're working on: either there were no modifications
11473 to the same file in the repository, so that your file
11474 remains as you last saw it; or there were modifications
11475 in the repository as well as in your copy, but they
11476 were merged successfully, without conflict, in your
11477 working directory.
11478
11479 @sc{cvs} will print some messages if it merges your work,
11480 and a backup copy of your working file (as it looked
11481 before you ran @code{update}) will be made.  The exact
11482 name of that file is printed while @code{update} runs.
11483
11484 @item C @var{file}
11485 @cindex .# files
11486 @cindex __ files (VMS)
11487 A conflict was detected while trying to merge your
11488 changes to @var{file} with changes from the source
11489 repository.  @var{file} (the copy in your working
11490 directory) is now the result of attempting to merge
11491 the two revisions; an unmodified copy of your file
11492 is also in your working directory, with the name
11493 @file{.#@var{file}.@var{revision}} where @var{revision}
11494 is the revision that your modified file started
11495 from.  Resolve the conflict as described in
11496 @ref{Conflicts example}.
11497 @c "some systems" as in out-of-the-box OSes?  Not as
11498 @c far as I know.  We need to advise sysadmins as well
11499 @c as users how to set up this kind of purge, if that is
11500 @c what they want.
11501 @c We also might want to think about cleaner solutions,
11502 @c like having CVS remove the .# file once the conflict
11503 @c has been resolved or something like that.
11504 (Note that some systems automatically purge
11505 files that begin with @file{.#} if they have not been
11506 accessed for a few days.  If you intend to keep a copy
11507 of your original file, it is a very good idea to rename
11508 it.)  Under @sc{vms}, the file name starts with
11509 @file{__} rather than @file{.#}.
11510
11511 @item ? @var{file}
11512 @var{file} is in your working directory, but does not
11513 correspond to anything in the source repository, and is
11514 not in the list of files for @sc{cvs} to ignore (see the
11515 description of the @samp{-I} option, and
11516 @pxref{cvsignore}).
11517 @end table
11518
11519 @c ----- END MAN 1 -----
11520 @c ---------------------------------------------------------------------
11521 @node Invoking CVS
11522 @appendix Quick reference to CVS commands
11523 @cindex Command reference
11524 @cindex Reference, commands
11525 @cindex Invoking CVS
11526
11527 This appendix describes how to invoke @sc{cvs}, with
11528 references to where each command or feature is
11529 described in detail.  For other references run the
11530 @code{cvs --help} command, or see @ref{Index}.
11531
11532 A @sc{cvs} command looks like:
11533
11534 @example
11535 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
11536 @end example
11537
11538 Global options:
11539
11540 @table @code
11541 @item --allow-root=@var{rootdir}
11542 Specify legal @sc{cvsroot} directory (server only) (not
11543 in @sc{cvs} 1.9 and older).  See @ref{Password
11544 authentication server}.
11545
11546 @item -a
11547 Authenticate all communication (client only) (not in @sc{cvs}
11548 1.9 and older).  See @ref{Global options}.
11549
11550 @item -b
11551 Specify RCS location (@sc{cvs} 1.9 and older).  See
11552 @ref{Global options}.
11553
11554 @item -d @var{root}
11555 Specify the @sc{cvsroot}.  See @ref{Repository}.
11556
11557 @item -e @var{editor}
11558 Edit messages with @var{editor}.  See @ref{Committing
11559 your changes}.
11560
11561 @item -f
11562 Do not read the @file{~/.cvsrc} file.  See @ref{Global
11563 options}.
11564
11565 @item -H
11566 @itemx --help
11567 Print a help message.  See @ref{Global options}.
11568
11569 @item -n
11570 Do not change any files.  See @ref{Global options}.
11571
11572 @item -Q
11573 Be really quiet.  See @ref{Global options}.
11574
11575 @item -q
11576 Be somewhat quiet.  See @ref{Global options}.
11577
11578 @item -r
11579 Make new working files read-only.  See @ref{Global options}.
11580
11581 @item -s @var{variable}=@var{value}
11582 Set a user variable.  See @ref{Variables}.
11583
11584 @item -T @var{tempdir}
11585 Put temporary files in @var{tempdir}.  See @ref{Global
11586 options}.
11587
11588 @item -t
11589 Trace @sc{cvs} execution.  See @ref{Global options}.
11590
11591 @item -v
11592 @item --version
11593 Display version and copyright information for @sc{cvs}.
11594
11595 @item -w
11596 Make new working files read-write.  See @ref{Global
11597 options}.
11598
11599 @item -x
11600 Encrypt all communication (client only).
11601 See @ref{Global options}.
11602
11603 @item -z @var{gzip-level}
11604 @cindex Compression
11605 @cindex Gzip
11606 Set the compression level (client only).
11607 See @ref{Global options}.
11608 @end table
11609
11610 Keyword expansion modes (@pxref{Substitution modes}):
11611
11612 @example
11613 -kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11614 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11615 -kk   $@splitrcskeyword{Id}$
11616 -kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
11617 -ko   @i{no expansion}
11618 -kb   @i{no expansion, file is binary}
11619 @end example
11620
11621 Keywords (@pxref{Keyword list}):
11622
11623 @example
11624 $@splitrcskeyword{Author}: joe $
11625 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11626 $@splitrcskeyword{CVSHeader}: files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11627 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11628 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11629 $@splitrcskeyword{Locker}: harry $
11630 $@splitrcskeyword{Name}: snapshot_1_14 $
11631 $@splitrcskeyword{RCSfile}: file1,v $
11632 $@splitrcskeyword{Revision}: 1.1 $
11633 $@splitrcskeyword{Source}: /home/files/file1,v $
11634 $@splitrcskeyword{State}: Exp $
11635 $@splitrcskeyword{Log}: file1,v $
11636 Revision 1.1  1993/12/09 03:30:17  joe
11637 Initial revision
11638
11639 @end example
11640
11641 @c The idea behind this table is that we want each item
11642 @c to be a sentence or two at most.  Preferably a
11643 @c single line.
11644 @c
11645 @c In some cases refs to "foo options" are just to get
11646 @c this thing written quickly, not because the "foo
11647 @c options" node is really the best place to point.
11648 Commands, command options, and command arguments:
11649
11650 @table @code
11651 @c ------------------------------------------------------------
11652 @item add [@var{options}] [@var{files}@dots{}]
11653 Add a new file/directory.  See @ref{Adding files}.
11654
11655 @table @code
11656 @item -k @var{kflag}
11657 Set keyword expansion.
11658
11659 @item -m @var{msg}
11660 Set file description.
11661 @end table
11662
11663 @c ------------------------------------------------------------
11664 @item admin [@var{options}] [@var{files}@dots{}]
11665 Administration of history files in the repository.  See
11666 @ref{admin}.
11667 @c This list omits those options which are not
11668 @c documented as being useful with CVS.  That might be
11669 @c a mistake...
11670
11671 @table @code
11672 @item -b[@var{rev}]
11673 Set default branch.  See @ref{Reverting local changes}.
11674
11675 @item -c@var{string}
11676 Set comment leader.
11677
11678 @item -k@var{subst}
11679 Set keyword substitution.  See @ref{Keyword
11680 substitution}.
11681
11682 @item -l[@var{rev}]
11683 Lock revision @var{rev}, or latest revision.
11684
11685 @item -m@var{rev}:@var{msg}
11686 Replace the log message of revision @var{rev} with
11687 @var{msg}.
11688
11689 @item -o@var{range}
11690 Delete revisions from the repository.  See
11691 @ref{admin options}.
11692
11693 @item -q
11694 Run quietly; do not print diagnostics.
11695
11696 @item -s@var{state}[:@var{rev}]
11697 Set the state.
11698
11699 @c Does not work for client/server CVS
11700 @item -t
11701 Set file description from standard input.
11702
11703 @item -t@var{file}
11704 Set file description from @var{file}.
11705
11706 @item -t-@var{string}
11707 Set file description to @var{string}.
11708
11709 @item -u[@var{rev}]
11710 Unlock revision @var{rev}, or latest revision.
11711 @end table
11712
11713 @c ------------------------------------------------------------
11714 @item annotate [@var{options}] [@var{files}@dots{}]
11715 Show last revision where each line was modified.  See
11716 @ref{annotate}.
11717
11718 @table @code
11719 @item -D @var{date}
11720 Annotate the most recent revision no later than
11721 @var{date}.  See @ref{Common options}.
11722
11723 @item -F
11724 Force annotation of binary files.  (Without this option,
11725 binary files are skipped with a message.)
11726
11727 @item -f
11728 Use head revision if tag/date not found.  See
11729 @ref{Common options}.
11730
11731 @item -l
11732 Local; run only in current working directory.  @xref{Recursive behavior}.
11733
11734 @item -R
11735 Operate recursively (default).  @xref{Recursive
11736 behavior}.
11737
11738 @item -r @var{tag}[:@var{date}]
11739 Annotate revisions specified by @var{tag} or, when @var{date} is specified
11740 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11741 existed on @var{date}.  See @ref{Common options}.
11742 @end table
11743
11744 @c ------------------------------------------------------------
11745 @item checkout [@var{options}] @var{modules}@dots{}
11746 Get a copy of the sources.  See @ref{checkout}.
11747
11748 @table @code
11749 @item -A
11750 Reset any sticky tags/date/options.  See @ref{Sticky
11751 tags} and @ref{Keyword substitution}.
11752
11753 @item -c
11754 Output the module database.  See @ref{checkout options}.
11755
11756 @item -D @var{date}
11757 Check out revisions as of @var{date} (is sticky).  See
11758 @ref{Common options}.
11759
11760 @item -d @var{dir}
11761 Check out into @var{dir}.  See @ref{checkout options}.
11762
11763 @item -f
11764 Use head revision if tag/date not found.  See
11765 @ref{Common options}.
11766
11767 @c Probably want to use rev1/rev2 style like for diff
11768 @c -r.  Here and in on-line help.
11769 @item -j @var{tag}[:@var{date}]
11770 Merge in the change specified by @var{tag}, or when @var{date} is specified
11771 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11772 existed on @var{date}.  See @ref{checkout options}.
11773
11774 @item -k @var{kflag}
11775 Use @var{kflag} keyword expansion.  See
11776 @ref{Substitution modes}.
11777
11778 @item -l
11779 Local; run only in current working directory.  @xref{Recursive behavior}.
11780
11781 @item -N
11782 Don't ``shorten'' module paths if -d specified.  See
11783 @ref{checkout options}.
11784
11785 @item -n
11786 Do not run module program (if any).  See @ref{checkout options}.
11787
11788 @item -P
11789 Prune empty directories.  See @ref{Moving directories}.
11790
11791 @item -p
11792 Check out files to standard output (avoids
11793 stickiness).  See @ref{checkout options}.
11794
11795 @item -R
11796 Operate recursively (default).  @xref{Recursive
11797 behavior}.
11798
11799 @item -r @var{tag}[:@var{date}]
11800 Checkout the revision already tagged with @var{tag} or, when @var{date} is
11801 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
11802 as it existed on @var{date}.  This .  See @ref{Common options}.
11803
11804 @item -s
11805 Like -c, but include module status.  See @ref{checkout options}.
11806 @end table
11807
11808 @c ------------------------------------------------------------
11809 @item commit [@var{options}] [@var{files}@dots{}]
11810 Check changes into the repository.  See @ref{commit}.
11811
11812 @table @code
11813 @item -c
11814 Check for valid edits before committing.  Requires a @sc{cvs} client and server
11815 both version 1.12.10 or greater.
11816
11817 @item -F @var{file}
11818 Read log message from @var{file}.  See @ref{commit options}.
11819
11820 @item -f
11821 @c What is this "disables recursion"?  It is from the
11822 @c on-line help; is it documented in this manual?
11823 Force the file to be committed; disables recursion.
11824 See @ref{commit options}.
11825
11826 @item -l
11827 Local; run only in current working directory.  See @ref{Recursive behavior}.
11828
11829 @item -m @var{msg}
11830 Use @var{msg} as log message.  See @ref{commit options}.
11831
11832 @item -n
11833 Do not run module program (if any).  See @ref{commit options}.
11834
11835 @item -R
11836 Operate recursively (default).  @xref{Recursive
11837 behavior}.
11838
11839 @item -r @var{rev}
11840 Commit to @var{rev}.  See @ref{commit options}.
11841 @c FIXME: should be dragging over text from
11842 @c commit options, especially if it can be cleaned up
11843 @c and made concise enough.
11844 @end table
11845
11846 @c ------------------------------------------------------------
11847 @item diff [@var{options}] [@var{files}@dots{}]
11848 Show differences between revisions.  See @ref{diff}.
11849 In addition to the options shown below, accepts a wide
11850 variety of options to control output style, for example
11851 @samp{-c} for context diffs.
11852
11853 @table @code
11854 @item -D @var{date1}
11855 Diff revision for date against working file.  See
11856 @ref{diff options}.
11857
11858 @item -D @var{date2}
11859 Diff @var{rev1}/@var{date1} against @var{date2}.  See
11860 @ref{diff options}.
11861
11862 @item -l
11863 Local; run only in current working directory.  See @ref{Recursive behavior}.
11864
11865 @item -N
11866 Include diffs for added and removed files.  See
11867 @ref{diff options}.
11868
11869 @item -R
11870 Operate recursively (default).  @xref{Recursive
11871 behavior}.
11872
11873 @item -r @var{tag1}[:@var{date1}]
11874 Diff the revisions specified by @var{tag1} or, when @var{date1} is specified
11875 and @var{tag1} is a branch tag, the version from the branch @var{tag1} as it
11876 existed on @var{date1}, against the working file.  See @ref{diff options}
11877 and @ref{Common options}.
11878
11879 @item -r @var{tag2}[:@var{date2}]
11880 Diff the revisions specified by @var{tag2} or, when @var{date2} is specified
11881 and @var{tag2} is a branch tag, the version from the branch @var{tag2} as it
11882 existed on @var{date2}, against @var{rev1}/@var{date1}.  See @ref{diff options}
11883 and @ref{Common options}.
11884 @end table
11885
11886 @c ------------------------------------------------------------
11887 @item edit [@var{options}] [@var{files}@dots{}]
11888 Get ready to edit a watched file.  See @ref{Editing files}.
11889
11890 @table @code
11891 @item -a @var{actions}
11892 Specify actions for temporary watch, where
11893 @var{actions} is @code{edit}, @code{unedit},
11894 @code{commit}, @code{all}, or @code{none}.  See
11895 @ref{Editing files}.
11896
11897 @item -c
11898 Check edits: Edit fails if someone else is already editting the file.
11899 Requires a @sc{cvs} client and server both of version 1.12.10 or greater.
11900
11901 @item -f
11902 Force edit; ignore other edits.  Added in CVS 1.12.10.
11903
11904 @item -l
11905 Local; run only in current working directory.  See @ref{Recursive behavior}.
11906
11907 @item -R
11908 Operate recursively (default).  @xref{Recursive
11909 behavior}.
11910 @end table
11911
11912 @c ------------------------------------------------------------
11913 @item editors [@var{options}] [@var{files}@dots{}]
11914 See who is editing a watched file.  See @ref{Watch information}.
11915
11916 @table @code
11917 @item -l
11918 Local; run only in current working directory.  See @ref{Recursive behavior}.
11919
11920 @item -R
11921 Operate recursively (default).  @xref{Recursive
11922 behavior}.
11923 @end table
11924
11925 @c ------------------------------------------------------------
11926 @item export [@var{options}] @var{modules}@dots{}
11927 Export files from @sc{cvs}.  See @ref{export}.
11928
11929 @table @code
11930 @item -D @var{date}
11931 Check out revisions as of @var{date}.  See
11932 @ref{Common options}.
11933
11934 @item -d @var{dir}
11935 Check out into @var{dir}.  See @ref{export options}.
11936
11937 @item -f
11938 Use head revision if tag/date not found.  See
11939 @ref{Common options}.
11940
11941 @item -k @var{kflag}
11942 Use @var{kflag} keyword expansion.  See
11943 @ref{Substitution modes}.
11944
11945 @item -l
11946 Local; run only in current working directory.  @xref{Recursive behavior}.
11947
11948 @item -N
11949 Don't ``shorten'' module paths if -d specified.  See
11950 @ref{export options}.
11951
11952 @item -n
11953 Do not run module program (if any).  See @ref{export options}.
11954
11955 @item -R
11956 Operate recursively (default).  @xref{Recursive
11957 behavior}.
11958
11959 @item -r @var{tag}[:@var{date}]
11960 Export the revisions specified by @var{tag} or, when @var{date} is specified
11961 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11962 existed on @var{date}.  See @ref{Common options}.
11963 @end table
11964
11965 @c ------------------------------------------------------------
11966 @item history [@var{options}] [@var{files}@dots{}]
11967 Show repository access history.  See @ref{history}.
11968
11969 @table @code
11970 @item -a
11971 All users (default is self).  See @ref{history options}.
11972
11973 @item -b @var{str}
11974 Back to record with @var{str} in module/file/repos
11975 field.  See @ref{history options}.
11976
11977 @item -c
11978 Report on committed (modified) files.  See @ref{history options}.
11979
11980 @item -D @var{date}
11981 Since @var{date}.  See @ref{history options}.
11982
11983 @item -e
11984 Report on all record types.  See @ref{history options}.
11985
11986 @item -l
11987 Last modified (committed or modified report).  See @ref{history options}.
11988
11989 @item -m @var{module}
11990 Report on @var{module} (repeatable).  See @ref{history options}.
11991
11992 @item -n @var{module}
11993 In @var{module}.  See @ref{history options}.
11994
11995 @item -o
11996 Report on checked out modules.  See @ref{history options}.
11997
11998 @item -p @var{repository}
11999 In @var{repository}.  See @ref{history options}.
12000
12001 @item -r @var{rev}
12002 Since revision @var{rev}.  See @ref{history options}.
12003
12004 @item -T
12005 @c What the @#$@# is a TAG?  Same as a tag?  This
12006 @c wording is also in the online-line help.
12007 Produce report on all TAGs.  See @ref{history options}.
12008
12009 @item -t @var{tag}
12010 Since tag record placed in history file (by anyone).
12011 See @ref{history options}.
12012
12013 @item -u @var{user}
12014 For user @var{user} (repeatable).  See @ref{history options}.
12015
12016 @item -w
12017 Working directory must match.  See @ref{history options}.
12018
12019 @item -x @var{types}
12020 Report on @var{types}, one or more of
12021 @code{TOEFWUPCGMAR}.  See @ref{history options}.
12022
12023 @item -z @var{zone}
12024 Output for time zone @var{zone}.  See @ref{history options}.
12025 @end table
12026
12027 @c ------------------------------------------------------------
12028 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
12029 Import files into @sc{cvs}, using vendor branches.  See
12030 @ref{import}.
12031
12032 @table @code
12033 @item -b @var{bra}
12034 Import to vendor branch @var{bra}.  See
12035 @ref{Multiple vendor branches}.
12036
12037 @item -d
12038 Use the file's modification time as the time of
12039 import.  See @ref{import options}.
12040
12041 @item -k @var{kflag}
12042 Set default keyword substitution mode.  See
12043 @ref{import options}.
12044
12045 @item -m @var{msg}
12046 Use @var{msg} for log message.  See
12047 @ref{import options}.
12048
12049 @item -I @var{ign}
12050 More files to ignore (! to reset).  See
12051 @ref{import options}.
12052
12053 @item -W @var{spec}
12054 More wrappers.  See @ref{import options}.
12055 @end table
12056
12057 @c ------------------------------------------------------------
12058 @item init
12059 Create a @sc{cvs} repository if it doesn't exist.  See
12060 @ref{Creating a repository}.
12061
12062 @c ------------------------------------------------------------
12063 @item kserver
12064 Kerberos authenticated server.
12065 See @ref{Kerberos authenticated}.
12066
12067 @c ------------------------------------------------------------
12068 @item log [@var{options}] [@var{files}@dots{}]
12069 Print out history information for files.  See @ref{log}.
12070
12071 @table @code
12072 @item -b
12073 Only list revisions on the default branch.  See @ref{log options}.
12074
12075 @item -d @var{dates}
12076 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12077 latest before).  See @ref{log options}.
12078
12079 @item -h
12080 Only print header.  See @ref{log options}.
12081
12082 @item -l
12083 Local; run only in current working directory.  See @ref{Recursive behavior}.
12084
12085 @item -N
12086 Do not list tags.  See @ref{log options}.
12087
12088 @item -R
12089 Only print name of RCS file.  See @ref{log options}.
12090
12091 @item -r@var{revs}
12092 Only list revisions @var{revs}.  See @ref{log options}.
12093
12094 @item -s @var{states}
12095 Only list revisions with specified states.  See @ref{log options}.
12096
12097 @item -t
12098 Only print header and descriptive text.  See @ref{log
12099 options}.
12100
12101 @item -w@var{logins}
12102 Only list revisions checked in by specified logins.  See @ref{log options}.
12103 @end table
12104
12105 @c ------------------------------------------------------------
12106 @item login
12107 Prompt for password for authenticating server.  See
12108 @ref{Password authentication client}.
12109
12110 @c ------------------------------------------------------------
12111 @item logout
12112 Remove stored password for authenticating server.  See
12113 @ref{Password authentication client}.
12114
12115 @c ------------------------------------------------------------
12116 @item pserver
12117 Password authenticated server.
12118 See @ref{Password authentication server}.
12119
12120 @c ------------------------------------------------------------
12121 @item rannotate [@var{options}] [@var{modules}@dots{}]
12122 Show last revision where each line was modified.  See
12123 @ref{annotate}.
12124
12125 @table @code
12126 @item -D @var{date}
12127 Annotate the most recent revision no later than
12128 @var{date}.  See @ref{Common options}.
12129
12130 @item -F
12131 Force annotation of binary files.  (Without this option,
12132 binary files are skipped with a message.)
12133
12134 @item -f
12135 Use head revision if tag/date not found.  See
12136 @ref{Common options}.
12137
12138 @item -l
12139 Local; run only in current working directory.  @xref{Recursive behavior}.
12140
12141 @item -R
12142 Operate recursively (default).  @xref{Recursive behavior}.
12143
12144 @item -r @var{tag}[:@var{date}]
12145 Annotate the revision specified by @var{tag} or, when @var{date} is specified
12146 and @var{tag} is a branch tag, the version from the branch @var{tag}
12147 as it existed on @var{date}.  See @ref{Common options}.
12148 @end table
12149
12150 @c ------------------------------------------------------------
12151 @item rdiff [@var{options}] @var{modules}@dots{}
12152 Show differences between releases.  See @ref{rdiff}.
12153
12154 @table @code
12155 @item -c
12156 Context diff output format (default).  See @ref{rdiff options}.
12157
12158 @item -D @var{date}
12159 Select revisions based on @var{date}.  See @ref{Common options}.
12160
12161 @item -f
12162 Use head revision if tag/date not found.  See
12163 @ref{Common options}.
12164
12165 @item -l
12166 Local; run only in current working directory.  See @ref{Recursive behavior}.
12167
12168 @item -R
12169 Operate recursively (default).  @xref{Recursive
12170 behavior}.
12171
12172 @item -r @var{tag}[:@var{date}]
12173 Select the revisions specified by @var{tag} or, when @var{date} is specified
12174 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12175 existed on @var{date}.  See @ref{diff options} and @ref{Common options}.
12176
12177 @item -s
12178 Short patch - one liner per file.  See @ref{rdiff options}.
12179
12180 @item -t
12181 Top two diffs - last change made to the file.  See
12182 @ref{diff options}.
12183
12184 @item -u
12185 Unidiff output format.  See @ref{rdiff options}.
12186
12187 @item -V @var{vers}
12188 Use RCS Version @var{vers} for keyword expansion (obsolete).  See
12189 @ref{rdiff options}.
12190 @end table
12191
12192 @c ------------------------------------------------------------
12193 @item release [@var{options}] @var{directory}
12194 Indicate that a directory is no longer in use.  See
12195 @ref{release}.
12196
12197 @table @code
12198 @item -d
12199 Delete the given directory.  See @ref{release options}.
12200 @end table
12201
12202 @c ------------------------------------------------------------
12203 @item remove [@var{options}] [@var{files}@dots{}]
12204 Remove an entry from the repository.  See @ref{Removing files}.
12205
12206 @table @code
12207 @item -f
12208 Delete the file before removing it.  See @ref{Removing files}.
12209
12210 @item -l
12211 Local; run only in current working directory.  See @ref{Recursive behavior}.
12212
12213 @item -R
12214 Operate recursively (default).  @xref{Recursive
12215 behavior}.
12216 @end table
12217
12218 @c ------------------------------------------------------------
12219 @item rlog [@var{options}] [@var{files}@dots{}]
12220 Print out history information for modules.  See @ref{log}.
12221
12222 @table @code
12223 @item -b
12224 Only list revisions on the default branch.  See @ref{log options}.
12225
12226 @item -d @var{dates}
12227 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12228 latest before).  See @ref{log options}.
12229
12230 @item -h
12231 Only print header.  See @ref{log options}.
12232
12233 @item -l
12234 Local; run only in current working directory.  See @ref{Recursive behavior}.
12235
12236 @item -N
12237 Do not list tags.  See @ref{log options}.
12238
12239 @item -R
12240 Only print name of RCS file.  See @ref{log options}.
12241
12242 @item -r@var{revs}
12243 Only list revisions @var{revs}.  See @ref{log options}.
12244
12245 @item -s @var{states}
12246 Only list revisions with specified states.  See @ref{log options}.
12247
12248 @item -t
12249 Only print header and descriptive text.  See @ref{log options}.
12250
12251 @item -w@var{logins}
12252 Only list revisions checked in by specified logins.  See @ref{log options}.
12253 @end table
12254
12255 @c ------------------------------------------------------------
12256 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
12257 Add a symbolic tag to a module.
12258 See @ref{Revisions} and @ref{Branching and merging}.
12259
12260 @table @code
12261 @item -a
12262 Clear tag from removed files that would not otherwise
12263 be tagged.  See @ref{Tagging add/remove}.
12264
12265 @item -b
12266 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12267
12268 @item -B
12269 Used in conjunction with -F or -d, enables movement and deletion of
12270 branch tags.  Use with extreme caution. 
12271
12272 @item -D @var{date}
12273 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12274
12275 @item -d
12276 Delete @var{tag}.  See @ref{Modifying tags}.
12277
12278 @item -F
12279 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12280
12281 @item -f
12282 Force a head revision match if tag/date not found.
12283 See @ref{Tagging by date/tag}.
12284
12285 @item -l
12286 Local; run only in current working directory.  See @ref{Recursive behavior}.
12287
12288 @item -n
12289 No execution of tag program.  See @ref{Common options}.
12290
12291 @item -R
12292 Operate recursively (default).  @xref{Recursive
12293 behavior}.
12294
12295 @item -r @var{tag}[:@var{date}]
12296 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
12297 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12298 existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12299 @end table
12300
12301 @c ------------------------------------------------------------
12302 @item server
12303 Rsh server.  See @ref{Connecting via rsh}.
12304
12305 @c ------------------------------------------------------------
12306 @item status [@var{options}] @var{files}@dots{}
12307 Display status information in a working directory.  See
12308 @ref{File status}.
12309
12310 @table @code
12311 @item -l
12312 Local; run only in current working directory.  See @ref{Recursive behavior}.
12313
12314 @item -R
12315 Operate recursively (default).  @xref{Recursive behavior}.
12316
12317 @item -v
12318 Include tag information for file.  See @ref{Tags}.
12319 @end table
12320
12321 @c ------------------------------------------------------------
12322 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
12323 Add a symbolic tag to checked out version of files.
12324 See @ref{Revisions} and @ref{Branching and merging}.
12325
12326 @table @code
12327 @item -b
12328 Create a branch named @var{tag}.  See @ref{Branching and merging}.
12329
12330 @item -c
12331 Check that working files are unmodified.  See
12332 @ref{Tagging the working directory}.
12333
12334 @item -D @var{date}
12335 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
12336
12337 @item -d
12338 Delete @var{tag}.  See @ref{Modifying tags}.
12339
12340 @item -F
12341 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
12342
12343 @item -f
12344 Force a head revision match if tag/date not found.
12345 See @ref{Tagging by date/tag}.
12346
12347 @item -l
12348 Local; run only in current working directory.  See @ref{Recursive behavior}.
12349
12350 @item -R
12351 Operate recursively (default).  @xref{Recursive behavior}.
12352
12353 @item -r @var{tag}[:@var{date}]
12354 Tag the revision already tagged with @var{tag}, or when @var{date} is specified
12355 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12356 existed on @var{date}.  See @ref{Tagging by date/tag} and @ref{Common options}.
12357 @end table
12358
12359 @c ------------------------------------------------------------
12360 @item unedit [@var{options}] [@var{files}@dots{}]
12361 Undo an edit command.  See @ref{Editing files}.
12362
12363 @table @code
12364 @item -l
12365 Local; run only in current working directory.  See @ref{Recursive behavior}.
12366
12367 @item -R
12368 Operate recursively (default).  @xref{Recursive behavior}.
12369 @end table
12370
12371 @c ------------------------------------------------------------
12372 @item update [@var{options}] [@var{files}@dots{}]
12373 Bring work tree in sync with repository.  See
12374 @ref{update}.
12375
12376 @table @code
12377 @item -A
12378 Reset any sticky tags/date/options.  See @ref{Sticky
12379 tags} and @ref{Keyword substitution}.
12380
12381 @item -C
12382 Overwrite locally modified files with clean copies from
12383 the repository (the modified file is saved in
12384 @file{.#@var{file}.@var{revision}}, however).
12385
12386 @item -D @var{date}
12387 Check out revisions as of @var{date} (is sticky).  See
12388 @ref{Common options}.
12389
12390 @item -d
12391 Create directories.  See @ref{update options}.
12392
12393 @item -f
12394 Use head revision if tag/date not found.  See
12395 @ref{Common options}.
12396
12397 @item -I @var{ign}
12398 More files to ignore (! to reset).  See
12399 @ref{import options}.
12400
12401 @c Probably want to use rev1/rev2 style like for diff
12402 @c -r.  Here and in on-line help.
12403 @item -j @var{tag}[:@var{date}]
12404 Merge in changes from revisions specified by @var{tag} or, when @var{date} is
12405 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12406 as it existed on @var{date}.  See @ref{update options}.
12407
12408 @item -k @var{kflag}
12409 Use @var{kflag} keyword expansion.  See
12410 @ref{Substitution modes}.
12411
12412 @item -l
12413 Local; run only in current working directory.  @xref{Recursive behavior}.
12414
12415 @item -P
12416 Prune empty directories.  See @ref{Moving directories}.
12417
12418 @item -p
12419 Check out files to standard output (avoids
12420 stickiness).  See @ref{update options}.
12421
12422 @item -R
12423 Operate recursively (default).  @xref{Recursive
12424 behavior}.
12425
12426 @item -r @var{tag}[:@var{date}]
12427 Checkout the revisions specified by @var{tag} or, when @var{date} is specified
12428 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12429 existed on @var{date}.  See @ref{Common options}.
12430
12431 @item -W @var{spec}
12432 More wrappers.  See @ref{import options}.
12433 @end table
12434
12435 @c ------------------------------------------------------------
12436 @item version
12437 @cindex version (subcommand)
12438
12439 Display the version of @sc{cvs} being used.  If the repository
12440 is remote, display both the client and server versions.
12441
12442 @c ------------------------------------------------------------
12443 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
12444
12445 on/off: turn on/off read-only checkouts of files.  See
12446 @ref{Setting a watch}.
12447
12448 add/remove: add or remove notification on actions.  See
12449 @ref{Getting Notified}.
12450
12451 @table @code
12452 @item -a @var{actions}
12453 Specify actions for temporary watch, where
12454 @var{actions} is @code{edit}, @code{unedit},
12455 @code{commit}, @code{all}, or @code{none}.  See
12456 @ref{Editing files}.
12457
12458 @item -l
12459 Local; run only in current working directory.  See @ref{Recursive behavior}.
12460
12461 @item -R
12462 Operate recursively (default).  @xref{Recursive
12463 behavior}.
12464 @end table
12465
12466 @c ------------------------------------------------------------
12467 @item watchers [@var{options}] [@var{files}@dots{}]
12468 See who is watching a file.  See @ref{Watch information}.
12469
12470 @table @code
12471 @item -l
12472 Local; run only in current working directory.  See @ref{Recursive behavior}.
12473
12474 @item -R
12475 Operate recursively (default).  @xref{Recursive
12476 behavior}.
12477 @end table
12478
12479 @end table
12480
12481 @c ---------------------------------------------------------------------
12482 @node Administrative files
12483 @appendix Reference manual for Administrative files
12484 @cindex Administrative files (reference)
12485 @cindex Files, reference manual
12486 @cindex Reference manual (files)
12487 @cindex CVSROOT (file)
12488
12489 Inside the repository, in the directory
12490 @file{$CVSROOT/CVSROOT}, there are a number of
12491 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
12492 fashion without any of them, but if they are set up
12493 properly they can help make life easier.  For a
12494 discussion of how to edit them, see @ref{Intro
12495 administrative files}.
12496
12497 The most important of these files is the @file{modules}
12498 file, which defines the modules inside the repository.
12499
12500 @menu
12501 * modules::                     Defining modules
12502 * Wrappers::                    Specify binary-ness based on file name
12503 * Trigger Scripts::             Launch scripts in response to server events
12504 * rcsinfo::                     Templates for the log messages
12505 * cvsignore::                   Ignoring files via cvsignore
12506 * checkoutlist::                Adding your own administrative files
12507 * history file::                History information
12508 * Variables::                   Various variables are expanded
12509 * config::                      Miscellaneous CVS configuration
12510 @end menu
12511
12512 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12513 @node modules
12514 @appendixsec The modules file
12515 @cindex Modules (admin file)
12516 @cindex Defining modules (reference manual)
12517
12518 The @file{modules} file records your definitions of
12519 names for collections of source code.  @sc{cvs} will
12520 use these definitions if you use @sc{cvs} to update the
12521 modules file (use normal commands like @code{add},
12522 @code{commit}, etc).
12523
12524 The @file{modules} file may contain blank lines and
12525 comments (lines beginning with @samp{#}) as well as
12526 module definitions.  Long lines can be continued on the
12527 next line by specifying a backslash (@samp{\}) as the
12528 last character on the line.
12529
12530 There are three basic types of modules: alias modules,
12531 regular modules, and ampersand modules.  The difference
12532 between them is the way that they map files in the
12533 repository to files in the working directory.  In all
12534 of the following examples, the top-level repository
12535 contains a directory called @file{first-dir}, which
12536 contains two files, @file{file1} and @file{file2}, and a
12537 directory @file{sdir}.  @file{first-dir/sdir} contains
12538 a file @file{sfile}.
12539
12540 @c FIXME: should test all the examples in this section.
12541
12542 @menu
12543 * Alias modules::             The simplest kind of module
12544 * Regular modules::
12545 * Ampersand modules::
12546 * Excluding directories::     Excluding directories from a module
12547 * Module options::            Regular and ampersand modules can take options
12548 * Module program options::    How the modules ``program options'' programs
12549                               are run. 
12550 @end menu
12551
12552 @node Alias modules
12553 @appendixsubsec Alias modules
12554 @cindex Alias modules
12555 @cindex -a, in modules file
12556
12557 Alias modules are the simplest kind of module:
12558
12559 @table @code
12560 @item @var{mname} -a @var{aliases}@dots{}
12561 This represents the simplest way of defining a module
12562 @var{mname}.  The @samp{-a} flags the definition as a
12563 simple alias: @sc{cvs} will treat any use of @var{mname} (as
12564 a command argument) as if the list of names
12565 @var{aliases} had been specified instead.
12566 @var{aliases} may contain either other module names or
12567 paths.  When you use paths in aliases, @code{checkout}
12568 creates all intermediate directories in the working
12569 directory, just as if the path had been specified
12570 explicitly in the @sc{cvs} arguments.
12571 @end table
12572
12573 For example, if the modules file contains:
12574
12575 @example
12576 amodule -a first-dir
12577 @end example
12578
12579 @noindent
12580 then the following two commands are equivalent:
12581
12582 @example
12583 $ cvs co amodule
12584 $ cvs co first-dir
12585 @end example
12586
12587 @noindent
12588 and they each would provide output such as:
12589
12590 @example
12591 cvs checkout: Updating first-dir
12592 U first-dir/file1
12593 U first-dir/file2
12594 cvs checkout: Updating first-dir/sdir
12595 U first-dir/sdir/sfile
12596 @end example
12597
12598 @node Regular modules
12599 @appendixsubsec Regular modules
12600 @cindex Regular modules
12601
12602 @table @code
12603 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12604 In the simplest case, this form of module definition
12605 reduces to @samp{@var{mname} @var{dir}}.  This defines
12606 all the files in directory @var{dir} as module mname.
12607 @var{dir} is a relative path (from @code{$CVSROOT}) to a
12608 directory of source in the source repository.  In this
12609 case, on checkout, a single directory called
12610 @var{mname} is created as a working directory; no
12611 intermediate directory levels are used by default, even
12612 if @var{dir} was a path involving several directory
12613 levels.
12614 @end table
12615
12616 For example, if a module is defined by:
12617
12618 @example
12619 regmodule first-dir
12620 @end example
12621
12622 @noindent
12623 then regmodule will contain the files from first-dir:
12624
12625 @example
12626 $ cvs co regmodule
12627 cvs checkout: Updating regmodule
12628 U regmodule/file1
12629 U regmodule/file2
12630 cvs checkout: Updating regmodule/sdir
12631 U regmodule/sdir/sfile
12632 $
12633 @end example
12634
12635 By explicitly specifying files in the module definition
12636 after @var{dir}, you can select particular files from
12637 directory @var{dir}.  Here is
12638 an example:
12639
12640 @example
12641 regfiles first-dir/sdir sfile
12642 @end example
12643
12644 @noindent
12645 With this definition, getting the regfiles module
12646 will create a single working directory
12647 @file{regfiles} containing the file listed, which
12648 comes from a directory deeper
12649 in the @sc{cvs} source repository:
12650
12651 @example
12652 $ cvs co regfiles
12653 U regfiles/sfile
12654 $
12655 @end example
12656
12657 @node Ampersand modules
12658 @appendixsubsec Ampersand modules
12659 @cindex Ampersand modules
12660 @cindex &, in modules file
12661
12662 A module definition can refer to other modules by
12663 including @samp{&@var{module}} in its definition.
12664 @example
12665 @var{mname} [ options ] @var{&module}@dots{}
12666 @end example
12667
12668 Then getting the module creates a subdirectory for each such
12669 module, in the directory containing the module.  For
12670 example, if modules contains
12671
12672 @example
12673 ampermod &first-dir
12674 @end example
12675
12676 @noindent
12677 then a checkout will create an @code{ampermod} directory
12678 which contains a directory called @code{first-dir},
12679 which in turns contains all the directories and files
12680 which live there.  For example, the command
12681
12682 @example
12683 $ cvs co ampermod
12684 @end example
12685
12686 @noindent
12687 will create the following files:
12688
12689 @example
12690 ampermod/first-dir/file1
12691 ampermod/first-dir/file2
12692 ampermod/first-dir/sdir/sfile
12693 @end example
12694
12695 There is one quirk/bug: the messages that @sc{cvs}
12696 prints omit the @file{ampermod}, and thus do not
12697 correctly display the location to which it is checking
12698 out the files:
12699
12700 @example
12701 $ cvs co ampermod
12702 cvs checkout: Updating first-dir
12703 U first-dir/file1
12704 U first-dir/file2
12705 cvs checkout: Updating first-dir/sdir
12706 U first-dir/sdir/sfile
12707 $
12708 @end example
12709
12710 Do not rely on this buggy behavior; it may get fixed in
12711 a future release of @sc{cvs}.
12712
12713 @c FIXCVS: What happens if regular and & modules are
12714 @c combined, as in "ampermodule first-dir &second-dir"?
12715 @c When I tried it, it seemed to just ignore the
12716 @c "first-dir".  I think perhaps it should be an error
12717 @c (but this needs further investigation).
12718 @c In addition to discussing what each one does, we
12719 @c should put in a few words about why you would use one or
12720 @c the other in various situations.
12721
12722 @node Excluding directories
12723 @appendixsubsec Excluding directories
12724 @cindex Excluding directories, in modules file
12725 @cindex !, in modules file
12726
12727 An alias module may exclude particular directories from
12728 other modules by using an exclamation mark (@samp{!})
12729 before the name of each directory to be excluded.
12730
12731 For example, if the modules file contains:
12732
12733 @example
12734 exmodule -a !first-dir/sdir first-dir
12735 @end example
12736
12737 @noindent
12738 then checking out the module @samp{exmodule} will check
12739 out everything in @samp{first-dir} except any files in
12740 the subdirectory @samp{first-dir/sdir}.
12741 @c Note that the "!first-dir/sdir" sometimes must be listed
12742 @c before "first-dir".  That seems like a probable bug, in which
12743 @c case perhaps it should be fixed (to allow either
12744 @c order) rather than documented.  See modules4 in testsuite.
12745
12746 @node Module options
12747 @appendixsubsec Module options
12748 @cindex Options, in modules file
12749
12750 Either regular modules or ampersand modules can contain
12751 options, which supply additional information concerning
12752 the module.
12753
12754 @table @code
12755 @cindex -d, in modules file
12756 @item -d @var{name}
12757 Name the working directory something other than the
12758 module name.
12759 @c FIXME: Needs a bunch of examples, analogous to the
12760 @c examples for alias, regular, and ampersand modules
12761 @c which show where the files go without -d.
12762
12763 @cindex Export program
12764 @cindex -e, in modules file
12765 @item -e @var{prog}
12766 Specify a program @var{prog} to run whenever files in a
12767 module are exported.  @var{prog} runs with a single
12768 argument, the module name.
12769 @c FIXME: Is it run on server? client?
12770
12771 @cindex Checkout program
12772 @cindex -o, in modules file
12773 @item -o @var{prog}
12774 Specify a program @var{prog} to run whenever files in a
12775 module are checked out.  @var{prog} runs with a single
12776 argument, the module name.  See @ref{Module program options} for
12777 information on how @var{prog} is called.
12778 @c FIXME: Is it run on server? client?
12779
12780 @cindex Status of a module
12781 @cindex Module status
12782 @cindex -s, in modules file
12783 @item -s @var{status}
12784 Assign a status to the module.  When the module file is
12785 printed with @samp{cvs checkout -s} the modules are
12786 sorted according to primarily module status, and
12787 secondarily according to the module name.  This option
12788 has no other meaning.  You can use this option for
12789 several things besides status: for instance, list the
12790 person that is responsible for this module.
12791
12792 @cindex Tag program
12793 @cindex -t, in modules file
12794 @item -t @var{prog}
12795 Specify a program @var{prog} to run whenever files in a
12796 module are tagged with @code{rtag}.  @var{prog} runs
12797 with two arguments: the module name and the symbolic
12798 tag specified to @code{rtag}.  It is not run
12799 when @code{tag} is executed.  Generally you will find
12800 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
12801 @c FIXME: Is it run on server? client?
12802 @c Problems with -t include:
12803 @c * It is run after the tag not before
12804 @c * It doesn't get passed all the information that
12805 @c   taginfo does ("mov", &c).
12806 @c * It only is run for rtag, not tag.
12807 @end table
12808
12809 You should also see @pxref{Module program options} about how the
12810 ``program options'' programs are run.
12811
12812 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12813
12814 @node Module program options
12815 @appendixsubsec How the modules file ``program options'' programs are run
12816 @cindex Modules file program options
12817 @cindex -t, in modules file
12818 @cindex -o, in modules file
12819 @cindex -e, in modules file
12820
12821 @noindent
12822 For checkout, rtag, and export, the program is server-based, and as such the
12823 following applies:-
12824
12825 If using remote access methods (pserver, ext, etc.),
12826 @sc{cvs} will execute this program on the server from a temporary
12827 directory. The path is searched for this program.
12828
12829 If using ``local access'' (on a local or remote NFS file system, i.e.
12830 repository set just to a path),
12831 the program will be executed from the newly checked-out tree, if
12832 found there, or alternatively searched for in the path if not.
12833
12834 The programs are all run after the operation has effectively
12835 completed.
12836
12837
12838 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12839 @node Wrappers
12840 @appendixsec The cvswrappers file
12841 @cindex cvswrappers (admin file)
12842 @cindex CVSWRAPPERS, environment variable
12843 @cindex Wrappers
12844
12845 @c FIXME: need some better way of separating this out
12846 @c by functionality.  -m is
12847 @c one feature, and -k is a another.  And this discussion
12848 @c should be better motivated (e.g. start with the
12849 @c problems, then explain how the feature solves it).
12850
12851 Wrappers refers to a @sc{cvs} feature which lets you
12852 control certain settings based on the name of the file
12853 which is being operated on.  The settings are @samp{-k}
12854 for binary files, and @samp{-m} for nonmergeable text
12855 files.
12856
12857 The @samp{-m} option
12858 specifies the merge methodology that should be used when
12859 a non-binary file is updated.  @code{MERGE} means the usual
12860 @sc{cvs} behavior: try to merge the files.  @code{COPY}
12861 means that @code{cvs update} will refuse to merge
12862 files, as it also does for files specified as binary
12863 with @samp{-kb} (but if the file is specified as
12864 binary, there is no need to specify @samp{-m 'COPY'}).
12865 @sc{cvs} will provide the user with the
12866 two versions of the files, and require the user using
12867 mechanisms outside @sc{cvs}, to insert any necessary
12868 changes.
12869
12870 @strong{WARNING: do not use @code{COPY} with
12871 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
12872 copy one version of your file over the other, wiping
12873 out the previous contents.}
12874 @c Ordinarily we don't document the behavior of old
12875 @c versions.  But this one is so dangerous, I think we
12876 @c must.  I almost renamed it to -m 'NOMERGE' so we
12877 @c could say "never use -m 'COPY'".
12878 The @samp{-m} wrapper option only affects behavior when
12879 merging is done on update; it does not affect how files
12880 are stored.  See @ref{Binary files}, for more on
12881 binary files.
12882
12883 The basic format of the file @file{cvswrappers} is:
12884
12885 @c FIXME: @example is all wrong for this.  Use @deffn or
12886 @c something more sensible.
12887 @example
12888 wildcard     [option value][option value]...
12889
12890 where option is one of
12891 -m           update methodology      value: MERGE or COPY
12892 -k           keyword expansion       value: expansion mode
12893
12894 and value is a single-quote delimited value.
12895 @end example
12896
12897 @ignore
12898 @example
12899 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
12900 *.c      -t 'indent %s %s'
12901 @end example
12902 @c When does the filter need to be an absolute pathname
12903 @c and when will something like the above work?  I
12904 @c suspect it relates to the PATH of the server (which
12905 @c in turn depends on all kinds of stuff, e.g. inetd
12906 @c for pserver).  I'm not sure whether/where to discuss
12907 @c this.
12908 @c FIXME: What do the %s's stand for?
12909
12910 @noindent
12911 The above example of a @file{cvswrappers} file
12912 states that all files/directories that end with a @code{.nib}
12913 should be filtered with the @file{wrap} program before
12914 checking the file into the repository. The file should
12915 be filtered though the @file{unwrap} program when the
12916 file is checked out of the repository. The
12917 @file{cvswrappers} file also states that a @code{COPY}
12918 methodology should be used when updating the files in
12919 the repository (that is, no merging should be performed).
12920
12921 @c What pitfalls arise when using indent this way?  Is
12922 @c it a winning thing to do?  Would be nice to at least
12923 @c hint at those issues; we want our examples to tell
12924 @c how to solve problems, not just to say that cvs can
12925 @c do certain things.
12926 The last example line says that all files that end with
12927 @code{.c} should be filtered with @file{indent}
12928 before being checked into the repository. Unlike the previous
12929 example, no filtering of the @code{.c} file is done when
12930 it is checked out of the repository.
12931 @noindent
12932 The @code{-t} filter is called with two arguments,
12933 the first is the name of the file/directory to filter
12934 and the second is the pathname to where the resulting
12935 filtered file should be placed.
12936
12937 @noindent
12938 The @code{-f} filter is called with one argument,
12939 which is the name of the file to filter from. The end
12940 result of this filter will be a file in the users directory
12941 that they can work on as they normally would.
12942
12943 Note that the @samp{-t}/@samp{-f} features do not
12944 conveniently handle one portion of @sc{cvs}'s operation:
12945 determining when files are modified.  @sc{cvs} will still
12946 want a file (or directory) to exist, and it will use
12947 its modification time to determine whether a file is
12948 modified.  If @sc{cvs} erroneously thinks a file is
12949 unmodified (for example, a directory is unchanged but
12950 one of the files within it is changed), you can force
12951 it to check in the file anyway by specifying the
12952 @samp{-f} option to @code{cvs commit} (@pxref{commit
12953 options}).
12954 @c This is, of course, a serious design flaw in -t/-f.
12955 @c Probably the whole functionality needs to be
12956 @c redesigned (starting from requirements) to fix this.
12957 @end ignore
12958
12959 @c FIXME: We don't document -W or point to where it is
12960 @c documented.  Or .cvswrappers.
12961 For example, the following command imports a
12962 directory, treating files whose name ends in
12963 @samp{.exe} as binary:
12964
12965 @example
12966 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
12967 @end example
12968
12969 @c Another good example, would be storing files
12970 @c (e.g. binary files) compressed in the repository.
12971 @c      ::::::::::::::::::
12972 @c      cvswrappers
12973 @c      ::::::::::::::::::
12974 @c      *.t12 -m 'COPY'
12975 @c      *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
12976 @c
12977 @c      ::::::::::::::::::
12978 @c      gunzipcp
12979 @c      ::::::::::::::::::
12980 @c      :
12981 @c      [ -f $1 ] || exit 1
12982 @c      zcat $1 > /tmp/.#$1.$$
12983 @c      mv /tmp/.#$1.$$ $1
12984 @c
12985 @c      ::::::::::::::::::
12986 @c      gzipcp
12987 @c      ::::::::::::::::::
12988 @c      :
12989 @c      DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
12990 @c      if [ ! -d $DIRNAME ] ; then
12991 @c            DIRNAME=`echo $1 | sed -e "s|.*/||g"`
12992 @c      fi
12993 @c      gzip -c  $DIRNAME  > $2
12994 @c One catch--"cvs diff" will not invoke the wrappers
12995 @c (probably a CVS bug, although I haven't thought it out).
12996
12997 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12998 @node Trigger Scripts
12999 @appendixsec The Trigger Scripts
13000 @cindex info files
13001 @cindex trigger scripts
13002 @cindex script hooks
13003
13004 @c FIXME
13005 @c Somewhere there needs to be a more "how-to" guide to writing these.
13006 @c One particular issue that people sometimes are worried about is performance,
13007 @c and the impact of writing in perl or sh or ____.  Performance comparisons
13008 @c should probably remain outside the scope of this document, but at least
13009 @c _that_ much could be referenced, perhaps with links to other sources.
13010
13011 Several of the administrative files support triggers, or the launching external
13012 scripts or programs at specific times before or after particular events, during
13013 the execution of @sc{cvs} commands.  These hooks can be used to prevent certain
13014 actions, log them, and/or maintain anything else you deem practical.
13015
13016 All the trigger scripts are launched in a copy of the user sandbox being
13017 committed, on the server, in client-server mode.  In local mode, the scripts
13018 are actually launched directly from the user sandbox directory being committed.
13019 For most intents and purposes, the same scripts can be run in both locations
13020 without alteration.
13021
13022 @menu
13023 * syntax::                      The common syntax
13024 * Trigger Script Security::     Trigger script security
13025
13026 * commit files::                The commit support files (commitinfo,
13027                                 verifymsg, loginfo)
13028 *   commitinfo::                Pre-commit checking
13029 *   verifymsg::                 How are log messages evaluated?
13030 *   loginfo::                   Where should log messages be sent?
13031
13032 * postadmin::                   Logging admin commands
13033 * taginfo::                     Verifying/Logging tags
13034 * posttag::                     Logging tags
13035 * postwatch::                   Logging watch commands
13036
13037 * preproxy::                    Launch a script on a secondary server prior
13038                                 to becoming a write proxy
13039 * postproxy::                   Launch a script on a secondary server after
13040                                 completing proxy operations
13041 @end menu
13042
13043 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13044 @node syntax
13045 @appendixsubsec The common syntax
13046 @cindex info files, common syntax
13047 @cindex script hooks, common syntax
13048 @cindex trigger script hooks, common syntax
13049 @cindex syntax of trigger script hooks
13050
13051 @c FIXME: having this so totally separate from the
13052 @c Variables node is rather bogus.
13053
13054 The administrative files such as @file{commitinfo},
13055 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
13056 all have a common format.  The purpose of the files are
13057 described later on.  The common syntax is described
13058 here.
13059
13060 @cindex Regular expression syntax
13061 Each line contains the following:
13062
13063 @itemize @bullet
13064 @cindex @samp{ALL} keyword, in lieu of regular expressions in script hooks
13065 @cindex @samp{DEFAULT} keyword, in lieu of regular expressions in script hooks
13066 @item
13067 A regular expression or the literal string @samp{DEFAULT}.  Some script hooks
13068 also support the literal string @samp{ALL}.  Other than the @samp{ALL} and
13069 @samp{DEFAULT} keywords, this is a basic regular expression in the syntax used
13070 by GNU emacs.  See the descriptions of the individual script hooks for
13071 information on whether the @samp{ALL} keyword is supported
13072 (@pxref{Trigger Scripts}).
13073 @c FIXME: What we probably should be saying is "POSIX Basic
13074 @c Regular Expression with the following extensions (`\('
13075 @c `\|' '+' etc)"
13076 @c rather than define it with reference to emacs.
13077 @c The reference to emacs is not strictly speaking
13078 @c true, as we don't support \=, \s, or \S.  Also it isn't
13079 @c clear we should document and/or promise to continue to
13080 @c support all the obscure emacs extensions like \<.
13081 @c Also need to better cite (or include) full
13082 @c documentation for the syntax.
13083 @c Also see comment in configure.in about what happens to the
13084 @c syntax if we pick up a system-supplied regexp matcher.
13085
13086 @item
13087 A whitespace separator---one or more spaces and/or tabs.
13088
13089 @item
13090 A file name or command-line template.
13091 @end itemize
13092
13093 @noindent
13094 Blank lines are ignored.  Lines that start with the
13095 character @samp{#} are treated as comments.  Long lines
13096 unfortunately can @emph{not} be broken in two parts in
13097 any way.
13098
13099 The first regular expression that matches the current
13100 directory name in the repository or the first line containing @samp{DEFAULT}
13101 in lieu of a regular expression is used and all lines containing @samp{ALL} is
13102 used for the hooks which support the @samp{ALL} keyword.  The rest of the line
13103 is used as a file name or command-line template as appropriate.  See the
13104 descriptions of the individual script hooks for information on whether the
13105 @samp{ALL} keyword is supported (@pxref{Trigger Scripts}).
13106
13107 @cindex format strings
13108 @cindex format strings, common syntax
13109 @cindex info files, common syntax, format strings
13110 @cindex Common syntax of info files, format strings
13111 @noindent
13112 @emph{Note:  The following information on format strings is valid
13113 as long as the line @code{UseNewInfoFmtStrings=yes} appears in
13114 your repository's config file (@pxref{config}).  Otherwise,
13115 default format strings may be appended to the command line and
13116 the @samp{loginfo} file, especially, can exhibit slightly
13117 different behavior.  For more information,
13118 @xref{Updating Commit Files}.}
13119
13120 In the cases where the second segment of the matched line is a
13121 command line template (e.g. @file{commitinfo}, @file{loginfo},
13122 & @file{verifymsg}), the command line template may contain format
13123 strings which will be replaced with specific values before the
13124 script is run.
13125 @c FIXCVS then FIXME - it really would make sense to allow %r & maybe even %p
13126 @c to be used in rcsinfo to construct a path, but I haven't
13127 @c coded this yet.
13128
13129 Format strings can represent a single variable or one or more
13130 attributes of a list variable.  An example of a list variable
13131 would be the list available to scripts hung on the loginfo hooks
13132 - the list of files which were just committed.  In the case of
13133 loginfo, three attributes are available for each list item: file
13134 name, precommit version, and postcommit version.
13135
13136 Format strings consist of a @samp{%} character followed by an optional
13137 @samp{@{} (required in the multiple list attribute case), a
13138 single format character representing a variable or a single attribute of
13139 list elements or multiple format characters representing attributes of
13140 list elements, and a closing @samp{@}} when the open bracket was present.
13141
13142 @emph{Flat format strings}, or single format characters which get replaced
13143 with a single value, will generate a single argument
13144 to the called script, regardless of whether the replacement variable contains
13145 white space or other special characters.
13146
13147 @emph{List attributes} will generate an argument for each attribute
13148 requested for each list item.  For example, @samp{%@{sVv@}}
13149 in a @file{loginfo} command template will generate three
13150 arguments (file name, precommit version, postcommit version,
13151 ...) for each file committed.  As in the flat format string
13152 case, each attribute will be passed in as a single argument
13153 regardless of whether it contains white space or other
13154 special characters.
13155  
13156 @samp{%%} will be replaced with a literal @samp{%}.
13157
13158 The format strings available to all script hooks are:
13159
13160 @table @t
13161 @item c
13162 The canonical name of the command being executed.  For instance, in the case of
13163 a hook run from @code{cvs up}, @sc{cvs} would replace @samp{%c} with the string
13164 @samp{update} and, in the case of a hook run from @code{cvs ci}, @sc{cvs} would
13165 replace @samp{%c} with the string @samp{commit}.
13166 @item n
13167 The null, or empty, string.
13168 @item p
13169 The name of the directory being operated on within the repository.
13170 @item r
13171 The name of the repository (the path portion of @code{$CVSROOT}).
13172 @item R
13173 On a server, the name of the referrer, if any.  The referrer is the CVSROOT the
13174 client reports it used to contact a server which then referred it to this
13175 server.  Should usually be set on a primary server with a write proxy setup.
13176 @end table
13177
13178 Other format strings are file specific.  See the docs on the
13179 particular script hooks for more information
13180 (@pxref{Trigger Scripts}).
13181
13182 As an example, the following line in a @file{loginfo} file would
13183 match only the directory @file{module} and any subdirectories of
13184 @file{module}:
13185
13186 @example
13187 ^module\(/\|$\) (echo; echo %p; echo %@{sVv@}; cat) >>$CVSROOT/CVSROOT/commitlog
13188 @end example
13189
13190 Using this same line and assuming a commit of new revisions
13191 1.5.4.4 and 1.27.4.1 based on old revisions 1.5.4.3 and 1.27,
13192 respectively, of file1 and file2 in module, something like the
13193 following log message should be appended to commitlog:
13194
13195 @example
13196
13197 module
13198 file1 1.5.4.3 1.5.4.4 file2 1.27 1.27.4.1
13199 Update of /cvsroot/module
13200 In directory localhost.localdomain:/home/jrandom/work/module
13201
13202 Modified Files:
13203         file1 file2
13204 Log Message:
13205 A log message.
13206 @end example
13207
13208 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13209 @node Trigger Script Security
13210 @appendixsubsec Security and the Trigger Scripts
13211 @cindex info files, security
13212 @cindex script hooks, security
13213 @cindex trigger scripts, security
13214
13215 Security is a huge subject, and implementing a secure system is a non-trivial
13216 task.  This section will barely touch on all the issues involved, but it is
13217 well to note that, as with any script you will be allowing an untrusted
13218 user to run on your server, there are measures you can take to help prevent
13219 your trigger scripts from being abused.
13220
13221 For instance, since the CVS trigger scripts all run in a copy of the user's
13222 sandbox on the server, a naively coded Perl trigger script which attempts to
13223 use a Perl module that is not installed on the system can be hijacked by any
13224 user with commit access who is checking in a file with the correct name.  Other
13225 scripting languages may be vulnerable to similar hacks.
13226
13227 One way to make a script more secure, at least with Perl, is to use scripts
13228 which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
13229 In the most basic terms, this causes Perl to avoid running code that may have
13230 come from an external source.  Please run the @code{perldoc perlsec} command
13231 for more on Perl security.  Again, other languages may implement other security
13232 verification hooks which look more or less like Perl's "taint-check" mechanism.
13233
13234 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13235 @node commit files
13236 @appendixsubsec The commit support files
13237 @cindex Commits, administrative support files
13238 @cindex commit files, see Info files
13239
13240 The @samp{-i} flag in the @file{modules} file can be
13241 used to run a certain program whenever files are
13242 committed (@pxref{modules}).  The files described in
13243 this section provide other, more flexible, ways to run
13244 programs whenever something is committed.
13245
13246 There are three kinds of programs that can be run on
13247 commit.  They are specified in files in the repository,
13248 as described below.  The following table summarizes the
13249 file names and the purpose of the corresponding
13250 programs.
13251
13252 @table @file
13253 @item commitinfo
13254 The program is responsible for checking that the commit
13255 is allowed.  If it exits with a non-zero exit status
13256 the commit will be aborted.  @xref{commitinfo}.
13257
13258 @item verifymsg
13259 The specified program is used to evaluate the log message,
13260 and possibly verify that it contains all required
13261 fields.  This is most useful in combination with the
13262 @file{rcsinfo} file, which can hold a log message
13263 template (@pxref{rcsinfo}).  @xref{verifymsg}.
13264
13265 @item loginfo
13266 The specified program is called when the commit is
13267 complete.  It receives the log message and some
13268 additional information and can store the log message in
13269 a file, or mail it to appropriate persons, or maybe
13270 post it to a local newsgroup, or@dots{}  Your
13271 imagination is the limit!  @xref{loginfo}.
13272 @end table
13273
13274 @menu
13275 * Updating Commit Files::       Updating legacy repositories to stop using
13276                                 deprecated command line template formats
13277 @end menu
13278
13279 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13280 @node Updating Commit Files
13281 @appendixsubsubsec  Updating legacy repositories to stop using deprecated command line template formats
13282 @cindex info files, common syntax, updating legacy repositories
13283 @cindex Syntax of info files, updating legacy repositories
13284 @cindex Common syntax of info files, updating legacy repositories
13285 New repositories are created set to use the new format strings by default, so
13286 if you are creating a new repository, you shouldn't have to worry about this
13287 section.
13288
13289 If you are attempting to maintain a legacy repository which was
13290 making use of the @file{commitinfo}, @file{editinfo}, @file{verifymsg},
13291 @file{loginfo}, and/or @file{taginfo} script hooks, you should have no
13292 immediate problems with using the current @sc{cvs} executable, but your users
13293 will probably start to see deprecation warnings.
13294
13295 The reason for this is that all of the script hooks have been updated to
13296 use a new command line parser that extensibly supports multiple
13297 @file{loginfo} & @file{notify} style format strings (@pxref{syntax})
13298 and this support is not completely compatible with the old style format
13299 strings.
13300
13301 The quick upgrade method is to stick a @samp{1} after each format string
13302 in your old @file{loginfo} file.  For example:
13303
13304 @example
13305 DEFAULT (echo ""; id; echo %@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13306 @end example
13307
13308 would become:
13309
13310 @example
13311 DEFAULT (echo ""; id; echo %1@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13312 @end example
13313
13314 If you were counting on the fact that only the first @samp{%} in the line was
13315 replaced as a format string, you may also have to double up any further
13316 percent signs on the line.
13317
13318 If you did this all at once and checked it in, everything should still be
13319 running properly.
13320
13321 Now add the following line to your config file (@pxref{config}):
13322 @example
13323 UseNewInfoFmtStrings=yes
13324 @end example
13325
13326 Everything should still be running properly, but your users will probably
13327 start seeing new deprecation warnings.
13328   
13329 Dealing with the deprecation warnings now generated by @file{commitinfo},
13330 @file{editinfo}, @file{verifymsg}, and @file{taginfo} should be easy.  Simply
13331 specify what are currently implicit arguments explicitly.  This means appending
13332 the following strings to each active command line template in each file:
13333 @table @code
13334 @item commitinfo
13335 @samp{ %r/%p %s}
13336 @item editinfo
13337 @samp{ %l}
13338 @item taginfo
13339 @samp{ %t %o %p %@{sv@}}
13340 @item verifymsg
13341 @samp{ %l}
13342 @end table
13343
13344 If you don't desire that any of the newly available information be passed to
13345 the scripts hanging off of these hooks, no further modifications to these
13346 files should be necessary to insure current and future compatibility with
13347 @sc{cvs}'s format strings.
13348
13349 Fixing @file{loginfo} could be a little tougher.  The old style
13350 @file{loginfo} format strings caused a single space and comma separated
13351 argument to be passed in in place of the format string.  This is what will
13352 continue to be generated due to the deprecated @samp{1} you inserted into
13353 the format strings.
13354
13355 Since the new format separates each individual item and passes it into the
13356 script as a separate argument (for a good reason - arguments containing commas
13357 and/or white space are now parsable), to remove the deprecated @samp{1} from
13358 your @file{loginfo} command line templates, you will most likely have to
13359 rewrite any scripts called by the hook to handle the new argument format.
13360
13361 Also note that the way @samp{%} followed by unrecognized characters and by
13362 @samp{@{@}} was treated in past versions of CVS is not strictly adhered to as
13363 there were bugs in the old versions.  Specifically, @samp{%@{@}} would eat the
13364 next character and unrecognized strings resolved only to the empty string,
13365 which was counter to what was stated in the documentation.  This version will
13366 do what the documentation said it should have (if you were using only some
13367 combination of @samp{%@{sVv@}}, e.g. @samp{%@{sVv@}}, @samp{%@{sV@}}, or
13368 @samp{%v}, you should have no troubles).
13369
13370 On the bright side, you should have plenty of time to do this before all
13371 support for the old format strings is removed from @sc{cvs}, so you can just
13372 put up with the deprecation warnings for awhile if you like.
13373
13374 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13375 @node commitinfo
13376 @appendixsubsec Commitinfo
13377 @cindex @file{commitinfo}
13378 @cindex Commits, precommit verification of
13379 @cindex commitinfo (admin file)
13380 @cindex info files, commitinfo
13381 @cindex script hooks, commitinfo
13382 @cindex trigger scripts, commitinfo
13383 @cindex info files, precommit verification of commits
13384 @cindex script hooks, precommit verification of commits
13385 @cindex trigger scripts, precommit verification of commits
13386
13387 The @file{commitinfo} file defines programs to execute
13388 whenever @samp{cvs commit} is about to execute.  These
13389 programs are used for pre-commit checking to verify
13390 that the modified, added and removed files are really
13391 ready to be committed.  This could be used, for
13392 instance, to verify that the changed files conform to
13393 to your site's standards for coding practice.
13394
13395 The @file{commitinfo} file has the standard form for script hooks
13396 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13397 a command to execute.  It supports only the DEFAULT keywords.
13398
13399 @cindex format strings, commitinfo admin file
13400 In addition to the common format strings (@pxref{syntax}),
13401 @file{commitinfo} supports:
13402
13403 @table @t
13404 @item @{s@}
13405 a list of the names of files to be committed
13406 @end table
13407
13408 @cindex commitinfo (admin file), updating legacy repositories
13409 @cindex compatibility notes, commitinfo admin file
13410 Currently, if no format strings are specified, a default
13411 string of @samp{ %r/%p %@{s@}} will be appended to the command
13412 line template before replacement is performed, but this
13413 feature is deprecated.  It is simply in place so that legacy
13414 repositories will remain compatible with the new @sc{cvs} application.
13415 For information on updating, @pxref{Updating Commit Files}.
13416
13417 @cindex Exit status, of commitinfo
13418 @cindex commitinfo (admin file), exit status
13419 The first line with a regular expression matching the
13420 directory within the repository will be used.  If the
13421 command returns a non-zero exit status the commit will
13422 be aborted.
13423 @c FIXME: need example(s) of what "directory within the
13424 @c repository" means.
13425
13426 @cindex @file{commitinfo}, working directory
13427 @cindex @file{commitinfo}, command environment
13428 The command will be run in the root of the workspace
13429 containing the new versions of any files the user would like
13430 to modify (commit), @emph{or in a copy of the workspace on
13431 the server (@pxref{Remote repositories})}.  If a file is
13432 being removed, there will be no copy of the file under the
13433 current directory.  If a file is being added, there will be
13434 no corresponding archive file in the repository unless the
13435 file is being resurrected.
13436
13437 Note that both the repository directory and the corresponding
13438 Attic (@pxref{Attic}) directory may need to be checked to
13439 locate the archive file corresponding to any given file being
13440 committed.  Much of the information about the specific commit
13441 request being made, including the destination branch, commit
13442 message, and command line options specified, is not available
13443 to the command.
13444
13445 @c FIXME: should discuss using commitinfo to control
13446 @c who has checkin access to what (e.g. Joe can check into
13447 @c directories a, b, and c, and Mary can check into
13448 @c directories b, c, and d--note this case cannot be
13449 @c conveniently handled with unix groups).  Of course,
13450 @c adding a new set of features to CVS might be a more
13451 @c natural way to fix this problem than telling people to
13452 @c use commitinfo.
13453 @c FIXME: Should make some reference, especially in
13454 @c the context of controlling who has access, to the fact
13455 @c that commitinfo can be circumvented.  Perhaps
13456 @c mention SETXID (but has it been carefully examined
13457 @c for holes?).  This fits in with the discussion of
13458 @c general CVS security in "Password authentication
13459 @c security" (the bit which is not pserver-specific).
13460
13461 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13462 @node verifymsg
13463 @appendixsubsec Verifying log messages
13464 @cindex @file{verifymsg} (admin file)
13465 @cindex Log message, verifying
13466 @cindex logging, commits
13467
13468 Once you have entered a log message, you can evaluate
13469 that message to check for specific content, such as
13470 a bug ID.  Use the @file{verifymsg} file to
13471 specify a program that is used to verify the log message.
13472 This program could be a simple script that checks
13473 that the entered message contains the required fields.
13474
13475 The @file{verifymsg} file is often most useful together
13476 with the @file{rcsinfo} file, which can be used to
13477 specify a log message template (@pxref{rcsinfo}).
13478
13479 The @file{verifymsg} file has the standard form for script hooks
13480 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13481 a command to execute.  It supports only the DEFAULT keywords.
13482
13483 @cindex format strings, verifymsg admin file
13484 In addition to the common format strings (@pxref{syntax}),
13485 @file{verifymsg} supports:
13486
13487 @table @t
13488 @item l
13489 the full path to the file containing the log message to be verified
13490 @end table
13491
13492 @cindex verifymsg (admin/commit file), updating legacy repositories
13493 @cindex compatibility notes, verifymsg admin file
13494 Currently, if no format strings are specified, a default
13495 string of @samp{ %l} will be appended to the command
13496 line template before replacement is performed, but this
13497 feature is deprecated.  It is simply in place so that legacy
13498 repositories will remain compatible with the new @sc{cvs} application.
13499 For information on updating, @pxref{Updating Commit Files}.
13500
13501 One thing that should be noted is that the @samp{ALL}
13502 keyword is not supported.  If more than one matching
13503 line is found, the first one is used.  This can be
13504 useful for specifying a default verification script in a
13505 directory, and then overriding it in a subdirectory.
13506
13507 @cindex Exit status, of @file{verifymsg}
13508 If the verification script exits with a non-zero exit status,
13509 the commit is aborted.
13510
13511 @cindex @file{verifymsg}, changing the log message
13512 In the default configuration, CVS allows the
13513 verification script to change the log message. This is
13514 controlled via the RereadLogAfterVerify CVSROOT/config
13515 option.
13516
13517 When @samp{RereadLogAfterVerify=always} or
13518 @samp{RereadLogAfterVerify=stat}, the log message will
13519 either always be reread after the verification script
13520 is run or reread only if the log message file status
13521 has changed.
13522
13523 @xref{config}, for more on CVSROOT/config options.
13524
13525 It is NOT a good idea for a @file{verifymsg} script to
13526 interact directly with the user in the various
13527 client/server methods. For the @code{pserver} method,
13528 there is no protocol support for communicating between
13529 @file{verifymsg} and the client on the remote end. For the
13530 @code{ext} and @code{server} methods, it is possible
13531 for CVS to become confused by the characters going
13532 along the same channel as the CVS protocol
13533 messages. See @ref{Remote repositories}, for more
13534 information on client/server setups.  In addition, at the time
13535 the @file{verifymsg} script runs, the CVS
13536 server has locks in place in the repository.  If control is
13537 returned to the user here then other users may be stuck waiting
13538 for access to the repository.
13539
13540 This option can be useful if you find yourself using an
13541 rcstemplate that needs to be modified to remove empty
13542 elements or to fill in default values.  It can also be
13543 useful if the rcstemplate has changed in the repository
13544 and the CVS/Template was not updated, but is able to be
13545 adapted to the new format by the verification script
13546 that is run by @file{verifymsg}.
13547
13548 An example of an update might be to change all
13549 occurrences of 'BugId:' to be 'DefectId:' (which can be
13550 useful if the rcstemplate has recently been changed and
13551 there are still checked-out user trees with cached
13552 copies in the CVS/Template file of the older version).
13553
13554 Another example of an update might be to delete a line
13555 that contains 'BugID: none' from the log message after
13556 validation of that value as being allowed is made.
13557
13558 @menu
13559 * verifymsg example::            Verifymsg example
13560 @end menu
13561
13562 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13563 @node verifymsg example
13564 @appendixsubsubsec Verifying log messages
13565 @cindex verifymsg, example
13566 The following is a little silly example of a
13567 @file{verifymsg} file, together with the corresponding
13568 @file{rcsinfo} file, the log message template and a
13569 verification script.  We begin with the log message template.
13570 We want to always record a bug-id number on the first
13571 line of the log message.  The rest of log message is
13572 free text.  The following template is found in the file
13573 @file{/usr/cvssupport/tc.template}.
13574
13575 @example
13576 BugId:
13577 @end example
13578
13579 The script @file{/usr/cvssupport/bugid.verify} is used to
13580 evaluate the log message.
13581
13582 @example
13583 #!/bin/sh
13584 #
13585 #       bugid.verify filename
13586 #
13587 #  Verify that the log message contains a valid bugid
13588 #  on the first line.
13589 #
13590 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
13591     exit 0
13592 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
13593     # It is okay to allow commits with 'BugId: none',
13594     # but do not put that text into the real log message.
13595     grep -v '^BugId:[ ]*none$' > $1.rewrite
13596     mv $1.rewrite $1
13597     exit 0
13598 else
13599     echo "No BugId found."
13600     exit 1
13601 fi
13602 @end example
13603
13604 The @file{verifymsg} file contains this line:
13605
13606 @example
13607 ^tc     /usr/cvssupport/bugid.verify %l
13608 @end example
13609
13610 The @file{rcsinfo} file contains this line:
13611
13612 @example
13613 ^tc     /usr/cvssupport/tc.template
13614 @end example
13615
13616 The @file{config} file contains this line:
13617
13618 @example
13619 RereadLogAfterVerify=always
13620 @end example
13621
13622
13623
13624 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13625 @node loginfo
13626 @appendixsubsec Loginfo
13627 @cindex loginfo (admin file)
13628 @cindex logging, commits
13629 @cindex Storing log messages
13630 @cindex Mailing log messages
13631 @cindex Distributing log messages
13632 @cindex Log messages
13633
13634 The @file{loginfo} file is used to control where log information is sent after
13635 versioned changes are made to repository archive files and after directories
13636 are added ot the repository.  @ref{posttag} for how to log tagging
13637 information and @ref{postadmin} for how to log changes due to the @code{admin}
13638 command.
13639
13640 The @file{loginfo} file has the standard form for script hooks
13641 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13642 a command to execute.  It supports the ALL and DEFAULT keywords.
13643
13644 Any specified scripts are called:
13645
13646 @table @code
13647 @item commit
13648 Once per directory, immediately after a successfully completing the commit of
13649 all files within that directory.
13650 @item import
13651 Once per import, immediately after completion of all write operations.
13652 @item add
13653 Immediately after the successful @code{add} of a directory.
13654 @end table
13655
13656 Any script called via @file{loginfo} will be fed the log information on its
13657 standard input.  Note that the filter program @strong{must} read @strong{all}
13658 of the log information from its standard input or @sc{cvs} may fail with a
13659 broken pipe signal.
13660
13661 @cindex format strings, loginfo admin file
13662 In addition to the common format strings (@pxref{syntax}),
13663 @file{loginfo} supports:
13664
13665 @table @t
13666 @item @{sVv@}
13667 File attributes, where:
13668 @table @t
13669 @item s
13670 file name
13671 @item V
13672 old version number (pre-checkin)
13673 @item v
13674 new version number (post-checkin)
13675 @end table
13676 @end table
13677
13678 For example, some valid format strings are @samp{%%},
13679 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13680
13681 @cindex loginfo (admin file), updating legacy repositories
13682 @cindex compatibility notes, loginfo admin file
13683 Currently, if @samp{UseNewInfoFmtStrings} is not set in the @file{config}
13684 administration file (@pxref{config}), the format strings will be substituted
13685 as they were in past versions of @sc{cvs}, but this feature is deprecated.
13686 It is simply in place so that legacy repositories will remain compatible with
13687 the new @sc{cvs} application.  For information on updating,
13688 please see @ref{Updating Commit Files}.
13689
13690 As an example, if @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%p}
13691 and @samp{%@{sVv@}} are the format strings, and three files (@t{ChangeLog},
13692 @t{Makefile}, @t{foo.c}) were modified, the output might be:
13693
13694 @example
13695 yoyodyne/tc ChangeLog 1.1 1.2 Makefile 1.3 1.4 foo.c 1.12 1.13
13696 @end example
13697
13698 Note: when @sc{cvs} is accessing a remote repository,
13699 @file{loginfo} will be run on the @emph{remote}
13700 (i.e., server) side, not the client side (@pxref{Remote
13701 repositories}).
13702
13703 @menu
13704 * loginfo example::                          Loginfo example
13705 * Keeping a checked out copy::               Updating a tree on every checkin
13706 @end menu
13707
13708 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13709 @node loginfo example
13710 @appendixsubsubsec Loginfo example
13711
13712 The following @file{loginfo} file, together with the
13713 tiny shell-script below, appends all log messages
13714 to the file @file{$CVSROOT/CVSROOT/commitlog},
13715 and any commits to the administrative files (inside
13716 the @file{CVSROOT} directory) are also logged in
13717 @file{/usr/adm/cvsroot-log}.
13718 Commits to the @file{prog1} directory are mailed to @t{ceder}.
13719
13720 @c FIXME: is it a CVS feature or bug that only the
13721 @c first matching line is used?  It is documented
13722 @c above, but is it useful?  For example, if we wanted
13723 @c to run both "cvs-log" and "Mail" for the CVSROOT
13724 @c directory, it is kind of awkward if
13725 @c only the first matching line is used.
13726 @example
13727 ALL                     /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
13728 ^CVSROOT\(/\|$\)        /usr/local/bin/cvs-log /usr/adm/cvsroot-log $USER
13729 ^prog1\(/\|$\)          Mail -s "%p %s" ceder
13730 @end example
13731
13732 The shell-script @file{/usr/local/bin/cvs-log} looks
13733 like this:
13734
13735 @example
13736 #!/bin/sh
13737 (echo "------------------------------------------------------";
13738  echo -n "$2  ";
13739  date;
13740  echo;
13741  cat) >> $1
13742 @end example
13743
13744
13745
13746 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13747 @node Keeping a checked out copy
13748 @appendixsubsubsec Keeping a checked out copy
13749
13750 @c What other index entries?  It seems like
13751 @c people might want to use a lot of different
13752 @c words for this functionality.
13753 @cindex Keeping a checked out copy
13754 @cindex Checked out copy, keeping
13755 @cindex Web pages, maintaining with CVS
13756
13757 It is often useful to maintain a directory tree which
13758 contains files which correspond to the latest version
13759 in the repository.  For example, other developers might
13760 want to refer to the latest sources without having to
13761 check them out, or you might be maintaining a web site
13762 with @sc{cvs} and want every checkin to cause the files
13763 used by the web server to be updated.
13764 @c Can we offer more details on the web example?  Or
13765 @c point the user at how to figure it out?  This text
13766 @c strikes me as sufficient for someone who already has
13767 @c some idea of what we mean but not enough for the naive
13768 @c user/sysadmin to understand it and set it up.
13769
13770 The way to do this is by having loginfo invoke
13771 @code{cvs update}.  Doing so in the naive way will
13772 cause a problem with locks, so the @code{cvs update}
13773 must be run in the background.
13774 @c Should we try to describe the problem with locks?
13775 @c It seems like a digression for someone who just
13776 @c wants to know how to make it work.
13777 @c Another choice which might work for a single file
13778 @c is to use "cvs -n update -p" which doesn't take
13779 @c out locks (I think) but I don't see many advantages
13780 @c of that and we might as well document something which
13781 @c works for multiple files.
13782 Here is an example for unix (this should all be on one line):
13783
13784 @example
13785 ^cyclic-pages\(/\|$\)   (date; cat; (sleep 2; cd /u/www/local-docs;
13786  cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
13787 @end example
13788
13789 This will cause checkins to repository directory @code{cyclic-pages}
13790 and its subdirectories to update the checked
13791 out tree in @file{/u/www/local-docs}.
13792 @c More info on some of the details?  The "sleep 2" is
13793 @c so if we are lucky the lock will be gone by the time
13794 @c we start and we can wait 2 seconds instead of 30.
13795
13796
13797
13798 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13799 @node postadmin
13800 @appendixsubsec Logging admin commands
13801 @cindex postadmin (admin file)
13802 @cindex script hook, postadmin
13803 @cindex Admin commands, logging
13804
13805 The @file{postadmin} file defines programs to execute after an @code{admin}
13806 command modifies files.  The @file{postadmin} file has the standard form
13807 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
13808 expression followed by a command to execute.  It supports the ALL and DEFAULT
13809 keywords.
13810
13811 @cindex format strings, postadmin admin file
13812 The @file{postadmin} file supports no format strings other than the common
13813 ones (@pxref{syntax}),
13814
13815
13816
13817 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13818 @node taginfo
13819 @appendixsubsec Taginfo
13820 @cindex taginfo (admin file)
13821 @cindex script hook, taginfo
13822 @cindex Tags, logging
13823 @cindex Tags, verifying
13824 The @file{taginfo} file defines programs to execute
13825 when someone executes a @code{tag} or @code{rtag}
13826 command.  The @file{taginfo} file has the standard form
13827 for script hooks (@pxref{Trigger Scripts}), where each line
13828 is a regular expression followed by a command to execute.
13829 It supports the ALL and DEFAULT keywords.
13830
13831 @cindex format strings, taginfo admin file
13832 In addition to the common format strings (@pxref{syntax}),
13833 @file{taginfo} supports:
13834
13835 @table @t
13836 @item b
13837 tag type (@code{T} for branch, @code{N} for not-branch, or @code{?} for
13838 unknown, as during delete operations)
13839 @item o
13840 operation (@code{add} for @code{tag}, @code{mov} for @code{tag -F}, or
13841 @code{del} for @code{tag -d})
13842 @item t
13843 tag name
13844 @item @{sVv@}
13845 file attributes, where:
13846 @table @t
13847 @item s
13848 file name
13849 @item V
13850 old version number (for a move or delete operation)
13851 @item v
13852 new version number (for an add or move operation)
13853 @end table
13854 @end table
13855
13856 For example, some valid format strings are @samp{%%}, @samp{%p}, @samp{%t},
13857 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
13858
13859 @cindex taginfo (admin file), updating legacy repositories
13860 @cindex compatibility notes, taginfo admin file
13861 Currently, if no format strings are specified, a default
13862 string of @samp{ %t %o %p %@{sv@}} will be appended to the command
13863 line template before replacement is performed, but this
13864 feature is deprecated.  It is simply in place so that legacy
13865 repositories will remain compatible with the new @sc{cvs} application.
13866 For information on updating, @pxref{Updating Commit Files}.
13867
13868 @cindex Exit status, of taginfo admin file
13869 @cindex taginfo (admin file), exit status
13870 A non-zero exit of the filter program will cause the tag to be
13871 aborted.
13872
13873 Here is an example of using @file{taginfo} to log @code{tag} and @code{rtag}
13874 commands.  In the @file{taginfo} file put:
13875
13876 @example
13877 ALL /usr/local/cvsroot/CVSROOT/loggit %t %b %o %p %@{sVv@}
13878 @end example
13879
13880 @noindent
13881 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
13882 following script:
13883
13884 @example
13885 #!/bin/sh
13886 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
13887 @end example
13888
13889
13890
13891 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13892 @node posttag
13893 @appendixsubsec Logging tags
13894 @cindex posttag (admin file)
13895 @cindex script hook, posttag
13896 @cindex Tags, logging
13897
13898 The @file{posttag} file defines programs to execute after a @code{tag} or
13899 @code{rtag} command modifies files.  The @file{posttag} file has the standard
13900 form for script hooks (@pxref{Trigger Scripts}), where each line is a regular
13901 expression followed by a command to execute.  It supports the ALL and DEFAULT
13902 keywords.
13903
13904 @cindex format strings, posttag admin file
13905 The @file{posttag} admin file supports the same format strings as the
13906 @file{taginfo} file (@pxref{taginfo}),
13907
13908
13909
13910 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13911 @node postwatch
13912 @appendixsubsec Logging watch commands
13913 @cindex postwatch (admin file)
13914 @cindex script hook, postwatch
13915 @cindex Watch family of commands, logging
13916
13917 The @file{postwatch} file defines programs to execute after any command (for
13918 instance, @code{watch}, @code{edit}, @code{unedit}, or @code{commit}) modifies
13919 any @file{CVS/fileattr} file in the repository (@pxref{Watches}).  The
13920 @file{postwatch} file has the standard form for script hooks
13921 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13922 a command to execute.  It supports the ALL and DEFAULT keywords.
13923
13924 @cindex format strings, postwatch admin file
13925 The @file{postwatch} file supports no format strings other than the common
13926 ones (@pxref{syntax}), but it is worth noting that the @code{%c} format string
13927 may not be replaced as you might expect.  Client runs of @code{edit} and
13928 @code{unedit} can sometimes skip contacting the @sc{cvs} server and cache the
13929 notification of the file attribute change to be sent the next time the client
13930 contacts the server for whatever other reason,
13931
13932
13933
13934 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13935 @node preproxy
13936 @appendixsubsec Launch a Script before Proxying
13937 @cindex preproxy (admin file)
13938 @cindex script hook, preproxy
13939 @cindex Write proxy, verifying
13940 @cindex Write proxy, logging
13941
13942 The @file{preproxy} file defines programs to execute after a secondary
13943 server receives a write request from a client, just before it starts up the
13944 primary server and becomes a write proxy.  This hook could be used to
13945 dial a modem, launch an SSH tunnel, establish a VPN, or anything else that
13946 might be necessary to do before contacting the primary server.
13947
13948 @file{preproxy} scripts are called once, at the time of the write request, with
13949 the repository argument (if requested) set from the topmost directory sent by
13950 the client.
13951
13952 The @file{preproxy} file has the standard form
13953 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
13954 expression followed by a command to execute.  It supports the ALL and DEFAULT
13955 keywords.
13956
13957 @cindex format strings, preproxy admin file
13958 In addition to the common format strings, the @file{preproxy} file supports the
13959 following format string:
13960
13961 @table @t
13962 @item P
13963 the CVSROOT string which specifies the primary server
13964 @end table
13965
13966
13967
13968 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13969 @node postproxy
13970 @appendixsubsec Launch a Script after Proxying
13971 @cindex postproxy (admin file)
13972 @cindex script hook, postproxy
13973 @cindex Write proxy, logging
13974 @cindex Write proxy, pull updates
13975 @cindex secondary server, pull updates
13976
13977 The @file{postproxy} file defines programs to execute after a secondary
13978 server notes that the connection to the primary server has shut down and before
13979 it releases the client by shutting down the connection to the client.
13980 This could hook could be used to
13981 disconnect a modem, an SSH tunnel, a VPN, or anything else that
13982 might be necessary to do after contacting the primary server.  This hook should
13983 also be used to pull updates from the primary server before allowing the client
13984 which did the write to disconnect since otherwise the client's next read
13985 request may generate error messages and fail upon encountering an out of date
13986 repository on the secondary server.
13987
13988 @file{postproxy} scripts are called once per directory.
13989
13990 The @file{postproxy} file has the standard form
13991 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
13992 expression followed by a command to execute.  It supports the ALL and DEFAULT
13993 keywords.
13994
13995 @cindex format strings, postproxy admin file
13996 In addition to the common format strings, the @file{postproxy} file supports
13997 the following format string:
13998
13999 @table @t
14000 @item P
14001 the CVSROOT string which specifies the primary server
14002 @end table
14003
14004
14005
14006 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14007 @node rcsinfo
14008 @appendixsec Rcsinfo
14009 @cindex rcsinfo (admin file)
14010 @cindex Form for log message
14011 @cindex Log message template
14012 @cindex Template for log message
14013 @cindex logging, commits
14014
14015 The @file{rcsinfo} file can be used to specify a form to
14016 edit when filling out the commit log.  The
14017 @file{rcsinfo} file has a syntax similar to the
14018 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
14019 files.  @xref{syntax}.  Unlike the other files the second
14020 part is @emph{not} a command-line template.  Instead,
14021 the part after the regular expression should be a full pathname to
14022 a file containing the log message template.
14023
14024 If the repository name does not match any of the
14025 regular expressions in this file, the @samp{DEFAULT}
14026 line is used, if it is specified.
14027
14028 All occurrences of the name @samp{ALL} appearing as a
14029 regular expression are used in addition to the first
14030 matching regular expression or @samp{DEFAULT}.
14031
14032 @c FIXME: should be offering advice, somewhere around
14033 @c here, about where to put the template file.  The
14034 @c verifymsg example uses /usr/cvssupport but doesn't
14035 @c say anything about what that directory is for or
14036 @c whether it is hardwired into CVS or who creates
14037 @c it or anything.  In particular we should say
14038 @c how to version control the template file.  A
14039 @c probably better answer than the /usr/cvssupport
14040 @c stuff is to use checkoutlist (with xref to the
14041 @c checkoutlist doc).
14042 @c Also I am starting to see a connection between
14043 @c this and the Keeping a checked out copy node.
14044 @c Probably want to say something about that.
14045 The log message template will be used as a default log
14046 message.  If you specify a log message with @samp{cvs
14047 commit -m @var{message}} or @samp{cvs commit -f
14048 @var{file}} that log message will override the
14049 template.
14050
14051 @xref{verifymsg}, for an example @file{rcsinfo}
14052 file.
14053
14054 When @sc{cvs} is accessing a remote repository,
14055 the contents of @file{rcsinfo} at the time a directory
14056 is first checked out will specify a template. This
14057 template will be updated on all @samp{cvs update}
14058 commands. It will also be added to new directories
14059 added with a @samp{cvs add new-directory} command.
14060 In versions of @sc{cvs} prior to version 1.12, the
14061 @file{CVS/Template} file was not updated. If the
14062 @sc{cvs} server is at version 1.12 or higher an older
14063 client may be used and the @file{CVS/Template} will
14064 be updated from the server.
14065
14066 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14067 @node cvsignore
14068 @appendixsec Ignoring files via cvsignore
14069 @cindex cvsignore (admin file), global
14070 @cindex Global cvsignore
14071 @cindex Ignoring files
14072 @c -- This chapter should maybe be moved to the
14073 @c tutorial part of the manual?
14074
14075 There are certain file names that frequently occur
14076 inside your working copy, but that you don't want to
14077 put under @sc{cvs} control.  Examples are all the object
14078 files that you get while you compile your sources.
14079 Normally, when you run @samp{cvs update}, it prints a
14080 line for each file it encounters that it doesn't know
14081 about (@pxref{update output}).
14082
14083 @sc{cvs} has a list of files (or sh(1) file name patterns)
14084 that it should ignore while running @code{update},
14085 @code{import} and @code{release}.
14086 @c -- Are those the only three commands affected?
14087 This list is constructed in the following way.
14088
14089 @itemize @bullet
14090 @item
14091 The list is initialized to include certain file name
14092 patterns: names associated with @sc{cvs}
14093 administration, or with other common source control
14094 systems; common names for patch files, object files,
14095 archive files, and editor backup files; and other names
14096 that are usually artifacts of assorted utilities.
14097 Currently, the default list of ignored file name
14098 patterns is:
14099
14100 @cindex Ignored files
14101 @cindex Automatically ignored files
14102 @example
14103     RCS     SCCS    CVS     CVS.adm
14104     RCSLOG  cvslog.*
14105     tags    TAGS
14106     .make.state     .nse_depinfo
14107     *~      #*      .#*     ,*      _$*     *$
14108     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
14109     *.a     *.olb   *.o     *.obj   *.so    *.exe
14110     *.Z     *.elc   *.ln
14111     core
14112 @end example
14113
14114 @item
14115 The per-repository list in
14116 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
14117 the list, if that file exists.
14118
14119 @item
14120 The per-user list in @file{.cvsignore} in your home
14121 directory is appended to the list, if it exists.
14122
14123 @item
14124 Any entries in the environment variable
14125 @code{$CVSIGNORE} is appended to the list.
14126
14127 @item
14128 Any @samp{-I} options given to @sc{cvs} is appended.
14129
14130 @item
14131 As @sc{cvs} traverses through your directories, the contents
14132 of any @file{.cvsignore} will be appended to the list.
14133 The patterns found in @file{.cvsignore} are only valid
14134 for the directory that contains them, not for
14135 any sub-directories.
14136 @end itemize
14137
14138 In any of the 5 places listed above, a single
14139 exclamation mark (@samp{!}) clears the ignore list.
14140 This can be used if you want to store any file which
14141 normally is ignored by @sc{cvs}.
14142
14143 Specifying @samp{-I !} to @code{cvs import} will import
14144 everything, which is generally what you want to do if
14145 you are importing files from a pristine distribution or
14146 any other source which is known to not contain any
14147 extraneous files.  However, looking at the rules above
14148 you will see there is a fly in the ointment; if the
14149 distribution contains any @file{.cvsignore} files, then
14150 the patterns from those files will be processed even if
14151 @samp{-I !} is specified.  The only workaround is to
14152 remove the @file{.cvsignore} files in order to do the
14153 import.  Because this is awkward, in the future
14154 @samp{-I !} might be modified to override
14155 @file{.cvsignore} files in each directory.
14156
14157 Note that the syntax of the ignore files consists of a
14158 series of lines, each of which contains a space
14159 separated list of filenames.  This offers no clean way
14160 to specify filenames which contain spaces, but you can
14161 use a workaround like @file{foo?bar} to match a file
14162 named @file{foo bar} (it also matches @file{fooxbar}
14163 and the like).  Also note that there is currently no
14164 way to specify comments.
14165 @c FIXCVS?  I don't _like_ this syntax at all, but
14166 @c changing it raises all the usual compatibility
14167 @c issues and I'm also not sure what to change it to.
14168
14169 @node checkoutlist
14170 @appendixsec The checkoutlist file
14171 @cindex checkoutlist
14172
14173 It may be helpful to use @sc{cvs} to maintain your own
14174 files in the @file{CVSROOT} directory.  For example,
14175 suppose that you have a script @file{logcommit.pl}
14176 which you run by including the following line in the
14177 @file{commitinfo} administrative file:
14178
14179 @example
14180 ALL   $CVSROOT/CVSROOT/logcommit.pl %r/%p %s
14181 @end example
14182
14183 To maintain @file{logcommit.pl} with @sc{cvs} you would
14184 add the following line to the @file{checkoutlist}
14185 administrative file:
14186
14187 @example
14188 logcommit.pl
14189 @end example
14190
14191 The format of @file{checkoutlist} is one line for each
14192 file that you want to maintain using @sc{cvs}, giving
14193 the name of the file, followed optionally by more whitespace
14194 and any error message that should print if the file cannot be
14195 checked out into CVSROOT after a commit:
14196
14197 @example
14198 logcommit.pl    Could not update CVSROOT/logcommit.pl.
14199 @end example
14200
14201 After setting up @file{checkoutlist} in this fashion,
14202 the files listed there will function just like
14203 @sc{cvs}'s built-in administrative files.  For example,
14204 when checking in one of the files you should get a
14205 message such as:
14206
14207 @example
14208 cvs commit: Rebuilding administrative file database
14209 @end example
14210
14211 @noindent
14212 and the checked out copy in the @file{CVSROOT}
14213 directory should be updated.
14214
14215 Note that listing @file{passwd} (@pxref{Password
14216 authentication server}) in @file{checkoutlist} is not
14217 recommended for security reasons.
14218
14219 For information about keeping a checkout out copy in a
14220 more general context than the one provided by
14221 @file{checkoutlist}, see @ref{Keeping a checked out
14222 copy}.
14223
14224 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14225 @node history file
14226 @appendixsec The history file
14227 @cindex History file
14228 @cindex Log information, saving
14229
14230 The file @file{$CVSROOT/CVSROOT/history} is used
14231 to log information for the @code{history} command
14232 (@pxref{history}).  This file must be created to turn
14233 on logging.  This is done automatically if the
14234 @code{cvs init} command is used to set up the
14235 repository (@pxref{Creating a repository}).
14236
14237 The file format of the @file{history} file is
14238 documented only in comments in the @sc{cvs} source
14239 code, but generally programs should use the @code{cvs
14240 history} command to access it anyway, in case the
14241 format changes with future releases of @sc{cvs}.
14242
14243 @node Variables
14244 @appendixsec Expansions in administrative files
14245 @cindex Internal variables
14246 @cindex Variables
14247
14248 Sometimes in writing an administrative file, you might
14249 want the file to be able to know various things based
14250 on environment @sc{cvs} is running in.  There are
14251 several mechanisms to do that.
14252
14253 To find the home directory of the user running @sc{cvs}
14254 (from the @code{HOME} environment variable), use
14255 @samp{~} followed by @samp{/} or the end of the line.
14256 Likewise for the home directory of @var{user}, use
14257 @samp{~@var{user}}.  These variables are expanded on
14258 the server machine, and don't get any reasonable
14259 expansion if pserver (@pxref{Password authenticated})
14260 is in use; therefore user variables (see below) may be
14261 a better choice to customize behavior based on the user
14262 running @sc{cvs}.
14263 @c Based on these limitations, should we deprecate ~?
14264 @c What is it good for?  Are people using it?
14265
14266 One may want to know about various pieces of
14267 information internal to @sc{cvs}.  A @sc{cvs} internal
14268 variable has the syntax @code{$@{@var{variable}@}},
14269 where @var{variable} starts with a letter and consists
14270 of alphanumeric characters and @samp{_}.  If the
14271 character following @var{variable} is a
14272 non-alphanumeric character other than @samp{_}, the
14273 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
14274 internal variables are:
14275
14276 @table @code
14277 @item CVSROOT
14278 @cindex CVSROOT, internal variable
14279 This is the absolute path to the current @sc{cvs} root directory.
14280 @xref{Repository}, for a description of the various
14281 ways to specify this, but note that the internal
14282 variable contains just the directory and not any
14283 of the access method information.
14284
14285 @item RCSBIN
14286 @cindex RCSBIN, internal variable
14287 In @sc{cvs} 1.9.18 and older, this specified the
14288 directory where @sc{cvs} was looking for @sc{rcs}
14289 programs.  Because @sc{cvs} no longer runs @sc{rcs}
14290 programs, specifying this internal variable is now an
14291 error.
14292
14293 @item CVSEDITOR
14294 @cindex CVSEDITOR, internal variable
14295 @itemx EDITOR
14296 @cindex EDITOR, internal variable
14297 @itemx VISUAL
14298 @cindex VISUAL, internal variable
14299 These all expand to the same value, which is the editor
14300 that @sc{cvs} is using.  @xref{Global options}, for how
14301 to specify this.
14302
14303 @item USER
14304 @cindex USER, internal variable
14305 Username of the user running @sc{cvs} (on the @sc{cvs}
14306 server machine).
14307 When using pserver, this is the user specified in the repository
14308 specification which need not be the same as the username the
14309 server is running as (@pxref{Password authentication server}).
14310 Do not confuse this with the environment variable of the same name.
14311 @end table
14312
14313 If you want to pass a value to the administrative files
14314 which the user who is running @sc{cvs} can specify,
14315 use a user variable.
14316 @cindex User variables
14317 To expand a user variable, the
14318 administrative file contains
14319 @code{$@{=@var{variable}@}}.  To set a user variable,
14320 specify the global option @samp{-s} to @sc{cvs}, with
14321 argument @code{@var{variable}=@var{value}}.  It may be
14322 particularly useful to specify this option via
14323 @file{.cvsrc} (@pxref{~/.cvsrc}).
14324
14325 For example, if you want the administrative file to
14326 refer to a test directory you might create a user
14327 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
14328 as
14329
14330 @example
14331 cvs -s TESTDIR=/work/local/tests
14332 @end example
14333
14334 @noindent
14335 and the
14336 administrative file contains @code{sh
14337 $@{=TESTDIR@}/runtests}, then that string is expanded
14338 to @code{sh /work/local/tests/runtests}.
14339
14340 All other strings containing @samp{$} are reserved;
14341 there is no way to quote a @samp{$} character so that
14342 @samp{$} represents itself.
14343
14344 Environment variables passed to administrative files are:
14345
14346 @table @code
14347 @cindex environment variables, passed to administrative files
14348
14349 @item CVS_USER
14350 @cindex CVS_USER, environment variable
14351 The @sc{cvs}-specific username provided by the user, if it
14352 can be provided (currently just for the pserver access
14353 method), and to the empty string otherwise.  (@code{CVS_USER}
14354 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
14355 is used to map @sc{cvs} usernames to system usernames.)
14356
14357 @item LOGNAME
14358 @cindex LOGNAME, environment variable
14359 The username of the system user.
14360
14361 @item USER
14362 @cindex USER, environment variable
14363 Same as @code{LOGNAME}.
14364 Do not confuse this with the internal variable of the same name.
14365 @end table
14366
14367 @node config
14368 @appendixsec The CVSROOT/config configuration file
14369
14370 @cindex config, in CVSROOT
14371 @cindex CVSROOT/config
14372
14373 The administrative file @file{config} contains various
14374 miscellaneous settings which affect the behavior of
14375 @sc{cvs}.  The syntax is slightly different from the
14376 other administrative files.  Variables are not
14377 expanded.  Lines which start with @samp{#} are
14378 considered comments.
14379 @c FIXME: where do we define comments for the other
14380 @c administrative files.
14381 Other lines consist of a keyword, @samp{=}, and a
14382 value.  Note that this syntax is very strict.
14383 Extraneous spaces or tabs are not permitted.
14384 @c See comments in parseinfo.c:parse_config for more
14385 @c discussion of this strictness.
14386
14387 Currently defined keywords are:
14388
14389 @table @code
14390 @cindex RCSBIN, in CVSROOT/config
14391 @item RCSBIN=@var{bindir}
14392 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
14393 @sc{cvs} to look for @sc{rcs} programs in the
14394 @var{bindir} directory.  Current versions of @sc{cvs}
14395 do not run @sc{rcs} programs; for compatibility this
14396 setting is accepted, but it does nothing.
14397
14398 @cindex SystemAuth, in CVSROOT/config
14399 @item SystemAuth=@var{value}
14400 If @var{value} is @samp{yes}, then pserver should check
14401 for users in the system's user database if not found in
14402 @file{CVSROOT/passwd}.  If it is @samp{no}, then all
14403 pserver users must exist in @file{CVSROOT/passwd}.
14404 The default is @samp{yes}.  For more on pserver, see
14405 @ref{Password authenticated}.
14406
14407 @cindex LocalKeyword, in CVSROOT/config
14408 @item LocalKeyword=@var{value}
14409 Specify a local alias for a standard keyword.
14410 For example, @samp{LocalKeyword=MYCVS=CVSHeader}.
14411 For more on local keywords, see @ref{Keyword substitution}.
14412
14413 @cindex KeywordExpand, in CVSROOT/config
14414 @item KeywordExpand=@var{value}
14415 Specify @samp{i} followed by a list of keywords to be expanded
14416 (for example, @samp{KeywordExpand=iMYCVS,Name,Date}),
14417 or @samp{e} followed by a list of keywords not to be expanded
14418 (for example, @samp{KeywordExpand=eCVSHeader}).
14419 For more on keyword expansion, see @ref{Configuring keyword expansion}.
14420
14421 @ignore
14422 @cindex PreservePermissions, in CVSROOT/config
14423 @item PreservePermissions=@var{value}
14424 Enable support for saving special device files,
14425 symbolic links, file permissions and ownerships in the
14426 repository.  The default value is @samp{no}.
14427 @xref{Special Files}, for the full implications of using
14428 this keyword.
14429 @end ignore
14430
14431 @cindex TopLevelAdmin, in CVSROOT/config
14432 @item TopLevelAdmin=@var{value}
14433 Modify the @samp{checkout} command to create a
14434 @samp{CVS} directory at the top level of the new
14435 working directory, in addition to @samp{CVS}
14436 directories created within checked-out directories.
14437 The default value is @samp{no}.
14438
14439 This option is useful if you find yourself performing
14440 many commands at the top level of your working
14441 directory, rather than in one of the checked out
14442 subdirectories.  The @file{CVS} directory created there
14443 will mean you don't have to specify @code{CVSROOT} for
14444 each command.  It also provides a place for the
14445 @file{CVS/Template} file (@pxref{Working directory
14446 storage}).
14447
14448 @cindex LockDir, in CVSROOT/config
14449 @item LockDir=@var{directory}
14450 Put @sc{cvs} lock files in @var{directory} rather than
14451 directly in the repository.  This is useful if you want
14452 to let users read from the repository while giving them
14453 write access only to @var{directory}, not to the
14454 repository.
14455 It can also be used to put the locks on a very fast
14456 in-memory file system to speed up locking and unlocking
14457 the repository.
14458 You need to create @var{directory}, but
14459 @sc{cvs} will create subdirectories of @var{directory} as it
14460 needs them.  For information on @sc{cvs} locks, see
14461 @ref{Concurrency}.
14462
14463 @c Mention this in Compatibility section?
14464 Before enabling the LockDir option, make sure that you
14465 have tracked down and removed any copies of @sc{cvs} 1.9 or
14466 older.  Such versions neither support LockDir, nor will
14467 give an error indicating that they don't support it.
14468 The result, if this is allowed to happen, is that some
14469 @sc{cvs} users will put the locks one place, and others will
14470 put them another place, and therefore the repository
14471 could become corrupted.  @sc{cvs} 1.10 does not support
14472 LockDir but it will print a warning if run on a
14473 repository with LockDir enabled.
14474
14475 @cindex LogHistory, in CVSROOT/config
14476 @item LogHistory=@var{value}
14477 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
14478 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
14479 all transactions.  Any subset of the default is
14480 legal.  (For example, to only log transactions that modify the
14481 @file{*,v} files, use @samp{LogHistory=TMAR}.)
14482
14483 @cindex RereadLogAfterVerify, in CVSROOT/config
14484 @cindex @file{verifymsg}, changing the log message
14485 @item RereadLogAfterVerify=@var{value}
14486 Modify the @samp{commit} command such that CVS will reread the
14487 log message after running the program specified by @file{verifymsg}.
14488 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
14489 the log message should always be reread; @samp{no}
14490 or @samp{never}, indicating that it should never be
14491 reread; or @var{value} may be @samp{stat}, indicating
14492 that the file should be checked with the file system
14493 @samp{stat()} function to see if it has changed (see warning below)
14494 before rereading.  The default value is @samp{always}.
14495
14496 @strong{Note: the `stat' mode can cause CVS to pause for up to
14497 one extra second per directory committed.  This can be less IO and
14498 CPU intensive but is not recommended for use with large repositories}
14499
14500 @xref{verifymsg}, for more information on how verifymsg
14501 may be used.
14502
14503 @cindex UserAdminOptions, in CVSROOT/config
14504 @item UserAdminOptions=@var{value}
14505 Control what options will be allowed with the @code{cvs admin}
14506 command (@pxref{admin}) for users not in the @code{cvsadmin} group.
14507 The @var{value} string is a list of single character options
14508 which should be allowed.  If a user who is not a member of the
14509 @code{cvsadmin} group tries to execute any @code{cvs admin}
14510 option which is not listed they will will receive an error message
14511 reporting that the option is restricted.
14512
14513 If no @code{cvsadmin} group exists on the server, @sc{cvs} will
14514 ignore the @code{UserAdminOptions} keyword (@pxref{admin}).
14515
14516 When not specified, @code{UserAdminOptions} defaults to
14517 @samp{k}.  In other words, it defaults to allowing
14518 users outside of the @code{cvsadmin} group to use the
14519 @code{cvs admin} command only to change the default keyword
14520 expansion mode for files.
14521
14522 As an example, to restrict users not in the @code{cvsadmin}
14523 group to using @code{cvs admin} to change the default keyword
14524 substitution mode, lock revisions, unlock revisions, and
14525 replace the log message, use @samp{UserAdminOptions=klum}.
14526
14527 @cindex format strings, config admin file
14528 @cindex config (admin file), updating legacy repositories
14529 @cindex compatibility notes, config admin file
14530 @cindex UseNewInfoFmtStrings, in CVSROOT/config
14531 @item UseNewInfoFmtStrings=@var{value}
14532 Specify whether @sc{cvs} should support the new or old command line
14533 template model for the commit support files (@pxref{commit files}).
14534 This configuration variable began life in deprecation and is only here
14535 in order to give people time to update legacy repositories to use the new
14536 format string syntax before support for the old syntax is removed.  For
14537 information on updating your repository to support the new model,
14538 please see @ref{Updating Commit Files}.
14539
14540 @emph{Note that new repositories (created with the @code{cvs init} command)
14541 will have this value set to @samp{yes}, but the default value is @samp{no}.}
14542
14543 @cindex import, config admin file
14544 @cindex config (admin file), import
14545 @cindex ImportNewFilesToVendorBranchOnly, in CVSROOT/config
14546 @item ImportNewFilesToVendorBranchOnly=@var{value}
14547 Specify whether @code{cvs import} should always behave as if the
14548 @samp{-X} flag was specified on the command line.  
14549 @var{value} may be either @samp{yes} or @samp{no}.  If set to @samp{yes},
14550 all uses of @code{cvs import} on the repository will behave as if the
14551 @samp{-X} flag was set.  The default value is @samp{no}.
14552
14553 @cindex PrimaryServer, in CVSROOT/config
14554 @cindex Primary server
14555 @cindex Secondary server
14556 @cindex proxy, write
14557 @cindex write proxy
14558 @item PrimaryServer=@var{CVSROOT}
14559 When specified, and the repository specified by @var{CVSROOT} is not the one
14560 currently being accessed, then the server will turn itself into a transparent
14561 proxy to @var{CVSROOT} for write requests.  The @var{hostname} configured as
14562 part of @var{CVSROOT} must resolve to the same string returned by the
14563 @command{uname} command on the primary server for this to work.  Host name
14564 resolution is performed via some combination of @command{named}, a broken out
14565 line from @file{/etc/hosts}, and the Network Information Service (NIS or YP),
14566 depending on the configuration of the particular system.
14567
14568 Only the @samp{:ext:} method is
14569 currently supported for primaries (actually, @samp{:fork:} is supported as
14570 well, but only for testing - if you find another use for accessing a primary
14571 via the @samp{:fork:} method, please send a note to @email{bug-cvs@@gnu.org}
14572 about it).  See @ref{Write proxies} for more on configuring and using write
14573 proxies.
14574
14575 @cindex MaxCommentLeaderLength, in CVSROOT/config
14576 @cindex Log keyword, configuring substitution behavior
14577 @item MaxCommentLeaderLength=@var{length}
14578 Set to some length, in bytes, where a trailing @samp{k}, @samp{M}, @samp{G},
14579 or @samp{T} causes the preceding nubmer to be interpreted as kilobytes,
14580 megabytes, gigabytes, or terrabytes, respectively, will cause
14581 @code{$@splitrcskeyword{Log}$} keywords (@pxref{Keyword substitution}), with
14582 more than @var{length} bytes preceding it on a line to be ignored (or to fall
14583 back on the comment leader set in the RCS archive file - see
14584 @code{UseArchiveCommentLeader} below).  Defaults to 20 bytes to allow checkouts
14585 to proceed normally when they include binary files containing
14586 @code{$@splitrcskeyword{Log}$} keywords and which users have neglected to mark
14587 as binary.
14588
14589 @cindex UseArchiveCommentLeader, in CVSROOT/config
14590 @cindex Log keyword, configuring substitution behavior
14591 @item UseArchiveCommentLeader=@var{value}
14592 Set to @code{true}, if the text preceding a @code{$@splitrcskeyword{Log}$}
14593 keyword is found to exceed @code{MaxCommentLeaderLength} bytes, then the
14594 comment leader set in the RCS archive file (@pxref{admin}), if any, will be
14595 used instead.  If there is no comment leader set in the archive file or
14596 @var{value} is set to @samp{false}, then the keyword will not be expanded
14597 (@pxref{Keyword list}).  To force the comment leader in the RCS archive file to
14598 be used exclusively (and @code{$@splitrcskeyword{Log}$} expansion skipped in
14599 files where the comment leader has not been set in the archive file), set
14600 @var{value} and set @code{MaxCommentLeaderLength} to @code{0}.
14601 @end table
14602
14603
14604
14605 @c ---------------------------------------------------------------------
14606 @node Environment variables
14607 @appendix All environment variables which affect CVS
14608 @cindex Environment variables
14609 @cindex Reference manual for variables
14610
14611 This is a complete list of all environment variables
14612 that affect @sc{cvs}.
14613
14614 @table @code
14615 @cindex CVSIGNORE, environment variable
14616 @item $CVSIGNORE
14617 A whitespace-separated list of file name patterns that
14618 @sc{cvs} should ignore. @xref{cvsignore}.
14619
14620 @cindex CVSWRAPPERS, environment variable
14621 @item $CVSWRAPPERS
14622 A whitespace-separated list of file name patterns that
14623 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
14624
14625 @cindex CVSREAD, environment variable
14626 @cindex Read-only files, and CVSREAD
14627 @item $CVSREAD
14628 If this is set, @code{checkout} and @code{update} will
14629 try hard to make the files in your working directory
14630 read-only.  When this is not set, the default behavior
14631 is to permit modification of your working files.
14632
14633 @cindex CVSREADONLYFS, environment variable
14634 @item $CVSREADONLYFS
14635 Turns on read-only repository mode. This allows one to
14636 check out from a read-only repository, such as within
14637 an anoncvs server, or from a @sc{cd-rom} repository.
14638
14639 It has the same effect as if the @samp{-R} command-line
14640 option is used. This can also allow the use of
14641 read-only NFS repositories.
14642
14643 @item $CVSUMASK
14644 Controls permissions of files in the repository.  See
14645 @ref{File permissions}.
14646
14647 @item $CVSROOT
14648 Should contain the full pathname to the root of the @sc{cvs}
14649 source repository (where the @sc{rcs} files are
14650 kept).  This information must be available to @sc{cvs} for
14651 most commands to execute; if @code{$CVSROOT} is not set,
14652 or if you wish to override it for one invocation, you
14653 can supply it on the command line: @samp{cvs -d cvsroot
14654 cvs_command@dots{}} Once you have checked out a working
14655 directory, @sc{cvs} stores the appropriate root (in
14656 the file @file{CVS/Root}), so normally you only need to
14657 worry about this when initially checking out a working
14658 directory.
14659
14660 @item $CVSEDITOR
14661 @cindex CVSEDITOR, environment variable
14662 @itemx $EDITOR
14663 @cindex EDITOR, environment variable
14664 @itemx $VISUAL
14665 @cindex VISUAL, environment variable
14666 Specifies the program to use for recording log messages
14667 during commit.  @code{$CVSEDITOR} overrides
14668 @code{$EDITOR}, which overrides @code{$VISUAL}.
14669 See @ref{Committing your changes} for more or
14670 @ref{Global options} for alternative ways of specifying a
14671 log editor.
14672
14673 @cindex PATH, environment variable
14674 @item $PATH
14675 If @code{$RCSBIN} is not set, and no path is compiled
14676 into @sc{cvs}, it will use @code{$PATH} to try to find all
14677 programs it uses.
14678
14679 @cindex HOME, environment variable
14680 @item $HOME
14681 @cindex HOMEPATH, environment variable
14682 @item $HOMEPATH
14683 @cindex HOMEDRIVE, environment variable
14684 @item $HOMEDRIVE
14685 Used to locate the directory where the @file{.cvsrc}
14686 file, and other such files, are searched.  On Unix, @sc{cvs}
14687 just checks for @code{HOME}.  On Windows NT, the system will
14688 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
14689 for example to @file{\joe}.  On Windows 95, you'll
14690 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
14691 @c We are being vague about whether HOME works on
14692 @c Windows; see long comment in windows-NT/filesubr.c.
14693
14694 @cindex CVS_RSH, environment variable
14695 @item $CVS_RSH
14696 Specifies the external program which @sc{cvs} connects with,
14697 when @code{:ext:} access method is specified.
14698 @pxref{Connecting via rsh}.
14699
14700 @item $CVS_SERVER
14701 Used in client-server mode when accessing a remote
14702 repository using @sc{rsh}.  It specifies the name of
14703 the program to start on the server side (and any
14704 necessary arguments) when accessing a remote repository
14705 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
14706 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
14707 the default value for @code{:fork:} is the name used to run the client.
14708 @pxref{Connecting via rsh}
14709
14710 @item $CVS_PASSFILE
14711 Used in client-server mode when accessing the @code{cvs
14712 login server}.  Default value is @file{$HOME/.cvspass}.
14713 @pxref{Password authentication client}
14714
14715 @cindex CVS_CLIENT_PORT
14716 @item $CVS_CLIENT_PORT
14717 Used in client-server mode to set the port to use when accessing the server
14718 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
14719 if the port is not specified in the CVSROOT.
14720 @pxref{Remote repositories}
14721
14722 @cindex CVS_PROXY_PORT
14723 @item $CVS_PROXY_PORT
14724 Used in client-server mode to set the port to use when accessing a server
14725 via a web proxy, if the port is not specified in the CVSROOT.  Works with
14726 GSSAPI, and the password authentication protocol.
14727 @pxref{Remote repositories}
14728
14729 @cindex CVS_RCMD_PORT, environment variable
14730 @item $CVS_RCMD_PORT
14731 Used in client-server mode.  If set, specifies the port
14732 number to be used when accessing the @sc{rcmd} demon on
14733 the server side. (Currently not used for Unix clients).
14734
14735 @cindex CVS_CLIENT_LOG, environment variable
14736 @item $CVS_CLIENT_LOG
14737 Used for debugging only in client-server
14738 mode.  If set, everything sent to the server is logged
14739 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
14740 sent from the server is logged into
14741 @file{@code{$CVS_CLIENT_LOG}.out}.
14742
14743 @cindex CVS_SERVER_SLEEP, environment variable
14744 @item $CVS_SERVER_SLEEP
14745 Used only for debugging the server side in
14746 client-server mode.  If set, delays the start of the
14747 server child process the specified amount of
14748 seconds so that you can attach to it with a debugger.
14749
14750 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
14751 @item $CVS_IGNORE_REMOTE_ROOT
14752 For @sc{cvs} 1.10 and older, setting this variable
14753 prevents @sc{cvs} from overwriting the @file{CVS/Root}
14754 file when the @samp{-d} global option is specified.
14755 Later versions of @sc{cvs} do not rewrite
14756 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
14757 effect.
14758
14759 @cindex CVS_LOCAL_BRANCH_NUM, environment variable
14760 @item $CVS_LOCAL_BRANCH_NUM
14761 Setting this variable allows some control over the
14762 branch number that is assigned. This is specifically to
14763 support the local commit feature of CVSup. If one sets
14764 @code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
14765 the local repository, the revision numbers will look
14766 like 1.66.1000.xx. There is almost a dead-set certainty
14767 that there will be no conflicts with version numbers.
14768
14769 @cindex COMSPEC, environment variable
14770 @item $COMSPEC
14771 Used under OS/2 only.  It specifies the name of the
14772 command interpreter and defaults to @sc{cmd.exe}.
14773
14774 @cindex TMPDIR, environment variable
14775 @item $TMPDIR
14776 @cindex TMP, environment variable
14777 @itemx $TMP
14778 @cindex TEMP, environment variable
14779 @itemx $TEMP
14780 @cindex Temporary files, location of
14781 @c This is quite nuts.  We don't talk about tempnam
14782 @c or mkstemp which we sometimes use.  The discussion
14783 @c of "Global options" is semi-incoherent.
14784 @c I'm not even sure those are the only inaccuracies.
14785 @c Furthermore, the conventions are
14786 @c pretty crazy and they should be simplified.
14787 Directory in which temporary files are located.
14788 The @sc{cvs} server uses
14789 @code{TMPDIR}.  @xref{Global options}, for a
14790 description of how to specify this.
14791 Some parts of @sc{cvs} will always use @file{/tmp} (via
14792 the @code{tmpnam} function provided by the system).
14793
14794 On Windows NT, @code{TMP} is used (via the @code{_tempnam}
14795 function provided by the system).
14796
14797 The @code{patch} program which is used by the @sc{cvs}
14798 client uses @code{TMPDIR}, and if it is not set, uses
14799 @file{/tmp} (at least with GNU patch 2.1).  Note that
14800 if your server and client are both running @sc{cvs}
14801 1.9.10 or later, @sc{cvs} will not invoke an external
14802 @code{patch} program.
14803
14804 @cindex CVS_PID, environment variable
14805 @item $CVS_PID
14806 This is the process identification (aka pid) number of
14807 the @sc{cvs} process. It is often useful in the
14808 programs and/or scripts specified by the
14809 @file{commitinfo}, @file{verifymsg}, @file{loginfo}
14810 files.
14811 @end table
14812
14813 @node Compatibility
14814 @appendix Compatibility between CVS Versions
14815
14816 @cindex CVS, versions of
14817 @cindex Versions, of CVS
14818 @cindex Compatibility, between CVS versions
14819 @c We don't mention versions older than CVS 1.3
14820 @c on the theory that it would clutter it up for the vast
14821 @c majority of people, who don't have anything that old.
14822 @c
14823 The repository format is compatible going back to
14824 @sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
14825 you have copies of @sc{cvs} 1.6 or older and you want
14826 to use the optional developer communication features.
14827 @c If you "cvs rm" and commit using 1.3, then you'll
14828 @c want to run "rcs -sdead <file,v>" on each of the
14829 @c files in the Attic if you then want 1.5 and
14830 @c later to recognize those files as dead (I think the
14831 @c symptom if this is not done is that files reappear
14832 @c in joins).  (Wait: the above will work but really to
14833 @c be strictly correct we should suggest checking
14834 @c in a new revision rather than just changing the
14835 @c state of the head revision, shouldn't we?).
14836 @c The old convert.sh script was for this, but it never
14837 @c did get updated to reflect use of the RCS "dead"
14838 @c state.
14839 @c Note: this is tricky to document without confusing
14840 @c people--need to carefully say what CVS version we
14841 @c are talking about and keep in mind the distinction
14842 @c between a
14843 @c repository created with 1.3 and on which one now
14844 @c uses 1.5+, and a repository on which one wants to
14845 @c use both versions side by side (e.g. during a
14846 @c transition period).
14847 @c Wait, can't CVS just detect the case in which a file
14848 @c is in the Attic but the head revision is not dead?
14849 @c Not sure whether this should produce a warning or
14850 @c something, and probably needs further thought, but
14851 @c it would appear that the situation can be detected.
14852 @c
14853 @c We might want to separate out the 1.3 compatibility
14854 @c section (for repository & working directory) from the
14855 @c rest--that might help avoid confusing people who
14856 @c are upgrading (for example) from 1.6 to 1.8.
14857 @c
14858 @c A minor incompatibility is if a current version of CVS
14859 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
14860 @c see this as if there is no tag.  Seems to me this is
14861 @c too obscure to mention.
14862
14863 The working directory format is compatible going back
14864 to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
14865 and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
14866 a working directory checked out with @sc{cvs} 1.3,
14867 @sc{cvs} will convert it, but to go back to @sc{cvs}
14868 1.3 you need to check out a new working directory with
14869 @sc{cvs} 1.3.
14870
14871 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
14872 further (1.5 was the first official release with the remote protocol,
14873 but some older versions might still be floating around).  In many
14874 cases you need to upgrade both the client and the server to take
14875 advantage of new features and bug fixes, however.
14876
14877 @c Perhaps should be saying something here about the
14878 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
14879 @c older don't use them).  These are supposed to be
14880 @c compatible in both directions, but I'm not sure
14881 @c they quite are 100%.  One common gripe is if you
14882 @c "rm -r" a directory and 1.9 gets confused, as it
14883 @c still sees it in Entries.  That one is fixed in
14884 @c (say) 1.9.6.  Someone else reported problems with
14885 @c starting with a directory which was checked out with
14886 @c an old version, and then using a new version, and
14887 @c some "D" lines appeared, but not for every
14888 @c directory, causing some directories to be skipped.
14889 @c They weren't sure how to reproduce this, though.
14890
14891 @c ---------------------------------------------------------------------
14892 @node Troubleshooting
14893 @appendix Troubleshooting
14894
14895 If you are having trouble with @sc{cvs}, this appendix
14896 may help.  If there is a particular error message which
14897 you are seeing, then you can look up the message
14898 alphabetically.  If not, you can look through the
14899 section on other problems to see if your problem is
14900 mentioned there.
14901
14902 @menu
14903 * Error messages::              Partial list of CVS errors
14904 * Connection::                  Trouble making a connection to a CVS server
14905 * Other problems::              Problems not readily listed by error message
14906 @end menu
14907
14908 @ignore
14909 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14910 @c @node Bad administrative files
14911 @appendixsec Bad administrative files
14912
14913 @c -- Give hints on how to fix them
14914 @end ignore
14915
14916 @node Error messages
14917 @appendixsec Partial list of error messages
14918
14919 Here is a partial list of error messages that you may
14920 see from @sc{cvs}.  It is not a complete list---@sc{cvs}
14921 is capable of printing many, many error messages, often
14922 with parts of them supplied by the operating system,
14923 but the intention is to list the common and/or
14924 potentially confusing error messages.
14925
14926 The messages are alphabetical, but introductory text
14927 such as @samp{cvs update: } is not considered in
14928 ordering them.
14929
14930 In some cases the list includes messages printed by old
14931 versions of @sc{cvs} (partly because users may not be
14932 sure which version of @sc{cvs} they are using at any
14933 particular moment).
14934 @c If we want to start retiring messages, perhaps we
14935 @c should pick a cutoff version (for example, no more
14936 @c messages which are specific to versions before 1.9)
14937 @c and then move the old messages to an "old messages"
14938 @c node rather than deleting them completely.
14939
14940 @table @code
14941 @c FIXME: What is the correct way to format a multiline
14942 @c error message here?  Maybe @table is the wrong
14943 @c choice?  Texinfo gurus?
14944 @item @var{file}:@var{line}: Assertion '@var{text}' failed
14945 The exact format of this message may vary depending on
14946 your system.  It indicates a bug in @sc{cvs}, which can
14947 be handled as described in @ref{BUGS}.
14948
14949 @item cvs @var{command}: authorization failed: server @var{host} rejected access
14950 This is a generic response when trying to connect to a
14951 pserver server which chooses not to provide a
14952 specific reason for denying authorization.  Check that
14953 the username and password specified are correct and
14954 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
14955 in @file{inetd.conf}.  See @ref{Password authenticated}.
14956
14957 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
14958 This message indicates that you removed a file, and
14959 someone else modified it.  To resolve the conflict,
14960 first run @samp{cvs add @var{file}}.  If desired, look
14961 at the other party's modification to decide whether you
14962 still want to remove it.  If you don't want to remove
14963 it, stop here.  If you do want to remove it, proceed
14964 with @samp{cvs remove @var{file}} and commit your
14965 removal.
14966 @c Tests conflicts2-142b* in sanity.sh test for this.
14967
14968 @item cannot change permissions on temporary directory
14969 @example
14970 Operation not permitted
14971 @end example
14972 This message has been happening in a non-reproducible,
14973 occasional way when we run the client/server testsuite,
14974 both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
14975 able to figure out what causes it, nor is it known
14976 whether it is specific to Linux (or even to this
14977 particular machine!).  If the problem does occur on
14978 other unices, @samp{Operation not permitted} would be
14979 likely to read @samp{Not owner} or whatever the system
14980 in question uses for the unix @code{EPERM} error.  If
14981 you have any information to add, please let us know as
14982 described in @ref{BUGS}.  If you experience this error
14983 while using @sc{cvs}, retrying the operation which
14984 produced it should work fine.
14985 @c This has been seen in a variety of tests, including
14986 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
14987 @c so it doesn't seem particularly specific to any one
14988 @c test.
14989
14990 @item cvs [server aborted]: Cannot check out files into the repository itself
14991 The obvious cause for this message (especially for
14992 non-client/server @sc{cvs}) is that the @sc{cvs} root
14993 is, for example, @file{/usr/local/cvsroot} and you try
14994 to check out files when you are in a subdirectory, such
14995 as @file{/usr/local/cvsroot/test}.  However, there is a
14996 more subtle cause, which is that the temporary
14997 directory on the server is set to a subdirectory of the
14998 root (which is also not allowed).  If this is the
14999 problem, set the temporary directory to somewhere else,
15000 for example @file{/var/tmp}; see @code{TMPDIR} in
15001 @ref{Environment variables}, for how to set the
15002 temporary directory.
15003
15004 @item cannot commit files as 'root'
15005 See @samp{'root' is not allowed to commit files}.
15006
15007 @c For one example see basica-1a10 in the testsuite
15008 @c For another example, "cvs co ." on NT; see comment
15009 @c at windows-NT/filesubr.c (expand_wild).
15010 @c For another example, "cvs co foo/bar" where foo exists.
15011 @item cannot open CVS/Entries for reading: No such file or directory
15012 This generally indicates a @sc{cvs} internal error, and
15013 can be handled as with other @sc{cvs} bugs
15014 (@pxref{BUGS}).  Usually there is a workaround---the
15015 exact nature of which would depend on the situation but
15016 which hopefully could be figured out.
15017
15018 @c This is more obscure than it might sound; it only
15019 @c happens if you run "cvs init" from a directory which
15020 @c contains a CVS/Root file at the start.
15021 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
15022 This message is harmless.  Provided it is not
15023 accompanied by other errors, the operation has
15024 completed successfully.  This message should not occur
15025 with current versions of @sc{cvs}, but it is documented
15026 here for the benefit of @sc{cvs} 1.9 and older.
15027
15028 @item cvs server: cannot open /root/.cvsignore: Permission denied
15029 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
15030 See @ref{Connection}.
15031
15032 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
15033 This message has been reported as intermittently
15034 happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
15035 unknown; if you know more about what causes it, let us
15036 know as described in @ref{BUGS}.
15037
15038 @item cvs [@var{command} aborted]: cannot start server via rcmd
15039 This, unfortunately, is a rather nonspecific error
15040 message which @sc{cvs} 1.9 will print if you are
15041 running the @sc{cvs} client and it is having trouble
15042 connecting to the server.  Current versions of @sc{cvs}
15043 should print a much more specific error message.  If
15044 you get this message when you didn't mean to run the
15045 client at all, you probably forgot to specify
15046 @code{:local:}, as described in @ref{Repository}.
15047
15048 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
15049 @sc{cvs} 1.9 and older will print this message
15050 when trying to check in a binary file if
15051 @sc{rcs} is not correctly installed.  Re-read the
15052 instructions that came with your @sc{rcs} distribution
15053 and the @sc{install} file in the @sc{cvs}
15054 distribution.  Alternately, upgrade to a current
15055 version of @sc{cvs}, which checks in files itself
15056 rather than via @sc{rcs}.
15057
15058 @item cvs checkout: could not check out @var{file}
15059 With @sc{cvs} 1.9, this can mean that the @code{co} program
15060 (part of @sc{rcs}) returned a failure.  It should be
15061 preceded by another error message, however it has been
15062 observed without another error message and the cause is
15063 not well-understood.  With the current version of @sc{cvs},
15064 which does not run @code{co}, if this message occurs
15065 without another error message, it is definitely a @sc{cvs}
15066 bug (@pxref{BUGS}).
15067 @c My current suspicion is that the RCS in the rcs (not
15068 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
15069 @c CD is bad (remains to be confirmed).
15070 @c There is also a report of something which looks
15071 @c very similar on SGI, Irix 5.2, so I dunno.
15072
15073 @item cvs [login aborted]: could not find out home directory
15074 This means that you need to set the environment
15075 variables that @sc{cvs} uses to locate your home directory.
15076 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
15077 @ref{Environment variables}.
15078
15079 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
15080 @sc{cvs} 1.9 and older will print this message if there was
15081 a problem finding the @code{rcsmerge} program.  Make
15082 sure that it is in your @code{PATH}, or upgrade to a
15083 current version of @sc{cvs}, which does not require
15084 an external @code{rcsmerge} program.
15085
15086 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
15087 This means that there was a problem finding the
15088 @code{patch} program.  Make sure that it is in your
15089 @code{PATH}.  Note that despite appearances the message
15090 is @emph{not} referring to whether it can find @var{file}.
15091 If both the client and the server are running a current
15092 version of @sc{cvs}, then there is no need for an
15093 external patch program and you should not see this
15094 message.  But if either client or server is running
15095 @sc{cvs} 1.9, then you need @code{patch}.
15096
15097 @item cvs update: could not patch @var{file}; will refetch
15098 This means that for whatever reason the client was
15099 unable to apply a patch that the server sent.  The
15100 message is nothing to be concerned about, because
15101 inability to apply the patch only slows things down and
15102 has no effect on what @sc{cvs} does.
15103 @c xref to update output.  Or File status?
15104 @c Or some place else that
15105 @c explains this whole "patch"/P/Needs Patch thing?
15106
15107 @item dying gasps from @var{server} unexpected
15108 There is a known bug in the server for @sc{cvs} 1.9.18
15109 and older which can cause this.  For me, this was
15110 reproducible if I used the @samp{-t} global option.  It
15111 was fixed by Andy Piper's 14 Nov 1997 change to
15112 src/filesubr.c, if anyone is curious.
15113 If you see the message,
15114 you probably can just retry the operation which failed,
15115 or if you have discovered information concerning its
15116 cause, please let us know as described in @ref{BUGS}.
15117
15118 @item end of file from server (consult above messages if any)
15119 The most common cause for this message is if you are
15120 using an external @code{rsh} program and it exited with
15121 an error.  In this case the @code{rsh} program should
15122 have printed a message, which will appear before the
15123 above message.  For more information on setting up a
15124 @sc{cvs} client and server, see @ref{Remote repositories}.
15125
15126 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
15127 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
15128 This means that there is a syntax error in the given
15129 @sc{rcs} file.  Note that this might be true even if @sc{rcs} can
15130 read the file OK; @sc{cvs} does more error checking of
15131 errors in the RCS file.  That is why you may see this
15132 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
15133 1.10.  The likely cause for the original corruption is
15134 hardware, the operating system, or the like.  Of
15135 course, if you find a case in which @sc{cvs} seems to
15136 corrupting the file, by all means report it,
15137 (@pxref{BUGS}).
15138 There are quite a few variations of this error message,
15139 depending on exactly where in the @sc{rcs} file @sc{cvs}
15140 finds the syntax error.
15141
15142 @cindex mkmodules
15143 @item cvs commit: Executing 'mkmodules'
15144 This means that your repository is set up for a version
15145 of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
15146 1.8 or later, the above message will be preceded by
15147
15148 @example
15149 cvs commit: Rebuilding administrative file database
15150 @end example
15151
15152 If you see both messages, the database is being rebuilt
15153 twice, which is unnecessary but harmless.  If you wish
15154 to avoid the duplication, and you have no versions of
15155 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
15156 every place it appears in your @code{modules}
15157 file.  For more information on the @code{modules} file,
15158 see @ref{modules}.
15159
15160 @c This message comes from "co", and I believe is
15161 @c possible only with older versions of CVS which call
15162 @c co.  The problem with being able to create the bogus
15163 @c RCS file still exists, though (and I think maybe
15164 @c there is a different symptom(s) now).
15165 @c FIXME: Would be nice to have a more exact wording
15166 @c for this message.
15167 @item missing author
15168 Typically this can happen if you created an RCS file
15169 with your username set to empty.  @sc{cvs} will, bogusly,
15170 create an illegal RCS file with no value for the author
15171 field.  The solution is to make sure your username is
15172 set to a non-empty value and re-create the RCS file.
15173 @c "make sure your username is set" is complicated in
15174 @c and of itself, as there are the environment
15175 @c variables the system login name, &c, and it depends
15176 @c on the version of CVS.
15177
15178 @item cvs [checkout aborted]: no such tag @var{tag}
15179 This message means that @sc{cvs} isn't familiar with
15180 the tag @var{tag}.  Usually the root cause is that you have
15181 mistyped a tag name.  Ocassionally this can also occur because the
15182 users creating tags do not have permissions to write to the
15183 @file{CVSROOT/val-tags} file (@pxref{File permissions}, for more).
15184
15185 Prior to @sc{cvs} version 1.12.10, there were a few relatively
15186 obscure cases where a given tag could be created in an archive
15187 file in the repository but @sc{cvs} would require the user to
15188 @c Search sanity.sh for "no such tag" to see some of
15189 @c the relatively obscure cases.
15190 try a few other @sc{cvs} commands involving that tag
15191 until one was found whch caused @sc{cvs} to update
15192 @cindex CVSROOT/val-tags file, forcing tags into
15193 @cindex val-tags file, forcing tags into
15194 the @file{val-tags} file, at which point the originally failing command
15195 would begin to work.  This same method can be used to repair a @file{val-tags}
15196 file that becomes out of date due to the permissions problem mentioned above.
15197 This updating is only required once per tag - once a tag is listed in
15198 @file{val-tags}, it stays there.
15199
15200 Note that using @samp{tag -f} to not require tag matches did not and
15201 does not override this check (@pxref{Common options}). 
15202  
15203 @item *PANIC* administration files missing
15204 This typically means that there is a directory named
15205 @sc{cvs} but it does not contain the administrative files
15206 which @sc{cvs} puts in a CVS directory.  If the problem is
15207 that you created a CVS directory via some mechanism
15208 other than @sc{cvs}, then the answer is simple, use a name
15209 other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
15210 (@pxref{BUGS}).
15211
15212 @item rcs error: Unknown option: -x,v/
15213 This message will be followed by a usage message for
15214 @sc{rcs}.  It means that you have an old version of
15215 @sc{rcs} (probably supplied with your operating
15216 system), as well as an old version of @sc{cvs}.
15217 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
15218 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
15219 @c For more information on installing @sc{cvs}, see
15220 @c (FIXME: where?  it depends on whether you are
15221 @c getting binaries or sources or what).
15222 @c The message can also say "ci error" or something
15223 @c instead of "rcs error", I suspect.
15224
15225 @item cvs [server aborted]: received broken pipe signal
15226 This message can be caused by a loginfo program that fails to
15227 read all of the log information from its standard input.
15228 If you find it happening in any other circumstances,
15229 please let us know as described in @ref{BUGS}.
15230
15231 @item 'root' is not allowed to commit files
15232 When committing a permanent change, @sc{cvs} makes a log entry of
15233 who committed the change.  If you are committing the change logged
15234 in as "root" (not under "su" or other root-priv giving program),
15235 @sc{cvs} cannot determine who is actually making the change.
15236 As such, by default, @sc{cvs} disallows changes to be committed by users
15237 logged in as "root".  (You can disable this option by passing the
15238 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
15239 On some systems this means editing the appropriate @file{config.h} file
15240 before building @sc{cvs}.)
15241
15242 @item Too many arguments!
15243 This message is typically printed by the @file{log.pl}
15244 script which is in the @file{contrib} directory in the
15245 @sc{cvs} source distribution.  In some versions of
15246 @sc{cvs}, @file{log.pl} has been part of the default
15247 @sc{cvs} installation.  The @file{log.pl} script gets
15248 called from the @file{loginfo} administrative file.
15249 Check that the arguments passed in @file{loginfo} match
15250 what your version of @file{log.pl} expects.  In
15251 particular, the @file{log.pl} from @sc{cvs} 1.3 and
15252 older expects the log file as an argument whereas the
15253 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
15254 log file to be specified with a @samp{-f} option.  Of
15255 course, if you don't need @file{log.pl} you can just
15256 comment it out of @file{loginfo}.
15257
15258 @item cvs [update aborted]: unexpected EOF reading @var{file},v
15259 See @samp{EOF in key in RCS file}.
15260
15261 @item cvs [login aborted]: unrecognized auth response from @var{server}
15262 This message typically means that the server is not set
15263 up properly.  For example, if @file{inetd.conf} points
15264 to a nonexistent cvs executable.  To debug it further,
15265 find the log file which inetd writes
15266 (@file{/var/log/messages} or whatever inetd uses on
15267 your system).  For details, see @ref{Connection}, and
15268 @ref{Password authentication server}.
15269
15270 @item cvs commit: Up-to-date check failed for `@var{file}'
15271 This means that someone else has committed a change to
15272 that file since the last time that you did a @code{cvs
15273 update}.  So before proceeding with your @code{cvs
15274 commit} you need to @code{cvs update}.  @sc{cvs} will merge
15275 the changes that you made and the changes that the
15276 other person made.  If it does not detect any conflicts
15277 it will report @samp{M @var{file}} and you are ready
15278 to @code{cvs commit}.  If it detects conflicts it will
15279 print a message saying so, will report @samp{C @var{file}},
15280 and you need to manually resolve the
15281 conflict.  For more details on this process see
15282 @ref{Conflicts example}.
15283
15284 @item Usage:    diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
15285 @example
15286 Only one of [exEX3] allowed
15287 @end example
15288 This indicates a problem with the installation of
15289 @code{diff3} and @code{rcsmerge}.  Specifically
15290 @code{rcsmerge} was compiled to look for GNU diff3, but
15291 it is finding unix diff3 instead.  The exact text of
15292 the message will vary depending on the system.  The
15293 simplest solution is to upgrade to a current version of
15294 @sc{cvs}, which does not rely on external
15295 @code{rcsmerge} or @code{diff3} programs.
15296
15297 @item warning: unrecognized response `@var{text}' from cvs server
15298 If @var{text} contains a valid response (such as
15299 @samp{ok}) followed by an extra carriage return
15300 character (on many systems this will cause the second
15301 part of the message to overwrite the first part), then
15302 it probably means that you are using the @samp{:ext:}
15303 access method with a version of rsh, such as most
15304 non-unix rsh versions, which does not by default
15305 provide a transparent data stream.  In such cases you
15306 probably want to try @samp{:server:} instead of
15307 @samp{:ext:}.  If @var{text} is something else, this
15308 may signify a problem with your @sc{cvs} server.
15309 Double-check your installation against the instructions
15310 for setting up the @sc{cvs} server.
15311 @c FIXCVS: should be printing CR as \r or \015 or some
15312 @c such, probably.
15313
15314 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
15315 This is a normal message, not an error.  See
15316 @ref{Concurrency}, for more details.
15317
15318 @item cvs commit: warning: editor session failed
15319 @cindex Exit status, of editor
15320 This means that the editor which @sc{cvs} is using exits with a nonzero
15321 exit status.  Some versions of vi will do this even when there was not
15322 a problem editing the file.  If so, point the
15323 @code{CVSEDITOR} environment variable to a small script
15324 such as:
15325
15326 @example
15327 #!/bin/sh
15328 vi $*
15329 exit 0
15330 @end example
15331
15332 @item cvs [server aborted]: Secondary out of sync with primary!
15333
15334 This usually means that the version of @sc{cvs} running on a secondary server
15335 and a primary server (@pxref{Write proxies}) are not the same.  This will not
15336 occur if the client support redirection.
15337
15338 It is not the version number that is significant here, but the list of
15339 supported requests that the servers provide to the client.  Thus, if the
15340 secondary was compiled with GSSAPI support and the primary was not, then the
15341 list of supported requests provided by the two servers will be different and
15342 the secondary will not work as a transparent proxy to the primary.  Conversely,
15343 one server could be version 1.12.10 and the other version 1.12.11 if they both
15344 provided the same list of valid requests to the client.
15345
15346 @c "warning: foo was lost" and "no longer pertinent" (both normal).
15347 @c Would be nice to write these up--they are
15348 @c potentially confusing for the new user.
15349 @end table
15350
15351 @node Connection
15352 @appendixsec Trouble making a connection to a CVS server
15353
15354 This section concerns what to do if you are having
15355 trouble making a connection to a @sc{cvs} server.  If
15356 you are running the @sc{cvs} command line client
15357 running on Windows, first upgrade the client to
15358 @sc{cvs} 1.9.12 or later.  The error reporting in
15359 earlier versions provided much less information about
15360 what the problem was.  If the client is non-Windows,
15361 @sc{cvs} 1.9 should be fine.
15362
15363 If the error messages are not sufficient to track down
15364 the problem, the next steps depend largely on which
15365 access method you are using.
15366
15367 @table @code
15368 @cindex :ext:, troubleshooting
15369 @item :ext:
15370 Try running the rsh program from the command line.  For
15371 example: "rsh servername cvs -v" should print @sc{cvs}
15372 version information.  If this doesn't work, you need to
15373 fix it before you can worry about @sc{cvs} problems.
15374
15375 @cindex :server:, troubleshooting
15376 @item :server:
15377 You don't need a command line rsh program to use this
15378 access method, but if you have an rsh program around,
15379 it may be useful as a debugging tool.  Follow the
15380 directions given for :ext:.
15381
15382 @cindex :pserver:, troubleshooting
15383 @item :pserver:
15384 Errors along the lines of "connection refused" typically indicate
15385 that inetd isn't even listening for connections on port 2401
15386 whereas errors like "connection reset by peer",
15387 "received broken pipe signal", "recv() from server: EOF",
15388 or "end of file from server"
15389 typically indicate that inetd is listening for
15390 connections but is unable to start @sc{cvs} (this is frequently
15391 caused by having an incorrect path in @file{inetd.conf}
15392 or by firewall software rejecting the connection).
15393 "unrecognized auth response" errors are caused by a bad command
15394 line in @file{inetd.conf}, typically an invalid option or forgetting
15395 to put the @samp{pserver} command at the end of the line.
15396 Another less common problem is invisible control characters that
15397 your editor "helpfully" added without you noticing.
15398
15399 One good debugging tool is to "telnet servername
15400 2401".  After connecting, send any text (for example
15401 "foo" followed by return).  If @sc{cvs} is working
15402 correctly, it will respond with
15403
15404 @example
15405 cvs [pserver aborted]: bad auth protocol start: foo
15406 @end example
15407
15408 If instead you get:
15409
15410 @example
15411 Usage: cvs [cvs-options] command [command-options-and-arguments]
15412 ...
15413 @end example
15414
15415 @noindent
15416 then you're missing the @samp{pserver} command at the end of the
15417 line in @file{inetd.conf}; check to make sure that the entire command
15418 is on one line and that it's complete.
15419
15420 Likewise, if you get something like:
15421
15422 @example
15423 Unknown command: `pserved'
15424
15425 CVS commands are:
15426         add          Add a new file/directory to the repository
15427 ...
15428 @end example
15429
15430 @noindent
15431 then you've misspelled @samp{pserver} in some way.  If it isn't
15432 obvious, check for invisible control characters (particularly
15433 carriage returns) in @file{inetd.conf}.
15434
15435 If it fails to work at all, then make sure inetd is working
15436 right.  Change the invocation in @file{inetd.conf} to run the
15437 echo program instead of cvs.  For example:
15438
15439 @example
15440 2401  stream  tcp  nowait  root /bin/echo echo hello
15441 @end example
15442
15443 After making that change and instructing inetd to
15444 re-read its configuration file, "telnet servername
15445 2401" should show you the text hello and then the
15446 server should close the connection.  If this doesn't
15447 work, you need to fix it before you can worry about
15448 @sc{cvs} problems.
15449
15450 On AIX systems, the system will often have its own
15451 program trying to use port 2401.  This is AIX's problem
15452 in the sense that port 2401 is registered for use with
15453 @sc{cvs}.  I hear that there is an AIX patch available
15454 to address this problem.
15455
15456 Another good debugging tool is the @samp{-d}
15457 (debugging) option to inetd.  Consult your system
15458 documentation for more information.
15459
15460 If you seem to be connecting but get errors like:
15461
15462 @example
15463 cvs server: cannot open /root/.cvsignore: Permission denied
15464 cvs [server aborted]: can't chdir(/root): Permission denied
15465 @end example
15466
15467 @noindent
15468 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
15469 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
15470 your system setting the @code{$HOME} environment variable
15471 for programs being run by inetd.  In this case, you can either
15472 have inetd run a shell script that unsets @code{$HOME} and then runs
15473 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
15474 environment.)
15475
15476 If you can connect successfully for a while but then can't,
15477 you've probably hit inetd's rate limit.
15478 (If inetd receives too many requests for the same service
15479 in a short period of time, it assumes that something is wrong
15480 and temporarily disables the service.)
15481 Check your inetd documentation to find out how to adjust the
15482 rate limit (some versions of inetd have a single rate limit,
15483 others allow you to set the limit for each service separately.)
15484 @end table
15485
15486 @node Other problems
15487 @appendixsec Other common problems
15488
15489 Here is a list of problems which do not fit into the
15490 above categories.  They are in no particular order.
15491
15492 @itemize @bullet
15493 @item
15494 On Windows, if there is a 30 second or so delay when
15495 you run a @sc{cvs} command, it may mean that you have
15496 your home directory set to @file{C:/}, for example (see
15497 @code{HOMEDRIVE} and @code{HOMEPATH} in
15498 @ref{Environment variables}).  @sc{cvs} expects the home
15499 directory to not end in a slash, for example @file{C:}
15500 or @file{C:\cvs}.
15501 @c FIXCVS: CVS should at least detect this and print an
15502 @c error, presumably.
15503
15504 @item
15505 If you are running @sc{cvs} 1.9.18 or older, and
15506 @code{cvs update} finds a conflict and tries to
15507 merge, as described in @ref{Conflicts example}, but
15508 doesn't tell you there were conflicts, then you may
15509 have an old version of @sc{rcs}.  The easiest solution
15510 probably is to upgrade to a current version of
15511 @sc{cvs}, which does not rely on external @sc{rcs}
15512 programs.
15513 @end itemize
15514
15515 @c ---------------------------------------------------------------------
15516 @node Credits
15517 @appendix Credits
15518
15519 @cindex Contributors (manual)
15520 @cindex Credits (manual)
15521 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
15522 wrote the manual pages which were distributed with
15523 @sc{cvs} 1.3.  Much of their text was copied into this
15524 manual.  He also read an early draft
15525 of this manual and contributed many ideas and
15526 corrections.
15527
15528 The mailing-list @code{info-cvs} is sometimes
15529 informative. I have included information from postings
15530 made by the following persons:
15531 David G. Grubbs <@t{dgg@@think.com}>.
15532
15533 Some text has been extracted from the man pages for
15534 @sc{rcs}.
15535
15536 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
15537 useful material.  The @sc{faq} is no longer maintained,
15538 however, and this manual is about the closest thing there
15539 is to a successor (with respect to documenting how to
15540 use @sc{cvs}, at least).
15541
15542 In addition, the following persons have helped by
15543 telling me about mistakes I've made:
15544
15545 @display
15546 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
15547 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
15548 Karl Pingle <@t{pingle@@acuson.com}>,
15549 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
15550 Inge Wallin <@t{ingwa@@signum.se}>,
15551 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
15552 and Michael Brown <@t{brown@@wi.extrel.com}>.
15553 @end display
15554
15555 The list of contributors here is not comprehensive; for a more
15556 complete list of who has contributed to this manual see
15557 the file @file{doc/ChangeLog} in the @sc{cvs} source
15558 distribution.
15559
15560 @c ---------------------------------------------------------------------
15561 @node BUGS
15562 @appendix Dealing with bugs in CVS or this manual
15563
15564 @cindex Bugs in this manual or CVS
15565 Neither @sc{cvs} nor this manual is perfect, and they
15566 probably never will be.  If you are having trouble
15567 using @sc{cvs}, or think you have found a bug, there
15568 are a number of things you can do about it.  Note that
15569 if the manual is unclear, that can be considered a bug
15570 in the manual, so these problems are often worth doing
15571 something about as well as problems with @sc{cvs} itself.
15572
15573 @cindex Reporting bugs
15574 @cindex Bugs, reporting
15575 @cindex Errors, reporting
15576 @itemize @bullet
15577 @item
15578 If you want someone to help you and fix bugs that you
15579 report, there are companies which will do that for a
15580 fee.  One such company is:
15581
15582 @cindex Ximbiot
15583 @cindex Support, getting CVS support
15584 @example
15585 Ximbiot
15586 319 S. River St.
15587 Harrisburg, PA  17104-1657
15588 USA
15589 Email: info@@ximbiot.com
15590 Phone: (717) 579-6168
15591 Fax:   (717) 234-3125
15592 @url{http://ximbiot.com/}
15593
15594 @end example
15595
15596 @item
15597 If you got @sc{cvs} through a distributor, such as an
15598 operating system vendor or a vendor of freeware
15599 @sc{cd-rom}s, you may wish to see whether the
15600 distributor provides support.  Often, they will provide
15601 no support or minimal support, but this may vary from
15602 distributor to distributor.
15603
15604 @item
15605 If you have the skills and time to do so, you may wish
15606 to fix the bug yourself.  If you wish to submit your
15607 fix for inclusion in future releases of @sc{cvs}, see
15608 the file @sc{hacking} in the @sc{cvs} source
15609 distribution.  It contains much more information on the
15610 process of submitting fixes.
15611
15612 @item
15613 There may be resources on the net which can help.  Two
15614 good places to start are:
15615
15616 @example
15617 @url{http://www.cvshome.org}
15618 @end example
15619
15620 If you are so inspired, increasing the information
15621 available on the net is likely to be appreciated.  For
15622 example, before the standard @sc{cvs} distribution
15623 worked on Windows 95, there was a web page with some
15624 explanation and patches for running @sc{cvs} on Windows
15625 95, and various people helped out by mentioning this
15626 page on mailing lists or newsgroups when the subject
15627 came up.
15628
15629 @item
15630 It is also possible to report bugs to @email{bug-cvs@@gnu.org}.
15631 Note that someone may or may not want to do anything
15632 with your bug report---if you need a solution consider
15633 one of the options mentioned above.  People probably do
15634 want to hear about bugs which are particularly severe
15635 in consequences and/or easy to fix, however.  You can
15636 also increase your odds by being as clear as possible
15637 about the exact nature of the bug and any other
15638 relevant information.  The way to report bugs is to
15639 send email to @email{bug-cvs@@gnu.org}.  Note
15640 that submissions to @email{bug-cvs@@gnu.org} may be distributed
15641 under the terms of the @sc{gnu} Public License, so if
15642 you don't like this, don't submit them.  There is
15643 usually no justification for sending mail directly to
15644 one of the @sc{cvs} maintainers rather than to
15645 @email{bug-cvs@@gnu.org}; those maintainers who want to hear
15646 about such bug reports read @email{bug-cvs@@gnu.org}.  Also note
15647 that sending a bug report to other mailing lists or
15648 newsgroups is @emph{not} a substitute for sending it to
15649 @email{bug-cvs@@gnu.org}.  It is fine to discuss @sc{cvs} bugs on
15650 whatever forum you prefer, but there are not
15651 necessarily any maintainers reading bug reports sent
15652 anywhere except @email{bug-cvs@@gnu.org}.
15653 @end itemize
15654
15655 @cindex Known bugs in this manual or CVS
15656 People often ask if there is a list of known bugs or
15657 whether a particular bug is a known one.  The file
15658 @sc{bugs} in the @sc{cvs} source distribution is one
15659 list of known bugs, but it doesn't necessarily try to
15660 be comprehensive.  Perhaps there will never be a
15661 comprehensive, detailed list of known bugs.
15662
15663 @c ---------------------------------------------------------------------
15664 @node Index
15665 @unnumbered Index
15666 @cindex Index
15667
15668 @printindex cp
15669
15670 @summarycontents
15671
15672 @contents
15673
15674 @bye
15675 \f
15676 Local Variables:
15677 fill-column: 55
15678 End: