]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/doc/cvs.texinfo
This commit was generated by cvs2svn to compensate for changes in r173932,
[FreeBSD/FreeBSD.git] / contrib / cvs / doc / cvs.texinfo
1 \input texinfo  @c -*-texinfo-*-
2 @comment Documentation for CVS.
3 @setfilename cvs.info
4 @macro copyleftnotice
5 @noindent
6 Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
7                        2001, 2002, 2003, 2004 Free Software Foundation, Inc.
8
9 @multitable @columnfractions .12 .88
10 @item Portions
11 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004
12                                   Derek R. Price,
13 @item @tab Copyright @copyright{} 2002, 2003, 2004
14                                   Ximbiot @url{http://ximbiot.com},
15 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
16 @item @tab and Copyright @copyright{} others.
17 @end multitable
18
19 @ignore
20 Permission is granted to process this file through Tex and print the
21 results, provided the printed document carries copying permission
22 notice identical to this one except for the removal of this paragraph
23 (this paragraph not being relevant to the printed manual).
24
25 @end ignore
26 Permission is granted to make and distribute verbatim copies of
27 this manual provided the copyright notice and this permission notice
28 are preserved on all copies.
29
30 Permission is granted to copy and distribute modified versions of this
31 manual under the conditions for verbatim copying, provided also that the
32 entire resulting derived work is distributed under the terms of a
33 permission notice identical to this one.
34
35 Permission is granted to copy and distribute translations of this manual
36 into another language, under the above conditions for modified versions,
37 except that this permission notice may be stated in a translation
38 approved by the Free Software Foundation.
39 @end macro
40
41 @comment This file is part of the CVS distribution.
42
43 @comment CVS is free software; you can redistribute it and/or modify
44 @comment it under the terms of the GNU General Public License as published by
45 @comment the Free Software Foundation; either version 2, or (at your option)
46 @comment any later version.
47
48 @comment CVS is distributed in the hope that it will be useful,
49 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
50 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
51 @comment GNU General Public License for more details.
52
53 @c See ../README for A4 vs. US letter size.
54 @c When we provided A4 postscript, and people tried to
55 @c print it on US letter, the usual complaint was that the
56 @c page numbers would get cut off.
57 @c If one prints US letter on A4, reportedly there is
58 @c some extra space at the top and/or bottom, and the side
59 @c margins are a bit narrow, but no text is lost.
60 @c
61 @c See
62 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
63 @c for more on paper sizes.  Insuring that margins are
64 @c big enough to print on either A4 or US letter does
65 @c indeed seem to be the usual approach (RFC2346).
66
67 @c This document seems to get overfull hboxes with some
68 @c frequency (probably because the tendency is to
69 @c sanity-check it with "make info" and run TeX less
70 @c often).  The big ugly boxes just seem to add insult
71 @c to injury, and I'm not aware of them helping to fix
72 @c the overfull hboxes at all.
73 @finalout
74
75 @include version.texi
76 @settitle CVS---Concurrent Versions System v@value{VERSION}
77 @setchapternewpage odd
78
79 @c -- TODO list:
80 @c -- Fix all lines that match "^@c -- "
81 @c -- Also places marked with FIXME should be manual
82 @c problems (as opposed to FIXCVS for CVS problems).
83
84 @c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
85 @c @asis when generating info and dvi, and by <i></i> in the generated html,
86 @c such that keywords are not expanded in the generated html. 
87 @ifnothtml
88 @macro splitrcskeyword {arg}
89 @asis{}\arg\
90 @end macro
91 @end ifnothtml
92
93 @ifhtml
94 @macro splitrcskeyword {arg}
95 @i{}\arg\
96 @end macro
97 @end ifhtml
98
99 @dircategory GNU Packages
100 @direntry
101 * CVS: (cvs).                   Concurrent Versions System
102 @end direntry
103 @dircategory Individual utilities
104 @direntry
105 * cvs: (cvs)CVS commands.       Concurrent Versions System
106 @end direntry
107
108 @comment The titlepage section does not appear in the Info file.
109 @titlepage
110 @sp 4
111 @comment The title is printed in a large font.
112 @center @titlefont{Version Management}
113 @sp
114 @center @titlefont{with}
115 @sp
116 @center @titlefont{CVS}
117 @sp 2
118 @center for @sc{cvs} @value{VERSION}
119 @comment -release-
120 @sp 3
121 @center Per Cederqvist et al
122
123 @comment  The following two commands start the copyright page
124 @comment  for the printed manual.  This will not appear in the Info file.
125 @page
126 @vskip 0pt plus 1filll
127 @copyleftnotice
128 @end titlepage
129
130 @comment ================================================================
131 @comment                   The real text starts here
132 @comment ================================================================
133
134 @ifnottex
135 @c ---------------------------------------------------------------------
136 @node    Top
137 @top
138
139 This info manual describes how to use and administer
140 @sc{cvs} version @value{VERSION}.
141 @end ifnottex
142
143 @ifinfo
144 @copyleftnotice
145 @end ifinfo
146
147 @c This menu is pretty long.  Not sure how easily that
148 @c can be fixed (no brilliant ideas right away)...
149 @menu
150 * Overview::                    An introduction to CVS
151 * Repository::                  Where all your sources are stored
152 * Starting a new project::      Starting a project with CVS
153 * Revisions::                   Numeric and symbolic names for revisions
154 * Branching and merging::       Diverging/rejoining branches of development
155 * Recursive behavior::          CVS descends directories
156 * Adding and removing::         Adding/removing/renaming files/directories
157 * History browsing::            Viewing the history of files in various ways
158
159 CVS and the Real World.
160 -----------------------
161 * Binary files::                CVS can handle binary files
162 * Multiple developers::         How CVS helps a group of developers
163 * Revision management::         Policy questions for revision management
164 * Keyword substitution::        CVS can include the revision inside the file
165 * Tracking sources::            Tracking third-party sources
166 * Builds::                      Issues related to CVS and builds
167 * Special Files::               Devices, links and other non-regular files
168
169 References.
170 -----------
171 * CVS commands::                CVS commands share some things
172 * Invoking CVS::                Quick reference to CVS commands
173 * Administrative files::        Reference manual for the Administrative files
174 * Environment variables::       All environment variables which affect CVS
175 * Compatibility::               Upgrading CVS versions
176 * Troubleshooting::             Some tips when nothing works
177 * Credits::                     Some of the contributors to this manual
178 * BUGS::                        Dealing with bugs in CVS or this manual
179 * Index::                       Index
180 @end menu
181
182 @c ---------------------------------------------------------------------
183 @node Overview
184 @chapter Overview
185 @cindex Overview
186
187 This chapter is for people who have never used
188 @sc{cvs}, and perhaps have never used version control
189 software before.
190
191 If you are already familiar with @sc{cvs} and are just
192 trying to learn a particular feature or remember a
193 certain command, you can probably skip everything here.
194
195 @menu
196 * What is CVS?::                What you can do with @sc{cvs}
197 * What is CVS not?::            Problems @sc{cvs} doesn't try to solve
198 * A sample session::            A tour of basic @sc{cvs} usage
199 @end menu
200
201 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202 @node What is CVS?
203 @section What is CVS?
204 @cindex What is CVS?
205 @cindex Introduction to CVS
206 @cindex CVS, introduction to
207
208 @sc{cvs} is a version control system.  Using it, you can
209 record the history of your source files.
210
211 @c -- ///
212 @c -- ///Those who cannot remember the past are condemned to repeat it.
213 @c -- ///               -- George Santayana
214 @c -- //////
215
216 @c -- Insert history  quote here!
217 For example, bugs sometimes creep in when
218 software is modified, and you might not detect the bug
219 until a long time after you make the modification.
220 With @sc{cvs}, you can easily retrieve old versions to see
221 exactly which change caused the bug.  This can
222 sometimes be a big help.
223
224 You could of course save every version of every file
225 you have ever created.  This would
226 however waste an enormous amount of disk space.  @sc{cvs}
227 stores all the versions of a file in a single file in a
228 clever way that only stores the differences between
229 versions.
230
231 @sc{cvs} also helps you if you are part of a group of people working
232 on the same project.  It is all too easy to overwrite
233 each others' changes unless you are extremely careful.
234 Some editors, like @sc{gnu} Emacs, try to make sure that
235 the same file is never modified by two people at the
236 same time.  Unfortunately, if someone is using another
237 editor, that safeguard will not work.  @sc{cvs} solves this problem
238 by insulating the different developers from each other.  Every
239 developer works in his own directory, and @sc{cvs} merges
240 the work when each developer is done.
241
242 @cindex History of CVS
243 @cindex CVS, history of
244 @cindex Credits (CVS program)
245 @cindex Contributors (CVS program)
246 @sc{cvs} started out as a bunch of shell scripts written by
247 Dick Grune, posted to the newsgroup
248 @code{comp.sources.unix} in the volume 6
249 release of July, 1986.  While no actual code from
250 these shell scripts is present in the current version
251 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
252 come from them.
253
254 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
255 Jeff Polk later helped Brian with the design of the @sc{cvs}
256 module and vendor branch support.
257
258 @cindex Source, getting CVS source
259 You can get @sc{cvs} in a variety of ways, including
260 free download from the Internet.  For more information
261 on downloading @sc{cvs} and other @sc{cvs} topics, see:
262
263 @example
264 @url{http://www.cvshome.org/}
265 @url{http://www.loria.fr/~molli/cvs-index.html}
266 @end example
267
268 @cindex Mailing list
269 @cindex List, mailing list
270 @cindex Newsgroups
271 There is a mailing list, known as @email{info-cvs@@gnu.org},
272 devoted to @sc{cvs}.  To subscribe or
273 unsubscribe
274 write to
275 @email{info-cvs-request@@gnu.org}.
276 If you prefer a Usenet group, there is a one-way mirror (posts to the email
277 list are usually sent to the news group, but not visa versa) of
278 @email{info-cvs@@gnu.org} at @url{news:gnu.cvs.help}.  The right
279 Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
280 @sc{cvs} discussions (along with other configuration
281 management systems).  In the future, it might be
282 possible to create a
283 @code{comp.software.config-mgmt.cvs}, but probably only
284 if there is sufficient @sc{cvs} traffic on
285 @url{news:comp.software.config-mgmt}.
286 @c Other random data is that the tale was very
287 @c skeptical of comp.software.config-mgmt.cvs when the
288 @c subject came up around 1995 or so (for one
289 @c thing, because creating it would be a "reorg" which
290 @c would need to take a more comprehensive look at the
291 @c whole comp.software.config-mgmt.* hierarchy).
292
293 You can also subscribe to the @email{bug-cvs@@gnu.org} mailing list,
294 described in more detail in @ref{BUGS}.  To subscribe
295 send mail to @email{bug-cvs-request@@gnu.org}.  There is a two-way
296 Usenet mirror (posts to the Usenet group are usually sent to the email list and
297 visa versa) of @email{bug-cvs@@gnu.org} named @url{news:gnu.cvs.bug}.
298
299 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
300 @node What is CVS not?
301 @section What is CVS not?
302 @cindex What is CVS not?
303
304 @sc{cvs} can do a lot of things for you, but it does
305 not try to be everything for everyone.
306
307 @table @asis
308 @item @sc{cvs} is not a build system.
309
310 Though the structure of your repository and modules
311 file interact with your build system
312 (e.g. @file{Makefile}s), they are essentially
313 independent.
314
315 @sc{cvs} does not dictate how you build anything.  It
316 merely stores files for retrieval in a tree structure
317 you devise.
318
319 @sc{cvs} does not dictate how to use disk space in the
320 checked out working directories.  If you write your
321 @file{Makefile}s or scripts in every directory so they
322 have to know the relative positions of everything else,
323 you wind up requiring the entire repository to be
324 checked out.
325
326 If you modularize your work, and construct a build
327 system that will share files (via links, mounts,
328 @code{VPATH} in @file{Makefile}s, etc.), you can
329 arrange your disk usage however you like.
330
331 But you have to remember that @emph{any} such system is
332 a lot of work to construct and maintain.  @sc{cvs} does
333 not address the issues involved.
334
335 Of course, you should place the tools created to
336 support such a build system (scripts, @file{Makefile}s,
337 etc) under @sc{cvs}.
338
339 Figuring out what files need to be rebuilt when
340 something changes is, again, something to be handled
341 outside the scope of @sc{cvs}.  One traditional
342 approach is to use @code{make} for building, and use
343 some automated tool for generating the dependencies which
344 @code{make} uses.
345
346 See @ref{Builds}, for more information on doing builds
347 in conjunction with @sc{cvs}.
348
349 @item @sc{cvs} is not a substitute for management.
350
351 Your managers and project leaders are expected to talk
352 to you frequently enough to make certain you are aware
353 of schedules, merge points, branch names and release
354 dates.  If they don't, @sc{cvs} can't help.
355
356 @sc{cvs} is an instrument for making sources dance to
357 your tune.  But you are the piper and the composer.  No
358 instrument plays itself or writes its own music.
359
360 @item @sc{cvs} is not a substitute for developer communication.
361
362 When faced with conflicts within a single file, most
363 developers manage to resolve them without too much
364 effort.  But a more general definition of ``conflict''
365 includes problems too difficult to solve without
366 communication between developers.
367
368 @sc{cvs} cannot determine when simultaneous changes
369 within a single file, or across a whole collection of
370 files, will logically conflict with one another.  Its
371 concept of a @dfn{conflict} is purely textual, arising
372 when two changes to the same base file are near enough
373 to spook the merge (i.e. @code{diff3}) command.
374
375 @sc{cvs} does not claim to help at all in figuring out
376 non-textual or distributed conflicts in program logic.
377
378 For example: Say you change the arguments to function
379 @code{X} defined in file @file{A}.  At the same time,
380 someone edits file @file{B}, adding new calls to
381 function @code{X} using the old arguments.  You are
382 outside the realm of @sc{cvs}'s competence.
383
384 Acquire the habit of reading specs and talking to your
385 peers.
386
387
388 @item @sc{cvs} does not have change control
389
390 Change control refers to a number of things.  First of
391 all it can mean @dfn{bug-tracking}, that is being able
392 to keep a database of reported bugs and the status of
393 each one (is it fixed?  in what release?  has the bug
394 submitter agreed that it is fixed?).  For interfacing
395 @sc{cvs} to an external bug-tracking system, see the
396 @file{rcsinfo} and @file{verifymsg} files
397 (@pxref{Administrative files}).
398
399 Another aspect of change control is keeping track of
400 the fact that changes to several files were in fact
401 changed together as one logical change.  If you check
402 in several files in a single @code{cvs commit}
403 operation, @sc{cvs} then forgets that those files were
404 checked in together, and the fact that they have the
405 same log message is the only thing tying them
406 together.  Keeping a @sc{gnu} style @file{ChangeLog}
407 can help somewhat.
408 @c FIXME: should have an xref to a section which talks
409 @c more about keeping ChangeLog's with CVS, but that
410 @c section hasn't been written yet.
411
412 Another aspect of change control, in some systems, is
413 the ability to keep track of the status of each
414 change.  Some changes have been written by a developer,
415 others have been reviewed by a second developer, and so
416 on.  Generally, the way to do this with @sc{cvs} is to
417 generate a diff (using @code{cvs diff} or @code{diff})
418 and email it to someone who can then apply it using the
419 @code{patch} utility.  This is very flexible, but
420 depends on mechanisms outside @sc{cvs} to make sure
421 nothing falls through the cracks.
422
423 @item @sc{cvs} is not an automated testing program
424
425 It should be possible to enforce mandatory use of a
426 test suite using the @code{commitinfo} file.  I haven't
427 heard a lot about projects trying to do that or whether
428 there are subtle gotchas, however.
429
430 @item @sc{cvs} does not have a built-in process model
431
432 Some systems provide ways to ensure that changes or
433 releases go through various steps, with various
434 approvals as needed.  Generally, one can accomplish
435 this with @sc{cvs} but it might be a little more work.
436 In some cases you'll want to use the @file{commitinfo},
437 @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
438 files, to require that certain steps be performed
439 before cvs will allow a checkin.  Also consider whether
440 features such as branches and tags can be used to
441 perform tasks such as doing work in a development tree
442 and then merging certain changes over to a stable tree
443 only once they have been proven.
444 @end table
445
446 @c ---------------------------------------------------------------------
447 @node A sample session
448 @section A sample session
449 @cindex Example of a work-session
450 @cindex Getting started
451 @cindex Work-session, example of
452 @cindex tc, Trivial Compiler (example)
453 @cindex Trivial Compiler (example)
454
455 @c I think an example is a pretty good way to start.  But
456 @c somewhere in here, maybe after the sample session,
457 @c we need something which is kind of
458 @c a "roadmap" which is more directed at sketching out
459 @c the functionality of CVS and pointing people to
460 @c various other parts of the manual.  As it stands now
461 @c people who read in order get dumped right into all
462 @c manner of hair regarding remote repositories,
463 @c creating a repository, etc.
464 @c
465 @c The following was in the old Basic concepts node.  I don't
466 @c know how good a job it does at introducing modules,
467 @c or whether they need to be introduced so soon, but
468 @c something of this sort might go into some
469 @c introductory material somewhere.
470 @ignore
471 @cindex Modules (intro)
472 The repository contains directories and files, in an
473 arbitrary tree.  The @dfn{modules} feature can be used
474 to group together a set of directories or files into a
475 single entity (@pxref{modules}).  A typical usage is to
476 define one module per project.
477 @end ignore
478
479 As a way of introducing @sc{cvs}, we'll go through a
480 typical work-session using @sc{cvs}.  The first thing
481 to understand is that @sc{cvs} stores all files in a
482 centralized @dfn{repository} (@pxref{Repository}); this
483 section assumes that a repository is set up.
484 @c I'm not sure that the sentence concerning the
485 @c repository quite tells the user what they need to
486 @c know at this point.  Might need to expand on "centralized"
487 @c slightly (maybe not here, maybe further down in the example?)
488
489 Suppose you are working on a simple compiler.  The source
490 consists of a handful of C files and a @file{Makefile}.
491 The compiler is called @samp{tc} (Trivial Compiler),
492 and the repository is set up so that there is a module
493 called @samp{tc}.
494
495 @menu
496 * Getting the source::          Creating a workspace
497 * Committing your changes::     Making your work available to others
498 * Cleaning up::                 Cleaning up
499 * Viewing differences::         Viewing differences
500 @end menu
501
502 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
503 @node Getting the source
504 @subsection Getting the source
505 @cindex Getting the source
506 @cindex Checking out source
507 @cindex Fetching source
508 @cindex Source, getting from CVS
509 @cindex Checkout, example
510
511 The first thing you must do is to get your own working copy of the
512 source for @samp{tc}.  For this, you use the @code{checkout} command:
513
514 @example
515 $ cvs checkout tc
516 @end example
517
518 @noindent
519 This will create a new directory called @file{tc} and populate it with
520 the source files.
521
522 @example
523 $ cd tc
524 $ ls
525 CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
526 @end example
527
528 The @file{CVS} directory is used internally by
529 @sc{cvs}.  Normally, you should not modify or remove
530 any of the files in it.
531
532 You start your favorite editor, hack away at @file{backend.c}, and a couple
533 of hours later you have added an optimization pass to the compiler.
534 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
535 you want to edit.  @xref{Multiple developers}, for an explanation.
536
537 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
538 @node Committing your changes
539 @subsection Committing your changes
540 @cindex Committing changes to files
541 @cindex Log message entry
542
543 When you have checked that the compiler is still compilable you decide
544 to make a new version of @file{backend.c}.  This will
545 store your new @file{backend.c} in the repository and
546 make it available to anyone else who is using that same
547 repository.
548
549 @example
550 $ cvs commit backend.c
551 @end example
552
553 @noindent
554 @sc{cvs} starts an editor, to allow you to enter a log
555 message.  You type in ``Added an optimization pass.'',
556 save the temporary file, and exit the editor.
557
558 @cindex CVSEDITOR, environment variable
559 @cindex EDITOR, environment variable
560 The environment variable @code{$CVSEDITOR} determines
561 which editor is started.  If @code{$CVSEDITOR} is not
562 set, then if the environment variable @code{$EDITOR} is
563 set, it will be used. If both @code{$CVSEDITOR} and
564 @code{$EDITOR} are not set then there is a default
565 which will vary with your operating system, for example
566 @code{vi} for unix or @code{notepad} for Windows
567 NT/95.
568
569 @cindex VISUAL, environment variable
570 In addition, @sc{cvs} checks the @code{$VISUAL} environment
571 variable.  Opinions vary on whether this behavior is desirable and
572 whether future releases of @sc{cvs} should check @code{$VISUAL} or
573 ignore it.  You will be OK either way if you make sure that
574 @code{$VISUAL} is either unset or set to the same thing as
575 @code{$EDITOR}.
576
577 @c This probably should go into some new node
578 @c containing detailed info on the editor, rather than
579 @c the intro.  In fact, perhaps some of the stuff with
580 @c CVSEDITOR and -m and so on should too.
581 When @sc{cvs} starts the editor, it includes a list of
582 files which are modified.  For the @sc{cvs} client,
583 this list is based on comparing the modification time
584 of the file against the modification time that the file
585 had when it was last gotten or updated.  Therefore, if
586 a file's modification time has changed but its contents
587 have not, it will show up as modified.  The simplest
588 way to handle this is simply not to worry about it---if
589 you proceed with the commit @sc{cvs} will detect that
590 the contents are not modified and treat it as an
591 unmodified file.  The next @code{update} will clue
592 @sc{cvs} in to the fact that the file is unmodified,
593 and it will reset its stored timestamp so that the file
594 will not show up in future editor sessions.
595 @c FIXCVS: Might be nice if "commit" and other commands
596 @c would reset that timestamp too, but currently commit
597 @c doesn't.
598 @c FIXME: Need to talk more about the process of
599 @c prompting for the log message.  Like show an example
600 @c of what it pops up in the editor, for example.  Also
601 @c a discussion of how to get the "a)bort, c)ontinue,
602 @c e)dit" prompt and what to do with it.  Might also
603 @c work in the suggestion that if you want a diff, you
604 @c should make it before running commit (someone
605 @c suggested that the diff pop up in the editor.  I'm
606 @c not sure that is better than telling people to run
607 @c "cvs diff" first if that is what they want, but if
608 @c we want to tell people that, the manual possibly
609 @c should say it).
610
611 If you want to avoid
612 starting an editor you can specify the log message on
613 the command line using the @samp{-m} flag instead, like
614 this:
615
616 @example
617 $ cvs commit -m "Added an optimization pass" backend.c
618 @end example
619
620 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
621 @node Cleaning up
622 @subsection Cleaning up
623 @cindex Cleaning up
624 @cindex Working copy, removing
625 @cindex Removing your working copy
626 @cindex Releasing your working copy
627
628 Before you turn to other tasks you decide to remove your working copy of
629 tc.  One acceptable way to do that is of course
630
631 @example
632 $ cd ..
633 $ rm -r tc
634 @end example
635
636 @noindent
637 but a better way is to use the @code{release} command (@pxref{release}):
638
639 @example
640 $ cd ..
641 $ cvs release -d tc
642 M driver.c
643 ? tc
644 You have [1] altered files in this repository.
645 Are you sure you want to release (and delete) directory `tc': n
646 ** `release' aborted by user choice.
647 @end example
648
649 The @code{release} command checks that all your modifications have been
650 committed.  If history logging is enabled it also makes a note in the
651 history file.  @xref{history file}.
652
653 When you use the @samp{-d} flag with @code{release}, it
654 also removes your working copy.
655
656 In the example above, the @code{release} command wrote a couple of lines
657 of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
658 That is nothing to worry about: @file{tc} is the executable compiler,
659 and it should not be stored in the repository.  @xref{cvsignore},
660 for information about how to make that warning go away.
661 @xref{release output}, for a complete explanation of
662 all possible output from @code{release}.
663
664 @samp{M driver.c} is more serious.  It means that the
665 file @file{driver.c} has been modified since it was
666 checked out.
667
668 The @code{release} command always finishes by telling
669 you how many modified files you have in your working
670 copy of the sources, and then asks you for confirmation
671 before deleting any files or making any note in the
672 history file.
673
674 You decide to play it safe and answer @kbd{n @key{RET}}
675 when @code{release} asks for confirmation.
676
677 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
678 @node Viewing differences
679 @subsection Viewing differences
680 @cindex Viewing differences
681 @cindex Diff
682
683 You do not remember modifying @file{driver.c}, so you want to see what
684 has happened to that file.
685
686 @example
687 $ cd tc
688 $ cvs diff driver.c
689 @end example
690
691 This command runs @code{diff} to compare the version of @file{driver.c}
692 that you checked out with your working copy.  When you see the output
693 you remember that you added a command line option that enabled the
694 optimization pass.  You check it in, and release the module.
695 @c FIXME: we haven't yet defined the term "check in".
696
697 @example
698 $ cvs commit -m "Added an optimization pass" driver.c
699 Checking in driver.c;
700 /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
701 new revision: 1.2; previous revision: 1.1
702 done
703 $ cd ..
704 $ cvs release -d tc
705 ? tc
706 You have [0] altered files in this repository.
707 Are you sure you want to release (and delete) directory `tc': y
708 @end example
709
710 @c ---------------------------------------------------------------------
711 @node Repository
712 @chapter The Repository
713 @cindex Repository (intro)
714 @cindex Repository, example
715 @cindex Layout of repository
716 @cindex Typical repository
717 @cindex /usr/local/cvsroot, as example repository
718 @cindex cvsroot
719
720 The @sc{cvs} @dfn{repository} stores a complete copy of
721 all the files and directories which are under version
722 control.
723
724 Normally, you never access any of the files in the
725 repository directly.  Instead, you use @sc{cvs}
726 commands to get your own copy of the files into a
727 @dfn{working directory}, and then
728 work on that copy.  When you've finished a set of
729 changes, you check (or @dfn{commit}) them back into the
730 repository.  The repository then contains the changes
731 which you have made, as well as recording exactly what
732 you changed, when you changed it, and other such
733 information.  Note that the repository is not a
734 subdirectory of the working directory, or vice versa;
735 they should be in separate locations.
736 @c Need some example, e.g. repository
737 @c /usr/local/cvsroot; working directory
738 @c /home/joe/sources.  But this node is too long
739 @c as it is; need a little reorganization...
740
741 @cindex :local:, setting up
742 @sc{cvs} can access a repository by a variety of
743 means.  It might be on the local computer, or it might
744 be on a computer across the room or across the world.
745 To distinguish various ways to access a repository, the
746 repository name can start with an @dfn{access method}.
747 For example, the access method @code{:local:} means to
748 access a repository directory, so the repository
749 @code{:local:/usr/local/cvsroot} means that the
750 repository is in @file{/usr/local/cvsroot} on the
751 computer running @sc{cvs}.  For information on other
752 access methods, see @ref{Remote repositories}.
753
754 @c Can se say this more concisely?  Like by passing
755 @c more of the buck to the Remote repositories node?
756 If the access method is omitted, then if the repository
757 starts with @samp{/}, then @code{:local:} is
758 assumed.  If it does not start with @samp{/} then either
759 @code{:ext:} or @code{:server:} is assumed.  For
760 example, if you have a local repository in
761 @file{/usr/local/cvsroot}, you can use
762 @code{/usr/local/cvsroot} instead of
763 @code{:local:/usr/local/cvsroot}.  But if (under
764 Windows NT, for example) your local repository is
765 @file{c:\src\cvsroot}, then you must specify the access
766 method, as in @code{:local:c:/src/cvsroot}.
767
768 @c This might appear to go in Repository storage, but
769 @c actually it is describing something which is quite
770 @c user-visible, when you do a "cvs co CVSROOT".  This
771 @c isn't necessary the perfect place for that, though.
772 The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
773 administrative files for @sc{cvs}.  The other directories contain the actual
774 user-defined modules.
775
776 @menu
777 * Specifying a repository::     Telling CVS where your repository is
778 * Repository storage::          The structure of the repository
779 * Working directory storage::   The structure of working directories
780 * Intro administrative files::  Defining modules
781 * Multiple repositories::       Multiple repositories
782 * Creating a repository::       Creating a repository
783 * Backing up::                  Backing up a repository
784 * Moving a repository::         Moving a repository
785 * Remote repositories::         Accessing repositories on remote machines
786 * Read-only access::            Granting read-only access to the repository
787 * Server temporary directory::  The server creates temporary directories
788 @end menu
789
790 @node Specifying a repository
791 @section Telling CVS where your repository is
792
793 There are several ways to tell @sc{cvs}
794 where to find the repository.  You can name the
795 repository on the command line explicitly, with the
796 @code{-d} (for "directory") option:
797
798 @example
799 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
800 @end example
801
802 @cindex .profile, setting CVSROOT in
803 @cindex .cshrc, setting CVSROOT in
804 @cindex .tcshrc, setting CVSROOT in
805 @cindex .bashrc, setting CVSROOT in
806 @cindex CVSROOT, environment variable
807         Or you can set the @code{$CVSROOT} environment
808 variable to an absolute path to the root of the
809 repository, @file{/usr/local/cvsroot} in this example.
810 To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
811 users should have this line in their @file{.cshrc} or
812 @file{.tcshrc} files:
813
814 @example
815 setenv CVSROOT /usr/local/cvsroot
816 @end example
817
818 @noindent
819 @code{sh} and @code{bash} users should instead have these lines in their
820 @file{.profile} or @file{.bashrc}:
821
822 @example
823 CVSROOT=/usr/local/cvsroot
824 export CVSROOT
825 @end example
826
827 @cindex Root file, in CVS directory
828 @cindex CVS/Root file
829         A repository specified with @code{-d} will
830 override the @code{$CVSROOT} environment variable.
831 Once you've checked a working copy out from the
832 repository, it will remember where its repository is
833 (the information is recorded in the
834 @file{CVS/Root} file in the working copy).
835
836 The @code{-d} option and the @file{CVS/Root} file both
837 override the @code{$CVSROOT} environment variable.  If
838 @code{-d} option differs from @file{CVS/Root}, the
839 former is used.  Of course, for proper operation they
840 should be two ways of referring to the same repository.
841
842 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
843 @node Repository storage
844 @section How data is stored in the repository
845 @cindex Repository, how data is stored
846
847 For most purposes it isn't important @emph{how}
848 @sc{cvs} stores information in the repository.  In
849 fact, the format has changed in the past, and is likely
850 to change in the future.  Since in almost all cases one
851 accesses the repository via @sc{cvs} commands, such
852 changes need not be disruptive.
853
854 However, in some cases it may be necessary to
855 understand how @sc{cvs} stores data in the repository,
856 for example you might need to track down @sc{cvs} locks
857 (@pxref{Concurrency}) or you might need to deal with
858 the file permissions appropriate for the repository.
859
860 @menu
861 * Repository files::            What files are stored in the repository
862 * File permissions::            File permissions
863 * Windows permissions::         Issues specific to Windows
864 * Attic::                       Some files are stored in the Attic
865 * CVS in repository::           Additional information in CVS directory
866 * Locks::                       CVS locks control concurrent accesses
867 * CVSROOT storage::             A few things about CVSROOT are different
868 @end menu
869
870 @node Repository files
871 @subsection Where files are stored within the repository
872
873 @c @cindex Filenames, legal
874 @c @cindex Legal filenames
875 @c Somewhere we need to say something about legitimate
876 @c characters in filenames in working directory and
877 @c repository.  Not "/" (not even on non-unix).  And
878 @c here is a specific set of issues:
879 @c      Files starting with a - are handled inconsistently. They can not
880 @c   be added to a repository with an add command, because it they are
881 @c   interpreted as a switch. They can appear in a repository if they are
882 @c   part of a tree that is imported. They can not be removed from the tree
883 @c   once they are there.
884 @c Note that "--" *is* supported (as a
885 @c consequence of using GNU getopt).  Should document
886 @c this somewhere ("Common options"?).  The other usual technique,
887 @c "./-foo", isn't as effective, at least for "cvs add"
888 @c which doesn't support pathnames containing "/".
889
890 The overall structure of the repository is a directory
891 tree corresponding to the directories in the working
892 directory.  For example, supposing the repository is in
893
894 @example
895 /usr/local/cvsroot
896 @end example
897
898 @noindent
899 here is a possible directory tree (showing only the
900 directories):
901
902 @example
903 @t{/usr}
904  |
905  +--@t{local}
906  |   |
907  |   +--@t{cvsroot}
908  |   |    |
909  |   |    +--@t{CVSROOT}
910           |      (administrative files)
911           |
912           +--@t{gnu}
913           |   |
914           |   +--@t{diff}
915           |   |   (source code to @sc{gnu} diff)
916           |   |
917           |   +--@t{rcs}
918           |   |   (source code to @sc{rcs})
919           |   |
920           |   +--@t{cvs}
921           |       (source code to @sc{cvs})
922           |
923           +--@t{yoyodyne}
924               |
925               +--@t{tc}
926               |    |
927               |    +--@t{man}
928               |    |
929               |    +--@t{testing}
930               |
931               +--(other Yoyodyne software)
932 @end example
933
934 With the directories are @dfn{history files} for each file
935 under version control.  The name of the history file is
936 the name of the corresponding file with @samp{,v}
937 appended to the end.  Here is what the repository for
938 the @file{yoyodyne/tc} directory might look like:
939 @c FIXME: Should also mention CVS (CVSREP)
940 @c FIXME? Should we introduce Attic with an xref to
941 @c Attic?  Not sure whether that is a good idea or not.
942 @example
943   @code{$CVSROOT}
944     |
945     +--@t{yoyodyne}
946     |   |
947     |   +--@t{tc}
948     |   |   |
949             +--@t{Makefile,v}
950             +--@t{backend.c,v}
951             +--@t{driver.c,v}
952             +--@t{frontend.c,v}
953             +--@t{parser.c,v}
954             +--@t{man}
955             |    |
956             |    +--@t{tc.1,v}
957             |
958             +--@t{testing}
959                  |
960                  +--@t{testpgm.t,v}
961                  +--@t{test2.t,v}
962 @end example
963
964 @cindex History files
965 @cindex RCS history files
966 @c The first sentence, about what history files
967 @c contain, is kind of redundant with our intro to what the
968 @c repository does in node Repository....
969 The history files contain, among other things, enough
970 information to recreate any revision of the file, a log
971 of all commit messages and the user-name of the person
972 who committed the revision.  The history files are
973 known as @dfn{RCS files}, because the first program to
974 store files in that format was a version control system
975 known as @sc{rcs}.  For a full
976 description of the file format, see the @code{man} page
977 @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
978 file @file{doc/RCSFILES} in the @sc{cvs} source
979 distribution.  This
980 file format has become very common---many systems other
981 than @sc{cvs} or @sc{rcs} can at least import history
982 files in this format.
983 @c FIXME: Think about including documentation for this
984 @c rather than citing it?  In the long run, getting
985 @c this to be a standard (not sure if we can cope with
986 @c a standards process as formal as IEEE/ANSI/ISO/etc,
987 @c though...) is the way to go, so maybe citing is
988 @c better.
989
990 The @sc{rcs} files used in @sc{cvs} differ in a few
991 ways from the standard format.  The biggest difference
992 is magic branches; for more information see @ref{Magic
993 branch numbers}.  Also in @sc{cvs} the valid tag names
994 are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
995 rules see @ref{Tags}.
996
997 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
998 @node File permissions
999 @subsection File permissions
1000 @c -- Move this to @node Creating a repository or similar
1001 @cindex Security, file permissions in repository
1002 @cindex File permissions, general
1003 @cindex Permissions, general
1004 @c FIXME: we need to somehow reflect "permissions in
1005 @c repository" versus "permissions in working
1006 @c directory" in the index entries.
1007 @cindex Group, UNIX file permissions, in repository
1008 @cindex Read-only files, in repository
1009 All @samp{,v} files are created read-only, and you
1010 should not change the permission of those files.  The
1011 directories inside the repository should be writable by
1012 the persons that have permission to modify the files in
1013 each directory.  This normally means that you must
1014 create a UNIX group (see group(5)) consisting of the
1015 persons that are to edit the files in a project, and
1016 set up the repository so that it is that group that
1017 owns the directory.
1018 (On some systems, you also need to set the set-group-ID-on-execution bit
1019 on the repository directories (see chmod(1)) so that newly-created files
1020 and directories get the group-ID of the parent directory rather than
1021 that of the current process.)
1022
1023 @c See also comment in commitinfo node regarding cases
1024 @c which are really awkward with unix groups.
1025
1026 This means that you can only control access to files on
1027 a per-directory basis.
1028
1029 Note that users must also have write access to check
1030 out files, because @sc{cvs} needs to create lock files
1031 (@pxref{Concurrency}).  You can use LockDir in CVSROOT/config
1032 to put the lock files somewhere other than in the repository
1033 if you want to allow read-only access to some directories
1034 (@pxref{config}).
1035
1036 @c CVS seems to use CVSUMASK in picking permissions for
1037 @c val-tags, but maybe we should say more about this.
1038 @c Like val-tags gets created by someone who doesn't
1039 @c have CVSUMASK set right?
1040 @cindex CVSROOT/val-tags file, and read-only access to projects
1041 @cindex val-tags file, and read-only access to projects
1042 Also note that users must have write access to the
1043 @file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1044 track of what tags are valid tag names (it is sometimes
1045 updated when tags are used, as well as when they are
1046 created).
1047
1048 Each @sc{rcs} file will be owned by the user who last
1049 checked it in.  This has little significance; what
1050 really matters is who owns the directories.
1051
1052 @cindex CVSUMASK, environment variable
1053 @cindex Umask, for repository files
1054 @sc{cvs} tries to set up reasonable file permissions
1055 for new directories that are added inside the tree, but
1056 you must fix the permissions manually when a new
1057 directory should have different permissions than its
1058 parent directory.  If you set the @code{CVSUMASK}
1059 environment variable that will control the file
1060 permissions which @sc{cvs} uses in creating directories
1061 and/or files in the repository.  @code{CVSUMASK} does
1062 not affect the file permissions in the working
1063 directory; such files have the permissions which are
1064 typical for newly created files, except that sometimes
1065 @sc{cvs} creates them read-only (see the sections on
1066 watches, @ref{Setting a watch}; -r, @ref{Global
1067 options}; or @code{CVSREAD}, @ref{Environment variables}).
1068 @c FIXME: Need more discussion of which
1069 @c group should own the file in the repository.
1070 @c Include a somewhat detailed example of the usual
1071 @c case where CVSUMASK is 007, the developers are all
1072 @c in a group, and that group owns stuff in the
1073 @c repository.  Need to talk about group ownership of
1074 @c newly-created directories/files (on some unices,
1075 @c such as SunOS4, setting the setgid bit on the
1076 @c directories will make files inherit the directory's
1077 @c group.  On other unices, your mileage may vary.  I
1078 @c can't remember what POSIX says about this, if
1079 @c anything).
1080
1081 Note that using the client/server @sc{cvs}
1082 (@pxref{Remote repositories}), there is no good way to
1083 set @code{CVSUMASK}; the setting on the client machine
1084 has no effect.  If you are connecting with @code{rsh}, you
1085 can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1086 described in the documentation for your operating
1087 system.  This behavior might change in future versions
1088 of @sc{cvs}; do not rely on the setting of
1089 @code{CVSUMASK} on the client having no effect.
1090 @c FIXME: need to explain what a umask is or cite
1091 @c someplace which does.
1092 @c
1093 @c There is also a larger (largely separate) issue
1094 @c about the meaning of CVSUMASK in a non-unix context.
1095 @c For example, whether there is
1096 @c an equivalent which fits better into other
1097 @c protection schemes like POSIX.6, VMS, &c.
1098 @c
1099 @c FIXME: Need one place which discusses this
1100 @c read-only files thing.  Why would one use -r or
1101 @c CVSREAD?  Why would one use watches?  How do they
1102 @c interact?
1103 @c
1104 @c FIXME: We need to state
1105 @c whether using CVSUMASK removes the need for manually
1106 @c fixing permissions (in fact, if we are going to mention
1107 @c manually fixing permission, we better document a lot
1108 @c better just what we mean by "fix").
1109
1110 Using pserver, you will generally need stricter
1111 permissions on the @sc{cvsroot} directory and
1112 directories above it in the tree; see @ref{Password
1113 authentication security}.
1114
1115 @cindex Setuid
1116 @cindex Setgid
1117 @cindex Security, setuid
1118 @cindex Installed images (VMS)
1119 Some operating systems have features which allow a
1120 particular program to run with the ability to perform
1121 operations which the caller of the program could not.
1122 For example, the set user ID (setuid) or set group ID
1123 (setgid) features of unix or the installed image
1124 feature of VMS.  @sc{cvs} was not written to use such
1125 features and therefore attempting to install @sc{cvs} in
1126 this fashion will provide protection against only
1127 accidental lapses; anyone who is trying to circumvent
1128 the measure will be able to do so, and depending on how
1129 you have set it up may gain access to more than just
1130 @sc{cvs}.  You may wish to instead consider pserver.  It
1131 shares some of the same attributes, in terms of
1132 possibly providing a false sense of security or opening
1133 security holes wider than the ones you are trying to
1134 fix, so read the documentation on pserver security
1135 carefully if you are considering this option
1136 (@ref{Password authentication security}).
1137
1138 @node Windows permissions
1139 @subsection File Permission issues specific to Windows
1140 @cindex Windows, and permissions
1141 @cindex File permissions, Windows-specific
1142 @cindex Permissions, Windows-specific
1143
1144 Some file permission issues are specific to Windows
1145 operating systems (Windows 95, Windows NT, and
1146 presumably future operating systems in this family.
1147 Some of the following might apply to OS/2 but I'm not
1148 sure).
1149
1150 If you are using local @sc{cvs} and the repository is on a
1151 networked file system which is served by the Samba SMB
1152 server, some people have reported problems with
1153 permissions.  Enabling WRITE=YES in the samba
1154 configuration is said to fix/workaround it.
1155 Disclaimer: I haven't investigated enough to know the
1156 implications of enabling that option, nor do I know
1157 whether there is something which @sc{cvs} could be doing
1158 differently in order to avoid the problem.  If you find
1159 something out, please let us know as described in
1160 @ref{BUGS}.
1161
1162 @node Attic
1163 @subsection The attic
1164 @cindex Attic
1165
1166 You will notice that sometimes @sc{cvs} stores an
1167 @sc{rcs} file in the @code{Attic}.  For example, if the
1168 @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1169 talking about the file @file{backend.c} in the
1170 directory @file{yoyodyne/tc}, then the file normally
1171 would be in
1172
1173 @example
1174 /usr/local/cvsroot/yoyodyne/tc/backend.c,v
1175 @end example
1176
1177 @noindent
1178 but if it goes in the attic, it would be in
1179
1180 @example
1181 /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1182 @end example
1183
1184 @noindent
1185 @cindex Dead state
1186 instead.  It should not matter from a user point of
1187 view whether a file is in the attic; @sc{cvs} keeps
1188 track of this and looks in the attic when it needs to.
1189 But in case you want to know, the rule is that the RCS
1190 file is stored in the attic if and only if the head
1191 revision on the trunk has state @code{dead}.  A
1192 @code{dead} state means that file has been removed, or
1193 never added, for that revision.  For example, if you
1194 add a file on a branch, it will have a trunk revision
1195 in @code{dead} state, and a branch revision in a
1196 non-@code{dead} state.
1197 @c Probably should have some more concrete examples
1198 @c here, or somewhere (not sure exactly how we should
1199 @c arrange the discussion of the dead state, versus
1200 @c discussion of the attic).
1201
1202 @node CVS in repository
1203 @subsection The CVS directory in the repository
1204 @cindex CVS directory, in repository
1205
1206 The @file{CVS} directory in each repository directory
1207 contains information such as file attributes (in a file
1208 called @file{CVS/fileattr}.  In the
1209 future additional files may be added to this directory,
1210 so implementations should silently ignore additional
1211 files.
1212
1213 This behavior is implemented only by @sc{cvs} 1.7 and
1214 later; for details see @ref{Watches Compatibility}.
1215
1216 The format of the @file{fileattr} file is a series of entries
1217 of the following form (where @samp{@{} and @samp{@}}
1218 means the text between the braces can be repeated zero
1219 or more times):
1220
1221 @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1222   @{; @var{attrname} = @var{attrval}@} <linefeed>
1223
1224 @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1225 attributes for that file.
1226
1227 @var{ent-type} is @samp{D},
1228 and @var{filename} empty, to specify default attributes
1229 to be used for newly added files.
1230
1231 Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1232 will delete them any time it writes file attributes.
1233 @sc{cvs} 1.10 and later will preserve them.
1234
1235 Note that the order of the lines is not significant;
1236 a program writing the fileattr file may
1237 rearrange them at its convenience.
1238
1239 There is currently no way of quoting tabs or line feeds in the
1240 filename, @samp{=} in @var{attrname},
1241 @samp{;} in @var{attrval}, etc.  Note: some implementations also
1242 don't handle a NUL character in any of the fields, but
1243 implementations are encouraged to allow it.
1244
1245 By convention, @var{attrname} starting with @samp{_} is for an attribute given
1246 special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1247 (or will be, once implementations start supporting user-defined attributes).
1248
1249 Built-in attributes:
1250
1251 @table @code
1252 @item _watched
1253 Present means the file is watched and should be checked out
1254 read-only.
1255
1256 @item _watchers
1257 Users with watches for this file.  Value is
1258 @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1259 where @var{watcher} is a username, and @var{type}
1260 is zero or more of edit,unedit,commit separated by
1261 @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1262
1263 @item _editors
1264 Users editing this file.  Value is
1265 @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1266 where @var{editor} is a username, and @var{val} is
1267 @var{time}+@var{hostname}+@var{pathname}, where
1268 @var{time} is when the @code{cvs edit} command (or
1269 equivalent) happened,
1270 and @var{hostname} and @var{pathname} are for the working directory.
1271 @end table
1272
1273 Example:
1274
1275 @c FIXME: sanity.sh should contain a similar test case
1276 @c so we can compare this example from something from
1277 @c Real Life(TM).  See cvsclient.texi (under Notify) for more
1278 @c discussion of the date format of _editors.
1279 @example
1280 Ffile1 _watched=;_watchers=joe>edit,mary>commit
1281 Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1282 D _watched=
1283 @end example
1284
1285 @noindent
1286 means that the file @file{file1} should be checked out
1287 read-only.  Furthermore, joe is watching for edits and
1288 mary is watching for commits.  The file @file{file2}
1289 should be checked out read-only; sue started editing it
1290 on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1291 the machine @code{workstn1}.  Future files which are
1292 added should be checked out read-only.  To represent
1293 this example here, we have shown a space after
1294 @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1295 there must be a single tab character there and no spaces.
1296
1297 @node Locks
1298 @subsection CVS locks in the repository
1299
1300 @cindex #cvs.rfl, technical details
1301 @cindex #cvs.wfl, technical details
1302 @cindex #cvs.lock, technical details
1303 @cindex Locks, cvs, technical details
1304 For an introduction to @sc{cvs} locks focusing on
1305 user-visible behavior, see @ref{Concurrency}.  The
1306 following section is aimed at people who are writing
1307 tools which want to access a @sc{cvs} repository without
1308 interfering with other tools accessing the same
1309 repository.  If you find yourself confused by concepts
1310 described here, like @dfn{read lock}, @dfn{write lock},
1311 and @dfn{deadlock}, you might consult the literature on
1312 operating systems or databases.
1313
1314 @cindex #cvs.tfl
1315 Any file in the repository with a name starting
1316 with @file{#cvs.rfl.} is a read lock.  Any file in
1317 the repository with a name starting with
1318 @file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1319 (before @sc{cvs} 1.5) also created files with names starting
1320 with @file{#cvs.tfl}, but they are not discussed here.
1321 The directory @file{#cvs.lock} serves as a master
1322 lock.  That is, one must obtain this lock first before
1323 creating any of the other locks.
1324
1325 To obtain a read lock, first create the @file{#cvs.lock}
1326 directory.  This operation must be atomic (which should
1327 be true for creating a directory under most operating
1328 systems).  If it fails because the directory already
1329 existed, wait for a while and try again.  After
1330 obtaining the @file{#cvs.lock} lock, create a file
1331 whose name is @file{#cvs.rfl.} followed by information
1332 of your choice (for example, hostname and process
1333 identification number).  Then remove the
1334 @file{#cvs.lock} directory to release the master lock.
1335 Then proceed with reading the repository.  When you are
1336 done, remove the @file{#cvs.rfl} file to release the
1337 read lock.
1338
1339 To obtain a write lock, first create the
1340 @file{#cvs.lock} directory, as with read locks.  Then
1341 check that there are no files whose names start with
1342 @file{#cvs.rfl.}.  If there are, remove
1343 @file{#cvs.lock}, wait for a while, and try again.  If
1344 there are no readers, then create a file whose name is
1345 @file{#cvs.wfl} followed by information of your choice
1346 (for example, hostname and process identification
1347 number).  Hang on to the @file{#cvs.lock} lock.  Proceed
1348 with writing the repository.  When you are done, first
1349 remove the @file{#cvs.wfl} file and then the
1350 @file{#cvs.lock} directory. Note that unlike the
1351 @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1352 informational; it has no effect on the locking operation
1353 beyond what is provided by holding on to the
1354 @file{#cvs.lock} lock itself.
1355
1356 Note that each lock (write lock or read lock) only locks
1357 a single directory in the repository, including
1358 @file{Attic} and @file{CVS} but not including
1359 subdirectories which represent other directories under
1360 version control.  To lock an entire tree, you need to
1361 lock each directory (note that if you fail to obtain
1362 any lock you need, you must release the whole tree
1363 before waiting and trying again, to avoid deadlocks).
1364
1365 Note also that @sc{cvs} expects write locks to control
1366 access to individual @file{foo,v} files.  @sc{rcs} has
1367 a scheme where the @file{,foo,} file serves as a lock,
1368 but @sc{cvs} does not implement it and so taking out a
1369 @sc{cvs} write lock is recommended.  See the comments at
1370 rcs_internal_lockfile in the @sc{cvs} source code for
1371 further discussion/rationale.
1372
1373 @node CVSROOT storage
1374 @subsection How files are stored in the CVSROOT directory
1375 @cindex CVSROOT, storage of files
1376
1377 The @file{$CVSROOT/CVSROOT} directory contains the
1378 various administrative files.  In some ways this
1379 directory is just like any other directory in the
1380 repository; it contains @sc{rcs} files whose names end
1381 in @samp{,v}, and many of the @sc{cvs} commands operate
1382 on it the same way.  However, there are a few
1383 differences.
1384
1385 For each administrative file, in addition to the
1386 @sc{rcs} file, there is also a checked out copy of the
1387 file.  For example, there is an @sc{rcs} file
1388 @file{loginfo,v} and a file @file{loginfo} which
1389 contains the latest revision contained in
1390 @file{loginfo,v}.  When you check in an administrative
1391 file, @sc{cvs} should print
1392
1393 @example
1394 cvs commit: Rebuilding administrative file database
1395 @end example
1396
1397 @noindent
1398 and update the checked out copy in
1399 @file{$CVSROOT/CVSROOT}.  If it does not, there is
1400 something wrong (@pxref{BUGS}).  To add your own files
1401 to the files to be updated in this fashion, you can add
1402 them to the @file{checkoutlist} administrative file
1403 (@pxref{checkoutlist}).
1404
1405 @cindex modules.db
1406 @cindex modules.pag
1407 @cindex modules.dir
1408 By default, the @file{modules} file behaves as
1409 described above.  If the modules file is very large,
1410 storing it as a flat text file may make looking up
1411 modules slow (I'm not sure whether this is as much of a
1412 concern now as when @sc{cvs} first evolved this
1413 feature; I haven't seen benchmarks).  Therefore, by
1414 making appropriate edits to the @sc{cvs} source code
1415 one can store the modules file in a database which
1416 implements the @code{ndbm} interface, such as Berkeley
1417 db or GDBM.  If this option is in use, then the modules
1418 database will be stored in the files @file{modules.db},
1419 @file{modules.pag}, and/or @file{modules.dir}.
1420 @c I think fileattr also will use the database stuff.
1421 @c Anything else?
1422
1423 For information on the meaning of the various
1424 administrative files, see @ref{Administrative files}.
1425
1426 @node Working directory storage
1427 @section How data is stored in the working directory
1428
1429 @c FIXME: Somewhere we should discuss timestamps (test
1430 @c case "stamps" in sanity.sh).  But not here.  Maybe
1431 @c in some kind of "working directory" chapter which
1432 @c would encompass the "Builds" one?  But I'm not sure
1433 @c whether that is a good organization (is it based on
1434 @c what the user wants to do?).
1435
1436 @cindex CVS directory, in working directory
1437 While we are discussing @sc{cvs} internals which may
1438 become visible from time to time, we might as well talk
1439 about what @sc{cvs} puts in the @file{CVS} directories
1440 in the working directories.  As with the repository,
1441 @sc{cvs} handles this information and one can usually
1442 access it via @sc{cvs} commands.  But in some cases it
1443 may be useful to look at it, and other programs, such
1444 as the @code{jCVS} graphical user interface or the
1445 @code{VC} package for emacs, may need to look at it.
1446 Such programs should follow the recommendations in this
1447 section if they hope to be able to work with other
1448 programs which use those files, including future
1449 versions of the programs just mentioned and the
1450 command-line @sc{cvs} client.
1451
1452 The @file{CVS} directory contains several files.
1453 Programs which are reading this directory should
1454 silently ignore files which are in the directory but
1455 which are not documented here, to allow for future
1456 expansion.
1457
1458 The files are stored according to the text file
1459 convention for the system in question.  This means that
1460 working directories are not portable between systems
1461 with differing conventions for storing text files.
1462 This is intentional, on the theory that the files being
1463 managed by @sc{cvs} probably will not be portable between
1464 such systems either.
1465
1466 @table @file
1467 @item Root
1468 This file contains the current @sc{cvs} root, as
1469 described in @ref{Specifying a repository}.
1470
1471 @cindex Repository file, in CVS directory
1472 @cindex CVS/Repository file
1473 @item Repository
1474 This file contains the directory within the repository
1475 which the current directory corresponds with.  It can
1476 be either an absolute pathname or a relative pathname;
1477 @sc{cvs} has had the ability to read either format
1478 since at least version 1.3 or so.  The relative
1479 pathname is relative to the root, and is the more
1480 sensible approach, but the absolute pathname is quite
1481 common and implementations should accept either.  For
1482 example, after the command
1483
1484 @example
1485 cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1486 @end example
1487
1488 @noindent
1489 @file{Root} will contain
1490
1491 @example
1492 :local:/usr/local/cvsroot
1493 @end example
1494
1495 @noindent
1496 and @file{Repository} will contain either
1497
1498 @example
1499 /usr/local/cvsroot/yoyodyne/tc
1500 @end example
1501
1502 @noindent
1503 or
1504
1505 @example
1506 yoyodyne/tc
1507 @end example
1508
1509 If the particular working directory does not correspond
1510 to a directory in the repository, then @file{Repository}
1511 should contain @file{CVSROOT/Emptydir}.
1512 @cindex Emptydir, in CVSROOT directory
1513 @cindex CVSROOT/Emptydir directory
1514
1515 @cindex Entries file, in CVS directory
1516 @cindex CVS/Entries file
1517 @item Entries
1518 This file lists the files and directories in the
1519 working directory.
1520 The first character of each line indicates what sort of
1521 line it is.  If the character is unrecognized, programs
1522 reading the file should silently skip that line, to
1523 allow for future expansion.
1524
1525 If the first character is @samp{/}, then the format is:
1526
1527 @example
1528 /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1529 @end example
1530
1531 @noindent
1532 where @samp{[} and @samp{]} are not part of the entry,
1533 but instead indicate that the @samp{+} and conflict
1534 marker are optional.  @var{name} is the name of the
1535 file within the directory.  @var{revision} is the
1536 revision that the file in the working derives from, or
1537 @samp{0} for an added file, or @samp{-} followed by a
1538 revision for a removed file.  @var{timestamp} is the
1539 timestamp of the file at the time that @sc{cvs} created
1540 it; if the timestamp differs with the actual
1541 modification time of the file it means the file has
1542 been modified.  It is stored in
1543 the format used by the ISO C asctime() function (for
1544 example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1545 write a string which is not in that format, for
1546 example, @samp{Result of merge}, to indicate that the
1547 file should always be considered to be modified.  This
1548 is not a special case; to see whether a file is
1549 modified a program should take the timestamp of the file
1550 and simply do a string compare with @var{timestamp}.
1551 If there was a conflict, @var{conflict} can be set to
1552 the modification time of the file after the file has been
1553 written with conflict markers (@pxref{Conflicts example}).
1554 Thus if @var{conflict} is subsequently the same as the actual
1555 modification time of the file it means that the user
1556 has obviously not resolved the conflict.  @var{options}
1557 contains sticky options (for example @samp{-kb} for a
1558 binary file).  @var{tagdate} contains @samp{T} followed
1559 by a tag name, or @samp{D} for a date, followed by a
1560 sticky tag or date.  Note that if @var{timestamp}
1561 contains a pair of timestamps separated by a space,
1562 rather than a single timestamp, you are dealing with a
1563 version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1564 documented here).
1565
1566 The timezone on the timestamp in CVS/Entries (local or
1567 universal) should be the same as the operating system
1568 stores for the timestamp of the file itself.  For
1569 example, on Unix the file's timestamp is in universal
1570 time (UT), so the timestamp in CVS/Entries should be
1571 too.  On @sc{vms}, the file's timestamp is in local
1572 time, so @sc{cvs} on @sc{vms} should use local time.
1573 This rule is so that files do not appear to be modified
1574 merely because the timezone changed (for example, to or
1575 from summer time).
1576 @c See comments and calls to gmtime() and friends in
1577 @c src/vers_ts.c (function time_stamp).
1578
1579 If the first character of a line in @file{Entries} is
1580 @samp{D}, then it indicates a subdirectory.  @samp{D}
1581 on a line all by itself indicates that the program
1582 which wrote the @file{Entries} file does record
1583 subdirectories (therefore, if there is such a line and
1584 no other lines beginning with @samp{D}, one knows there
1585 are no subdirectories).  Otherwise, the line looks
1586 like:
1587
1588 @example
1589 D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1590 @end example
1591
1592 @noindent
1593 where @var{name} is the name of the subdirectory, and
1594 all the @var{filler} fields should be silently ignored,
1595 for future expansion.  Programs which modify
1596 @code{Entries} files should preserve these fields.
1597
1598 The lines in the @file{Entries} file can be in any order.
1599
1600 @cindex Entries.Log file, in CVS directory
1601 @cindex CVS/Entries.Log file
1602 @item Entries.Log
1603 This file does not record any information beyond that
1604 in @file{Entries}, but it does provide a way to update
1605 the information without having to rewrite the entire
1606 @file{Entries} file, including the ability to preserve
1607 the information even if the program writing
1608 @file{Entries} and @file{Entries.Log} abruptly aborts.
1609 Programs which are reading the @file{Entries} file
1610 should also check for @file{Entries.Log}.  If the latter
1611 exists, they should read @file{Entries} and then apply
1612 the changes mentioned in @file{Entries.Log}.  After
1613 applying the changes, the recommended practice is to
1614 rewrite @file{Entries} and then delete @file{Entries.Log}.
1615 The format of a line in @file{Entries.Log} is a single
1616 character command followed by a space followed by a
1617 line in the format specified for a line in
1618 @file{Entries}.  The single character command is
1619 @samp{A} to indicate that the entry is being added,
1620 @samp{R} to indicate that the entry is being removed,
1621 or any other character to indicate that the entire line
1622 in @file{Entries.Log} should be silently ignored (for
1623 future expansion).  If the second character of the line
1624 in @file{Entries.Log} is not a space, then it was
1625 written by an older version of @sc{cvs} (not documented
1626 here).
1627
1628 Programs which are writing rather than reading can
1629 safely ignore @file{Entries.Log} if they so choose.
1630
1631 @cindex Entries.Backup file, in CVS directory
1632 @cindex CVS/Entries.Backup file
1633 @item Entries.Backup
1634 This is a temporary file.  Recommended usage is to
1635 write a new entries file to @file{Entries.Backup}, and
1636 then to rename it (atomically, where possible) to @file{Entries}.
1637
1638 @cindex Entries.Static file, in CVS directory
1639 @cindex CVS/Entries.Static file
1640 @item Entries.Static
1641 The only relevant thing about this file is whether it
1642 exists or not.  If it exists, then it means that only
1643 part of a directory was gotten and @sc{cvs} will
1644 not create additional files in that directory.  To
1645 clear it, use the @code{update} command with the
1646 @samp{-d} option, which will get the additional files
1647 and remove @file{Entries.Static}.
1648 @c FIXME: This needs to be better documented, in places
1649 @c other than Working Directory Storage.
1650 @c FIXCVS: The fact that this setting exists needs to
1651 @c be more visible to the user.  For example "cvs
1652 @c status foo", in the case where the file would be
1653 @c gotten except for Entries.Static, might say
1654 @c something to distinguish this from other cases.
1655 @c One thing that periodically gets suggested is to
1656 @c have "cvs update" print something when it skips
1657 @c files due to Entries.Static, but IMHO that kind of
1658 @c noise pretty much makes the Entries.Static feature
1659 @c useless.
1660
1661 @cindex Tag file, in CVS directory
1662 @cindex CVS/Tag file
1663 @cindex Sticky tags/dates, per-directory
1664 @cindex Per-directory sticky tags/dates
1665 @item Tag
1666 This file contains per-directory sticky tags or dates.
1667 The first character is @samp{T} for a branch tag,
1668 @samp{N} for a non-branch tag, or @samp{D} for a date,
1669 or another character to mean the file should be
1670 silently ignored, for future expansion.  This character
1671 is followed by the tag or date.  Note that
1672 per-directory sticky tags or dates are used for things
1673 like applying to files which are newly added; they
1674 might not be the same as the sticky tags or dates on
1675 individual files.  For general information on sticky
1676 tags and dates, see @ref{Sticky tags}.
1677 @c FIXME: This needs to be much better documented,
1678 @c preferably not in the context of "working directory
1679 @c storage".
1680 @c FIXME: The Sticky tags node needs to discuss, or xref to
1681 @c someplace which discusses, per-directory sticky
1682 @c tags and the distinction with per-file sticky tags.
1683
1684 @cindex Notify file, in CVS directory
1685 @cindex CVS/Notify file
1686 @item Notify
1687 This file stores notifications (for example, for
1688 @code{edit} or @code{unedit}) which have not yet been
1689 sent to the server.  Its format is not yet documented
1690 here.
1691
1692 @cindex Notify.tmp file, in CVS directory
1693 @cindex CVS/Notify.tmp file
1694 @item Notify.tmp
1695 This file is to @file{Notify} as @file{Entries.Backup}
1696 is to @file{Entries}.  That is, to write @file{Notify},
1697 first write the new contents to @file{Notify.tmp} and
1698 then (atomically where possible), rename it to
1699 @file{Notify}.
1700
1701 @cindex Base directory, in CVS directory
1702 @cindex CVS/Base directory
1703 @item Base
1704 If watches are in use, then an @code{edit} command
1705 stores the original copy of the file in the @file{Base}
1706 directory.  This allows the @code{unedit} command to
1707 operate even if it is unable to communicate with the
1708 server.
1709
1710 @cindex Baserev file, in CVS directory
1711 @cindex CVS/Baserev file
1712 @item Baserev
1713 The file lists the revision for each of the files in
1714 the @file{Base} directory.  The format is:
1715
1716 @example
1717 B@var{name}/@var{rev}/@var{expansion}
1718 @end example
1719
1720 @noindent
1721 where @var{expansion} should be ignored, to allow for
1722 future expansion.
1723
1724 @cindex Baserev.tmp file, in CVS directory
1725 @cindex CVS/Baserev.tmp file
1726 @item Baserev.tmp
1727 This file is to @file{Baserev} as @file{Entries.Backup}
1728 is to @file{Entries}.  That is, to write @file{Baserev},
1729 first write the new contents to @file{Baserev.tmp} and
1730 then (atomically where possible), rename it to
1731 @file{Baserev}.
1732
1733 @cindex Template file, in CVS directory
1734 @cindex CVS/Template file
1735 @item Template
1736 This file contains the template specified by the
1737 @file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1738 by the client; the non-client/server @sc{cvs} consults
1739 @file{rcsinfo} directly.
1740 @end table
1741
1742 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1743 @node Intro administrative files
1744 @section The administrative files
1745 @cindex Administrative files (intro)
1746 @cindex Modules file
1747 @cindex CVSROOT, module name
1748 @cindex Defining modules (intro)
1749
1750 @c FIXME: this node should be reorganized into "general
1751 @c information about admin files" and put the "editing
1752 @c admin files" stuff up front rather than jumping into
1753 @c the details of modules right away.  Then the
1754 @c Administrative files node can go away, the information
1755 @c on each admin file distributed to a place appropriate
1756 @c to its function, and this node can contain a table
1757 @c listing each file and a @ref to its detailed description.
1758
1759 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1760 files}.  @xref{Administrative files}, for a complete description.
1761 You can use @sc{cvs} without any of these files, but
1762 some commands work better when at least the
1763 @file{modules} file is properly set up.
1764
1765 The most important of these files is the @file{modules}
1766 file.  It defines all modules in the repository.  This
1767 is a sample @file{modules} file.
1768
1769 @c FIXME: The CVSROOT line is a goofy example now that
1770 @c mkmodules doesn't exist.
1771 @example
1772 CVSROOT         CVSROOT
1773 modules         CVSROOT modules
1774 cvs             gnu/cvs
1775 rcs             gnu/rcs
1776 diff            gnu/diff
1777 tc              yoyodyne/tc
1778 @end example
1779
1780 The @file{modules} file is line oriented.  In its
1781 simplest form each line contains the name of the
1782 module, whitespace, and the directory where the module
1783 resides.  The directory is a path relative to
1784 @code{$CVSROOT}.  The last four lines in the example
1785 above are examples of such lines.
1786
1787 @c FIXME: might want to introduce the concept of options in modules file
1788 @c (the old example which was here, -i mkmodules, is obsolete).
1789
1790 The line that defines the module called @samp{modules}
1791 uses features that are not explained here.
1792 @xref{modules}, for a full explanation of all the
1793 available features.
1794
1795 @c FIXME: subsection without node is bogus
1796 @subsection Editing administrative files
1797 @cindex Editing administrative files
1798 @cindex Administrative files, editing them
1799
1800 You edit the administrative files in the same way that you would edit
1801 any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1802 copy, edit it, and commit your changes in the normal way.
1803
1804 It is possible to commit an erroneous administrative
1805 file.  You can often fix the error and check in a new
1806 revision, but sometimes a particularly bad error in the
1807 administrative file makes it impossible to commit new
1808 revisions.
1809 @c @xref{Bad administrative files} for a hint
1810 @c about how to solve such situations.
1811 @c -- administrative file checking--
1812
1813 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1814 @node Multiple repositories
1815 @section Multiple repositories
1816 @cindex Multiple repositories
1817 @cindex Repositories, multiple
1818 @cindex Many repositories
1819 @cindex Parallel repositories
1820 @cindex Disjoint repositories
1821 @cindex CVSROOT, multiple repositories
1822
1823 In some situations it is a good idea to have more than
1824 one repository, for instance if you have two
1825 development groups that work on separate projects
1826 without sharing any code.  All you have to do to have
1827 several repositories is to specify the appropriate
1828 repository, using the @code{CVSROOT} environment
1829 variable, the @samp{-d} option to @sc{cvs}, or (once
1830 you have checked out a working directory) by simply
1831 allowing @sc{cvs} to use the repository that was used
1832 to check out the working directory
1833 (@pxref{Specifying a repository}).
1834
1835 The big advantage of having multiple repositories is
1836 that they can reside on different servers.  With @sc{cvs}
1837 version 1.10, a single command cannot recurse into
1838 directories from different repositories.  With development
1839 versions of @sc{cvs}, you can check out code from multiple
1840 servers into your working directory.  @sc{cvs} will
1841 recurse and handle all the details of making
1842 connections to as many server machines as necessary to
1843 perform the requested command.  Here is an example of
1844 how to set up a working directory:
1845
1846 @example
1847 cvs -d server1:/cvs co dir1
1848 cd dir1
1849 cvs -d server2:/root co sdir
1850 cvs update
1851 @end example
1852
1853 The @code{cvs co} commands set up the working
1854 directory, and then the @code{cvs update} command will
1855 contact server2, to update the dir1/sdir subdirectory,
1856 and server1, to update everything else.
1857
1858 @c FIXME: Does the FAQ have more about this?  I have a
1859 @c dim recollection, but I'm too lazy to check right now.
1860
1861 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1862 @node Creating a repository
1863 @section Creating a repository
1864
1865 @cindex Repository, setting up
1866 @cindex Creating a repository
1867 @cindex Setting up a repository
1868
1869 To set up a @sc{cvs} repository, first choose the
1870 machine and disk on which you want to store the
1871 revision history of the source files.  CPU and memory
1872 requirements are modest, so most machines should be
1873 adequate.  For details see @ref{Server requirements}.
1874 @c Possible that we should be providing a quick rule of
1875 @c thumb, like the 32M memory for the server.  That
1876 @c might increase the number of people who are happy
1877 @c with the answer, without following the xref.
1878
1879 To estimate disk space
1880 requirements, if you are importing RCS files from
1881 another system, the size of those files is the
1882 approximate initial size of your repository, or if you
1883 are starting without any version history, a rule of
1884 thumb is to allow for the server approximately three
1885 times the size of the code to be under @sc{cvs} for the
1886 repository (you will eventually outgrow this, but not
1887 for a while).  On the machines on which the developers
1888 will be working, you'll want disk space for
1889 approximately one working directory for each developer
1890 (either the entire tree or a portion of it, depending
1891 on what each developer uses).
1892
1893 The repository should be accessible
1894 (directly or via a networked file system) from all
1895 machines which want to use @sc{cvs} in server or local
1896 mode; the client machines need not have any access to
1897 it other than via the @sc{cvs} protocol.  It is not
1898 possible to use @sc{cvs} to read from a repository
1899 which one only has read access to; @sc{cvs} needs to be
1900 able to create lock files (@pxref{Concurrency}).
1901
1902 @cindex init (subcommand)
1903 To create a repository, run the @code{cvs init}
1904 command.  It will set up an empty repository in the
1905 @sc{cvs} root specified in the usual way
1906 (@pxref{Repository}).  For example,
1907
1908 @example
1909 cvs -d /usr/local/cvsroot init
1910 @end example
1911
1912 @code{cvs init} is careful to never overwrite any
1913 existing files in the repository, so no harm is done if
1914 you run @code{cvs init} on an already set-up
1915 repository.
1916
1917 @code{cvs init} will enable history logging; if you
1918 don't want that, remove the history file after running
1919 @code{cvs init}.  @xref{history file}.
1920
1921 @node Backing up
1922 @section Backing up a repository
1923 @cindex Repository, backing up
1924 @cindex Backing up, repository
1925
1926 There is nothing particularly magical about the files
1927 in the repository; for the most part it is possible to
1928 back them up just like any other files.  However, there
1929 are a few issues to consider.
1930
1931 @cindex Locks, cvs, and backups
1932 @cindex #cvs.rfl, and backups
1933 The first is that to be paranoid, one should either not
1934 use @sc{cvs} during the backup, or have the backup
1935 program lock @sc{cvs} while doing the backup.  To not
1936 use @sc{cvs}, you might forbid logins to machines which
1937 can access the repository, turn off your @sc{cvs}
1938 server, or similar mechanisms.  The details would
1939 depend on your operating system and how you have
1940 @sc{cvs} set up.  To lock @sc{cvs}, you would create
1941 @file{#cvs.rfl} locks in each repository directory.
1942 See @ref{Concurrency}, for more on @sc{cvs} locks.
1943 Having said all this, if you just back up without any
1944 of these precautions, the results are unlikely to be
1945 particularly dire.  Restoring from backup, the
1946 repository might be in an inconsistent state, but this
1947 would not be particularly hard to fix manually.
1948
1949 When you restore a repository from backup, assuming
1950 that changes in the repository were made after the time
1951 of the backup, working directories which were not
1952 affected by the failure may refer to revisions which no
1953 longer exist in the repository.  Trying to run @sc{cvs}
1954 in such directories will typically produce an error
1955 message.  One way to get those changes back into the
1956 repository is as follows:
1957
1958 @itemize @bullet
1959 @item
1960 Get a new working directory.
1961
1962 @item
1963 Copy the files from the working directory from before
1964 the failure over to the new working directory (do not
1965 copy the contents of the @file{CVS} directories, of
1966 course).
1967
1968 @item
1969 Working in the new working directory, use commands such
1970 as @code{cvs update} and @code{cvs diff} to figure out
1971 what has changed, and then when you are ready, commit
1972 the changes into the repository.
1973 @end itemize
1974
1975 @node Moving a repository
1976 @section Moving a repository
1977 @cindex Repository, moving
1978 @cindex Moving a repository
1979 @cindex Copying a repository
1980
1981 Just as backing up the files in the repository is
1982 pretty much like backing up any other files, if you
1983 need to move a repository from one place to another it
1984 is also pretty much like just moving any other
1985 collection of files.
1986
1987 The main thing to consider is that working directories
1988 point to the repository.  The simplest way to deal with
1989 a moved repository is to just get a fresh working
1990 directory after the move.  Of course, you'll want to
1991 make sure that the old working directory had been
1992 checked in before the move, or you figured out some
1993 other way to make sure that you don't lose any
1994 changes.  If you really do want to reuse the existing
1995 working directory, it should be possible with manual
1996 surgery on the @file{CVS/Repository} files.  You can
1997 see @ref{Working directory storage}, for information on
1998 the @file{CVS/Repository} and @file{CVS/Root} files, but
1999 unless you are sure you want to bother, it probably
2000 isn't worth it.
2001 @c FIXME: Surgery on CVS/Repository should be avoided
2002 @c by making RELATIVE_REPOS the default.
2003 @c FIXME-maybe: might want some documented way to
2004 @c change the CVS/Root files in some particular tree.
2005 @c But then again, I don't know, maybe just having
2006 @c people do this in perl/shell/&c isn't so bad...
2007
2008 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2009 @node Remote repositories
2010 @section Remote repositories
2011 @cindex Repositories, remote
2012 @cindex Remote repositories
2013 @cindex Client/Server Operation
2014 @cindex Server, CVS
2015 @cindex Remote repositories, port specification
2016 @cindex Repositories, remote, port specification
2017 @cindex Client/Server Operation, port specification
2018 @cindex pserver (client/server connection method), port specification
2019 @cindex kserver (client/server connection method), port specification
2020 @cindex gserver (client/server connection method), port specification
2021 @cindex port, specifying for remote repositories
2022
2023         Your working copy of the sources can be on a
2024 different machine than the repository.  Using @sc{cvs}
2025 in this manner is known as @dfn{client/server}
2026 operation.  You run @sc{cvs} on a machine which can
2027 mount your working directory, known as the
2028 @dfn{client}, and tell it to communicate to a machine
2029 which can mount the repository, known as the
2030 @dfn{server}.  Generally, using a remote
2031 repository is just like using a local one, except that
2032 the format of the repository name is:
2033
2034 @example
2035 [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2036 @end example
2037
2038 Specifying a password in the repository name is not recommended during
2039 checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2040 password in each created directory.  @code{cvs login} first instead
2041 (@pxref{Password authentication client}).
2042
2043 The details of exactly what needs to be set up depend
2044 on how you are connecting to the server.
2045
2046 If @var{method} is not specified, and the repository
2047 name contains @samp{:}, then the default is @code{ext}
2048 or @code{server}, depending on your platform; both are
2049 described in @ref{Connecting via rsh}.
2050 @c Should we try to explain which platforms are which?
2051 @c Platforms like unix and VMS, which only allow
2052 @c privileged programs to bind to sockets <1024 lose on
2053 @c :server:
2054 @c Platforms like Mac and VMS, whose rsh program is
2055 @c unusable or nonexistent, lose on :ext:
2056 @c Platforms like OS/2 and NT probably could plausibly
2057 @c default either way (modulo -b troubles).
2058
2059 @c FIXME: We need to have a better way of explaining
2060 @c what method to use.  This presentation totally
2061 @c obscures the fact that :ext: and CVS_RSH is the way to
2062 @c use SSH, for example.  Plus it incorrectly implies
2063 @c that you need an @code{rsh} binary on the client to use
2064 @c :server:.
2065 @c Also note that rsh not pserver is the right choice if you want
2066 @c users to be able to create their own repositories
2067 @c (because of the --allow-root related issues).
2068 @menu
2069 * Server requirements::         Memory and other resources for servers
2070 * Connecting via rsh::          Using the @code{rsh} program to connect
2071 * Password authenticated::      Direct connections using passwords
2072 * GSSAPI authenticated::        Direct connections using GSSAPI
2073 * Kerberos authenticated::      Direct connections with Kerberos
2074 * Connecting via fork::         Using a forked @code{cvs server} to connect
2075 @end menu
2076
2077 @node Server requirements
2078 @subsection Server requirements
2079
2080 The quick answer to what sort of machine is suitable as
2081 a server is that requirements are modest---a server
2082 with 32M of memory or even less can handle a fairly
2083 large source tree with a fair amount of activity.
2084 @c Say something about CPU speed too?  I'm even less sure
2085 @c what to say on that subject...
2086
2087 The real answer, of course, is more complicated.
2088 Estimating the known areas of large memory consumption
2089 should be sufficient to estimate memory requirements.
2090 There are two such areas documented here; other memory
2091 consumption should be small by comparison (if you find
2092 that is not the case, let us know, as described in
2093 @ref{BUGS}, so we can update this documentation).
2094
2095 The first area of big memory consumption is large
2096 checkouts, when using the @sc{cvs} server.  The server
2097 consists of two processes for each client that it is
2098 serving.  Memory consumption on the child process
2099 should remain fairly small.  Memory consumption on the
2100 parent process, particularly if the network connection
2101 to the client is slow, can be expected to grow to
2102 slightly more than the size of the sources in a single
2103 directory, or two megabytes, whichever is larger.
2104 @c "two megabytes" of course is SERVER_HI_WATER.  But
2105 @c we don't mention that here because we are
2106 @c documenting the default configuration of CVS.  If it
2107 @c is a "standard" thing to change that value, it
2108 @c should be some kind of run-time configuration.
2109 @c
2110 @c See cvsclient.texi for more on the design decision
2111 @c to not have locks in place while waiting for the
2112 @c client, which is what results in memory consumption
2113 @c as high as this.
2114
2115 Multiplying the size of each @sc{cvs} server by the
2116 number of servers which you expect to have active at
2117 one time should give an idea of memory requirements for
2118 the server.  For the most part, the memory consumed by
2119 the parent process probably can be swap space rather
2120 than physical memory.
2121 @c Has anyone verified that notion about swap space?
2122 @c I say it based pretty much on guessing that the
2123 @c ->text of the struct buffer_data only gets accessed
2124 @c in a first in, first out fashion, but I haven't
2125 @c looked very closely.
2126
2127 @c What about disk usage in /tmp on the server?  I think that
2128 @c it can be substantial, but I haven't looked at this
2129 @c again and tried to figure it out ("cvs import" is
2130 @c probably the worst case...).
2131
2132 The second area of large memory consumption is
2133 @code{diff}, when checking in large files.  This is
2134 required even for binary files.  The rule of thumb is
2135 to allow about ten times the size of the largest file
2136 you will want to check in, although five times may be
2137 adequate.  For example, if you want to check in a file
2138 which is 10 megabytes, you should have 100 megabytes of
2139 memory on the machine doing the checkin (the server
2140 machine for client/server, or the machine running
2141 @sc{cvs} for non-client/server).  This can be swap
2142 space rather than physical memory.  Because the memory
2143 is only required briefly, there is no particular need
2144 to allow memory for more than one such checkin at a
2145 time.
2146 @c The 5-10 times rule of thumb is from Paul Eggert for
2147 @c GNU diff.  I don't think it is in the GNU diff
2148 @c manual or anyplace like that.
2149 @c
2150 @c Probably we could be saying more about
2151 @c non-client/server CVS.
2152 @c I would guess for non-client/server CVS in an NFS
2153 @c environment the biggest issues are the network and
2154 @c the NFS server.
2155
2156 Resource consumption for the client is even more
2157 modest---any machine with enough capacity to run the
2158 operating system in question should have little
2159 trouble.
2160 @c Is that true?  I think the client still wants to
2161 @c (bogusly) store entire files in memory at times.
2162
2163 For information on disk space requirements, see
2164 @ref{Creating a repository}.
2165
2166 @node Connecting via rsh
2167 @subsection Connecting with rsh
2168
2169 @cindex rsh
2170 @sc{cvs} uses the @samp{rsh} protocol to perform these
2171 operations, so the remote user host needs to have a
2172 @file{.rhosts} file which grants access to the local
2173 user.
2174
2175 For example, suppose you are the user @samp{mozart} on
2176 the local machine @samp{toe.example.com}, and the
2177 server machine is @samp{faun.example.org}.  On
2178 faun, put the following line into the file
2179 @file{.rhosts} in @samp{bach}'s home directory:
2180
2181 @example
2182 toe.example.com  mozart
2183 @end example
2184
2185 @noindent
2186 Then test that @samp{rsh} is working with
2187
2188 @example
2189 rsh -l bach faun.example.org 'echo $PATH'
2190 @end example
2191
2192 @cindex CVS_SERVER, environment variable
2193 Next you have to make sure that @code{rsh} will be able
2194 to find the server.  Make sure that the path which
2195 @code{rsh} printed in the above example includes the
2196 directory containing a program named @code{cvs} which
2197 is the server.  You need to set the path in
2198 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2199 or @file{.profile}.  Alternately, you can set the
2200 environment variable @code{CVS_SERVER} on the client
2201 machine to the filename of the server you want to use,
2202 for example @file{/usr/local/bin/cvs-1.6}.
2203 @c FIXME: there should be a way to specify the
2204 @c program in CVSROOT, not CVS_SERVER, so that one can use
2205 @c different ones for different roots.  e.g. ":server;cvs=cvs-1.6:"
2206 @c instead of ":server:".
2207
2208 There is no need to edit @file{inetd.conf} or start a
2209 @sc{cvs} server daemon.
2210
2211 @cindex :server:, setting up
2212 @cindex :ext:, setting up
2213 @cindex Kerberos, using kerberized rsh
2214 @cindex SSH (rsh replacement)
2215 @cindex rsh replacements (Kerberized, SSH, &c)
2216 There are two access methods that you use in @code{CVSROOT}
2217 for rsh.  @code{:server:} specifies an internal rsh
2218 client, which is supported only by some @sc{cvs} ports.
2219 @code{:ext:} specifies an external rsh program.  By
2220 default this is @code{rsh} but you may set the
2221 @code{CVS_RSH} environment variable to invoke another
2222 program which can access the remote server (for
2223 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2224 something different).  It must be a program which can
2225 transmit data to and from the server without modifying
2226 it; for example the Windows NT @code{rsh} is not
2227 suitable since it by default translates between CRLF
2228 and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2229 to @code{rsh} to get around this, but since this could
2230 potentially cause problems for programs other than the
2231 standard @code{rsh}, it may change in the future.  If
2232 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2233 replacement, the instructions in the rest of this
2234 section concerning @file{.rhosts} and so on are likely
2235 to be inapplicable; consult the documentation for your rsh
2236 replacement.
2237 @c FIXME: there should be a way to specify the
2238 @c program in CVSROOT, not CVS_RSH, so that one can use
2239 @c different ones for different roots.  e.g. ":ext;rsh=remsh:"
2240 @c instead of ":ext:".
2241 @c See also the comment in src/client.c for rationale
2242 @c concerning "rsh" being the default and never
2243 @c "remsh".
2244
2245 Continuing our example, supposing you want to access
2246 the module @file{foo} in the repository
2247 @file{/usr/local/cvsroot/}, on machine
2248 @file{faun.example.org}, you are ready to go:
2249
2250 @example
2251 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2252 @end example
2253
2254 @noindent
2255 (The @file{bach@@} can be omitted if the username is
2256 the same on both the local and remote hosts.)
2257
2258 @c Should we mention "rsh host echo hi" and "rsh host
2259 @c cat" (the latter followed by typing text and ^D)
2260 @c as troubleshooting techniques?  Probably yes
2261 @c (people tend to have trouble setting this up),
2262 @c but this kind of thing can be hard to spell out.
2263
2264 @node Password authenticated
2265 @subsection Direct connection with password authentication
2266
2267 The @sc{cvs} client can also connect to the server
2268 using a password protocol.  This is particularly useful
2269 if using @code{rsh} is not feasible (for example,
2270 the server is behind a firewall), and Kerberos also is
2271 not available.
2272
2273         To use this method, it is necessary to make
2274 some adjustments on both the server and client sides.
2275
2276 @menu
2277 * Password authentication server::     Setting up the server
2278 * Password authentication client::     Using the client
2279 * Password authentication security::   What this method does and does not do
2280 @end menu
2281
2282 @node Password authentication server
2283 @subsubsection Setting up the server for password authentication
2284
2285 First of all, you probably want to tighten the
2286 permissions on the @file{$CVSROOT} and
2287 @file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2288 authentication security}, for more details.
2289
2290 @cindex pserver (subcommand)
2291 @cindex Remote repositories, port specification
2292 @cindex Repositories, remote, port specification
2293 @cindex Client/Server Operation, port specification
2294 @cindex pserver (client/server connection method), port specification
2295 @cindex kserver (client/server connection method), port specification
2296 @cindex gserver (client/server connection method), port specification
2297 @cindex port, specifying for remote repositories
2298 @cindex Password server, setting up
2299 @cindex Authenticating server, setting up
2300 @cindex inetd, configuring for pserver
2301 @cindex xinetd, configuring for pserver
2302 @c FIXME: this isn't quite right regarding port
2303 @c numbers; CVS looks up "cvspserver" in
2304 @c /etc/services (on unix, but what about non-unix?).
2305 On the server side, the file @file{/etc/inetd.conf}
2306 needs to be edited so @code{inetd} knows to run the
2307 command @code{cvs pserver} when it receives a
2308 connection on the right port.  By default, the port
2309 number is 2401; it would be different if your client
2310 were compiled with @code{CVS_AUTH_PORT} defined to
2311 something else, though.  This can also be specified in the CVSROOT variable
2312 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2313 environment variable (@pxref{Environment variables}).
2314
2315         If your @code{inetd} allows raw port numbers in
2316 @file{/etc/inetd.conf}, then the following (all on a
2317 single line in @file{inetd.conf}) should be sufficient:
2318
2319 @example
2320 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
2321 cvs -f --allow-root=/usr/cvsroot pserver
2322 @end example
2323
2324 @noindent
2325 (You could also use the
2326 @samp{-T} option to specify a temporary directory.)
2327
2328 The @samp{--allow-root} option specifies the allowable
2329 @sc{cvsroot} directory.  Clients which attempt to use a
2330 different @sc{cvsroot} directory will not be allowed to
2331 connect.  If there is more than one @sc{cvsroot}
2332 directory which you want to allow, repeat the option.
2333 (Unfortunately, many versions of @code{inetd} have very small
2334 limits on the number of arguments and/or the total length
2335 of the command.  The usual solution to this problem is
2336 to have @code{inetd} run a shell script which then invokes
2337 @sc{cvs} with the necessary arguments.)
2338
2339         If your @code{inetd} wants a symbolic service
2340 name instead of a raw port number, then put this in
2341 @file{/etc/services}:
2342
2343 @example
2344 cvspserver      2401/tcp
2345 @end example
2346
2347 @noindent
2348 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2349
2350 If your system uses @code{xinetd} instead of @code{inetd},
2351 the procedure is slightly different.
2352 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2353
2354 @example
2355 service cvspserver
2356 @{
2357    port        = 2401
2358    socket_type = stream
2359    protocol    = tcp
2360    wait        = no
2361    user        = root
2362    passenv     = PATH
2363    server      = /usr/local/bin/cvs
2364    server_args = -f --allow-root=/usr/cvsroot pserver
2365 @}
2366 @end example
2367
2368 @noindent
2369 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2370 the @code{port} line.)
2371
2372         Once the above is taken care of, restart your
2373 @code{inetd}, or do whatever is necessary to force it
2374 to reread its initialization files.
2375
2376 If you are having trouble setting this up, see
2377 @ref{Connection}.
2378
2379 @cindex CVS passwd file
2380 @cindex passwd (admin file)
2381 Because the client stores and transmits passwords in
2382 cleartext (almost---see @ref{Password authentication
2383 security}, for details), a separate @sc{cvs} password
2384 file is generally used, so people don't compromise
2385 their regular passwords when they access the
2386 repository.  This file is
2387 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2388 administrative files}).  It uses a colon-separated
2389 format, similar to @file{/etc/passwd} on Unix systems,
2390 except that it has fewer fields: @sc{cvs} username,
2391 optional password, and an optional system username for
2392 @sc{cvs} to run as if authentication succeeds.  Here is
2393 an example @file{passwd} file with five entries:
2394
2395 @example
2396 anonymous:
2397 bach:ULtgRLXo7NRxs
2398 spwang:1sOp854gDF3DY
2399 melissa:tGX1fS8sun6rY:pubcvs
2400 qproj:XR4EZcEs0szik:pubcvs
2401 @end example
2402
2403 @noindent
2404 (The passwords are encrypted according to the standard
2405 Unix @code{crypt()} function, so it is possible to
2406 paste in passwords directly from regular Unix
2407 @file{/etc/passwd} files.)
2408
2409 The first line in the example will grant access to any
2410 @sc{cvs} client attempting to authenticate as user
2411 @code{anonymous}, no matter what password they use,
2412 including an empty password.  (This is typical for
2413 sites granting anonymous read-only access; for
2414 information on how to do the "read-only" part, see
2415 @ref{Read-only access}.)
2416
2417 The second and third lines will grant access to
2418 @code{bach} and @code{spwang} if they supply their
2419 respective plaintext passwords.
2420
2421 @cindex User aliases
2422 The fourth line will grant access to @code{melissa}, if
2423 she supplies the correct password, but her @sc{cvs}
2424 operations will actually run on the server side under
2425 the system user @code{pubcvs}.  Thus, there need not be
2426 any system user named @code{melissa}, but there
2427 @emph{must} be one named @code{pubcvs}.
2428
2429 The fifth line shows that system user identities can be
2430 shared: any client who successfully authenticates as
2431 @code{qproj} will actually run as @code{pubcvs}, just
2432 as @code{melissa} does.  That way you could create a
2433 single, shared system user for each project in your
2434 repository, and give each developer their own line in
2435 the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2436 username on each line would be different, but the
2437 system username would be the same.  The reason to have
2438 different @sc{cvs} usernames is that @sc{cvs} will log their
2439 actions under those names: when @code{melissa} commits
2440 a change to a project, the checkin is recorded in the
2441 project's history under the name @code{melissa}, not
2442 @code{pubcvs}.  And the reason to have them share a
2443 system username is so that you can arrange permissions
2444 in the relevant area of the repository such that only
2445 that account has write-permission there.
2446
2447 If the system-user field is present, all
2448 password-authenticated @sc{cvs} commands run as that
2449 user; if no system user is specified, @sc{cvs} simply
2450 takes the @sc{cvs} username as the system username and
2451 runs commands as that user.  In either case, if there
2452 is no such user on the system, then the @sc{cvs}
2453 operation will fail (regardless of whether the client
2454 supplied a valid password).
2455
2456 The password and system-user fields can both be omitted
2457 (and if the system-user field is omitted, then also
2458 omit the colon that would have separated it from the
2459 encrypted password).  For example, this would be a
2460 valid @file{$CVSROOT/CVSROOT/passwd} file:
2461
2462 @example
2463 anonymous::pubcvs
2464 fish:rKa5jzULzmhOo:kfogel
2465 sussman:1sOp854gDF3DY
2466 @end example
2467
2468 @noindent
2469 When the password field is omitted or empty, then the
2470 client's authentication attempt will succeed with any
2471 password, including the empty string.  However, the
2472 colon after the @sc{cvs} username is always necessary,
2473 even if the password is empty.
2474
2475 @sc{cvs} can also fall back to use system authentication.
2476 When authenticating a password, the server first checks
2477 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2478 file.  If it finds the user, it will use that entry for
2479 authentication as described above.  But if it does not
2480 find the user, or if the @sc{cvs} @file{passwd} file
2481 does not exist, then the server can try to authenticate
2482 the username and password using the operating system's
2483 user-lookup routines (this "fallback" behavior can be
2484 disabled by setting @code{SystemAuth=no} in the
2485 @sc{cvs} @file{config} file, @pxref{config}).  Be
2486 aware, however, that falling back to system
2487 authentication might be a security risk: @sc{cvs}
2488 operations would then be authenticated with that user's
2489 regular login password, and the password flies across
2490 the network in plaintext.  See @ref{Password
2491 authentication security} for more on this.
2492
2493 Right now, the only way to put a password in the
2494 @sc{cvs} @file{passwd} file is to paste it there from
2495 somewhere else.  Someday, there may be a @code{cvs
2496 passwd} command.
2497
2498 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2499 is normal to edit the @file{passwd} file in-place,
2500 rather than via @sc{cvs}.  This is because of the
2501 possible security risks of having the @file{passwd}
2502 file checked out to people's working copies.  If you do
2503 want to include the @file{passwd} file in checkouts of
2504 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2505
2506 @c We might also suggest using the @code{htpasswd} command
2507 @c from freely available web servers as well, but that
2508 @c would open up a can of worms in that the users next
2509 @c questions are likely to be "where do I get it?" and
2510 @c "how do I use it?"
2511 @c Also note that htpasswd, at least the version I had,
2512 @c likes to clobber the third field.
2513
2514 @node Password authentication client
2515 @subsubsection Using the client with password authentication
2516 @cindex Login (subcommand)
2517 @cindex Password client, using
2518 @cindex Authenticated client, using
2519 @cindex :pserver:, setting up
2520 To run a @sc{cvs} command on a remote repository via
2521 the password-authenticating server, one specifies the
2522 @code{pserver} protocol, optional username, repository host, an
2523 optional port number, and path to the repository.  For example:
2524
2525 @example
2526 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2527 @end example
2528
2529 @noindent
2530 or
2531
2532 @example
2533 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2534 cvs checkout someproj
2535 @end example
2536
2537 However, unless you're connecting to a public-access
2538 repository (i.e., one where that username doesn't
2539 require a password), you'll need to supply a password or @dfn{log in} first.
2540 Logging in verifies your password with the repository and stores it in a file.
2541 It's done with the @code{login} command, which will
2542 prompt you interactively for the password if you didn't supply one as part of
2543 @var{$CVSROOT}:
2544
2545 @example
2546 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2547 CVS password:
2548 @end example
2549
2550 @noindent
2551 or
2552
2553 @example
2554 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2555 @end example
2556
2557 After you enter the password, @sc{cvs} verifies it with
2558 the server.  If the verification succeeds, then that
2559 combination of username, host, repository, and password
2560 is permanently recorded, so future transactions with
2561 that repository won't require you to run @code{cvs
2562 login}.  (If verification fails, @sc{cvs} will exit
2563 complaining that the password was incorrect, and
2564 nothing will be recorded.)
2565
2566 The records are stored, by default, in the file
2567 @file{$HOME/.cvspass}.  That file's format is
2568 human-readable, and to a degree human-editable, but
2569 note that the passwords are not stored in
2570 cleartext---they are trivially encoded to protect them
2571 from "innocent" compromise (i.e., inadvertent viewing
2572 by a system administrator or other non-malicious
2573 person).
2574
2575 @cindex CVS_PASSFILE, environment variable
2576 You can change the default location of this file by
2577 setting the @code{CVS_PASSFILE} environment variable.
2578 If you use this variable, make sure you set it
2579 @emph{before} @code{cvs login} is run.  If you were to
2580 set it after running @code{cvs login}, then later
2581 @sc{cvs} commands would be unable to look up the
2582 password for transmission to the server.
2583   
2584 Once you have logged in, all @sc{cvs} commands using
2585 that remote repository and username will authenticate
2586 with the stored password.  So, for example
2587   
2588 @example
2589 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2590 @end example
2591
2592 @noindent
2593 should just work (unless the password changes on the
2594 server side, in which case you'll have to re-run
2595 @code{cvs login}).
2596
2597 Note that if the @samp{:pserver:} were not present in
2598 the repository specification, @sc{cvs} would assume it
2599 should use @code{rsh} to connect with the server
2600 instead (@pxref{Connecting via rsh}).
2601
2602 Of course, once you have a working copy checked out and
2603 are running @sc{cvs} commands from within it, there is
2604 no longer any need to specify the repository
2605 explicitly, because @sc{cvs} can deduce the repository
2606 from the working copy's @file{CVS} subdirectory.
2607
2608 @c FIXME: seems to me this needs somewhat more
2609 @c explanation.
2610 @cindex Logout (subcommand)
2611 The password for a given remote repository can be
2612 removed from the @code{CVS_PASSFILE} by using the
2613 @code{cvs logout} command.
2614
2615 @node Password authentication security
2616 @subsubsection Security considerations with password authentication
2617
2618 @cindex Security, of pserver
2619 The passwords are stored on the client side in a
2620 trivial encoding of the cleartext, and transmitted in
2621 the same encoding.  The encoding is done only to
2622 prevent inadvertent password compromises (i.e., a
2623 system administrator accidentally looking at the file),
2624 and will not prevent even a naive attacker from gaining
2625 the password.
2626
2627 @c FIXME: The bit about "access to the repository
2628 @c implies general access to the system is *not* specific
2629 @c to pserver; it applies to kerberos and SSH and
2630 @c everything else too.  Should reorganize the
2631 @c documentation to make this clear.
2632 The separate @sc{cvs} password file (@pxref{Password
2633 authentication server}) allows people
2634 to use a different password for repository access than
2635 for login access.  On the other hand, once a user has
2636 non-read-only
2637 access to the repository, she can execute programs on
2638 the server system through a variety of means.  Thus, repository
2639 access implies fairly broad system access as well.  It
2640 might be possible to modify @sc{cvs} to prevent that,
2641 but no one has done so as of this writing.
2642 @c OpenBSD uses chroot() and copies the repository to
2643 @c provide anonymous read-only access (for details see
2644 @c http://www.openbsd.org/anoncvs.shar).  While this
2645 @c closes the most obvious holes, I'm not sure it
2646 @c closes enough holes to recommend it (plus it is
2647 @c *very* easy to accidentally screw up a setup of this
2648 @c type).
2649
2650 Note that because the @file{$CVSROOT/CVSROOT} directory
2651 contains @file{passwd} and other files which are used
2652 to check security, you must control the permissions on
2653 this directory as tightly as the permissions on
2654 @file{/etc}.  The same applies to the @file{$CVSROOT}
2655 directory itself and any directory
2656 above it in the tree.  Anyone who has write access to
2657 such a directory will have the ability to become any
2658 user on the system.  Note that these permissions are
2659 typically tighter than you would use if you are not
2660 using pserver.
2661 @c TODO: Would be really nice to document/implement a
2662 @c scheme where the CVS server can run as some non-root
2663 @c user, e.g. "cvs".  CVSROOT/passwd would contain a
2664 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2665 @c would be implicit).  This would greatly reduce
2666 @c security risks such as those hinted at in the
2667 @c previous paragraph.  I think minor changes to CVS
2668 @c might be required but mostly this would just need
2669 @c someone who wants to play with it, document it, &c.
2670
2671 In summary, anyone who gets the password gets
2672 repository access (which may imply some measure of general system
2673 access as well).  The password is available to anyone
2674 who can sniff network packets or read a protected
2675 (i.e., user read-only) file.  If you want real
2676 security, get Kerberos.
2677
2678 @node GSSAPI authenticated
2679 @subsection Direct connection with GSSAPI
2680
2681 @cindex GSSAPI
2682 @cindex Security, GSSAPI
2683 @cindex :gserver:, setting up
2684 @cindex Kerberos, using :gserver:
2685 GSSAPI is a generic interface to network security
2686 systems such as Kerberos 5.
2687 If you have a working GSSAPI library, you can have
2688 @sc{cvs} connect via a direct @sc{tcp} connection,
2689 authenticating with GSSAPI.
2690
2691 To do this, @sc{cvs} needs to be compiled with GSSAPI
2692 support; when configuring @sc{cvs} it tries to detect
2693 whether GSSAPI libraries using Kerberos version 5 are
2694 present.  You can also use the @file{--with-gssapi}
2695 flag to configure.
2696
2697 The connection is authenticated using GSSAPI, but the
2698 message stream is @emph{not} authenticated by default.
2699 You must use the @code{-a} global option to request
2700 stream authentication.
2701
2702 The data transmitted is @emph{not} encrypted by
2703 default.  Encryption support must be compiled into both
2704 the client and the server; use the
2705 @file{--enable-encrypt} configure option to turn it on.
2706 You must then use the @code{-x} global option to
2707 request encryption.
2708
2709 GSSAPI connections are handled on the server side by
2710 the same server which handles the password
2711 authentication server; see @ref{Password authentication
2712 server}.  If you are using a GSSAPI mechanism such as
2713 Kerberos which provides for strong authentication, you
2714 will probably want to disable the ability to
2715 authenticate via cleartext passwords.  To do so, create
2716 an empty @file{CVSROOT/passwd} password file, and set
2717 @code{SystemAuth=no} in the config file
2718 (@pxref{config}).
2719
2720 The GSSAPI server uses a principal name of
2721 cvs/@var{hostname}, where @var{hostname} is the
2722 canonical name of the server host.  You will have to
2723 set this up as required by your GSSAPI mechanism.
2724
2725 To connect using GSSAPI, use the @samp{:gserver:} method.  For
2726 example,
2727
2728 @example
2729 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2730 @end example
2731
2732 @node Kerberos authenticated
2733 @subsection Direct connection with Kerberos
2734
2735 @cindex Kerberos, using :kserver:
2736 @cindex Security, Kerberos
2737 @cindex :kserver:, setting up
2738 The easiest way to use Kerberos is to use the Kerberos
2739 @code{rsh}, as described in @ref{Connecting via rsh}.
2740 The main disadvantage of using rsh is that all the data
2741 needs to pass through additional programs, so it may be
2742 slower.  So if you have Kerberos installed you can
2743 connect via a direct @sc{tcp} connection,
2744 authenticating with Kerberos.
2745
2746 This section concerns the Kerberos network security
2747 system, version 4.  Kerberos version 5 is supported via
2748 the GSSAPI generic network security interface, as
2749 described in the previous section.
2750
2751 To do this, @sc{cvs} needs to be compiled with Kerberos
2752 support; when configuring @sc{cvs} it tries to detect
2753 whether Kerberos is present or you can use the
2754 @file{--with-krb4} flag to configure.
2755
2756 The data transmitted is @emph{not} encrypted by
2757 default.  Encryption support must be compiled into both
2758 the client and server; use the
2759 @file{--enable-encryption} configure option to turn it
2760 on.  You must then use the @code{-x} global option to
2761 request encryption.
2762
2763 @cindex CVS_CLIENT_PORT
2764 You need to edit @file{inetd.conf} on the server
2765 machine to run @code{cvs kserver}.  The client uses
2766 port 1999 by default; if you want to use another port
2767 specify it in the @code{CVSROOT} (@pxref{Remote repositories})
2768 or the @code{CVS_CLIENT_PORT} environment variable
2769 (@pxref{Environment variables}) on the client.
2770
2771 @cindex kinit
2772 When you want to use @sc{cvs}, get a ticket in the
2773 usual way (generally @code{kinit}); it must be a ticket
2774 which allows you to log into the server machine.  Then
2775 you are ready to go:
2776
2777 @example
2778 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
2779 @end example
2780
2781 Previous versions of @sc{cvs} would fall back to a
2782 connection via rsh; this version will not do so.
2783
2784 @node Connecting via fork
2785 @subsection Connecting with fork
2786
2787 @cindex fork, access method
2788 @cindex :fork:, setting up
2789 This access method allows you to connect to a
2790 repository on your local disk via the remote protocol.
2791 In other words it does pretty much the same thing as
2792 @code{:local:}, but various quirks, bugs and the like are
2793 those of the remote @sc{cvs} rather than the local
2794 @sc{cvs}.
2795
2796 For day-to-day operations you might prefer either
2797 @code{:local:} or @code{:fork:}, depending on your
2798 preferences.  Of course @code{:fork:} comes in
2799 particularly handy in testing or
2800 debugging @code{cvs} and the remote protocol.
2801 Specifically, we avoid all of the network-related
2802 setup/configuration, timeouts, and authentication
2803 inherent in the other remote access methods but still
2804 create a connection which uses the remote protocol.
2805
2806 To connect using the @code{fork} method, use
2807 @samp{:fork:} and the pathname to your local
2808 repository.  For example:
2809
2810 @example
2811 cvs -d :fork:/usr/local/cvsroot checkout foo
2812 @end example
2813
2814 @cindex CVS_SERVER, and :fork:
2815 As with @code{:ext:}, the server is called @samp{cvs}
2816 by default, or the value of the @code{CVS_SERVER}
2817 environment variable.
2818
2819 @c ---------------------------------------------------------------------
2820 @node Read-only access
2821 @section Read-only repository access
2822 @cindex Read-only repository access
2823 @cindex readers (admin file)
2824 @cindex writers (admin file)
2825
2826         It is possible to grant read-only repository
2827 access to people using the password-authenticated
2828 server (@pxref{Password authenticated}).  (The
2829 other access methods do not have explicit support for
2830 read-only users because those methods all assume login
2831 access to the repository machine anyway, and therefore
2832 the user can do whatever local file permissions allow
2833 her to do.)
2834
2835         A user who has read-only access can do only
2836 those @sc{cvs} operations which do not modify the
2837 repository, except for certain ``administrative'' files
2838 (such as lock files and the history file).  It may be
2839 desirable to use this feature in conjunction with
2840 user-aliasing (@pxref{Password authentication server}).
2841
2842 Unlike with previous versions of @sc{cvs}, read-only
2843 users should be able merely to read the repository, and
2844 not to execute programs on the server or otherwise gain
2845 unexpected levels of access.  Or to be more accurate,
2846 the @emph{known} holes have been plugged.  Because this
2847 feature is new and has not received a comprehensive
2848 security audit, you should use whatever level of
2849 caution seems warranted given your attitude concerning
2850 security.
2851
2852         There are two ways to specify read-only access
2853 for a user: by inclusion, and by exclusion.
2854
2855         "Inclusion" means listing that user
2856 specifically in the @file{$CVSROOT/CVSROOT/readers}
2857 file, which is simply a newline-separated list of
2858 users.  Here is a sample @file{readers} file:
2859
2860 @example
2861 melissa
2862 splotnik
2863 jrandom
2864 @end example
2865
2866 @noindent
2867         (Don't forget the newline after the last user.)
2868
2869         "Exclusion" means explicitly listing everyone
2870 who has @emph{write} access---if the file
2871
2872 @example
2873 $CVSROOT/CVSROOT/writers
2874 @end example
2875
2876 @noindent
2877 exists, then only
2878 those users listed in it have write access, and
2879 everyone else has read-only access (of course, even the
2880 read-only users still need to be listed in the
2881 @sc{cvs} @file{passwd} file).  The
2882 @file{writers} file has the same format as the
2883 @file{readers} file.
2884
2885         Note: if your @sc{cvs} @file{passwd}
2886 file maps cvs users onto system users (@pxref{Password
2887 authentication server}), make sure you deny or grant
2888 read-only access using the @emph{cvs} usernames, not
2889 the system usernames.  That is, the @file{readers} and
2890 @file{writers} files contain cvs usernames, which may
2891 or may not be the same as system usernames.
2892
2893         Here is a complete description of the server's
2894 behavior in deciding whether to grant read-only or
2895 read-write access:
2896
2897         If @file{readers} exists, and this user is
2898 listed in it, then she gets read-only access.  Or if
2899 @file{writers} exists, and this user is NOT listed in
2900 it, then she also gets read-only access (this is true
2901 even if @file{readers} exists but she is not listed
2902 there).  Otherwise, she gets full read-write access.
2903
2904         Of course there is a conflict if the user is
2905 listed in both files.  This is resolved in the more
2906 conservative way, it being better to protect the
2907 repository too much than too little: such a user gets
2908 read-only access.
2909
2910 @node Server temporary directory
2911 @section Temporary directories for the server
2912 @cindex Temporary directories, and server
2913 @cindex Server, temporary directories
2914
2915 While running, the @sc{cvs} server creates temporary
2916 directories.  They are named
2917
2918 @example
2919 cvs-serv@var{pid}
2920 @end example
2921
2922 @noindent
2923 where @var{pid} is the process identification number of
2924 the server.
2925 They are located in the directory specified by 
2926 the @samp{-T} global option (@pxref{Global options}), 
2927 the @code{TMPDIR} environment variable (@pxref{Environment variables}), 
2928 or, failing that, @file{/tmp}.
2929
2930 In most cases the server will remove the temporary
2931 directory when it is done, whether it finishes normally
2932 or abnormally.  However, there are a few cases in which
2933 the server does not or cannot remove the temporary
2934 directory, for example:
2935
2936 @itemize @bullet
2937 @item
2938 If the server aborts due to an internal server error,
2939 it may preserve the directory to aid in debugging
2940
2941 @item
2942 If the server is killed in a way that it has no way of
2943 cleaning up (most notably, @samp{kill -KILL} on unix).
2944
2945 @item
2946 If the system shuts down without an orderly shutdown,
2947 which tells the server to clean up.
2948 @end itemize
2949
2950 In cases such as this, you will need to manually remove
2951 the @file{cvs-serv@var{pid}} directories.  As long as
2952 there is no server running with process identification
2953 number @var{pid}, it is safe to do so.
2954
2955 @c ---------------------------------------------------------------------
2956 @node Starting a new project
2957 @chapter Starting a project with CVS
2958 @cindex Starting a project with CVS
2959 @cindex Creating a project
2960
2961 @comment --moduledb--
2962 Because renaming files and moving them between
2963 directories is somewhat inconvenient, the first thing
2964 you do when you start a new project should be to think
2965 through your file organization.  It is not impossible
2966 to rename or move files, but it does increase the
2967 potential for confusion and @sc{cvs} does have some
2968 quirks particularly in the area of renaming
2969 directories.  @xref{Moving files}.
2970
2971 What to do next depends on the situation at hand.
2972
2973 @menu
2974 * Setting up the files::        Getting the files into the repository
2975 * Defining the module::         How to make a module of the files
2976 @end menu
2977 @c -- File permissions!
2978
2979 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2980 @node Setting up the files
2981 @section Setting up the files
2982
2983 The first step is to create the files inside the repository.  This can
2984 be done in a couple of different ways.
2985
2986 @c -- The contributed scripts
2987 @menu
2988 * From files::                  This method is useful with old projects
2989                                 where files already exists.
2990 * From other version control systems::  Old projects where you want to
2991                                         preserve history from another system.
2992 * From scratch::                Creating a directory tree from scratch.
2993 @end menu
2994
2995 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2996 @node From files
2997 @subsection Creating a directory tree from a number of files
2998 @cindex Importing files
2999
3000 When you begin using @sc{cvs}, you will probably already have several
3001 projects that can be
3002 put under @sc{cvs} control.  In these cases the easiest way is to use the
3003 @code{import} command.  An example is probably the easiest way to
3004 explain how to use it.  If the files you want to install in
3005 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3006 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3007
3008 @example
3009 $ cd @var{wdir}
3010 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3011 @end example
3012
3013 Unless you supply a log message with the @samp{-m}
3014 flag, @sc{cvs} starts an editor and prompts for a
3015 message.  The string @samp{yoyo} is a @dfn{vendor tag},
3016 and @samp{start} is a @dfn{release tag}.  They may fill
3017 no purpose in this context, but since @sc{cvs} requires
3018 them they must be present.  @xref{Tracking sources}, for
3019 more information about them.
3020
3021 You can now verify that it worked, and remove your
3022 original source directory.
3023 @c FIXME: Need to say more about "verify that it
3024 @c worked".  What should the user look for in the output
3025 @c from "diff -r"?
3026
3027 @example
3028 $ cd ..
3029 $ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3030 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3031 $ rm -r @var{wdir}
3032 @end example
3033
3034 @noindent
3035 Erasing the original sources is a good idea, to make sure that you do
3036 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3037 Of course, it would be wise to make sure that you have
3038 a backup of the sources before you remove them.
3039
3040 The @code{checkout} command can either take a module
3041 name as argument (as it has done in all previous
3042 examples) or a path name relative to @code{$CVSROOT},
3043 as it did in the example above.
3044
3045 It is a good idea to check that the permissions
3046 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3047 are reasonable, and that they belong to the proper
3048 groups.  @xref{File permissions}.
3049
3050 If some of the files you want to import are binary, you
3051 may want to use the wrappers features to specify which
3052 files are binary and which are not.  @xref{Wrappers}.
3053
3054 @c The node name is too long, but I am having trouble
3055 @c thinking of something more concise.
3056 @node From other version control systems
3057 @subsection Creating Files From Other Version Control Systems
3058 @cindex Importing files, from other version control systems
3059
3060 If you have a project which you are maintaining with
3061 another version control system, such as @sc{rcs}, you
3062 may wish to put the files from that project into
3063 @sc{cvs}, and preserve the revision history of the
3064 files.
3065
3066 @table @asis
3067 @cindex RCS, importing files from
3068 @item From RCS
3069 If you have been using @sc{rcs}, find the @sc{rcs}
3070 files---usually a file named @file{foo.c} will have its
3071 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3072 other places; consult the @sc{rcs} documentation for
3073 details).  Then create the appropriate directories in
3074 @sc{cvs} if they do not already exist.  Then copy the
3075 files into the appropriate directories in the @sc{cvs}
3076 repository (the name in the repository must be the name
3077 of the source file with @samp{,v} added; the files go
3078 directly in the appropriate directory of the repository,
3079 not in an @file{RCS} subdirectory).  This is one of the
3080 few times when it is a good idea to access the @sc{cvs}
3081 repository directly, rather than using @sc{cvs}
3082 commands.  Then you are ready to check out a new
3083 working directory.
3084 @c Someday there probably should be a "cvs import -t
3085 @c rcs" or some such.  It could even create magic
3086 @c branches.  It could also do something about the case
3087 @c where the RCS file had a (non-magic) "0" branch.
3088
3089 The @sc{rcs} file should not be locked when you move it
3090 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3091 letting you operate on it.
3092 @c What is the easiest way to unlock your files if you
3093 @c have them locked?  Especially if you have a lot of them?
3094 @c This is a CVS bug/misfeature; importing RCS files
3095 @c should ignore whether they are locked and leave them in
3096 @c an unlocked state.  Yet another reason for a separate
3097 @c "import RCS file" command.
3098
3099 @c How many is "many"? Or do they just import RCS files?
3100 @item From another version control system
3101 Many version control systems have the ability to export
3102 @sc{rcs} files in the standard format.  If yours does,
3103 export the @sc{rcs} files and then follow the above
3104 instructions.
3105
3106 Failing that, probably your best bet is to write a
3107 script that will check out the files one revision at a
3108 time using the command line interface to the other
3109 system, and then check the revisions into @sc{cvs}.
3110 The @file{sccs2rcs} script mentioned below may be a
3111 useful example to follow.
3112
3113 @cindex SCCS, importing files from
3114 @item From SCCS
3115 There is a script in the @file{contrib} directory of
3116 the @sc{cvs} source distribution called @file{sccs2rcs}
3117 which converts @sc{sccs} files to @sc{rcs} files.
3118 Note: you must run it on a machine which has both
3119 @sc{sccs} and @sc{rcs} installed, and like everything
3120 else in contrib it is unsupported (your mileage may
3121 vary).
3122
3123 @cindex PVCS, importing files from
3124 @item From PVCS
3125 There is a script in the @file{contrib} directory of
3126 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3127 which converts @sc{pvcs} archives to @sc{rcs} files.
3128 You must run it on a machine which has both
3129 @sc{pvcs} and @sc{rcs} installed, and like everything
3130 else in contrib it is unsupported (your mileage may
3131 vary).  See the comments in the script for details.
3132 @end table
3133 @c CMZ and/or PATCHY were systems that were used in the
3134 @c high energy physics community (especially for
3135 @c CERNLIB).  CERN has replaced them with CVS, but the
3136 @c CAR format seems to live on as a way to submit
3137 @c changes.  There is a program car2cvs which converts
3138 @c but I'm not sure where one gets a copy.
3139 @c Not sure it is worth mentioning here, since it would
3140 @c appear to affect only one particular community.
3141 @c Best page for more information is:
3142 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3143 @c See also:
3144 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3145
3146 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3147 @node From scratch
3148 @subsection Creating a directory tree from scratch
3149
3150 @c Also/instead should be documenting
3151 @c $ cvs co -l .
3152 @c $ mkdir tc
3153 @c $ cvs add tc
3154 @c $ cd tc
3155 @c $ mkdir man
3156 @c $ cvs add man
3157 @c etc.
3158 @c Using import to create the directories only is
3159 @c probably a somewhat confusing concept.
3160 For a new project, the easiest thing to do is probably
3161 to create an empty directory structure, like this:
3162
3163 @example
3164 $ mkdir tc
3165 $ mkdir tc/man
3166 $ mkdir tc/testing
3167 @end example
3168
3169 After that, you use the @code{import} command to create
3170 the corresponding (empty) directory structure inside
3171 the repository:
3172
3173 @example
3174 $ cd tc
3175 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3176 @end example
3177
3178 This will add yoyodyne/@var{dir} as a directory under
3179 @code{$CVSROOT}.
3180
3181 Then, use @code{add} to add files (and new directories)
3182 as they appear.
3183
3184 Check that the permissions @sc{cvs} sets on the
3185 directories inside @code{$CVSROOT} are reasonable.
3186
3187 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3188 @node Defining the module
3189 @section Defining the module
3190 @cindex Defining a module
3191 @cindex Editing the modules file
3192 @cindex Module, defining
3193 @cindex Modules file, changing
3194
3195 The next step is to define the module in the
3196 @file{modules} file.  This is not strictly necessary,
3197 but modules can be convenient in grouping together
3198 related files and directories.
3199
3200 In simple cases these steps are sufficient to define a module.
3201
3202 @enumerate
3203 @item
3204 Get a working copy of the modules file.
3205
3206 @example
3207 $ cvs checkout CVSROOT/modules
3208 $ cd CVSROOT
3209 @end example
3210
3211 @item
3212 Edit the file and insert a line that defines the module.  @xref{Intro
3213 administrative files}, for an introduction.  @xref{modules}, for a full
3214 description of the modules file.  You can use the
3215 following line to define the module @samp{tc}:
3216
3217 @example
3218 tc   yoyodyne/tc
3219 @end example
3220
3221 @item
3222 Commit your changes to the modules file.
3223
3224 @example
3225 $ cvs commit -m "Added the tc module." modules
3226 @end example
3227
3228 @item
3229 Release the modules module.
3230
3231 @example
3232 $ cd ..
3233 $ cvs release -d CVSROOT
3234 @end example
3235 @end enumerate
3236
3237 @c ---------------------------------------------------------------------
3238 @node Revisions
3239 @chapter Revisions
3240
3241 For many uses of @sc{cvs}, one doesn't need to worry
3242 too much about revision numbers; @sc{cvs} assigns
3243 numbers such as @code{1.1}, @code{1.2}, and so on, and
3244 that is all one needs to know.  However, some people
3245 prefer to have more knowledge and control concerning
3246 how @sc{cvs} assigns revision numbers.
3247
3248 If one wants to keep track of a set of revisions
3249 involving more than one file, such as which revisions
3250 went into a particular release, one uses a @dfn{tag},
3251 which is a symbolic revision which can be assigned to a
3252 numeric revision in each file.
3253
3254 @menu
3255 * Revision numbers::            The meaning of a revision number
3256 * Versions revisions releases::  Terminology used in this manual
3257 * Assigning revisions::         Assigning revisions
3258 * Tags::                        Tags--Symbolic revisions
3259 * Tagging the working directory::  The cvs tag command
3260 * Tagging by date/tag::         The cvs rtag command
3261 * Modifying tags::              Adding, renaming, and deleting tags
3262 * Tagging add/remove::          Tags with adding and removing files
3263 * Sticky tags::                 Certain tags are persistent
3264 @end menu
3265
3266 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3267 @node Revision numbers
3268 @section Revision numbers
3269 @cindex Revision numbers
3270 @cindex Revision tree
3271 @cindex Linear development
3272 @cindex Number, revision-
3273 @cindex Decimal revision number
3274 @cindex Branch number
3275 @cindex Number, branch
3276
3277 Each version of a file has a unique @dfn{revision
3278 number}.  Revision numbers look like @samp{1.1},
3279 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3280 A revision number always has an even number of
3281 period-separated decimal integers.  By default revision
3282 1.1 is the first revision of a file.  Each successive
3283 revision is given a new number by increasing the
3284 rightmost number by one.  The following figure displays
3285 a few revisions, with newer revisions to the right.
3286
3287 @example
3288        +-----+    +-----+    +-----+    +-----+    +-----+
3289        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3290        +-----+    +-----+    +-----+    +-----+    +-----+
3291 @end example
3292
3293 It is also possible to end up with numbers containing
3294 more than one period, for example @samp{1.3.2.2}.  Such
3295 revisions represent revisions on branches
3296 (@pxref{Branching and merging}); such revision numbers
3297 are explained in detail in @ref{Branches and
3298 revisions}.
3299
3300 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3301 @node Versions revisions releases
3302 @section Versions, revisions and releases
3303 @cindex Revisions, versions and releases
3304 @cindex Versions, revisions and releases
3305 @cindex Releases, revisions and versions
3306
3307 A file can have several versions, as described above.
3308 Likewise, a software product can have several versions.
3309 A software product is often given a version number such
3310 as @samp{4.1.1}.
3311
3312 Versions in the first sense are called @dfn{revisions}
3313 in this document, and versions in the second sense are
3314 called @dfn{releases}.  To avoid confusion, the word
3315 @dfn{version} is almost never used in this document.
3316
3317 @node Assigning revisions
3318 @section Assigning revisions
3319
3320 @c We avoid the "major revision" terminology.  It seems
3321 @c like jargon.  Hopefully "first number" is clear enough.
3322 By default, @sc{cvs} will assign numeric revisions by
3323 leaving the first number the same and incrementing the
3324 second number.  For example, @code{1.1}, @code{1.2},
3325 @code{1.3}, etc.
3326
3327 When adding a new file, the second number will always
3328 be one and the first number will equal the highest
3329 first number of any file in that directory.  For
3330 example, the current directory contains files whose
3331 highest numbered revisions are @code{1.7}, @code{3.1},
3332 and @code{4.12}, then an added file will be given the
3333 numeric revision @code{4.1}.
3334 (When using client/server @sc{cvs},
3335 only files that are actually sent to the server are considered.)
3336
3337 @c This is sort of redundant with something we said a
3338 @c while ago.  Somewhere we need a better way of
3339 @c introducing how the first number can be anything
3340 @c except "1", perhaps.  Also I don't think this
3341 @c presentation is clear on why we are discussing releases
3342 @c and first numbers of numeric revisions in the same
3343 @c breath.
3344 Normally there is no reason to care
3345 about the revision numbers---it is easier to treat them
3346 as internal numbers that @sc{cvs} maintains, and tags
3347 provide a better way to distinguish between things like
3348 release 1 versus release 2 of your product
3349 (@pxref{Tags}).  However, if you want to set the
3350 numeric revisions, the @samp{-r} option to @code{cvs
3351 commit} can do that.  The @samp{-r} option implies the
3352 @samp{-f} option, in the sense that it causes the
3353 files to be committed even if they are not modified.
3354
3355 For example, to bring all your files up to
3356 revision 3.0 (including those that haven't changed),
3357 you might invoke:
3358
3359 @example
3360 $ cvs commit -r 3.0
3361 @end example
3362
3363 Note that the number you specify with @samp{-r} must be
3364 larger than any existing revision number.  That is, if
3365 revision 3.0 exists, you cannot @samp{cvs commit
3366 -r 1.3}.  If you want to maintain several releases in
3367 parallel, you need to use a branch (@pxref{Branching and merging}).
3368
3369 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3370 @node Tags
3371 @section Tags--Symbolic revisions
3372 @cindex Tags
3373
3374 The revision numbers live a life of their own.  They
3375 need not have anything at all to do with the release
3376 numbers of your software product.  Depending
3377 on how you use @sc{cvs} the revision numbers might change several times
3378 between two releases.  As an example, some of the
3379 source files that make up @sc{rcs} 5.6 have the following
3380 revision numbers:
3381 @cindex RCS revision numbers
3382
3383 @example
3384 ci.c            5.21
3385 co.c            5.9
3386 ident.c         5.3
3387 rcs.c           5.12
3388 rcsbase.h       5.11
3389 rcsdiff.c       5.10
3390 rcsedit.c       5.11
3391 rcsfcmp.c       5.9
3392 rcsgen.c        5.10
3393 rcslex.c        5.11
3394 rcsmap.c        5.2
3395 rcsutil.c       5.10
3396 @end example
3397
3398 @cindex tag, command, introduction
3399 @cindex Tag, symbolic name
3400 @cindex Symbolic name (tag)
3401 @cindex Name, symbolic (tag)
3402 @cindex HEAD, as reserved tag name
3403 @cindex BASE, as reserved tag name
3404 You can use the @code{tag} command to give a symbolic name to a
3405 certain revision of a file.  You can use the @samp{-v} flag to the
3406 @code{status} command to see all tags that a file has, and
3407 which revision numbers they represent.  Tag names must
3408 start with an uppercase or lowercase letter and can
3409 contain uppercase and lowercase letters, digits,
3410 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
3411 and @code{HEAD} are reserved for use by @sc{cvs}.  It
3412 is expected that future names which are special to
3413 @sc{cvs} will be specially named, for example by
3414 starting with @samp{.}, rather than being named analogously to
3415 @code{BASE} and @code{HEAD}, to avoid conflicts with
3416 actual tag names.
3417 @c Including a character such as % or = has also been
3418 @c suggested as the naming convention for future
3419 @c special tag names.  Starting with . is nice because
3420 @c that is not a legal tag name as far as RCS is concerned.
3421 @c FIXME: CVS actually accepts quite a few characters
3422 @c in tag names, not just the ones documented above
3423 @c (see RCS_check_tag).  RCS
3424 @c defines legitimate tag names by listing illegal
3425 @c characters rather than legal ones.  CVS is said to lose its
3426 @c mind if you try to use "/" (try making such a tag sticky
3427 @c and using "cvs status" client/server--see remote
3428 @c protocol format for entries line for probable cause).
3429 @c TODO: The testsuite
3430 @c should test for whatever are documented above as
3431 @c officially-OK tag names, and CVS should at least reject
3432 @c characters that won't work, like "/".
3433
3434 You'll want to choose some convention for naming tags,
3435 based on information such as the name of the program
3436 and the version number of the release.  For example,
3437 one might take the name of the program, immediately
3438 followed by the version number with @samp{.} changed to
3439 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3440 @code{cvs1-9}.  If you choose a consistent convention,
3441 then you won't constantly be guessing whether a tag is
3442 @code{cvs-1-9} or @code{cvs1_9} or what.  You might
3443 even want to consider enforcing your convention in the
3444 @file{taginfo} file (@pxref{taginfo}).
3445 @c Might be nice to say more about using taginfo this
3446 @c way, like giving an example, or pointing out any particular
3447 @c issues which arise.
3448
3449 @cindex Adding a tag
3450 @cindex Tag, example
3451 The following example shows how you can add a tag to a
3452 file.  The commands must be issued inside your working
3453 directory.  That is, you should issue the
3454 command in the directory where @file{backend.c}
3455 resides.
3456
3457 @example
3458 $ cvs tag rel-0-4 backend.c
3459 T backend.c
3460 $ cvs status -v backend.c
3461 ===================================================================
3462 File: backend.c         Status: Up-to-date
3463
3464     Version:            1.4     Tue Dec  1 14:39:01 1992
3465     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3466     Sticky Tag:         (none)
3467     Sticky Date:        (none)
3468     Sticky Options:     (none)
3469
3470     Existing Tags:
3471         rel-0-4                     (revision: 1.4)
3472
3473 @end example
3474
3475 For a complete summary of the syntax of @code{cvs tag},
3476 including the various options, see @ref{Invoking CVS}.
3477
3478 There is seldom reason to tag a file in isolation.  A more common use is
3479 to tag all the files that constitute a module with the same tag at
3480 strategic points in the development life-cycle, such as when a release
3481 is made.
3482
3483 @example
3484 $ cvs tag rel-1-0 .
3485 cvs tag: Tagging .
3486 T Makefile
3487 T backend.c
3488 T driver.c
3489 T frontend.c
3490 T parser.c
3491 @end example
3492
3493 @noindent
3494 (When you give @sc{cvs} a directory as argument, it generally applies the
3495 operation to all the files in that directory, and (recursively), to any
3496 subdirectories that it may contain.  @xref{Recursive behavior}.)
3497
3498 @cindex Retrieving an old revision using tags
3499 @cindex Tag, retrieving old revisions
3500 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3501 a certain revision of a module.  This flag makes it easy to
3502 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3503 any time in the future:
3504
3505 @example
3506 $ cvs checkout -r rel-1-0 tc
3507 @end example
3508
3509 @noindent
3510 This is useful, for instance, if someone claims that there is a bug in
3511 that release, but you cannot find the bug in the current working copy.
3512
3513 You can also check out a module as it was at any given date.
3514 @xref{checkout options}.  When specifying @samp{-r} to
3515 any of these commands, you will need beware of sticky
3516 tags; see @ref{Sticky tags}.
3517
3518 When you tag more than one file with the same tag you
3519 can think about the tag as "a curve drawn through a
3520 matrix of filename vs. revision number."  Say we have 5
3521 files with the following revisions:
3522
3523 @example
3524 @group
3525         file1   file2   file3   file4   file5
3526
3527         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3528         1.2*-   1.2     1.2    -1.2*-
3529         1.3  \- 1.3*-   1.3   / 1.3
3530         1.4          \  1.4  /  1.4
3531                       \-1.5*-   1.5
3532                         1.6
3533 @end group
3534 @end example
3535
3536 At some time in the past, the @code{*} versions were tagged.
3537 You can think of the tag as a handle attached to the curve
3538 drawn through the tagged revisions.  When you pull on
3539 the handle, you get all the tagged revisions.  Another
3540 way to look at it is that you "sight" through a set of
3541 revisions that is "flat" along the tagged revisions,
3542 like this:
3543
3544 @example
3545 @group
3546         file1   file2   file3   file4   file5
3547
3548                         1.1
3549                         1.2
3550                 1.1     1.3                       _
3551         1.1     1.2     1.4     1.1              /
3552         1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
3553         1.3             1.6     1.3              \_
3554         1.4                     1.4
3555                                 1.5
3556 @end group
3557 @end example
3558
3559 @node Tagging the working directory
3560 @section Specifying what to tag from the working directory
3561
3562 @cindex tag (subcommand)
3563 The example in the previous section demonstrates one of
3564 the most common ways to choose which revisions to tag.
3565 Namely, running the @code{cvs tag} command without
3566 arguments causes @sc{cvs} to select the revisions which
3567 are checked out in the current working directory.  For
3568 example, if the copy of @file{backend.c} in working
3569 directory was checked out from revision 1.4, then
3570 @sc{cvs} will tag revision 1.4.  Note that the tag is
3571 applied immediately to revision 1.4 in the repository;
3572 tagging is not like modifying a file, or other
3573 operations in which one first modifies the working
3574 directory and then runs @code{cvs commit} to transfer
3575 that modification to the repository.
3576
3577 One potentially surprising aspect of the fact that
3578 @code{cvs tag} operates on the repository is that you
3579 are tagging the checked-in revisions, which may differ
3580 from locally modified files in your working directory.
3581 If you want to avoid doing this by mistake, specify the
3582 @samp{-c} option to @code{cvs tag}.  If there are any
3583 locally modified files, @sc{cvs} will abort with an
3584 error before it tags any files:
3585
3586 @example
3587 $ cvs tag -c rel-0-4
3588 cvs tag: backend.c is locally modified
3589 cvs [tag aborted]: correct the above errors first!
3590 @end example
3591
3592 @node Tagging by date/tag
3593 @section Specifying what to tag by date or revision
3594 @cindex rtag (subcommand)
3595
3596 The @code{cvs rtag} command tags the repository as of a
3597 certain date or time (or can be used to tag the latest
3598 revision).  @code{rtag} works directly on the
3599 repository contents (it requires no prior checkout and
3600 does not look for a working directory).
3601
3602 The following options specify which date or revision to
3603 tag.  See @ref{Common options}, for a complete
3604 description of them.
3605
3606 @table @code
3607 @item -D @var{date}
3608 Tag the most recent revision no later than @var{date}.
3609
3610 @item -f
3611 Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
3612 flags.  If no matching revision is found, use the most
3613 recent revision (instead of ignoring the file).
3614
3615 @item -r @var{tag}
3616 Only tag those files that contain existing tag @var{tag}.
3617 @end table
3618
3619 The @code{cvs tag} command also allows one to specify
3620 files by revision or date, using the same @samp{-r},
3621 @samp{-D}, and @samp{-f} options.  However, this
3622 feature is probably not what you want.  The reason is
3623 that @code{cvs tag} chooses which files to tag based on
3624 the files that exist in the working directory, rather
3625 than the files which existed as of the given tag/date.
3626 Therefore, you are generally better off using @code{cvs
3627 rtag}.  The exceptions might be cases like:
3628
3629 @example
3630 cvs tag -r 1.4 backend.c
3631 @end example
3632
3633 @node Modifying tags
3634 @section Deleting, moving, and renaming tags
3635
3636 @c Also see:
3637 @c  "How do I move or rename a magic branch tag?"
3638 @c in the FAQ (I think the issues it talks about still
3639 @c apply, but this could use some sanity.sh work).
3640
3641 Normally one does not modify tags.  They exist in order
3642 to record the history of the repository and so deleting
3643 them or changing their meaning would, generally, not be
3644 what you want.
3645
3646 However, there might be cases in which one uses a tag
3647 temporarily or accidentally puts one in the wrong
3648 place.  Therefore, one might delete, move, or rename a
3649 tag.
3650
3651 @noindent
3652 @strong{WARNING: the commands in this section are
3653 dangerous; they permanently discard historical
3654 information and it can be difficult or impossible to
3655 recover from errors.  If you are a @sc{cvs}
3656 administrator, you may consider restricting these
3657 commands with the @file{taginfo} file (@pxref{taginfo}).}
3658
3659 @cindex Deleting tags
3660 @cindex Deleting branch tags
3661 @cindex Removing tags
3662 @cindex Removing branch tags
3663 @cindex Tags, deleting
3664 @cindex Branch tags, deleting
3665 To delete a tag, specify the @samp{-d} option to either
3666 @code{cvs tag} or @code{cvs rtag}.  For example:
3667
3668 @example
3669 cvs rtag -d rel-0-4 tc
3670 @end example
3671
3672 @noindent
3673 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
3674 In the event that branch tags are encountered within the repository
3675 with the given name, a warning message will be issued and the branch 
3676 tag will not be deleted.  If you are absolutely certain you know what
3677 you are doing, the @code{-B} option may be specified to allow deletion
3678 of branch tags.  In that case, any non-branch tags encountered will
3679 trigger warnings and will not be deleted.
3680
3681 @noindent
3682 @strong{WARNING: Moving branch tags is very dangerous!  If you think
3683 you need the @code{-B} option, think again and ask your @sc{cvs}
3684 administrator about it (if that isn't you).  There is almost certainly
3685 another way to accomplish what you want to accomplish.}
3686
3687 @cindex Moving tags
3688 @cindex Moving branch tags
3689 @cindex Tags, moving
3690 @cindex Branch tags, moving
3691 When we say @dfn{move} a tag, we mean to make the same
3692 name point to different revisions.  For example, the
3693 @code{stable} tag may currently point to revision 1.4
3694 of @file{backend.c} and perhaps we want to make it
3695 point to revision 1.6.  To move a non-branch tag, specify the
3696 @samp{-F} option to either @code{cvs tag} or @code{cvs
3697 rtag}.  For example, the task just mentioned might be
3698 accomplished as:
3699
3700 @example
3701 cvs tag -r 1.6 -F stable backend.c
3702 @end example
3703
3704 @noindent
3705 If any branch tags are encountered in the repository 
3706 with the given name, a warning is issued and the branch
3707 tag is not disturbed.  If you are absolutely certain you
3708 wish to move the branch tag, the @code{-B} option may be specified.
3709 In that case, non-branch tags encountered with the given
3710 name are ignored with a warning message.
3711
3712 @noindent
3713 @strong{WARNING: Moving branch tags is very dangerous!  If you think you
3714 need the @code{-B} option, think again and ask your @sc{cvs}
3715 administrator about it (if that isn't you).  There is almost certainly
3716 another way to accomplish what you want to accomplish.}
3717
3718 @cindex Renaming tags
3719 @cindex Tags, renaming
3720 When we say @dfn{rename} a tag, we mean to make a
3721 different name point to the same revisions as the old
3722 tag.  For example, one may have misspelled the tag name
3723 and want to correct it (hopefully before others are
3724 relying on the old spelling).  To rename a tag, first
3725 create a new tag using the @samp{-r} option to
3726 @code{cvs rtag}, and then delete the old name.  (Caution:
3727 this method will not work with branch tags.) 
3728 This leaves the new tag on exactly the 
3729 same files as the old tag.  For example:
3730
3731 @example
3732 cvs rtag -r old-name-0-4 rel-0-4 tc
3733 cvs rtag -d old-name-0-4 tc
3734 @end example
3735
3736 @node Tagging add/remove
3737 @section Tagging and adding and removing files
3738
3739 The subject of exactly how tagging interacts with
3740 adding and removing files is somewhat obscure; for the
3741 most part @sc{cvs} will keep track of whether files
3742 exist or not without too much fussing.  By default,
3743 tags are applied to only files which have a revision
3744 corresponding to what is being tagged.  Files which did
3745 not exist yet, or which were already removed, simply
3746 omit the tag, and @sc{cvs} knows to treat the absence
3747 of a tag as meaning that the file didn't exist as of
3748 that tag.
3749
3750 However, this can lose a small amount of information.
3751 For example, suppose a file was added and then removed.
3752 Then, if the tag is missing for that file, there is no
3753 way to know whether the tag refers to the time before
3754 the file was added, or the time after it was removed.
3755 If you specify the @samp{-r} option to @code{cvs rtag},
3756 then @sc{cvs} tags the files which have been removed,
3757 and thereby avoids this problem.  For example, one
3758 might specify @code{-r HEAD} to tag the head.
3759
3760 On the subject of adding and removing files, the
3761 @code{cvs rtag} command has a @samp{-a} option which
3762 means to clear the tag from removed files that would
3763 not otherwise be tagged.  For example, one might
3764 specify this option in conjunction with @samp{-F} when
3765 moving a tag.  If one moved a tag without @samp{-a},
3766 then the tag in the removed files might still refer to
3767 the old revision, rather than reflecting the fact that
3768 the file had been removed.  I don't think this is
3769 necessary if @samp{-r} is specified, as noted above.
3770
3771 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3772 @node Sticky tags
3773 @section Sticky tags
3774 @cindex Sticky tags
3775 @cindex Tags, sticky
3776
3777 @c A somewhat related issue is per-directory sticky
3778 @c tags (see comment at CVS/Tag in node Working
3779 @c directory storage); we probably want to say
3780 @c something like "you can set a sticky tag for only
3781 @c some files, but you don't want to" or some such.
3782
3783 Sometimes a working copy's revision has extra data
3784 associated with it, for example it might be on a branch
3785 (@pxref{Branching and merging}), or restricted to
3786 versions prior to a certain date by @samp{checkout -D}
3787 or @samp{update -D}.  Because this data persists --
3788 that is, it applies to subsequent commands in the
3789 working copy -- we refer to it as @dfn{sticky}.
3790
3791 Most of the time, stickiness is an obscure aspect of
3792 @sc{cvs} that you don't need to think about.  However,
3793 even if you don't want to use the feature, you may need
3794 to know @emph{something} about sticky tags (for
3795 example, how to avoid them!).
3796
3797 You can use the @code{status} command to see if any
3798 sticky tags or dates are set:
3799
3800 @example
3801 $ cvs status driver.c
3802 ===================================================================
3803 File: driver.c          Status: Up-to-date
3804
3805     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
3806     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
3807     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
3808     Sticky Date:        (none)
3809     Sticky Options:     (none)
3810
3811 @end example
3812
3813 @cindex Resetting sticky tags
3814 @cindex Sticky tags, resetting
3815 @cindex Deleting sticky tags
3816 The sticky tags will remain on your working files until
3817 you delete them with @samp{cvs update -A}.  The
3818 @samp{-A} option merges local changes into the version of the
3819 file from the head of the trunk, removing any sticky tags,
3820 dates, or options.  See @ref{update} for more on the operation
3821 of @code{cvs update}.
3822
3823 @cindex Sticky date
3824 The most common use of sticky tags is to identify which
3825 branch one is working on, as described in
3826 @ref{Accessing branches}.  However, non-branch
3827 sticky tags have uses as well.  For example,
3828 suppose that you want to avoid updating your working
3829 directory, to isolate yourself from possibly
3830 destabilizing changes other people are making.  You
3831 can, of course, just refrain from running @code{cvs
3832 update}.  But if you want to avoid updating only a
3833 portion of a larger tree, then sticky tags can help.
3834 If you check out a certain revision (such as 1.4) it
3835 will become sticky.  Subsequent @code{cvs update}
3836 commands will
3837 not retrieve the latest revision until you reset the
3838 tag with @code{cvs update -A}.  Likewise, use of the
3839 @samp{-D} option to @code{update} or @code{checkout}
3840 sets a @dfn{sticky date}, which, similarly, causes that
3841 date to be used for future retrievals.
3842
3843 People often want to retrieve an old version of
3844 a file without setting a sticky tag.  This can
3845 be done with the @samp{-p} option to @code{checkout} or
3846 @code{update}, which sends the contents of the file to
3847 standard output.  For example:
3848 @example
3849 $ cvs update -p -r 1.1 file1 >file1
3850 ===================================================================
3851 Checking out file1
3852 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
3853 VERS: 1.1
3854 ***************
3855 $
3856 @end example
3857
3858 However, this isn't the easiest way, if you are asking
3859 how to undo a previous checkin (in this example, put
3860 @file{file1} back to the way it was as of revision
3861 1.1).  In that case you are better off using the
3862 @samp{-j} option to @code{update}; for further
3863 discussion see @ref{Merging two revisions}.
3864
3865 @c ---------------------------------------------------------------------
3866 @node Branching and merging
3867 @chapter Branching and merging
3868 @cindex Branching
3869 @cindex Merging
3870 @cindex Copying changes
3871 @cindex Main trunk and branches
3872 @cindex Revision tree, making branches
3873 @cindex Branches, copying changes between
3874 @cindex Changes, copying between branches
3875 @cindex Modifications, copying between branches
3876
3877 @sc{cvs} allows you to isolate changes onto a separate
3878 line of development, known as a @dfn{branch}.  When you
3879 change files on a branch, those changes do not appear
3880 on the main trunk or other branches.
3881
3882 Later you can move changes from one branch to another
3883 branch (or the main trunk) by @dfn{merging}.  Merging
3884 involves first running @code{cvs update -j}, to merge
3885 the changes into the working directory.
3886 You can then commit that revision, and thus effectively
3887 copy the changes onto another branch.
3888
3889 @menu
3890 * Branches motivation::         What branches are good for
3891 * Creating a branch::           Creating a branch
3892 * Accessing branches::          Checking out and updating branches
3893 * Branches and revisions::      Branches are reflected in revision numbers
3894 * Magic branch numbers::        Magic branch numbers
3895 * Merging a branch::            Merging an entire branch
3896 * Merging more than once::      Merging from a branch several times
3897 * Merging two revisions::       Merging differences between two revisions
3898 * Merging adds and removals::   What if files are added or removed?
3899 * Merging and keywords::        Avoiding conflicts due to keyword substitution
3900 @end menu
3901
3902 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3903 @node Branches motivation
3904 @section What branches are good for
3905 @cindex Branches motivation
3906 @cindex What branches are good for
3907 @cindex Motivation for branches
3908
3909 @c FIXME: this node mentions one way to use branches,
3910 @c but it is by no means the only way.  For example,
3911 @c the technique of committing a new feature on a branch,
3912 @c until it is ready for the main trunk.  The whole
3913 @c thing is generally speaking more akin to the
3914 @c "Revision management" node although it isn't clear to
3915 @c me whether policy matters should be centralized or
3916 @c distributed throughout the relevant sections.
3917 Suppose that release 1.0 of tc has been made.  You are continuing to
3918 develop tc, planning to create release 1.1 in a couple of months.  After a
3919 while your customers start to complain about a fatal bug.  You check
3920 out release 1.0 (@pxref{Tags}) and find the bug
3921 (which turns out to have a trivial fix).  However, the current revision
3922 of the sources are in a state of flux and are not expected to be stable
3923 for at least another month.  There is no way to make a
3924 bug fix release based on the newest sources.
3925
3926 The thing to do in a situation like this is to create a @dfn{branch} on
3927 the revision trees for all the files that make up
3928 release 1.0 of tc.  You can then make
3929 modifications to the branch without disturbing the main trunk.  When the
3930 modifications are finished you can elect to either incorporate them on
3931 the main trunk, or leave them on the branch.
3932
3933 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3934 @node Creating a branch
3935 @section Creating a branch
3936 @cindex Creating a branch
3937 @cindex Branch, creating a
3938 @cindex tag, creating a branch using
3939 @cindex rtag, creating a branch using
3940
3941 You can create a branch with @code{tag -b}; for
3942 example, assuming you're in a working copy:
3943
3944 @example
3945 $ cvs tag -b rel-1-0-patches
3946 @end example
3947
3948 @c FIXME: we should be more explicit about the value of
3949 @c having a tag on the branchpoint.  For example
3950 @c "cvs tag rel-1-0-patches-branchpoint" before
3951 @c the "cvs tag -b".  This points out that
3952 @c rel-1-0-patches is a pretty awkward name for
3953 @c this example (more so than for the rtag example
3954 @c below).
3955
3956 This splits off a branch based on the current revisions
3957 in the working copy, assigning that branch the name
3958 @samp{rel-1-0-patches}.
3959
3960 It is important to understand that branches get created
3961 in the repository, not in the working copy.  Creating a
3962 branch based on current revisions, as the above example
3963 does, will @emph{not} automatically switch the working
3964 copy to be on the new branch.  For information on how
3965 to do that, see @ref{Accessing branches}.
3966
3967 You can also create a branch without reference to any
3968 working copy, by using @code{rtag}:
3969
3970 @example
3971 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
3972 @end example
3973
3974 @samp{-r rel-1-0} says that this branch should be
3975 rooted at the revision that
3976 corresponds to the tag @samp{rel-1-0}.  It need not
3977 be the most recent revision -- it's often useful to
3978 split a branch off an old revision (for example, when
3979 fixing a bug in a past release otherwise known to be
3980 stable).
3981
3982 As with @samp{tag}, the @samp{-b} flag tells
3983 @code{rtag} to create a branch (rather than just a
3984 symbolic revision name).  Note that the numeric
3985 revision number that matches @samp{rel-1-0} will
3986 probably be different from file to file.
3987
3988 So, the full effect of the command is to create a new
3989 branch -- named @samp{rel-1-0-patches} -- in module
3990 @samp{tc}, rooted in the revision tree at the point tagged
3991 by @samp{rel-1-0}.
3992
3993 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3994 @node Accessing branches
3995 @section Accessing branches
3996 @cindex Check out a branch
3997 @cindex Retrieve a branch
3998 @cindex Access a branch
3999 @cindex Identifying a branch
4000 @cindex Branch, check out
4001 @cindex Branch, retrieving
4002 @cindex Branch, accessing
4003 @cindex Branch, identifying
4004
4005 You can retrieve a branch in one of two ways: by
4006 checking it out fresh from the repository, or by
4007 switching an existing working copy over to the branch.
4008
4009 To check out a branch from the repository, invoke
4010 @samp{checkout} with the @samp{-r} flag, followed by
4011 the tag name of the branch (@pxref{Creating a branch}):
4012
4013 @example
4014 $ cvs checkout -r rel-1-0-patches tc
4015 @end example
4016
4017 Or, if you already have a working copy, you can switch
4018 it to a given branch with @samp{update -r}:
4019
4020 @example
4021 $ cvs update -r rel-1-0-patches tc
4022 @end example
4023
4024 @noindent
4025 or equivalently:
4026
4027 @example
4028 $ cd tc
4029 $ cvs update -r rel-1-0-patches
4030 @end example
4031
4032 It does not matter if the working copy was originally
4033 on the main trunk or on some other branch -- the above
4034 command will switch it to the named branch.  And
4035 similarly to a regular @samp{update} command,
4036 @samp{update -r} merges any changes you have made,
4037 notifying you of conflicts where they occur.
4038
4039 Once you have a working copy tied to a particular
4040 branch, it remains there until you tell it otherwise.
4041 This means that changes checked in from the working
4042 copy will add new revisions on that branch, while
4043 leaving the main trunk and other branches unaffected.
4044
4045 @cindex Branches, sticky
4046 To find out what branch a working copy is on, you can
4047 use the @samp{status} command.  In its output, look for
4048 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4049 -- that's @sc{cvs}'s way of telling you the branch, if
4050 any, of the current working files:
4051
4052 @example
4053 $ cvs status -v driver.c backend.c
4054 ===================================================================
4055 File: driver.c          Status: Up-to-date
4056
4057     Version:            1.7     Sat Dec  5 18:25:54 1992
4058     RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4059     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4060     Sticky Date:        (none)
4061     Sticky Options:     (none)
4062
4063     Existing Tags:
4064         rel-1-0-patches             (branch: 1.7.2)
4065         rel-1-0                     (revision: 1.7)
4066
4067 ===================================================================
4068 File: backend.c         Status: Up-to-date
4069
4070     Version:            1.4     Tue Dec  1 14:39:01 1992
4071     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4072     Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4073     Sticky Date:        (none)
4074     Sticky Options:     (none)
4075
4076     Existing Tags:
4077         rel-1-0-patches             (branch: 1.4.2)
4078         rel-1-0                     (revision: 1.4)
4079         rel-0-4                     (revision: 1.4)
4080
4081 @end example
4082
4083 Don't be confused by the fact that the branch numbers
4084 for each file are different (@samp{1.7.2} and
4085 @samp{1.4.2} respectively).  The branch tag is the
4086 same, @samp{rel-1-0-patches}, and the files are
4087 indeed on the same branch.  The numbers simply reflect
4088 the point in each file's revision history at which the
4089 branch was made.  In the above example, one can deduce
4090 that @samp{driver.c} had been through more changes than
4091 @samp{backend.c} before this branch was created.
4092
4093 See @ref{Branches and revisions} for details about how
4094 branch numbers are constructed.
4095
4096 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4097 @node Branches and revisions
4098 @section Branches and revisions
4099 @cindex Branch number
4100 @cindex Number, branch
4101 @cindex Revision numbers (branches)
4102
4103 Ordinarily, a file's revision history is a linear
4104 series of increments (@pxref{Revision numbers}):
4105
4106 @example
4107        +-----+    +-----+    +-----+    +-----+    +-----+
4108        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4109        +-----+    +-----+    +-----+    +-----+    +-----+
4110 @end example
4111
4112 However, @sc{cvs} is not limited to linear development.  The
4113 @dfn{revision tree} can be split into @dfn{branches},
4114 where each branch is a self-maintained line of
4115 development.  Changes made on one branch can easily be
4116 moved back to the main trunk.
4117
4118 Each branch has a @dfn{branch number}, consisting of an
4119 odd number of period-separated decimal integers.  The
4120 branch number is created by appending an integer to the
4121 revision number where the corresponding branch forked
4122 off.  Having branch numbers allows more than one branch
4123 to be forked off from a certain revision.
4124
4125 @need 3500
4126 All revisions on a branch have revision numbers formed
4127 by appending an ordinal number to the branch number.
4128 The following figure illustrates branching with an
4129 example.
4130
4131 @example
4132 @c This example used to have a 1.2.2.4 revision, which
4133 @c might help clarify that development can continue on
4134 @c 1.2.2.  Might be worth reinstating if it can be done
4135 @c without overfull hboxes.
4136 @group
4137                                                       +-------------+
4138                            Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4139                                                     / +-------------+
4140                                                    /
4141                                                   /
4142                  +---------+    +---------+    +---------+
4143 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4144                / +---------+    +---------+    +---------+
4145               /
4146              /
4147 +-----+    +-----+    +-----+    +-----+    +-----+
4148 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4149 +-----+    +-----+    +-----+    +-----+    +-----+
4150                 !
4151                 !
4152                 !   +---------+    +---------+    +---------+
4153 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4154                     +---------+    +---------+    +---------+
4155
4156 @end group
4157 @end example
4158
4159 @c --   However, at least for me the figure is not enough.  I suggest more
4160 @c --   text to accompany it.  "A picture is worth a thousand words", so you
4161 @c --   have to make sure the reader notices the couple of hundred words
4162 @c --   *you* had in mind more than the others!
4163
4164 @c --   Why an even number of segments?  This section implies that this is
4165 @c --   how the main trunk is distinguished from branch roots, but you never
4166 @c --   explicitly say that this is the purpose of the [by itself rather
4167 @c --   surprising] restriction to an even number of segments.
4168
4169 The exact details of how the branch number is
4170 constructed is not something you normally need to be
4171 concerned about, but here is how it works: When
4172 @sc{cvs} creates a branch number it picks the first
4173 unused even integer, starting with 2.  So when you want
4174 to create a branch from revision 6.4 it will be
4175 numbered 6.4.2.  All branch numbers ending in a zero
4176 (such as 6.4.0) are used internally by @sc{cvs}
4177 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4178 special meaning.  @xref{Tracking sources}.
4179
4180 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4181 @node Magic branch numbers
4182 @section Magic branch numbers
4183
4184 @c Want xref to here from "log"?
4185
4186 This section describes a @sc{cvs} feature called
4187 @dfn{magic branches}.  For most purposes, you need not
4188 worry about magic branches; @sc{cvs} handles them for
4189 you.  However, they are visible to you in certain
4190 circumstances, so it may be useful to have some idea of
4191 how it works.
4192
4193 Externally, branch numbers consist of an odd number of
4194 dot-separated decimal integers.  @xref{Revision
4195 numbers}.  That is not the whole truth, however.  For
4196 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4197 in the second rightmost position (1.2.4 becomes
4198 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4199 on).
4200
4201 @sc{cvs} does a pretty good job at hiding these so
4202 called magic branches, but in a few places the hiding
4203 is incomplete:
4204
4205 @itemize @bullet
4206 @ignore
4207 @c This is in ignore as I'm taking their word for it,
4208 @c that this was fixed
4209 @c a long time ago.  But before deleting this
4210 @c entirely, I'd rather verify it (and add a test
4211 @c case to the testsuite).
4212 @item
4213 The magic branch can appear in the output from
4214 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4215 fixed in @sc{cvs} 1.3-s2.
4216
4217 @end ignore
4218 @item
4219 The magic branch number appears in the output from
4220 @code{cvs log}.
4221 @c What output should appear instead?
4222
4223 @item
4224 You cannot specify a symbolic branch name to @code{cvs
4225 admin}.
4226
4227 @end itemize
4228
4229 @c Can CVS do this automatically the first time
4230 @c you check something in to that branch?  Should
4231 @c it?
4232 You can use the @code{admin} command to reassign a
4233 symbolic name to a branch the way @sc{rcs} expects it
4234 to be.  If @code{R4patches} is assigned to the branch
4235 1.4.2 (magic branch number 1.4.0.2) in file
4236 @file{numbers.c} you can do this:
4237
4238 @example
4239 $ cvs admin -NR4patches:1.4.2 numbers.c
4240 @end example
4241
4242 It only works if at least one revision is already
4243 committed on the branch.  Be very careful so that you
4244 do not assign the tag to the wrong number.  (There is
4245 no way to see how the tag was assigned yesterday).
4246
4247 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4248 @node Merging a branch
4249 @section Merging an entire branch
4250 @cindex Merging a branch
4251 @cindex -j (merging branches)
4252
4253 You can merge changes made on a branch into your working copy by giving
4254 the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4255 @samp{-j @var{branchname}} option it merges the changes made between the
4256 greatest common ancestor (GCA) of the branch and the destination revision (in
4257 the simple case below the GCA is the point where the branch forked) and the
4258 newest revision on that branch into your working copy.
4259
4260 @cindex Join
4261 The @samp{-j} stands for ``join''.
4262
4263 @cindex Branch merge example
4264 @cindex Example, branch merge
4265 @cindex Merge, branch example
4266 Consider this revision tree:
4267
4268 @example
4269 +-----+    +-----+    +-----+    +-----+
4270 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4271 +-----+    +-----+    +-----+    +-----+
4272                 !
4273                 !
4274                 !   +---------+    +---------+
4275 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4276                     +---------+    +---------+
4277 @end example
4278
4279 @noindent
4280 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4281 following example assumes that the module @samp{mod} contains only one
4282 file, @file{m.c}.
4283
4284 @example
4285 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4286
4287 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4288                                  # @r{i.e. the changes between revision 1.2}
4289                                  # @r{and 1.2.2.2, into your working copy}
4290                                  # @r{of the file.}
4291
4292 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4293 @end example
4294
4295 A conflict can result from a merge operation.  If that
4296 happens, you should resolve it before committing the
4297 new revision.  @xref{Conflicts example}.
4298
4299 If your source files contain keywords (@pxref{Keyword substitution}),
4300 you might be getting more conflicts than strictly necessary.  See
4301 @ref{Merging and keywords}, for information on how to avoid this.
4302
4303 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4304 same effect as above could be achieved with this:
4305
4306 @example
4307 $ cvs checkout -j R1fix mod
4308 $ cvs commit -m "Included R1fix"
4309 @end example
4310
4311 It should be noted that @code{update -j @var{tagname}} will also work but may
4312 not produce the desired result.  @xref{Merging adds and removals}, for more.
4313
4314 @node Merging more than once
4315 @section Merging from a branch several times
4316
4317 Continuing our example, the revision tree now looks
4318 like this:
4319
4320 @example
4321 +-----+    +-----+    +-----+    +-----+    +-----+
4322 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4323 +-----+    +-----+    +-----+    +-----+    +-----+
4324                 !                           *
4325                 !                          *
4326                 !   +---------+    +---------+
4327 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4328                     +---------+    +---------+
4329 @end example
4330
4331 @noindent
4332 where the starred line represents the merge from the
4333 @samp{R1fix} branch to the main trunk, as just
4334 discussed.
4335
4336 Now suppose that development continues on the
4337 @samp{R1fix} branch:
4338
4339 @example
4340 +-----+    +-----+    +-----+    +-----+    +-----+
4341 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4342 +-----+    +-----+    +-----+    +-----+    +-----+
4343                 !                           *
4344                 !                          *
4345                 !   +---------+    +---------+    +---------+
4346 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4347                     +---------+    +---------+    +---------+
4348 @end example
4349
4350 @noindent
4351 and then you want to merge those new changes onto the
4352 main trunk.  If you just use the @code{cvs update -j
4353 R1fix m.c} command again, @sc{cvs} will attempt to
4354 merge again the changes which you have already merged,
4355 which can have undesirable side effects.
4356
4357 So instead you need to specify that you only want to
4358 merge the changes on the branch which have not yet been
4359 merged into the trunk.  To do that you specify two
4360 @samp{-j} options, and @sc{cvs} merges the changes from
4361 the first revision to the second revision.  For
4362 example, in this case the simplest way would be
4363
4364 @example
4365 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4366                                       # @r{head of the R1fix branch}
4367 @end example
4368
4369 The problem with this is that you need to specify the
4370 1.2.2.2 revision manually.  A slightly better approach
4371 might be to use the date the last merge was done:
4372
4373 @example
4374 cvs update -j R1fix:yesterday -j R1fix m.c
4375 @end example
4376
4377 Better yet, tag the R1fix branch after every merge into
4378 the trunk, and then use that tag for subsequent merges:
4379
4380 @example
4381 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4382 @end example
4383
4384 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4385 @node Merging two revisions
4386 @section Merging differences between any two revisions
4387 @cindex Merging two revisions
4388 @cindex Revisions, merging differences between
4389 @cindex Differences, merging
4390
4391 With two @samp{-j @var{revision}} flags, the @code{update}
4392 (and @code{checkout}) command can merge the differences
4393 between any two revisions into your working file.
4394
4395 @cindex Undoing a change
4396 @cindex Removing a change
4397 @example
4398 $ cvs update -j 1.5 -j 1.3 backend.c
4399 @end example
4400
4401 @noindent
4402 will undo all changes made between revision
4403 1.3 and 1.5.  Note the order of the revisions!
4404
4405 If you try to use this option when operating on
4406 multiple files, remember that the numeric revisions will
4407 probably be very different between the various files.
4408 You almost always use symbolic
4409 tags rather than revision numbers when operating on
4410 multiple files.
4411
4412 @cindex Restoring old version of removed file
4413 @cindex Resurrecting old version of dead file
4414 Specifying two @samp{-j} options can also undo file
4415 removals or additions.  For example, suppose you have
4416 a file
4417 named @file{file1} which existed as revision 1.1, and
4418 you then removed it (thus adding a dead revision 1.2).
4419 Now suppose you want to add it again, with the same
4420 contents it had previously.  Here is how to do it:
4421
4422 @example
4423 $ cvs update -j 1.2 -j 1.1 file1
4424 U file1
4425 $ cvs commit -m test
4426 Checking in file1;
4427 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4428 new revision: 1.3; previous revision: 1.2
4429 done
4430 $
4431 @end example
4432
4433 @node Merging adds and removals
4434 @section Merging can add or remove files
4435
4436 If the changes which you are merging involve removing
4437 or adding some files, @code{update -j} will reflect
4438 such additions or removals.
4439
4440 @c FIXME: This example needs a lot more explanation.
4441 @c We also need other examples for some of the other
4442 @c cases (not all--there are too many--as long as we present a
4443 @c coherent general principle).
4444 For example:
4445 @example
4446 cvs update -A
4447 touch a b c
4448 cvs add a b c ; cvs ci -m "added" a b c
4449 cvs tag -b branchtag
4450 cvs update -r branchtag
4451 touch d ; cvs add d
4452 rm a ; cvs rm a
4453 cvs ci -m "added d, removed a"
4454 cvs update -A
4455 cvs update -jbranchtag
4456 @end example
4457
4458 After these commands are executed and a @samp{cvs commit} is done,
4459 file @file{a} will be removed and file @file{d} added in the main branch.
4460 @c (which was determined by trying it)
4461
4462 Note that using a single static tag (@samp{-j @var{tagname}})
4463 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4464 changes from a branch will usually not remove files which were removed on the
4465 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4466 The exception to this rule occurs when
4467 a static tag has been attached to a dead revision manually.  Use the branch tag
4468 to merge all changes from the branch or use two static tags as merge endpoints
4469 to be sure that all intended changes are propagated in the merge.
4470
4471 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4472 @node Merging and keywords
4473 @section Merging and keywords
4474 @cindex Merging, and keyword substitution
4475 @cindex Keyword substitution, and merging
4476 @cindex -j (merging branches), and keyword substitution
4477 @cindex -kk, to avoid conflicts during a merge
4478
4479 If you merge files containing keywords (@pxref{Keyword
4480 substitution}), you will normally get numerous
4481 conflicts during the merge, because the keywords are
4482 expanded differently in the revisions which you are
4483 merging.
4484
4485 Therefore, you will often want to specify the
4486 @samp{-kk} (@pxref{Substitution modes}) switch to the
4487 merge command line.  By substituting just the name of
4488 the keyword, not the expanded value of that keyword,
4489 this option ensures that the revisions which you are
4490 merging will be the same as each other, and avoid
4491 spurious conflicts.
4492
4493 For example, suppose you have a file like this:
4494
4495 @example
4496        +---------+
4497       _! 1.1.2.1 !   <-  br1
4498      / +---------+
4499     /
4500    /
4501 +-----+    +-----+
4502 ! 1.1 !----! 1.2 !
4503 +-----+    +-----+
4504 @end example
4505
4506 @noindent
4507 and your working directory is currently on the trunk
4508 (revision 1.2).  Then you might get the following
4509 results from a merge:
4510
4511 @example
4512 $ cat file1
4513 key $@splitrcskeyword{Revision}: 1.2 $
4514 . . .
4515 $ cvs update -j br1
4516 U file1
4517 RCS file: /cvsroot/first-dir/file1,v
4518 retrieving revision 1.1
4519 retrieving revision 1.1.2.1
4520 Merging differences between 1.1 and 1.1.2.1 into file1
4521 rcsmerge: warning: conflicts during merge
4522 $ cat file1
4523 @asis{}<<<<<<< file1
4524 key $@splitrcskeyword{Revision}: 1.2 $
4525 @asis{}=======
4526 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4527 @asis{}>>>>>>> 1.1.2.1
4528 . . .
4529 @end example
4530
4531 What happened was that the merge tried to merge the
4532 differences between 1.1 and 1.1.2.1 into your working
4533 directory.  So, since the keyword changed from
4534 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4535 @sc{cvs} tried to merge that change into your working
4536 directory, which conflicted with the fact that your
4537 working directory had contained @code{Revision: 1.2}.
4538
4539 Here is what happens if you had used @samp{-kk}:
4540
4541 @example
4542 $ cat file1
4543 key $@splitrcskeyword{Revision}: 1.2 $
4544 . . .
4545 $ cvs update -kk -j br1
4546 U file1
4547 RCS file: /cvsroot/first-dir/file1,v
4548 retrieving revision 1.1
4549 retrieving revision 1.1.2.1
4550 Merging differences between 1.1 and 1.1.2.1 into file1
4551 $ cat file1
4552 key $@splitrcskeyword{Revision}$
4553 . . .
4554 @end example
4555
4556 What is going on here is that revision 1.1 and 1.1.2.1
4557 both expand as plain @code{Revision}, and therefore
4558 merging the changes between them into the working
4559 directory need not change anything.  Therefore, there
4560 is no conflict.
4561
4562 There is, however, one major caveat with using
4563 @samp{-kk} on merges.  Namely, it overrides whatever
4564 keyword expansion mode @sc{cvs} would normally have
4565 used.  In particular, this is a problem if the mode had
4566 been @samp{-kb} for a binary file.  Therefore, if your
4567 repository contains binary files, you will need to deal
4568 with the conflicts rather than using @samp{-kk}.
4569
4570 @ignore
4571 The following seems rather confusing, possibly buggy,
4572 and in general, in need of much more thought before it
4573 is a recommended technique.  For one thing, does it
4574 apply on Windows as well as on Unix?
4575
4576 Unchanged binary files will undergo the same keyword substitution
4577 but will not be checked in on a subsequent
4578 @code{cvs commit}.  Be aware that binary files containing keyword
4579 strings which are present in or below the working directory
4580 will most likely remain corrupt until repaired, however.  A simple 
4581 @code{cvs update -A} is sufficient to fix these otherwise unaltered binary files
4582 if the merge is being done to the main branch but
4583 this must be done after the merge has been committed or the merge itself
4584 will be lost.
4585
4586 For Example:
4587 @example
4588 cvs update -Akk -jbranchtag
4589 cvs commit
4590 cvs update -A
4591 @end example
4592
4593 @noindent
4594 will update the current directory from the main trunk of the
4595 repository, substituting the base keyword strings for keywords,
4596 and merge changes made on the branch @samp{branchtag} into the new
4597 work files, performing the same keyword substitution on that file set before
4598 comparing the two sets.  The final @code{cvs update -A} will restore any
4599 corrupted binary files as well as resetting the sticky @samp{-kk} tags which
4600 were present on the files in and below the working directory.
4601 Unfortunately, this doesn't work as well with an arbitrary branch tag, as the
4602 @samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk}
4603 switches attached to the working files as @samp{-A} does.  The workaround
4604 for this is to release the working directory after the merge has been
4605 committed and check it out again.
4606 @end ignore
4607
4608 @c ---------------------------------------------------------------------
4609 @node Recursive behavior
4610 @chapter Recursive behavior
4611 @cindex Recursive (directory descending)
4612 @cindex Directory, descending
4613 @cindex Descending directories
4614 @cindex Subdirectories
4615
4616 Almost all of the subcommands of @sc{cvs} work
4617 recursively when you specify a directory as an
4618 argument.  For instance, consider this directory
4619 structure:
4620
4621 @example
4622       @code{$HOME}
4623         |
4624         +--@t{tc}
4625         |   |
4626             +--@t{CVS}
4627             |      (internal @sc{cvs} files)
4628             +--@t{Makefile}
4629             +--@t{backend.c}
4630             +--@t{driver.c}
4631             +--@t{frontend.c}
4632             +--@t{parser.c}
4633             +--@t{man}
4634             |    |
4635             |    +--@t{CVS}
4636             |    |  (internal @sc{cvs} files)
4637             |    +--@t{tc.1}
4638             |
4639             +--@t{testing}
4640                  |
4641                  +--@t{CVS}
4642                  |  (internal @sc{cvs} files)
4643                  +--@t{testpgm.t}
4644                  +--@t{test2.t}
4645 @end example
4646
4647 @noindent
4648 If @file{tc} is the current working directory, the
4649 following is true:
4650
4651 @itemize @bullet
4652 @item
4653 @samp{cvs update testing} is equivalent to
4654
4655 @example
4656 cvs update testing/testpgm.t testing/test2.t
4657 @end example
4658
4659 @item
4660 @samp{cvs update testing man} updates all files in the
4661 subdirectories
4662
4663 @item
4664 @samp{cvs update .} or just @samp{cvs update} updates
4665 all files in the @code{tc} directory
4666 @end itemize
4667
4668 If no arguments are given to @code{update} it will
4669 update all files in the current working directory and
4670 all its subdirectories.  In other words, @file{.} is a
4671 default argument to @code{update}.  This is also true
4672 for most of the @sc{cvs} subcommands, not only the
4673 @code{update} command.
4674
4675 The recursive behavior of the @sc{cvs} subcommands can be
4676 turned off with the @samp{-l} option.
4677 Conversely, the @samp{-R} option can be used to force recursion if
4678 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4679
4680 @example
4681 $ cvs update -l         # @r{Don't update files in subdirectories}
4682 @end example
4683
4684 @c ---------------------------------------------------------------------
4685 @node Adding and removing
4686 @chapter Adding, removing, and renaming files and directories
4687
4688 In the course of a project, one will often add new
4689 files.  Likewise with removing or renaming, or with
4690 directories.  The general concept to keep in mind in
4691 all these cases is that instead of making an
4692 irreversible change you want @sc{cvs} to record the
4693 fact that a change has taken place, just as with
4694 modifying an existing file.  The exact mechanisms to do
4695 this in @sc{cvs} vary depending on the situation.
4696
4697 @menu
4698 * Adding files::                Adding files
4699 * Removing files::              Removing files
4700 * Removing directories::        Removing directories
4701 * Moving files::                Moving and renaming files
4702 * Moving directories::          Moving and renaming directories
4703 @end menu
4704
4705 @node Adding files
4706 @section Adding files to a directory
4707 @cindex Adding files
4708
4709 To add a new file to a directory, follow these steps.
4710
4711 @itemize @bullet
4712 @item
4713 You must have a working copy of the directory.
4714 @xref{Getting the source}.
4715
4716 @item
4717 Create the new file inside your working copy of the directory.
4718
4719 @item
4720 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
4721 want to version control the file.  If the file contains
4722 binary data, specify @samp{-kb} (@pxref{Binary files}).
4723
4724 @item
4725 Use @samp{cvs commit @var{filename}} to actually check
4726 in the file into the repository.  Other developers
4727 cannot see the file until you perform this step.
4728 @end itemize
4729
4730 You can also use the @code{add} command to add a new
4731 directory.
4732 @c FIXCVS and/or FIXME: Adding a directory doesn't
4733 @c require the commit step.  This probably can be
4734 @c considered a CVS bug, but it is possible we should
4735 @c warn people since this behavior probably won't be
4736 @c changing right away.
4737
4738 Unlike most other commands, the @code{add} command is
4739 not recursive.  You have to expcicitly name files and
4740 directories that you wish to add to the repository.
4741 However, each directory will need to be added
4742 separately before you will be able to add new files
4743 to those directories.
4744
4745 @example
4746 $ mkdir -p foo/bar
4747 $ cp ~/myfile foo/bar/myfile
4748 $ cvs add foo foo/bar
4749 $ cvs add foo/bar/myfile
4750 @end example
4751
4752 @cindex add (subcommand)
4753 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
4754
4755 Schedule @var{files} to be added to the repository.
4756 The files or directories specified with @code{add} must
4757 already exist in the current directory.  To add a whole
4758 new directory hierarchy to the source repository (for
4759 example, files received from a third-party vendor), use
4760 the @code{import} command instead.  @xref{import}.
4761
4762 The added files are not placed in the source repository
4763 until you use @code{commit} to make the change
4764 permanent.  Doing an @code{add} on a file that was
4765 removed with the @code{remove} command will undo the
4766 effect of the @code{remove}, unless a @code{commit}
4767 command intervened.  @xref{Removing files}, for an
4768 example.
4769
4770 The @samp{-k} option specifies the default way that
4771 this file will be checked out; for more information see
4772 @ref{Substitution modes}.
4773
4774 @c As noted in BUGS, -m is broken client/server (Nov
4775 @c 96).  Also see testsuite log2-* tests.
4776 The @samp{-m} option specifies a description for the
4777 file.  This description appears in the history log (if
4778 it is enabled, @pxref{history file}).  It will also be
4779 saved in the version history inside the repository when
4780 the file is committed.  The @code{log} command displays
4781 this description.  The description can be changed using
4782 @samp{admin -t}.  @xref{admin}.  If you omit the
4783 @samp{-m @var{description}} flag, an empty string will
4784 be used.  You will not be prompted for a description.
4785 @end deffn
4786
4787 For example, the following commands add the file
4788 @file{backend.c} to the repository:
4789
4790 @c This example used to specify
4791 @c     -m "Optimizer and code generation passes."
4792 @c to the cvs add command, but that doesn't work
4793 @c client/server (see log2 in sanity.sh).  Should fix CVS,
4794 @c but also seems strange to document things which
4795 @c don't work...
4796 @example
4797 $ cvs add backend.c
4798 $ cvs commit -m "Early version. Not yet compilable." backend.c
4799 @end example
4800
4801 When you add a file it is added only on the branch
4802 which you are working on (@pxref{Branching and merging}).  You can
4803 later merge the additions to another branch if you want
4804 (@pxref{Merging adds and removals}).
4805 @c Should we mention that earlier versions of CVS
4806 @c lacked this feature (1.3) or implemented it in a buggy
4807 @c way (well, 1.8 had many bugs in cvs update -j)?
4808 @c Should we mention the bug/limitation regarding a
4809 @c file being a regular file on one branch and a directory
4810 @c on another?
4811 @c FIXME: This needs an example, or several, here or
4812 @c elsewhere, for it to make much sense.
4813 @c Somewhere we need to discuss the aspects of death
4814 @c support which don't involve branching, I guess.
4815 @c Like the ability to re-create a release from a tag.
4816
4817 @c ---------------------------------------------------------------------
4818 @node Removing files
4819 @section Removing files
4820 @cindex Removing files
4821 @cindex Deleting files
4822
4823 @c FIXME: this node wants to be split into several
4824 @c smaller nodes.  Could make these children of
4825 @c "Adding and removing", probably (death support could
4826 @c be its own section, for example, as could the
4827 @c various bits about undoing mistakes in adding and
4828 @c removing).
4829 Directories change.  New files are added, and old files
4830 disappear.  Still, you want to be able to retrieve an
4831 exact copy of old releases.
4832
4833 Here is what you can do to remove a file,
4834 but remain able to retrieve old revisions:
4835
4836 @itemize @bullet
4837 @c FIXME: should probably be saying something about
4838 @c having a working directory in the first place.
4839 @item
4840 Make sure that you have not made any uncommitted
4841 modifications to the file.  @xref{Viewing differences},
4842 for one way to do that.  You can also use the
4843 @code{status} or @code{update} command.  If you remove
4844 the file without committing your changes, you will of
4845 course not be able to retrieve the file as it was
4846 immediately before you deleted it.
4847
4848 @item
4849 Remove the file from your working copy of the directory.
4850 You can for instance use @code{rm}.
4851
4852 @item
4853 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
4854 you really want to delete the file.
4855
4856 @item
4857 Use @samp{cvs commit @var{filename}} to actually
4858 perform the removal of the file from the repository.
4859 @end itemize
4860
4861 @c FIXME: Somehow this should be linked in with a more
4862 @c general discussion of death support.  I don't know
4863 @c whether we want to use the term "death support" or
4864 @c not (we can perhaps get by without it), but we do
4865 @c need to discuss the "dead" state in "cvs log" and
4866 @c related subjects.  The current discussion is
4867 @c scattered around, and not xref'd to each other.
4868 @c FIXME: I think this paragraph wants to be moved
4869 @c later down, at least after the first example.
4870 When you commit the removal of the file, @sc{cvs}
4871 records the fact that the file no longer exists.  It is
4872 possible for a file to exist on only some branches and
4873 not on others, or to re-add another file with the same
4874 name later.  @sc{cvs} will correctly create or not create
4875 the file, based on the @samp{-r} and @samp{-D} options
4876 specified to @code{checkout} or @code{update}.
4877
4878 @c FIXME: This style seems to clash with how we
4879 @c document things in general.
4880 @cindex Remove (subcommand)
4881 @deffn Command {cvs remove} [options] files @dots{}
4882
4883 Schedule file(s) to be removed from the repository
4884 (files which have not already been removed from the
4885 working directory are not processed).  This command
4886 does not actually remove the file from the repository
4887 until you commit the removal.  For a full list of
4888 options, see @ref{Invoking CVS}.
4889 @end deffn
4890
4891 Here is an example of removing several files:
4892
4893 @example
4894 $ cd test
4895 $ rm *.c
4896 $ cvs remove
4897 cvs remove: Removing .
4898 cvs remove: scheduling a.c for removal
4899 cvs remove: scheduling b.c for removal
4900 cvs remove: use 'cvs commit' to remove these files permanently
4901 $ cvs ci -m "Removed unneeded files"
4902 cvs commit: Examining .
4903 cvs commit: Committing .
4904 @end example
4905
4906 As a convenience you can remove the file and @code{cvs
4907 remove} it in one step, by specifying the @samp{-f}
4908 option.  For example, the above example could also be
4909 done like this:
4910
4911 @example
4912 $ cd test
4913 $ cvs remove -f *.c
4914 cvs remove: scheduling a.c for removal
4915 cvs remove: scheduling b.c for removal
4916 cvs remove: use 'cvs commit' to remove these files permanently
4917 $ cvs ci -m "Removed unneeded files"
4918 cvs commit: Examining .
4919 cvs commit: Committing .
4920 @end example
4921
4922 If you execute @code{remove} for a file, and then
4923 change your mind before you commit, you can undo the
4924 @code{remove} with an @code{add} command.
4925 @ignore
4926 @c is this worth saying or not?  Somehow it seems
4927 @c confusing to me.
4928 Of course,
4929 since you have removed your copy of file in the working
4930 directory, @sc{cvs} does not necessarily bring back the
4931 contents of the file from right before you executed
4932 @code{remove}; instead it gets the file from the
4933 repository again.
4934 @end ignore
4935
4936 @c FIXME: what if you change your mind after you commit
4937 @c it?  (answer is also "cvs add" but we don't say that...).
4938 @c We need some index entries for thinks like "undoing
4939 @c removal" too.
4940
4941 @example
4942 $ ls
4943 CVS   ja.h  oj.c
4944 $ rm oj.c
4945 $ cvs remove oj.c
4946 cvs remove: scheduling oj.c for removal
4947 cvs remove: use 'cvs commit' to remove this file permanently
4948 $ cvs add oj.c
4949 U oj.c
4950 cvs add: oj.c, version 1.1.1.1, resurrected
4951 @end example
4952
4953 If you realize your mistake before you run the
4954 @code{remove} command you can use @code{update} to
4955 resurrect the file:
4956
4957 @example
4958 $ rm oj.c
4959 $ cvs update oj.c
4960 cvs update: warning: oj.c was lost
4961 U oj.c
4962 @end example
4963
4964 When you remove a file it is removed only on the branch
4965 which you are working on (@pxref{Branching and merging}).  You can
4966 later merge the removals to another branch if you want
4967 (@pxref{Merging adds and removals}).
4968
4969 @node Removing directories
4970 @section Removing directories
4971 @cindex Removing directories
4972 @cindex Directories, removing
4973
4974 In concept removing directories is somewhat similar to
4975 removing files---you want the directory to not exist in
4976 your current working directories, but you also want to
4977 be able to retrieve old releases in which the directory
4978 existed.
4979
4980 The way that you remove a directory is to remove all
4981 the files in it.  You don't remove the directory
4982 itself; there is no way to do that.
4983 Instead you specify the @samp{-P} option to
4984 @code{cvs update} or @code{cvs checkout},
4985 which will cause @sc{cvs} to remove empty
4986 directories from working directories.
4987 (Note that @code{cvs export} always removes empty directories.)
4988 Probably the
4989 best way to do this is to always specify @samp{-P}; if
4990 you want an empty directory then put a dummy file (for
4991 example @file{.keepme}) in it to prevent @samp{-P} from
4992 removing it.
4993
4994 @c I'd try to give a rationale for this, but I'm not
4995 @c sure there is a particularly convincing one.  What
4996 @c we would _like_ is for CVS to do a better job of version
4997 @c controlling whether directories exist, to eliminate the
4998 @c need for -P and so that a file can be a directory in
4999 @c one revision and a regular file in another.
5000 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5001 options of @code{checkout}.  This way
5002 @sc{cvs} will be able to correctly create the directory
5003 or not depending on whether the particular version you
5004 are checking out contains any files in that directory.
5005
5006 @c ---------------------------------------------------------------------
5007 @node Moving files
5008 @section Moving and renaming files
5009 @cindex Moving files
5010 @cindex Renaming files
5011 @cindex Files, moving
5012
5013 Moving files to a different directory or renaming them
5014 is not difficult, but some of the ways in which this
5015 works may be non-obvious.  (Moving or renaming a
5016 directory is even harder.  @xref{Moving directories}.).
5017
5018 The examples below assume that the file @var{old} is renamed to
5019 @var{new}.
5020
5021 @menu
5022 * Outside::                     The normal way to Rename
5023 * Inside::                      A tricky, alternative way
5024 * Rename by copying::           Another tricky, alternative way
5025 @end menu
5026
5027 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5028 @node Outside
5029 @subsection The Normal way to Rename
5030
5031 @c More rename issues.  Not sure whether these are
5032 @c worth documenting; I'm putting them here because
5033 @c it seems to be as good a place as any to try to
5034 @c set down the issues.
5035 @c * "cvs annotate" will annotate either the new
5036 @c file or the old file; it cannot annotate _each
5037 @c line_ based on whether it was last changed in the
5038 @c new or old file.  Unlike "cvs log", where the
5039 @c consequences of having to select either the new
5040 @c or old name seem fairly benign, this may be a
5041 @c real advantage to having CVS know about renames
5042 @c other than as a deletion and an addition.
5043
5044 The normal way to move a file is to copy @var{old} to
5045 @var{new}, and then issue the normal @sc{cvs} commands
5046 to remove @var{old} from the repository, and add
5047 @var{new} to it.
5048 @c The following sentence is not true: one must cd into
5049 @c the directory to run "cvs add".
5050 @c  (Both @var{old} and @var{new} could
5051 @c contain relative paths, for example @file{foo/bar.c}).
5052
5053 @example
5054 $ mv @var{old} @var{new}
5055 $ cvs remove @var{old}
5056 $ cvs add @var{new}
5057 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5058 @end example
5059
5060 This is the simplest way to move a file, it is not
5061 error-prone, and it preserves the history of what was
5062 done.  Note that to access the history of the file you
5063 must specify the old or the new name, depending on what
5064 portion of the history you are accessing.  For example,
5065 @code{cvs log @var{old}} will give the log up until the
5066 time of the rename.
5067
5068 When @var{new} is committed its revision numbers will
5069 start again, usually at 1.1, so if that bothers you,
5070 use the @samp{-r rev} option to commit.  For more
5071 information see @ref{Assigning revisions}.
5072
5073 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5074 @node Inside
5075 @subsection Moving the history file
5076
5077 This method is more dangerous, since it involves moving
5078 files inside the repository.  Read this entire section
5079 before trying it out!
5080
5081 @example
5082 $ cd $CVSROOT/@var{dir}
5083 $ mv @var{old},v @var{new},v
5084 @end example
5085
5086 @noindent
5087 Advantages:
5088
5089 @itemize @bullet
5090 @item
5091 The log of changes is maintained intact.
5092
5093 @item
5094 The revision numbers are not affected.
5095 @end itemize
5096
5097 @noindent
5098 Disadvantages:
5099
5100 @itemize @bullet
5101 @item
5102 Old releases cannot easily be fetched from the
5103 repository.  (The file will show up as @var{new} even
5104 in revisions from the time before it was renamed).
5105
5106 @item
5107 There is no log information of when the file was renamed.
5108
5109 @item
5110 Nasty things might happen if someone accesses the history file
5111 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5112 commands while you move it.
5113 @end itemize
5114
5115 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5116 @node Rename by copying
5117 @subsection Copying the history file
5118
5119 This way also involves direct modifications to the
5120 repository.  It is safe, but not without drawbacks.
5121
5122 @example
5123 # @r{Copy the @sc{rcs} file inside the repository}
5124 $ cd $CVSROOT/@var{dir}
5125 $ cp @var{old},v @var{new},v
5126 # @r{Remove the old file}
5127 $ cd ~/@var{dir}
5128 $ rm @var{old}
5129 $ cvs remove @var{old}
5130 $ cvs commit @var{old}
5131 # @r{Remove all tags from @var{new}}
5132 $ cvs update @var{new}
5133 $ cvs log @var{new}             # @r{Remember the non-branch tag names}
5134 $ cvs tag -d @var{tag1} @var{new}
5135 $ cvs tag -d @var{tag2} @var{new}
5136 @dots{}
5137 @end example
5138
5139 By removing the tags you will be able to check out old
5140 revisions.
5141
5142 @noindent
5143 Advantages:
5144
5145 @itemize @bullet
5146 @item
5147 @c FIXME: Is this true about -D now that we have death
5148 @c support?  See 5B.3 in the FAQ.
5149 Checking out old revisions works correctly, as long as
5150 you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
5151 to retrieve the revisions.
5152
5153 @item
5154 The log of changes is maintained intact.
5155
5156 @item
5157 The revision numbers are not affected.
5158 @end itemize
5159
5160 @noindent
5161 Disadvantages:
5162
5163 @itemize @bullet
5164 @item
5165 You cannot easily see the history of the file across the rename.
5166
5167 @ignore
5168 @c Is this true?  I don't see how the revision numbers
5169 @c _could_ start over, when new,v is just old,v with
5170 @c the tags deleted.
5171 @c If there is some need to reinstate this text,
5172 @c it is "usually 1.1", not "1.0" and it needs an
5173 @c xref to Assigning revisions
5174 @item
5175 Unless you use the @samp{-r rev} (@pxref{commit
5176 options}) flag when @var{new} is committed its revision
5177 numbers will start at 1.0 again.
5178 @end ignore
5179 @end itemize
5180
5181 @c ---------------------------------------------------------------------
5182 @node Moving directories
5183 @section Moving and renaming directories
5184 @cindex Moving directories
5185 @cindex Renaming directories
5186 @cindex Directories, moving
5187
5188 The normal way to rename or move a directory is to
5189 rename or move each file within it as described in
5190 @ref{Outside}.  Then check out with the @samp{-P}
5191 option, as described in @ref{Removing directories}.
5192
5193 If you really want to hack the repository to rename or
5194 delete a directory in the repository, you can do it
5195 like this:
5196
5197 @enumerate
5198 @item
5199 Inform everyone who has a checked out copy of the directory that the
5200 directory will be renamed.  They should commit all
5201 their changes, and remove their working copies,
5202 before you take the steps below.
5203
5204 @item
5205 Rename the directory inside the repository.
5206
5207 @example
5208 $ cd $CVSROOT/@var{parent-dir}
5209 $ mv @var{old-dir} @var{new-dir}
5210 @end example
5211
5212 @item
5213 Fix the @sc{cvs} administrative files, if necessary (for
5214 instance if you renamed an entire module).
5215
5216 @item
5217 Tell everyone that they can check out again and continue
5218 working.
5219
5220 @end enumerate
5221
5222 If someone had a working copy the @sc{cvs} commands will
5223 cease to work for him, until he removes the directory
5224 that disappeared inside the repository.
5225
5226 It is almost always better to move the files in the
5227 directory instead of moving the directory.  If you move the
5228 directory you are unlikely to be able to retrieve old
5229 releases correctly, since they probably depend on the
5230 name of the directories.
5231
5232 @c ---------------------------------------------------------------------
5233 @node History browsing
5234 @chapter History browsing
5235 @cindex History browsing
5236 @cindex Traceability
5237 @cindex Isolation
5238
5239 @ignore
5240 @c This is too long for an introduction (goal is
5241 @c one 20x80 character screen), and also mixes up a
5242 @c variety of issues (parallel development, history,
5243 @c maybe even touches on process control).
5244
5245 @c -- @quote{To lose ones history is to lose ones soul.}
5246 @c -- ///
5247 @c -- ///Those who cannot remember the past are condemned to repeat it.
5248 @c -- ///               -- George Santayana
5249 @c -- ///
5250
5251 @sc{cvs} tries to make it easy for a group of people to work
5252 together.  This is done in two ways:
5253
5254 @itemize @bullet
5255 @item
5256 Isolation---You have your own working copy of the
5257 source.  You are not affected by modifications made by
5258 others until you decide to incorporate those changes
5259 (via the @code{update} command---@pxref{update}).
5260
5261 @item
5262 Traceability---When something has changed, you can
5263 always see @emph{exactly} what changed.
5264 @end itemize
5265
5266 There are several features of @sc{cvs} that together lead
5267 to traceability:
5268
5269 @itemize @bullet
5270 @item
5271 Each revision of a file has an accompanying log
5272 message.
5273
5274 @item
5275 All commits are optionally logged to a central history
5276 database.
5277
5278 @item
5279 Logging information can be sent to a user-defined
5280 program (@pxref{loginfo}).
5281 @end itemize
5282
5283 @c -- More text here.
5284
5285 This chapter should talk about the history file, the
5286 @code{log} command, the usefulness of ChangeLogs
5287 even when you run @sc{cvs}, and things like that.
5288
5289 @end ignore
5290
5291 @c kind of lame, in a lot of ways the above text inside
5292 @c the @ignore motivates this chapter better
5293 Once you have used @sc{cvs} to store a version control
5294 history---what files have changed when, how, and by
5295 whom, there are a variety of mechanisms for looking
5296 through the history.
5297
5298 @c FIXME: should also be talking about how you look at
5299 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5300 @menu
5301 * log messages::                Log messages
5302 * history database::            The history database
5303 * user-defined logging::        User-defined logging
5304 @end menu
5305
5306 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5307 @node log messages
5308 @section Log messages
5309
5310 @c FIXME: @xref to place where we talk about how to
5311 @c specify message to commit.
5312 Whenever you commit a file you specify a log message.
5313
5314 @c FIXME: bring the information here, and get rid of or
5315 @c greatly shrink the "log" node.
5316 To look through the log messages which have been
5317 specified for every revision which has been committed,
5318 use the @code{cvs log} command (@pxref{log}).
5319
5320 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5321 @node history database
5322 @section The history database
5323
5324 @c FIXME: bring the information from the history file
5325 @c and history nodes here.  Rewrite it to be motivated
5326 @c better (start out by clearly explaining what gets
5327 @c logged in history, for example).
5328 You can use the history file (@pxref{history file}) to
5329 log various @sc{cvs} actions.  To retrieve the
5330 information from the history file, use the @code{cvs
5331 history} command (@pxref{history}).
5332
5333 Note: you can control what is logged to this file by using the
5334 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5335 (@pxref{config}).
5336
5337 @c
5338 @c The history database has many problems:
5339 @c * It is very unclear what field means what.  This
5340 @c could be improved greatly by better documentation,
5341 @c but there are still non-orthogonalities (for
5342 @c example, tag does not record the "repository"
5343 @c field but most records do).
5344 @c * Confusion about files, directories, and modules.
5345 @c Some commands record one, some record others.
5346 @c * File removal is not logged.  There is an 'R'
5347 @c record type documented, but CVS never uses it.
5348 @c * Tags are only logged for the "cvs rtag" command,
5349 @c not "cvs tag".  The fix for this is not completely
5350 @c clear (see above about modules vs. files).
5351 @c * Are there other cases of operations that are not
5352 @c logged?  One would hope for all changes to the
5353 @c repository to be logged somehow (particularly
5354 @c operations like tagging, "cvs admin -k", and other
5355 @c operations which do not record a history that one
5356 @c can get with "cvs log").  Operations on the working
5357 @c directory, like export, get, and release, are a
5358 @c second category also covered by the current "cvs
5359 @c history".
5360 @c * The history file does not record the options given
5361 @c to a command.  The most serious manifestation of
5362 @c this is perhaps that it doesn't record whether a command
5363 @c was recursive.  It is not clear to me whether one
5364 @c wants to log at a level very close to the command
5365 @c line, as a sort of way of logging each command
5366 @c (more or less), or whether one wants
5367 @c to log more at the level of what was changed (or
5368 @c something in between), but either way the current
5369 @c information has pretty big gaps.
5370 @c * Further details about a tag--like whether it is a
5371 @c branch tag or, if a non-branch tag, which branch it
5372 @c is on.  One can find out this information about the
5373 @c tag as it exists _now_, but if the tag has been
5374 @c moved, one doesn't know what it was like at the time
5375 @c the history record was written.
5376 @c * Whether operating on a particular tag, date, or
5377 @c options was implicit (sticky) or explicit.
5378 @c
5379 @c Another item, only somewhat related to the above, is a
5380 @c way to control what is logged in the history file.
5381 @c This is probably the only good way to handle
5382 @c different people having different ideas about
5383 @c information/space tradeoffs.
5384 @c
5385 @c It isn't really clear that it makes sense to try to
5386 @c patch up the history file format as it exists now to
5387 @c include all that stuff.  It might be better to
5388 @c design a whole new CVSROOT/nhistory file and "cvs
5389 @c nhistory" command, or some such, or in some other
5390 @c way trying to come up with a clean break from the
5391 @c past, which can address the above concerns.  Another
5392 @c open question is how/whether this relates to
5393 @c taginfo/loginfo/etc.
5394
5395 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5396 @node user-defined logging
5397 @section User-defined logging
5398
5399 @c FIXME: probably should centralize this information
5400 @c here, at least to some extent.  Maybe by moving the
5401 @c loginfo, etc., nodes here and replacing
5402 @c the "user-defined logging" node with one node for
5403 @c each method.
5404 You can customize @sc{cvs} to log various kinds of
5405 actions, in whatever manner you choose.  These
5406 mechanisms operate by executing a script at various
5407 times.  The script might append a message to a file
5408 listing the information and the programmer who created
5409 it, or send mail to a group of developers, or, perhaps,
5410 post a message to a particular newsgroup.  To log
5411 commits, use the @file{loginfo} file (@pxref{loginfo}).
5412 To log tags, use the @file{taginfo} file (@pxref{taginfo}).
5413 @c FIXME: What is difference between doing it in the
5414 @c modules file and using loginfo/taginfo?  Why should
5415 @c user use one or the other?
5416 To log commits, checkouts, exports, and tags,
5417 respectively, you can also use the @samp{-i},
5418 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5419 modules file.  For a more flexible way of giving
5420 notifications to various users, which requires less in
5421 the way of keeping centralized scripts up to date, use
5422 the @code{cvs watch add} command (@pxref{Getting
5423 Notified}); this command is useful even if you are not
5424 using @code{cvs watch on}.
5425
5426 @c ---------------------------------------------------------------------
5427 @node Binary files
5428 @chapter Handling binary files
5429 @cindex Binary files
5430
5431 The most common use for @sc{cvs} is to store text
5432 files.  With text files, @sc{cvs} can merge revisions,
5433 display the differences between revisions in a
5434 human-visible fashion, and other such operations.
5435 However, if you are willing to give up a few of these
5436 abilities, @sc{cvs} can store binary files.  For
5437 example, one might store a web site in @sc{cvs}
5438 including both text files and binary images.
5439
5440 @menu
5441 * Binary why::     More details on issues with binary files
5442 * Binary howto::   How to store them
5443 @end menu
5444
5445 @node Binary why
5446 @section The issues with binary files
5447
5448 While the need to manage binary files may seem obvious
5449 if the files that you customarily work with are binary,
5450 putting them into version control does present some
5451 additional issues.
5452
5453 One basic function of version control is to show the
5454 differences between two revisions.  For example, if
5455 someone else checked in a new version of a file, you
5456 may wish to look at what they changed and determine
5457 whether their changes are good.  For text files,
5458 @sc{cvs} provides this functionality via the @code{cvs
5459 diff} command.  For binary files, it may be possible to
5460 extract the two revisions and then compare them with a
5461 tool external to @sc{cvs} (for example, word processing
5462 software often has such a feature).  If there is no
5463 such tool, one must track changes via other mechanisms,
5464 such as urging people to write good log messages, and
5465 hoping that the changes they actually made were the
5466 changes that they intended to make.
5467
5468 Another ability of a version control system is the
5469 ability to merge two revisions.  For @sc{cvs} this
5470 happens in two contexts.  The first is when users make
5471 changes in separate working directories
5472 (@pxref{Multiple developers}).  The second is when one
5473 merges explicitly with the @samp{update -j} command
5474 (@pxref{Branching and merging}).
5475
5476 In the case of text
5477 files, @sc{cvs} can merge changes made independently,
5478 and signal a conflict if the changes conflict.  With
5479 binary files, the best that @sc{cvs} can do is present
5480 the two different copies of the file, and leave it to
5481 the user to resolve the conflict.  The user may choose
5482 one copy or the other, or may run an external merge
5483 tool which knows about that particular file format, if
5484 one exists.
5485 Note that having the user merge relies primarily on the
5486 user to not accidentally omit some changes, and thus is
5487 potentially error prone.
5488
5489 If this process is thought to be undesirable, the best
5490 choice may be to avoid merging.  To avoid the merges
5491 that result from separate working directories, see the
5492 discussion of reserved checkouts (file locking) in
5493 @ref{Multiple developers}.  To avoid the merges
5494 resulting from branches, restrict use of branches.
5495
5496 @node Binary howto
5497 @section How to store binary files
5498
5499 There are two issues with using @sc{cvs} to store
5500 binary files.  The first is that @sc{cvs} by default
5501 converts line endings between the canonical form in
5502 which they are stored in the repository (linefeed
5503 only), and the form appropriate to the operating system
5504 in use on the client (for example, carriage return
5505 followed by line feed for Windows NT).
5506
5507 The second is that a binary file might happen to
5508 contain data which looks like a keyword (@pxref{Keyword
5509 substitution}), so keyword expansion must be turned
5510 off.
5511
5512 @c FIXME: the third is that one can't do merges with
5513 @c binary files.  xref to Multiple Developers and the
5514 @c reserved checkout issues.
5515
5516 The @samp{-kb} option available with some @sc{cvs}
5517 commands insures that neither line ending conversion
5518 nor keyword expansion will be done.
5519
5520 Here is an example of how you can create a new file
5521 using the @samp{-kb} flag:
5522
5523 @example
5524 $ echo '$@splitrcskeyword{Id}$' > kotest
5525 $ cvs add -kb -m"A test file" kotest
5526 $ cvs ci -m"First checkin; contains a keyword" kotest
5527 @end example
5528
5529 If a file accidentally gets added without @samp{-kb},
5530 one can use the @code{cvs admin} command to recover.
5531 For example:
5532
5533 @example
5534 $ echo '$@splitrcskeyword{Id}$' > kotest
5535 $ cvs add -m"A test file" kotest
5536 $ cvs ci -m"First checkin; contains a keyword" kotest
5537 $ cvs admin -kb kotest
5538 $ cvs update -A kotest
5539 # @r{For non-unix systems:}
5540 # @r{Copy in a good copy of the file from outside CVS}
5541 $ cvs commit -m "make it binary" kotest
5542 @end example
5543
5544 @c Trying to describe this for both unix and non-unix
5545 @c in the same description is very confusing.  Might
5546 @c want to split the two, or just ditch the unix "shortcut"
5547 @c (unixheads don't do much with binary files, anyway).
5548 @c This used to say "(Try the above example, and do a
5549 @c @code{cat kotest} after every command)".  But that
5550 @c only really makes sense for the unix case.
5551 When you check in the file @file{kotest} the file is
5552 not preserved as a binary file, because you did not
5553 check it in as a binary file.  The @code{cvs
5554 admin -kb} command sets the default keyword
5555 substitution method for this file, but it does not
5556 alter the working copy of the file that you have.  If you need to
5557 cope with line endings (that is, you are using
5558 @sc{cvs} on a non-unix system), then you need to
5559 check in a new copy of the file, as shown by the
5560 @code{cvs commit} command above.
5561 On unix, the @code{cvs update -A} command suffices.
5562 @c FIXME: should also describe what the *other users*
5563 @c need to do, if they have checked out copies which
5564 @c have been corrupted by lack of -kb.  I think maybe
5565 @c "cvs update -kb" or "cvs
5566 @c update -A" would suffice, although the user who
5567 @c reported this suggested removing the file, manually
5568 @c removing it from CVS/Entries, and then "cvs update"
5569 (Note that you can use @code{cvs log} to determine the default keyword
5570 substitution method for a file and @code{cvs status} to determine
5571 the keyword substitution method for a working copy.)
5572
5573 However, in using @code{cvs admin -k} to change the
5574 keyword expansion, be aware that the keyword expansion
5575 mode is not version controlled.  This means that, for
5576 example, that if you have a text file in old releases,
5577 and a binary file with the same name in new releases,
5578 @sc{cvs} provides no way to check out the file in text
5579 or binary mode depending on what version you are
5580 checking out.  There is no good workaround for this
5581 problem.
5582
5583 You can also set a default for whether @code{cvs add}
5584 and @code{cvs import} treat a file as binary based on
5585 its name; for example you could say that files who
5586 names end in @samp{.exe} are binary.  @xref{Wrappers}.
5587 There is currently no way to have @sc{cvs} detect
5588 whether a file is binary based on its contents.  The
5589 main difficulty with designing such a feature is that
5590 it is not clear how to distinguish between binary and
5591 non-binary files, and the rules to apply would vary
5592 considerably with the operating system.
5593 @c For example, it would be good on MS-DOS-family OSes
5594 @c for anything containing ^Z to be binary.  Having
5595 @c characters with the 8th bit set imply binary is almost
5596 @c surely a bad idea in the context of ISO-8859-* and
5597 @c other such character sets.  On VMS or the Mac, we
5598 @c could use the OS's file typing.  This is a
5599 @c commonly-desired feature, and something of this sort
5600 @c may make sense.  But there are a lot of pitfalls here.
5601 @c
5602 @c Another, probably better, way to tell is to read the
5603 @c file in text mode, write it to a temp file in text
5604 @c mode, and then do a binary mode compare of the two
5605 @c files.  If they differ, it is a binary file.  This
5606 @c might have problems on VMS (or some other system
5607 @c with several different text modes), but in general
5608 @c should be relatively portable.  The only other
5609 @c downside I can think of is that it would be fairly
5610 @c slow, but that is perhaps a small price to pay for
5611 @c not having your files corrupted.  Another issue is
5612 @c what happens if you import a text file with bare
5613 @c linefeeds on Windows.  Such files will show up on
5614 @c Windows sometimes (I think some native windows
5615 @c programs even write them, on occasion).  Perhaps it
5616 @c is reasonable to treat such files as binary; after
5617 @c all it is something of a presumption to assume that
5618 @c the user would want the linefeeds converted to CRLF.
5619
5620 @c ---------------------------------------------------------------------
5621 @node Multiple developers
5622 @chapter Multiple developers
5623 @cindex Multiple developers
5624 @cindex Team of developers
5625 @cindex File locking
5626 @cindex Locking files
5627 @cindex Working copy
5628 @cindex Reserved checkouts
5629 @cindex Unreserved checkouts
5630 @cindex RCS-style locking
5631
5632 When more than one person works on a software project
5633 things often get complicated.  Often, two people try to
5634 edit the same file simultaneously.  One solution, known
5635 as @dfn{file locking} or @dfn{reserved checkouts}, is
5636 to allow only one person to edit each file at a time.
5637 This is the only solution with some version control
5638 systems, including @sc{rcs} and @sc{sccs}.  Currently
5639 the usual way to get reserved checkouts with @sc{cvs}
5640 is the @code{cvs admin -l} command (@pxref{admin
5641 options}).  This is not as nicely integrated into
5642 @sc{cvs} as the watch features, described below, but it
5643 seems that most people with a need for reserved
5644 checkouts find it adequate.
5645 @c Or "find it better than worrying about implementing
5646 @c nicely integrated reserved checkouts" or ...?
5647 It also may be possible to use the watches
5648 features described below, together with suitable
5649 procedures (not enforced by software), to avoid having
5650 two people edit at the same time.
5651
5652 @c Our unreserved checkout model might not
5653 @c be quite the same as others.  For example, I
5654 @c think that some systems will tend to create a branch
5655 @c in the case where CVS prints "up-to-date check failed".
5656 @c It isn't clear to me whether we should try to
5657 @c explore these subtleties; it could easily just
5658 @c confuse people.
5659 The default model with @sc{cvs} is known as
5660 @dfn{unreserved checkouts}.  In this model, developers
5661 can edit their own @dfn{working copy} of a file
5662 simultaneously.  The first person that commits his
5663 changes has no automatic way of knowing that another
5664 has started to edit it.  Others will get an error
5665 message when they try to commit the file.  They must
5666 then use @sc{cvs} commands to bring their working copy
5667 up to date with the repository revision.  This process
5668 is almost automatic.
5669
5670 @c FIXME? should probably use the word "watch" here, to
5671 @c tie this into the text below and above.
5672 @sc{cvs} also supports mechanisms which facilitate
5673 various kinds of communication, without actually
5674 enforcing rules like reserved checkouts do.
5675
5676 The rest of this chapter describes how these various
5677 models work, and some of the issues involved in
5678 choosing between them.
5679
5680 @ignore
5681 Here is a draft reserved checkout design or discussion
5682 of the issues.  This seems like as good a place as any
5683 for this.
5684
5685 Might want a cvs lock/cvs unlock--in which the names
5686 differ from edit/unedit because the network must be up
5687 for these to work.  unedit gives an error if there is a
5688 reserved checkout in place (so that people don't
5689 accidentally leave locks around); unlock gives an error
5690 if one is not in place (this is more arguable; perhaps
5691 it should act like unedit in that case).
5692
5693 On the other hand, might want it so that emacs,
5694 scripts, etc., can get ready to edit a file without
5695 having to know which model is in use.  In that case we
5696 would have a "cvs watch lock" (or .cvsrc?) (that is,
5697 three settings, "on", "off", and "lock").  Having cvs
5698 watch lock set would cause a get to record in the CVS
5699 directory which model is in use, and cause "cvs edit"
5700 to change behaviors.  We'd want a way to query which
5701 setting is in effect (this would be handy even if it is
5702 only "on" or "off" as presently).  If lock is in
5703 effect, then commit would require a lock before
5704 allowing a checkin; chmod wouldn't suffice (might be
5705 debatable--see chmod comment below, in watches--but it
5706 is the way people expect RCS to work and I can't think
5707 of any significant downside.  On the other hand, maybe
5708 it isn't worth bothering, because people who are used
5709 to RCS wouldn't think to use chmod anyway).
5710
5711 Implementation: use file attributes or use RCS
5712 locking.  The former avoids more dependence on RCS
5713 behaviors we will need to re-implement as we librarify
5714 RCS, and makes it easier to import/export RCS files (in
5715 that context, want to ignore the locker field).  But
5716 note that RCS locks are per-branch, which is the
5717 correct behavior (this is also an issue for the "watch
5718 on" features; they should be per-branch too).
5719
5720 Here are a few more random notes about implementation
5721 details, assuming "cvs watch lock" and
5722
5723 CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
5724 Cases: (1) file is checked out (unreserved or with watch on) by old
5725 version of @sc{cvs}, now we do something with new one, (2) file is checked
5726 out by new version, now we do something with old one.
5727
5728 Remote protocol would have a "Watched" analogous to "Mode".  Of course
5729 it would apply to all Updated-like requests.  How do we keep this
5730 setting up to date?  I guess that there wants to be a Watched request,
5731 and the server would send a new one if it isn't up to date? (Ugh--hard
5732 to implement and slows down "cvs -q update"--is there an easier way?)
5733
5734 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
5735 "edit-lock" request.  Which comes back with a Checked-in with
5736 appropriate Watched (off, on, lock, locked, or some such?), or error
5737 message if already locked.
5738
5739 "cvs commit"--only will commit if off/on/locked.  lock is not OK.
5740
5741 Doc:
5742 note that "cvs edit" must be connected to network if watch lock is in
5743 effect.
5744
5745 Talk about what to do if someone has locked a file and you want to
5746 edit that file.  (breaking locks, or lack thereof).
5747
5748
5749 One other idea (which could work along with the
5750 existing "cvs admin -l" reserved checkouts, as well as
5751 the above):
5752
5753 "cvs editors" could show who has the file locked, if
5754 someone does.
5755
5756 @end ignore
5757
5758 @menu
5759 * File status::                 A file can be in several states
5760 * Updating a file::             Bringing a file up-to-date
5761 * Conflicts example::           An informative example
5762 * Informing others::            To cooperate you must inform
5763 * Concurrency::                 Simultaneous repository access
5764 * Watches::                     Mechanisms to track who is editing files
5765 * Choosing a model::            Reserved or unreserved checkouts?
5766 @end menu
5767
5768 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5769 @node File status
5770 @section File status
5771 @cindex File status
5772 @cindex Status of a file
5773
5774 @c Shouldn't this start with an example or something,
5775 @c introducing the unreserved checkout model?  Before we
5776 @c dive into listing states?
5777 Based on what operations you have performed on a
5778 checked out file, and what operations others have
5779 performed to that file in the repository, one can
5780 classify a file in a number of states.  The states, as
5781 reported by the @code{status} command, are:
5782
5783 @c The order of items is chosen to group logically
5784 @c similar outputs together.
5785 @c People who want alphabetical can use the index...
5786 @table @asis
5787 @cindex Up-to-date
5788 @item Up-to-date
5789 The file is identical with the latest revision in the
5790 repository for the branch in use.
5791 @c FIXME: should we clarify "in use"?  The answer is
5792 @c sticky tags, and trying to distinguish branch sticky
5793 @c tags from non-branch sticky tags seems rather awkward
5794 @c here.
5795 @c FIXME: What happens with non-branch sticky tags?  Is
5796 @c a stuck file "Up-to-date" or "Needs checkout" or what?
5797
5798 @item Locally Modified
5799 @cindex Locally Modified
5800 You have edited the file, and not yet committed your changes.
5801
5802 @item Locally Added
5803 @cindex Locally Added
5804 You have added the file with @code{add}, and not yet
5805 committed your changes.
5806 @c There are many cases involving the file being
5807 @c added/removed/modified in the working directory, and
5808 @c added/removed/modified in the repository, which we
5809 @c don't try to describe here.  I'm not sure that "cvs
5810 @c status" produces a non-confusing output in most of
5811 @c those cases.
5812
5813 @item Locally Removed
5814 @cindex Locally Removed
5815 You have removed the file with @code{remove}, and not yet
5816 committed your changes.
5817
5818 @item Needs Checkout
5819 @cindex Needs Checkout
5820 Someone else has committed a newer revision to the
5821 repository.  The name is slightly misleading; you will
5822 ordinarily use @code{update} rather than
5823 @code{checkout} to get that newer revision.
5824
5825 @item Needs Patch
5826 @cindex Needs Patch
5827 @c See also newb-123j0 in sanity.sh (although that case
5828 @c should probably be changed rather than documented).
5829 Like Needs Checkout, but the @sc{cvs} server will send
5830 a patch rather than the entire file.  Sending a patch or
5831 sending an entire file accomplishes the same thing.
5832
5833 @item Needs Merge
5834 @cindex Needs Merge
5835 Someone else has committed a newer revision to the repository, and you
5836 have also made modifications to the file.
5837
5838 @item Unresolved Conflict
5839 @cindex Unresolved Conflict
5840 @c FIXCVS - This file status needs to be changed to some more informative
5841 @c text that distinguishes it more clearly from each of the Locally Added,
5842 @c File had conflicts on merge, and Unknown status types, but an exact and
5843 @c succinct wording escapes me at the moment.
5844 A file with the same name as this new file has been added to the repository
5845 from a second workspace.  This file will need to be moved out of the way
5846 to allow an @code{update} to complete.
5847
5848 @item File had conflicts on merge
5849 @cindex File had conflicts on merge
5850 @c is it worth saying that this message was "Unresolved
5851 @c Conflict" in CVS 1.9 and earlier?  I'm inclined to
5852 @c think that is unnecessarily confusing to new users.
5853 This is like Locally Modified, except that a previous
5854 @code{update} command gave a conflict.  If you have not
5855 already done so, you need to
5856 resolve the conflict as described in @ref{Conflicts example}.
5857
5858 @item Unknown
5859 @cindex Unknown
5860 @sc{cvs} doesn't know anything about this file.  For
5861 example, you have created a new file and have not run
5862 @code{add}.
5863 @c
5864 @c "Entry Invalid" and "Classify Error" are also in the
5865 @c status.c.  The latter definitely indicates a CVS bug
5866 @c (should it be worded more like "internal error" so
5867 @c people submit bug reports if they see it?).  The former
5868 @c I'm not as sure; I haven't tracked down whether/when it
5869 @c appears in "cvs status" output.
5870
5871 @end table
5872
5873 To help clarify the file status, @code{status} also
5874 reports the @code{Working revision} which is the
5875 revision that the file in the working directory derives
5876 from, and the @code{Repository revision} which is the
5877 latest revision in the repository for the branch in
5878 use.
5879 @c FIXME: should we clarify "in use"?  The answer is
5880 @c sticky tags, and trying to distinguish branch sticky
5881 @c tags from non-branch sticky tags seems rather awkward
5882 @c here.
5883 @c FIXME: What happens with non-branch sticky tags?
5884 @c What is the Repository Revision there?  See the
5885 @c comment at vn_rcs in cvs.h, which is kind of
5886 @c confused--we really need to document better what this
5887 @c field contains.
5888 @c Q: Should we document "New file!" and other such
5889 @c outputs or are they self-explanatory?
5890 @c FIXME: what about the date to the right of "Working
5891 @c revision"?  It doesn't appear with client/server and
5892 @c seems unnecessary (redundant with "ls -l") so
5893 @c perhaps it should be removed for non-client/server too?
5894 @c FIXME: Need some examples.
5895 @c FIXME: Working revision can also be something like
5896 @c "-1.3" for a locally removed file.  Not at all
5897 @c self-explanatory (and it is possible that CVS should
5898 @c be changed rather than documenting this).
5899
5900 @c Would be nice to have an @example showing output
5901 @c from cvs status, with comments showing the xref
5902 @c where each part of the output is described.  This
5903 @c might fit in nicely if it is desirable to split this
5904 @c node in two; one to introduce "cvs status" and one
5905 @c to list each of the states.
5906 The options to @code{status} are listed in
5907 @ref{Invoking CVS}.  For information on its @code{Sticky tag}
5908 and @code{Sticky date} output, see @ref{Sticky tags}.
5909 For information on its @code{Sticky options} output,
5910 see the @samp{-k} option in @ref{update options}.
5911
5912 You can think of the @code{status} and @code{update}
5913 commands as somewhat complementary.  You use
5914 @code{update} to bring your files up to date, and you
5915 can use @code{status} to give you some idea of what an
5916 @code{update} would do (of course, the state of the
5917 repository might change before you actually run
5918 @code{update}).  In fact, if you want a command to
5919 display file status in a more brief format than is
5920 displayed by the @code{status} command, you can invoke
5921
5922 @cindex update, to display file status
5923 @example
5924 $ cvs -n -q update
5925 @end example
5926
5927 The @samp{-n} option means to not actually do the
5928 update, but merely to display statuses; the @samp{-q}
5929 option avoids printing the name of each directory.  For
5930 more information on the @code{update} command, and
5931 these options, see @ref{Invoking CVS}.
5932
5933 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5934 @node Updating a file
5935 @section Bringing a file up to date
5936 @cindex Bringing a file up to date
5937 @cindex Updating a file
5938 @cindex Merging a file
5939 @cindex Update, introduction
5940
5941 When you want to update or merge a file, use the @code{update}
5942 command.  For files that are not up to date this is roughly equivalent
5943 to a @code{checkout} command: the newest revision of the file is
5944 extracted from the repository and put in your working directory.
5945
5946 Your modifications to a file are never lost when you
5947 use @code{update}.  If no newer revision exists,
5948 running @code{update} has no effect.  If you have
5949 edited the file, and a newer revision is available,
5950 @sc{cvs} will merge all changes into your working copy.
5951
5952 For instance, imagine that you checked out revision 1.4 and started
5953 editing it.  In the meantime someone else committed revision 1.5, and
5954 shortly after that revision 1.6.  If you run @code{update} on the file
5955 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
5956 your file.
5957
5958 @cindex Overlap
5959 If any of the changes between 1.4 and 1.6 were made too
5960 close to any of the changes you have made, an
5961 @dfn{overlap} occurs.  In such cases a warning is
5962 printed, and the resulting file includes both
5963 versions of the lines that overlap, delimited by
5964 special markers.
5965 @xref{update}, for a complete description of the
5966 @code{update} command.
5967
5968 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5969 @node Conflicts example
5970 @section Conflicts example
5971 @cindex Merge, an example
5972 @cindex Example of merge
5973 @cindex driver.c (merge example)
5974
5975 Suppose revision 1.4 of @file{driver.c} contains this:
5976
5977 @example
5978 #include <stdio.h>
5979
5980 void main()
5981 @{
5982     parse();
5983     if (nerr == 0)
5984         gencode();
5985     else
5986         fprintf(stderr, "No code generated.\n");
5987     exit(nerr == 0 ? 0 : 1);
5988 @}
5989 @end example
5990
5991 @noindent
5992 Revision 1.6 of @file{driver.c} contains this:
5993
5994 @example
5995 #include <stdio.h>
5996
5997 int main(int argc,
5998          char **argv)
5999 @{
6000     parse();
6001     if (argc != 1)
6002     @{
6003         fprintf(stderr, "tc: No args expected.\n");
6004         exit(1);
6005     @}
6006     if (nerr == 0)
6007         gencode();
6008     else
6009         fprintf(stderr, "No code generated.\n");
6010     exit(!!nerr);
6011 @}
6012 @end example
6013
6014 @noindent
6015 Your working copy of @file{driver.c}, based on revision
6016 1.4, contains this before you run @samp{cvs update}:
6017 @c -- Really include "cvs"?
6018
6019 @example
6020 #include <stdlib.h>
6021 #include <stdio.h>
6022
6023 void main()
6024 @{
6025     init_scanner();
6026     parse();
6027     if (nerr == 0)
6028         gencode();
6029     else
6030         fprintf(stderr, "No code generated.\n");
6031     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6032 @}
6033 @end example
6034
6035 @noindent
6036 You run @samp{cvs update}:
6037 @c -- Really include "cvs"?
6038
6039 @example
6040 $ cvs update driver.c
6041 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6042 retrieving revision 1.4
6043 retrieving revision 1.6
6044 Merging differences between 1.4 and 1.6 into driver.c
6045 rcsmerge warning: overlaps during merge
6046 cvs update: conflicts found in driver.c
6047 C driver.c
6048 @end example
6049
6050 @noindent
6051 @cindex Conflicts (merge example)
6052 @sc{cvs} tells you that there were some conflicts.
6053 Your original working file is saved unmodified in
6054 @file{.#driver.c.1.4}.  The new version of
6055 @file{driver.c} contains this:
6056
6057 @example
6058 #include <stdlib.h>
6059 #include <stdio.h>
6060
6061 int main(int argc,
6062          char **argv)
6063 @{
6064     init_scanner();
6065     parse();
6066     if (argc != 1)
6067     @{
6068         fprintf(stderr, "tc: No args expected.\n");
6069         exit(1);
6070     @}
6071     if (nerr == 0)
6072         gencode();
6073     else
6074         fprintf(stderr, "No code generated.\n");
6075 @asis{}<<<<<<< driver.c
6076     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6077 @asis{}=======
6078     exit(!!nerr);
6079 @asis{}>>>>>>> 1.6
6080 @}
6081 @end example
6082
6083 @noindent
6084 @cindex Markers, conflict
6085 @cindex Conflict markers
6086 @cindex <<<<<<<
6087 @cindex >>>>>>>
6088 @cindex =======
6089
6090 Note how all non-overlapping modifications are incorporated in your working
6091 copy, and that the overlapping section is clearly marked with
6092 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6093
6094 @cindex Resolving a conflict
6095 @cindex Conflict resolution
6096 You resolve the conflict by editing the file, removing the markers and
6097 the erroneous line.  Suppose you end up with this file:
6098 @c -- Add xref to the pcl-cvs manual when it talks
6099 @c -- about this.
6100 @example
6101 #include <stdlib.h>
6102 #include <stdio.h>
6103
6104 int main(int argc,
6105          char **argv)
6106 @{
6107     init_scanner();
6108     parse();
6109     if (argc != 1)
6110     @{
6111         fprintf(stderr, "tc: No args expected.\n");
6112         exit(1);
6113     @}
6114     if (nerr == 0)
6115         gencode();
6116     else
6117         fprintf(stderr, "No code generated.\n");
6118     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6119 @}
6120 @end example
6121
6122 @noindent
6123 You can now go ahead and commit this as revision 1.7.
6124
6125 @example
6126 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6127 Checking in driver.c;
6128 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6129 new revision: 1.7; previous revision: 1.6
6130 done
6131 @end example
6132
6133 For your protection, @sc{cvs} will refuse to check in a
6134 file if a conflict occurred and you have not resolved
6135 the conflict.  Currently to resolve a conflict, you
6136 must change the timestamp on the file.  In previous
6137 versions of @sc{cvs}, you also needed to
6138 insure that the file contains no conflict markers.
6139 Because
6140 your file may legitimately contain conflict markers (that
6141 is, occurrences of @samp{>>>>>>> } at the start of a
6142 line that don't mark a conflict), the current
6143 version of @sc{cvs} will print a warning and proceed to
6144 check in the file.
6145 @c The old behavior was really icky; the only way out
6146 @c was to start hacking on
6147 @c the @code{CVS/Entries} file or other such workarounds.
6148 @c
6149 @c If the timestamp thing isn't considered nice enough,
6150 @c maybe there should be a "cvs resolved" command
6151 @c which clears the conflict indication.  For a nice user
6152 @c interface, this should be invoked by an interactive
6153 @c merge tool like emerge rather than by the user
6154 @c directly--such a tool can verify that the user has
6155 @c really dealt with each conflict.
6156
6157 @cindex emerge
6158 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6159 Emacs front-end for @sc{cvs}) you can use an Emacs
6160 package called emerge to help you resolve conflicts.
6161 See the documentation for pcl-cvs.
6162
6163 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6164 @node Informing others
6165 @section Informing others about commits
6166 @cindex Informing others
6167 @cindex Spreading information
6168 @cindex Mail, automatic mail on commit
6169
6170 It is often useful to inform others when you commit a
6171 new revision of a file.  The @samp{-i} option of the
6172 @file{modules} file, or the @file{loginfo} file, can be
6173 used to automate this process.  @xref{modules}.
6174 @xref{loginfo}.  You can use these features of @sc{cvs}
6175 to, for instance, instruct @sc{cvs} to mail a
6176 message to all developers, or post a message to a local
6177 newsgroup.
6178 @c -- More text would be nice here.
6179
6180 @node Concurrency
6181 @section Several developers simultaneously attempting to run CVS
6182
6183 @cindex Locks, cvs, introduction
6184 @c For a discussion of *why* CVS creates locks, see
6185 @c the comment at the start of src/lock.c
6186 If several developers try to run @sc{cvs} at the same
6187 time, one may get the following message:
6188
6189 @example
6190 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6191 @end example
6192
6193 @cindex #cvs.rfl, removing
6194 @cindex #cvs.wfl, removing
6195 @cindex #cvs.lock, removing
6196 @sc{cvs} will try again every 30 seconds, and either
6197 continue with the operation or print the message again,
6198 if it still needs to wait.  If a lock seems to stick
6199 around for an undue amount of time, find the person
6200 holding the lock and ask them about the cvs command
6201 they are running.  If they aren't running a cvs
6202 command, look in the repository directory mentioned in
6203 the message and remove files which they own whose names
6204 start with @file{#cvs.rfl},
6205 @file{#cvs.wfl}, or @file{#cvs.lock}.
6206
6207 Note that these locks are to protect @sc{cvs}'s
6208 internal data structures and have no relationship to
6209 the word @dfn{lock} in the sense used by
6210 @sc{rcs}---which refers to reserved checkouts
6211 (@pxref{Multiple developers}).
6212
6213 Any number of people can be reading from a given
6214 repository at a time; only when someone is writing do
6215 the locks prevent other people from reading or writing.
6216
6217 @cindex Atomic transactions, lack of
6218 @cindex Transactions, atomic, lack of
6219 @c the following talks about what one might call commit/update
6220 @c atomicity.
6221 @c Probably also should say something about
6222 @c commit/commit atomicity, that is, "An update will
6223 @c not get partial versions of more than one commit".
6224 @c CVS currently has this property and I guess we can
6225 @c make it a documented feature.
6226 @c For example one person commits
6227 @c a/one.c and b/four.c and another commits a/two.c and
6228 @c b/three.c.  Then an update cannot get the new a/one.c
6229 @c and a/two.c and the old b/four.c and b/three.c.
6230 One might hope for the following property:
6231
6232 @quotation
6233 If someone commits some changes in one cvs command,
6234 then an update by someone else will either get all the
6235 changes, or none of them.
6236 @end quotation
6237
6238 @noindent
6239 but @sc{cvs} does @emph{not} have this property.  For
6240 example, given the files
6241
6242 @example
6243 a/one.c
6244 a/two.c
6245 b/three.c
6246 b/four.c
6247 @end example
6248
6249 @noindent
6250 if someone runs
6251
6252 @example
6253 cvs ci a/two.c b/three.c
6254 @end example
6255
6256 @noindent
6257 and someone else runs @code{cvs update} at the same
6258 time, the person running @code{update} might get only
6259 the change to @file{b/three.c} and not the change to
6260 @file{a/two.c}.
6261
6262 @node Watches
6263 @section Mechanisms to track who is editing files
6264 @cindex Watches
6265
6266 For many groups, use of @sc{cvs} in its default mode is
6267 perfectly satisfactory.  Users may sometimes go to
6268 check in a modification only to find that another
6269 modification has intervened, but they deal with it and
6270 proceed with their check in.  Other groups prefer to be
6271 able to know who is editing what files, so that if two
6272 people try to edit the same file they can choose to
6273 talk about who is doing what when rather than be
6274 surprised at check in time.  The features in this
6275 section allow such coordination, while retaining the
6276 ability of two developers to edit the same file at the
6277 same time.
6278
6279 @c Some people might ask why CVS does not enforce the
6280 @c rule on chmod, by requiring a cvs edit before a cvs
6281 @c commit.  The main reason is that it could always be
6282 @c circumvented--one could edit the file, and
6283 @c then when ready to check it in, do the cvs edit and put
6284 @c in the new contents and do the cvs commit.  One
6285 @c implementation note: if we _do_ want to have cvs commit
6286 @c require a cvs edit, we should store the state on
6287 @c whether the cvs edit has occurred in the working
6288 @c directory, rather than having the server try to keep
6289 @c track of what working directories exist.
6290 @c FIXME: should the above discussion be part of the
6291 @c manual proper, somewhere, not just in a comment?
6292 For maximum benefit developers should use @code{cvs
6293 edit} (not @code{chmod}) to make files read-write to
6294 edit them, and @code{cvs release} (not @code{rm}) to
6295 discard a working directory which is no longer in use,
6296 but @sc{cvs} is not able to enforce this behavior.
6297
6298 @c I'm a little dissatisfied with this presentation,
6299 @c because "watch on"/"edit"/"editors" are one set of
6300 @c functionality, and "watch add"/"watchers" is another
6301 @c which is somewhat orthogonal even though they interact in
6302 @c various ways.  But I think it might be
6303 @c confusing to describe them separately (e.g. "watch
6304 @c add" with loginfo).  I don't know.
6305
6306 @menu
6307 * Setting a watch::             Telling CVS to watch certain files
6308 * Getting Notified::            Telling CVS to notify you
6309 * Editing files::               How to edit a file which is being watched
6310 * Watch information::           Information about who is watching and editing
6311 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6312 @end menu
6313
6314 @node Setting a watch
6315 @subsection Telling CVS to watch certain files
6316
6317 To enable the watch features, you first specify that
6318 certain files are to be watched.
6319
6320 @cindex watch on (subcommand)
6321 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6322
6323 @cindex Read-only files, and watches
6324 Specify that developers should run @code{cvs edit}
6325 before editing @var{files}.  @sc{cvs} will create working
6326 copies of @var{files} read-only, to remind developers
6327 to run the @code{cvs edit} command before working on
6328 them.
6329
6330 If @var{files} includes the name of a directory, @sc{cvs}
6331 arranges to watch all files added to the corresponding
6332 repository directory, and sets a default for files
6333 added in the future; this allows the user to set
6334 notification policies on a per-directory basis.  The
6335 contents of the directory are processed recursively,
6336 unless the @code{-l} option is given.
6337 The @code{-R} option can be used to force recursion if the @code{-l}
6338 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6339
6340 If @var{files} is omitted, it defaults to the current directory.
6341
6342 @cindex watch off (subcommand)
6343 @end deffn
6344
6345 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6346
6347 Do not create @var{files} read-only on checkout; thus,
6348 developers will not be reminded to use @code{cvs edit}
6349 and @code{cvs unedit}.
6350 @ignore
6351 @sc{cvs} will check out @var{files}
6352 read-write as usual, unless other permissions override
6353 due to the @code{PreservePermissions} option being
6354 enabled in the @file{config} administrative file
6355 (@pxref{Special Files}, @pxref{config})
6356 @end ignore
6357
6358 The @var{files} and options are processed as for @code{cvs
6359 watch on}.
6360
6361 @end deffn
6362
6363 @node Getting Notified
6364 @subsection Telling CVS to notify you
6365
6366 You can tell @sc{cvs} that you want to receive
6367 notifications about various actions taken on a file.
6368 You can do this without using @code{cvs watch on} for
6369 the file, but generally you will want to use @code{cvs
6370 watch on}, to remind developers to use the @code{cvs edit}
6371 command.
6372
6373 @cindex watch add (subcommand)
6374 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6375
6376 Add the current user to the list of people to receive notification of
6377 work done on @var{files}.
6378
6379 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6380 the user about.  @var{action} is one of the following:
6381
6382 @table @code
6383
6384 @item edit
6385 Another user has applied the @code{cvs edit} command (described
6386 below) to a watched file.
6387
6388 @item commit
6389 Another user has committed changes to one of the named @var{files}.
6390
6391 @item unedit
6392 Another user has abandoned editing a file (other than by committing changes).
6393 They can do this in several ways, by:
6394
6395 @itemize @bullet
6396
6397 @item
6398 applying the @code{cvs unedit} command (described below) to the file
6399
6400 @item
6401 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6402 (or recursively to a directory more than one level up)
6403
6404 @item
6405 deleting the file and allowing @code{cvs update} to recreate it
6406
6407 @end itemize
6408
6409 @item all
6410 All of the above.
6411
6412 @item none
6413 None of the above.  (This is useful with @code{cvs edit},
6414 described below.)
6415
6416 @end table
6417
6418 The @code{-a} option may appear more than once, or not at all.  If
6419 omitted, the action defaults to @code{all}.
6420
6421 The @var{files} and options are processed as for
6422 @code{cvs watch on}.
6423
6424 @end deffn
6425
6426
6427 @cindex watch remove (subcommand)
6428 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6429
6430 Remove a notification request established using @code{cvs watch add};
6431 the arguments are the same.  If the @code{-a} option is present, only
6432 watches for the specified actions are removed.
6433
6434 @end deffn
6435
6436 @cindex notify (admin file)
6437 When the conditions exist for notification, @sc{cvs}
6438 calls the @file{notify} administrative file.  Edit
6439 @file{notify} as one edits the other administrative
6440 files (@pxref{Intro administrative files}).  This
6441 file follows the usual conventions for administrative
6442 files (@pxref{syntax}), where each line is a regular
6443 expression followed by a command to execute.  The
6444 command should contain a single occurrence of @samp{%s}
6445 which will be replaced by the user to notify; the rest
6446 of the information regarding the notification will be
6447 supplied to the command on standard input.  The
6448 standard thing to put in the @code{notify} file is the
6449 single line:
6450
6451 @example
6452 ALL mail %s -s "CVS notification"
6453 @end example
6454
6455 @noindent
6456 This causes users to be notified by electronic mail.
6457 @c FIXME: should it be this hard to set up this
6458 @c behavior (and the result when one fails to do so,
6459 @c silent failure to notify, so non-obvious)?  Should
6460 @c CVS give a warning if no line in notify matches (and
6461 @c document the use of "DEFAULT :" for the case where
6462 @c skipping the notification is indeed desired)?
6463
6464 @cindex users (admin file)
6465 Note that if you set this up in the straightforward
6466 way, users receive notifications on the server machine.
6467 One could of course write a @file{notify} script which
6468 directed notifications elsewhere, but to make this
6469 easy, @sc{cvs} allows you to associate a notification
6470 address for each user.  To do so create a file
6471 @file{users} in @file{CVSROOT} with a line for each
6472 user in the format @var{user}:@var{value}.  Then
6473 instead of passing the name of the user to be notified
6474 to @file{notify}, @sc{cvs} will pass the @var{value}
6475 (normally an email address on some other machine).
6476
6477 @sc{cvs} does not notify you for your own changes.
6478 Currently this check is done based on whether the user
6479 name of the person taking the action which triggers
6480 notification matches the user name of the person
6481 getting notification.  In fact, in general, the watches
6482 features only track one edit by each user.  It probably
6483 would be more useful if watches tracked each working
6484 directory separately, so this behavior might be worth
6485 changing.
6486 @c "behavior might be worth changing" is an effort to
6487 @c point to future directions while also not promising
6488 @c that "they" (as in "why don't they fix CVS to....")
6489 @c will do this.
6490 @c one implementation issue is identifying whether a
6491 @c working directory is same or different.  Comparing
6492 @c pathnames/hostnames is hopeless, but having the server
6493 @c supply a serial number which the client stores in the
6494 @c CVS directory as a magic cookie should work.
6495
6496 @node Editing files
6497 @subsection How to edit a file which is being watched
6498
6499 @cindex Checkout, as term for getting ready to edit
6500 Since a file which is being watched is checked out
6501 read-only, you cannot simply edit it.  To make it
6502 read-write, and inform others that you are planning to
6503 edit it, use the @code{cvs edit} command.  Some systems
6504 call this a @dfn{checkout}, but @sc{cvs} uses that term
6505 for obtaining a copy of the sources (@pxref{Getting the
6506 source}), an operation which those systems call a
6507 @dfn{get} or a @dfn{fetch}.
6508 @c Issue to think about: should we transition CVS
6509 @c towards the "get" terminology?  "cvs get" is already a
6510 @c synonym for "cvs checkout" and that section of the
6511 @c manual refers to "Getting the source".  If this is
6512 @c done, needs to be done gingerly (for example, we should
6513 @c still accept "checkout" in .cvsrc files indefinitely
6514 @c even if the CVS's messages are changed from "cvs checkout: "
6515 @c to "cvs get: ").
6516 @c There is a concern about whether "get" is not as
6517 @c good for novices because it is a more general term
6518 @c than "checkout" (and thus arguably harder to assign
6519 @c a technical meaning for).
6520
6521 @cindex edit (subcommand)
6522 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6523
6524 Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6525 @var{files} read-write, and notifies users who have requested
6526 @code{edit} notification for any of @var{files}.
6527
6528 The @code{cvs edit} command accepts the same options as the
6529 @code{cvs watch add} command, and establishes a temporary watch for the
6530 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6531 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
6532 receive notifications, she should specify @code{-a none}.
6533
6534 The @var{files} and the options are processed as for the @code{cvs
6535 watch} commands.
6536
6537 @ignore
6538 @strong{Caution: If the @code{PreservePermissions}
6539 option is enabled in the repository (@pxref{config}),
6540 @sc{cvs} will not change the permissions on any of the
6541 @var{files}.  The reason for this change is to ensure
6542 that using @samp{cvs edit} does not interfere with the
6543 ability to store file permissions in the @sc{cvs}
6544 repository.}
6545 @end ignore
6546
6547 @end deffn
6548
6549 Normally when you are done with a set of changes, you
6550 use the @code{cvs commit} command, which checks in your
6551 changes and returns the watched files to their usual
6552 read-only state.  But if you instead decide to abandon
6553 your changes, or not to make any changes, you can use
6554 the @code{cvs unedit} command.
6555
6556 @cindex unedit (subcommand)
6557 @cindex Abandoning work
6558 @cindex Reverting to repository version
6559 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6560
6561 Abandon work on the working files @var{files}, and revert them to the
6562 repository versions on which they are based.  @sc{cvs} makes those
6563 @var{files} read-only for which users have requested notification using
6564 @code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6565 notification for any of @var{files}.
6566
6567 The @var{files} and options are processed as for the
6568 @code{cvs watch} commands.
6569
6570 If watches are not in use, the @code{unedit} command
6571 probably does not work, and the way to revert to the
6572 repository version is with the command @code{cvs update -C file}
6573 (@pxref{update}).
6574 The meaning is
6575 not precisely the same; the latter may also
6576 bring in some changes which have been made in the
6577 repository since the last time you updated.
6578 @c It would be a useful enhancement to CVS to make
6579 @c unedit work in the non-watch case as well.
6580 @end deffn
6581
6582 When using client/server @sc{cvs}, you can use the
6583 @code{cvs edit} and @code{cvs unedit} commands even if
6584 @sc{cvs} is unable to successfully communicate with the
6585 server; the notifications will be sent upon the next
6586 successful @sc{cvs} command.
6587
6588 @node Watch information
6589 @subsection Information about who is watching and editing
6590
6591 @cindex watchers (subcommand)
6592 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6593
6594 List the users currently watching changes to @var{files}.  The report
6595 includes the files being watched, and the mail address of each watcher.
6596
6597 The @var{files} and options are processed as for the
6598 @code{cvs watch} commands.
6599
6600 @end deffn
6601
6602
6603 @cindex editors (subcommand)
6604 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6605
6606 List the users currently working on @var{files}.  The report
6607 includes the mail address of each user, the time when the user began
6608 working with the file, and the host and path of the working directory
6609 containing the file.
6610
6611 The @var{files} and options are processed as for the
6612 @code{cvs watch} commands.
6613
6614 @end deffn
6615
6616 @node Watches Compatibility
6617 @subsection Using watches with old versions of CVS
6618
6619 @cindex CVS 1.6, and watches
6620 If you use the watch features on a repository, it
6621 creates @file{CVS} directories in the repository and
6622 stores the information about watches in that directory.
6623 If you attempt to use @sc{cvs} 1.6 or earlier with the
6624 repository, you get an error message such as the
6625 following (all on one line):
6626
6627 @example
6628 cvs update: cannot open CVS/Entries for reading:
6629 No such file or directory
6630 @end example
6631
6632 @noindent
6633 and your operation will likely be aborted.  To use the
6634 watch features, you must upgrade all copies of @sc{cvs}
6635 which use that repository in local or server mode.  If
6636 you cannot upgrade, use the @code{watch off} and
6637 @code{watch remove} commands to remove all watches, and
6638 that will restore the repository to a state which
6639 @sc{cvs} 1.6 can cope with.
6640
6641 @node Choosing a model
6642 @section Choosing between reserved or unreserved checkouts
6643 @cindex Choosing, reserved or unreserved checkouts
6644
6645 Reserved and unreserved checkouts each have pros and
6646 cons.  Let it be said that a lot of this is a matter of
6647 opinion or what works given different groups' working
6648 styles, but here is a brief description of some of the
6649 issues.  There are many ways to organize a team of
6650 developers.  @sc{cvs} does not try to enforce a certain
6651 organization.  It is a tool that can be used in several
6652 ways.
6653
6654 Reserved checkouts can be very counter-productive.  If
6655 two persons want to edit different parts of a file,
6656 there may be no reason to prevent either of them from
6657 doing so.  Also, it is common for someone to take out a
6658 lock on a file, because they are planning to edit it,
6659 but then forget to release the lock.
6660
6661 @c "many groups"?  specifics?  cites to papers on this?
6662 @c some way to weasel-word it a bit more so we don't
6663 @c need facts :-)?
6664 People, especially people who are familiar with
6665 reserved checkouts, often wonder how often conflicts
6666 occur if unreserved checkouts are used, and how
6667 difficult they are to resolve.  The experience with
6668 many groups is that they occur rarely and usually are
6669 relatively straightforward to resolve.
6670
6671 The rarity of serious conflicts may be surprising, until one realizes
6672 that they occur only when two developers disagree on the proper design
6673 for a given section of code; such a disagreement suggests that the
6674 team has not been communicating properly in the first place.  In order
6675 to collaborate under @emph{any} source management regimen, developers
6676 must agree on the general design of the system; given this agreement,
6677 overlapping changes are usually straightforward to merge.
6678
6679 In some cases unreserved checkouts are clearly
6680 inappropriate.  If no merge tool exists for the kind of
6681 file you are managing (for example word processor files
6682 or files edited by Computer Aided Design programs), and
6683 it is not desirable to change to a program which uses a
6684 mergeable data format, then resolving conflicts is
6685 going to be unpleasant enough that you generally will
6686 be better off to simply avoid the conflicts instead, by
6687 using reserved checkouts.
6688
6689 The watches features described above in @ref{Watches}
6690 can be considered to be an intermediate model between
6691 reserved checkouts and unreserved checkouts.  When you
6692 go to edit a file, it is possible to find out who else
6693 is editing it.  And rather than having the system
6694 simply forbid both people editing the file, it can tell
6695 you what the situation is and let you figure out
6696 whether it is a problem in that particular case or not.
6697 Therefore, for some groups it can be considered the
6698 best of both the reserved checkout and unreserved
6699 checkout worlds.
6700
6701 @c ---------------------------------------------------------------------
6702 @node Revision management
6703 @chapter Revision management
6704 @cindex Revision management
6705
6706 @c -- This chapter could be expanded a lot.
6707 @c -- Experiences are very welcome!
6708
6709 If you have read this far, you probably have a pretty
6710 good grasp on what @sc{cvs} can do for you.  This
6711 chapter talks a little about things that you still have
6712 to decide.
6713
6714 If you are doing development on your own using @sc{cvs}
6715 you could probably skip this chapter.  The questions
6716 this chapter takes up become more important when more
6717 than one person is working in a repository.
6718
6719 @menu
6720 * When to commit::              Some discussion on the subject
6721 @end menu
6722
6723 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6724 @node When to commit
6725 @section When to commit?
6726 @cindex When to commit
6727 @cindex Committing, when to
6728 @cindex Policy
6729
6730 Your group should decide which policy to use regarding
6731 commits.  Several policies are possible, and as your
6732 experience with @sc{cvs} grows you will probably find
6733 out what works for you.
6734
6735 If you commit files too quickly you might commit files
6736 that do not even compile.  If your partner updates his
6737 working sources to include your buggy file, he will be
6738 unable to compile the code.  On the other hand, other
6739 persons will not be able to benefit from the
6740 improvements you make to the code if you commit very
6741 seldom, and conflicts will probably be more common.
6742
6743 It is common to only commit files after making sure
6744 that they can be compiled.  Some sites require that the
6745 files pass a test suite.  Policies like this can be
6746 enforced using the commitinfo file
6747 (@pxref{commitinfo}), but you should think twice before
6748 you enforce such a convention.  By making the
6749 development environment too controlled it might become
6750 too regimented and thus counter-productive to the real
6751 goal, which is to get software written.
6752
6753 @c ---------------------------------------------------------------------
6754 @node Keyword substitution
6755 @chapter Keyword substitution
6756 @cindex Keyword substitution
6757 @cindex Keyword expansion
6758 @cindex Identifying files
6759
6760 @comment   Be careful when editing this chapter.
6761 @comment   Remember that this file is kept under
6762 @comment   version control, so we must not accidentally
6763 @comment   include a valid keyword in the running text.
6764
6765 As long as you edit source files inside a working
6766 directory you can always find out the state of
6767 your files via @samp{cvs status} and @samp{cvs log}.
6768 But as soon as you export the files from your
6769 development environment it becomes harder to identify
6770 which revisions they are.
6771
6772 @sc{cvs} can use a mechanism known as @dfn{keyword
6773 substitution} (or @dfn{keyword expansion}) to help
6774 identifying the files.  Embedded strings of the form
6775 @code{$@var{keyword}$} and
6776 @code{$@var{keyword}:@dots{}$} in a file are replaced
6777 with strings of the form
6778 @code{$@var{keyword}:@var{value}$} whenever you obtain
6779 a new revision of the file.
6780
6781 @menu
6782 * Keyword list::                Keywords
6783 * Using keywords::              Using keywords
6784 * Avoiding substitution::       Avoiding substitution
6785 * Substitution modes::          Substitution modes
6786 * Log keyword::                 Problems with the $@splitrcskeyword{Log}$ keyword.
6787 @end menu
6788
6789 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6790 @node Keyword list
6791 @section Keyword List
6792 @cindex Keyword List
6793
6794 @c FIXME: need some kind of example here I think,
6795 @c perhaps in a
6796 @c "Keyword intro" node.  The intro in the "Keyword
6797 @c substitution" node itself seems OK, but to launch
6798 @c into a list of the keywords somehow seems too abrupt.
6799
6800 This is a list of the keywords:
6801
6802 @table @code
6803 @cindex Author keyword
6804 @item $@splitrcskeyword{Author}$
6805 The login name of the user who checked in the revision.
6806
6807 @cindex Date keyword
6808 @item $@splitrcskeyword{Date}$
6809 The date and time (UTC) the revision was checked in.
6810
6811 @cindex Header keyword
6812 @item $@splitrcskeyword{Header}$
6813 A standard header containing the full pathname of the
6814 @sc{rcs} file, the revision number, the date (UTC), the
6815 author, the state, and the locker (if locked).  Files
6816 will normally never be locked when you use @sc{cvs}.
6817
6818 @cindex Id keyword
6819 @item $@splitrcskeyword{Id}$
6820 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
6821 filename is without a path.
6822
6823 @cindex Name keyword
6824 @item $@splitrcskeyword{Name}$
6825 Tag name used to check out this file.  The keyword is
6826 expanded only if one checks out with an explicit tag
6827 name.  For example, when running the command @code{cvs
6828 co -r first}, the keyword expands to @samp{Name: first}.
6829
6830 @cindex Locker keyword
6831 @item $@splitrcskeyword{Locker}$
6832 The login name of the user who locked the revision
6833 (empty if not locked, which is the normal case unless
6834 @code{cvs admin -l} is in use).
6835
6836 @cindex Log keyword
6837 @item $@splitrcskeyword{Log}$
6838 The log message supplied during commit, preceded by a
6839 header containing the @sc{rcs} filename, the revision
6840 number, the author, and the date (UTC).  Existing log
6841 messages are @emph{not} replaced.  Instead, the new log
6842 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
6843 Each new line is prefixed with the same string which
6844 precedes the @code{$Log} keyword.  For example, if the
6845 file contains:
6846
6847 @example
6848   /* Here is what people have been up to:
6849    *
6850    * $@splitrcskeyword{Log}: frob.c,v $
6851    * Revision 1.1  1997/01/03 14:23:51  joe
6852    * Add the superfrobnicate option
6853    *
6854    */
6855 @end example
6856
6857 @noindent
6858 then additional lines which are added when expanding
6859 the @code{$Log} keyword will be preceded by @samp{   * }.
6860 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
6861 @dfn{comment leader} from the @sc{rcs} file is not used.
6862 The @code{$Log} keyword is useful for
6863 accumulating a complete change log in a source file,
6864 but for several reasons it can be problematic.
6865 @xref{Log keyword}.
6866
6867 @cindex RCSfile keyword
6868 @item $@splitrcskeyword{RCSfile}$
6869 The name of the RCS file without a path.
6870
6871 @cindex Revision keyword
6872 @item $@splitrcskeyword{Revision}$
6873 The revision number assigned to the revision.
6874
6875 @cindex Source keyword
6876 @item $@splitrcskeyword{Source}$
6877 The full pathname of the RCS file.
6878
6879 @cindex State keyword
6880 @item $@splitrcskeyword{State}$
6881 The state assigned to the revision.  States can be
6882 assigned with @code{cvs admin -s}---see @ref{admin options}.
6883
6884 @end table
6885
6886 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6887 @node Using keywords
6888 @section Using keywords
6889
6890 To include a keyword string you simply include the
6891 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
6892 file, and commit the file.  @sc{cvs} will automatically (Or,
6893 more accurately, as part of the update run that
6894 automatically happens after a commit.)
6895 expand the string as part of the commit operation.
6896
6897 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
6898 the source files so that it gets passed through to
6899 generated files.  For example, if you are managing
6900 computer program source code, you might include a
6901 variable which is initialized to contain that string.
6902 Or some C compilers may provide a @code{#pragma ident}
6903 directive.  Or a document management system might
6904 provide a way to pass a string through to generated
6905 files.
6906
6907 @c Would be nice to give an example, but doing this in
6908 @c portable C is not possible and the problem with
6909 @c picking any one language (VMS HELP files, Ada,
6910 @c troff, whatever) is that people use CVS for all
6911 @c kinds of files.
6912
6913 @cindex Ident (shell command)
6914 The @code{ident} command (which is part of the @sc{rcs}
6915 package) can be used to extract keywords and their
6916 values from a file.  This can be handy for text files,
6917 but it is even more useful for extracting keywords from
6918 binary files.
6919
6920 @example
6921 $ ident samp.c
6922 samp.c:
6923      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6924 $ gcc samp.c
6925 $ ident a.out
6926 a.out:
6927      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6928 @end example
6929
6930 @cindex What (shell command)
6931 S@sc{ccs} is another popular revision control system.
6932 It has a command, @code{what}, which is very similar to
6933 @code{ident} and used for the same purpose.  Many sites
6934 without @sc{rcs} have @sc{sccs}.  Since @code{what}
6935 looks for the character sequence @code{@@(#)} it is
6936 easy to include keywords that are detected by either
6937 command.  Simply prefix the keyword with the
6938 magic @sc{sccs} phrase, like this:
6939
6940 @example
6941 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
6942 @end example
6943
6944 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6945 @node Avoiding substitution
6946 @section Avoiding substitution
6947
6948 Keyword substitution has its disadvantages.  Sometimes
6949 you might want the literal text string
6950 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
6951 @sc{cvs} interpreting it as a keyword and expanding it
6952 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
6953
6954 There is unfortunately no way to selectively turn off
6955 keyword substitution.  You can use @samp{-ko}
6956 (@pxref{Substitution modes}) to turn off keyword
6957 substitution entirely.
6958
6959 In many cases you can avoid using keywords in
6960 the source, even though they appear in the final
6961 product.  For example, the source for this manual
6962 contains @samp{$@@asis@{@}Author$} whenever the text
6963 @samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
6964 and @code{troff} you can embed the null-character
6965 @code{\&} inside the keyword for a similar effect.
6966
6967 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6968 @node Substitution modes
6969 @section Substitution modes
6970 @cindex Keyword substitution, changing modes
6971 @cindex -k (keyword substitution)
6972 @cindex Kflag
6973
6974 @c FIXME: This could be made more coherent, by expanding it
6975 @c with more examples or something.
6976 Each file has a stored default substitution mode, and
6977 each working directory copy of a file also has a
6978 substitution mode.  The former is set by the @samp{-k}
6979 option to @code{cvs add} and @code{cvs admin}; the
6980 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
6981 checkout} or @code{cvs update}.  @code{cvs diff} also
6982 has a @samp{-k} option.  For some examples,
6983 see @ref{Binary files}, and @ref{Merging and keywords}.
6984 @c The fact that -A is overloaded to mean both reset
6985 @c sticky options and reset sticky tags/dates is
6986 @c somewhat questionable.  Perhaps there should be
6987 @c separate options to reset sticky options (e.g. -k
6988 @c A") and tags/dates (someone suggested -r HEAD could
6989 @c do this instead of setting a sticky tag of "HEAD"
6990 @c as in the status quo but I haven't thought much
6991 @c about that idea.  Of course -r .reset or something
6992 @c could be coined if this needs to be a new option).
6993 @c On the other hand, having -A mean "get things back
6994 @c into the state after a fresh checkout" has a certain
6995 @c appeal, and maybe there is no sufficient reason for
6996 @c creeping featurism in this area.
6997
6998 The modes available are:
6999
7000 @table @samp
7001 @item -kkv
7002 Generate keyword strings using the default form, e.g.
7003 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7004 keyword.
7005
7006 @item -kkvl
7007 Like @samp{-kkv}, except that a locker's name is always
7008 inserted if the given revision is currently locked.
7009 The locker's name is only relevant if @code{cvs admin
7010 -l} is in use.
7011
7012 @item -kk
7013 Generate only keyword names in keyword strings; omit
7014 their values.  For example, for the @code{Revision}
7015 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7016 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7017 is useful to ignore differences due to keyword
7018 substitution when comparing different revisions of a
7019 file (@pxref{Merging and keywords}).
7020
7021 @item -ko
7022 Generate the old keyword string, present in the working
7023 file just before it was checked in.  For example, for
7024 the @code{Revision} keyword, generate the string
7025 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7026 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7027 string appeared when the file was checked in.
7028
7029 @item -kb
7030 Like @samp{-ko}, but also inhibit conversion of line
7031 endings between the canonical form in which they are
7032 stored in the repository (linefeed only), and the form
7033 appropriate to the operating system in use on the
7034 client.  For systems, like unix, which use linefeed
7035 only to terminate lines, this is the same as
7036 @samp{-ko}.  For more information on binary files, see
7037 @ref{Binary files}.
7038
7039 @item -kv
7040 Generate only keyword values for keyword strings.  For
7041 example, for the @code{Revision} keyword, generate the string
7042 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7043 This can help generate files in programming languages
7044 where it is hard to strip keyword delimiters like
7045 @code{$@splitrcskeyword{Revision}: $} from a string.  However,
7046 further keyword substitution cannot be performed once
7047 the keyword names are removed, so this option should be
7048 used with care.
7049
7050 One often would like to use @samp{-kv} with @code{cvs
7051 export}---@pxref{export}.  But be aware that doesn't
7052 handle an export containing binary files correctly.
7053
7054 @end table
7055
7056 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7057 @node Log keyword
7058 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7059
7060 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7061 controversial.  As long as you are working on your
7062 development system the information is easily accessible
7063 even if you do not use the @code{$@splitrcskeyword{Log}$}
7064 keyword---just do a @code{cvs log}.  Once you export
7065 the file the history information might be useless
7066 anyhow.
7067
7068 A more serious concern is that @sc{cvs} is not good at
7069 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7070 merged onto the main trunk.  Conflicts often result
7071 from the merging operation.
7072 @c Might want to check whether the CVS implementation
7073 @c of RCS_merge has this problem the same way rcsmerge
7074 @c does.  I would assume so....
7075
7076 People also tend to "fix" the log entries in the file
7077 (correcting spelling mistakes and maybe even factual
7078 errors).  If that is done the information from
7079 @code{cvs log} will not be consistent with the
7080 information inside the file.  This may or may not be a
7081 problem in real life.
7082
7083 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7084 keyword should be inserted @emph{last} in the file, and
7085 not in the files header, if it is to be used at all.
7086 That way the long list of change messages will not
7087 interfere with everyday source file browsing.
7088
7089 @c ---------------------------------------------------------------------
7090 @node Tracking sources
7091 @chapter Tracking third-party sources
7092 @cindex Third-party sources
7093 @cindex Tracking sources
7094
7095 @c FIXME: Need discussion of added and removed files.
7096 @c FIXME: This doesn't really adequately introduce the
7097 @c concepts of "vendor" and "you".  They don't *have*
7098 @c to be separate organizations or separate people.
7099 @c We want a description which is somewhat more based on
7100 @c the technical issues of which sources go where, but
7101 @c also with enough examples of how this relates to
7102 @c relationships like customer-supplier, developer-QA,
7103 @c maintainer-contributor, or whatever, to make it
7104 @c seem concrete.
7105 If you modify a program to better fit your site, you
7106 probably want to include your modifications when the next
7107 release of the program arrives.  @sc{cvs} can help you with
7108 this task.
7109
7110 @cindex Vendor
7111 @cindex Vendor branch
7112 @cindex Branch, vendor-
7113 In the terminology used in @sc{cvs}, the supplier of the
7114 program is called a @dfn{vendor}.  The unmodified
7115 distribution from the vendor is checked in on its own
7116 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
7117 1.1.1 for this use.
7118
7119 When you modify the source and commit it, your revision
7120 will end up on the main trunk.  When a new release is
7121 made by the vendor, you commit it on the vendor branch
7122 and copy the modifications onto the main trunk.
7123
7124 Use the @code{import} command to create and update
7125 the vendor branch.  When you import a new file,
7126 the vendor branch is made the `head' revision, so
7127 anyone that checks out a copy of the file gets that
7128 revision.  When a local modification is committed it is
7129 placed on the main trunk, and made the `head'
7130 revision.
7131
7132 @menu
7133 * First import::                Importing for the first time
7134 * Update imports::              Updating with the import command
7135 * Reverting local changes::     Reverting to the latest vendor release
7136 * Binary files in imports::     Binary files require special handling
7137 * Keywords in imports::         Keyword substitution might be undesirable
7138 * Multiple vendor branches::    What if you get sources from several places?
7139 @end menu
7140
7141 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7142 @node First import
7143 @section Importing for the first time
7144 @cindex Importing modules
7145
7146 @c Should mention naming conventions for vendor tags,
7147 @c release tags, and perhaps directory names.
7148 Use the @code{import} command to check in the sources
7149 for the first time.  When you use the @code{import}
7150 command to track third-party sources, the @dfn{vendor
7151 tag} and @dfn{release tags} are useful.  The
7152 @dfn{vendor tag} is a symbolic name for the branch
7153 (which is always 1.1.1, unless you use the @samp{-b
7154 @var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7155 @dfn{release tags} are symbolic names for a particular
7156 release, such as @samp{FSF_0_04}.
7157
7158 @c I'm not completely sure this belongs here.  But
7159 @c we need to say it _somewhere_ reasonably obvious; it
7160 @c is a common misconception among people first learning CVS
7161 Note that @code{import} does @emph{not} change the
7162 directory in which you invoke it.  In particular, it
7163 does not set up that directory as a @sc{cvs} working
7164 directory; if you want to work with the sources import
7165 them first and then check them out into a different
7166 directory (@pxref{Getting the source}).
7167
7168 @cindex wdiff (import example)
7169 Suppose you have the sources to a program called
7170 @code{wdiff} in a directory @file{wdiff-0.04},
7171 and are going to make private modifications that you
7172 want to be able to use even when new releases are made
7173 in the future.  You start by importing the source to
7174 your repository:
7175
7176 @example
7177 $ cd wdiff-0.04
7178 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7179 @end example
7180
7181 The vendor tag is named @samp{FSF_DIST} in the above
7182 example, and the only release tag assigned is
7183 @samp{WDIFF_0_04}.
7184 @c FIXME: Need to say where fsf/wdiff comes from.
7185
7186 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7187 @node Update imports
7188 @section Updating with the import command
7189
7190 When a new release of the source arrives, you import it into the
7191 repository with the same @code{import} command that you used to set up
7192 the repository in the first place.  The only difference is that you
7193 specify a different release tag this time:
7194
7195 @example
7196 $ tar xfz wdiff-0.05.tar.gz
7197 $ cd wdiff-0.05
7198 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7199 @end example
7200
7201 For files that have not been modified locally, the newly created
7202 revision becomes the head revision.  If you have made local
7203 changes, @code{import} will warn you that you must merge the changes
7204 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7205
7206 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7207 @c "import"?  I think the assumption is that one has
7208 @c "wdiff fsf/wdiff" or some such in modules, but it
7209 @c would be better to not use modules in this example.
7210 @example
7211 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7212 @end example
7213
7214 @noindent
7215 The above command will check out the latest revision of
7216 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7217 since yesterday into the working copy.  If any conflicts arise during
7218 the merge they should be resolved in the normal way (@pxref{Conflicts
7219 example}).  Then, the modified files may be committed.
7220
7221 However, it is much better to use the two release tags rather than using
7222 a date on the branch as suggested above:
7223
7224 @example
7225 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7226 @end example
7227
7228 @noindent
7229 The reason this is better is that
7230 using a date, as suggested above, assumes that you do
7231 not import more than one release of a product per day.
7232 More importantly, using the release tags allows @sc{cvs} to detect files
7233 that were removed between the two vendor releases and mark them for
7234 removal.  Since @code{import} has no way to detect removed files, you
7235 should do a merge like this even if @code{import} doesn't tell you to.
7236
7237 @node Reverting local changes
7238 @section Reverting to the latest vendor release
7239
7240 You can also revert local changes completely and return
7241 to the latest vendor release by changing the `head'
7242 revision back to the vendor branch on all files.  For
7243 example, if you have a checked-out copy of the sources
7244 in @file{~/work.d/wdiff}, and you want to revert to the
7245 vendor's version for all the files in that directory,
7246 you would type:
7247
7248 @example
7249 $ cd ~/work.d/wdiff
7250 $ cvs admin -bFSF_DIST .
7251 @end example
7252
7253 @noindent
7254 You must specify the @samp{-bFSF_DIST} without any space
7255 after the @samp{-b}.  @xref{admin options}.
7256
7257 @node Binary files in imports
7258 @section How to handle binary files with cvs import
7259
7260 Use the @samp{-k} wrapper option to tell import which
7261 files are binary.  @xref{Wrappers}.
7262
7263 @node Keywords in imports
7264 @section How to handle keyword substitution with cvs import
7265
7266 The sources which you are importing may contain
7267 keywords (@pxref{Keyword substitution}).  For example,
7268 the vendor may use @sc{cvs} or some other system
7269 which uses similar keyword expansion syntax.  If you
7270 just import the files in the default fashion, then
7271 the keyword expansions supplied by the vendor will
7272 be replaced by keyword expansions supplied by your
7273 own copy of @sc{cvs}.  It may be more convenient to
7274 maintain the expansions supplied by the vendor, so
7275 that this information can supply information about
7276 the sources that you imported from the vendor.
7277
7278 To maintain the keyword expansions supplied by the
7279 vendor, supply the @samp{-ko} option to @code{cvs
7280 import} the first time you import the file.
7281 This will turn off keyword expansion
7282 for that file entirely, so if you want to be more
7283 selective you'll have to think about what you want
7284 and use the @samp{-k} option to @code{cvs update} or
7285 @code{cvs admin} as appropriate.
7286 @c Supplying -ko to import if the file already existed
7287 @c has no effect.  Not clear to me whether it should
7288 @c or not.
7289
7290 @node Multiple vendor branches
7291 @section Multiple vendor branches
7292
7293 All the examples so far assume that there is only one
7294 vendor from which you are getting sources.  In some
7295 situations you might get sources from a variety of
7296 places.  For example, suppose that you are dealing with
7297 a project where many different people and teams are
7298 modifying the software.  There are a variety of ways to
7299 handle this, but in some cases you have a bunch of
7300 source trees lying around and what you want to do more
7301 than anything else is just to all put them in @sc{cvs} so
7302 that you at least have them in one place.
7303
7304 For handling situations in which there may be more than
7305 one vendor, you may specify the @samp{-b} option to
7306 @code{cvs import}.  It takes as an argument the vendor
7307 branch to import to.  The default is @samp{-b 1.1.1}.
7308
7309 For example, suppose that there are two teams, the red
7310 team and the blue team, that are sending you sources.
7311 You want to import the red team's efforts to branch
7312 1.1.1 and use the vendor tag RED.  You want to import
7313 the blue team's efforts to branch 1.1.3 and use the
7314 vendor tag BLUE.  So the commands you might use are:
7315
7316 @example
7317 $ cvs import dir RED RED_1-0
7318 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7319 @end example
7320
7321 Note that if your vendor tag does not match your
7322 @samp{-b} option, @sc{cvs} will not detect this case!  For
7323 example,
7324
7325 @example
7326 $ cvs import -b 1.1.3 dir RED RED_1-0
7327 @end example
7328
7329 @noindent
7330 Be careful; this kind of mismatch is sure to sow
7331 confusion or worse.  I can't think of a useful purpose
7332 for the ability to specify a mismatch here, but if you
7333 discover such a use, don't.  @sc{cvs} is likely to make this
7334 an error in some future release.
7335
7336 @c Probably should say more about the semantics of
7337 @c multiple branches.  What about the default branch?
7338 @c What about joining (perhaps not as useful with
7339 @c multiple branches, or perhaps it is.  Either way
7340 @c should be mentioned).
7341
7342 @c I'm not sure about the best location for this.  In
7343 @c one sense, it might belong right after we've introduced
7344 @c CVS's basic version control model, because people need
7345 @c to figure out builds right away.  The current location
7346 @c is based on the theory that it kind of akin to the
7347 @c "Revision management" section.
7348 @node Builds
7349 @chapter How your build system interacts with CVS
7350 @cindex Builds
7351 @cindex make
7352
7353 As mentioned in the introduction, @sc{cvs} does not
7354 contain software for building your software from source
7355 code.  This section describes how various aspects of
7356 your build system might interact with @sc{cvs}.
7357
7358 @c Is there a way to discuss this without reference to
7359 @c tools other than CVS?  I'm not sure there is; I
7360 @c wouldn't think that people who learn CVS first would
7361 @c even have this concern.
7362 One common question, especially from people who are
7363 accustomed to @sc{rcs}, is how to make their build get
7364 an up to date copy of the sources.  The answer to this
7365 with @sc{cvs} is two-fold.  First of all, since
7366 @sc{cvs} itself can recurse through directories, there
7367 is no need to modify your @file{Makefile} (or whatever
7368 configuration file your build tool uses) to make sure
7369 each file is up to date.  Instead, just use two
7370 commands, first @code{cvs -q update} and then
7371 @code{make} or whatever the command is to invoke your
7372 build tool.  Secondly, you do not necessarily
7373 @emph{want} to get a copy of a change someone else made
7374 until you have finished your own work.  One suggested
7375 approach is to first update your sources, then
7376 implement, build and
7377 test the change you were thinking of, and then commit
7378 your sources (updating first if necessary).  By
7379 periodically (in between changes, using the approach
7380 just described) updating your entire tree, you ensure
7381 that your sources are sufficiently up to date.
7382
7383 @cindex Bill of materials
7384 One common need is to record which versions of which
7385 source files went into a particular build.  This kind
7386 of functionality is sometimes called @dfn{bill of
7387 materials} or something similar.  The best way to do
7388 this with @sc{cvs} is to use the @code{tag} command to
7389 record which versions went into a given build
7390 (@pxref{Tags}).
7391
7392 Using @sc{cvs} in the most straightforward manner
7393 possible, each developer will have a copy of the entire
7394 source tree which is used in a particular build.  If
7395 the source tree is small, or if developers are
7396 geographically dispersed, this is the preferred
7397 solution.  In fact one approach for larger projects is
7398 to break a project down into smaller
7399 @c I say subsystem instead of module because they may or
7400 @c may not use the modules file.
7401 separately-compiled subsystems, and arrange a way of
7402 releasing them internally so that each developer need
7403 check out only those subsystems which they are
7404 actively working on.
7405
7406 Another approach is to set up a structure which allows
7407 developers to have their own copies of some files, and
7408 for other files to access source files from a central
7409 location.  Many people have come up with some such a
7410 @c two such people are paul@sander.cupertino.ca.us (for
7411 @c a previous employer)
7412 @c and gtornblo@senet.abb.se (spicm and related tools),
7413 @c but as far as I know
7414 @c no one has nicely packaged or released such a system (or
7415 @c instructions for constructing one).
7416 system using features such as the symbolic link feature
7417 found in many operating systems, or the @code{VPATH}
7418 feature found in many versions of @code{make}.  One build
7419 tool which is designed to help with this kind of thing
7420 is Odin (see
7421 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7422 @c Should we be saying more about Odin?  Or how you use
7423 @c it with CVS?  Also, the Prime Time Freeware for Unix
7424 @c disk (see http://www.ptf.com/) has Odin (with a nice
7425 @c paragraph summarizing it on the web), so that might be a
7426 @c semi-"official" place to point people.
7427 @c
7428 @c Of course, many non-CVS systems have this kind of
7429 @c functionality, for example OSF's ODE
7430 @c (http://www.osf.org/ode/) or mk
7431 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7432 @c He has changed providers in the past; a search engine search
7433 @c for "Peter Ziobrzynski" probably won't get too many
7434 @c spurious hits :-).  A more stable URL might be
7435 @c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7436 @c there is any point in mentioning them here unless they
7437 @c can work with CVS.
7438
7439 @c ---------------------------------------------------------------------
7440 @node Special Files
7441 @chapter Special Files
7442
7443 @cindex Special files
7444 @cindex Device nodes
7445 @cindex Ownership, saving in CVS
7446 @cindex Permissions, saving in CVS
7447 @cindex Hard links
7448 @cindex Symbolic links
7449
7450 In normal circumstances, @sc{cvs} works only with regular
7451 files.  Every file in a project is assumed to be
7452 persistent; it must be possible to open, read and close
7453 them; and so on.  @sc{cvs} also ignores file permissions and
7454 ownerships, leaving such issues to be resolved by the
7455 developer at installation time.  In other words, it is
7456 not possible to "check in" a device into a repository;
7457 if the device file cannot be opened, @sc{cvs} will refuse to
7458 handle it.  Files also lose their ownerships and
7459 permissions during repository transactions.
7460
7461 @ignore
7462 If the configuration variable @code{PreservePermissions}
7463 (@pxref{config}) is set in the repository, @sc{cvs} will
7464 save the following file characteristics in the
7465 repository:
7466
7467 @itemize @bullet
7468 @item user and group ownership
7469 @item permissions
7470 @item major and minor device numbers
7471 @item symbolic links
7472 @item hard link structure
7473 @end itemize
7474
7475 Using the @code{PreservePermissions} option affects the
7476 behavior of @sc{cvs} in several ways.  First, some of the
7477 new operations supported by @sc{cvs} are not accessible to
7478 all users.  In particular, file ownership and special
7479 file characteristics may only be changed by the
7480 superuser.  When the @code{PreservePermissions}
7481 configuration variable is set, therefore, users will
7482 have to be `root' in order to perform @sc{cvs} operations.
7483
7484 When @code{PreservePermissions} is in use, some @sc{cvs}
7485 operations (such as @samp{cvs status}) will not
7486 recognize a file's hard link structure, and so will
7487 emit spurious warnings about mismatching hard links.
7488 The reason is that @sc{cvs}'s internal structure does not
7489 make it easy for these operations to collect all the
7490 necessary data about hard links, so they check for file
7491 conflicts with inaccurate data.
7492
7493 A more subtle difference is that @sc{cvs} considers a file
7494 to have changed only if its contents have changed
7495 (specifically, if the modification time of the working
7496 file does not match that of the repository's file).
7497 Therefore, if only the permissions, ownership or hard
7498 linkage have changed, or if a device's major or minor
7499 numbers have changed, @sc{cvs} will not notice.  In order to
7500 commit such a change to the repository, you must force
7501 the commit with @samp{cvs commit -f}.  This also means
7502 that if a file's permissions have changed and the
7503 repository file is newer than the working copy,
7504 performing @samp{cvs update} will silently change the
7505 permissions on the working copy.
7506
7507 Changing hard links in a @sc{cvs} repository is particularly
7508 delicate.  Suppose that file @file{foo} is linked to
7509 file @file{old}, but is later relinked to file
7510 @file{new}.  You can wind up in the unusual situation
7511 where, although @file{foo}, @file{old} and @file{new}
7512 have all had their underlying link patterns changed,
7513 only @file{foo} and @file{new} have been modified, so
7514 @file{old} is not considered a candidate for checking
7515 in.  It can be very easy to produce inconsistent
7516 results this way.  Therefore, we recommend that when it
7517 is important to save hard links in a repository, the
7518 prudent course of action is to @code{touch} any file
7519 whose linkage or status has changed since the last
7520 checkin.  Indeed, it may be wise to @code{touch *}
7521 before each commit in a directory with complex hard
7522 link structures.
7523
7524 It is worth noting that only regular files may
7525 be merged, for reasons that hopefully are obvious.  If
7526 @samp{cvs update} or @samp{cvs checkout -j} attempts to
7527 merge a symbolic link with a regular file, or two
7528 device files for different kinds of devices, @sc{cvs} will
7529 report a conflict and refuse to perform the merge.  At
7530 the same time, @samp{cvs diff} will not report any
7531 differences between these files, since no meaningful
7532 textual comparisons can be made on files which contain
7533 no text.
7534
7535 The @code{PreservePermissions} features do not work
7536 with client/server @sc{cvs}.  Another limitation is
7537 that hard links must be to other files within the same
7538 directory; hard links across directories are not
7539 supported.
7540 @end ignore
7541
7542 @c ---------------------------------------------------------------------
7543 @c ----- START MAN 1 -----
7544 @node CVS commands
7545 @appendix Guide to CVS commands
7546
7547 This appendix describes the overall structure of
7548 @sc{cvs} commands, and describes some commands in
7549 detail (others are described elsewhere; for a quick
7550 reference to @sc{cvs} commands, @pxref{Invoking CVS}).
7551 @c The idea is that we want to move the commands which
7552 @c are described here into the main body of the manual,
7553 @c in the process reorganizing the manual to be
7554 @c organized around what the user wants to do, not
7555 @c organized around CVS commands.
7556 @c
7557 @c Note that many users do expect a manual which is
7558 @c organized by command.  At least some users do.
7559 @c One good addition to the "organized by command"
7560 @c section (if any) would be "see also" links.
7561 @c The awk manual might be a good example; it has a
7562 @c reference manual which is more verbose than Invoking
7563 @c CVS but probably somewhat less verbose than CVS
7564 @c Commands.
7565
7566 @menu
7567 * Structure::                   Overall structure of CVS commands
7568 * Exit status::                 Indicating CVS's success or failure
7569 * ~/.cvsrc::                    Default options with the ~/.cvsrc file
7570 * Global options::              Options you give to the left of cvs_command
7571 * Common options::              Options you give to the right of cvs_command
7572 * admin::                       Administration
7573 * annotate::                    What revision modified each line of a file?
7574 * checkout::                    Checkout sources for editing
7575 * commit::                      Check files into the repository
7576 * diff::                        Show differences between revisions
7577 * export::                      Export sources from CVS, similar to checkout
7578 * history::                     Show status of files and users
7579 * import::                      Import sources into CVS, using vendor branches
7580 * log::                         Show log messages for files
7581 * rdiff::                       'patch' format diffs between releases
7582 * release::                     Indicate that a directory is no longer in use
7583 * update::                      Bring work tree in sync with repository
7584 @end menu
7585
7586 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7587 @node Structure
7588 @appendixsec Overall structure of CVS commands
7589 @cindex Structure
7590 @cindex CVS command structure
7591 @cindex Command structure
7592 @cindex Format of CVS commands
7593
7594 The overall format of all @sc{cvs} commands is:
7595
7596 @example
7597 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
7598 @end example
7599
7600 @table @code
7601 @item cvs
7602 The name of the @sc{cvs} program.
7603
7604 @item cvs_options
7605 Some options that affect all sub-commands of @sc{cvs}.  These are
7606 described below.
7607
7608 @item cvs_command
7609 One of several different sub-commands.  Some of the commands have
7610 aliases that can be used instead; those aliases are noted in the
7611 reference manual for that command.  There are only two situations
7612 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
7613 list of available commands, and @samp{cvs -v} displays version
7614 information on @sc{cvs} itself.
7615
7616 @item command_options
7617 Options that are specific for the command.
7618
7619 @item command_args
7620 Arguments to the commands.
7621 @end table
7622
7623 There is unfortunately some confusion between
7624 @code{cvs_options} and @code{command_options}.
7625 When given as a @code{cvs_option}, some options only
7626 affect some of the commands.  When given as a
7627 @code{command_option} it may have a different meaning, and
7628 be accepted by more commands.  In other words, do not
7629 take the above categorization too seriously.  Look at
7630 the documentation instead.
7631
7632 @node Exit status
7633 @appendixsec CVS's exit status
7634 @cindex Exit status, of CVS
7635
7636 @sc{cvs} can indicate to the calling environment whether it
7637 succeeded or failed by setting its @dfn{exit status}.
7638 The exact way of testing the exit status will vary from
7639 one operating system to another.  For example in a unix
7640 shell script the @samp{$?} variable will be 0 if the
7641 last command returned a successful exit status, or
7642 greater than 0 if the exit status indicated failure.
7643
7644 If @sc{cvs} is successful, it returns a successful status;
7645 if there is an error, it prints an error message and
7646 returns a failure status.  The one exception to this is
7647 the @code{cvs diff} command.  It will return a
7648 successful status if it found no differences, or a
7649 failure status if there were differences or if there
7650 was an error.  Because this behavior provides no good
7651 way to detect errors, in the future it is possible that
7652 @code{cvs diff} will be changed to behave like the
7653 other @sc{cvs} commands.
7654 @c It might seem like checking whether cvs -q diff
7655 @c produces empty or non-empty output can tell whether
7656 @c there were differences or not.  But it seems like
7657 @c there are cases with output but no differences
7658 @c (testsuite basica-8b).  It is not clear to me how
7659 @c useful it is for a script to be able to check
7660 @c whether there were differences.
7661 @c FIXCVS? In previous versions of CVS, cvs diff
7662 @c returned 0 for no differences, 1 for differences, or
7663 @c 2 for errors.  Is this behavior worth trying to
7664 @c bring back (but what does it mean for VMS?)?
7665
7666 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7667 @node ~/.cvsrc
7668 @appendixsec Default options and the ~/.cvsrc file
7669 @cindex .cvsrc file
7670 @cindex Option defaults
7671
7672 There are some @code{command_options} that are used so
7673 often that you might have set up an alias or some other
7674 means to make sure you always specify that option.  One
7675 example (the one that drove the implementation of the
7676 @file{.cvsrc} support, actually) is that many people find the
7677 default output of the @samp{diff} command to be very
7678 hard to read, and that either context diffs or unidiffs
7679 are much easier to understand.
7680
7681 The @file{~/.cvsrc} file is a way that you can add
7682 default options to @code{cvs_commands} within cvs,
7683 instead of relying on aliases or other shell scripts.
7684
7685 The format of the @file{~/.cvsrc} file is simple.  The
7686 file is searched for a line that begins with the same
7687 name as the @code{cvs_command} being executed.  If a
7688 match is found, then the remainder of the line is split
7689 up (at whitespace characters) into separate options and
7690 added to the command arguments @emph{before} any
7691 options from the command line.
7692
7693 If a command has two names (e.g., @code{checkout} and
7694 @code{co}), the official name, not necessarily the one
7695 used on the command line, will be used to match against
7696 the file.  So if this is the contents of the user's
7697 @file{~/.cvsrc} file:
7698
7699 @example
7700 log -N
7701 diff -uN
7702 rdiff -u
7703 update -Pd
7704 checkout -P
7705 release -d
7706 @end example
7707
7708 @noindent
7709 the command @samp{cvs checkout foo} would have the
7710 @samp{-P} option added to the arguments, as well as
7711 @samp{cvs co foo}.
7712
7713 With the example file above, the output from @samp{cvs
7714 diff foobar} will be in unidiff format.  @samp{cvs diff
7715 -c foobar} will provide context diffs, as usual.
7716 Getting "old" format diffs would be slightly more
7717 complicated, because @code{diff} doesn't have an option
7718 to specify use of the "old" format, so you would need
7719 @samp{cvs -f diff foobar}.
7720
7721 In place of the command name you can use @code{cvs} to
7722 specify global options (@pxref{Global options}).  For
7723 example the following line in @file{.cvsrc}
7724
7725 @example
7726 cvs -z6
7727 @end example
7728
7729 @noindent
7730 causes @sc{cvs} to use compression level 6.
7731
7732 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7733 @node Global options
7734 @appendixsec Global options
7735 @cindex Options, global
7736 @cindex Global options
7737 @cindex Left-hand options
7738
7739 The available @samp{cvs_options} (that are given to the
7740 left of @samp{cvs_command}) are:
7741
7742 @table @code
7743 @item --allow-root=@var{rootdir}
7744 Specify legal @sc{cvsroot} directory.  See
7745 @ref{Password authentication server}.
7746
7747 @cindex Authentication, stream
7748 @cindex Stream authentication
7749 @item -a
7750 Authenticate all communication between the client and
7751 the server.  Only has an effect on the @sc{cvs} client.
7752 As of this writing, this is only implemented when using
7753 a GSSAPI connection (@pxref{GSSAPI authenticated}).
7754 Authentication prevents certain sorts of attacks
7755 involving hijacking the active @sc{tcp} connection.
7756 Enabling authentication does not enable encryption.
7757
7758 @cindex RCSBIN, overriding
7759 @cindex Overriding RCSBIN
7760 @item -b @var{bindir}
7761 In @sc{cvs} 1.9.18 and older, this specified that
7762 @sc{rcs} programs are in the @var{bindir} directory.
7763 Current versions of @sc{cvs} do not run @sc{rcs}
7764 programs; for compatibility this option is accepted,
7765 but it does nothing.
7766
7767 @cindex TMPDIR, overriding
7768 @cindex Overriding TMPDIR
7769 @item -T @var{tempdir}
7770 Use @var{tempdir} as the directory where temporary files are
7771 located.  Overrides the setting of the @code{$TMPDIR} environment
7772 variable and any precompiled directory.  This parameter should be
7773 specified as an absolute pathname.
7774 (When running client/server, @samp{-T} affects only the local process;
7775 specifying @samp{-T} for the client has no effect on the server and
7776 vice versa.)
7777
7778 @cindex CVSROOT, overriding
7779 @cindex Overriding CVSROOT
7780 @item -d @var{cvs_root_directory}
7781 Use @var{cvs_root_directory} as the root directory
7782 pathname of the repository.  Overrides the setting of
7783 the @code{$CVSROOT} environment variable.  @xref{Repository}.
7784
7785 @cindex EDITOR, overriding
7786 @cindex Overriding EDITOR
7787 @item -e @var{editor}
7788 Use @var{editor} to enter revision log information.  Overrides the
7789 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
7790 environment variables.  For more information, see
7791 @ref{Committing your changes}.
7792
7793 @item -f
7794 Do not read the @file{~/.cvsrc} file.  This
7795 option is most often used because of the
7796 non-orthogonality of the @sc{cvs} option set.  For
7797 example, the @samp{cvs log} option @samp{-N} (turn off
7798 display of tag names) does not have a corresponding
7799 option to turn the display on.  So if you have
7800 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
7801 you may need to use @samp{-f} to show the tag names.
7802
7803 @item -H
7804 @itemx --help
7805 Display usage information about the specified @samp{cvs_command}
7806 (but do not actually execute the command).  If you don't specify
7807 a command name, @samp{cvs -H} displays overall help for
7808 @sc{cvs}, including a list of other help options.
7809 @c It seems to me it is better to document it this way
7810 @c rather than trying to update this documentation
7811 @c every time that we add a --help-foo option.  But
7812 @c perhaps that is confusing...
7813
7814 @cindex Read-only mode
7815 @item -n
7816 Do not change any files.  Attempt to execute the
7817 @samp{cvs_command}, but only to issue reports; do not remove,
7818 update, or merge any existing files, or create any new files.
7819
7820 Note that @sc{cvs} will not necessarily produce exactly
7821 the same output as without @samp{-n}.  In some cases
7822 the output will be the same, but in other cases
7823 @sc{cvs} will skip some of the processing that would
7824 have been required to produce the exact same output.
7825
7826 @item -Q
7827 Cause the command to be really quiet; the command will only
7828 generate output for serious problems.
7829
7830 @item -q
7831 Cause the command to be somewhat quiet; informational messages,
7832 such as reports of recursion through subdirectories, are
7833 suppressed.
7834
7835 @cindex Read-only files, and -r
7836 @item -r
7837 Make new working files read-only.  Same effect
7838 as if the @code{$CVSREAD} environment variable is set
7839 (@pxref{Environment variables}).  The default is to
7840 make working files writable, unless watches are on
7841 (@pxref{Watches}).
7842
7843 @item -s @var{variable}=@var{value}
7844 Set a user variable (@pxref{Variables}).
7845
7846 @cindex Trace
7847 @item -t
7848 Trace program execution; display messages showing the steps of
7849 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
7850 potential impact of an unfamiliar command.
7851
7852 @item -v
7853 @item --version
7854 Display version and copyright information for @sc{cvs}.
7855
7856 @cindex CVSREAD, overriding
7857 @cindex Overriding CVSREAD
7858 @item -w
7859 Make new working files read-write.  Overrides the
7860 setting of the @code{$CVSREAD} environment variable.
7861 Files are created read-write by default, unless @code{$CVSREAD} is
7862 set or @samp{-r} is given.
7863 @c Note that -w only overrides -r and CVSREAD; it has
7864 @c no effect on files which are readonly because of
7865 @c "cvs watch on".  My guess is that is the way it
7866 @c should be (or should "cvs -w get" on a watched file
7867 @c be the same as a get and a cvs edit?), but I'm not
7868 @c completely sure whether to document it this way.
7869
7870 @item -x
7871 @cindex Encryption
7872 Encrypt all communication between the client and the
7873 server.  Only has an effect on the @sc{cvs} client.  As
7874 of this writing, this is only implemented when using a
7875 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
7876 Kerberos connection (@pxref{Kerberos authenticated}).
7877 Enabling encryption implies that message traffic is
7878 also authenticated.  Encryption support is not
7879 available by default; it must be enabled using a
7880 special configure option, @file{--enable-encryption},
7881 when you build @sc{cvs}.
7882
7883 @item -z @var{gzip-level}
7884 @cindex Compression
7885 @cindex Gzip
7886 Set the compression level.
7887 Valid levels are 1 (high speed, low compression) to
7888 9 (low speed, high compression), or 0 to disable
7889 compression (the default).
7890 Only has an effect on the @sc{cvs} client.
7891
7892 @end table
7893
7894 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7895 @node Common options
7896 @appendixsec Common command options
7897 @cindex Common options
7898 @cindex Right-hand options
7899
7900 This section describes the @samp{command_options} that
7901 are available across several @sc{cvs} commands.  These
7902 options are always given to the right of
7903 @samp{cvs_command}. Not all
7904 commands support all of these options; each option is
7905 only supported for commands where it makes sense.
7906 However, when a command has one of these options you
7907 can almost always count on the same behavior of the
7908 option as in other commands.  (Other command options,
7909 which are listed with the individual commands, may have
7910 different behavior from one @sc{cvs} command to the other).
7911
7912 @strong{Note: the @samp{history} command is an exception; it supports
7913 many options that conflict even with these standard options.}
7914
7915 @table @code
7916 @cindex Dates
7917 @cindex Time
7918 @cindex Specifying dates
7919 @item -D @var{date_spec}
7920 Use the most recent revision no later than @var{date_spec}.
7921 @var{date_spec} is a single argument, a date description
7922 specifying a date in the past.
7923
7924 The specification is @dfn{sticky} when you use it to make a
7925 private copy of a source file; that is, when you get a working
7926 file using @samp{-D}, @sc{cvs} records the date you specified, so that
7927 further updates in the same directory will use the same date
7928 (for more information on sticky tags/dates, @pxref{Sticky tags}).
7929
7930 @samp{-D} is available with the @code{annotate}, @code{checkout},
7931 @code{diff}, @code{export}, @code{history},
7932 @code{rdiff}, @code{rtag}, and @code{update} commands.
7933 (The @code{history} command uses this option in a
7934 slightly different way; @pxref{history options}).
7935
7936 @c What other formats should we accept?  I don't want
7937 @c to start accepting a whole mess of non-standard
7938 @c new formats (there are a lot which are in wide use in
7939 @c one context or another), but practicality does
7940 @c dictate some level of flexibility.
7941 @c * POSIX.2 (e.g. touch, ls output, date) and other
7942 @c POSIX and/or de facto unix standards (e.g. at).  The
7943 @c practice here is too inconsistent to be of any use.
7944 @c * VMS dates.  This is not a formal standard, but
7945 @c there is a published specification (see SYS$ASCTIM
7946 @c and SYS$BINTIM in the _VMS System Services Reference
7947 @c Manual_), it is implemented consistently in VMS
7948 @c utilities, and VMS users will expect CVS running on
7949 @c VMS to support this format (and if we're going to do
7950 @c that, better to make CVS support it on all
7951 @c platforms.  Maybe).
7952 @c
7953 @c NOTE: The tar manual has some documentation for
7954 @c getdate.y (just for our info; we don't want to
7955 @c attempt to document all the formats accepted by
7956 @c getdate.y).
7957 @c
7958 @c One more note: In output, CVS should consistently
7959 @c use one date format, and that format should be one that
7960 @c it accepts in input as well.  The former isn't
7961 @c really true (see survey below), and I'm not
7962 @c sure that either of those formats is accepted in
7963 @c input.
7964 @c
7965 @c cvs log
7966 @c   current 1996/01/02 13:45:31
7967 @c   Internet 02 Jan 1996 13:45:31 UT
7968 @c   ISO 1996-01-02 13:45:31
7969 @c cvs ann
7970 @c   current 02-Jan-96
7971 @c   Internet-like 02 Jan 96
7972 @c   ISO 96-01-02
7973 @c cvs status
7974 @c   current Tue Jun 11 02:54:53 1996
7975 @c   Internet [Tue,] 11 Jun 1996 02:54:53
7976 @c   ISO 1996-06-11 02:54:53
7977 @c   note: date possibly should be omitted entirely for
7978 @c   other reasons.
7979 @c cvs editors
7980 @c   current Tue Jun 11 02:54:53 1996 GMT
7981 @c cvs history
7982 @c   current 06/11 02:54 +0000
7983 @c any others?
7984 @c There is a good chance the proper solution has to
7985 @c involve at least some level of letting the user
7986 @c decide which format (with the default being the
7987 @c formats CVS has always used; changing these might be
7988 @c _very_ disruptive since scripts may very well be
7989 @c parsing them).
7990 @c
7991 @c Another random bit of prior art concerning dates is
7992 @c the strptime function which takes templates such as
7993 @c "%m/%d/%y", and apparent a variant of getdate()
7994 @c which also honors them.  See
7995 @c X/Open CAE Specification, System Interfaces and
7996 @c Headers Issue 4, Version 2 (September 1994), in the
7997 @c entry for getdate() on page 231
7998
7999 @cindex Timezone, in input
8000 @cindex Zone, time, in input
8001 A wide variety of date formats are supported by
8002 @sc{cvs}.  The most standard ones are ISO8601 (from the
8003 International Standards Organization) and the Internet
8004 e-mail standard (specified in RFC822 as amended by
8005 RFC1123).
8006
8007 @c Probably should be doing more to spell out just what
8008 @c the rules are, rather than just giving examples.
8009 @c But I want to keep this simple too.
8010 @c So I don't know....
8011 @c A few specific issues: (1) Maybe should reassure
8012 @c people that years after 2000
8013 @c work (they are in the testsuite, so they do indeed
8014 @c work).  (2) What do two digit years
8015 @c mean?  Where do we accept them?  (3) Local times can
8016 @c be ambiguous or nonexistent if they fall during the
8017 @c hour when daylight savings time goes into or out of
8018 @c effect.  Pretty obscure, so I'm not at all sure we
8019 @c should be documenting the behavior in that case.
8020 ISO8601 dates have many variants but a few examples
8021 are:
8022
8023 @example
8024 1972-09-24
8025 1972-09-24 20:05
8026 @end example
8027 @c I doubt we really accept all ISO8601 format dates
8028 @c (for example, decimal hours like 1972-09-24 20,2)
8029 @c I'm not sure we should, many of them are pretty
8030 @c bizarre and it has lots of gratuitous multiple ways
8031 @c to specify the same thing.
8032
8033 There are a lot more ISO8601 date formats, and @sc{cvs}
8034 accepts many of them, but you probably don't want to
8035 hear the @emph{whole} long story :-).
8036
8037 @c Citing a URL here is kind of problematic given how
8038 @c much they change and people who have old versions of
8039 @c this manual, but in case we want to reinstate an
8040 @c ISO8601 URL, a few are:
8041 @c http://www.saqqara.demon.co.uk/datefmt.htm
8042 @c http://www.cl.cam.ac.uk/~mgk25/iso-time.html
8043 @c Citing some other ISO8601 source is probably even
8044 @c worse :-).
8045
8046 In addition to the dates allowed in Internet e-mail
8047 itself, @sc{cvs} also allows some of the fields to be
8048 omitted.  For example:
8049 @c FIXME: Need to figure out better, and document,
8050 @c what we want to allow the user to omit.
8051 @c NOTE: "omit" does not imply "reorder".
8052 @c FIXME: Need to cite a web page describing how to get
8053 @c RFC's.
8054
8055 @example
8056 24 Sep 1972 20:05
8057 24 Sep
8058 @end example
8059
8060 The date is interpreted as being in the
8061 local timezone, unless a specific timezone is
8062 specified.
8063
8064 These two date formats are preferred.  However,
8065 @sc{cvs} currently accepts a wide variety of other date
8066 formats.  They are intentionally not documented here in
8067 any detail, and future versions of @sc{cvs} might not
8068 accept all of them.
8069 @c We should document and testsuite "now" and
8070 @c "yesterday".  "now" is mentioned in the FAQ and
8071 @c "yesterday" is mentioned in this document (and the
8072 @c message from "cvs import" suggesting a merge
8073 @c command).  What else?  Probably some/all of the "3
8074 @c weeks ago" family.
8075 @c
8076 @c Maybe at
8077 @c some point have CVS start give warnings on "unofficial"
8078 @c formats (many of which might be typos or user
8079 @c misunderstandings, and/or formats people never/rarely
8080 @c use to specify dates)?
8081
8082 One such format is
8083 @code{@var{month}/@var{day}/@var{year}}.  This may
8084 confuse people who are accustomed to having the month
8085 and day in the other order; @samp{1/4/96} is January 4,
8086 not April 1.
8087
8088 Remember to quote the argument to the @samp{-D}
8089 flag so that your shell doesn't interpret spaces as
8090 argument separators.  A command using the @samp{-D}
8091 flag can look like this:
8092
8093 @example
8094 $ cvs diff -D "1 hour ago" cvs.texinfo
8095 @end example
8096
8097 @cindex Forcing a tag match
8098 @item -f
8099 When you specify a particular date or tag to @sc{cvs} commands, they
8100 normally ignore files that do not contain the tag (or did not
8101 exist prior to the date) that you specified.  Use the @samp{-f} option
8102 if you want files retrieved even when there is no match for the
8103 tag or date.  (The most recent revision of the file
8104 will be used).
8105
8106 Note that even with @samp{-f}, a tag that you specify
8107 must exist (that is, in some file, not necessary in
8108 every file).  This is so that @sc{cvs} will continue to
8109 give an error if you mistype a tag name.
8110
8111 @need 800
8112 @samp{-f} is available with these commands:
8113 @code{annotate}, @code{checkout}, @code{export},
8114 @code{rdiff}, @code{rtag}, and @code{update}.
8115
8116 @strong{WARNING:  The @code{commit} and @code{remove}
8117 commands also have a
8118 @samp{-f} option, but it has a different behavior for
8119 those commands.  See @ref{commit options}, and
8120 @ref{Removing files}.}
8121
8122 @item -k @var{kflag}
8123 Alter the default processing of keywords.
8124 @xref{Keyword substitution}, for the meaning of
8125 @var{kflag}.  Your @var{kflag} specification is
8126 @dfn{sticky} when you use it to create a private copy
8127 of a source file; that is, when you use this option
8128 with the @code{checkout} or @code{update} commands,
8129 @sc{cvs} associates your selected @var{kflag} with the
8130 file, and continues to use it with future update
8131 commands on the same file until you specify otherwise.
8132
8133 The @samp{-k} option is available with the @code{add},
8134 @code{checkout}, @code{diff}, @code{import} and
8135 @code{update} commands.
8136
8137 @item -l
8138 Local; run only in current working directory, rather than
8139 recursing through subdirectories.
8140
8141 Available with the following commands: @code{annotate}, @code{checkout},
8142 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8143 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8144 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8145 and @code{watchers}.
8146
8147 @cindex Editor, avoiding invocation of
8148 @cindex Avoiding editor invocation
8149 @item -m @var{message}
8150 Use @var{message} as log information, instead of
8151 invoking an editor.
8152
8153 Available with the following commands: @code{add},
8154 @code{commit} and @code{import}.
8155
8156 @item -n
8157 Do not run any tag program.  (A program can be
8158 specified to run in the modules
8159 database (@pxref{modules}); this option bypasses it).
8160
8161 @strong{Note: this is not the same as the @samp{cvs -n}
8162 program option, which you can specify to the left of a cvs command!}
8163
8164 Available with the @code{checkout}, @code{commit}, @code{export},
8165 and @code{rtag} commands.
8166
8167 @item -P
8168 Prune empty directories.  See @ref{Removing directories}.
8169
8170 @item -p
8171 Pipe the files retrieved from the repository to standard output,
8172 rather than writing them in the current directory.  Available
8173 with the @code{checkout} and @code{update} commands.
8174
8175 @item -R
8176 Process directories recursively.  This is on by default.
8177
8178 Available with the following commands: @code{annotate}, @code{checkout},
8179 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8180 @code{rdiff}, @code{remove}, @code{rtag},
8181 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8182 and @code{watchers}.
8183
8184 @item -r @var{tag}
8185 @cindex HEAD, special tag
8186 @cindex BASE, special tag
8187 Use the revision specified by the @var{tag} argument instead of the
8188 default @dfn{head} revision.  As well as arbitrary tags defined
8189 with the @code{tag} or @code{rtag} command, two special tags are
8190 always available: @samp{HEAD} refers to the most recent version
8191 available in the repository, and @samp{BASE} refers to the
8192 revision you last checked out into the current working directory.
8193
8194 @c FIXME: What does HEAD really mean?  I believe that
8195 @c the current answer is the head of the default branch
8196 @c for all cvs commands except diff.  For diff, it
8197 @c seems to be (a) the head of the trunk (or the default
8198 @c branch?) if there is no sticky tag, (b) the head of the
8199 @c branch for the sticky tag, if there is a sticky tag.
8200 @c (b) is ugly as it differs
8201 @c from what HEAD means for other commands, but people
8202 @c and/or scripts are quite possibly used to it.
8203 @c See "head" tests in sanity.sh.
8204 @c Probably the best fix is to introduce two new
8205 @c special tags, ".thead" for the head of the trunk,
8206 @c and ".bhead" for the head of the current branch.
8207 @c Then deprecate HEAD.  This has the advantage of
8208 @c not surprising people with a change to HEAD, and a
8209 @c side benefit of also phasing out the poorly-named
8210 @c HEAD (see discussion of reserved tag names in node
8211 @c "Tags").  Of course, .thead and .bhead should be
8212 @c carefully implemented (with the implementation the
8213 @c same for "diff" as for everyone else), test cases
8214 @c written (similar to the ones in "head"), new tests
8215 @c cases written for things like default branches, &c.
8216
8217 The tag specification is sticky when you use this
8218 @c option
8219 with @code{checkout} or @code{update} to make your own
8220 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8221 future update commands, until you specify otherwise (for more information
8222 on sticky tags/dates, @pxref{Sticky tags}).
8223
8224 The tag can be either a symbolic or numeric tag, as
8225 described in @ref{Tags}, or the name of a branch, as
8226 described in @ref{Branching and merging}.
8227
8228 Specifying the @samp{-q} global option along with the
8229 @samp{-r} command option is often useful, to suppress
8230 the warning messages when the @sc{rcs} file
8231 does not contain the specified tag.
8232
8233 @strong{Note: this is not the same as the overall @samp{cvs -r} option,
8234 which you can specify to the left of a @sc{cvs} command!}
8235
8236 @samp{-r} is available with the @code{checkout}, @code{commit},
8237 @code{diff}, @code{history}, @code{export}, @code{rdiff},
8238 @code{rtag}, and @code{update} commands.
8239
8240 @item -W
8241 Specify file names that should be filtered.  You can
8242 use this option repeatedly.  The spec can be a file
8243 name pattern of the same type that you can specify in
8244 the @file{.cvswrappers} file.
8245 Available with the following commands: @code{import},
8246 and @code{update}.
8247
8248 @end table
8249
8250 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8251 @node admin
8252 @appendixsec admin---Administration
8253 @cindex Admin (subcommand)
8254
8255 @itemize @bullet
8256 @item
8257 Requires: repository, working directory.
8258 @item
8259 Changes: repository.
8260 @item
8261 Synonym: rcs
8262 @end itemize
8263
8264 This is the @sc{cvs} interface to assorted
8265 administrative facilities.  Some of them have
8266 questionable usefulness for @sc{cvs} but exist for
8267 historical purposes.  Some of the questionable options
8268 are likely to disappear in the future.  This command
8269 @emph{does} work recursively, so extreme care should be
8270 used.
8271
8272 @cindex cvsadmin
8273 On unix, if there is a group named @code{cvsadmin},
8274 only members of that group can run @code{cvs admin}
8275 (except for the @code{cvs admin -k} command, which can
8276 be run by anybody).  This group should exist on the
8277 server, or any system running the non-client/server
8278 @sc{cvs}.  To disallow @code{cvs admin} for all users,
8279 create a group with no users in it.  On NT, the
8280 @code{cvsadmin} feature does not exist and all users
8281 can run @code{cvs admin}.
8282
8283 @menu
8284 * admin options::               admin options
8285 @end menu
8286
8287 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8288 @node admin options
8289 @appendixsubsec admin options
8290
8291 Some of these options have questionable usefulness for
8292 @sc{cvs} but exist for historical purposes.  Some even
8293 make it impossible to use @sc{cvs} until you undo the
8294 effect!
8295
8296 @table @code
8297 @item -A@var{oldfile}
8298 Might not work together with @sc{cvs}.  Append the
8299 access list of @var{oldfile} to the access list of the
8300 @sc{rcs} file.
8301
8302 @item -a@var{logins}
8303 Might not work together with @sc{cvs}.  Append the
8304 login names appearing in the comma-separated list
8305 @var{logins} to the access list of the @sc{rcs} file.
8306
8307 @item -b[@var{rev}]
8308 Set the default branch to @var{rev}.  In @sc{cvs}, you
8309 normally do not manipulate default branches; sticky
8310 tags (@pxref{Sticky tags}) are a better way to decide
8311 which branch you want to work on.  There is one reason
8312 to run @code{cvs admin -b}: to revert to the vendor's
8313 version when using vendor branches (@pxref{Reverting
8314 local changes}).
8315 There can be no space between @samp{-b} and its argument.
8316 @c Hmm, we don't document the usage where rev is
8317 @c omitted.  Maybe that usage can/should be deprecated
8318 @c (and replaced with -bHEAD or something?) (so we can toss
8319 @c the optional argument).  Note that -bHEAD does not
8320 @c work, as of 17 Sep 1997, but probably will once "cvs
8321 @c admin" is internal to CVS.
8322
8323 @cindex Comment leader
8324 @item -c@var{string}
8325 Sets the comment leader to @var{string}.  The comment
8326 leader is not used by current versions of @sc{cvs} or
8327 @sc{rcs} 5.7.  Therefore, you can almost surely not
8328 worry about it.  @xref{Keyword substitution}.
8329
8330 @item -e[@var{logins}]
8331 Might not work together with @sc{cvs}.  Erase the login
8332 names appearing in the comma-separated list
8333 @var{logins} from the access list of the RCS file.  If
8334 @var{logins} is omitted, erase the entire access list.
8335 There can be no space between @samp{-e} and its argument.
8336
8337 @item -I
8338 Run interactively, even if the standard input is not a
8339 terminal.  This option does not work with the
8340 client/server @sc{cvs} and is likely to disappear in
8341 a future release of @sc{cvs}.
8342
8343 @item -i
8344 Useless with @sc{cvs}.  This creates and initializes a
8345 new @sc{rcs} file, without depositing a revision.  With
8346 @sc{cvs}, add files with the @code{cvs add} command
8347 (@pxref{Adding files}).
8348
8349 @item -k@var{subst}
8350 Set the default keyword
8351 substitution to @var{subst}.  @xref{Keyword
8352 substitution}.  Giving an explicit @samp{-k} option to
8353 @code{cvs update}, @code{cvs export}, or @code{cvs
8354 checkout} overrides this default.
8355
8356 @item -l[@var{rev}]
8357 Lock the revision with number @var{rev}.  If a branch
8358 is given, lock the latest revision on that branch.  If
8359 @var{rev} is omitted, lock the latest revision on the
8360 default branch.  There can be no space between
8361 @samp{-l} and its argument.
8362
8363 This can be used in conjunction with the
8364 @file{rcslock.pl} script in the @file{contrib}
8365 directory of the @sc{cvs} source distribution to
8366 provide reserved checkouts (where only one user can be
8367 editing a given file at a time).  See the comments in
8368 that file for details (and see the @file{README} file
8369 in that directory for disclaimers about the unsupported
8370 nature of contrib).  According to comments in that
8371 file, locking must set to strict (which is the default).
8372
8373 @item -L
8374 Set locking to strict.  Strict locking means that the
8375 owner of an RCS file is not exempt from locking for
8376 checkin.  For use with @sc{cvs}, strict locking must be
8377 set; see the discussion under the @samp{-l} option above.
8378
8379 @cindex Changing a log message
8380 @cindex Replacing a log message
8381 @cindex Correcting a log message
8382 @cindex Fixing a log message
8383 @cindex Log message, correcting
8384 @item -m@var{rev}:@var{msg}
8385 Replace the log message of revision @var{rev} with
8386 @var{msg}.
8387
8388 @c The rcs -M option, to suppress sending mail, has never been
8389 @c documented as a cvs admin option.
8390
8391 @item -N@var{name}[:[@var{rev}]]
8392 Act like @samp{-n}, except override any previous
8393 assignment of @var{name}.  For use with magic branches,
8394 see @ref{Magic branch numbers}.
8395
8396 @item -n@var{name}[:[@var{rev}]]
8397 Associate the symbolic name @var{name} with the branch
8398 or revision @var{rev}.  It is normally better to use
8399 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8400 symbolic name if both @samp{:} and @var{rev} are
8401 omitted; otherwise, print an error message if
8402 @var{name} is already associated with another number.
8403 If @var{rev} is symbolic, it is expanded before
8404 association.  A @var{rev} consisting of a branch number
8405 followed by a @samp{.} stands for the current latest
8406 revision in the branch.  A @samp{:} with an empty
8407 @var{rev} stands for the current latest revision on the
8408 default branch, normally the trunk.  For example,
8409 @samp{cvs admin -n@var{name}:} associates @var{name} with the
8410 current latest revision of all the RCS files;
8411 this contrasts with @samp{cvs admin -n@var{name}:$} which
8412 associates @var{name} with the revision numbers
8413 extracted from keyword strings in the corresponding
8414 working files.
8415
8416 @cindex Deleting revisions
8417 @cindex Outdating revisions
8418 @cindex Saving space
8419 @item -o@var{range}
8420 Deletes (@dfn{outdates}) the revisions given by
8421 @var{range}.
8422
8423 Note that this command can be quite dangerous unless
8424 you know @emph{exactly} what you are doing (for example
8425 see the warnings below about how the
8426 @var{rev1}:@var{rev2} syntax is confusing).
8427
8428 If you are short on disc this option might help you.
8429 But think twice before using it---there is no way short
8430 of restoring the latest backup to undo this command!
8431 If you delete different revisions than you planned,
8432 either due to carelessness or (heaven forbid) a @sc{cvs}
8433 bug, there is no opportunity to correct the error
8434 before the revisions are deleted.  It probably would be
8435 a good idea to experiment on a copy of the repository
8436 first.
8437
8438 Specify @var{range} in one of the following ways:
8439
8440 @table @code
8441 @item @var{rev1}::@var{rev2}
8442 Collapse all revisions between rev1 and rev2, so that
8443 @sc{cvs} only stores the differences associated with going
8444 from rev1 to rev2, not intermediate steps.  For
8445 example, after @samp{-o 1.3::1.5} one can retrieve
8446 revision 1.3, revision 1.5, or the differences to get
8447 from 1.3 to 1.5, but not the revision 1.4, or the
8448 differences between 1.3 and 1.4.  Other examples:
8449 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8450 effect, because there are no intermediate revisions to
8451 remove.
8452
8453 @item ::@var{rev}
8454 Collapse revisions between the beginning of the branch
8455 containing @var{rev} and @var{rev} itself.  The
8456 branchpoint and @var{rev} are left intact.  For
8457 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8458 revision 1.3.2.5, and everything in between, but leaves
8459 1.3 and 1.3.2.6 intact.
8460
8461 @item @var{rev}::
8462 Collapse revisions between @var{rev} and the end of the
8463 branch containing @var{rev}.  Revision @var{rev} is
8464 left intact but the head revision is deleted.
8465
8466 @item @var{rev}
8467 Delete the revision @var{rev}.  For example, @samp{-o
8468 1.3} is equivalent to @samp{-o 1.2::1.4}.
8469
8470 @item @var{rev1}:@var{rev2}
8471 Delete the revisions from @var{rev1} to @var{rev2},
8472 inclusive, on the same branch.  One will not be able to
8473 retrieve @var{rev1} or @var{rev2} or any of the
8474 revisions in between.  For example, the command
8475 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8476 It means to delete revisions up to, and including, the
8477 tag R_1_02.  But beware!  If there are files that have not
8478 changed between R_1_02 and R_1_03 the file will have
8479 @emph{the same} numerical revision number assigned to
8480 the tags R_1_02 and R_1_03.  So not only will it be
8481 impossible to retrieve R_1_02; R_1_03 will also have to
8482 be restored from the tapes!  In most cases you want to
8483 specify @var{rev1}::@var{rev2} instead.
8484
8485 @item :@var{rev}
8486 Delete revisions from the beginning of the
8487 branch containing @var{rev} up to and including
8488 @var{rev}.
8489
8490 @item @var{rev}:
8491 Delete revisions from revision @var{rev}, including
8492 @var{rev} itself, to the end of the branch containing
8493 @var{rev}.
8494 @end table
8495
8496 None of the revisions to be deleted may have
8497 branches or locks.
8498
8499 If any of the revisions to be deleted have symbolic
8500 names, and one specifies one of the @samp{::} syntaxes,
8501 then @sc{cvs} will give an error and not delete any
8502 revisions.  If you really want to delete both the
8503 symbolic names and the revisions, first delete the
8504 symbolic names with @code{cvs tag -d}, then run
8505 @code{cvs admin -o}.  If one specifies the
8506 non-@samp{::} syntaxes, then @sc{cvs} will delete the
8507 revisions but leave the symbolic names pointing to
8508 nonexistent revisions.  This behavior is preserved for
8509 compatibility with previous versions of @sc{cvs}, but
8510 because it isn't very useful, in the future it may
8511 change to be like the @samp{::} case.
8512
8513 Due to the way @sc{cvs} handles branches @var{rev}
8514 cannot be specified symbolically if it is a branch.
8515 @xref{Magic branch numbers}, for an explanation.
8516 @c FIXME: is this still true?  I suspect not.
8517
8518 Make sure that no-one has checked out a copy of the
8519 revision you outdate.  Strange things will happen if he
8520 starts to edit it and tries to check it back in.  For
8521 this reason, this option is not a good way to take back
8522 a bogus commit; commit a new revision undoing the bogus
8523 change instead (@pxref{Merging two revisions}).
8524
8525 @item -q
8526 Run quietly; do not print diagnostics.
8527
8528 @item -s@var{state}[:@var{rev}]
8529 Useful with @sc{cvs}.  Set the state attribute of the
8530 revision @var{rev} to @var{state}.  If @var{rev} is a
8531 branch number, assume the latest revision on that
8532 branch.  If @var{rev} is omitted, assume the latest
8533 revision on the default branch.  Any identifier is
8534 acceptable for @var{state}.  A useful set of states is
8535 @samp{Exp} (for experimental), @samp{Stab} (for
8536 stable), and @samp{Rel} (for released).  By default,
8537 the state of a new revision is set to @samp{Exp} when
8538 it is created.  The state is visible in the output from
8539 @var{cvs log} (@pxref{log}), and in the
8540 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
8541 (@pxref{Keyword substitution}).  Note that @sc{cvs}
8542 uses the @code{dead} state for its own purposes; to
8543 take a file to or from the @code{dead} state use
8544 commands like @code{cvs remove} and @code{cvs add}, not
8545 @code{cvs admin -s}.
8546
8547 @item -t[@var{file}]
8548 Useful with @sc{cvs}.  Write descriptive text from the
8549 contents of the named @var{file} into the RCS file,
8550 deleting the existing text.  The @var{file} pathname
8551 may not begin with @samp{-}.  The descriptive text can be seen in the
8552 output from @samp{cvs log} (@pxref{log}).
8553 There can be no space between @samp{-t} and its argument.
8554
8555 If @var{file} is omitted,
8556 obtain the text from standard input, terminated by
8557 end-of-file or by a line containing @samp{.} by itself.
8558 Prompt for the text if interaction is possible; see
8559 @samp{-I}.
8560
8561 @item -t-@var{string}
8562 Similar to @samp{-t@var{file}}. Write descriptive text
8563 from the @var{string} into the @sc{rcs} file, deleting
8564 the existing text.
8565 There can be no space between @samp{-t} and its argument.
8566
8567 @c The rcs -T option, do not update last-mod time for
8568 @c minor changes, has never been documented as a
8569 @c cvs admin option.
8570
8571 @item -U
8572 Set locking to non-strict.  Non-strict locking means
8573 that the owner of a file need not lock a revision for
8574 checkin.  For use with @sc{cvs}, strict locking must be
8575 set; see the discussion under the @samp{-l} option
8576 above.
8577
8578 @item -u[@var{rev}]
8579 See the option @samp{-l} above, for a discussion of
8580 using this option with @sc{cvs}.  Unlock the revision
8581 with number @var{rev}.  If a branch is given, unlock
8582 the latest revision on that branch.  If @var{rev} is
8583 omitted, remove the latest lock held by the caller.
8584 Normally, only the locker of a revision may unlock it;
8585 somebody else unlocking a revision breaks the lock.
8586 This causes the original locker to be sent a @code{commit}
8587 notification (@pxref{Getting Notified}).
8588 There can be no space between @samp{-u} and its argument.
8589
8590 @item -V@var{n}
8591 In previous versions of @sc{cvs}, this option meant to
8592 write an @sc{rcs} file which would be acceptable to
8593 @sc{rcs} version @var{n}, but it is now obsolete and
8594 specifying it will produce an error.
8595 @c Note that -V without an argument has never been
8596 @c documented as a cvs admin option.
8597
8598 @item -x@var{suffixes}
8599 In previous versions of @sc{cvs}, this was documented
8600 as a way of specifying the names of the @sc{rcs}
8601 files.  However, @sc{cvs} has always required that the
8602 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
8603 this option has never done anything useful.
8604
8605 @c The rcs -z option, to specify the timezone, has
8606 @c never been documented as a cvs admin option.
8607 @end table
8608
8609
8610 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8611 @node annotate
8612 @appendixsec annotate---What revision modified each line of a file?
8613 @cindex annotate (subcommand)
8614
8615 @itemize @bullet
8616 @item
8617 Synopsis: annotate [options] files@dots{}
8618 @item
8619 Requires: repository.
8620 @item
8621 Changes: nothing.
8622 @end itemize
8623
8624 For each file in @var{files}, print the head revision
8625 of the trunk, together with information on the last
8626 modification for each line.  
8627
8628 @menu
8629 * annotate options::            annotate options
8630 * annotate example::            annotate example
8631 @end menu
8632
8633 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8634 @node annotate options
8635 @appendixsubsec annotate options
8636
8637 These standard options are supported by @code{annotate}
8638 (@pxref{Common options}, for a complete description of
8639 them):
8640
8641 @table @code
8642 @item -l
8643 Local directory only, no recursion.
8644
8645 @item -R
8646 Process directories recursively.
8647
8648 @item -f
8649 Use head revision if tag/date not found.
8650
8651 @item -F
8652 Annotate binary files.
8653
8654 @item -r @var{revision}
8655 Annotate file as of specified revision/tag.
8656
8657 @item -D @var{date}
8658 Annotate file as of specified date.
8659 @end table
8660
8661 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8662 @node annotate example
8663 @appendixsubsec annotate example
8664
8665 For example:
8666
8667 @example
8668 $ cvs annotate ssfile
8669 Annotations for ssfile
8670 ***************
8671 1.1          (mary     27-Mar-96): ssfile line 1
8672 1.2          (joe      28-Mar-96): ssfile line 2
8673 @end example
8674
8675 The file @file{ssfile} currently contains two lines.
8676 The @code{ssfile line 1} line was checked in by
8677 @code{mary} on March 27.  Then, on March 28, @code{joe}
8678 added a line @code{ssfile line 2}, without modifying
8679 the @code{ssfile line 1} line.  This report doesn't
8680 tell you anything about lines which have been deleted
8681 or replaced; you need to use @code{cvs diff} for that
8682 (@pxref{diff}).
8683
8684 The options to @code{cvs annotate} are listed in
8685 @ref{Invoking CVS}, and can be used to select the files
8686 and revisions to annotate.  The options are described
8687 in more detail there and in @ref{Common options}.
8688
8689 @c FIXME: maybe an example using the options?  Just
8690 @c what it means to select a revision might be worth a
8691 @c few words of explanation ("you want to see who
8692 @c changed this line *before* 1.4"...).
8693
8694
8695 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8696 @node checkout
8697 @appendixsec checkout---Check out sources for editing
8698 @cindex checkout (subcommand)
8699 @cindex co (subcommand)
8700
8701 @itemize @bullet
8702 @item
8703 Synopsis: checkout [options] modules@dots{}
8704 @item
8705 Requires: repository.
8706 @item
8707 Changes: working directory.
8708 @item
8709 Synonyms: co, get
8710 @end itemize
8711
8712 Create or update a working directory containing copies of the
8713 source files specified by @var{modules}.  You must execute
8714 @code{checkout} before using most of the other @sc{cvs}
8715 commands, since most of them operate on your working
8716 directory.
8717
8718 The @var{modules} are either
8719 symbolic names for some
8720 collection of source directories and files, or paths to
8721 directories or files in the repository.  The symbolic
8722 names are defined in the @samp{modules} file.
8723 @xref{modules}.
8724 @c Needs an example, particularly of the non-"modules"
8725 @c case but probably of both.
8726
8727 @c FIXME: this seems like a very odd place to introduce
8728 @c people to how CVS works.  The bit about unreserved
8729 @c checkouts is also misleading as it depends on how
8730 @c things are set up.
8731 Depending on the modules you specify, @code{checkout} may
8732 recursively create directories and populate them with
8733 the appropriate source files.  You can then edit these
8734 source files at any time (regardless of whether other
8735 software developers are editing their own copies of the
8736 sources); update them to include new changes applied by
8737 others to the source repository; or commit your work as
8738 a permanent change to the source repository.
8739
8740 Note that @code{checkout} is used to create
8741 directories.  The top-level directory created is always
8742 added to the directory where @code{checkout} is
8743 invoked, and usually has the same name as the specified
8744 module.  In the case of a module alias, the created
8745 sub-directory may have a different name, but you can be
8746 sure that it will be a sub-directory, and that
8747 @code{checkout} will show the relative path leading to
8748 each file as it is extracted into your private work
8749 area (unless you specify the @samp{-Q} global option).
8750
8751 The files created by @code{checkout} are created
8752 read-write, unless the @samp{-r} option to @sc{cvs}
8753 (@pxref{Global options}) is specified, the
8754 @code{CVSREAD} environment variable is specified
8755 (@pxref{Environment variables}), or a watch is in
8756 effect for that file (@pxref{Watches}).
8757
8758 Note that running @code{checkout} on a directory that was already
8759 built by a prior @code{checkout} is also permitted.
8760 This is similar to specifying the @samp{-d} option
8761 to the @code{update} command in the sense that new
8762 directories that have been created in the repository
8763 will appear in your work area.
8764 However, @code{checkout} takes a module name whereas
8765 @code{update} takes a directory name.  Also
8766 to use @code{checkout} this way it must be run from the
8767 top level directory (where you originally ran
8768 @code{checkout} from), so before you run
8769 @code{checkout} to update an existing directory, don't
8770 forget to change your directory to the top level
8771 directory.
8772
8773 For the output produced by the @code{checkout} command
8774 see @ref{update output}.
8775
8776 @menu
8777 * checkout options::            checkout options
8778 * checkout examples::           checkout examples
8779 @end menu
8780
8781 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8782 @node checkout options
8783 @appendixsubsec checkout options
8784
8785 These standard options are supported by @code{checkout}
8786 (@pxref{Common options}, for a complete description of
8787 them):
8788
8789 @table @code
8790 @item -D @var{date}
8791 Use the most recent revision no later than @var{date}.
8792 This option is sticky, and implies @samp{-P}.  See
8793 @ref{Sticky tags}, for more information on sticky tags/dates.
8794
8795 @item -f
8796 Only useful with the @samp{-D @var{date}} or @samp{-r
8797 @var{tag}} flags.  If no matching revision is found,
8798 retrieve the most recent revision (instead of ignoring
8799 the file).
8800
8801 @item -k @var{kflag}
8802 Process keywords according to @var{kflag}.  See
8803 @ref{Keyword substitution}.
8804 This option is sticky; future updates of
8805 this file in this working directory will use the same
8806 @var{kflag}.  The @code{status} command can be viewed
8807 to see the sticky options.  See @ref{Invoking CVS}, for
8808 more information on the @code{status} command.
8809
8810 @item -l
8811 Local; run only in current working directory.
8812
8813 @item -n
8814 Do not run any checkout program (as specified
8815 with the @samp{-o} option in the modules file;
8816 @pxref{modules}).
8817
8818 @item -P
8819 Prune empty directories.  See @ref{Moving directories}.
8820
8821 @item -p
8822 Pipe files to the standard output.
8823
8824 @item -R
8825 Checkout directories recursively.  This option is on by default.
8826
8827 @item -r @var{tag}
8828 Use revision @var{tag}.  This option is sticky, and implies @samp{-P}.
8829 See @ref{Sticky tags}, for more information on sticky tags/dates.
8830 @end table
8831
8832 In addition to those, you can use these special command
8833 options with @code{checkout}:
8834
8835 @table @code
8836 @item -A
8837 Reset any sticky tags, dates, or @samp{-k} options.
8838 See @ref{Sticky tags}, for more information on sticky tags/dates.
8839
8840 @item -c
8841 Copy the module file, sorted, to the standard output,
8842 instead of creating or modifying any files or
8843 directories in your working directory.
8844
8845 @item -d @var{dir}
8846 Create a directory called @var{dir} for the working
8847 files, instead of using the module name.  In general,
8848 using this flag is equivalent to using @samp{mkdir
8849 @var{dir}; cd @var{dir}} followed by the checkout
8850 command without the @samp{-d} flag.
8851
8852 There is an important exception, however.  It is very
8853 convenient when checking out a single item to have the
8854 output appear in a directory that doesn't contain empty
8855 intermediate directories.  In this case @emph{only},
8856 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
8857 directories.
8858
8859 For example, given a module @samp{foo} that contains
8860 the file @samp{bar.c}, the command @samp{cvs co -d dir
8861 foo} will create directory @samp{dir} and place
8862 @samp{bar.c} inside.  Similarly, given a module
8863 @samp{bar} which has subdirectory @samp{baz} wherein
8864 there is a file @samp{quux.c}, the command @samp{cvs co
8865 -d dir bar/baz} will create directory @samp{dir} and
8866 place @samp{quux.c} inside.
8867
8868 Using the @samp{-N} flag will defeat this behavior.
8869 Given the same module definitions above, @samp{cvs co
8870 -N -d dir foo} will create directories @samp{dir/foo}
8871 and place @samp{bar.c} inside, while @samp{cvs co -N -d
8872 dir bar/baz} will create directories @samp{dir/bar/baz}
8873 and place @samp{quux.c} inside.
8874
8875 @item -j @var{tag}
8876 With two @samp{-j} options, merge changes from the
8877 revision specified with the first @samp{-j} option to
8878 the revision specified with the second @samp{j} option,
8879 into the working directory.
8880
8881 With one @samp{-j} option, merge changes from the
8882 ancestor revision to the revision specified with the
8883 @samp{-j} option, into the working directory.  The
8884 ancestor revision is the common ancestor of the
8885 revision which the working directory is based on, and
8886 the revision specified in the @samp{-j} option.
8887
8888 In addition, each -j option can contain an optional
8889 date specification which, when used with branches, can
8890 limit the chosen revision to one within a specific
8891 date.  An optional date is specified by adding a colon
8892 (:) to the tag:
8893 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
8894
8895 @xref{Branching and merging}.
8896
8897 @item -N
8898 Only useful together with @samp{-d @var{dir}}.  With
8899 this option, @sc{cvs} will not ``shorten'' module paths
8900 in your working directory when you check out a single
8901 module.  See the @samp{-d} flag for examples and a
8902 discussion.
8903
8904 @item -s
8905 Like @samp{-c}, but include the status of all modules,
8906 and sort it by the status string.  @xref{modules}, for
8907 info about the @samp{-s} option that is used inside the
8908 modules file to set the module status.
8909 @end table
8910
8911 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8912 @node checkout examples
8913 @appendixsubsec checkout examples
8914
8915 Get a copy of the module @samp{tc}:
8916
8917 @example
8918 $ cvs checkout tc
8919 @end example
8920
8921 Get a copy of the module @samp{tc} as it looked one day
8922 ago:
8923
8924 @example
8925 $ cvs checkout -D yesterday tc
8926 @end example
8927
8928 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8929 @node commit
8930 @appendixsec commit---Check files into the repository
8931 @cindex commit (subcommand)
8932
8933 @itemize @bullet
8934 @item
8935 Synopsis: commit [-lnRf] [-m 'log_message' |
8936 -F file] [-r revision] [files@dots{}]
8937 @item
8938 Requires: working directory, repository.
8939 @item
8940 Changes: repository.
8941 @item
8942 Synonym: ci
8943 @end itemize
8944
8945 Use @code{commit} when you want to incorporate changes
8946 from your working source files into the source
8947 repository.
8948
8949 If you don't specify particular files to commit, all of
8950 the files in your working current directory are
8951 examined.  @code{commit} is careful to change in the
8952 repository only those files that you have really
8953 changed.  By default (or if you explicitly specify the
8954 @samp{-R} option), files in subdirectories are also
8955 examined and committed if they have changed; you can
8956 use the @samp{-l} option to limit @code{commit} to the
8957 current directory only.
8958
8959 @code{commit} verifies that the selected files are up
8960 to date with the current revisions in the source
8961 repository; it will notify you, and exit without
8962 committing, if any of the specified files must be made
8963 current first with @code{update} (@pxref{update}).
8964 @code{commit} does not call the @code{update} command
8965 for you, but rather leaves that for you to do when the
8966 time is right.
8967
8968 When all is well, an editor is invoked to allow you to
8969 enter a log message that will be written to one or more
8970 logging programs (@pxref{modules}, and @pxref{loginfo})
8971 and placed in the @sc{rcs} file inside the
8972 repository.  This log message can be retrieved with the
8973 @code{log} command; see @ref{log}.  You can specify the
8974 log message on the command line with the @samp{-m
8975 @var{message}} option, and thus avoid the editor invocation,
8976 or use the @samp{-F @var{file}} option to specify
8977 that the argument file contains the log message.
8978
8979 @menu
8980 * commit options::              commit options
8981 * commit examples::             commit examples
8982 @end menu
8983
8984 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8985 @node commit options
8986 @appendixsubsec commit options
8987
8988 These standard options are supported by @code{commit}
8989 (@pxref{Common options}, for a complete description of
8990 them):
8991
8992 @table @code
8993 @item -l
8994 Local; run only in current working directory.
8995
8996 @item -R
8997 Commit directories recursively.  This is on by default.
8998
8999 @item -r @var{revision}
9000 Commit to @var{revision}.  @var{revision} must be
9001 either a branch, or a revision on the main trunk that
9002 is higher than any existing revision number
9003 (@pxref{Assigning revisions}).  You
9004 cannot commit to a specific revision on a branch.
9005 @c FIXME: Need xref for branch case.
9006 @end table
9007
9008 @code{commit} also supports these options:
9009
9010 @table @code
9011 @item -F @var{file}
9012 Read the log message from @var{file}, instead
9013 of invoking an editor.
9014
9015 @item -f
9016 Note that this is not the standard behavior of
9017 the @samp{-f} option as defined in @ref{Common options}.
9018
9019 Force @sc{cvs} to commit a new revision even if you haven't
9020 made any changes to the file.  If the current revision
9021 of @var{file} is 1.7, then the following two commands
9022 are equivalent:
9023
9024 @example
9025 $ cvs commit -f @var{file}
9026 $ cvs commit -r 1.8 @var{file}
9027 @end example
9028
9029 @c This is odd, but it's how CVS has worked for some
9030 @c time.
9031 The @samp{-f} option disables recursion (i.e., it
9032 implies @samp{-l}).  To force @sc{cvs} to commit a new
9033 revision for all files in all subdirectories, you must
9034 use @samp{-f -R}.
9035
9036 @item -m @var{message}
9037 Use @var{message} as the log message, instead of
9038 invoking an editor.
9039 @end table
9040
9041 @need 2000
9042 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9043 @node commit examples
9044 @appendixsubsec commit examples
9045
9046 @c FIXME: this material wants to be somewhere
9047 @c in "Branching and merging".
9048
9049 @appendixsubsubsec Committing to a branch
9050
9051 You can commit to a branch revision (one that has an
9052 even number of dots) with the @samp{-r} option.  To
9053 create a branch revision, use the @samp{-b} option
9054 of the @code{rtag} or @code{tag} commands
9055 (@pxref{Branching and merging}).  Then, either @code{checkout} or
9056 @code{update} can be used to base your sources on the
9057 newly created branch.  From that point on, all
9058 @code{commit} changes made within these working sources
9059 will be automatically added to a branch revision,
9060 thereby not disturbing main-line development in any
9061 way.  For example, if you had to create a patch to the
9062 1.2 version of the product, even though the 2.0 version
9063 is already under development, you might do:
9064
9065 @example
9066 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9067 $ cvs checkout -r FCS1_2_Patch product_module
9068 $ cd product_module
9069 [[ hack away ]]
9070 $ cvs commit
9071 @end example
9072
9073 @noindent
9074 This works automatically since the @samp{-r} option is
9075 sticky.
9076
9077 @appendixsubsubsec Creating the branch after editing
9078
9079 Say you have been working on some extremely
9080 experimental software, based on whatever revision you
9081 happened to checkout last week.  If others in your
9082 group would like to work on this software with you, but
9083 without disturbing main-line development, you could
9084 commit your change to a new branch.  Others can then
9085 checkout your experimental stuff and utilize the full
9086 benefit of @sc{cvs} conflict resolution.  The scenario might
9087 look like:
9088
9089 @c FIXME: Should we be recommending tagging the branchpoint?
9090 @example
9091 [[ hacked sources are present ]]
9092 $ cvs tag -b EXPR1
9093 $ cvs update -r EXPR1
9094 $ cvs commit
9095 @end example
9096
9097 The @code{update} command will make the @samp{-r
9098 EXPR1} option sticky on all files.  Note that your
9099 changes to the files will never be removed by the
9100 @code{update} command.  The @code{commit} will
9101 automatically commit to the correct branch, because the
9102 @samp{-r} is sticky.  You could also do like this:
9103
9104 @c FIXME: Should we be recommending tagging the branchpoint?
9105 @example
9106 [[ hacked sources are present ]]
9107 $ cvs tag -b EXPR1
9108 $ cvs commit -r EXPR1
9109 @end example
9110
9111 @noindent
9112 but then, only those files that were changed by you
9113 will have the @samp{-r EXPR1} sticky flag.  If you hack
9114 away, and commit without specifying the @samp{-r EXPR1}
9115 flag, some files may accidentally end up on the main
9116 trunk.
9117
9118 To work with you on the experimental change, others
9119 would simply do
9120
9121 @example
9122 $ cvs checkout -r EXPR1 whatever_module
9123 @end example
9124
9125 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9126 @node diff
9127 @appendixsec diff---Show differences between revisions
9128 @cindex diff (subcommand)
9129
9130 @itemize @bullet
9131 @item
9132 Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 |  -D date2]] [files@dots{}]
9133 @item
9134 Requires: working directory, repository.
9135 @item
9136 Changes: nothing.
9137 @end itemize
9138
9139 The @code{diff} command is used to compare different
9140 revisions of files.  The default action is to compare
9141 your working files with the revisions they were based
9142 on, and report any differences that are found.
9143
9144 If any file names are given, only those files are
9145 compared.  If any directories are given, all files
9146 under them will be compared.
9147
9148 The exit status for diff is different than for other
9149 @sc{cvs} commands; for details @ref{Exit status}.
9150
9151 @menu
9152 * diff options::                diff options
9153 * diff examples::               diff examples
9154 @end menu
9155
9156 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9157 @node diff options
9158 @appendixsubsec diff options
9159
9160 These standard options are supported by @code{diff}
9161 (@pxref{Common options}, for a complete description of
9162 them):
9163
9164 @table @code
9165 @item -D @var{date}
9166 Use the most recent revision no later than @var{date}.
9167 See @samp{-r} for how this affects the comparison.
9168
9169 @item -k @var{kflag}
9170 Process keywords according to @var{kflag}.  See
9171 @ref{Keyword substitution}.
9172
9173 @item -l
9174 Local; run only in current working directory.
9175
9176 @item -R
9177 Examine directories recursively.  This option is on by
9178 default.
9179
9180 @item -r @var{tag}
9181 Compare with revision @var{tag}.  Zero, one or two
9182 @samp{-r} options can be present.  With no @samp{-r}
9183 option, the working file will be compared with the
9184 revision it was based on.  With one @samp{-r}, that
9185 revision will be compared to your current working file.
9186 With two @samp{-r} options those two revisions will be
9187 compared (and your working file will not affect the
9188 outcome in any way).
9189 @c We should be a lot more explicit, with examples,
9190 @c about the difference between "cvs diff" and "cvs
9191 @c diff -r HEAD".  This often confuses new users.
9192
9193 One or both @samp{-r} options can be replaced by a
9194 @samp{-D @var{date}} option, described above.
9195 @end table
9196
9197 @c Conceptually, this is a disaster.  There are 3
9198 @c zillion diff formats that we support via the diff
9199 @c library.  It is not obvious to me that we should
9200 @c document them all.  Maybe just the most common ones
9201 @c like -c and -u, and think about phasing out the
9202 @c obscure ones.
9203 @c FIXCVS: also should be a way to specify an external
9204 @c diff program (which can be different for different
9205 @c file types) and pass through
9206 @c arbitrary options, so that the user can do
9207 @c "--pass=-Z --pass=foo" or something even if CVS
9208 @c doesn't know about the "-Z foo" option to diff.
9209 @c This would fit nicely with deprecating/eliminating
9210 @c the obscure options of the diff library, because it
9211 @c would let people specify an external GNU diff if
9212 @c they are into that sort of thing.
9213 The following options specify the format of the
9214 output.  They have the same meaning as in GNU diff.
9215 Most options have two equivalent names, one of which is a single letter
9216 preceded by @samp{-}, and the other of which is a long name preceded by
9217 @samp{--}.
9218
9219 @table @samp
9220 @item -@var{lines}
9221 Show @var{lines} (an integer) lines of context.  This option does not
9222 specify an output format by itself; it has no effect unless it is
9223 combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9224 operation, @code{patch} typically needs at least two lines of context.
9225
9226 @item -a
9227 Treat all files as text and compare them line-by-line, even if they
9228 do not seem to be text.
9229
9230 @item -b
9231 Ignore trailing white space and consider all other sequences of one or
9232 more white space characters to be equivalent.
9233
9234 @item -B
9235 Ignore changes that just insert or delete blank lines.
9236
9237 @item --binary
9238 Read and write data in binary mode.
9239
9240 @item --brief
9241 Report only whether the files differ, not the details of the
9242 differences.
9243
9244 @item -c
9245 Use the context output format.
9246
9247 @item -C @var{lines}
9248 @itemx --context@r{[}=@var{lines}@r{]}
9249 Use the context output format, showing @var{lines} (an integer) lines of
9250 context, or three if @var{lines} is not given.
9251 For proper operation, @code{patch} typically needs at least two lines of
9252 context.
9253
9254 @item --changed-group-format=@var{format}
9255 Use @var{format} to output a line group containing differing lines from
9256 both files in if-then-else format.  @xref{Line group formats}.
9257
9258 @item -d
9259 Change the algorithm to perhaps find a smaller set of changes.  This makes
9260 @code{diff} slower (sometimes much slower).
9261
9262 @item -e
9263 @itemx --ed
9264 Make output that is a valid @code{ed} script.
9265
9266 @item --expand-tabs
9267 Expand tabs to spaces in the output, to preserve the alignment of tabs
9268 in the input files.
9269
9270 @item -f
9271 Make output that looks vaguely like an @code{ed} script but has changes
9272 in the order they appear in the file.
9273
9274 @item -F @var{regexp}
9275 In context and unified format, for each hunk of differences, show some
9276 of the last preceding line that matches @var{regexp}.
9277
9278 @item --forward-ed
9279 Make output that looks vaguely like an @code{ed} script but has changes
9280 in the order they appear in the file.
9281
9282 @item -H
9283 Use heuristics to speed handling of large files that have numerous
9284 scattered small changes.
9285
9286 @item --horizon-lines=@var{lines}
9287 Do not discard the last @var{lines} lines of the common prefix
9288 and the first @var{lines} lines of the common suffix.
9289
9290 @item -i
9291 Ignore changes in case; consider upper- and lower-case letters
9292 equivalent.
9293
9294 @item -I @var{regexp}
9295 Ignore changes that just insert or delete lines that match @var{regexp}.
9296
9297 @item --ifdef=@var{name}
9298 Make merged if-then-else output using @var{name}.
9299
9300 @item --ignore-all-space
9301 Ignore white space when comparing lines.
9302
9303 @item --ignore-blank-lines
9304 Ignore changes that just insert or delete blank lines.
9305
9306 @item --ignore-case
9307 Ignore changes in case; consider upper- and lower-case to be the same.
9308
9309 @item --ignore-matching-lines=@var{regexp}
9310 Ignore changes that just insert or delete lines that match @var{regexp}.
9311
9312 @item --ignore-space-change
9313 Ignore trailing white space and consider all other sequences of one or
9314 more white space characters to be equivalent.
9315
9316 @item --initial-tab
9317 Output a tab rather than a space before the text of a line in normal or
9318 context format.  This causes the alignment of tabs in the line to look
9319 normal.
9320
9321 @item -L @var{label}
9322 Use @var{label} instead of the file name in the context format
9323 and unified format headers.
9324
9325 @item --label=@var{label}
9326 Use @var{label} instead of the file name in the context format
9327 and unified format headers.
9328
9329 @item --left-column
9330 Print only the left column of two common lines in side by side format.
9331
9332 @item --line-format=@var{format}
9333 Use @var{format} to output all input lines in if-then-else format.
9334 @xref{Line formats}.
9335
9336 @item --minimal
9337 Change the algorithm to perhaps find a smaller set of changes.  This
9338 makes @code{diff} slower (sometimes much slower).
9339
9340 @item -n
9341 Output RCS-format diffs; like @samp{-f} except that each command
9342 specifies the number of lines affected.
9343
9344 @item -N
9345 @itemx --new-file
9346 In directory comparison, if a file is found in only one directory,
9347 treat it as present but empty in the other directory.
9348
9349 @item --new-group-format=@var{format}
9350 Use @var{format} to output a group of lines taken from just the second
9351 file in if-then-else format.  @xref{Line group formats}.
9352
9353 @item --new-line-format=@var{format}
9354 Use @var{format} to output a line taken from just the second file in
9355 if-then-else format.  @xref{Line formats}.
9356
9357 @item --old-group-format=@var{format}
9358 Use @var{format} to output a group of lines taken from just the first
9359 file in if-then-else format.  @xref{Line group formats}.
9360
9361 @item --old-line-format=@var{format}
9362 Use @var{format} to output a line taken from just the first file in
9363 if-then-else format.  @xref{Line formats}.
9364
9365 @item -p
9366 Show which C function each change is in.
9367
9368 @item --rcs
9369 Output RCS-format diffs; like @samp{-f} except that each command
9370 specifies the number of lines affected.
9371
9372 @item --report-identical-files
9373 @itemx -s
9374 Report when two files are the same.
9375
9376 @item --show-c-function
9377 Show which C function each change is in.
9378
9379 @item --show-function-line=@var{regexp}
9380 In context and unified format, for each hunk of differences, show some
9381 of the last preceding line that matches @var{regexp}.
9382
9383 @item --side-by-side
9384 Use the side by side output format.
9385
9386 @item --speed-large-files
9387 Use heuristics to speed handling of large files that have numerous
9388 scattered small changes.
9389
9390 @item --suppress-common-lines
9391 Do not print common lines in side by side format.
9392
9393 @item -t
9394 Expand tabs to spaces in the output, to preserve the alignment of tabs
9395 in the input files.
9396
9397 @item -T
9398 Output a tab rather than a space before the text of a line in normal or
9399 context format.  This causes the alignment of tabs in the line to look
9400 normal.
9401
9402 @item --text
9403 Treat all files as text and compare them line-by-line, even if they
9404 do not appear to be text.
9405
9406 @item -u
9407 Use the unified output format.
9408
9409 @item --unchanged-group-format=@var{format}
9410 Use @var{format} to output a group of common lines taken from both files
9411 in if-then-else format.  @xref{Line group formats}.
9412
9413 @item --unchanged-line-format=@var{format}
9414 Use @var{format} to output a line common to both files in if-then-else
9415 format.  @xref{Line formats}.
9416
9417 @item -U @var{lines}
9418 @itemx --unified@r{[}=@var{lines}@r{]}
9419 Use the unified output format, showing @var{lines} (an integer) lines of
9420 context, or three if @var{lines} is not given.
9421 For proper operation, @code{patch} typically needs at least two lines of
9422 context.
9423
9424 @item -w
9425 Ignore white space when comparing lines.
9426
9427 @item -W @var{columns}
9428 @itemx --width=@var{columns}
9429 Use an output width of @var{columns} in side by side format.
9430
9431 @item -y
9432 Use the side by side output format.
9433 @end table
9434
9435 @menu
9436 * Line group formats::          Line group formats
9437 * Line formats::                Line formats
9438 @end menu
9439
9440 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9441 @node Line group formats
9442 @appendixsubsubsec Line group formats
9443
9444 Line group formats let you specify formats suitable for many
9445 applications that allow if-then-else input, including programming
9446 languages and text formatting languages.  A line group format specifies
9447 the output format for a contiguous group of similar lines.
9448
9449 For example, the following command compares the TeX file @file{myfile}
9450 with the original version from the repository,
9451 and outputs a merged file in which old regions are
9452 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
9453 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
9454
9455 @example
9456 cvs diff \
9457    --old-group-format='\begin@{em@}
9458 %<\end@{em@}
9459 ' \
9460    --new-group-format='\begin@{bf@}
9461 %>\end@{bf@}
9462 ' \
9463    myfile
9464 @end example
9465
9466 The following command is equivalent to the above example, but it is a
9467 little more verbose, because it spells out the default line group formats.
9468
9469 @example
9470 cvs diff \
9471    --old-group-format='\begin@{em@}
9472 %<\end@{em@}
9473 ' \
9474    --new-group-format='\begin@{bf@}
9475 %>\end@{bf@}
9476 ' \
9477    --unchanged-group-format='%=' \
9478    --changed-group-format='\begin@{em@}
9479 %<\end@{em@}
9480 \begin@{bf@}
9481 %>\end@{bf@}
9482 ' \
9483    myfile
9484 @end example
9485
9486 Here is a more advanced example, which outputs a diff listing with
9487 headers containing line numbers in a ``plain English'' style.
9488
9489 @example
9490 cvs diff \
9491    --unchanged-group-format='' \
9492    --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
9493 %<' \
9494    --new-group-format='-------- %dN line%(N=1?:s) added after %de:
9495 %>' \
9496    --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
9497 %<-------- to:
9498 %>' \
9499    myfile
9500 @end example
9501
9502 To specify a line group format, use one of the options
9503 listed below.  You can specify up to four line group formats, one for
9504 each kind of line group.  You should quote @var{format}, because it
9505 typically contains shell metacharacters.
9506
9507 @table @samp
9508 @item --old-group-format=@var{format}
9509 These line groups are hunks containing only lines from the first file.
9510 The default old group format is the same as the changed group format if
9511 it is specified; otherwise it is a format that outputs the line group as-is.
9512
9513 @item --new-group-format=@var{format}
9514 These line groups are hunks containing only lines from the second
9515 file.  The default new group format is same as the changed group
9516 format if it is specified; otherwise it is a format that outputs the
9517 line group as-is.
9518
9519 @item --changed-group-format=@var{format}
9520 These line groups are hunks containing lines from both files.  The
9521 default changed group format is the concatenation of the old and new
9522 group formats.
9523
9524 @item --unchanged-group-format=@var{format}
9525 These line groups contain lines common to both files.  The default
9526 unchanged group format is a format that outputs the line group as-is.
9527 @end table
9528
9529 In a line group format, ordinary characters represent themselves;
9530 conversion specifications start with @samp{%} and have one of the
9531 following forms.
9532
9533 @table @samp
9534 @item %<
9535 stands for the lines from the first file, including the trailing newline.
9536 Each line is formatted according to the old line format (@pxref{Line formats}).
9537
9538 @item %>
9539 stands for the lines from the second file, including the trailing newline.
9540 Each line is formatted according to the new line format.
9541
9542 @item %=
9543 stands for the lines common to both files, including the trailing newline.
9544 Each line is formatted according to the unchanged line format.
9545
9546 @item %%
9547 stands for @samp{%}.
9548
9549 @item %c'@var{C}'
9550 where @var{C} is a single character, stands for @var{C}.
9551 @var{C} may not be a backslash or an apostrophe.
9552 For example, @samp{%c':'} stands for a colon, even inside
9553 the then-part of an if-then-else format, which a colon would
9554 normally terminate.
9555
9556 @item %c'\@var{O}'
9557 where @var{O} is a string of 1, 2, or 3 octal digits,
9558 stands for the character with octal code @var{O}.
9559 For example, @samp{%c'\0'} stands for a null character.
9560
9561 @item @var{F}@var{n}
9562 where @var{F} is a @code{printf} conversion specification and @var{n} is one
9563 of the following letters, stands for @var{n}'s value formatted with @var{F}.
9564
9565 @table @samp
9566 @item e
9567 The line number of the line just before the group in the old file.
9568
9569 @item f
9570 The line number of the first line in the group in the old file;
9571 equals @var{e} + 1.
9572
9573 @item l
9574 The line number of the last line in the group in the old file.
9575
9576 @item m
9577 The line number of the line just after the group in the old file;
9578 equals @var{l} + 1.
9579
9580 @item n
9581 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
9582
9583 @item E, F, L, M, N
9584 Likewise, for lines in the new file.
9585
9586 @end table
9587
9588 The @code{printf} conversion specification can be @samp{%d},
9589 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
9590 lower case hexadecimal, or upper case hexadecimal output
9591 respectively.  After the @samp{%} the following options can appear in
9592 sequence: a @samp{-} specifying left-justification; an integer
9593 specifying the minimum field width; and a period followed by an
9594 optional integer specifying the minimum number of digits.
9595 For example, @samp{%5dN} prints the number of new lines in the group
9596 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
9597
9598 @item (@var{A}=@var{B}?@var{T}:@var{E})
9599 If @var{A} equals @var{B} then @var{T} else @var{E}.
9600 @var{A} and @var{B} are each either a decimal constant
9601 or a single letter interpreted as above.
9602 This format spec is equivalent to @var{T} if
9603 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
9604
9605 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
9606 @samp{no lines} if @var{N} (the number of lines in the group in the
9607 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
9608 otherwise.
9609 @end table
9610
9611 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9612 @node Line formats
9613 @appendixsubsubsec Line formats
9614
9615 Line formats control how each line taken from an input file is
9616 output as part of a line group in if-then-else format.
9617
9618 For example, the following command outputs text with a one-column
9619 change indicator to the left of the text.  The first column of output
9620 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
9621 for unchanged lines.  The formats contain newline characters where
9622 newlines are desired on output.
9623
9624 @example
9625 cvs diff \
9626    --old-line-format='-%l
9627 ' \
9628    --new-line-format='|%l
9629 ' \
9630    --unchanged-line-format=' %l
9631 ' \
9632    myfile
9633 @end example
9634
9635 To specify a line format, use one of the following options.  You should
9636 quote @var{format}, since it often contains shell metacharacters.
9637
9638 @table @samp
9639 @item --old-line-format=@var{format}
9640 formats lines just from the first file.
9641
9642 @item --new-line-format=@var{format}
9643 formats lines just from the second file.
9644
9645 @item --unchanged-line-format=@var{format}
9646 formats lines common to both files.
9647
9648 @item --line-format=@var{format}
9649 formats all lines; in effect, it sets all three above options simultaneously.
9650 @end table
9651
9652 In a line format, ordinary characters represent themselves;
9653 conversion specifications start with @samp{%} and have one of the
9654 following forms.
9655
9656 @table @samp
9657 @item %l
9658 stands for the contents of the line, not counting its trailing
9659 newline (if any).  This format ignores whether the line is incomplete.
9660
9661 @item %L
9662 stands for the contents of the line, including its trailing newline
9663 (if any).  If a line is incomplete, this format preserves its
9664 incompleteness.
9665
9666 @item %%
9667 stands for @samp{%}.
9668
9669 @item %c'@var{C}'
9670 where @var{C} is a single character, stands for @var{C}.
9671 @var{C} may not be a backslash or an apostrophe.
9672 For example, @samp{%c':'} stands for a colon.
9673
9674 @item %c'\@var{O}'
9675 where @var{O} is a string of 1, 2, or 3 octal digits,
9676 stands for the character with octal code @var{O}.
9677 For example, @samp{%c'\0'} stands for a null character.
9678
9679 @item @var{F}n
9680 where @var{F} is a @code{printf} conversion specification,
9681 stands for the line number formatted with @var{F}.
9682 For example, @samp{%.5dn} prints the line number using the
9683 @code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
9684 more about printf conversion specifications.
9685
9686 @end table
9687
9688 The default line format is @samp{%l} followed by a newline character.
9689
9690 If the input contains tab characters and it is important that they line
9691 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
9692 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
9693 @samp{%L} with a tab character), or you should use the @samp{-t} or
9694 @samp{--expand-tabs} option.
9695
9696 Taken together, the line and line group formats let you specify many
9697 different formats.  For example, the following command uses a format
9698 similar to @code{diff}'s normal format.  You can tailor this command
9699 to get fine control over @code{diff}'s output.
9700
9701 @example
9702 cvs diff \
9703    --old-line-format='< %l
9704 ' \
9705    --new-line-format='> %l
9706 ' \
9707    --old-group-format='%df%(f=l?:,%dl)d%dE
9708 %<' \
9709    --new-group-format='%dea%dF%(F=L?:,%dL)
9710 %>' \
9711    --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
9712 %<---
9713 %>' \
9714    --unchanged-group-format='' \
9715    myfile
9716 @end example
9717
9718 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9719 @node diff examples
9720 @appendixsubsec diff examples
9721
9722 The following line produces a Unidiff (@samp{-u} flag)
9723 between revision 1.14 and 1.19 of
9724 @file{backend.c}.  Due to the @samp{-kk} flag no
9725 keywords are substituted, so differences that only depend
9726 on keyword substitution are ignored.
9727
9728 @example
9729 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
9730 @end example
9731
9732 Suppose the experimental branch EXPR1 was based on a
9733 set of files tagged RELEASE_1_0.  To see what has
9734 happened on that branch, the following can be used:
9735
9736 @example
9737 $ cvs diff -r RELEASE_1_0 -r EXPR1
9738 @end example
9739
9740 A command like this can be used to produce a context
9741 diff between two releases:
9742
9743 @example
9744 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
9745 @end example
9746
9747 If you are maintaining ChangeLogs, a command like the following
9748 just before you commit your changes may help you write
9749 the ChangeLog entry.  All local modifications that have
9750 not yet been committed will be printed.
9751
9752 @example
9753 $ cvs diff -u | less
9754 @end example
9755
9756 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9757 @node export
9758 @appendixsec export---Export sources from CVS, similar to checkout
9759 @cindex export (subcommand)
9760
9761 @itemize @bullet
9762 @item
9763 Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
9764 @item
9765 Requires: repository.
9766 @item
9767 Changes: current directory.
9768 @end itemize
9769
9770 This command is a variant of @code{checkout}; use it
9771 when you want a copy of the source for module without
9772 the @sc{cvs} administrative directories.  For example, you
9773 might use @code{export} to prepare source for shipment
9774 off-site.  This command requires that you specify a
9775 date or tag (with @samp{-D} or @samp{-r}), so that you
9776 can count on reproducing the source you ship to others
9777 (and thus it always prunes empty directories).
9778
9779 One often would like to use @samp{-kv} with @code{cvs
9780 export}.  This causes any keywords to be
9781 expanded such that an import done at some other site
9782 will not lose the keyword revision information.  But be
9783 aware that doesn't handle an export containing binary
9784 files correctly.  Also be aware that after having used
9785 @samp{-kv}, one can no longer use the @code{ident}
9786 command (which is part of the @sc{rcs} suite---see
9787 ident(1)) which looks for keyword strings.  If
9788 you want to be able to use @code{ident} you must not
9789 use @samp{-kv}.
9790
9791 @menu
9792 * export options::              export options
9793 @end menu
9794
9795 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9796 @node export options
9797 @appendixsubsec export options
9798
9799 These standard options are supported by @code{export}
9800 (@pxref{Common options}, for a complete description of
9801 them):
9802
9803 @table @code
9804 @item -D @var{date}
9805 Use the most recent revision no later than @var{date}.
9806
9807 @item -f
9808 If no matching revision is found, retrieve the most
9809 recent revision (instead of ignoring the file).
9810
9811 @item -l
9812 Local; run only in current working directory.
9813
9814 @item -n
9815 Do not run any checkout program.
9816
9817 @item -R
9818 Export directories recursively.  This is on by default.
9819
9820 @item -r @var{tag}
9821 Use revision @var{tag}.
9822 @end table
9823
9824 In addition, these options (that are common to
9825 @code{checkout} and @code{export}) are also supported:
9826
9827 @table @code
9828 @item -d @var{dir}
9829 Create a directory called @var{dir} for the working
9830 files, instead of using the module name.
9831 @xref{checkout options}, for complete details on how
9832 @sc{cvs} handles this flag.
9833
9834 @item -k @var{subst}
9835 Set keyword expansion mode (@pxref{Substitution modes}).
9836
9837 @item -N
9838 Only useful together with @samp{-d @var{dir}}.
9839 @xref{checkout options}, for complete details on how
9840 @sc{cvs} handles this flag.
9841 @end table
9842
9843 @ignore
9844 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9845 @c @node export examples
9846 @appendixsubsec export examples
9847
9848 Contributed examples are gratefully accepted.
9849 @c -- Examples here!!
9850 @end ignore
9851
9852 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9853 @node history
9854 @appendixsec history---Show status of files and users
9855 @cindex history (subcommand)
9856
9857 @itemize @bullet
9858 @item
9859 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
9860 @item
9861 Requires: the file @file{$CVSROOT/CVSROOT/history}
9862 @item
9863 Changes: nothing.
9864 @end itemize
9865
9866 @sc{cvs} can keep a history file that tracks each use of the
9867 @code{checkout}, @code{commit}, @code{rtag},
9868 @code{update}, and @code{release} commands.  You can
9869 use @code{history} to display this information in
9870 various formats.
9871
9872 Logging must be enabled by creating the file
9873 @file{$CVSROOT/CVSROOT/history}.
9874
9875 @strong{Note: @code{history} uses @samp{-f}, @samp{-l},
9876 @samp{-n}, and @samp{-p} in ways that conflict with the
9877 normal use inside @sc{cvs} (@pxref{Common options}).}
9878
9879 @menu
9880 * history options::             history options
9881 @end menu
9882
9883 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9884 @node history options
9885 @appendixsubsec history options
9886
9887 Several options (shown above as @samp{-report})  control  what
9888 kind of report is generated:
9889
9890 @table @code
9891 @item -c
9892 Report on each time commit was used (i.e., each time
9893 the repository was modified).
9894
9895 @item -e
9896 Everything (all record types).  Equivalent to
9897 specifying @samp{-x} with all record types.  Of course,
9898 @samp{-e} will also include record types which are
9899 added in a future version of @sc{cvs}; if you are
9900 writing a script which can only handle certain record
9901 types, you'll want to specify @samp{-x}.
9902
9903 @item -m @var{module}
9904 Report on a particular module.  (You can meaningfully
9905 use @samp{-m} more than once on the command line.)
9906
9907 @item -o
9908 Report on checked-out modules.  This is the default report type.
9909
9910 @item -T
9911 Report on all tags.
9912
9913 @item -x @var{type}
9914 Extract a particular set of record types @var{type} from the @sc{cvs}
9915 history.  The types are indicated by single letters,
9916 which you may specify in combination.
9917
9918 Certain commands have a single record type:
9919
9920 @table @code
9921 @item F
9922 release
9923 @item O
9924 checkout
9925 @item E
9926 export
9927 @item T
9928 rtag
9929 @end table
9930
9931 @noindent
9932 One of five record types may result from an update:
9933
9934 @table @code
9935 @item C
9936 A merge was necessary but collisions were
9937 detected (requiring manual merging).
9938 @item G
9939 A merge was necessary and it succeeded.
9940 @item U
9941 A working file was copied from the repository.
9942 @item P
9943 A working file was patched to match the repository.
9944 @item W
9945 The working copy of a file was deleted during
9946 update (because it was gone from the repository).
9947 @end table
9948
9949 @noindent
9950 One of three record types results from commit:
9951
9952 @table @code
9953 @item A
9954 A file was added for the first time.
9955 @item M
9956 A file was modified.
9957 @item R
9958 A file was removed.
9959 @end table
9960 @end table
9961
9962 The options shown as @samp{-flags} constrain or expand
9963 the report without requiring option arguments:
9964
9965 @table @code
9966 @item -a
9967 Show data for all users (the default is to show data
9968 only for the user executing @code{history}).
9969
9970 @item -l
9971 Show last modification only.
9972
9973 @item -w
9974 Show only the records for modifications done from the
9975 same working directory where @code{history} is
9976 executing.
9977 @end table
9978
9979 The options shown as @samp{-options @var{args}} constrain the report
9980 based on an argument:
9981
9982 @table @code
9983 @item -b @var{str}
9984 Show data back to a record containing  the  string
9985 @var{str}  in  either the module name, the file name, or
9986 the repository path.
9987
9988 @item -D @var{date}
9989 Show data since @var{date}.  This is slightly different
9990 from the normal use of @samp{-D @var{date}}, which
9991 selects the newest revision older than @var{date}.
9992
9993 @item -f @var{file}
9994 Show data for a particular file
9995 (you can specify several @samp{-f} options on the same command line).
9996 This is equivalent to specifying the file on the command line.
9997
9998 @item -n @var{module}
9999 Show data for a particular module
10000 (you can specify several @samp{-n} options on the same command line).
10001
10002 @item -p @var{repository}
10003 Show data for a particular source repository  (you
10004 can specify several @samp{-p} options on the same command
10005 line).
10006
10007 @item -r @var{rev}
10008 Show records referring to revisions since the revision
10009 or tag named @var{rev} appears in individual @sc{rcs}
10010 files.  Each @sc{rcs} file is searched for the revision or
10011 tag.
10012
10013 @item -t @var{tag}
10014 Show records since tag @var{tag} was last added to the
10015 history file.  This differs from the @samp{-r} flag
10016 above in that it reads only the history file, not the
10017 @sc{rcs} files, and is much faster.
10018
10019 @item -u @var{name}
10020 Show records for user @var{name}.
10021
10022 @item -z @var{timezone}
10023 Show times in the selected records using the specified
10024 time zone instead of UTC.
10025 @end table
10026
10027 @ignore
10028 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10029 @c @node history examples
10030 @appendixsubsec history examples
10031
10032 Contributed examples will gratefully be accepted.
10033 @c -- Examples here!
10034 @end ignore
10035
10036 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10037 @node import
10038 @appendixsec import---Import sources into CVS, using vendor branches
10039 @cindex import (subcommand)
10040
10041 @c FIXME: This node is way too long for one which has subnodes.
10042
10043 @itemize @bullet
10044 @item
10045 Synopsis: import [-options] repository vendortag releasetag@dots{}
10046 @item
10047 Requires: Repository, source distribution directory.
10048 @item
10049 Changes: repository.
10050 @end itemize
10051
10052 Use @code{import} to incorporate an entire source
10053 distribution from an outside source (e.g., a source
10054 vendor) into your source repository directory.  You can
10055 use this command both for initial creation of a
10056 repository, and for wholesale updates to the module
10057 from the outside source.  @xref{Tracking sources}, for
10058 a discussion on this subject.
10059
10060 The @var{repository} argument gives a directory name
10061 (or a path to a directory) under the @sc{cvs} root directory
10062 for repositories; if the directory did not exist,
10063 import creates it.
10064
10065 When you use import for updates to source that has been
10066 modified in your source repository (since a prior
10067 import), it will notify you of any files that conflict
10068 in the two branches of development; use @samp{checkout
10069 -j} to reconcile the differences, as import instructs
10070 you to do.
10071
10072 If @sc{cvs} decides a file should be ignored
10073 (@pxref{cvsignore}), it does not import it and prints
10074 @samp{I } followed by the filename (@pxref{import output}, for a
10075 complete description of the output).
10076
10077 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10078 any file whose names match the specifications in that
10079 file will be treated as packages and the appropriate
10080 filtering will be performed on the file/directory
10081 before being imported.  @xref{Wrappers}.
10082
10083 The outside source is saved in a first-level
10084 branch, by default 1.1.1.  Updates are leaves of this
10085 branch; for example, files from the first imported
10086 collection of source will be revision 1.1.1.1, then
10087 files from the first imported update will be revision
10088 1.1.1.2, and so on.
10089
10090 At least three arguments are required.
10091 @var{repository} is needed to identify the collection
10092 of source.  @var{vendortag} is a tag for the entire
10093 branch (e.g., for 1.1.1).  You must also specify at
10094 least one @var{releasetag} to identify the files at
10095 the leaves created each time you execute @code{import}.
10096
10097 @c I'm not completely sure this belongs here.  But
10098 @c we need to say it _somewhere_ reasonably obvious; it
10099 @c is a common misconception among people first learning CVS
10100 Note that @code{import} does @emph{not} change the
10101 directory in which you invoke it.  In particular, it
10102 does not set up that directory as a @sc{cvs} working
10103 directory; if you want to work with the sources import
10104 them first and then check them out into a different
10105 directory (@pxref{Getting the source}).
10106
10107 @menu
10108 * import options::              import options
10109 * import output::               import output
10110 * import examples::             import examples
10111 @end menu
10112
10113 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10114 @node import options
10115 @appendixsubsec import options
10116
10117 This standard option is supported by @code{import}
10118 (@pxref{Common options}, for a complete description):
10119
10120 @table @code
10121 @item -m @var{message}
10122 Use @var{message} as log information, instead of
10123 invoking an editor.
10124 @end table
10125
10126 There are the following additional special options.
10127
10128 @table @code
10129 @item -b @var{branch}
10130 See @ref{Multiple vendor branches}.
10131
10132 @item -k @var{subst}
10133 Indicate the keyword expansion mode desired.  This
10134 setting will apply to all files created during the
10135 import, but not to any files that previously existed in
10136 the repository.  See @ref{Substitution modes}, for a
10137 list of valid @samp{-k} settings.
10138
10139 @item -I @var{name}
10140 Specify file names that should be ignored during
10141 import.  You can use this option repeatedly.  To avoid
10142 ignoring any files at all (even those ignored by
10143 default), specify `-I !'.
10144
10145 @var{name} can be a file name pattern of the same type
10146 that you can specify in the @file{.cvsignore} file.
10147 @xref{cvsignore}.
10148 @c -- Is this really true?
10149
10150 @item -W @var{spec}
10151 Specify file names that should be filtered during
10152 import.  You can use this option repeatedly.
10153
10154 @var{spec} can be a file name pattern of the same type
10155 that you can specify in the @file{.cvswrappers}
10156 file. @xref{Wrappers}.
10157 @end table
10158
10159 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10160 @node import output
10161 @appendixsubsec import output
10162
10163 @code{import} keeps you informed of its progress by printing a line
10164 for each file, preceded by one character indicating the status of the file:
10165
10166 @table @code
10167 @item U @var{file}
10168 The file already exists in the repository and has not been locally
10169 modified; a new revision has been created (if necessary).
10170
10171 @item N @var{file}
10172 The file is a new file which has been added to the repository.
10173
10174 @item C @var{file}
10175 The file already exists in the repository but has been locally modified;
10176 you will have to merge the changes.
10177
10178 @item I @var{file}
10179 The file is being ignored (@pxref{cvsignore}).
10180
10181 @cindex Symbolic link, importing
10182 @cindex Link, symbolic, importing
10183 @c FIXME: also (somewhere else) probably
10184 @c should be documenting what happens if you "cvs add"
10185 @c a symbolic link.  Also maybe what happens if
10186 @c you manually create symbolic links within the
10187 @c repository (? - not sure why we'd want to suggest
10188 @c doing that).
10189 @item L @var{file}
10190 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10191 People periodically suggest that this behavior should
10192 be changed, but if there is a consensus on what it
10193 should be changed to, it doesn't seem to be apparent.
10194 (Various options in the @file{modules} file can be used
10195 to recreate symbolic links on checkout, update, etc.;
10196 @pxref{modules}.)
10197 @end table
10198
10199 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10200 @node import examples
10201 @appendixsubsec import examples
10202
10203 See @ref{Tracking sources}, and @ref{From files}.
10204
10205 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10206 @node log
10207 @appendixsec log---Print out log information for files
10208 @cindex log (subcommand)
10209
10210 @itemize @bullet
10211 @item
10212 Synopsis: log [options] [files@dots{}]
10213 @item
10214 Requires: repository, working directory.
10215 @item
10216 Changes: nothing.
10217 @end itemize
10218
10219 Display log information for files.  @code{log} used to
10220 call the @sc{rcs} utility @code{rlog}.  Although this
10221 is no longer true in the current sources, this history
10222 determines the format of the output and the options,
10223 which are not quite in the style of the other @sc{cvs}
10224 commands.
10225
10226 @cindex Timezone, in output
10227 @cindex Zone, time, in output
10228 @c Kind of a funny place to document the timezone used
10229 @c in output from commands other than @code{log}.
10230 @c There is also more we need to say about this,
10231 @c including what happens in a client/server environment.
10232 The output includes the location of the @sc{rcs} file,
10233 the @dfn{head} revision (the latest revision on the
10234 trunk), all symbolic names (tags) and some other
10235 things.  For each revision, the revision number, the
10236 author, the number of lines added/deleted and the log
10237 message are printed.  All times are displayed in
10238 Coordinated Universal Time (UTC).  (Other parts of
10239 @sc{cvs} print times in the local timezone).
10240 @c FIXCVS: need a better way to control the timezone
10241 @c used in output.  Previous/current versions of CVS did/do
10242 @c sometimes support -z in RCSINIT, and/or an
10243 @c undocumented (except by reference to 'rlog') -z option
10244 @c to cvs log, but this has not been a consistent,
10245 @c documented feature.  Perhaps a new global option,
10246 @c where LT means the client's timezone, which the
10247 @c client then communicates to the server, is the
10248 @c right solution.
10249
10250 @strong{Note: @code{log} uses @samp{-R} in a way that conflicts
10251 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10252
10253 @menu
10254 * log options::                 log options
10255 * log examples::                log examples
10256 @end menu
10257
10258 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10259 @node log options
10260 @appendixsubsec log options
10261
10262 By default, @code{log} prints all information that is
10263 available.  All other options restrict the output.
10264
10265 @table @code
10266 @item -b
10267 Print information about the revisions on the default
10268 branch, normally the highest branch on the trunk.
10269
10270 @item -d @var{dates}
10271 Print information about revisions with a checkin
10272 date/time in the range given by the
10273 semicolon-separated list of dates.  The date formats
10274 accepted are those accepted by the @samp{-D} option to
10275 many other @sc{cvs} commands (@pxref{Common options}).
10276 Dates can be combined into ranges as follows:
10277
10278 @c Should we be thinking about accepting ISO8601
10279 @c ranges?  For example "1972-09-10/1972-09-12".
10280 @table @code
10281 @item @var{d1}<@var{d2}
10282 @itemx @var{d2}>@var{d1}
10283 Select the revisions that were deposited between
10284 @var{d1} and @var{d2}.
10285
10286 @item <@var{d}
10287 @itemx @var{d}>
10288 Select all revisions dated @var{d} or earlier.
10289
10290 @item @var{d}<
10291 @itemx >@var{d}
10292 Select all revisions dated @var{d} or later.
10293
10294 @item @var{d}
10295 Select the single, latest revision dated @var{d} or
10296 earlier.
10297 @end table
10298
10299 The @samp{>} or @samp{<} characters may be followed by
10300 @samp{=} to indicate an inclusive range rather than an
10301 exclusive one.
10302
10303 Note that the separator is a semicolon (;).
10304
10305 @item -h
10306 Print only the name of the @sc{rcs} file, name
10307 of the file in the working directory, head,
10308 default branch, access list, locks, symbolic names, and
10309 suffix.
10310
10311 @item -l
10312 Local; run only in current working directory.  (Default
10313 is to run recursively).
10314
10315 @item -N
10316 Do not print the list of tags for this file.  This
10317 option can be very useful when your site uses a lot of
10318 tags, so rather than "more"'ing over 3 pages of tag
10319 information, the log information is presented without
10320 tags at all.
10321
10322 @item -R
10323 Print only the name of the @sc{rcs} file.
10324
10325 @c Note that using a bare revision (in addition to not
10326 @c being explicitly documented here) is potentially
10327 @c confusing; it shows the log message to get from the
10328 @c previous revision to that revision.  "-r1.3 -r1.6"
10329 @c (equivalent to "-r1.3,1.6") is even worse; it
10330 @c prints the messages to get from 1.2 to 1.3 and 1.5
10331 @c to 1.6.  By analogy with "cvs diff", users might
10332 @c expect that it is more like specifying a range.
10333 @c It is not 100% clear to me how much of this should
10334 @c be documented (for example, multiple -r options
10335 @c perhaps could/should be deprecated given the false
10336 @c analogy with "cvs diff").
10337 @c In general, this section should be rewritten to talk
10338 @c about messages to get from revision rev1 to rev2,
10339 @c rather than messages for revision rev2 (that is, the
10340 @c messages are associated with a change not a static
10341 @c revision and failing to make this distinction causes
10342 @c much confusion).
10343 @item -r@var{revisions}
10344 Print information about revisions given in the
10345 comma-separated list @var{revisions} of revisions and
10346 ranges.  The following table explains the available
10347 range formats:
10348
10349 @table @code
10350 @item @var{rev1}:@var{rev2}
10351 Revisions @var{rev1} to @var{rev2} (which must be on
10352 the same branch).
10353
10354 @item @var{rev1}::@var{rev2}
10355 The same, but excluding @var{rev1}.
10356
10357 @item :@var{rev}
10358 @itemx ::@var{rev}
10359 Revisions from the beginning of the branch up to
10360 and including @var{rev}.
10361
10362 @item @var{rev}:
10363 Revisions starting with @var{rev} to the end of the
10364 branch containing @var{rev}.
10365
10366 @item @var{rev}::
10367 Revisions starting just after @var{rev} to the end of the
10368 branch containing @var{rev}.
10369
10370 @item @var{branch}
10371 An argument that is a branch means all revisions on
10372 that branch.
10373
10374 @item @var{branch1}:@var{branch2}
10375 @itemx @var{branch1}::@var{branch2}
10376 A range of branches means all revisions
10377 on the branches in that range.
10378
10379 @item @var{branch}.
10380 The latest revision in @var{branch}.
10381 @end table
10382
10383 A bare @samp{-r} with no revisions means the latest
10384 revision on the default branch, normally the trunk.
10385 There can be no space between the @samp{-r} option and
10386 its argument.
10387
10388 @item -S
10389 Suppress the header if no revisions are selected.
10390
10391 @item -s @var{states}
10392 Print information about revisions whose state
10393 attributes match one of the states given in the
10394 comma-separated list @var{states}.
10395
10396 @item -t
10397 Print the same as @samp{-h}, plus the descriptive text.
10398
10399 @item -w@var{logins}
10400 Print information about revisions checked in by users
10401 with login names appearing in the comma-separated list
10402 @var{logins}.  If @var{logins} is omitted, the user's
10403 login is assumed.  There can be no space between the
10404 @samp{-w} option and its argument.
10405 @end table
10406
10407 @code{log} prints the intersection of the revisions
10408 selected with the options @samp{-d}, @samp{-s}, and
10409 @samp{-w}, intersected with the union of the revisions
10410 selected by @samp{-b} and @samp{-r}.
10411
10412 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10413 @node log examples
10414 @appendixsubsec log examples
10415
10416 Contributed examples are gratefully accepted.
10417
10418 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10419 @node rdiff
10420 @appendixsec rdiff---'patch' format diffs between releases
10421 @cindex rdiff (subcommand)
10422
10423 @itemize @bullet
10424 @item
10425 rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
10426 @item
10427 Requires: repository.
10428 @item
10429 Changes: nothing.
10430 @item
10431 Synonym: patch
10432 @end itemize
10433
10434 Builds a Larry Wall format patch(1) file between two
10435 releases, that can be fed directly into the @code{patch}
10436 program to bring an old release up-to-date with the new
10437 release.  (This is one of the few @sc{cvs} commands that
10438 operates directly from the repository, and doesn't
10439 require a prior checkout.) The diff output is sent to
10440 the standard output device.
10441
10442 You can specify (using the standard @samp{-r} and
10443 @samp{-D} options) any combination of one or two
10444 revisions or dates.  If only one revision or date is
10445 specified, the patch file reflects differences between
10446 that revision or date and the current head revisions in
10447 the @sc{rcs} file.
10448
10449 Note that if the software release affected is contained
10450 in more than one directory, then it may be necessary to
10451 specify the @samp{-p} option to the @code{patch} command when
10452 patching the old sources, so that @code{patch} is able to find
10453 the files that are located in other directories.
10454
10455 @menu
10456 * rdiff options::               rdiff options
10457 * rdiff examples::              rdiff examples
10458 @end menu
10459
10460 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10461 @node rdiff options
10462 @appendixsubsec rdiff options
10463
10464 These standard options are supported by @code{rdiff}
10465 (@pxref{Common options}, for a complete description of
10466 them):
10467
10468 @table @code
10469 @item -D @var{date}
10470 Use the most recent revision no later than @var{date}.
10471
10472 @item -f
10473 If no matching revision is found, retrieve the most
10474 recent revision (instead of ignoring the file).
10475
10476 @item -l
10477 Local; don't descend subdirectories.
10478
10479 @item -R
10480 Examine directories recursively.  This option is on by default.
10481
10482 @item -r @var{tag}
10483 Use revision @var{tag}.
10484 @end table
10485
10486 In addition to the above, these options are available:
10487
10488 @table @code
10489 @item -c
10490 Use the context diff format.  This is the default format.
10491
10492 @item -s
10493 Create a summary change report instead of a patch.  The
10494 summary includes information about files that were
10495 changed or added between the releases.  It is sent to
10496 the standard output device.  This is useful for finding
10497 out, for example, which files have changed between two
10498 dates or revisions.
10499
10500 @item -t
10501 A diff of the top two revisions is sent to the standard
10502 output device.  This is most useful for seeing what the
10503 last change to a file was.
10504
10505 @item -u
10506 Use the unidiff format for the context diffs.
10507 Remember that old versions
10508 of the @code{patch} program can't handle the unidiff
10509 format, so if you plan to post this patch to the net
10510 you should probably not use @samp{-u}.
10511
10512 @item -V @var{vn}
10513 Expand keywords according to the rules current in
10514 @sc{rcs} version @var{vn} (the expansion format changed with
10515 @sc{rcs} version 5).  Note that this option is no
10516 longer accepted.  @sc{cvs} will always expand keywords the
10517 way that @sc{rcs} version 5 does.
10518 @end table
10519
10520 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10521 @node rdiff examples
10522 @appendixsubsec rdiff examples
10523
10524 Suppose you receive mail from @t{foo@@example.net} asking for an
10525 update from release 1.2 to 1.4 of the tc compiler.  You
10526 have no such patches on hand, but with @sc{cvs} that can
10527 easily be fixed with a command such as this:
10528
10529 @example
10530 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
10531 $$ Mail -s 'The patches you asked for' foo@@example.net
10532 @end example
10533
10534 Suppose you have made release 1.3, and forked a branch
10535 called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
10536 corresponds to release 1.3.1, which was made some time
10537 ago.  Now, you want to see how much development has been
10538 done on the branch.  This command can be used:
10539
10540 @example
10541 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
10542 cvs rdiff: Diffing module-name
10543 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
10544 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
10545 File bar.h,v changed from revision 1.29.2.1 to 1.2
10546 @end example
10547
10548 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10549 @node release
10550 @appendixsec release---Indicate that a Module is no longer in use
10551 @cindex release (subcommand)
10552
10553 @itemize @bullet
10554 @item
10555 release [-d] directories@dots{}
10556 @item
10557 Requires: Working directory.
10558 @item
10559 Changes: Working directory, history log.
10560 @end itemize
10561
10562 This command is meant to safely cancel the effect of
10563 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
10564 isn't strictly necessary to use this command.  You can
10565 always simply delete your working directory, if you
10566 like; but you risk losing changes you may have
10567 forgotten, and you leave no trace in the @sc{cvs} history
10568 file (@pxref{history file}) that you've abandoned your
10569 checkout.
10570
10571 Use @samp{cvs release} to avoid these problems.  This
10572 command checks that no uncommitted changes are
10573 present; that you are executing it from immediately
10574 above a @sc{cvs} working directory; and that the repository
10575 recorded for your files is the same as the repository
10576 defined in the module database.
10577
10578 If all these conditions are true, @samp{cvs release}
10579 leaves a record of its execution (attesting to your
10580 intentionally abandoning your checkout) in the @sc{cvs}
10581 history log.
10582
10583 @menu
10584 * release options::             release options
10585 * release output::              release output
10586 * release examples::            release examples
10587 @end menu
10588
10589 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10590 @node release options
10591 @appendixsubsec release options
10592
10593 The @code{release} command supports one command option:
10594
10595 @table @code
10596 @item -d
10597 Delete your working copy of the file if the release
10598 succeeds.  If this flag is not given your files will
10599 remain in your working directory.
10600
10601 @strong{WARNING:  The @code{release} command deletes
10602 all directories and files recursively.  This
10603 has the very serious side-effect that any directory
10604 that you have created inside your checked-out sources,
10605 and not added to the repository (using the @code{add}
10606 command; @pxref{Adding files}) will be silently deleted---even
10607 if it is non-empty!}
10608 @end table
10609
10610 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10611 @node release output
10612 @appendixsubsec release output
10613
10614 Before @code{release} releases your sources it will
10615 print a one-line message for any file that is not
10616 up-to-date.
10617
10618 @table @code
10619 @item U @var{file}
10620 @itemx P @var{file}
10621 There exists a newer revision of this file in the
10622 repository, and you have not modified your local copy
10623 of the file (@samp{U} and @samp{P} mean the same thing).
10624
10625 @item A @var{file}
10626 The file has been added to your private copy of the
10627 sources, but has not yet been committed to the
10628 repository.  If you delete your copy of the sources
10629 this file will be lost.
10630
10631 @item R @var{file}
10632 The file has been removed from your private copy of the
10633 sources, but has not yet been removed from the
10634 repository, since you have not yet committed the
10635 removal.  @xref{commit}.
10636
10637 @item M @var{file}
10638 The file is modified in your working directory.  There
10639 might also be a newer revision inside the repository.
10640
10641 @item ? @var{file}
10642 @var{file} is in your working directory, but does not
10643 correspond to anything in the source repository, and is
10644 not in the list of files for @sc{cvs} to ignore (see the
10645 description of the @samp{-I} option, and
10646 @pxref{cvsignore}).  If you remove your working
10647 sources, this file will be lost.
10648 @end table
10649
10650 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10651 @node release examples
10652 @appendixsubsec release examples
10653
10654 Release the @file{tc} directory, and delete your local working copy
10655 of the files.
10656
10657 @example
10658 $ cd ..         # @r{You must stand immediately above the}
10659                 # @r{sources when you issue @samp{cvs release}.}
10660 $ cvs release -d tc
10661 You have [0] altered files in this repository.
10662 Are you sure you want to release (and delete) directory `tc': y
10663 $
10664 @end example
10665
10666 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10667 @node update
10668 @appendixsec update---Bring work tree in sync with repository
10669 @cindex update (subcommand)
10670
10671 @itemize @bullet
10672 @item
10673 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files@dots{}
10674 @item
10675 Requires: repository, working directory.
10676 @item
10677 Changes: working directory.
10678 @end itemize
10679
10680 After you've run checkout to create your private copy
10681 of source from the common repository, other developers
10682 will continue changing the central source.  From time
10683 to time, when it is convenient in your development
10684 process, you can use the @code{update} command from
10685 within your working directory to reconcile your work
10686 with any revisions applied to the source repository
10687 since your last checkout or update.
10688
10689 @menu
10690 * update options::              update options
10691 * update output::               update output
10692 @end menu
10693
10694 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10695 @node update options
10696 @appendixsubsec update options
10697
10698 These standard options are available with @code{update}
10699 (@pxref{Common options}, for a complete description of
10700 them):
10701
10702 @table @code
10703 @item -D date
10704 Use the most recent revision no later than @var{date}.
10705 This option is sticky, and implies @samp{-P}.
10706 See @ref{Sticky tags}, for more information on sticky tags/dates.
10707
10708 @item -f
10709 Only useful with the @samp{-D @var{date}} or @samp{-r
10710 @var{tag}} flags.  If no matching revision is found,
10711 retrieve the most recent revision (instead of ignoring
10712 the file).
10713
10714 @item -k @var{kflag}
10715 Process keywords according to @var{kflag}.  See
10716 @ref{Keyword substitution}.
10717 This option is sticky; future updates of
10718 this file in this working directory will use the same
10719 @var{kflag}.  The @code{status} command can be viewed
10720 to see the sticky options.  See @ref{Invoking CVS}, for
10721 more information on the @code{status} command.
10722
10723 @item -l
10724 Local; run only in current working directory.  @xref{Recursive behavior}.
10725
10726 @item -P
10727 Prune empty directories.  See @ref{Moving directories}.
10728
10729 @item -p
10730 Pipe files to the standard output.
10731
10732 @item -R
10733 Update directories recursively (default).  @xref{Recursive
10734 behavior}.
10735
10736 @item -r rev
10737 Retrieve revision/tag @var{rev}.  This option is sticky,
10738 and implies @samp{-P}.
10739 See @ref{Sticky tags}, for more information on sticky tags/dates.
10740 @end table
10741
10742 @need 800
10743 These special options are also available with
10744 @code{update}.
10745
10746 @table @code
10747 @item -A
10748 Reset any sticky tags, dates, or @samp{-k} options.
10749 See @ref{Sticky tags}, for more information on sticky tags/dates.
10750
10751 @item -C
10752 Overwrite locally modified files with clean copies from
10753 the repository (the modified file is saved in
10754 @file{.#@var{file}.@var{revision}}, however).
10755
10756 @item -d
10757 Create any directories that exist in the repository if
10758 they're missing from the working directory.  Normally,
10759 @code{update} acts only on directories and files that
10760 were already enrolled in your working directory.
10761
10762 This is useful for updating directories that were
10763 created in the repository since the initial checkout;
10764 but it has an unfortunate side effect.  If you
10765 deliberately avoided certain directories in the
10766 repository when you created your working directory
10767 (either through use of a module name or by listing
10768 explicitly the files and directories you wanted on the
10769 command line), then updating with @samp{-d} will create
10770 those directories, which may not be what you want.
10771
10772 @item -I @var{name}
10773 Ignore files whose names match @var{name} (in your
10774 working directory) during the update.  You can specify
10775 @samp{-I} more than once on the command line to specify
10776 several files to ignore.  Use @samp{-I !} to avoid
10777 ignoring any files at all.  @xref{cvsignore}, for other
10778 ways to make @sc{cvs} ignore some files.
10779
10780 @item -W@var{spec}
10781 Specify file names that should be filtered during
10782 update.  You can use this option repeatedly.
10783
10784 @var{spec} can be a file name pattern of the same type
10785 that you can specify in the @file{.cvswrappers}
10786 file. @xref{Wrappers}.
10787
10788 @item -j@var{revision}
10789 With two @samp{-j} options, merge changes from the
10790 revision specified with the first @samp{-j} option to
10791 the revision specified with the second @samp{j} option,
10792 into the working directory.
10793
10794 With one @samp{-j} option, merge changes from the
10795 ancestor revision to the revision specified with the
10796 @samp{-j} option, into the working directory.  The
10797 ancestor revision is the common ancestor of the
10798 revision which the working directory is based on, and
10799 the revision specified in the @samp{-j} option.
10800
10801 Note that using a single @samp{-j @var{tagname}} option rather than
10802 @samp{-j @var{branchname}} to merge changes from a branch will
10803 often not remove files which were removed on the branch.
10804 @xref{Merging adds and removals}, for more.
10805
10806 In addition, each @samp{-j} option can contain an optional
10807 date specification which, when used with branches, can
10808 limit the chosen revision to one within a specific
10809 date.  An optional date is specified by adding a colon
10810 (:) to the tag:
10811 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
10812
10813 @xref{Branching and merging}.
10814
10815 @end table
10816
10817 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10818 @node update output
10819 @appendixsubsec update output
10820
10821 @code{update} and @code{checkout} keep you informed of
10822 their progress by printing a line for each file, preceded
10823 by one character indicating the status of the file:
10824
10825 @table @code
10826 @item U @var{file}
10827 The file was brought up to date with respect to the
10828 repository.  This is done for any file that exists in
10829 the repository but not in your source, and for files
10830 that you haven't changed but are not the most recent
10831 versions available in the repository.
10832
10833 @item P @var{file}
10834 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
10835 file.  This accomplishes the same thing as @samp{U} using less bandwidth.
10836
10837 @item A @var{file}
10838 The file has been added to your private copy of the
10839 sources, and will be added to the source repository
10840 when you run @code{commit} on the file.  This is a
10841 reminder to you that the file needs to be committed.
10842
10843 @item R @var{file}
10844 The file has been removed from your private copy of the
10845 sources, and will be removed from the source repository
10846 when you run @code{commit} on the file.  This is a
10847 reminder to you that the file needs to be committed.
10848
10849 @item M @var{file}
10850 The file is modified in  your  working  directory.
10851
10852 @samp{M} can indicate one of two states for a file
10853 you're working on: either there were no modifications
10854 to the same file in the repository, so that your file
10855 remains as you last saw it; or there were modifications
10856 in the repository as well as in your copy, but they
10857 were merged successfully, without conflict, in your
10858 working directory.
10859
10860 @sc{cvs} will print some messages if it merges your work,
10861 and a backup copy of your working file (as it looked
10862 before you ran @code{update}) will be made.  The exact
10863 name of that file is printed while @code{update} runs.
10864
10865 @item C @var{file}
10866 @cindex .# files
10867 @cindex __ files (VMS)
10868 A conflict was detected while trying to merge your
10869 changes to @var{file} with changes from the source
10870 repository.  @var{file} (the copy in your working
10871 directory) is now the result of attempting to merge
10872 the two revisions; an unmodified copy of your file
10873 is also in your working directory, with the name
10874 @file{.#@var{file}.@var{revision}} where @var{revision}
10875 is the revision that your modified file started
10876 from.  Resolve the conflict as described in
10877 @ref{Conflicts example}.
10878 @c "some systems" as in out-of-the-box OSes?  Not as
10879 @c far as I know.  We need to advise sysadmins as well
10880 @c as users how to set up this kind of purge, if that is
10881 @c what they want.
10882 @c We also might want to think about cleaner solutions,
10883 @c like having CVS remove the .# file once the conflict
10884 @c has been resolved or something like that.
10885 (Note that some systems automatically purge
10886 files that begin with @file{.#} if they have not been
10887 accessed for a few days.  If you intend to keep a copy
10888 of your original file, it is a very good idea to rename
10889 it.)  Under @sc{vms}, the file name starts with
10890 @file{__} rather than @file{.#}.
10891
10892 @item ? @var{file}
10893 @var{file} is in your working directory, but does not
10894 correspond to anything in the source repository, and is
10895 not in the list of files for @sc{cvs} to ignore (see the
10896 description of the @samp{-I} option, and
10897 @pxref{cvsignore}).
10898 @end table
10899
10900 @c ----- END MAN 1 -----
10901 @c ---------------------------------------------------------------------
10902 @node Invoking CVS
10903 @appendix Quick reference to CVS commands
10904 @cindex Command reference
10905 @cindex Reference, commands
10906 @cindex Invoking CVS
10907
10908 This appendix describes how to invoke @sc{cvs}, with
10909 references to where each command or feature is
10910 described in detail.  For other references run the
10911 @code{cvs --help} command, or see @ref{Index}.
10912
10913 A @sc{cvs} command looks like:
10914
10915 @example
10916 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
10917 @end example
10918
10919 Global options:
10920
10921 @table @code
10922 @item --allow-root=@var{rootdir}
10923 Specify legal @sc{cvsroot} directory (server only) (not
10924 in @sc{cvs} 1.9 and older).  See @ref{Password
10925 authentication server}.
10926
10927 @item -a
10928 Authenticate all communication (client only) (not in @sc{cvs}
10929 1.9 and older).  See @ref{Global options}.
10930
10931 @item -b
10932 Specify RCS location (@sc{cvs} 1.9 and older).  See
10933 @ref{Global options}.
10934
10935 @item -d @var{root}
10936 Specify the @sc{cvsroot}.  See @ref{Repository}.
10937
10938 @item -e @var{editor}
10939 Edit messages with @var{editor}.  See @ref{Committing
10940 your changes}.
10941
10942 @item -f
10943 Do not read the @file{~/.cvsrc} file.  See @ref{Global
10944 options}.
10945
10946 @item -H
10947 @itemx --help
10948 Print a help message.  See @ref{Global options}.
10949
10950 @item -n
10951 Do not change any files.  See @ref{Global options}.
10952
10953 @item -Q
10954 Be really quiet.  See @ref{Global options}.
10955
10956 @item -q
10957 Be somewhat quiet.  See @ref{Global options}.
10958
10959 @item -r
10960 Make new working files read-only.  See @ref{Global options}.
10961
10962 @item -s @var{variable}=@var{value}
10963 Set a user variable.  See @ref{Variables}.
10964
10965 @item -T @var{tempdir}
10966 Put temporary files in @var{tempdir}.  See @ref{Global
10967 options}.
10968
10969 @item -t
10970 Trace @sc{cvs} execution.  See @ref{Global options}.
10971
10972 @item -v
10973 @item --version
10974 Display version and copyright information for @sc{cvs}.
10975
10976 @item -w
10977 Make new working files read-write.  See @ref{Global
10978 options}.
10979
10980 @item -x
10981 Encrypt all communication (client only).
10982 See @ref{Global options}.
10983
10984 @item -z @var{gzip-level}
10985 @cindex Compression
10986 @cindex Gzip
10987 Set the compression level (client only).
10988 See @ref{Global options}.
10989 @end table
10990
10991 Keyword expansion modes (@pxref{Substitution modes}):
10992
10993 @example
10994 -kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
10995 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
10996 -kk   $@splitrcskeyword{Id}$
10997 -kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
10998 -ko   @i{no expansion}
10999 -kb   @i{no expansion, file is binary}
11000 @end example
11001
11002 Keywords (@pxref{Keyword list}):
11003
11004 @example
11005 $@splitrcskeyword{Author}: joe $
11006 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11007 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11008 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11009 $@splitrcskeyword{Locker}: harry $
11010 $@splitrcskeyword{Name}: snapshot_1_14 $
11011 $@splitrcskeyword{RCSfile}: file1,v $
11012 $@splitrcskeyword{Revision}: 1.1 $
11013 $@splitrcskeyword{Source}: /home/files/file1,v $
11014 $@splitrcskeyword{State}: Exp $
11015 $@splitrcskeyword{Log}: file1,v $
11016 Revision 1.1  1993/12/09 03:30:17  joe
11017 Initial revision
11018
11019 @end example
11020
11021 @c The idea behind this table is that we want each item
11022 @c to be a sentence or two at most.  Preferably a
11023 @c single line.
11024 @c
11025 @c In some cases refs to "foo options" are just to get
11026 @c this thing written quickly, not because the "foo
11027 @c options" node is really the best place to point.
11028 Commands, command options, and command arguments:
11029
11030 @table @code
11031 @c ------------------------------------------------------------
11032 @item add [@var{options}] [@var{files}@dots{}]
11033 Add a new file/directory.  See @ref{Adding files}.
11034
11035 @table @code
11036 @item -k @var{kflag}
11037 Set keyword expansion.
11038
11039 @item -m @var{msg}
11040 Set file description.
11041 @end table
11042
11043 @c ------------------------------------------------------------
11044 @item admin [@var{options}] [@var{files}@dots{}]
11045 Administration of history files in the repository.  See
11046 @ref{admin}.
11047 @c This list omits those options which are not
11048 @c documented as being useful with CVS.  That might be
11049 @c a mistake...
11050
11051 @table @code
11052 @item -b[@var{rev}]
11053 Set default branch.  See @ref{Reverting local changes}.
11054
11055 @item -c@var{string}
11056 Set comment leader.
11057
11058 @item -k@var{subst}
11059 Set keyword substitution.  See @ref{Keyword
11060 substitution}.
11061
11062 @item -l[@var{rev}]
11063 Lock revision @var{rev}, or latest revision.
11064
11065 @item -m@var{rev}:@var{msg}
11066 Replace the log message of revision @var{rev} with
11067 @var{msg}.
11068
11069 @item -o@var{range}
11070 Delete revisions from the repository.  See
11071 @ref{admin options}.
11072
11073 @item -q
11074 Run quietly; do not print diagnostics.
11075
11076 @item -s@var{state}[:@var{rev}]
11077 Set the state.
11078
11079 @c Does not work for client/server CVS
11080 @item -t
11081 Set file description from standard input.
11082
11083 @item -t@var{file}
11084 Set file description from @var{file}.
11085
11086 @item -t-@var{string}
11087 Set file description to @var{string}.
11088
11089 @item -u[@var{rev}]
11090 Unlock revision @var{rev}, or latest revision.
11091 @end table
11092
11093 @c ------------------------------------------------------------
11094 @item annotate [@var{options}] [@var{files}@dots{}]
11095 Show last revision where each line was modified.  See
11096 @ref{annotate}.
11097
11098 @table @code
11099 @item -D @var{date}
11100 Annotate the most recent revision no later than
11101 @var{date}.  See @ref{Common options}.
11102
11103 @item -F
11104 Force annotation of binary files.  (Without this option,
11105 binary files are skipped with a message.)
11106
11107 @item -f
11108 Use head revision if tag/date not found.  See
11109 @ref{Common options}.
11110
11111 @item -l
11112 Local; run only in current working directory.  @xref{Recursive behavior}.
11113
11114 @item -R
11115 Operate recursively (default).  @xref{Recursive
11116 behavior}.
11117
11118 @item -r @var{tag}
11119 Annotate revision @var{tag}.  See @ref{Common options}.
11120 @end table
11121
11122 @c ------------------------------------------------------------
11123 @item checkout [@var{options}] @var{modules}@dots{}
11124 Get a copy of the sources.  See @ref{checkout}.
11125
11126 @table @code
11127 @item -A
11128 Reset any sticky tags/date/options.  See @ref{Sticky
11129 tags} and @ref{Keyword substitution}.
11130
11131 @item -c
11132 Output the module database.  See @ref{checkout options}.
11133
11134 @item -D @var{date}
11135 Check out revisions as of @var{date} (is sticky).  See
11136 @ref{Common options}.
11137
11138 @item -d @var{dir}
11139 Check out into @var{dir}.  See @ref{checkout options}.
11140
11141 @item -f
11142 Use head revision if tag/date not found.  See
11143 @ref{Common options}.
11144
11145 @c Probably want to use rev1/rev2 style like for diff
11146 @c -r.  Here and in on-line help.
11147 @item -j @var{rev}
11148 Merge in changes.  See @ref{checkout options}.
11149
11150 @item -k @var{kflag}
11151 Use @var{kflag} keyword expansion.  See
11152 @ref{Substitution modes}.
11153
11154 @item -l
11155 Local; run only in current working directory.  @xref{Recursive behavior}.
11156
11157 @item -N
11158 Don't ``shorten'' module paths if -d specified.  See
11159 @ref{checkout options}.
11160
11161 @item -n
11162 Do not run module program (if any).  See @ref{checkout options}.
11163
11164 @item -P
11165 Prune empty directories.  See @ref{Moving directories}.
11166
11167 @item -p
11168 Check out files to standard output (avoids
11169 stickiness).  See @ref{checkout options}.
11170
11171 @item -R
11172 Operate recursively (default).  @xref{Recursive
11173 behavior}.
11174
11175 @item -r @var{tag}
11176 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11177
11178 @item -s
11179 Like -c, but include module status.  See @ref{checkout options}.
11180 @end table
11181
11182 @c ------------------------------------------------------------
11183 @item commit [@var{options}] [@var{files}@dots{}]
11184 Check changes into the repository.  See @ref{commit}.
11185
11186 @table @code
11187 @item -F @var{file}
11188 Read log message from @var{file}.  See @ref{commit options}.
11189
11190 @item -f
11191 @c What is this "disables recursion"?  It is from the
11192 @c on-line help; is it documented in this manual?
11193 Force the file to be committed; disables recursion.
11194 See @ref{commit options}.
11195
11196 @item -l
11197 Local; run only in current working directory.  See @ref{Recursive behavior}.
11198
11199 @item -m @var{msg}
11200 Use @var{msg} as log message.  See @ref{commit options}.
11201
11202 @item -n
11203 Do not run module program (if any).  See @ref{commit options}.
11204
11205 @item -R
11206 Operate recursively (default).  @xref{Recursive
11207 behavior}.
11208
11209 @item -r @var{rev}
11210 Commit to @var{rev}.  See @ref{commit options}.
11211 @c FIXME: should be dragging over text from
11212 @c commit options, especially if it can be cleaned up
11213 @c and made concise enough.
11214 @end table
11215
11216 @c ------------------------------------------------------------
11217 @item diff [@var{options}] [@var{files}@dots{}]
11218 Show differences between revisions.  See @ref{diff}.
11219 In addition to the options shown below, accepts a wide
11220 variety of options to control output style, for example
11221 @samp{-c} for context diffs.
11222
11223 @table @code
11224 @item -D @var{date1}
11225 Diff revision for date against working file.  See
11226 @ref{diff options}.
11227
11228 @item -D @var{date2}
11229 Diff @var{rev1}/@var{date1} against @var{date2}.  See
11230 @ref{diff options}.
11231
11232 @item -l
11233 Local; run only in current working directory.  See @ref{Recursive behavior}.
11234
11235 @item -N
11236 Include diffs for added and removed files.  See
11237 @ref{diff options}.
11238
11239 @item -R
11240 Operate recursively (default).  @xref{Recursive
11241 behavior}.
11242
11243 @item -r @var{rev1}
11244 Diff revision for @var{rev1} against working file.  See
11245 @ref{diff options}.
11246
11247 @item -r @var{rev2}
11248 Diff @var{rev1}/@var{date1} against @var{rev2}.  See @ref{diff options}.
11249 @end table
11250
11251 @c ------------------------------------------------------------
11252 @item edit [@var{options}] [@var{files}@dots{}]
11253 Get ready to edit a watched file.  See @ref{Editing files}.
11254
11255 @table @code
11256 @item -a @var{actions}
11257 Specify actions for temporary watch, where
11258 @var{actions} is @code{edit}, @code{unedit},
11259 @code{commit}, @code{all}, or @code{none}.  See
11260 @ref{Editing files}.
11261
11262 @item -l
11263 Local; run only in current working directory.  See @ref{Recursive behavior}.
11264
11265 @item -R
11266 Operate recursively (default).  @xref{Recursive
11267 behavior}.
11268 @end table
11269
11270 @c ------------------------------------------------------------
11271 @item editors [@var{options}] [@var{files}@dots{}]
11272 See who is editing a watched file.  See @ref{Watch information}.
11273
11274 @table @code
11275 @item -l
11276 Local; run only in current working directory.  See @ref{Recursive behavior}.
11277
11278 @item -R
11279 Operate recursively (default).  @xref{Recursive
11280 behavior}.
11281 @end table
11282
11283 @c ------------------------------------------------------------
11284 @item export [@var{options}] @var{modules}@dots{}
11285 Export files from @sc{cvs}.  See @ref{export}.
11286
11287 @table @code
11288 @item -D @var{date}
11289 Check out revisions as of @var{date}.  See
11290 @ref{Common options}.
11291
11292 @item -d @var{dir}
11293 Check out into @var{dir}.  See @ref{export options}.
11294
11295 @item -f
11296 Use head revision if tag/date not found.  See
11297 @ref{Common options}.
11298
11299 @item -k @var{kflag}
11300 Use @var{kflag} keyword expansion.  See
11301 @ref{Substitution modes}.
11302
11303 @item -l
11304 Local; run only in current working directory.  @xref{Recursive behavior}.
11305
11306 @item -N
11307 Don't ``shorten'' module paths if -d specified.  See
11308 @ref{export options}.
11309
11310 @item -n
11311 Do not run module program (if any).  See @ref{export options}.
11312
11313 @item -R
11314 Operate recursively (default).  @xref{Recursive
11315 behavior}.
11316
11317 @item -r @var{tag}
11318 Checkout revision @var{tag}.  See @ref{Common options}.
11319 @end table
11320
11321 @c ------------------------------------------------------------
11322 @item history [@var{options}] [@var{files}@dots{}]
11323 Show repository access history.  See @ref{history}.
11324
11325 @table @code
11326 @item -a
11327 All users (default is self).  See @ref{history options}.
11328
11329 @item -b @var{str}
11330 Back to record with @var{str} in module/file/repos
11331 field.  See @ref{history options}.
11332
11333 @item -c
11334 Report on committed (modified) files.  See @ref{history options}.
11335
11336 @item -D @var{date}
11337 Since @var{date}.  See @ref{history options}.
11338
11339 @item -e
11340 Report on all record types.  See @ref{history options}.
11341
11342 @item -l
11343 Last modified (committed or modified report).  See @ref{history options}.
11344
11345 @item -m @var{module}
11346 Report on @var{module} (repeatable).  See @ref{history options}.
11347
11348 @item -n @var{module}
11349 In @var{module}.  See @ref{history options}.
11350
11351 @item -o
11352 Report on checked out modules.  See @ref{history options}.
11353
11354 @item -p @var{repository}
11355 In @var{repository}.  See @ref{history options}.
11356
11357 @item -r @var{rev}
11358 Since revision @var{rev}.  See @ref{history options}.
11359
11360 @item -T
11361 @c What the @#$@# is a TAG?  Same as a tag?  This
11362 @c wording is also in the online-line help.
11363 Produce report on all TAGs.  See @ref{history options}.
11364
11365 @item -t @var{tag}
11366 Since tag record placed in history file (by anyone).
11367 See @ref{history options}.
11368
11369 @item -u @var{user}
11370 For user @var{user} (repeatable).  See @ref{history options}.
11371
11372 @item -w
11373 Working directory must match.  See @ref{history options}.
11374
11375 @item -x @var{types}
11376 Report on @var{types}, one or more of
11377 @code{TOEFWUPCGMAR}.  See @ref{history options}.
11378
11379 @item -z @var{zone}
11380 Output for time zone @var{zone}.  See @ref{history options}.
11381 @end table
11382
11383 @c ------------------------------------------------------------
11384 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
11385 Import files into @sc{cvs}, using vendor branches.  See
11386 @ref{import}.
11387
11388 @table @code
11389 @item -b @var{bra}
11390 Import to vendor branch @var{bra}.  See
11391 @ref{Multiple vendor branches}.
11392
11393 @item -d
11394 Use the file's modification time as the time of
11395 import.  See @ref{import options}.
11396
11397 @item -k @var{kflag}
11398 Set default keyword substitution mode.  See
11399 @ref{import options}.
11400
11401 @item -m @var{msg}
11402 Use @var{msg} for log message.  See
11403 @ref{import options}.
11404
11405 @item -I @var{ign}
11406 More files to ignore (! to reset).  See
11407 @ref{import options}.
11408
11409 @item -W @var{spec}
11410 More wrappers.  See @ref{import options}.
11411 @end table
11412
11413 @c ------------------------------------------------------------
11414 @item init
11415 Create a @sc{cvs} repository if it doesn't exist.  See
11416 @ref{Creating a repository}.
11417
11418 @c ------------------------------------------------------------
11419 @item kserver
11420 Kerberos authenticated server.
11421 See @ref{Kerberos authenticated}.
11422
11423 @c ------------------------------------------------------------
11424 @item log [@var{options}] [@var{files}@dots{}]
11425 Print out history information for files.  See @ref{log}.
11426
11427 @table @code
11428 @item -b
11429 Only list revisions on the default branch.  See @ref{log options}.
11430
11431 @item -d @var{dates}
11432 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
11433 latest before).  See @ref{log options}.
11434
11435 @item -h
11436 Only print header.  See @ref{log options}.
11437
11438 @item -l
11439 Local; run only in current working directory.  See @ref{Recursive behavior}.
11440
11441 @item -N
11442 Do not list tags.  See @ref{log options}.
11443
11444 @item -R
11445 Only print name of RCS file.  See @ref{log options}.
11446
11447 @item -r@var{revs}
11448 Only list revisions @var{revs}.  See @ref{log options}.
11449
11450 @item -s @var{states}
11451 Only list revisions with specified states.  See @ref{log options}.
11452
11453 @item -t
11454 Only print header and descriptive text.  See @ref{log
11455 options}.
11456
11457 @item -w@var{logins}
11458 Only list revisions checked in by specified logins.  See @ref{log options}.
11459 @end table
11460
11461 @c ------------------------------------------------------------
11462 @item login
11463 Prompt for password for authenticating server.  See
11464 @ref{Password authentication client}.
11465
11466 @c ------------------------------------------------------------
11467 @item logout
11468 Remove stored password for authenticating server.  See
11469 @ref{Password authentication client}.
11470
11471 @c ------------------------------------------------------------
11472 @item pserver
11473 Password authenticated server.
11474 See @ref{Password authentication server}.
11475
11476 @c ------------------------------------------------------------
11477 @item rannotate [@var{options}] [@var{modules}@dots{}]
11478 Show last revision where each line was modified.  See
11479 @ref{annotate}.
11480
11481 @table @code
11482 @item -D @var{date}
11483 Annotate the most recent revision no later than
11484 @var{date}.  See @ref{Common options}.
11485
11486 @item -F
11487 Force annotation of binary files.  (Without this option,
11488 binary files are skipped with a message.)
11489
11490 @item -f
11491 Use head revision if tag/date not found.  See
11492 @ref{Common options}.
11493
11494 @item -l
11495 Local; run only in current working directory.  @xref{Recursive behavior}.
11496
11497 @item -R
11498 Operate recursively (default).  @xref{Recursive behavior}.
11499
11500 @item -r @var{tag}
11501 Annotate revision @var{tag}.  See @ref{Common options}.
11502 @end table
11503
11504 @c ------------------------------------------------------------
11505 @item rdiff [@var{options}] @var{modules}@dots{}
11506 Show differences between releases.  See @ref{rdiff}.
11507
11508 @table @code
11509 @item -c
11510 Context diff output format (default).  See @ref{rdiff options}.
11511
11512 @item -D @var{date}
11513 Select revisions based on @var{date}.  See @ref{Common options}.
11514
11515 @item -f
11516 Use head revision if tag/date not found.  See
11517 @ref{Common options}.
11518
11519 @item -l
11520 Local; run only in current working directory.  See @ref{Recursive behavior}.
11521
11522 @item -R
11523 Operate recursively (default).  @xref{Recursive
11524 behavior}.
11525
11526 @item -r @var{rev}
11527 Select revisions based on @var{rev}.  See @ref{Common options}.
11528
11529 @item -s
11530 Short patch - one liner per file.  See @ref{rdiff options}.
11531
11532 @item -t
11533 Top two diffs - last change made to the file.  See
11534 @ref{diff options}.
11535
11536 @item -u
11537 Unidiff output format.  See @ref{rdiff options}.
11538
11539 @item -V @var{vers}
11540 Use RCS Version @var{vers} for keyword expansion (obsolete).  See
11541 @ref{rdiff options}.
11542 @end table
11543
11544 @c ------------------------------------------------------------
11545 @item release [@var{options}] @var{directory}
11546 Indicate that a directory is no longer in use.  See
11547 @ref{release}.
11548
11549 @table @code
11550 @item -d
11551 Delete the given directory.  See @ref{release options}.
11552 @end table
11553
11554 @c ------------------------------------------------------------
11555 @item remove [@var{options}] [@var{files}@dots{}]
11556 Remove an entry from the repository.  See @ref{Removing files}.
11557
11558 @table @code
11559 @item -f
11560 Delete the file before removing it.  See @ref{Removing files}.
11561
11562 @item -l
11563 Local; run only in current working directory.  See @ref{Recursive behavior}.
11564
11565 @item -R
11566 Operate recursively (default).  @xref{Recursive
11567 behavior}.
11568 @end table
11569
11570 @c ------------------------------------------------------------
11571 @item rlog [@var{options}] [@var{files}@dots{}]
11572 Print out history information for modules.  See @ref{log}.
11573
11574 @table @code
11575 @item -b
11576 Only list revisions on the default branch.  See @ref{log options}.
11577
11578 @item -d @var{dates}
11579 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
11580 latest before).  See @ref{log options}.
11581
11582 @item -h
11583 Only print header.  See @ref{log options}.
11584
11585 @item -l
11586 Local; run only in current working directory.  See @ref{Recursive behavior}.
11587
11588 @item -N
11589 Do not list tags.  See @ref{log options}.
11590
11591 @item -R
11592 Only print name of RCS file.  See @ref{log options}.
11593
11594 @item -r@var{revs}
11595 Only list revisions @var{revs}.  See @ref{log options}.
11596
11597 @item -s @var{states}
11598 Only list revisions with specified states.  See @ref{log options}.
11599
11600 @item -t
11601 Only print header and descriptive text.  See @ref{log options}.
11602
11603 @item -w@var{logins}
11604 Only list revisions checked in by specified logins.  See @ref{log options}.
11605 @end table
11606
11607 @c ------------------------------------------------------------
11608 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
11609 Add a symbolic tag to a module.
11610 See @ref{Revisions} and @ref{Branching and merging}.
11611
11612 @table @code
11613 @item -a
11614 Clear tag from removed files that would not otherwise
11615 be tagged.  See @ref{Tagging add/remove}.
11616
11617 @item -b
11618 Create a branch named @var{tag}.  See @ref{Branching and merging}.
11619
11620 @item -B
11621 Used in conjunction with -F or -d, enables movement and deletion of
11622 branch tags.  Use with extreme caution. 
11623
11624 @item -D @var{date}
11625 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
11626
11627 @item -d
11628 Delete @var{tag}.  See @ref{Modifying tags}.
11629
11630 @item -F
11631 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
11632
11633 @item -f
11634 Force a head revision match if tag/date not found.
11635 See @ref{Tagging by date/tag}.
11636
11637 @item -l
11638 Local; run only in current working directory.  See @ref{Recursive behavior}.
11639
11640 @item -n
11641 No execution of tag program.  See @ref{Common options}.
11642
11643 @item -R
11644 Operate recursively (default).  @xref{Recursive
11645 behavior}.
11646
11647 @item -r @var{rev}
11648 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
11649 @end table
11650
11651 @c ------------------------------------------------------------
11652 @item server
11653 Rsh server.  See @ref{Connecting via rsh}.
11654
11655 @c ------------------------------------------------------------
11656 @item status [@var{options}] @var{files}@dots{}
11657 Display status information in a working directory.  See
11658 @ref{File status}.
11659
11660 @table @code
11661 @item -l
11662 Local; run only in current working directory.  See @ref{Recursive behavior}.
11663
11664 @item -R
11665 Operate recursively (default).  @xref{Recursive
11666 behavior}.
11667
11668 @item -v
11669 Include tag information for file.  See @ref{Tags}.
11670 @end table
11671
11672 @c ------------------------------------------------------------
11673 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
11674 Add a symbolic tag to checked out version of files.
11675 See @ref{Revisions} and @ref{Branching and merging}.
11676
11677 @table @code
11678 @item -b
11679 Create a branch named @var{tag}.  See @ref{Branching and merging}.
11680
11681 @item -c
11682 Check that working files are unmodified.  See
11683 @ref{Tagging the working directory}.
11684
11685 @item -D @var{date}
11686 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
11687
11688 @item -d
11689 Delete @var{tag}.  See @ref{Modifying tags}.
11690
11691 @item -F
11692 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
11693
11694 @item -f
11695 Force a head revision match if tag/date not found.
11696 See @ref{Tagging by date/tag}.
11697
11698 @item -l
11699 Local; run only in current working directory.  See @ref{Recursive behavior}.
11700
11701 @item -R
11702 Operate recursively (default).  @xref{Recursive
11703 behavior}.
11704
11705 @item -r @var{rev}
11706 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
11707 @end table
11708
11709 @c ------------------------------------------------------------
11710 @item unedit [@var{options}] [@var{files}@dots{}]
11711 Undo an edit command.  See @ref{Editing files}.
11712
11713 @table @code
11714 @item -l
11715 Local; run only in current working directory.  See @ref{Recursive behavior}.
11716
11717 @item -R
11718 Operate recursively (default).  @xref{Recursive behavior}.
11719 @end table
11720
11721 @c ------------------------------------------------------------
11722 @item update [@var{options}] [@var{files}@dots{}]
11723 Bring work tree in sync with repository.  See
11724 @ref{update}.
11725
11726 @table @code
11727 @item -A
11728 Reset any sticky tags/date/options.  See @ref{Sticky
11729 tags} and @ref{Keyword substitution}.
11730
11731 @item -C
11732 Overwrite locally modified files with clean copies from
11733 the repository (the modified file is saved in
11734 @file{.#@var{file}.@var{revision}}, however).
11735
11736 @item -D @var{date}
11737 Check out revisions as of @var{date} (is sticky).  See
11738 @ref{Common options}.
11739
11740 @item -d
11741 Create directories.  See @ref{update options}.
11742
11743 @item -f
11744 Use head revision if tag/date not found.  See
11745 @ref{Common options}.
11746
11747 @item -I @var{ign}
11748 More files to ignore (! to reset).  See
11749 @ref{import options}.
11750
11751 @c Probably want to use rev1/rev2 style like for diff
11752 @c -r.  Here and in on-line help.
11753 @item -j @var{rev}
11754 Merge in changes.  See @ref{update options}.
11755
11756 @item -k @var{kflag}
11757 Use @var{kflag} keyword expansion.  See
11758 @ref{Substitution modes}.
11759
11760 @item -l
11761 Local; run only in current working directory.  @xref{Recursive behavior}.
11762
11763 @item -P
11764 Prune empty directories.  See @ref{Moving directories}.
11765
11766 @item -p
11767 Check out files to standard output (avoids
11768 stickiness).  See @ref{update options}.
11769
11770 @item -R
11771 Operate recursively (default).  @xref{Recursive
11772 behavior}.
11773
11774 @item -r @var{tag}
11775 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11776
11777 @item -W @var{spec}
11778 More wrappers.  See @ref{import options}.
11779 @end table
11780
11781 @c ------------------------------------------------------------
11782 @item version
11783 @cindex version (subcommand)
11784
11785 Display the version of @sc{cvs} being used.  If the repository
11786 is remote, display both the client and server versions.
11787
11788 @c ------------------------------------------------------------
11789 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
11790
11791 on/off: turn on/off read-only checkouts of files.  See
11792 @ref{Setting a watch}.
11793
11794 add/remove: add or remove notification on actions.  See
11795 @ref{Getting Notified}.
11796
11797 @table @code
11798 @item -a @var{actions}
11799 Specify actions for temporary watch, where
11800 @var{actions} is @code{edit}, @code{unedit},
11801 @code{commit}, @code{all}, or @code{none}.  See
11802 @ref{Editing files}.
11803
11804 @item -l
11805 Local; run only in current working directory.  See @ref{Recursive behavior}.
11806
11807 @item -R
11808 Operate recursively (default).  @xref{Recursive
11809 behavior}.
11810 @end table
11811
11812 @c ------------------------------------------------------------
11813 @item watchers [@var{options}] [@var{files}@dots{}]
11814 See who is watching a file.  See @ref{Watch information}.
11815
11816 @table @code
11817 @item -l
11818 Local; run only in current working directory.  See @ref{Recursive behavior}.
11819
11820 @item -R
11821 Operate recursively (default).  @xref{Recursive
11822 behavior}.
11823 @end table
11824
11825 @end table
11826
11827 @c ---------------------------------------------------------------------
11828 @node Administrative files
11829 @appendix Reference manual for Administrative files
11830 @cindex Administrative files (reference)
11831 @cindex Files, reference manual
11832 @cindex Reference manual (files)
11833 @cindex CVSROOT (file)
11834
11835 @c FIXME?  Somewhere there needs to be a more "how-to"
11836 @c guide to writing these.  I think the triggers
11837 @c (commitinfo, loginfo, taginfo, &c) are perhaps a
11838 @c different case than files like modules.  One
11839 @c particular issue that people sometimes are
11840 @c (unnecessarily?) worried about is performance, and
11841 @c the impact of writing in perl or sh or ____.
11842 Inside the repository, in the directory
11843 @file{$CVSROOT/CVSROOT}, there are a number of
11844 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
11845 fashion without any of them, but if they are set up
11846 properly they can help make life easier.  For a
11847 discussion of how to edit them, see @ref{Intro
11848 administrative files}.
11849
11850 The most important of these files is the @file{modules}
11851 file, which defines the modules inside the repository.
11852
11853 @menu
11854 * modules::                     Defining modules
11855 * Wrappers::                    Specify binary-ness based on file name
11856 * commit files::                The commit support files (commitinfo,
11857                                 verifymsg, editinfo, loginfo)
11858 * taginfo::                     Verifying/Logging tags
11859 * rcsinfo::                     Templates for the log messages
11860 * cvsignore::                   Ignoring files via cvsignore
11861 * checkoutlist::                Adding your own administrative files
11862 * history file::                History information
11863 * Variables::                   Various variables are expanded
11864 * config::                      Miscellaneous CVS configuration
11865 @end menu
11866
11867 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11868 @node modules
11869 @appendixsec The modules file
11870 @cindex Modules (admin file)
11871 @cindex Defining modules (reference manual)
11872
11873 The @file{modules} file records your definitions of
11874 names for collections of source code.  @sc{cvs} will
11875 use these definitions if you use @sc{cvs} to update the
11876 modules file (use normal commands like @code{add},
11877 @code{commit}, etc).
11878
11879 The @file{modules} file may contain blank lines and
11880 comments (lines beginning with @samp{#}) as well as
11881 module definitions.  Long lines can be continued on the
11882 next line by specifying a backslash (@samp{\}) as the
11883 last character on the line.
11884
11885 There are three basic types of modules: alias modules,
11886 regular modules, and ampersand modules.  The difference
11887 between them is the way that they map files in the
11888 repository to files in the working directory.  In all
11889 of the following examples, the top-level repository
11890 contains a directory called @file{first-dir}, which
11891 contains two files, @file{file1} and @file{file2}, and a
11892 directory @file{sdir}.  @file{first-dir/sdir} contains
11893 a file @file{sfile}.
11894
11895 @c FIXME: should test all the examples in this section.
11896
11897 @menu
11898 * Alias modules::             The simplest kind of module
11899 * Regular modules::
11900 * Ampersand modules::
11901 * Excluding directories::     Excluding directories from a module
11902 * Module options::            Regular and ampersand modules can take options
11903 * Module program options::    How the modules ``program options'' programs
11904                               are run. 
11905 @end menu
11906
11907 @node Alias modules
11908 @appendixsubsec Alias modules
11909 @cindex Alias modules
11910 @cindex -a, in modules file
11911
11912 Alias modules are the simplest kind of module:
11913
11914 @table @code
11915 @item @var{mname} -a @var{aliases}@dots{}
11916 This represents the simplest way of defining a module
11917 @var{mname}.  The @samp{-a} flags the definition as a
11918 simple alias: @sc{cvs} will treat any use of @var{mname} (as
11919 a command argument) as if the list of names
11920 @var{aliases} had been specified instead.
11921 @var{aliases} may contain either other module names or
11922 paths.  When you use paths in aliases, @code{checkout}
11923 creates all intermediate directories in the working
11924 directory, just as if the path had been specified
11925 explicitly in the @sc{cvs} arguments.
11926 @end table
11927
11928 For example, if the modules file contains:
11929
11930 @example
11931 amodule -a first-dir
11932 @end example
11933
11934 @noindent
11935 then the following two commands are equivalent:
11936
11937 @example
11938 $ cvs co amodule
11939 $ cvs co first-dir
11940 @end example
11941
11942 @noindent
11943 and they each would provide output such as:
11944
11945 @example
11946 cvs checkout: Updating first-dir
11947 U first-dir/file1
11948 U first-dir/file2
11949 cvs checkout: Updating first-dir/sdir
11950 U first-dir/sdir/sfile
11951 @end example
11952
11953 @node Regular modules
11954 @appendixsubsec Regular modules
11955 @cindex Regular modules
11956
11957 @table @code
11958 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
11959 In the simplest case, this form of module definition
11960 reduces to @samp{@var{mname} @var{dir}}.  This defines
11961 all the files in directory @var{dir} as module mname.
11962 @var{dir} is a relative path (from @code{$CVSROOT}) to a
11963 directory of source in the source repository.  In this
11964 case, on checkout, a single directory called
11965 @var{mname} is created as a working directory; no
11966 intermediate directory levels are used by default, even
11967 if @var{dir} was a path involving several directory
11968 levels.
11969 @end table
11970
11971 For example, if a module is defined by:
11972
11973 @example
11974 regmodule first-dir
11975 @end example
11976
11977 @noindent
11978 then regmodule will contain the files from first-dir:
11979
11980 @example
11981 $ cvs co regmodule
11982 cvs checkout: Updating regmodule
11983 U regmodule/file1
11984 U regmodule/file2
11985 cvs checkout: Updating regmodule/sdir
11986 U regmodule/sdir/sfile
11987 $
11988 @end example
11989
11990 By explicitly specifying files in the module definition
11991 after @var{dir}, you can select particular files from
11992 directory @var{dir}.  Here is
11993 an example:
11994
11995 @example
11996 regfiles first-dir/sdir sfile
11997 @end example
11998
11999 @noindent
12000 With this definition, getting the regfiles module
12001 will create a single working directory
12002 @file{regfiles} containing the file listed, which
12003 comes from a directory deeper
12004 in the @sc{cvs} source repository:
12005
12006 @example
12007 $ cvs co regfiles
12008 U regfiles/sfile
12009 $
12010 @end example
12011
12012 @node Ampersand modules
12013 @appendixsubsec Ampersand modules
12014 @cindex Ampersand modules
12015 @cindex &, in modules file
12016
12017 A module definition can refer to other modules by
12018 including @samp{&@var{module}} in its definition.
12019 @example
12020 @var{mname} [ options ] @var{&module}@dots{}
12021 @end example
12022
12023 Then getting the module creates a subdirectory for each such
12024 module, in the directory containing the module.  For
12025 example, if modules contains
12026
12027 @example
12028 ampermod &first-dir
12029 @end example
12030
12031 @noindent
12032 then a checkout will create an @code{ampermod} directory
12033 which contains a directory called @code{first-dir},
12034 which in turns contains all the directories and files
12035 which live there.  For example, the command
12036
12037 @example
12038 $ cvs co ampermod
12039 @end example
12040
12041 @noindent
12042 will create the following files:
12043
12044 @example
12045 ampermod/first-dir/file1
12046 ampermod/first-dir/file2
12047 ampermod/first-dir/sdir/sfile
12048 @end example
12049
12050 There is one quirk/bug: the messages that @sc{cvs}
12051 prints omit the @file{ampermod}, and thus do not
12052 correctly display the location to which it is checking
12053 out the files:
12054
12055 @example
12056 $ cvs co ampermod
12057 cvs checkout: Updating first-dir
12058 U first-dir/file1
12059 U first-dir/file2
12060 cvs checkout: Updating first-dir/sdir
12061 U first-dir/sdir/sfile
12062 $
12063 @end example
12064
12065 Do not rely on this buggy behavior; it may get fixed in
12066 a future release of @sc{cvs}.
12067
12068 @c FIXCVS: What happens if regular and & modules are
12069 @c combined, as in "ampermodule first-dir &second-dir"?
12070 @c When I tried it, it seemed to just ignore the
12071 @c "first-dir".  I think perhaps it should be an error
12072 @c (but this needs further investigation).
12073 @c In addition to discussing what each one does, we
12074 @c should put in a few words about why you would use one or
12075 @c the other in various situations.
12076
12077 @node Excluding directories
12078 @appendixsubsec Excluding directories
12079 @cindex Excluding directories, in modules file
12080 @cindex !, in modules file
12081
12082 An alias module may exclude particular directories from
12083 other modules by using an exclamation mark (@samp{!})
12084 before the name of each directory to be excluded.
12085
12086 For example, if the modules file contains:
12087
12088 @example
12089 exmodule -a !first-dir/sdir first-dir
12090 @end example
12091
12092 @noindent
12093 then checking out the module @samp{exmodule} will check
12094 out everything in @samp{first-dir} except any files in
12095 the subdirectory @samp{first-dir/sdir}.
12096 @c Note that the "!first-dir/sdir" sometimes must be listed
12097 @c before "first-dir".  That seems like a probable bug, in which
12098 @c case perhaps it should be fixed (to allow either
12099 @c order) rather than documented.  See modules4 in testsuite.
12100
12101 @node Module options
12102 @appendixsubsec Module options
12103 @cindex Options, in modules file
12104
12105 Either regular modules or ampersand modules can contain
12106 options, which supply additional information concerning
12107 the module.
12108
12109 @table @code
12110 @cindex -d, in modules file
12111 @item -d @var{name}
12112 Name the working directory something other than the
12113 module name.
12114 @c FIXME: Needs a bunch of examples, analogous to the
12115 @c examples for alias, regular, and ampersand modules
12116 @c which show where the files go without -d.
12117
12118 @cindex Export program
12119 @cindex -e, in modules file
12120 @item -e @var{prog}
12121 Specify a program @var{prog} to run whenever files in a
12122 module are exported.  @var{prog} runs with a single
12123 argument, the module name.
12124 @c FIXME: Is it run on server? client?
12125
12126 @cindex Checkout program
12127 @cindex -o, in modules file
12128 @item -o @var{prog}
12129 Specify a program @var{prog} to run whenever files in a
12130 module are checked out.  @var{prog} runs with a single
12131 argument, the module name.  See @ref{Module program options} for
12132 information on how @var{prog} is called.
12133 @c FIXME: Is it run on server? client?
12134
12135 @cindex Status of a module
12136 @cindex Module status
12137 @cindex -s, in modules file
12138 @item -s @var{status}
12139 Assign a status to the module.  When the module file is
12140 printed with @samp{cvs checkout -s} the modules are
12141 sorted according to primarily module status, and
12142 secondarily according to the module name.  This option
12143 has no other meaning.  You can use this option for
12144 several things besides status: for instance, list the
12145 person that is responsible for this module.
12146
12147 @cindex Tag program
12148 @cindex -t, in modules file
12149 @item -t @var{prog}
12150 Specify a program @var{prog} to run whenever files in a
12151 module are tagged with @code{rtag}.  @var{prog} runs
12152 with two arguments: the module name and the symbolic
12153 tag specified to @code{rtag}.  It is not run
12154 when @code{tag} is executed.  Generally you will find
12155 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
12156 @c FIXME: Is it run on server? client?
12157 @c Problems with -t include:
12158 @c * It is run after the tag not before
12159 @c * It doesn't get passed all the information that
12160 @c   taginfo does ("mov", &c).
12161 @c * It only is run for rtag, not tag.
12162 @end table
12163
12164 You should also see @pxref{Module program options} about how the
12165 ``program options'' programs are run.
12166
12167 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12168
12169 @node Module program options
12170 @appendixsubsec How the modules file ``program options'' programs are run
12171 @cindex Modules file program options
12172 @cindex -t, in modules file
12173 @cindex -o, in modules file
12174 @cindex -e, in modules file
12175
12176 @noindent
12177 For checkout, rtag, and export, the program is server-based, and as such the
12178 following applies:-
12179
12180 If using remote access methods (pserver, ext, etc.),
12181 @sc{cvs} will execute this program on the server from a temporary
12182 directory. The path is searched for this program.
12183
12184 If using ``local access'' (on a local or remote NFS file system, i.e.
12185 repository set just to a path),
12186 the program will be executed from the newly checked-out tree, if
12187 found there, or alternatively searched for in the path if not.
12188
12189 The programs are all run after the operation has effectively
12190 completed.
12191
12192
12193 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12194 @node Wrappers
12195 @appendixsec The cvswrappers file
12196 @cindex cvswrappers (admin file)
12197 @cindex CVSWRAPPERS, environment variable
12198 @cindex Wrappers
12199
12200 @c FIXME: need some better way of separating this out
12201 @c by functionality.  -m is
12202 @c one feature, and -k is a another.  And this discussion
12203 @c should be better motivated (e.g. start with the
12204 @c problems, then explain how the feature solves it).
12205
12206 Wrappers refers to a @sc{cvs} feature which lets you
12207 control certain settings based on the name of the file
12208 which is being operated on.  The settings are @samp{-k}
12209 for binary files, and @samp{-m} for nonmergeable text
12210 files.
12211
12212 The @samp{-m} option
12213 specifies the merge methodology that should be used when
12214 a non-binary file is updated.  @code{MERGE} means the usual
12215 @sc{cvs} behavior: try to merge the files.  @code{COPY}
12216 means that @code{cvs update} will refuse to merge
12217 files, as it also does for files specified as binary
12218 with @samp{-kb} (but if the file is specified as
12219 binary, there is no need to specify @samp{-m 'COPY'}).
12220 @sc{cvs} will provide the user with the
12221 two versions of the files, and require the user using
12222 mechanisms outside @sc{cvs}, to insert any necessary
12223 changes.
12224
12225 @strong{WARNING: do not use @code{COPY} with
12226 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
12227 copy one version of your file over the other, wiping
12228 out the previous contents.}
12229 @c Ordinarily we don't document the behavior of old
12230 @c versions.  But this one is so dangerous, I think we
12231 @c must.  I almost renamed it to -m 'NOMERGE' so we
12232 @c could say "never use -m 'COPY'".
12233 The @samp{-m} wrapper option only affects behavior when
12234 merging is done on update; it does not affect how files
12235 are stored.  See @ref{Binary files}, for more on
12236 binary files.
12237
12238 The basic format of the file @file{cvswrappers} is:
12239
12240 @c FIXME: @example is all wrong for this.  Use @deffn or
12241 @c something more sensible.
12242 @example
12243 wildcard     [option value][option value]...
12244
12245 where option is one of
12246 -m           update methodology      value: MERGE or COPY
12247 -k           keyword expansion       value: expansion mode
12248
12249 and value is a single-quote delimited value.
12250 @end example
12251
12252 @ignore
12253 @example
12254 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
12255 *.c      -t 'indent %s %s'
12256 @end example
12257 @c When does the filter need to be an absolute pathname
12258 @c and when will something like the above work?  I
12259 @c suspect it relates to the PATH of the server (which
12260 @c in turn depends on all kinds of stuff, e.g. inetd
12261 @c for pserver).  I'm not sure whether/where to discuss
12262 @c this.
12263 @c FIXME: What do the %s's stand for?
12264
12265 @noindent
12266 The above example of a @file{cvswrappers} file
12267 states that all files/directories that end with a @code{.nib}
12268 should be filtered with the @file{wrap} program before
12269 checking the file into the repository. The file should
12270 be filtered though the @file{unwrap} program when the
12271 file is checked out of the repository. The
12272 @file{cvswrappers} file also states that a @code{COPY}
12273 methodology should be used when updating the files in
12274 the repository (that is, no merging should be performed).
12275
12276 @c What pitfalls arise when using indent this way?  Is
12277 @c it a winning thing to do?  Would be nice to at least
12278 @c hint at those issues; we want our examples to tell
12279 @c how to solve problems, not just to say that cvs can
12280 @c do certain things.
12281 The last example line says that all files that end with
12282 @code{.c} should be filtered with @file{indent}
12283 before being checked into the repository. Unlike the previous
12284 example, no filtering of the @code{.c} file is done when
12285 it is checked out of the repository.
12286 @noindent
12287 The @code{-t} filter is called with two arguments,
12288 the first is the name of the file/directory to filter
12289 and the second is the pathname to where the resulting
12290 filtered file should be placed.
12291
12292 @noindent
12293 The @code{-f} filter is called with one argument,
12294 which is the name of the file to filter from. The end
12295 result of this filter will be a file in the users directory
12296 that they can work on as they normally would.
12297
12298 Note that the @samp{-t}/@samp{-f} features do not
12299 conveniently handle one portion of @sc{cvs}'s operation:
12300 determining when files are modified.  @sc{cvs} will still
12301 want a file (or directory) to exist, and it will use
12302 its modification time to determine whether a file is
12303 modified.  If @sc{cvs} erroneously thinks a file is
12304 unmodified (for example, a directory is unchanged but
12305 one of the files within it is changed), you can force
12306 it to check in the file anyway by specifying the
12307 @samp{-f} option to @code{cvs commit} (@pxref{commit
12308 options}).
12309 @c This is, of course, a serious design flaw in -t/-f.
12310 @c Probably the whole functionality needs to be
12311 @c redesigned (starting from requirements) to fix this.
12312 @end ignore
12313
12314 @c FIXME: We don't document -W or point to where it is
12315 @c documented.  Or .cvswrappers.
12316 For example, the following command imports a
12317 directory, treating files whose name ends in
12318 @samp{.exe} as binary:
12319
12320 @example
12321 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
12322 @end example
12323
12324 @c Another good example, would be storing files
12325 @c (e.g. binary files) compressed in the repository.
12326 @c      ::::::::::::::::::
12327 @c      cvswrappers
12328 @c      ::::::::::::::::::
12329 @c      *.t12 -m 'COPY'
12330 @c      *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
12331 @c
12332 @c      ::::::::::::::::::
12333 @c      gunzipcp
12334 @c      ::::::::::::::::::
12335 @c      :
12336 @c      [ -f $1 ] || exit 1
12337 @c      zcat $1 > /tmp/.#$1.$$
12338 @c      mv /tmp/.#$1.$$ $1
12339 @c
12340 @c      ::::::::::::::::::
12341 @c      gzipcp
12342 @c      ::::::::::::::::::
12343 @c      :
12344 @c      DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
12345 @c      if [ ! -d $DIRNAME ] ; then
12346 @c            DIRNAME=`echo $1 | sed -e "s|.*/||g"`
12347 @c      fi
12348 @c      gzip -c  $DIRNAME  > $2
12349 @c One catch--"cvs diff" will not invoke the wrappers
12350 @c (probably a CVS bug, although I haven't thought it out).
12351
12352 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12353 @node commit files
12354 @appendixsec The commit support files
12355 @cindex Committing, administrative support files
12356
12357 The @samp{-i} flag in the @file{modules} file can be
12358 used to run a certain program whenever files are
12359 committed (@pxref{modules}).  The files described in
12360 this section provide other, more flexible, ways to run
12361 programs whenever something is committed.
12362
12363 There are three kinds of programs that can be run on
12364 commit.  They are specified in files in the repository,
12365 as described below.  The following table summarizes the
12366 file names and the purpose of the corresponding
12367 programs.
12368
12369 @table @file
12370 @item commitinfo
12371 The program is responsible for checking that the commit
12372 is allowed.  If it exits with a non-zero exit status
12373 the commit will be aborted.
12374
12375 @item verifymsg
12376 The specified program is used to evaluate the log message,
12377 and possibly verify that it contains all required
12378 fields.  This is most useful in combination with the
12379 @file{rcsinfo} file, which can hold a log message
12380 template (@pxref{rcsinfo}).
12381
12382 @item editinfo
12383 The specified program is used to edit the log message,
12384 and possibly verify that it contains all required
12385 fields.  This is most useful in combination with the
12386 @file{rcsinfo} file, which can hold a log message
12387 template (@pxref{rcsinfo}).  (obsolete)
12388
12389 @item loginfo
12390 The specified program is called when the commit is
12391 complete.  It receives the log message and some
12392 additional information and can store the log message in
12393 a file, or mail it to appropriate persons, or maybe
12394 post it to a local newsgroup, or@dots{}  Your
12395 imagination is the limit!
12396 @end table
12397
12398 @menu
12399 * syntax::                      The common syntax
12400 * commitinfo::                  Pre-commit checking
12401 * verifymsg::                   How are log messages evaluated?
12402 * editinfo::                    Specifying how log messages are created
12403                                 (obsolete)
12404 * loginfo::                     Where should log messages be sent?
12405 @end menu
12406
12407 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12408 @node syntax
12409 @appendixsubsec The common syntax
12410 @cindex Info files (syntax)
12411 @cindex Syntax of info files
12412 @cindex Common syntax of info files
12413
12414 @c FIXME: having this so totally separate from the
12415 @c Variables node is rather bogus.
12416
12417 The administrative files such as @file{commitinfo},
12418 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
12419 all have a common format.  The purpose of the files are
12420 described later on.  The common syntax is described
12421 here.
12422
12423 @cindex Regular expression syntax
12424 Each line contains the following:
12425 @itemize @bullet
12426 @item
12427 @c Say anything about DEFAULT and ALL?  Right now we
12428 @c leave that to the description of each file (and in fact
12429 @c the practice is inconsistent which is really annoying).
12430 A regular expression.  This is a basic regular
12431 expression in the syntax used by GNU emacs.
12432 @c FIXME: What we probably should be saying is "POSIX Basic
12433 @c Regular Expression with the following extensions (`\('
12434 @c `\|' '+' etc)"
12435 @c rather than define it with reference to emacs.
12436 @c The reference to emacs is not strictly speaking
12437 @c true, as we don't support \=, \s, or \S.  Also it isn't
12438 @c clear we should document and/or promise to continue to
12439 @c support all the obscure emacs extensions like \<.
12440 @c Also need to better cite (or include) full
12441 @c documentation for the syntax.
12442 @c Also see comment in configure.in about what happens to the
12443 @c syntax if we pick up a system-supplied regexp matcher.
12444
12445 @item
12446 A whitespace separator---one or more spaces and/or tabs.
12447
12448 @item
12449 A file name or command-line template.
12450 @end itemize
12451
12452 @noindent
12453 Blank lines are ignored.  Lines that start with the
12454 character @samp{#} are treated as comments.  Long lines
12455 unfortunately can @emph{not} be broken in two parts in
12456 any way.
12457
12458 The first regular expression that matches the current
12459 directory name in the repository is used.  The rest of the line
12460 is used as a file name or command-line as appropriate.
12461
12462 @c FIXME: need an example.  In particular, show what
12463 @c the regular expression is matched against (one
12464 @c ordinarily clueful person got confused about whether it
12465 @c includes the filename--"directory name" above should be
12466 @c unambiguous but there is nothing like an example to
12467 @c confirm people's understanding of this sort of thing).
12468
12469 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12470 @node commitinfo
12471 @appendixsubsec Commitinfo
12472 @cindex @file{commitinfo}
12473 @cindex Commits, precommit verification of
12474 @cindex Precommit checking
12475
12476 The @file{commitinfo} file defines programs to execute
12477 whenever @samp{cvs commit} is about to execute.  These
12478 programs are used for pre-commit checking to verify
12479 that the modified, added and removed files are really
12480 ready to be committed.  This could be used, for
12481 instance, to verify that the changed files conform to
12482 to your site's standards for coding practice.
12483
12484 As mentioned earlier, each line in the
12485 @file{commitinfo} file consists of a regular expression
12486 and a command-line template.  The template can include
12487 a program name and any number of arguments you wish to
12488 supply to it.  The full path to the current source
12489 repository is appended to the template, followed by the
12490 file names of any files involved in the commit (added,
12491 removed, and modified files).
12492
12493 @cindex Exit status, of commitinfo
12494 The first line with a regular expression matching the
12495 directory within the repository will be used.  If the
12496 command returns a non-zero exit status the commit will
12497 be aborted.
12498 @c FIXME: need example(s) of what "directory within the
12499 @c repository" means.
12500
12501 @cindex DEFAULT in commitinfo
12502 If the repository name does not match any of the
12503 regular expressions in this file, the @samp{DEFAULT}
12504 line is used, if it is specified.
12505
12506 @cindex ALL in commitinfo
12507 All occurrences of the name @samp{ALL} appearing as a
12508 regular expression are used in addition to the first
12509 matching regular expression or the name @samp{DEFAULT}.
12510
12511 @cindex @file{commitinfo}, working directory
12512 @cindex @file{commitinfo}, command environment
12513 The command will be run in the root of the workspace
12514 containing the new versions of any files the user would like
12515 to modify (commit), @emph{or in a copy of the workspace on
12516 the server (@pxref{Remote repositories})}.  If a file is
12517 being removed, there will be no copy of the file under the
12518 current directory.  If a file is being added, there will be
12519 no corresponding archive file in the repository unless the
12520 file is being resurrected.
12521
12522 Note that both the repository directory and the corresponding
12523 Attic (@pxref{Attic}) directory may need to be checked to
12524 locate the archive file corresponding to any given file being
12525 committed.  Much of the information about the specific commit
12526 request being made, including the destination branch, commit
12527 message, and command line options specified, is not available
12528 to the command.
12529
12530 @c FIXME: should discuss using commitinfo to control
12531 @c who has checkin access to what (e.g. Joe can check into
12532 @c directories a, b, and c, and Mary can check into
12533 @c directories b, c, and d--note this case cannot be
12534 @c conveniently handled with unix groups).  Of course,
12535 @c adding a new set of features to CVS might be a more
12536 @c natural way to fix this problem than telling people to
12537 @c use commitinfo.
12538 @c FIXME: Should make some reference, especially in
12539 @c the context of controlling who has access, to the fact
12540 @c that commitinfo can be circumvented.  Perhaps
12541 @c mention SETXID (but has it been carefully examined
12542 @c for holes?).  This fits in with the discussion of
12543 @c general CVS security in "Password authentication
12544 @c security" (the bit which is not pserver-specific).
12545
12546 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12547 @node verifymsg
12548 @appendixsubsec Verifying log messages
12549 @cindex @file{verifymsg} (admin file)
12550 @cindex Log message, verifying
12551
12552 Once you have entered a log message, you can evaluate
12553 that message to check for specific content, such as
12554 a bug ID.  Use the @file{verifymsg} file to
12555 specify a program that is used to verify the log message.
12556 This program could be a simple script that checks
12557 that the entered message contains the required fields.
12558
12559 The @file{verifymsg} file is often most useful together
12560 with the @file{rcsinfo} file, which can be used to
12561 specify a log message template.
12562
12563 Each line in the @file{verifymsg} file consists of a
12564 regular expression and a command-line template.  The
12565 template must include a program name, and can include
12566 any number of arguments.  The full path to the current
12567 log message template file is appended to the template.
12568
12569 One thing that should be noted is that the @samp{ALL}
12570 keyword is not supported.  If more than one matching
12571 line is found, the first one is used.  This can be
12572 useful for specifying a default verification script in a
12573 directory, and then overriding it in a subdirectory.
12574
12575 @cindex DEFAULT in @file{verifymsg}
12576 If the repository name does not match any of the
12577 regular expressions in this file, the @samp{DEFAULT}
12578 line is used, if it is specified.
12579
12580 @cindex Exit status, of @file{verifymsg}
12581 If the verification script exits with a non-zero exit status,
12582 the commit is aborted.
12583
12584 @cindex @file{verifymsg}, changing the log message
12585 In the default configuration, CVS allows the
12586 verification script to change the log message. This is
12587 controlled via the RereadLogAfterVerify CVSROOT/config
12588 option.
12589
12590 When @samp{RereadLogAfterVerify=always} or
12591 @samp{RereadLogAfterVerify=stat}, the log message will
12592 either always be reread after the verification script
12593 is run or reread only if the log message file status
12594 has changed.
12595
12596 @xref{config}, for more on CVSROOT/config options.
12597
12598 It is NOT a good idea for a @file{verifymsg} script to
12599 interact directly with the user in the various
12600 client/server methods. For the @code{pserver} method,
12601 there is no protocol support for communicating between
12602 @file{verifymsg} and the client on the remote end. For the
12603 @code{ext} and @code{server} methods, it is possible
12604 for CVS to become confused by the characters going
12605 along the same channel as the CVS protocol
12606 messages. See @ref{Remote repositories}, for more
12607 information on client/server setups.  In addition, at the time
12608 the @file{verifymsg} script runs, the CVS
12609 server has locks in place in the repository.  If control is
12610 returned to the user here then other users may be stuck waiting
12611 for access to the repository.
12612
12613 This option can be useful if you find yourself using an
12614 rcstemplate that needs to be modified to remove empty
12615 elements or to fill in default values.  It can also be
12616 useful if the rcstemplate has changed in the repository
12617 and the CVS/Template was not updated, but is able to be
12618 adapted to the new format by the verification script
12619 that is run by @file{verifymsg}.
12620
12621 An example of an update might be to change all
12622 occurrences of 'BugId:' to be 'DefectId:' (which can be
12623 useful if the rcstemplate has recently been changed and
12624 there are still checked-out user trees with cached
12625 copies in the CVS/Template file of the older version).
12626
12627 Another example of an update might be to delete a line
12628 that contains 'BugID: none' from the log message after
12629 validation of that value as being allowed is made.
12630
12631 The following is a little silly example of a
12632 @file{verifymsg} file, together with the corresponding
12633 @file{rcsinfo} file, the log message template and an
12634 verification  script.  We begin with the log message template.
12635 We want to always record a bug-id number on the first
12636 line of the log message.  The rest of log message is
12637 free text.  The following template is found in the file
12638 @file{/usr/cvssupport/tc.template}.
12639
12640 @example
12641 BugId:
12642 @end example
12643
12644 The script @file{/usr/cvssupport/bugid.verify} is used to
12645 evaluate the log message.
12646
12647 @example
12648 #!/bin/sh
12649 #
12650 #       bugid.verify filename
12651 #
12652 #  Verify that the log message contains a valid bugid
12653 #  on the first line.
12654 #
12655 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
12656     exit 0
12657 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
12658     # It is okay to allow commits with 'BugId: none',
12659     # but do not put that text into the real log message.
12660     grep -v '^BugId:[ ]*none$' > $1.rewrite
12661     mv $1.rewrite $1
12662     exit 0
12663 else
12664     echo "No BugId found."
12665     exit 1
12666 fi
12667 @end example
12668
12669 The @file{verifymsg} file contains this line:
12670
12671 @example
12672 ^tc     /usr/cvssupport/bugid.verify
12673 @end example
12674
12675 The @file{rcsinfo} file contains this line:
12676
12677 @example
12678 ^tc     /usr/cvssupport/tc.template
12679 @end example
12680
12681 The @file{config} file contains this line:
12682
12683 @example
12684 RereadLogAfterVerify=always
12685 @end example
12686
12687
12688
12689 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12690 @node editinfo
12691 @appendixsubsec Editinfo
12692 @cindex editinfo (admin file)
12693 @cindex Editor, specifying per module
12694 @cindex Per-module editor
12695 @cindex Log messages, editing
12696
12697 @strong{Note: The @file{editinfo} feature has been
12698 rendered obsolete.  To set a default editor for log
12699 messages use the @code{CVSEDITOR}, @code{EDITOR} environment variables
12700 (@pxref{Environment variables}) or the @samp{-e} global
12701 option (@pxref{Global options}).  See @ref{verifymsg},
12702 for information on the use of the @file{verifymsg}
12703 feature for evaluating log messages.}
12704
12705 If you want to make sure that all log messages look the
12706 same way, you can use the @file{editinfo} file to
12707 specify a program that is used to edit the log message.
12708 This program could be a custom-made editor that always
12709 enforces a certain style of the log message, or maybe a
12710 simple shell script that calls an editor, and checks
12711 that the entered message contains the required fields.
12712
12713 If no matching line is found in the @file{editinfo}
12714 file, the editor specified in the environment variable
12715 @code{$CVSEDITOR} is used instead.  If that variable is
12716 not set, then the environment variable @code{$EDITOR}
12717 is used instead.  If that variable is not
12718 set a default will be used.  See @ref{Committing your changes}.
12719
12720 The @file{editinfo} file is often most useful together
12721 with the @file{rcsinfo} file, which can be used to
12722 specify a log message template.
12723
12724 Each line in the @file{editinfo} file consists of a
12725 regular expression and a command-line template.  The
12726 template must include a program name, and can include
12727 any number of arguments.  The full path to the current
12728 log message template file is appended to the template.
12729
12730 One thing that should be noted is that the @samp{ALL}
12731 keyword is not supported.  If more than one matching
12732 line is found, the first one is used.  This can be
12733 useful for specifying a default edit script in a
12734 module, and then overriding it in a subdirectory.
12735
12736 @cindex DEFAULT in editinfo
12737 If the repository name does not match any of the
12738 regular expressions in this file, the @samp{DEFAULT}
12739 line is used, if it is specified.
12740
12741 If the edit script exits with a non-zero exit status,
12742 the commit is aborted.
12743
12744 Note: when @sc{cvs} is accessing a remote repository,
12745 or when the @samp{-m} or @samp{-F} options to @code{cvs
12746 commit} are used, @file{editinfo} will not be consulted.
12747 There is no good workaround for this; use
12748 @file{verifymsg} instead.
12749
12750 @menu
12751 * editinfo example::            Editinfo example
12752 @end menu
12753
12754 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12755 @node editinfo example
12756 @appendixsubsubsec Editinfo example
12757
12758 The following is a little silly example of a
12759 @file{editinfo} file, together with the corresponding
12760 @file{rcsinfo} file, the log message template and an
12761 editor script.  We begin with the log message template.
12762 We want to always record a bug-id number on the first
12763 line of the log message.  The rest of log message is
12764 free text.  The following template is found in the file
12765 @file{/usr/cvssupport/tc.template}.
12766
12767 @example
12768 BugId:
12769 @end example
12770
12771 The script @file{/usr/cvssupport/bugid.edit} is used to
12772 edit the log message.
12773
12774 @example
12775 #!/bin/sh
12776 #
12777 #       bugid.edit filename
12778 #
12779 #  Call $EDITOR on FILENAME, and verify that the
12780 #  resulting file contains a valid bugid on the first
12781 #  line.
12782 if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
12783 if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
12784 $CVSEDITOR $1
12785 until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
12786 do  echo -n  "No BugId found.  Edit again? ([y]/n)"
12787     read ans
12788     case $@{ans@} in
12789         n*) exit 1;;
12790     esac
12791     $CVSEDITOR $1
12792 done
12793 @end example
12794
12795 The @file{editinfo} file contains this line:
12796
12797 @example
12798 ^tc     /usr/cvssupport/bugid.edit
12799 @end example
12800
12801 The @file{rcsinfo} file contains this line:
12802
12803 @example
12804 ^tc     /usr/cvssupport/tc.template
12805 @end example
12806
12807 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12808 @node loginfo
12809 @appendixsubsec Loginfo
12810 @cindex loginfo (admin file)
12811 @cindex Storing log messages
12812 @cindex Mailing log messages
12813 @cindex Distributing log messages
12814 @cindex Log messages
12815
12816 @c "cvs commit" is not quite right.  What we
12817 @c mean is "when the repository gets changed" which
12818 @c also includes "cvs import" and "cvs add" on a directory.
12819 The @file{loginfo} file is used to control where
12820 @samp{cvs commit} log information is sent.  The first
12821 entry on a line is a regular expression which is tested
12822 against the directory that the change is being made to,
12823 relative to the @code{$CVSROOT}.  If a match is found, then
12824 the remainder of the line is a filter program that
12825 should expect log information on its standard input.
12826 Note that the filter program @strong{must} read @strong{all}
12827 of the log information or @sc{cvs} may fail with a broken pipe signal.
12828
12829 If the repository name does not match any of the
12830 regular expressions in this file, the @samp{DEFAULT}
12831 line is used, if it is specified.
12832
12833 All occurrences of the name @samp{ALL} appearing as a
12834 regular expression are used in addition to the first
12835 matching regular expression or @samp{DEFAULT}.
12836
12837 The first matching regular expression is used.
12838
12839 @xref{commit files}, for a description of the syntax of
12840 the @file{loginfo} file.
12841
12842 The user may specify a format string as
12843 part of the filter.  The string is composed of a
12844 @samp{%} followed by a space, or followed by a single
12845 format character, or followed by a set of format
12846 characters surrounded by @samp{@{} and @samp{@}} as
12847 separators.  The format characters are:
12848
12849 @table @t
12850 @item s
12851 file name
12852 @item V
12853 old version number (pre-checkin)
12854 @item v
12855 new version number (post-checkin)
12856 @end table
12857
12858 All other characters that appear in a format string
12859 expand to an empty field (commas separating fields are
12860 still provided).
12861
12862 For example, some valid format strings are @samp{%},
12863 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
12864
12865 The output will be a space separated string of tokens enclosed in
12866 quotation marks (@t{"}).
12867 Any embedded dollar signs (@t{$}), backticks (@t{`}),
12868 backslashes (@t{\}), or quotation marks will be preceded
12869 by a backslash (this allows the shell to correctly parse it
12870 as a single string, reguardless of the characters it contains).
12871 For backwards compatibility, the first
12872 token will be the repository subdirectory.  The rest of the
12873 tokens will be comma-delimited lists of the information
12874 requested in the format string.  For example, if
12875 @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}}
12876 is the format string, and three files (@t{ChangeLog},
12877 @t{Makefile}, @t{foo.c}) were modified, the output
12878 might be:
12879
12880 @example
12881 "yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13"
12882 @end example
12883
12884 As another example, @samp{%@{@}} means that only the
12885 name of the repository will be generated.
12886
12887 Note: when @sc{cvs} is accessing a remote repository,
12888 @file{loginfo} will be run on the @emph{remote}
12889 (i.e., server) side, not the client side (@pxref{Remote
12890 repositories}).
12891
12892 @menu
12893 * loginfo example::             Loginfo example
12894 * Keeping a checked out copy::  Updating a tree on every checkin
12895 @end menu
12896
12897 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12898 @node loginfo example
12899 @appendixsubsubsec Loginfo example
12900
12901 The following @file{loginfo} file, together with the
12902 tiny shell-script below, appends all log messages
12903 to the file @file{$CVSROOT/CVSROOT/commitlog},
12904 and any commits to the administrative files (inside
12905 the @file{CVSROOT} directory) are also logged in
12906 @file{/usr/adm/cvsroot-log}.
12907 Commits to the @file{prog1} directory are mailed to @t{ceder}.
12908
12909 @c FIXME: is it a CVS feature or bug that only the
12910 @c first matching line is used?  It is documented
12911 @c above, but is it useful?  For example, if we wanted
12912 @c to run both "cvs-log" and "Mail" for the CVSROOT
12913 @c directory, it is kind of awkward if
12914 @c only the first matching line is used.
12915 @example
12916 ALL             /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
12917 ^CVSROOT        /usr/local/bin/cvs-log /usr/adm/cvsroot-log
12918 ^prog1          Mail -s %s ceder
12919 @end example
12920
12921 The shell-script @file{/usr/local/bin/cvs-log} looks
12922 like this:
12923
12924 @example
12925 #!/bin/sh
12926 (echo "------------------------------------------------------";
12927  echo -n $2"  ";
12928  date;
12929  echo;
12930  cat) >> $1
12931 @end example
12932
12933 @node Keeping a checked out copy
12934 @appendixsubsubsec Keeping a checked out copy
12935
12936 @c What other index entries?  It seems like
12937 @c people might want to use a lot of different
12938 @c words for this functionality.
12939 @cindex Keeping a checked out copy
12940 @cindex Checked out copy, keeping
12941 @cindex Web pages, maintaining with CVS
12942
12943 It is often useful to maintain a directory tree which
12944 contains files which correspond to the latest version
12945 in the repository.  For example, other developers might
12946 want to refer to the latest sources without having to
12947 check them out, or you might be maintaining a web site
12948 with @sc{cvs} and want every checkin to cause the files
12949 used by the web server to be updated.
12950 @c Can we offer more details on the web example?  Or
12951 @c point the user at how to figure it out?  This text
12952 @c strikes me as sufficient for someone who already has
12953 @c some idea of what we mean but not enough for the naive
12954 @c user/sysadmin to understand it and set it up.
12955
12956 The way to do this is by having loginfo invoke
12957 @code{cvs update}.  Doing so in the naive way will
12958 cause a problem with locks, so the @code{cvs update}
12959 must be run in the background.
12960 @c Should we try to describe the problem with locks?
12961 @c It seems like a digression for someone who just
12962 @c wants to know how to make it work.
12963 @c Another choice which might work for a single file
12964 @c is to use "cvs -n update -p" which doesn't take
12965 @c out locks (I think) but I don't see many advantages
12966 @c of that and we might as well document something which
12967 @c works for multiple files.
12968 Here is an example for unix (this should all be on one line):
12969
12970 @example
12971 ^cyclic-pages           (date; cat; (sleep 2; cd /u/www/local-docs;
12972  cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
12973 @end example
12974
12975 This will cause checkins to repository directories
12976 starting with @code{cyclic-pages} to update the checked
12977 out tree in @file{/u/www/local-docs}.
12978 @c More info on some of the details?  The "sleep 2" is
12979 @c so if we are lucky the lock will be gone by the time
12980 @c we start and we can wait 2 seconds instead of 30.
12981
12982 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12983 @node rcsinfo
12984 @appendixsec Rcsinfo
12985 @cindex rcsinfo (admin file)
12986 @cindex Form for log message
12987 @cindex Log message template
12988 @cindex Template for log message
12989
12990 The @file{rcsinfo} file can be used to specify a form to
12991 edit when filling out the commit log.  The
12992 @file{rcsinfo} file has a syntax similar to the
12993 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
12994 files.  @xref{syntax}.  Unlike the other files the second
12995 part is @emph{not} a command-line template.  Instead,
12996 the part after the regular expression should be a full pathname to
12997 a file containing the log message template.
12998
12999 If the repository name does not match any of the
13000 regular expressions in this file, the @samp{DEFAULT}
13001 line is used, if it is specified.
13002
13003 All occurrences of the name @samp{ALL} appearing as a
13004 regular expression are used in addition to the first
13005 matching regular expression or @samp{DEFAULT}.
13006
13007 @c FIXME: should be offering advice, somewhere around
13008 @c here, about where to put the template file.  The
13009 @c verifymsg example uses /usr/cvssupport but doesn't
13010 @c say anything about what that directory is for or
13011 @c whether it is hardwired into CVS or who creates
13012 @c it or anything.  In particular we should say
13013 @c how to version control the template file.  A
13014 @c probably better answer than the /usr/cvssupport
13015 @c stuff is to use checkoutlist (with xref to the
13016 @c checkoutlist doc).
13017 @c Also I am starting to see a connection between
13018 @c this and the Keeping a checked out copy node.
13019 @c Probably want to say something about that.
13020 The log message template will be used as a default log
13021 message.  If you specify a log message with @samp{cvs
13022 commit -m @var{message}} or @samp{cvs commit -f
13023 @var{file}} that log message will override the
13024 template.
13025
13026 @xref{verifymsg}, for an example @file{rcsinfo}
13027 file.
13028
13029 When @sc{cvs} is accessing a remote repository,
13030 the contents of @file{rcsinfo} at the time a directory
13031 is first checked out will specify a template which does
13032 not then change.  If you edit @file{rcsinfo} or its
13033 templates, you may need to check out a new working
13034 directory.
13035 @c Would be nice to fix CVS so this isn't needed.  For
13036 @c example, a mechanism analogous to CVS/Entries, where
13037 @c the client keeps track of what version of the template
13038 @c it has.
13039
13040 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13041 @node taginfo
13042 @appendixsec Taginfo
13043 @cindex taginfo (admin file)
13044 @cindex Tags, logging
13045 @cindex Tags, verifying
13046 The @file{taginfo} file defines programs to execute
13047 when someone executes a @code{tag} or @code{rtag}
13048 command.  The @file{taginfo} file has the standard form
13049 for administrative files (@pxref{syntax}),
13050 where each line is a regular expression
13051 followed by a command to execute.  The arguments passed
13052 to the command are, in order, the @var{tagname},
13053 @var{operation} (@code{add} for @code{tag},
13054 @code{mov} for @code{tag -F}, and @code{del} for
13055 @code{tag -d}), @var{repository}, and any remaining are
13056 pairs of @var{filename} @var{revision}.  A non-zero
13057 exit of the filter program will cause the tag to be
13058 aborted.
13059
13060 Here is an example of using the @file{taginfo} file
13061 to log @code{tag} and @code{rtag}
13062 commands.  In the @file{taginfo} file put:
13063
13064 @example
13065 ALL /usr/local/cvsroot/CVSROOT/loggit
13066 @end example
13067
13068 @noindent
13069 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
13070 following script:
13071
13072 @example
13073 #!/bin/sh
13074 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
13075 @end example
13076
13077 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13078 @node cvsignore
13079 @appendixsec Ignoring files via cvsignore
13080 @cindex cvsignore (admin file), global
13081 @cindex Global cvsignore
13082 @cindex Ignoring files
13083 @c -- This chapter should maybe be moved to the
13084 @c tutorial part of the manual?
13085
13086 There are certain file names that frequently occur
13087 inside your working copy, but that you don't want to
13088 put under @sc{cvs} control.  Examples are all the object
13089 files that you get while you compile your sources.
13090 Normally, when you run @samp{cvs update}, it prints a
13091 line for each file it encounters that it doesn't know
13092 about (@pxref{update output}).
13093
13094 @sc{cvs} has a list of files (or sh(1) file name patterns)
13095 that it should ignore while running @code{update},
13096 @code{import} and @code{release}.
13097 @c -- Are those the only three commands affected?
13098 This list is constructed in the following way.
13099
13100 @itemize @bullet
13101 @item
13102 The list is initialized to include certain file name
13103 patterns: names associated with @sc{cvs}
13104 administration, or with other common source control
13105 systems; common names for patch files, object files,
13106 archive files, and editor backup files; and other names
13107 that are usually artifacts of assorted utilities.
13108 Currently, the default list of ignored file name
13109 patterns is:
13110
13111 @cindex Ignored files
13112 @cindex Automatically ignored files
13113 @example
13114     RCS     SCCS    CVS     CVS.adm
13115     RCSLOG  cvslog.*
13116     tags    TAGS
13117     .make.state     .nse_depinfo
13118     *~      #*      .#*     ,*      _$*     *$
13119     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
13120     *.a     *.olb   *.o     *.obj   *.so    *.exe
13121     *.Z     *.elc   *.ln
13122     core
13123 @end example
13124
13125 @item
13126 The per-repository list in
13127 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
13128 the list, if that file exists.
13129
13130 @item
13131 The per-user list in @file{.cvsignore} in your home
13132 directory is appended to the list, if it exists.
13133
13134 @item
13135 Any entries in the environment variable
13136 @code{$CVSIGNORE} is appended to the list.
13137
13138 @item
13139 Any @samp{-I} options given to @sc{cvs} is appended.
13140
13141 @item
13142 As @sc{cvs} traverses through your directories, the contents
13143 of any @file{.cvsignore} will be appended to the list.
13144 The patterns found in @file{.cvsignore} are only valid
13145 for the directory that contains them, not for
13146 any sub-directories.
13147 @end itemize
13148
13149 In any of the 5 places listed above, a single
13150 exclamation mark (@samp{!}) clears the ignore list.
13151 This can be used if you want to store any file which
13152 normally is ignored by @sc{cvs}.
13153
13154 Specifying @samp{-I !} to @code{cvs import} will import
13155 everything, which is generally what you want to do if
13156 you are importing files from a pristine distribution or
13157 any other source which is known to not contain any
13158 extraneous files.  However, looking at the rules above
13159 you will see there is a fly in the ointment; if the
13160 distribution contains any @file{.cvsignore} files, then
13161 the patterns from those files will be processed even if
13162 @samp{-I !} is specified.  The only workaround is to
13163 remove the @file{.cvsignore} files in order to do the
13164 import.  Because this is awkward, in the future
13165 @samp{-I !} might be modified to override
13166 @file{.cvsignore} files in each directory.
13167
13168 Note that the syntax of the ignore files consists of a
13169 series of lines, each of which contains a space
13170 separated list of filenames.  This offers no clean way
13171 to specify filenames which contain spaces, but you can
13172 use a workaround like @file{foo?bar} to match a file
13173 named @file{foo bar} (it also matches @file{fooxbar}
13174 and the like).  Also note that there is currently no
13175 way to specify comments.
13176 @c FIXCVS?  I don't _like_ this syntax at all, but
13177 @c changing it raises all the usual compatibility
13178 @c issues and I'm also not sure what to change it to.
13179
13180 @node checkoutlist
13181 @appendixsec The checkoutlist file
13182 @cindex checkoutlist
13183
13184 It may be helpful to use @sc{cvs} to maintain your own
13185 files in the @file{CVSROOT} directory.  For example,
13186 suppose that you have a script @file{logcommit.pl}
13187 which you run by including the following line in the
13188 @file{commitinfo} administrative file:
13189
13190 @example
13191 ALL   $CVSROOT/CVSROOT/logcommit.pl
13192 @end example
13193
13194 To maintain @file{logcommit.pl} with @sc{cvs} you would
13195 add the following line to the @file{checkoutlist}
13196 administrative file:
13197
13198 @example
13199 logcommit.pl
13200 @end example
13201
13202 The format of @file{checkoutlist} is one line for each
13203 file that you want to maintain using @sc{cvs}, giving
13204 the name of the file, followed optionally by more whitespace
13205 and any error message that should print if the file cannot be
13206 checked out into CVSROOT after a commit:
13207
13208 @example
13209 logcommit.pl    Could not update CVSROOT/logcommit.pl.
13210 @end example
13211
13212 After setting up @file{checkoutlist} in this fashion,
13213 the files listed there will function just like
13214 @sc{cvs}'s built-in administrative files.  For example,
13215 when checking in one of the files you should get a
13216 message such as:
13217
13218 @example
13219 cvs commit: Rebuilding administrative file database
13220 @end example
13221
13222 @noindent
13223 and the checked out copy in the @file{CVSROOT}
13224 directory should be updated.
13225
13226 Note that listing @file{passwd} (@pxref{Password
13227 authentication server}) in @file{checkoutlist} is not
13228 recommended for security reasons.
13229
13230 For information about keeping a checkout out copy in a
13231 more general context than the one provided by
13232 @file{checkoutlist}, see @ref{Keeping a checked out
13233 copy}.
13234
13235 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13236 @node history file
13237 @appendixsec The history file
13238 @cindex History file
13239 @cindex Log information, saving
13240
13241 The file @file{$CVSROOT/CVSROOT/history} is used
13242 to log information for the @code{history} command
13243 (@pxref{history}).  This file must be created to turn
13244 on logging.  This is done automatically if the
13245 @code{cvs init} command is used to set up the
13246 repository (@pxref{Creating a repository}).
13247
13248 The file format of the @file{history} file is
13249 documented only in comments in the @sc{cvs} source
13250 code, but generally programs should use the @code{cvs
13251 history} command to access it anyway, in case the
13252 format changes with future releases of @sc{cvs}.
13253
13254 @node Variables
13255 @appendixsec Expansions in administrative files
13256 @cindex Internal variables
13257 @cindex Variables
13258
13259 Sometimes in writing an administrative file, you might
13260 want the file to be able to know various things based
13261 on environment @sc{cvs} is running in.  There are
13262 several mechanisms to do that.
13263
13264 To find the home directory of the user running @sc{cvs}
13265 (from the @code{HOME} environment variable), use
13266 @samp{~} followed by @samp{/} or the end of the line.
13267 Likewise for the home directory of @var{user}, use
13268 @samp{~@var{user}}.  These variables are expanded on
13269 the server machine, and don't get any reasonable
13270 expansion if pserver (@pxref{Password authenticated})
13271 is in use; therefore user variables (see below) may be
13272 a better choice to customize behavior based on the user
13273 running @sc{cvs}.
13274 @c Based on these limitations, should we deprecate ~?
13275 @c What is it good for?  Are people using it?
13276
13277 One may want to know about various pieces of
13278 information internal to @sc{cvs}.  A @sc{cvs} internal
13279 variable has the syntax @code{$@{@var{variable}@}},
13280 where @var{variable} starts with a letter and consists
13281 of alphanumeric characters and @samp{_}.  If the
13282 character following @var{variable} is a
13283 non-alphanumeric character other than @samp{_}, the
13284 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
13285 internal variables are:
13286
13287 @table @code
13288 @item CVSROOT
13289 @cindex CVSROOT, internal variable
13290 This is the absolute path to the current @sc{cvs} root directory.
13291 @xref{Repository}, for a description of the various
13292 ways to specify this, but note that the internal
13293 variable contains just the directory and not any
13294 of the access method information.
13295
13296 @item RCSBIN
13297 @cindex RCSBIN, internal variable
13298 In @sc{cvs} 1.9.18 and older, this specified the
13299 directory where @sc{cvs} was looking for @sc{rcs}
13300 programs.  Because @sc{cvs} no longer runs @sc{rcs}
13301 programs, specifying this internal variable is now an
13302 error.
13303
13304 @item CVSEDITOR
13305 @cindex CVSEDITOR, internal variable
13306 @itemx EDITOR
13307 @cindex EDITOR, internal variable
13308 @itemx VISUAL
13309 @cindex VISUAL, internal variable
13310 These all expand to the same value, which is the editor
13311 that @sc{cvs} is using.  @xref{Global options}, for how
13312 to specify this.
13313
13314 @item USER
13315 @cindex USER, internal variable
13316 Username of the user running @sc{cvs} (on the @sc{cvs}
13317 server machine).
13318 When using pserver, this is the user specified in the repository
13319 specification which need not be the same as the username the
13320 server is running as (@pxref{Password authentication server}).
13321 Do not confuse this with the environment variable of the same name.
13322 @end table
13323
13324 If you want to pass a value to the administrative files
13325 which the user who is running @sc{cvs} can specify,
13326 use a user variable.
13327 @cindex User variables
13328 To expand a user variable, the
13329 administrative file contains
13330 @code{$@{=@var{variable}@}}.  To set a user variable,
13331 specify the global option @samp{-s} to @sc{cvs}, with
13332 argument @code{@var{variable}=@var{value}}.  It may be
13333 particularly useful to specify this option via
13334 @file{.cvsrc} (@pxref{~/.cvsrc}).
13335
13336 For example, if you want the administrative file to
13337 refer to a test directory you might create a user
13338 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
13339 as
13340
13341 @example
13342 cvs -s TESTDIR=/work/local/tests
13343 @end example
13344
13345 @noindent
13346 and the
13347 administrative file contains @code{sh
13348 $@{=TESTDIR@}/runtests}, then that string is expanded
13349 to @code{sh /work/local/tests/runtests}.
13350
13351 All other strings containing @samp{$} are reserved;
13352 there is no way to quote a @samp{$} character so that
13353 @samp{$} represents itself.
13354
13355 Environment variables passed to administrative files are:
13356
13357 @table @code
13358 @cindex environment variables, passed to administrative files
13359
13360 @item CVS_USER
13361 @cindex CVS_USER, environment variable
13362 The @sc{cvs}-specific username provided by the user, if it
13363 can be provided (currently just for the pserver access
13364 method), and to the empty string otherwise.  (@code{CVS_USER}
13365 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
13366 is used to map @sc{cvs} usernames to system usernames.)
13367
13368 @item LOGNAME
13369 @cindex LOGNAME, environment variable
13370 The username of the system user.
13371
13372 @item USER
13373 @cindex USER, environment variable
13374 Same as @code{LOGNAME}.
13375 Do not confuse this with the internal variable of the same name.
13376 @end table
13377
13378 @node config
13379 @appendixsec The CVSROOT/config configuration file
13380
13381 @cindex config, in CVSROOT
13382 @cindex CVSROOT/config
13383
13384 The administrative file @file{config} contains various
13385 miscellaneous settings which affect the behavior of
13386 @sc{cvs}.  The syntax is slightly different from the
13387 other administrative files.  Variables are not
13388 expanded.  Lines which start with @samp{#} are
13389 considered comments.
13390 @c FIXME: where do we define comments for the other
13391 @c administrative files.
13392 Other lines consist of a keyword, @samp{=}, and a
13393 value.  Note that this syntax is very strict.
13394 Extraneous spaces or tabs are not permitted.
13395 @c See comments in parseinfo.c:parse_config for more
13396 @c discussion of this strictness.
13397
13398 Currently defined keywords are:
13399
13400 @table @code
13401 @cindex RCSBIN, in CVSROOT/config
13402 @item RCSBIN=@var{bindir}
13403 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
13404 @sc{cvs} to look for @sc{rcs} programs in the
13405 @var{bindir} directory.  Current versions of @sc{cvs}
13406 do not run @sc{rcs} programs; for compatibility this
13407 setting is accepted, but it does nothing.
13408
13409 @cindex SystemAuth, in CVSROOT/config
13410 @item SystemAuth=@var{value}
13411 If @var{value} is @samp{yes}, then pserver should check
13412 for users in the system's user database if not found in
13413 @file{CVSROOT/passwd}.  If it is @samp{no}, then all
13414 pserver users must exist in @file{CVSROOT/passwd}.
13415 The default is @samp{yes}.  For more on pserver, see
13416 @ref{Password authenticated}.
13417
13418 @ignore
13419 @cindex PreservePermissions, in CVSROOT/config
13420 @item PreservePermissions=@var{value}
13421 Enable support for saving special device files,
13422 symbolic links, file permissions and ownerships in the
13423 repository.  The default value is @samp{no}.
13424 @xref{Special Files}, for the full implications of using
13425 this keyword.
13426 @end ignore
13427
13428 @cindex TopLevelAdmin, in CVSROOT/config
13429 @item TopLevelAdmin=@var{value}
13430 Modify the @samp{checkout} command to create a
13431 @samp{CVS} directory at the top level of the new
13432 working directory, in addition to @samp{CVS}
13433 directories created within checked-out directories.
13434 The default value is @samp{no}.
13435
13436 This option is useful if you find yourself performing
13437 many commands at the top level of your working
13438 directory, rather than in one of the checked out
13439 subdirectories.  The @file{CVS} directory created there
13440 will mean you don't have to specify @code{CVSROOT} for
13441 each command.  It also provides a place for the
13442 @file{CVS/Template} file (@pxref{Working directory
13443 storage}).
13444
13445 @cindex LockDir, in CVSROOT/config
13446 @item LockDir=@var{directory}
13447 Put @sc{cvs} lock files in @var{directory} rather than
13448 directly in the repository.  This is useful if you want
13449 to let users read from the repository while giving them
13450 write access only to @var{directory}, not to the
13451 repository.
13452 It can also be used to put the locks on a very fast
13453 in-memory file system to speed up locking and unlocking
13454 the repository.
13455 You need to create @var{directory}, but
13456 @sc{cvs} will create subdirectories of @var{directory} as it
13457 needs them.  For information on @sc{cvs} locks, see
13458 @ref{Concurrency}.
13459
13460 @c Mention this in Compatibility section?
13461 Before enabling the LockDir option, make sure that you
13462 have tracked down and removed any copies of @sc{cvs} 1.9 or
13463 older.  Such versions neither support LockDir, nor will
13464 give an error indicating that they don't support it.
13465 The result, if this is allowed to happen, is that some
13466 @sc{cvs} users will put the locks one place, and others will
13467 put them another place, and therefore the repository
13468 could become corrupted.  @sc{cvs} 1.10 does not support
13469 LockDir but it will print a warning if run on a
13470 repository with LockDir enabled.
13471
13472 @cindex LogHistory, in CVSROOT/config
13473 @item LogHistory=@var{value}
13474 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
13475 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
13476 all transactions.  Any subset of the default is
13477 legal.  (For example, to only log transactions that modify the
13478 @file{*,v} files, use @samp{LogHistory=TMAR}.)
13479
13480 @cindex RereadLogAfterVerify, in CVSROOT/config
13481 @cindex @file{verifymsg}, changing the log message
13482 @item RereadLogAfterVerify=@var{value}
13483 Modify the @samp{commit} command such that CVS will reread the
13484 log message after running the program specified by @file{verifymsg}.
13485 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
13486 the log message should always be reread; @samp{no}
13487 or @samp{never}, indicating that it should never be
13488 reread; or @var{value} may be @samp{stat}, indicating
13489 that the file should be checked with the file system
13490 @samp{stat()} function to see if it has changed (see warning below)
13491 before rereading.  The default value is @samp{always}.
13492
13493 @strong{Note: the `stat' mode can cause CVS to pause for up to
13494 one extra second per directory committed.  This can be less IO and
13495 CPU intensive but is not recommended for use with large repositories}
13496
13497 @xref{verifymsg}, for more information on how verifymsg
13498 may be used.
13499 @end table
13500
13501 @c ---------------------------------------------------------------------
13502 @node Environment variables
13503 @appendix All environment variables which affect CVS
13504 @cindex Environment variables
13505 @cindex Reference manual for variables
13506
13507 This is a complete list of all environment variables
13508 that affect @sc{cvs}.
13509
13510 @table @code
13511 @cindex CVSIGNORE, environment variable
13512 @item $CVSIGNORE
13513 A whitespace-separated list of file name patterns that
13514 @sc{cvs} should ignore. @xref{cvsignore}.
13515
13516 @cindex CVSWRAPPERS, environment variable
13517 @item $CVSWRAPPERS
13518 A whitespace-separated list of file name patterns that
13519 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
13520
13521 @cindex CVSREAD, environment variable
13522 @cindex Read-only files, and CVSREAD
13523 @item $CVSREAD
13524 If this is set, @code{checkout} and @code{update} will
13525 try hard to make the files in your working directory
13526 read-only.  When this is not set, the default behavior
13527 is to permit modification of your working files.
13528
13529 @item $CVSUMASK
13530 Controls permissions of files in the repository.  See
13531 @ref{File permissions}.
13532
13533 @item $CVSROOT
13534 Should contain the full pathname to the root of the @sc{cvs}
13535 source repository (where the @sc{rcs} files are
13536 kept).  This information must be available to @sc{cvs} for
13537 most commands to execute; if @code{$CVSROOT} is not set,
13538 or if you wish to override it for one invocation, you
13539 can supply it on the command line: @samp{cvs -d cvsroot
13540 cvs_command@dots{}} Once you have checked out a working
13541 directory, @sc{cvs} stores the appropriate root (in
13542 the file @file{CVS/Root}), so normally you only need to
13543 worry about this when initially checking out a working
13544 directory.
13545
13546 @item $CVSEDITOR
13547 @cindex CVSEDITOR, environment variable
13548 @itemx $EDITOR
13549 @cindex EDITOR, environment variable
13550 @itemx $VISUAL
13551 @cindex VISUAL, environment variable
13552 Specifies the program to use for recording log messages
13553 during commit.  @code{$CVSEDITOR} overrides
13554 @code{$EDITOR}, which overrides @code{$VISUAL}.
13555 See @ref{Committing your changes} for more or
13556 @ref{Global options} for alternative ways of specifying a
13557 log editor.
13558
13559 @cindex PATH, environment variable
13560 @item $PATH
13561 If @code{$RCSBIN} is not set, and no path is compiled
13562 into @sc{cvs}, it will use @code{$PATH} to try to find all
13563 programs it uses.
13564
13565 @cindex HOME, environment variable
13566 @item $HOME
13567 @cindex HOMEPATH, environment variable
13568 @item $HOMEPATH
13569 @cindex HOMEDRIVE, environment variable
13570 @item $HOMEDRIVE
13571 Used to locate the directory where the @file{.cvsrc}
13572 file, and other such files, are searched.  On Unix, @sc{cvs}
13573 just checks for @code{HOME}.  On Windows NT, the system will
13574 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
13575 for example to @file{\joe}.  On Windows 95, you'll
13576 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
13577 @c We are being vague about whether HOME works on
13578 @c Windows; see long comment in windows-NT/filesubr.c.
13579
13580 @cindex CVS_RSH, environment variable
13581 @item $CVS_RSH
13582 Specifies the external program which @sc{cvs} connects with,
13583 when @code{:ext:} access method is specified.
13584 @pxref{Connecting via rsh}.
13585
13586 @item $CVS_SERVER
13587 Used in client-server mode when accessing a remote
13588 repository using @sc{rsh}.  It specifies the name of
13589 the program to start on the server side (and any
13590 necessary arguments) when accessing a remote repository
13591 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
13592 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
13593 the default value for @code{:fork:} is the name used to run the client.
13594 @pxref{Connecting via rsh}
13595
13596 @item $CVS_PASSFILE
13597 Used in client-server mode when accessing the @code{cvs
13598 login server}.  Default value is @file{$HOME/.cvspass}.
13599 @pxref{Password authentication client}
13600
13601 @item $CVS_CLIENT_PORT
13602 Used in client-server mode to set the port to use when accessing the server
13603 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
13604 if the port is not specified in the CVSROOT.
13605 @pxref{Remote repositories}
13606
13607 @cindex CVS_RCMD_PORT, environment variable
13608 @item $CVS_RCMD_PORT
13609 Used in client-server mode.  If set, specifies the port
13610 number to be used when accessing the @sc{rcmd} demon on
13611 the server side. (Currently not used for Unix clients).
13612
13613 @cindex CVS_CLIENT_LOG, environment variable
13614 @item $CVS_CLIENT_LOG
13615 Used for debugging only in client-server
13616 mode.  If set, everything sent to the server is logged
13617 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
13618 sent from the server is logged into
13619 @file{@code{$CVS_CLIENT_LOG}.out}.
13620
13621 @cindex CVS_SERVER_SLEEP, environment variable
13622 @item $CVS_SERVER_SLEEP
13623 Used only for debugging the server side in
13624 client-server mode.  If set, delays the start of the
13625 server child process the specified amount of
13626 seconds so that you can attach to it with a debugger.
13627
13628 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
13629 @item $CVS_IGNORE_REMOTE_ROOT
13630 For @sc{cvs} 1.10 and older, setting this variable
13631 prevents @sc{cvs} from overwriting the @file{CVS/Root}
13632 file when the @samp{-d} global option is specified.
13633 Later versions of @sc{cvs} do not rewrite
13634 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
13635 effect.
13636
13637 @cindex COMSPEC, environment variable
13638 @item $COMSPEC
13639 Used under OS/2 only.  It specifies the name of the
13640 command interpreter and defaults to @sc{cmd.exe}.
13641
13642 @cindex TMPDIR, environment variable
13643 @item $TMPDIR
13644 @cindex TMP, environment variable
13645 @itemx $TMP
13646 @cindex TEMP, environment variable
13647 @itemx $TEMP
13648 @cindex Temporary files, location of
13649 @c This is quite nuts.  We don't talk about tempnam
13650 @c or mkstemp which we sometimes use.  The discussion
13651 @c of "Global options" is semi-incoherent.
13652 @c I'm not even sure those are the only inaccuracies.
13653 @c Furthermore, the conventions are
13654 @c pretty crazy and they should be simplified.
13655 Directory in which temporary files are located.
13656 The @sc{cvs} server uses
13657 @code{TMPDIR}.  @xref{Global options}, for a
13658 description of how to specify this.
13659 Some parts of @sc{cvs} will always use @file{/tmp} (via
13660 the @code{tmpnam} function provided by the system).
13661
13662 On Windows NT, @code{TMP} is used (via the @code{_tempnam}
13663 function provided by the system).
13664
13665 The @code{patch} program which is used by the @sc{cvs}
13666 client uses @code{TMPDIR}, and if it is not set, uses
13667 @file{/tmp} (at least with GNU patch 2.1).  Note that
13668 if your server and client are both running @sc{cvs}
13669 1.9.10 or later, @sc{cvs} will not invoke an external
13670 @code{patch} program.
13671 @end table
13672
13673 @node Compatibility
13674 @appendix Compatibility between CVS Versions
13675
13676 @cindex CVS, versions of
13677 @cindex Versions, of CVS
13678 @cindex Compatibility, between CVS versions
13679 @c We don't mention versions older than CVS 1.3
13680 @c on the theory that it would clutter it up for the vast
13681 @c majority of people, who don't have anything that old.
13682 @c
13683 The repository format is compatible going back to
13684 @sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
13685 you have copies of @sc{cvs} 1.6 or older and you want
13686 to use the optional developer communication features.
13687 @c If you "cvs rm" and commit using 1.3, then you'll
13688 @c want to run "rcs -sdead <file,v>" on each of the
13689 @c files in the Attic if you then want 1.5 and
13690 @c later to recognize those files as dead (I think the
13691 @c symptom if this is not done is that files reappear
13692 @c in joins).  (Wait: the above will work but really to
13693 @c be strictly correct we should suggest checking
13694 @c in a new revision rather than just changing the
13695 @c state of the head revision, shouldn't we?).
13696 @c The old convert.sh script was for this, but it never
13697 @c did get updated to reflect use of the RCS "dead"
13698 @c state.
13699 @c Note: this is tricky to document without confusing
13700 @c people--need to carefully say what CVS version we
13701 @c are talking about and keep in mind the distinction
13702 @c between a
13703 @c repository created with 1.3 and on which one now
13704 @c uses 1.5+, and a repository on which one wants to
13705 @c use both versions side by side (e.g. during a
13706 @c transition period).
13707 @c Wait, can't CVS just detect the case in which a file
13708 @c is in the Attic but the head revision is not dead?
13709 @c Not sure whether this should produce a warning or
13710 @c something, and probably needs further thought, but
13711 @c it would appear that the situation can be detected.
13712 @c
13713 @c We might want to separate out the 1.3 compatibility
13714 @c section (for repository & working directory) from the
13715 @c rest--that might help avoid confusing people who
13716 @c are upgrading (for example) from 1.6 to 1.8.
13717 @c
13718 @c A minor incompatibility is if a current version of CVS
13719 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
13720 @c see this as if there is no tag.  Seems to me this is
13721 @c too obscure to mention.
13722
13723 The working directory format is compatible going back
13724 to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
13725 and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
13726 a working directory checked out with @sc{cvs} 1.3,
13727 @sc{cvs} will convert it, but to go back to @sc{cvs}
13728 1.3 you need to check out a new working directory with
13729 @sc{cvs} 1.3.
13730
13731 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
13732 further (1.5 was the first official release with the remote protocol,
13733 but some older versions might still be floating around).  In many
13734 cases you need to upgrade both the client and the server to take
13735 advantage of new features and bug fixes, however.
13736
13737 @c Perhaps should be saying something here about the
13738 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
13739 @c older don't use them).  These are supposed to be
13740 @c compatible in both directions, but I'm not sure
13741 @c they quite are 100%.  One common gripe is if you
13742 @c "rm -r" a directory and 1.9 gets confused, as it
13743 @c still sees it in Entries.  That one is fixed in
13744 @c (say) 1.9.6.  Someone else reported problems with
13745 @c starting with a directory which was checked out with
13746 @c an old version, and then using a new version, and
13747 @c some "D" lines appeared, but not for every
13748 @c directory, causing some directories to be skipped.
13749 @c They weren't sure how to reproduce this, though.
13750
13751 @c ---------------------------------------------------------------------
13752 @node Troubleshooting
13753 @appendix Troubleshooting
13754
13755 If you are having trouble with @sc{cvs}, this appendix
13756 may help.  If there is a particular error message which
13757 you are seeing, then you can look up the message
13758 alphabetically.  If not, you can look through the
13759 section on other problems to see if your problem is
13760 mentioned there.
13761
13762 @menu
13763 * Error messages::              Partial list of CVS errors
13764 * Connection::                  Trouble making a connection to a CVS server
13765 * Other problems::              Problems not readily listed by error message
13766 @end menu
13767
13768 @ignore
13769 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13770 @c @node Bad administrative files
13771 @appendixsec Bad administrative files
13772
13773 @c -- Give hints on how to fix them
13774 @end ignore
13775
13776 @node Error messages
13777 @appendixsec Partial list of error messages
13778
13779 Here is a partial list of error messages that you may
13780 see from @sc{cvs}.  It is not a complete list---@sc{cvs}
13781 is capable of printing many, many error messages, often
13782 with parts of them supplied by the operating system,
13783 but the intention is to list the common and/or
13784 potentially confusing error messages.
13785
13786 The messages are alphabetical, but introductory text
13787 such as @samp{cvs update: } is not considered in
13788 ordering them.
13789
13790 In some cases the list includes messages printed by old
13791 versions of @sc{cvs} (partly because users may not be
13792 sure which version of @sc{cvs} they are using at any
13793 particular moment).
13794 @c If we want to start retiring messages, perhaps we
13795 @c should pick a cutoff version (for example, no more
13796 @c messages which are specific to versions before 1.9)
13797 @c and then move the old messages to an "old messages"
13798 @c node rather than deleting them completely.
13799
13800 @table @code
13801 @c FIXME: What is the correct way to format a multiline
13802 @c error message here?  Maybe @table is the wrong
13803 @c choice?  Texinfo gurus?
13804 @item @var{file}:@var{line}: Assertion '@var{text}' failed
13805 The exact format of this message may vary depending on
13806 your system.  It indicates a bug in @sc{cvs}, which can
13807 be handled as described in @ref{BUGS}.
13808
13809 @item cvs @var{command}: authorization failed: server @var{host} rejected access
13810 This is a generic response when trying to connect to a
13811 pserver server which chooses not to provide a
13812 specific reason for denying authorization.  Check that
13813 the username and password specified are correct and
13814 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
13815 in @file{inetd.conf}.  See @ref{Password authenticated}.
13816
13817 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
13818 This message indicates that you removed a file, and
13819 someone else modified it.  To resolve the conflict,
13820 first run @samp{cvs add @var{file}}.  If desired, look
13821 at the other party's modification to decide whether you
13822 still want to remove it.  If you don't want to remove
13823 it, stop here.  If you do want to remove it, proceed
13824 with @samp{cvs remove @var{file}} and commit your
13825 removal.
13826 @c Tests conflicts2-142b* in sanity.sh test for this.
13827
13828 @item cannot change permissions on temporary directory
13829 @example
13830 Operation not permitted
13831 @end example
13832 This message has been happening in a non-reproducible,
13833 occasional way when we run the client/server testsuite,
13834 both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
13835 able to figure out what causes it, nor is it known
13836 whether it is specific to Linux (or even to this
13837 particular machine!).  If the problem does occur on
13838 other unices, @samp{Operation not permitted} would be
13839 likely to read @samp{Not owner} or whatever the system
13840 in question uses for the unix @code{EPERM} error.  If
13841 you have any information to add, please let us know as
13842 described in @ref{BUGS}.  If you experience this error
13843 while using @sc{cvs}, retrying the operation which
13844 produced it should work fine.
13845 @c This has been seen in a variety of tests, including
13846 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
13847 @c so it doesn't seem particularly specific to any one
13848 @c test.
13849
13850 @item cvs [server aborted]: Cannot check out files into the repository itself
13851 The obvious cause for this message (especially for
13852 non-client/server @sc{cvs}) is that the @sc{cvs} root
13853 is, for example, @file{/usr/local/cvsroot} and you try
13854 to check out files when you are in a subdirectory, such
13855 as @file{/usr/local/cvsroot/test}.  However, there is a
13856 more subtle cause, which is that the temporary
13857 directory on the server is set to a subdirectory of the
13858 root (which is also not allowed).  If this is the
13859 problem, set the temporary directory to somewhere else,
13860 for example @file{/var/tmp}; see @code{TMPDIR} in
13861 @ref{Environment variables}, for how to set the
13862 temporary directory.
13863
13864 @item cannot commit files as 'root'
13865 See @samp{'root' is not allowed to commit files}.
13866
13867 @c For one example see basica-1a10 in the testsuite
13868 @c For another example, "cvs co ." on NT; see comment
13869 @c at windows-NT/filesubr.c (expand_wild).
13870 @c For another example, "cvs co foo/bar" where foo exists.
13871 @item cannot open CVS/Entries for reading: No such file or directory
13872 This generally indicates a @sc{cvs} internal error, and
13873 can be handled as with other @sc{cvs} bugs
13874 (@pxref{BUGS}).  Usually there is a workaround---the
13875 exact nature of which would depend on the situation but
13876 which hopefully could be figured out.
13877
13878 @c This is more obscure than it might sound; it only
13879 @c happens if you run "cvs init" from a directory which
13880 @c contains a CVS/Root file at the start.
13881 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
13882 This message is harmless.  Provided it is not
13883 accompanied by other errors, the operation has
13884 completed successfully.  This message should not occur
13885 with current versions of @sc{cvs}, but it is documented
13886 here for the benefit of @sc{cvs} 1.9 and older.
13887
13888 @item cvs server: cannot open /root/.cvsignore: Permission denied
13889 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
13890 See @ref{Connection}.
13891
13892 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
13893 This message has been reported as intermittently
13894 happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
13895 unknown; if you know more about what causes it, let us
13896 know as described in @ref{BUGS}.
13897
13898 @item cvs [@var{command} aborted]: cannot start server via rcmd
13899 This, unfortunately, is a rather nonspecific error
13900 message which @sc{cvs} 1.9 will print if you are
13901 running the @sc{cvs} client and it is having trouble
13902 connecting to the server.  Current versions of @sc{cvs}
13903 should print a much more specific error message.  If
13904 you get this message when you didn't mean to run the
13905 client at all, you probably forgot to specify
13906 @code{:local:}, as described in @ref{Repository}.
13907
13908 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
13909 @sc{cvs} 1.9 and older will print this message
13910 when trying to check in a binary file if
13911 @sc{rcs} is not correctly installed.  Re-read the
13912 instructions that came with your @sc{rcs} distribution
13913 and the @sc{install} file in the @sc{cvs}
13914 distribution.  Alternately, upgrade to a current
13915 version of @sc{cvs}, which checks in files itself
13916 rather than via @sc{rcs}.
13917
13918 @item cvs checkout: could not check out @var{file}
13919 With @sc{cvs} 1.9, this can mean that the @code{co} program
13920 (part of @sc{rcs}) returned a failure.  It should be
13921 preceded by another error message, however it has been
13922 observed without another error message and the cause is
13923 not well-understood.  With the current version of @sc{cvs},
13924 which does not run @code{co}, if this message occurs
13925 without another error message, it is definitely a @sc{cvs}
13926 bug (@pxref{BUGS}).
13927 @c My current suspicion is that the RCS in the rcs (not
13928 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
13929 @c CD is bad (remains to be confirmed).
13930 @c There is also a report of something which looks
13931 @c very similar on SGI, Irix 5.2, so I dunno.
13932
13933 @item cvs [login aborted]: could not find out home directory
13934 This means that you need to set the environment
13935 variables that @sc{cvs} uses to locate your home directory.
13936 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
13937 @ref{Environment variables}.
13938
13939 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
13940 @sc{cvs} 1.9 and older will print this message if there was
13941 a problem finding the @code{rcsmerge} program.  Make
13942 sure that it is in your @code{PATH}, or upgrade to a
13943 current version of @sc{cvs}, which does not require
13944 an external @code{rcsmerge} program.
13945
13946 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
13947 This means that there was a problem finding the
13948 @code{patch} program.  Make sure that it is in your
13949 @code{PATH}.  Note that despite appearances the message
13950 is @emph{not} referring to whether it can find @var{file}.
13951 If both the client and the server are running a current
13952 version of @sc{cvs}, then there is no need for an
13953 external patch program and you should not see this
13954 message.  But if either client or server is running
13955 @sc{cvs} 1.9, then you need @code{patch}.
13956
13957 @item cvs update: could not patch @var{file}; will refetch
13958 This means that for whatever reason the client was
13959 unable to apply a patch that the server sent.  The
13960 message is nothing to be concerned about, because
13961 inability to apply the patch only slows things down and
13962 has no effect on what @sc{cvs} does.
13963 @c xref to update output.  Or File status?
13964 @c Or some place else that
13965 @c explains this whole "patch"/P/Needs Patch thing?
13966
13967 @item dying gasps from @var{server} unexpected
13968 There is a known bug in the server for @sc{cvs} 1.9.18
13969 and older which can cause this.  For me, this was
13970 reproducible if I used the @samp{-t} global option.  It
13971 was fixed by Andy Piper's 14 Nov 1997 change to
13972 src/filesubr.c, if anyone is curious.
13973 If you see the message,
13974 you probably can just retry the operation which failed,
13975 or if you have discovered information concerning its
13976 cause, please let us know as described in @ref{BUGS}.
13977
13978 @item end of file from server (consult above messages if any)
13979 The most common cause for this message is if you are
13980 using an external @code{rsh} program and it exited with
13981 an error.  In this case the @code{rsh} program should
13982 have printed a message, which will appear before the
13983 above message.  For more information on setting up a
13984 @sc{cvs} client and server, see @ref{Remote repositories}.
13985
13986 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
13987 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
13988 This means that there is a syntax error in the given
13989 @sc{rcs} file.  Note that this might be true even if @sc{rcs} can
13990 read the file OK; @sc{cvs} does more error checking of
13991 errors in the RCS file.  That is why you may see this
13992 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
13993 1.10.  The likely cause for the original corruption is
13994 hardware, the operating system, or the like.  Of
13995 course, if you find a case in which @sc{cvs} seems to
13996 corrupting the file, by all means report it,
13997 (@pxref{BUGS}).
13998 There are quite a few variations of this error message,
13999 depending on exactly where in the @sc{rcs} file @sc{cvs}
14000 finds the syntax error.
14001
14002 @cindex mkmodules
14003 @item cvs commit: Executing 'mkmodules'
14004 This means that your repository is set up for a version
14005 of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
14006 1.8 or later, the above message will be preceded by
14007
14008 @example
14009 cvs commit: Rebuilding administrative file database
14010 @end example
14011
14012 If you see both messages, the database is being rebuilt
14013 twice, which is unnecessary but harmless.  If you wish
14014 to avoid the duplication, and you have no versions of
14015 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
14016 every place it appears in your @code{modules}
14017 file.  For more information on the @code{modules} file,
14018 see @ref{modules}.
14019
14020 @c This message comes from "co", and I believe is
14021 @c possible only with older versions of CVS which call
14022 @c co.  The problem with being able to create the bogus
14023 @c RCS file still exists, though (and I think maybe
14024 @c there is a different symptom(s) now).
14025 @c FIXME: Would be nice to have a more exact wording
14026 @c for this message.
14027 @item missing author
14028 Typically this can happen if you created an RCS file
14029 with your username set to empty.  @sc{cvs} will, bogusly,
14030 create an illegal RCS file with no value for the author
14031 field.  The solution is to make sure your username is
14032 set to a non-empty value and re-create the RCS file.
14033 @c "make sure your username is set" is complicated in
14034 @c and of itself, as there are the environment
14035 @c variables the system login name, &c, and it depends
14036 @c on the version of CVS.
14037
14038 @item cvs [checkout aborted]: no such tag @var{tag}
14039 This message means that @sc{cvs} isn't familiar with
14040 the tag @var{tag}.  Usually this means that you have
14041 mistyped a tag name; however there are (relatively
14042 obscure) cases in which @sc{cvs} will require you to
14043 @c Search sanity.sh for "no such tag" to see some of
14044 @c the relatively obscure cases.
14045 try a few other @sc{cvs} commands involving that tag,
14046 before you find one which will cause @sc{cvs} to update
14047 @cindex CVSROOT/val-tags file, forcing tags into
14048 @cindex val-tags file, forcing tags into
14049 the @file{val-tags} file; see discussion of val-tags in
14050 @ref{File permissions}.  You only need to worry about
14051 this once for a given tag; when a tag is listed in
14052 @file{val-tags}, it stays there.  Note that using
14053 @samp{-f} to not require tag matches does not override
14054 this check; see @ref{Common options}.
14055
14056 @item *PANIC* administration files missing
14057 This typically means that there is a directory named
14058 @sc{cvs} but it does not contain the administrative files
14059 which @sc{cvs} puts in a CVS directory.  If the problem is
14060 that you created a CVS directory via some mechanism
14061 other than @sc{cvs}, then the answer is simple, use a name
14062 other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
14063 (@pxref{BUGS}).
14064
14065 @item rcs error: Unknown option: -x,v/
14066 This message will be followed by a usage message for
14067 @sc{rcs}.  It means that you have an old version of
14068 @sc{rcs} (probably supplied with your operating
14069 system), as well as an old version of @sc{cvs}.
14070 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
14071 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
14072 @c For more information on installing @sc{cvs}, see
14073 @c (FIXME: where?  it depends on whether you are
14074 @c getting binaries or sources or what).
14075 @c The message can also say "ci error" or something
14076 @c instead of "rcs error", I suspect.
14077
14078 @item cvs [server aborted]: received broken pipe signal
14079 This message can be caused by a loginfo program that fails to
14080 read all of the log information from its standard input.
14081 If you find it happening in any other circumstances,
14082 please let us know as described in @ref{BUGS}.
14083
14084 @item 'root' is not allowed to commit files
14085 When committing a permanent change, @sc{cvs} makes a log entry of
14086 who committed the change.  If you are committing the change logged
14087 in as "root" (not under "su" or other root-priv giving program),
14088 @sc{cvs} cannot determine who is actually making the change.
14089 As such, by default, @sc{cvs} disallows changes to be committed by users
14090 logged in as "root".  (You can disable this option by passing the
14091 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
14092 On some systems this means editing the appropriate @file{config.h} file
14093 before building @sc{cvs}.)
14094
14095 @item Too many arguments!
14096 This message is typically printed by the @file{log.pl}
14097 script which is in the @file{contrib} directory in the
14098 @sc{cvs} source distribution.  In some versions of
14099 @sc{cvs}, @file{log.pl} has been part of the default
14100 @sc{cvs} installation.  The @file{log.pl} script gets
14101 called from the @file{loginfo} administrative file.
14102 Check that the arguments passed in @file{loginfo} match
14103 what your version of @file{log.pl} expects.  In
14104 particular, the @file{log.pl} from @sc{cvs} 1.3 and
14105 older expects the log file as an argument whereas the
14106 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
14107 log file to be specified with a @samp{-f} option.  Of
14108 course, if you don't need @file{log.pl} you can just
14109 comment it out of @file{loginfo}.
14110
14111 @item cvs [update aborted]: unexpected EOF reading @var{file},v
14112 See @samp{EOF in key in RCS file}.
14113
14114 @item cvs [login aborted]: unrecognized auth response from @var{server}
14115 This message typically means that the server is not set
14116 up properly.  For example, if @file{inetd.conf} points
14117 to a nonexistent cvs executable.  To debug it further,
14118 find the log file which inetd writes
14119 (@file{/var/log/messages} or whatever inetd uses on
14120 your system).  For details, see @ref{Connection}, and
14121 @ref{Password authentication server}.
14122
14123 @item cvs commit: Up-to-date check failed for `@var{file}'
14124 This means that someone else has committed a change to
14125 that file since the last time that you did a @code{cvs
14126 update}.  So before proceeding with your @code{cvs
14127 commit} you need to @code{cvs update}.  @sc{cvs} will merge
14128 the changes that you made and the changes that the
14129 other person made.  If it does not detect any conflicts
14130 it will report @samp{M @var{file}} and you are ready
14131 to @code{cvs commit}.  If it detects conflicts it will
14132 print a message saying so, will report @samp{C @var{file}},
14133 and you need to manually resolve the
14134 conflict.  For more details on this process see
14135 @ref{Conflicts example}.
14136
14137 @item Usage:    diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
14138 @example
14139 Only one of [exEX3] allowed
14140 @end example
14141 This indicates a problem with the installation of
14142 @code{diff3} and @code{rcsmerge}.  Specifically
14143 @code{rcsmerge} was compiled to look for GNU diff3, but
14144 it is finding unix diff3 instead.  The exact text of
14145 the message will vary depending on the system.  The
14146 simplest solution is to upgrade to a current version of
14147 @sc{cvs}, which does not rely on external
14148 @code{rcsmerge} or @code{diff3} programs.
14149
14150 @item warning: unrecognized response `@var{text}' from cvs server
14151 If @var{text} contains a valid response (such as
14152 @samp{ok}) followed by an extra carriage return
14153 character (on many systems this will cause the second
14154 part of the message to overwrite the first part), then
14155 it probably means that you are using the @samp{:ext:}
14156 access method with a version of rsh, such as most
14157 non-unix rsh versions, which does not by default
14158 provide a transparent data stream.  In such cases you
14159 probably want to try @samp{:server:} instead of
14160 @samp{:ext:}.  If @var{text} is something else, this
14161 may signify a problem with your @sc{cvs} server.
14162 Double-check your installation against the instructions
14163 for setting up the @sc{cvs} server.
14164 @c FIXCVS: should be printing CR as \r or \015 or some
14165 @c such, probably.
14166
14167 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
14168 This is a normal message, not an error.  See
14169 @ref{Concurrency}, for more details.
14170
14171 @item cvs commit: warning: editor session failed
14172 @cindex Exit status, of editor
14173 This means that the editor which @sc{cvs} is using exits with a nonzero
14174 exit status.  Some versions of vi will do this even when there was not
14175 a problem editing the file.  If so, point the
14176 @code{CVSEDITOR} environment variable to a small script
14177 such as:
14178
14179 @example
14180 #!/bin/sh
14181 vi $*
14182 exit 0
14183 @end example
14184
14185 @c "warning: foo was lost" and "no longer pertinent" (both normal).
14186 @c Would be nice to write these up--they are
14187 @c potentially confusing for the new user.
14188 @end table
14189
14190 @node Connection
14191 @appendixsec Trouble making a connection to a CVS server
14192
14193 This section concerns what to do if you are having
14194 trouble making a connection to a @sc{cvs} server.  If
14195 you are running the @sc{cvs} command line client
14196 running on Windows, first upgrade the client to
14197 @sc{cvs} 1.9.12 or later.  The error reporting in
14198 earlier versions provided much less information about
14199 what the problem was.  If the client is non-Windows,
14200 @sc{cvs} 1.9 should be fine.
14201
14202 If the error messages are not sufficient to track down
14203 the problem, the next steps depend largely on which
14204 access method you are using.
14205
14206 @table @code
14207 @cindex :ext:, troubleshooting
14208 @item :ext:
14209 Try running the rsh program from the command line.  For
14210 example: "rsh servername cvs -v" should print @sc{cvs}
14211 version information.  If this doesn't work, you need to
14212 fix it before you can worry about @sc{cvs} problems.
14213
14214 @cindex :server:, troubleshooting
14215 @item :server:
14216 You don't need a command line rsh program to use this
14217 access method, but if you have an rsh program around,
14218 it may be useful as a debugging tool.  Follow the
14219 directions given for :ext:.
14220
14221 @cindex :pserver:, troubleshooting
14222 @item :pserver:
14223 Errors along the lines of "connection refused" typically indicate
14224 that inetd isn't even listening for connections on port 2401
14225 whereas errors like "connection reset by peer",
14226 "received broken pipe signal", "recv() from server: EOF",
14227 or "end of file from server"
14228 typically indicate that inetd is listening for
14229 connections but is unable to start @sc{cvs} (this is frequently
14230 caused by having an incorrect path in @file{inetd.conf}
14231 or by firewall software rejecting the connection).
14232 "unrecognized auth response" errors are caused by a bad command
14233 line in @file{inetd.conf}, typically an invalid option or forgetting
14234 to put the @samp{pserver} command at the end of the line.
14235 Another less common problem is invisible control characters that
14236 your editor "helpfully" added without you noticing.
14237
14238 One good debugging tool is to "telnet servername
14239 2401".  After connecting, send any text (for example
14240 "foo" followed by return).  If @sc{cvs} is working
14241 correctly, it will respond with
14242
14243 @example
14244 cvs [pserver aborted]: bad auth protocol start: foo
14245 @end example
14246
14247 If instead you get:
14248
14249 @example
14250 Usage: cvs [cvs-options] command [command-options-and-arguments]
14251 ...
14252 @end example
14253
14254 @noindent
14255 then you're missing the @samp{pserver} command at the end of the
14256 line in @file{inetd.conf}; check to make sure that the entire command
14257 is on one line and that it's complete.
14258
14259 Likewise, if you get something like:
14260
14261 @example
14262 Unknown command: `pserved'
14263
14264 CVS commands are:
14265         add          Add a new file/directory to the repository
14266 ...
14267 @end example
14268
14269 @noindent
14270 then you've misspelled @samp{pserver} in some way.  If it isn't
14271 obvious, check for invisible control characters (particularly
14272 carriage returns) in @file{inetd.conf}.
14273
14274 If it fails to work at all, then make sure inetd is working
14275 right.  Change the invocation in @file{inetd.conf} to run the
14276 echo program instead of cvs.  For example:
14277
14278 @example
14279 2401  stream  tcp  nowait  root /bin/echo echo hello
14280 @end example
14281
14282 After making that change and instructing inetd to
14283 re-read its configuration file, "telnet servername
14284 2401" should show you the text hello and then the
14285 server should close the connection.  If this doesn't
14286 work, you need to fix it before you can worry about
14287 @sc{cvs} problems.
14288
14289 On AIX systems, the system will often have its own
14290 program trying to use port 2401.  This is AIX's problem
14291 in the sense that port 2401 is registered for use with
14292 @sc{cvs}.  I hear that there is an AIX patch available
14293 to address this problem.
14294
14295 Another good debugging tool is the @samp{-d}
14296 (debugging) option to inetd.  Consult your system
14297 documentation for more information.
14298
14299 If you seem to be connecting but get errors like:
14300
14301 @example
14302 cvs server: cannot open /root/.cvsignore: Permission denied
14303 cvs [server aborted]: can't chdir(/root): Permission denied
14304 @end example
14305
14306 @noindent
14307 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
14308 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
14309 your system setting the @code{$HOME} environment variable
14310 for programs being run by inetd.  In this case, you can either
14311 have inetd run a shell script that unsets @code{$HOME} and then runs
14312 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
14313 environment.)
14314
14315 If you can connect successfully for a while but then can't,
14316 you've probably hit inetd's rate limit.
14317 (If inetd receives too many requests for the same service
14318 in a short period of time, it assumes that something is wrong
14319 and temporarily disables the service.)
14320 Check your inetd documentation to find out how to adjust the
14321 rate limit (some versions of inetd have a single rate limit,
14322 others allow you to set the limit for each service separately.)
14323 @end table
14324
14325 @node Other problems
14326 @appendixsec Other common problems
14327
14328 Here is a list of problems which do not fit into the
14329 above categories.  They are in no particular order.
14330
14331 @itemize @bullet
14332 @item
14333 On Windows, if there is a 30 second or so delay when
14334 you run a @sc{cvs} command, it may mean that you have
14335 your home directory set to @file{C:/}, for example (see
14336 @code{HOMEDRIVE} and @code{HOMEPATH} in
14337 @ref{Environment variables}).  @sc{cvs} expects the home
14338 directory to not end in a slash, for example @file{C:}
14339 or @file{C:\cvs}.
14340 @c FIXCVS: CVS should at least detect this and print an
14341 @c error, presumably.
14342
14343 @item
14344 If you are running @sc{cvs} 1.9.18 or older, and
14345 @code{cvs update} finds a conflict and tries to
14346 merge, as described in @ref{Conflicts example}, but
14347 doesn't tell you there were conflicts, then you may
14348 have an old version of @sc{rcs}.  The easiest solution
14349 probably is to upgrade to a current version of
14350 @sc{cvs}, which does not rely on external @sc{rcs}
14351 programs.
14352 @end itemize
14353
14354 @c ---------------------------------------------------------------------
14355 @node Credits
14356 @appendix Credits
14357
14358 @cindex Contributors (manual)
14359 @cindex Credits (manual)
14360 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
14361 wrote the manual pages which were distributed with
14362 @sc{cvs} 1.3.  Much of their text was copied into this
14363 manual.  He also read an early draft
14364 of this manual and contributed many ideas and
14365 corrections.
14366
14367 The mailing-list @code{info-cvs} is sometimes
14368 informative. I have included information from postings
14369 made by the following persons:
14370 David G. Grubbs <@t{dgg@@think.com}>.
14371
14372 Some text has been extracted from the man pages for
14373 @sc{rcs}.
14374
14375 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
14376 useful material.  The @sc{faq} is no longer maintained,
14377 however, and this manual is about the closest thing there
14378 is to a successor (with respect to documenting how to
14379 use @sc{cvs}, at least).
14380
14381 In addition, the following persons have helped by
14382 telling me about mistakes I've made:
14383
14384 @display
14385 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
14386 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
14387 Karl Pingle <@t{pingle@@acuson.com}>,
14388 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
14389 Inge Wallin <@t{ingwa@@signum.se}>,
14390 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
14391 and Michael Brown <@t{brown@@wi.extrel.com}>.
14392 @end display
14393
14394 The list of contributors here is not comprehensive; for a more
14395 complete list of who has contributed to this manual see
14396 the file @file{doc/ChangeLog} in the @sc{cvs} source
14397 distribution.
14398
14399 @c ---------------------------------------------------------------------
14400 @node BUGS
14401 @appendix Dealing with bugs in CVS or this manual
14402
14403 @cindex Bugs in this manual or CVS
14404 Neither @sc{cvs} nor this manual is perfect, and they
14405 probably never will be.  If you are having trouble
14406 using @sc{cvs}, or think you have found a bug, there
14407 are a number of things you can do about it.  Note that
14408 if the manual is unclear, that can be considered a bug
14409 in the manual, so these problems are often worth doing
14410 something about as well as problems with @sc{cvs} itself.
14411
14412 @cindex Reporting bugs
14413 @cindex Bugs, reporting
14414 @cindex Errors, reporting
14415 @itemize @bullet
14416 @item
14417 If you want someone to help you and fix bugs that you
14418 report, there are companies which will do that for a
14419 fee.  One such company is:
14420
14421 @cindex Ximbiot
14422 @cindex Support, getting CVS support
14423 @example
14424 Ximbiot
14425 319 S. River St.
14426 Harrisburg, PA  17104-1657
14427 USA
14428 Email: info@@ximbiot.com
14429 Phone: (717) 579-6168
14430 Fax:   (717) 234-3125
14431 @url{http://ximbiot.com/}
14432
14433 @end example
14434
14435 @item
14436 If you got @sc{cvs} through a distributor, such as an
14437 operating system vendor or a vendor of freeware
14438 @sc{cd-rom}s, you may wish to see whether the
14439 distributor provides support.  Often, they will provide
14440 no support or minimal support, but this may vary from
14441 distributor to distributor.
14442
14443 @item
14444 If you have the skills and time to do so, you may wish
14445 to fix the bug yourself.  If you wish to submit your
14446 fix for inclusion in future releases of @sc{cvs}, see
14447 the file @sc{hacking} in the @sc{cvs} source
14448 distribution.  It contains much more information on the
14449 process of submitting fixes.
14450
14451 @item
14452 There may be resources on the net which can help.  Two
14453 good places to start are:
14454
14455 @example
14456 @url{http://www.cvshome.org}
14457 @url{http://www.loria.fr/~molli/cvs-index.html}
14458 @end example
14459
14460 If you are so inspired, increasing the information
14461 available on the net is likely to be appreciated.  For
14462 example, before the standard @sc{cvs} distribution
14463 worked on Windows 95, there was a web page with some
14464 explanation and patches for running @sc{cvs} on Windows
14465 95, and various people helped out by mentioning this
14466 page on mailing lists or newsgroups when the subject
14467 came up.
14468
14469 @item
14470 It is also possible to report bugs to @email{bug-cvs@@gnu.org}.
14471 Note that someone may or may not want to do anything
14472 with your bug report---if you need a solution consider
14473 one of the options mentioned above.  People probably do
14474 want to hear about bugs which are particularly severe
14475 in consequences and/or easy to fix, however.  You can
14476 also increase your odds by being as clear as possible
14477 about the exact nature of the bug and any other
14478 relevant information.  The way to report bugs is to
14479 send email to @email{bug-cvs@@gnu.org}.  Note
14480 that submissions to @email{bug-cvs@@gnu.org} may be distributed
14481 under the terms of the @sc{gnu} Public License, so if
14482 you don't like this, don't submit them.  There is
14483 usually no justification for sending mail directly to
14484 one of the @sc{cvs} maintainers rather than to
14485 @email{bug-cvs@@gnu.org}; those maintainers who want to hear
14486 about such bug reports read @email{bug-cvs@@gnu.org}.  Also note
14487 that sending a bug report to other mailing lists or
14488 newsgroups is @emph{not} a substitute for sending it to
14489 @email{bug-cvs@@gnu.org}.  It is fine to discuss @sc{cvs} bugs on
14490 whatever forum you prefer, but there are not
14491 necessarily any maintainers reading bug reports sent
14492 anywhere except @email{bug-cvs@@gnu.org}.
14493 @end itemize
14494
14495 @cindex Known bugs in this manual or CVS
14496 People often ask if there is a list of known bugs or
14497 whether a particular bug is a known one.  The file
14498 @sc{bugs} in the @sc{cvs} source distribution is one
14499 list of known bugs, but it doesn't necessarily try to
14500 be comprehensive.  Perhaps there will never be a
14501 comprehensive, detailed list of known bugs.
14502
14503 @c ---------------------------------------------------------------------
14504 @node Index
14505 @unnumbered Index
14506 @cindex Index
14507
14508 @printindex cp
14509
14510 @summarycontents
14511
14512 @contents
14513
14514 @bye
14515 \f
14516 Local Variables:
14517 fill-column: 55
14518 End: