]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/doc/cvs.texinfo
This commit was generated by cvs2svn to compensate for changes in r176892,
[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, 2005
8                        Free Software Foundation, Inc.
9
10 @multitable @columnfractions .12 .88
11 @item Portions
12 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005
13                                   Derek R. Price,
14 @item @tab Copyright @copyright{} 2002, 2003, 2004, 2005
15                                   Ximbiot @url{http://ximbiot.com},
16 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
17 @item @tab and Copyright @copyright{} others.
18 @end multitable
19
20 @ignore
21 Permission is granted to process this file through Tex and print the
22 results, provided the printed document carries copying permission
23 notice identical to this one except for the removal of this paragraph
24 (this paragraph not being relevant to the printed manual).
25
26 @end ignore
27 Permission is granted to make and distribute verbatim copies of
28 this manual provided the copyright notice and this permission notice
29 are preserved on all copies.
30
31 Permission is granted to copy and distribute modified versions of this
32 manual under the conditions for verbatim copying, provided also that the
33 entire resulting derived work is distributed under the terms of a
34 permission notice identical to this one.
35
36 Permission is granted to copy and distribute translations of this manual
37 into another language, under the above conditions for modified versions,
38 except that this permission notice may be stated in a translation
39 approved by the Free Software Foundation.
40 @end macro
41
42 @comment This file is part of the CVS distribution.
43
44 @comment CVS is free software; you can redistribute it and/or modify
45 @comment it under the terms of the GNU General Public License as published by
46 @comment the Free Software Foundation; either version 2, or (at your option)
47 @comment any later version.
48
49 @comment CVS is distributed in the hope that it will be useful,
50 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
51 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
52 @comment GNU General Public License for more details.
53
54 @c See ../README for A4 vs. US letter size.
55 @c When we provided A4 postscript, and people tried to
56 @c print it on US letter, the usual complaint was that the
57 @c page numbers would get cut off.
58 @c If one prints US letter on A4, reportedly there is
59 @c some extra space at the top and/or bottom, and the side
60 @c margins are a bit narrow, but no text is lost.
61 @c
62 @c See
63 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
64 @c for more on paper sizes.  Insuring that margins are
65 @c big enough to print on either A4 or US letter does
66 @c indeed seem to be the usual approach (RFC2346).
67
68 @c This document seems to get overfull hboxes with some
69 @c frequency (probably because the tendency is to
70 @c sanity-check it with "make info" and run TeX less
71 @c often).  The big ugly boxes just seem to add insult
72 @c to injury, and I'm not aware of them helping to fix
73 @c the overfull hboxes at all.
74 @finalout
75
76 @include version.texi
77 @settitle CVS---Concurrent Versions System v@value{VERSION}
78 @setchapternewpage odd
79
80 @c -- TODO list:
81 @c -- Fix all lines that match "^@c -- "
82 @c -- Also places marked with FIXME should be manual
83 @c problems (as opposed to FIXCVS for CVS problems).
84
85 @c @splitrcskeyword{} is used to avoid keyword expansion.  It is replaced by
86 @c @asis when generating info and dvi, and by <i></i> in the generated html,
87 @c such that keywords are not expanded in the generated html. 
88 @ifnothtml
89 @macro splitrcskeyword {arg}
90 @asis{}\arg\
91 @end macro
92 @end ifnothtml
93
94 @ifhtml
95 @macro splitrcskeyword {arg}
96 @i{}\arg\
97 @end macro
98 @end ifhtml
99
100 @dircategory GNU Packages
101 @direntry
102 * CVS: (cvs).                   Concurrent Versions System
103 @end direntry
104 @dircategory Individual utilities
105 @direntry
106 * cvs: (cvs)CVS commands.       Concurrent Versions System
107 @end direntry
108
109 @comment The titlepage section does not appear in the Info file.
110 @titlepage
111 @sp 4
112 @comment The title is printed in a large font.
113 @center @titlefont{Version Management}
114 @sp
115 @center @titlefont{with}
116 @sp
117 @center @titlefont{CVS}
118 @sp 2
119 @center for @sc{cvs} @value{VERSION}
120 @comment -release-
121 @sp 3
122 @center Per Cederqvist et al
123
124 @comment  The following two commands start the copyright page
125 @comment  for the printed manual.  This will not appear in the Info file.
126 @page
127 @vskip 0pt plus 1filll
128 @copyleftnotice
129 @end titlepage
130
131 @summarycontents
132
133 @contents
134
135 @comment ================================================================
136 @comment                   The real text starts here
137 @comment ================================================================
138
139 @ifnottex
140 @c ---------------------------------------------------------------------
141 @node    Top
142 @top
143
144 This info manual describes how to use and administer
145 @sc{cvs} version @value{VERSION}.
146 @end ifnottex
147
148 @ifinfo
149 @copyleftnotice
150 @end ifinfo
151
152 @c This menu is pretty long.  Not sure how easily that
153 @c can be fixed (no brilliant ideas right away)...
154 @menu
155 * Overview::                    An introduction to CVS
156 * Repository::                  Where all your sources are stored
157 * Starting a new project::      Starting a project with CVS
158 * Revisions::                   Numeric and symbolic names for revisions
159 * Branching and merging::       Diverging/rejoining branches of development
160 * Recursive behavior::          CVS descends directories
161 * Adding and removing::         Adding/removing/renaming files/directories
162 * History browsing::            Viewing the history of files in various ways
163
164 CVS and the Real World.
165 -----------------------
166 * Binary files::                CVS can handle binary files
167 * Multiple developers::         How CVS helps a group of developers
168 * Revision management::         Policy questions for revision management
169 * Keyword substitution::        CVS can include the revision inside the file
170 * Tracking sources::            Tracking third-party sources
171 * Builds::                      Issues related to CVS and builds
172 * Special Files::               Devices, links and other non-regular files
173
174 References.
175 -----------
176 * CVS commands::                CVS commands share some things
177 * Invoking CVS::                Quick reference to CVS commands
178 * Administrative files::        Reference manual for the Administrative files
179 * Environment variables::       All environment variables which affect CVS
180 * Compatibility::               Upgrading CVS versions
181 * Troubleshooting::             Some tips when nothing works
182 * Credits::                     Some of the contributors to this manual
183 * BUGS::                        Dealing with bugs in CVS or this manual
184 * Index::                       Index
185 @end menu
186
187 @c ---------------------------------------------------------------------
188 @node Overview
189 @chapter Overview
190 @cindex Overview
191
192 This chapter is for people who have never used
193 @sc{cvs}, and perhaps have never used version control
194 software before.
195
196 If you are already familiar with @sc{cvs} and are just
197 trying to learn a particular feature or remember a
198 certain command, you can probably skip everything here.
199
200 @menu
201 * What is CVS?::                What you can do with @sc{cvs}
202 * What is CVS not?::            Problems @sc{cvs} doesn't try to solve
203 * A sample session::            A tour of basic @sc{cvs} usage
204 @end menu
205
206 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
207 @node What is CVS?
208 @section What is CVS?
209 @cindex What is CVS?
210 @cindex Introduction to CVS
211 @cindex CVS, introduction to
212
213 @sc{cvs} is a version control system.  Using it, you can
214 record the history of your source files.
215
216 @c -- ///
217 @c -- ///Those who cannot remember the past are condemned to repeat it.
218 @c -- ///               -- George Santayana
219 @c -- //////
220
221 @c -- Insert history  quote here!
222 For example, bugs sometimes creep in when
223 software is modified, and you might not detect the bug
224 until a long time after you make the modification.
225 With @sc{cvs}, you can easily retrieve old versions to see
226 exactly which change caused the bug.  This can
227 sometimes be a big help.
228
229 You could of course save every version of every file
230 you have ever created.  This would
231 however waste an enormous amount of disk space.  @sc{cvs}
232 stores all the versions of a file in a single file in a
233 clever way that only stores the differences between
234 versions.
235
236 @sc{cvs} also helps you if you are part of a group of people working
237 on the same project.  It is all too easy to overwrite
238 each others' changes unless you are extremely careful.
239 Some editors, like @sc{gnu} Emacs, try to make sure that
240 two people never modify the same file at the
241 same time.  Unfortunately, if someone is using another
242 editor, that safeguard will not work.  @sc{cvs} solves this problem
243 by insulating the different developers from each other.  Every
244 developer works in his own directory, and @sc{cvs} merges
245 the work when each developer is done.
246
247 @cindex History of CVS
248 @cindex CVS, history of
249 @cindex Credits (CVS program)
250 @cindex Contributors (CVS program)
251 @sc{cvs} started out as a bunch of shell scripts written by
252 Dick Grune, posted to the newsgroup
253 @code{comp.sources.unix} in the volume 6
254 release of July, 1986.  While no actual code from
255 these shell scripts is present in the current version
256 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
257 come from them.
258
259 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
260 Jeff Polk later helped Brian with the design of the @sc{cvs}
261 module and vendor branch support.
262
263 @cindex Source, getting CVS source
264 You can get @sc{cvs} in a variety of ways, including
265 free download from the Internet.  For more information
266 on downloading @sc{cvs} and other @sc{cvs} topics, see:
267
268 @example
269 @url{http://cvs.nongnu.org/}
270 @end example
271
272 @cindex Mailing list
273 @cindex List, mailing list
274 @cindex Newsgroups
275 There is a mailing list, known as @email{info-cvs@@nongnu.org},
276 devoted to @sc{cvs}.  To subscribe or
277 unsubscribe
278 write to
279 @email{info-cvs-request@@nongnu.org}.
280 If you prefer a Usenet group, there is a one-way mirror (posts to the email
281 list are usually sent to the news group, but not vice versa) of
282 @email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}.  The right
283 Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
284 @sc{cvs} discussions (along with other configuration
285 management systems).  In the future, it might be
286 possible to create a
287 @code{comp.software.config-mgmt.cvs}, but probably only
288 if there is sufficient @sc{cvs} traffic on
289 @url{news:comp.software.config-mgmt}.
290 @c Other random data is that the tale was very
291 @c skeptical of comp.software.config-mgmt.cvs when the
292 @c subject came up around 1995 or so (for one
293 @c thing, because creating it would be a "reorg" which
294 @c would need to take a more comprehensive look at the
295 @c whole comp.software.config-mgmt.* hierarchy).
296
297 You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list,
298 described in more detail in @ref{BUGS}.  To subscribe
299 send mail to @email{bug-cvs-request@@nongnu.org}.  There is a two-way
300 Usenet mirror (posts to the Usenet group are usually sent to the email list and
301 vice versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}.
302
303 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
304 @node What is CVS not?
305 @section What is CVS not?
306 @cindex What is CVS not?
307
308 @sc{cvs} can do a lot of things for you, but it does
309 not try to be everything for everyone.
310
311 @table @asis
312 @item @sc{cvs} is not a build system.
313
314 Though the structure of your repository and modules
315 file interact with your build system
316 (e.g. @file{Makefile}s), they are essentially
317 independent.
318
319 @sc{cvs} does not dictate how you build anything.  It
320 merely stores files for retrieval in a tree structure
321 you devise.
322
323 @sc{cvs} does not dictate how to use disk space in the
324 checked out working directories.  If you write your
325 @file{Makefile}s or scripts in every directory so they
326 have to know the relative positions of everything else,
327 you wind up requiring the entire repository to be
328 checked out.
329
330 If you modularize your work, and construct a build
331 system that will share files (via links, mounts,
332 @code{VPATH} in @file{Makefile}s, etc.), you can
333 arrange your disk usage however you like.
334
335 But you have to remember that @emph{any} such system is
336 a lot of work to construct and maintain.  @sc{cvs} does
337 not address the issues involved.
338
339 Of course, you should place the tools created to
340 support such a build system (scripts, @file{Makefile}s,
341 etc) under @sc{cvs}.
342
343 Figuring out what files need to be rebuilt when
344 something changes is, again, something to be handled
345 outside the scope of @sc{cvs}.  One traditional
346 approach is to use @code{make} for building, and use
347 some automated tool for generating the dependencies which
348 @code{make} uses.
349
350 See @ref{Builds}, for more information on doing builds
351 in conjunction with @sc{cvs}.
352
353 @item @sc{cvs} is not a substitute for management.
354
355 Your managers and project leaders are expected to talk
356 to you frequently enough to make certain you are aware
357 of schedules, merge points, branch names and release
358 dates.  If they don't, @sc{cvs} can't help.
359
360 @sc{cvs} is an instrument for making sources dance to
361 your tune.  But you are the piper and the composer.  No
362 instrument plays itself or writes its own music.
363
364 @item @sc{cvs} is not a substitute for developer communication.
365
366 When faced with conflicts within a single file, most
367 developers manage to resolve them without too much
368 effort.  But a more general definition of ``conflict''
369 includes problems too difficult to solve without
370 communication between developers.
371
372 @sc{cvs} cannot determine when simultaneous changes
373 within a single file, or across a whole collection of
374 files, will logically conflict with one another.  Its
375 concept of a @dfn{conflict} is purely textual, arising
376 when two changes to the same base file are near enough
377 to spook the merge (i.e. @code{diff3}) command.
378
379 @sc{cvs} does not claim to help at all in figuring out
380 non-textual or distributed conflicts in program logic.
381
382 For example: Say you change the arguments to function
383 @code{X} defined in file @file{A}.  At the same time,
384 someone edits file @file{B}, adding new calls to
385 function @code{X} using the old arguments.  You are
386 outside the realm of @sc{cvs}'s competence.
387
388 Acquire the habit of reading specs and talking to your
389 peers.
390
391
392 @item @sc{cvs} does not have change control
393
394 Change control refers to a number of things.  First of
395 all it can mean @dfn{bug-tracking}, that is being able
396 to keep a database of reported bugs and the status of
397 each one (is it fixed?  in what release?  has the bug
398 submitter agreed that it is fixed?).  For interfacing
399 @sc{cvs} to an external bug-tracking system, see the
400 @file{rcsinfo} and @file{verifymsg} files
401 (@pxref{Administrative files}).
402
403 Another aspect of change control is keeping track of
404 the fact that changes to several files were in fact
405 changed together as one logical change.  If you check
406 in several files in a single @code{cvs commit}
407 operation, @sc{cvs} then forgets that those files were
408 checked in together, and the fact that they have the
409 same log message is the only thing tying them
410 together.  Keeping a @sc{gnu} style @file{ChangeLog}
411 can help somewhat.
412 @c FIXME: should have an xref to a section which talks
413 @c more about keeping ChangeLog's with CVS, but that
414 @c section hasn't been written yet.
415
416 Another aspect of change control, in some systems, is
417 the ability to keep track of the status of each
418 change.  Some changes have been written by a developer,
419 others have been reviewed by a second developer, and so
420 on.  Generally, the way to do this with @sc{cvs} is to
421 generate a diff (using @code{cvs diff} or @code{diff})
422 and email it to someone who can then apply it using the
423 @code{patch} utility.  This is very flexible, but
424 depends on mechanisms outside @sc{cvs} to make sure
425 nothing falls through the cracks.
426
427 @item @sc{cvs} is not an automated testing program
428
429 It should be possible to enforce mandatory use of a
430 test suite using the @code{commitinfo} file.  I haven't
431 heard a lot about projects trying to do that or whether
432 there are subtle gotchas, however.
433
434 @item @sc{cvs} does not have a built-in process model
435
436 Some systems provide ways to ensure that changes or
437 releases go through various steps, with various
438 approvals as needed.  Generally, one can accomplish
439 this with @sc{cvs} but it might be a little more work.
440 In some cases you'll want to use the @file{commitinfo},
441 @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
442 files, to require that certain steps be performed
443 before cvs will allow a checkin.  Also consider whether
444 features such as branches and tags can be used to
445 perform tasks such as doing work in a development tree
446 and then merging certain changes over to a stable tree
447 only once they have been proven.
448 @end table
449
450 @c ---------------------------------------------------------------------
451 @node A sample session
452 @section A sample session
453 @cindex Example of a work-session
454 @cindex Getting started
455 @cindex Work-session, example of
456 @cindex tc, Trivial Compiler (example)
457 @cindex Trivial Compiler (example)
458
459 @c I think an example is a pretty good way to start.  But
460 @c somewhere in here, maybe after the sample session,
461 @c we need something which is kind of
462 @c a "roadmap" which is more directed at sketching out
463 @c the functionality of CVS and pointing people to
464 @c various other parts of the manual.  As it stands now
465 @c people who read in order get dumped right into all
466 @c manner of hair regarding remote repositories,
467 @c creating a repository, etc.
468 @c
469 @c The following was in the old Basic concepts node.  I don't
470 @c know how good a job it does at introducing modules,
471 @c or whether they need to be introduced so soon, but
472 @c something of this sort might go into some
473 @c introductory material somewhere.
474 @ignore
475 @cindex Modules (intro)
476 The repository contains directories and files, in an
477 arbitrary tree.  The @dfn{modules} feature can be used
478 to group together a set of directories or files into a
479 single entity (@pxref{modules}).  A typical usage is to
480 define one module per project.
481 @end ignore
482
483 As a way of introducing @sc{cvs}, we'll go through a
484 typical work-session using @sc{cvs}.  The first thing
485 to understand is that @sc{cvs} stores all files in a
486 centralized @dfn{repository} (@pxref{Repository}); this
487 section assumes that a repository is set up.
488 @c I'm not sure that the sentence concerning the
489 @c repository quite tells the user what they need to
490 @c know at this point.  Might need to expand on "centralized"
491 @c slightly (maybe not here, maybe further down in the example?)
492
493 Suppose you are working on a simple compiler.  The source
494 consists of a handful of C files and a @file{Makefile}.
495 The compiler is called @samp{tc} (Trivial Compiler),
496 and the repository is set up so that there is a module
497 called @samp{tc}.
498
499 @menu
500 * Getting the source::          Creating a workspace
501 * Committing your changes::     Making your work available to others
502 * Cleaning up::                 Cleaning up
503 * Viewing differences::         Viewing differences
504 @end menu
505
506 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
507 @node Getting the source
508 @subsection Getting the source
509 @cindex Getting the source
510 @cindex Checking out source
511 @cindex Fetching source
512 @cindex Source, getting from CVS
513 @cindex Checkout, example
514
515 The first thing you must do is to get your own working copy of the
516 source for @samp{tc}.  For this, you use the @code{checkout} command:
517
518 @example
519 $ cvs checkout tc
520 @end example
521
522 @noindent
523 This will create a new directory called @file{tc} and populate it with
524 the source files.
525
526 @example
527 $ cd tc
528 $ ls
529 CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
530 @end example
531
532 The @file{CVS} directory is used internally by
533 @sc{cvs}.  Normally, you should not modify or remove
534 any of the files in it.
535
536 You start your favorite editor, hack away at @file{backend.c}, and a couple
537 of hours later you have added an optimization pass to the compiler.
538 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
539 you want to edit.  @xref{Multiple developers}, for an explanation.
540
541 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
542 @node Committing your changes
543 @subsection Committing your changes
544 @cindex Committing changes to files
545 @cindex Log message entry
546
547 When you have checked that the compiler is still compilable you decide
548 to make a new version of @file{backend.c}.  This will
549 store your new @file{backend.c} in the repository and
550 make it available to anyone else who is using that same
551 repository.
552
553 @example
554 $ cvs commit backend.c
555 @end example
556
557 @noindent
558 @sc{cvs} starts an editor, to allow you to enter a log
559 message.  You type in ``Added an optimization pass.'',
560 save the temporary file, and exit the editor.
561
562 @cindex CVSEDITOR, environment variable
563 @cindex EDITOR, environment variable
564 The environment variable @code{$CVSEDITOR} determines
565 which editor is started.  If @code{$CVSEDITOR} is not
566 set, then if the environment variable @code{$EDITOR} is
567 set, it will be used. If both @code{$CVSEDITOR} and
568 @code{$EDITOR} are not set then there is a default
569 which will vary with your operating system, for example
570 @code{vi} for unix or @code{notepad} for Windows
571 NT/95.
572
573 @cindex VISUAL, environment variable
574 In addition, @sc{cvs} checks the @code{$VISUAL} environment
575 variable.  Opinions vary on whether this behavior is desirable and
576 whether future releases of @sc{cvs} should check @code{$VISUAL} or
577 ignore it.  You will be OK either way if you make sure that
578 @code{$VISUAL} is either unset or set to the same thing as
579 @code{$EDITOR}.
580
581 @c This probably should go into some new node
582 @c containing detailed info on the editor, rather than
583 @c the intro.  In fact, perhaps some of the stuff with
584 @c CVSEDITOR and -m and so on should too.
585 When @sc{cvs} starts the editor, it includes a list of
586 files which are modified.  For the @sc{cvs} client,
587 this list is based on comparing the modification time
588 of the file against the modification time that the file
589 had when it was last gotten or updated.  Therefore, if
590 a file's modification time has changed but its contents
591 have not, it will show up as modified.  The simplest
592 way to handle this is simply not to worry about it---if
593 you proceed with the commit @sc{cvs} will detect that
594 the contents are not modified and treat it as an
595 unmodified file.  The next @code{update} will clue
596 @sc{cvs} in to the fact that the file is unmodified,
597 and it will reset its stored timestamp so that the file
598 will not show up in future editor sessions.
599 @c FIXCVS: Might be nice if "commit" and other commands
600 @c would reset that timestamp too, but currently commit
601 @c doesn't.
602 @c FIXME: Need to talk more about the process of
603 @c prompting for the log message.  Like show an example
604 @c of what it pops up in the editor, for example.  Also
605 @c a discussion of how to get the "a)bort, c)ontinue,
606 @c e)dit" prompt and what to do with it.  Might also
607 @c work in the suggestion that if you want a diff, you
608 @c should make it before running commit (someone
609 @c suggested that the diff pop up in the editor.  I'm
610 @c not sure that is better than telling people to run
611 @c "cvs diff" first if that is what they want, but if
612 @c we want to tell people that, the manual possibly
613 @c should say it).
614
615 If you want to avoid
616 starting an editor you can specify the log message on
617 the command line using the @samp{-m} flag instead, like
618 this:
619
620 @example
621 $ cvs commit -m "Added an optimization pass" backend.c
622 @end example
623
624 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
625 @node Cleaning up
626 @subsection Cleaning up
627 @cindex Cleaning up
628 @cindex Working copy, removing
629 @cindex Removing your working copy
630 @cindex Releasing your working copy
631
632 Before you turn to other tasks you decide to remove your working copy of
633 tc.  One acceptable way to do that is of course
634
635 @example
636 $ cd ..
637 $ rm -r tc
638 @end example
639
640 @noindent
641 but a better way is to use the @code{release} command (@pxref{release}):
642
643 @example
644 $ cd ..
645 $ cvs release -d tc
646 M driver.c
647 ? tc
648 You have [1] altered files in this repository.
649 Are you sure you want to release (and delete) directory `tc': n
650 ** `release' aborted by user choice.
651 @end example
652
653 The @code{release} command checks that all your modifications have been
654 committed.  If history logging is enabled it also makes a note in the
655 history file.  @xref{history file}.
656
657 When you use the @samp{-d} flag with @code{release}, it
658 also removes your working copy.
659
660 In the example above, the @code{release} command wrote a couple of lines
661 of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
662 That is nothing to worry about: @file{tc} is the executable compiler,
663 and it should not be stored in the repository.  @xref{cvsignore},
664 for information about how to make that warning go away.
665 @xref{release output}, for a complete explanation of
666 all possible output from @code{release}.
667
668 @samp{M driver.c} is more serious.  It means that the
669 file @file{driver.c} has been modified since it was
670 checked out.
671
672 The @code{release} command always finishes by telling
673 you how many modified files you have in your working
674 copy of the sources, and then asks you for confirmation
675 before deleting any files or making any note in the
676 history file.
677
678 You decide to play it safe and answer @kbd{n @key{RET}}
679 when @code{release} asks for confirmation.
680
681 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
682 @node Viewing differences
683 @subsection Viewing differences
684 @cindex Viewing differences
685 @cindex Diff
686
687 You do not remember modifying @file{driver.c}, so you want to see what
688 has happened to that file.
689
690 @example
691 $ cd tc
692 $ cvs diff driver.c
693 @end example
694
695 This command runs @code{diff} to compare the version of @file{driver.c}
696 that you checked out with your working copy.  When you see the output
697 you remember that you added a command line option that enabled the
698 optimization pass.  You check it in, and release the module.
699 @c FIXME: we haven't yet defined the term "check in".
700
701 @example
702 $ cvs commit -m "Added an optimization pass" driver.c
703 Checking in driver.c;
704 /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
705 new revision: 1.2; previous revision: 1.1
706 done
707 $ cd ..
708 $ cvs release -d tc
709 ? tc
710 You have [0] altered files in this repository.
711 Are you sure you want to release (and delete) directory `tc': y
712 @end example
713
714 @c ---------------------------------------------------------------------
715 @node Repository
716 @chapter The Repository
717 @cindex Repository (intro)
718 @cindex Repository, example
719 @cindex Layout of repository
720 @cindex Typical repository
721 @cindex /usr/local/cvsroot, as example repository
722 @cindex cvsroot
723
724 The @sc{cvs} @dfn{repository} stores a complete copy of
725 all the files and directories which are under version
726 control.
727
728 Normally, you never access any of the files in the
729 repository directly.  Instead, you use @sc{cvs}
730 commands to get your own copy of the files into a
731 @dfn{working directory}, and then
732 work on that copy.  When you've finished a set of
733 changes, you check (or @dfn{commit}) them back into the
734 repository.  The repository then contains the changes
735 which you have made, as well as recording exactly what
736 you changed, when you changed it, and other such
737 information.  Note that the repository is not a
738 subdirectory of the working directory, or vice versa;
739 they should be in separate locations.
740 @c Need some example, e.g. repository
741 @c /usr/local/cvsroot; working directory
742 @c /home/joe/sources.  But this node is too long
743 @c as it is; need a little reorganization...
744
745 @cindex :local:, setting up
746 @sc{cvs} can access a repository by a variety of
747 means.  It might be on the local computer, or it might
748 be on a computer across the room or across the world.
749 To distinguish various ways to access a repository, the
750 repository name can start with an @dfn{access method}.
751 For example, the access method @code{:local:} means to
752 access a repository directory, so the repository
753 @code{:local:/usr/local/cvsroot} means that the
754 repository is in @file{/usr/local/cvsroot} on the
755 computer running @sc{cvs}.  For information on other
756 access methods, see @ref{Remote repositories}.
757
758 @c Can se say this more concisely?  Like by passing
759 @c more of the buck to the Remote repositories node?
760 If the access method is omitted, then if the repository
761 starts with @samp{/}, then @code{:local:} is
762 assumed.  If it does not start with @samp{/} then either
763 @code{:ext:} or @code{:server:} is assumed.  For
764 example, if you have a local repository in
765 @file{/usr/local/cvsroot}, you can use
766 @code{/usr/local/cvsroot} instead of
767 @code{:local:/usr/local/cvsroot}.  But if (under
768 Windows NT, for example) your local repository is
769 @file{c:\src\cvsroot}, then you must specify the access
770 method, as in @code{:local:c:/src/cvsroot}.
771
772 @c This might appear to go in Repository storage, but
773 @c actually it is describing something which is quite
774 @c user-visible, when you do a "cvs co CVSROOT".  This
775 @c isn't necessary the perfect place for that, though.
776 The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
777 administrative files for @sc{cvs}.  The other directories contain the actual
778 user-defined modules.
779
780 @menu
781 * Specifying a repository::     Telling CVS where your repository is
782 * Repository storage::          The structure of the repository
783 * Working directory storage::   The structure of working directories
784 * Intro administrative files::  Defining modules
785 * Multiple repositories::       Multiple repositories
786 * Creating a repository::       Creating a repository
787 * Backing up::                  Backing up a repository
788 * Moving a repository::         Moving a repository
789 * Remote repositories::         Accessing repositories on remote machines
790 * Read-only access::            Granting read-only access to the repository
791 * Server temporary directory::  The server creates temporary directories
792 @end menu
793
794 @node Specifying a repository
795 @section Telling CVS where your repository is
796
797 There are several ways to tell @sc{cvs}
798 where to find the repository.  You can name the
799 repository on the command line explicitly, with the
800 @code{-d} (for "directory") option:
801
802 @example
803 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
804 @end example
805
806 @cindex .profile, setting CVSROOT in
807 @cindex .cshrc, setting CVSROOT in
808 @cindex .tcshrc, setting CVSROOT in
809 @cindex .bashrc, setting CVSROOT in
810 @cindex CVSROOT, environment variable
811         Or you can set the @code{$CVSROOT} environment
812 variable to an absolute path to the root of the
813 repository, @file{/usr/local/cvsroot} in this example.
814 To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
815 users should have this line in their @file{.cshrc} or
816 @file{.tcshrc} files:
817
818 @example
819 setenv CVSROOT /usr/local/cvsroot
820 @end example
821
822 @noindent
823 @code{sh} and @code{bash} users should instead have these lines in their
824 @file{.profile} or @file{.bashrc}:
825
826 @example
827 CVSROOT=/usr/local/cvsroot
828 export CVSROOT
829 @end example
830
831 @cindex Root file, in CVS directory
832 @cindex CVS/Root file
833         A repository specified with @code{-d} will
834 override the @code{$CVSROOT} environment variable.
835 Once you've checked a working copy out from the
836 repository, it will remember where its repository is
837 (the information is recorded in the
838 @file{CVS/Root} file in the working copy).
839
840 The @code{-d} option and the @file{CVS/Root} file both
841 override the @code{$CVSROOT} environment variable.  If
842 @code{-d} option differs from @file{CVS/Root}, the
843 former is used.  Of course, for proper operation they
844 should be two ways of referring to the same repository.
845
846 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
847 @node Repository storage
848 @section How data is stored in the repository
849 @cindex Repository, how data is stored
850
851 For most purposes it isn't important @emph{how}
852 @sc{cvs} stores information in the repository.  In
853 fact, the format has changed in the past, and is likely
854 to change in the future.  Since in almost all cases one
855 accesses the repository via @sc{cvs} commands, such
856 changes need not be disruptive.
857
858 However, in some cases it may be necessary to
859 understand how @sc{cvs} stores data in the repository,
860 for example you might need to track down @sc{cvs} locks
861 (@pxref{Concurrency}) or you might need to deal with
862 the file permissions appropriate for the repository.
863
864 @menu
865 * Repository files::            What files are stored in the repository
866 * File permissions::            File permissions
867 * Windows permissions::         Issues specific to Windows
868 * Attic::                       Some files are stored in the Attic
869 * CVS in repository::           Additional information in CVS directory
870 * Locks::                       CVS locks control concurrent accesses
871 * CVSROOT storage::             A few things about CVSROOT are different
872 @end menu
873
874 @node Repository files
875 @subsection Where files are stored within the repository
876
877 @c @cindex Filenames, legal
878 @c @cindex Legal filenames
879 @c Somewhere we need to say something about legitimate
880 @c characters in filenames in working directory and
881 @c repository.  Not "/" (not even on non-unix).  And
882 @c here is a specific set of issues:
883 @c      Files starting with a - are handled inconsistently. They can not
884 @c   be added to a repository with an add command, because it they are
885 @c   interpreted as a switch. They can appear in a repository if they are
886 @c   part of a tree that is imported. They can not be removed from the tree
887 @c   once they are there.
888 @c Note that "--" *is* supported (as a
889 @c consequence of using GNU getopt).  Should document
890 @c this somewhere ("Common options"?).  The other usual technique,
891 @c "./-foo", isn't as effective, at least for "cvs add"
892 @c which doesn't support pathnames containing "/".
893
894 The overall structure of the repository is a directory
895 tree corresponding to the directories in the working
896 directory.  For example, supposing the repository is in
897
898 @example
899 /usr/local/cvsroot
900 @end example
901
902 @noindent
903 here is a possible directory tree (showing only the
904 directories):
905
906 @example
907 @t{/usr}
908  |
909  +--@t{local}
910  |   |
911  |   +--@t{cvsroot}
912  |   |    |
913  |   |    +--@t{CVSROOT}
914           |      (administrative files)
915           |
916           +--@t{gnu}
917           |   |
918           |   +--@t{diff}
919           |   |   (source code to @sc{gnu} diff)
920           |   |
921           |   +--@t{rcs}
922           |   |   (source code to @sc{rcs})
923           |   |
924           |   +--@t{cvs}
925           |       (source code to @sc{cvs})
926           |
927           +--@t{yoyodyne}
928               |
929               +--@t{tc}
930               |    |
931               |    +--@t{man}
932               |    |
933               |    +--@t{testing}
934               |
935               +--(other Yoyodyne software)
936 @end example
937
938 With the directories are @dfn{history files} for each file
939 under version control.  The name of the history file is
940 the name of the corresponding file with @samp{,v}
941 appended to the end.  Here is what the repository for
942 the @file{yoyodyne/tc} directory might look like:
943 @c FIXME: Should also mention CVS (CVSREP)
944 @c FIXME? Should we introduce Attic with an xref to
945 @c Attic?  Not sure whether that is a good idea or not.
946 @example
947   @code{$CVSROOT}
948     |
949     +--@t{yoyodyne}
950     |   |
951     |   +--@t{tc}
952     |   |   |
953             +--@t{Makefile,v}
954             +--@t{backend.c,v}
955             +--@t{driver.c,v}
956             +--@t{frontend.c,v}
957             +--@t{parser.c,v}
958             +--@t{man}
959             |    |
960             |    +--@t{tc.1,v}
961             |
962             +--@t{testing}
963                  |
964                  +--@t{testpgm.t,v}
965                  +--@t{test2.t,v}
966 @end example
967
968 @cindex History files
969 @cindex RCS history files
970 @c The first sentence, about what history files
971 @c contain, is kind of redundant with our intro to what the
972 @c repository does in node Repository....
973 The history files contain, among other things, enough
974 information to recreate any revision of the file, a log
975 of all commit messages and the user-name of the person
976 who committed the revision.  The history files are
977 known as @dfn{RCS files}, because the first program to
978 store files in that format was a version control system
979 known as @sc{rcs}.  For a full
980 description of the file format, see the @code{man} page
981 @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
982 file @file{doc/RCSFILES} in the @sc{cvs} source
983 distribution.  This
984 file format has become very common---many systems other
985 than @sc{cvs} or @sc{rcs} can at least import history
986 files in this format.
987 @c FIXME: Think about including documentation for this
988 @c rather than citing it?  In the long run, getting
989 @c this to be a standard (not sure if we can cope with
990 @c a standards process as formal as IEEE/ANSI/ISO/etc,
991 @c though...) is the way to go, so maybe citing is
992 @c better.
993
994 The @sc{rcs} files used in @sc{cvs} differ in a few
995 ways from the standard format.  The biggest difference
996 is magic branches; for more information see @ref{Magic
997 branch numbers}.  Also in @sc{cvs} the valid tag names
998 are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
999 rules see @ref{Tags}.
1000
1001 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1002 @node File permissions
1003 @subsection File permissions
1004 @c -- Move this to @node Creating a repository or similar
1005 @cindex Security, file permissions in repository
1006 @cindex File permissions, general
1007 @cindex Permissions, general
1008 @c FIXME: we need to somehow reflect "permissions in
1009 @c repository" versus "permissions in working
1010 @c directory" in the index entries.
1011 @cindex Group, UNIX file permissions, in repository
1012 @cindex Read-only files, in repository
1013 All @samp{,v} files are created read-only, and you
1014 should not change the permission of those files.  The
1015 directories inside the repository should be writable by
1016 the persons that have permission to modify the files in
1017 each directory.  This normally means that you must
1018 create a UNIX group (see group(5)) consisting of the
1019 persons that are to edit the files in a project, and
1020 set up the repository so that it is that group that
1021 owns the directory.
1022 (On some systems, you also need to set the set-group-ID-on-execution bit
1023 on the repository directories (see chmod(1)) so that newly-created files
1024 and directories get the group-ID of the parent directory rather than
1025 that of the current process.)
1026
1027 @c See also comment in commitinfo node regarding cases
1028 @c which are really awkward with unix groups.
1029
1030 This means that you can only control access to files on
1031 a per-directory basis.
1032
1033 Note that users must also have write access to check
1034 out files, because @sc{cvs} needs to create lock files
1035 (@pxref{Concurrency}).  You can use LockDir in CVSROOT/config
1036 to put the lock files somewhere other than in the repository
1037 if you want to allow read-only access to some directories
1038 (@pxref{config}).
1039
1040 @c CVS seems to use CVSUMASK in picking permissions for
1041 @c val-tags, but maybe we should say more about this.
1042 @c Like val-tags gets created by someone who doesn't
1043 @c have CVSUMASK set right?
1044 @cindex CVSROOT/val-tags file, and read-only access to projects
1045 @cindex val-tags file, and read-only access to projects
1046 Also note that users must have write access to the
1047 @file{CVSROOT/val-tags} file.  @sc{cvs} uses it to keep
1048 track of what tags are valid tag names (it is sometimes
1049 updated when tags are used, as well as when they are
1050 created).
1051
1052 Each @sc{rcs} file will be owned by the user who last
1053 checked it in.  This has little significance; what
1054 really matters is who owns the directories.
1055
1056 @cindex CVSUMASK, environment variable
1057 @cindex Umask, for repository files
1058 @sc{cvs} tries to set up reasonable file permissions
1059 for new directories that are added inside the tree, but
1060 you must fix the permissions manually when a new
1061 directory should have different permissions than its
1062 parent directory.  If you set the @code{CVSUMASK}
1063 environment variable that will control the file
1064 permissions which @sc{cvs} uses in creating directories
1065 and/or files in the repository.  @code{CVSUMASK} does
1066 not affect the file permissions in the working
1067 directory; such files have the permissions which are
1068 typical for newly created files, except that sometimes
1069 @sc{cvs} creates them read-only (see the sections on
1070 watches, @ref{Setting a watch}; -r, @ref{Global
1071 options}; or @code{CVSREAD}, @ref{Environment variables}).
1072 @c FIXME: Need more discussion of which
1073 @c group should own the file in the repository.
1074 @c Include a somewhat detailed example of the usual
1075 @c case where CVSUMASK is 007, the developers are all
1076 @c in a group, and that group owns stuff in the
1077 @c repository.  Need to talk about group ownership of
1078 @c newly-created directories/files (on some unices,
1079 @c such as SunOS4, setting the setgid bit on the
1080 @c directories will make files inherit the directory's
1081 @c group.  On other unices, your mileage may vary.  I
1082 @c can't remember what POSIX says about this, if
1083 @c anything).
1084
1085 Note that using the client/server @sc{cvs}
1086 (@pxref{Remote repositories}), there is no good way to
1087 set @code{CVSUMASK}; the setting on the client machine
1088 has no effect.  If you are connecting with @code{rsh}, you
1089 can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1090 described in the documentation for your operating
1091 system.  This behavior might change in future versions
1092 of @sc{cvs}; do not rely on the setting of
1093 @code{CVSUMASK} on the client having no effect.
1094 @c FIXME: need to explain what a umask is or cite
1095 @c someplace which does.
1096 @c
1097 @c There is also a larger (largely separate) issue
1098 @c about the meaning of CVSUMASK in a non-unix context.
1099 @c For example, whether there is
1100 @c an equivalent which fits better into other
1101 @c protection schemes like POSIX.6, VMS, &c.
1102 @c
1103 @c FIXME: Need one place which discusses this
1104 @c read-only files thing.  Why would one use -r or
1105 @c CVSREAD?  Why would one use watches?  How do they
1106 @c interact?
1107 @c
1108 @c FIXME: We need to state
1109 @c whether using CVSUMASK removes the need for manually
1110 @c fixing permissions (in fact, if we are going to mention
1111 @c manually fixing permission, we better document a lot
1112 @c better just what we mean by "fix").
1113
1114 Using pserver, you will generally need stricter
1115 permissions on the @sc{cvsroot} directory and
1116 directories above it in the tree; see @ref{Password
1117 authentication security}.
1118
1119 @cindex Setuid
1120 @cindex Setgid
1121 @cindex Security, setuid
1122 @cindex Installed images (VMS)
1123 Some operating systems have features which allow a
1124 particular program to run with the ability to perform
1125 operations which the caller of the program could not.
1126 For example, the set user ID (setuid) or set group ID
1127 (setgid) features of unix or the installed image
1128 feature of VMS.  @sc{cvs} was not written to use such
1129 features and therefore attempting to install @sc{cvs} in
1130 this fashion will provide protection against only
1131 accidental lapses; anyone who is trying to circumvent
1132 the measure will be able to do so, and depending on how
1133 you have set it up may gain access to more than just
1134 @sc{cvs}.  You may wish to instead consider pserver.  It
1135 shares some of the same attributes, in terms of
1136 possibly providing a false sense of security or opening
1137 security holes wider than the ones you are trying to
1138 fix, so read the documentation on pserver security
1139 carefully if you are considering this option
1140 (@ref{Password authentication security}).
1141
1142 @node Windows permissions
1143 @subsection File Permission issues specific to Windows
1144 @cindex Windows, and permissions
1145 @cindex File permissions, Windows-specific
1146 @cindex Permissions, Windows-specific
1147
1148 Some file permission issues are specific to Windows
1149 operating systems (Windows 95, Windows NT, and
1150 presumably future operating systems in this family.
1151 Some of the following might apply to OS/2 but I'm not
1152 sure).
1153
1154 If you are using local @sc{cvs} and the repository is on a
1155 networked file system which is served by the Samba SMB
1156 server, some people have reported problems with
1157 permissions.  Enabling WRITE=YES in the samba
1158 configuration is said to fix/workaround it.
1159 Disclaimer: I haven't investigated enough to know the
1160 implications of enabling that option, nor do I know
1161 whether there is something which @sc{cvs} could be doing
1162 differently in order to avoid the problem.  If you find
1163 something out, please let us know as described in
1164 @ref{BUGS}.
1165
1166 @node Attic
1167 @subsection The attic
1168 @cindex Attic
1169
1170 You will notice that sometimes @sc{cvs} stores an
1171 @sc{rcs} file in the @code{Attic}.  For example, if the
1172 @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1173 talking about the file @file{backend.c} in the
1174 directory @file{yoyodyne/tc}, then the file normally
1175 would be in
1176
1177 @example
1178 /usr/local/cvsroot/yoyodyne/tc/backend.c,v
1179 @end example
1180
1181 @noindent
1182 but if it goes in the attic, it would be in
1183
1184 @example
1185 /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1186 @end example
1187
1188 @noindent
1189 @cindex Dead state
1190 instead.  It should not matter from a user point of
1191 view whether a file is in the attic; @sc{cvs} keeps
1192 track of this and looks in the attic when it needs to.
1193 But in case you want to know, the rule is that the RCS
1194 file is stored in the attic if and only if the head
1195 revision on the trunk has state @code{dead}.  A
1196 @code{dead} state means that file has been removed, or
1197 never added, for that revision.  For example, if you
1198 add a file on a branch, it will have a trunk revision
1199 in @code{dead} state, and a branch revision in a
1200 non-@code{dead} state.
1201 @c Probably should have some more concrete examples
1202 @c here, or somewhere (not sure exactly how we should
1203 @c arrange the discussion of the dead state, versus
1204 @c discussion of the attic).
1205
1206 @node CVS in repository
1207 @subsection The CVS directory in the repository
1208 @cindex CVS directory, in repository
1209
1210 The @file{CVS} directory in each repository directory
1211 contains information such as file attributes (in a file
1212 called @file{CVS/fileattr}.  In the
1213 future additional files may be added to this directory,
1214 so implementations should silently ignore additional
1215 files.
1216
1217 This behavior is implemented only by @sc{cvs} 1.7 and
1218 later; for details see @ref{Watches Compatibility}.
1219
1220 The format of the @file{fileattr} file is a series of entries
1221 of the following form (where @samp{@{} and @samp{@}}
1222 means the text between the braces can be repeated zero
1223 or more times):
1224
1225 @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1226   @{; @var{attrname} = @var{attrval}@} <linefeed>
1227
1228 @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1229 attributes for that file.
1230
1231 @var{ent-type} is @samp{D},
1232 and @var{filename} empty, to specify default attributes
1233 to be used for newly added files.
1234
1235 Other @var{ent-type} are reserved for future expansion.  @sc{cvs} 1.9 and older
1236 will delete them any time it writes file attributes.
1237 @sc{cvs} 1.10 and later will preserve them.
1238
1239 Note that the order of the lines is not significant;
1240 a program writing the fileattr file may
1241 rearrange them at its convenience.
1242
1243 There is currently no way of quoting tabs or line feeds in the
1244 filename, @samp{=} in @var{attrname},
1245 @samp{;} in @var{attrval}, etc.  Note: some implementations also
1246 don't handle a NUL character in any of the fields, but
1247 implementations are encouraged to allow it.
1248
1249 By convention, @var{attrname} starting with @samp{_} is for an attribute given
1250 special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1251 (or will be, once implementations start supporting user-defined attributes).
1252
1253 Built-in attributes:
1254
1255 @table @code
1256 @item _watched
1257 Present means the file is watched and should be checked out
1258 read-only.
1259
1260 @item _watchers
1261 Users with watches for this file.  Value is
1262 @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1263 where @var{watcher} is a username, and @var{type}
1264 is zero or more of edit,unedit,commit separated by
1265 @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1266
1267 @item _editors
1268 Users editing this file.  Value is
1269 @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1270 where @var{editor} is a username, and @var{val} is
1271 @var{time}+@var{hostname}+@var{pathname}, where
1272 @var{time} is when the @code{cvs edit} command (or
1273 equivalent) happened,
1274 and @var{hostname} and @var{pathname} are for the working directory.
1275 @end table
1276
1277 Example:
1278
1279 @c FIXME: sanity.sh should contain a similar test case
1280 @c so we can compare this example from something from
1281 @c Real Life(TM).  See cvsclient.texi (under Notify) for more
1282 @c discussion of the date format of _editors.
1283 @example
1284 Ffile1 _watched=;_watchers=joe>edit,mary>commit
1285 Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1286 D _watched=
1287 @end example
1288
1289 @noindent
1290 means that the file @file{file1} should be checked out
1291 read-only.  Furthermore, joe is watching for edits and
1292 mary is watching for commits.  The file @file{file2}
1293 should be checked out read-only; sue started editing it
1294 on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1295 the machine @code{workstn1}.  Future files which are
1296 added should be checked out read-only.  To represent
1297 this example here, we have shown a space after
1298 @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1299 there must be a single tab character there and no spaces.
1300
1301 @node Locks
1302 @subsection CVS locks in the repository
1303
1304 @cindex #cvs.rfl, technical details
1305 @cindex #cvs.wfl, technical details
1306 @cindex #cvs.lock, technical details
1307 @cindex Locks, cvs, technical details
1308 For an introduction to @sc{cvs} locks focusing on
1309 user-visible behavior, see @ref{Concurrency}.  The
1310 following section is aimed at people who are writing
1311 tools which want to access a @sc{cvs} repository without
1312 interfering with other tools accessing the same
1313 repository.  If you find yourself confused by concepts
1314 described here, like @dfn{read lock}, @dfn{write lock},
1315 and @dfn{deadlock}, you might consult the literature on
1316 operating systems or databases.
1317
1318 @cindex #cvs.tfl
1319 Any file in the repository with a name starting
1320 with @file{#cvs.rfl.} is a read lock.  Any file in
1321 the repository with a name starting with
1322 @file{#cvs.wfl} is a write lock.  Old versions of @sc{cvs}
1323 (before @sc{cvs} 1.5) also created files with names starting
1324 with @file{#cvs.tfl}, but they are not discussed here.
1325 The directory @file{#cvs.lock} serves as a master
1326 lock.  That is, one must obtain this lock first before
1327 creating any of the other locks.
1328
1329 To obtain a read lock, first create the @file{#cvs.lock}
1330 directory.  This operation must be atomic (which should
1331 be true for creating a directory under most operating
1332 systems).  If it fails because the directory already
1333 existed, wait for a while and try again.  After
1334 obtaining the @file{#cvs.lock} lock, create a file
1335 whose name is @file{#cvs.rfl.} followed by information
1336 of your choice (for example, hostname and process
1337 identification number).  Then remove the
1338 @file{#cvs.lock} directory to release the master lock.
1339 Then proceed with reading the repository.  When you are
1340 done, remove the @file{#cvs.rfl} file to release the
1341 read lock.
1342
1343 To obtain a write lock, first create the
1344 @file{#cvs.lock} directory, as with read locks.  Then
1345 check that there are no files whose names start with
1346 @file{#cvs.rfl.}.  If there are, remove
1347 @file{#cvs.lock}, wait for a while, and try again.  If
1348 there are no readers, then create a file whose name is
1349 @file{#cvs.wfl} followed by information of your choice
1350 (for example, hostname and process identification
1351 number).  Hang on to the @file{#cvs.lock} lock.  Proceed
1352 with writing the repository.  When you are done, first
1353 remove the @file{#cvs.wfl} file and then the
1354 @file{#cvs.lock} directory. Note that unlike the
1355 @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1356 informational; it has no effect on the locking operation
1357 beyond what is provided by holding on to the
1358 @file{#cvs.lock} lock itself.
1359
1360 Note that each lock (write lock or read lock) only locks
1361 a single directory in the repository, including
1362 @file{Attic} and @file{CVS} but not including
1363 subdirectories which represent other directories under
1364 version control.  To lock an entire tree, you need to
1365 lock each directory (note that if you fail to obtain
1366 any lock you need, you must release the whole tree
1367 before waiting and trying again, to avoid deadlocks).
1368
1369 Note also that @sc{cvs} expects write locks to control
1370 access to individual @file{foo,v} files.  @sc{rcs} has
1371 a scheme where the @file{,foo,} file serves as a lock,
1372 but @sc{cvs} does not implement it and so taking out a
1373 @sc{cvs} write lock is recommended.  See the comments at
1374 rcs_internal_lockfile in the @sc{cvs} source code for
1375 further discussion/rationale.
1376
1377 @node CVSROOT storage
1378 @subsection How files are stored in the CVSROOT directory
1379 @cindex CVSROOT, storage of files
1380
1381 The @file{$CVSROOT/CVSROOT} directory contains the
1382 various administrative files.  In some ways this
1383 directory is just like any other directory in the
1384 repository; it contains @sc{rcs} files whose names end
1385 in @samp{,v}, and many of the @sc{cvs} commands operate
1386 on it the same way.  However, there are a few
1387 differences.
1388
1389 For each administrative file, in addition to the
1390 @sc{rcs} file, there is also a checked out copy of the
1391 file.  For example, there is an @sc{rcs} file
1392 @file{loginfo,v} and a file @file{loginfo} which
1393 contains the latest revision contained in
1394 @file{loginfo,v}.  When you check in an administrative
1395 file, @sc{cvs} should print
1396
1397 @example
1398 cvs commit: Rebuilding administrative file database
1399 @end example
1400
1401 @noindent
1402 and update the checked out copy in
1403 @file{$CVSROOT/CVSROOT}.  If it does not, there is
1404 something wrong (@pxref{BUGS}).  To add your own files
1405 to the files to be updated in this fashion, you can add
1406 them to the @file{checkoutlist} administrative file
1407 (@pxref{checkoutlist}).
1408
1409 @cindex modules.db
1410 @cindex modules.pag
1411 @cindex modules.dir
1412 By default, the @file{modules} file behaves as
1413 described above.  If the modules file is very large,
1414 storing it as a flat text file may make looking up
1415 modules slow (I'm not sure whether this is as much of a
1416 concern now as when @sc{cvs} first evolved this
1417 feature; I haven't seen benchmarks).  Therefore, by
1418 making appropriate edits to the @sc{cvs} source code
1419 one can store the modules file in a database which
1420 implements the @code{ndbm} interface, such as Berkeley
1421 db or GDBM.  If this option is in use, then the modules
1422 database will be stored in the files @file{modules.db},
1423 @file{modules.pag}, and/or @file{modules.dir}.
1424 @c I think fileattr also will use the database stuff.
1425 @c Anything else?
1426
1427 For information on the meaning of the various
1428 administrative files, see @ref{Administrative files}.
1429
1430 @node Working directory storage
1431 @section How data is stored in the working directory
1432
1433 @c FIXME: Somewhere we should discuss timestamps (test
1434 @c case "stamps" in sanity.sh).  But not here.  Maybe
1435 @c in some kind of "working directory" chapter which
1436 @c would encompass the "Builds" one?  But I'm not sure
1437 @c whether that is a good organization (is it based on
1438 @c what the user wants to do?).
1439
1440 @cindex CVS directory, in working directory
1441 While we are discussing @sc{cvs} internals which may
1442 become visible from time to time, we might as well talk
1443 about what @sc{cvs} puts in the @file{CVS} directories
1444 in the working directories.  As with the repository,
1445 @sc{cvs} handles this information and one can usually
1446 access it via @sc{cvs} commands.  But in some cases it
1447 may be useful to look at it, and other programs, such
1448 as the @code{jCVS} graphical user interface or the
1449 @code{VC} package for emacs, may need to look at it.
1450 Such programs should follow the recommendations in this
1451 section if they hope to be able to work with other
1452 programs which use those files, including future
1453 versions of the programs just mentioned and the
1454 command-line @sc{cvs} client.
1455
1456 The @file{CVS} directory contains several files.
1457 Programs which are reading this directory should
1458 silently ignore files which are in the directory but
1459 which are not documented here, to allow for future
1460 expansion.
1461
1462 The files are stored according to the text file
1463 convention for the system in question.  This means that
1464 working directories are not portable between systems
1465 with differing conventions for storing text files.
1466 This is intentional, on the theory that the files being
1467 managed by @sc{cvs} probably will not be portable between
1468 such systems either.
1469
1470 @table @file
1471 @item Root
1472 This file contains the current @sc{cvs} root, as
1473 described in @ref{Specifying a repository}.
1474
1475 @cindex Repository file, in CVS directory
1476 @cindex CVS/Repository file
1477 @item Repository
1478 This file contains the directory within the repository
1479 which the current directory corresponds with.  It can
1480 be either an absolute pathname or a relative pathname;
1481 @sc{cvs} has had the ability to read either format
1482 since at least version 1.3 or so.  The relative
1483 pathname is relative to the root, and is the more
1484 sensible approach, but the absolute pathname is quite
1485 common and implementations should accept either.  For
1486 example, after the command
1487
1488 @example
1489 cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1490 @end example
1491
1492 @noindent
1493 @file{Root} will contain
1494
1495 @example
1496 :local:/usr/local/cvsroot
1497 @end example
1498
1499 @noindent
1500 and @file{Repository} will contain either
1501
1502 @example
1503 /usr/local/cvsroot/yoyodyne/tc
1504 @end example
1505
1506 @noindent
1507 or
1508
1509 @example
1510 yoyodyne/tc
1511 @end example
1512
1513 If the particular working directory does not correspond
1514 to a directory in the repository, then @file{Repository}
1515 should contain @file{CVSROOT/Emptydir}.
1516 @cindex Emptydir, in CVSROOT directory
1517 @cindex CVSROOT/Emptydir directory
1518
1519 @cindex Entries file, in CVS directory
1520 @cindex CVS/Entries file
1521 @item Entries
1522 This file lists the files and directories in the
1523 working directory.
1524 The first character of each line indicates what sort of
1525 line it is.  If the character is unrecognized, programs
1526 reading the file should silently skip that line, to
1527 allow for future expansion.
1528
1529 If the first character is @samp{/}, then the format is:
1530
1531 @example
1532 /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1533 @end example
1534
1535 @noindent
1536 where @samp{[} and @samp{]} are not part of the entry,
1537 but instead indicate that the @samp{+} and conflict
1538 marker are optional.  @var{name} is the name of the
1539 file within the directory.  @var{revision} is the
1540 revision that the file in the working derives from, or
1541 @samp{0} for an added file, or @samp{-} followed by a
1542 revision for a removed file.  @var{timestamp} is the
1543 timestamp of the file at the time that @sc{cvs} created
1544 it; if the timestamp differs with the actual
1545 modification time of the file it means the file has
1546 been modified.  It is stored in
1547 the format used by the ISO C asctime() function (for
1548 example, @samp{Sun Apr  7 01:29:26 1996}).  One may
1549 write a string which is not in that format, for
1550 example, @samp{Result of merge}, to indicate that the
1551 file should always be considered to be modified.  This
1552 is not a special case; to see whether a file is
1553 modified a program should take the timestamp of the file
1554 and simply do a string compare with @var{timestamp}.
1555 If there was a conflict, @var{conflict} can be set to
1556 the modification time of the file after the file has been
1557 written with conflict markers (@pxref{Conflicts example}).
1558 Thus if @var{conflict} is subsequently the same as the actual
1559 modification time of the file it means that the user
1560 has obviously not resolved the conflict.  @var{options}
1561 contains sticky options (for example @samp{-kb} for a
1562 binary file).  @var{tagdate} contains @samp{T} followed
1563 by a tag name, or @samp{D} for a date, followed by a
1564 sticky tag or date.  Note that if @var{timestamp}
1565 contains a pair of timestamps separated by a space,
1566 rather than a single timestamp, you are dealing with a
1567 version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1568 documented here).
1569
1570 The timezone on the timestamp in CVS/Entries (local or
1571 universal) should be the same as the operating system
1572 stores for the timestamp of the file itself.  For
1573 example, on Unix the file's timestamp is in universal
1574 time (UT), so the timestamp in CVS/Entries should be
1575 too.  On @sc{vms}, the file's timestamp is in local
1576 time, so @sc{cvs} on @sc{vms} should use local time.
1577 This rule is so that files do not appear to be modified
1578 merely because the timezone changed (for example, to or
1579 from summer time).
1580 @c See comments and calls to gmtime() and friends in
1581 @c src/vers_ts.c (function time_stamp).
1582
1583 If the first character of a line in @file{Entries} is
1584 @samp{D}, then it indicates a subdirectory.  @samp{D}
1585 on a line all by itself indicates that the program
1586 which wrote the @file{Entries} file does record
1587 subdirectories (therefore, if there is such a line and
1588 no other lines beginning with @samp{D}, one knows there
1589 are no subdirectories).  Otherwise, the line looks
1590 like:
1591
1592 @example
1593 D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1594 @end example
1595
1596 @noindent
1597 where @var{name} is the name of the subdirectory, and
1598 all the @var{filler} fields should be silently ignored,
1599 for future expansion.  Programs which modify
1600 @code{Entries} files should preserve these fields.
1601
1602 The lines in the @file{Entries} file can be in any order.
1603
1604 @cindex Entries.Log file, in CVS directory
1605 @cindex CVS/Entries.Log file
1606 @item Entries.Log
1607 This file does not record any information beyond that
1608 in @file{Entries}, but it does provide a way to update
1609 the information without having to rewrite the entire
1610 @file{Entries} file, including the ability to preserve
1611 the information even if the program writing
1612 @file{Entries} and @file{Entries.Log} abruptly aborts.
1613 Programs which are reading the @file{Entries} file
1614 should also check for @file{Entries.Log}.  If the latter
1615 exists, they should read @file{Entries} and then apply
1616 the changes mentioned in @file{Entries.Log}.  After
1617 applying the changes, the recommended practice is to
1618 rewrite @file{Entries} and then delete @file{Entries.Log}.
1619 The format of a line in @file{Entries.Log} is a single
1620 character command followed by a space followed by a
1621 line in the format specified for a line in
1622 @file{Entries}.  The single character command is
1623 @samp{A} to indicate that the entry is being added,
1624 @samp{R} to indicate that the entry is being removed,
1625 or any other character to indicate that the entire line
1626 in @file{Entries.Log} should be silently ignored (for
1627 future expansion).  If the second character of the line
1628 in @file{Entries.Log} is not a space, then it was
1629 written by an older version of @sc{cvs} (not documented
1630 here).
1631
1632 Programs which are writing rather than reading can
1633 safely ignore @file{Entries.Log} if they so choose.
1634
1635 @cindex Entries.Backup file, in CVS directory
1636 @cindex CVS/Entries.Backup file
1637 @item Entries.Backup
1638 This is a temporary file.  Recommended usage is to
1639 write a new entries file to @file{Entries.Backup}, and
1640 then to rename it (atomically, where possible) to @file{Entries}.
1641
1642 @cindex Entries.Static file, in CVS directory
1643 @cindex CVS/Entries.Static file
1644 @item Entries.Static
1645 The only relevant thing about this file is whether it
1646 exists or not.  If it exists, then it means that only
1647 part of a directory was gotten and @sc{cvs} will
1648 not create additional files in that directory.  To
1649 clear it, use the @code{update} command with the
1650 @samp{-d} option, which will get the additional files
1651 and remove @file{Entries.Static}.
1652 @c FIXME: This needs to be better documented, in places
1653 @c other than Working Directory Storage.
1654 @c FIXCVS: The fact that this setting exists needs to
1655 @c be more visible to the user.  For example "cvs
1656 @c status foo", in the case where the file would be
1657 @c gotten except for Entries.Static, might say
1658 @c something to distinguish this from other cases.
1659 @c One thing that periodically gets suggested is to
1660 @c have "cvs update" print something when it skips
1661 @c files due to Entries.Static, but IMHO that kind of
1662 @c noise pretty much makes the Entries.Static feature
1663 @c useless.
1664
1665 @cindex Tag file, in CVS directory
1666 @cindex CVS/Tag file
1667 @cindex Sticky tags/dates, per-directory
1668 @cindex Per-directory sticky tags/dates
1669 @item Tag
1670 This file contains per-directory sticky tags or dates.
1671 The first character is @samp{T} for a branch tag,
1672 @samp{N} for a non-branch tag, or @samp{D} for a date,
1673 or another character to mean the file should be
1674 silently ignored, for future expansion.  This character
1675 is followed by the tag or date.  Note that
1676 per-directory sticky tags or dates are used for things
1677 like applying to files which are newly added; they
1678 might not be the same as the sticky tags or dates on
1679 individual files.  For general information on sticky
1680 tags and dates, see @ref{Sticky tags}.
1681 @c FIXME: This needs to be much better documented,
1682 @c preferably not in the context of "working directory
1683 @c storage".
1684 @c FIXME: The Sticky tags node needs to discuss, or xref to
1685 @c someplace which discusses, per-directory sticky
1686 @c tags and the distinction with per-file sticky tags.
1687
1688 @cindex Notify file, in CVS directory
1689 @cindex CVS/Notify file
1690 @item Notify
1691 This file stores notifications (for example, for
1692 @code{edit} or @code{unedit}) which have not yet been
1693 sent to the server.  Its format is not yet documented
1694 here.
1695
1696 @cindex Notify.tmp file, in CVS directory
1697 @cindex CVS/Notify.tmp file
1698 @item Notify.tmp
1699 This file is to @file{Notify} as @file{Entries.Backup}
1700 is to @file{Entries}.  That is, to write @file{Notify},
1701 first write the new contents to @file{Notify.tmp} and
1702 then (atomically where possible), rename it to
1703 @file{Notify}.
1704
1705 @cindex Base directory, in CVS directory
1706 @cindex CVS/Base directory
1707 @item Base
1708 If watches are in use, then an @code{edit} command
1709 stores the original copy of the file in the @file{Base}
1710 directory.  This allows the @code{unedit} command to
1711 operate even if it is unable to communicate with the
1712 server.
1713
1714 @cindex Baserev file, in CVS directory
1715 @cindex CVS/Baserev file
1716 @item Baserev
1717 The file lists the revision for each of the files in
1718 the @file{Base} directory.  The format is:
1719
1720 @example
1721 B@var{name}/@var{rev}/@var{expansion}
1722 @end example
1723
1724 @noindent
1725 where @var{expansion} should be ignored, to allow for
1726 future expansion.
1727
1728 @cindex Baserev.tmp file, in CVS directory
1729 @cindex CVS/Baserev.tmp file
1730 @item Baserev.tmp
1731 This file is to @file{Baserev} as @file{Entries.Backup}
1732 is to @file{Entries}.  That is, to write @file{Baserev},
1733 first write the new contents to @file{Baserev.tmp} and
1734 then (atomically where possible), rename it to
1735 @file{Baserev}.
1736
1737 @cindex Template file, in CVS directory
1738 @cindex CVS/Template file
1739 @item Template
1740 This file contains the template specified by the
1741 @file{rcsinfo} file (@pxref{rcsinfo}).  It is only used
1742 by the client; the non-client/server @sc{cvs} consults
1743 @file{rcsinfo} directly.
1744 @end table
1745
1746 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1747 @node Intro administrative files
1748 @section The administrative files
1749 @cindex Administrative files (intro)
1750 @cindex Modules file
1751 @cindex CVSROOT, module name
1752 @cindex Defining modules (intro)
1753
1754 @c FIXME: this node should be reorganized into "general
1755 @c information about admin files" and put the "editing
1756 @c admin files" stuff up front rather than jumping into
1757 @c the details of modules right away.  Then the
1758 @c Administrative files node can go away, the information
1759 @c on each admin file distributed to a place appropriate
1760 @c to its function, and this node can contain a table
1761 @c listing each file and a @ref to its detailed description.
1762
1763 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1764 files}.  @xref{Administrative files}, for a complete description.
1765 You can use @sc{cvs} without any of these files, but
1766 some commands work better when at least the
1767 @file{modules} file is properly set up.
1768
1769 The most important of these files is the @file{modules}
1770 file.  It defines all modules in the repository.  This
1771 is a sample @file{modules} file.
1772
1773 @c FIXME: The CVSROOT line is a goofy example now that
1774 @c mkmodules doesn't exist.
1775 @example
1776 CVSROOT         CVSROOT
1777 modules         CVSROOT modules
1778 cvs             gnu/cvs
1779 rcs             gnu/rcs
1780 diff            gnu/diff
1781 tc              yoyodyne/tc
1782 @end example
1783
1784 The @file{modules} file is line oriented.  In its
1785 simplest form each line contains the name of the
1786 module, whitespace, and the directory where the module
1787 resides.  The directory is a path relative to
1788 @code{$CVSROOT}.  The last four lines in the example
1789 above are examples of such lines.
1790
1791 @c FIXME: might want to introduce the concept of options in modules file
1792 @c (the old example which was here, -i mkmodules, is obsolete).
1793
1794 The line that defines the module called @samp{modules}
1795 uses features that are not explained here.
1796 @xref{modules}, for a full explanation of all the
1797 available features.
1798
1799 @c FIXME: subsection without node is bogus
1800 @subsection Editing administrative files
1801 @cindex Editing administrative files
1802 @cindex Administrative files, editing them
1803
1804 You edit the administrative files in the same way that you would edit
1805 any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1806 copy, edit it, and commit your changes in the normal way.
1807
1808 It is possible to commit an erroneous administrative
1809 file.  You can often fix the error and check in a new
1810 revision, but sometimes a particularly bad error in the
1811 administrative file makes it impossible to commit new
1812 revisions.  If and when this happens, you can correct
1813 the problem by temporarily copying a corrected administrative file
1814 directly into the @code{$CVSROOT/CVSROOT} repository directory,
1815 then committing the same correction via a checkout of the @file{CVSROOT}
1816 module.  It is important that the correction also be made via the
1817 checked out copy, or the next checkout and commit to the
1818 <code>CVSROOT</code> module will overwrite the correction that was
1819 copied directly into the repository, possibly breaking things in such
1820 a way as to prevent commits again.
1821 @c @xref{Bad administrative files} for a hint
1822 @c about how to solve such situations.
1823 @c -- administrative file checking--
1824
1825 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1826 @node Multiple repositories
1827 @section Multiple repositories
1828 @cindex Multiple repositories
1829 @cindex Repositories, multiple
1830 @cindex Many repositories
1831 @cindex Parallel repositories
1832 @cindex Disjoint repositories
1833 @cindex CVSROOT, multiple repositories
1834
1835 In some situations it is a good idea to have more than
1836 one repository, for instance if you have two
1837 development groups that work on separate projects
1838 without sharing any code.  All you have to do to have
1839 several repositories is to specify the appropriate
1840 repository, using the @code{CVSROOT} environment
1841 variable, the @samp{-d} option to @sc{cvs}, or (once
1842 you have checked out a working directory) by simply
1843 allowing @sc{cvs} to use the repository that was used
1844 to check out the working directory
1845 (@pxref{Specifying a repository}).
1846
1847 The big advantage of having multiple repositories is
1848 that they can reside on different servers.  With @sc{cvs}
1849 version 1.10, a single command cannot recurse into
1850 directories from different repositories.  With development
1851 versions of @sc{cvs}, you can check out code from multiple
1852 servers into your working directory.  @sc{cvs} will
1853 recurse and handle all the details of making
1854 connections to as many server machines as necessary to
1855 perform the requested command.  Here is an example of
1856 how to set up a working directory:
1857
1858 @example
1859 cvs -d server1:/cvs co dir1
1860 cd dir1
1861 cvs -d server2:/root co sdir
1862 cvs update
1863 @end example
1864
1865 The @code{cvs co} commands set up the working
1866 directory, and then the @code{cvs update} command will
1867 contact server2, to update the dir1/sdir subdirectory,
1868 and server1, to update everything else.
1869
1870 @c FIXME: Does the FAQ have more about this?  I have a
1871 @c dim recollection, but I'm too lazy to check right now.
1872
1873 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1874 @node Creating a repository
1875 @section Creating a repository
1876
1877 @cindex Repository, setting up
1878 @cindex Creating a repository
1879 @cindex Setting up a repository
1880
1881 This section describes how to set up a @sc{cvs} repository for any
1882 sort of access method.  After completing the setup described in this
1883 section, you should be able to access your @sc{cvs} repository immediately
1884 via the local access method and several remote access methods.  For
1885 more information on setting up remote access to the repository you create
1886 in this section, please read the section on @xref{Remote repositories}.
1887
1888 To set up a @sc{cvs} repository, first choose the
1889 machine and disk on which you want to store the
1890 revision history of the source files.  CPU and memory
1891 requirements are modest, so most machines should be
1892 adequate.  For details see @ref{Server requirements}.
1893 @c Possible that we should be providing a quick rule of
1894 @c thumb, like the 32M memory for the server.  That
1895 @c might increase the number of people who are happy
1896 @c with the answer, without following the xref.
1897
1898 To estimate disk space
1899 requirements, if you are importing RCS files from
1900 another system, the size of those files is the
1901 approximate initial size of your repository, or if you
1902 are starting without any version history, a rule of
1903 thumb is to allow for the server approximately three
1904 times the size of the code to be under @sc{cvs} for the
1905 repository (you will eventually outgrow this, but not
1906 for a while).  On the machines on which the developers
1907 will be working, you'll want disk space for
1908 approximately one working directory for each developer
1909 (either the entire tree or a portion of it, depending
1910 on what each developer uses).
1911
1912 The repository should be accessible
1913 (directly or via a networked file system) from all
1914 machines which want to use @sc{cvs} in server or local
1915 mode; the client machines need not have any access to
1916 it other than via the @sc{cvs} protocol.  It is not
1917 possible to use @sc{cvs} to read from a repository
1918 which one only has read access to; @sc{cvs} needs to be
1919 able to create lock files (@pxref{Concurrency}).
1920
1921 @cindex init (subcommand)
1922 To create a repository, run the @code{cvs init}
1923 command.  It will set up an empty repository in the
1924 @sc{cvs} root specified in the usual way
1925 (@pxref{Repository}).  For example,
1926
1927 @example
1928 cvs -d /usr/local/cvsroot init
1929 @end example
1930
1931 @code{cvs init} is careful to never overwrite any
1932 existing files in the repository, so no harm is done if
1933 you run @code{cvs init} on an already set-up
1934 repository.
1935
1936 @code{cvs init} will enable history logging; if you
1937 don't want that, remove the history file after running
1938 @code{cvs init}.  @xref{history file}.
1939
1940 @node Backing up
1941 @section Backing up a repository
1942 @cindex Repository, backing up
1943 @cindex Backing up, repository
1944
1945 There is nothing particularly magical about the files
1946 in the repository; for the most part it is possible to
1947 back them up just like any other files.  However, there
1948 are a few issues to consider.
1949
1950 @cindex Locks, cvs, and backups
1951 @cindex #cvs.rfl, and backups
1952 The first is that to be paranoid, one should either not
1953 use @sc{cvs} during the backup, or have the backup
1954 program lock @sc{cvs} while doing the backup.  To not
1955 use @sc{cvs}, you might forbid logins to machines which
1956 can access the repository, turn off your @sc{cvs}
1957 server, or similar mechanisms.  The details would
1958 depend on your operating system and how you have
1959 @sc{cvs} set up.  To lock @sc{cvs}, you would create
1960 @file{#cvs.rfl} locks in each repository directory.
1961 See @ref{Concurrency}, for more on @sc{cvs} locks.
1962 Having said all this, if you just back up without any
1963 of these precautions, the results are unlikely to be
1964 particularly dire.  Restoring from backup, the
1965 repository might be in an inconsistent state, but this
1966 would not be particularly hard to fix manually.
1967
1968 When you restore a repository from backup, assuming
1969 that changes in the repository were made after the time
1970 of the backup, working directories which were not
1971 affected by the failure may refer to revisions which no
1972 longer exist in the repository.  Trying to run @sc{cvs}
1973 in such directories will typically produce an error
1974 message.  One way to get those changes back into the
1975 repository is as follows:
1976
1977 @itemize @bullet
1978 @item
1979 Get a new working directory.
1980
1981 @item
1982 Copy the files from the working directory from before
1983 the failure over to the new working directory (do not
1984 copy the contents of the @file{CVS} directories, of
1985 course).
1986
1987 @item
1988 Working in the new working directory, use commands such
1989 as @code{cvs update} and @code{cvs diff} to figure out
1990 what has changed, and then when you are ready, commit
1991 the changes into the repository.
1992 @end itemize
1993
1994 @node Moving a repository
1995 @section Moving a repository
1996 @cindex Repository, moving
1997 @cindex Moving a repository
1998 @cindex Copying a repository
1999
2000 Just as backing up the files in the repository is
2001 pretty much like backing up any other files, if you
2002 need to move a repository from one place to another it
2003 is also pretty much like just moving any other
2004 collection of files.
2005
2006 The main thing to consider is that working directories
2007 point to the repository.  The simplest way to deal with
2008 a moved repository is to just get a fresh working
2009 directory after the move.  Of course, you'll want to
2010 make sure that the old working directory had been
2011 checked in before the move, or you figured out some
2012 other way to make sure that you don't lose any
2013 changes.  If you really do want to reuse the existing
2014 working directory, it should be possible with manual
2015 surgery on the @file{CVS/Repository} files.  You can
2016 see @ref{Working directory storage}, for information on
2017 the @file{CVS/Repository} and @file{CVS/Root} files, but
2018 unless you are sure you want to bother, it probably
2019 isn't worth it.
2020 @c FIXME: Surgery on CVS/Repository should be avoided
2021 @c by making RELATIVE_REPOS the default.
2022 @c FIXME-maybe: might want some documented way to
2023 @c change the CVS/Root files in some particular tree.
2024 @c But then again, I don't know, maybe just having
2025 @c people do this in perl/shell/&c isn't so bad...
2026
2027 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2028 @node Remote repositories
2029 @section Remote repositories
2030 @cindex Repositories, remote
2031 @cindex Remote repositories
2032 @cindex Client/Server Operation
2033 @cindex Server, CVS
2034 @cindex Remote repositories, port specification
2035 @cindex Repositories, remote, port specification
2036 @cindex Client/Server Operation, port specification
2037 @cindex pserver (client/server connection method), port specification
2038 @cindex kserver (client/server connection method), port specification
2039 @cindex gserver (client/server connection method), port specification
2040 @cindex port, specifying for remote repositories
2041
2042         Your working copy of the sources can be on a
2043 different machine than the repository.  Using @sc{cvs}
2044 in this manner is known as @dfn{client/server}
2045 operation.  You run @sc{cvs} on a machine which can
2046 mount your working directory, known as the
2047 @dfn{client}, and tell it to communicate to a machine
2048 which can mount the repository, known as the
2049 @dfn{server}.  Generally, using a remote
2050 repository is just like using a local one, except that
2051 the format of the repository name is:
2052
2053 @example
2054 [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2055 @end example
2056
2057 Specifying a password in the repository name is not recommended during
2058 checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2059 password in each created directory.  @code{cvs login} first instead
2060 (@pxref{Password authentication client}).
2061
2062 The details of exactly what needs to be set up depend
2063 on how you are connecting to the server.
2064
2065 If @var{method} is not specified, and the repository
2066 name contains @samp{:}, then the default is @code{ext}
2067 or @code{server}, depending on your platform; both are
2068 described in @ref{Connecting via rsh}.
2069 @c Should we try to explain which platforms are which?
2070 @c Platforms like unix and VMS, which only allow
2071 @c privileged programs to bind to sockets <1024 lose on
2072 @c :server:
2073 @c Platforms like Mac and VMS, whose rsh program is
2074 @c unusable or nonexistent, lose on :ext:
2075 @c Platforms like OS/2 and NT probably could plausibly
2076 @c default either way (modulo -b troubles).
2077
2078 @c FIXME: We need to have a better way of explaining
2079 @c what method to use.  This presentation totally
2080 @c obscures the fact that :ext: and CVS_RSH is the way to
2081 @c use SSH, for example.  Plus it incorrectly implies
2082 @c that you need an @code{rsh} binary on the client to use
2083 @c :server:.
2084 @c Also note that rsh not pserver is the right choice if you want
2085 @c users to be able to create their own repositories
2086 @c (because of the --allow-root related issues).
2087 @menu
2088 * Server requirements::         Memory and other resources for servers
2089 * Connecting via rsh::          Using the @code{rsh} program to connect
2090 * Password authenticated::      Direct connections using passwords
2091 * GSSAPI authenticated::        Direct connections using GSSAPI
2092 * Kerberos authenticated::      Direct connections with Kerberos
2093 * Connecting via fork::         Using a forked @code{cvs server} to connect
2094 @end menu
2095
2096 @node Server requirements
2097 @subsection Server requirements
2098
2099 The quick answer to what sort of machine is suitable as
2100 a server is that requirements are modest---a server
2101 with 32M of memory or even less can handle a fairly
2102 large source tree with a fair amount of activity.
2103 @c Say something about CPU speed too?  I'm even less sure
2104 @c what to say on that subject...
2105
2106 The real answer, of course, is more complicated.
2107 Estimating the known areas of large memory consumption
2108 should be sufficient to estimate memory requirements.
2109 There are two such areas documented here; other memory
2110 consumption should be small by comparison (if you find
2111 that is not the case, let us know, as described in
2112 @ref{BUGS}, so we can update this documentation).
2113
2114 The first area of big memory consumption is large
2115 checkouts, when using the @sc{cvs} server.  The server
2116 consists of two processes for each client that it is
2117 serving.  Memory consumption on the child process
2118 should remain fairly small.  Memory consumption on the
2119 parent process, particularly if the network connection
2120 to the client is slow, can be expected to grow to
2121 slightly more than the size of the sources in a single
2122 directory, or two megabytes, whichever is larger.
2123 @c "two megabytes" of course is SERVER_HI_WATER.  But
2124 @c we don't mention that here because we are
2125 @c documenting the default configuration of CVS.  If it
2126 @c is a "standard" thing to change that value, it
2127 @c should be some kind of run-time configuration.
2128 @c
2129 @c See cvsclient.texi for more on the design decision
2130 @c to not have locks in place while waiting for the
2131 @c client, which is what results in memory consumption
2132 @c as high as this.
2133
2134 Multiplying the size of each @sc{cvs} server by the
2135 number of servers which you expect to have active at
2136 one time should give an idea of memory requirements for
2137 the server.  For the most part, the memory consumed by
2138 the parent process probably can be swap space rather
2139 than physical memory.
2140 @c Has anyone verified that notion about swap space?
2141 @c I say it based pretty much on guessing that the
2142 @c ->text of the struct buffer_data only gets accessed
2143 @c in a first in, first out fashion, but I haven't
2144 @c looked very closely.
2145
2146 @c What about disk usage in /tmp on the server?  I think that
2147 @c it can be substantial, but I haven't looked at this
2148 @c again and tried to figure it out ("cvs import" is
2149 @c probably the worst case...).
2150
2151 The second area of large memory consumption is
2152 @code{diff}, when checking in large files.  This is
2153 required even for binary files.  The rule of thumb is
2154 to allow about ten times the size of the largest file
2155 you will want to check in, although five times may be
2156 adequate.  For example, if you want to check in a file
2157 which is 10 megabytes, you should have 100 megabytes of
2158 memory on the machine doing the checkin (the server
2159 machine for client/server, or the machine running
2160 @sc{cvs} for non-client/server).  This can be swap
2161 space rather than physical memory.  Because the memory
2162 is only required briefly, there is no particular need
2163 to allow memory for more than one such checkin at a
2164 time.
2165 @c The 5-10 times rule of thumb is from Paul Eggert for
2166 @c GNU diff.  I don't think it is in the GNU diff
2167 @c manual or anyplace like that.
2168 @c
2169 @c Probably we could be saying more about
2170 @c non-client/server CVS.
2171 @c I would guess for non-client/server CVS in an NFS
2172 @c environment the biggest issues are the network and
2173 @c the NFS server.
2174
2175 Resource consumption for the client is even more
2176 modest---any machine with enough capacity to run the
2177 operating system in question should have little
2178 trouble.
2179 @c Is that true?  I think the client still wants to
2180 @c (bogusly) store entire files in memory at times.
2181
2182 For information on disk space requirements, see
2183 @ref{Creating a repository}.
2184
2185 @node Connecting via rsh
2186 @subsection Connecting with rsh
2187
2188 @cindex rsh
2189 @sc{cvs} uses the @samp{rsh} protocol to perform these
2190 operations, so the remote user host needs to have a
2191 @file{.rhosts} file which grants access to the local
2192 user.
2193
2194 For example, suppose you are the user @samp{mozart} on
2195 the local machine @samp{toe.example.com}, and the
2196 server machine is @samp{faun.example.org}.  On
2197 faun, put the following line into the file
2198 @file{.rhosts} in @samp{bach}'s home directory:
2199
2200 @example
2201 toe.example.com  mozart
2202 @end example
2203
2204 @noindent
2205 Then test that @samp{rsh} is working with
2206
2207 @example
2208 rsh -l bach faun.example.org 'echo $PATH'
2209 @end example
2210
2211 @cindex CVS_SERVER, environment variable
2212 Next you have to make sure that @code{rsh} will be able
2213 to find the server.  Make sure that the path which
2214 @code{rsh} printed in the above example includes the
2215 directory containing a program named @code{cvs} which
2216 is the server.  You need to set the path in
2217 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2218 or @file{.profile}.  Alternately, you can set the
2219 environment variable @code{CVS_SERVER} on the client
2220 machine to the filename of the server you want to use,
2221 for example @file{/usr/local/bin/cvs-1.6}.
2222 @c FIXME: there should be a way to specify the
2223 @c program in CVSROOT, not CVS_SERVER, so that one can use
2224 @c different ones for different roots.  e.g. ":server;cvs=cvs-1.6:"
2225 @c instead of ":server:".
2226
2227 There is no need to edit @file{inetd.conf} or start a
2228 @sc{cvs} server daemon.
2229
2230 @cindex :server:, setting up
2231 @cindex :ext:, setting up
2232 @cindex Kerberos, using kerberized rsh
2233 @cindex SSH (rsh replacement)
2234 @cindex rsh replacements (Kerberized, SSH, &c)
2235 There are two access methods that you use in @code{CVSROOT}
2236 for rsh.  @code{:server:} specifies an internal rsh
2237 client, which is supported only by some @sc{cvs} ports.
2238 @code{:ext:} specifies an external rsh program.  By
2239 default this is @code{rsh} but you may set the
2240 @code{CVS_RSH} environment variable to invoke another
2241 program which can access the remote server (for
2242 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2243 something different).  It must be a program which can
2244 transmit data to and from the server without modifying
2245 it; for example the Windows NT @code{rsh} is not
2246 suitable since it by default translates between CRLF
2247 and LF.  The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2248 to @code{rsh} to get around this, but since this could
2249 potentially cause problems for programs other than the
2250 standard @code{rsh}, it may change in the future.  If
2251 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2252 replacement, the instructions in the rest of this
2253 section concerning @file{.rhosts} and so on are likely
2254 to be inapplicable; consult the documentation for your rsh
2255 replacement.
2256 @c FIXME: there should be a way to specify the
2257 @c program in CVSROOT, not CVS_RSH, so that one can use
2258 @c different ones for different roots.  e.g. ":ext;rsh=remsh:"
2259 @c instead of ":ext:".
2260 @c See also the comment in src/client.c for rationale
2261 @c concerning "rsh" being the default and never
2262 @c "remsh".
2263
2264 Continuing our example, supposing you want to access
2265 the module @file{foo} in the repository
2266 @file{/usr/local/cvsroot/}, on machine
2267 @file{faun.example.org}, you are ready to go:
2268
2269 @example
2270 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2271 @end example
2272
2273 @noindent
2274 (The @file{bach@@} can be omitted if the username is
2275 the same on both the local and remote hosts.)
2276
2277 @c Should we mention "rsh host echo hi" and "rsh host
2278 @c cat" (the latter followed by typing text and ^D)
2279 @c as troubleshooting techniques?  Probably yes
2280 @c (people tend to have trouble setting this up),
2281 @c but this kind of thing can be hard to spell out.
2282
2283 @node Password authenticated
2284 @subsection Direct connection with password authentication
2285
2286 The @sc{cvs} client can also connect to the server
2287 using a password protocol.  This is particularly useful
2288 if using @code{rsh} is not feasible (for example,
2289 the server is behind a firewall), and Kerberos also is
2290 not available.
2291
2292         To use this method, it is necessary to make
2293 some adjustments on both the server and client sides.
2294
2295 @menu
2296 * Password authentication server::     Setting up the server
2297 * Password authentication client::     Using the client
2298 * Password authentication security::   What this method does and does not do
2299 @end menu
2300
2301 @node Password authentication server
2302 @subsubsection Setting up the server for password authentication
2303
2304 First of all, you probably want to tighten the
2305 permissions on the @file{$CVSROOT} and
2306 @file{$CVSROOT/CVSROOT} directories.  See @ref{Password
2307 authentication security}, for more details.
2308
2309 @cindex pserver (subcommand)
2310 @cindex Remote repositories, port specification
2311 @cindex Repositories, remote, port specification
2312 @cindex Client/Server Operation, port specification
2313 @cindex pserver (client/server connection method), port specification
2314 @cindex kserver (client/server connection method), port specification
2315 @cindex gserver (client/server connection method), port specification
2316 @cindex port, specifying for remote repositories
2317 @cindex Password server, setting up
2318 @cindex Authenticating server, setting up
2319 @cindex inetd, configuring for pserver
2320 @cindex xinetd, configuring for pserver
2321 @c FIXME: this isn't quite right regarding port
2322 @c numbers; CVS looks up "cvspserver" in
2323 @c /etc/services (on unix, but what about non-unix?).
2324 On the server side, the file @file{/etc/inetd.conf}
2325 needs to be edited so @code{inetd} knows to run the
2326 command @code{cvs pserver} when it receives a
2327 connection on the right port.  By default, the port
2328 number is 2401; it would be different if your client
2329 were compiled with @code{CVS_AUTH_PORT} defined to
2330 something else, though.  This can also be specified in the CVSROOT variable
2331 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2332 environment variable (@pxref{Environment variables}).
2333
2334         If your @code{inetd} allows raw port numbers in
2335 @file{/etc/inetd.conf}, then the following (all on a
2336 single line in @file{inetd.conf}) should be sufficient:
2337
2338 @example
2339 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
2340 cvs -f --allow-root=/usr/cvsroot pserver
2341 @end example
2342
2343 @noindent
2344 (You could also use the
2345 @samp{-T} option to specify a temporary directory.)
2346
2347 The @samp{--allow-root} option specifies the allowable
2348 @sc{cvsroot} directory.  Clients which attempt to use a
2349 different @sc{cvsroot} directory will not be allowed to
2350 connect.  If there is more than one @sc{cvsroot}
2351 directory which you want to allow, repeat the option.
2352 (Unfortunately, many versions of @code{inetd} have very small
2353 limits on the number of arguments and/or the total length
2354 of the command.  The usual solution to this problem is
2355 to have @code{inetd} run a shell script which then invokes
2356 @sc{cvs} with the necessary arguments.)
2357
2358         If your @code{inetd} wants a symbolic service
2359 name instead of a raw port number, then put this in
2360 @file{/etc/services}:
2361
2362 @example
2363 cvspserver      2401/tcp
2364 @end example
2365
2366 @noindent
2367 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2368
2369 If your system uses @code{xinetd} instead of @code{inetd},
2370 the procedure is slightly different.
2371 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2372
2373 @example
2374 service cvspserver
2375 @{
2376    port        = 2401
2377    socket_type = stream
2378    protocol    = tcp
2379    wait        = no
2380    user        = root
2381    passenv     = PATH
2382    server      = /usr/local/bin/cvs
2383    server_args = -f --allow-root=/usr/cvsroot pserver
2384 @}
2385 @end example
2386
2387 @noindent
2388 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2389 the @code{port} line.)
2390
2391         Once the above is taken care of, restart your
2392 @code{inetd}, or do whatever is necessary to force it
2393 to reread its initialization files.
2394
2395 If you are having trouble setting this up, see
2396 @ref{Connection}.
2397
2398 @cindex CVS passwd file
2399 @cindex passwd (admin file)
2400 Because the client stores and transmits passwords in
2401 cleartext (almost---see @ref{Password authentication
2402 security}, for details), a separate @sc{cvs} password
2403 file is generally used, so people don't compromise
2404 their regular passwords when they access the
2405 repository.  This file is
2406 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2407 administrative files}).  It uses a colon-separated
2408 format, similar to @file{/etc/passwd} on Unix systems,
2409 except that it has fewer fields: @sc{cvs} username,
2410 optional password, and an optional system username for
2411 @sc{cvs} to run as if authentication succeeds.  Here is
2412 an example @file{passwd} file with five entries:
2413
2414 @example
2415 anonymous:
2416 bach:ULtgRLXo7NRxs
2417 spwang:1sOp854gDF3DY
2418 melissa:tGX1fS8sun6rY:pubcvs
2419 qproj:XR4EZcEs0szik:pubcvs
2420 @end example
2421
2422 @noindent
2423 (The passwords are encrypted according to the standard
2424 Unix @code{crypt()} function, so it is possible to
2425 paste in passwords directly from regular Unix
2426 @file{/etc/passwd} files.)
2427
2428 The first line in the example will grant access to any
2429 @sc{cvs} client attempting to authenticate as user
2430 @code{anonymous}, no matter what password they use,
2431 including an empty password.  (This is typical for
2432 sites granting anonymous read-only access; for
2433 information on how to do the "read-only" part, see
2434 @ref{Read-only access}.)
2435
2436 The second and third lines will grant access to
2437 @code{bach} and @code{spwang} if they supply their
2438 respective plaintext passwords.
2439
2440 @cindex User aliases
2441 The fourth line will grant access to @code{melissa}, if
2442 she supplies the correct password, but her @sc{cvs}
2443 operations will actually run on the server side under
2444 the system user @code{pubcvs}.  Thus, there need not be
2445 any system user named @code{melissa}, but there
2446 @emph{must} be one named @code{pubcvs}.
2447
2448 The fifth line shows that system user identities can be
2449 shared: any client who successfully authenticates as
2450 @code{qproj} will actually run as @code{pubcvs}, just
2451 as @code{melissa} does.  That way you could create a
2452 single, shared system user for each project in your
2453 repository, and give each developer their own line in
2454 the @file{$CVSROOT/CVSROOT/passwd} file.  The @sc{cvs}
2455 username on each line would be different, but the
2456 system username would be the same.  The reason to have
2457 different @sc{cvs} usernames is that @sc{cvs} will log their
2458 actions under those names: when @code{melissa} commits
2459 a change to a project, the checkin is recorded in the
2460 project's history under the name @code{melissa}, not
2461 @code{pubcvs}.  And the reason to have them share a
2462 system username is so that you can arrange permissions
2463 in the relevant area of the repository such that only
2464 that account has write-permission there.
2465
2466 If the system-user field is present, all
2467 password-authenticated @sc{cvs} commands run as that
2468 user; if no system user is specified, @sc{cvs} simply
2469 takes the @sc{cvs} username as the system username and
2470 runs commands as that user.  In either case, if there
2471 is no such user on the system, then the @sc{cvs}
2472 operation will fail (regardless of whether the client
2473 supplied a valid password).
2474
2475 The password and system-user fields can both be omitted
2476 (and if the system-user field is omitted, then also
2477 omit the colon that would have separated it from the
2478 encrypted password).  For example, this would be a
2479 valid @file{$CVSROOT/CVSROOT/passwd} file:
2480
2481 @example
2482 anonymous::pubcvs
2483 fish:rKa5jzULzmhOo:kfogel
2484 sussman:1sOp854gDF3DY
2485 @end example
2486
2487 @noindent
2488 When the password field is omitted or empty, then the
2489 client's authentication attempt will succeed with any
2490 password, including the empty string.  However, the
2491 colon after the @sc{cvs} username is always necessary,
2492 even if the password is empty.
2493
2494 @sc{cvs} can also fall back to use system authentication.
2495 When authenticating a password, the server first checks
2496 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2497 file.  If it finds the user, it will use that entry for
2498 authentication as described above.  But if it does not
2499 find the user, or if the @sc{cvs} @file{passwd} file
2500 does not exist, then the server can try to authenticate
2501 the username and password using the operating system's
2502 user-lookup routines (this "fallback" behavior can be
2503 disabled by setting @code{SystemAuth=no} in the
2504 @sc{cvs} @file{config} file, @pxref{config}).  Be
2505 aware, however, that falling back to system
2506 authentication might be a security risk: @sc{cvs}
2507 operations would then be authenticated with that user's
2508 regular login password, and the password flies across
2509 the network in plaintext.  See @ref{Password
2510 authentication security} for more on this.
2511
2512 Right now, the only way to put a password in the
2513 @sc{cvs} @file{passwd} file is to paste it there from
2514 somewhere else.  Someday, there may be a @code{cvs
2515 passwd} command.
2516
2517 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2518 is normal to edit the @file{passwd} file in-place,
2519 rather than via @sc{cvs}.  This is because of the
2520 possible security risks of having the @file{passwd}
2521 file checked out to people's working copies.  If you do
2522 want to include the @file{passwd} file in checkouts of
2523 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2524
2525 @c We might also suggest using the @code{htpasswd} command
2526 @c from freely available web servers as well, but that
2527 @c would open up a can of worms in that the users next
2528 @c questions are likely to be "where do I get it?" and
2529 @c "how do I use it?"
2530 @c Also note that htpasswd, at least the version I had,
2531 @c likes to clobber the third field.
2532
2533 @node Password authentication client
2534 @subsubsection Using the client with password authentication
2535 @cindex Login (subcommand)
2536 @cindex Password client, using
2537 @cindex Authenticated client, using
2538 @cindex :pserver:, setting up
2539 To run a @sc{cvs} command on a remote repository via
2540 the password-authenticating server, one specifies the
2541 @code{pserver} protocol, optional username, repository host, an
2542 optional port number, and path to the repository.  For example:
2543
2544 @example
2545 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2546 @end example
2547
2548 @noindent
2549 or
2550
2551 @example
2552 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2553 cvs checkout someproj
2554 @end example
2555
2556 However, unless you're connecting to a public-access
2557 repository (i.e., one where that username doesn't
2558 require a password), you'll need to supply a password or @dfn{log in} first.
2559 Logging in verifies your password with the repository and stores it in a file.
2560 It's done with the @code{login} command, which will
2561 prompt you interactively for the password if you didn't supply one as part of
2562 @var{$CVSROOT}:
2563
2564 @example
2565 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2566 CVS password:
2567 @end example
2568
2569 @noindent
2570 or
2571
2572 @example
2573 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2574 @end example
2575
2576 After you enter the password, @sc{cvs} verifies it with
2577 the server.  If the verification succeeds, then that
2578 combination of username, host, repository, and password
2579 is permanently recorded, so future transactions with
2580 that repository won't require you to run @code{cvs
2581 login}.  (If verification fails, @sc{cvs} will exit
2582 complaining that the password was incorrect, and
2583 nothing will be recorded.)
2584
2585 The records are stored, by default, in the file
2586 @file{$HOME/.cvspass}.  That file's format is
2587 human-readable, and to a degree human-editable, but
2588 note that the passwords are not stored in
2589 cleartext---they are trivially encoded to protect them
2590 from "innocent" compromise (i.e., inadvertent viewing
2591 by a system administrator or other non-malicious
2592 person).
2593
2594 @cindex CVS_PASSFILE, environment variable
2595 You can change the default location of this file by
2596 setting the @code{CVS_PASSFILE} environment variable.
2597 If you use this variable, make sure you set it
2598 @emph{before} @code{cvs login} is run.  If you were to
2599 set it after running @code{cvs login}, then later
2600 @sc{cvs} commands would be unable to look up the
2601 password for transmission to the server.
2602   
2603 Once you have logged in, all @sc{cvs} commands using
2604 that remote repository and username will authenticate
2605 with the stored password.  So, for example
2606   
2607 @example
2608 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2609 @end example
2610
2611 @noindent
2612 should just work (unless the password changes on the
2613 server side, in which case you'll have to re-run
2614 @code{cvs login}).
2615
2616 Note that if the @samp{:pserver:} were not present in
2617 the repository specification, @sc{cvs} would assume it
2618 should use @code{rsh} to connect with the server
2619 instead (@pxref{Connecting via rsh}).
2620
2621 Of course, once you have a working copy checked out and
2622 are running @sc{cvs} commands from within it, there is
2623 no longer any need to specify the repository
2624 explicitly, because @sc{cvs} can deduce the repository
2625 from the working copy's @file{CVS} subdirectory.
2626
2627 @c FIXME: seems to me this needs somewhat more
2628 @c explanation.
2629 @cindex Logout (subcommand)
2630 The password for a given remote repository can be
2631 removed from the @code{CVS_PASSFILE} by using the
2632 @code{cvs logout} command.
2633
2634 @node Password authentication security
2635 @subsubsection Security considerations with password authentication
2636
2637 @cindex Security, of pserver
2638 The passwords are stored on the client side in a
2639 trivial encoding of the cleartext, and transmitted in
2640 the same encoding.  The encoding is done only to
2641 prevent inadvertent password compromises (i.e., a
2642 system administrator accidentally looking at the file),
2643 and will not prevent even a naive attacker from gaining
2644 the password.
2645
2646 @c FIXME: The bit about "access to the repository
2647 @c implies general access to the system is *not* specific
2648 @c to pserver; it applies to kerberos and SSH and
2649 @c everything else too.  Should reorganize the
2650 @c documentation to make this clear.
2651 The separate @sc{cvs} password file (@pxref{Password
2652 authentication server}) allows people
2653 to use a different password for repository access than
2654 for login access.  On the other hand, once a user has
2655 non-read-only
2656 access to the repository, she can execute programs on
2657 the server system through a variety of means.  Thus, repository
2658 access implies fairly broad system access as well.  It
2659 might be possible to modify @sc{cvs} to prevent that,
2660 but no one has done so as of this writing.
2661 @c OpenBSD uses chroot() and copies the repository to
2662 @c provide anonymous read-only access (for details see
2663 @c http://www.openbsd.org/anoncvs.shar).  While this
2664 @c closes the most obvious holes, I'm not sure it
2665 @c closes enough holes to recommend it (plus it is
2666 @c *very* easy to accidentally screw up a setup of this
2667 @c type).
2668
2669 Note that because the @file{$CVSROOT/CVSROOT} directory
2670 contains @file{passwd} and other files which are used
2671 to check security, you must control the permissions on
2672 this directory as tightly as the permissions on
2673 @file{/etc}.  The same applies to the @file{$CVSROOT}
2674 directory itself and any directory
2675 above it in the tree.  Anyone who has write access to
2676 such a directory will have the ability to become any
2677 user on the system.  Note that these permissions are
2678 typically tighter than you would use if you are not
2679 using pserver.
2680 @c TODO: Would be really nice to document/implement a
2681 @c scheme where the CVS server can run as some non-root
2682 @c user, e.g. "cvs".  CVSROOT/passwd would contain a
2683 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2684 @c would be implicit).  This would greatly reduce
2685 @c security risks such as those hinted at in the
2686 @c previous paragraph.  I think minor changes to CVS
2687 @c might be required but mostly this would just need
2688 @c someone who wants to play with it, document it, &c.
2689
2690 In summary, anyone who gets the password gets
2691 repository access (which may imply some measure of general system
2692 access as well).  The password is available to anyone
2693 who can sniff network packets or read a protected
2694 (i.e., user read-only) file.  If you want real
2695 security, get Kerberos.
2696
2697 @node GSSAPI authenticated
2698 @subsection Direct connection with GSSAPI
2699
2700 @cindex GSSAPI
2701 @cindex Security, GSSAPI
2702 @cindex :gserver:, setting up
2703 @cindex Kerberos, using :gserver:
2704 GSSAPI is a generic interface to network security
2705 systems such as Kerberos 5.
2706 If you have a working GSSAPI library, you can have
2707 @sc{cvs} connect via a direct @sc{tcp} connection,
2708 authenticating with GSSAPI.
2709
2710 To do this, @sc{cvs} needs to be compiled with GSSAPI
2711 support; when configuring @sc{cvs} it tries to detect
2712 whether GSSAPI libraries using Kerberos version 5 are
2713 present.  You can also use the @file{--with-gssapi}
2714 flag to configure.
2715
2716 The connection is authenticated using GSSAPI, but the
2717 message stream is @emph{not} authenticated by default.
2718 You must use the @code{-a} global option to request
2719 stream authentication.
2720
2721 The data transmitted is @emph{not} encrypted by
2722 default.  Encryption support must be compiled into both
2723 the client and the server; use the
2724 @file{--enable-encrypt} configure option to turn it on.
2725 You must then use the @code{-x} global option to
2726 request encryption.
2727
2728 GSSAPI connections are handled on the server side by
2729 the same server which handles the password
2730 authentication server; see @ref{Password authentication
2731 server}.  If you are using a GSSAPI mechanism such as
2732 Kerberos which provides for strong authentication, you
2733 will probably want to disable the ability to
2734 authenticate via cleartext passwords.  To do so, create
2735 an empty @file{CVSROOT/passwd} password file, and set
2736 @code{SystemAuth=no} in the config file
2737 (@pxref{config}).
2738
2739 The GSSAPI server uses a principal name of
2740 cvs/@var{hostname}, where @var{hostname} is the
2741 canonical name of the server host.  You will have to
2742 set this up as required by your GSSAPI mechanism.
2743
2744 To connect using GSSAPI, use the @samp{:gserver:} method.  For
2745 example,
2746
2747 @example
2748 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
2749 @end example
2750
2751 @node Kerberos authenticated
2752 @subsection Direct connection with Kerberos
2753
2754 @cindex Kerberos, using :kserver:
2755 @cindex Security, Kerberos
2756 @cindex :kserver:, setting up
2757 The easiest way to use Kerberos is to use the Kerberos
2758 @code{rsh}, as described in @ref{Connecting via rsh}.
2759 The main disadvantage of using rsh is that all the data
2760 needs to pass through additional programs, so it may be
2761 slower.  So if you have Kerberos installed you can
2762 connect via a direct @sc{tcp} connection,
2763 authenticating with Kerberos.
2764
2765 This section concerns the Kerberos network security
2766 system, version 4.  Kerberos version 5 is supported via
2767 the GSSAPI generic network security interface, as
2768 described in the previous section.
2769
2770 To do this, @sc{cvs} needs to be compiled with Kerberos
2771 support; when configuring @sc{cvs} it tries to detect
2772 whether Kerberos is present or you can use the
2773 @file{--with-krb4} flag to configure.
2774
2775 The data transmitted is @emph{not} encrypted by
2776 default.  Encryption support must be compiled into both
2777 the client and server; use the
2778 @file{--enable-encryption} configure option to turn it
2779 on.  You must then use the @code{-x} global option to
2780 request encryption.
2781
2782 @cindex CVS_CLIENT_PORT
2783 You need to edit @file{inetd.conf} on the server
2784 machine to run @code{cvs kserver}.  The client uses
2785 port 1999 by default; if you want to use another port
2786 specify it in the @code{CVSROOT} (@pxref{Remote repositories})
2787 or the @code{CVS_CLIENT_PORT} environment variable
2788 (@pxref{Environment variables}) on the client.
2789
2790 @cindex kinit
2791 When you want to use @sc{cvs}, get a ticket in the
2792 usual way (generally @code{kinit}); it must be a ticket
2793 which allows you to log into the server machine.  Then
2794 you are ready to go:
2795
2796 @example
2797 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
2798 @end example
2799
2800 Previous versions of @sc{cvs} would fall back to a
2801 connection via rsh; this version will not do so.
2802
2803 @node Connecting via fork
2804 @subsection Connecting with fork
2805
2806 @cindex fork, access method
2807 @cindex :fork:, setting up
2808 This access method allows you to connect to a
2809 repository on your local disk via the remote protocol.
2810 In other words it does pretty much the same thing as
2811 @code{:local:}, but various quirks, bugs and the like are
2812 those of the remote @sc{cvs} rather than the local
2813 @sc{cvs}.
2814
2815 For day-to-day operations you might prefer either
2816 @code{:local:} or @code{:fork:}, depending on your
2817 preferences.  Of course @code{:fork:} comes in
2818 particularly handy in testing or
2819 debugging @code{cvs} and the remote protocol.
2820 Specifically, we avoid all of the network-related
2821 setup/configuration, timeouts, and authentication
2822 inherent in the other remote access methods but still
2823 create a connection which uses the remote protocol.
2824
2825 To connect using the @code{fork} method, use
2826 @samp{:fork:} and the pathname to your local
2827 repository.  For example:
2828
2829 @example
2830 cvs -d :fork:/usr/local/cvsroot checkout foo
2831 @end example
2832
2833 @cindex CVS_SERVER, and :fork:
2834 As with @code{:ext:}, the server is called @samp{cvs}
2835 by default, or the value of the @code{CVS_SERVER}
2836 environment variable.
2837
2838 @c ---------------------------------------------------------------------
2839 @node Read-only access
2840 @section Read-only repository access
2841 @cindex Read-only repository access
2842 @cindex readers (admin file)
2843 @cindex writers (admin file)
2844
2845         It is possible to grant read-only repository
2846 access to people using the password-authenticated
2847 server (@pxref{Password authenticated}).  (The
2848 other access methods do not have explicit support for
2849 read-only users because those methods all assume login
2850 access to the repository machine anyway, and therefore
2851 the user can do whatever local file permissions allow
2852 her to do.)
2853
2854         A user who has read-only access can do only
2855 those @sc{cvs} operations which do not modify the
2856 repository, except for certain ``administrative'' files
2857 (such as lock files and the history file).  It may be
2858 desirable to use this feature in conjunction with
2859 user-aliasing (@pxref{Password authentication server}).
2860
2861 Unlike with previous versions of @sc{cvs}, read-only
2862 users should be able merely to read the repository, and
2863 not to execute programs on the server or otherwise gain
2864 unexpected levels of access.  Or to be more accurate,
2865 the @emph{known} holes have been plugged.  Because this
2866 feature is new and has not received a comprehensive
2867 security audit, you should use whatever level of
2868 caution seems warranted given your attitude concerning
2869 security.
2870
2871         There are two ways to specify read-only access
2872 for a user: by inclusion, and by exclusion.
2873
2874         "Inclusion" means listing that user
2875 specifically in the @file{$CVSROOT/CVSROOT/readers}
2876 file, which is simply a newline-separated list of
2877 users.  Here is a sample @file{readers} file:
2878
2879 @example
2880 melissa
2881 splotnik
2882 jrandom
2883 @end example
2884
2885 @noindent
2886         (Don't forget the newline after the last user.)
2887
2888         "Exclusion" means explicitly listing everyone
2889 who has @emph{write} access---if the file
2890
2891 @example
2892 $CVSROOT/CVSROOT/writers
2893 @end example
2894
2895 @noindent
2896 exists, then only
2897 those users listed in it have write access, and
2898 everyone else has read-only access (of course, even the
2899 read-only users still need to be listed in the
2900 @sc{cvs} @file{passwd} file).  The
2901 @file{writers} file has the same format as the
2902 @file{readers} file.
2903
2904         Note: if your @sc{cvs} @file{passwd}
2905 file maps cvs users onto system users (@pxref{Password
2906 authentication server}), make sure you deny or grant
2907 read-only access using the @emph{cvs} usernames, not
2908 the system usernames.  That is, the @file{readers} and
2909 @file{writers} files contain cvs usernames, which may
2910 or may not be the same as system usernames.
2911
2912         Here is a complete description of the server's
2913 behavior in deciding whether to grant read-only or
2914 read-write access:
2915
2916         If @file{readers} exists, and this user is
2917 listed in it, then she gets read-only access.  Or if
2918 @file{writers} exists, and this user is NOT listed in
2919 it, then she also gets read-only access (this is true
2920 even if @file{readers} exists but she is not listed
2921 there).  Otherwise, she gets full read-write access.
2922
2923         Of course there is a conflict if the user is
2924 listed in both files.  This is resolved in the more
2925 conservative way, it being better to protect the
2926 repository too much than too little: such a user gets
2927 read-only access.
2928
2929 @node Server temporary directory
2930 @section Temporary directories for the server
2931 @cindex Temporary directories, and server
2932 @cindex Server, temporary directories
2933
2934 While running, the @sc{cvs} server creates temporary
2935 directories.  They are named
2936
2937 @example
2938 cvs-serv@var{pid}
2939 @end example
2940
2941 @noindent
2942 where @var{pid} is the process identification number of
2943 the server.
2944 They are located in the directory specified by 
2945 the @samp{-T} global option (@pxref{Global options}), 
2946 the @code{TMPDIR} environment variable (@pxref{Environment variables}), 
2947 or, failing that, @file{/tmp}.
2948
2949 In most cases the server will remove the temporary
2950 directory when it is done, whether it finishes normally
2951 or abnormally.  However, there are a few cases in which
2952 the server does not or cannot remove the temporary
2953 directory, for example:
2954
2955 @itemize @bullet
2956 @item
2957 If the server aborts due to an internal server error,
2958 it may preserve the directory to aid in debugging
2959
2960 @item
2961 If the server is killed in a way that it has no way of
2962 cleaning up (most notably, @samp{kill -KILL} on unix).
2963
2964 @item
2965 If the system shuts down without an orderly shutdown,
2966 which tells the server to clean up.
2967 @end itemize
2968
2969 In cases such as this, you will need to manually remove
2970 the @file{cvs-serv@var{pid}} directories.  As long as
2971 there is no server running with process identification
2972 number @var{pid}, it is safe to do so.
2973
2974 @c ---------------------------------------------------------------------
2975 @node Starting a new project
2976 @chapter Starting a project with CVS
2977 @cindex Starting a project with CVS
2978 @cindex Creating a project
2979
2980 @comment --moduledb--
2981 Because renaming files and moving them between
2982 directories is somewhat inconvenient, the first thing
2983 you do when you start a new project should be to think
2984 through your file organization.  It is not impossible
2985 to rename or move files, but it does increase the
2986 potential for confusion and @sc{cvs} does have some
2987 quirks particularly in the area of renaming
2988 directories.  @xref{Moving files}.
2989
2990 What to do next depends on the situation at hand.
2991
2992 @menu
2993 * Setting up the files::        Getting the files into the repository
2994 * Defining the module::         How to make a module of the files
2995 @end menu
2996 @c -- File permissions!
2997
2998 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2999 @node Setting up the files
3000 @section Setting up the files
3001
3002 The first step is to create the files inside the repository.  This can
3003 be done in a couple of different ways.
3004
3005 @c -- The contributed scripts
3006 @menu
3007 * From files::                  This method is useful with old projects
3008                                 where files already exists.
3009 * From other version control systems::  Old projects where you want to
3010                                         preserve history from another system.
3011 * From scratch::                Creating a directory tree from scratch.
3012 @end menu
3013
3014 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3015 @node From files
3016 @subsection Creating a directory tree from a number of files
3017 @cindex Importing files
3018
3019 When you begin using @sc{cvs}, you will probably already have several
3020 projects that can be
3021 put under @sc{cvs} control.  In these cases the easiest way is to use the
3022 @code{import} command.  An example is probably the easiest way to
3023 explain how to use it.  If the files you want to install in
3024 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3025 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3026
3027 @example
3028 $ cd @var{wdir}
3029 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3030 @end example
3031
3032 Unless you supply a log message with the @samp{-m}
3033 flag, @sc{cvs} starts an editor and prompts for a
3034 message.  The string @samp{yoyo} is a @dfn{vendor tag},
3035 and @samp{start} is a @dfn{release tag}.  They may fill
3036 no purpose in this context, but since @sc{cvs} requires
3037 them they must be present.  @xref{Tracking sources}, for
3038 more information about them.
3039
3040 You can now verify that it worked, and remove your
3041 original source directory.
3042 @c FIXME: Need to say more about "verify that it
3043 @c worked".  What should the user look for in the output
3044 @c from "diff -r"?
3045
3046 @example
3047 $ cd ..
3048 $ cvs checkout yoyodyne/@var{rdir}       # @r{Explanation below}
3049 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3050 $ rm -r @var{wdir}
3051 @end example
3052
3053 @noindent
3054 Erasing the original sources is a good idea, to make sure that you do
3055 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3056 Of course, it would be wise to make sure that you have
3057 a backup of the sources before you remove them.
3058
3059 The @code{checkout} command can either take a module
3060 name as argument (as it has done in all previous
3061 examples) or a path name relative to @code{$CVSROOT},
3062 as it did in the example above.
3063
3064 It is a good idea to check that the permissions
3065 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3066 are reasonable, and that they belong to the proper
3067 groups.  @xref{File permissions}.
3068
3069 If some of the files you want to import are binary, you
3070 may want to use the wrappers features to specify which
3071 files are binary and which are not.  @xref{Wrappers}.
3072
3073 @c The node name is too long, but I am having trouble
3074 @c thinking of something more concise.
3075 @node From other version control systems
3076 @subsection Creating Files From Other Version Control Systems
3077 @cindex Importing files, from other version control systems
3078
3079 If you have a project which you are maintaining with
3080 another version control system, such as @sc{rcs}, you
3081 may wish to put the files from that project into
3082 @sc{cvs}, and preserve the revision history of the
3083 files.
3084
3085 @table @asis
3086 @cindex RCS, importing files from
3087 @item From RCS
3088 If you have been using @sc{rcs}, find the @sc{rcs}
3089 files---usually a file named @file{foo.c} will have its
3090 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3091 other places; consult the @sc{rcs} documentation for
3092 details).  Then create the appropriate directories in
3093 @sc{cvs} if they do not already exist.  Then copy the
3094 files into the appropriate directories in the @sc{cvs}
3095 repository (the name in the repository must be the name
3096 of the source file with @samp{,v} added; the files go
3097 directly in the appropriate directory of the repository,
3098 not in an @file{RCS} subdirectory).  This is one of the
3099 few times when it is a good idea to access the @sc{cvs}
3100 repository directly, rather than using @sc{cvs}
3101 commands.  Then you are ready to check out a new
3102 working directory.
3103 @c Someday there probably should be a "cvs import -t
3104 @c rcs" or some such.  It could even create magic
3105 @c branches.  It could also do something about the case
3106 @c where the RCS file had a (non-magic) "0" branch.
3107
3108 The @sc{rcs} file should not be locked when you move it
3109 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3110 letting you operate on it.
3111 @c What is the easiest way to unlock your files if you
3112 @c have them locked?  Especially if you have a lot of them?
3113 @c This is a CVS bug/misfeature; importing RCS files
3114 @c should ignore whether they are locked and leave them in
3115 @c an unlocked state.  Yet another reason for a separate
3116 @c "import RCS file" command.
3117
3118 @c How many is "many"? Or do they just import RCS files?
3119 @item From another version control system
3120 Many version control systems have the ability to export
3121 @sc{rcs} files in the standard format.  If yours does,
3122 export the @sc{rcs} files and then follow the above
3123 instructions.
3124
3125 Failing that, probably your best bet is to write a
3126 script that will check out the files one revision at a
3127 time using the command line interface to the other
3128 system, and then check the revisions into @sc{cvs}.
3129 The @file{sccs2rcs} script mentioned below may be a
3130 useful example to follow.
3131
3132 @cindex SCCS, importing files from
3133 @item From SCCS
3134 There is a script in the @file{contrib} directory of
3135 the @sc{cvs} source distribution called @file{sccs2rcs}
3136 which converts @sc{sccs} files to @sc{rcs} files.
3137 Note: you must run it on a machine which has both
3138 @sc{sccs} and @sc{rcs} installed, and like everything
3139 else in contrib it is unsupported (your mileage may
3140 vary).
3141
3142 @cindex PVCS, importing files from
3143 @item From PVCS
3144 There is a script in the @file{contrib} directory of
3145 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3146 which converts @sc{pvcs} archives to @sc{rcs} files.
3147 You must run it on a machine which has both
3148 @sc{pvcs} and @sc{rcs} installed, and like everything
3149 else in contrib it is unsupported (your mileage may
3150 vary).  See the comments in the script for details.
3151 @end table
3152 @c CMZ and/or PATCHY were systems that were used in the
3153 @c high energy physics community (especially for
3154 @c CERNLIB).  CERN has replaced them with CVS, but the
3155 @c CAR format seems to live on as a way to submit
3156 @c changes.  There is a program car2cvs which converts
3157 @c but I'm not sure where one gets a copy.
3158 @c Not sure it is worth mentioning here, since it would
3159 @c appear to affect only one particular community.
3160 @c Best page for more information is:
3161 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3162 @c See also:
3163 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3164
3165 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3166 @node From scratch
3167 @subsection Creating a directory tree from scratch
3168
3169 @c Also/instead should be documenting
3170 @c $ cvs co -l .
3171 @c $ mkdir tc
3172 @c $ cvs add tc
3173 @c $ cd tc
3174 @c $ mkdir man
3175 @c $ cvs add man
3176 @c etc.
3177 @c Using import to create the directories only is
3178 @c probably a somewhat confusing concept.
3179 For a new project, the easiest thing to do is probably
3180 to create an empty directory structure, like this:
3181
3182 @example
3183 $ mkdir tc
3184 $ mkdir tc/man
3185 $ mkdir tc/testing
3186 @end example
3187
3188 After that, you use the @code{import} command to create
3189 the corresponding (empty) directory structure inside
3190 the repository:
3191
3192 @example
3193 $ cd tc
3194 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3195 @end example
3196
3197 This will add yoyodyne/@var{dir} as a directory under
3198 @code{$CVSROOT}.
3199
3200 Use @code{checkout} to get the new project.  Then, use @code{add}
3201 to add files (and new directories) as needed.
3202
3203 @example
3204 $ cd ..
3205 $ cvs co yoyodyne/@var{dir}
3206 @end example
3207
3208 Check that the permissions @sc{cvs} sets on the
3209 directories inside @code{$CVSROOT} are reasonable.
3210
3211 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3212 @node Defining the module
3213 @section Defining the module
3214 @cindex Defining a module
3215 @cindex Editing the modules file
3216 @cindex Module, defining
3217 @cindex Modules file, changing
3218
3219 The next step is to define the module in the
3220 @file{modules} file.  This is not strictly necessary,
3221 but modules can be convenient in grouping together
3222 related files and directories.
3223
3224 In simple cases these steps are sufficient to define a module.
3225
3226 @enumerate
3227 @item
3228 Get a working copy of the modules file.
3229
3230 @example
3231 $ cvs checkout CVSROOT/modules
3232 $ cd CVSROOT
3233 @end example
3234
3235 @item
3236 Edit the file and insert a line that defines the module.  @xref{Intro
3237 administrative files}, for an introduction.  @xref{modules}, for a full
3238 description of the modules file.  You can use the
3239 following line to define the module @samp{tc}:
3240
3241 @example
3242 tc   yoyodyne/tc
3243 @end example
3244
3245 @item
3246 Commit your changes to the modules file.
3247
3248 @example
3249 $ cvs commit -m "Added the tc module." modules
3250 @end example
3251
3252 @item
3253 Release the modules module.
3254
3255 @example
3256 $ cd ..
3257 $ cvs release -d CVSROOT
3258 @end example
3259 @end enumerate
3260
3261 @c ---------------------------------------------------------------------
3262 @node Revisions
3263 @chapter Revisions
3264
3265 For many uses of @sc{cvs}, one doesn't need to worry
3266 too much about revision numbers; @sc{cvs} assigns
3267 numbers such as @code{1.1}, @code{1.2}, and so on, and
3268 that is all one needs to know.  However, some people
3269 prefer to have more knowledge and control concerning
3270 how @sc{cvs} assigns revision numbers.
3271
3272 If one wants to keep track of a set of revisions
3273 involving more than one file, such as which revisions
3274 went into a particular release, one uses a @dfn{tag},
3275 which is a symbolic revision which can be assigned to a
3276 numeric revision in each file.
3277
3278 @menu
3279 * Revision numbers::            The meaning of a revision number
3280 * Versions revisions releases::  Terminology used in this manual
3281 * Assigning revisions::         Assigning revisions
3282 * Tags::                        Tags--Symbolic revisions
3283 * Tagging the working directory::  The cvs tag command
3284 * Tagging by date/tag::         The cvs rtag command
3285 * Modifying tags::              Adding, renaming, and deleting tags
3286 * Tagging add/remove::          Tags with adding and removing files
3287 * Sticky tags::                 Certain tags are persistent
3288 @end menu
3289
3290 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3291 @node Revision numbers
3292 @section Revision numbers
3293 @cindex Revision numbers
3294 @cindex Revision tree
3295 @cindex Linear development
3296 @cindex Number, revision-
3297 @cindex Decimal revision number
3298 @cindex Branch number
3299 @cindex Number, branch
3300
3301 Each version of a file has a unique @dfn{revision
3302 number}.  Revision numbers look like @samp{1.1},
3303 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3304 A revision number always has an even number of
3305 period-separated decimal integers.  By default revision
3306 1.1 is the first revision of a file.  Each successive
3307 revision is given a new number by increasing the
3308 rightmost number by one.  The following figure displays
3309 a few revisions, with newer revisions to the right.
3310
3311 @example
3312        +-----+    +-----+    +-----+    +-----+    +-----+
3313        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3314        +-----+    +-----+    +-----+    +-----+    +-----+
3315 @end example
3316
3317 It is also possible to end up with numbers containing
3318 more than one period, for example @samp{1.3.2.2}.  Such
3319 revisions represent revisions on branches
3320 (@pxref{Branching and merging}); such revision numbers
3321 are explained in detail in @ref{Branches and
3322 revisions}.
3323
3324 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3325 @node Versions revisions releases
3326 @section Versions, revisions and releases
3327 @cindex Revisions, versions and releases
3328 @cindex Versions, revisions and releases
3329 @cindex Releases, revisions and versions
3330
3331 A file can have several versions, as described above.
3332 Likewise, a software product can have several versions.
3333 A software product is often given a version number such
3334 as @samp{4.1.1}.
3335
3336 Versions in the first sense are called @dfn{revisions}
3337 in this document, and versions in the second sense are
3338 called @dfn{releases}.  To avoid confusion, the word
3339 @dfn{version} is almost never used in this document.
3340
3341 @node Assigning revisions
3342 @section Assigning revisions
3343
3344 @c We avoid the "major revision" terminology.  It seems
3345 @c like jargon.  Hopefully "first number" is clear enough.
3346 By default, @sc{cvs} will assign numeric revisions by
3347 leaving the first number the same and incrementing the
3348 second number.  For example, @code{1.1}, @code{1.2},
3349 @code{1.3}, etc.
3350
3351 When adding a new file, the second number will always
3352 be one and the first number will equal the highest
3353 first number of any file in that directory.  For
3354 example, the current directory contains files whose
3355 highest numbered revisions are @code{1.7}, @code{3.1},
3356 and @code{4.12}, then an added file will be given the
3357 numeric revision @code{4.1}.
3358 (When using client/server @sc{cvs},
3359 only files that are actually sent to the server are considered.)
3360
3361 @c This is sort of redundant with something we said a
3362 @c while ago.  Somewhere we need a better way of
3363 @c introducing how the first number can be anything
3364 @c except "1", perhaps.  Also I don't think this
3365 @c presentation is clear on why we are discussing releases
3366 @c and first numbers of numeric revisions in the same
3367 @c breath.
3368 Normally there is no reason to care
3369 about the revision numbers---it is easier to treat them
3370 as internal numbers that @sc{cvs} maintains, and tags
3371 provide a better way to distinguish between things like
3372 release 1 versus release 2 of your product
3373 (@pxref{Tags}).  However, if you want to set the
3374 numeric revisions, the @samp{-r} option to @code{cvs
3375 commit} can do that.  The @samp{-r} option implies the
3376 @samp{-f} option, in the sense that it causes the
3377 files to be committed even if they are not modified.
3378
3379 For example, to bring all your files up to
3380 revision 3.0 (including those that haven't changed),
3381 you might invoke:
3382
3383 @example
3384 $ cvs commit -r 3.0
3385 @end example
3386
3387 Note that the number you specify with @samp{-r} must be
3388 larger than any existing revision number.  That is, if
3389 revision 3.0 exists, you cannot @samp{cvs commit
3390 -r 1.3}.  If you want to maintain several releases in
3391 parallel, you need to use a branch (@pxref{Branching and merging}).
3392
3393 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3394 @node Tags
3395 @section Tags--Symbolic revisions
3396 @cindex Tags
3397
3398 The revision numbers live a life of their own.  They
3399 need not have anything at all to do with the release
3400 numbers of your software product.  Depending
3401 on how you use @sc{cvs} the revision numbers might change several times
3402 between two releases.  As an example, some of the
3403 source files that make up @sc{rcs} 5.6 have the following
3404 revision numbers:
3405 @cindex RCS revision numbers
3406
3407 @example
3408 ci.c            5.21
3409 co.c            5.9
3410 ident.c         5.3
3411 rcs.c           5.12
3412 rcsbase.h       5.11
3413 rcsdiff.c       5.10
3414 rcsedit.c       5.11
3415 rcsfcmp.c       5.9
3416 rcsgen.c        5.10
3417 rcslex.c        5.11
3418 rcsmap.c        5.2
3419 rcsutil.c       5.10
3420 @end example
3421
3422 @cindex tag, command, introduction
3423 @cindex Tag, symbolic name
3424 @cindex Symbolic name (tag)
3425 @cindex Name, symbolic (tag)
3426 @cindex HEAD, as reserved tag name
3427 @cindex BASE, as reserved tag name
3428 You can use the @code{tag} command to give a symbolic name to a
3429 certain revision of a file.  You can use the @samp{-v} flag to the
3430 @code{status} command to see all tags that a file has, and
3431 which revision numbers they represent.  Tag names must
3432 start with an uppercase or lowercase letter and can
3433 contain uppercase and lowercase letters, digits,
3434 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
3435 and @code{HEAD} are reserved for use by @sc{cvs}.  It
3436 is expected that future names which are special to
3437 @sc{cvs} will be specially named, for example by
3438 starting with @samp{.}, rather than being named analogously to
3439 @code{BASE} and @code{HEAD}, to avoid conflicts with
3440 actual tag names.
3441 @c Including a character such as % or = has also been
3442 @c suggested as the naming convention for future
3443 @c special tag names.  Starting with . is nice because
3444 @c that is not a legal tag name as far as RCS is concerned.
3445 @c FIXME: CVS actually accepts quite a few characters
3446 @c in tag names, not just the ones documented above
3447 @c (see RCS_check_tag).  RCS
3448 @c defines legitimate tag names by listing illegal
3449 @c characters rather than legal ones.  CVS is said to lose its
3450 @c mind if you try to use "/" (try making such a tag sticky
3451 @c and using "cvs status" client/server--see remote
3452 @c protocol format for entries line for probable cause).
3453 @c TODO: The testsuite
3454 @c should test for whatever are documented above as
3455 @c officially-OK tag names, and CVS should at least reject
3456 @c characters that won't work, like "/".
3457
3458 You'll want to choose some convention for naming tags,
3459 based on information such as the name of the program
3460 and the version number of the release.  For example,
3461 one might take the name of the program, immediately
3462 followed by the version number with @samp{.} changed to
3463 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3464 @code{cvs1-9}.  If you choose a consistent convention,
3465 then you won't constantly be guessing whether a tag is
3466 @code{cvs-1-9} or @code{cvs1_9} or what.  You might
3467 even want to consider enforcing your convention in the
3468 @file{taginfo} file (@pxref{taginfo}).
3469 @c Might be nice to say more about using taginfo this
3470 @c way, like giving an example, or pointing out any particular
3471 @c issues which arise.
3472
3473 @cindex Adding a tag
3474 @cindex Tag, example
3475 The following example shows how you can add a tag to a
3476 file.  The commands must be issued inside your working
3477 directory.  That is, you should issue the
3478 command in the directory where @file{backend.c}
3479 resides.
3480
3481 @example
3482 $ cvs tag rel-0-4 backend.c
3483 T backend.c
3484 $ cvs status -v backend.c
3485 ===================================================================
3486 File: backend.c         Status: Up-to-date
3487
3488     Version:            1.4     Tue Dec  1 14:39:01 1992
3489     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
3490     Sticky Tag:         (none)
3491     Sticky Date:        (none)
3492     Sticky Options:     (none)
3493
3494     Existing Tags:
3495         rel-0-4                     (revision: 1.4)
3496
3497 @end example
3498
3499 For a complete summary of the syntax of @code{cvs tag},
3500 including the various options, see @ref{Invoking CVS}.
3501
3502 There is seldom reason to tag a file in isolation.  A more common use is
3503 to tag all the files that constitute a module with the same tag at
3504 strategic points in the development life-cycle, such as when a release
3505 is made.
3506
3507 @example
3508 $ cvs tag rel-1-0 .
3509 cvs tag: Tagging .
3510 T Makefile
3511 T backend.c
3512 T driver.c
3513 T frontend.c
3514 T parser.c
3515 @end example
3516
3517 @noindent
3518 (When you give @sc{cvs} a directory as argument, it generally applies the
3519 operation to all the files in that directory, and (recursively), to any
3520 subdirectories that it may contain.  @xref{Recursive behavior}.)
3521
3522 @cindex Retrieving an old revision using tags
3523 @cindex Tag, retrieving old revisions
3524 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3525 a certain revision of a module.  This flag makes it easy to
3526 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3527 any time in the future:
3528
3529 @example
3530 $ cvs checkout -r rel-1-0 tc
3531 @end example
3532
3533 @noindent
3534 This is useful, for instance, if someone claims that there is a bug in
3535 that release, but you cannot find the bug in the current working copy.
3536
3537 You can also check out a module as it was at any given date.
3538 @xref{checkout options}.  When specifying @samp{-r} to
3539 any of these commands, you will need beware of sticky
3540 tags; see @ref{Sticky tags}.
3541
3542 When you tag more than one file with the same tag you
3543 can think about the tag as "a curve drawn through a
3544 matrix of filename vs. revision number."  Say we have 5
3545 files with the following revisions:
3546
3547 @example
3548 @group
3549         file1   file2   file3   file4   file5
3550
3551         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
3552         1.2*-   1.2     1.2    -1.2*-
3553         1.3  \- 1.3*-   1.3   / 1.3
3554         1.4          \  1.4  /  1.4
3555                       \-1.5*-   1.5
3556                         1.6
3557 @end group
3558 @end example
3559
3560 At some time in the past, the @code{*} versions were tagged.
3561 You can think of the tag as a handle attached to the curve
3562 drawn through the tagged revisions.  When you pull on
3563 the handle, you get all the tagged revisions.  Another
3564 way to look at it is that you "sight" through a set of
3565 revisions that is "flat" along the tagged revisions,
3566 like this:
3567
3568 @example
3569 @group
3570         file1   file2   file3   file4   file5
3571
3572                         1.1
3573                         1.2
3574                 1.1     1.3                       _
3575         1.1     1.2     1.4     1.1              /
3576         1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
3577         1.3             1.6     1.3              \_
3578         1.4                     1.4
3579                                 1.5
3580 @end group
3581 @end example
3582
3583 @node Tagging the working directory
3584 @section Specifying what to tag from the working directory
3585
3586 @cindex tag (subcommand)
3587 The example in the previous section demonstrates one of
3588 the most common ways to choose which revisions to tag.
3589 Namely, running the @code{cvs tag} command without
3590 arguments causes @sc{cvs} to select the revisions which
3591 are checked out in the current working directory.  For
3592 example, if the copy of @file{backend.c} in working
3593 directory was checked out from revision 1.4, then
3594 @sc{cvs} will tag revision 1.4.  Note that the tag is
3595 applied immediately to revision 1.4 in the repository;
3596 tagging is not like modifying a file, or other
3597 operations in which one first modifies the working
3598 directory and then runs @code{cvs commit} to transfer
3599 that modification to the repository.
3600
3601 One potentially surprising aspect of the fact that
3602 @code{cvs tag} operates on the repository is that you
3603 are tagging the checked-in revisions, which may differ
3604 from locally modified files in your working directory.
3605 If you want to avoid doing this by mistake, specify the
3606 @samp{-c} option to @code{cvs tag}.  If there are any
3607 locally modified files, @sc{cvs} will abort with an
3608 error before it tags any files:
3609
3610 @example
3611 $ cvs tag -c rel-0-4
3612 cvs tag: backend.c is locally modified
3613 cvs [tag aborted]: correct the above errors first!
3614 @end example
3615
3616 @node Tagging by date/tag
3617 @section Specifying what to tag by date or revision
3618 @cindex rtag (subcommand)
3619
3620 The @code{cvs rtag} command tags the repository as of a
3621 certain date or time (or can be used to tag the latest
3622 revision).  @code{rtag} works directly on the
3623 repository contents (it requires no prior checkout and
3624 does not look for a working directory).
3625
3626 The following options specify which date or revision to
3627 tag.  See @ref{Common options}, for a complete
3628 description of them.
3629
3630 @table @code
3631 @item -D @var{date}
3632 Tag the most recent revision no later than @var{date}.
3633
3634 @item -f
3635 Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
3636 flags.  If no matching revision is found, use the most
3637 recent revision (instead of ignoring the file).
3638
3639 @item -r @var{tag}
3640 Only tag those files that contain existing tag @var{tag}.
3641 @end table
3642
3643 The @code{cvs tag} command also allows one to specify
3644 files by revision or date, using the same @samp{-r},
3645 @samp{-D}, and @samp{-f} options.  However, this
3646 feature is probably not what you want.  The reason is
3647 that @code{cvs tag} chooses which files to tag based on
3648 the files that exist in the working directory, rather
3649 than the files which existed as of the given tag/date.
3650 Therefore, you are generally better off using @code{cvs
3651 rtag}.  The exceptions might be cases like:
3652
3653 @example
3654 cvs tag -r 1.4 backend.c
3655 @end example
3656
3657 @node Modifying tags
3658 @section Deleting, moving, and renaming tags
3659
3660 @c Also see:
3661 @c  "How do I move or rename a magic branch tag?"
3662 @c in the FAQ (I think the issues it talks about still
3663 @c apply, but this could use some sanity.sh work).
3664
3665 Normally one does not modify tags.  They exist in order
3666 to record the history of the repository and so deleting
3667 them or changing their meaning would, generally, not be
3668 what you want.
3669
3670 However, there might be cases in which one uses a tag
3671 temporarily or accidentally puts one in the wrong
3672 place.  Therefore, one might delete, move, or rename a
3673 tag.
3674
3675 @noindent
3676 @strong{WARNING: the commands in this section are
3677 dangerous; they permanently discard historical
3678 information and it can be difficult or impossible to
3679 recover from errors.  If you are a @sc{cvs}
3680 administrator, you may consider restricting these
3681 commands with the @file{taginfo} file (@pxref{taginfo}).}
3682
3683 @cindex Deleting tags
3684 @cindex Deleting branch tags
3685 @cindex Removing tags
3686 @cindex Removing branch tags
3687 @cindex Tags, deleting
3688 @cindex Branch tags, deleting
3689 To delete a tag, specify the @samp{-d} option to either
3690 @code{cvs tag} or @code{cvs rtag}.  For example:
3691
3692 @example
3693 cvs rtag -d rel-0-4 tc
3694 @end example
3695
3696 @noindent
3697 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
3698 In the event that branch tags are encountered within the repository
3699 with the given name, a warning message will be issued and the branch 
3700 tag will not be deleted.  If you are absolutely certain you know what
3701 you are doing, the @code{-B} option may be specified to allow deletion
3702 of branch tags.  In that case, any non-branch tags encountered will
3703 trigger warnings and will not be deleted.
3704
3705 @noindent
3706 @strong{WARNING: Moving branch tags is very dangerous!  If you think
3707 you need the @code{-B} option, think again and ask your @sc{cvs}
3708 administrator about it (if that isn't you).  There is almost certainly
3709 another way to accomplish what you want to accomplish.}
3710
3711 @cindex Moving tags
3712 @cindex Moving branch tags
3713 @cindex Tags, moving
3714 @cindex Branch tags, moving
3715 When we say @dfn{move} a tag, we mean to make the same
3716 name point to different revisions.  For example, the
3717 @code{stable} tag may currently point to revision 1.4
3718 of @file{backend.c} and perhaps we want to make it
3719 point to revision 1.6.  To move a non-branch tag, specify the
3720 @samp{-F} option to either @code{cvs tag} or @code{cvs
3721 rtag}.  For example, the task just mentioned might be
3722 accomplished as:
3723
3724 @example
3725 cvs tag -r 1.6 -F stable backend.c
3726 @end example
3727
3728 @noindent
3729 If any branch tags are encountered in the repository 
3730 with the given name, a warning is issued and the branch
3731 tag is not disturbed.  If you are absolutely certain you
3732 wish to move the branch tag, the @code{-B} option may be specified.
3733 In that case, non-branch tags encountered with the given
3734 name are ignored with a warning message.
3735
3736 @noindent
3737 @strong{WARNING: Moving branch tags is very dangerous!  If you think you
3738 need the @code{-B} option, think again and ask your @sc{cvs}
3739 administrator about it (if that isn't you).  There is almost certainly
3740 another way to accomplish what you want to accomplish.}
3741
3742 @cindex Renaming tags
3743 @cindex Tags, renaming
3744 When we say @dfn{rename} a tag, we mean to make a
3745 different name point to the same revisions as the old
3746 tag.  For example, one may have misspelled the tag name
3747 and want to correct it (hopefully before others are
3748 relying on the old spelling).  To rename a tag, first
3749 create a new tag using the @samp{-r} option to
3750 @code{cvs rtag}, and then delete the old name.  (Caution:
3751 this method will not work with branch tags.) 
3752 This leaves the new tag on exactly the 
3753 same files as the old tag.  For example:
3754
3755 @example
3756 cvs rtag -r old-name-0-4 rel-0-4 tc
3757 cvs rtag -d old-name-0-4 tc
3758 @end example
3759
3760 @node Tagging add/remove
3761 @section Tagging and adding and removing files
3762
3763 The subject of exactly how tagging interacts with
3764 adding and removing files is somewhat obscure; for the
3765 most part @sc{cvs} will keep track of whether files
3766 exist or not without too much fussing.  By default,
3767 tags are applied to only files which have a revision
3768 corresponding to what is being tagged.  Files which did
3769 not exist yet, or which were already removed, simply
3770 omit the tag, and @sc{cvs} knows to treat the absence
3771 of a tag as meaning that the file didn't exist as of
3772 that tag.
3773
3774 However, this can lose a small amount of information.
3775 For example, suppose a file was added and then removed.
3776 Then, if the tag is missing for that file, there is no
3777 way to know whether the tag refers to the time before
3778 the file was added, or the time after it was removed.
3779 If you specify the @samp{-r} option to @code{cvs rtag},
3780 then @sc{cvs} tags the files which have been removed,
3781 and thereby avoids this problem.  For example, one
3782 might specify @code{-r HEAD} to tag the head.
3783
3784 On the subject of adding and removing files, the
3785 @code{cvs rtag} command has a @samp{-a} option which
3786 means to clear the tag from removed files that would
3787 not otherwise be tagged.  For example, one might
3788 specify this option in conjunction with @samp{-F} when
3789 moving a tag.  If one moved a tag without @samp{-a},
3790 then the tag in the removed files might still refer to
3791 the old revision, rather than reflecting the fact that
3792 the file had been removed.  I don't think this is
3793 necessary if @samp{-r} is specified, as noted above.
3794
3795 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3796 @node Sticky tags
3797 @section Sticky tags
3798 @cindex Sticky tags
3799 @cindex Tags, sticky
3800
3801 @c A somewhat related issue is per-directory sticky
3802 @c tags (see comment at CVS/Tag in node Working
3803 @c directory storage); we probably want to say
3804 @c something like "you can set a sticky tag for only
3805 @c some files, but you don't want to" or some such.
3806
3807 Sometimes a working copy's revision has extra data
3808 associated with it, for example it might be on a branch
3809 (@pxref{Branching and merging}), or restricted to
3810 versions prior to a certain date by @samp{checkout -D}
3811 or @samp{update -D}.  Because this data persists --
3812 that is, it applies to subsequent commands in the
3813 working copy -- we refer to it as @dfn{sticky}.
3814
3815 Most of the time, stickiness is an obscure aspect of
3816 @sc{cvs} that you don't need to think about.  However,
3817 even if you don't want to use the feature, you may need
3818 to know @emph{something} about sticky tags (for
3819 example, how to avoid them!).
3820
3821 You can use the @code{status} command to see if any
3822 sticky tags or dates are set:
3823
3824 @example
3825 $ cvs status driver.c
3826 ===================================================================
3827 File: driver.c          Status: Up-to-date
3828
3829     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
3830     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
3831     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
3832     Sticky Date:        (none)
3833     Sticky Options:     (none)
3834
3835 @end example
3836
3837 @cindex Resetting sticky tags
3838 @cindex Sticky tags, resetting
3839 @cindex Deleting sticky tags
3840 The sticky tags will remain on your working files until
3841 you delete them with @samp{cvs update -A}.  The
3842 @samp{-A} option merges local changes into the version of the
3843 file from the head of the trunk, removing any sticky tags,
3844 dates, or options (other than sticky @samp{-k} options on locally
3845 modified files).  See @ref{update} for more on the operation
3846 of @code{cvs update}.
3847
3848 @cindex Sticky date
3849 The most common use of sticky tags is to identify which
3850 branch one is working on, as described in
3851 @ref{Accessing branches}.  However, non-branch
3852 sticky tags have uses as well.  For example,
3853 suppose that you want to avoid updating your working
3854 directory, to isolate yourself from possibly
3855 destabilizing changes other people are making.  You
3856 can, of course, just refrain from running @code{cvs
3857 update}.  But if you want to avoid updating only a
3858 portion of a larger tree, then sticky tags can help.
3859 If you check out a certain revision (such as 1.4) it
3860 will become sticky.  Subsequent @code{cvs update}
3861 commands will
3862 not retrieve the latest revision until you reset the
3863 tag with @code{cvs update -A}.  Likewise, use of the
3864 @samp{-D} option to @code{update} or @code{checkout}
3865 sets a @dfn{sticky date}, which, similarly, causes that
3866 date to be used for future retrievals.
3867
3868 People often want to retrieve an old version of
3869 a file without setting a sticky tag.  This can
3870 be done with the @samp{-p} option to @code{checkout} or
3871 @code{update}, which sends the contents of the file to
3872 standard output.  For example:
3873 @example
3874 $ cvs update -p -r 1.1 file1 >file1
3875 ===================================================================
3876 Checking out file1
3877 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
3878 VERS: 1.1
3879 ***************
3880 $
3881 @end example
3882
3883 However, this isn't the easiest way, if you are asking
3884 how to undo a previous checkin (in this example, put
3885 @file{file1} back to the way it was as of revision
3886 1.1).  In that case you are better off using the
3887 @samp{-j} option to @code{update}; for further
3888 discussion see @ref{Merging two revisions}.
3889
3890 @c ---------------------------------------------------------------------
3891 @node Branching and merging
3892 @chapter Branching and merging
3893 @cindex Branching
3894 @cindex Merging
3895 @cindex Copying changes
3896 @cindex Main trunk and branches
3897 @cindex Revision tree, making branches
3898 @cindex Branches, copying changes between
3899 @cindex Changes, copying between branches
3900 @cindex Modifications, copying between branches
3901
3902 @sc{cvs} allows you to isolate changes onto a separate
3903 line of development, known as a @dfn{branch}.  When you
3904 change files on a branch, those changes do not appear
3905 on the main trunk or other branches.
3906
3907 Later you can move changes from one branch to another
3908 branch (or the main trunk) by @dfn{merging}.  Merging
3909 involves first running @code{cvs update -j}, to merge
3910 the changes into the working directory.
3911 You can then commit that revision, and thus effectively
3912 copy the changes onto another branch.
3913
3914 @menu
3915 * Branches motivation::         What branches are good for
3916 * Creating a branch::           Creating a branch
3917 * Accessing branches::          Checking out and updating branches
3918 * Branches and revisions::      Branches are reflected in revision numbers
3919 * Magic branch numbers::        Magic branch numbers
3920 * Merging a branch::            Merging an entire branch
3921 * Merging more than once::      Merging from a branch several times
3922 * Merging two revisions::       Merging differences between two revisions
3923 * Merging adds and removals::   What if files are added or removed?
3924 * Merging and keywords::        Avoiding conflicts due to keyword substitution
3925 @end menu
3926
3927 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3928 @node Branches motivation
3929 @section What branches are good for
3930 @cindex Branches motivation
3931 @cindex What branches are good for
3932 @cindex Motivation for branches
3933
3934 @c FIXME: this node mentions one way to use branches,
3935 @c but it is by no means the only way.  For example,
3936 @c the technique of committing a new feature on a branch,
3937 @c until it is ready for the main trunk.  The whole
3938 @c thing is generally speaking more akin to the
3939 @c "Revision management" node although it isn't clear to
3940 @c me whether policy matters should be centralized or
3941 @c distributed throughout the relevant sections.
3942 Suppose that release 1.0 of tc has been made.  You are continuing to
3943 develop tc, planning to create release 1.1 in a couple of months.  After a
3944 while your customers start to complain about a fatal bug.  You check
3945 out release 1.0 (@pxref{Tags}) and find the bug
3946 (which turns out to have a trivial fix).  However, the current revision
3947 of the sources are in a state of flux and are not expected to be stable
3948 for at least another month.  There is no way to make a
3949 bug fix release based on the newest sources.
3950
3951 The thing to do in a situation like this is to create a @dfn{branch} on
3952 the revision trees for all the files that make up
3953 release 1.0 of tc.  You can then make
3954 modifications to the branch without disturbing the main trunk.  When the
3955 modifications are finished you can elect to either incorporate them on
3956 the main trunk, or leave them on the branch.
3957
3958 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3959 @node Creating a branch
3960 @section Creating a branch
3961 @cindex Creating a branch
3962 @cindex Branch, creating a
3963 @cindex tag, creating a branch using
3964 @cindex rtag, creating a branch using
3965
3966 You can create a branch with @code{tag -b}; for
3967 example, assuming you're in a working copy:
3968
3969 @example
3970 $ cvs tag -b rel-1-0-patches
3971 @end example
3972
3973 @c FIXME: we should be more explicit about the value of
3974 @c having a tag on the branchpoint.  For example
3975 @c "cvs tag rel-1-0-patches-branchpoint" before
3976 @c the "cvs tag -b".  This points out that
3977 @c rel-1-0-patches is a pretty awkward name for
3978 @c this example (more so than for the rtag example
3979 @c below).
3980
3981 This splits off a branch based on the current revisions
3982 in the working copy, assigning that branch the name
3983 @samp{rel-1-0-patches}.
3984
3985 It is important to understand that branches get created
3986 in the repository, not in the working copy.  Creating a
3987 branch based on current revisions, as the above example
3988 does, will @emph{not} automatically switch the working
3989 copy to be on the new branch.  For information on how
3990 to do that, see @ref{Accessing branches}.
3991
3992 You can also create a branch without reference to any
3993 working copy, by using @code{rtag}:
3994
3995 @example
3996 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
3997 @end example
3998
3999 @samp{-r rel-1-0} says that this branch should be
4000 rooted at the revision that
4001 corresponds to the tag @samp{rel-1-0}.  It need not
4002 be the most recent revision -- it's often useful to
4003 split a branch off an old revision (for example, when
4004 fixing a bug in a past release otherwise known to be
4005 stable).
4006
4007 As with @samp{tag}, the @samp{-b} flag tells
4008 @code{rtag} to create a branch (rather than just a
4009 symbolic revision name).  Note that the numeric
4010 revision number that matches @samp{rel-1-0} will
4011 probably be different from file to file.
4012
4013 So, the full effect of the command is to create a new
4014 branch -- named @samp{rel-1-0-patches} -- in module
4015 @samp{tc}, rooted in the revision tree at the point tagged
4016 by @samp{rel-1-0}.
4017
4018 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4019 @node Accessing branches
4020 @section Accessing branches
4021 @cindex Check out a branch
4022 @cindex Retrieve a branch
4023 @cindex Access a branch
4024 @cindex Identifying a branch
4025 @cindex Branch, check out
4026 @cindex Branch, retrieving
4027 @cindex Branch, accessing
4028 @cindex Branch, identifying
4029
4030 You can retrieve a branch in one of two ways: by
4031 checking it out fresh from the repository, or by
4032 switching an existing working copy over to the branch.
4033
4034 To check out a branch from the repository, invoke
4035 @samp{checkout} with the @samp{-r} flag, followed by
4036 the tag name of the branch (@pxref{Creating a branch}):
4037
4038 @example
4039 $ cvs checkout -r rel-1-0-patches tc
4040 @end example
4041
4042 Or, if you already have a working copy, you can switch
4043 it to a given branch with @samp{update -r}:
4044
4045 @example
4046 $ cvs update -r rel-1-0-patches tc
4047 @end example
4048
4049 @noindent
4050 or equivalently:
4051
4052 @example
4053 $ cd tc
4054 $ cvs update -r rel-1-0-patches
4055 @end example
4056
4057 It does not matter if the working copy was originally
4058 on the main trunk or on some other branch -- the above
4059 command will switch it to the named branch.  And
4060 similarly to a regular @samp{update} command,
4061 @samp{update -r} merges any changes you have made,
4062 notifying you of conflicts where they occur.
4063
4064 Once you have a working copy tied to a particular
4065 branch, it remains there until you tell it otherwise.
4066 This means that changes checked in from the working
4067 copy will add new revisions on that branch, while
4068 leaving the main trunk and other branches unaffected.
4069
4070 @cindex Branches, sticky
4071 To find out what branch a working copy is on, you can
4072 use the @samp{status} command.  In its output, look for
4073 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4074 -- that's @sc{cvs}'s way of telling you the branch, if
4075 any, of the current working files:
4076
4077 @example
4078 $ cvs status -v driver.c backend.c
4079 ===================================================================
4080 File: driver.c          Status: Up-to-date
4081
4082     Version:            1.7     Sat Dec  5 18:25:54 1992
4083     RCS Version:        1.7     /u/cvsroot/yoyodyne/tc/driver.c,v
4084     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
4085     Sticky Date:        (none)
4086     Sticky Options:     (none)
4087
4088     Existing Tags:
4089         rel-1-0-patches             (branch: 1.7.2)
4090         rel-1-0                     (revision: 1.7)
4091
4092 ===================================================================
4093 File: backend.c         Status: Up-to-date
4094
4095     Version:            1.4     Tue Dec  1 14:39:01 1992
4096     RCS Version:        1.4     /u/cvsroot/yoyodyne/tc/backend.c,v
4097     Sticky Tag:         rel-1-0-patches (branch: 1.4.2)
4098     Sticky Date:        (none)
4099     Sticky Options:     (none)
4100
4101     Existing Tags:
4102         rel-1-0-patches             (branch: 1.4.2)
4103         rel-1-0                     (revision: 1.4)
4104         rel-0-4                     (revision: 1.4)
4105
4106 @end example
4107
4108 Don't be confused by the fact that the branch numbers
4109 for each file are different (@samp{1.7.2} and
4110 @samp{1.4.2} respectively).  The branch tag is the
4111 same, @samp{rel-1-0-patches}, and the files are
4112 indeed on the same branch.  The numbers simply reflect
4113 the point in each file's revision history at which the
4114 branch was made.  In the above example, one can deduce
4115 that @samp{driver.c} had been through more changes than
4116 @samp{backend.c} before this branch was created.
4117
4118 See @ref{Branches and revisions} for details about how
4119 branch numbers are constructed.
4120
4121 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4122 @node Branches and revisions
4123 @section Branches and revisions
4124 @cindex Branch number
4125 @cindex Number, branch
4126 @cindex Revision numbers (branches)
4127
4128 Ordinarily, a file's revision history is a linear
4129 series of increments (@pxref{Revision numbers}):
4130
4131 @example
4132        +-----+    +-----+    +-----+    +-----+    +-----+
4133        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4134        +-----+    +-----+    +-----+    +-----+    +-----+
4135 @end example
4136
4137 However, @sc{cvs} is not limited to linear development.  The
4138 @dfn{revision tree} can be split into @dfn{branches},
4139 where each branch is a self-maintained line of
4140 development.  Changes made on one branch can easily be
4141 moved back to the main trunk.
4142
4143 Each branch has a @dfn{branch number}, consisting of an
4144 odd number of period-separated decimal integers.  The
4145 branch number is created by appending an integer to the
4146 revision number where the corresponding branch forked
4147 off.  Having branch numbers allows more than one branch
4148 to be forked off from a certain revision.
4149
4150 @need 3500
4151 All revisions on a branch have revision numbers formed
4152 by appending an ordinal number to the branch number.
4153 The following figure illustrates branching with an
4154 example.
4155
4156 @example
4157 @c This example used to have a 1.2.2.4 revision, which
4158 @c might help clarify that development can continue on
4159 @c 1.2.2.  Might be worth reinstating if it can be done
4160 @c without overfull hboxes.
4161 @group
4162                                                       +-------------+
4163                            Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
4164                                                     / +-------------+
4165                                                    /
4166                                                   /
4167                  +---------+    +---------+    +---------+
4168 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4169                / +---------+    +---------+    +---------+
4170               /
4171              /
4172 +-----+    +-----+    +-----+    +-----+    +-----+
4173 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !  <- The main trunk
4174 +-----+    +-----+    +-----+    +-----+    +-----+
4175                 !
4176                 !
4177                 !   +---------+    +---------+    +---------+
4178 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4179                     +---------+    +---------+    +---------+
4180
4181 @end group
4182 @end example
4183
4184 @c --   However, at least for me the figure is not enough.  I suggest more
4185 @c --   text to accompany it.  "A picture is worth a thousand words", so you
4186 @c --   have to make sure the reader notices the couple of hundred words
4187 @c --   *you* had in mind more than the others!
4188
4189 @c --   Why an even number of segments?  This section implies that this is
4190 @c --   how the main trunk is distinguished from branch roots, but you never
4191 @c --   explicitly say that this is the purpose of the [by itself rather
4192 @c --   surprising] restriction to an even number of segments.
4193
4194 The exact details of how the branch number is
4195 constructed is not something you normally need to be
4196 concerned about, but here is how it works: When
4197 @sc{cvs} creates a branch number it picks the first
4198 unused even integer, starting with 2.  So when you want
4199 to create a branch from revision 6.4 it will be
4200 numbered 6.4.2.  All branch numbers ending in a zero
4201 (such as 6.4.0) are used internally by @sc{cvs}
4202 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
4203 special meaning.  @xref{Tracking sources}.
4204
4205 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4206 @node Magic branch numbers
4207 @section Magic branch numbers
4208
4209 @c Want xref to here from "log"?
4210
4211 This section describes a @sc{cvs} feature called
4212 @dfn{magic branches}.  For most purposes, you need not
4213 worry about magic branches; @sc{cvs} handles them for
4214 you.  However, they are visible to you in certain
4215 circumstances, so it may be useful to have some idea of
4216 how it works.
4217
4218 Externally, branch numbers consist of an odd number of
4219 dot-separated decimal integers.  @xref{Revision
4220 numbers}.  That is not the whole truth, however.  For
4221 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4222 in the second rightmost position (1.2.4 becomes
4223 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4224 on).
4225
4226 @sc{cvs} does a pretty good job at hiding these so
4227 called magic branches, but in a few places the hiding
4228 is incomplete:
4229
4230 @itemize @bullet
4231 @ignore
4232 @c This is in ignore as I'm taking their word for it,
4233 @c that this was fixed
4234 @c a long time ago.  But before deleting this
4235 @c entirely, I'd rather verify it (and add a test
4236 @c case to the testsuite).
4237 @item
4238 The magic branch can appear in the output from
4239 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
4240 fixed in @sc{cvs} 1.3-s2.
4241
4242 @end ignore
4243 @item
4244 The magic branch number appears in the output from
4245 @code{cvs log}.
4246 @c What output should appear instead?
4247
4248 @item
4249 You cannot specify a symbolic branch name to @code{cvs
4250 admin}.
4251
4252 @end itemize
4253
4254 @c Can CVS do this automatically the first time
4255 @c you check something in to that branch?  Should
4256 @c it?
4257 You can use the @code{admin} command to reassign a
4258 symbolic name to a branch the way @sc{rcs} expects it
4259 to be.  If @code{R4patches} is assigned to the branch
4260 1.4.2 (magic branch number 1.4.0.2) in file
4261 @file{numbers.c} you can do this:
4262
4263 @example
4264 $ cvs admin -NR4patches:1.4.2 numbers.c
4265 @end example
4266
4267 It only works if at least one revision is already
4268 committed on the branch.  Be very careful so that you
4269 do not assign the tag to the wrong number.  (There is
4270 no way to see how the tag was assigned yesterday).
4271
4272 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4273 @node Merging a branch
4274 @section Merging an entire branch
4275 @cindex Merging a branch
4276 @cindex -j (merging branches)
4277
4278 You can merge changes made on a branch into your working copy by giving
4279 the @samp{-j @var{branchname}} flag to the @code{update} subcommand.  With one
4280 @samp{-j @var{branchname}} option it merges the changes made between the
4281 greatest common ancestor (GCA) of the branch and the destination revision (in
4282 the simple case below the GCA is the point where the branch forked) and the
4283 newest revision on that branch into your working copy.
4284
4285 @cindex Join
4286 The @samp{-j} stands for ``join''.
4287
4288 @cindex Branch merge example
4289 @cindex Example, branch merge
4290 @cindex Merge, branch example
4291 Consider this revision tree:
4292
4293 @example
4294 +-----+    +-----+    +-----+    +-----+
4295 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
4296 +-----+    +-----+    +-----+    +-----+
4297                 !
4298                 !
4299                 !   +---------+    +---------+
4300 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4301                     +---------+    +---------+
4302 @end example
4303
4304 @noindent
4305 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
4306 following example assumes that the module @samp{mod} contains only one
4307 file, @file{m.c}.
4308
4309 @example
4310 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
4311
4312 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
4313                                  # @r{i.e. the changes between revision 1.2}
4314                                  # @r{and 1.2.2.2, into your working copy}
4315                                  # @r{of the file.}
4316
4317 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4318 @end example
4319
4320 A conflict can result from a merge operation.  If that
4321 happens, you should resolve it before committing the
4322 new revision.  @xref{Conflicts example}.
4323
4324 If your source files contain keywords (@pxref{Keyword substitution}),
4325 you might be getting more conflicts than strictly necessary.  See
4326 @ref{Merging and keywords}, for information on how to avoid this.
4327
4328 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag.  The
4329 same effect as above could be achieved with this:
4330
4331 @example
4332 $ cvs checkout -j R1fix mod
4333 $ cvs commit -m "Included R1fix"
4334 @end example
4335
4336 It should be noted that @code{update -j @var{tagname}} will also work but may
4337 not produce the desired result.  @xref{Merging adds and removals}, for more.
4338
4339 @node Merging more than once
4340 @section Merging from a branch several times
4341
4342 Continuing our example, the revision tree now looks
4343 like this:
4344
4345 @example
4346 +-----+    +-----+    +-----+    +-----+    +-----+
4347 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4348 +-----+    +-----+    +-----+    +-----+    +-----+
4349                 !                           *
4350                 !                          *
4351                 !   +---------+    +---------+
4352 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4353                     +---------+    +---------+
4354 @end example
4355
4356 @noindent
4357 where the starred line represents the merge from the
4358 @samp{R1fix} branch to the main trunk, as just
4359 discussed.
4360
4361 Now suppose that development continues on the
4362 @samp{R1fix} branch:
4363
4364 @example
4365 +-----+    +-----+    +-----+    +-----+    +-----+
4366 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   <- The main trunk
4367 +-----+    +-----+    +-----+    +-----+    +-----+
4368                 !                           *
4369                 !                          *
4370                 !   +---------+    +---------+    +---------+
4371 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4372                     +---------+    +---------+    +---------+
4373 @end example
4374
4375 @noindent
4376 and then you want to merge those new changes onto the
4377 main trunk.  If you just use the @code{cvs update -j
4378 R1fix m.c} command again, @sc{cvs} will attempt to
4379 merge again the changes which you have already merged,
4380 which can have undesirable side effects.
4381
4382 So instead you need to specify that you only want to
4383 merge the changes on the branch which have not yet been
4384 merged into the trunk.  To do that you specify two
4385 @samp{-j} options, and @sc{cvs} merges the changes from
4386 the first revision to the second revision.  For
4387 example, in this case the simplest way would be
4388
4389 @example
4390 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
4391                                       # @r{head of the R1fix branch}
4392 @end example
4393
4394 The problem with this is that you need to specify the
4395 1.2.2.2 revision manually.  A slightly better approach
4396 might be to use the date the last merge was done:
4397
4398 @example
4399 cvs update -j R1fix:yesterday -j R1fix m.c
4400 @end example
4401
4402 Better yet, tag the R1fix branch after every merge into
4403 the trunk, and then use that tag for subsequent merges:
4404
4405 @example
4406 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4407 @end example
4408
4409 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4410 @node Merging two revisions
4411 @section Merging differences between any two revisions
4412 @cindex Merging two revisions
4413 @cindex Revisions, merging differences between
4414 @cindex Differences, merging
4415
4416 With two @samp{-j @var{revision}} flags, the @code{update}
4417 (and @code{checkout}) command can merge the differences
4418 between any two revisions into your working file.
4419
4420 @cindex Undoing a change
4421 @cindex Removing a change
4422 @example
4423 $ cvs update -j 1.5 -j 1.3 backend.c
4424 @end example
4425
4426 @noindent
4427 will undo all changes made between revision
4428 1.3 and 1.5.  Note the order of the revisions!
4429
4430 If you try to use this option when operating on
4431 multiple files, remember that the numeric revisions will
4432 probably be very different between the various files.
4433 You almost always use symbolic
4434 tags rather than revision numbers when operating on
4435 multiple files.
4436
4437 @cindex Restoring old version of removed file
4438 @cindex Resurrecting old version of dead file
4439 Specifying two @samp{-j} options can also undo file
4440 removals or additions.  For example, suppose you have
4441 a file
4442 named @file{file1} which existed as revision 1.1, and
4443 you then removed it (thus adding a dead revision 1.2).
4444 Now suppose you want to add it again, with the same
4445 contents it had previously.  Here is how to do it:
4446
4447 @example
4448 $ cvs update -j 1.2 -j 1.1 file1
4449 U file1
4450 $ cvs commit -m test
4451 Checking in file1;
4452 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
4453 new revision: 1.3; previous revision: 1.2
4454 done
4455 $
4456 @end example
4457
4458 @node Merging adds and removals
4459 @section Merging can add or remove files
4460
4461 If the changes which you are merging involve removing
4462 or adding some files, @code{update -j} will reflect
4463 such additions or removals.
4464
4465 @c FIXME: This example needs a lot more explanation.
4466 @c We also need other examples for some of the other
4467 @c cases (not all--there are too many--as long as we present a
4468 @c coherent general principle).
4469 For example:
4470 @example
4471 cvs update -A
4472 touch a b c
4473 cvs add a b c ; cvs ci -m "added" a b c
4474 cvs tag -b branchtag
4475 cvs update -r branchtag
4476 touch d ; cvs add d
4477 rm a ; cvs rm a
4478 cvs ci -m "added d, removed a"
4479 cvs update -A
4480 cvs update -jbranchtag
4481 @end example
4482
4483 After these commands are executed and a @samp{cvs commit} is done,
4484 file @file{a} will be removed and file @file{d} added in the main branch.
4485 @c (which was determined by trying it)
4486
4487 Note that using a single static tag (@samp{-j @var{tagname}})
4488 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4489 changes from a branch will usually not remove files which were removed on the
4490 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4491 The exception to this rule occurs when
4492 a static tag has been attached to a dead revision manually.  Use the branch tag
4493 to merge all changes from the branch or use two static tags as merge endpoints
4494 to be sure that all intended changes are propagated in the merge.
4495
4496 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4497 @node Merging and keywords
4498 @section Merging and keywords
4499 @cindex Merging, and keyword substitution
4500 @cindex Keyword substitution, and merging
4501 @cindex -j (merging branches), and keyword substitution
4502 @cindex -kk, to avoid conflicts during a merge
4503
4504 If you merge files containing keywords (@pxref{Keyword
4505 substitution}), you will normally get numerous
4506 conflicts during the merge, because the keywords are
4507 expanded differently in the revisions which you are
4508 merging.
4509
4510 Therefore, you will often want to specify the
4511 @samp{-kk} (@pxref{Substitution modes}) switch to the
4512 merge command line.  By substituting just the name of
4513 the keyword, not the expanded value of that keyword,
4514 this option ensures that the revisions which you are
4515 merging will be the same as each other, and avoid
4516 spurious conflicts.
4517
4518 For example, suppose you have a file like this:
4519
4520 @example
4521        +---------+
4522       _! 1.1.2.1 !   <-  br1
4523      / +---------+
4524     /
4525    /
4526 +-----+    +-----+
4527 ! 1.1 !----! 1.2 !
4528 +-----+    +-----+
4529 @end example
4530
4531 @noindent
4532 and your working directory is currently on the trunk
4533 (revision 1.2).  Then you might get the following
4534 results from a merge:
4535
4536 @example
4537 $ cat file1
4538 key $@splitrcskeyword{Revision}: 1.2 $
4539 . . .
4540 $ cvs update -j br1
4541 U file1
4542 RCS file: /cvsroot/first-dir/file1,v
4543 retrieving revision 1.1
4544 retrieving revision 1.1.2.1
4545 Merging differences between 1.1 and 1.1.2.1 into file1
4546 rcsmerge: warning: conflicts during merge
4547 $ cat file1
4548 @asis{}<<<<<<< file1
4549 key $@splitrcskeyword{Revision}: 1.2 $
4550 @asis{}=======
4551 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4552 @asis{}>>>>>>> 1.1.2.1
4553 . . .
4554 @end example
4555
4556 What happened was that the merge tried to merge the
4557 differences between 1.1 and 1.1.2.1 into your working
4558 directory.  So, since the keyword changed from
4559 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4560 @sc{cvs} tried to merge that change into your working
4561 directory, which conflicted with the fact that your
4562 working directory had contained @code{Revision: 1.2}.
4563
4564 Here is what happens if you had used @samp{-kk}:
4565
4566 @example
4567 $ cat file1
4568 key $@splitrcskeyword{Revision}: 1.2 $
4569 . . .
4570 $ cvs update -kk -j br1
4571 U file1
4572 RCS file: /cvsroot/first-dir/file1,v
4573 retrieving revision 1.1
4574 retrieving revision 1.1.2.1
4575 Merging differences between 1.1 and 1.1.2.1 into file1
4576 $ cat file1
4577 key $@splitrcskeyword{Revision}$
4578 . . .
4579 @end example
4580
4581 What is going on here is that revision 1.1 and 1.1.2.1
4582 both expand as plain @code{Revision}, and therefore
4583 merging the changes between them into the working
4584 directory need not change anything.  Therefore, there
4585 is no conflict.
4586
4587 There is, however, one major caveat with using
4588 @samp{-kk} on merges.  Namely, it overrides whatever
4589 keyword expansion mode @sc{cvs} would normally have
4590 used.  In particular, this is a problem if the mode had
4591 been @samp{-kb} for a binary file.  Therefore, if your
4592 repository contains binary files, you will need to deal
4593 with the conflicts rather than using @samp{-kk}.
4594
4595 @ignore
4596 The following seems rather confusing, possibly buggy,
4597 and in general, in need of much more thought before it
4598 is a recommended technique.  For one thing, does it
4599 apply on Windows as well as on Unix?
4600
4601 Unchanged binary files will undergo the same keyword substitution
4602 but will not be checked in on a subsequent
4603 @code{cvs commit}.  Be aware that binary files containing keyword
4604 strings which are present in or below the working directory
4605 will most likely remain corrupt until repaired, however.  A simple 
4606 @code{cvs update -A} is sufficient to fix these otherwise unaltered binary files
4607 if the merge is being done to the main branch but
4608 this must be done after the merge has been committed or the merge itself
4609 will be lost.
4610
4611 For Example:
4612 @example
4613 cvs update -Akk -jbranchtag
4614 cvs commit
4615 cvs update -A
4616 @end example
4617
4618 @noindent
4619 will update the current directory from the main trunk of the
4620 repository, substituting the base keyword strings for keywords,
4621 and merge changes made on the branch @samp{branchtag} into the new
4622 work files, performing the same keyword substitution on that file set before
4623 comparing the two sets.  The final @code{cvs update -A} will restore any
4624 corrupted binary files as well as resetting the sticky @samp{-kk} tags which
4625 were present on the files in and below the working directory.
4626 Unfortunately, this doesn't work as well with an arbitrary branch tag, as the
4627 @samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk}
4628 switches attached to the working files as @samp{-A} does.  The workaround
4629 for this is to release the working directory after the merge has been
4630 committed and check it out again.
4631 @end ignore
4632
4633 As a result of using @samp{-kk} during the merge, each file examined by the
4634 update will have @samp{-kk} set as sticky options.  Running @code{update -A}
4635 will clear the sticky options on unmodified files, but it will not clear
4636 the sticky options on modified files.  To get back to the default keyword
4637 substitution for modified files, you must commit the results of the merge
4638 and then run @code{update -A}.
4639
4640 @c ---------------------------------------------------------------------
4641 @node Recursive behavior
4642 @chapter Recursive behavior
4643 @cindex Recursive (directory descending)
4644 @cindex Directory, descending
4645 @cindex Descending directories
4646 @cindex Subdirectories
4647
4648 Almost all of the subcommands of @sc{cvs} work
4649 recursively when you specify a directory as an
4650 argument.  For instance, consider this directory
4651 structure:
4652
4653 @example
4654       @code{$HOME}
4655         |
4656         +--@t{tc}
4657         |   |
4658             +--@t{CVS}
4659             |      (internal @sc{cvs} files)
4660             +--@t{Makefile}
4661             +--@t{backend.c}
4662             +--@t{driver.c}
4663             +--@t{frontend.c}
4664             +--@t{parser.c}
4665             +--@t{man}
4666             |    |
4667             |    +--@t{CVS}
4668             |    |  (internal @sc{cvs} files)
4669             |    +--@t{tc.1}
4670             |
4671             +--@t{testing}
4672                  |
4673                  +--@t{CVS}
4674                  |  (internal @sc{cvs} files)
4675                  +--@t{testpgm.t}
4676                  +--@t{test2.t}
4677 @end example
4678
4679 @noindent
4680 If @file{tc} is the current working directory, the
4681 following is true:
4682
4683 @itemize @bullet
4684 @item
4685 @samp{cvs update testing} is equivalent to
4686
4687 @example
4688 cvs update testing/testpgm.t testing/test2.t
4689 @end example
4690
4691 @item
4692 @samp{cvs update testing man} updates all files in the
4693 subdirectories
4694
4695 @item
4696 @samp{cvs update .} or just @samp{cvs update} updates
4697 all files in the @code{tc} directory
4698 @end itemize
4699
4700 If no arguments are given to @code{update} it will
4701 update all files in the current working directory and
4702 all its subdirectories.  In other words, @file{.} is a
4703 default argument to @code{update}.  This is also true
4704 for most of the @sc{cvs} subcommands, not only the
4705 @code{update} command.
4706
4707 The recursive behavior of the @sc{cvs} subcommands can be
4708 turned off with the @samp{-l} option.
4709 Conversely, the @samp{-R} option can be used to force recursion if
4710 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
4711
4712 @example
4713 $ cvs update -l         # @r{Don't update files in subdirectories}
4714 @end example
4715
4716 @c ---------------------------------------------------------------------
4717 @node Adding and removing
4718 @chapter Adding, removing, and renaming files and directories
4719
4720 In the course of a project, one will often add new
4721 files.  Likewise with removing or renaming, or with
4722 directories.  The general concept to keep in mind in
4723 all these cases is that instead of making an
4724 irreversible change you want @sc{cvs} to record the
4725 fact that a change has taken place, just as with
4726 modifying an existing file.  The exact mechanisms to do
4727 this in @sc{cvs} vary depending on the situation.
4728
4729 @menu
4730 * Adding files::                Adding files
4731 * Removing files::              Removing files
4732 * Removing directories::        Removing directories
4733 * Moving files::                Moving and renaming files
4734 * Moving directories::          Moving and renaming directories
4735 @end menu
4736
4737 @node Adding files
4738 @section Adding files to a directory
4739 @cindex Adding files
4740
4741 To add a new file to a directory, follow these steps.
4742
4743 @itemize @bullet
4744 @item
4745 You must have a working copy of the directory.
4746 @xref{Getting the source}.
4747
4748 @item
4749 Create the new file inside your working copy of the directory.
4750
4751 @item
4752 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
4753 want to version control the file.  If the file contains
4754 binary data, specify @samp{-kb} (@pxref{Binary files}).
4755
4756 @item
4757 Use @samp{cvs commit @var{filename}} to actually check
4758 in the file into the repository.  Other developers
4759 cannot see the file until you perform this step.
4760 @end itemize
4761
4762 You can also use the @code{add} command to add a new
4763 directory.
4764 @c FIXCVS and/or FIXME: Adding a directory doesn't
4765 @c require the commit step.  This probably can be
4766 @c considered a CVS bug, but it is possible we should
4767 @c warn people since this behavior probably won't be
4768 @c changing right away.
4769
4770 Unlike most other commands, the @code{add} command is
4771 not recursive.  You have to expcicitly name files and
4772 directories that you wish to add to the repository.
4773 However, each directory will need to be added
4774 separately before you will be able to add new files
4775 to those directories.
4776
4777 @example
4778 $ mkdir -p foo/bar
4779 $ cp ~/myfile foo/bar/myfile
4780 $ cvs add foo foo/bar
4781 $ cvs add foo/bar/myfile
4782 @end example
4783
4784 @cindex add (subcommand)
4785 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
4786
4787 Schedule @var{files} to be added to the repository.
4788 The files or directories specified with @code{add} must
4789 already exist in the current directory.  To add a whole
4790 new directory hierarchy to the source repository (for
4791 example, files received from a third-party vendor), use
4792 the @code{import} command instead.  @xref{import}.
4793
4794 The added files are not placed in the source repository
4795 until you use @code{commit} to make the change
4796 permanent.  Doing an @code{add} on a file that was
4797 removed with the @code{remove} command will undo the
4798 effect of the @code{remove}, unless a @code{commit}
4799 command intervened.  @xref{Removing files}, for an
4800 example.
4801
4802 The @samp{-k} option specifies the default way that
4803 this file will be checked out; for more information see
4804 @ref{Substitution modes}.
4805
4806 @c As noted in BUGS, -m is broken client/server (Nov
4807 @c 96).  Also see testsuite log2-* tests.
4808 The @samp{-m} option specifies a description for the
4809 file.  This description appears in the history log (if
4810 it is enabled, @pxref{history file}).  It will also be
4811 saved in the version history inside the repository when
4812 the file is committed.  The @code{log} command displays
4813 this description.  The description can be changed using
4814 @samp{admin -t}.  @xref{admin}.  If you omit the
4815 @samp{-m @var{description}} flag, an empty string will
4816 be used.  You will not be prompted for a description.
4817 @end deffn
4818
4819 For example, the following commands add the file
4820 @file{backend.c} to the repository:
4821
4822 @c This example used to specify
4823 @c     -m "Optimizer and code generation passes."
4824 @c to the cvs add command, but that doesn't work
4825 @c client/server (see log2 in sanity.sh).  Should fix CVS,
4826 @c but also seems strange to document things which
4827 @c don't work...
4828 @example
4829 $ cvs add backend.c
4830 $ cvs commit -m "Early version. Not yet compilable." backend.c
4831 @end example
4832
4833 When you add a file it is added only on the branch
4834 which you are working on (@pxref{Branching and merging}).  You can
4835 later merge the additions to another branch if you want
4836 (@pxref{Merging adds and removals}).
4837 @c Should we mention that earlier versions of CVS
4838 @c lacked this feature (1.3) or implemented it in a buggy
4839 @c way (well, 1.8 had many bugs in cvs update -j)?
4840 @c Should we mention the bug/limitation regarding a
4841 @c file being a regular file on one branch and a directory
4842 @c on another?
4843 @c FIXME: This needs an example, or several, here or
4844 @c elsewhere, for it to make much sense.
4845 @c Somewhere we need to discuss the aspects of death
4846 @c support which don't involve branching, I guess.
4847 @c Like the ability to re-create a release from a tag.
4848
4849 @c ---------------------------------------------------------------------
4850 @node Removing files
4851 @section Removing files
4852 @cindex Removing files
4853 @cindex Deleting files
4854
4855 @c FIXME: this node wants to be split into several
4856 @c smaller nodes.  Could make these children of
4857 @c "Adding and removing", probably (death support could
4858 @c be its own section, for example, as could the
4859 @c various bits about undoing mistakes in adding and
4860 @c removing).
4861 Directories change.  New files are added, and old files
4862 disappear.  Still, you want to be able to retrieve an
4863 exact copy of old releases.
4864
4865 Here is what you can do to remove a file,
4866 but remain able to retrieve old revisions:
4867
4868 @itemize @bullet
4869 @c FIXME: should probably be saying something about
4870 @c having a working directory in the first place.
4871 @item
4872 Make sure that you have not made any uncommitted
4873 modifications to the file.  @xref{Viewing differences},
4874 for one way to do that.  You can also use the
4875 @code{status} or @code{update} command.  If you remove
4876 the file without committing your changes, you will of
4877 course not be able to retrieve the file as it was
4878 immediately before you deleted it.
4879
4880 @item
4881 Remove the file from your working copy of the directory.
4882 You can for instance use @code{rm}.
4883
4884 @item
4885 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
4886 you really want to delete the file.
4887
4888 @item
4889 Use @samp{cvs commit @var{filename}} to actually
4890 perform the removal of the file from the repository.
4891 @end itemize
4892
4893 @c FIXME: Somehow this should be linked in with a more
4894 @c general discussion of death support.  I don't know
4895 @c whether we want to use the term "death support" or
4896 @c not (we can perhaps get by without it), but we do
4897 @c need to discuss the "dead" state in "cvs log" and
4898 @c related subjects.  The current discussion is
4899 @c scattered around, and not xref'd to each other.
4900 @c FIXME: I think this paragraph wants to be moved
4901 @c later down, at least after the first example.
4902 When you commit the removal of the file, @sc{cvs}
4903 records the fact that the file no longer exists.  It is
4904 possible for a file to exist on only some branches and
4905 not on others, or to re-add another file with the same
4906 name later.  @sc{cvs} will correctly create or not create
4907 the file, based on the @samp{-r} and @samp{-D} options
4908 specified to @code{checkout} or @code{update}.
4909
4910 @c FIXME: This style seems to clash with how we
4911 @c document things in general.
4912 @cindex Remove (subcommand)
4913 @deffn Command {cvs remove} [options] files @dots{}
4914
4915 Schedule file(s) to be removed from the repository
4916 (files which have not already been removed from the
4917 working directory are not processed).  This command
4918 does not actually remove the file from the repository
4919 until you commit the removal.  For a full list of
4920 options, see @ref{Invoking CVS}.
4921 @end deffn
4922
4923 Here is an example of removing several files:
4924
4925 @example
4926 $ cd test
4927 $ rm *.c
4928 $ cvs remove
4929 cvs remove: Removing .
4930 cvs remove: scheduling a.c for removal
4931 cvs remove: scheduling b.c for removal
4932 cvs remove: use 'cvs commit' to remove these files permanently
4933 $ cvs ci -m "Removed unneeded files"
4934 cvs commit: Examining .
4935 cvs commit: Committing .
4936 @end example
4937
4938 As a convenience you can remove the file and @code{cvs
4939 remove} it in one step, by specifying the @samp{-f}
4940 option.  For example, the above example could also be
4941 done like this:
4942
4943 @example
4944 $ cd test
4945 $ cvs remove -f *.c
4946 cvs remove: scheduling a.c for removal
4947 cvs remove: scheduling b.c for removal
4948 cvs remove: use 'cvs commit' to remove these files permanently
4949 $ cvs ci -m "Removed unneeded files"
4950 cvs commit: Examining .
4951 cvs commit: Committing .
4952 @end example
4953
4954 If you execute @code{remove} for a file, and then
4955 change your mind before you commit, you can undo the
4956 @code{remove} with an @code{add} command.
4957 @ignore
4958 @c is this worth saying or not?  Somehow it seems
4959 @c confusing to me.
4960 Of course,
4961 since you have removed your copy of file in the working
4962 directory, @sc{cvs} does not necessarily bring back the
4963 contents of the file from right before you executed
4964 @code{remove}; instead it gets the file from the
4965 repository again.
4966 @end ignore
4967
4968 @c FIXME: what if you change your mind after you commit
4969 @c it?  (answer is also "cvs add" but we don't say that...).
4970 @c We need some index entries for thinks like "undoing
4971 @c removal" too.
4972
4973 @example
4974 $ ls
4975 CVS   ja.h  oj.c
4976 $ rm oj.c
4977 $ cvs remove oj.c
4978 cvs remove: scheduling oj.c for removal
4979 cvs remove: use 'cvs commit' to remove this file permanently
4980 $ cvs add oj.c
4981 U oj.c
4982 cvs add: oj.c, version 1.1.1.1, resurrected
4983 @end example
4984
4985 If you realize your mistake before you run the
4986 @code{remove} command you can use @code{update} to
4987 resurrect the file:
4988
4989 @example
4990 $ rm oj.c
4991 $ cvs update oj.c
4992 cvs update: warning: oj.c was lost
4993 U oj.c
4994 @end example
4995
4996 When you remove a file it is removed only on the branch
4997 which you are working on (@pxref{Branching and merging}).  You can
4998 later merge the removals to another branch if you want
4999 (@pxref{Merging adds and removals}).
5000
5001 @node Removing directories
5002 @section Removing directories
5003 @cindex Removing directories
5004 @cindex Directories, removing
5005
5006 In concept, removing directories is somewhat similar to
5007 removing files---you want the directory to not exist in
5008 your current working directories, but you also want to
5009 be able to retrieve old releases in which the directory
5010 existed.
5011
5012 The way that you remove a directory is to remove all
5013 the files in it.  You don't remove the directory
5014 itself; there is no way to do that.
5015 Instead you specify the @samp{-P} option to
5016 @code{cvs update} or @code{cvs checkout},
5017 which will cause @sc{cvs} to remove empty
5018 directories from working directories.
5019 (Note that @code{cvs export} always removes empty directories.)
5020 Probably the
5021 best way to do this is to always specify @samp{-P}; if
5022 you want an empty directory then put a dummy file (for
5023 example @file{.keepme}) in it to prevent @samp{-P} from
5024 removing it.
5025
5026 @c I'd try to give a rationale for this, but I'm not
5027 @c sure there is a particularly convincing one.  What
5028 @c we would _like_ is for CVS to do a better job of version
5029 @c controlling whether directories exist, to eliminate the
5030 @c need for -P and so that a file can be a directory in
5031 @c one revision and a regular file in another.
5032 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5033 options of @code{checkout}.  This way,
5034 @sc{cvs} will be able to correctly create the directory
5035 or not depending on whether the particular version you
5036 are checking out contains any files in that directory.
5037
5038 @c ---------------------------------------------------------------------
5039 @node Moving files
5040 @section Moving and renaming files
5041 @cindex Moving files
5042 @cindex Renaming files
5043 @cindex Files, moving
5044
5045 Moving files to a different directory or renaming them
5046 is not difficult, but some of the ways in which this
5047 works may be non-obvious.  (Moving or renaming a
5048 directory is even harder.  @xref{Moving directories}.).
5049
5050 The examples below assume that the file @var{old} is renamed to
5051 @var{new}.
5052
5053 @menu
5054 * Outside::                     The normal way to Rename
5055 * Inside::                      A tricky, alternative way
5056 * Rename by copying::           Another tricky, alternative way
5057 @end menu
5058
5059 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5060 @node Outside
5061 @subsection The Normal way to Rename
5062
5063 @c More rename issues.  Not sure whether these are
5064 @c worth documenting; I'm putting them here because
5065 @c it seems to be as good a place as any to try to
5066 @c set down the issues.
5067 @c * "cvs annotate" will annotate either the new
5068 @c file or the old file; it cannot annotate _each
5069 @c line_ based on whether it was last changed in the
5070 @c new or old file.  Unlike "cvs log", where the
5071 @c consequences of having to select either the new
5072 @c or old name seem fairly benign, this may be a
5073 @c real advantage to having CVS know about renames
5074 @c other than as a deletion and an addition.
5075
5076 The normal way to move a file is to copy @var{old} to
5077 @var{new}, and then issue the normal @sc{cvs} commands
5078 to remove @var{old} from the repository, and add
5079 @var{new} to it.
5080 @c The following sentence is not true: one must cd into
5081 @c the directory to run "cvs add".
5082 @c  (Both @var{old} and @var{new} could
5083 @c contain relative paths, for example @file{foo/bar.c}).
5084
5085 @example
5086 $ mv @var{old} @var{new}
5087 $ cvs remove @var{old}
5088 $ cvs add @var{new}
5089 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5090 @end example
5091
5092 This is the simplest way to move a file, it is not
5093 error-prone, and it preserves the history of what was
5094 done.  Note that to access the history of the file you
5095 must specify the old or the new name, depending on what
5096 portion of the history you are accessing.  For example,
5097 @code{cvs log @var{old}} will give the log up until the
5098 time of the rename.
5099
5100 When @var{new} is committed its revision numbers will
5101 start again, usually at 1.1, so if that bothers you,
5102 use the @samp{-r rev} option to commit.  For more
5103 information see @ref{Assigning revisions}.
5104
5105 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5106 @node Inside
5107 @subsection Moving the history file
5108
5109 This method is more dangerous, since it involves moving
5110 files inside the repository.  Read this entire section
5111 before trying it out!
5112
5113 @example
5114 $ cd $CVSROOT/@var{dir}
5115 $ mv @var{old},v @var{new},v
5116 @end example
5117
5118 @noindent
5119 Advantages:
5120
5121 @itemize @bullet
5122 @item
5123 The log of changes is maintained intact.
5124
5125 @item
5126 The revision numbers are not affected.
5127 @end itemize
5128
5129 @noindent
5130 Disadvantages:
5131
5132 @itemize @bullet
5133 @item
5134 Old releases cannot easily be fetched from the
5135 repository.  (The file will show up as @var{new} even
5136 in revisions from the time before it was renamed).
5137
5138 @item
5139 There is no log information of when the file was renamed.
5140
5141 @item
5142 Nasty things might happen if someone accesses the history file
5143 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
5144 commands while you move it.
5145 @end itemize
5146
5147 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5148 @node Rename by copying
5149 @subsection Copying the history file
5150
5151 This way also involves direct modifications to the
5152 repository.  It is safe, but not without drawbacks.
5153
5154 @example
5155 # @r{Copy the @sc{rcs} file inside the repository}
5156 $ cd $CVSROOT/@var{dir}
5157 $ cp @var{old},v @var{new},v
5158 # @r{Remove the old file}
5159 $ cd ~/@var{dir}
5160 $ rm @var{old}
5161 $ cvs remove @var{old}
5162 $ cvs commit @var{old}
5163 # @r{Remove all tags from @var{new}}
5164 $ cvs update @var{new}
5165 $ cvs log @var{new}             # @r{Remember the non-branch tag names}
5166 $ cvs tag -d @var{tag1} @var{new}
5167 $ cvs tag -d @var{tag2} @var{new}
5168 @dots{}
5169 @end example
5170
5171 By removing the tags you will be able to check out old
5172 revisions.
5173
5174 @noindent
5175 Advantages:
5176
5177 @itemize @bullet
5178 @item
5179 @c FIXME: Is this true about -D now that we have death
5180 @c support?  See 5B.3 in the FAQ.
5181 Checking out old revisions works correctly, as long as
5182 you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
5183 to retrieve the revisions.
5184
5185 @item
5186 The log of changes is maintained intact.
5187
5188 @item
5189 The revision numbers are not affected.
5190 @end itemize
5191
5192 @noindent
5193 Disadvantages:
5194
5195 @itemize @bullet
5196 @item
5197 You cannot easily see the history of the file across the rename.
5198
5199 @ignore
5200 @c Is this true?  I don't see how the revision numbers
5201 @c _could_ start over, when new,v is just old,v with
5202 @c the tags deleted.
5203 @c If there is some need to reinstate this text,
5204 @c it is "usually 1.1", not "1.0" and it needs an
5205 @c xref to Assigning revisions
5206 @item
5207 Unless you use the @samp{-r rev} (@pxref{commit
5208 options}) flag when @var{new} is committed its revision
5209 numbers will start at 1.0 again.
5210 @end ignore
5211 @end itemize
5212
5213 @c ---------------------------------------------------------------------
5214 @node Moving directories
5215 @section Moving and renaming directories
5216 @cindex Moving directories
5217 @cindex Renaming directories
5218 @cindex Directories, moving
5219
5220 The normal way to rename or move a directory is to
5221 rename or move each file within it as described in
5222 @ref{Outside}.  Then check out with the @samp{-P}
5223 option, as described in @ref{Removing directories}.
5224
5225 If you really want to hack the repository to rename or
5226 delete a directory in the repository, you can do it
5227 like this:
5228
5229 @enumerate
5230 @item
5231 Inform everyone who has a checked out copy of the directory that the
5232 directory will be renamed.  They should commit all their changes in all their
5233 copies of the project containing the directory to be removed, and remove
5234 all their working copies of said project, before you take the steps below.
5235
5236 @item
5237 Rename the directory inside the repository.
5238
5239 @example
5240 $ cd $CVSROOT/@var{parent-dir}
5241 $ mv @var{old-dir} @var{new-dir}
5242 @end example
5243
5244 @item
5245 Fix the @sc{cvs} administrative files, if necessary (for
5246 instance if you renamed an entire module).
5247
5248 @item
5249 Tell everyone that they can check out again and continue
5250 working.
5251
5252 @end enumerate
5253
5254 If someone had a working copy the @sc{cvs} commands will
5255 cease to work for him, until he removes the directory
5256 that disappeared inside the repository.
5257
5258 It is almost always better to move the files in the
5259 directory instead of moving the directory.  If you move the
5260 directory you are unlikely to be able to retrieve old
5261 releases correctly, since they probably depend on the
5262 name of the directories.
5263
5264 @c ---------------------------------------------------------------------
5265 @node History browsing
5266 @chapter History browsing
5267 @cindex History browsing
5268 @cindex Traceability
5269 @cindex Isolation
5270
5271 @ignore
5272 @c This is too long for an introduction (goal is
5273 @c one 20x80 character screen), and also mixes up a
5274 @c variety of issues (parallel development, history,
5275 @c maybe even touches on process control).
5276
5277 @c -- @quote{To lose ones history is to lose ones soul.}
5278 @c -- ///
5279 @c -- ///Those who cannot remember the past are condemned to repeat it.
5280 @c -- ///               -- George Santayana
5281 @c -- ///
5282
5283 @sc{cvs} tries to make it easy for a group of people to work
5284 together.  This is done in two ways:
5285
5286 @itemize @bullet
5287 @item
5288 Isolation---You have your own working copy of the
5289 source.  You are not affected by modifications made by
5290 others until you decide to incorporate those changes
5291 (via the @code{update} command---@pxref{update}).
5292
5293 @item
5294 Traceability---When something has changed, you can
5295 always see @emph{exactly} what changed.
5296 @end itemize
5297
5298 There are several features of @sc{cvs} that together lead
5299 to traceability:
5300
5301 @itemize @bullet
5302 @item
5303 Each revision of a file has an accompanying log
5304 message.
5305
5306 @item
5307 All commits are optionally logged to a central history
5308 database.
5309
5310 @item
5311 Logging information can be sent to a user-defined
5312 program (@pxref{loginfo}).
5313 @end itemize
5314
5315 @c -- More text here.
5316
5317 This chapter should talk about the history file, the
5318 @code{log} command, the usefulness of ChangeLogs
5319 even when you run @sc{cvs}, and things like that.
5320
5321 @end ignore
5322
5323 @c kind of lame, in a lot of ways the above text inside
5324 @c the @ignore motivates this chapter better
5325 Once you have used @sc{cvs} to store a version control
5326 history---what files have changed when, how, and by
5327 whom, there are a variety of mechanisms for looking
5328 through the history.
5329
5330 @c FIXME: should also be talking about how you look at
5331 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5332 @menu
5333 * log messages::                Log messages
5334 * history database::            The history database
5335 * user-defined logging::        User-defined logging
5336 @end menu
5337
5338 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5339 @node log messages
5340 @section Log messages
5341
5342 @c FIXME: @xref to place where we talk about how to
5343 @c specify message to commit.
5344 Whenever you commit a file you specify a log message.
5345
5346 @c FIXME: bring the information here, and get rid of or
5347 @c greatly shrink the "log" node.
5348 To look through the log messages which have been
5349 specified for every revision which has been committed,
5350 use the @code{cvs log} command (@pxref{log}).
5351
5352 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5353 @node history database
5354 @section The history database
5355
5356 @c FIXME: bring the information from the history file
5357 @c and history nodes here.  Rewrite it to be motivated
5358 @c better (start out by clearly explaining what gets
5359 @c logged in history, for example).
5360 You can use the history file (@pxref{history file}) to
5361 log various @sc{cvs} actions.  To retrieve the
5362 information from the history file, use the @code{cvs
5363 history} command (@pxref{history}).
5364
5365 Note: you can control what is logged to this file by using the
5366 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5367 (@pxref{config}).
5368
5369 @c
5370 @c The history database has many problems:
5371 @c * It is very unclear what field means what.  This
5372 @c could be improved greatly by better documentation,
5373 @c but there are still non-orthogonalities (for
5374 @c example, tag does not record the "repository"
5375 @c field but most records do).
5376 @c * Confusion about files, directories, and modules.
5377 @c Some commands record one, some record others.
5378 @c * File removal is not logged.  There is an 'R'
5379 @c record type documented, but CVS never uses it.
5380 @c * Tags are only logged for the "cvs rtag" command,
5381 @c not "cvs tag".  The fix for this is not completely
5382 @c clear (see above about modules vs. files).
5383 @c * Are there other cases of operations that are not
5384 @c logged?  One would hope for all changes to the
5385 @c repository to be logged somehow (particularly
5386 @c operations like tagging, "cvs admin -k", and other
5387 @c operations which do not record a history that one
5388 @c can get with "cvs log").  Operations on the working
5389 @c directory, like export, get, and release, are a
5390 @c second category also covered by the current "cvs
5391 @c history".
5392 @c * The history file does not record the options given
5393 @c to a command.  The most serious manifestation of
5394 @c this is perhaps that it doesn't record whether a command
5395 @c was recursive.  It is not clear to me whether one
5396 @c wants to log at a level very close to the command
5397 @c line, as a sort of way of logging each command
5398 @c (more or less), or whether one wants
5399 @c to log more at the level of what was changed (or
5400 @c something in between), but either way the current
5401 @c information has pretty big gaps.
5402 @c * Further details about a tag--like whether it is a
5403 @c branch tag or, if a non-branch tag, which branch it
5404 @c is on.  One can find out this information about the
5405 @c tag as it exists _now_, but if the tag has been
5406 @c moved, one doesn't know what it was like at the time
5407 @c the history record was written.
5408 @c * Whether operating on a particular tag, date, or
5409 @c options was implicit (sticky) or explicit.
5410 @c
5411 @c Another item, only somewhat related to the above, is a
5412 @c way to control what is logged in the history file.
5413 @c This is probably the only good way to handle
5414 @c different people having different ideas about
5415 @c information/space tradeoffs.
5416 @c
5417 @c It isn't really clear that it makes sense to try to
5418 @c patch up the history file format as it exists now to
5419 @c include all that stuff.  It might be better to
5420 @c design a whole new CVSROOT/nhistory file and "cvs
5421 @c nhistory" command, or some such, or in some other
5422 @c way trying to come up with a clean break from the
5423 @c past, which can address the above concerns.  Another
5424 @c open question is how/whether this relates to
5425 @c taginfo/loginfo/etc.
5426
5427 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5428 @node user-defined logging
5429 @section User-defined logging
5430
5431 @c FIXME: probably should centralize this information
5432 @c here, at least to some extent.  Maybe by moving the
5433 @c loginfo, etc., nodes here and replacing
5434 @c the "user-defined logging" node with one node for
5435 @c each method.
5436 You can customize @sc{cvs} to log various kinds of
5437 actions, in whatever manner you choose.  These
5438 mechanisms operate by executing a script at various
5439 times.  The script might append a message to a file
5440 listing the information and the programmer who created
5441 it, or send mail to a group of developers, or, perhaps,
5442 post a message to a particular newsgroup.  To log
5443 commits, use the @file{loginfo} file (@pxref{loginfo}).
5444 To log tags, use the @file{taginfo} file (@pxref{taginfo}).
5445 @c FIXME: What is difference between doing it in the
5446 @c modules file and using loginfo/taginfo?  Why should
5447 @c user use one or the other?
5448 To log commits, checkouts, exports, and tags,
5449 respectively, you can also use the @samp{-i},
5450 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5451 modules file.  For a more flexible way of giving
5452 notifications to various users, which requires less in
5453 the way of keeping centralized scripts up to date, use
5454 the @code{cvs watch add} command (@pxref{Getting
5455 Notified}); this command is useful even if you are not
5456 using @code{cvs watch on}.
5457
5458 @c ---------------------------------------------------------------------
5459 @node Binary files
5460 @chapter Handling binary files
5461 @cindex Binary files
5462
5463 The most common use for @sc{cvs} is to store text
5464 files.  With text files, @sc{cvs} can merge revisions,
5465 display the differences between revisions in a
5466 human-visible fashion, and other such operations.
5467 However, if you are willing to give up a few of these
5468 abilities, @sc{cvs} can store binary files.  For
5469 example, one might store a web site in @sc{cvs}
5470 including both text files and binary images.
5471
5472 @menu
5473 * Binary why::     More details on issues with binary files
5474 * Binary howto::   How to store them
5475 @end menu
5476
5477 @node Binary why
5478 @section The issues with binary files
5479
5480 While the need to manage binary files may seem obvious
5481 if the files that you customarily work with are binary,
5482 putting them into version control does present some
5483 additional issues.
5484
5485 One basic function of version control is to show the
5486 differences between two revisions.  For example, if
5487 someone else checked in a new version of a file, you
5488 may wish to look at what they changed and determine
5489 whether their changes are good.  For text files,
5490 @sc{cvs} provides this functionality via the @code{cvs
5491 diff} command.  For binary files, it may be possible to
5492 extract the two revisions and then compare them with a
5493 tool external to @sc{cvs} (for example, word processing
5494 software often has such a feature).  If there is no
5495 such tool, one must track changes via other mechanisms,
5496 such as urging people to write good log messages, and
5497 hoping that the changes they actually made were the
5498 changes that they intended to make.
5499
5500 Another ability of a version control system is the
5501 ability to merge two revisions.  For @sc{cvs} this
5502 happens in two contexts.  The first is when users make
5503 changes in separate working directories
5504 (@pxref{Multiple developers}).  The second is when one
5505 merges explicitly with the @samp{update -j} command
5506 (@pxref{Branching and merging}).
5507
5508 In the case of text
5509 files, @sc{cvs} can merge changes made independently,
5510 and signal a conflict if the changes conflict.  With
5511 binary files, the best that @sc{cvs} can do is present
5512 the two different copies of the file, and leave it to
5513 the user to resolve the conflict.  The user may choose
5514 one copy or the other, or may run an external merge
5515 tool which knows about that particular file format, if
5516 one exists.
5517 Note that having the user merge relies primarily on the
5518 user to not accidentally omit some changes, and thus is
5519 potentially error prone.
5520
5521 If this process is thought to be undesirable, the best
5522 choice may be to avoid merging.  To avoid the merges
5523 that result from separate working directories, see the
5524 discussion of reserved checkouts (file locking) in
5525 @ref{Multiple developers}.  To avoid the merges
5526 resulting from branches, restrict use of branches.
5527
5528 @node Binary howto
5529 @section How to store binary files
5530
5531 There are two issues with using @sc{cvs} to store
5532 binary files.  The first is that @sc{cvs} by default
5533 converts line endings between the canonical form in
5534 which they are stored in the repository (linefeed
5535 only), and the form appropriate to the operating system
5536 in use on the client (for example, carriage return
5537 followed by line feed for Windows NT).
5538
5539 The second is that a binary file might happen to
5540 contain data which looks like a keyword (@pxref{Keyword
5541 substitution}), so keyword expansion must be turned
5542 off.
5543
5544 @c FIXME: the third is that one can't do merges with
5545 @c binary files.  xref to Multiple Developers and the
5546 @c reserved checkout issues.
5547
5548 The @samp{-kb} option available with some @sc{cvs}
5549 commands insures that neither line ending conversion
5550 nor keyword expansion will be done.
5551
5552 Here is an example of how you can create a new file
5553 using the @samp{-kb} flag:
5554
5555 @example
5556 $ echo '$@splitrcskeyword{Id}$' > kotest
5557 $ cvs add -kb -m"A test file" kotest
5558 $ cvs ci -m"First checkin; contains a keyword" kotest
5559 @end example
5560
5561 If a file accidentally gets added without @samp{-kb},
5562 one can use the @code{cvs admin} command to recover.
5563 For example:
5564
5565 @example
5566 $ echo '$@splitrcskeyword{Id}$' > kotest
5567 $ cvs add -m"A test file" kotest
5568 $ cvs ci -m"First checkin; contains a keyword" kotest
5569 $ cvs admin -kb kotest
5570 $ cvs update -A kotest
5571 # @r{For non-unix systems:}
5572 # @r{Copy in a good copy of the file from outside CVS}
5573 $ cvs commit -m "make it binary" kotest
5574 @end example
5575
5576 @c Trying to describe this for both unix and non-unix
5577 @c in the same description is very confusing.  Might
5578 @c want to split the two, or just ditch the unix "shortcut"
5579 @c (unixheads don't do much with binary files, anyway).
5580 @c This used to say "(Try the above example, and do a
5581 @c @code{cat kotest} after every command)".  But that
5582 @c only really makes sense for the unix case.
5583 When you check in the file @file{kotest} the file is
5584 not preserved as a binary file, because you did not
5585 check it in as a binary file.  The @code{cvs
5586 admin -kb} command sets the default keyword
5587 substitution method for this file, but it does not
5588 alter the working copy of the file that you have.  If you need to
5589 cope with line endings (that is, you are using
5590 @sc{cvs} on a non-unix system), then you need to
5591 check in a new copy of the file, as shown by the
5592 @code{cvs commit} command above.
5593 On unix, the @code{cvs update -A} command suffices.
5594 @c FIXME: should also describe what the *other users*
5595 @c need to do, if they have checked out copies which
5596 @c have been corrupted by lack of -kb.  I think maybe
5597 @c "cvs update -kb" or "cvs
5598 @c update -A" would suffice, although the user who
5599 @c reported this suggested removing the file, manually
5600 @c removing it from CVS/Entries, and then "cvs update"
5601 (Note that you can use @code{cvs log} to determine the default keyword
5602 substitution method for a file and @code{cvs status} to determine
5603 the keyword substitution method for a working copy.)
5604
5605 However, in using @code{cvs admin -k} to change the
5606 keyword expansion, be aware that the keyword expansion
5607 mode is not version controlled.  This means that, for
5608 example, that if you have a text file in old releases,
5609 and a binary file with the same name in new releases,
5610 @sc{cvs} provides no way to check out the file in text
5611 or binary mode depending on what version you are
5612 checking out.  There is no good workaround for this
5613 problem.
5614
5615 You can also set a default for whether @code{cvs add}
5616 and @code{cvs import} treat a file as binary based on
5617 its name; for example you could say that files who
5618 names end in @samp{.exe} are binary.  @xref{Wrappers}.
5619 There is currently no way to have @sc{cvs} detect
5620 whether a file is binary based on its contents.  The
5621 main difficulty with designing such a feature is that
5622 it is not clear how to distinguish between binary and
5623 non-binary files, and the rules to apply would vary
5624 considerably with the operating system.
5625 @c For example, it would be good on MS-DOS-family OSes
5626 @c for anything containing ^Z to be binary.  Having
5627 @c characters with the 8th bit set imply binary is almost
5628 @c surely a bad idea in the context of ISO-8859-* and
5629 @c other such character sets.  On VMS or the Mac, we
5630 @c could use the OS's file typing.  This is a
5631 @c commonly-desired feature, and something of this sort
5632 @c may make sense.  But there are a lot of pitfalls here.
5633 @c
5634 @c Another, probably better, way to tell is to read the
5635 @c file in text mode, write it to a temp file in text
5636 @c mode, and then do a binary mode compare of the two
5637 @c files.  If they differ, it is a binary file.  This
5638 @c might have problems on VMS (or some other system
5639 @c with several different text modes), but in general
5640 @c should be relatively portable.  The only other
5641 @c downside I can think of is that it would be fairly
5642 @c slow, but that is perhaps a small price to pay for
5643 @c not having your files corrupted.  Another issue is
5644 @c what happens if you import a text file with bare
5645 @c linefeeds on Windows.  Such files will show up on
5646 @c Windows sometimes (I think some native windows
5647 @c programs even write them, on occasion).  Perhaps it
5648 @c is reasonable to treat such files as binary; after
5649 @c all it is something of a presumption to assume that
5650 @c the user would want the linefeeds converted to CRLF.
5651
5652 @c ---------------------------------------------------------------------
5653 @node Multiple developers
5654 @chapter Multiple developers
5655 @cindex Multiple developers
5656 @cindex Team of developers
5657 @cindex File locking
5658 @cindex Locking files
5659 @cindex Working copy
5660 @cindex Reserved checkouts
5661 @cindex Unreserved checkouts
5662 @cindex RCS-style locking
5663
5664 When more than one person works on a software project
5665 things often get complicated.  Often, two people try to
5666 edit the same file simultaneously.  One solution, known
5667 as @dfn{file locking} or @dfn{reserved checkouts}, is
5668 to allow only one person to edit each file at a time.
5669 This is the only solution with some version control
5670 systems, including @sc{rcs} and @sc{sccs}.  Currently
5671 the usual way to get reserved checkouts with @sc{cvs}
5672 is the @code{cvs admin -l} command (@pxref{admin
5673 options}).  This is not as nicely integrated into
5674 @sc{cvs} as the watch features, described below, but it
5675 seems that most people with a need for reserved
5676 checkouts find it adequate.
5677 @c Or "find it better than worrying about implementing
5678 @c nicely integrated reserved checkouts" or ...?
5679 It also may be possible to use the watches
5680 features described below, together with suitable
5681 procedures (not enforced by software), to avoid having
5682 two people edit at the same time.
5683
5684 @c Our unreserved checkout model might not
5685 @c be quite the same as others.  For example, I
5686 @c think that some systems will tend to create a branch
5687 @c in the case where CVS prints "up-to-date check failed".
5688 @c It isn't clear to me whether we should try to
5689 @c explore these subtleties; it could easily just
5690 @c confuse people.
5691 The default model with @sc{cvs} is known as
5692 @dfn{unreserved checkouts}.  In this model, developers
5693 can edit their own @dfn{working copy} of a file
5694 simultaneously.  The first person that commits his
5695 changes has no automatic way of knowing that another
5696 has started to edit it.  Others will get an error
5697 message when they try to commit the file.  They must
5698 then use @sc{cvs} commands to bring their working copy
5699 up to date with the repository revision.  This process
5700 is almost automatic.
5701
5702 @c FIXME? should probably use the word "watch" here, to
5703 @c tie this into the text below and above.
5704 @sc{cvs} also supports mechanisms which facilitate
5705 various kinds of communication, without actually
5706 enforcing rules like reserved checkouts do.
5707
5708 The rest of this chapter describes how these various
5709 models work, and some of the issues involved in
5710 choosing between them.
5711
5712 @ignore
5713 Here is a draft reserved checkout design or discussion
5714 of the issues.  This seems like as good a place as any
5715 for this.
5716
5717 Might want a cvs lock/cvs unlock--in which the names
5718 differ from edit/unedit because the network must be up
5719 for these to work.  unedit gives an error if there is a
5720 reserved checkout in place (so that people don't
5721 accidentally leave locks around); unlock gives an error
5722 if one is not in place (this is more arguable; perhaps
5723 it should act like unedit in that case).
5724
5725 On the other hand, might want it so that emacs,
5726 scripts, etc., can get ready to edit a file without
5727 having to know which model is in use.  In that case we
5728 would have a "cvs watch lock" (or .cvsrc?) (that is,
5729 three settings, "on", "off", and "lock").  Having cvs
5730 watch lock set would cause a get to record in the CVS
5731 directory which model is in use, and cause "cvs edit"
5732 to change behaviors.  We'd want a way to query which
5733 setting is in effect (this would be handy even if it is
5734 only "on" or "off" as presently).  If lock is in
5735 effect, then commit would require a lock before
5736 allowing a checkin; chmod wouldn't suffice (might be
5737 debatable--see chmod comment below, in watches--but it
5738 is the way people expect RCS to work and I can't think
5739 of any significant downside.  On the other hand, maybe
5740 it isn't worth bothering, because people who are used
5741 to RCS wouldn't think to use chmod anyway).
5742
5743 Implementation: use file attributes or use RCS
5744 locking.  The former avoids more dependence on RCS
5745 behaviors we will need to re-implement as we librarify
5746 RCS, and makes it easier to import/export RCS files (in
5747 that context, want to ignore the locker field).  But
5748 note that RCS locks are per-branch, which is the
5749 correct behavior (this is also an issue for the "watch
5750 on" features; they should be per-branch too).
5751
5752 Here are a few more random notes about implementation
5753 details, assuming "cvs watch lock" and
5754
5755 CVS/Watched file?  Or try to fit this into CVS/Entries somehow?
5756 Cases: (1) file is checked out (unreserved or with watch on) by old
5757 version of @sc{cvs}, now we do something with new one, (2) file is checked
5758 out by new version, now we do something with old one.
5759
5760 Remote protocol would have a "Watched" analogous to "Mode".  Of course
5761 it would apply to all Updated-like requests.  How do we keep this
5762 setting up to date?  I guess that there wants to be a Watched request,
5763 and the server would send a new one if it isn't up to date? (Ugh--hard
5764 to implement and slows down "cvs -q update"--is there an easier way?)
5765
5766 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
5767 "edit-lock" request.  Which comes back with a Checked-in with
5768 appropriate Watched (off, on, lock, locked, or some such?), or error
5769 message if already locked.
5770
5771 "cvs commit"--only will commit if off/on/locked.  lock is not OK.
5772
5773 Doc:
5774 note that "cvs edit" must be connected to network if watch lock is in
5775 effect.
5776
5777 Talk about what to do if someone has locked a file and you want to
5778 edit that file.  (breaking locks, or lack thereof).
5779
5780
5781 One other idea (which could work along with the
5782 existing "cvs admin -l" reserved checkouts, as well as
5783 the above):
5784
5785 "cvs editors" could show who has the file locked, if
5786 someone does.
5787
5788 @end ignore
5789
5790 @menu
5791 * File status::                 A file can be in several states
5792 * Updating a file::             Bringing a file up-to-date
5793 * Conflicts example::           An informative example
5794 * Informing others::            To cooperate you must inform
5795 * Concurrency::                 Simultaneous repository access
5796 * Watches::                     Mechanisms to track who is editing files
5797 * Choosing a model::            Reserved or unreserved checkouts?
5798 @end menu
5799
5800 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5801 @node File status
5802 @section File status
5803 @cindex File status
5804 @cindex Status of a file
5805
5806 @c Shouldn't this start with an example or something,
5807 @c introducing the unreserved checkout model?  Before we
5808 @c dive into listing states?
5809 Based on what operations you have performed on a
5810 checked out file, and what operations others have
5811 performed to that file in the repository, one can
5812 classify a file in a number of states.  The states, as
5813 reported by the @code{status} command, are:
5814
5815 @c The order of items is chosen to group logically
5816 @c similar outputs together.
5817 @c People who want alphabetical can use the index...
5818 @table @asis
5819 @cindex Up-to-date
5820 @item Up-to-date
5821 The file is identical with the latest revision in the
5822 repository for the branch in use.
5823 @c FIXME: should we clarify "in use"?  The answer is
5824 @c sticky tags, and trying to distinguish branch sticky
5825 @c tags from non-branch sticky tags seems rather awkward
5826 @c here.
5827 @c FIXME: What happens with non-branch sticky tags?  Is
5828 @c a stuck file "Up-to-date" or "Needs checkout" or what?
5829
5830 @item Locally Modified
5831 @cindex Locally Modified
5832 You have edited the file, and not yet committed your changes.
5833
5834 @item Locally Added
5835 @cindex Locally Added
5836 You have added the file with @code{add}, and not yet
5837 committed your changes.
5838 @c There are many cases involving the file being
5839 @c added/removed/modified in the working directory, and
5840 @c added/removed/modified in the repository, which we
5841 @c don't try to describe here.  I'm not sure that "cvs
5842 @c status" produces a non-confusing output in most of
5843 @c those cases.
5844
5845 @item Locally Removed
5846 @cindex Locally Removed
5847 You have removed the file with @code{remove}, and not yet
5848 committed your changes.
5849
5850 @item Needs Checkout
5851 @cindex Needs Checkout
5852 Someone else has committed a newer revision to the
5853 repository.  The name is slightly misleading; you will
5854 ordinarily use @code{update} rather than
5855 @code{checkout} to get that newer revision.
5856
5857 @item Needs Patch
5858 @cindex Needs Patch
5859 @c See also newb-123j0 in sanity.sh (although that case
5860 @c should probably be changed rather than documented).
5861 Like Needs Checkout, but the @sc{cvs} server will send
5862 a patch rather than the entire file.  Sending a patch or
5863 sending an entire file accomplishes the same thing.
5864
5865 @item Needs Merge
5866 @cindex Needs Merge
5867 Someone else has committed a newer revision to the repository, and you
5868 have also made modifications to the file.
5869
5870 @item Unresolved Conflict
5871 @cindex Unresolved Conflict
5872 @c FIXCVS - This file status needs to be changed to some more informative
5873 @c text that distinguishes it more clearly from each of the Locally Added,
5874 @c File had conflicts on merge, and Unknown status types, but an exact and
5875 @c succinct wording escapes me at the moment.
5876 A file with the same name as this new file has been added to the repository
5877 from a second workspace.  This file will need to be moved out of the way
5878 to allow an @code{update} to complete.
5879
5880 @item File had conflicts on merge
5881 @cindex File had conflicts on merge
5882 @c is it worth saying that this message was "Unresolved
5883 @c Conflict" in CVS 1.9 and earlier?  I'm inclined to
5884 @c think that is unnecessarily confusing to new users.
5885 This is like Locally Modified, except that a previous
5886 @code{update} command gave a conflict.  If you have not
5887 already done so, you need to
5888 resolve the conflict as described in @ref{Conflicts example}.
5889
5890 @item Unknown
5891 @cindex Unknown
5892 @sc{cvs} doesn't know anything about this file.  For
5893 example, you have created a new file and have not run
5894 @code{add}.
5895 @c
5896 @c "Entry Invalid" and "Classify Error" are also in the
5897 @c status.c.  The latter definitely indicates a CVS bug
5898 @c (should it be worded more like "internal error" so
5899 @c people submit bug reports if they see it?).  The former
5900 @c I'm not as sure; I haven't tracked down whether/when it
5901 @c appears in "cvs status" output.
5902
5903 @end table
5904
5905 To help clarify the file status, @code{status} also
5906 reports the @code{Working revision} which is the
5907 revision that the file in the working directory derives
5908 from, and the @code{Repository revision} which is the
5909 latest revision in the repository for the branch in
5910 use.
5911 @c FIXME: should we clarify "in use"?  The answer is
5912 @c sticky tags, and trying to distinguish branch sticky
5913 @c tags from non-branch sticky tags seems rather awkward
5914 @c here.
5915 @c FIXME: What happens with non-branch sticky tags?
5916 @c What is the Repository Revision there?  See the
5917 @c comment at vn_rcs in cvs.h, which is kind of
5918 @c confused--we really need to document better what this
5919 @c field contains.
5920 @c Q: Should we document "New file!" and other such
5921 @c outputs or are they self-explanatory?
5922 @c FIXME: what about the date to the right of "Working
5923 @c revision"?  It doesn't appear with client/server and
5924 @c seems unnecessary (redundant with "ls -l") so
5925 @c perhaps it should be removed for non-client/server too?
5926 @c FIXME: Need some examples.
5927 @c FIXME: Working revision can also be something like
5928 @c "-1.3" for a locally removed file.  Not at all
5929 @c self-explanatory (and it is possible that CVS should
5930 @c be changed rather than documenting this).
5931
5932 @c Would be nice to have an @example showing output
5933 @c from cvs status, with comments showing the xref
5934 @c where each part of the output is described.  This
5935 @c might fit in nicely if it is desirable to split this
5936 @c node in two; one to introduce "cvs status" and one
5937 @c to list each of the states.
5938 The options to @code{status} are listed in
5939 @ref{Invoking CVS}.  For information on its @code{Sticky tag}
5940 and @code{Sticky date} output, see @ref{Sticky tags}.
5941 For information on its @code{Sticky options} output,
5942 see the @samp{-k} option in @ref{update options}.
5943
5944 You can think of the @code{status} and @code{update}
5945 commands as somewhat complementary.  You use
5946 @code{update} to bring your files up to date, and you
5947 can use @code{status} to give you some idea of what an
5948 @code{update} would do (of course, the state of the
5949 repository might change before you actually run
5950 @code{update}).  In fact, if you want a command to
5951 display file status in a more brief format than is
5952 displayed by the @code{status} command, you can invoke
5953
5954 @cindex update, to display file status
5955 @example
5956 $ cvs -n -q update
5957 @end example
5958
5959 The @samp{-n} option means to not actually do the
5960 update, but merely to display statuses; the @samp{-q}
5961 option avoids printing the name of each directory.  For
5962 more information on the @code{update} command, and
5963 these options, see @ref{Invoking CVS}.
5964
5965 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5966 @node Updating a file
5967 @section Bringing a file up to date
5968 @cindex Bringing a file up to date
5969 @cindex Updating a file
5970 @cindex Merging a file
5971 @cindex Update, introduction
5972
5973 When you want to update or merge a file, use the @code{cvs update -d}
5974 command.  For files that are not up to date this is roughly equivalent
5975 to a @code{checkout} command: the newest revision of the file is
5976 extracted from the repository and put in your working directory.  The
5977 @code{-d} option, not necessary with @code{checkout}, tells @sc{cvs}
5978 that you wish it to create directories added by other developers.
5979
5980 Your modifications to a file are never lost when you
5981 use @code{update}.  If no newer revision exists,
5982 running @code{update} has no effect.  If you have
5983 edited the file, and a newer revision is available,
5984 @sc{cvs} will merge all changes into your working copy.
5985
5986 For instance, imagine that you checked out revision 1.4 and started
5987 editing it.  In the meantime someone else committed revision 1.5, and
5988 shortly after that revision 1.6.  If you run @code{update} on the file
5989 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
5990 your file.
5991
5992 @cindex Overlap
5993 If any of the changes between 1.4 and 1.6 were made too
5994 close to any of the changes you have made, an
5995 @dfn{overlap} occurs.  In such cases a warning is
5996 printed, and the resulting file includes both
5997 versions of the lines that overlap, delimited by
5998 special markers.
5999 @xref{update}, for a complete description of the
6000 @code{update} command.
6001
6002 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6003 @node Conflicts example
6004 @section Conflicts example
6005 @cindex Merge, an example
6006 @cindex Example of merge
6007 @cindex driver.c (merge example)
6008
6009 Suppose revision 1.4 of @file{driver.c} contains this:
6010
6011 @example
6012 #include <stdio.h>
6013
6014 void main()
6015 @{
6016     parse();
6017     if (nerr == 0)
6018         gencode();
6019     else
6020         fprintf(stderr, "No code generated.\n");
6021     exit(nerr == 0 ? 0 : 1);
6022 @}
6023 @end example
6024
6025 @noindent
6026 Revision 1.6 of @file{driver.c} contains this:
6027
6028 @example
6029 #include <stdio.h>
6030
6031 int main(int argc,
6032          char **argv)
6033 @{
6034     parse();
6035     if (argc != 1)
6036     @{
6037         fprintf(stderr, "tc: No args expected.\n");
6038         exit(1);
6039     @}
6040     if (nerr == 0)
6041         gencode();
6042     else
6043         fprintf(stderr, "No code generated.\n");
6044     exit(!!nerr);
6045 @}
6046 @end example
6047
6048 @noindent
6049 Your working copy of @file{driver.c}, based on revision
6050 1.4, contains this before you run @samp{cvs update}:
6051 @c -- Really include "cvs"?
6052
6053 @example
6054 #include <stdlib.h>
6055 #include <stdio.h>
6056
6057 void main()
6058 @{
6059     init_scanner();
6060     parse();
6061     if (nerr == 0)
6062         gencode();
6063     else
6064         fprintf(stderr, "No code generated.\n");
6065     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6066 @}
6067 @end example
6068
6069 @noindent
6070 You run @samp{cvs update}:
6071 @c -- Really include "cvs"?
6072
6073 @example
6074 $ cvs update driver.c
6075 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6076 retrieving revision 1.4
6077 retrieving revision 1.6
6078 Merging differences between 1.4 and 1.6 into driver.c
6079 rcsmerge warning: overlaps during merge
6080 cvs update: conflicts found in driver.c
6081 C driver.c
6082 @end example
6083
6084 @noindent
6085 @cindex Conflicts (merge example)
6086 @sc{cvs} tells you that there were some conflicts.
6087 Your original working file is saved unmodified in
6088 @file{.#driver.c.1.4}.  The new version of
6089 @file{driver.c} contains this:
6090
6091 @example
6092 #include <stdlib.h>
6093 #include <stdio.h>
6094
6095 int main(int argc,
6096          char **argv)
6097 @{
6098     init_scanner();
6099     parse();
6100     if (argc != 1)
6101     @{
6102         fprintf(stderr, "tc: No args expected.\n");
6103         exit(1);
6104     @}
6105     if (nerr == 0)
6106         gencode();
6107     else
6108         fprintf(stderr, "No code generated.\n");
6109 @asis{}<<<<<<< driver.c
6110     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6111 @asis{}=======
6112     exit(!!nerr);
6113 @asis{}>>>>>>> 1.6
6114 @}
6115 @end example
6116
6117 @noindent
6118 @cindex Markers, conflict
6119 @cindex Conflict markers
6120 @cindex <<<<<<<
6121 @cindex >>>>>>>
6122 @cindex =======
6123
6124 Note how all non-overlapping modifications are incorporated in your working
6125 copy, and that the overlapping section is clearly marked with
6126 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6127
6128 @cindex Resolving a conflict
6129 @cindex Conflict resolution
6130 You resolve the conflict by editing the file, removing the markers and
6131 the erroneous line.  Suppose you end up with this file:
6132 @c -- Add xref to the pcl-cvs manual when it talks
6133 @c -- about this.
6134 @example
6135 #include <stdlib.h>
6136 #include <stdio.h>
6137
6138 int main(int argc,
6139          char **argv)
6140 @{
6141     init_scanner();
6142     parse();
6143     if (argc != 1)
6144     @{
6145         fprintf(stderr, "tc: No args expected.\n");
6146         exit(1);
6147     @}
6148     if (nerr == 0)
6149         gencode();
6150     else
6151         fprintf(stderr, "No code generated.\n");
6152     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6153 @}
6154 @end example
6155
6156 @noindent
6157 You can now go ahead and commit this as revision 1.7.
6158
6159 @example
6160 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
6161 Checking in driver.c;
6162 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
6163 new revision: 1.7; previous revision: 1.6
6164 done
6165 @end example
6166
6167 For your protection, @sc{cvs} will refuse to check in a
6168 file if a conflict occurred and you have not resolved
6169 the conflict.  Currently to resolve a conflict, you
6170 must change the timestamp on the file.  In previous
6171 versions of @sc{cvs}, you also needed to
6172 insure that the file contains no conflict markers.
6173 Because
6174 your file may legitimately contain conflict markers (that
6175 is, occurrences of @samp{>>>>>>> } at the start of a
6176 line that don't mark a conflict), the current
6177 version of @sc{cvs} will print a warning and proceed to
6178 check in the file.
6179 @c The old behavior was really icky; the only way out
6180 @c was to start hacking on
6181 @c the @code{CVS/Entries} file or other such workarounds.
6182 @c
6183 @c If the timestamp thing isn't considered nice enough,
6184 @c maybe there should be a "cvs resolved" command
6185 @c which clears the conflict indication.  For a nice user
6186 @c interface, this should be invoked by an interactive
6187 @c merge tool like emerge rather than by the user
6188 @c directly--such a tool can verify that the user has
6189 @c really dealt with each conflict.
6190
6191 @cindex emerge
6192 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6193 Emacs front-end for @sc{cvs}) you can use an Emacs
6194 package called emerge to help you resolve conflicts.
6195 See the documentation for pcl-cvs.
6196
6197 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6198 @node Informing others
6199 @section Informing others about commits
6200 @cindex Informing others
6201 @cindex Spreading information
6202 @cindex Mail, automatic mail on commit
6203
6204 It is often useful to inform others when you commit a
6205 new revision of a file.  The @samp{-i} option of the
6206 @file{modules} file, or the @file{loginfo} file, can be
6207 used to automate this process.  @xref{modules}.
6208 @xref{loginfo}.  You can use these features of @sc{cvs}
6209 to, for instance, instruct @sc{cvs} to mail a
6210 message to all developers, or post a message to a local
6211 newsgroup.
6212 @c -- More text would be nice here.
6213
6214 @node Concurrency
6215 @section Several developers simultaneously attempting to run CVS
6216
6217 @cindex Locks, cvs, introduction
6218 @c For a discussion of *why* CVS creates locks, see
6219 @c the comment at the start of src/lock.c
6220 If several developers try to run @sc{cvs} at the same
6221 time, one may get the following message:
6222
6223 @example
6224 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6225 @end example
6226
6227 @cindex #cvs.rfl, removing
6228 @cindex #cvs.wfl, removing
6229 @cindex #cvs.lock, removing
6230 @sc{cvs} will try again every 30 seconds, and either
6231 continue with the operation or print the message again,
6232 if it still needs to wait.  If a lock seems to stick
6233 around for an undue amount of time, find the person
6234 holding the lock and ask them about the cvs command
6235 they are running.  If they aren't running a cvs
6236 command, look in the repository directory mentioned in
6237 the message and remove files which they own whose names
6238 start with @file{#cvs.rfl},
6239 @file{#cvs.wfl}, or @file{#cvs.lock}.
6240
6241 Note that these locks are to protect @sc{cvs}'s
6242 internal data structures and have no relationship to
6243 the word @dfn{lock} in the sense used by
6244 @sc{rcs}---which refers to reserved checkouts
6245 (@pxref{Multiple developers}).
6246
6247 Any number of people can be reading from a given
6248 repository at a time; only when someone is writing do
6249 the locks prevent other people from reading or writing.
6250
6251 @cindex Atomic transactions, lack of
6252 @cindex Transactions, atomic, lack of
6253 @c the following talks about what one might call commit/update
6254 @c atomicity.
6255 @c Probably also should say something about
6256 @c commit/commit atomicity, that is, "An update will
6257 @c not get partial versions of more than one commit".
6258 @c CVS currently has this property and I guess we can
6259 @c make it a documented feature.
6260 @c For example one person commits
6261 @c a/one.c and b/four.c and another commits a/two.c and
6262 @c b/three.c.  Then an update cannot get the new a/one.c
6263 @c and a/two.c and the old b/four.c and b/three.c.
6264 One might hope for the following property:
6265
6266 @quotation
6267 If someone commits some changes in one cvs command,
6268 then an update by someone else will either get all the
6269 changes, or none of them.
6270 @end quotation
6271
6272 @noindent
6273 but @sc{cvs} does @emph{not} have this property.  For
6274 example, given the files
6275
6276 @example
6277 a/one.c
6278 a/two.c
6279 b/three.c
6280 b/four.c
6281 @end example
6282
6283 @noindent
6284 if someone runs
6285
6286 @example
6287 cvs ci a/two.c b/three.c
6288 @end example
6289
6290 @noindent
6291 and someone else runs @code{cvs update} at the same
6292 time, the person running @code{update} might get only
6293 the change to @file{b/three.c} and not the change to
6294 @file{a/two.c}.
6295
6296 @node Watches
6297 @section Mechanisms to track who is editing files
6298 @cindex Watches
6299
6300 For many groups, use of @sc{cvs} in its default mode is
6301 perfectly satisfactory.  Users may sometimes go to
6302 check in a modification only to find that another
6303 modification has intervened, but they deal with it and
6304 proceed with their check in.  Other groups prefer to be
6305 able to know who is editing what files, so that if two
6306 people try to edit the same file they can choose to
6307 talk about who is doing what when rather than be
6308 surprised at check in time.  The features in this
6309 section allow such coordination, while retaining the
6310 ability of two developers to edit the same file at the
6311 same time.
6312
6313 @c Some people might ask why CVS does not enforce the
6314 @c rule on chmod, by requiring a cvs edit before a cvs
6315 @c commit.  The main reason is that it could always be
6316 @c circumvented--one could edit the file, and
6317 @c then when ready to check it in, do the cvs edit and put
6318 @c in the new contents and do the cvs commit.  One
6319 @c implementation note: if we _do_ want to have cvs commit
6320 @c require a cvs edit, we should store the state on
6321 @c whether the cvs edit has occurred in the working
6322 @c directory, rather than having the server try to keep
6323 @c track of what working directories exist.
6324 @c FIXME: should the above discussion be part of the
6325 @c manual proper, somewhere, not just in a comment?
6326 For maximum benefit developers should use @code{cvs
6327 edit} (not @code{chmod}) to make files read-write to
6328 edit them, and @code{cvs release} (not @code{rm}) to
6329 discard a working directory which is no longer in use,
6330 but @sc{cvs} is not able to enforce this behavior.
6331
6332 @c I'm a little dissatisfied with this presentation,
6333 @c because "watch on"/"edit"/"editors" are one set of
6334 @c functionality, and "watch add"/"watchers" is another
6335 @c which is somewhat orthogonal even though they interact in
6336 @c various ways.  But I think it might be
6337 @c confusing to describe them separately (e.g. "watch
6338 @c add" with loginfo).  I don't know.
6339
6340 @menu
6341 * Setting a watch::             Telling CVS to watch certain files
6342 * Getting Notified::            Telling CVS to notify you
6343 * Editing files::               How to edit a file which is being watched
6344 * Watch information::           Information about who is watching and editing
6345 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
6346 @end menu
6347
6348 @node Setting a watch
6349 @subsection Telling CVS to watch certain files
6350
6351 To enable the watch features, you first specify that
6352 certain files are to be watched.
6353
6354 @cindex watch on (subcommand)
6355 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6356
6357 @cindex Read-only files, and watches
6358 Specify that developers should run @code{cvs edit}
6359 before editing @var{files}.  @sc{cvs} will create working
6360 copies of @var{files} read-only, to remind developers
6361 to run the @code{cvs edit} command before working on
6362 them.
6363
6364 If @var{files} includes the name of a directory, @sc{cvs}
6365 arranges to watch all files added to the corresponding
6366 repository directory, and sets a default for files
6367 added in the future; this allows the user to set
6368 notification policies on a per-directory basis.  The
6369 contents of the directory are processed recursively,
6370 unless the @code{-l} option is given.
6371 The @code{-R} option can be used to force recursion if the @code{-l}
6372 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6373
6374 If @var{files} is omitted, it defaults to the current directory.
6375
6376 @cindex watch off (subcommand)
6377 @end deffn
6378
6379 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6380
6381 Do not create @var{files} read-only on checkout; thus,
6382 developers will not be reminded to use @code{cvs edit}
6383 and @code{cvs unedit}.
6384 @ignore
6385 @sc{cvs} will check out @var{files}
6386 read-write as usual, unless other permissions override
6387 due to the @code{PreservePermissions} option being
6388 enabled in the @file{config} administrative file
6389 (@pxref{Special Files}, @pxref{config})
6390 @end ignore
6391
6392 The @var{files} and options are processed as for @code{cvs
6393 watch on}.
6394
6395 @end deffn
6396
6397 @node Getting Notified
6398 @subsection Telling CVS to notify you
6399
6400 You can tell @sc{cvs} that you want to receive
6401 notifications about various actions taken on a file.
6402 You can do this without using @code{cvs watch on} for
6403 the file, but generally you will want to use @code{cvs
6404 watch on}, to remind developers to use the @code{cvs edit}
6405 command.
6406
6407 @cindex watch add (subcommand)
6408 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6409
6410 Add the current user to the list of people to receive notification of
6411 work done on @var{files}.
6412
6413 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6414 the user about.  @var{action} is one of the following:
6415
6416 @table @code
6417
6418 @item edit
6419 Another user has applied the @code{cvs edit} command (described
6420 below) to a watched file.
6421
6422 @item commit
6423 Another user has committed changes to one of the named @var{files}.
6424
6425 @item unedit
6426 Another user has abandoned editing a file (other than by committing changes).
6427 They can do this in several ways, by:
6428
6429 @itemize @bullet
6430
6431 @item
6432 applying the @code{cvs unedit} command (described below) to the file
6433
6434 @item
6435 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6436 (or recursively to a directory more than one level up)
6437
6438 @item
6439 deleting the file and allowing @code{cvs update} to recreate it
6440
6441 @end itemize
6442
6443 @item all
6444 All of the above.
6445
6446 @item none
6447 None of the above.  (This is useful with @code{cvs edit},
6448 described below.)
6449
6450 @end table
6451
6452 The @code{-a} option may appear more than once, or not at all.  If
6453 omitted, the action defaults to @code{all}.
6454
6455 The @var{files} and options are processed as for
6456 @code{cvs watch on}.
6457
6458 @end deffn
6459
6460
6461 @cindex watch remove (subcommand)
6462 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6463
6464 Remove a notification request established using @code{cvs watch add};
6465 the arguments are the same.  If the @code{-a} option is present, only
6466 watches for the specified actions are removed.
6467
6468 @end deffn
6469
6470 @cindex notify (admin file)
6471 When the conditions exist for notification, @sc{cvs}
6472 calls the @file{notify} administrative file.  Edit
6473 @file{notify} as one edits the other administrative
6474 files (@pxref{Intro administrative files}).  This
6475 file follows the usual conventions for administrative
6476 files (@pxref{syntax}), where each line is a regular
6477 expression followed by a command to execute.  The
6478 command should contain a single occurrence of @samp{%s}
6479 which will be replaced by the user to notify; the rest
6480 of the information regarding the notification will be
6481 supplied to the command on standard input.  The
6482 standard thing to put in the @code{notify} file is the
6483 single line:
6484
6485 @example
6486 ALL mail %s -s "CVS notification"
6487 @end example
6488
6489 @noindent
6490 This causes users to be notified by electronic mail.
6491 @c FIXME: should it be this hard to set up this
6492 @c behavior (and the result when one fails to do so,
6493 @c silent failure to notify, so non-obvious)?  Should
6494 @c CVS give a warning if no line in notify matches (and
6495 @c document the use of "DEFAULT :" for the case where
6496 @c skipping the notification is indeed desired)?
6497
6498 @cindex users (admin file)
6499 Note that if you set this up in the straightforward
6500 way, users receive notifications on the server machine.
6501 One could of course write a @file{notify} script which
6502 directed notifications elsewhere, but to make this
6503 easy, @sc{cvs} allows you to associate a notification
6504 address for each user.  To do so create a file
6505 @file{users} in @file{CVSROOT} with a line for each
6506 user in the format @var{user}:@var{value}.  Then
6507 instead of passing the name of the user to be notified
6508 to @file{notify}, @sc{cvs} will pass the @var{value}
6509 (normally an email address on some other machine).
6510
6511 @sc{cvs} does not notify you for your own changes.
6512 Currently this check is done based on whether the user
6513 name of the person taking the action which triggers
6514 notification matches the user name of the person
6515 getting notification.  In fact, in general, the watches
6516 features only track one edit by each user.  It probably
6517 would be more useful if watches tracked each working
6518 directory separately, so this behavior might be worth
6519 changing.
6520 @c "behavior might be worth changing" is an effort to
6521 @c point to future directions while also not promising
6522 @c that "they" (as in "why don't they fix CVS to....")
6523 @c will do this.
6524 @c one implementation issue is identifying whether a
6525 @c working directory is same or different.  Comparing
6526 @c pathnames/hostnames is hopeless, but having the server
6527 @c supply a serial number which the client stores in the
6528 @c CVS directory as a magic cookie should work.
6529
6530 @node Editing files
6531 @subsection How to edit a file which is being watched
6532
6533 @cindex Checkout, as term for getting ready to edit
6534 Since a file which is being watched is checked out
6535 read-only, you cannot simply edit it.  To make it
6536 read-write, and inform others that you are planning to
6537 edit it, use the @code{cvs edit} command.  Some systems
6538 call this a @dfn{checkout}, but @sc{cvs} uses that term
6539 for obtaining a copy of the sources (@pxref{Getting the
6540 source}), an operation which those systems call a
6541 @dfn{get} or a @dfn{fetch}.
6542 @c Issue to think about: should we transition CVS
6543 @c towards the "get" terminology?  "cvs get" is already a
6544 @c synonym for "cvs checkout" and that section of the
6545 @c manual refers to "Getting the source".  If this is
6546 @c done, needs to be done gingerly (for example, we should
6547 @c still accept "checkout" in .cvsrc files indefinitely
6548 @c even if the CVS's messages are changed from "cvs checkout: "
6549 @c to "cvs get: ").
6550 @c There is a concern about whether "get" is not as
6551 @c good for novices because it is a more general term
6552 @c than "checkout" (and thus arguably harder to assign
6553 @c a technical meaning for).
6554
6555 @cindex edit (subcommand)
6556 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6557
6558 Prepare to edit the working files @var{files}.  @sc{cvs} makes the
6559 @var{files} read-write, and notifies users who have requested
6560 @code{edit} notification for any of @var{files}.
6561
6562 The @code{cvs edit} command accepts the same options as the
6563 @code{cvs watch add} command, and establishes a temporary watch for the
6564 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6565 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
6566 receive notifications, she should specify @code{-a none}.
6567
6568 The @var{files} and the options are processed as for the @code{cvs
6569 watch} commands.
6570
6571 @ignore
6572 @strong{Caution: If the @code{PreservePermissions}
6573 option is enabled in the repository (@pxref{config}),
6574 @sc{cvs} will not change the permissions on any of the
6575 @var{files}.  The reason for this change is to ensure
6576 that using @samp{cvs edit} does not interfere with the
6577 ability to store file permissions in the @sc{cvs}
6578 repository.}
6579 @end ignore
6580
6581 @end deffn
6582
6583 Normally when you are done with a set of changes, you
6584 use the @code{cvs commit} command, which checks in your
6585 changes and returns the watched files to their usual
6586 read-only state.  But if you instead decide to abandon
6587 your changes, or not to make any changes, you can use
6588 the @code{cvs unedit} command.
6589
6590 @cindex unedit (subcommand)
6591 @cindex Abandoning work
6592 @cindex Reverting to repository version
6593 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6594
6595 Abandon work on the working files @var{files}, and revert them to the
6596 repository versions on which they are based.  @sc{cvs} makes those
6597 @var{files} read-only for which users have requested notification using
6598 @code{cvs watch on}.  @sc{cvs} notifies users who have requested @code{unedit}
6599 notification for any of @var{files}.
6600
6601 The @var{files} and options are processed as for the
6602 @code{cvs watch} commands.
6603
6604 If watches are not in use, the @code{unedit} command
6605 probably does not work, and the way to revert to the
6606 repository version is with the command @code{cvs update -C file}
6607 (@pxref{update}).
6608 The meaning is
6609 not precisely the same; the latter may also
6610 bring in some changes which have been made in the
6611 repository since the last time you updated.
6612 @c It would be a useful enhancement to CVS to make
6613 @c unedit work in the non-watch case as well.
6614 @end deffn
6615
6616 When using client/server @sc{cvs}, you can use the
6617 @code{cvs edit} and @code{cvs unedit} commands even if
6618 @sc{cvs} is unable to successfully communicate with the
6619 server; the notifications will be sent upon the next
6620 successful @sc{cvs} command.
6621
6622 @node Watch information
6623 @subsection Information about who is watching and editing
6624
6625 @cindex watchers (subcommand)
6626 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
6627
6628 List the users currently watching changes to @var{files}.  The report
6629 includes the files being watched, and the mail address of each watcher.
6630
6631 The @var{files} and options are processed as for the
6632 @code{cvs watch} commands.
6633
6634 @end deffn
6635
6636
6637 @cindex editors (subcommand)
6638 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
6639
6640 List the users currently working on @var{files}.  The report
6641 includes the mail address of each user, the time when the user began
6642 working with the file, and the host and path of the working directory
6643 containing the file.
6644
6645 The @var{files} and options are processed as for the
6646 @code{cvs watch} commands.
6647
6648 @end deffn
6649
6650 @node Watches Compatibility
6651 @subsection Using watches with old versions of CVS
6652
6653 @cindex CVS 1.6, and watches
6654 If you use the watch features on a repository, it
6655 creates @file{CVS} directories in the repository and
6656 stores the information about watches in that directory.
6657 If you attempt to use @sc{cvs} 1.6 or earlier with the
6658 repository, you get an error message such as the
6659 following (all on one line):
6660
6661 @example
6662 cvs update: cannot open CVS/Entries for reading:
6663 No such file or directory
6664 @end example
6665
6666 @noindent
6667 and your operation will likely be aborted.  To use the
6668 watch features, you must upgrade all copies of @sc{cvs}
6669 which use that repository in local or server mode.  If
6670 you cannot upgrade, use the @code{watch off} and
6671 @code{watch remove} commands to remove all watches, and
6672 that will restore the repository to a state which
6673 @sc{cvs} 1.6 can cope with.
6674
6675 @node Choosing a model
6676 @section Choosing between reserved or unreserved checkouts
6677 @cindex Choosing, reserved or unreserved checkouts
6678
6679 Reserved and unreserved checkouts each have pros and
6680 cons.  Let it be said that a lot of this is a matter of
6681 opinion or what works given different groups' working
6682 styles, but here is a brief description of some of the
6683 issues.  There are many ways to organize a team of
6684 developers.  @sc{cvs} does not try to enforce a certain
6685 organization.  It is a tool that can be used in several
6686 ways.
6687
6688 Reserved checkouts can be very counter-productive.  If
6689 two persons want to edit different parts of a file,
6690 there may be no reason to prevent either of them from
6691 doing so.  Also, it is common for someone to take out a
6692 lock on a file, because they are planning to edit it,
6693 but then forget to release the lock.
6694
6695 @c "many groups"?  specifics?  cites to papers on this?
6696 @c some way to weasel-word it a bit more so we don't
6697 @c need facts :-)?
6698 People, especially people who are familiar with
6699 reserved checkouts, often wonder how often conflicts
6700 occur if unreserved checkouts are used, and how
6701 difficult they are to resolve.  The experience with
6702 many groups is that they occur rarely and usually are
6703 relatively straightforward to resolve.
6704
6705 The rarity of serious conflicts may be surprising, until one realizes
6706 that they occur only when two developers disagree on the proper design
6707 for a given section of code; such a disagreement suggests that the
6708 team has not been communicating properly in the first place.  In order
6709 to collaborate under @emph{any} source management regimen, developers
6710 must agree on the general design of the system; given this agreement,
6711 overlapping changes are usually straightforward to merge.
6712
6713 In some cases unreserved checkouts are clearly
6714 inappropriate.  If no merge tool exists for the kind of
6715 file you are managing (for example word processor files
6716 or files edited by Computer Aided Design programs), and
6717 it is not desirable to change to a program which uses a
6718 mergeable data format, then resolving conflicts is
6719 going to be unpleasant enough that you generally will
6720 be better off to simply avoid the conflicts instead, by
6721 using reserved checkouts.
6722
6723 The watches features described above in @ref{Watches}
6724 can be considered to be an intermediate model between
6725 reserved checkouts and unreserved checkouts.  When you
6726 go to edit a file, it is possible to find out who else
6727 is editing it.  And rather than having the system
6728 simply forbid both people editing the file, it can tell
6729 you what the situation is and let you figure out
6730 whether it is a problem in that particular case or not.
6731 Therefore, for some groups it can be considered the
6732 best of both the reserved checkout and unreserved
6733 checkout worlds.
6734
6735 @c ---------------------------------------------------------------------
6736 @node Revision management
6737 @chapter Revision management
6738 @cindex Revision management
6739
6740 @c -- This chapter could be expanded a lot.
6741 @c -- Experiences are very welcome!
6742
6743 If you have read this far, you probably have a pretty
6744 good grasp on what @sc{cvs} can do for you.  This
6745 chapter talks a little about things that you still have
6746 to decide.
6747
6748 If you are doing development on your own using @sc{cvs}
6749 you could probably skip this chapter.  The questions
6750 this chapter takes up become more important when more
6751 than one person is working in a repository.
6752
6753 @menu
6754 * When to commit::              Some discussion on the subject
6755 @end menu
6756
6757 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6758 @node When to commit
6759 @section When to commit?
6760 @cindex When to commit
6761 @cindex Committing, when to
6762 @cindex Policy
6763
6764 Your group should decide which policy to use regarding
6765 commits.  Several policies are possible, and as your
6766 experience with @sc{cvs} grows you will probably find
6767 out what works for you.
6768
6769 If you commit files too quickly you might commit files
6770 that do not even compile.  If your partner updates his
6771 working sources to include your buggy file, he will be
6772 unable to compile the code.  On the other hand, other
6773 persons will not be able to benefit from the
6774 improvements you make to the code if you commit very
6775 seldom, and conflicts will probably be more common.
6776
6777 It is common to only commit files after making sure
6778 that they can be compiled.  Some sites require that the
6779 files pass a test suite.  Policies like this can be
6780 enforced using the commitinfo file
6781 (@pxref{commitinfo}), but you should think twice before
6782 you enforce such a convention.  By making the
6783 development environment too controlled it might become
6784 too regimented and thus counter-productive to the real
6785 goal, which is to get software written.
6786
6787 @c ---------------------------------------------------------------------
6788 @node Keyword substitution
6789 @chapter Keyword substitution
6790 @cindex Keyword substitution
6791 @cindex Keyword expansion
6792 @cindex Identifying files
6793
6794 @comment   Be careful when editing this chapter.
6795 @comment   Remember that this file is kept under
6796 @comment   version control, so we must not accidentally
6797 @comment   include a valid keyword in the running text.
6798
6799 As long as you edit source files inside a working
6800 directory you can always find out the state of
6801 your files via @samp{cvs status} and @samp{cvs log}.
6802 But as soon as you export the files from your
6803 development environment it becomes harder to identify
6804 which revisions they are.
6805
6806 @sc{cvs} can use a mechanism known as @dfn{keyword
6807 substitution} (or @dfn{keyword expansion}) to help
6808 identifying the files.  Embedded strings of the form
6809 @code{$@var{keyword}$} and
6810 @code{$@var{keyword}:@dots{}$} in a file are replaced
6811 with strings of the form
6812 @code{$@var{keyword}:@var{value}$} whenever you obtain
6813 a new revision of the file.
6814
6815 @menu
6816 * Keyword list::                Keywords
6817 * Using keywords::              Using keywords
6818 * Avoiding substitution::       Avoiding substitution
6819 * Substitution modes::          Substitution modes
6820 * Log keyword::                 Problems with the $@splitrcskeyword{Log}$ keyword.
6821 @end menu
6822
6823 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6824 @node Keyword list
6825 @section Keyword List
6826 @cindex Keyword List
6827
6828 @c FIXME: need some kind of example here I think,
6829 @c perhaps in a
6830 @c "Keyword intro" node.  The intro in the "Keyword
6831 @c substitution" node itself seems OK, but to launch
6832 @c into a list of the keywords somehow seems too abrupt.
6833
6834 This is a list of the keywords:
6835
6836 @table @code
6837 @cindex Author keyword
6838 @item $@splitrcskeyword{Author}$
6839 The login name of the user who checked in the revision.
6840
6841 @cindex Date keyword
6842 @item $@splitrcskeyword{Date}$
6843 The date and time (UTC) the revision was checked in.
6844
6845 @cindex Header keyword
6846 @item $@splitrcskeyword{Header}$
6847 A standard header containing the full pathname of the
6848 @sc{rcs} file, the revision number, the date (UTC), the
6849 author, the state, and the locker (if locked).  Files
6850 will normally never be locked when you use @sc{cvs}.
6851
6852 @cindex Id keyword
6853 @item $@splitrcskeyword{Id}$
6854 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
6855 filename is without a path.
6856
6857 @cindex Name keyword
6858 @item $@splitrcskeyword{Name}$
6859 Tag name used to check out this file.  The keyword is
6860 expanded only if one checks out with an explicit tag
6861 name.  For example, when running the command @code{cvs
6862 co -r first}, the keyword expands to @samp{Name: first}.
6863
6864 @cindex Locker keyword
6865 @item $@splitrcskeyword{Locker}$
6866 The login name of the user who locked the revision
6867 (empty if not locked, which is the normal case unless
6868 @code{cvs admin -l} is in use).
6869
6870 @cindex Log keyword
6871 @item $@splitrcskeyword{Log}$
6872 The log message supplied during commit, preceded by a
6873 header containing the @sc{rcs} filename, the revision
6874 number, the author, and the date (UTC).  Existing log
6875 messages are @emph{not} replaced.  Instead, the new log
6876 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
6877 Each new line is prefixed with the same string which
6878 precedes the @code{$Log} keyword.  For example, if the
6879 file contains:
6880
6881 @example
6882   /* Here is what people have been up to:
6883    *
6884    * $@splitrcskeyword{Log}: frob.c,v $
6885    * Revision 1.1  1997/01/03 14:23:51  joe
6886    * Add the superfrobnicate option
6887    *
6888    */
6889 @end example
6890
6891 @noindent
6892 then additional lines which are added when expanding
6893 the @code{$Log} keyword will be preceded by @samp{   * }.
6894 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
6895 @dfn{comment leader} from the @sc{rcs} file is not used.
6896 The @code{$Log} keyword is useful for
6897 accumulating a complete change log in a source file,
6898 but for several reasons it can be problematic.
6899 @xref{Log keyword}.
6900
6901 @cindex RCSfile keyword
6902 @item $@splitrcskeyword{RCSfile}$
6903 The name of the RCS file without a path.
6904
6905 @cindex Revision keyword
6906 @item $@splitrcskeyword{Revision}$
6907 The revision number assigned to the revision.
6908
6909 @cindex Source keyword
6910 @item $@splitrcskeyword{Source}$
6911 The full pathname of the RCS file.
6912
6913 @cindex State keyword
6914 @item $@splitrcskeyword{State}$
6915 The state assigned to the revision.  States can be
6916 assigned with @code{cvs admin -s}---see @ref{admin options}.
6917
6918 @end table
6919
6920 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6921 @node Using keywords
6922 @section Using keywords
6923
6924 To include a keyword string you simply include the
6925 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
6926 file, and commit the file.  @sc{cvs} will automatically (Or,
6927 more accurately, as part of the update run that
6928 automatically happens after a commit.)
6929 expand the string as part of the commit operation.
6930
6931 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
6932 the source files so that it gets passed through to
6933 generated files.  For example, if you are managing
6934 computer program source code, you might include a
6935 variable which is initialized to contain that string.
6936 Or some C compilers may provide a @code{#pragma ident}
6937 directive.  Or a document management system might
6938 provide a way to pass a string through to generated
6939 files.
6940
6941 @c Would be nice to give an example, but doing this in
6942 @c portable C is not possible and the problem with
6943 @c picking any one language (VMS HELP files, Ada,
6944 @c troff, whatever) is that people use CVS for all
6945 @c kinds of files.
6946
6947 @cindex Ident (shell command)
6948 The @code{ident} command (which is part of the @sc{rcs}
6949 package) can be used to extract keywords and their
6950 values from a file.  This can be handy for text files,
6951 but it is even more useful for extracting keywords from
6952 binary files.
6953
6954 @example
6955 $ ident samp.c
6956 samp.c:
6957      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6958 $ gcc samp.c
6959 $ ident a.out
6960 a.out:
6961      $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
6962 @end example
6963
6964 @cindex What (shell command)
6965 S@sc{ccs} is another popular revision control system.
6966 It has a command, @code{what}, which is very similar to
6967 @code{ident} and used for the same purpose.  Many sites
6968 without @sc{rcs} have @sc{sccs}.  Since @code{what}
6969 looks for the character sequence @code{@@(#)} it is
6970 easy to include keywords that are detected by either
6971 command.  Simply prefix the keyword with the
6972 magic @sc{sccs} phrase, like this:
6973
6974 @example
6975 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
6976 @end example
6977
6978 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6979 @node Avoiding substitution
6980 @section Avoiding substitution
6981
6982 Keyword substitution has its disadvantages.  Sometimes
6983 you might want the literal text string
6984 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
6985 @sc{cvs} interpreting it as a keyword and expanding it
6986 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
6987
6988 There is unfortunately no way to selectively turn off
6989 keyword substitution.  You can use @samp{-ko}
6990 (@pxref{Substitution modes}) to turn off keyword
6991 substitution entirely.
6992
6993 In many cases you can avoid using keywords in
6994 the source, even though they appear in the final
6995 product.  For example, the source for this manual
6996 contains @samp{$@@asis@{@}Author$} whenever the text
6997 @samp{$@splitrcskeyword{Author}$} should appear.  In @code{nroff}
6998 and @code{troff} you can embed the null-character
6999 @code{\&} inside the keyword for a similar effect.
7000
7001 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7002 @node Substitution modes
7003 @section Substitution modes
7004 @cindex Keyword substitution, changing modes
7005 @cindex -k (keyword substitution)
7006 @cindex Kflag
7007
7008 @c FIXME: This could be made more coherent, by expanding it
7009 @c with more examples or something.
7010 Each file has a stored default substitution mode, and
7011 each working directory copy of a file also has a
7012 substitution mode.  The former is set by the @samp{-k}
7013 option to @code{cvs add} and @code{cvs admin}; the
7014 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7015 checkout} or @code{cvs update}.
7016 @code{cvs diff} and @code{cvs rdiff} also
7017 have @samp{-k} options.
7018 For some examples,
7019 see @ref{Binary files}, and @ref{Merging and keywords}.
7020 @c The fact that -A is overloaded to mean both reset
7021 @c sticky options and reset sticky tags/dates is
7022 @c somewhat questionable.  Perhaps there should be
7023 @c separate options to reset sticky options (e.g. -k
7024 @c A") and tags/dates (someone suggested -r HEAD could
7025 @c do this instead of setting a sticky tag of "HEAD"
7026 @c as in the status quo but I haven't thought much
7027 @c about that idea.  Of course -r .reset or something
7028 @c could be coined if this needs to be a new option).
7029 @c On the other hand, having -A mean "get things back
7030 @c into the state after a fresh checkout" has a certain
7031 @c appeal, and maybe there is no sufficient reason for
7032 @c creeping featurism in this area.
7033
7034 The modes available are:
7035
7036 @table @samp
7037 @item -kkv
7038 Generate keyword strings using the default form, e.g.
7039 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7040 keyword.
7041
7042 @item -kkvl
7043 Like @samp{-kkv}, except that a locker's name is always
7044 inserted if the given revision is currently locked.
7045 The locker's name is only relevant if @code{cvs admin
7046 -l} is in use.
7047
7048 @item -kk
7049 Generate only keyword names in keyword strings; omit
7050 their values.  For example, for the @code{Revision}
7051 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7052 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.  This option
7053 is useful to ignore differences due to keyword
7054 substitution when comparing different revisions of a
7055 file (@pxref{Merging and keywords}).
7056
7057 @item -ko
7058 Generate the old keyword string, present in the working
7059 file just before it was checked in.  For example, for
7060 the @code{Revision} keyword, generate the string
7061 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7062 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7063 string appeared when the file was checked in.
7064
7065 @item -kb
7066 Like @samp{-ko}, but also inhibit conversion of line
7067 endings between the canonical form in which they are
7068 stored in the repository (linefeed only), and the form
7069 appropriate to the operating system in use on the
7070 client.  For systems, like unix, which use linefeed
7071 only to terminate lines, this is the same as
7072 @samp{-ko}.  For more information on binary files, see
7073 @ref{Binary files}.
7074
7075 @item -kv
7076 Generate only keyword values for keyword strings.  For
7077 example, for the @code{Revision} keyword, generate the string
7078 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7079 This can help generate files in programming languages
7080 where it is hard to strip keyword delimiters like
7081 @code{$@splitrcskeyword{Revision}: $} from a string.  However,
7082 further keyword substitution cannot be performed once
7083 the keyword names are removed, so this option should be
7084 used with care.
7085
7086 One often would like to use @samp{-kv} with @code{cvs
7087 export}---@pxref{export}.  But be aware that doesn't
7088 handle an export containing binary files correctly.
7089
7090 @end table
7091
7092 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7093 @node Log keyword
7094 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7095
7096 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7097 controversial.  As long as you are working on your
7098 development system the information is easily accessible
7099 even if you do not use the @code{$@splitrcskeyword{Log}$}
7100 keyword---just do a @code{cvs log}.  Once you export
7101 the file the history information might be useless
7102 anyhow.
7103
7104 A more serious concern is that @sc{cvs} is not good at
7105 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7106 merged onto the main trunk.  Conflicts often result
7107 from the merging operation.
7108 @c Might want to check whether the CVS implementation
7109 @c of RCS_merge has this problem the same way rcsmerge
7110 @c does.  I would assume so....
7111
7112 People also tend to "fix" the log entries in the file
7113 (correcting spelling mistakes and maybe even factual
7114 errors).  If that is done the information from
7115 @code{cvs log} will not be consistent with the
7116 information inside the file.  This may or may not be a
7117 problem in real life.
7118
7119 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7120 keyword should be inserted @emph{last} in the file, and
7121 not in the files header, if it is to be used at all.
7122 That way the long list of change messages will not
7123 interfere with everyday source file browsing.
7124
7125 @c ---------------------------------------------------------------------
7126 @node Tracking sources
7127 @chapter Tracking third-party sources
7128 @cindex Third-party sources
7129 @cindex Tracking sources
7130
7131 @c FIXME: Need discussion of added and removed files.
7132 @c FIXME: This doesn't really adequately introduce the
7133 @c concepts of "vendor" and "you".  They don't *have*
7134 @c to be separate organizations or separate people.
7135 @c We want a description which is somewhat more based on
7136 @c the technical issues of which sources go where, but
7137 @c also with enough examples of how this relates to
7138 @c relationships like customer-supplier, developer-QA,
7139 @c maintainer-contributor, or whatever, to make it
7140 @c seem concrete.
7141 If you modify a program to better fit your site, you
7142 probably want to include your modifications when the next
7143 release of the program arrives.  @sc{cvs} can help you with
7144 this task.
7145
7146 @cindex Vendor
7147 @cindex Vendor branch
7148 @cindex Branch, vendor-
7149 In the terminology used in @sc{cvs}, the supplier of the
7150 program is called a @dfn{vendor}.  The unmodified
7151 distribution from the vendor is checked in on its own
7152 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
7153 1.1.1 for this use.
7154
7155 When you modify the source and commit it, your revision
7156 will end up on the main trunk.  When a new release is
7157 made by the vendor, you commit it on the vendor branch
7158 and copy the modifications onto the main trunk.
7159
7160 Use the @code{import} command to create and update
7161 the vendor branch.  When you import a new file,
7162 the vendor branch is made the `head' revision, so
7163 anyone that checks out a copy of the file gets that
7164 revision.  When a local modification is committed it is
7165 placed on the main trunk, and made the `head'
7166 revision.
7167
7168 @menu
7169 * First import::                Importing for the first time
7170 * Update imports::              Updating with the import command
7171 * Reverting local changes::     Reverting to the latest vendor release
7172 * Binary files in imports::     Binary files require special handling
7173 * Keywords in imports::         Keyword substitution might be undesirable
7174 * Multiple vendor branches::    What if you get sources from several places?
7175 @end menu
7176
7177 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7178 @node First import
7179 @section Importing for the first time
7180 @cindex Importing modules
7181
7182 @c Should mention naming conventions for vendor tags,
7183 @c release tags, and perhaps directory names.
7184 Use the @code{import} command to check in the sources
7185 for the first time.  When you use the @code{import}
7186 command to track third-party sources, the @dfn{vendor
7187 tag} and @dfn{release tags} are useful.  The
7188 @dfn{vendor tag} is a symbolic name for the branch
7189 (which is always 1.1.1, unless you use the @samp{-b
7190 @var{branch}} flag---see @ref{Multiple vendor branches}.).  The
7191 @dfn{release tags} are symbolic names for a particular
7192 release, such as @samp{FSF_0_04}.
7193
7194 @c I'm not completely sure this belongs here.  But
7195 @c we need to say it _somewhere_ reasonably obvious; it
7196 @c is a common misconception among people first learning CVS
7197 Note that @code{import} does @emph{not} change the
7198 directory in which you invoke it.  In particular, it
7199 does not set up that directory as a @sc{cvs} working
7200 directory; if you want to work with the sources import
7201 them first and then check them out into a different
7202 directory (@pxref{Getting the source}).
7203
7204 @cindex wdiff (import example)
7205 Suppose you have the sources to a program called
7206 @code{wdiff} in a directory @file{wdiff-0.04},
7207 and are going to make private modifications that you
7208 want to be able to use even when new releases are made
7209 in the future.  You start by importing the source to
7210 your repository:
7211
7212 @example
7213 $ cd wdiff-0.04
7214 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7215 @end example
7216
7217 The vendor tag is named @samp{FSF_DIST} in the above
7218 example, and the only release tag assigned is
7219 @samp{WDIFF_0_04}.
7220 @c FIXME: Need to say where fsf/wdiff comes from.
7221
7222 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7223 @node Update imports
7224 @section Updating with the import command
7225
7226 When a new release of the source arrives, you import it into the
7227 repository with the same @code{import} command that you used to set up
7228 the repository in the first place.  The only difference is that you
7229 specify a different release tag this time:
7230
7231 @example
7232 $ tar xfz wdiff-0.05.tar.gz
7233 $ cd wdiff-0.05
7234 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7235 @end example
7236
7237 @strong{WARNING: If you use a release tag that already exists in one of the
7238 repository archives, files removed by an import may not be detected.}
7239
7240 For files that have not been modified locally, the newly created
7241 revision becomes the head revision.  If you have made local
7242 changes, @code{import} will warn you that you must merge the changes
7243 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7244
7245 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7246 @c "import"?  I think the assumption is that one has
7247 @c "wdiff fsf/wdiff" or some such in modules, but it
7248 @c would be better to not use modules in this example.
7249 @example
7250 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7251 @end example
7252
7253 @noindent
7254 The above command will check out the latest revision of
7255 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7256 since yesterday into the working copy.  If any conflicts arise during
7257 the merge they should be resolved in the normal way (@pxref{Conflicts
7258 example}).  Then, the modified files may be committed.
7259
7260 However, it is much better to use the two release tags rather than using
7261 a date on the branch as suggested above:
7262
7263 @example
7264 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7265 @end example
7266
7267 @noindent
7268 The reason this is better is that
7269 using a date, as suggested above, assumes that you do
7270 not import more than one release of a product per day.
7271 More importantly, using the release tags allows @sc{cvs} to detect files
7272 that were removed between the two vendor releases and mark them for
7273 removal.  Since @code{import} has no way to detect removed files, you
7274 should do a merge like this even if @code{import} doesn't tell you to.
7275
7276 @node Reverting local changes
7277 @section Reverting to the latest vendor release
7278
7279 You can also revert local changes completely and return
7280 to the latest vendor release by changing the `head'
7281 revision back to the vendor branch on all files.  For
7282 example, if you have a checked-out copy of the sources
7283 in @file{~/work.d/wdiff}, and you want to revert to the
7284 vendor's version for all the files in that directory,
7285 you would type:
7286
7287 @example
7288 $ cd ~/work.d/wdiff
7289 $ cvs admin -bFSF_DIST .
7290 @end example
7291
7292 @noindent
7293 You must specify the @samp{-bFSF_DIST} without any space
7294 after the @samp{-b}.  @xref{admin options}.
7295
7296 @node Binary files in imports
7297 @section How to handle binary files with cvs import
7298
7299 Use the @samp{-k} wrapper option to tell import which
7300 files are binary.  @xref{Wrappers}.
7301
7302 @node Keywords in imports
7303 @section How to handle keyword substitution with cvs import
7304
7305 The sources which you are importing may contain
7306 keywords (@pxref{Keyword substitution}).  For example,
7307 the vendor may use @sc{cvs} or some other system
7308 which uses similar keyword expansion syntax.  If you
7309 just import the files in the default fashion, then
7310 the keyword expansions supplied by the vendor will
7311 be replaced by keyword expansions supplied by your
7312 own copy of @sc{cvs}.  It may be more convenient to
7313 maintain the expansions supplied by the vendor, so
7314 that this information can supply information about
7315 the sources that you imported from the vendor.
7316
7317 To maintain the keyword expansions supplied by the
7318 vendor, supply the @samp{-ko} option to @code{cvs
7319 import} the first time you import the file.
7320 This will turn off keyword expansion
7321 for that file entirely, so if you want to be more
7322 selective you'll have to think about what you want
7323 and use the @samp{-k} option to @code{cvs update} or
7324 @code{cvs admin} as appropriate.
7325 @c Supplying -ko to import if the file already existed
7326 @c has no effect.  Not clear to me whether it should
7327 @c or not.
7328
7329 @node Multiple vendor branches
7330 @section Multiple vendor branches
7331
7332 All the examples so far assume that there is only one
7333 vendor from which you are getting sources.  In some
7334 situations you might get sources from a variety of
7335 places.  For example, suppose that you are dealing with
7336 a project where many different people and teams are
7337 modifying the software.  There are a variety of ways to
7338 handle this, but in some cases you have a bunch of
7339 source trees lying around and what you want to do more
7340 than anything else is just to all put them in @sc{cvs} so
7341 that you at least have them in one place.
7342
7343 For handling situations in which there may be more than
7344 one vendor, you may specify the @samp{-b} option to
7345 @code{cvs import}.  It takes as an argument the vendor
7346 branch to import to.  The default is @samp{-b 1.1.1}.
7347
7348 For example, suppose that there are two teams, the red
7349 team and the blue team, that are sending you sources.
7350 You want to import the red team's efforts to branch
7351 1.1.1 and use the vendor tag RED.  You want to import
7352 the blue team's efforts to branch 1.1.3 and use the
7353 vendor tag BLUE.  So the commands you might use are:
7354
7355 @example
7356 $ cvs import dir RED RED_1-0
7357 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7358 @end example
7359
7360 Note that if your vendor tag does not match your
7361 @samp{-b} option, @sc{cvs} will not detect this case!  For
7362 example,
7363
7364 @example
7365 $ cvs import -b 1.1.3 dir RED RED_1-0
7366 @end example
7367
7368 @noindent
7369 Be careful; this kind of mismatch is sure to sow
7370 confusion or worse.  I can't think of a useful purpose
7371 for the ability to specify a mismatch here, but if you
7372 discover such a use, don't.  @sc{cvs} is likely to make this
7373 an error in some future release.
7374
7375 @c Probably should say more about the semantics of
7376 @c multiple branches.  What about the default branch?
7377 @c What about joining (perhaps not as useful with
7378 @c multiple branches, or perhaps it is.  Either way
7379 @c should be mentioned).
7380
7381 @c I'm not sure about the best location for this.  In
7382 @c one sense, it might belong right after we've introduced
7383 @c CVS's basic version control model, because people need
7384 @c to figure out builds right away.  The current location
7385 @c is based on the theory that it kind of akin to the
7386 @c "Revision management" section.
7387 @node Builds
7388 @chapter How your build system interacts with CVS
7389 @cindex Builds
7390 @cindex make
7391
7392 As mentioned in the introduction, @sc{cvs} does not
7393 contain software for building your software from source
7394 code.  This section describes how various aspects of
7395 your build system might interact with @sc{cvs}.
7396
7397 @c Is there a way to discuss this without reference to
7398 @c tools other than CVS?  I'm not sure there is; I
7399 @c wouldn't think that people who learn CVS first would
7400 @c even have this concern.
7401 One common question, especially from people who are
7402 accustomed to @sc{rcs}, is how to make their build get
7403 an up to date copy of the sources.  The answer to this
7404 with @sc{cvs} is two-fold.  First of all, since
7405 @sc{cvs} itself can recurse through directories, there
7406 is no need to modify your @file{Makefile} (or whatever
7407 configuration file your build tool uses) to make sure
7408 each file is up to date.  Instead, just use two
7409 commands, first @code{cvs -q update} and then
7410 @code{make} or whatever the command is to invoke your
7411 build tool.  Secondly, you do not necessarily
7412 @emph{want} to get a copy of a change someone else made
7413 until you have finished your own work.  One suggested
7414 approach is to first update your sources, then
7415 implement, build and
7416 test the change you were thinking of, and then commit
7417 your sources (updating first if necessary).  By
7418 periodically (in between changes, using the approach
7419 just described) updating your entire tree, you ensure
7420 that your sources are sufficiently up to date.
7421
7422 @cindex Bill of materials
7423 One common need is to record which versions of which
7424 source files went into a particular build.  This kind
7425 of functionality is sometimes called @dfn{bill of
7426 materials} or something similar.  The best way to do
7427 this with @sc{cvs} is to use the @code{tag} command to
7428 record which versions went into a given build
7429 (@pxref{Tags}).
7430
7431 Using @sc{cvs} in the most straightforward manner
7432 possible, each developer will have a copy of the entire
7433 source tree which is used in a particular build.  If
7434 the source tree is small, or if developers are
7435 geographically dispersed, this is the preferred
7436 solution.  In fact one approach for larger projects is
7437 to break a project down into smaller
7438 @c I say subsystem instead of module because they may or
7439 @c may not use the modules file.
7440 separately-compiled subsystems, and arrange a way of
7441 releasing them internally so that each developer need
7442 check out only those subsystems which they are
7443 actively working on.
7444
7445 Another approach is to set up a structure which allows
7446 developers to have their own copies of some files, and
7447 for other files to access source files from a central
7448 location.  Many people have come up with some such a
7449 @c two such people are paul@sander.cupertino.ca.us (for
7450 @c a previous employer)
7451 @c and gunnar.tornblom@se.abb.com (spicm and related tools),
7452 @c but as far as I know
7453 @c no one has nicely packaged or released such a system (or
7454 @c instructions for constructing one).
7455 system using features such as the symbolic link feature
7456 found in many operating systems, or the @code{VPATH}
7457 feature found in many versions of @code{make}.  One build
7458 tool which is designed to help with this kind of thing
7459 is Odin (see
7460 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
7461 @c Should we be saying more about Odin?  Or how you use
7462 @c it with CVS?  Also, the Prime Time Freeware for Unix
7463 @c disk (see http://www.ptf.com/) has Odin (with a nice
7464 @c paragraph summarizing it on the web), so that might be a
7465 @c semi-"official" place to point people.
7466 @c
7467 @c Of course, many non-CVS systems have this kind of
7468 @c functionality, for example OSF's ODE
7469 @c (http://www.osf.org/ode/) or mk
7470 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
7471 @c He has changed providers in the past; a search engine search
7472 @c for "Peter Ziobrzynski" probably won't get too many
7473 @c spurious hits :-).  A more stable URL might be
7474 @c ftp://ftp.uu.net/pub/cmvc/mk).  But I'm not sure
7475 @c there is any point in mentioning them here unless they
7476 @c can work with CVS.
7477
7478 @c ---------------------------------------------------------------------
7479 @node Special Files
7480 @chapter Special Files
7481
7482 @cindex Special files
7483 @cindex Device nodes
7484 @cindex Ownership, saving in CVS
7485 @cindex Permissions, saving in CVS
7486 @cindex Hard links
7487 @cindex Symbolic links
7488
7489 In normal circumstances, @sc{cvs} works only with regular
7490 files.  Every file in a project is assumed to be
7491 persistent; it must be possible to open, read and close
7492 them; and so on.  @sc{cvs} also ignores file permissions and
7493 ownerships, leaving such issues to be resolved by the
7494 developer at installation time.  In other words, it is
7495 not possible to "check in" a device into a repository;
7496 if the device file cannot be opened, @sc{cvs} will refuse to
7497 handle it.  Files also lose their ownerships and
7498 permissions during repository transactions.
7499
7500 @ignore
7501 If the configuration variable @code{PreservePermissions}
7502 (@pxref{config}) is set in the repository, @sc{cvs} will
7503 save the following file characteristics in the
7504 repository:
7505
7506 @itemize @bullet
7507 @item user and group ownership
7508 @item permissions
7509 @item major and minor device numbers
7510 @item symbolic links
7511 @item hard link structure
7512 @end itemize
7513
7514 Using the @code{PreservePermissions} option affects the
7515 behavior of @sc{cvs} in several ways.  First, some of the
7516 new operations supported by @sc{cvs} are not accessible to
7517 all users.  In particular, file ownership and special
7518 file characteristics may only be changed by the
7519 superuser.  When the @code{PreservePermissions}
7520 configuration variable is set, therefore, users will
7521 have to be `root' in order to perform @sc{cvs} operations.
7522
7523 When @code{PreservePermissions} is in use, some @sc{cvs}
7524 operations (such as @samp{cvs status}) will not
7525 recognize a file's hard link structure, and so will
7526 emit spurious warnings about mismatching hard links.
7527 The reason is that @sc{cvs}'s internal structure does not
7528 make it easy for these operations to collect all the
7529 necessary data about hard links, so they check for file
7530 conflicts with inaccurate data.
7531
7532 A more subtle difference is that @sc{cvs} considers a file
7533 to have changed only if its contents have changed
7534 (specifically, if the modification time of the working
7535 file does not match that of the repository's file).
7536 Therefore, if only the permissions, ownership or hard
7537 linkage have changed, or if a device's major or minor
7538 numbers have changed, @sc{cvs} will not notice.  In order to
7539 commit such a change to the repository, you must force
7540 the commit with @samp{cvs commit -f}.  This also means
7541 that if a file's permissions have changed and the
7542 repository file is newer than the working copy,
7543 performing @samp{cvs update} will silently change the
7544 permissions on the working copy.
7545
7546 Changing hard links in a @sc{cvs} repository is particularly
7547 delicate.  Suppose that file @file{foo} is linked to
7548 file @file{old}, but is later relinked to file
7549 @file{new}.  You can wind up in the unusual situation
7550 where, although @file{foo}, @file{old} and @file{new}
7551 have all had their underlying link patterns changed,
7552 only @file{foo} and @file{new} have been modified, so
7553 @file{old} is not considered a candidate for checking
7554 in.  It can be very easy to produce inconsistent
7555 results this way.  Therefore, we recommend that when it
7556 is important to save hard links in a repository, the
7557 prudent course of action is to @code{touch} any file
7558 whose linkage or status has changed since the last
7559 checkin.  Indeed, it may be wise to @code{touch *}
7560 before each commit in a directory with complex hard
7561 link structures.
7562
7563 It is worth noting that only regular files may
7564 be merged, for reasons that hopefully are obvious.  If
7565 @samp{cvs update} or @samp{cvs checkout -j} attempts to
7566 merge a symbolic link with a regular file, or two
7567 device files for different kinds of devices, @sc{cvs} will
7568 report a conflict and refuse to perform the merge.  At
7569 the same time, @samp{cvs diff} will not report any
7570 differences between these files, since no meaningful
7571 textual comparisons can be made on files which contain
7572 no text.
7573
7574 The @code{PreservePermissions} features do not work
7575 with client/server @sc{cvs}.  Another limitation is
7576 that hard links must be to other files within the same
7577 directory; hard links across directories are not
7578 supported.
7579 @end ignore
7580
7581 @c ---------------------------------------------------------------------
7582 @c ----- START MAN 1 -----
7583 @node CVS commands
7584 @appendix Guide to CVS commands
7585
7586 This appendix describes the overall structure of
7587 @sc{cvs} commands, and describes some commands in
7588 detail (others are described elsewhere; for a quick
7589 reference to @sc{cvs} commands, @pxref{Invoking CVS}).
7590 @c The idea is that we want to move the commands which
7591 @c are described here into the main body of the manual,
7592 @c in the process reorganizing the manual to be
7593 @c organized around what the user wants to do, not
7594 @c organized around CVS commands.
7595 @c
7596 @c Note that many users do expect a manual which is
7597 @c organized by command.  At least some users do.
7598 @c One good addition to the "organized by command"
7599 @c section (if any) would be "see also" links.
7600 @c The awk manual might be a good example; it has a
7601 @c reference manual which is more verbose than Invoking
7602 @c CVS but probably somewhat less verbose than CVS
7603 @c Commands.
7604
7605 @menu
7606 * Structure::                   Overall structure of CVS commands
7607 * Exit status::                 Indicating CVS's success or failure
7608 * ~/.cvsrc::                    Default options with the ~/.cvsrc file
7609 * Global options::              Options you give to the left of cvs_command
7610 * Common options::              Options you give to the right of cvs_command
7611 * admin::                       Administration
7612 * annotate::                    What revision modified each line of a file?
7613 * checkout::                    Checkout sources for editing
7614 * commit::                      Check files into the repository
7615 * diff::                        Show differences between revisions
7616 * export::                      Export sources from CVS, similar to checkout
7617 * history::                     Show status of files and users
7618 * import::                      Import sources into CVS, using vendor branches
7619 * log::                         Show log messages for files
7620 * rdiff::                       'patch' format diffs between releases
7621 * release::                     Indicate that a directory is no longer in use
7622 * update::                      Bring work tree in sync with repository
7623 @end menu
7624
7625 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7626 @node Structure
7627 @appendixsec Overall structure of CVS commands
7628 @cindex Structure
7629 @cindex CVS command structure
7630 @cindex Command structure
7631 @cindex Format of CVS commands
7632
7633 The overall format of all @sc{cvs} commands is:
7634
7635 @example
7636 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
7637 @end example
7638
7639 @table @code
7640 @item cvs
7641 The name of the @sc{cvs} program.
7642
7643 @item cvs_options
7644 Some options that affect all sub-commands of @sc{cvs}.  These are
7645 described below.
7646
7647 @item cvs_command
7648 One of several different sub-commands.  Some of the commands have
7649 aliases that can be used instead; those aliases are noted in the
7650 reference manual for that command.  There are only two situations
7651 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
7652 list of available commands, and @samp{cvs -v} displays version
7653 information on @sc{cvs} itself.
7654
7655 @item command_options
7656 Options that are specific for the command.
7657
7658 @item command_args
7659 Arguments to the commands.
7660 @end table
7661
7662 There is unfortunately some confusion between
7663 @code{cvs_options} and @code{command_options}.
7664 When given as a @code{cvs_option}, some options only
7665 affect some of the commands.  When given as a
7666 @code{command_option} it may have a different meaning, and
7667 be accepted by more commands.  In other words, do not
7668 take the above categorization too seriously.  Look at
7669 the documentation instead.
7670
7671 @node Exit status
7672 @appendixsec CVS's exit status
7673 @cindex Exit status, of CVS
7674
7675 @sc{cvs} can indicate to the calling environment whether it
7676 succeeded or failed by setting its @dfn{exit status}.
7677 The exact way of testing the exit status will vary from
7678 one operating system to another.  For example in a unix
7679 shell script the @samp{$?} variable will be 0 if the
7680 last command returned a successful exit status, or
7681 greater than 0 if the exit status indicated failure.
7682
7683 If @sc{cvs} is successful, it returns a successful status;
7684 if there is an error, it prints an error message and
7685 returns a failure status.  The one exception to this is
7686 the @code{cvs diff} command.  It will return a
7687 successful status if it found no differences, or a
7688 failure status if there were differences or if there
7689 was an error.  Because this behavior provides no good
7690 way to detect errors, in the future it is possible that
7691 @code{cvs diff} will be changed to behave like the
7692 other @sc{cvs} commands.
7693 @c It might seem like checking whether cvs -q diff
7694 @c produces empty or non-empty output can tell whether
7695 @c there were differences or not.  But it seems like
7696 @c there are cases with output but no differences
7697 @c (testsuite basica-8b).  It is not clear to me how
7698 @c useful it is for a script to be able to check
7699 @c whether there were differences.
7700 @c FIXCVS? In previous versions of CVS, cvs diff
7701 @c returned 0 for no differences, 1 for differences, or
7702 @c 2 for errors.  Is this behavior worth trying to
7703 @c bring back (but what does it mean for VMS?)?
7704
7705 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7706 @node ~/.cvsrc
7707 @appendixsec Default options and the ~/.cvsrc file
7708 @cindex .cvsrc file
7709 @cindex Option defaults
7710
7711 There are some @code{command_options} that are used so
7712 often that you might have set up an alias or some other
7713 means to make sure you always specify that option.  One
7714 example (the one that drove the implementation of the
7715 @file{.cvsrc} support, actually) is that many people find the
7716 default output of the @samp{diff} command to be very
7717 hard to read, and that either context diffs or unidiffs
7718 are much easier to understand.
7719
7720 The @file{~/.cvsrc} file is a way that you can add
7721 default options to @code{cvs_commands} within cvs,
7722 instead of relying on aliases or other shell scripts.
7723
7724 The format of the @file{~/.cvsrc} file is simple.  The
7725 file is searched for a line that begins with the same
7726 name as the @code{cvs_command} being executed.  If a
7727 match is found, then the remainder of the line is split
7728 up (at whitespace characters) into separate options and
7729 added to the command arguments @emph{before} any
7730 options from the command line.
7731
7732 If a command has two names (e.g., @code{checkout} and
7733 @code{co}), the official name, not necessarily the one
7734 used on the command line, will be used to match against
7735 the file.  So if this is the contents of the user's
7736 @file{~/.cvsrc} file:
7737
7738 @example
7739 log -N
7740 diff -uN
7741 rdiff -u
7742 update -Pd
7743 checkout -P
7744 release -d
7745 @end example
7746
7747 @noindent
7748 the command @samp{cvs checkout foo} would have the
7749 @samp{-P} option added to the arguments, as well as
7750 @samp{cvs co foo}.
7751
7752 With the example file above, the output from @samp{cvs
7753 diff foobar} will be in unidiff format.  @samp{cvs diff
7754 -c foobar} will provide context diffs, as usual.
7755 Getting "old" format diffs would be slightly more
7756 complicated, because @code{diff} doesn't have an option
7757 to specify use of the "old" format, so you would need
7758 @samp{cvs -f diff foobar}.
7759
7760 In place of the command name you can use @code{cvs} to
7761 specify global options (@pxref{Global options}).  For
7762 example the following line in @file{.cvsrc}
7763
7764 @example
7765 cvs -z6
7766 @end example
7767
7768 @noindent
7769 causes @sc{cvs} to use compression level 6.
7770
7771 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7772 @node Global options
7773 @appendixsec Global options
7774 @cindex Options, global
7775 @cindex Global options
7776 @cindex Left-hand options
7777
7778 The available @samp{cvs_options} (that are given to the
7779 left of @samp{cvs_command}) are:
7780
7781 @table @code
7782 @item --allow-root=@var{rootdir}
7783 Specify legal @sc{cvsroot} directory.  See
7784 @ref{Password authentication server}.
7785
7786 @cindex Authentication, stream
7787 @cindex Stream authentication
7788 @item -a
7789 Authenticate all communication between the client and
7790 the server.  Only has an effect on the @sc{cvs} client.
7791 As of this writing, this is only implemented when using
7792 a GSSAPI connection (@pxref{GSSAPI authenticated}).
7793 Authentication prevents certain sorts of attacks
7794 involving hijacking the active @sc{tcp} connection.
7795 Enabling authentication does not enable encryption.
7796
7797 @cindex RCSBIN, overriding
7798 @cindex Overriding RCSBIN
7799 @item -b @var{bindir}
7800 In @sc{cvs} 1.9.18 and older, this specified that
7801 @sc{rcs} programs are in the @var{bindir} directory.
7802 Current versions of @sc{cvs} do not run @sc{rcs}
7803 programs; for compatibility this option is accepted,
7804 but it does nothing.
7805
7806 @cindex TMPDIR, overriding
7807 @cindex Overriding TMPDIR
7808 @item -T @var{tempdir}
7809 Use @var{tempdir} as the directory where temporary files are
7810 located.  Overrides the setting of the @code{$TMPDIR} environment
7811 variable and any precompiled directory.  This parameter should be
7812 specified as an absolute pathname.
7813 (When running client/server, @samp{-T} affects only the local process;
7814 specifying @samp{-T} for the client has no effect on the server and
7815 vice versa.)
7816
7817 @cindex CVSROOT, overriding
7818 @cindex Overriding CVSROOT
7819 @item -d @var{cvs_root_directory}
7820 Use @var{cvs_root_directory} as the root directory
7821 pathname of the repository.  Overrides the setting of
7822 the @code{$CVSROOT} environment variable.  @xref{Repository}.
7823
7824 @cindex EDITOR, overriding
7825 @cindex Overriding EDITOR
7826 @item -e @var{editor}
7827 Use @var{editor} to enter revision log information.  Overrides the
7828 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
7829 environment variables.  For more information, see
7830 @ref{Committing your changes}.
7831
7832 @item -f
7833 Do not read the @file{~/.cvsrc} file.  This
7834 option is most often used because of the
7835 non-orthogonality of the @sc{cvs} option set.  For
7836 example, the @samp{cvs log} option @samp{-N} (turn off
7837 display of tag names) does not have a corresponding
7838 option to turn the display on.  So if you have
7839 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
7840 you may need to use @samp{-f} to show the tag names.
7841
7842 @item -H
7843 @itemx --help
7844 Display usage information about the specified @samp{cvs_command}
7845 (but do not actually execute the command).  If you don't specify
7846 a command name, @samp{cvs -H} displays overall help for
7847 @sc{cvs}, including a list of other help options.
7848 @c It seems to me it is better to document it this way
7849 @c rather than trying to update this documentation
7850 @c every time that we add a --help-foo option.  But
7851 @c perhaps that is confusing...
7852
7853 @cindex Read-only mode
7854 @item -n
7855 Do not change any files.  Attempt to execute the
7856 @samp{cvs_command}, but only to issue reports; do not remove,
7857 update, or merge any existing files, or create any new files.
7858
7859 Note that @sc{cvs} will not necessarily produce exactly
7860 the same output as without @samp{-n}.  In some cases
7861 the output will be the same, but in other cases
7862 @sc{cvs} will skip some of the processing that would
7863 have been required to produce the exact same output.
7864
7865 @item -Q
7866 Cause the command to be really quiet; the command will only
7867 generate output for serious problems.
7868
7869 @item -q
7870 Cause the command to be somewhat quiet; informational messages,
7871 such as reports of recursion through subdirectories, are
7872 suppressed.
7873
7874 @cindex Read-only files, and -r
7875 @item -r
7876 Make new working files read-only.  Same effect
7877 as if the @code{$CVSREAD} environment variable is set
7878 (@pxref{Environment variables}).  The default is to
7879 make working files writable, unless watches are on
7880 (@pxref{Watches}).
7881
7882 @item -s @var{variable}=@var{value}
7883 Set a user variable (@pxref{Variables}).
7884
7885 @cindex Trace
7886 @item -t
7887 Trace program execution; display messages showing the steps of
7888 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
7889 potential impact of an unfamiliar command.
7890
7891 @item -v
7892 @item --version
7893 Display version and copyright information for @sc{cvs}.
7894
7895 @cindex CVSREAD, overriding
7896 @cindex Overriding CVSREAD
7897 @item -w
7898 Make new working files read-write.  Overrides the
7899 setting of the @code{$CVSREAD} environment variable.
7900 Files are created read-write by default, unless @code{$CVSREAD} is
7901 set or @samp{-r} is given.
7902 @c Note that -w only overrides -r and CVSREAD; it has
7903 @c no effect on files which are readonly because of
7904 @c "cvs watch on".  My guess is that is the way it
7905 @c should be (or should "cvs -w get" on a watched file
7906 @c be the same as a get and a cvs edit?), but I'm not
7907 @c completely sure whether to document it this way.
7908
7909 @item -x
7910 @cindex Encryption
7911 Encrypt all communication between the client and the
7912 server.  Only has an effect on the @sc{cvs} client.  As
7913 of this writing, this is only implemented when using a
7914 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
7915 Kerberos connection (@pxref{Kerberos authenticated}).
7916 Enabling encryption implies that message traffic is
7917 also authenticated.  Encryption support is not
7918 available by default; it must be enabled using a
7919 special configure option, @file{--enable-encryption},
7920 when you build @sc{cvs}.
7921
7922 @item -z @var{gzip-level}
7923 @cindex Compression
7924 @cindex Gzip
7925 Set the compression level.
7926 Valid levels are 1 (high speed, low compression) to
7927 9 (low speed, high compression), or 0 to disable
7928 compression (the default).
7929 Only has an effect on the @sc{cvs} client.
7930
7931 @end table
7932
7933 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7934 @node Common options
7935 @appendixsec Common command options
7936 @cindex Common options
7937 @cindex Right-hand options
7938
7939 This section describes the @samp{command_options} that
7940 are available across several @sc{cvs} commands.  These
7941 options are always given to the right of
7942 @samp{cvs_command}. Not all
7943 commands support all of these options; each option is
7944 only supported for commands where it makes sense.
7945 However, when a command has one of these options you
7946 can almost always count on the same behavior of the
7947 option as in other commands.  (Other command options,
7948 which are listed with the individual commands, may have
7949 different behavior from one @sc{cvs} command to the other).
7950
7951 @strong{The @samp{history} command is an exception; it supports
7952 many options that conflict even with these standard options.}
7953
7954 @table @code
7955 @cindex Dates
7956 @cindex Time
7957 @cindex Specifying dates
7958 @item -D @var{date_spec}
7959 Use the most recent revision no later than @var{date_spec}.
7960 @var{date_spec} is a single argument, a date description
7961 specifying a date in the past.
7962
7963 The specification is @dfn{sticky} when you use it to make a
7964 private copy of a source file; that is, when you get a working
7965 file using @samp{-D}, @sc{cvs} records the date you specified, so that
7966 further updates in the same directory will use the same date
7967 (for more information on sticky tags/dates, @pxref{Sticky tags}).
7968
7969 @samp{-D} is available with the @code{annotate}, @code{checkout},
7970 @code{diff}, @code{export}, @code{history},
7971 @code{rdiff}, @code{rtag}, and @code{update} commands.
7972 (The @code{history} command uses this option in a
7973 slightly different way; @pxref{history options}).
7974
7975 @c What other formats should we accept?  I don't want
7976 @c to start accepting a whole mess of non-standard
7977 @c new formats (there are a lot which are in wide use in
7978 @c one context or another), but practicality does
7979 @c dictate some level of flexibility.
7980 @c * POSIX.2 (e.g. touch, ls output, date) and other
7981 @c POSIX and/or de facto unix standards (e.g. at).  The
7982 @c practice here is too inconsistent to be of any use.
7983 @c * VMS dates.  This is not a formal standard, but
7984 @c there is a published specification (see SYS$ASCTIM
7985 @c and SYS$BINTIM in the _VMS System Services Reference
7986 @c Manual_), it is implemented consistently in VMS
7987 @c utilities, and VMS users will expect CVS running on
7988 @c VMS to support this format (and if we're going to do
7989 @c that, better to make CVS support it on all
7990 @c platforms.  Maybe).
7991 @c
7992 @c NOTE: The tar manual has some documentation for
7993 @c getdate.y (just for our info; we don't want to
7994 @c attempt to document all the formats accepted by
7995 @c getdate.y).
7996 @c
7997 @c One more note: In output, CVS should consistently
7998 @c use one date format, and that format should be one that
7999 @c it accepts in input as well.  The former isn't
8000 @c really true (see survey below), and I'm not
8001 @c sure that either of those formats is accepted in
8002 @c input.
8003 @c
8004 @c cvs log
8005 @c   current 1996/01/02 13:45:31
8006 @c   Internet 02 Jan 1996 13:45:31 UT
8007 @c   ISO 1996-01-02 13:45:31
8008 @c cvs ann
8009 @c   current 02-Jan-96
8010 @c   Internet-like 02 Jan 96
8011 @c   ISO 96-01-02
8012 @c cvs status
8013 @c   current Tue Jun 11 02:54:53 1996
8014 @c   Internet [Tue,] 11 Jun 1996 02:54:53
8015 @c   ISO 1996-06-11 02:54:53
8016 @c   note: date possibly should be omitted entirely for
8017 @c   other reasons.
8018 @c cvs editors
8019 @c   current Tue Jun 11 02:54:53 1996 GMT
8020 @c cvs history
8021 @c   current 06/11 02:54 +0000
8022 @c any others?
8023 @c There is a good chance the proper solution has to
8024 @c involve at least some level of letting the user
8025 @c decide which format (with the default being the
8026 @c formats CVS has always used; changing these might be
8027 @c _very_ disruptive since scripts may very well be
8028 @c parsing them).
8029 @c
8030 @c Another random bit of prior art concerning dates is
8031 @c the strptime function which takes templates such as
8032 @c "%m/%d/%y", and apparent a variant of getdate()
8033 @c which also honors them.  See
8034 @c X/Open CAE Specification, System Interfaces and
8035 @c Headers Issue 4, Version 2 (September 1994), in the
8036 @c entry for getdate() on page 231
8037
8038 @cindex Timezone, in input
8039 @cindex Zone, time, in input
8040 A wide variety of date formats are supported by
8041 @sc{cvs}.  The most standard ones are ISO8601 (from the
8042 International Standards Organization) and the Internet
8043 e-mail standard (specified in RFC822 as amended by
8044 RFC1123).
8045
8046 @c Probably should be doing more to spell out just what
8047 @c the rules are, rather than just giving examples.
8048 @c But I want to keep this simple too.
8049 @c So I don't know....
8050 @c A few specific issues: (1) Maybe should reassure
8051 @c people that years after 2000
8052 @c work (they are in the testsuite, so they do indeed
8053 @c work).  (2) What do two digit years
8054 @c mean?  Where do we accept them?  (3) Local times can
8055 @c be ambiguous or nonexistent if they fall during the
8056 @c hour when daylight savings time goes into or out of
8057 @c effect.  Pretty obscure, so I'm not at all sure we
8058 @c should be documenting the behavior in that case.
8059 ISO8601 dates have many variants but a few examples
8060 are:
8061
8062 @example
8063 1972-09-24
8064 1972-09-24 20:05
8065 @end example
8066 @c I doubt we really accept all ISO8601 format dates
8067 @c (for example, decimal hours like 1972-09-24 20,2)
8068 @c I'm not sure we should, many of them are pretty
8069 @c bizarre and it has lots of gratuitous multiple ways
8070 @c to specify the same thing.
8071
8072 There are a lot more ISO8601 date formats, and @sc{cvs}
8073 accepts many of them, but you probably don't want to
8074 hear the @emph{whole} long story :-).
8075
8076 @c Citing a URL here is kind of problematic given how
8077 @c much they change and people who have old versions of
8078 @c this manual, but in case we want to reinstate an
8079 @c ISO8601 URL, a few are:
8080 @c http://www.saqqara.demon.co.uk/datefmt.htm
8081 @c http://www.cl.cam.ac.uk/~mgk25/iso-time.html
8082 @c Citing some other ISO8601 source is probably even
8083 @c worse :-).
8084
8085 In addition to the dates allowed in Internet e-mail
8086 itself, @sc{cvs} also allows some of the fields to be
8087 omitted.  For example:
8088 @c FIXME: Need to figure out better, and document,
8089 @c what we want to allow the user to omit.
8090 @c NOTE: "omit" does not imply "reorder".
8091 @c FIXME: Need to cite a web page describing how to get
8092 @c RFC's.
8093
8094 @example
8095 24 Sep 1972 20:05
8096 24 Sep
8097 @end example
8098
8099 The date is interpreted as being in the
8100 local timezone, unless a specific timezone is
8101 specified.
8102
8103 These two date formats are preferred.  However,
8104 @sc{cvs} currently accepts a wide variety of other date
8105 formats.  They are intentionally not documented here in
8106 any detail, and future versions of @sc{cvs} might not
8107 accept all of them.
8108 @c We should document and testsuite "now" and
8109 @c "yesterday".  "now" is mentioned in the FAQ and
8110 @c "yesterday" is mentioned in this document (and the
8111 @c message from "cvs import" suggesting a merge
8112 @c command).  What else?  Probably some/all of the "3
8113 @c weeks ago" family.
8114 @c
8115 @c Maybe at
8116 @c some point have CVS start give warnings on "unofficial"
8117 @c formats (many of which might be typos or user
8118 @c misunderstandings, and/or formats people never/rarely
8119 @c use to specify dates)?
8120
8121 One such format is
8122 @code{@var{month}/@var{day}/@var{year}}.  This may
8123 confuse people who are accustomed to having the month
8124 and day in the other order; @samp{1/4/96} is January 4,
8125 not April 1.
8126
8127 Remember to quote the argument to the @samp{-D}
8128 flag so that your shell doesn't interpret spaces as
8129 argument separators.  A command using the @samp{-D}
8130 flag can look like this:
8131
8132 @example
8133 $ cvs diff -D "1 hour ago" cvs.texinfo
8134 @end example
8135
8136 @cindex Forcing a tag match
8137 @item -f
8138 When you specify a particular date or tag to @sc{cvs} commands, they
8139 normally ignore files that do not contain the tag (or did not
8140 exist prior to the date) that you specified.  Use the @samp{-f} option
8141 if you want files retrieved even when there is no match for the
8142 tag or date.  (The most recent revision of the file
8143 will be used).
8144
8145 Note that even with @samp{-f}, a tag that you specify
8146 must exist (that is, in some file, not necessary in
8147 every file).  This is so that @sc{cvs} will continue to
8148 give an error if you mistype a tag name.
8149
8150 @need 800
8151 @samp{-f} is available with these commands:
8152 @code{annotate}, @code{checkout}, @code{export},
8153 @code{rdiff}, @code{rtag}, and @code{update}.
8154
8155 @strong{WARNING:  The @code{commit} and @code{remove}
8156 commands also have a
8157 @samp{-f} option, but it has a different behavior for
8158 those commands.  See @ref{commit options}, and
8159 @ref{Removing files}.}
8160
8161 @item -k @var{kflag}
8162 Alter the default processing of keywords.
8163 @xref{Keyword substitution}, for the meaning of
8164 @var{kflag}.  Your @var{kflag} specification is
8165 @dfn{sticky} when you use it to create a private copy
8166 of a source file; that is, when you use this option
8167 with the @code{checkout} or @code{update} commands,
8168 @sc{cvs} associates your selected @var{kflag} with the
8169 file, and continues to use it with future update
8170 commands on the same file until you specify otherwise.
8171
8172 The @samp{-k} option is available with the @code{add},
8173 @code{checkout}, @code{diff}, @code{rdiff}, @code{import} and
8174 @code{update} commands.
8175
8176 @item -l
8177 Local; run only in current working directory, rather than
8178 recursing through subdirectories.
8179
8180 Available with the following commands: @code{annotate}, @code{checkout},
8181 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8182 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8183 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8184 and @code{watchers}.
8185
8186 @cindex Editor, avoiding invocation of
8187 @cindex Avoiding editor invocation
8188 @item -m @var{message}
8189 Use @var{message} as log information, instead of
8190 invoking an editor.
8191
8192 Available with the following commands: @code{add},
8193 @code{commit} and @code{import}.
8194
8195 @item -n
8196 Do not run any tag program.  (A program can be
8197 specified to run in the modules
8198 database (@pxref{modules}); this option bypasses it).
8199
8200 @strong{This is not the same as the @samp{cvs -n}
8201 program option, which you can specify to the left of a cvs command!}
8202
8203 Available with the @code{checkout}, @code{export},
8204 and @code{rtag} commands.
8205
8206 @item -P
8207 Prune empty directories.  See @ref{Removing directories}.
8208
8209 @item -p
8210 Pipe the files retrieved from the repository to standard output,
8211 rather than writing them in the current directory.  Available
8212 with the @code{checkout} and @code{update} commands.
8213
8214 @item -R
8215 Process directories recursively.  This is on by default.
8216
8217 Available with the following commands: @code{annotate}, @code{checkout},
8218 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8219 @code{rdiff}, @code{remove}, @code{rtag},
8220 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8221 and @code{watchers}.
8222
8223 @item -r @var{tag}
8224 @cindex HEAD, special tag
8225 @cindex BASE, special tag
8226 Use the revision specified by the @var{tag} argument instead of the
8227 default @dfn{head} revision.  As well as arbitrary tags defined
8228 with the @code{tag} or @code{rtag} command, two special tags are
8229 always available: @samp{HEAD} refers to the most recent version
8230 available in the repository, and @samp{BASE} refers to the
8231 revision you last checked out into the current working directory.
8232
8233 @c FIXME: What does HEAD really mean?  I believe that
8234 @c the current answer is the head of the default branch
8235 @c for all cvs commands except diff.  For diff, it
8236 @c seems to be (a) the head of the trunk (or the default
8237 @c branch?) if there is no sticky tag, (b) the head of the
8238 @c branch for the sticky tag, if there is a sticky tag.
8239 @c (b) is ugly as it differs
8240 @c from what HEAD means for other commands, but people
8241 @c and/or scripts are quite possibly used to it.
8242 @c See "head" tests in sanity.sh.
8243 @c Probably the best fix is to introduce two new
8244 @c special tags, ".thead" for the head of the trunk,
8245 @c and ".bhead" for the head of the current branch.
8246 @c Then deprecate HEAD.  This has the advantage of
8247 @c not surprising people with a change to HEAD, and a
8248 @c side benefit of also phasing out the poorly-named
8249 @c HEAD (see discussion of reserved tag names in node
8250 @c "Tags").  Of course, .thead and .bhead should be
8251 @c carefully implemented (with the implementation the
8252 @c same for "diff" as for everyone else), test cases
8253 @c written (similar to the ones in "head"), new tests
8254 @c cases written for things like default branches, &c.
8255
8256 The tag specification is sticky when you use this
8257 @c option
8258 with @code{checkout} or @code{update} to make your own
8259 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8260 future update commands, until you specify otherwise (for more information
8261 on sticky tags/dates, @pxref{Sticky tags}).
8262
8263 The tag can be either a symbolic or numeric tag, as
8264 described in @ref{Tags}, or the name of a branch, as
8265 described in @ref{Branching and merging}.
8266 When a command expects a specific revision,
8267 the name of a branch is interpreted as the most recent
8268 revision on that branch.
8269
8270 Specifying the @samp{-q} global option along with the
8271 @samp{-r} command option is often useful, to suppress
8272 the warning messages when the @sc{rcs} file
8273 does not contain the specified tag.
8274
8275 @strong{This is not the same as the overall @samp{cvs -r} option,
8276 which you can specify to the left of a @sc{cvs} command!}
8277
8278 @samp{-r} is available with the @code{annotate}, @code{checkout},
8279 @code{commit}, @code{diff}, @code{history}, @code{export}, @code{rdiff}, 
8280 @code{rtag}, and @code{update} commands.
8281
8282 @item -W
8283 Specify file names that should be filtered.  You can
8284 use this option repeatedly.  The spec can be a file
8285 name pattern of the same type that you can specify in
8286 the @file{.cvswrappers} file.
8287 Available with the following commands: @code{import},
8288 and @code{update}.
8289
8290 @end table
8291
8292 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8293 @node admin
8294 @appendixsec admin---Administration
8295 @cindex Admin (subcommand)
8296
8297 @itemize @bullet
8298 @item
8299 Requires: repository, working directory.
8300 @item
8301 Changes: repository.
8302 @item
8303 Synonym: rcs
8304 @end itemize
8305
8306 This is the @sc{cvs} interface to assorted
8307 administrative facilities.  Some of them have
8308 questionable usefulness for @sc{cvs} but exist for
8309 historical purposes.  Some of the questionable options
8310 are likely to disappear in the future.  This command
8311 @emph{does} work recursively, so extreme care should be
8312 used.
8313
8314 @cindex cvsadmin
8315 On unix, if there is a group named @code{cvsadmin},
8316 only members of that group can run @code{cvs admin}
8317 (except for the @code{cvs admin -k} command, which can
8318 be run by anybody).  This group should exist on the
8319 server, or any system running the non-client/server
8320 @sc{cvs}.  To disallow @code{cvs admin} for all users,
8321 create a group with no users in it.  On NT, the
8322 @code{cvsadmin} feature does not exist and all users
8323 can run @code{cvs admin}.
8324
8325 @menu
8326 * admin options::               admin options
8327 @end menu
8328
8329 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8330 @node admin options
8331 @appendixsubsec admin options
8332
8333 Some of these options have questionable usefulness for
8334 @sc{cvs} but exist for historical purposes.  Some even
8335 make it impossible to use @sc{cvs} until you undo the
8336 effect!
8337
8338 @table @code
8339 @item -A@var{oldfile}
8340 Might not work together with @sc{cvs}.  Append the
8341 access list of @var{oldfile} to the access list of the
8342 @sc{rcs} file.
8343
8344 @item -a@var{logins}
8345 Might not work together with @sc{cvs}.  Append the
8346 login names appearing in the comma-separated list
8347 @var{logins} to the access list of the @sc{rcs} file.
8348
8349 @item -b[@var{rev}]
8350 Set the default branch to @var{rev}.  In @sc{cvs}, you
8351 normally do not manipulate default branches; sticky
8352 tags (@pxref{Sticky tags}) are a better way to decide
8353 which branch you want to work on.  There is one reason
8354 to run @code{cvs admin -b}: to revert to the vendor's
8355 version when using vendor branches (@pxref{Reverting
8356 local changes}).
8357 There can be no space between @samp{-b} and its argument.
8358 @c Hmm, we don't document the usage where rev is
8359 @c omitted.  Maybe that usage can/should be deprecated
8360 @c (and replaced with -bHEAD or something?) (so we can toss
8361 @c the optional argument).  Note that -bHEAD does not
8362 @c work, as of 17 Sep 1997, but probably will once "cvs
8363 @c admin" is internal to CVS.
8364
8365 @cindex Comment leader
8366 @item -c@var{string}
8367 Sets the comment leader to @var{string}.  The comment
8368 leader is not used by current versions of @sc{cvs} or
8369 @sc{rcs} 5.7.  Therefore, you can almost surely not
8370 worry about it.  @xref{Keyword substitution}.
8371
8372 @item -e[@var{logins}]
8373 Might not work together with @sc{cvs}.  Erase the login
8374 names appearing in the comma-separated list
8375 @var{logins} from the access list of the RCS file.  If
8376 @var{logins} is omitted, erase the entire access list.
8377 There can be no space between @samp{-e} and its argument.
8378
8379 @item -I
8380 Run interactively, even if the standard input is not a
8381 terminal.  This option does not work with the
8382 client/server @sc{cvs} and is likely to disappear in
8383 a future release of @sc{cvs}.
8384
8385 @item -i
8386 Useless with @sc{cvs}.  This creates and initializes a
8387 new @sc{rcs} file, without depositing a revision.  With
8388 @sc{cvs}, add files with the @code{cvs add} command
8389 (@pxref{Adding files}).
8390
8391 @item -k@var{subst}
8392 Set the default keyword
8393 substitution to @var{subst}.  @xref{Keyword
8394 substitution}.  Giving an explicit @samp{-k} option to
8395 @code{cvs update}, @code{cvs export}, or @code{cvs
8396 checkout} overrides this default.
8397
8398 @item -l[@var{rev}]
8399 Lock the revision with number @var{rev}.  If a branch
8400 is given, lock the latest revision on that branch.  If
8401 @var{rev} is omitted, lock the latest revision on the
8402 default branch.  There can be no space between
8403 @samp{-l} and its argument.
8404
8405 This can be used in conjunction with the
8406 @file{rcslock.pl} script in the @file{contrib}
8407 directory of the @sc{cvs} source distribution to
8408 provide reserved checkouts (where only one user can be
8409 editing a given file at a time).  See the comments in
8410 that file for details (and see the @file{README} file
8411 in that directory for disclaimers about the unsupported
8412 nature of contrib).  According to comments in that
8413 file, locking must set to strict (which is the default).
8414
8415 @item -L
8416 Set locking to strict.  Strict locking means that the
8417 owner of an RCS file is not exempt from locking for
8418 checkin.  For use with @sc{cvs}, strict locking must be
8419 set; see the discussion under the @samp{-l} option above.
8420
8421 @cindex Changing a log message
8422 @cindex Replacing a log message
8423 @cindex Correcting a log message
8424 @cindex Fixing a log message
8425 @cindex Log message, correcting
8426 @item -m@var{rev}:@var{msg}
8427 Replace the log message of revision @var{rev} with
8428 @var{msg}.
8429
8430 @c The rcs -M option, to suppress sending mail, has never been
8431 @c documented as a cvs admin option.
8432
8433 @item -N@var{name}[:[@var{rev}]]
8434 Act like @samp{-n}, except override any previous
8435 assignment of @var{name}.  For use with magic branches,
8436 see @ref{Magic branch numbers}.
8437
8438 @item -n@var{name}[:[@var{rev}]]
8439 Associate the symbolic name @var{name} with the branch
8440 or revision @var{rev}.  It is normally better to use
8441 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
8442 symbolic name if both @samp{:} and @var{rev} are
8443 omitted; otherwise, print an error message if
8444 @var{name} is already associated with another number.
8445 If @var{rev} is symbolic, it is expanded before
8446 association.  A @var{rev} consisting of a branch number
8447 followed by a @samp{.} stands for the current latest
8448 revision in the branch.  A @samp{:} with an empty
8449 @var{rev} stands for the current latest revision on the
8450 default branch, normally the trunk.  For example,
8451 @samp{cvs admin -n@var{name}:} associates @var{name} with the
8452 current latest revision of all the RCS files;
8453 this contrasts with @samp{cvs admin -n@var{name}:$} which
8454 associates @var{name} with the revision numbers
8455 extracted from keyword strings in the corresponding
8456 working files.
8457
8458 @cindex Deleting revisions
8459 @cindex Outdating revisions
8460 @cindex Saving space
8461 @item -o@var{range}
8462 Deletes (@dfn{outdates}) the revisions given by
8463 @var{range}.
8464
8465 Note that this command can be quite dangerous unless
8466 you know @emph{exactly} what you are doing (for example
8467 see the warnings below about how the
8468 @var{rev1}:@var{rev2} syntax is confusing).
8469
8470 If you are short on disc this option might help you.
8471 But think twice before using it---there is no way short
8472 of restoring the latest backup to undo this command!
8473 If you delete different revisions than you planned,
8474 either due to carelessness or (heaven forbid) a @sc{cvs}
8475 bug, there is no opportunity to correct the error
8476 before the revisions are deleted.  It probably would be
8477 a good idea to experiment on a copy of the repository
8478 first.
8479
8480 Specify @var{range} in one of the following ways:
8481
8482 @table @code
8483 @item @var{rev1}::@var{rev2}
8484 Collapse all revisions between rev1 and rev2, so that
8485 @sc{cvs} only stores the differences associated with going
8486 from rev1 to rev2, not intermediate steps.  For
8487 example, after @samp{-o 1.3::1.5} one can retrieve
8488 revision 1.3, revision 1.5, or the differences to get
8489 from 1.3 to 1.5, but not the revision 1.4, or the
8490 differences between 1.3 and 1.4.  Other examples:
8491 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
8492 effect, because there are no intermediate revisions to
8493 remove.
8494
8495 @item ::@var{rev}
8496 Collapse revisions between the beginning of the branch
8497 containing @var{rev} and @var{rev} itself.  The
8498 branchpoint and @var{rev} are left intact.  For
8499 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
8500 revision 1.3.2.5, and everything in between, but leaves
8501 1.3 and 1.3.2.6 intact.
8502
8503 @item @var{rev}::
8504 Collapse revisions between @var{rev} and the end of the
8505 branch containing @var{rev}.  Revision @var{rev} is
8506 left intact but the head revision is deleted.
8507
8508 @item @var{rev}
8509 Delete the revision @var{rev}.  For example, @samp{-o
8510 1.3} is equivalent to @samp{-o 1.2::1.4}.
8511
8512 @item @var{rev1}:@var{rev2}
8513 Delete the revisions from @var{rev1} to @var{rev2},
8514 inclusive, on the same branch.  One will not be able to
8515 retrieve @var{rev1} or @var{rev2} or any of the
8516 revisions in between.  For example, the command
8517 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
8518 It means to delete revisions up to, and including, the
8519 tag R_1_02.  But beware!  If there are files that have not
8520 changed between R_1_02 and R_1_03 the file will have
8521 @emph{the same} numerical revision number assigned to
8522 the tags R_1_02 and R_1_03.  So not only will it be
8523 impossible to retrieve R_1_02; R_1_03 will also have to
8524 be restored from the tapes!  In most cases you want to
8525 specify @var{rev1}::@var{rev2} instead.
8526
8527 @item :@var{rev}
8528 Delete revisions from the beginning of the
8529 branch containing @var{rev} up to and including
8530 @var{rev}.
8531
8532 @item @var{rev}:
8533 Delete revisions from revision @var{rev}, including
8534 @var{rev} itself, to the end of the branch containing
8535 @var{rev}.
8536 @end table
8537
8538 None of the revisions to be deleted may have
8539 branches or locks.
8540
8541 If any of the revisions to be deleted have symbolic
8542 names, and one specifies one of the @samp{::} syntaxes,
8543 then @sc{cvs} will give an error and not delete any
8544 revisions.  If you really want to delete both the
8545 symbolic names and the revisions, first delete the
8546 symbolic names with @code{cvs tag -d}, then run
8547 @code{cvs admin -o}.  If one specifies the
8548 non-@samp{::} syntaxes, then @sc{cvs} will delete the
8549 revisions but leave the symbolic names pointing to
8550 nonexistent revisions.  This behavior is preserved for
8551 compatibility with previous versions of @sc{cvs}, but
8552 because it isn't very useful, in the future it may
8553 change to be like the @samp{::} case.
8554
8555 Due to the way @sc{cvs} handles branches @var{rev}
8556 cannot be specified symbolically if it is a branch.
8557 @xref{Magic branch numbers}, for an explanation.
8558 @c FIXME: is this still true?  I suspect not.
8559
8560 Make sure that no-one has checked out a copy of the
8561 revision you outdate.  Strange things will happen if he
8562 starts to edit it and tries to check it back in.  For
8563 this reason, this option is not a good way to take back
8564 a bogus commit; commit a new revision undoing the bogus
8565 change instead (@pxref{Merging two revisions}).
8566
8567 @item -q
8568 Run quietly; do not print diagnostics.
8569
8570 @item -s@var{state}[:@var{rev}]
8571 Useful with @sc{cvs}.  Set the state attribute of the
8572 revision @var{rev} to @var{state}.  If @var{rev} is a
8573 branch number, assume the latest revision on that
8574 branch.  If @var{rev} is omitted, assume the latest
8575 revision on the default branch.  Any identifier is
8576 acceptable for @var{state}.  A useful set of states is
8577 @samp{Exp} (for experimental), @samp{Stab} (for
8578 stable), and @samp{Rel} (for released).  By default,
8579 the state of a new revision is set to @samp{Exp} when
8580 it is created.  The state is visible in the output from
8581 @var{cvs log} (@pxref{log}), and in the
8582 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
8583 (@pxref{Keyword substitution}).  Note that @sc{cvs}
8584 uses the @code{dead} state for its own purposes (@pxref{Attic}); to
8585 take a file to or from the @code{dead} state use
8586 commands like @code{cvs remove} and @code{cvs add}
8587 (@pxref{Adding and removing}), not @code{cvs admin -s}.
8588
8589 @item -t[@var{file}]
8590 Useful with @sc{cvs}.  Write descriptive text from the
8591 contents of the named @var{file} into the RCS file,
8592 deleting the existing text.  The @var{file} pathname
8593 may not begin with @samp{-}.  The descriptive text can be seen in the
8594 output from @samp{cvs log} (@pxref{log}).
8595 There can be no space between @samp{-t} and its argument.
8596
8597 If @var{file} is omitted,
8598 obtain the text from standard input, terminated by
8599 end-of-file or by a line containing @samp{.} by itself.
8600 Prompt for the text if interaction is possible; see
8601 @samp{-I}.
8602
8603 @item -t-@var{string}
8604 Similar to @samp{-t@var{file}}. Write descriptive text
8605 from the @var{string} into the @sc{rcs} file, deleting
8606 the existing text.
8607 There can be no space between @samp{-t} and its argument.
8608
8609 @c The rcs -T option, do not update last-mod time for
8610 @c minor changes, has never been documented as a
8611 @c cvs admin option.
8612
8613 @item -U
8614 Set locking to non-strict.  Non-strict locking means
8615 that the owner of a file need not lock a revision for
8616 checkin.  For use with @sc{cvs}, strict locking must be
8617 set; see the discussion under the @samp{-l} option
8618 above.
8619
8620 @item -u[@var{rev}]
8621 See the option @samp{-l} above, for a discussion of
8622 using this option with @sc{cvs}.  Unlock the revision
8623 with number @var{rev}.  If a branch is given, unlock
8624 the latest revision on that branch.  If @var{rev} is
8625 omitted, remove the latest lock held by the caller.
8626 Normally, only the locker of a revision may unlock it;
8627 somebody else unlocking a revision breaks the lock.
8628 This causes the original locker to be sent a @code{commit}
8629 notification (@pxref{Getting Notified}).
8630 There can be no space between @samp{-u} and its argument.
8631
8632 @item -V@var{n}
8633 In previous versions of @sc{cvs}, this option meant to
8634 write an @sc{rcs} file which would be acceptable to
8635 @sc{rcs} version @var{n}, but it is now obsolete and
8636 specifying it will produce an error.
8637 @c Note that -V without an argument has never been
8638 @c documented as a cvs admin option.
8639
8640 @item -x@var{suffixes}
8641 In previous versions of @sc{cvs}, this was documented
8642 as a way of specifying the names of the @sc{rcs}
8643 files.  However, @sc{cvs} has always required that the
8644 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
8645 this option has never done anything useful.
8646
8647 @c The rcs -z option, to specify the timezone, has
8648 @c never been documented as a cvs admin option.
8649 @end table
8650
8651
8652 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8653 @node annotate
8654 @appendixsec annotate---What revision modified each line of a file?
8655 @cindex annotate (subcommand)
8656
8657 @itemize @bullet
8658 @item
8659 Synopsis: annotate [options] files@dots{}
8660 @item
8661 Requires: repository.
8662 @item
8663 Changes: nothing.
8664 @end itemize
8665
8666 For each file in @var{files}, print the head revision
8667 of the trunk, together with information on the last
8668 modification for each line.  
8669
8670 @menu
8671 * annotate options::            annotate options
8672 * annotate example::            annotate example
8673 @end menu
8674
8675 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8676 @node annotate options
8677 @appendixsubsec annotate options
8678
8679 These standard options are supported by @code{annotate}
8680 (@pxref{Common options}, for a complete description of
8681 them):
8682
8683 @table @code
8684 @item -l
8685 Local directory only, no recursion.
8686
8687 @item -R
8688 Process directories recursively.
8689
8690 @item -f
8691 Use head revision if tag/date not found.
8692
8693 @item -F
8694 Annotate binary files.
8695
8696 @item -r @var{revision}
8697 Annotate file as of specified revision/tag.
8698
8699 @item -D @var{date}
8700 Annotate file as of specified date.
8701 @end table
8702
8703 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8704 @node annotate example
8705 @appendixsubsec annotate example
8706
8707 For example:
8708
8709 @example
8710 $ cvs annotate ssfile
8711 Annotations for ssfile
8712 ***************
8713 1.1          (mary     27-Mar-96): ssfile line 1
8714 1.2          (joe      28-Mar-96): ssfile line 2
8715 @end example
8716
8717 The file @file{ssfile} currently contains two lines.
8718 The @code{ssfile line 1} line was checked in by
8719 @code{mary} on March 27.  Then, on March 28, @code{joe}
8720 added a line @code{ssfile line 2}, without modifying
8721 the @code{ssfile line 1} line.  This report doesn't
8722 tell you anything about lines which have been deleted
8723 or replaced; you need to use @code{cvs diff} for that
8724 (@pxref{diff}).
8725
8726 The options to @code{cvs annotate} are listed in
8727 @ref{Invoking CVS}, and can be used to select the files
8728 and revisions to annotate.  The options are described
8729 in more detail there and in @ref{Common options}.
8730
8731 @c FIXME: maybe an example using the options?  Just
8732 @c what it means to select a revision might be worth a
8733 @c few words of explanation ("you want to see who
8734 @c changed this line *before* 1.4"...).
8735
8736
8737 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8738 @node checkout
8739 @appendixsec checkout---Check out sources for editing
8740 @cindex checkout (subcommand)
8741 @cindex co (subcommand)
8742
8743 @itemize @bullet
8744 @item
8745 Synopsis: checkout [options] modules@dots{}
8746 @item
8747 Requires: repository.
8748 @item
8749 Changes: working directory.
8750 @item
8751 Synonyms: co, get
8752 @end itemize
8753
8754 Create or update a working directory containing copies of the
8755 source files specified by @var{modules}.  You must execute
8756 @code{checkout} before using most of the other @sc{cvs}
8757 commands, since most of them operate on your working
8758 directory.
8759
8760 The @var{modules} are either
8761 symbolic names for some
8762 collection of source directories and files, or paths to
8763 directories or files in the repository.  The symbolic
8764 names are defined in the @samp{modules} file.
8765 @xref{modules}.
8766 @c Needs an example, particularly of the non-"modules"
8767 @c case but probably of both.
8768
8769 @c FIXME: this seems like a very odd place to introduce
8770 @c people to how CVS works.  The bit about unreserved
8771 @c checkouts is also misleading as it depends on how
8772 @c things are set up.
8773 Depending on the modules you specify, @code{checkout} may
8774 recursively create directories and populate them with
8775 the appropriate source files.  You can then edit these
8776 source files at any time (regardless of whether other
8777 software developers are editing their own copies of the
8778 sources); update them to include new changes applied by
8779 others to the source repository; or commit your work as
8780 a permanent change to the source repository.
8781
8782 Note that @code{checkout} is used to create
8783 directories.  The top-level directory created is always
8784 added to the directory where @code{checkout} is
8785 invoked, and usually has the same name as the specified
8786 module.  In the case of a module alias, the created
8787 sub-directory may have a different name, but you can be
8788 sure that it will be a sub-directory, and that
8789 @code{checkout} will show the relative path leading to
8790 each file as it is extracted into your private work
8791 area (unless you specify the @samp{-Q} global option).
8792
8793 The files created by @code{checkout} are created
8794 read-write, unless the @samp{-r} option to @sc{cvs}
8795 (@pxref{Global options}) is specified, the
8796 @code{CVSREAD} environment variable is specified
8797 (@pxref{Environment variables}), or a watch is in
8798 effect for that file (@pxref{Watches}).
8799
8800 Note that running @code{checkout} on a directory that was already
8801 built by a prior @code{checkout} is also permitted.
8802 This is similar to specifying the @samp{-d} option
8803 to the @code{update} command in the sense that new
8804 directories that have been created in the repository
8805 will appear in your work area.
8806 However, @code{checkout} takes a module name whereas
8807 @code{update} takes a directory name.  Also
8808 to use @code{checkout} this way it must be run from the
8809 top level directory (where you originally ran
8810 @code{checkout} from), so before you run
8811 @code{checkout} to update an existing directory, don't
8812 forget to change your directory to the top level
8813 directory.
8814
8815 For the output produced by the @code{checkout} command
8816 see @ref{update output}.
8817
8818 @menu
8819 * checkout options::            checkout options
8820 * checkout examples::           checkout examples
8821 @end menu
8822
8823 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8824 @node checkout options
8825 @appendixsubsec checkout options
8826
8827 These standard options are supported by @code{checkout}
8828 (@pxref{Common options}, for a complete description of
8829 them):
8830
8831 @table @code
8832 @item -D @var{date}
8833 Use the most recent revision no later than @var{date}.
8834 This option is sticky, and implies @samp{-P}.  See
8835 @ref{Sticky tags}, for more information on sticky tags/dates.
8836
8837 @item -f
8838 Only useful with the @samp{-D @var{date}} or @samp{-r
8839 @var{tag}} flags.  If no matching revision is found,
8840 retrieve the most recent revision (instead of ignoring
8841 the file).
8842
8843 @item -k @var{kflag}
8844 Process keywords according to @var{kflag}.  See
8845 @ref{Keyword substitution}.
8846 This option is sticky; future updates of
8847 this file in this working directory will use the same
8848 @var{kflag}.  The @code{status} command can be viewed
8849 to see the sticky options.  See @ref{Invoking CVS}, for
8850 more information on the @code{status} command.
8851
8852 @item -l
8853 Local; run only in current working directory.
8854
8855 @item -n
8856 Do not run any checkout program (as specified
8857 with the @samp{-o} option in the modules file;
8858 @pxref{modules}).
8859
8860 @item -P
8861 Prune empty directories.  See @ref{Moving directories}.
8862
8863 @item -p
8864 Pipe files to the standard output.
8865
8866 @item -R
8867 Checkout directories recursively.  This option is on by default.
8868
8869 @item -r @var{tag}
8870 Use revision @var{tag}.  This option is sticky, and implies @samp{-P}.
8871 See @ref{Sticky tags}, for more information on sticky tags/dates.
8872 @end table
8873
8874 In addition to those, you can use these special command
8875 options with @code{checkout}:
8876
8877 @table @code
8878 @item -A
8879 Reset any sticky tags, dates, or @samp{-k} options.
8880 Does not reset sticky @samp{-k} options on modified files.
8881 See @ref{Sticky tags}, for more information on sticky tags/dates.
8882
8883 @item -c
8884 Copy the module file, sorted, to the standard output,
8885 instead of creating or modifying any files or
8886 directories in your working directory.
8887
8888 @item -d @var{dir}
8889 Create a directory called @var{dir} for the working
8890 files, instead of using the module name.  In general,
8891 using this flag is equivalent to using @samp{mkdir
8892 @var{dir}; cd @var{dir}} followed by the checkout
8893 command without the @samp{-d} flag.
8894
8895 There is an important exception, however.  It is very
8896 convenient when checking out a single item to have the
8897 output appear in a directory that doesn't contain empty
8898 intermediate directories.  In this case @emph{only},
8899 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
8900 directories.
8901
8902 For example, given a module @samp{foo} that contains
8903 the file @samp{bar.c}, the command @samp{cvs co -d dir
8904 foo} will create directory @samp{dir} and place
8905 @samp{bar.c} inside.  Similarly, given a module
8906 @samp{bar} which has subdirectory @samp{baz} wherein
8907 there is a file @samp{quux.c}, the command @samp{cvs co
8908 -d dir bar/baz} will create directory @samp{dir} and
8909 place @samp{quux.c} inside.
8910
8911 Using the @samp{-N} flag will defeat this behavior.
8912 Given the same module definitions above, @samp{cvs co
8913 -N -d dir foo} will create directories @samp{dir/foo}
8914 and place @samp{bar.c} inside, while @samp{cvs co -N -d
8915 dir bar/baz} will create directories @samp{dir/bar/baz}
8916 and place @samp{quux.c} inside.
8917
8918 @item -j @var{tag}
8919 With two @samp{-j} options, merge changes from the
8920 revision specified with the first @samp{-j} option to
8921 the revision specified with the second @samp{j} option,
8922 into the working directory.
8923
8924 With one @samp{-j} option, merge changes from the
8925 ancestor revision to the revision specified with the
8926 @samp{-j} option, into the working directory.  The
8927 ancestor revision is the common ancestor of the
8928 revision which the working directory is based on, and
8929 the revision specified in the @samp{-j} option.
8930
8931 In addition, each -j option can contain an optional
8932 date specification which, when used with branches, can
8933 limit the chosen revision to one within a specific
8934 date.  An optional date is specified by adding a colon
8935 (:) to the tag:
8936 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
8937
8938 @xref{Branching and merging}.
8939
8940 @item -N
8941 Only useful together with @samp{-d @var{dir}}.  With
8942 this option, @sc{cvs} will not ``shorten'' module paths
8943 in your working directory when you check out a single
8944 module.  See the @samp{-d} flag for examples and a
8945 discussion.
8946
8947 @item -s
8948 Like @samp{-c}, but include the status of all modules,
8949 and sort it by the status string.  @xref{modules}, for
8950 info about the @samp{-s} option that is used inside the
8951 modules file to set the module status.
8952 @end table
8953
8954 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8955 @node checkout examples
8956 @appendixsubsec checkout examples
8957
8958 Get a copy of the module @samp{tc}:
8959
8960 @example
8961 $ cvs checkout tc
8962 @end example
8963
8964 Get a copy of the module @samp{tc} as it looked one day
8965 ago:
8966
8967 @example
8968 $ cvs checkout -D yesterday tc
8969 @end example
8970
8971 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8972 @node commit
8973 @appendixsec commit---Check files into the repository
8974 @cindex commit (subcommand)
8975
8976 @itemize @bullet
8977 @item
8978 Synopsis: commit [-lRf] [-m 'log_message' |
8979 -F file] [-r revision] [files@dots{}]
8980 @item
8981 Requires: working directory, repository.
8982 @item
8983 Changes: repository.
8984 @item
8985 Synonym: ci
8986 @end itemize
8987
8988 Use @code{commit} when you want to incorporate changes
8989 from your working source files into the source
8990 repository.
8991
8992 If you don't specify particular files to commit, all of
8993 the files in your working current directory are
8994 examined.  @code{commit} is careful to change in the
8995 repository only those files that you have really
8996 changed.  By default (or if you explicitly specify the
8997 @samp{-R} option), files in subdirectories are also
8998 examined and committed if they have changed; you can
8999 use the @samp{-l} option to limit @code{commit} to the
9000 current directory only.
9001
9002 @code{commit} verifies that the selected files are up
9003 to date with the current revisions in the source
9004 repository; it will notify you, and exit without
9005 committing, if any of the specified files must be made
9006 current first with @code{update} (@pxref{update}).
9007 @code{commit} does not call the @code{update} command
9008 for you, but rather leaves that for you to do when the
9009 time is right.
9010
9011 When all is well, an editor is invoked to allow you to
9012 enter a log message that will be written to one or more
9013 logging programs (@pxref{modules}, and @pxref{loginfo})
9014 and placed in the @sc{rcs} file inside the
9015 repository.  This log message can be retrieved with the
9016 @code{log} command; see @ref{log}.  You can specify the
9017 log message on the command line with the @samp{-m
9018 @var{message}} option, and thus avoid the editor invocation,
9019 or use the @samp{-F @var{file}} option to specify
9020 that the argument file contains the log message.
9021
9022 @menu
9023 * commit options::              commit options
9024 * commit examples::             commit examples
9025 @end menu
9026
9027 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9028 @node commit options
9029 @appendixsubsec commit options
9030
9031 These standard options are supported by @code{commit}
9032 (@pxref{Common options}, for a complete description of
9033 them):
9034
9035 @table @code
9036 @item -l
9037 Local; run only in current working directory.
9038
9039 @item -R
9040 Commit directories recursively.  This is on by default.
9041
9042 @item -r @var{revision}
9043 Commit to @var{revision}.  @var{revision} must be
9044 either a branch, or a revision on the main trunk that
9045 is higher than any existing revision number
9046 (@pxref{Assigning revisions}).  You
9047 cannot commit to a specific revision on a branch.
9048 @c FIXME: Need xref for branch case.
9049 @end table
9050
9051 @code{commit} also supports these options:
9052
9053 @table @code
9054 @item -F @var{file}
9055 Read the log message from @var{file}, instead
9056 of invoking an editor.
9057
9058 @item -f
9059 Note that this is not the standard behavior of
9060 the @samp{-f} option as defined in @ref{Common options}.
9061
9062 Force @sc{cvs} to commit a new revision even if you haven't
9063 made any changes to the file.  If the current revision
9064 of @var{file} is 1.7, then the following two commands
9065 are equivalent:
9066
9067 @example
9068 $ cvs commit -f @var{file}
9069 $ cvs commit -r 1.8 @var{file}
9070 @end example
9071
9072 @c This is odd, but it's how CVS has worked for some
9073 @c time.
9074 The @samp{-f} option disables recursion (i.e., it
9075 implies @samp{-l}).  To force @sc{cvs} to commit a new
9076 revision for all files in all subdirectories, you must
9077 use @samp{-f -R}.
9078
9079 @item -m @var{message}
9080 Use @var{message} as the log message, instead of
9081 invoking an editor.
9082 @end table
9083
9084 @need 2000
9085 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9086 @node commit examples
9087 @appendixsubsec commit examples
9088
9089 @c FIXME: this material wants to be somewhere
9090 @c in "Branching and merging".
9091
9092 @appendixsubsubsec Committing to a branch
9093
9094 You can commit to a branch revision (one that has an
9095 even number of dots) with the @samp{-r} option.  To
9096 create a branch revision, use the @samp{-b} option
9097 of the @code{rtag} or @code{tag} commands
9098 (@pxref{Branching and merging}).  Then, either @code{checkout} or
9099 @code{update} can be used to base your sources on the
9100 newly created branch.  From that point on, all
9101 @code{commit} changes made within these working sources
9102 will be automatically added to a branch revision,
9103 thereby not disturbing main-line development in any
9104 way.  For example, if you had to create a patch to the
9105 1.2 version of the product, even though the 2.0 version
9106 is already under development, you might do:
9107
9108 @example
9109 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9110 $ cvs checkout -r FCS1_2_Patch product_module
9111 $ cd product_module
9112 [[ hack away ]]
9113 $ cvs commit
9114 @end example
9115
9116 @noindent
9117 This works automatically since the @samp{-r} option is
9118 sticky.
9119
9120 @appendixsubsubsec Creating the branch after editing
9121
9122 Say you have been working on some extremely
9123 experimental software, based on whatever revision you
9124 happened to checkout last week.  If others in your
9125 group would like to work on this software with you, but
9126 without disturbing main-line development, you could
9127 commit your change to a new branch.  Others can then
9128 checkout your experimental stuff and utilize the full
9129 benefit of @sc{cvs} conflict resolution.  The scenario might
9130 look like:
9131
9132 @c FIXME: Should we be recommending tagging the branchpoint?
9133 @example
9134 [[ hacked sources are present ]]
9135 $ cvs tag -b EXPR1
9136 $ cvs update -r EXPR1
9137 $ cvs commit
9138 @end example
9139
9140 The @code{update} command will make the @samp{-r
9141 EXPR1} option sticky on all files.  Note that your
9142 changes to the files will never be removed by the
9143 @code{update} command.  The @code{commit} will
9144 automatically commit to the correct branch, because the
9145 @samp{-r} is sticky.  You could also do like this:
9146
9147 @c FIXME: Should we be recommending tagging the branchpoint?
9148 @example
9149 [[ hacked sources are present ]]
9150 $ cvs tag -b EXPR1
9151 $ cvs commit -r EXPR1
9152 @end example
9153
9154 @noindent
9155 but then, only those files that were changed by you
9156 will have the @samp{-r EXPR1} sticky flag.  If you hack
9157 away, and commit without specifying the @samp{-r EXPR1}
9158 flag, some files may accidentally end up on the main
9159 trunk.
9160
9161 To work with you on the experimental change, others
9162 would simply do
9163
9164 @example
9165 $ cvs checkout -r EXPR1 whatever_module
9166 @end example
9167
9168 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9169 @node diff
9170 @appendixsec diff---Show differences between revisions
9171 @cindex diff (subcommand)
9172
9173 @itemize @bullet
9174 @item
9175 Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 |  -D date2]] [files@dots{}]
9176 @item
9177 Requires: working directory, repository.
9178 @item
9179 Changes: nothing.
9180 @end itemize
9181
9182 The @code{diff} command is used to compare different
9183 revisions of files.  The default action is to compare
9184 your working files with the revisions they were based
9185 on, and report any differences that are found.
9186
9187 If any file names are given, only those files are
9188 compared.  If any directories are given, all files
9189 under them will be compared.
9190
9191 The exit status for diff is different than for other
9192 @sc{cvs} commands; for details @ref{Exit status}.
9193
9194 @menu
9195 * diff options::                diff options
9196 * diff examples::               diff examples
9197 @end menu
9198
9199 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9200 @node diff options
9201 @appendixsubsec diff options
9202
9203 These standard options are supported by @code{diff}
9204 (@pxref{Common options}, for a complete description of
9205 them):
9206
9207 @table @code
9208 @item -D @var{date}
9209 Use the most recent revision no later than @var{date}.
9210 See @samp{-r} for how this affects the comparison.
9211
9212 @item -k @var{kflag}
9213 Process keywords according to @var{kflag}.  See
9214 @ref{Keyword substitution}.
9215
9216 @item -l
9217 Local; run only in current working directory.
9218
9219 @item -R
9220 Examine directories recursively.  This option is on by
9221 default.
9222
9223 @item -r @var{tag}
9224 Compare with revision @var{tag}.  Zero, one or two
9225 @samp{-r} options can be present.  With no @samp{-r}
9226 option, the working file will be compared with the
9227 revision it was based on.  With one @samp{-r}, that
9228 revision will be compared to your current working file.
9229 With two @samp{-r} options those two revisions will be
9230 compared (and your working file will not affect the
9231 outcome in any way).
9232 @c We should be a lot more explicit, with examples,
9233 @c about the difference between "cvs diff" and "cvs
9234 @c diff -r HEAD".  This often confuses new users.
9235
9236 One or both @samp{-r} options can be replaced by a
9237 @samp{-D @var{date}} option, described above.
9238 @end table
9239
9240 @c Conceptually, this is a disaster.  There are 3
9241 @c zillion diff formats that we support via the diff
9242 @c library.  It is not obvious to me that we should
9243 @c document them all.  Maybe just the most common ones
9244 @c like -c and -u, and think about phasing out the
9245 @c obscure ones.
9246 @c FIXCVS: also should be a way to specify an external
9247 @c diff program (which can be different for different
9248 @c file types) and pass through
9249 @c arbitrary options, so that the user can do
9250 @c "--pass=-Z --pass=foo" or something even if CVS
9251 @c doesn't know about the "-Z foo" option to diff.
9252 @c This would fit nicely with deprecating/eliminating
9253 @c the obscure options of the diff library, because it
9254 @c would let people specify an external GNU diff if
9255 @c they are into that sort of thing.
9256 The following options specify the format of the
9257 output.  They have the same meaning as in GNU diff.
9258 Most options have two equivalent names, one of which is a single letter
9259 preceded by @samp{-}, and the other of which is a long name preceded by
9260 @samp{--}.
9261
9262 @table @samp
9263 @item -@var{lines}
9264 Show @var{lines} (an integer) lines of context.  This option does not
9265 specify an output format by itself; it has no effect unless it is
9266 combined with @samp{-c} or @samp{-u}.  This option is obsolete.  For proper
9267 operation, @code{patch} typically needs at least two lines of context.
9268
9269 @item -a
9270 Treat all files as text and compare them line-by-line, even if they
9271 do not seem to be text.
9272
9273 @item -b
9274 Ignore trailing white space and consider all other sequences of one or
9275 more white space characters to be equivalent.
9276
9277 @item -B
9278 Ignore changes that just insert or delete blank lines.
9279
9280 @item --binary
9281 Read and write data in binary mode.
9282
9283 @item --brief
9284 Report only whether the files differ, not the details of the
9285 differences.
9286
9287 @item -c
9288 Use the context output format.
9289
9290 @item -C @var{lines}
9291 @itemx --context@r{[}=@var{lines}@r{]}
9292 Use the context output format, showing @var{lines} (an integer) lines of
9293 context, or three if @var{lines} is not given.
9294 For proper operation, @code{patch} typically needs at least two lines of
9295 context.
9296
9297 @item --changed-group-format=@var{format}
9298 Use @var{format} to output a line group containing differing lines from
9299 both files in if-then-else format.  @xref{Line group formats}.
9300
9301 @item -d
9302 Change the algorithm to perhaps find a smaller set of changes.  This makes
9303 @code{diff} slower (sometimes much slower).
9304
9305 @item -e
9306 @itemx --ed
9307 Make output that is a valid @code{ed} script.
9308
9309 @item --expand-tabs
9310 Expand tabs to spaces in the output, to preserve the alignment of tabs
9311 in the input files.
9312
9313 @item -f
9314 Make output that looks vaguely like an @code{ed} script but has changes
9315 in the order they appear in the file.
9316
9317 @item -F @var{regexp}
9318 In context and unified format, for each hunk of differences, show some
9319 of the last preceding line that matches @var{regexp}.
9320
9321 @item --forward-ed
9322 Make output that looks vaguely like an @code{ed} script but has changes
9323 in the order they appear in the file.
9324
9325 @item -H
9326 Use heuristics to speed handling of large files that have numerous
9327 scattered small changes.
9328
9329 @item --horizon-lines=@var{lines}
9330 Do not discard the last @var{lines} lines of the common prefix
9331 and the first @var{lines} lines of the common suffix.
9332
9333 @item -i
9334 Ignore changes in case; consider upper- and lower-case letters
9335 equivalent.
9336
9337 @item -I @var{regexp}
9338 Ignore changes that just insert or delete lines that match @var{regexp}.
9339
9340 @item --ifdef=@var{name}
9341 Make merged if-then-else output using @var{name}.
9342
9343 @item --ignore-all-space
9344 Ignore white space when comparing lines.
9345
9346 @item --ignore-blank-lines
9347 Ignore changes that just insert or delete blank lines.
9348
9349 @item --ignore-case
9350 Ignore changes in case; consider upper- and lower-case to be the same.
9351
9352 @item --ignore-matching-lines=@var{regexp}
9353 Ignore changes that just insert or delete lines that match @var{regexp}.
9354
9355 @item --ignore-space-change
9356 Ignore trailing white space and consider all other sequences of one or
9357 more white space characters to be equivalent.
9358
9359 @item --initial-tab
9360 Output a tab rather than a space before the text of a line in normal or
9361 context format.  This causes the alignment of tabs in the line to look
9362 normal.
9363
9364 @item -L @var{label}
9365 Use @var{label} instead of the file name in the context format
9366 and unified format headers.
9367
9368 @item --label=@var{label}
9369 Use @var{label} instead of the file name in the context format
9370 and unified format headers.
9371
9372 @item --left-column
9373 Print only the left column of two common lines in side by side format.
9374
9375 @item --line-format=@var{format}
9376 Use @var{format} to output all input lines in if-then-else format.
9377 @xref{Line formats}.
9378
9379 @item --minimal
9380 Change the algorithm to perhaps find a smaller set of changes.  This
9381 makes @code{diff} slower (sometimes much slower).
9382
9383 @item -n
9384 Output RCS-format diffs; like @samp{-f} except that each command
9385 specifies the number of lines affected.
9386
9387 @item -N
9388 @itemx --new-file
9389 In directory comparison, if a file is found in only one directory,
9390 treat it as present but empty in the other directory.
9391
9392 @item --new-group-format=@var{format}
9393 Use @var{format} to output a group of lines taken from just the second
9394 file in if-then-else format.  @xref{Line group formats}.
9395
9396 @item --new-line-format=@var{format}
9397 Use @var{format} to output a line taken from just the second file in
9398 if-then-else format.  @xref{Line formats}.
9399
9400 @item --old-group-format=@var{format}
9401 Use @var{format} to output a group of lines taken from just the first
9402 file in if-then-else format.  @xref{Line group formats}.
9403
9404 @item --old-line-format=@var{format}
9405 Use @var{format} to output a line taken from just the first file in
9406 if-then-else format.  @xref{Line formats}.
9407
9408 @item -p
9409 Show which C function each change is in.
9410
9411 @item --rcs
9412 Output RCS-format diffs; like @samp{-f} except that each command
9413 specifies the number of lines affected.
9414
9415 @item --report-identical-files
9416 @itemx -s
9417 Report when two files are the same.
9418
9419 @item --show-c-function
9420 Show which C function each change is in.
9421
9422 @item --show-function-line=@var{regexp}
9423 In context and unified format, for each hunk of differences, show some
9424 of the last preceding line that matches @var{regexp}.
9425
9426 @item --side-by-side
9427 Use the side by side output format.
9428
9429 @item --speed-large-files
9430 Use heuristics to speed handling of large files that have numerous
9431 scattered small changes.
9432
9433 @item --suppress-common-lines
9434 Do not print common lines in side by side format.
9435
9436 @item -t
9437 Expand tabs to spaces in the output, to preserve the alignment of tabs
9438 in the input files.
9439
9440 @item -T
9441 Output a tab rather than a space before the text of a line in normal or
9442 context format.  This causes the alignment of tabs in the line to look
9443 normal.
9444
9445 @item --text
9446 Treat all files as text and compare them line-by-line, even if they
9447 do not appear to be text.
9448
9449 @item -u
9450 Use the unified output format.
9451
9452 @item --unchanged-group-format=@var{format}
9453 Use @var{format} to output a group of common lines taken from both files
9454 in if-then-else format.  @xref{Line group formats}.
9455
9456 @item --unchanged-line-format=@var{format}
9457 Use @var{format} to output a line common to both files in if-then-else
9458 format.  @xref{Line formats}.
9459
9460 @item -U @var{lines}
9461 @itemx --unified@r{[}=@var{lines}@r{]}
9462 Use the unified output format, showing @var{lines} (an integer) lines of
9463 context, or three if @var{lines} is not given.
9464 For proper operation, @code{patch} typically needs at least two lines of
9465 context.
9466
9467 @item -w
9468 Ignore white space when comparing lines.
9469
9470 @item -W @var{columns}
9471 @itemx --width=@var{columns}
9472 Use an output width of @var{columns} in side by side format.
9473
9474 @item -y
9475 Use the side by side output format.
9476 @end table
9477
9478 @menu
9479 * Line group formats::          Line group formats
9480 * Line formats::                Line formats
9481 @end menu
9482
9483 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9484 @node Line group formats
9485 @appendixsubsubsec Line group formats
9486
9487 Line group formats let you specify formats suitable for many
9488 applications that allow if-then-else input, including programming
9489 languages and text formatting languages.  A line group format specifies
9490 the output format for a contiguous group of similar lines.
9491
9492 For example, the following command compares the TeX file @file{myfile}
9493 with the original version from the repository,
9494 and outputs a merged file in which old regions are
9495 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
9496 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
9497
9498 @example
9499 cvs diff \
9500    --old-group-format='\begin@{em@}
9501 %<\end@{em@}
9502 ' \
9503    --new-group-format='\begin@{bf@}
9504 %>\end@{bf@}
9505 ' \
9506    myfile
9507 @end example
9508
9509 The following command is equivalent to the above example, but it is a
9510 little more verbose, because it spells out the default line group formats.
9511
9512 @example
9513 cvs diff \
9514    --old-group-format='\begin@{em@}
9515 %<\end@{em@}
9516 ' \
9517    --new-group-format='\begin@{bf@}
9518 %>\end@{bf@}
9519 ' \
9520    --unchanged-group-format='%=' \
9521    --changed-group-format='\begin@{em@}
9522 %<\end@{em@}
9523 \begin@{bf@}
9524 %>\end@{bf@}
9525 ' \
9526    myfile
9527 @end example
9528
9529 Here is a more advanced example, which outputs a diff listing with
9530 headers containing line numbers in a ``plain English'' style.
9531
9532 @example
9533 cvs diff \
9534    --unchanged-group-format='' \
9535    --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
9536 %<' \
9537    --new-group-format='-------- %dN line%(N=1?:s) added after %de:
9538 %>' \
9539    --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
9540 %<-------- to:
9541 %>' \
9542    myfile
9543 @end example
9544
9545 To specify a line group format, use one of the options
9546 listed below.  You can specify up to four line group formats, one for
9547 each kind of line group.  You should quote @var{format}, because it
9548 typically contains shell metacharacters.
9549
9550 @table @samp
9551 @item --old-group-format=@var{format}
9552 These line groups are hunks containing only lines from the first file.
9553 The default old group format is the same as the changed group format if
9554 it is specified; otherwise it is a format that outputs the line group as-is.
9555
9556 @item --new-group-format=@var{format}
9557 These line groups are hunks containing only lines from the second
9558 file.  The default new group format is same as the changed group
9559 format if it is specified; otherwise it is a format that outputs the
9560 line group as-is.
9561
9562 @item --changed-group-format=@var{format}
9563 These line groups are hunks containing lines from both files.  The
9564 default changed group format is the concatenation of the old and new
9565 group formats.
9566
9567 @item --unchanged-group-format=@var{format}
9568 These line groups contain lines common to both files.  The default
9569 unchanged group format is a format that outputs the line group as-is.
9570 @end table
9571
9572 In a line group format, ordinary characters represent themselves;
9573 conversion specifications start with @samp{%} and have one of the
9574 following forms.
9575
9576 @table @samp
9577 @item %<
9578 stands for the lines from the first file, including the trailing newline.
9579 Each line is formatted according to the old line format (@pxref{Line formats}).
9580
9581 @item %>
9582 stands for the lines from the second file, including the trailing newline.
9583 Each line is formatted according to the new line format.
9584
9585 @item %=
9586 stands for the lines common to both files, including the trailing newline.
9587 Each line is formatted according to the unchanged line format.
9588
9589 @item %%
9590 stands for @samp{%}.
9591
9592 @item %c'@var{C}'
9593 where @var{C} is a single character, stands for @var{C}.
9594 @var{C} may not be a backslash or an apostrophe.
9595 For example, @samp{%c':'} stands for a colon, even inside
9596 the then-part of an if-then-else format, which a colon would
9597 normally terminate.
9598
9599 @item %c'\@var{O}'
9600 where @var{O} is a string of 1, 2, or 3 octal digits,
9601 stands for the character with octal code @var{O}.
9602 For example, @samp{%c'\0'} stands for a null character.
9603
9604 @item @var{F}@var{n}
9605 where @var{F} is a @code{printf} conversion specification and @var{n} is one
9606 of the following letters, stands for @var{n}'s value formatted with @var{F}.
9607
9608 @table @samp
9609 @item e
9610 The line number of the line just before the group in the old file.
9611
9612 @item f
9613 The line number of the first line in the group in the old file;
9614 equals @var{e} + 1.
9615
9616 @item l
9617 The line number of the last line in the group in the old file.
9618
9619 @item m
9620 The line number of the line just after the group in the old file;
9621 equals @var{l} + 1.
9622
9623 @item n
9624 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
9625
9626 @item E, F, L, M, N
9627 Likewise, for lines in the new file.
9628
9629 @end table
9630
9631 The @code{printf} conversion specification can be @samp{%d},
9632 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
9633 lower case hexadecimal, or upper case hexadecimal output
9634 respectively.  After the @samp{%} the following options can appear in
9635 sequence: a @samp{-} specifying left-justification; an integer
9636 specifying the minimum field width; and a period followed by an
9637 optional integer specifying the minimum number of digits.
9638 For example, @samp{%5dN} prints the number of new lines in the group
9639 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
9640
9641 @item (@var{A}=@var{B}?@var{T}:@var{E})
9642 If @var{A} equals @var{B} then @var{T} else @var{E}.
9643 @var{A} and @var{B} are each either a decimal constant
9644 or a single letter interpreted as above.
9645 This format spec is equivalent to @var{T} if
9646 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
9647
9648 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
9649 @samp{no lines} if @var{N} (the number of lines in the group in the
9650 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
9651 otherwise.
9652 @end table
9653
9654 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9655 @node Line formats
9656 @appendixsubsubsec Line formats
9657
9658 Line formats control how each line taken from an input file is
9659 output as part of a line group in if-then-else format.
9660
9661 For example, the following command outputs text with a one-column
9662 change indicator to the left of the text.  The first column of output
9663 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
9664 for unchanged lines.  The formats contain newline characters where
9665 newlines are desired on output.
9666
9667 @example
9668 cvs diff \
9669    --old-line-format='-%l
9670 ' \
9671    --new-line-format='|%l
9672 ' \
9673    --unchanged-line-format=' %l
9674 ' \
9675    myfile
9676 @end example
9677
9678 To specify a line format, use one of the following options.  You should
9679 quote @var{format}, since it often contains shell metacharacters.
9680
9681 @table @samp
9682 @item --old-line-format=@var{format}
9683 formats lines just from the first file.
9684
9685 @item --new-line-format=@var{format}
9686 formats lines just from the second file.
9687
9688 @item --unchanged-line-format=@var{format}
9689 formats lines common to both files.
9690
9691 @item --line-format=@var{format}
9692 formats all lines; in effect, it sets all three above options simultaneously.
9693 @end table
9694
9695 In a line format, ordinary characters represent themselves;
9696 conversion specifications start with @samp{%} and have one of the
9697 following forms.
9698
9699 @table @samp
9700 @item %l
9701 stands for the contents of the line, not counting its trailing
9702 newline (if any).  This format ignores whether the line is incomplete.
9703
9704 @item %L
9705 stands for the contents of the line, including its trailing newline
9706 (if any).  If a line is incomplete, this format preserves its
9707 incompleteness.
9708
9709 @item %%
9710 stands for @samp{%}.
9711
9712 @item %c'@var{C}'
9713 where @var{C} is a single character, stands for @var{C}.
9714 @var{C} may not be a backslash or an apostrophe.
9715 For example, @samp{%c':'} stands for a colon.
9716
9717 @item %c'\@var{O}'
9718 where @var{O} is a string of 1, 2, or 3 octal digits,
9719 stands for the character with octal code @var{O}.
9720 For example, @samp{%c'\0'} stands for a null character.
9721
9722 @item @var{F}n
9723 where @var{F} is a @code{printf} conversion specification,
9724 stands for the line number formatted with @var{F}.
9725 For example, @samp{%.5dn} prints the line number using the
9726 @code{printf} format @code{"%.5d"}.  @xref{Line group formats}, for
9727 more about printf conversion specifications.
9728
9729 @end table
9730
9731 The default line format is @samp{%l} followed by a newline character.
9732
9733 If the input contains tab characters and it is important that they line
9734 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
9735 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
9736 @samp{%L} with a tab character), or you should use the @samp{-t} or
9737 @samp{--expand-tabs} option.
9738
9739 Taken together, the line and line group formats let you specify many
9740 different formats.  For example, the following command uses a format
9741 similar to @code{diff}'s normal format.  You can tailor this command
9742 to get fine control over @code{diff}'s output.
9743
9744 @example
9745 cvs diff \
9746    --old-line-format='< %l
9747 ' \
9748    --new-line-format='> %l
9749 ' \
9750    --old-group-format='%df%(f=l?:,%dl)d%dE
9751 %<' \
9752    --new-group-format='%dea%dF%(F=L?:,%dL)
9753 %>' \
9754    --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
9755 %<---
9756 %>' \
9757    --unchanged-group-format='' \
9758    myfile
9759 @end example
9760
9761 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9762 @node diff examples
9763 @appendixsubsec diff examples
9764
9765 The following line produces a Unidiff (@samp{-u} flag)
9766 between revision 1.14 and 1.19 of
9767 @file{backend.c}.  Due to the @samp{-kk} flag no
9768 keywords are substituted, so differences that only depend
9769 on keyword substitution are ignored.
9770
9771 @example
9772 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
9773 @end example
9774
9775 Suppose the experimental branch EXPR1 was based on a
9776 set of files tagged RELEASE_1_0.  To see what has
9777 happened on that branch, the following can be used:
9778
9779 @example
9780 $ cvs diff -r RELEASE_1_0 -r EXPR1
9781 @end example
9782
9783 A command like this can be used to produce a context
9784 diff between two releases:
9785
9786 @example
9787 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
9788 @end example
9789
9790 If you are maintaining ChangeLogs, a command like the following
9791 just before you commit your changes may help you write
9792 the ChangeLog entry.  All local modifications that have
9793 not yet been committed will be printed.
9794
9795 @example
9796 $ cvs diff -u | less
9797 @end example
9798
9799 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9800 @node export
9801 @appendixsec export---Export sources from CVS, similar to checkout
9802 @cindex export (subcommand)
9803
9804 @itemize @bullet
9805 @item
9806 Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
9807 @item
9808 Requires: repository.
9809 @item
9810 Changes: current directory.
9811 @end itemize
9812
9813 This command is a variant of @code{checkout}; use it
9814 when you want a copy of the source for module without
9815 the @sc{cvs} administrative directories.  For example, you
9816 might use @code{export} to prepare source for shipment
9817 off-site.  This command requires that you specify a
9818 date or tag (with @samp{-D} or @samp{-r}), so that you
9819 can count on reproducing the source you ship to others
9820 (and thus it always prunes empty directories).
9821
9822 One often would like to use @samp{-kv} with @code{cvs
9823 export}.  This causes any keywords to be
9824 expanded such that an import done at some other site
9825 will not lose the keyword revision information.  But be
9826 aware that doesn't handle an export containing binary
9827 files correctly.  Also be aware that after having used
9828 @samp{-kv}, one can no longer use the @code{ident}
9829 command (which is part of the @sc{rcs} suite---see
9830 ident(1)) which looks for keyword strings.  If
9831 you want to be able to use @code{ident} you must not
9832 use @samp{-kv}.
9833
9834 @menu
9835 * export options::              export options
9836 @end menu
9837
9838 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9839 @node export options
9840 @appendixsubsec export options
9841
9842 These standard options are supported by @code{export}
9843 (@pxref{Common options}, for a complete description of
9844 them):
9845
9846 @table @code
9847 @item -D @var{date}
9848 Use the most recent revision no later than @var{date}.
9849
9850 @item -f
9851 If no matching revision is found, retrieve the most
9852 recent revision (instead of ignoring the file).
9853
9854 @item -l
9855 Local; run only in current working directory.
9856
9857 @item -n
9858 Do not run any checkout program.
9859
9860 @item -R
9861 Export directories recursively.  This is on by default.
9862
9863 @item -r @var{tag}
9864 Use revision @var{tag}.
9865 @end table
9866
9867 In addition, these options (that are common to
9868 @code{checkout} and @code{export}) are also supported:
9869
9870 @table @code
9871 @item -d @var{dir}
9872 Create a directory called @var{dir} for the working
9873 files, instead of using the module name.
9874 @xref{checkout options}, for complete details on how
9875 @sc{cvs} handles this flag.
9876
9877 @item -k @var{subst}
9878 Set keyword expansion mode (@pxref{Substitution modes}).
9879
9880 @item -N
9881 Only useful together with @samp{-d @var{dir}}.
9882 @xref{checkout options}, for complete details on how
9883 @sc{cvs} handles this flag.
9884 @end table
9885
9886 @ignore
9887 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9888 @c @node export examples
9889 @appendixsubsec export examples
9890
9891 Contributed examples are gratefully accepted.
9892 @c -- Examples here!!
9893 @end ignore
9894
9895 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9896 @node history
9897 @appendixsec history---Show status of files and users
9898 @cindex history (subcommand)
9899
9900 @itemize @bullet
9901 @item
9902 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
9903 @item
9904 Requires: the file @file{$CVSROOT/CVSROOT/history}
9905 @item
9906 Changes: nothing.
9907 @end itemize
9908
9909 @sc{cvs} can keep a history file that tracks each use of the
9910 @code{checkout}, @code{commit}, @code{rtag},
9911 @code{update}, and @code{release} commands.  You can
9912 use @code{history} to display this information in
9913 various formats.
9914
9915 Logging must be enabled by creating the file
9916 @file{$CVSROOT/CVSROOT/history}.
9917
9918 @strong{@code{history} uses @samp{-f}, @samp{-l},
9919 @samp{-n}, and @samp{-p} in ways that conflict with the
9920 normal use inside @sc{cvs} (@pxref{Common options}).}
9921
9922 @menu
9923 * history options::             history options
9924 @end menu
9925
9926 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9927 @node history options
9928 @appendixsubsec history options
9929
9930 Several options (shown above as @samp{-report})  control  what
9931 kind of report is generated:
9932
9933 @table @code
9934 @item -c
9935 Report on each time commit was used (i.e., each time
9936 the repository was modified).
9937
9938 @item -e
9939 Everything (all record types).  Equivalent to
9940 specifying @samp{-x} with all record types.  Of course,
9941 @samp{-e} will also include record types which are
9942 added in a future version of @sc{cvs}; if you are
9943 writing a script which can only handle certain record
9944 types, you'll want to specify @samp{-x}.
9945
9946 @item -m @var{module}
9947 Report on a particular module.  (You can meaningfully
9948 use @samp{-m} more than once on the command line.)
9949
9950 @item -o
9951 Report on checked-out modules.  This is the default report type.
9952
9953 @item -T
9954 Report on all tags.
9955
9956 @item -x @var{type}
9957 Extract a particular set of record types @var{type} from the @sc{cvs}
9958 history.  The types are indicated by single letters,
9959 which you may specify in combination.
9960
9961 Certain commands have a single record type:
9962
9963 @table @code
9964 @item F
9965 release
9966 @item O
9967 checkout
9968 @item E
9969 export
9970 @item T
9971 rtag
9972 @end table
9973
9974 @noindent
9975 One of five record types may result from an update:
9976
9977 @table @code
9978 @item C
9979 A merge was necessary but collisions were
9980 detected (requiring manual merging).
9981 @item G
9982 A merge was necessary and it succeeded.
9983 @item U
9984 A working file was copied from the repository.
9985 @item P
9986 A working file was patched to match the repository.
9987 @item W
9988 The working copy of a file was deleted during
9989 update (because it was gone from the repository).
9990 @end table
9991
9992 @noindent
9993 One of three record types results from commit:
9994
9995 @table @code
9996 @item A
9997 A file was added for the first time.
9998 @item M
9999 A file was modified.
10000 @item R
10001 A file was removed.
10002 @end table
10003 @end table
10004
10005 The options shown as @samp{-flags} constrain or expand
10006 the report without requiring option arguments:
10007
10008 @table @code
10009 @item -a
10010 Show data for all users (the default is to show data
10011 only for the user executing @code{history}).
10012
10013 @item -l
10014 Show last modification only.
10015
10016 @item -w
10017 Show only the records for modifications done from the
10018 same working directory where @code{history} is
10019 executing.
10020 @end table
10021
10022 The options shown as @samp{-options @var{args}} constrain the report
10023 based on an argument:
10024
10025 @table @code
10026 @item -b @var{str}
10027 Show data back to a record containing  the  string
10028 @var{str}  in  either the module name, the file name, or
10029 the repository path.
10030
10031 @item -D @var{date}
10032 Show data since @var{date}.  This is slightly different
10033 from the normal use of @samp{-D @var{date}}, which
10034 selects the newest revision older than @var{date}.
10035
10036 @item -f @var{file}
10037 Show data for a particular file
10038 (you can specify several @samp{-f} options on the same command line).
10039 This is equivalent to specifying the file on the command line.
10040
10041 @item -n @var{module}
10042 Show data for a particular module
10043 (you can specify several @samp{-n} options on the same command line).
10044
10045 @item -p @var{repository}
10046 Show data for a particular source repository  (you
10047 can specify several @samp{-p} options on the same command
10048 line).
10049
10050 @item -r @var{rev}
10051 Show records referring to revisions since the revision
10052 or tag named @var{rev} appears in individual @sc{rcs}
10053 files.  Each @sc{rcs} file is searched for the revision or
10054 tag.
10055
10056 @item -t @var{tag}
10057 Show records since tag @var{tag} was last added to the
10058 history file.  This differs from the @samp{-r} flag
10059 above in that it reads only the history file, not the
10060 @sc{rcs} files, and is much faster.
10061
10062 @item -u @var{name}
10063 Show records for user @var{name}.
10064
10065 @item -z @var{timezone}
10066 Show times in the selected records using the specified
10067 time zone instead of UTC.
10068 @end table
10069
10070 @ignore
10071 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10072 @c @node history examples
10073 @appendixsubsec history examples
10074
10075 Contributed examples will gratefully be accepted.
10076 @c -- Examples here!
10077 @end ignore
10078
10079 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10080 @node import
10081 @appendixsec import---Import sources into CVS, using vendor branches
10082 @cindex import (subcommand)
10083
10084 @c FIXME: This node is way too long for one which has subnodes.
10085
10086 @itemize @bullet
10087 @item
10088 Synopsis: import [-options] repository vendortag releasetag@dots{}
10089 @item
10090 Requires: Repository, source distribution directory.
10091 @item
10092 Changes: repository.
10093 @end itemize
10094
10095 Use @code{import} to incorporate an entire source
10096 distribution from an outside source (e.g., a source
10097 vendor) into your source repository directory.  You can
10098 use this command both for initial creation of a
10099 repository, and for wholesale updates to the module
10100 from the outside source.  @xref{Tracking sources}, for
10101 a discussion on this subject.
10102
10103 The @var{repository} argument gives a directory name
10104 (or a path to a directory) under the @sc{cvs} root directory
10105 for repositories; if the directory did not exist,
10106 import creates it.
10107
10108 When you use import for updates to source that has been
10109 modified in your source repository (since a prior
10110 import), it will notify you of any files that conflict
10111 in the two branches of development; use @samp{checkout
10112 -j} to reconcile the differences, as import instructs
10113 you to do.
10114
10115 If @sc{cvs} decides a file should be ignored
10116 (@pxref{cvsignore}), it does not import it and prints
10117 @samp{I } followed by the filename (@pxref{import output}, for a
10118 complete description of the output).
10119
10120 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10121 any file whose names match the specifications in that
10122 file will be treated as packages and the appropriate
10123 filtering will be performed on the file/directory
10124 before being imported.  @xref{Wrappers}.
10125
10126 The outside source is saved in a first-level
10127 branch, by default 1.1.1.  Updates are leaves of this
10128 branch; for example, files from the first imported
10129 collection of source will be revision 1.1.1.1, then
10130 files from the first imported update will be revision
10131 1.1.1.2, and so on.
10132
10133 At least three arguments are required.
10134 @var{repository} is needed to identify the collection
10135 of source.  @var{vendortag} is a tag for the entire
10136 branch (e.g., for 1.1.1).  You must also specify at
10137 least one @var{releasetag} to uniquely identify the files at
10138 the leaves created each time you execute @code{import}.  The
10139 @var{releasetag} should be new, not previously existing in the
10140 repository file, and uniquely identify the imported release,
10141
10142 @c I'm not completely sure this belongs here.  But
10143 @c we need to say it _somewhere_ reasonably obvious; it
10144 @c is a common misconception among people first learning CVS
10145 Note that @code{import} does @emph{not} change the
10146 directory in which you invoke it.  In particular, it
10147 does not set up that directory as a @sc{cvs} working
10148 directory; if you want to work with the sources import
10149 them first and then check them out into a different
10150 directory (@pxref{Getting the source}).
10151
10152 @menu
10153 * import options::              import options
10154 * import output::               import output
10155 * import examples::             import examples
10156 @end menu
10157
10158 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10159 @node import options
10160 @appendixsubsec import options
10161
10162 This standard option is supported by @code{import}
10163 (@pxref{Common options}, for a complete description):
10164
10165 @table @code
10166 @item -m @var{message}
10167 Use @var{message} as log information, instead of
10168 invoking an editor.
10169 @end table
10170
10171 There are the following additional special options.
10172
10173 @table @code
10174 @item -b @var{branch}
10175 See @ref{Multiple vendor branches}.
10176
10177 @item -k @var{subst}
10178 Indicate the keyword expansion mode desired.  This
10179 setting will apply to all files created during the
10180 import, but not to any files that previously existed in
10181 the repository.  See @ref{Substitution modes}, for a
10182 list of valid @samp{-k} settings.
10183
10184 @item -I @var{name}
10185 Specify file names that should be ignored during
10186 import.  You can use this option repeatedly.  To avoid
10187 ignoring any files at all (even those ignored by
10188 default), specify `-I !'.
10189
10190 @var{name} can be a file name pattern of the same type
10191 that you can specify in the @file{.cvsignore} file.
10192 @xref{cvsignore}.
10193 @c -- Is this really true?
10194
10195 @item -W @var{spec}
10196 Specify file names that should be filtered during
10197 import.  You can use this option repeatedly.
10198
10199 @var{spec} can be a file name pattern of the same type
10200 that you can specify in the @file{.cvswrappers}
10201 file. @xref{Wrappers}.
10202 @end table
10203
10204 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10205 @node import output
10206 @appendixsubsec import output
10207
10208 @code{import} keeps you informed of its progress by printing a line
10209 for each file, preceded by one character indicating the status of the file:
10210
10211 @table @code
10212 @item U @var{file}
10213 The file already exists in the repository and has not been locally
10214 modified; a new revision has been created (if necessary).
10215
10216 @item N @var{file}
10217 The file is a new file which has been added to the repository.
10218
10219 @item C @var{file}
10220 The file already exists in the repository but has been locally modified;
10221 you will have to merge the changes.
10222
10223 @item I @var{file}
10224 The file is being ignored (@pxref{cvsignore}).
10225
10226 @cindex Symbolic link, importing
10227 @cindex Link, symbolic, importing
10228 @c FIXME: also (somewhere else) probably
10229 @c should be documenting what happens if you "cvs add"
10230 @c a symbolic link.  Also maybe what happens if
10231 @c you manually create symbolic links within the
10232 @c repository (? - not sure why we'd want to suggest
10233 @c doing that).
10234 @item L @var{file}
10235 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10236 People periodically suggest that this behavior should
10237 be changed, but if there is a consensus on what it
10238 should be changed to, it doesn't seem to be apparent.
10239 (Various options in the @file{modules} file can be used
10240 to recreate symbolic links on checkout, update, etc.;
10241 @pxref{modules}.)
10242 @end table
10243
10244 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10245 @node import examples
10246 @appendixsubsec import examples
10247
10248 See @ref{Tracking sources}, and @ref{From files}.
10249
10250 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10251 @node log
10252 @appendixsec log---Print out log information for files
10253 @cindex log (subcommand)
10254
10255 @itemize @bullet
10256 @item
10257 Synopsis: log [options] [files@dots{}]
10258 @item
10259 Requires: repository, working directory.
10260 @item
10261 Changes: nothing.
10262 @end itemize
10263
10264 Display log information for files.  @code{log} used to
10265 call the @sc{rcs} utility @code{rlog}.  Although this
10266 is no longer true in the current sources, this history
10267 determines the format of the output and the options,
10268 which are not quite in the style of the other @sc{cvs}
10269 commands.
10270
10271 @cindex Timezone, in output
10272 @cindex Zone, time, in output
10273 @c Kind of a funny place to document the timezone used
10274 @c in output from commands other than @code{log}.
10275 @c There is also more we need to say about this,
10276 @c including what happens in a client/server environment.
10277 The output includes the location of the @sc{rcs} file,
10278 the @dfn{head} revision (the latest revision on the
10279 trunk), all symbolic names (tags) and some other
10280 things.  For each revision, the revision number, the
10281 author, the number of lines added/deleted and the log
10282 message are printed.  All times are displayed in
10283 Coordinated Universal Time (UTC).  (Other parts of
10284 @sc{cvs} print times in the local timezone).
10285 @c FIXCVS: need a better way to control the timezone
10286 @c used in output.  Previous/current versions of CVS did/do
10287 @c sometimes support -z in RCSINIT, and/or an
10288 @c undocumented (except by reference to 'rlog') -z option
10289 @c to cvs log, but this has not been a consistent,
10290 @c documented feature.  Perhaps a new global option,
10291 @c where LT means the client's timezone, which the
10292 @c client then communicates to the server, is the
10293 @c right solution.
10294
10295 @strong{@code{log} uses @samp{-R} in a way that conflicts
10296 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10297
10298 @menu
10299 * log options::                 log options
10300 * log examples::                log examples
10301 @end menu
10302
10303 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10304 @node log options
10305 @appendixsubsec log options
10306
10307 By default, @code{log} prints all information that is
10308 available.  All other options restrict the output.  Note that the revision
10309 selection options (@code{-d}, @code{-r}, @code{-s}, and @code{-w}) have no
10310 effect, other than possibly causing a search for files in Attic directories,
10311 when used in conjunction with the options that restrict the output to only
10312 @code{log} header fields (@code{-b}, @code{-h}, @code{-R}, and @code{-t})
10313 unless the @code{-S} option is also specified.
10314
10315 @table @code
10316 @item -b
10317 Print information about the revisions on the default
10318 branch, normally the highest branch on the trunk.
10319
10320 @item -d @var{dates}
10321 Print information about revisions with a checkin
10322 date/time in the range given by the
10323 semicolon-separated list of dates.  The date formats
10324 accepted are those accepted by the @samp{-D} option to
10325 many other @sc{cvs} commands (@pxref{Common options}).
10326 Dates can be combined into ranges as follows:
10327
10328 @c Should we be thinking about accepting ISO8601
10329 @c ranges?  For example "1972-09-10/1972-09-12".
10330 @table @code
10331 @item @var{d1}<@var{d2}
10332 @itemx @var{d2}>@var{d1}
10333 Select the revisions that were deposited between
10334 @var{d1} and @var{d2}.
10335
10336 @item <@var{d}
10337 @itemx @var{d}>
10338 Select all revisions dated @var{d} or earlier.
10339
10340 @item @var{d}<
10341 @itemx >@var{d}
10342 Select all revisions dated @var{d} or later.
10343
10344 @item @var{d}
10345 Select the single, latest revision dated @var{d} or
10346 earlier.
10347 @end table
10348
10349 The @samp{>} or @samp{<} characters may be followed by
10350 @samp{=} to indicate an inclusive range rather than an
10351 exclusive one.
10352
10353 Note that the separator is a semicolon (;).
10354
10355 @item -h
10356 Print only the name of the @sc{rcs} file, name
10357 of the file in the working directory, head,
10358 default branch, access list, locks, symbolic names, and
10359 suffix.
10360
10361 @item -l
10362 Local; run only in current working directory.  (Default
10363 is to run recursively).
10364
10365 @item -N
10366 Do not print the list of tags for this file.  This
10367 option can be very useful when your site uses a lot of
10368 tags, so rather than "more"'ing over 3 pages of tag
10369 information, the log information is presented without
10370 tags at all.
10371
10372 @item -R
10373 Print only the name of the @sc{rcs} file.
10374
10375 @c Note that using a bare revision (in addition to not
10376 @c being explicitly documented here) is potentially
10377 @c confusing; it shows the log message to get from the
10378 @c previous revision to that revision.  "-r1.3 -r1.6"
10379 @c (equivalent to "-r1.3,1.6") is even worse; it
10380 @c prints the messages to get from 1.2 to 1.3 and 1.5
10381 @c to 1.6.  By analogy with "cvs diff", users might
10382 @c expect that it is more like specifying a range.
10383 @c It is not 100% clear to me how much of this should
10384 @c be documented (for example, multiple -r options
10385 @c perhaps could/should be deprecated given the false
10386 @c analogy with "cvs diff").
10387 @c In general, this section should be rewritten to talk
10388 @c about messages to get from revision rev1 to rev2,
10389 @c rather than messages for revision rev2 (that is, the
10390 @c messages are associated with a change not a static
10391 @c revision and failing to make this distinction causes
10392 @c much confusion).
10393 @item -r@var{revisions}
10394 Print information about revisions given in the
10395 comma-separated list @var{revisions} of revisions and
10396 ranges.  The following table explains the available
10397 range formats:
10398
10399 @table @code
10400 @item @var{rev1}:@var{rev2}
10401 Revisions @var{rev1} to @var{rev2} (which must be on
10402 the same branch).
10403
10404 @item @var{rev1}::@var{rev2}
10405 The same, but excluding @var{rev1}.
10406
10407 @item :@var{rev}
10408 @itemx ::@var{rev}
10409 Revisions from the beginning of the branch up to
10410 and including @var{rev}.
10411
10412 @item @var{rev}:
10413 Revisions starting with @var{rev} to the end of the
10414 branch containing @var{rev}.
10415
10416 @item @var{rev}::
10417 Revisions starting just after @var{rev} to the end of the
10418 branch containing @var{rev}.
10419
10420 @item @var{branch}
10421 An argument that is a branch means all revisions on
10422 that branch.
10423
10424 @item @var{branch1}:@var{branch2}
10425 @itemx @var{branch1}::@var{branch2}
10426 A range of branches means all revisions
10427 on the branches in that range.
10428
10429 @item @var{branch}.
10430 The latest revision in @var{branch}.
10431 @end table
10432
10433 A bare @samp{-r} with no revisions means the latest
10434 revision on the default branch, normally the trunk.
10435 There can be no space between the @samp{-r} option and
10436 its argument.
10437
10438 @item -S
10439 Suppress the header if no revisions are selected.
10440
10441 @item -s @var{states}
10442 Print information about revisions whose state
10443 attributes match one of the states given in the
10444 comma-separated list @var{states}.  Individual states may
10445 be any text string, though @sc{cvs} commonly only uses two
10446 states, @samp{Exp} and @samp{dead}.  See @ref{admin options}
10447 for more information.
10448
10449 @item -t
10450 Print the same as @samp{-h}, plus the descriptive text.
10451
10452 @item -w@var{logins}
10453 Print information about revisions checked in by users
10454 with login names appearing in the comma-separated list
10455 @var{logins}.  If @var{logins} is omitted, the user's
10456 login is assumed.  There can be no space between the
10457 @samp{-w} option and its argument.
10458 @end table
10459
10460 @code{log} prints the intersection of the revisions
10461 selected with the options @samp{-d}, @samp{-s}, and
10462 @samp{-w}, intersected with the union of the revisions
10463 selected by @samp{-b} and @samp{-r}.
10464
10465 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10466 @node log examples
10467 @appendixsubsec log examples
10468
10469 Contributed examples are gratefully accepted.
10470
10471 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10472 @node rdiff
10473 @appendixsec rdiff---'patch' format diffs between releases
10474 @cindex rdiff (subcommand)
10475
10476 @itemize @bullet
10477 @item
10478 rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
10479 @item
10480 Requires: repository.
10481 @item
10482 Changes: nothing.
10483 @item
10484 Synonym: patch
10485 @end itemize
10486
10487 Builds a Larry Wall format patch(1) file between two
10488 releases, that can be fed directly into the @code{patch}
10489 program to bring an old release up-to-date with the new
10490 release.  (This is one of the few @sc{cvs} commands that
10491 operates directly from the repository, and doesn't
10492 require a prior checkout.) The diff output is sent to
10493 the standard output device.
10494
10495 You can specify (using the standard @samp{-r} and
10496 @samp{-D} options) any combination of one or two
10497 revisions or dates.  If only one revision or date is
10498 specified, the patch file reflects differences between
10499 that revision or date and the current head revisions in
10500 the @sc{rcs} file.
10501
10502 Note that if the software release affected is contained
10503 in more than one directory, then it may be necessary to
10504 specify the @samp{-p} option to the @code{patch} command when
10505 patching the old sources, so that @code{patch} is able to find
10506 the files that are located in other directories.
10507
10508 @menu
10509 * rdiff options::               rdiff options
10510 * rdiff examples::              rdiff examples
10511 @end menu
10512
10513 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10514 @node rdiff options
10515 @appendixsubsec rdiff options
10516
10517 These standard options are supported by @code{rdiff}
10518 (@pxref{Common options}, for a complete description of
10519 them):
10520
10521 @table @code
10522 @item -D @var{date}
10523 Use the most recent revision no later than @var{date}.
10524
10525 @item -f
10526 If no matching revision is found, retrieve the most
10527 recent revision (instead of ignoring the file).
10528
10529 @item -k @var{kflag}
10530 Process keywords according to @var{kflag}.  See
10531 @ref{Keyword substitution}.
10532
10533 @item -l
10534 Local; don't descend subdirectories.
10535
10536 @item -R
10537 Examine directories recursively.  This option is on by default.
10538
10539 @item -r @var{tag}
10540 Use revision @var{tag}.
10541 @end table
10542
10543 In addition to the above, these options are available:
10544
10545 @table @code
10546 @item -c
10547 Use the context diff format.  This is the default format.
10548
10549 @item -s
10550 Create a summary change report instead of a patch.  The
10551 summary includes information about files that were
10552 changed or added between the releases.  It is sent to
10553 the standard output device.  This is useful for finding
10554 out, for example, which files have changed between two
10555 dates or revisions.
10556
10557 @item -t
10558 A diff of the top two revisions is sent to the standard
10559 output device.  This is most useful for seeing what the
10560 last change to a file was.
10561
10562 @item -u
10563 Use the unidiff format for the context diffs.
10564 Remember that old versions
10565 of the @code{patch} program can't handle the unidiff
10566 format, so if you plan to post this patch to the net
10567 you should probably not use @samp{-u}.
10568
10569 @item -V @var{vn}
10570 Expand keywords according to the rules current in
10571 @sc{rcs} version @var{vn} (the expansion format changed with
10572 @sc{rcs} version 5).  Note that this option is no
10573 longer accepted.  @sc{cvs} will always expand keywords the
10574 way that @sc{rcs} version 5 does.
10575 @end table
10576
10577 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10578 @node rdiff examples
10579 @appendixsubsec rdiff examples
10580
10581 Suppose you receive mail from @t{foo@@example.net} asking for an
10582 update from release 1.2 to 1.4 of the tc compiler.  You
10583 have no such patches on hand, but with @sc{cvs} that can
10584 easily be fixed with a command such as this:
10585
10586 @example
10587 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
10588 $$ Mail -s 'The patches you asked for' foo@@example.net
10589 @end example
10590
10591 Suppose you have made release 1.3, and forked a branch
10592 called @samp{R_1_3fix} for bug fixes.  @samp{R_1_3_1}
10593 corresponds to release 1.3.1, which was made some time
10594 ago.  Now, you want to see how much development has been
10595 done on the branch.  This command can be used:
10596
10597 @example
10598 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
10599 cvs rdiff: Diffing module-name
10600 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
10601 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
10602 File bar.h,v changed from revision 1.29.2.1 to 1.2
10603 @end example
10604
10605 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10606 @node release
10607 @appendixsec release---Indicate that a Module is no longer in use
10608 @cindex release (subcommand)
10609
10610 @itemize @bullet
10611 @item
10612 release [-d] directories@dots{}
10613 @item
10614 Requires: Working directory.
10615 @item
10616 Changes: Working directory, history log.
10617 @end itemize
10618
10619 This command is meant to safely cancel the effect of
10620 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
10621 isn't strictly necessary to use this command.  You can
10622 always simply delete your working directory, if you
10623 like; but you risk losing changes you may have
10624 forgotten, and you leave no trace in the @sc{cvs} history
10625 file (@pxref{history file}) that you've abandoned your
10626 checkout.
10627
10628 Use @samp{cvs release} to avoid these problems.  This
10629 command checks that no uncommitted changes are
10630 present; that you are executing it from immediately
10631 above a @sc{cvs} working directory; and that the repository
10632 recorded for your files is the same as the repository
10633 defined in the module database.
10634
10635 If all these conditions are true, @samp{cvs release}
10636 leaves a record of its execution (attesting to your
10637 intentionally abandoning your checkout) in the @sc{cvs}
10638 history log.
10639
10640 @menu
10641 * release options::             release options
10642 * release output::              release output
10643 * release examples::            release examples
10644 @end menu
10645
10646 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10647 @node release options
10648 @appendixsubsec release options
10649
10650 The @code{release} command supports one command option:
10651
10652 @table @code
10653 @item -d
10654 Delete your working copy of the file if the release
10655 succeeds.  If this flag is not given your files will
10656 remain in your working directory.
10657
10658 @strong{WARNING:  The @code{release} command deletes
10659 all directories and files recursively.  This
10660 has the very serious side-effect that any directory
10661 that you have created inside your checked-out sources,
10662 and not added to the repository (using the @code{add}
10663 command; @pxref{Adding files}) will be silently deleted---even
10664 if it is non-empty!}
10665 @end table
10666
10667 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10668 @node release output
10669 @appendixsubsec release output
10670
10671 Before @code{release} releases your sources it will
10672 print a one-line message for any file that is not
10673 up-to-date.
10674
10675 @table @code
10676 @item U @var{file}
10677 @itemx P @var{file}
10678 There exists a newer revision of this file in the
10679 repository, and you have not modified your local copy
10680 of the file (@samp{U} and @samp{P} mean the same thing).
10681
10682 @item A @var{file}
10683 The file has been added to your private copy of the
10684 sources, but has not yet been committed to the
10685 repository.  If you delete your copy of the sources
10686 this file will be lost.
10687
10688 @item R @var{file}
10689 The file has been removed from your private copy of the
10690 sources, but has not yet been removed from the
10691 repository, since you have not yet committed the
10692 removal.  @xref{commit}.
10693
10694 @item M @var{file}
10695 The file is modified in your working directory.  There
10696 might also be a newer revision inside the repository.
10697
10698 @item ? @var{file}
10699 @var{file} is in your working directory, but does not
10700 correspond to anything in the source repository, and is
10701 not in the list of files for @sc{cvs} to ignore (see the
10702 description of the @samp{-I} option, and
10703 @pxref{cvsignore}).  If you remove your working
10704 sources, this file will be lost.
10705 @end table
10706
10707 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10708 @node release examples
10709 @appendixsubsec release examples
10710
10711 Release the @file{tc} directory, and delete your local working copy
10712 of the files.
10713
10714 @example
10715 $ cd ..         # @r{You must stand immediately above the}
10716                 # @r{sources when you issue @samp{cvs release}.}
10717 $ cvs release -d tc
10718 You have [0] altered files in this repository.
10719 Are you sure you want to release (and delete) directory `tc': y
10720 $
10721 @end example
10722
10723 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10724 @node update
10725 @appendixsec update---Bring work tree in sync with repository
10726 @cindex update (subcommand)
10727
10728 @itemize @bullet
10729 @item
10730 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files@dots{}
10731 @item
10732 Requires: repository, working directory.
10733 @item
10734 Changes: working directory.
10735 @end itemize
10736
10737 After you've run checkout to create your private copy
10738 of source from the common repository, other developers
10739 will continue changing the central source.  From time
10740 to time, when it is convenient in your development
10741 process, you can use the @code{update} command from
10742 within your working directory to reconcile your work
10743 with any revisions applied to the source repository
10744 since your last checkout or update.
10745
10746 @menu
10747 * update options::              update options
10748 * update output::               update output
10749 @end menu
10750
10751 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10752 @node update options
10753 @appendixsubsec update options
10754
10755 These standard options are available with @code{update}
10756 (@pxref{Common options}, for a complete description of
10757 them):
10758
10759 @table @code
10760 @item -D date
10761 Use the most recent revision no later than @var{date}.
10762 This option is sticky, and implies @samp{-P}.
10763 See @ref{Sticky tags}, for more information on sticky tags/dates.
10764
10765 @item -f
10766 Only useful with the @samp{-D @var{date}} or @samp{-r
10767 @var{tag}} flags.  If no matching revision is found,
10768 retrieve the most recent revision (instead of ignoring
10769 the file).
10770
10771 @item -k @var{kflag}
10772 Process keywords according to @var{kflag}.  See
10773 @ref{Keyword substitution}.
10774 This option is sticky; future updates of
10775 this file in this working directory will use the same
10776 @var{kflag}.  The @code{status} command can be viewed
10777 to see the sticky options.  See @ref{Invoking CVS}, for
10778 more information on the @code{status} command.
10779
10780 @item -l
10781 Local; run only in current working directory.  @xref{Recursive behavior}.
10782
10783 @item -P
10784 Prune empty directories.  See @ref{Moving directories}.
10785
10786 @item -p
10787 Pipe files to the standard output.
10788
10789 @item -R
10790 Update directories recursively (default).  @xref{Recursive
10791 behavior}.
10792
10793 @item -r rev
10794 Retrieve revision/tag @var{rev}.  This option is sticky,
10795 and implies @samp{-P}.
10796 See @ref{Sticky tags}, for more information on sticky tags/dates.
10797 @end table
10798
10799 @need 800
10800 These special options are also available with
10801 @code{update}.
10802
10803 @table @code
10804 @item -A
10805 Reset any sticky tags, dates, or @samp{-k} options.
10806 Does not reset sticky @samp{-k} options on modified files.
10807 See @ref{Sticky tags}, for more information on sticky tags/dates.
10808
10809 @item -C
10810 Overwrite locally modified files with clean copies from
10811 the repository (the modified file is saved in
10812 @file{.#@var{file}.@var{revision}}, however).
10813
10814 @item -d
10815 Create any directories that exist in the repository if
10816 they're missing from the working directory.  Normally,
10817 @code{update} acts only on directories and files that
10818 were already enrolled in your working directory.
10819
10820 This is useful for updating directories that were
10821 created in the repository since the initial checkout;
10822 but it has an unfortunate side effect.  If you
10823 deliberately avoided certain directories in the
10824 repository when you created your working directory
10825 (either through use of a module name or by listing
10826 explicitly the files and directories you wanted on the
10827 command line), then updating with @samp{-d} will create
10828 those directories, which may not be what you want.
10829
10830 @item -I @var{name}
10831 Ignore files whose names match @var{name} (in your
10832 working directory) during the update.  You can specify
10833 @samp{-I} more than once on the command line to specify
10834 several files to ignore.  Use @samp{-I !} to avoid
10835 ignoring any files at all.  @xref{cvsignore}, for other
10836 ways to make @sc{cvs} ignore some files.
10837
10838 @item -W@var{spec}
10839 Specify file names that should be filtered during
10840 update.  You can use this option repeatedly.
10841
10842 @var{spec} can be a file name pattern of the same type
10843 that you can specify in the @file{.cvswrappers}
10844 file. @xref{Wrappers}.
10845
10846 @item -j@var{revision}
10847 With two @samp{-j} options, merge changes from the
10848 revision specified with the first @samp{-j} option to
10849 the revision specified with the second @samp{j} option,
10850 into the working directory.
10851
10852 With one @samp{-j} option, merge changes from the
10853 ancestor revision to the revision specified with the
10854 @samp{-j} option, into the working directory.  The
10855 ancestor revision is the common ancestor of the
10856 revision which the working directory is based on, and
10857 the revision specified in the @samp{-j} option.
10858
10859 Note that using a single @samp{-j @var{tagname}} option rather than
10860 @samp{-j @var{branchname}} to merge changes from a branch will
10861 often not remove files which were removed on the branch.
10862 @xref{Merging adds and removals}, for more.
10863
10864 In addition, each @samp{-j} option can contain an optional
10865 date specification which, when used with branches, can
10866 limit the chosen revision to one within a specific
10867 date.  An optional date is specified by adding a colon
10868 (:) to the tag:
10869 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
10870
10871 @xref{Branching and merging}.
10872
10873 @end table
10874
10875 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10876 @node update output
10877 @appendixsubsec update output
10878
10879 @code{update} and @code{checkout} keep you informed of
10880 their progress by printing a line for each file, preceded
10881 by one character indicating the status of the file:
10882
10883 @table @code
10884 @item U @var{file}
10885 The file was brought up to date with respect to the
10886 repository.  This is done for any file that exists in
10887 the repository but not in your working directory, and for files
10888 that you haven't changed but are not the most recent
10889 versions available in the repository.
10890
10891 @item P @var{file}
10892 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
10893 file.  This accomplishes the same thing as @samp{U} using less bandwidth.
10894
10895 @item A @var{file}
10896 The file has been added to your private copy of the
10897 sources, and will be added to the source repository
10898 when you run @code{commit} on the file.  This is a
10899 reminder to you that the file needs to be committed.
10900
10901 @item R @var{file}
10902 The file has been removed from your private copy of the
10903 sources, and will be removed from the source repository
10904 when you run @code{commit} on the file.  This is a
10905 reminder to you that the file needs to be committed.
10906
10907 @item M @var{file}
10908 The file is modified in  your  working  directory.
10909
10910 @samp{M} can indicate one of two states for a file
10911 you're working on: either there were no modifications
10912 to the same file in the repository, so that your file
10913 remains as you last saw it; or there were modifications
10914 in the repository as well as in your copy, but they
10915 were merged successfully, without conflict, in your
10916 working directory.
10917
10918 @sc{cvs} will print some messages if it merges your work,
10919 and a backup copy of your working file (as it looked
10920 before you ran @code{update}) will be made.  The exact
10921 name of that file is printed while @code{update} runs.
10922
10923 @item C @var{file}
10924 @cindex .# files
10925 @cindex __ files (VMS)
10926 A conflict was detected while trying to merge your
10927 changes to @var{file} with changes from the source
10928 repository.  @var{file} (the copy in your working
10929 directory) is now the result of attempting to merge
10930 the two revisions; an unmodified copy of your file
10931 is also in your working directory, with the name
10932 @file{.#@var{file}.@var{revision}} where @var{revision}
10933 is the revision that your modified file started
10934 from.  Resolve the conflict as described in
10935 @ref{Conflicts example}.
10936 @c "some systems" as in out-of-the-box OSes?  Not as
10937 @c far as I know.  We need to advise sysadmins as well
10938 @c as users how to set up this kind of purge, if that is
10939 @c what they want.
10940 @c We also might want to think about cleaner solutions,
10941 @c like having CVS remove the .# file once the conflict
10942 @c has been resolved or something like that.
10943 (Note that some systems automatically purge
10944 files that begin with @file{.#} if they have not been
10945 accessed for a few days.  If you intend to keep a copy
10946 of your original file, it is a very good idea to rename
10947 it.)  Under @sc{vms}, the file name starts with
10948 @file{__} rather than @file{.#}.
10949
10950 @item ? @var{file}
10951 @var{file} is in your working directory, but does not
10952 correspond to anything in the source repository, and is
10953 not in the list of files for @sc{cvs} to ignore (see the
10954 description of the @samp{-I} option, and
10955 @pxref{cvsignore}).
10956 @end table
10957
10958 @c ----- END MAN 1 -----
10959 @c ---------------------------------------------------------------------
10960 @node Invoking CVS
10961 @appendix Quick reference to CVS commands
10962 @cindex Command reference
10963 @cindex Reference, commands
10964 @cindex Invoking CVS
10965
10966 This appendix describes how to invoke @sc{cvs}, with
10967 references to where each command or feature is
10968 described in detail.  For other references run the
10969 @code{cvs --help} command, or see @ref{Index}.
10970
10971 A @sc{cvs} command looks like:
10972
10973 @example
10974 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
10975 @end example
10976
10977 Global options:
10978
10979 @table @code
10980 @item --allow-root=@var{rootdir}
10981 Specify legal @sc{cvsroot} directory (server only) (not
10982 in @sc{cvs} 1.9 and older).  See @ref{Password
10983 authentication server}.
10984
10985 @item -a
10986 Authenticate all communication (client only) (not in @sc{cvs}
10987 1.9 and older).  See @ref{Global options}.
10988
10989 @item -b
10990 Specify RCS location (@sc{cvs} 1.9 and older).  See
10991 @ref{Global options}.
10992
10993 @item -d @var{root}
10994 Specify the @sc{cvsroot}.  See @ref{Repository}.
10995
10996 @item -e @var{editor}
10997 Edit messages with @var{editor}.  See @ref{Committing
10998 your changes}.
10999
11000 @item -f
11001 Do not read the @file{~/.cvsrc} file.  See @ref{Global
11002 options}.
11003
11004 @item -H
11005 @itemx --help
11006 Print a help message.  See @ref{Global options}.
11007
11008 @item -n
11009 Do not change any files.  See @ref{Global options}.
11010
11011 @item -Q
11012 Be really quiet.  See @ref{Global options}.
11013
11014 @item -q
11015 Be somewhat quiet.  See @ref{Global options}.
11016
11017 @item -r
11018 Make new working files read-only.  See @ref{Global options}.
11019
11020 @item -s @var{variable}=@var{value}
11021 Set a user variable.  See @ref{Variables}.
11022
11023 @item -T @var{tempdir}
11024 Put temporary files in @var{tempdir}.  See @ref{Global
11025 options}.
11026
11027 @item -t
11028 Trace @sc{cvs} execution.  See @ref{Global options}.
11029
11030 @item -v
11031 @item --version
11032 Display version and copyright information for @sc{cvs}.
11033
11034 @item -w
11035 Make new working files read-write.  See @ref{Global
11036 options}.
11037
11038 @item -x
11039 Encrypt all communication (client only).
11040 See @ref{Global options}.
11041
11042 @item -z @var{gzip-level}
11043 @cindex Compression
11044 @cindex Gzip
11045 Set the compression level (client only).
11046 See @ref{Global options}.
11047 @end table
11048
11049 Keyword expansion modes (@pxref{Substitution modes}):
11050
11051 @example
11052 -kkv  $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11053 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11054 -kk   $@splitrcskeyword{Id}$
11055 -kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
11056 -ko   @i{no expansion}
11057 -kb   @i{no expansion, file is binary}
11058 @end example
11059
11060 Keywords (@pxref{Keyword list}):
11061
11062 @example
11063 $@splitrcskeyword{Author}: joe $
11064 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11065 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11066 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11067 $@splitrcskeyword{Locker}: harry $
11068 $@splitrcskeyword{Name}: snapshot_1_14 $
11069 $@splitrcskeyword{RCSfile}: file1,v $
11070 $@splitrcskeyword{Revision}: 1.1 $
11071 $@splitrcskeyword{Source}: /home/files/file1,v $
11072 $@splitrcskeyword{State}: Exp $
11073 $@splitrcskeyword{Log}: file1,v $
11074 Revision 1.1  1993/12/09 03:30:17  joe
11075 Initial revision
11076
11077 @end example
11078
11079 @c The idea behind this table is that we want each item
11080 @c to be a sentence or two at most.  Preferably a
11081 @c single line.
11082 @c
11083 @c In some cases refs to "foo options" are just to get
11084 @c this thing written quickly, not because the "foo
11085 @c options" node is really the best place to point.
11086 Commands, command options, and command arguments:
11087
11088 @table @code
11089 @c ------------------------------------------------------------
11090 @item add [@var{options}] [@var{files}@dots{}]
11091 Add a new file/directory.  See @ref{Adding files}.
11092
11093 @table @code
11094 @item -k @var{kflag}
11095 Set keyword expansion.
11096
11097 @item -m @var{msg}
11098 Set file description.
11099 @end table
11100
11101 @c ------------------------------------------------------------
11102 @item admin [@var{options}] [@var{files}@dots{}]
11103 Administration of history files in the repository.  See
11104 @ref{admin}.
11105 @c This list omits those options which are not
11106 @c documented as being useful with CVS.  That might be
11107 @c a mistake...
11108
11109 @table @code
11110 @item -b[@var{rev}]
11111 Set default branch.  See @ref{Reverting local changes}.
11112
11113 @item -c@var{string}
11114 Set comment leader.
11115
11116 @item -k@var{subst}
11117 Set keyword substitution.  See @ref{Keyword
11118 substitution}.
11119
11120 @item -l[@var{rev}]
11121 Lock revision @var{rev}, or latest revision.
11122
11123 @item -m@var{rev}:@var{msg}
11124 Replace the log message of revision @var{rev} with
11125 @var{msg}.
11126
11127 @item -o@var{range}
11128 Delete revisions from the repository.  See
11129 @ref{admin options}.
11130
11131 @item -q
11132 Run quietly; do not print diagnostics.
11133
11134 @item -s@var{state}[:@var{rev}]
11135 Set the state.  See @ref{admin options} for more information on possible
11136 states.
11137
11138 @c Does not work for client/server CVS
11139 @item -t
11140 Set file description from standard input.
11141
11142 @item -t@var{file}
11143 Set file description from @var{file}.
11144
11145 @item -t-@var{string}
11146 Set file description to @var{string}.
11147
11148 @item -u[@var{rev}]
11149 Unlock revision @var{rev}, or latest revision.
11150 @end table
11151
11152 @c ------------------------------------------------------------
11153 @item annotate [@var{options}] [@var{files}@dots{}]
11154 Show last revision where each line was modified.  See
11155 @ref{annotate}.
11156
11157 @table @code
11158 @item -D @var{date}
11159 Annotate the most recent revision no later than
11160 @var{date}.  See @ref{Common options}.
11161
11162 @item -F
11163 Force annotation of binary files.  (Without this option,
11164 binary files are skipped with a message.)
11165
11166 @item -f
11167 Use head revision if tag/date not found.  See
11168 @ref{Common options}.
11169
11170 @item -l
11171 Local; run only in current working directory.  @xref{Recursive behavior}.
11172
11173 @item -R
11174 Operate recursively (default).  @xref{Recursive
11175 behavior}.
11176
11177 @item -r @var{tag}
11178 Annotate revision @var{tag}.  See @ref{Common options}.
11179 @end table
11180
11181 @c ------------------------------------------------------------
11182 @item checkout [@var{options}] @var{modules}@dots{}
11183 Get a copy of the sources.  See @ref{checkout}.
11184
11185 @table @code
11186 @item -A
11187 Reset any sticky tags/date/options.  See @ref{Sticky
11188 tags} and @ref{Keyword substitution}.
11189
11190 @item -c
11191 Output the module database.  See @ref{checkout options}.
11192
11193 @item -D @var{date}
11194 Check out revisions as of @var{date} (is sticky).  See
11195 @ref{Common options}.
11196
11197 @item -d @var{dir}
11198 Check out into @var{dir}.  See @ref{checkout options}.
11199
11200 @item -f
11201 Use head revision if tag/date not found.  See
11202 @ref{Common options}.
11203
11204 @c Probably want to use rev1/rev2 style like for diff
11205 @c -r.  Here and in on-line help.
11206 @item -j @var{rev}
11207 Merge in changes.  See @ref{checkout options}.
11208
11209 @item -k @var{kflag}
11210 Use @var{kflag} keyword expansion.  See
11211 @ref{Substitution modes}.
11212
11213 @item -l
11214 Local; run only in current working directory.  @xref{Recursive behavior}.
11215
11216 @item -N
11217 Don't ``shorten'' module paths if -d specified.  See
11218 @ref{checkout options}.
11219
11220 @item -n
11221 Do not run module program (if any).  See @ref{checkout options}.
11222
11223 @item -P
11224 Prune empty directories.  See @ref{Moving directories}.
11225
11226 @item -p
11227 Check out files to standard output (avoids
11228 stickiness).  See @ref{checkout options}.
11229
11230 @item -R
11231 Operate recursively (default).  @xref{Recursive
11232 behavior}.
11233
11234 @item -r @var{tag}
11235 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11236
11237 @item -s
11238 Like -c, but include module status.  See @ref{checkout options}.
11239 @end table
11240
11241 @c ------------------------------------------------------------
11242 @item commit [@var{options}] [@var{files}@dots{}]
11243 Check changes into the repository.  See @ref{commit}.
11244
11245 @table @code
11246 @item -F @var{file}
11247 Read log message from @var{file}.  See @ref{commit options}.
11248
11249 @item -f
11250 @c What is this "disables recursion"?  It is from the
11251 @c on-line help; is it documented in this manual?
11252 Force the file to be committed; disables recursion.
11253 See @ref{commit options}.
11254
11255 @item -l
11256 Local; run only in current working directory.  See @ref{Recursive behavior}.
11257
11258 @item -m @var{msg}
11259 Use @var{msg} as log message.  See @ref{commit options}.
11260
11261 @item -n
11262 Do not run module program (if any).  See @ref{commit options}.
11263
11264 @item -R
11265 Operate recursively (default).  @xref{Recursive
11266 behavior}.
11267
11268 @item -r @var{rev}
11269 Commit to @var{rev}.  See @ref{commit options}.
11270 @c FIXME: should be dragging over text from
11271 @c commit options, especially if it can be cleaned up
11272 @c and made concise enough.
11273 @end table
11274
11275 @c ------------------------------------------------------------
11276 @item diff [@var{options}] [@var{files}@dots{}]
11277 Show differences between revisions.  See @ref{diff}.
11278 In addition to the options shown below, accepts a wide
11279 variety of options to control output style, for example
11280 @samp{-c} for context diffs.
11281
11282 @table @code
11283 @item -D @var{date1}
11284 Diff revision for date against working file.  See
11285 @ref{diff options}.
11286
11287 @item -D @var{date2}
11288 Diff @var{rev1}/@var{date1} against @var{date2}.  See
11289 @ref{diff options}.
11290
11291 @item -l
11292 Local; run only in current working directory.  See @ref{Recursive behavior}.
11293
11294 @item -N
11295 Include diffs for added and removed files.  See
11296 @ref{diff options}.
11297
11298 @item -R
11299 Operate recursively (default).  @xref{Recursive
11300 behavior}.
11301
11302 @item -r @var{rev1}
11303 Diff revision for @var{rev1} against working file.  See
11304 @ref{diff options}.
11305
11306 @item -r @var{rev2}
11307 Diff @var{rev1}/@var{date1} against @var{rev2}.  See @ref{diff options}.
11308 @end table
11309
11310 @c ------------------------------------------------------------
11311 @item edit [@var{options}] [@var{files}@dots{}]
11312 Get ready to edit a watched file.  See @ref{Editing files}.
11313
11314 @table @code
11315 @item -a @var{actions}
11316 Specify actions for temporary watch, where
11317 @var{actions} is @code{edit}, @code{unedit},
11318 @code{commit}, @code{all}, or @code{none}.  See
11319 @ref{Editing files}.
11320
11321 @item -l
11322 Local; run only in current working directory.  See @ref{Recursive behavior}.
11323
11324 @item -R
11325 Operate recursively (default).  @xref{Recursive
11326 behavior}.
11327 @end table
11328
11329 @c ------------------------------------------------------------
11330 @item editors [@var{options}] [@var{files}@dots{}]
11331 See who is editing a watched file.  See @ref{Watch information}.
11332
11333 @table @code
11334 @item -l
11335 Local; run only in current working directory.  See @ref{Recursive behavior}.
11336
11337 @item -R
11338 Operate recursively (default).  @xref{Recursive
11339 behavior}.
11340 @end table
11341
11342 @c ------------------------------------------------------------
11343 @item export [@var{options}] @var{modules}@dots{}
11344 Export files from @sc{cvs}.  See @ref{export}.
11345
11346 @table @code
11347 @item -D @var{date}
11348 Check out revisions as of @var{date}.  See
11349 @ref{Common options}.
11350
11351 @item -d @var{dir}
11352 Check out into @var{dir}.  See @ref{export options}.
11353
11354 @item -f
11355 Use head revision if tag/date not found.  See
11356 @ref{Common options}.
11357
11358 @item -k @var{kflag}
11359 Use @var{kflag} keyword expansion.  See
11360 @ref{Substitution modes}.
11361
11362 @item -l
11363 Local; run only in current working directory.  @xref{Recursive behavior}.
11364
11365 @item -N
11366 Don't ``shorten'' module paths if -d specified.  See
11367 @ref{export options}.
11368
11369 @item -n
11370 Do not run module program (if any).  See @ref{export options}.
11371
11372 @item -R
11373 Operate recursively (default).  @xref{Recursive
11374 behavior}.
11375
11376 @item -r @var{tag}
11377 Checkout revision @var{tag}.  See @ref{Common options}.
11378 @end table
11379
11380 @c ------------------------------------------------------------
11381 @item history [@var{options}] [@var{files}@dots{}]
11382 Show repository access history.  See @ref{history}.
11383
11384 @table @code
11385 @item -a
11386 All users (default is self).  See @ref{history options}.
11387
11388 @item -b @var{str}
11389 Back to record with @var{str} in module/file/repos
11390 field.  See @ref{history options}.
11391
11392 @item -c
11393 Report on committed (modified) files.  See @ref{history options}.
11394
11395 @item -D @var{date}
11396 Since @var{date}.  See @ref{history options}.
11397
11398 @item -e
11399 Report on all record types.  See @ref{history options}.
11400
11401 @item -l
11402 Last modified (committed or modified report).  See @ref{history options}.
11403
11404 @item -m @var{module}
11405 Report on @var{module} (repeatable).  See @ref{history options}.
11406
11407 @item -n @var{module}
11408 In @var{module}.  See @ref{history options}.
11409
11410 @item -o
11411 Report on checked out modules.  See @ref{history options}.
11412
11413 @item -p @var{repository}
11414 In @var{repository}.  See @ref{history options}.
11415
11416 @item -r @var{rev}
11417 Since revision @var{rev}.  See @ref{history options}.
11418
11419 @item -T
11420 @c What the @#$@# is a TAG?  Same as a tag?  This
11421 @c wording is also in the online-line help.
11422 Produce report on all TAGs.  See @ref{history options}.
11423
11424 @item -t @var{tag}
11425 Since tag record placed in history file (by anyone).
11426 See @ref{history options}.
11427
11428 @item -u @var{user}
11429 For user @var{user} (repeatable).  See @ref{history options}.
11430
11431 @item -w
11432 Working directory must match.  See @ref{history options}.
11433
11434 @item -x @var{types}
11435 Report on @var{types}, one or more of
11436 @code{TOEFWUPCGMAR}.  See @ref{history options}.
11437
11438 @item -z @var{zone}
11439 Output for time zone @var{zone}.  See @ref{history options}.
11440 @end table
11441
11442 @c ------------------------------------------------------------
11443 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
11444 Import files into @sc{cvs}, using vendor branches.  See
11445 @ref{import}.
11446
11447 @table @code
11448 @item -b @var{bra}
11449 Import to vendor branch @var{bra}.  See
11450 @ref{Multiple vendor branches}.
11451
11452 @item -d
11453 Use the file's modification time as the time of
11454 import.  See @ref{import options}.
11455
11456 @item -k @var{kflag}
11457 Set default keyword substitution mode.  See
11458 @ref{import options}.
11459
11460 @item -m @var{msg}
11461 Use @var{msg} for log message.  See
11462 @ref{import options}.
11463
11464 @item -I @var{ign}
11465 More files to ignore (! to reset).  See
11466 @ref{import options}.
11467
11468 @item -W @var{spec}
11469 More wrappers.  See @ref{import options}.
11470 @end table
11471
11472 @c ------------------------------------------------------------
11473 @item init
11474 Create a @sc{cvs} repository if it doesn't exist.  See
11475 @ref{Creating a repository}.
11476
11477 @c ------------------------------------------------------------
11478 @item kserver
11479 Kerberos authenticated server.
11480 See @ref{Kerberos authenticated}.
11481
11482 @c ------------------------------------------------------------
11483 @item log [@var{options}] [@var{files}@dots{}]
11484 Print out history information for files.  See @ref{log}.
11485
11486 @table @code
11487 @item -b
11488 Only list revisions on the default branch.  See @ref{log options}.
11489
11490 @item -d @var{dates}
11491 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
11492 latest before).  See @ref{log options}.
11493
11494 @item -h
11495 Only print header.  See @ref{log options}.
11496
11497 @item -l
11498 Local; run only in current working directory.  See @ref{Recursive behavior}.
11499
11500 @item -N
11501 Do not list tags.  See @ref{log options}.
11502
11503 @item -R
11504 Only print name of RCS file.  See @ref{log options}.
11505
11506 @item -r@var{revs}
11507 Only list revisions @var{revs}.  See @ref{log options}.
11508
11509 @item -s @var{states}
11510 Only list revisions with specified states.  See @ref{log options}.
11511
11512 @item -t
11513 Only print header and descriptive text.  See @ref{log
11514 options}.
11515
11516 @item -w@var{logins}
11517 Only list revisions checked in by specified logins.  See @ref{log options}.
11518 @end table
11519
11520 @c ------------------------------------------------------------
11521 @item login
11522 Prompt for password for authenticating server.  See
11523 @ref{Password authentication client}.
11524
11525 @c ------------------------------------------------------------
11526 @item logout
11527 Remove stored password for authenticating server.  See
11528 @ref{Password authentication client}.
11529
11530 @c ------------------------------------------------------------
11531 @item pserver
11532 Password authenticated server.
11533 See @ref{Password authentication server}.
11534
11535 @c ------------------------------------------------------------
11536 @item rannotate [@var{options}] [@var{modules}@dots{}]
11537 Show last revision where each line was modified.  See
11538 @ref{annotate}.
11539
11540 @table @code
11541 @item -D @var{date}
11542 Annotate the most recent revision no later than
11543 @var{date}.  See @ref{Common options}.
11544
11545 @item -F
11546 Force annotation of binary files.  (Without this option,
11547 binary files are skipped with a message.)
11548
11549 @item -f
11550 Use head revision if tag/date not found.  See
11551 @ref{Common options}.
11552
11553 @item -l
11554 Local; run only in current working directory.  @xref{Recursive behavior}.
11555
11556 @item -R
11557 Operate recursively (default).  @xref{Recursive behavior}.
11558
11559 @item -r @var{tag}
11560 Annotate revision @var{tag}.  See @ref{Common options}.
11561 @end table
11562
11563 @c ------------------------------------------------------------
11564 @item rdiff [@var{options}] @var{modules}@dots{}
11565 Show differences between releases.  See @ref{rdiff}.
11566
11567 @table @code
11568 @item -c
11569 Context diff output format (default).  See @ref{rdiff options}.
11570
11571 @item -D @var{date}
11572 Select revisions based on @var{date}.  See @ref{Common options}.
11573
11574 @item -f
11575 Use head revision if tag/date not found.  See
11576 @ref{Common options}.
11577
11578 @item -l
11579 Local; run only in current working directory.  See @ref{Recursive behavior}.
11580
11581 @item -R
11582 Operate recursively (default).  @xref{Recursive
11583 behavior}.
11584
11585 @item -r @var{rev}
11586 Select revisions based on @var{rev}.  See @ref{Common options}.
11587
11588 @item -s
11589 Short patch - one liner per file.  See @ref{rdiff options}.
11590
11591 @item -t
11592 Top two diffs - last change made to the file.  See
11593 @ref{diff options}.
11594
11595 @item -u
11596 Unidiff output format.  See @ref{rdiff options}.
11597
11598 @item -V @var{vers}
11599 Use RCS Version @var{vers} for keyword expansion (obsolete).  See
11600 @ref{rdiff options}.
11601 @end table
11602
11603 @c ------------------------------------------------------------
11604 @item release [@var{options}] @var{directory}
11605 Indicate that a directory is no longer in use.  See
11606 @ref{release}.
11607
11608 @table @code
11609 @item -d
11610 Delete the given directory.  See @ref{release options}.
11611 @end table
11612
11613 @c ------------------------------------------------------------
11614 @item remove [@var{options}] [@var{files}@dots{}]
11615 Remove an entry from the repository.  See @ref{Removing files}.
11616
11617 @table @code
11618 @item -f
11619 Delete the file before removing it.  See @ref{Removing files}.
11620
11621 @item -l
11622 Local; run only in current working directory.  See @ref{Recursive behavior}.
11623
11624 @item -R
11625 Operate recursively (default).  @xref{Recursive
11626 behavior}.
11627 @end table
11628
11629 @c ------------------------------------------------------------
11630 @item rlog [@var{options}] [@var{files}@dots{}]
11631 Print out history information for modules.  See @ref{log}.
11632
11633 @table @code
11634 @item -b
11635 Only list revisions on the default branch.  See @ref{log options}.
11636
11637 @item -d @var{dates}
11638 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
11639 latest before).  See @ref{log options}.
11640
11641 @item -h
11642 Only print header.  See @ref{log options}.
11643
11644 @item -l
11645 Local; run only in current working directory.  See @ref{Recursive behavior}.
11646
11647 @item -N
11648 Do not list tags.  See @ref{log options}.
11649
11650 @item -R
11651 Only print name of RCS file.  See @ref{log options}.
11652
11653 @item -r@var{revs}
11654 Only list revisions @var{revs}.  See @ref{log options}.
11655
11656 @item -s @var{states}
11657 Only list revisions with specified states.  See @ref{log options}.
11658
11659 @item -t
11660 Only print header and descriptive text.  See @ref{log options}.
11661
11662 @item -w@var{logins}
11663 Only list revisions checked in by specified logins.  See @ref{log options}.
11664 @end table
11665
11666 @c ------------------------------------------------------------
11667 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
11668 Add a symbolic tag to a module.
11669 See @ref{Revisions} and @ref{Branching and merging}.
11670
11671 @table @code
11672 @item -a
11673 Clear tag from removed files that would not otherwise
11674 be tagged.  See @ref{Tagging add/remove}.
11675
11676 @item -b
11677 Create a branch named @var{tag}.  See @ref{Branching and merging}.
11678
11679 @item -B
11680 Used in conjunction with -F or -d, enables movement and deletion of
11681 branch tags.  Use with extreme caution. 
11682
11683 @item -D @var{date}
11684 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
11685
11686 @item -d
11687 Delete @var{tag}.  See @ref{Modifying tags}.
11688
11689 @item -F
11690 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
11691
11692 @item -f
11693 Force a head revision match if tag/date not found.
11694 See @ref{Tagging by date/tag}.
11695
11696 @item -l
11697 Local; run only in current working directory.  See @ref{Recursive behavior}.
11698
11699 @item -n
11700 No execution of tag program.  See @ref{Common options}.
11701
11702 @item -R
11703 Operate recursively (default).  @xref{Recursive
11704 behavior}.
11705
11706 @item -r @var{rev}
11707 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
11708 @end table
11709
11710 @c ------------------------------------------------------------
11711 @item server
11712 Rsh server.  See @ref{Connecting via rsh}.
11713
11714 @c ------------------------------------------------------------
11715 @item status [@var{options}] @var{files}@dots{}
11716 Display status information in a working directory.  See
11717 @ref{File status}.
11718
11719 @table @code
11720 @item -l
11721 Local; run only in current working directory.  See @ref{Recursive behavior}.
11722
11723 @item -R
11724 Operate recursively (default).  @xref{Recursive
11725 behavior}.
11726
11727 @item -v
11728 Include tag information for file.  See @ref{Tags}.
11729 @end table
11730
11731 @c ------------------------------------------------------------
11732 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
11733 Add a symbolic tag to checked out version of files.
11734 See @ref{Revisions} and @ref{Branching and merging}.
11735
11736 @table @code
11737 @item -b
11738 Create a branch named @var{tag}.  See @ref{Branching and merging}.
11739
11740 @item -c
11741 Check that working files are unmodified.  See
11742 @ref{Tagging the working directory}.
11743
11744 @item -D @var{date}
11745 Tag revisions as of @var{date}.  See @ref{Tagging by date/tag}.
11746
11747 @item -d
11748 Delete @var{tag}.  See @ref{Modifying tags}.
11749
11750 @item -F
11751 Move @var{tag} if it already exists.  See @ref{Modifying tags}.
11752
11753 @item -f
11754 Force a head revision match if tag/date not found.
11755 See @ref{Tagging by date/tag}.
11756
11757 @item -l
11758 Local; run only in current working directory.  See @ref{Recursive behavior}.
11759
11760 @item -R
11761 Operate recursively (default).  @xref{Recursive
11762 behavior}.
11763
11764 @item -r @var{rev}
11765 Tag existing tag @var{rev}.  See @ref{Tagging by date/tag}.
11766 @end table
11767
11768 @c ------------------------------------------------------------
11769 @item unedit [@var{options}] [@var{files}@dots{}]
11770 Undo an edit command.  See @ref{Editing files}.
11771
11772 @table @code
11773 @item -l
11774 Local; run only in current working directory.  See @ref{Recursive behavior}.
11775
11776 @item -R
11777 Operate recursively (default).  @xref{Recursive behavior}.
11778 @end table
11779
11780 @c ------------------------------------------------------------
11781 @item update [@var{options}] [@var{files}@dots{}]
11782 Bring work tree in sync with repository.  See
11783 @ref{update}.
11784
11785 @table @code
11786 @item -A
11787 Reset any sticky tags/date/options.  See @ref{Sticky
11788 tags} and @ref{Keyword substitution}.
11789
11790 @item -C
11791 Overwrite locally modified files with clean copies from
11792 the repository (the modified file is saved in
11793 @file{.#@var{file}.@var{revision}}, however).
11794
11795 @item -D @var{date}
11796 Check out revisions as of @var{date} (is sticky).  See
11797 @ref{Common options}.
11798
11799 @item -d
11800 Create directories.  See @ref{update options}.
11801
11802 @item -f
11803 Use head revision if tag/date not found.  See
11804 @ref{Common options}.
11805
11806 @item -I @var{ign}
11807 More files to ignore (! to reset).  See
11808 @ref{import options}.
11809
11810 @c Probably want to use rev1/rev2 style like for diff
11811 @c -r.  Here and in on-line help.
11812 @item -j @var{rev}
11813 Merge in changes.  See @ref{update options}.
11814
11815 @item -k @var{kflag}
11816 Use @var{kflag} keyword expansion.  See
11817 @ref{Substitution modes}.
11818
11819 @item -l
11820 Local; run only in current working directory.  @xref{Recursive behavior}.
11821
11822 @item -P
11823 Prune empty directories.  See @ref{Moving directories}.
11824
11825 @item -p
11826 Check out files to standard output (avoids
11827 stickiness).  See @ref{update options}.
11828
11829 @item -R
11830 Operate recursively (default).  @xref{Recursive
11831 behavior}.
11832
11833 @item -r @var{tag}
11834 Checkout revision @var{tag} (is sticky).  See @ref{Common options}.
11835
11836 @item -W @var{spec}
11837 More wrappers.  See @ref{import options}.
11838 @end table
11839
11840 @c ------------------------------------------------------------
11841 @item version
11842 @cindex version (subcommand)
11843
11844 Display the version of @sc{cvs} being used.  If the repository
11845 is remote, display both the client and server versions.
11846
11847 @c ------------------------------------------------------------
11848 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
11849
11850 on/off: turn on/off read-only checkouts of files.  See
11851 @ref{Setting a watch}.
11852
11853 add/remove: add or remove notification on actions.  See
11854 @ref{Getting Notified}.
11855
11856 @table @code
11857 @item -a @var{actions}
11858 Specify actions for temporary watch, where
11859 @var{actions} is @code{edit}, @code{unedit},
11860 @code{commit}, @code{all}, or @code{none}.  See
11861 @ref{Editing files}.
11862
11863 @item -l
11864 Local; run only in current working directory.  See @ref{Recursive behavior}.
11865
11866 @item -R
11867 Operate recursively (default).  @xref{Recursive
11868 behavior}.
11869 @end table
11870
11871 @c ------------------------------------------------------------
11872 @item watchers [@var{options}] [@var{files}@dots{}]
11873 See who is watching a file.  See @ref{Watch information}.
11874
11875 @table @code
11876 @item -l
11877 Local; run only in current working directory.  See @ref{Recursive behavior}.
11878
11879 @item -R
11880 Operate recursively (default).  @xref{Recursive
11881 behavior}.
11882 @end table
11883
11884 @end table
11885
11886 @c ---------------------------------------------------------------------
11887 @node Administrative files
11888 @appendix Reference manual for Administrative files
11889 @cindex Administrative files (reference)
11890 @cindex Files, reference manual
11891 @cindex Reference manual (files)
11892 @cindex CVSROOT (file)
11893
11894 @c FIXME?  Somewhere there needs to be a more "how-to"
11895 @c guide to writing these.  I think the triggers
11896 @c (commitinfo, loginfo, taginfo, &c) are perhaps a
11897 @c different case than files like modules.  One
11898 @c particular issue that people sometimes are
11899 @c (unnecessarily?) worried about is performance, and
11900 @c the impact of writing in perl or sh or ____.
11901 Inside the repository, in the directory
11902 @file{$CVSROOT/CVSROOT}, there are a number of
11903 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
11904 fashion without any of them, but if they are set up
11905 properly they can help make life easier.  For a
11906 discussion of how to edit them, see @ref{Intro
11907 administrative files}.
11908
11909 The most important of these files is the @file{modules}
11910 file, which defines the modules inside the repository.
11911
11912 @menu
11913 * modules::                     Defining modules
11914 * Wrappers::                    Specify binary-ness based on file name
11915 * Trigger Scripts::             Some notes on the commit support files and
11916                                 taginfo, referenced below.
11917 * commit files::                The commit support files (commitinfo,
11918                                 verifymsg, editinfo, loginfo)
11919 * taginfo::                     Verifying/Logging tags
11920 * rcsinfo::                     Templates for the log messages
11921 * cvsignore::                   Ignoring files via cvsignore
11922 * checkoutlist::                Adding your own administrative files
11923 * history file::                History information
11924 * Variables::                   Various variables are expanded
11925 * config::                      Miscellaneous CVS configuration
11926 @end menu
11927
11928 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11929 @node modules
11930 @appendixsec The modules file
11931 @cindex Modules (admin file)
11932 @cindex Defining modules (reference manual)
11933
11934 The @file{modules} file records your definitions of
11935 names for collections of source code.  @sc{cvs} will
11936 use these definitions if you use @sc{cvs} to update the
11937 modules file (use normal commands like @code{add},
11938 @code{commit}, etc).
11939
11940 The @file{modules} file may contain blank lines and
11941 comments (lines beginning with @samp{#}) as well as
11942 module definitions.  Long lines can be continued on the
11943 next line by specifying a backslash (@samp{\}) as the
11944 last character on the line.
11945
11946 There are three basic types of modules: alias modules,
11947 regular modules, and ampersand modules.  The difference
11948 between them is the way that they map files in the
11949 repository to files in the working directory.  In all
11950 of the following examples, the top-level repository
11951 contains a directory called @file{first-dir}, which
11952 contains two files, @file{file1} and @file{file2}, and a
11953 directory @file{sdir}.  @file{first-dir/sdir} contains
11954 a file @file{sfile}.
11955
11956 @c FIXME: should test all the examples in this section.
11957
11958 @menu
11959 * Alias modules::             The simplest kind of module
11960 * Regular modules::
11961 * Ampersand modules::
11962 * Excluding directories::     Excluding directories from a module
11963 * Module options::            Regular and ampersand modules can take options
11964 * Module program options::    How the modules ``program options'' programs
11965                               are run. 
11966 @end menu
11967
11968 @node Alias modules
11969 @appendixsubsec Alias modules
11970 @cindex Alias modules
11971 @cindex -a, in modules file
11972
11973 Alias modules are the simplest kind of module:
11974
11975 @table @code
11976 @item @var{mname} -a @var{aliases}@dots{}
11977 This represents the simplest way of defining a module
11978 @var{mname}.  The @samp{-a} flags the definition as a
11979 simple alias: @sc{cvs} will treat any use of @var{mname} (as
11980 a command argument) as if the list of names
11981 @var{aliases} had been specified instead.
11982 @var{aliases} may contain either other module names or
11983 paths.  When you use paths in aliases, @code{checkout}
11984 creates all intermediate directories in the working
11985 directory, just as if the path had been specified
11986 explicitly in the @sc{cvs} arguments.
11987 @end table
11988
11989 For example, if the modules file contains:
11990
11991 @example
11992 amodule -a first-dir
11993 @end example
11994
11995 @noindent
11996 then the following two commands are equivalent:
11997
11998 @example
11999 $ cvs co amodule
12000 $ cvs co first-dir
12001 @end example
12002
12003 @noindent
12004 and they each would provide output such as:
12005
12006 @example
12007 cvs checkout: Updating first-dir
12008 U first-dir/file1
12009 U first-dir/file2
12010 cvs checkout: Updating first-dir/sdir
12011 U first-dir/sdir/sfile
12012 @end example
12013
12014 @node Regular modules
12015 @appendixsubsec Regular modules
12016 @cindex Regular modules
12017
12018 @table @code
12019 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12020 In the simplest case, this form of module definition
12021 reduces to @samp{@var{mname} @var{dir}}.  This defines
12022 all the files in directory @var{dir} as module mname.
12023 @var{dir} is a relative path (from @code{$CVSROOT}) to a
12024 directory of source in the source repository.  In this
12025 case, on checkout, a single directory called
12026 @var{mname} is created as a working directory; no
12027 intermediate directory levels are used by default, even
12028 if @var{dir} was a path involving several directory
12029 levels.
12030 @end table
12031
12032 For example, if a module is defined by:
12033
12034 @example
12035 regmodule first-dir
12036 @end example
12037
12038 @noindent
12039 then regmodule will contain the files from first-dir:
12040
12041 @example
12042 $ cvs co regmodule
12043 cvs checkout: Updating regmodule
12044 U regmodule/file1
12045 U regmodule/file2
12046 cvs checkout: Updating regmodule/sdir
12047 U regmodule/sdir/sfile
12048 $
12049 @end example
12050
12051 By explicitly specifying files in the module definition
12052 after @var{dir}, you can select particular files from
12053 directory @var{dir}.  Here is
12054 an example:
12055
12056 @example
12057 regfiles first-dir/sdir sfile
12058 @end example
12059
12060 @noindent
12061 With this definition, getting the regfiles module
12062 will create a single working directory
12063 @file{regfiles} containing the file listed, which
12064 comes from a directory deeper
12065 in the @sc{cvs} source repository:
12066
12067 @example
12068 $ cvs co regfiles
12069 U regfiles/sfile
12070 $
12071 @end example
12072
12073 @node Ampersand modules
12074 @appendixsubsec Ampersand modules
12075 @cindex Ampersand modules
12076 @cindex &, in modules file
12077
12078 A module definition can refer to other modules by
12079 including @samp{&@var{module}} in its definition.
12080 @example
12081 @var{mname} [ options ] @var{&module}@dots{}
12082 @end example
12083
12084 Then getting the module creates a subdirectory for each such
12085 module, in the directory containing the module.  For
12086 example, if modules contains
12087
12088 @example
12089 ampermod &first-dir
12090 @end example
12091
12092 @noindent
12093 then a checkout will create an @code{ampermod} directory
12094 which contains a directory called @code{first-dir},
12095 which in turns contains all the directories and files
12096 which live there.  For example, the command
12097
12098 @example
12099 $ cvs co ampermod
12100 @end example
12101
12102 @noindent
12103 will create the following files:
12104
12105 @example
12106 ampermod/first-dir/file1
12107 ampermod/first-dir/file2
12108 ampermod/first-dir/sdir/sfile
12109 @end example
12110
12111 There is one quirk/bug: the messages that @sc{cvs}
12112 prints omit the @file{ampermod}, and thus do not
12113 correctly display the location to which it is checking
12114 out the files:
12115
12116 @example
12117 $ cvs co ampermod
12118 cvs checkout: Updating first-dir
12119 U first-dir/file1
12120 U first-dir/file2
12121 cvs checkout: Updating first-dir/sdir
12122 U first-dir/sdir/sfile
12123 $
12124 @end example
12125
12126 Do not rely on this buggy behavior; it may get fixed in
12127 a future release of @sc{cvs}.
12128
12129 @c FIXCVS: What happens if regular and & modules are
12130 @c combined, as in "ampermodule first-dir &second-dir"?
12131 @c When I tried it, it seemed to just ignore the
12132 @c "first-dir".  I think perhaps it should be an error
12133 @c (but this needs further investigation).
12134 @c In addition to discussing what each one does, we
12135 @c should put in a few words about why you would use one or
12136 @c the other in various situations.
12137
12138 @node Excluding directories
12139 @appendixsubsec Excluding directories
12140 @cindex Excluding directories, in modules file
12141 @cindex !, in modules file
12142
12143 An alias module may exclude particular directories from
12144 other modules by using an exclamation mark (@samp{!})
12145 before the name of each directory to be excluded.
12146
12147 For example, if the modules file contains:
12148
12149 @example
12150 exmodule -a !first-dir/sdir first-dir
12151 @end example
12152
12153 @noindent
12154 then checking out the module @samp{exmodule} will check
12155 out everything in @samp{first-dir} except any files in
12156 the subdirectory @samp{first-dir/sdir}.
12157 @c Note that the "!first-dir/sdir" sometimes must be listed
12158 @c before "first-dir".  That seems like a probable bug, in which
12159 @c case perhaps it should be fixed (to allow either
12160 @c order) rather than documented.  See modules4 in testsuite.
12161
12162 @node Module options
12163 @appendixsubsec Module options
12164 @cindex Options, in modules file
12165
12166 Either regular modules or ampersand modules can contain
12167 options, which supply additional information concerning
12168 the module.
12169
12170 @table @code
12171 @cindex -d, in modules file
12172 @item -d @var{name}
12173 Name the working directory something other than the
12174 module name.
12175 @c FIXME: Needs a bunch of examples, analogous to the
12176 @c examples for alias, regular, and ampersand modules
12177 @c which show where the files go without -d.
12178
12179 @cindex Export program
12180 @cindex -e, in modules file
12181 @item -e @var{prog}
12182 Specify a program @var{prog} to run whenever files in a
12183 module are exported.  @var{prog} runs with a single
12184 argument, the module name.
12185 @c FIXME: Is it run on server? client?
12186
12187 @cindex Checkout program
12188 @cindex -o, in modules file
12189 @item -o @var{prog}
12190 Specify a program @var{prog} to run whenever files in a
12191 module are checked out.  @var{prog} runs with a single
12192 argument, the module name.  See @ref{Module program options} for
12193 information on how @var{prog} is called.
12194 @c FIXME: Is it run on server? client?
12195
12196 @cindex Status of a module
12197 @cindex Module status
12198 @cindex -s, in modules file
12199 @item -s @var{status}
12200 Assign a status to the module.  When the module file is
12201 printed with @samp{cvs checkout -s} the modules are
12202 sorted according to primarily module status, and
12203 secondarily according to the module name.  This option
12204 has no other meaning.  You can use this option for
12205 several things besides status: for instance, list the
12206 person that is responsible for this module.
12207
12208 @cindex Tag program
12209 @cindex -t, in modules file
12210 @item -t @var{prog}
12211 Specify a program @var{prog} to run whenever files in a
12212 module are tagged with @code{rtag}.  @var{prog} runs
12213 with two arguments: the module name and the symbolic
12214 tag specified to @code{rtag}.  It is not run
12215 when @code{tag} is executed.  Generally you will find
12216 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
12217 @c FIXME: Is it run on server? client?
12218 @c Problems with -t include:
12219 @c * It is run after the tag not before
12220 @c * It doesn't get passed all the information that
12221 @c   taginfo does ("mov", &c).
12222 @c * It only is run for rtag, not tag.
12223 @end table
12224
12225 You should also see @pxref{Module program options} about how the
12226 ``program options'' programs are run.
12227
12228 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12229
12230 @node Module program options
12231 @appendixsubsec How the modules file ``program options'' programs are run
12232 @cindex Modules file program options
12233 @cindex -t, in modules file
12234 @cindex -o, in modules file
12235 @cindex -e, in modules file
12236
12237 @noindent
12238 For checkout, rtag, and export, the program is server-based, and as such the
12239 following applies:-
12240
12241 If using remote access methods (pserver, ext, etc.),
12242 @sc{cvs} will execute this program on the server from a temporary
12243 directory. The path is searched for this program.
12244
12245 If using ``local access'' (on a local or remote NFS file system, i.e.
12246 repository set just to a path),
12247 the program will be executed from the newly checked-out tree, if
12248 found there, or alternatively searched for in the path if not.
12249
12250 The programs are all run after the operation has effectively
12251 completed.
12252
12253
12254 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12255 @node Wrappers
12256 @appendixsec The cvswrappers file
12257 @cindex cvswrappers (admin file)
12258 @cindex CVSWRAPPERS, environment variable
12259 @cindex Wrappers
12260
12261 @c FIXME: need some better way of separating this out
12262 @c by functionality.  -m is
12263 @c one feature, and -k is a another.  And this discussion
12264 @c should be better motivated (e.g. start with the
12265 @c problems, then explain how the feature solves it).
12266
12267 Wrappers refers to a @sc{cvs} feature which lets you
12268 control certain settings based on the name of the file
12269 which is being operated on.  The settings are @samp{-k}
12270 for binary files, and @samp{-m} for nonmergeable text
12271 files.
12272
12273 The @samp{-m} option
12274 specifies the merge methodology that should be used when
12275 a non-binary file is updated.  @code{MERGE} means the usual
12276 @sc{cvs} behavior: try to merge the files.  @code{COPY}
12277 means that @code{cvs update} will refuse to merge
12278 files, as it also does for files specified as binary
12279 with @samp{-kb} (but if the file is specified as
12280 binary, there is no need to specify @samp{-m 'COPY'}).
12281 @sc{cvs} will provide the user with the
12282 two versions of the files, and require the user using
12283 mechanisms outside @sc{cvs}, to insert any necessary
12284 changes.
12285
12286 @strong{WARNING: do not use @code{COPY} with
12287 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
12288 copy one version of your file over the other, wiping
12289 out the previous contents.}
12290 @c Ordinarily we don't document the behavior of old
12291 @c versions.  But this one is so dangerous, I think we
12292 @c must.  I almost renamed it to -m 'NOMERGE' so we
12293 @c could say "never use -m 'COPY'".
12294 The @samp{-m} wrapper option only affects behavior when
12295 merging is done on update; it does not affect how files
12296 are stored.  See @ref{Binary files}, for more on
12297 binary files.
12298
12299 The basic format of the file @file{cvswrappers} is:
12300
12301 @c FIXME: @example is all wrong for this.  Use @deffn or
12302 @c something more sensible.
12303 @example
12304 wildcard     [option value][option value]...
12305
12306 where option is one of
12307 -m           update methodology      value: MERGE or COPY
12308 -k           keyword expansion       value: expansion mode
12309
12310 and value is a single-quote delimited value.
12311 @end example
12312
12313 @ignore
12314 @example
12315 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
12316 *.c      -t 'indent %s %s'
12317 @end example
12318 @c When does the filter need to be an absolute pathname
12319 @c and when will something like the above work?  I
12320 @c suspect it relates to the PATH of the server (which
12321 @c in turn depends on all kinds of stuff, e.g. inetd
12322 @c for pserver).  I'm not sure whether/where to discuss
12323 @c this.
12324 @c FIXME: What do the %s's stand for?
12325
12326 @noindent
12327 The above example of a @file{cvswrappers} file
12328 states that all files/directories that end with a @code{.nib}
12329 should be filtered with the @file{wrap} program before
12330 checking the file into the repository. The file should
12331 be filtered though the @file{unwrap} program when the
12332 file is checked out of the repository. The
12333 @file{cvswrappers} file also states that a @code{COPY}
12334 methodology should be used when updating the files in
12335 the repository (that is, no merging should be performed).
12336
12337 @c What pitfalls arise when using indent this way?  Is
12338 @c it a winning thing to do?  Would be nice to at least
12339 @c hint at those issues; we want our examples to tell
12340 @c how to solve problems, not just to say that cvs can
12341 @c do certain things.
12342 The last example line says that all files that end with
12343 @code{.c} should be filtered with @file{indent}
12344 before being checked into the repository. Unlike the previous
12345 example, no filtering of the @code{.c} file is done when
12346 it is checked out of the repository.
12347 @noindent
12348 The @code{-t} filter is called with two arguments,
12349 the first is the name of the file/directory to filter
12350 and the second is the pathname to where the resulting
12351 filtered file should be placed.
12352
12353 @noindent
12354 The @code{-f} filter is called with one argument,
12355 which is the name of the file to filter from. The end
12356 result of this filter will be a file in the users directory
12357 that they can work on as they normally would.
12358
12359 Note that the @samp{-t}/@samp{-f} features do not
12360 conveniently handle one portion of @sc{cvs}'s operation:
12361 determining when files are modified.  @sc{cvs} will still
12362 want a file (or directory) to exist, and it will use
12363 its modification time to determine whether a file is
12364 modified.  If @sc{cvs} erroneously thinks a file is
12365 unmodified (for example, a directory is unchanged but
12366 one of the files within it is changed), you can force
12367 it to check in the file anyway by specifying the
12368 @samp{-f} option to @code{cvs commit} (@pxref{commit
12369 options}).
12370 @c This is, of course, a serious design flaw in -t/-f.
12371 @c Probably the whole functionality needs to be
12372 @c redesigned (starting from requirements) to fix this.
12373 @end ignore
12374
12375 @c FIXME: We don't document -W or point to where it is
12376 @c documented.  Or .cvswrappers.
12377 For example, the following command imports a
12378 directory, treating files whose name ends in
12379 @samp{.exe} as binary:
12380
12381 @example
12382 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
12383 @end example
12384
12385 @c Another good example, would be storing files
12386 @c (e.g. binary files) compressed in the repository.
12387 @c      ::::::::::::::::::
12388 @c      cvswrappers
12389 @c      ::::::::::::::::::
12390 @c      *.t12 -m 'COPY'
12391 @c      *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
12392 @c
12393 @c      ::::::::::::::::::
12394 @c      gunzipcp
12395 @c      ::::::::::::::::::
12396 @c      :
12397 @c      [ -f $1 ] || exit 1
12398 @c      zcat $1 > /tmp/.#$1.$$
12399 @c      mv /tmp/.#$1.$$ $1
12400 @c
12401 @c      ::::::::::::::::::
12402 @c      gzipcp
12403 @c      ::::::::::::::::::
12404 @c      :
12405 @c      DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
12406 @c      if [ ! -d $DIRNAME ] ; then
12407 @c            DIRNAME=`echo $1 | sed -e "s|.*/||g"`
12408 @c      fi
12409 @c      gzip -c  $DIRNAME  > $2
12410 @c One catch--"cvs diff" will not invoke the wrappers
12411 @c (probably a CVS bug, although I haven't thought it out).
12412
12413 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12414 @node Trigger Scripts
12415 @appendixsec The Trigger Scripts
12416 @cindex Info files
12417 @cindex Trigger scripts
12418
12419 Several of the administrative files support triggers, or the launching external
12420 scripts or programs at specific times before or after particular events.  The
12421 individual files are discussed in the later sections, @ref{commit files} and
12422 @ref{taginfo}, but some of the common elements are discussed here.
12423
12424 All the trigger scripts are launched in a copy of the user sandbox being
12425 committed, on the server, in client-server mode.  In local mode, the scripts
12426 are actually launched directly from the user sandbox directory being committed.
12427 For most intents and purposes, the same scripts can be run in both locations
12428 without alteration.
12429
12430 @menu
12431 * syntax::                      The common syntax
12432 * Trigger Script Security::     Trigger script security
12433 @end menu
12434
12435 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12436 @node syntax
12437 @appendixsubsec The common syntax
12438 @cindex Info files (syntax)
12439 @cindex Syntax of info files
12440 @cindex Common syntax of info files
12441
12442 @c FIXME: having this so totally separate from the
12443 @c Variables node is rather bogus.
12444
12445 The administrative files such as @file{commitinfo},
12446 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
12447 all have a common format.  The purpose of the files are
12448 described later on.  The common syntax is described
12449 here.
12450
12451 @cindex Regular expression syntax
12452 Each line contains the following:
12453 @itemize @bullet
12454 @item
12455 @c Say anything about DEFAULT and ALL?  Right now we
12456 @c leave that to the description of each file (and in fact
12457 @c the practice is inconsistent which is really annoying).
12458 A regular expression.  This is a basic regular
12459 expression in the syntax used by GNU emacs.
12460 @c FIXME: What we probably should be saying is "POSIX Basic
12461 @c Regular Expression with the following extensions (`\('
12462 @c `\|' '+' etc)"
12463 @c rather than define it with reference to emacs.
12464 @c The reference to emacs is not strictly speaking
12465 @c true, as we don't support \=, \s, or \S.  Also it isn't
12466 @c clear we should document and/or promise to continue to
12467 @c support all the obscure emacs extensions like \<.
12468 @c Also need to better cite (or include) full
12469 @c documentation for the syntax.
12470 @c Also see comment in configure.in about what happens to the
12471 @c syntax if we pick up a system-supplied regexp matcher.
12472
12473 @item
12474 A whitespace separator---one or more spaces and/or tabs.
12475
12476 @item
12477 A file name or command-line template.
12478 @end itemize
12479
12480 @noindent
12481 Blank lines are ignored.  Lines that start with the
12482 character @samp{#} are treated as comments.  Long lines
12483 unfortunately can @emph{not} be broken in two parts in
12484 any way.
12485
12486 The first regular expression that matches the current
12487 directory name in the repository is used.  The rest of the line
12488 is used as a file name or command-line as appropriate.
12489
12490 @c FIXME: need an example.  In particular, show what
12491 @c the regular expression is matched against (one
12492 @c ordinarily clueful person got confused about whether it
12493 @c includes the filename--"directory name" above should be
12494 @c unambiguous but there is nothing like an example to
12495 @c confirm people's understanding of this sort of thing).
12496
12497 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12498 @node Trigger Script Security
12499 @appendixsubsec Security and the Trigger Scripts
12500 @cindex Info files, security
12501 @cindex Trigger scripts, security
12502
12503 Security is a huge subject, and implementing a secure system is a non-trivial
12504 task.  This section will barely touch on all the issues involved, but it is
12505 well to note that, as with any script you will be allowing an untrusted
12506 user to run on your server, there are measures you can take to help prevent
12507 your trigger scripts from being abused.
12508
12509 For instance, since the CVS trigger scripts all run in a copy of the user's
12510 sandbox on the server, a naively coded Perl trigger script which attempts to
12511 use a Perl module that is not installed on the system can be hijacked by any
12512 user with commit access who is checking in a file with the correct name.  Other
12513 scripting languages may be vulnerable to similar hacks.
12514
12515 One way to make a script more secure, at least with Perl, is to use scripts
12516 which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
12517 In the most basic terms, this causes Perl to avoid running code that may have
12518 come from an external source.  Please run the @code{perldoc perlsec} command
12519 for more on Perl security.  Again, other languages may implement other security
12520 verification hooks which look more or less like Perl's "taint-check" mechanism.
12521
12522 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12523 @node commit files
12524 @appendixsec The commit support files
12525 @cindex Committing, administrative support files
12526
12527 There are three kinds of trigger scripts (@pxref{Trigger Scripts}) that can be
12528 run at various times during a commit.  They are specified in files in the
12529 repository, as described below.  The following table summarizes the
12530 file names and the purpose of the corresponding programs.
12531
12532 @table @file
12533 @item commitinfo
12534 The program is responsible for checking that the commit
12535 is allowed.  If it exits with a non-zero exit status
12536 the commit will be aborted.
12537
12538 @item verifymsg
12539 The specified program is used to evaluate the log message,
12540 and possibly verify that it contains all required
12541 fields.  This is most useful in combination with the
12542 @file{rcsinfo} file, which can hold a log message
12543 template (@pxref{rcsinfo}).
12544
12545 @item editinfo
12546 The specified program is used to edit the log message,
12547 and possibly verify that it contains all required
12548 fields.  This is most useful in combination with the
12549 @file{rcsinfo} file, which can hold a log message
12550 template (@pxref{rcsinfo}).  (obsolete)
12551
12552 @item loginfo
12553 The specified program is called when the commit is
12554 complete.  It receives the log message and some
12555 additional information and can store the log message in
12556 a file, or mail it to appropriate persons, or maybe
12557 post it to a local newsgroup, or@dots{}  Your
12558 imagination is the limit!
12559 @end table
12560
12561 @menu
12562 * commitinfo::                  Pre-commit checking
12563 * verifymsg::                   How are log messages evaluated?
12564 * editinfo::                    Specifying how log messages are created
12565                                 (obsolete)
12566 * loginfo::                     Where should log messages be sent?
12567 @end menu
12568
12569 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12570 @node commitinfo
12571 @appendixsubsec Commitinfo
12572 @cindex @file{commitinfo}
12573 @cindex Commits, precommit verification of
12574 @cindex Precommit checking
12575
12576 The @file{commitinfo} file defines programs to execute
12577 whenever @samp{cvs commit} is about to execute.  These
12578 programs are used for pre-commit checking to verify
12579 that the modified, added and removed files are really
12580 ready to be committed.  This could be used, for
12581 instance, to verify that the changed files conform to
12582 to your site's standards for coding practice.
12583
12584 As mentioned earlier, each line in the
12585 @file{commitinfo} file consists of a regular expression
12586 and a command-line template.  The template can include
12587 a program name and any number of arguments you wish to
12588 supply to it.  The full path to the current source
12589 repository is appended to the template, followed by the
12590 file names of any files involved in the commit (added,
12591 removed, and modified files).
12592
12593 @cindex Exit status, of commitinfo
12594 The first line with a regular expression matching the
12595 directory within the repository will be used.  If the
12596 command returns a non-zero exit status the commit will
12597 be aborted.
12598 @c FIXME: need example(s) of what "directory within the
12599 @c repository" means.
12600
12601 @cindex DEFAULT in commitinfo
12602 If the repository name does not match any of the
12603 regular expressions in this file, the @samp{DEFAULT}
12604 line is used, if it is specified.
12605
12606 @cindex ALL in commitinfo
12607 All occurrences of the name @samp{ALL} appearing as a
12608 regular expression are used in addition to the first
12609 matching regular expression or the name @samp{DEFAULT}.
12610
12611 @cindex @file{commitinfo}, working directory
12612 @cindex @file{commitinfo}, command environment
12613 The command will be run in the root of the workspace
12614 containing the new versions of any files the user would like
12615 to modify (commit), @emph{or in a copy of the workspace on
12616 the server (@pxref{Remote repositories})}.  If a file is
12617 being removed, there will be no copy of the file under the
12618 current directory.  If a file is being added, there will be
12619 no corresponding archive file in the repository unless the
12620 file is being resurrected.
12621
12622 Note that both the repository directory and the corresponding
12623 Attic (@pxref{Attic}) directory may need to be checked to
12624 locate the archive file corresponding to any given file being
12625 committed.  Much of the information about the specific commit
12626 request being made, including the destination branch, commit
12627 message, and command line options specified, is not available
12628 to the command.
12629
12630 @c FIXME: should discuss using commitinfo to control
12631 @c who has checkin access to what (e.g. Joe can check into
12632 @c directories a, b, and c, and Mary can check into
12633 @c directories b, c, and d--note this case cannot be
12634 @c conveniently handled with unix groups).  Of course,
12635 @c adding a new set of features to CVS might be a more
12636 @c natural way to fix this problem than telling people to
12637 @c use commitinfo.
12638 @c FIXME: Should make some reference, especially in
12639 @c the context of controlling who has access, to the fact
12640 @c that commitinfo can be circumvented.  Perhaps
12641 @c mention SETXID (but has it been carefully examined
12642 @c for holes?).  This fits in with the discussion of
12643 @c general CVS security in "Password authentication
12644 @c security" (the bit which is not pserver-specific).
12645
12646 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12647 @node verifymsg
12648 @appendixsubsec Verifying log messages
12649 @cindex @file{verifymsg} (admin file)
12650 @cindex Log message, verifying
12651
12652 Once you have entered a log message, you can evaluate
12653 that message to check for specific content, such as
12654 a bug ID.  Use the @file{verifymsg} file to
12655 specify a program that is used to verify the log message.
12656 This program could be a simple script that checks
12657 that the entered message contains the required fields.
12658
12659 The @file{verifymsg} file is often most useful together
12660 with the @file{rcsinfo} file, which can be used to
12661 specify a log message template.
12662
12663 Each line in the @file{verifymsg} file consists of a
12664 regular expression and a command-line template.  The
12665 template must include a program name, and can include
12666 any number of arguments.  The full path to the current
12667 log message template file is appended to the template.
12668
12669 One thing that should be noted is that the @samp{ALL}
12670 keyword is not supported.  If more than one matching
12671 line is found, the first one is used.  This can be
12672 useful for specifying a default verification script in a
12673 directory, and then overriding it in a subdirectory.
12674
12675 @cindex DEFAULT in @file{verifymsg}
12676 If the repository name does not match any of the
12677 regular expressions in this file, the @samp{DEFAULT}
12678 line is used, if it is specified.
12679
12680 @cindex Exit status, of @file{verifymsg}
12681 If the verification script exits with a non-zero exit status,
12682 the commit is aborted.
12683
12684 @cindex @file{verifymsg}, changing the log message
12685 In the default configuration, CVS allows the
12686 verification script to change the log message. This is
12687 controlled via the RereadLogAfterVerify CVSROOT/config
12688 option.
12689
12690 When @samp{RereadLogAfterVerify=always} or
12691 @samp{RereadLogAfterVerify=stat}, the log message will
12692 either always be reread after the verification script
12693 is run or reread only if the log message file status
12694 has changed.
12695
12696 @xref{config}, for more on CVSROOT/config options.
12697
12698 It is NOT a good idea for a @file{verifymsg} script to
12699 interact directly with the user in the various
12700 client/server methods. For the @code{pserver} method,
12701 there is no protocol support for communicating between
12702 @file{verifymsg} and the client on the remote end. For the
12703 @code{ext} and @code{server} methods, it is possible
12704 for CVS to become confused by the characters going
12705 along the same channel as the CVS protocol
12706 messages. See @ref{Remote repositories}, for more
12707 information on client/server setups.  In addition, at the time
12708 the @file{verifymsg} script runs, the CVS
12709 server has locks in place in the repository.  If control is
12710 returned to the user here then other users may be stuck waiting
12711 for access to the repository.
12712
12713 This option can be useful if you find yourself using an
12714 rcstemplate that needs to be modified to remove empty
12715 elements or to fill in default values.  It can also be
12716 useful if the rcstemplate has changed in the repository
12717 and the CVS/Template was not updated, but is able to be
12718 adapted to the new format by the verification script
12719 that is run by @file{verifymsg}.
12720
12721 An example of an update might be to change all
12722 occurrences of 'BugId:' to be 'DefectId:' (which can be
12723 useful if the rcstemplate has recently been changed and
12724 there are still checked-out user trees with cached
12725 copies in the CVS/Template file of the older version).
12726
12727 Another example of an update might be to delete a line
12728 that contains 'BugID: none' from the log message after
12729 validation of that value as being allowed is made.
12730
12731 The following is a little silly example of a
12732 @file{verifymsg} file, together with the corresponding
12733 @file{rcsinfo} file, the log message template and an
12734 verification  script.  We begin with the log message template.
12735 We want to always record a bug-id number on the first
12736 line of the log message.  The rest of log message is
12737 free text.  The following template is found in the file
12738 @file{/usr/cvssupport/tc.template}.
12739
12740 @example
12741 BugId:
12742 @end example
12743
12744 The script @file{/usr/cvssupport/bugid.verify} is used to
12745 evaluate the log message.
12746
12747 @example
12748 #!/bin/sh
12749 #
12750 #       bugid.verify filename
12751 #
12752 #  Verify that the log message contains a valid bugid
12753 #  on the first line.
12754 #
12755 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
12756     exit 0
12757 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
12758     # It is okay to allow commits with 'BugId: none',
12759     # but do not put that text into the real log message.
12760     grep -v '^BugId:[ ]*none$' > $1.rewrite
12761     mv $1.rewrite $1
12762     exit 0
12763 else
12764     echo "No BugId found."
12765     exit 1
12766 fi
12767 @end example
12768
12769 The @file{verifymsg} file contains this line:
12770
12771 @example
12772 ^tc     /usr/cvssupport/bugid.verify
12773 @end example
12774
12775 The @file{rcsinfo} file contains this line:
12776
12777 @example
12778 ^tc     /usr/cvssupport/tc.template
12779 @end example
12780
12781 The @file{config} file contains this line:
12782
12783 @example
12784 RereadLogAfterVerify=always
12785 @end example
12786
12787
12788
12789 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12790 @node editinfo
12791 @appendixsubsec Editinfo
12792 @cindex editinfo (admin file)
12793 @cindex Editor, specifying per module
12794 @cindex Per-module editor
12795 @cindex Log messages, editing
12796
12797 @strong{The @file{editinfo} feature has been
12798 rendered obsolete.  To set a default editor for log
12799 messages use the @code{CVSEDITOR}, @code{EDITOR} environment variables
12800 (@pxref{Environment variables}) or the @samp{-e} global
12801 option (@pxref{Global options}).  See @ref{verifymsg},
12802 for information on the use of the @file{verifymsg}
12803 feature for evaluating log messages.}
12804
12805 If you want to make sure that all log messages look the
12806 same way, you can use the @file{editinfo} file to
12807 specify a program that is used to edit the log message.
12808 This program could be a custom-made editor that always
12809 enforces a certain style of the log message, or maybe a
12810 simple shell script that calls an editor, and checks
12811 that the entered message contains the required fields.
12812
12813 If no matching line is found in the @file{editinfo}
12814 file, the editor specified in the environment variable
12815 @code{$CVSEDITOR} is used instead.  If that variable is
12816 not set, then the environment variable @code{$EDITOR}
12817 is used instead.  If that variable is not
12818 set a default will be used.  See @ref{Committing your changes}.
12819
12820 The @file{editinfo} file is often most useful together
12821 with the @file{rcsinfo} file, which can be used to
12822 specify a log message template.
12823
12824 Each line in the @file{editinfo} file consists of a
12825 regular expression and a command-line template.  The
12826 template must include a program name, and can include
12827 any number of arguments.  The full path to the current
12828 log message template file is appended to the template.
12829
12830 One thing that should be noted is that the @samp{ALL}
12831 keyword is not supported.  If more than one matching
12832 line is found, the first one is used.  This can be
12833 useful for specifying a default edit script in a
12834 module, and then overriding it in a subdirectory.
12835
12836 @cindex DEFAULT in editinfo
12837 If the repository name does not match any of the
12838 regular expressions in this file, the @samp{DEFAULT}
12839 line is used, if it is specified.
12840
12841 If the edit script exits with a non-zero exit status,
12842 the commit is aborted.
12843
12844 Note: when @sc{cvs} is accessing a remote repository,
12845 or when the @samp{-m} or @samp{-F} options to @code{cvs
12846 commit} are used, @file{editinfo} will not be consulted.
12847 There is no good workaround for this; use
12848 @file{verifymsg} instead.
12849
12850 @menu
12851 * editinfo example::            Editinfo example
12852 @end menu
12853
12854 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12855 @node editinfo example
12856 @appendixsubsubsec Editinfo example
12857
12858 The following is a little silly example of a
12859 @file{editinfo} file, together with the corresponding
12860 @file{rcsinfo} file, the log message template and an
12861 editor script.  We begin with the log message template.
12862 We want to always record a bug-id number on the first
12863 line of the log message.  The rest of log message is
12864 free text.  The following template is found in the file
12865 @file{/usr/cvssupport/tc.template}.
12866
12867 @example
12868 BugId:
12869 @end example
12870
12871 The script @file{/usr/cvssupport/bugid.edit} is used to
12872 edit the log message.
12873
12874 @example
12875 #!/bin/sh
12876 #
12877 #       bugid.edit filename
12878 #
12879 #  Call $EDITOR on FILENAME, and verify that the
12880 #  resulting file contains a valid bugid on the first
12881 #  line.
12882 if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
12883 if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
12884 $CVSEDITOR $1
12885 until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
12886 do  echo -n  "No BugId found.  Edit again? ([y]/n)"
12887     read ans
12888     case $@{ans@} in
12889         n*) exit 1;;
12890     esac
12891     $CVSEDITOR $1
12892 done
12893 @end example
12894
12895 The @file{editinfo} file contains this line:
12896
12897 @example
12898 ^tc     /usr/cvssupport/bugid.edit
12899 @end example
12900
12901 The @file{rcsinfo} file contains this line:
12902
12903 @example
12904 ^tc     /usr/cvssupport/tc.template
12905 @end example
12906
12907 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12908 @node loginfo
12909 @appendixsubsec Loginfo
12910 @cindex loginfo (admin file)
12911 @cindex Storing log messages
12912 @cindex Mailing log messages
12913 @cindex Distributing log messages
12914 @cindex Log messages
12915
12916 @c "cvs commit" is not quite right.  What we
12917 @c mean is "when the repository gets changed" which
12918 @c also includes "cvs import" and "cvs add" on a directory.
12919 The @file{loginfo} file is used to control where
12920 @samp{cvs commit} log information is sent.  The first
12921 entry on a line is a regular expression which is tested
12922 against the directory that the change is being made to,
12923 relative to the @code{$CVSROOT}.  If a match is found, then
12924 the remainder of the line is a filter program that
12925 should expect log information on its standard input.
12926 Note that the filter program @strong{must} read @strong{all}
12927 of the log information or @sc{cvs} may fail with a broken pipe signal.
12928
12929 If the repository name does not match any of the
12930 regular expressions in this file, the @samp{DEFAULT}
12931 line is used, if it is specified.
12932
12933 All occurrences of the name @samp{ALL} appearing as a
12934 regular expression are used in addition to the first
12935 matching regular expression or @samp{DEFAULT}.
12936
12937 The first matching regular expression is used.
12938
12939 @xref{commit files}, for a description of the syntax of
12940 the @file{loginfo} file.
12941
12942 The user may specify a format string as
12943 part of the filter.  The string is composed of a
12944 @samp{%} followed by a space, or followed by a single
12945 format character, or followed by a set of format
12946 characters surrounded by @samp{@{} and @samp{@}} as
12947 separators.  The format characters are:
12948
12949 @table @t
12950 @item s
12951 file name
12952 @item V
12953 old version number (pre-checkin)
12954 @item v
12955 new version number (post-checkin)
12956 @end table
12957
12958 All other characters that appear in a format string
12959 expand to an empty field (commas separating fields are
12960 still provided).
12961
12962 For example, some valid format strings are @samp{%},
12963 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
12964
12965 The output will be a space separated string of tokens enclosed in
12966 quotation marks (@t{"}).
12967 Any embedded dollar signs (@t{$}), backticks (@t{`}),
12968 backslashes (@t{\}), or quotation marks will be preceded
12969 by a backslash (this allows the shell to correctly parse it
12970 as a single string, reguardless of the characters it contains).
12971 For backwards compatibility, the first
12972 token will be the repository subdirectory.  The rest of the
12973 tokens will be comma-delimited lists of the information
12974 requested in the format string.  For example, if
12975 @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}}
12976 is the format string, and three files (@t{ChangeLog},
12977 @t{Makefile}, @t{foo.c}) were modified, the output
12978 might be:
12979
12980 @example
12981 "yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13"
12982 @end example
12983
12984 As another example, @samp{%@{@}} means that only the
12985 name of the repository will be generated.
12986
12987 Note: when @sc{cvs} is accessing a remote repository,
12988 @file{loginfo} will be run on the @emph{remote}
12989 (i.e., server) side, not the client side (@pxref{Remote
12990 repositories}).
12991
12992 @menu
12993 * loginfo example::             Loginfo example
12994 * Keeping a checked out copy::  Updating a tree on every checkin
12995 @end menu
12996
12997 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12998 @node loginfo example
12999 @appendixsubsubsec Loginfo example
13000
13001 The following @file{loginfo} file, together with the
13002 tiny shell-script below, appends all log messages
13003 to the file @file{$CVSROOT/CVSROOT/commitlog},
13004 and any commits to the administrative files (inside
13005 the @file{CVSROOT} directory) are also logged in
13006 @file{/usr/adm/cvsroot-log}.
13007 Commits to the @file{prog1} directory are mailed to @t{ceder}.
13008
13009 @c FIXME: is it a CVS feature or bug that only the
13010 @c first matching line is used?  It is documented
13011 @c above, but is it useful?  For example, if we wanted
13012 @c to run both "cvs-log" and "Mail" for the CVSROOT
13013 @c directory, it is kind of awkward if
13014 @c only the first matching line is used.
13015 @example
13016 ALL             /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
13017 ^CVSROOT        /usr/local/bin/cvs-log /usr/adm/cvsroot-log
13018 ^prog1          Mail -s %s ceder
13019 @end example
13020
13021 The shell-script @file{/usr/local/bin/cvs-log} looks
13022 like this:
13023
13024 @example
13025 #!/bin/sh
13026 (echo "------------------------------------------------------";
13027  echo -n $2"  ";
13028  date;
13029  echo;
13030  cat) >> $1
13031 @end example
13032
13033 @node Keeping a checked out copy
13034 @appendixsubsubsec Keeping a checked out copy
13035
13036 @c What other index entries?  It seems like
13037 @c people might want to use a lot of different
13038 @c words for this functionality.
13039 @cindex Keeping a checked out copy
13040 @cindex Checked out copy, keeping
13041 @cindex Web pages, maintaining with CVS
13042
13043 It is often useful to maintain a directory tree which
13044 contains files which correspond to the latest version
13045 in the repository.  For example, other developers might
13046 want to refer to the latest sources without having to
13047 check them out, or you might be maintaining a web site
13048 with @sc{cvs} and want every checkin to cause the files
13049 used by the web server to be updated.
13050 @c Can we offer more details on the web example?  Or
13051 @c point the user at how to figure it out?  This text
13052 @c strikes me as sufficient for someone who already has
13053 @c some idea of what we mean but not enough for the naive
13054 @c user/sysadmin to understand it and set it up.
13055
13056 The way to do this is by having loginfo invoke
13057 @code{cvs update}.  Doing so in the naive way will
13058 cause a problem with locks, so the @code{cvs update}
13059 must be run in the background.
13060 @c Should we try to describe the problem with locks?
13061 @c It seems like a digression for someone who just
13062 @c wants to know how to make it work.
13063 @c Another choice which might work for a single file
13064 @c is to use "cvs -n update -p" which doesn't take
13065 @c out locks (I think) but I don't see many advantages
13066 @c of that and we might as well document something which
13067 @c works for multiple files.
13068 Here is an example for unix (this should all be on one line):
13069
13070 @example
13071 ^cyclic-pages           (date; cat; (sleep 2; cd /u/www/local-docs;
13072  cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
13073 @end example
13074
13075 This will cause checkins to repository directories
13076 starting with @code{cyclic-pages} to update the checked
13077 out tree in @file{/u/www/local-docs}.
13078 @c More info on some of the details?  The "sleep 2" is
13079 @c so if we are lucky the lock will be gone by the time
13080 @c we start and we can wait 2 seconds instead of 30.
13081
13082 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13083 @node rcsinfo
13084 @appendixsec Rcsinfo
13085 @cindex rcsinfo (admin file)
13086 @cindex Form for log message
13087 @cindex Log message template
13088 @cindex Template for log message
13089
13090 The @file{rcsinfo} file can be used to specify a form to
13091 edit when filling out the commit log.  The
13092 @file{rcsinfo} file has a syntax similar to the
13093 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
13094 files.  @xref{syntax}.  Unlike the other files the second
13095 part is @emph{not} a command-line template.  Instead,
13096 the part after the regular expression should be a full pathname to
13097 a file containing the log message template.
13098
13099 If the repository name does not match any of the
13100 regular expressions in this file, the @samp{DEFAULT}
13101 line is used, if it is specified.
13102
13103 All occurrences of the name @samp{ALL} appearing as a
13104 regular expression are used in addition to the first
13105 matching regular expression or @samp{DEFAULT}.
13106
13107 @c FIXME: should be offering advice, somewhere around
13108 @c here, about where to put the template file.  The
13109 @c verifymsg example uses /usr/cvssupport but doesn't
13110 @c say anything about what that directory is for or
13111 @c whether it is hardwired into CVS or who creates
13112 @c it or anything.  In particular we should say
13113 @c how to version control the template file.  A
13114 @c probably better answer than the /usr/cvssupport
13115 @c stuff is to use checkoutlist (with xref to the
13116 @c checkoutlist doc).
13117 @c Also I am starting to see a connection between
13118 @c this and the Keeping a checked out copy node.
13119 @c Probably want to say something about that.
13120 The log message template will be used as a default log
13121 message.  If you specify a log message with @samp{cvs
13122 commit -m @var{message}} or @samp{cvs commit -f
13123 @var{file}} that log message will override the
13124 template.
13125
13126 @xref{verifymsg}, for an example @file{rcsinfo}
13127 file.
13128
13129 When @sc{cvs} is accessing a remote repository,
13130 the contents of @file{rcsinfo} at the time a directory
13131 is first checked out will specify a template which does
13132 not then change.  If you edit @file{rcsinfo} or its
13133 templates, you may need to check out a new working
13134 directory.
13135 @c Would be nice to fix CVS so this isn't needed.  For
13136 @c example, a mechanism analogous to CVS/Entries, where
13137 @c the client keeps track of what version of the template
13138 @c it has.
13139
13140 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13141 @node taginfo
13142 @appendixsec Taginfo
13143 @cindex taginfo (admin file)
13144 @cindex Tags, logging
13145 @cindex Tags, verifying
13146 The @file{taginfo} file defines programs to execute
13147 when someone executes a @code{tag} or @code{rtag}
13148 command.  The @file{taginfo} file has the standard form
13149 for trigger scripts (@pxref{Trigger Scripts}),
13150 where each line is a regular expression
13151 followed by a command to execute (@pxref{syntax}).  The arguments passed
13152 to the command are, in order, the @var{tagname},
13153 @var{operation} (@code{add} for @code{tag},
13154 @code{mov} for @code{tag -F}, and @code{del} for
13155 @code{tag -d}), @var{repository}, and any remaining are
13156 pairs of @var{filename} @var{revision}.  A non-zero
13157 exit of the filter program will cause the tag to be
13158 aborted.
13159
13160 Here is an example of using the @file{taginfo} file
13161 to log @code{tag} and @code{rtag}
13162 commands.  In the @file{taginfo} file put:
13163
13164 @example
13165 ALL /usr/local/cvsroot/CVSROOT/loggit
13166 @end example
13167
13168 @noindent
13169 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
13170 following script:
13171
13172 @example
13173 #!/bin/sh
13174 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
13175 @end example
13176
13177 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13178 @node cvsignore
13179 @appendixsec Ignoring files via cvsignore
13180 @cindex cvsignore (admin file), global
13181 @cindex Global cvsignore
13182 @cindex Ignoring files
13183 @c -- This chapter should maybe be moved to the
13184 @c tutorial part of the manual?
13185
13186 There are certain file names that frequently occur
13187 inside your working copy, but that you don't want to
13188 put under @sc{cvs} control.  Examples are all the object
13189 files that you get while you compile your sources.
13190 Normally, when you run @samp{cvs update}, it prints a
13191 line for each file it encounters that it doesn't know
13192 about (@pxref{update output}).
13193
13194 @sc{cvs} has a list of files (or sh(1) file name patterns)
13195 that it should ignore while running @code{update},
13196 @code{import} and @code{release}.
13197 @c -- Are those the only three commands affected?
13198 This list is constructed in the following way.
13199
13200 @itemize @bullet
13201 @item
13202 The list is initialized to include certain file name
13203 patterns: names associated with @sc{cvs}
13204 administration, or with other common source control
13205 systems; common names for patch files, object files,
13206 archive files, and editor backup files; and other names
13207 that are usually artifacts of assorted utilities.
13208 Currently, the default list of ignored file name
13209 patterns is:
13210
13211 @cindex Ignored files
13212 @cindex Automatically ignored files
13213 @example
13214     RCS     SCCS    CVS     CVS.adm
13215     RCSLOG  cvslog.*
13216     tags    TAGS
13217     .make.state     .nse_depinfo
13218     *~      #*      .#*     ,*      _$*     *$
13219     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
13220     *.a     *.olb   *.o     *.obj   *.so    *.exe
13221     *.Z     *.elc   *.ln
13222     core
13223 @end example
13224
13225 @item
13226 The per-repository list in
13227 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
13228 the list, if that file exists.
13229
13230 @item
13231 The per-user list in @file{.cvsignore} in your home
13232 directory is appended to the list, if it exists.
13233
13234 @item
13235 Any entries in the environment variable
13236 @code{$CVSIGNORE} is appended to the list.
13237
13238 @item
13239 Any @samp{-I} options given to @sc{cvs} is appended.
13240
13241 @item
13242 As @sc{cvs} traverses through your directories, the contents
13243 of any @file{.cvsignore} will be appended to the list.
13244 The patterns found in @file{.cvsignore} are only valid
13245 for the directory that contains them, not for
13246 any sub-directories.
13247 @end itemize
13248
13249 In any of the 5 places listed above, a single
13250 exclamation mark (@samp{!}) clears the ignore list.
13251 This can be used if you want to store any file which
13252 normally is ignored by @sc{cvs}.
13253
13254 Specifying @samp{-I !} to @code{cvs import} will import
13255 everything, which is generally what you want to do if
13256 you are importing files from a pristine distribution or
13257 any other source which is known to not contain any
13258 extraneous files.  However, looking at the rules above
13259 you will see there is a fly in the ointment; if the
13260 distribution contains any @file{.cvsignore} files, then
13261 the patterns from those files will be processed even if
13262 @samp{-I !} is specified.  The only workaround is to
13263 remove the @file{.cvsignore} files in order to do the
13264 import.  Because this is awkward, in the future
13265 @samp{-I !} might be modified to override
13266 @file{.cvsignore} files in each directory.
13267
13268 Note that the syntax of the ignore files consists of a
13269 series of lines, each of which contains a space
13270 separated list of filenames.  This offers no clean way
13271 to specify filenames which contain spaces, but you can
13272 use a workaround like @file{foo?bar} to match a file
13273 named @file{foo bar} (it also matches @file{fooxbar}
13274 and the like).  Also note that there is currently no
13275 way to specify comments.
13276 @c FIXCVS?  I don't _like_ this syntax at all, but
13277 @c changing it raises all the usual compatibility
13278 @c issues and I'm also not sure what to change it to.
13279
13280 @node checkoutlist
13281 @appendixsec The checkoutlist file
13282 @cindex checkoutlist
13283
13284 It may be helpful to use @sc{cvs} to maintain your own
13285 files in the @file{CVSROOT} directory.  For example,
13286 suppose that you have a script @file{logcommit.pl}
13287 which you run by including the following line in the
13288 @file{commitinfo} administrative file:
13289
13290 @example
13291 ALL   $CVSROOT/CVSROOT/logcommit.pl
13292 @end example
13293
13294 To maintain @file{logcommit.pl} with @sc{cvs} you would
13295 add the following line to the @file{checkoutlist}
13296 administrative file:
13297
13298 @example
13299 logcommit.pl
13300 @end example
13301
13302 The format of @file{checkoutlist} is one line for each
13303 file that you want to maintain using @sc{cvs}, giving
13304 the name of the file, followed optionally by more whitespace
13305 and any error message that should print if the file cannot be
13306 checked out into CVSROOT after a commit:
13307
13308 @example
13309 logcommit.pl    Could not update CVSROOT/logcommit.pl.
13310 @end example
13311
13312 After setting up @file{checkoutlist} in this fashion,
13313 the files listed there will function just like
13314 @sc{cvs}'s built-in administrative files.  For example,
13315 when checking in one of the files you should get a
13316 message such as:
13317
13318 @example
13319 cvs commit: Rebuilding administrative file database
13320 @end example
13321
13322 @noindent
13323 and the checked out copy in the @file{CVSROOT}
13324 directory should be updated.
13325
13326 Note that listing @file{passwd} (@pxref{Password
13327 authentication server}) in @file{checkoutlist} is not
13328 recommended for security reasons.
13329
13330 For information about keeping a checkout out copy in a
13331 more general context than the one provided by
13332 @file{checkoutlist}, see @ref{Keeping a checked out
13333 copy}.
13334
13335 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13336 @node history file
13337 @appendixsec The history file
13338 @cindex History file
13339 @cindex Log information, saving
13340
13341 The file @file{$CVSROOT/CVSROOT/history} is used
13342 to log information for the @code{history} command
13343 (@pxref{history}).  This file must be created to turn
13344 on logging.  This is done automatically if the
13345 @code{cvs init} command is used to set up the
13346 repository (@pxref{Creating a repository}).
13347
13348 The file format of the @file{history} file is
13349 documented only in comments in the @sc{cvs} source
13350 code, but generally programs should use the @code{cvs
13351 history} command to access it anyway, in case the
13352 format changes with future releases of @sc{cvs}.
13353
13354 @node Variables
13355 @appendixsec Expansions in administrative files
13356 @cindex Internal variables
13357 @cindex Variables
13358
13359 Sometimes in writing an administrative file, you might
13360 want the file to be able to know various things based
13361 on environment @sc{cvs} is running in.  There are
13362 several mechanisms to do that.
13363
13364 To find the home directory of the user running @sc{cvs}
13365 (from the @code{HOME} environment variable), use
13366 @samp{~} followed by @samp{/} or the end of the line.
13367 Likewise for the home directory of @var{user}, use
13368 @samp{~@var{user}}.  These variables are expanded on
13369 the server machine, and don't get any reasonable
13370 expansion if pserver (@pxref{Password authenticated})
13371 is in use; therefore user variables (see below) may be
13372 a better choice to customize behavior based on the user
13373 running @sc{cvs}.
13374 @c Based on these limitations, should we deprecate ~?
13375 @c What is it good for?  Are people using it?
13376
13377 One may want to know about various pieces of
13378 information internal to @sc{cvs}.  A @sc{cvs} internal
13379 variable has the syntax @code{$@{@var{variable}@}},
13380 where @var{variable} starts with a letter and consists
13381 of alphanumeric characters and @samp{_}.  If the
13382 character following @var{variable} is a
13383 non-alphanumeric character other than @samp{_}, the
13384 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
13385 internal variables are:
13386
13387 @table @code
13388 @item CVSROOT
13389 @cindex CVSROOT, internal variable
13390 This is the absolute path to the current @sc{cvs} root directory.
13391 @xref{Repository}, for a description of the various
13392 ways to specify this, but note that the internal
13393 variable contains just the directory and not any
13394 of the access method information.
13395
13396 @item RCSBIN
13397 @cindex RCSBIN, internal variable
13398 In @sc{cvs} 1.9.18 and older, this specified the
13399 directory where @sc{cvs} was looking for @sc{rcs}
13400 programs.  Because @sc{cvs} no longer runs @sc{rcs}
13401 programs, specifying this internal variable is now an
13402 error.
13403
13404 @item CVSEDITOR
13405 @cindex CVSEDITOR, internal variable
13406 @itemx EDITOR
13407 @cindex EDITOR, internal variable
13408 @itemx VISUAL
13409 @cindex VISUAL, internal variable
13410 These all expand to the same value, which is the editor
13411 that @sc{cvs} is using.  @xref{Global options}, for how
13412 to specify this.
13413
13414 @item USER
13415 @cindex USER, internal variable
13416 Username of the user running @sc{cvs} (on the @sc{cvs}
13417 server machine).
13418 When using pserver, this is the user specified in the repository
13419 specification which need not be the same as the username the
13420 server is running as (@pxref{Password authentication server}).
13421 Do not confuse this with the environment variable of the same name.
13422 @end table
13423
13424 If you want to pass a value to the administrative files
13425 which the user who is running @sc{cvs} can specify,
13426 use a user variable.
13427 @cindex User variables
13428 To expand a user variable, the
13429 administrative file contains
13430 @code{$@{=@var{variable}@}}.  To set a user variable,
13431 specify the global option @samp{-s} to @sc{cvs}, with
13432 argument @code{@var{variable}=@var{value}}.  It may be
13433 particularly useful to specify this option via
13434 @file{.cvsrc} (@pxref{~/.cvsrc}).
13435
13436 For example, if you want the administrative file to
13437 refer to a test directory you might create a user
13438 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
13439 as
13440
13441 @example
13442 cvs -s TESTDIR=/work/local/tests
13443 @end example
13444
13445 @noindent
13446 and the
13447 administrative file contains @code{sh
13448 $@{=TESTDIR@}/runtests}, then that string is expanded
13449 to @code{sh /work/local/tests/runtests}.
13450
13451 All other strings containing @samp{$} are reserved;
13452 there is no way to quote a @samp{$} character so that
13453 @samp{$} represents itself.
13454
13455 Environment variables passed to administrative files are:
13456
13457 @table @code
13458 @cindex environment variables, passed to administrative files
13459
13460 @item CVS_USER
13461 @cindex CVS_USER, environment variable
13462 The @sc{cvs}-specific username provided by the user, if it
13463 can be provided (currently just for the pserver access
13464 method), and to the empty string otherwise.  (@code{CVS_USER}
13465 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
13466 is used to map @sc{cvs} usernames to system usernames.)
13467
13468 @item LOGNAME
13469 @cindex LOGNAME, environment variable
13470 The username of the system user.
13471
13472 @item USER
13473 @cindex USER, environment variable
13474 Same as @code{LOGNAME}.
13475 Do not confuse this with the internal variable of the same name.
13476 @end table
13477
13478 @node config
13479 @appendixsec The CVSROOT/config configuration file
13480
13481 @cindex config, in CVSROOT
13482 @cindex CVSROOT/config
13483
13484 The administrative file @file{config} contains various
13485 miscellaneous settings which affect the behavior of
13486 @sc{cvs}.  The syntax is slightly different from the
13487 other administrative files.  Variables are not
13488 expanded.  Lines which start with @samp{#} are
13489 considered comments.
13490 @c FIXME: where do we define comments for the other
13491 @c administrative files.
13492 Other lines consist of a keyword, @samp{=}, and a
13493 value.  Note that this syntax is very strict.
13494 Extraneous spaces or tabs are not permitted.
13495 @c See comments in parseinfo.c:parse_config for more
13496 @c discussion of this strictness.
13497
13498 Currently defined keywords are:
13499
13500 @table @code
13501 @cindex RCSBIN, in CVSROOT/config
13502 @item RCSBIN=@var{bindir}
13503 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
13504 @sc{cvs} to look for @sc{rcs} programs in the
13505 @var{bindir} directory.  Current versions of @sc{cvs}
13506 do not run @sc{rcs} programs; for compatibility this
13507 setting is accepted, but it does nothing.
13508
13509 @cindex SystemAuth, in CVSROOT/config
13510 @item SystemAuth=@var{value}
13511 If @var{value} is @samp{yes}, then pserver should check
13512 for users in the system's user database if not found in
13513 @file{CVSROOT/passwd}.  If it is @samp{no}, then all
13514 pserver users must exist in @file{CVSROOT/passwd}.
13515 The default is @samp{yes}.  For more on pserver, see
13516 @ref{Password authenticated}.
13517
13518 @ignore
13519 @cindex PreservePermissions, in CVSROOT/config
13520 @item PreservePermissions=@var{value}
13521 Enable support for saving special device files,
13522 symbolic links, file permissions and ownerships in the
13523 repository.  The default value is @samp{no}.
13524 @xref{Special Files}, for the full implications of using
13525 this keyword.
13526 @end ignore
13527
13528 @cindex TopLevelAdmin, in CVSROOT/config
13529 @item TopLevelAdmin=@var{value}
13530 Modify the @samp{checkout} command to create a
13531 @samp{CVS} directory at the top level of the new
13532 working directory, in addition to @samp{CVS}
13533 directories created within checked-out directories.
13534 The default value is @samp{no}.
13535
13536 This option is useful if you find yourself performing
13537 many commands at the top level of your working
13538 directory, rather than in one of the checked out
13539 subdirectories.  The @file{CVS} directory created there
13540 will mean you don't have to specify @code{CVSROOT} for
13541 each command.  It also provides a place for the
13542 @file{CVS/Template} file (@pxref{Working directory
13543 storage}).
13544
13545 @cindex LockDir, in CVSROOT/config
13546 @item LockDir=@var{directory}
13547 Put @sc{cvs} lock files in @var{directory} rather than
13548 directly in the repository.  This is useful if you want
13549 to let users read from the repository while giving them
13550 write access only to @var{directory}, not to the
13551 repository.
13552 It can also be used to put the locks on a very fast
13553 in-memory file system to speed up locking and unlocking
13554 the repository.
13555 You need to create @var{directory}, but
13556 @sc{cvs} will create subdirectories of @var{directory} as it
13557 needs them.  For information on @sc{cvs} locks, see
13558 @ref{Concurrency}.
13559
13560 @c Mention this in Compatibility section?
13561 Before enabling the LockDir option, make sure that you
13562 have tracked down and removed any copies of @sc{cvs} 1.9 or
13563 older.  Such versions neither support LockDir, nor will
13564 give an error indicating that they don't support it.
13565 The result, if this is allowed to happen, is that some
13566 @sc{cvs} users will put the locks one place, and others will
13567 put them another place, and therefore the repository
13568 could become corrupted.  @sc{cvs} 1.10 does not support
13569 LockDir but it will print a warning if run on a
13570 repository with LockDir enabled.
13571
13572 @cindex LogHistory, in CVSROOT/config
13573 @item LogHistory=@var{value}
13574 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
13575 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
13576 all transactions.  Any subset of the default is
13577 legal.  (For example, to only log transactions that modify the
13578 @file{*,v} files, use @samp{LogHistory=TMAR}.)
13579
13580 @cindex RereadLogAfterVerify, in CVSROOT/config
13581 @cindex @file{verifymsg}, changing the log message
13582 @item RereadLogAfterVerify=@var{value}
13583 Modify the @samp{commit} command such that CVS will reread the
13584 log message after running the program specified by @file{verifymsg}.
13585 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
13586 the log message should always be reread; @samp{no}
13587 or @samp{never}, indicating that it should never be
13588 reread; or @var{value} may be @samp{stat}, indicating
13589 that the file should be checked with the file system
13590 @samp{stat()} function to see if it has changed (see warning below)
13591 before rereading.  The default value is @samp{always}.
13592
13593 @strong{The `stat' mode can cause CVS to pause for up to
13594 one extra second per directory committed.  This can be less IO and
13595 CPU intensive but is not recommended for use with large repositories}
13596
13597 @xref{verifymsg}, for more information on how verifymsg
13598 may be used.
13599 @end table
13600
13601 @c ---------------------------------------------------------------------
13602 @node Environment variables
13603 @appendix All environment variables which affect CVS
13604 @cindex Environment variables
13605 @cindex Reference manual for variables
13606
13607 This is a complete list of all environment variables
13608 that affect @sc{cvs}.
13609
13610 @table @code
13611 @cindex CVSIGNORE, environment variable
13612 @item $CVSIGNORE
13613 A whitespace-separated list of file name patterns that
13614 @sc{cvs} should ignore. @xref{cvsignore}.
13615
13616 @cindex CVSWRAPPERS, environment variable
13617 @item $CVSWRAPPERS
13618 A whitespace-separated list of file name patterns that
13619 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
13620
13621 @cindex CVSREAD, environment variable
13622 @cindex Read-only files, and CVSREAD
13623 @item $CVSREAD
13624 If this is set, @code{checkout} and @code{update} will
13625 try hard to make the files in your working directory
13626 read-only.  When this is not set, the default behavior
13627 is to permit modification of your working files.
13628
13629 @item $CVSUMASK
13630 Controls permissions of files in the repository.  See
13631 @ref{File permissions}.
13632
13633 @item $CVSROOT
13634 Should contain the full pathname to the root of the @sc{cvs}
13635 source repository (where the @sc{rcs} files are
13636 kept).  This information must be available to @sc{cvs} for
13637 most commands to execute; if @code{$CVSROOT} is not set,
13638 or if you wish to override it for one invocation, you
13639 can supply it on the command line: @samp{cvs -d cvsroot
13640 cvs_command@dots{}} Once you have checked out a working
13641 directory, @sc{cvs} stores the appropriate root (in
13642 the file @file{CVS/Root}), so normally you only need to
13643 worry about this when initially checking out a working
13644 directory.
13645
13646 @item $CVSEDITOR
13647 @cindex CVSEDITOR, environment variable
13648 @itemx $EDITOR
13649 @cindex EDITOR, environment variable
13650 @itemx $VISUAL
13651 @cindex VISUAL, environment variable
13652 Specifies the program to use for recording log messages
13653 during commit.  @code{$CVSEDITOR} overrides
13654 @code{$EDITOR}, which overrides @code{$VISUAL}.
13655 See @ref{Committing your changes} for more or
13656 @ref{Global options} for alternative ways of specifying a
13657 log editor.
13658
13659 @cindex PATH, environment variable
13660 @item $PATH
13661 If @code{$RCSBIN} is not set, and no path is compiled
13662 into @sc{cvs}, it will use @code{$PATH} to try to find all
13663 programs it uses.
13664
13665 @cindex HOME, environment variable
13666 @item $HOME
13667 @cindex HOMEPATH, environment variable
13668 @item $HOMEPATH
13669 @cindex HOMEDRIVE, environment variable
13670 @item $HOMEDRIVE
13671 Used to locate the directory where the @file{.cvsrc}
13672 file, and other such files, are searched.  On Unix, @sc{cvs}
13673 just checks for @code{HOME}.  On Windows NT, the system will
13674 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
13675 for example to @file{\joe}.  On Windows 95, you'll
13676 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
13677 @c We are being vague about whether HOME works on
13678 @c Windows; see long comment in windows-NT/filesubr.c.
13679
13680 @cindex CVS_RSH, environment variable
13681 @item $CVS_RSH
13682 Specifies the external program which @sc{cvs} connects with,
13683 when @code{:ext:} access method is specified.
13684 @pxref{Connecting via rsh}.
13685
13686 @item $CVS_SERVER
13687 Used in client-server mode when accessing a remote
13688 repository using @sc{rsh}.  It specifies the name of
13689 the program to start on the server side (and any
13690 necessary arguments) when accessing a remote repository
13691 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
13692 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
13693 the default value for @code{:fork:} is the name used to run the client.
13694 @pxref{Connecting via rsh}
13695
13696 @item $CVS_PASSFILE
13697 Used in client-server mode when accessing the @code{cvs
13698 login server}.  Default value is @file{$HOME/.cvspass}.
13699 @pxref{Password authentication client}
13700
13701 @item $CVS_CLIENT_PORT
13702 Used in client-server mode to set the port to use when accessing the server
13703 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
13704 if the port is not specified in the CVSROOT.
13705 @pxref{Remote repositories}
13706
13707 @cindex CVS_RCMD_PORT, environment variable
13708 @item $CVS_RCMD_PORT
13709 Used in client-server mode.  If set, specifies the port
13710 number to be used when accessing the @sc{rcmd} demon on
13711 the server side. (Currently not used for Unix clients).
13712
13713 @cindex CVS_CLIENT_LOG, environment variable
13714 @item $CVS_CLIENT_LOG
13715 Used for debugging only in client-server
13716 mode.  If set, everything sent to the server is logged
13717 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
13718 sent from the server is logged into
13719 @file{@code{$CVS_CLIENT_LOG}.out}.
13720
13721 @cindex CVS_SERVER_SLEEP, environment variable
13722 @item $CVS_SERVER_SLEEP
13723 Used only for debugging the server side in
13724 client-server mode.  If set, delays the start of the
13725 server child process the specified amount of
13726 seconds so that you can attach to it with a debugger.
13727
13728 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
13729 @item $CVS_IGNORE_REMOTE_ROOT
13730 For @sc{cvs} 1.10 and older, setting this variable
13731 prevents @sc{cvs} from overwriting the @file{CVS/Root}
13732 file when the @samp{-d} global option is specified.
13733 Later versions of @sc{cvs} do not rewrite
13734 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
13735 effect.
13736
13737 @cindex COMSPEC, environment variable
13738 @item $COMSPEC
13739 Used under OS/2 only.  It specifies the name of the
13740 command interpreter and defaults to @sc{cmd.exe}.
13741
13742 @cindex TMPDIR, environment variable
13743 @item $TMPDIR
13744 @cindex TMP, environment variable
13745 @itemx $TMP
13746 @cindex TEMP, environment variable
13747 @itemx $TEMP
13748 @cindex Temporary files, location of
13749 @c This is quite nuts.  We don't talk about tempnam
13750 @c or mkstemp which we sometimes use.  The discussion
13751 @c of "Global options" is semi-incoherent.
13752 @c I'm not even sure those are the only inaccuracies.
13753 @c Furthermore, the conventions are
13754 @c pretty crazy and they should be simplified.
13755 Directory in which temporary files are located.
13756 The @sc{cvs} server uses
13757 @code{TMPDIR}.  @xref{Global options}, for a
13758 description of how to specify this.
13759 Some parts of @sc{cvs} will always use @file{/tmp} (via
13760 the @code{tmpnam} function provided by the system).
13761
13762 On Windows NT, @code{TMP} is used (via the @code{_tempnam}
13763 function provided by the system).
13764
13765 The @code{patch} program which is used by the @sc{cvs}
13766 client uses @code{TMPDIR}, and if it is not set, uses
13767 @file{/tmp} (at least with GNU patch 2.1).  Note that
13768 if your server and client are both running @sc{cvs}
13769 1.9.10 or later, @sc{cvs} will not invoke an external
13770 @code{patch} program.
13771 @end table
13772
13773 @node Compatibility
13774 @appendix Compatibility between CVS Versions
13775
13776 @cindex CVS, versions of
13777 @cindex Versions, of CVS
13778 @cindex Compatibility, between CVS versions
13779 @c We don't mention versions older than CVS 1.3
13780 @c on the theory that it would clutter it up for the vast
13781 @c majority of people, who don't have anything that old.
13782 @c
13783 The repository format is compatible going back to
13784 @sc{cvs} 1.3.  But see @ref{Watches Compatibility}, if
13785 you have copies of @sc{cvs} 1.6 or older and you want
13786 to use the optional developer communication features.
13787 @c If you "cvs rm" and commit using 1.3, then you'll
13788 @c want to run "rcs -sdead <file,v>" on each of the
13789 @c files in the Attic if you then want 1.5 and
13790 @c later to recognize those files as dead (I think the
13791 @c symptom if this is not done is that files reappear
13792 @c in joins).  (Wait: the above will work but really to
13793 @c be strictly correct we should suggest checking
13794 @c in a new revision rather than just changing the
13795 @c state of the head revision, shouldn't we?).
13796 @c The old convert.sh script was for this, but it never
13797 @c did get updated to reflect use of the RCS "dead"
13798 @c state.
13799 @c Note: this is tricky to document without confusing
13800 @c people--need to carefully say what CVS version we
13801 @c are talking about and keep in mind the distinction
13802 @c between a
13803 @c repository created with 1.3 and on which one now
13804 @c uses 1.5+, and a repository on which one wants to
13805 @c use both versions side by side (e.g. during a
13806 @c transition period).
13807 @c Wait, can't CVS just detect the case in which a file
13808 @c is in the Attic but the head revision is not dead?
13809 @c Not sure whether this should produce a warning or
13810 @c something, and probably needs further thought, but
13811 @c it would appear that the situation can be detected.
13812 @c
13813 @c We might want to separate out the 1.3 compatibility
13814 @c section (for repository & working directory) from the
13815 @c rest--that might help avoid confusing people who
13816 @c are upgrading (for example) from 1.6 to 1.8.
13817 @c
13818 @c A minor incompatibility is if a current version of CVS
13819 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
13820 @c see this as if there is no tag.  Seems to me this is
13821 @c too obscure to mention.
13822
13823 The working directory format is compatible going back
13824 to @sc{cvs} 1.5.  It did change between @sc{cvs} 1.3
13825 and @sc{cvs} 1.5.  If you run @sc{cvs} 1.5 or newer on
13826 a working directory checked out with @sc{cvs} 1.3,
13827 @sc{cvs} will convert it, but to go back to @sc{cvs}
13828 1.3 you need to check out a new working directory with
13829 @sc{cvs} 1.3.
13830
13831 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
13832 further (1.5 was the first official release with the remote protocol,
13833 but some older versions might still be floating around).  In many
13834 cases you need to upgrade both the client and the server to take
13835 advantage of new features and bug fixes, however.
13836
13837 @c Perhaps should be saying something here about the
13838 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
13839 @c older don't use them).  These are supposed to be
13840 @c compatible in both directions, but I'm not sure
13841 @c they quite are 100%.  One common gripe is if you
13842 @c "rm -r" a directory and 1.9 gets confused, as it
13843 @c still sees it in Entries.  That one is fixed in
13844 @c (say) 1.9.6.  Someone else reported problems with
13845 @c starting with a directory which was checked out with
13846 @c an old version, and then using a new version, and
13847 @c some "D" lines appeared, but not for every
13848 @c directory, causing some directories to be skipped.
13849 @c They weren't sure how to reproduce this, though.
13850
13851 @c ---------------------------------------------------------------------
13852 @node Troubleshooting
13853 @appendix Troubleshooting
13854
13855 If you are having trouble with @sc{cvs}, this appendix
13856 may help.  If there is a particular error message which
13857 you are seeing, then you can look up the message
13858 alphabetically.  If not, you can look through the
13859 section on other problems to see if your problem is
13860 mentioned there.
13861
13862 @menu
13863 * Error messages::              Partial list of CVS errors
13864 * Connection::                  Trouble making a connection to a CVS server
13865 * Other problems::              Problems not readily listed by error message
13866 @end menu
13867
13868 @ignore
13869 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13870 @c @node Bad administrative files
13871 @appendixsec Bad administrative files
13872
13873 @c -- Give hints on how to fix them
13874 @end ignore
13875
13876 @node Error messages
13877 @appendixsec Partial list of error messages
13878
13879 Here is a partial list of error messages that you may
13880 see from @sc{cvs}.  It is not a complete list---@sc{cvs}
13881 is capable of printing many, many error messages, often
13882 with parts of them supplied by the operating system,
13883 but the intention is to list the common and/or
13884 potentially confusing error messages.
13885
13886 The messages are alphabetical, but introductory text
13887 such as @samp{cvs update: } is not considered in
13888 ordering them.
13889
13890 In some cases the list includes messages printed by old
13891 versions of @sc{cvs} (partly because users may not be
13892 sure which version of @sc{cvs} they are using at any
13893 particular moment).
13894 @c If we want to start retiring messages, perhaps we
13895 @c should pick a cutoff version (for example, no more
13896 @c messages which are specific to versions before 1.9)
13897 @c and then move the old messages to an "old messages"
13898 @c node rather than deleting them completely.
13899
13900 @table @code
13901 @c FIXME: What is the correct way to format a multiline
13902 @c error message here?  Maybe @table is the wrong
13903 @c choice?  Texinfo gurus?
13904 @item @var{file}:@var{line}: Assertion '@var{text}' failed
13905 The exact format of this message may vary depending on
13906 your system.  It indicates a bug in @sc{cvs}, which can
13907 be handled as described in @ref{BUGS}.
13908
13909 @item cvs @var{command}: authorization failed: server @var{host} rejected access
13910 This is a generic response when trying to connect to a
13911 pserver server which chooses not to provide a
13912 specific reason for denying authorization.  Check that
13913 the username and password specified are correct and
13914 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
13915 in @file{inetd.conf}.  See @ref{Password authenticated}.
13916
13917 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
13918 This message indicates that you removed a file, and
13919 someone else modified it.  To resolve the conflict,
13920 first run @samp{cvs add @var{file}}.  If desired, look
13921 at the other party's modification to decide whether you
13922 still want to remove it.  If you don't want to remove
13923 it, stop here.  If you do want to remove it, proceed
13924 with @samp{cvs remove @var{file}} and commit your
13925 removal.
13926 @c Tests conflicts2-142b* in sanity.sh test for this.
13927
13928 @item cannot change permissions on temporary directory
13929 @example
13930 Operation not permitted
13931 @end example
13932 This message has been happening in a non-reproducible,
13933 occasional way when we run the client/server testsuite,
13934 both on Red Hat Linux 3.0.3 and 4.1.  We haven't been
13935 able to figure out what causes it, nor is it known
13936 whether it is specific to Linux (or even to this
13937 particular machine!).  If the problem does occur on
13938 other unices, @samp{Operation not permitted} would be
13939 likely to read @samp{Not owner} or whatever the system
13940 in question uses for the unix @code{EPERM} error.  If
13941 you have any information to add, please let us know as
13942 described in @ref{BUGS}.  If you experience this error
13943 while using @sc{cvs}, retrying the operation which
13944 produced it should work fine.
13945 @c This has been seen in a variety of tests, including
13946 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
13947 @c so it doesn't seem particularly specific to any one
13948 @c test.
13949
13950 @item cvs [server aborted]: Cannot check out files into the repository itself
13951 The obvious cause for this message (especially for
13952 non-client/server @sc{cvs}) is that the @sc{cvs} root
13953 is, for example, @file{/usr/local/cvsroot} and you try
13954 to check out files when you are in a subdirectory, such
13955 as @file{/usr/local/cvsroot/test}.  However, there is a
13956 more subtle cause, which is that the temporary
13957 directory on the server is set to a subdirectory of the
13958 root (which is also not allowed).  If this is the
13959 problem, set the temporary directory to somewhere else,
13960 for example @file{/var/tmp}; see @code{TMPDIR} in
13961 @ref{Environment variables}, for how to set the
13962 temporary directory.
13963
13964 @item cannot commit files as 'root'
13965 See @samp{'root' is not allowed to commit files}.
13966
13967 @c For one example see basica-1a10 in the testsuite
13968 @c For another example, "cvs co ." on NT; see comment
13969 @c at windows-NT/filesubr.c (expand_wild).
13970 @c For another example, "cvs co foo/bar" where foo exists.
13971 @item cannot open CVS/Entries for reading: No such file or directory
13972 This generally indicates a @sc{cvs} internal error, and
13973 can be handled as with other @sc{cvs} bugs
13974 (@pxref{BUGS}).  Usually there is a workaround---the
13975 exact nature of which would depend on the situation but
13976 which hopefully could be figured out.
13977
13978 @c This is more obscure than it might sound; it only
13979 @c happens if you run "cvs init" from a directory which
13980 @c contains a CVS/Root file at the start.
13981 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
13982 This message is harmless.  Provided it is not
13983 accompanied by other errors, the operation has
13984 completed successfully.  This message should not occur
13985 with current versions of @sc{cvs}, but it is documented
13986 here for the benefit of @sc{cvs} 1.9 and older.
13987
13988 @item cvs server: cannot open /root/.cvsignore: Permission denied
13989 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
13990 See @ref{Connection}.
13991
13992 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
13993 This message has been reported as intermittently
13994 happening with @sc{cvs} 1.9 on Solaris 2.5.  The cause is
13995 unknown; if you know more about what causes it, let us
13996 know as described in @ref{BUGS}.
13997
13998 @item cvs [@var{command} aborted]: cannot start server via rcmd
13999 This, unfortunately, is a rather nonspecific error
14000 message which @sc{cvs} 1.9 will print if you are
14001 running the @sc{cvs} client and it is having trouble
14002 connecting to the server.  Current versions of @sc{cvs}
14003 should print a much more specific error message.  If
14004 you get this message when you didn't mean to run the
14005 client at all, you probably forgot to specify
14006 @code{:local:}, as described in @ref{Repository}.
14007
14008 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
14009 @sc{cvs} 1.9 and older will print this message
14010 when trying to check in a binary file if
14011 @sc{rcs} is not correctly installed.  Re-read the
14012 instructions that came with your @sc{rcs} distribution
14013 and the @sc{install} file in the @sc{cvs}
14014 distribution.  Alternately, upgrade to a current
14015 version of @sc{cvs}, which checks in files itself
14016 rather than via @sc{rcs}.
14017
14018 @item cvs checkout: could not check out @var{file}
14019 With @sc{cvs} 1.9, this can mean that the @code{co} program
14020 (part of @sc{rcs}) returned a failure.  It should be
14021 preceded by another error message, however it has been
14022 observed without another error message and the cause is
14023 not well-understood.  With the current version of @sc{cvs},
14024 which does not run @code{co}, if this message occurs
14025 without another error message, it is definitely a @sc{cvs}
14026 bug (@pxref{BUGS}).
14027 @c My current suspicion is that the RCS in the rcs (not
14028 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
14029 @c CD is bad (remains to be confirmed).
14030 @c There is also a report of something which looks
14031 @c very similar on SGI, Irix 5.2, so I dunno.
14032
14033 @item cvs [login aborted]: could not find out home directory
14034 This means that you need to set the environment
14035 variables that @sc{cvs} uses to locate your home directory.
14036 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
14037 @ref{Environment variables}.
14038
14039 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
14040 @sc{cvs} 1.9 and older will print this message if there was
14041 a problem finding the @code{rcsmerge} program.  Make
14042 sure that it is in your @code{PATH}, or upgrade to a
14043 current version of @sc{cvs}, which does not require
14044 an external @code{rcsmerge} program.
14045
14046 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
14047 This means that there was a problem finding the
14048 @code{patch} program.  Make sure that it is in your
14049 @code{PATH}.  Note that despite appearances the message
14050 is @emph{not} referring to whether it can find @var{file}.
14051 If both the client and the server are running a current
14052 version of @sc{cvs}, then there is no need for an
14053 external patch program and you should not see this
14054 message.  But if either client or server is running
14055 @sc{cvs} 1.9, then you need @code{patch}.
14056
14057 @item cvs update: could not patch @var{file}; will refetch
14058 This means that for whatever reason the client was
14059 unable to apply a patch that the server sent.  The
14060 message is nothing to be concerned about, because
14061 inability to apply the patch only slows things down and
14062 has no effect on what @sc{cvs} does.
14063 @c xref to update output.  Or File status?
14064 @c Or some place else that
14065 @c explains this whole "patch"/P/Needs Patch thing?
14066
14067 @item dying gasps from @var{server} unexpected
14068 There is a known bug in the server for @sc{cvs} 1.9.18
14069 and older which can cause this.  For me, this was
14070 reproducible if I used the @samp{-t} global option.  It
14071 was fixed by Andy Piper's 14 Nov 1997 change to
14072 src/filesubr.c, if anyone is curious.
14073 If you see the message,
14074 you probably can just retry the operation which failed,
14075 or if you have discovered information concerning its
14076 cause, please let us know as described in @ref{BUGS}.
14077
14078 @item end of file from server (consult above messages if any)
14079 The most common cause for this message is if you are
14080 using an external @code{rsh} program and it exited with
14081 an error.  In this case the @code{rsh} program should
14082 have printed a message, which will appear before the
14083 above message.  For more information on setting up a
14084 @sc{cvs} client and server, see @ref{Remote repositories}.
14085
14086 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
14087 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
14088 This means that there is a syntax error in the given
14089 @sc{rcs} file.  Note that this might be true even if @sc{rcs} can
14090 read the file OK; @sc{cvs} does more error checking of
14091 errors in the RCS file.  That is why you may see this
14092 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
14093 1.10.  The likely cause for the original corruption is
14094 hardware, the operating system, or the like.  Of
14095 course, if you find a case in which @sc{cvs} seems to
14096 corrupting the file, by all means report it,
14097 (@pxref{BUGS}).
14098 There are quite a few variations of this error message,
14099 depending on exactly where in the @sc{rcs} file @sc{cvs}
14100 finds the syntax error.
14101
14102 @cindex mkmodules
14103 @item cvs commit: Executing 'mkmodules'
14104 This means that your repository is set up for a version
14105 of @sc{cvs} prior to @sc{cvs} 1.8.  When using @sc{cvs}
14106 1.8 or later, the above message will be preceded by
14107
14108 @example
14109 cvs commit: Rebuilding administrative file database
14110 @end example
14111
14112 If you see both messages, the database is being rebuilt
14113 twice, which is unnecessary but harmless.  If you wish
14114 to avoid the duplication, and you have no versions of
14115 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
14116 every place it appears in your @code{modules}
14117 file.  For more information on the @code{modules} file,
14118 see @ref{modules}.
14119
14120 @c This message comes from "co", and I believe is
14121 @c possible only with older versions of CVS which call
14122 @c co.  The problem with being able to create the bogus
14123 @c RCS file still exists, though (and I think maybe
14124 @c there is a different symptom(s) now).
14125 @c FIXME: Would be nice to have a more exact wording
14126 @c for this message.
14127 @item missing author
14128 Typically this can happen if you created an RCS file
14129 with your username set to empty.  @sc{cvs} will, bogusly,
14130 create an illegal RCS file with no value for the author
14131 field.  The solution is to make sure your username is
14132 set to a non-empty value and re-create the RCS file.
14133 @c "make sure your username is set" is complicated in
14134 @c and of itself, as there are the environment
14135 @c variables the system login name, &c, and it depends
14136 @c on the version of CVS.
14137
14138 @item cvs [checkout aborted]: no such tag @var{tag}
14139 This message means that @sc{cvs} isn't familiar with
14140 the tag @var{tag}.  Usually this means that you have
14141 mistyped a tag name; however there are (relatively
14142 obscure) cases in which @sc{cvs} will require you to
14143 @c Search sanity.sh for "no such tag" to see some of
14144 @c the relatively obscure cases.
14145 try a few other @sc{cvs} commands involving that tag,
14146 before you find one which will cause @sc{cvs} to update
14147 @cindex CVSROOT/val-tags file, forcing tags into
14148 @cindex val-tags file, forcing tags into
14149 the @file{val-tags} file; see discussion of val-tags in
14150 @ref{File permissions}.  You only need to worry about
14151 this once for a given tag; when a tag is listed in
14152 @file{val-tags}, it stays there.  Note that using
14153 @samp{-f} to not require tag matches does not override
14154 this check; see @ref{Common options}.
14155
14156 @item *PANIC* administration files missing
14157 This typically means that there is a directory named
14158 @sc{cvs} but it does not contain the administrative files
14159 which @sc{cvs} puts in a CVS directory.  If the problem is
14160 that you created a CVS directory via some mechanism
14161 other than @sc{cvs}, then the answer is simple, use a name
14162 other than @sc{cvs}.  If not, it indicates a @sc{cvs} bug
14163 (@pxref{BUGS}).
14164
14165 @item rcs error: Unknown option: -x,v/
14166 This message will be followed by a usage message for
14167 @sc{rcs}.  It means that you have an old version of
14168 @sc{rcs} (probably supplied with your operating
14169 system), as well as an old version of @sc{cvs}.
14170 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
14171 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
14172 @c For more information on installing @sc{cvs}, see
14173 @c (FIXME: where?  it depends on whether you are
14174 @c getting binaries or sources or what).
14175 @c The message can also say "ci error" or something
14176 @c instead of "rcs error", I suspect.
14177
14178 @item cvs [server aborted]: received broken pipe signal
14179 This message can be caused by a loginfo program that fails to
14180 read all of the log information from its standard input.
14181 If you find it happening in any other circumstances,
14182 please let us know as described in @ref{BUGS}.
14183
14184 @item 'root' is not allowed to commit files
14185 When committing a permanent change, @sc{cvs} makes a log entry of
14186 who committed the change.  If you are committing the change logged
14187 in as "root" (not under "su" or other root-priv giving program),
14188 @sc{cvs} cannot determine who is actually making the change.
14189 As such, by default, @sc{cvs} disallows changes to be committed by users
14190 logged in as "root".  (You can disable this option by passing the
14191 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
14192 On some systems this means editing the appropriate @file{config.h} file
14193 before building @sc{cvs}.)
14194
14195 @item Terminated with fatal signal 11
14196 This message usually indicates that @sc{cvs} (the server, if you're
14197 using client/server mode) has run out of (virtual) memory.
14198 Although @sc{cvs} tries to catch the error and issue a more meaningful
14199 message, there are many circumstances where that is not possible.
14200 If you appear to have lots of memory available to the system,
14201 the problem is most likely that you're running into a system-wide
14202 limit on the amount of memory a single process can use or a
14203 similar process-specific limit.
14204 The mechanisms for displaying and setting such limits vary from
14205 system to system, so you'll have to consult an expert for your
14206 particular system if you don't know how to do that.
14207
14208 @item Too many arguments!
14209 This message is typically printed by the @file{log.pl}
14210 script which is in the @file{contrib} directory in the
14211 @sc{cvs} source distribution.  In some versions of
14212 @sc{cvs}, @file{log.pl} has been part of the default
14213 @sc{cvs} installation.  The @file{log.pl} script gets
14214 called from the @file{loginfo} administrative file.
14215 Check that the arguments passed in @file{loginfo} match
14216 what your version of @file{log.pl} expects.  In
14217 particular, the @file{log.pl} from @sc{cvs} 1.3 and
14218 older expects the log file as an argument whereas the
14219 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
14220 log file to be specified with a @samp{-f} option.  Of
14221 course, if you don't need @file{log.pl} you can just
14222 comment it out of @file{loginfo}.
14223
14224 @item cvs [update aborted]: unexpected EOF reading @var{file},v
14225 See @samp{EOF in key in RCS file}.
14226
14227 @item cvs [login aborted]: unrecognized auth response from @var{server}
14228 This message typically means that the server is not set
14229 up properly.  For example, if @file{inetd.conf} points
14230 to a nonexistent cvs executable.  To debug it further,
14231 find the log file which inetd writes
14232 (@file{/var/log/messages} or whatever inetd uses on
14233 your system).  For details, see @ref{Connection}, and
14234 @ref{Password authentication server}.
14235
14236 @item cvs commit: Up-to-date check failed for `@var{file}'
14237 This means that someone else has committed a change to
14238 that file since the last time that you did a @code{cvs
14239 update}.  So before proceeding with your @code{cvs
14240 commit} you need to @code{cvs update}.  @sc{cvs} will merge
14241 the changes that you made and the changes that the
14242 other person made.  If it does not detect any conflicts
14243 it will report @samp{M @var{file}} and you are ready
14244 to @code{cvs commit}.  If it detects conflicts it will
14245 print a message saying so, will report @samp{C @var{file}},
14246 and you need to manually resolve the
14247 conflict.  For more details on this process see
14248 @ref{Conflicts example}.
14249
14250 @item Usage:    diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
14251 @example
14252 Only one of [exEX3] allowed
14253 @end example
14254 This indicates a problem with the installation of
14255 @code{diff3} and @code{rcsmerge}.  Specifically
14256 @code{rcsmerge} was compiled to look for GNU diff3, but
14257 it is finding unix diff3 instead.  The exact text of
14258 the message will vary depending on the system.  The
14259 simplest solution is to upgrade to a current version of
14260 @sc{cvs}, which does not rely on external
14261 @code{rcsmerge} or @code{diff3} programs.
14262
14263 @item warning: unrecognized response `@var{text}' from cvs server
14264 If @var{text} contains a valid response (such as
14265 @samp{ok}) followed by an extra carriage return
14266 character (on many systems this will cause the second
14267 part of the message to overwrite the first part), then
14268 it probably means that you are using the @samp{:ext:}
14269 access method with a version of rsh, such as most
14270 non-unix rsh versions, which does not by default
14271 provide a transparent data stream.  In such cases you
14272 probably want to try @samp{:server:} instead of
14273 @samp{:ext:}.  If @var{text} is something else, this
14274 may signify a problem with your @sc{cvs} server.
14275 Double-check your installation against the instructions
14276 for setting up the @sc{cvs} server.
14277 @c FIXCVS: should be printing CR as \r or \015 or some
14278 @c such, probably.
14279
14280 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
14281 This is a normal message, not an error.  See
14282 @ref{Concurrency}, for more details.
14283
14284 @item cvs commit: warning: editor session failed
14285 @cindex Exit status, of editor
14286 This means that the editor which @sc{cvs} is using exits with a nonzero
14287 exit status.  Some versions of vi will do this even when there was not
14288 a problem editing the file.  If so, point the
14289 @code{CVSEDITOR} environment variable to a small script
14290 such as:
14291
14292 @example
14293 #!/bin/sh
14294 vi $*
14295 exit 0
14296 @end example
14297
14298 @item cvs update: warning: @var{file} was lost
14299 This means that the working copy of @var{file} has been deleted
14300 but it has not been removed from @sc{cvs}.
14301 This is nothing to be concerned about,
14302 the update will just recreate the local file from the repository.
14303 (This is a convenient way to discard local changes to a file:
14304 just delete it and then run @code{cvs update}.)
14305
14306 @item cvs update: warning: @var{file} is not (any longer) pertinent
14307 This means that the working copy of @var{file} has been deleted,
14308 it has not been removed from @sc{cvs} in the current working directory,
14309 but it has been removed from @sc{cvs} in some other working directory.
14310 This is nothing to be concerned about,
14311 the update would have removed the local file anyway.
14312
14313 @end table
14314
14315 @node Connection
14316 @appendixsec Trouble making a connection to a CVS server
14317
14318 This section concerns what to do if you are having
14319 trouble making a connection to a @sc{cvs} server.  If
14320 you are running the @sc{cvs} command line client
14321 running on Windows, first upgrade the client to
14322 @sc{cvs} 1.9.12 or later.  The error reporting in
14323 earlier versions provided much less information about
14324 what the problem was.  If the client is non-Windows,
14325 @sc{cvs} 1.9 should be fine.
14326
14327 If the error messages are not sufficient to track down
14328 the problem, the next steps depend largely on which
14329 access method you are using.
14330
14331 @table @code
14332 @cindex :ext:, troubleshooting
14333 @item :ext:
14334 Try running the rsh program from the command line.  For
14335 example: "rsh servername cvs -v" should print @sc{cvs}
14336 version information.  If this doesn't work, you need to
14337 fix it before you can worry about @sc{cvs} problems.
14338
14339 @cindex :server:, troubleshooting
14340 @item :server:
14341 You don't need a command line rsh program to use this
14342 access method, but if you have an rsh program around,
14343 it may be useful as a debugging tool.  Follow the
14344 directions given for :ext:.
14345
14346 @cindex :pserver:, troubleshooting
14347 @item :pserver:
14348 Errors along the lines of "connection refused" typically indicate
14349 that inetd isn't even listening for connections on port 2401
14350 whereas errors like "connection reset by peer",
14351 "received broken pipe signal", "recv() from server: EOF",
14352 or "end of file from server"
14353 typically indicate that inetd is listening for
14354 connections but is unable to start @sc{cvs} (this is frequently
14355 caused by having an incorrect path in @file{inetd.conf}
14356 or by firewall software rejecting the connection).
14357 "unrecognized auth response" errors are caused by a bad command
14358 line in @file{inetd.conf}, typically an invalid option or forgetting
14359 to put the @samp{pserver} command at the end of the line.
14360 Another less common problem is invisible control characters that
14361 your editor "helpfully" added without you noticing.
14362
14363 One good debugging tool is to "telnet servername
14364 2401".  After connecting, send any text (for example
14365 "foo" followed by return).  If @sc{cvs} is working
14366 correctly, it will respond with
14367
14368 @example
14369 cvs [pserver aborted]: bad auth protocol start: foo
14370 @end example
14371
14372 If instead you get:
14373
14374 @example
14375 Usage: cvs [cvs-options] command [command-options-and-arguments]
14376 ...
14377 @end example
14378
14379 @noindent
14380 then you're missing the @samp{pserver} command at the end of the
14381 line in @file{inetd.conf}; check to make sure that the entire command
14382 is on one line and that it's complete.
14383
14384 Likewise, if you get something like:
14385
14386 @example
14387 Unknown command: `pserved'
14388
14389 CVS commands are:
14390         add          Add a new file/directory to the repository
14391 ...
14392 @end example
14393
14394 @noindent
14395 then you've misspelled @samp{pserver} in some way.  If it isn't
14396 obvious, check for invisible control characters (particularly
14397 carriage returns) in @file{inetd.conf}.
14398
14399 If it fails to work at all, then make sure inetd is working
14400 right.  Change the invocation in @file{inetd.conf} to run the
14401 echo program instead of cvs.  For example:
14402
14403 @example
14404 2401  stream  tcp  nowait  root /bin/echo echo hello
14405 @end example
14406
14407 After making that change and instructing inetd to
14408 re-read its configuration file, "telnet servername
14409 2401" should show you the text hello and then the
14410 server should close the connection.  If this doesn't
14411 work, you need to fix it before you can worry about
14412 @sc{cvs} problems.
14413
14414 On AIX systems, the system will often have its own
14415 program trying to use port 2401.  This is AIX's problem
14416 in the sense that port 2401 is registered for use with
14417 @sc{cvs}.  I hear that there is an AIX patch available
14418 to address this problem.
14419
14420 Another good debugging tool is the @samp{-d}
14421 (debugging) option to inetd.  Consult your system
14422 documentation for more information.
14423
14424 If you seem to be connecting but get errors like:
14425
14426 @example
14427 cvs server: cannot open /root/.cvsignore: Permission denied
14428 cvs [server aborted]: can't chdir(/root): Permission denied
14429 @end example
14430
14431 @noindent
14432 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
14433 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
14434 your system setting the @code{$HOME} environment variable
14435 for programs being run by inetd.  In this case, you can either
14436 have inetd run a shell script that unsets @code{$HOME} and then runs
14437 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
14438 environment.)
14439
14440 If you can connect successfully for a while but then can't,
14441 you've probably hit inetd's rate limit.
14442 (If inetd receives too many requests for the same service
14443 in a short period of time, it assumes that something is wrong
14444 and temporarily disables the service.)
14445 Check your inetd documentation to find out how to adjust the
14446 rate limit (some versions of inetd have a single rate limit,
14447 others allow you to set the limit for each service separately.)
14448 @end table
14449
14450 @node Other problems
14451 @appendixsec Other common problems
14452
14453 Here is a list of problems which do not fit into the
14454 above categories.  They are in no particular order.
14455
14456 @itemize @bullet
14457 @item
14458 On Windows, if there is a 30 second or so delay when
14459 you run a @sc{cvs} command, it may mean that you have
14460 your home directory set to @file{C:/}, for example (see
14461 @code{HOMEDRIVE} and @code{HOMEPATH} in
14462 @ref{Environment variables}).  @sc{cvs} expects the home
14463 directory to not end in a slash, for example @file{C:}
14464 or @file{C:\cvs}.
14465 @c FIXCVS: CVS should at least detect this and print an
14466 @c error, presumably.
14467
14468 @item
14469 If you are running @sc{cvs} 1.9.18 or older, and
14470 @code{cvs update} finds a conflict and tries to
14471 merge, as described in @ref{Conflicts example}, but
14472 doesn't tell you there were conflicts, then you may
14473 have an old version of @sc{rcs}.  The easiest solution
14474 probably is to upgrade to a current version of
14475 @sc{cvs}, which does not rely on external @sc{rcs}
14476 programs.
14477 @end itemize
14478
14479 @c ---------------------------------------------------------------------
14480 @node Credits
14481 @appendix Credits
14482
14483 @cindex Contributors (manual)
14484 @cindex Credits (manual)
14485 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
14486 wrote the manual pages which were distributed with
14487 @sc{cvs} 1.3.  Much of their text was copied into this
14488 manual.  He also read an early draft
14489 of this manual and contributed many ideas and
14490 corrections.
14491
14492 The mailing-list @code{info-cvs} is sometimes
14493 informative. I have included information from postings
14494 made by the following persons:
14495 David G. Grubbs <@t{dgg@@think.com}>.
14496
14497 Some text has been extracted from the man pages for
14498 @sc{rcs}.
14499
14500 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
14501 useful material.  The @sc{faq} is no longer maintained,
14502 however, and this manual is about the closest thing there
14503 is to a successor (with respect to documenting how to
14504 use @sc{cvs}, at least).
14505
14506 In addition, the following persons have helped by
14507 telling me about mistakes I've made:
14508
14509 @display
14510 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
14511 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
14512 Karl Pingle <@t{pingle@@acuson.com}>,
14513 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
14514 Inge Wallin <@t{ingwa@@signum.se}>,
14515 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
14516 and Michael Brown <@t{brown@@wi.extrel.com}>.
14517 @end display
14518
14519 The list of contributors here is not comprehensive; for a more
14520 complete list of who has contributed to this manual see
14521 the file @file{doc/ChangeLog} in the @sc{cvs} source
14522 distribution.
14523
14524 @c ---------------------------------------------------------------------
14525 @node BUGS
14526 @appendix Dealing with bugs in CVS or this manual
14527
14528 @cindex Bugs in this manual or CVS
14529 Neither @sc{cvs} nor this manual is perfect, and they
14530 probably never will be.  If you are having trouble
14531 using @sc{cvs}, or think you have found a bug, there
14532 are a number of things you can do about it.  Note that
14533 if the manual is unclear, that can be considered a bug
14534 in the manual, so these problems are often worth doing
14535 something about as well as problems with @sc{cvs} itself.
14536
14537 @cindex Reporting bugs
14538 @cindex Bugs, reporting
14539 @cindex Errors, reporting
14540 @itemize @bullet
14541 @item
14542 If you want someone to help you and fix bugs that you
14543 report, there are companies which will do that for a
14544 fee.  One such company is:
14545
14546 @cindex Ximbiot
14547 @cindex Support, getting CVS support
14548 @example
14549 Ximbiot
14550 319 S. River St.
14551 Harrisburg, PA  17104-1657
14552 USA
14553 Email: info@@ximbiot.com
14554 Phone: (717) 579-6168
14555 Fax:   (717) 234-3125
14556 @url{http://ximbiot.com/}
14557
14558 @end example
14559
14560 @item
14561 If you got @sc{cvs} through a distributor, such as an
14562 operating system vendor or a vendor of freeware
14563 @sc{cd-rom}s, you may wish to see whether the
14564 distributor provides support.  Often, they will provide
14565 no support or minimal support, but this may vary from
14566 distributor to distributor.
14567
14568 @item
14569 If you have the skills and time to do so, you may wish
14570 to fix the bug yourself.  If you wish to submit your
14571 fix for inclusion in future releases of @sc{cvs}, see
14572 the file @sc{hacking} in the @sc{cvs} source
14573 distribution.  It contains much more information on the
14574 process of submitting fixes.
14575
14576 @item
14577 There may be resources on the net which can help.  A
14578 good place to start is:
14579
14580 @example
14581 @url{http://cvs.nongnu.org/}
14582 @end example
14583
14584 If you are so inspired, increasing the information
14585 available on the net is likely to be appreciated.  For
14586 example, before the standard @sc{cvs} distribution
14587 worked on Windows 95, there was a web page with some
14588 explanation and patches for running @sc{cvs} on Windows
14589 95, and various people helped out by mentioning this
14590 page on mailing lists or newsgroups when the subject
14591 came up.
14592
14593 @item
14594 It is also possible to report bugs to @email{bug-cvs@@nongnu.org}.
14595 Note that someone may or may not want to do anything
14596 with your bug report---if you need a solution consider
14597 one of the options mentioned above.  People probably do
14598 want to hear about bugs which are particularly severe
14599 in consequences and/or easy to fix, however.  You can
14600 also increase your odds by being as clear as possible
14601 about the exact nature of the bug and any other
14602 relevant information.  The way to report bugs is to
14603 send email to @email{bug-cvs@@nongnu.org}.  Note
14604 that submissions to @email{bug-cvs@@nongnu.org} may be distributed
14605 under the terms of the @sc{gnu} Public License, so if
14606 you don't like this, don't submit them.  There is
14607 usually no justification for sending mail directly to
14608 one of the @sc{cvs} maintainers rather than to
14609 @email{bug-cvs@@nongnu.org}; those maintainers who want to hear
14610 about such bug reports read @email{bug-cvs@@nongnu.org}.  Also note
14611 that sending a bug report to other mailing lists or
14612 newsgroups is @emph{not} a substitute for sending it to
14613 @email{bug-cvs@@nongnu.org}.  It is fine to discuss @sc{cvs} bugs on
14614 whatever forum you prefer, but there are not
14615 necessarily any maintainers reading bug reports sent
14616 anywhere except @email{bug-cvs@@nongnu.org}.
14617 @end itemize
14618
14619 @cindex Known bugs in this manual or CVS
14620 People often ask if there is a list of known bugs or
14621 whether a particular bug is a known one.  The file
14622 @sc{bugs} in the @sc{cvs} source distribution is one
14623 list of known bugs, but it doesn't necessarily try to
14624 be comprehensive.  Perhaps there will never be a
14625 comprehensive, detailed list of known bugs.
14626
14627 @c ---------------------------------------------------------------------
14628 @node Index
14629 @unnumbered Index
14630 @cindex Index
14631
14632 @printindex cp
14633
14634 @bye
14635 \f
14636 Local Variables:
14637 fill-column: 55
14638 End: