Debian Codegraph @

doc/cvs.texinfo

raw
1 \input texinfo @c -*-texinfo-*-
2 @comment Documentation for CVS.
3 @setfilename cvs.info
4 @set MBSDPATCHLEVEL -MirOS-0AB9.2
5 @tex
6 % set PA4 paper size (can print on both DIN ISO A4 and US Letter)
7 \globaldefs = 1%
8 \afourpaper%
9 \internalpagesizes{46\baselineskip}{160mm}%
10 {\voffset}{\hoffset}%
11 {\bindingoffset}{36pt}%
12 {28truecm}{21truecm}%
13 \globaldefs = 0%
14 @end tex
15 @comment $MirOS: src/gnu/usr.bin/cvs/doc/cvs.texinfo,v 1.39 2025/11/03 20:38:44 tg Exp $
16 @macro copyleftnotice
17 @noindent
18 Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
19 2001, 2002, 2003, 2004, 2005
20 Free Software Foundation, Inc.
21
22 @multitable @columnfractions .12 .88
23 @item Portions
24 @item @tab Copyright @copyright{} 2003, 2004, 2005, 2007, 2009, 2010, 2011,
25 2013, 2014, 2015, 2016, 2017, 2021
26 mirabilos, The MirOS Project
27 @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
28 2007
29 Derek R. Price,
30 @item @tab Copyright @copyright{} 2002, 2003, 2004, 2005
31 Ximbiot @url{http://ximbiot.com},
32 @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
33 @item @tab and Copyright @copyright{} others.
34 @end multitable
35
36 @ignore
37 Permission is granted to process this file through Tex and print the
38 results, provided the printed document carries copying permission
39 notice identical to this one except for the removal of this paragraph
40 (this paragraph not being relevant to the printed manual).
41
42 @end ignore
43 Permission is granted to make and distribute verbatim copies of
44 this manual provided the copyright notice and this permission notice
45 are preserved on all copies.
46
47 Permission is granted to copy and distribute modified versions of this
48 manual under the conditions for verbatim copying, provided also that the
49 entire resulting derived work is distributed under the terms of a
50 permission notice identical to this one.
51
52 Permission is granted to copy and distribute translations of this manual
53 into another language, under the above conditions for modified versions,
54 except that this permission notice may be stated in a translation
55 approved by the Free Software Foundation.
56 @end macro
57
58 @comment This file is part of the CVS distribution.
59
60 @comment CVS is free software; you can redistribute it and/or modify
61 @comment it under the terms of the GNU General Public License as published by
62 @comment the Free Software Foundation; either version 2, or (at your option)
63 @comment any later version.
64
65 @comment CVS is distributed in the hope that it will be useful,
66 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
67 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 @comment GNU General Public License for more details.
69
70 @comment It should be noted that the Texinfo manual is distributed
71 @comment under the above notice in all forms, except for the manpage
72 @comment generated from it, and that the manual and the source code
73 @comment of CVS often need to stay synchronised; therefore, exchanging
74 @comment between these three entities under these two licences seems
75 @comment to be granted, and the statement above can be interpreted as
76 @comment explicit dual-licence grant. As a major contributor to this
77 @comment documentation for MirBSD, I do not oppose. --mirabilos
78
79 @c See ../README for A4 vs. US letter size.
80 @c When we provided A4 postscript, and people tried to
81 @c print it on US letter, the usual complaint was that the
82 @c page numbers would get cut off.
83 @c If one prints US letter on A4, reportedly there is
84 @c some extra space at the top and/or bottom, and the side
85 @c margins are a bit narrow, but no text is lost.
86 @c
87 @c See
88 @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
89 @c for more on paper sizes. Insuring that margins are
90 @c big enough to print on either A4 or US letter does
91 @c indeed seem to be the usual approach (RFC2346).
92
93 @c This document seems to get overfull hboxes with some
94 @c frequency (probably because the tendency is to
95 @c sanity-check it with "make info" and run TeX less
96 @c often). The big ugly boxes just seem to add insult
97 @c to injury, and I'm not aware of them helping to fix
98 @c the overfull hboxes at all.
99 @finalout
100
101 @include version.texi
102 @settitle CVS---Concurrent Versions System v@value{VERSION}
103 @setchapternewpage odd
104
105 @c -- TODO list:
106 @c -- Fix all lines that match "^@c -- "
107 @c -- Also places marked with FIXME should be manual
108 @c problems (as opposed to FIXCVS for CVS problems).
109
110 @c @splitrcskeyword{} is used to avoid keyword expansion. It is replaced by
111 @c @asis when generating info and dvi, and by <i></i> in the generated html,
112 @c such that keywords are not expanded in the generated html.
113 @ifnothtml
114 @macro splitrcskeyword {arg}
115 @asis{}\arg\
116 @end macro
117 @end ifnothtml
118
119 @ifhtml
120 @macro splitrcskeyword {arg}
121 @i{}\arg\
122 @end macro
123 @end ifhtml
124
125 @dircategory GNU Packages
126 @direntry
127 * CVS: (cvs). Concurrent Versions System
128 @end direntry
129 @dircategory Individual utilities
130 @direntry
131 * cvs: (cvs)CVS command list. Concurrent Versions System
132 @end direntry
133
134 @comment The titlepage section does not appear in the Info file.
135 @titlepage
136 @sp 4
137 @comment The title is printed in a large font.
138 @center @titlefont{Version Management}
139 @sp 1
140 @center @titlefont{with}
141 @sp 1
142 @center @titlefont{CVS}
143 @sp 2
144 @center for @sc{cvs} @value{VERSION}@value{MBSDPATCHLEVEL}
145 @comment -release-
146 @sp 3
147 @center Per Cederqvist et al
148
149 @comment The following two commands start the copyright page
150 @comment for the printed manual. This will not appear in the Info file.
151 @page
152 @vskip 0pt plus 1filll
153 @copyleftnotice
154 @end titlepage
155
156 @summarycontents
157
158 @contents
159
160 @comment ================================================================
161 @comment The real text starts here
162 @comment ================================================================
163
164 @ifnottex
165 @c ---------------------------------------------------------------------
166 @node Top
167 @top
168
169 @ifnotinfo
170 @anchor{Cederqvist}
171 @end ifnotinfo
172 This info manual describes how to use and administer
173 @sc{cvs} version @value{VERSION}@value{MBSDPATCHLEVEL} and up.
174 @end ifnottex
175
176 @ifinfo
177 @copyleftnotice
178 @anchor{Cederqvist}
179 @end ifinfo
180 @iftex
181 @anchor{Cederqvist}
182 @end iftex
183
184 @c This menu is pretty long. Not sure how easily that
185 @c can be fixed (no brilliant ideas right away)...
186 @menu
187 * Overview:: An introduction to CVS
188 * Repository:: Where all your sources are stored
189 * Starting a new project:: Starting a project with CVS
190 * Revisions:: Numeric and symbolic names for revisions
191 * Branching and merging:: Diverging/rejoining branches of development
192 * Recursive behavior:: CVS descends directories
193 * Adding and removing:: Adding/removing/renaming files/directories
194 * History browsing:: Viewing the history of files in various ways
195
196 CVS and the Real World.
197 -----------------------
198 * Binary files:: CVS can handle binary files
199 * Multiple developers:: How CVS helps a group of developers
200 * Revision management:: Policy questions for revision management
201 * Keyword substitution:: CVS can include the revision inside the file
202 * Tracking sources:: Tracking third-party sources
203 * Builds:: Issues related to CVS and builds
204 * Special Files:: Devices, links and other non-regular files
205
206 References.
207 -----------
208 * CVS commands:: CVS commands share some things
209 * Invoking CVS:: Quick reference to CVS commands
210 * Administrative files:: Reference manual for the Administrative files
211 * Environment variables:: All environment variables which affect CVS
212 * Compatibility:: Upgrading CVS versions
213 * Troubleshooting:: Some tips when nothing works
214 * Credits:: Some of the contributors to this manual
215 * BUGS:: Dealing with bugs in CVS or this manual
216 * CVS command list:: Alphabetical list of all CVS commands
217 * Index:: Index
218 @end menu
219
220 @c ---------------------------------------------------------------------
221 @node Overview
222 @chapter Overview
223 @cindex Overview
224
225 This chapter is for people who have never used
226 @sc{cvs}, and perhaps have never used version control
227 software before.
228
229 If you are already familiar with @sc{cvs} and are just
230 trying to learn a particular feature or remember a
231 certain command, you can probably skip everything here.
232
233 @menu
234 * What is CVS?:: What you can do with @sc{cvs}
235 * What is CVS not?:: Problems @sc{cvs} doesn't try to solve
236 * A sample session:: A tour of basic @sc{cvs} usage
237 @end menu
238
239 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
240 @node What is CVS?
241 @section What is CVS?
242 @cindex What is CVS?
243 @cindex Introduction to CVS
244 @cindex CVS, introduction to
245
246 @sc{cvs} is a version control system. Using it, you can
247 record the history of your source files.
248
249 @c -- ///
250 @c -- ///Those who cannot remember the past are condemned to repeat it.
251 @c -- /// -- George Santayana
252 @c -- //////
253
254 @c -- Insert history quote here!
255 For example, bugs sometimes creep in when
256 software is modified, and you might not detect the bug
257 until a long time after you make the modification.
258 With @sc{cvs}, you can easily retrieve old versions to see
259 exactly which change caused the bug. This can
260 sometimes be a big help.
261
262 You could of course save every version of every file
263 you have ever created. This would
264 however waste an enormous amount of disk space. @sc{cvs}
265 stores all the versions of a file in a single file in a
266 clever way that only stores the differences between
267 versions.
268
269 @sc{cvs} also helps you if you are part of a group of people working
270 on the same project. It is all too easy to overwrite
271 each others' changes unless you are extremely careful.
272 Some editors, like @sc{gnu} Emacs, try to make sure that
273 two people never modify the same file at the
274 same time. Unfortunately, if someone is using another
275 editor, that safeguard will not work. @sc{cvs} solves this problem
276 by insulating the different developers from each other. Every
277 developer works in his own directory, and @sc{cvs} merges
278 the work when each developer is done.
279
280 @cindex History of CVS
281 @cindex CVS, history of
282 @cindex Credits (CVS program)
283 @cindex Contributors (CVS program)
284 @sc{cvs} started out as a bunch of shell scripts written by
285 Dick Grune, posted to the newsgroup
286 @code{comp.sources.unix} in the volume 6
287 release of July, 1986. While no actual code from
288 these shell scripts is present in the current version
289 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
290 come from them.
291
292 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
293 Jeff Polk later helped Brian with the design of the @sc{cvs}
294 module and vendor branch support.
295
296 @cindex Source, getting CVS source
297 You can get @sc{cvs} in a variety of ways, including
298 free download from the Internet. For more information
299 on downloading @sc{cvs} and other @sc{cvs} topics, see:
300
301 @example
302 @url{http://cvs.nongnu.org/}
303 @end example
304
305 @cindex Mailing list
306 @cindex List, mailing list
307 @cindex Newsgroups
308 There is a mailing list, known as @email{info-cvs@@nongnu.org},
309 devoted to @sc{cvs}. To subscribe or
310 unsubscribe
311 write to
312 @email{info-cvs-request@@nongnu.org}.
313 If you prefer a Usenet group, there is a one-way mirror (posts to the email
314 list are usually sent to the news group, but not visa versa) of
315 @email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}. The right
316 Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
317 @sc{cvs} discussions (along with other configuration
318 management systems). In the future, it might be
319 possible to create a
320 @code{comp.software.config-mgmt.cvs}, but probably only
321 if there is sufficient @sc{cvs} traffic on
322 @url{news:comp.software.config-mgmt}.
323 @c Other random data is that the tale was very
324 @c skeptical of comp.software.config-mgmt.cvs when the
325 @c subject came up around 1995 or so (for one
326 @c thing, because creating it would be a "reorg" which
327 @c would need to take a more comprehensive look at the
328 @c whole comp.software.config-mgmt.* hierarchy).
329
330 You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list,
331 described in more detail in @ref{BUGS}. To subscribe
332 send mail to @email{bug-cvs-request@@nongnu.org}. There is a two-way
333 Usenet mirror (posts to the Usenet group are usually sent to the email list and
334 visa versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}.
335
336 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
337 @node What is CVS not?
338 @section What is CVS not?
339 @cindex What is CVS not?
340
341 @sc{cvs} can do a lot of things for you, but it does
342 not try to be everything for everyone.
343
344 @table @asis
345 @item @sc{cvs} is not a build system.
346
347 Though the structure of your repository and modules
348 file interact with your build system
349 (e.g. @file{Makefile}s), they are essentially
350 independent.
351
352 @sc{cvs} does not dictate how you build anything. It
353 merely stores files for retrieval in a tree structure
354 you devise.
355
356 @sc{cvs} does not dictate how to use disk space in the
357 checked out working directories. If you write your
358 @file{Makefile}s or scripts in every directory so they
359 have to know the relative positions of everything else,
360 you wind up requiring the entire repository to be
361 checked out.
362
363 If you modularise your work, and construct a build
364 system that will share files (via links, mounts,
365 @code{VPATH} in @file{Makefile}s, etc.), you can
366 arrange your disk usage however you like.
367
368 But you have to remember that @emph{any} such system is
369 a lot of work to construct and maintain. @sc{cvs} does
370 not address the issues involved.
371
372 Of course, you should place the tools created to
373 support such a build system (scripts, @file{Makefile}s,
374 etc) under @sc{cvs}.
375
376 Figuring out what files need to be rebuilt when
377 something changes is, again, something to be handled
378 outside the scope of @sc{cvs}. One traditional
379 approach is to use @code{make} for building, and use
380 some automated tool for generating the dependencies which
381 @code{make} uses.
382
383 See @ref{Builds}, for more information on doing builds
384 in conjunction with @sc{cvs}.
385
386 @item @sc{cvs} is not a substitute for management.
387
388 Your managers and project leaders are expected to talk
389 to you frequently enough to make certain you are aware
390 of schedules, merge points, branch names and release
391 dates. If they don't, @sc{cvs} can't help.
392
393 @sc{cvs} is an instrument for making sources dance to
394 your tune. But you are the piper and the composer. No
395 instrument plays itself or writes its own music.
396
397 @item @sc{cvs} is not a substitute for developer communication.
398
399 When faced with conflicts within a single file, most
400 developers manage to resolve them without too much
401 effort. But a more general definition of ``conflict''
402 includes problems too difficult to solve without
403 communication between developers.
404
405 @sc{cvs} cannot determine when simultaneous changes
406 within a single file, or across a whole collection of
407 files, will logically conflict with one another. Its
408 concept of a @dfn{conflict} is purely textual, arising
409 when two changes to the same base file are near enough
410 to spook the merge (i.e. @code{diff3}) command.
411
412 @sc{cvs} does not claim to help at all in figuring out
413 non-textual or distributed conflicts in program logic.
414
415 For example: Say you change the arguments to function
416 @code{X} defined in file @file{A}. At the same time,
417 someone edits file @file{B}, adding new calls to
418 function @code{X} using the old arguments. You are
419 outside the realm of @sc{cvs}'s competence.
420
421 Acquire the habit of reading specs and talking to your
422 peers.
423
424
425 @item @sc{cvs} does not have change control
426
427 Change control refers to a number of things. First of
428 all it can mean @dfn{bug-tracking}, that is being able
429 to keep a database of reported bugs and the status of
430 each one (is it fixed? in what release? has the bug
431 submitter agreed that it is fixed?). For interfacing
432 @sc{cvs} to an external bug-tracking system, see the
433 @file{rcsinfo} and @file{verifymsg} files
434 (@pxref{Administrative files}).
435
436 Another aspect of change control is keeping track of
437 the fact that changes to several files were in fact
438 changed together as one logical change. If you check
439 in several files in a single @code{cvs commit}
440 operation, @sc{cvs} then forgets that those files were
441 checked in together, and the fact that they have the
442 same log message is the only thing tying them
443 together. Keeping a @sc{gnu} style @file{ChangeLog}
444 can help somewhat.
445 @c FIXME: should have an xref to a section which talks
446 @c more about keeping ChangeLog's with CVS, but that
447 @c section hasn't been written yet.
448
449 Another aspect of change control, in some systems, is
450 the ability to keep track of the status of each
451 change. Some changes have been written by a developer,
452 others have been reviewed by a second developer, and so
453 on. Generally, the way to do this with @sc{cvs} is to
454 generate a diff (using @code{cvs diff} or @code{diff})
455 and email it to someone who can then apply it using the
456 @code{patch} utility. This is very flexible, but
457 depends on mechanisms outside @sc{cvs} to make sure
458 nothing falls through the cracks.
459
460 @item @sc{cvs} is not an automated testing program
461
462 It should be possible to enforce mandatory use of a
463 test suite using the @code{commitinfo} file. I haven't
464 heard a lot about projects trying to do that or whether
465 there are subtle gotchas, however.
466
467 @item @sc{cvs} does not have a built-in process model
468
469 Some systems provide ways to ensure that changes or
470 releases go through various steps, with various
471 approvals as needed. Generally, one can accomplish
472 this with @sc{cvs} but it might be a little more work.
473 In some cases you'll want to use the @file{commitinfo},
474 @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
475 files, to require that certain steps be performed
476 before cvs will allow a checkin. Also consider whether
477 features such as branches and tags can be used to
478 perform tasks such as doing work in a development tree
479 and then merging certain changes over to a stable tree
480 only once they have been proven.
481 @end table
482
483 @c ---------------------------------------------------------------------
484 @node A sample session
485 @section A sample session
486 @cindex Example of a work-session
487 @cindex Getting started
488 @cindex Work-session, example of
489 @cindex tc, Trivial Compiler (example)
490 @cindex Trivial Compiler (example)
491
492 @c I think an example is a pretty good way to start. But
493 @c somewhere in here, maybe after the sample session,
494 @c we need something which is kind of
495 @c a "roadmap" which is more directed at sketching out
496 @c the functionality of CVS and pointing people to
497 @c various other parts of the manual. As it stands now
498 @c people who read in order get dumped right into all
499 @c manner of hair regarding remote repositories,
500 @c creating a repository, etc.
501 @c
502 @c The following was in the old Basic concepts node. I don't
503 @c know how good a job it does at introducing modules,
504 @c or whether they need to be introduced so soon, but
505 @c something of this sort might go into some
506 @c introductory material somewhere.
507 @ignore
508 @cindex Modules (intro)
509 The repository contains directories and files, in an
510 arbitrary tree. The @dfn{modules} feature can be used
511 to group together a set of directories or files into a
512 single entity (@pxref{modules}). A typical usage is to
513 define one module per project.
514 @end ignore
515
516 As a way of introducing @sc{cvs}, we'll go through a
517 typical work-session using @sc{cvs}. The first thing
518 to understand is that @sc{cvs} stores all files in a
519 centralised @dfn{repository} (@pxref{Repository}); this
520 section assumes that a repository is set up.
521 @c I'm not sure that the sentence concerning the
522 @c repository quite tells the user what they need to
523 @c know at this point. Might need to expand on "centralised"
524 @c slightly (maybe not here, maybe further down in the example?)
525
526 Suppose you are working on a simple compiler. The source
527 consists of a handful of C files and a @file{Makefile}.
528 The compiler is called @samp{tc} (Trivial Compiler),
529 and the repository is set up so that there is a module
530 called @samp{tc}.
531
532 @menu
533 * Getting the source:: Creating a workspace
534 * Committing your changes:: Making your work available to others
535 * Cleaning up:: Cleaning up
536 * Viewing differences:: Viewing differences
537 @end menu
538
539 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
540 @node Getting the source
541 @subsection Getting the source
542 @cindex Getting the source
543 @cindex Checking out source
544 @cindex Fetching source
545 @cindex Source, getting from CVS
546 @cindex Checkout, example
547
548 The first thing you must do is to get your own working copy of the
549 source for @samp{tc}. For this, you use the @code{checkout} command:
550
551 @example
552 $ cvs checkout tc
553 @end example
554
555 @noindent
556 This will create a new directory called @file{tc} and populate it with
557 the source files.
558
559 @example
560 $ cd tc
561 $ ls
562 CVS Makefile backend.c driver.c frontend.c parser.c
563 @end example
564
565 The @file{CVS} directory is used internally by
566 @sc{cvs}. Normally, you should not modify or remove
567 any of the files in it.
568
569 You start your favorite editor, hack away at @file{backend.c}, and a couple
570 of hours later you have added an optimization pass to the compiler.
571 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
572 you want to edit. @xref{Multiple developers}, for an explanation.
573
574 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
575 @node Committing your changes
576 @subsection Committing your changes
577 @cindex Committing changes to files
578 @cindex Log message entry
579
580 When you have checked that the compiler is still compilable you decide
581 to make a new version of @file{backend.c}. This will
582 store your new @file{backend.c} in the repository and
583 make it available to anyone else who is using that same
584 repository.
585
586 @example
587 $ cvs commit backend.c
588 @end example
589
590 @noindent
591 @sc{cvs} starts an editor, to allow you to enter a log
592 message. You type in ``Added an optimization pass.'',
593 save the temporary file, and exit the editor.
594
595 @cindex CVSEDITOR, environment variable
596 @cindex EDITOR, environment variable
597 The environment variable @code{$CVSEDITOR} determines
598 which editor is started. If @code{$CVSEDITOR} is not
599 set, then if the environment variable @code{$EDITOR} is
600 set, it will be used. If both @code{$CVSEDITOR} and
601 @code{$EDITOR} are not set then there is a default
602 which will vary with your operating system, for example
603 @code{vi} for unix or @code{notepad} for Windows
604 NT/95.
605
606 @cindex VISUAL, environment variable
607 In addition, @sc{cvs} checks the @code{$VISUAL} environment
608 variable. Opinions vary on whether this behavior is desirable and
609 whether future releases of @sc{cvs} should check @code{$VISUAL} or
610 ignore it. You will be OK either way if you make sure that
611 @code{$VISUAL} is either unset or set to the same thing as
612 @code{$EDITOR}.
613
614 @c This probably should go into some new node
615 @c containing detailed info on the editor, rather than
616 @c the intro. In fact, perhaps some of the stuff with
617 @c CVSEDITOR and -m and so on should too.
618 When @sc{cvs} starts the editor, it includes a list of
619 files which are modified. For the @sc{cvs} client,
620 this list is based on comparing the modification time
621 of the file against the modification time that the file
622 had when it was last gotten or updated. Therefore, if
623 a file's modification time has changed but its contents
624 have not, it will show up as modified. The simplest
625 way to handle this is simply not to worry about it---if
626 you proceed with the commit @sc{cvs} will detect that
627 the contents are not modified and treat it as an
628 unmodified file. The next @code{update} will clue
629 @sc{cvs} in to the fact that the file is unmodified,
630 and it will reset its stored timestamp so that the file
631 will not show up in future editor sessions.
632 @c FIXCVS: Might be nice if "commit" and other commands
633 @c would reset that timestamp too, but currently commit
634 @c doesn't.
635 @c FIXME: Need to talk more about the process of
636 @c prompting for the log message. Like show an example
637 @c of what it pops up in the editor, for example. Also
638 @c a discussion of how to get the "a)bort, c)ontinue,
639 @c e)dit" prompt and what to do with it. Might also
640 @c work in the suggestion that if you want a diff, you
641 @c should make it before running commit (someone
642 @c suggested that the diff pop up in the editor. I'm
643 @c not sure that is better than telling people to run
644 @c "cvs diff" first if that is what they want, but if
645 @c we want to tell people that, the manual possibly
646 @c should say it).
647
648 If you want to avoid
649 starting an editor you can specify the log message on
650 the command line using the @samp{-m} flag instead, like
651 this:
652
653 @example
654 $ cvs commit -m "Added an optimization pass" backend.c
655 @end example
656
657 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
658 @node Cleaning up
659 @subsection Cleaning up
660 @cindex Cleaning up
661 @cindex Working copy, removing
662 @cindex Removing your working copy
663 @cindex Releasing your working copy
664
665 Before you turn to other tasks you decide to remove your working copy of
666 tc. One acceptable way to do that is of course
667
668 @example
669 $ cd ..
670 $ rm -r tc
671 @end example
672
673 @noindent
674 but a better way is to use the @code{release} command (@pxref{release}):
675
676 @example
677 $ cd ..
678 $ cvs release -d tc
679 M driver.c
680 ? tc
681 You have [1] altered files in this repository.
682 Are you sure you want to release (and delete) directory `tc': n
683 ** `release' aborted by user choice.
684 @end example
685
686 The @code{release} command checks that all your modifications have been
687 committed. If history logging is enabled it also makes a note in the
688 history file. @xref{history file}.
689
690 When you use the @samp{-d} flag with @code{release}, it
691 also removes your working copy.
692
693 In the example above, the @code{release} command wrote a couple of lines
694 of output. @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
695 That is nothing to worry about: @file{tc} is the executable compiler,
696 and it should not be stored in the repository. @xref{cvsignore},
697 for information about how to make that warning go away.
698 @xref{release output}, for a complete explanation of
699 all possible output from @code{release}.
700
701 @samp{M driver.c} is more serious. It means that the
702 file @file{driver.c} has been modified since it was
703 checked out.
704
705 The @code{release} command always finishes by telling
706 you how many modified files you have in your working
707 copy of the sources, and then asks you for confirmation
708 before deleting any files or making any note in the
709 history file.
710
711 You decide to play it safe and answer @kbd{n @key{RET}}
712 when @code{release} asks for confirmation.
713
714 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
715 @node Viewing differences
716 @subsection Viewing differences
717 @cindex Viewing differences
718 @cindex Diff
719
720 You do not remember modifying @file{driver.c}, so you want to see what
721 has happened to that file.
722
723 @example
724 $ cd tc
725 $ cvs diff driver.c
726 @end example
727
728 This command runs @code{diff} to compare the version of @file{driver.c}
729 that you checked out with your working copy. When you see the output
730 you remember that you added a command line option that enabled the
731 optimization pass. You check it in, and release the module.
732 @c FIXME: we haven't yet defined the term "check in".
733
734 @example
735 $ cvs commit -m "Added an optimization pass" driver.c
736 Checking in driver.c;
737 /usr/local/cvsroot/tc/driver.c,v <-- driver.c
738 new revision: 1.2; previous revision: 1.1
739 done
740 $ cd ..
741 $ cvs release -d tc
742 ? tc
743 You have [0] altered files in this repository.
744 Are you sure you want to release (and delete) directory `tc': y
745 @end example
746
747 @c ---------------------------------------------------------------------
748 @node Repository
749 @chapter The Repository
750 @cindex Repository (intro)
751 @cindex Repository, example
752 @cindex Layout of repository
753 @cindex Typical repository
754 @cindex /usr/local/cvsroot, as example repository
755 @cindex cvsroot
756
757 The @sc{cvs} @dfn{repository} stores a complete copy of
758 all the files and directories which are under version
759 control.
760
761 Normally, you never access any of the files in the
762 repository directly. Instead, you use @sc{cvs}
763 commands to get your own copy of the files into a
764 @dfn{working directory}, and then
765 work on that copy. When you've finished a set of
766 changes, you check (or @dfn{commit}) them back into the
767 repository. The repository then contains the changes
768 which you have made, as well as recording exactly what
769 you changed, when you changed it, and other such
770 information. Note that the repository is not a
771 subdirectory of the working directory, or vice versa;
772 they should be in separate locations.
773 @c Need some example, e.g. repository
774 @c /usr/local/cvsroot; working directory
775 @c /home/joe/sources. But this node is too long
776 @c as it is; need a little reorganization...
777
778 @cindex local method, setting up
779 @sc{cvs} can access a repository by a variety of
780 means. It might be on the local computer, or it might
781 be on a computer across the room or across the world.
782 To distinguish various ways to access a repository, the
783 repository name can start with an @dfn{access method}.
784 For example, the access method @code{:local:} means to
785 access a repository directory, so the repository
786 @code{:local:/usr/local/cvsroot} means that the
787 repository is in @file{/usr/local/cvsroot} on the
788 computer running @sc{cvs}. For information on other
789 access methods, see @ref{Remote repositories}.
790
791 @c Can se say this more concisely? Like by passing
792 @c more of the buck to the Remote repositories node?
793 If the access method is omitted, then if the repository
794 starts with @samp{/}, then @code{:local:} is
795 assumed. If it does not start with @samp{/} then either
796 @code{:ext:} or @code{:server:} is assumed. For
797 example, if you have a local repository in
798 @file{/usr/local/cvsroot}, you can use
799 @code{/usr/local/cvsroot} instead of
800 @code{:local:/usr/local/cvsroot}. But if (under
801 Windows NT, for example) your local repository is
802 @file{c:\src\cvsroot}, then you must specify the access
803 method, as in @code{:local:c:/src/cvsroot}.
804
805 @c This might appear to go in Repository storage, but
806 @c actually it is describing something which is quite
807 @c user-visible, when you do a "cvs co CVSROOT". This
808 @c isn't necessary the perfect place for that, though.
809 The repository is split in two parts. @file{$CVSROOT/CVSROOT} contains
810 administrative files for @sc{cvs}. The other directories contain the actual
811 user-defined modules.
812
813 @menu
814 * Specifying a repository:: Telling CVS where your repository is
815 * Repository storage:: The structure of the repository
816 * Working directory storage:: The structure of working directories
817 * Intro administrative files:: Defining modules
818 * Multiple repositories:: Multiple repositories
819 * Creating a repository:: Creating a repository
820 * Backing up:: Backing up a repository
821 * Moving a repository:: Moving a repository
822 * Remote repositories:: Accessing repositories on remote machines
823 * Read-only access:: Granting read-only access to the repository
824 * Server temporary directory:: The server creates temporary directories
825 @end menu
826
827 @node Specifying a repository
828 @section Telling CVS where your repository is
829
830 There are several ways to tell @sc{cvs}
831 where to find the repository. You can name the
832 repository on the command line explicitly, with the
833 @code{-d} (for "directory") option:
834
835 @example
836 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
837 @end example
838
839 @cindex .profile, setting CVSROOT in
840 @cindex .cshrc, setting CVSROOT in
841 @cindex .tcshrc, setting CVSROOT in
842 @cindex .bashrc, setting CVSROOT in
843 @cindex CVSROOT, environment variable
844 Or you can set the @code{$CVSROOT} environment
845 variable to an absolute path to the root of the
846 repository, @file{/usr/local/cvsroot} in this example.
847 To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
848 users should have this line in their @file{.cshrc} or
849 @file{.tcshrc} files:
850
851 @example
852 setenv CVSROOT /usr/local/cvsroot
853 @end example
854
855 @noindent
856 @code{sh} and @code{bash} users should instead have these lines in their
857 @file{.profile} or @file{.bashrc}:
858
859 @example
860 CVSROOT=/usr/local/cvsroot
861 export CVSROOT
862 @end example
863
864 @cindex Root file, in CVS directory
865 @cindex CVS/Root file
866 A repository specified with @code{-d} will
867 override the @code{$CVSROOT} environment variable.
868 Once you've checked a working copy out from the
869 repository, it will remember where its repository is
870 (the information is recorded in the
871 @file{CVS/Root} file in the working copy).
872
873 The @code{-d} option and the @file{CVS/Root} file both
874 override the @code{$CVSROOT} environment variable. If
875 @code{-d} option differs from @file{CVS/Root}, the
876 former is used. Of course, for proper operation they
877 should be two ways of referring to the same repository.
878
879 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
880 @node Repository storage
881 @section How data is stored in the repository
882 @cindex Repository, how data is stored
883
884 For most purposes it isn't important @emph{how}
885 @sc{cvs} stores information in the repository. In
886 fact, the format has changed in the past, and is likely
887 to change in the future. Since in almost all cases one
888 accesses the repository via @sc{cvs} commands, such
889 changes need not be disruptive.
890
891 However, in some cases it may be necessary to
892 understand how @sc{cvs} stores data in the repository,
893 for example you might need to track down @sc{cvs} locks
894 (@pxref{Concurrency}) or you might need to deal with
895 the file permissions appropriate for the repository.
896
897 @menu
898 * Repository files:: What files are stored in the repository
899 * File permissions:: File permissions
900 * Windows permissions:: Issues specific to Windows
901 * Attic:: Some files are stored in the Attic
902 * CVS in repository:: Additional information in CVS directory
903 * Locks:: CVS locks control concurrent accesses
904 * CVSROOT storage:: A few things about CVSROOT are different
905 @end menu
906
907 @node Repository files
908 @subsection Where files are stored within the repository
909
910 @c @cindex Filenames, legal
911 @c @cindex Legal filenames
912 @c Somewhere we need to say something about legitimate
913 @c characters in filenames in working directory and
914 @c repository. Not "/" (not even on non-unix). And
915 @c here is a specific set of issues:
916 @c Files starting with a - are handled inconsistently. They can not
917 @c be added to a repository with an add command, because it they are
918 @c interpreted as a switch. They can appear in a repository if they are
919 @c part of a tree that is imported. They can not be removed from the tree
920 @c once they are there.
921 @c Note that "--" *is* supported (as a
922 @c consequence of using GNU getopt). Should document
923 @c this somewhere ("Common options"?). The other usual technique,
924 @c "./-foo", isn't as effective, at least for "cvs add"
925 @c which doesn't support pathnames containing "/".
926
927 The overall structure of the repository is a directory
928 tree corresponding to the directories in the working
929 directory. For example, supposing the repository is in
930
931 @example
932 /usr/local/cvsroot
933 @end example
934
935 @noindent
936 here is a possible directory tree (showing only the
937 directories):
938
939 @example
940 @t{/usr}
941 |
942 +--@t{local}
943 | |
944 | +--@t{cvsroot}
945 | | |
946 | | +--@t{CVSROOT}
947 | (administrative files)
948 |
949 +--@t{gnu}
950 | |
951 | +--@t{diff}
952 | | (source code to @sc{gnu} diff)
953 | |
954 | +--@t{rcs}
955 | | (source code to @sc{rcs})
956 | |
957 | +--@t{cvs}
958 | (source code to @sc{cvs})
959 |
960 +--@t{yoyodyne}
961 |
962 +--@t{tc}
963 | |
964 | +--@t{man}
965 | |
966 | +--@t{testing}
967 |
968 +--(other Yoyodyne software)
969 @end example
970
971 With the directories are @dfn{history files} for each file
972 under version control. The name of the history file is
973 the name of the corresponding file with @samp{,v}
974 appended to the end. Here is what the repository for
975 the @file{yoyodyne/tc} directory might look like:
976 @c FIXME: Should also mention CVS (CVSREP)
977 @c FIXME? Should we introduce Attic with an xref to
978 @c Attic? Not sure whether that is a good idea or not.
979 @example
980 @code{$CVSROOT}
981 |
982 +--@t{yoyodyne}
983 | |
984 | +--@t{tc}
985 | | |
986 +--@t{Makefile,v}
987 +--@t{backend.c,v}
988 +--@t{driver.c,v}
989 +--@t{frontend.c,v}
990 +--@t{parser.c,v}
991 +--@t{man}
992 | |
993 | +--@t{tc.1,v}
994 |
995 +--@t{testing}
996 |
997 +--@t{testpgm.t,v}
998 +--@t{test2.t,v}
999 @end example
1000
1001 @cindex History files
1002 @cindex RCS history files
1003 @c The first sentence, about what history files
1004 @c contain, is kind of redundant with our intro to what the
1005 @c repository does in node Repository....
1006 The history files contain, among other things, enough
1007 information to recreate any revision of the file, a log
1008 of all commit messages and the user-name of the person
1009 who committed the revision. The history files are
1010 known as @dfn{RCS files}, because the first program to
1011 store files in that format was a version control system
1012 known as @sc{rcs}. For a full
1013 description of the file format, see the @code{man} page
1014 @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
1015 file @file{doc/RCSFILES} in the @sc{cvs} source
1016 distribution. This
1017 file format has become very common---many systems other
1018 than @sc{cvs} or @sc{rcs} can at least import history
1019 files in this format.
1020 @c FIXME: Think about including documentation for this
1021 @c rather than citing it? In the long run, getting
1022 @c this to be a standard (not sure if we can cope with
1023 @c a standards process as formal as IEEE/ANSI/ISO/etc,
1024 @c though...) is the way to go, so maybe citing is
1025 @c better.
1026
1027 The @sc{rcs} files used in @sc{cvs} differ in a few
1028 ways from the standard format. The biggest difference
1029 is magic branches; for more information see @ref{Magic
1030 branch numbers}. Also in @sc{cvs} the valid tag names
1031 are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
1032 rules see @ref{Tags}.
1033
1034 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1035 @node File permissions
1036 @subsection File permissions
1037 @c -- Move this to @node Creating a repository or similar
1038 @cindex Security, file permissions in repository
1039 @cindex File permissions, general
1040 @cindex Permissions, general
1041 @c FIXME: we need to somehow reflect "permissions in
1042 @c repository" versus "permissions in working
1043 @c directory" in the index entries.
1044 @cindex Group, UNIX file permissions, in repository
1045 @cindex Read-only files, in repository
1046 All @samp{,v} files are created read-only, and you
1047 should not change the permission of those files. The
1048 directories inside the repository should be writable by
1049 the persons that have permission to modify the files in
1050 each directory. This normally means that you must
1051 create a UNIX group (see group(5)) consisting of the
1052 persons that are to edit the files in a project, and
1053 set up the repository so that it is that group that
1054 owns the directory.
1055 (On some systems, you also need to set the set-group-ID-on-execution bit
1056 on the repository directories (see chmod(1)) so that newly-created files
1057 and directories get the group-ID of the parent directory rather than
1058 that of the current process.)
1059
1060 @c See also comment in commitinfo node regarding cases
1061 @c which are really awkward with unix groups.
1062
1063 This means that you can only control access to files on
1064 a per-directory basis.
1065
1066 Note that users must also have write access to check
1067 out files, because @sc{cvs} needs to create lock files
1068 (@pxref{Concurrency}). You can use LockDir in CVSROOT/config
1069 to put the lock files somewhere other than in the repository
1070 if you want to allow read-only access to some directories
1071 (@pxref{config}).
1072
1073 @cindex CVSROOT/val-tags file, and read-only access to projects
1074 @cindex val-tags file, and read-only access to projects
1075 Also note that users must have write access to the
1076 @file{CVSROOT/val-tags} file. @sc{cvs} uses it to keep
1077 track of what tags are valid tag names (it is sometimes
1078 updated when tags are used, as well as when they are
1079 created).
1080
1081 Each @sc{rcs} file will be owned by the user who last
1082 checked it in. This has little significance; what
1083 really matters is who owns the directories.
1084
1085 @cindex CVSUMASK, environment variable
1086 @cindex Umask, for repository files
1087 @sc{cvs} tries to set up reasonable file permissions
1088 for new directories that are added inside the tree, but
1089 you must fix the permissions manually when a new
1090 directory should have different permissions than its
1091 parent directory. If you set the @code{CVSUMASK}
1092 environment variable that will control the file
1093 permissions which @sc{cvs} uses in creating directories
1094 and/or files in the repository. @code{CVSUMASK} does
1095 not affect the file permissions in the working
1096 directory; such files have the permissions which are
1097 typical for newly created files, except that sometimes
1098 @sc{cvs} creates them read-only (see the sections on
1099 watches, @ref{Setting a watch}; -r, @ref{Global
1100 options}; or @code{CVSREAD}, @ref{Environment variables}).
1101 @c FIXME: Need more discussion of which
1102 @c group should own the file in the repository.
1103 @c Include a somewhat detailed example of the usual
1104 @c case where CVSUMASK is 002, the developers are all
1105 @c in a group, and that group owns stuff in the
1106 @c repository. Need to talk about group ownership of
1107 @c newly-created directories/files (on some unices,
1108 @c such as SunOS4, setting the setgid bit on the
1109 @c directories will make files inherit the directory's
1110 @c group. On other unices, your mileage may vary. I
1111 @c can't remember what POSIX says about this, if
1112 @c anything).
1113
1114 Note that using the client/server @sc{cvs}
1115 (@pxref{Remote repositories}), there is no good way to
1116 set @code{CVSUMASK}; the setting on the client machine
1117 has no effect. If you are connecting with @code{rsh}, you
1118 can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
1119 described in the documentation for your operating
1120 system. This behavior might change in future versions
1121 of @sc{cvs}; do not rely on the setting of
1122 @code{CVSUMASK} on the client having no effect.
1123 @c FIXME: need to explain what a umask is or cite
1124 @c someplace which does.
1125 @c
1126 @c There is also a larger (largely separate) issue
1127 @c about the meaning of CVSUMASK in a non-unix context.
1128 @c For example, whether there is
1129 @c an equivalent which fits better into other
1130 @c protection schemes like POSIX.6, VMS, &c.
1131 @c
1132 @c FIXME: Need one place which discusses this
1133 @c read-only files thing. Why would one use -r or
1134 @c CVSREAD? Why would one use watches? How do they
1135 @c interact?
1136 @c
1137 @c FIXME: We need to state
1138 @c whether using CVSUMASK removes the need for manually
1139 @c fixing permissions (in fact, if we are going to mention
1140 @c manually fixing permission, we better document a lot
1141 @c better just what we mean by "fix").
1142
1143 Using pserver, you will generally need stricter
1144 permissions on the @sc{cvsroot} directory and
1145 directories above it in the tree; see @ref{Password
1146 authentication security}.
1147
1148 @cindex Setuid
1149 @cindex Setgid
1150 @cindex Security, setuid
1151 @cindex Installed images (VMS)
1152 Some operating systems have features which allow a
1153 particular program to run with the ability to perform
1154 operations which the caller of the program could not.
1155 For example, the set user ID (setuid) or set group ID
1156 (setgid) features of unix or the installed image
1157 feature of VMS. @sc{cvs} was not written to use such
1158 features and therefore attempting to install @sc{cvs} in
1159 this fashion will provide protection against only
1160 accidental lapses; anyone who is trying to circumvent
1161 the measure will be able to do so, and depending on how
1162 you have set it up may gain access to more than just
1163 @sc{cvs}. You may wish to instead consider pserver. It
1164 shares some of the same attributes, in terms of
1165 possibly providing a false sense of security or opening
1166 security holes wider than the ones you are trying to
1167 fix, so read the documentation on pserver security
1168 carefully if you are considering this option
1169 (@ref{Password authentication security}).
1170
1171 @node Windows permissions
1172 @subsection File Permission issues specific to Windows
1173 @cindex Windows, and permissions
1174 @cindex File permissions, Windows-specific
1175 @cindex Permissions, Windows-specific
1176
1177 Some file permission issues are specific to Windows
1178 operating systems (Windows 95, Windows NT, and
1179 presumably future operating systems in this family.
1180 Some of the following might apply to OS/2 but I'm not
1181 sure).
1182
1183 If you are using local @sc{cvs} and the repository is on a
1184 networked filesystem which is served by the Samba SMB
1185 server, some people have reported problems with
1186 permissions. Enabling WRITE=YES in the samba
1187 configuration is said to fix/workaround it.
1188 Disclaimer: I haven't investigated enough to know the
1189 implications of enabling that option, nor do I know
1190 whether there is something which @sc{cvs} could be doing
1191 differently in order to avoid the problem. If you find
1192 something out, please let us know as described in
1193 @ref{BUGS}.
1194
1195 @node Attic
1196 @subsection The attic
1197 @cindex Attic
1198
1199 You will notice that sometimes @sc{cvs} stores an
1200 @sc{rcs} file in the @code{Attic}. For example, if the
1201 @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
1202 talking about the file @file{backend.c} in the
1203 directory @file{yoyodyne/tc}, then the file normally
1204 would be in
1205
1206 @example
1207 /usr/local/cvsroot/yoyodyne/tc/backend.c,v
1208 @end example
1209
1210 @noindent
1211 but if it goes in the attic, it would be in
1212
1213 @example
1214 /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
1215 @end example
1216
1217 @noindent
1218 @cindex Dead state
1219 instead. It should not matter from a user point of
1220 view whether a file is in the attic; @sc{cvs} keeps
1221 track of this and looks in the attic when it needs to.
1222 But in case you want to know, the rule is that the RCS
1223 file is stored in the attic if and only if the head
1224 revision on the trunk has state @code{dead}. A
1225 @code{dead} state means that file has been removed, or
1226 never added, for that revision. For example, if you
1227 add a file on a branch, it will have a trunk revision
1228 in @code{dead} state, and a branch revision in a
1229 non-@code{dead} state.
1230 @c Probably should have some more concrete examples
1231 @c here, or somewhere (not sure exactly how we should
1232 @c arrange the discussion of the dead state, versus
1233 @c discussion of the attic).
1234
1235 @node CVS in repository
1236 @subsection The CVS directory in the repository
1237 @cindex CVS directory, in repository
1238
1239 The @file{CVS} directory in each repository directory
1240 contains information such as file attributes (in a file
1241 called @file{CVS/fileattr}. In the
1242 future additional files may be added to this directory,
1243 so implementations should silently ignore additional
1244 files.
1245
1246 This behavior is implemented only by @sc{cvs} 1.7 and
1247 later; for details see @ref{Watches Compatibility}.
1248
1249 The format of the @file{fileattr} file is a series of entries
1250 of the following form (where @samp{@{} and @samp{@}}
1251 means the text between the braces can be repeated zero
1252 or more times):
1253
1254 @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
1255 @{; @var{attrname} = @var{attrval}@} <linefeed>
1256
1257 @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
1258 attributes for that file.
1259
1260 @var{ent-type} is @samp{D},
1261 and @var{filename} empty, to specify default attributes
1262 to be used for newly added files.
1263
1264 Other @var{ent-type} are reserved for future expansion. @sc{cvs} 1.9 and older
1265 will delete them any time it writes file attributes.
1266 @sc{cvs} 1.10 and later will preserve them.
1267
1268 Note that the order of the lines is not significant;
1269 a program writing the fileattr file may
1270 rearrange them at its convenience.
1271
1272 There is currently no way of quoting tabs or line feeds in the
1273 filename, @samp{=} in @var{attrname},
1274 @samp{;} in @var{attrval}, etc. Note: some implementations also
1275 don't handle a NUL character in any of the fields, but
1276 implementations are encouraged to allow it.
1277
1278 By convention, @var{attrname} starting with @samp{_} is for an attribute given
1279 special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
1280 (or will be, once implementations start supporting user-defined attributes).
1281
1282 Built-in attributes:
1283
1284 @table @code
1285 @item _watched
1286 Present means the file is watched and should be checked out
1287 read-only.
1288
1289 @item _watchers
1290 Users with watches for this file. Value is
1291 @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
1292 where @var{watcher} is a username, and @var{type}
1293 is zero or more of edit,unedit,commit separated by
1294 @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
1295
1296 @item _editors
1297 Users editing this file. Value is
1298 @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
1299 where @var{editor} is a username, and @var{val} is
1300 @var{time}+@var{hostname}+@var{pathname}, where
1301 @var{time} is when the @code{cvs edit} command (or
1302 equivalent) happened,
1303 and @var{hostname} and @var{pathname} are for the working directory.
1304 @end table
1305
1306 Example:
1307
1308 @c FIXME: sanity.sh should contain a similar test case
1309 @c so we can compare this example from something from
1310 @c Real Life(TM). See cvsclient.texi (under Notify) for more
1311 @c discussion of the date format of _editors.
1312 @example
1313 Ffile1 _watched=;_watchers=joe>edit,mary>commit
1314 Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
1315 D _watched=
1316 @end example
1317
1318 @noindent
1319 means that the file @file{file1} should be checked out
1320 read-only. Furthermore, joe is watching for edits and
1321 mary is watching for commits. The file @file{file2}
1322 should be checked out read-only; sue started editing it
1323 on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
1324 the machine @code{workstn1}. Future files which are
1325 added should be checked out read-only. To represent
1326 this example here, we have shown a space after
1327 @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
1328 there must be a single tab character there and no spaces.
1329
1330 @node Locks
1331 @subsection CVS locks in the repository
1332
1333 @cindex #cvs.rfl, technical details
1334 @cindex #cvs.pfl, technical details
1335 @cindex #cvs.wfl, technical details
1336 @cindex #cvs.lock, technical details
1337 @cindex Locks, cvs, technical details
1338 For an introduction to @sc{cvs} locks focusing on
1339 user-visible behavior, see @ref{Concurrency}. The
1340 following section is aimed at people who are writing
1341 tools which want to access a @sc{cvs} repository without
1342 interfering with other tools accessing the same
1343 repository. If you find yourself confused by concepts
1344 described here, like @dfn{read lock}, @dfn{write lock},
1345 and @dfn{deadlock}, you might consult the literature on
1346 operating systems or databases.
1347
1348 @cindex #cvs.tfl
1349 Any file in the repository with a name starting
1350 with @file{#cvs.rfl.} is a read lock. Any file in
1351 the repository with a name starting with
1352 @file{#cvs.pfl} is a promotable read lock. Any file in
1353 the repository with a name starting with
1354 @file{#cvs.wfl} is a write lock. Old versions of @sc{cvs}
1355 (before @sc{cvs} 1.5) also created files with names starting
1356 with @file{#cvs.tfl}, but they are not discussed here.
1357 The directory @file{#cvs.lock} serves as a master
1358 lock. That is, one must obtain this lock first before
1359 creating any of the other locks.
1360
1361 To obtain a read lock, first create the @file{#cvs.lock}
1362 directory. This operation must be atomic (which should
1363 be true for creating a directory under most operating
1364 systems). If it fails because the directory already
1365 existed, wait for a while and try again. After
1366 obtaining the @file{#cvs.lock} lock, create a file
1367 whose name is @file{#cvs.rfl.} followed by information
1368 of your choice (for example, hostname and process
1369 identification number). Then remove the
1370 @file{#cvs.lock} directory to release the master lock.
1371 Then proceed with reading the repository. When you are
1372 done, remove the @file{#cvs.rfl} file to release the
1373 read lock.
1374
1375 Promotable read locks are a concept you may not find in other literature on
1376 concurrency. They are used to allow a two (or more) pass process to only lock
1377 a file for read on the first (read) pass(es), then upgrade its read locks to
1378 write locks if necessary for a final pass, still assured that the files have
1379 not changed since they were first read. @sc{cvs} uses promotable read locks,
1380 for example, to prevent commit and tag verification passes from interfering
1381 with other reading processes. It can then lock only a single directory at a
1382 time for write during the write pass.
1383
1384 To obtain a promotable read lock, first create the @file{#cvs.lock} directory,
1385 as with a non-promotable read lock. Then check
1386 that there are no files that start with
1387 @file{#cvs.pfl}. If there are, remove the master @file{#cvs.lock} directory,
1388 wait awhile (CVS waits 30 seconds between lock attempts), and try again. If
1389 there are no other promotable locks, go ahead and create a file whose name is
1390 @file{#cvs.pfl} followed by information of your choice (for example, CVS uses
1391 its hostname and the process identification number of the CVS server process
1392 creating the lock). If versions of @sc{cvs} older than version 1.12.4 access
1393 your repository directly (not via a @sc{cvs} server of version 1.12.4 or
1394 later), then you should also create a read lock since older versions of CVS
1395 will ignore the promotable lock when attempting to create their own write lock.
1396 Then remove the master @file{#cvs.lock} directory in order to allow other
1397 processes to obtain read locks.
1398
1399 To obtain a write lock, first create the
1400 @file{#cvs.lock} directory, as with read locks. Then
1401 check that there are no files whose names start with
1402 @file{#cvs.rfl.} and no files whose names start with @file{#cvs.pfl} that are
1403 not owned by the process attempting to get the write lock. If either exist,
1404 remove @file{#cvs.lock}, wait for a while, and try again. If
1405 there are no readers or promotable locks from other processes, then create a
1406 file whose name is @file{#cvs.wfl} followed by information of your choice
1407 (again, CVS uses the hostname and server process identification
1408 number). Remove your @file{#cvs.pfl} file if present. Hang on to the
1409 @file{#cvs.lock} lock. Proceed
1410 with writing the repository. When you are done, first
1411 remove the @file{#cvs.wfl} file and then the
1412 @file{#cvs.lock} directory. Note that unlike the
1413 @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
1414 informational; it has no effect on the locking operation
1415 beyond what is provided by holding on to the
1416 @file{#cvs.lock} lock itself.
1417
1418 Note that each lock (write lock or read lock) only locks
1419 a single directory in the repository, including
1420 @file{Attic} and @file{CVS} but not including
1421 subdirectories which represent other directories under
1422 version control. To lock an entire tree, you need to
1423 lock each directory (note that if you fail to obtain
1424 any lock you need, you must release the whole tree
1425 before waiting and trying again, to avoid deadlocks).
1426
1427 Note also that @sc{cvs} expects write locks to control
1428 access to individual @file{foo,v} files. @sc{rcs} has
1429 a scheme where the @file{,foo,} file serves as a lock,
1430 but @sc{cvs} does not implement it and so taking out a
1431 @sc{cvs} write lock is recommended. See the comments at
1432 rcs_internal_lockfile in the @sc{cvs} source code for
1433 further discussion/rationale.
1434
1435 @node CVSROOT storage
1436 @subsection How files are stored in the CVSROOT directory
1437 @cindex CVSROOT, storage of files
1438
1439 The @file{$CVSROOT/CVSROOT} directory contains the
1440 various administrative files. In some ways this
1441 directory is just like any other directory in the
1442 repository; it contains @sc{rcs} files whose names end
1443 in @samp{,v}, and many of the @sc{cvs} commands operate
1444 on it the same way. However, there are a few
1445 differences.
1446
1447 For each administrative file, in addition to the
1448 @sc{rcs} file, there is also a checked out copy of the
1449 file. For example, there is an @sc{rcs} file
1450 @file{loginfo,v} and a file @file{loginfo} which
1451 contains the latest revision contained in
1452 @file{loginfo,v}. When you check in an administrative
1453 file, @sc{cvs} should print
1454
1455 @example
1456 cvs commit: Rebuilding administrative file database
1457 @end example
1458
1459 @noindent
1460 and update the checked out copy in
1461 @file{$CVSROOT/CVSROOT}. If it does not, there is
1462 something wrong (@pxref{BUGS}). To add your own files
1463 to the files to be updated in this fashion, you can add
1464 them to the @file{checkoutlist} administrative file
1465 (@pxref{checkoutlist}).
1466
1467 @cindex modules.db
1468 @cindex modules.pag
1469 @cindex modules.dir
1470 By default, the @file{modules} file behaves as
1471 described above. If the modules file is very large,
1472 storing it as a flat text file may make looking up
1473 modules slow (I'm not sure whether this is as much of a
1474 concern now as when @sc{cvs} first evolved this
1475 feature; I haven't seen benchmarks). Therefore, by
1476 making appropriate edits to the @sc{cvs} source code
1477 one can store the modules file in a database which
1478 implements the @code{ndbm} interface, such as Berkeley
1479 db or GDBM. If this option is in use, then the modules
1480 database will be stored in the files @file{modules.db},
1481 @file{modules.pag}, and/or @file{modules.dir}.
1482 @c I think fileattr also will use the database stuff.
1483 @c Anything else?
1484
1485 For information on the meaning of the various
1486 administrative files, see @ref{Administrative files}.
1487
1488 @node Working directory storage
1489 @section How data is stored in the working directory
1490
1491 @c FIXME: Somewhere we should discuss timestamps (test
1492 @c case "stamps" in sanity.sh). But not here. Maybe
1493 @c in some kind of "working directory" chapter which
1494 @c would encompass the "Builds" one? But I'm not sure
1495 @c whether that is a good organization (is it based on
1496 @c what the user wants to do?).
1497
1498 @cindex CVS directory, in working directory
1499 While we are discussing @sc{cvs} internals which may
1500 become visible from time to time, we might as well talk
1501 about what @sc{cvs} puts in the @file{CVS} directories
1502 in the working directories. As with the repository,
1503 @sc{cvs} handles this information and one can usually
1504 access it via @sc{cvs} commands. But in some cases it
1505 may be useful to look at it, and other programs, such
1506 as the @code{jCVS} graphical user interface or the
1507 @code{VC} package for emacs, may need to look at it.
1508 Such programs should follow the recommendations in this
1509 section if they hope to be able to work with other
1510 programs which use those files, including future
1511 versions of the programs just mentioned and the
1512 command-line @sc{cvs} client.
1513
1514 The @file{CVS} directory contains several files.
1515 Programs which are reading this directory should
1516 silently ignore files which are in the directory but
1517 which are not documented here, to allow for future
1518 expansion.
1519
1520 The files are stored according to the text file
1521 convention for the system in question. This means that
1522 working directories are not portable between systems
1523 with differing conventions for storing text files.
1524 This is intentional, on the theory that the files being
1525 managed by @sc{cvs} probably will not be portable between
1526 such systems either.
1527
1528 @table @file
1529 @item Root
1530 This file contains the current @sc{cvs} root, as
1531 described in @ref{Specifying a repository}.
1532
1533 @cindex Repository file, in CVS directory
1534 @cindex CVS/Repository file
1535 @item Repository
1536 This file contains the directory within the repository
1537 which the current directory corresponds with. It can
1538 be either an absolute pathname or a relative pathname;
1539 @sc{cvs} has had the ability to read either format
1540 since at least version 1.3 or so. The relative
1541 pathname is relative to the root, and is the more
1542 sensible approach, but the absolute pathname is quite
1543 common and implementations should accept either. For
1544 example, after the command
1545
1546 @example
1547 cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
1548 @end example
1549
1550 @noindent
1551 @file{Root} will contain
1552
1553 @example
1554 :local:/usr/local/cvsroot
1555 @end example
1556
1557 @noindent
1558 and @file{Repository} will contain either
1559
1560 @example
1561 /usr/local/cvsroot/yoyodyne/tc
1562 @end example
1563
1564 @noindent
1565 or
1566
1567 @example
1568 yoyodyne/tc
1569 @end example
1570
1571 If the particular working directory does not correspond
1572 to a directory in the repository, then @file{Repository}
1573 should contain @file{CVSROOT/Emptydir}.
1574 @cindex Emptydir, in CVSROOT directory
1575 @cindex CVSROOT/Emptydir directory
1576
1577 @cindex Entries file, in CVS directory
1578 @cindex CVS/Entries file
1579 @item Entries
1580 This file lists the files and directories in the
1581 working directory.
1582 The first character of each line indicates what sort of
1583 line it is. If the character is unrecognised, programs
1584 reading the file should silently skip that line, to
1585 allow for future expansion.
1586
1587 If the first character is @samp{/}, then the format is:
1588
1589 @example
1590 /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
1591 @end example
1592
1593 @noindent
1594 where @samp{[} and @samp{]} are not part of the entry,
1595 but instead indicate that the @samp{+} and conflict
1596 marker are optional. @var{name} is the name of the
1597 file within the directory. @var{revision} is the
1598 revision that the file in the working derives from, or
1599 @samp{0} for an added file, or @samp{-} followed by a
1600 revision for a removed file. @var{timestamp} is the
1601 timestamp of the file at the time that @sc{cvs} created
1602 it; if the timestamp differs with the actual
1603 modification time of the file it means the file has
1604 been modified. It is stored in
1605 the format used by the ISO C asctime() function (for
1606 example, @samp{Sun Apr 7 01:29:26 1996}). One may
1607 write a string which is not in that format, for
1608 example, @samp{Result of merge}, to indicate that the
1609 file should always be considered to be modified. This
1610 is not a special case; to see whether a file is
1611 modified a program should take the timestamp of the file
1612 and simply do a string compare with @var{timestamp}.
1613 If there was a conflict, @var{conflict} can be set to
1614 the modification time of the file after the file has been
1615 written with conflict markers (@pxref{Conflicts example}).
1616 Thus if @var{conflict} is subsequently the same as the actual
1617 modification time of the file it means that the user
1618 has obviously not resolved the conflict. @var{options}
1619 contains sticky options (for example @samp{-kb} for a
1620 binary file). @var{tagdate} contains @samp{T} followed
1621 by a tag name, or @samp{D} for a date, followed by a
1622 sticky tag or date. Note that if @var{timestamp}
1623 contains a pair of timestamps separated by a space,
1624 rather than a single timestamp, you are dealing with a
1625 version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
1626 documented here).
1627
1628 The timezone on the timestamp in CVS/Entries (local or
1629 universal) should be the same as the operating system
1630 stores for the timestamp of the file itself. For
1631 example, on Unix the file's timestamp is in universal
1632 time (UT), so the timestamp in CVS/Entries should be
1633 too. On @sc{vms}, the file's timestamp is in local
1634 time, so @sc{cvs} on @sc{vms} should use local time.
1635 This rule is so that files do not appear to be modified
1636 merely because the timezone changed (for example, to or
1637 from summer time).
1638 @c See comments and calls to gmtime() and friends in
1639 @c src/vers_ts.c (function time_stamp).
1640
1641 If the first character of a line in @file{Entries} is
1642 @samp{D}, then it indicates a subdirectory. @samp{D}
1643 on a line all by itself indicates that the program
1644 which wrote the @file{Entries} file does record
1645 subdirectories (therefore, if there is such a line and
1646 no other lines beginning with @samp{D}, one knows there
1647 are no subdirectories). Otherwise, the line looks
1648 like:
1649
1650 @example
1651 D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
1652 @end example
1653
1654 @noindent
1655 where @var{name} is the name of the subdirectory, and
1656 all the @var{filler} fields should be silently ignored,
1657 for future expansion. Programs which modify
1658 @code{Entries} files should preserve these fields.
1659
1660 The lines in the @file{Entries} file can be in any order.
1661
1662 @cindex Entries.Log file, in CVS directory
1663 @cindex CVS/Entries.Log file
1664 @item Entries.Log
1665 This file does not record any information beyond that
1666 in @file{Entries}, but it does provide a way to update
1667 the information without having to rewrite the entire
1668 @file{Entries} file, including the ability to preserve
1669 the information even if the program writing
1670 @file{Entries} and @file{Entries.Log} abruptly aborts.
1671 Programs which are reading the @file{Entries} file
1672 should also check for @file{Entries.Log}. If the latter
1673 exists, they should read @file{Entries} and then apply
1674 the changes mentioned in @file{Entries.Log}. After
1675 applying the changes, the recommended practice is to
1676 rewrite @file{Entries} and then delete @file{Entries.Log}.
1677 The format of a line in @file{Entries.Log} is a single
1678 character command followed by a space followed by a
1679 line in the format specified for a line in
1680 @file{Entries}. The single character command is
1681 @samp{A} to indicate that the entry is being added,
1682 @samp{R} to indicate that the entry is being removed,
1683 or any other character to indicate that the entire line
1684 in @file{Entries.Log} should be silently ignored (for
1685 future expansion). If the second character of the line
1686 in @file{Entries.Log} is not a space, then it was
1687 written by an older version of @sc{cvs} (not documented
1688 here).
1689
1690 Programs which are writing rather than reading can
1691 safely ignore @file{Entries.Log} if they so choose.
1692
1693 @cindex Entries.Backup file, in CVS directory
1694 @cindex CVS/Entries.Backup file
1695 @item Entries.Backup
1696 This is a temporary file. Recommended usage is to
1697 write a new entries file to @file{Entries.Backup}, and
1698 then to rename it (atomically, where possible) to @file{Entries}.
1699
1700 @cindex Entries.Static file, in CVS directory
1701 @cindex CVS/Entries.Static file
1702 @item Entries.Static
1703 The only relevant thing about this file is whether it
1704 exists or not. If it exists, then it means that only
1705 part of a directory was gotten and @sc{cvs} will
1706 not create additional files in that directory. To
1707 clear it, use the @code{update} command with the
1708 @samp{-d} option, which will get the additional files
1709 and remove @file{Entries.Static}.
1710 @c FIXME: This needs to be better documented, in places
1711 @c other than Working Directory Storage.
1712 @c FIXCVS: The fact that this setting exists needs to
1713 @c be more visible to the user. For example "cvs
1714 @c status foo", in the case where the file would be
1715 @c gotten except for Entries.Static, might say
1716 @c something to distinguish this from other cases.
1717 @c One thing that periodically gets suggested is to
1718 @c have "cvs update" print something when it skips
1719 @c files due to Entries.Static, but IMHO that kind of
1720 @c noise pretty much makes the Entries.Static feature
1721 @c useless.
1722
1723 @cindex Tag file, in CVS directory
1724 @cindex CVS/Tag file
1725 @cindex Sticky tags/dates, per-directory
1726 @cindex Per-directory sticky tags/dates
1727 @item Tag
1728 This file contains per-directory sticky tags or dates.
1729 The first character is @samp{T} for a branch tag,
1730 @samp{N} for a non-branch tag, or @samp{D} for a date,
1731 or another character to mean the file should be
1732 silently ignored, for future expansion. This character
1733 is followed by the tag or date. Note that
1734 per-directory sticky tags or dates are used for things
1735 like applying to files which are newly added; they
1736 might not be the same as the sticky tags or dates on
1737 individual files. For general information on sticky
1738 tags and dates, see @ref{Sticky tags}.
1739 @c FIXME: This needs to be much better documented,
1740 @c preferably not in the context of "working directory
1741 @c storage".
1742 @c FIXME: The Sticky tags node needs to discuss, or xref to
1743 @c someplace which discusses, per-directory sticky
1744 @c tags and the distinction with per-file sticky tags.
1745
1746 @cindex Notify file, in CVS directory
1747 @cindex CVS/Notify file
1748 @item Notify
1749 This file stores notifications (for example, for
1750 @code{edit} or @code{unedit}) which have not yet been
1751 sent to the server. Its format is not yet documented
1752 here.
1753
1754 @cindex Notify.tmp file, in CVS directory
1755 @cindex CVS/Notify.tmp file
1756 @item Notify.tmp
1757 This file is to @file{Notify} as @file{Entries.Backup}
1758 is to @file{Entries}. That is, to write @file{Notify},
1759 first write the new contents to @file{Notify.tmp} and
1760 then (atomically where possible), rename it to
1761 @file{Notify}.
1762
1763 @cindex Base directory, in CVS directory
1764 @cindex CVS/Base directory
1765 @item Base
1766 If watches are in use, then an @code{edit} command
1767 stores the original copy of the file in the @file{Base}
1768 directory. This allows the @code{unedit} command to
1769 operate even if it is unable to communicate with the
1770 server.
1771
1772 @cindex Baserev file, in CVS directory
1773 @cindex CVS/Baserev file
1774 @item Baserev
1775 The file lists the revision for each of the files in
1776 the @file{Base} directory. The format is:
1777
1778 @example
1779 B@var{name}/@var{rev}/@var{expansion}
1780 @end example
1781
1782 @noindent
1783 where @var{expansion} should be ignored, to allow for
1784 future expansion.
1785
1786 @cindex Baserev.tmp file, in CVS directory
1787 @cindex CVS/Baserev.tmp file
1788 @item Baserev.tmp
1789 This file is to @file{Baserev} as @file{Entries.Backup}
1790 is to @file{Entries}. That is, to write @file{Baserev},
1791 first write the new contents to @file{Baserev.tmp} and
1792 then (atomically where possible), rename it to
1793 @file{Baserev}.
1794
1795 @cindex Template file, in CVS directory
1796 @cindex CVS/Template file
1797 @item Template
1798 This file contains the template specified by the
1799 @file{rcsinfo} file (@pxref{rcsinfo}). It is only used
1800 by the client; the non-client/server @sc{cvs} consults
1801 @file{rcsinfo} directly.
1802 @end table
1803
1804 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1805 @node Intro administrative files
1806 @section The administrative files
1807 @cindex Administrative files (intro)
1808 @cindex Modules file
1809 @cindex CVSROOT, module name
1810 @cindex Defining modules (intro)
1811
1812 @c FIXME: this node should be reorganised into "general
1813 @c information about admin files" and put the "editing
1814 @c admin files" stuff up front rather than jumping into
1815 @c the details of modules right away. Then the
1816 @c Administrative files node can go away, the information
1817 @c on each admin file distributed to a place appropriate
1818 @c to its function, and this node can contain a table
1819 @c listing each file and a @ref to its detailed description.
1820
1821 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1822 files}. @xref{Administrative files}, for a complete description.
1823 You can use @sc{cvs} without any of these files, but
1824 some commands work better when at least the
1825 @file{modules} file is properly set up.
1826
1827 The most important of these files is the @file{modules}
1828 file. It defines all modules in the repository. This
1829 is a sample @file{modules} file.
1830
1831 @c FIXME: The CVSROOT line is a goofy example now that
1832 @c mkmodules doesn't exist.
1833 @example
1834 CVSROOT CVSROOT
1835 modules CVSROOT modules
1836 cvs gnu/cvs
1837 rcs gnu/rcs
1838 diff gnu/diff
1839 tc yoyodyne/tc
1840 @end example
1841
1842 The @file{modules} file is line oriented. In its
1843 simplest form each line contains the name of the
1844 module, whitespace, and the directory where the module
1845 resides. The directory is a path relative to
1846 @code{$CVSROOT}. The last four lines in the example
1847 above are examples of such lines.
1848
1849 @c FIXME: might want to introduce the concept of options in modules file
1850 @c (the old example which was here, -i mkmodules, is obsolete).
1851
1852 The line that defines the module called @samp{modules}
1853 uses features that are not explained here.
1854 @xref{modules}, for a full explanation of all the
1855 available features.
1856
1857 @c FIXME: subsection without node is bogus
1858 @subsection Editing administrative files
1859 @cindex Editing administrative files
1860 @cindex Administrative files, editing them
1861
1862 You edit the administrative files in the same way that you would edit
1863 any other module. Use @samp{cvs checkout CVSROOT} to get a working
1864 copy, edit it, and commit your changes in the normal way.
1865
1866 It is possible to commit an erroneous administrative
1867 file. You can often fix the error and check in a new
1868 revision, but sometimes a particularly bad error in the
1869 administrative file makes it impossible to commit new
1870 revisions.
1871 @c @xref{Bad administrative files} for a hint
1872 @c about how to solve such situations.
1873 @c -- administrative file checking--
1874
1875 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1876 @node Multiple repositories
1877 @section Multiple repositories
1878 @cindex Multiple repositories
1879 @cindex Repositories, multiple
1880 @cindex Many repositories
1881 @cindex Parallel repositories
1882 @cindex Disjoint repositories
1883 @cindex CVSROOT, multiple repositories
1884
1885 In some situations it is a good idea to have more than
1886 one repository, for instance if you have two
1887 development groups that work on separate projects
1888 without sharing any code. All you have to do to have
1889 several repositories is to specify the appropriate
1890 repository, using the @code{CVSROOT} environment
1891 variable, the @samp{-d} option to @sc{cvs}, or (once
1892 you have checked out a working directory) by simply
1893 allowing @sc{cvs} to use the repository that was used
1894 to check out the working directory
1895 (@pxref{Specifying a repository}).
1896
1897 The big advantage of having multiple repositories is
1898 that they can reside on different servers. With @sc{cvs}
1899 version 1.10, a single command cannot recurse into
1900 directories from different repositories. With development
1901 versions of @sc{cvs}, you can check out code from multiple
1902 servers into your working directory. @sc{cvs} will
1903 recurse and handle all the details of making
1904 connections to as many server machines as necessary to
1905 perform the requested command. Here is an example of
1906 how to set up a working directory:
1907
1908 @example
1909 cvs -d server1:/cvs co dir1
1910 cd dir1
1911 cvs -d server2:/root co sdir
1912 cvs update
1913 @end example
1914
1915 The @code{cvs co} commands set up the working
1916 directory, and then the @code{cvs update} command will
1917 contact server2, to update the dir1/sdir subdirectory,
1918 and server1, to update everything else.
1919
1920 @c FIXME: Does the FAQ have more about this? I have a
1921 @c dim recollection, but I'm too lazy to check right now.
1922
1923 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1924 @node Creating a repository
1925 @section Creating a repository
1926
1927 @cindex Repository, setting up
1928 @cindex Creating a repository
1929 @cindex Setting up a repository
1930
1931 This section describes how to set up a @sc{cvs} repository for any
1932 sort of access method. After completing the setup described in this
1933 section, you should be able to access your @sc{cvs} repository immediately
1934 via the local access method and several remote access methods. For
1935 more information on setting up remote access to the repository you create
1936 in this section, please read the section on @xref{Remote repositories}.
1937
1938 To set up a @sc{cvs} repository, first choose the
1939 machine and disk on which you want to store the
1940 revision history of the source files. CPU and memory
1941 requirements are modest, so most machines should be
1942 adequate. For details see @ref{Server requirements}.
1943 @c Possible that we should be providing a quick rule of
1944 @c thumb, like the 32M memory for the server. That
1945 @c might increase the number of people who are happy
1946 @c with the answer, without following the xref.
1947
1948 To estimate disk space
1949 requirements, if you are importing RCS files from
1950 another system, the size of those files is the
1951 approximate initial size of your repository, or if you
1952 are starting without any version history, a rule of
1953 thumb is to allow for the server approximately three
1954 times the size of the code to be under @sc{cvs} for the
1955 repository (you will eventually outgrow this, but not
1956 for a while). On the machines on which the developers
1957 will be working, you'll want disk space for
1958 approximately one working directory for each developer
1959 (either the entire tree or a portion of it, depending
1960 on what each developer uses).
1961
1962 The repository should be accessible
1963 (directly or via a networked filesystem) from all
1964 machines which want to use @sc{cvs} in server or local
1965 mode; the client machines need not have any access to
1966 it other than via the @sc{cvs} protocol. It is not
1967 normally possible to use @sc{cvs} to read from a repository
1968 which one only has read access to; @sc{cvs} needs to be
1969 able to create lock files (@pxref{Concurrency}).
1970
1971 If the environment variable @code{$CVSREADONLYFS} is defined,
1972 however, CVS will allow read-only access without creating any
1973 history entries or reader lock files. This allows doing most
1974 usual repository operations except checkin in a fast way,
1975 although if any other user is accessing the same data at the
1976 same time, it may lead to corrupt data. This mode is best used
1977 for publicly accessible anonymous CVS mirrors, not the main
1978 working repository.
1979
1980 @cindex init (subcommand)
1981 To create a repository, run the @code{cvs init}
1982 command. It will set up an empty repository in the
1983 @sc{cvs} root specified in the usual way
1984 (@pxref{Repository}). For example,
1985
1986 @example
1987 cvs -d /usr/local/cvsroot init
1988 @end example
1989
1990 @code{cvs init} is careful to never overwrite any
1991 existing files in the repository, so no harm is done if
1992 you run @code{cvs init} on an already set-up
1993 repository.
1994
1995 The repository is created honouring the @code{$CVSUMASK}
1996 setting (@pxref{CVSUMASK}), even the @file{history} and
1997 @file{val-tags} files are not created world-writable any
1998 more as in previous CVS versions. History logging is,
1999 accordingly, configured to log write operations only; if
2000 you don’t want that, edit or remove the @samp{LogHistory}
2001 entry in the @file{config} file (@pxref{config}) and make
2002 sure that all users who need to write that file can do so,
2003 for example by using a @code{$CVSUMASK} of 002 (which is
2004 also the default) and putting everyone into the same Unix
2005 group (consider the security implications if you really
2006 want to enable world-writable logging).
2007
2008 @node Backing up
2009 @section Backing up a repository
2010 @cindex Repository, backing up
2011 @cindex Backing up, repository
2012
2013 There is nothing particularly magical about the files
2014 in the repository; for the most part it is possible to
2015 back them up just like any other files. However, there
2016 are a few issues to consider.
2017
2018 @cindex Locks, cvs, and backups
2019 @cindex #cvs.rfl, and backups
2020 The first is that to be paranoid, one should either not
2021 use @sc{cvs} during the backup, or have the backup
2022 program lock @sc{cvs} while doing the backup. To not
2023 use @sc{cvs}, you might forbid logins to machines which
2024 can access the repository, turn off your @sc{cvs}
2025 server, or similar mechanisms. The details would
2026 depend on your operating system and how you have
2027 @sc{cvs} set up. To lock @sc{cvs}, you would create
2028 @file{#cvs.rfl} locks in each repository directory.
2029 See @ref{Concurrency}, for more on @sc{cvs} locks.
2030 Having said all this, if you just back up without any
2031 of these precautions, the results are unlikely to be
2032 particularly dire. Restoring from backup, the
2033 repository might be in an inconsistent state, but this
2034 would not be particularly hard to fix manually.
2035
2036 When you restore a repository from backup, assuming
2037 that changes in the repository were made after the time
2038 of the backup, working directories which were not
2039 affected by the failure may refer to revisions which no
2040 longer exist in the repository. Trying to run @sc{cvs}
2041 in such directories will typically produce an error
2042 message. One way to get those changes back into the
2043 repository is as follows:
2044
2045 @itemize @bullet
2046 @item
2047 Get a new working directory.
2048
2049 @item
2050 Copy the files from the working directory from before
2051 the failure over to the new working directory (do not
2052 copy the contents of the @file{CVS} directories, of
2053 course).
2054
2055 @item
2056 Working in the new working directory, use commands such
2057 as @code{cvs update} and @code{cvs diff} to figure out
2058 what has changed, and then when you are ready, commit
2059 the changes into the repository.
2060 @end itemize
2061
2062 @node Moving a repository
2063 @section Moving a repository
2064 @cindex Repository, moving
2065 @cindex Moving a repository
2066 @cindex Copying a repository
2067
2068 Just as backing up the files in the repository is
2069 pretty much like backing up any other files, if you
2070 need to move a repository from one place to another it
2071 is also pretty much like just moving any other
2072 collection of files.
2073
2074 The main thing to consider is that working directories
2075 point to the repository. The simplest way to deal with
2076 a moved repository is to just get a fresh working
2077 directory after the move. Of course, you'll want to
2078 make sure that the old working directory had been
2079 checked in before the move, or you figured out some
2080 other way to make sure that you don't lose any
2081 changes. If you really do want to reuse the existing
2082 working directory, it should be possible with manual
2083 surgery on the @file{CVS/Repository} files. You can
2084 see @ref{Working directory storage}, for information on
2085 the @file{CVS/Repository} and @file{CVS/Root} files, but
2086 unless you are sure you want to bother, it probably
2087 isn't worth it.
2088 @c FIXME: Surgery on CVS/Repository should be avoided
2089 @c by making RELATIVE_REPOS the default.
2090 @c FIXME-maybe: might want some documented way to
2091 @c change the CVS/Root files in some particular tree.
2092 @c But then again, I don't know, maybe just having
2093 @c people do this in perl/shell/&c isn't so bad...
2094
2095 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2096 @node Remote repositories
2097 @section Remote repositories
2098 @cindex Repositories, remote
2099 @cindex Remote repositories
2100 @cindex Client/Server Operation
2101 @cindex Server, CVS
2102 @cindex Remote repositories, port specification
2103 @cindex Repositories, remote, port specification
2104 @cindex Client/Server Operation, port specification
2105 @cindex pserver (client/server connection method), port specification
2106 @cindex kserver (client/server connection method), port specification
2107 @cindex gserver (client/server connection method), port specification
2108 @cindex port, specifying for remote repositories
2109
2110 Your working copy of the sources can be on a
2111 different machine than the repository. Using @sc{cvs}
2112 in this manner is known as @dfn{client/server}
2113 operation. You run @sc{cvs} on a machine which can
2114 mount your working directory, known as the
2115 @dfn{client}, and tell it to communicate to a machine
2116 which can mount the repository, known as the
2117 @dfn{server}. Generally, using a remote
2118 repository is just like using a local one, except that
2119 the format of the repository name is:
2120
2121 @example
2122 [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
2123 @end example
2124
2125 Specifying a password in the repository name is not recommended during
2126 checkout, since this will cause @sc{cvs} to store a cleartext copy of the
2127 password in each created directory. @code{cvs login} first instead
2128 (@pxref{Password authentication client}).
2129
2130 The details of exactly what needs to be set up depend
2131 on how you are connecting to the server.
2132
2133 @c Should we try to explain which platforms are which?
2134 @c Platforms like unix and VMS, which only allow
2135 @c privileged programs to bind to sockets <1024 lose on
2136 @c :server:
2137 @c Platforms like Mac and VMS, whose rsh program is
2138 @c unusable or nonexistent, lose on :ext:
2139 @c Platforms like OS/2 and NT probably could plausibly
2140 @c default either way (modulo -b troubles).
2141
2142 @menu
2143 * Server requirements:: Memory and other resources for servers
2144 * The connection method:: Connection methods and method options
2145 * Connecting via rsh:: Using the @code{rsh} program to connect
2146 * Password authenticated:: Direct connections using passwords
2147 * GSSAPI authenticated:: Direct connections using GSSAPI
2148 * Kerberos authenticated:: Direct connections with Kerberos
2149 * Connecting via fork:: Using a forked @code{cvs server} to connect
2150 * Write proxies:: Distributing load across several CVS servers
2151 @end menu
2152
2153 For the protocol specification,
2154 @pxref{Top, the CVS client/server protocol,, cvsclient, The CVS client/server protocol}.
2155
2156 @node Server requirements
2157 @subsection Server requirements
2158
2159 The quick answer to what sort of machine is suitable as
2160 a server is that requirements are modest---a server
2161 with 32M of memory or even less can handle a fairly
2162 large source tree with a fair amount of activity.
2163 @c Say something about CPU speed too? I'm even less sure
2164 @c what to say on that subject...
2165
2166 The real answer, of course, is more complicated.
2167 Estimating the known areas of large memory consumption
2168 should be sufficient to estimate memory requirements.
2169 There are two such areas documented here; other memory
2170 consumption should be small by comparison (if you find
2171 that is not the case, let us know, as described in
2172 @ref{BUGS}, so we can update this documentation).
2173
2174 The first area of big memory consumption is large
2175 checkouts, when using the @sc{cvs} server. The server
2176 consists of two processes for each client that it is
2177 serving. Memory consumption on the child process
2178 should remain fairly small. Memory consumption on the
2179 parent process, particularly if the network connection
2180 to the client is slow, can be expected to grow to
2181 slightly more than the size of the sources in a single
2182 directory, or two megabytes, whichever is larger.
2183 @c "two megabytes" of course is SERVER_HI_WATER. But
2184 @c we don't mention that here because we are
2185 @c documenting the default configuration of CVS. If it
2186 @c is a "standard" thing to change that value, it
2187 @c should be some kind of run-time configuration.
2188 @c
2189 @c See cvsclient.texi for more on the design decision
2190 @c to not have locks in place while waiting for the
2191 @c client, which is what results in memory consumption
2192 @c as high as this.
2193
2194 Multiplying the size of each @sc{cvs} server by the
2195 number of servers which you expect to have active at
2196 one time should give an idea of memory requirements for
2197 the server. For the most part, the memory consumed by
2198 the parent process probably can be swap space rather
2199 than physical memory.
2200 @c Has anyone verified that notion about swap space?
2201 @c I say it based pretty much on guessing that the
2202 @c ->text of the struct buffer_data only gets accessed
2203 @c in a first in, first out fashion, but I haven't
2204 @c looked very closely.
2205
2206 @c What about disk usage in /tmp on the server? I think that
2207 @c it can be substantial, but I haven't looked at this
2208 @c again and tried to figure it out ("cvs import" is
2209 @c probably the worst case...).
2210
2211 The second area of large memory consumption is
2212 @code{diff}, when checking in large files. This is
2213 required even for binary files. The rule of thumb is
2214 to allow about ten times the size of the largest file
2215 you will want to check in, although five times may be
2216 adequate. For example, if you want to check in a file
2217 which is 10 megabytes, you should have 100 megabytes of
2218 memory on the machine doing the checkin (the server
2219 machine for client/server, or the machine running
2220 @sc{cvs} for non-client/server). This can be swap
2221 space rather than physical memory. Because the memory
2222 is only required briefly, there is no particular need
2223 to allow memory for more than one such checkin at a
2224 time.
2225 @c The 5-10 times rule of thumb is from Paul Eggert for
2226 @c GNU diff. I don't think it is in the GNU diff
2227 @c manual or anyplace like that.
2228 @c
2229 @c Probably we could be saying more about
2230 @c non-client/server CVS.
2231 @c I would guess for non-client/server CVS in an NFS
2232 @c environment the biggest issues are the network and
2233 @c the NFS server.
2234
2235 Resource consumption for the client is even more
2236 modest---any machine with enough capacity to run the
2237 operating system in question should have little
2238 trouble.
2239 @c Is that true? I think the client still wants to
2240 @c (bogusly) store entire files in memory at times.
2241
2242 For information on disk space requirements, see
2243 @ref{Creating a repository}.
2244
2245 @node The connection method
2246 @subsection The connection method
2247
2248 In its simplest form, the @var{method} portion of the repository string
2249 (@pxref{Remote repositories}) may be one of @samp{ext}, @samp{fork},
2250 @samp{gserver}, @samp{kserver}, @samp{local}, @samp{pserver}, and, on some
2251 platforms, @samp{server}.
2252
2253 If @var{method} is not specified, and the repository
2254 name starts with a @samp{/}, then the default is @code{local}.
2255 If @var{method} is not specified, and the repository
2256 name does not start with a @samp{/}, then the default is @code{ext}
2257 or @code{server}, depending on your platform; both the @samp{ext}
2258 and @samp{server} methods are described in @ref{Connecting via rsh}.
2259
2260 @cindex connection method options
2261 @cindex options, connection method
2262 The @code{ext}, @code{fork}, @code{gserver}, and @code{pserver} connection
2263 methods all accept optional method options, specified as part of the
2264 @var{method} string, like so:
2265
2266 @example
2267 :@var{method}[;@var{option}=@var{arg}...]:@var{other_connection_data}
2268 @end example
2269
2270 @sc{cvs} is not sensitive to the case of @var{method} or @var{option}, though
2271 it may sometimes be sensitive to the case of @var{arg}. The possible method
2272 options are as follows:
2273
2274 @table @code
2275 @cindex CVS_PROXY_PORT
2276 @cindex proxy, method option
2277 @cindex proxyport, method option
2278 @cindex proxies, web, connecting via
2279 @cindex web proxies, connecting via
2280 @cindex proxies, HTTP, connecting via
2281 @cindex HTTP proxies, connecting via
2282 @item proxy=@var{hostname}
2283 @itemx proxyport=@var{port}
2284 These two method options can be used to connect via an HTTP tunnel style web
2285 proxy. @var{hostname} should be the name of the HTTP proxy server to connect
2286 through and @var{port} is the port number on the HTTP proxy server to connect
2287 via. @var{port} defaults to 8080.
2288
2289 @emph{NOTE: An HTTP proxy server is not the same as a @sc{cvs} write proxy
2290 server - please see @ref{Write proxies} for more on @sc{cvs} write proxies.}
2291
2292 For example, to connect pserver via a web proxy listening on port 8000 of
2293 www.myproxy.net, you would use a method of:
2294
2295 @example
2296 :pserver;proxy=www.myproxy.net;proxyport=8000:@var{connstr}
2297 @end example
2298
2299 @emph{NOTE: In the above example, the pserver connection string @var{connstr}
2300 is still required to connect and authenticate to the CVS server, as noted in
2301 the upcoming sections on password authentication, @code{gserver}, and
2302 @code{kserver}. The example above only demonstrates a modification to the
2303 @var{method} portion of the repository name.}
2304
2305 These options first appeared in @sc{cvs} version 1.12.7 and are valid as
2306 modifcations to the @code{gserver} and @code{pserver} connection methods.
2307
2308 @cindex CVS_RSH method option
2309 @item CVS_RSH=@var{path}
2310 This method option can be used with the @code{ext} method to specify the path
2311 the @sc{cvs} client will use to find the remote shell used to contact the
2312 @sc{cvs} server and takes precedence over any path specified in the
2313 @code{$CVS_RSH} environment variable (@pxref{Connecting via rsh}). For
2314 example, to connect to a @sc{cvs} server via the local
2315 @file{/path/to/ssh/command} command, you could choose to specify the following
2316 @var{path} via the @code{CVS_RSH} method option:
2317
2318 @example
2319 :ext;CVS_RSH=/path/to/ssh/command:@var{ext_connection_string}
2320 @end example
2321
2322 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2323 as a modifcation to the @code{ext} connection method.
2324
2325 @cindex CVS_SERVER method option
2326 @item CVS_SERVER=@var{path}
2327 This method option can be used with the @code{ext} and @code{fork} methods to
2328 specify the path @sc{cvs} will use to find the @sc{cvs} executable on the
2329 @sc{cvs} server and takes precedence over any path specified in the
2330 @code{$CVS_SERVER} environment variable (@pxref{Connecting via rsh}). For
2331 example, to select the remote @file{/path/to/cvs/command} executable as your
2332 @sc{cvs} server application on the @sc{cvs} server machine, you could choose to
2333 specify the following @var{path} via the @code{CVS_SERVER} method option:
2334
2335 @example
2336 :ext;CVS_SERVER=/path/to/cvs/command:@var{ext_connection_string}
2337 @end example
2338
2339 @noindent
2340 or, to select an executable named @samp{cvs-1.12.11}, assuming it is in your
2341 @code{$PATH} on the @sc{cvs} server:
2342
2343 @example
2344 :ext;CVS_SERVER=cvs-1.12.11:@var{ext_connection_string}
2345 @end example
2346
2347 This method option first appeared in @sc{cvs} version 1.12.11 and is valid
2348 as a modifcation to both the @code{ext} and @code{fork} connection methods.
2349
2350 @cindex Redirect, method option
2351 @item Redirect=@var{boolean-state}
2352 The @code{Redirect} method option determines whether the @sc{cvs} client will
2353 allow a @sc{cvs} server to redirect it to a different @sc{cvs} server, usually
2354 for write requests, as in a write proxy setup.
2355
2356 A @var{boolean-state} of any value acceptable for boolean @file{CVSROOT/config}
2357 file options is acceptable here (@pxref{config}). For example, @samp{on},
2358 @samp{off}, @samp{true}, and @samp{false} are all valid values for
2359 @var{boolean-state}. @var{boolean-state} for the @code{Redirect} method option
2360 defaults to @samp{on}.
2361
2362 This option will have no effect when talking to any non-secondary @sc{cvs}
2363 server. For more on write proxies and secondary servers, please see
2364 @ref{Write proxies}.
2365
2366 This method option first appeared in @sc{cvs} version 1.12.11 and is valid only
2367 as a modifcation to the @code{ext} connection method.
2368 @end table
2369
2370 As a further example, to combine both the @code{CVS_RSH} and @code{CVS_SERVER}
2371 options, a method specification like the following would work:
2372
2373 @example
2374 :ext;CVS_RSH=/path/to/ssh/command;CVS_SERVER=/path/to/cvs/command:
2375 @end example
2376
2377 This means that you would not need to have
2378 the @code{CVS_SERVER} or @code{CVS_RSH} environment
2379 variables set correctly. See @ref{Connecting via rsh}, for more details on
2380 these environment variables.
2381
2382 @node Connecting via rsh
2383 @subsection Connecting with rsh
2384
2385 @cindex rsh
2386 @sc{cvs} uses the @samp{rsh} protocol to perform these
2387 operations, so the remote user host needs to have a
2388 @file{.rhosts} file which grants access to the local
2389 user. Note that the program that @sc{cvs} uses for this
2390 purpose may be specified using the @file{--with-rsh}
2391 flag to configure.
2392
2393 For example, suppose you are the user @samp{mozart} on
2394 the local machine @samp{toe.example.com}, and the
2395 server machine is @samp{faun.example.org}. On
2396 faun, put the following line into the file
2397 @file{.rhosts} in @samp{bach}'s home directory:
2398
2399 @example
2400 toe.example.com mozart
2401 @end example
2402
2403 @noindent
2404 Then test that @samp{rsh} is working with
2405
2406 @example
2407 rsh -l bach faun.example.org 'echo $PATH'
2408 @end example
2409
2410 @cindex CVS_SERVER, environment variable
2411 Next you have to make sure that @code{rsh} will be able
2412 to find the server. Make sure that the path which
2413 @code{rsh} printed in the above example includes the
2414 directory containing a program named @code{cvs} which
2415 is the server. You need to set the path in
2416 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
2417 or @file{.profile}. Alternately, you can set the
2418 environment variable @code{CVS_SERVER} on the client
2419 machine to the filename of the server you want to use,
2420 for example @file{/usr/local/bin/cvs-1.6}.
2421 For the @code{ext} and @code{fork} methods, you may
2422 also specify @var{CVS_SERVER} as an option in the
2423 @var{CVSROOT} so that you may use different servers for
2424 differnt roots. See @ref{Remote repositories} for more
2425 details.
2426
2427 There is no need to edit @file{inetd.conf} or start a
2428 @sc{cvs} server daemon.
2429
2430 @cindex server method, setting up
2431 @cindex ext method, setting up
2432 @cindex Kerberos, using kerberized rsh
2433 @cindex SSH (rsh replacement)
2434 @cindex rsh replacements (Kerberized, SSH, &c)
2435 There are two access methods that you use in @code{CVSROOT}
2436 for rsh. @code{:server:} specifies an internal rsh
2437 client, which is supported only by some @sc{cvs} ports.
2438 This is not supported on most Unix-style systems.
2439 @code{:ext:} specifies an external rsh program. By
2440 default this is @code{rsh} (unless otherwise specified
2441 by the @file{--with-rsh} flag to configure) but you may set the
2442 @code{CVS_RSH} environment variable to invoke another
2443 program which can access the remote server (for
2444 example, @code{remsh} on HP-UX 9 because @code{rsh} is
2445 something different, or @code{ssh} to allow the use of secure
2446 and/or compressed connections). It must be a program which can
2447 transmit data to and from the server without modifying
2448 it; for example the Windows NT @code{rsh} is not
2449 suitable since it by default translates between CRLF
2450 and LF. The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
2451 to @code{rsh} to get around this, but since this could
2452 potentially cause problems for programs other than the
2453 standard @code{rsh}, it may change in the future. If
2454 you set @code{CVS_RSH} to @code{SSH} or some other rsh
2455 replacement, the instructions in the rest of this
2456 section concerning @file{.rhosts} and so on are likely
2457 to be inapplicable; consult the documentation for your rsh
2458 replacement.
2459
2460 In the Debian and MirBSD versions of @sc{cvs}, you can
2461 also specify @code{:extssh:} to force use of the Secure
2462 Shell, or @code{:ext=prog:} or @code{:ext=/path/to/prog:}
2463 to specify the remote shell to use without needing to
2464 touch the @code{CVS_RSH} environment variable.
2465
2466 You may choose to specify the @var{CVS_RSH} option as a method option
2467 in the @var{CVSROOT} string to allow you to use different connection tools
2468 for different roots (@pxref{The connection method}). For example, allowing
2469 some roots to use @code{CVS_RSH=remsh} and some to use
2470 @code{CVS_RSH=ssh} for the @code{ext} method. See also
2471 the @ref{Remote repositories} for more details.
2472 @c See also the comment in src/client.c for rationale
2473 @c concerning "rsh" being the default and never
2474 @c "remsh".
2475
2476 Continuing our example, supposing you want to access
2477 the module @file{foo} in the repository
2478 @file{/usr/local/cvsroot/}, on machine
2479 @file{faun.example.org}, you are ready to go:
2480
2481 @example
2482 cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2483 @end example
2484
2485 @noindent
2486 (The @file{bach@@} can be omitted if the username is
2487 the same on both the local and remote hosts.)
2488
2489 @c Should we mention "rsh host echo hi" and "rsh host
2490 @c cat" (the latter followed by typing text and ^D)
2491 @c as troubleshooting techniques? Probably yes
2492 @c (people tend to have trouble setting this up),
2493 @c but this kind of thing can be hard to spell out.
2494
2495 @node Password authenticated
2496 @subsection Direct connection with password authentication
2497
2498 The @sc{cvs} client can also connect to the server
2499 using a password protocol. This is particularly useful
2500 if using @code{rsh} is not feasible (for example,
2501 the server is behind a firewall), and Kerberos also is
2502 not available.
2503
2504 To use this method, it is necessary to make
2505 some adjustments on both the server and client sides.
2506
2507 @menu
2508 * Password authentication server:: Setting up the server
2509 * Password authentication client:: Using the client
2510 * Password authentication security:: What this method does and does not do
2511 @end menu
2512
2513 @node Password authentication server
2514 @subsubsection Setting up the server for password authentication
2515
2516 First of all, you probably want to tighten the
2517 permissions on the @file{$CVSROOT} and
2518 @file{$CVSROOT/CVSROOT} directories. See @ref{Password
2519 authentication security}, for more details.
2520
2521 @cindex pserver (subcommand)
2522 @cindex Remote repositories, port specification
2523 @cindex Repositories, remote, port specification
2524 @cindex Client/Server Operation, port specification
2525 @cindex pserver (client/server connection method), port specification
2526 @cindex kserver (client/server connection method), port specification
2527 @cindex gserver (client/server connection method), port specification
2528 @cindex port, specifying for remote repositories
2529 @cindex Password server, setting up
2530 @cindex Authenticating server, setting up
2531 @cindex inetd, configuring for pserver
2532 @cindex xinetd, configuring for pserver
2533 @c FIXME: this isn't quite right regarding port
2534 @c numbers; CVS looks up "cvspserver" in
2535 @c /etc/services (on unix, but what about non-unix?).
2536 On the server side, the file @file{/etc/inetd.conf}
2537 needs to be edited so @code{inetd} knows to run the
2538 command @code{cvs pserver} when it receives a
2539 connection on the right port. By default, the port
2540 number is 2401; it would be different if your client
2541 were compiled with @code{CVS_AUTH_PORT} defined to
2542 something else, though. This can also be specified in the CVSROOT variable
2543 (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
2544 environment variable (@pxref{Environment variables}).
2545
2546 If your @code{inetd} allows raw port numbers in
2547 @file{/etc/inetd.conf}, then the following (all on a
2548 single line in @file{inetd.conf}) should be sufficient:
2549
2550 @example
2551 2401 stream tcp nowait root /usr/local/bin/cvs
2552 cvs -f --allow-root=/usr/cvsroot pserver
2553 @end example
2554
2555 @noindent
2556 (You could also use the
2557 @samp{-T} option to specify a temporary directory.)
2558
2559 The @samp{--allow-root} option specifies the allowable
2560 @sc{cvsroot} directory. Clients which attempt to use a
2561 different @sc{cvsroot} directory will not be allowed to
2562 connect. To allow a whole class of @sc{cvsroot}, specify
2563 a POSIX extended regular expression to match allowed
2564 directories with the @samp{--allow-root-regexp} option.
2565 These options may be used in conjunction, and both options
2566 may be repeated to allow access to multiple @sc{cvsroot}
2567 directories and classes of directories.
2568 (Unfortunately, many versions of @code{inetd} have very small
2569 limits on the number of arguments and/or the total length
2570 of the command. The usual solution to this problem is
2571 to have @code{inetd} run a shell script which then invokes
2572 @sc{cvs} with the necessary arguments.)
2573
2574 If your @code{inetd} wants a symbolic service
2575 name instead of a raw port number, then put this in
2576 @file{/etc/services}:
2577
2578 @example
2579 cvspserver 2401/tcp
2580 @end example
2581
2582 @noindent
2583 and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
2584
2585 If your system uses @code{xinetd} instead of @code{inetd},
2586 the procedure is slightly different.
2587 Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
2588
2589 @example
2590 service cvspserver
2591 @{
2592 port = 2401
2593 socket_type = stream
2594 protocol = tcp
2595 wait = no
2596 user = root
2597 passenv = PATH
2598 server = /usr/local/bin/cvs
2599 server_args = -f --allow-root=/usr/cvsroot pserver
2600 @}
2601 @end example
2602
2603 @noindent
2604 (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
2605 the @code{port} line.)
2606
2607 Once the above is taken care of, restart your
2608 @code{inetd}, or do whatever is necessary to force it
2609 to reread its initialization files.
2610
2611 If you are having trouble setting this up, see
2612 @ref{Connection}.
2613
2614 @cindex CVS passwd file
2615 @cindex passwd (admin file)
2616 Because the client stores and transmits passwords in
2617 cleartext (almost---see @ref{Password authentication
2618 security}, for details), a separate @sc{cvs} password
2619 file is generally used, so people don't compromise
2620 their regular passwords when they access the
2621 repository. This file is
2622 @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
2623 administrative files}). It uses a colon-separated
2624 format, similar to @file{/etc/passwd} on Unix systems,
2625 except that it has fewer fields: @sc{cvs} username,
2626 optional password, and an optional system username for
2627 @sc{cvs} to run as if authentication succeeds. Here is
2628 an example @file{passwd} file with five entries:
2629
2630 @example
2631 anonymous:
2632 bach:ULtgRLXo7NRxs
2633 spwang:1sOp854gDF3DY
2634 melissa:tGX1fS8sun6rY:pubcvs
2635 qproj:XR4EZcEs0szik:pubcvs
2636 @end example
2637
2638 @noindent
2639 (The passwords are encrypted according to the standard
2640 Unix @code{crypt()} function, so it is possible to
2641 paste in passwords directly from regular Unix
2642 @file{/etc/passwd} files.)
2643
2644 The first line in the example will grant access to any
2645 @sc{cvs} client attempting to authenticate as user
2646 @code{anonymous}, no matter what password they use,
2647 including an empty password. (This is typical for
2648 sites granting anonymous read-only access; for
2649 information on how to do the "read-only" part, see
2650 @ref{Read-only access}.)
2651
2652 The second and third lines will grant access to
2653 @code{bach} and @code{spwang} if they supply their
2654 respective plaintext passwords.
2655
2656 @cindex User aliases
2657 The fourth line will grant access to @code{melissa}, if
2658 she supplies the correct password, but her @sc{cvs}
2659 operations will actually run on the server side under
2660 the system user @code{pubcvs}. Thus, there need not be
2661 any system user named @code{melissa}, but there
2662 @emph{must} be one named @code{pubcvs}.
2663
2664 The fifth line shows that system user identities can be
2665 shared: any client who successfully authenticates as
2666 @code{qproj} will actually run as @code{pubcvs}, just
2667 as @code{melissa} does. That way you could create a
2668 single, shared system user for each project in your
2669 repository, and give each developer their own line in
2670 the @file{$CVSROOT/CVSROOT/passwd} file. The @sc{cvs}
2671 username on each line would be different, but the
2672 system username would be the same. The reason to have
2673 different @sc{cvs} usernames is that @sc{cvs} will log their
2674 actions under those names: when @code{melissa} commits
2675 a change to a project, the checkin is recorded in the
2676 project's history under the name @code{melissa}, not
2677 @code{pubcvs}. And the reason to have them share a
2678 system username is so that you can arrange permissions
2679 in the relevant area of the repository such that only
2680 that account has write-permission there.
2681
2682 If the system-user field is present, all
2683 password-authenticated @sc{cvs} commands run as that
2684 user; if no system user is specified, @sc{cvs} simply
2685 takes the @sc{cvs} username as the system username and
2686 runs commands as that user. In either case, if there
2687 is no such user on the system, then the @sc{cvs}
2688 operation will fail (regardless of whether the client
2689 supplied a valid password).
2690
2691 The password and system-user fields can both be omitted
2692 (and if the system-user field is omitted, then also
2693 omit the colon that would have separated it from the
2694 encrypted password). For example, this would be a
2695 valid @file{$CVSROOT/CVSROOT/passwd} file:
2696
2697 @example
2698 anonymous::pubcvs
2699 fish:rKa5jzULzmhOo:kfogel
2700 sussman:1sOp854gDF3DY
2701 @end example
2702
2703 @noindent
2704 When the password field is omitted or empty, then the
2705 client's authentication attempt will succeed with any
2706 password, including the empty string. However, the
2707 colon after the @sc{cvs} username is always necessary,
2708 even if the password is empty.
2709
2710 @sc{cvs} can also fall back to use system authentication.
2711 When authenticating a password, the server first checks
2712 for the user in the @file{$CVSROOT/CVSROOT/passwd}
2713 file. If it finds the user, it will use that entry for
2714 authentication as described above. But if it does not
2715 find the user, or if the @sc{cvs} @file{passwd} file
2716 does not exist, then the server can try to authenticate
2717 the username and password using the operating system's
2718 user-lookup routines (this "fallback" behavior can be
2719 disabled by setting @code{SystemAuth=no} in the
2720 @sc{cvs} @file{config} file, @pxref{config}).
2721
2722 The default fallback behavior is to look in
2723 @file{/etc/passwd} for this system user unless your
2724 system has PAM (Pluggable Authentication Modules)
2725 and your @sc{cvs} server executable was configured to
2726 use it at compile time (using @code{./configure --enable-pam} - see the
2727 INSTALL file for more). In this case, PAM will be consulted instead.
2728 This means that @sc{cvs} can be configured to use any password
2729 authentication source PAM can be configured to use (possibilities
2730 include a simple UNIX password, NIS, LDAP, and others) in its
2731 global configuration file (usually @file{/etc/pam.conf}
2732 or possibly @file{/etc/pam.d/cvs}). See your PAM documentation
2733 for more details on PAM configuration.
2734
2735 Note that PAM is an experimental feature in @sc{cvs} and feedback is
2736 encouraged. Please send a mail to one of the @sc{cvs} mailing lists
2737 (@code{info-cvs@@nongnu.org} or @code{bug-cvs@@nongnu.org}) if you use the
2738 @sc{cvs} PAM support.
2739
2740 @emph{WARNING: Using PAM gives the system administrator much more
2741 flexibility about how @sc{cvs} users are authenticated but
2742 no more security than other methods. See below for more.}
2743
2744 CVS needs an "auth", "account" and "session" module in the
2745 PAM configuration file. A typical PAM configuration
2746 would therefore have the following lines
2747 in @file{/etc/pam.conf} to emulate the standard @sc{cvs}
2748 system @file{/etc/passwd} authentication:
2749
2750 @example
2751 cvs auth required pam_unix.so
2752 cvs account required pam_unix.so
2753 cvs session required pam_unix.so
2754 @end example
2755
2756 The the equivalent @file{/etc/pam.d/cvs} would contain
2757
2758 @example
2759 auth required pam_unix.so
2760 account required pam_unix.so
2761 session required pam_unix.so
2762 @end example
2763
2764 Some systems require a full path to the module so that
2765 @file{pam_unix.so} (Linux) would become something like
2766 @file{/usr/lib/security/$ISA/pam_unix.so.1} (Sun Solaris).
2767 See the @file{contrib/pam} subdirectory of the @sc{cvs}
2768 source distribution for further example configurations.
2769
2770 The PAM service name given above as "cvs" is just
2771 the service name in the default configuration and can be
2772 set using
2773 @code{./configure --with-hardcoded-pam-service-name=<pam-service-name>}
2774 before compiling. @sc{cvs} can also be configured to use whatever
2775 name it is invoked as as its PAM service name using
2776 @code{./configure --without-hardcoded-pam-service-name}, but this
2777 feature should not be used if you may not have control of the name
2778 @sc{cvs} will be invoked as.
2779
2780 Be aware, also, that falling back to system
2781 authentication might be a security risk: @sc{cvs}
2782 operations would then be authenticated with that user's
2783 regular login password, and the password flies across
2784 the network in plaintext. See @ref{Password
2785 authentication security} for more on this.
2786 This may be more of a problem with PAM authentication
2787 because it is likely that the source of the system
2788 password is some central authentication service like
2789 LDAP which is also used to authenticate other services.
2790
2791 On the other hand, PAM makes it very easy to change your password
2792 regularly. If they are given the option of a one-password system for
2793 all of their activities, users are often more willing to change their
2794 password on a regular basis.
2795
2796 In the non-PAM configuration where the password is stored in the
2797 @file{CVSROOT/passwd} file, it is difficult to change passwords on a
2798 regular basis since only administrative users (or in some cases
2799 processes that act as an administrative user) are typically given
2800 access to modify this file. Either there needs to be some
2801 hand-crafted web page or set-uid program to update the file, or the
2802 update needs to be done by submitting a request to an administrator to
2803 perform the duty by hand. In the first case, having to remember to
2804 update a separate password on a periodic basis can be difficult. In
2805 the second case, the manual nature of the change will typically mean
2806 that the password will not be changed unless it is absolutely
2807 necessary.
2808
2809 Note that PAM administrators should probably avoid configuring
2810 one-time-passwords (OTP) for @sc{cvs} authentication/authorization. If
2811 OTPs are desired, the administrator may wish to encourage the use of
2812 one of the other Client/Server access methods. See the section on
2813 @pxref{Remote repositories} for a list of other methods.
2814
2815 Right now, the only way to put a password in the
2816 @sc{cvs} @file{passwd} file is to paste it there from
2817 somewhere else. Someday, there may be a @code{cvs
2818 passwd} command.
2819
2820 Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
2821 is normal to edit the @file{passwd} file in-place,
2822 rather than via @sc{cvs}. This is because of the
2823 possible security risks of having the @file{passwd}
2824 file checked out to people's working copies. If you do
2825 want to include the @file{passwd} file in checkouts of
2826 @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
2827
2828 @c We might also suggest using the @code{htpasswd} command
2829 @c from freely available web servers as well, but that
2830 @c would open up a can of worms in that the users next
2831 @c questions are likely to be "where do I get it?" and
2832 @c "how do I use it?"
2833 @c Also note that htpasswd, at least the version I had,
2834 @c likes to clobber the third field.
2835
2836 @node Password authentication client
2837 @subsubsection Using the client with password authentication
2838 @cindex Login (subcommand)
2839 @cindex Password client, using
2840 @cindex Authenticated client, using
2841 @cindex pserver method, setting up
2842 To run a @sc{cvs} command on a remote repository via
2843 the password-authenticating server, one specifies the
2844 @code{pserver} protocol, optional username, repository host, an
2845 optional port number, and path to the repository. For example:
2846
2847 @example
2848 cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
2849 @end example
2850
2851 @noindent
2852 or
2853
2854 @example
2855 CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
2856 cvs checkout someproj
2857 @end example
2858
2859 However, unless you're connecting to a public-access
2860 repository (i.e., one where that username doesn't
2861 require a password), you'll need to supply a password or @dfn{log in} first.
2862 Logging in verifies your password with the repository and stores it in a file.
2863 It's done with the @code{login} command, which will
2864 prompt you interactively for the password if you didn't supply one as part of
2865 @var{$CVSROOT}:
2866
2867 @example
2868 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
2869 CVS password:
2870 @end example
2871
2872 @noindent
2873 or
2874
2875 @example
2876 cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
2877 @end example
2878
2879 After you enter the password, @sc{cvs} verifies it with
2880 the server. If the verification succeeds, then that
2881 combination of username, host, repository, and password
2882 is permanently recorded, so future transactions with
2883 that repository won't require you to run @code{cvs
2884 login}. (If verification fails, @sc{cvs} will exit
2885 complaining that the password was incorrect, and
2886 nothing will be recorded.)
2887
2888 The records are stored, by default, in the file
2889 @file{$HOME/.cvspass}. That file's format is
2890 human-readable, and to a degree human-editable, but
2891 note that the passwords are not stored in
2892 cleartext---they are trivially encoded to protect them
2893 from "innocent" compromise (i.e., inadvertent viewing
2894 by a system administrator or other non-malicious
2895 person).
2896
2897 @cindex CVS_PASSFILE, environment variable
2898 You can change the default location of this file by
2899 setting the @code{CVS_PASSFILE} environment variable.
2900 If you use this variable, make sure you set it
2901 @emph{before} @code{cvs login} is run. If you were to
2902 set it after running @code{cvs login}, then later
2903 @sc{cvs} commands would be unable to look up the
2904 password for transmission to the server.
2905
2906 Once you have logged in, all @sc{cvs} commands using
2907 that remote repository and username will authenticate
2908 with the stored password. So, for example
2909
2910 @example
2911 cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
2912 @end example
2913
2914 @noindent
2915 should just work (unless the password changes on the
2916 server side, in which case you'll have to re-run
2917 @code{cvs login}).
2918
2919 Note that if the @samp{:pserver:} were not present in
2920 the repository specification, @sc{cvs} would assume it
2921 should use @code{rsh} to connect with the server
2922 instead (@pxref{Connecting via rsh}).
2923
2924 Of course, once you have a working copy checked out and
2925 are running @sc{cvs} commands from within it, there is
2926 no longer any need to specify the repository
2927 explicitly, because @sc{cvs} can deduce the repository
2928 from the working copy's @file{CVS} subdirectory.
2929
2930 @c FIXME: seems to me this needs somewhat more
2931 @c explanation.
2932 @cindex Logout (subcommand)
2933 The password for a given remote repository can be
2934 removed from the @code{CVS_PASSFILE} by using the
2935 @code{cvs logout} command.
2936
2937 @node Password authentication security
2938 @subsubsection Security considerations with password authentication
2939
2940 @cindex Security, of pserver
2941 The passwords are stored on the client side in a
2942 trivial encoding of the cleartext, and transmitted in
2943 the same encoding. The encoding is done only to
2944 prevent inadvertent password compromises (i.e., a
2945 system administrator accidentally looking at the file),
2946 and will not prevent even a naive attacker from gaining
2947 the password.
2948
2949 @c FIXME: The bit about "access to the repository
2950 @c implies general access to the system is *not* specific
2951 @c to pserver; it applies to kerberos and SSH and
2952 @c everything else too. Should reorganise the
2953 @c documentation to make this clear.
2954 The separate @sc{cvs} password file (@pxref{Password
2955 authentication server}) allows people
2956 to use a different password for repository access than
2957 for login access. On the other hand, once a user has
2958 non-read-only
2959 access to the repository, she can execute programs on
2960 the server system through a variety of means. Thus, repository
2961 access implies fairly broad system access as well. It
2962 might be possible to modify @sc{cvs} to prevent that,
2963 but no one has done so as of this writing.
2964 @c OpenBSD uses chroot() and copies the repository to
2965 @c provide anonymous read-only access (for details see
2966 @c http://www.openbsd.org/anoncvs.shar). While this
2967 @c closes the most obvious holes, I'm not sure it
2968 @c closes enough holes to recommend it (plus it is
2969 @c *very* easy to accidentally screw up a setup of this
2970 @c type).
2971
2972 Note that because the @file{$CVSROOT/CVSROOT} directory
2973 contains @file{passwd} and other files which are used
2974 to check security, you must control the permissions on
2975 this directory as tightly as the permissions on
2976 @file{/etc}. The same applies to the @file{$CVSROOT}
2977 directory itself and any directory
2978 above it in the tree. Anyone who has write access to
2979 such a directory will have the ability to become any
2980 user on the system. Note that these permissions are
2981 typically tighter than you would use if you are not
2982 using pserver.
2983 @c TODO: Would be really nice to document/implement a
2984 @c scheme where the CVS server can run as some non-root
2985 @c user, e.g. "cvs". CVSROOT/passwd would contain a
2986 @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
2987 @c would be implicit). This would greatly reduce
2988 @c security risks such as those hinted at in the
2989 @c previous paragraph. I think minor changes to CVS
2990 @c might be required but mostly this would just need
2991 @c someone who wants to play with it, document it, &c.
2992
2993 In summary, anyone who gets the password gets
2994 repository access (which may imply some measure of general system
2995 access as well). The password is available to anyone
2996 who can sniff network packets or read a protected
2997 (i.e., user read-only) file. If you want real
2998 security, get Kerberos.
2999
3000 @node GSSAPI authenticated
3001 @subsection Direct connection with GSSAPI
3002
3003 @cindex GSSAPI
3004 @cindex Security, GSSAPI
3005 @cindex gserver method, setting up
3006 @cindex Kerberos, using gserver method
3007 GSSAPI is a generic interface to network security
3008 systems such as Kerberos 5.
3009 If you have a working GSSAPI library, you can have
3010 @sc{cvs} connect via a direct @sc{tcp} connection,
3011 authenticating with GSSAPI.
3012
3013 To do this, @sc{cvs} needs to be compiled with GSSAPI
3014 support; when configuring @sc{cvs} it tries to detect
3015 whether GSSAPI libraries using Kerberos version 5 are
3016 present. You can also use the @file{--with-gssapi}
3017 flag to configure.
3018
3019 The connection is authenticated using GSSAPI, but the
3020 message stream is @emph{not} authenticated by default.
3021 You must use the @code{-a} global option to request
3022 stream authentication.
3023
3024 The data transmitted is @emph{not} encrypted by
3025 default. Encryption support must be compiled into both
3026 the client and the server; use the
3027 @file{--enable-encrypt} configure option to turn it on.
3028 You must then use the @code{-x} global option to
3029 request encryption.
3030
3031 GSSAPI connections are handled on the server side by
3032 the same server which handles the password
3033 authentication server; see @ref{Password authentication
3034 server}. If you are using a GSSAPI mechanism such as
3035 Kerberos which provides for strong authentication, you
3036 will probably want to disable the ability to
3037 authenticate via cleartext passwords. To do so, create
3038 an empty @file{CVSROOT/passwd} password file, and set
3039 @code{SystemAuth=no} in the config file
3040 (@pxref{config}).
3041
3042 The GSSAPI server uses a principal name of
3043 cvs/@var{hostname}, where @var{hostname} is the
3044 canonical name of the server host. You will have to
3045 set this up as required by your GSSAPI mechanism.
3046
3047 To connect using GSSAPI, use the @samp{:gserver:} method. For
3048 example,
3049
3050 @example
3051 cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
3052 @end example
3053
3054 @node Kerberos authenticated
3055 @subsection Direct connection with Kerberos
3056
3057 @cindex Kerberos, using kserver method
3058 @cindex Security, Kerberos
3059 @cindex kserver method, setting up
3060 The easiest way to use Kerberos is to use the Kerberos
3061 @code{rsh}, as described in @ref{Connecting via rsh}.
3062 The main disadvantage of using rsh is that all the data
3063 needs to pass through additional programs, so it may be
3064 slower. So if you have Kerberos installed you can
3065 connect via a direct @sc{tcp} connection,
3066 authenticating with Kerberos.
3067
3068 This section concerns the Kerberos network security
3069 system, version 4. Kerberos version 5 is supported via
3070 the GSSAPI generic network security interface, as
3071 described in the previous section.
3072
3073 To do this, @sc{cvs} needs to be compiled with Kerberos
3074 support; when configuring @sc{cvs} it tries to detect
3075 whether Kerberos is present or you can use the
3076 @file{--with-krb4} flag to configure.
3077
3078 The data transmitted is @emph{not} encrypted by
3079 default. Encryption support must be compiled into both
3080 the client and server; use the
3081 @file{--enable-encryption} configure option to turn it
3082 on. You must then use the @code{-x} global option to
3083 request encryption.
3084
3085 The CVS client will attempt to connect to port 1999 by default.
3086
3087 @cindex kinit
3088 When you want to use @sc{cvs}, get a ticket in the
3089 usual way (generally @code{kinit}); it must be a ticket
3090 which allows you to log into the server machine. Then
3091 you are ready to go:
3092
3093 @example
3094 cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
3095 @end example
3096
3097 Previous versions of @sc{cvs} would fall back to a
3098 connection via rsh; this version will not do so.
3099
3100 @node Connecting via fork
3101 @subsection Connecting with fork
3102
3103 @cindex fork, access method
3104 @cindex fork method, setting up
3105 This access method allows you to connect to a
3106 repository on your local disk via the remote protocol.
3107 In other words it does pretty much the same thing as
3108 @code{:local:}, but various quirks, bugs and the like are
3109 those of the remote @sc{cvs} rather than the local
3110 @sc{cvs}.
3111
3112 For day-to-day operations you might prefer either
3113 @code{:local:} or @code{:fork:}, depending on your
3114 preferences. Of course @code{:fork:} comes in
3115 particularly handy in testing or
3116 debugging @code{cvs} and the remote protocol.
3117 Specifically, we avoid all of the network-related
3118 setup/configuration, timeouts, and authentication
3119 inherent in the other remote access methods but still
3120 create a connection which uses the remote protocol.
3121
3122 To connect using the @code{fork} method, use
3123 @samp{:fork:} and the pathname to your local
3124 repository. For example:
3125
3126 @example
3127 cvs -d :fork:/usr/local/cvsroot checkout foo
3128 @end example
3129
3130 @cindex CVS_SERVER, and fork method
3131 As with @code{:ext:}, the server is called @samp{cvs}
3132 by default, or the value of the @code{CVS_SERVER}
3133 environment variable.
3134
3135
3136 @node Write proxies
3137 @subsection Distributing load across several CVS servers
3138
3139 @cindex PrimaryServer, in CVSROOT/config
3140 @cindex Primary server
3141 @cindex Secondary server
3142 @cindex proxy, write
3143 @cindex write proxy
3144 @sc{cvs} can be configured to distribute usage across several @sc{cvs}
3145 servers. This is accomplished by means of one or more @dfn{write proxies}, or
3146 @dfn{secondary servers}, for a single @dfn{primary server}.
3147
3148 When a @sc{cvs} client accesses a secondary server and only sends read
3149 requests, then the secondary server handles the entire request. If the client
3150 sends any write requests, however, the secondary server asks the client to
3151 redirect its write request to the primary server, if the client supports
3152 redirect requests, and otherwise becomes a transparent proxy for the primary
3153 server, which actually handles the write request.
3154
3155 In this manner, any number of read-only secondary servers may be configured as
3156 write proxies for the primary server, effectively distributing the load from
3157 all read operations between the secondary servers and restricting the load on
3158 the primary server to write operations and pushing changes to the secondaries.
3159
3160 Primary servers will not automatically push changes to secondaries. This must
3161 be configured via @file{loginfo}, @file{postadmin}, @file{posttag}, &
3162 @file{postwatch} scripts (@pxref{Trigger Scripts}) like the following:
3163
3164 @example
3165 ALL rsync -gopr -essh ./ secondary:/cvsroot/%p &
3166 @end example
3167
3168 You would probably actually want to lock directories for write on the secondary
3169 and for read on the primary before running the @samp{rsync} in the above
3170 example, but describing such a setup is beyond the scope of this document.
3171
3172 A secondary advantage of a write proxy setup is that users pointing at the
3173 secondary server can still execute fast read operations while on a network that
3174 connects to the primary over a slow link or even one where the link to the
3175 primary is periodically broken. Only write operations will require the network
3176 link to the primary.
3177
3178 To configure write proxies, the primary must be specified with the
3179 @samp{PrimaryServer} option in @file{CVSROOT/config} (@pxref{config}). For the
3180 transparent proxy mode to work, all secondary servers must also be running the
3181 same version of the @sc{cvs} server, or at least one that provides the same
3182 list of supported requests to the client as the primary server. This is not
3183 necessary for redirection.
3184
3185 Once a primary server is configured, secondary servers may be configured by:
3186
3187 @enumerate
3188 @item
3189 Duplicating the primary repository at the new location.
3190 @item
3191 Setting up the @file{loginfo}, @file{postadmin}, @file{posttag}, and
3192 @file{postwatch} files on the primary to propagate writes to the new secondary.
3193 @item
3194 Configure remote access to the secondary(ies) as you would configure access
3195 to any other CVS server (@pxref{Remote repositories}).
3196 @item
3197 Ensuring that @code{--allow-root=@var{secondary-cvsroot}} is passed to
3198 @strong{all} incovations of the secondary server if the path to the @sc{cvs}
3199 repository directory is different on the two servers and you wish to support
3200 clients that do not handle the @samp{Redirect} resopnse (CVS 1.12.9 and earlier
3201 clients do not handle the @samp{Redirect} response).
3202
3203 Please note, again, that writethrough proxy suport requires
3204 @code{--allow-root=@var{secondary-cvsroot}} to be specified for @strong{all}
3205 incovations of the secondary server, not just @samp{pserver} invocations.
3206 This may require a wrapper script for the @sc{cvs} executable
3207 on your server machine.
3208 @end enumerate
3209
3210
3211 @c ---------------------------------------------------------------------
3212 @node Read-only access
3213 @section Read-only repository access
3214 @cindex Read-only repository access
3215 @cindex readers (admin file)
3216 @cindex writers (admin file)
3217
3218 It is possible to grant read-only repository
3219 access to people using the password-authenticated
3220 server (@pxref{Password authenticated}). (The
3221 other access methods do not have explicit support for
3222 read-only users because those methods all assume login
3223 access to the repository machine anyway, and therefore
3224 the user can do whatever local file permissions allow
3225 her to do.)
3226
3227 A user who has read-only access can do only
3228 those @sc{cvs} operations which do not modify the
3229 repository, except for certain ``administrative'' files
3230 (such as lock files and the history file). It may be
3231 desirable to use this feature in conjunction with
3232 user-aliasing (@pxref{Password authentication server}).
3233
3234 Unlike with previous versions of @sc{cvs}, read-only
3235 users should be able merely to read the repository, and
3236 not to execute programs on the server or otherwise gain
3237 unexpected levels of access. Or to be more accurate,
3238 the @emph{known} holes have been plugged. Because this
3239 feature is new and has not received a comprehensive
3240 security audit, you should use whatever level of
3241 caution seems warranted given your attitude concerning
3242 security.
3243
3244 There are two ways to specify read-only access
3245 for a user: by inclusion, and by exclusion.
3246
3247 "Inclusion" means listing that user
3248 specifically in the @file{$CVSROOT/CVSROOT/readers}
3249 file, which is simply a newline-separated list of
3250 users. Here is a sample @file{readers} file:
3251
3252 @example
3253 melissa
3254 splotnik
3255 jrandom
3256 @end example
3257
3258 @noindent
3259 (Don't forget the newline after the last user.)
3260
3261 "Exclusion" means explicitly listing everyone
3262 who has @emph{write} access---if the file
3263
3264 @example
3265 $CVSROOT/CVSROOT/writers
3266 @end example
3267
3268 @noindent
3269 exists, then only
3270 those users listed in it have write access, and
3271 everyone else has read-only access (of course, even the
3272 read-only users still need to be listed in the
3273 @sc{cvs} @file{passwd} file). The
3274 @file{writers} file has the same format as the
3275 @file{readers} file.
3276
3277 Note: if your @sc{cvs} @file{passwd}
3278 file maps cvs users onto system users (@pxref{Password
3279 authentication server}), make sure you deny or grant
3280 read-only access using the @emph{cvs} usernames, not
3281 the system usernames. That is, the @file{readers} and
3282 @file{writers} files contain cvs usernames, which may
3283 or may not be the same as system usernames.
3284
3285 Here is a complete description of the server's
3286 behavior in deciding whether to grant read-only or
3287 read-write access:
3288
3289 If @file{readers} exists, and this user is
3290 listed in it, then she gets read-only access. Or if
3291 @file{writers} exists, and this user is NOT listed in
3292 it, then she also gets read-only access (this is true
3293 even if @file{readers} exists but she is not listed
3294 there). Otherwise, she gets full read-write access.
3295
3296 Of course there is a conflict if the user is
3297 listed in both files. This is resolved in the more
3298 conservative way, it being better to protect the
3299 repository too much than too little: such a user gets
3300 read-only access.
3301
3302 @node Server temporary directory
3303 @section Temporary directories for the server
3304 @cindex Temporary directories, and server
3305 @cindex Server, temporary directories
3306
3307 While running, the @sc{cvs} server creates temporary
3308 directories. They are named
3309
3310 @example
3311 cvs-serv@var{pid}
3312 @end example
3313
3314 @noindent
3315 where @var{pid} is the process identification number of
3316 the server.
3317 They are located in the directory specified by
3318 the @samp{-T} global option (@pxref{Global options}),
3319 the @code{TMPDIR} environment variable (@pxref{Environment variables}),
3320 or, failing that, @file{/tmp}.
3321
3322 In most cases the server will remove the temporary
3323 directory when it is done, whether it finishes normally
3324 or abnormally. However, there are a few cases in which
3325 the server does not or cannot remove the temporary
3326 directory, for example:
3327
3328 @itemize @bullet
3329 @item
3330 If the server aborts due to an internal server error,
3331 it may preserve the directory to aid in debugging
3332
3333 @item
3334 If the server is killed in a way that it has no way of
3335 cleaning up (most notably, @samp{kill -KILL} on unix).
3336
3337 @item
3338 If the system shuts down without an orderly shutdown,
3339 which tells the server to clean up.
3340 @end itemize
3341
3342 In cases such as this, you will need to manually remove
3343 the @file{cvs-serv@var{pid}} directories. As long as
3344 there is no server running with process identification
3345 number @var{pid}, it is safe to do so.
3346
3347 @c ---------------------------------------------------------------------
3348 @node Starting a new project
3349 @chapter Starting a project with CVS
3350 @cindex Starting a project with CVS
3351 @cindex Creating a project
3352
3353 @comment --moduledb--
3354 Because renaming files and moving them between
3355 directories is somewhat inconvenient, the first thing
3356 you do when you start a new project should be to think
3357 through your file organization. It is not impossible
3358 to rename or move files, but it does increase the
3359 potential for confusion and @sc{cvs} does have some
3360 quirks particularly in the area of renaming
3361 directories. @xref{Moving files}.
3362
3363 What to do next depends on the situation at hand.
3364
3365 @menu
3366 * Setting up the files:: Getting the files into the repository
3367 * Defining the module:: How to make a module of the files
3368 @end menu
3369 @c -- File permissions!
3370
3371 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3372 @node Setting up the files
3373 @section Setting up the files
3374
3375 The first step is to create the files inside the repository. This can
3376 be done in a couple of different ways.
3377
3378 @c -- The contributed scripts
3379 @menu
3380 * From files:: This method is useful with old projects
3381 where files already exists.
3382 * From other version control systems:: Old projects where you want to
3383 preserve history from another system.
3384 * From scratch:: Creating a directory tree from scratch.
3385 @end menu
3386
3387 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3388 @node From files
3389 @subsection Creating a directory tree from a number of files
3390 @cindex Importing files
3391
3392 When you begin using @sc{cvs}, you will probably already have several
3393 projects that can be
3394 put under @sc{cvs} control. In these cases the easiest way is to use the
3395 @code{import} command. An example is probably the easiest way to
3396 explain how to use it. If the files you want to install in
3397 @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
3398 repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
3399
3400 @example
3401 $ cd @var{wdir}
3402 $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
3403 @end example
3404
3405 Unless you supply a log message with the @samp{-m}
3406 flag, @sc{cvs} starts an editor and prompts for a
3407 message. The string @samp{yoyo} is a @dfn{vendor tag},
3408 and @samp{start} is a @dfn{release tag}. They may fill
3409 no purpose in this context, but since @sc{cvs} requires
3410 them they must be present. @xref{Tracking sources}, for
3411 more information about them.
3412
3413 You can now verify that it worked, and remove your
3414 original source directory.
3415 @c FIXME: Need to say more about "verify that it
3416 @c worked". What should the user look for in the output
3417 @c from "diff -r"?
3418
3419 @example
3420 $ cd ..
3421 $ cvs checkout yoyodyne/@var{rdir} # @r{Explanation below}
3422 $ diff -r @var{wdir} yoyodyne/@var{rdir}
3423 $ rm -r @var{wdir}
3424 @end example
3425
3426 @noindent
3427 Erasing the original sources is a good idea, to make sure that you do
3428 not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
3429 Of course, it would be wise to make sure that you have
3430 a backup of the sources before you remove them.
3431
3432 The @code{checkout} command can either take a module
3433 name as argument (as it has done in all previous
3434 examples) or a path name relative to @code{$CVSROOT},
3435 as it did in the example above.
3436
3437 It is a good idea to check that the permissions
3438 @sc{cvs} sets on the directories inside @code{$CVSROOT}
3439 are reasonable, and that they belong to the proper
3440 groups. @xref{File permissions}.
3441
3442 If some of the files you want to import are binary, you
3443 may want to use the wrappers features to specify which
3444 files are binary and which are not. @xref{Wrappers}.
3445
3446 @c The node name is too long, but I am having trouble
3447 @c thinking of something more concise.
3448 @node From other version control systems
3449 @subsection Creating Files From Other Version Control Systems
3450 @cindex Importing files, from other version control systems
3451
3452 If you have a project which you are maintaining with
3453 another version control system, such as @sc{rcs}, you
3454 may wish to put the files from that project into
3455 @sc{cvs}, and preserve the revision history of the
3456 files.
3457
3458 @table @asis
3459 @cindex RCS, importing files from
3460 @item From RCS
3461 If you have been using @sc{rcs}, find the @sc{rcs}
3462 files---usually a file named @file{foo.c} will have its
3463 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
3464 other places; consult the @sc{rcs} documentation for
3465 details). Then create the appropriate directories in
3466 @sc{cvs} if they do not already exist. Then copy the
3467 files into the appropriate directories in the @sc{cvs}
3468 repository (the name in the repository must be the name
3469 of the source file with @samp{,v} added; the files go
3470 directly in the appropriate directory of the repository,
3471 not in an @file{RCS} subdirectory). This is one of the
3472 few times when it is a good idea to access the @sc{cvs}
3473 repository directly, rather than using @sc{cvs}
3474 commands. Then you are ready to check out a new
3475 working directory.
3476 @c Someday there probably should be a "cvs import -t
3477 @c rcs" or some such. It could even create magic
3478 @c branches. It could also do something about the case
3479 @c where the RCS file had a (non-magic) "0" branch.
3480
3481 The @sc{rcs} file should not be locked when you move it
3482 into @sc{cvs}; if it is, @sc{cvs} will have trouble
3483 letting you operate on it.
3484 @c What is the easiest way to unlock your files if you
3485 @c have them locked? Especially if you have a lot of them?
3486 @c This is a CVS bug/misfeature; importing RCS files
3487 @c should ignore whether they are locked and leave them in
3488 @c an unlocked state. Yet another reason for a separate
3489 @c "import RCS file" command.
3490
3491 @c How many is "many"? Or do they just import RCS files?
3492 @item From another version control system
3493 Many version control systems have the ability to export
3494 @sc{rcs} files in the standard format. If yours does,
3495 export the @sc{rcs} files and then follow the above
3496 instructions.
3497
3498 Failing that, probably your best bet is to write a
3499 script that will check out the files one revision at a
3500 time using the command line interface to the other
3501 system, and then check the revisions into @sc{cvs}.
3502 The @file{sccs2rcs} script mentioned below may be a
3503 useful example to follow.
3504
3505 @cindex SCCS, importing files from
3506 @item From SCCS
3507 There is a script in the @file{contrib} directory of
3508 the @sc{cvs} source distribution called @file{sccs2rcs}
3509 which converts @sc{sccs} files to @sc{rcs} files.
3510 Note: you must run it on a machine which has both
3511 @sc{sccs} and @sc{rcs} installed, and like everything
3512 else in contrib it is unsupported (your mileage may
3513 vary).
3514
3515 @cindex PVCS, importing files from
3516 @item From PVCS
3517 There is a script in the @file{contrib} directory of
3518 the @sc{cvs} source distribution called @file{pvcs_to_rcs}
3519 which converts @sc{pvcs} archives to @sc{rcs} files.
3520 You must run it on a machine which has both
3521 @sc{pvcs} and @sc{rcs} installed, and like everything
3522 else in contrib it is unsupported (your mileage may
3523 vary). See the comments in the script for details.
3524 @end table
3525 @c CMZ and/or PATCHY were systems that were used in the
3526 @c high energy physics community (especially for
3527 @c CERNLIB). CERN has replaced them with CVS, but the
3528 @c CAR format seems to live on as a way to submit
3529 @c changes. There is a program car2cvs which converts
3530 @c but I'm not sure where one gets a copy.
3531 @c Not sure it is worth mentioning here, since it would
3532 @c appear to affect only one particular community.
3533 @c Best page for more information is:
3534 @c http://wwwcn1.cern.ch/asd/cvs/index.html
3535 @c See also:
3536 @c http://ecponion.cern.ch/ecpsa/cernlib.html
3537
3538 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3539 @node From scratch
3540 @subsection Creating a directory tree from scratch
3541
3542 @c Also/instead should be documenting
3543 @c $ cvs co -l .
3544 @c $ mkdir tc
3545 @c $ cvs add tc
3546 @c $ cd tc
3547 @c $ mkdir man
3548 @c $ cvs add man
3549 @c etc.
3550 @c Using import to create the directories only is
3551 @c probably a somewhat confusing concept.
3552 For a new project, the easiest thing to do is probably
3553 to create an empty directory structure, like this:
3554
3555 @example
3556 $ mkdir tc
3557 $ mkdir tc/man
3558 $ mkdir tc/testing
3559 @end example
3560
3561 After that, you use the @code{import} command to create
3562 the corresponding (empty) directory structure inside
3563 the repository:
3564
3565 @example
3566 $ cd tc
3567 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
3568 @end example
3569
3570 This will add yoyodyne/@var{dir} as a directory under
3571 @code{$CVSROOT}.
3572
3573 Use @code{checkout} to get the new project. Then, use @code{add}
3574 to add files (and new directories) as needed.
3575
3576 @example
3577 $ cd ..
3578 $ cvs co yoyodyne/@var{dir}
3579 @end example
3580
3581 Check that the permissions @sc{cvs} sets on the
3582 directories inside @code{$CVSROOT} are reasonable.
3583
3584 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3585 @node Defining the module
3586 @section Defining the module
3587 @cindex Defining a module
3588 @cindex Editing the modules file
3589 @cindex Module, defining
3590 @cindex Modules file, changing
3591
3592 The next step is to define the module in the
3593 @file{modules} file. This is not strictly necessary,
3594 but modules can be convenient in grouping together
3595 related files and directories.
3596
3597 In simple cases these steps are sufficient to define a module.
3598
3599 @enumerate
3600 @item
3601 Get a working copy of the modules file.
3602
3603 @example
3604 $ cvs checkout CVSROOT/modules
3605 $ cd CVSROOT
3606 @end example
3607
3608 @item
3609 Edit the file and insert a line that defines the module. @xref{Intro
3610 administrative files}, for an introduction. @xref{modules}, for a full
3611 description of the modules file. You can use the
3612 following line to define the module @samp{tc}:
3613
3614 @example
3615 tc yoyodyne/tc
3616 @end example
3617
3618 @item
3619 Commit your changes to the modules file.
3620
3621 @example
3622 $ cvs commit -m "Added the tc module." modules
3623 @end example
3624
3625 @item
3626 Release the modules module.
3627
3628 @example
3629 $ cd ..
3630 $ cvs release -d CVSROOT
3631 @end example
3632 @end enumerate
3633
3634 @c ---------------------------------------------------------------------
3635 @node Revisions
3636 @chapter Revisions
3637
3638 For many uses of @sc{cvs}, one doesn't need to worry
3639 too much about revision numbers; @sc{cvs} assigns
3640 numbers such as @code{1.1}, @code{1.2}, and so on, and
3641 that is all one needs to know. However, some people
3642 prefer to have more knowledge and control concerning
3643 how @sc{cvs} assigns revision numbers.
3644
3645 If one wants to keep track of a set of revisions
3646 involving more than one file, such as which revisions
3647 went into a particular release, one uses a @dfn{tag},
3648 which is a symbolic revision which can be assigned to a
3649 numeric revision in each file.
3650
3651 @menu
3652 * Revision numbers:: The meaning of a revision number
3653 * Versions revisions releases:: Terminology used in this manual
3654 * Assigning revisions:: Assigning revisions
3655 * Tags:: Tags--Symbolic revisions
3656 * Tagging the working directory:: The cvs tag command
3657 * Tagging by date/tag:: The cvs rtag command
3658 * Modifying tags:: Adding, renaming, and deleting tags
3659 * Tagging add/remove:: Tags with adding and removing files
3660 * Sticky tags:: Certain tags are persistent
3661 @end menu
3662
3663 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3664 @node Revision numbers
3665 @section Revision numbers
3666 @cindex Revision numbers
3667 @cindex Revision tree
3668 @cindex Linear development
3669 @cindex Number, revision-
3670 @cindex Decimal revision number
3671 @cindex Branch number
3672 @cindex Number, branch
3673
3674 Each version of a file has a unique @dfn{revision
3675 number}. Revision numbers look like @samp{1.1},
3676 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
3677 A revision number always has an even number of
3678 period-separated decimal integers. By default revision
3679 1.1 is the first revision of a file. Each successive
3680 revision is given a new number by increasing the
3681 rightmost number by one. The following figure displays
3682 a few revisions, with newer revisions to the right.
3683
3684 @example
3685 +-----+ +-----+ +-----+ +-----+ +-----+
3686 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
3687 +-----+ +-----+ +-----+ +-----+ +-----+
3688 @end example
3689
3690 It is also possible to end up with numbers containing
3691 more than one period, for example @samp{1.3.2.2}. Such
3692 revisions represent revisions on branches
3693 (@pxref{Branching and merging}); such revision numbers
3694 are explained in detail in @ref{Branches and
3695 revisions}.
3696
3697 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3698 @node Versions revisions releases
3699 @section Versions, revisions and releases
3700 @cindex Revisions, versions and releases
3701 @cindex Versions, revisions and releases
3702 @cindex Releases, revisions and versions
3703
3704 A file can have several versions, as described above.
3705 Likewise, a software product can have several versions.
3706 A software product is often given a version number such
3707 as @samp{4.1.1}.
3708
3709 Versions in the first sense are called @dfn{revisions}
3710 in this document, and versions in the second sense are
3711 called @dfn{releases}. To avoid confusion, the word
3712 @dfn{version} is almost never used in this document.
3713
3714 @node Assigning revisions
3715 @section Assigning revisions
3716
3717 @c We avoid the "major revision" terminology. It seems
3718 @c like jargon. Hopefully "first number" is clear enough.
3719 @c
3720 @c Well, in the context of software release numbers,
3721 @c "major" and "minor" release or version numbers are
3722 @c documented in at least the GNU Coding Standards, but I'm
3723 @c still not sure I find that a valid reason to apply the
3724 @c terminology to RCS revision numbers. "First", "Second",
3725 @c "subsequent", and so on is almost surely clearer,
3726 @c especially to a novice reader. -DRP
3727 By default, @sc{cvs} will assign numeric revisions by
3728 leaving the first number the same and incrementing the
3729 second number. For example, @code{1.1}, @code{1.2},
3730 @code{1.3}, etc.
3731
3732 When adding a new file, the second number will always
3733 be one and the first number will equal the highest
3734 first number of any file in that directory. For
3735 example, the current directory contains files whose
3736 highest numbered revisions are @code{1.7}, @code{3.1},
3737 and @code{4.12}, then an added file will be given the
3738 numeric revision @code{4.1}.
3739 (When using client/server @sc{cvs},
3740 only files that are actually sent to the server are considered.)
3741
3742 @c This is sort of redundant with something we said a
3743 @c while ago. Somewhere we need a better way of
3744 @c introducing how the first number can be anything
3745 @c except "1", perhaps. Also I don't think this
3746 @c presentation is clear on why we are discussing releases
3747 @c and first numbers of numeric revisions in the same
3748 @c breath.
3749 Normally there is no reason to care
3750 about the revision numbers---it is easier to treat them
3751 as internal numbers that @sc{cvs} maintains, and tags
3752 provide a better way to distinguish between things like
3753 release 1 versus release 2 of your product
3754 (@pxref{Tags}). However, if you want to set the
3755 numeric revisions, the @samp{-r} option to @code{cvs
3756 commit} can do that. The @samp{-r} option implies the
3757 @samp{-f} option, in the sense that it causes the
3758 files to be committed even if they are not modified.
3759
3760 For example, to bring all your files up to
3761 revision 3.0 (including those that haven't changed),
3762 you might invoke:
3763
3764 @example
3765 $ cvs commit -r 3.0
3766 @end example
3767
3768 Note that the number you specify with @samp{-r} must be
3769 larger than any existing revision number. That is, if
3770 revision 3.0 exists, you cannot @samp{cvs commit
3771 -r 1.3}. If you want to maintain several releases in
3772 parallel, you need to use a branch (@pxref{Branching and merging}).
3773
3774 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3775 @node Tags
3776 @section Tags--Symbolic revisions
3777 @cindex Tags
3778
3779 The revision numbers live a life of their own. They
3780 need not have anything at all to do with the release
3781 numbers of your software product. Depending
3782 on how you use @sc{cvs} the revision numbers might change several times
3783 between two releases. As an example, some of the
3784 source files that make up @sc{rcs} 5.6 have the following
3785 revision numbers:
3786 @cindex RCS revision numbers
3787
3788 @example
3789 ci.c 5.21
3790 co.c 5.9
3791 ident.c 5.3
3792 rcs.c 5.12
3793 rcsbase.h 5.11
3794 rcsdiff.c 5.10
3795 rcsedit.c 5.11
3796 rcsfcmp.c 5.9
3797 rcsgen.c 5.10
3798 rcslex.c 5.11
3799 rcsmap.c 5.2
3800 rcsutil.c 5.10
3801 @end example
3802
3803 @cindex tag (subcommand), introduction
3804 @cindex Tags, symbolic name
3805 @cindex Symbolic name (tag)
3806 @cindex Name, symbolic (tag)
3807 @cindex HEAD, as reserved tag name
3808 @cindex BASE, as reserved tag name
3809 You can use the @code{tag} command to give a symbolic name to a
3810 certain revision of a file. You can use the @samp{-v} flag to the
3811 @code{status} command to see all tags that a file has, and
3812 which revision numbers they represent. Tag names must
3813 start with an uppercase or lowercase letter and can
3814 contain uppercase and lowercase letters, digits,
3815 @samp{-}, and @samp{_}. The two tag names @code{BASE}
3816 and @code{HEAD} are reserved for use by @sc{cvs}. It
3817 is expected that future names which are special to
3818 @sc{cvs} will be specially named, for example by
3819 starting with @samp{.}, rather than being named analogously to
3820 @code{BASE} and @code{HEAD}, to avoid conflicts with
3821 actual tag names.
3822 @c Including a character such as % or = has also been
3823 @c suggested as the naming convention for future
3824 @c special tag names. Starting with . is nice because
3825 @c that is not a legal tag name as far as RCS is concerned.
3826 @c FIXME: CVS actually accepts quite a few characters
3827 @c in tag names, not just the ones documented above
3828 @c (see RCS_check_tag). RCS
3829 @c defines legitimate tag names by listing illegal
3830 @c characters rather than legal ones. CVS is said to lose its
3831 @c mind if you try to use "/" (try making such a tag sticky
3832 @c and using "cvs status" client/server--see remote
3833 @c protocol format for entries line for probable cause).
3834 @c TODO: The testsuite
3835 @c should test for whatever are documented above as
3836 @c officially-OK tag names, and CVS should at least reject
3837 @c characters that won't work, like "/".
3838
3839 You'll want to choose some convention for naming tags,
3840 based on information such as the name of the program
3841 and the version number of the release. For example,
3842 one might take the name of the program, immediately
3843 followed by the version number with @samp{.} changed to
3844 @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
3845 @code{cvs1-9}. If you choose a consistent convention,
3846 then you won't constantly be guessing whether a tag is
3847 @code{cvs-1-9} or @code{cvs1_9} or what. You might
3848 even want to consider enforcing your convention in the
3849 @file{taginfo} file (@pxref{taginfo}).
3850 @c Might be nice to say more about using taginfo this
3851 @c way, like giving an example, or pointing out any particular
3852 @c issues which arise.
3853
3854 @cindex Adding a tag
3855 @cindex Tags, example
3856 The following example shows how you can add a tag to a
3857 file. The commands must be issued inside your working
3858 directory. That is, you should issue the
3859 command in the directory where @file{backend.c}
3860 resides.
3861
3862 @example
3863 $ cvs tag rel-0-4 backend.c
3864 T backend.c
3865 $ cvs status -v backend.c
3866 ===================================================================
3867 File: backend.c Status: Up-to-date
3868
3869 Version: 1.4 Tue Dec 1 14:39:01 1992
3870 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v
3871 Sticky Tag: (none)
3872 Sticky Date: (none)
3873 Sticky Options: (none)
3874
3875 Existing Tags:
3876 rel-0-4 (revision: 1.4)
3877
3878 @end example
3879
3880 For a complete summary of the syntax of @code{cvs tag},
3881 including the various options, see @ref{Invoking CVS}.
3882
3883 There is seldom reason to tag a file in isolation. A more common use is
3884 to tag all the files that constitute a module with the same tag at
3885 strategic points in the development life-cycle, such as when a release
3886 is made.
3887
3888 @example
3889 $ cvs tag rel-1-0 .
3890 cvs tag: Tagging .
3891 T Makefile
3892 T backend.c
3893 T driver.c
3894 T frontend.c
3895 T parser.c
3896 @end example
3897
3898 @noindent
3899 (When you give @sc{cvs} a directory as argument, it generally applies the
3900 operation to all the files in that directory, and (recursively), to any
3901 subdirectories that it may contain. @xref{Recursive behavior}.)
3902
3903 @cindex Retrieving an old revision using tags
3904 @cindex Tags, retrieving old revisions
3905 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
3906 a certain revision of a module. This flag makes it easy to
3907 retrieve the sources that make up release 1.0 of the module @samp{tc} at
3908 any time in the future:
3909
3910 @example
3911 $ cvs checkout -r rel-1-0 tc
3912 @end example
3913
3914 @noindent
3915 This is useful, for instance, if someone claims that there is a bug in
3916 that release, but you cannot find the bug in the current working copy.
3917
3918 You can also check out a module as it was on any branch at any given date.
3919 @xref{checkout options}. When specifying @samp{-r} or @samp{-D} to
3920 any of these commands, you will need beware of sticky
3921 tags; see @ref{Sticky tags}.
3922
3923 When you tag more than one file with the same tag you
3924 can think about the tag as "a curve drawn through a
3925 matrix of filename vs. revision number." Say we have 5
3926 files with the following revisions:
3927
3928 @example
3929 @group
3930 file1 file2 file3 file4 file5
3931
3932 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG
3933 1.2*- 1.2 1.2 -1.2*-
3934 1.3 \- 1.3*- 1.3 / 1.3
3935 1.4 \ 1.4 / 1.4
3936 \-1.5*- 1.5
3937 1.6
3938 @end group
3939 @end example
3940
3941 At some time in the past, the @code{*} versions were tagged.
3942 You can think of the tag as a handle attached to the curve
3943 drawn through the tagged revisions. When you pull on
3944 the handle, you get all the tagged revisions. Another
3945 way to look at it is that you "sight" through a set of
3946 revisions that is "flat" along the tagged revisions,
3947 like this:
3948
3949 @example
3950 @group
3951 file1 file2 file3 file4 file5
3952
3953 1.1
3954 1.2
3955 1.1 1.3 _
3956 1.1 1.2 1.4 1.1 /
3957 1.2*----1.3*----1.5*----1.2*----1.1* (--- <--- Look here
3958 1.3 1.6 1.3 \_
3959 1.4 1.4
3960 1.5
3961 @end group
3962 @end example
3963
3964 @node Tagging the working directory
3965 @section Specifying what to tag from the working directory
3966
3967 @cindex tag (subcommand)
3968 The example in the previous section demonstrates one of
3969 the most common ways to choose which revisions to tag.
3970 Namely, running the @code{cvs tag} command without
3971 arguments causes @sc{cvs} to select the revisions which
3972 are checked out in the current working directory. For
3973 example, if the copy of @file{backend.c} in working
3974 directory was checked out from revision 1.4, then
3975 @sc{cvs} will tag revision 1.4. Note that the tag is
3976 applied immediately to revision 1.4 in the repository;
3977 tagging is not like modifying a file, or other
3978 operations in which one first modifies the working
3979 directory and then runs @code{cvs commit} to transfer
3980 that modification to the repository.
3981
3982 One potentially surprising aspect of the fact that
3983 @code{cvs tag} operates on the repository is that you
3984 are tagging the checked-in revisions, which may differ
3985 from locally modified files in your working directory.
3986 If you want to avoid doing this by mistake, specify the
3987 @samp{-c} option to @code{cvs tag}. If there are any
3988 locally modified files, @sc{cvs} will abort with an
3989 error before it tags any files:
3990
3991 @example
3992 $ cvs tag -c rel-0-4
3993 cvs tag: backend.c is locally modified
3994 cvs [tag aborted]: correct the above errors first!
3995 @end example
3996
3997 @node Tagging by date/tag
3998 @section Specifying what to tag by date or revision
3999 @cindex rtag (subcommand)
4000
4001 The @code{cvs rtag} command tags the repository as of a
4002 certain date or time (or can be used to tag the latest
4003 revision). @code{rtag} works directly on the
4004 repository contents (it requires no prior checkout and
4005 does not look for a working directory).
4006
4007 The following options specify which date or revision to
4008 tag. See @ref{Common options}, for a complete
4009 description of them.
4010
4011 @table @code
4012 @item -D @var{date}
4013 Tag the most recent revision no later than @var{date}.
4014
4015 @item -f
4016 Only useful with the @samp{-D} or @samp{-r}
4017 flags. If no matching revision is found, use the most
4018 recent revision (instead of ignoring the file).
4019
4020 @item -r @var{tag}[:@var{date}]
4021 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
4022 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
4023 existed on @var{date}. See @ref{Common options}.
4024 @end table
4025
4026 The @code{cvs tag} command also allows one to specify
4027 files by revision or date, using the same @samp{-r},
4028 @samp{-D}, and @samp{-f} options. However, this
4029 feature is probably not what you want. The reason is
4030 that @code{cvs tag} chooses which files to tag based on
4031 the files that exist in the working directory, rather
4032 than the files which existed as of the given tag/date.
4033 Therefore, you are generally better off using @code{cvs
4034 rtag}. The exceptions might be cases like:
4035
4036 @example
4037 cvs tag -r 1.4 stable backend.c
4038 @end example
4039
4040 @node Modifying tags
4041 @section Deleting, moving, and renaming tags
4042
4043 @c Also see:
4044 @c "How do I move or rename a magic branch tag?"
4045 @c in the FAQ (I think the issues it talks about still
4046 @c apply, but this could use some sanity.sh work).
4047
4048 Normally one does not modify tags. They exist in order
4049 to record the history of the repository and so deleting
4050 them or changing their meaning would, generally, not be
4051 what you want.
4052
4053 However, there might be cases in which one uses a tag
4054 temporarily or accidentally puts one in the wrong
4055 place. Therefore, one might delete, move, or rename a
4056 tag.
4057
4058 @noindent
4059 @emph{WARNING: the commands in this section are
4060 dangerous; they permanently discard historical
4061 information and it can be difficult or impossible to
4062 recover from errors. If you are a @sc{cvs}
4063 administrator, you may consider restricting these
4064 commands with the @file{taginfo} file (@pxref{taginfo}).}
4065
4066 @cindex Deleting tags
4067 @cindex Deleting branch tags
4068 @cindex Removing tags
4069 @cindex Removing branch tags
4070 @cindex Tags, deleting
4071 @cindex Branch tags, deleting
4072 To delete a tag, specify the @samp{-d} option to either
4073 @code{cvs tag} or @code{cvs rtag}. For example:
4074
4075 @example
4076 cvs rtag -d rel-0-4 tc
4077 @end example
4078
4079 @noindent
4080 deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
4081 In the event that branch tags are encountered within the repository
4082 with the given name, a warning message will be issued and the branch
4083 tag will not be deleted. If you are absolutely certain you know what
4084 you are doing, the @code{-B} option may be specified to allow deletion
4085 of branch tags. In that case, any non-branch tags encountered will
4086 trigger warnings and will not be deleted.
4087
4088 @noindent
4089 @emph{WARNING: Moving branch tags is very dangerous! If you think
4090 you need the @code{-B} option, think again and ask your @sc{cvs}
4091 administrator about it (if that isn't you). There is almost certainly
4092 another way to accomplish what you want to accomplish.}
4093
4094 @cindex Moving tags
4095 @cindex Moving branch tags
4096 @cindex Tags, moving
4097 @cindex Branch tags, moving
4098 When we say @dfn{move} a tag, we mean to make the same
4099 name point to different revisions. For example, the
4100 @code{stable} tag may currently point to revision 1.4
4101 of @file{backend.c} and perhaps we want to make it
4102 point to revision 1.6. To move a non-branch tag, specify the
4103 @samp{-F} option to either @code{cvs tag} or @code{cvs
4104 rtag}. For example, the task just mentioned might be
4105 accomplished as:
4106
4107 @example
4108 cvs tag -r 1.6 -F stable backend.c
4109 @end example
4110
4111 @noindent
4112 If any branch tags are encountered in the repository
4113 with the given name, a warning is issued and the branch
4114 tag is not disturbed. If you are absolutely certain you
4115 wish to move the branch tag, the @code{-B} option may be specified.
4116 In that case, non-branch tags encountered with the given
4117 name are ignored with a warning message.
4118
4119 @noindent
4120 @emph{WARNING: Moving branch tags is very dangerous! If you think you
4121 need the @code{-B} option, think again and ask your @sc{cvs}
4122 administrator about it (if that isn't you). There is almost certainly
4123 another way to accomplish what you want to accomplish.}
4124
4125 @cindex Renaming tags
4126 @cindex Tags, renaming
4127 When we say @dfn{rename} a tag, we mean to make a
4128 different name point to the same revisions as the old
4129 tag. For example, one may have misspelled the tag name
4130 and want to correct it (hopefully before others are
4131 relying on the old spelling). To rename a tag, first
4132 create a new tag using the @samp{-r} option to
4133 @code{cvs rtag}, and then delete the old name. (Caution:
4134 this method will not work with branch tags.)
4135 This leaves the new tag on exactly the
4136 same files as the old tag. For example:
4137
4138 @example
4139 cvs rtag -r old-name-0-4 rel-0-4 tc
4140 cvs rtag -d old-name-0-4 tc
4141 @end example
4142
4143 @node Tagging add/remove
4144 @section Tagging and adding and removing files
4145
4146 The subject of exactly how tagging interacts with
4147 adding and removing files is somewhat obscure; for the
4148 most part @sc{cvs} will keep track of whether files
4149 exist or not without too much fussing. By default,
4150 tags are applied to only files which have a revision
4151 corresponding to what is being tagged. Files which did
4152 not exist yet, or which were already removed, simply
4153 omit the tag, and @sc{cvs} knows to treat the absence
4154 of a tag as meaning that the file didn't exist as of
4155 that tag.
4156
4157 However, this can lose a small amount of information.
4158 For example, suppose a file was added and then removed.
4159 Then, if the tag is missing for that file, there is no
4160 way to know whether the tag refers to the time before
4161 the file was added, or the time after it was removed.
4162 If you specify the @samp{-r} option to @code{cvs rtag},
4163 then @sc{cvs} tags the files which have been removed,
4164 and thereby avoids this problem. For example, one
4165 might specify @code{-r HEAD} to tag the head.
4166
4167 On the subject of adding and removing files, the
4168 @code{cvs rtag} command has a @samp{-a} option which
4169 means to clear the tag from removed files that would
4170 not otherwise be tagged. For example, one might
4171 specify this option in conjunction with @samp{-F} when
4172 moving a tag. If one moved a tag without @samp{-a},
4173 then the tag in the removed files might still refer to
4174 the old revision, rather than reflecting the fact that
4175 the file had been removed. I don't think this is
4176 necessary if @samp{-r} is specified, as noted above.
4177
4178 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4179 @node Sticky tags
4180 @section Sticky tags
4181 @cindex Sticky tags
4182 @cindex Tags, sticky
4183
4184 @c A somewhat related issue is per-directory sticky
4185 @c tags (see comment at CVS/Tag in node Working
4186 @c directory storage); we probably want to say
4187 @c something like "you can set a sticky tag for only
4188 @c some files, but you don't want to" or some such.
4189
4190 Sometimes a working copy's revision has extra data
4191 associated with it, for example it might be on a branch
4192 (@pxref{Branching and merging}), or restricted to
4193 versions prior to a certain date by @samp{checkout -D}
4194 or @samp{update -D}. Because this data persists --
4195 that is, it applies to subsequent commands in the
4196 working copy -- we refer to it as @dfn{sticky}.
4197
4198 Most of the time, stickiness is an obscure aspect of
4199 @sc{cvs} that you don't need to think about. However,
4200 even if you don't want to use the feature, you may need
4201 to know @emph{something} about sticky tags (for
4202 example, how to avoid them!).
4203
4204 You can use the @code{status} command to see if any
4205 sticky tags or dates are set:
4206
4207 @example
4208 $ cvs status driver.c
4209 ===================================================================
4210 File: driver.c Status: Up-to-date
4211
4212 Version: 1.7.2.1 Sat Dec 5 19:35:03 1992
4213 RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
4214 Sticky Tag: rel-1-0-patches (branch: 1.7.2)
4215 Sticky Date: (none)
4216 Sticky Options: (none)
4217
4218 @end example
4219
4220 @cindex Resetting sticky tags
4221 @cindex Sticky tags, resetting
4222 @cindex Deleting sticky tags
4223 The sticky tags will remain on your working files until
4224 you delete them with @samp{cvs update -A}. The
4225 @samp{-A} option merges local changes into the version of the
4226 file from the head of the trunk, removing any sticky tags,
4227 dates, or options. See @ref{update} for more on the operation
4228 of @code{cvs update}.
4229
4230 @cindex Sticky date
4231 The most common use of sticky tags is to identify which
4232 branch one is working on, as described in
4233 @ref{Accessing branches}. However, non-branch
4234 sticky tags have uses as well. For example,
4235 suppose that you want to avoid updating your working
4236 directory, to isolate yourself from possibly
4237 destabilizing changes other people are making. You
4238 can, of course, just refrain from running @code{cvs
4239 update}. But if you want to avoid updating only a
4240 portion of a larger tree, then sticky tags can help.
4241 If you check out a certain revision (such as 1.4) it
4242 will become sticky. Subsequent @code{cvs update}
4243 commands will
4244 not retrieve the latest revision until you reset the
4245 tag with @code{cvs update -A}. Likewise, use of the
4246 @samp{-D} option to @code{update} or @code{checkout}
4247 sets a @dfn{sticky date}, which, similarly, causes that
4248 date to be used for future retrievals.
4249
4250 People often want to retrieve an old version of
4251 a file without setting a sticky tag. This can
4252 be done with the @samp{-p} option to @code{checkout} or
4253 @code{update}, which sends the contents of the file to
4254 standard output. For example:
4255 @example
4256 $ cvs update -p -r 1.1 file1 >file1
4257 ===================================================================
4258 Checking out file1
4259 RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
4260 VERS: 1.1
4261 ***************
4262 $
4263 @end example
4264
4265 However, this isn't the easiest way, if you are asking
4266 how to undo a previous checkin (in this example, put
4267 @file{file1} back to the way it was as of revision
4268 1.1). In that case you are better off using the
4269 @samp{-j} option to @code{update}; for further
4270 discussion see @ref{Merging two revisions}.
4271
4272 @c ---------------------------------------------------------------------
4273 @node Branching and merging
4274 @chapter Branching and merging
4275 @cindex Branching
4276 @cindex Merging
4277 @cindex Copying changes
4278 @cindex Main trunk and branches
4279 @cindex Revision tree, making branches
4280 @cindex Branches, copying changes between
4281 @cindex Changes, copying between branches
4282 @cindex Modifications, copying between branches
4283
4284 @sc{cvs} allows you to isolate changes onto a separate
4285 line of development, known as a @dfn{branch}. When you
4286 change files on a branch, those changes do not appear
4287 on the main trunk or other branches.
4288
4289 Later you can move changes from one branch to another
4290 branch (or the main trunk) by @dfn{merging}. Merging
4291 involves first running @code{cvs update -j}, to merge
4292 the changes into the working directory.
4293 You can then commit that revision, and thus effectively
4294 copy the changes onto another branch.
4295
4296 @menu
4297 * Branches motivation:: What branches are good for
4298 * Creating a branch:: Creating a branch
4299 * Accessing branches:: Checking out and updating branches
4300 * Branches and revisions:: Branches are reflected in revision numbers
4301 * Magic branch numbers:: Magic branch numbers
4302 * Merging a branch:: Merging an entire branch
4303 * Merging more than once:: Merging from a branch several times
4304 * Merging two revisions:: Merging differences between two revisions
4305 * Merging adds and removals:: What if files are added or removed?
4306 * Merging and keywords:: Avoiding conflicts due to keyword substitution
4307 @end menu
4308
4309 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4310 @node Branches motivation
4311 @section What branches are good for
4312 @cindex Branches motivation
4313 @cindex What branches are good for
4314 @cindex Motivation for branches
4315
4316 @c FIXME: this node mentions one way to use branches,
4317 @c but it is by no means the only way. For example,
4318 @c the technique of committing a new feature on a branch,
4319 @c until it is ready for the main trunk. The whole
4320 @c thing is generally speaking more akin to the
4321 @c "Revision management" node although it isn't clear to
4322 @c me whether policy matters should be centralised or
4323 @c distributed throughout the relevant sections.
4324 Suppose that release 1.0 of tc has been made. You are continuing to
4325 develop tc, planning to create release 1.1 in a couple of months. After a
4326 while your customers start to complain about a fatal bug. You check
4327 out release 1.0 (@pxref{Tags}) and find the bug
4328 (which turns out to have a trivial fix). However, the current revision
4329 of the sources are in a state of flux and are not expected to be stable
4330 for at least another month. There is no way to make a
4331 bug fix release based on the newest sources.
4332
4333 The thing to do in a situation like this is to create a @dfn{branch} on
4334 the revision trees for all the files that make up
4335 release 1.0 of tc. You can then make
4336 modifications to the branch without disturbing the main trunk. When the
4337 modifications are finished you can elect to either incorporate them on
4338 the main trunk, or leave them on the branch.
4339
4340 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4341 @node Creating a branch
4342 @section Creating a branch
4343 @cindex Creating a branch
4344 @cindex Branch, creating a
4345 @cindex tag (subcommand), creating a branch using
4346 @cindex rtag (subcommand), creating a branch using
4347
4348 You can create a branch with @code{tag -b}; for
4349 example, assuming you're in a working copy:
4350
4351 @example
4352 $ cvs tag -b rel-1-0-patches
4353 @end example
4354
4355 @c FIXME: we should be more explicit about the value of
4356 @c having a tag on the branchpoint. For example
4357 @c "cvs tag rel-1-0-patches-branchpoint" before
4358 @c the "cvs tag -b". This points out that
4359 @c rel-1-0-patches is a pretty awkward name for
4360 @c this example (more so than for the rtag example
4361 @c below).
4362
4363 This splits off a branch based on the current revisions
4364 in the working copy, assigning that branch the name
4365 @samp{rel-1-0-patches}.
4366
4367 It is important to understand that branches get created
4368 in the repository, not in the working copy. Creating a
4369 branch based on current revisions, as the above example
4370 does, will @emph{not} automatically switch the working
4371 copy to be on the new branch. For information on how
4372 to do that, see @ref{Accessing branches}.
4373
4374 You can also create a branch without reference to any
4375 working copy, by using @code{rtag}:
4376
4377 @example
4378 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
4379 @end example
4380
4381 @samp{-r rel-1-0} says that this branch should be
4382 rooted at the revision that
4383 corresponds to the tag @samp{rel-1-0}. It need not
4384 be the most recent revision -- it's often useful to
4385 split a branch off an old revision (for example, when
4386 fixing a bug in a past release otherwise known to be
4387 stable).
4388
4389 As with @samp{tag}, the @samp{-b} flag tells
4390 @code{rtag} to create a branch (rather than just a
4391 symbolic revision name). Note that the numeric
4392 revision number that matches @samp{rel-1-0} will
4393 probably be different from file to file.
4394
4395 So, the full effect of the command is to create a new
4396 branch -- named @samp{rel-1-0-patches} -- in module
4397 @samp{tc}, rooted in the revision tree at the point tagged
4398 by @samp{rel-1-0}.
4399
4400 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4401 @node Accessing branches
4402 @section Accessing branches
4403 @cindex Check out a branch
4404 @cindex Retrieve a branch
4405 @cindex Access a branch
4406 @cindex Identifying a branch
4407 @cindex Branch, check out
4408 @cindex Branch, retrieving
4409 @cindex Branch, accessing
4410 @cindex Branch, identifying
4411
4412 You can retrieve a branch in one of two ways: by
4413 checking it out fresh from the repository, or by
4414 switching an existing working copy over to the branch.
4415
4416 To check out a branch from the repository, invoke
4417 @samp{checkout} with the @samp{-r} flag, followed by
4418 the tag name of the branch (@pxref{Creating a branch}):
4419
4420 @example
4421 $ cvs checkout -r rel-1-0-patches tc
4422 @end example
4423
4424 Or, if you already have a working copy, you can switch
4425 it to a given branch with @samp{update -r}:
4426
4427 @example
4428 $ cvs update -r rel-1-0-patches tc
4429 @end example
4430
4431 @noindent
4432 or equivalently:
4433
4434 @example
4435 $ cd tc
4436 $ cvs update -r rel-1-0-patches
4437 @end example
4438
4439 It does not matter if the working copy was originally
4440 on the main trunk or on some other branch -- the above
4441 command will switch it to the named branch. And
4442 similarly to a regular @samp{update} command,
4443 @samp{update -r} merges any changes you have made,
4444 notifying you of conflicts where they occur.
4445
4446 Once you have a working copy tied to a particular
4447 branch, it remains there until you tell it otherwise.
4448 This means that changes checked in from the working
4449 copy will add new revisions on that branch, while
4450 leaving the main trunk and other branches unaffected.
4451
4452 @cindex Branches, sticky
4453 To find out what branch a working copy is on, you can
4454 use the @samp{status} command. In its output, look for
4455 the field named @samp{Sticky tag} (@pxref{Sticky tags})
4456 -- that's @sc{cvs}'s way of telling you the branch, if
4457 any, of the current working files:
4458
4459 @example
4460 $ cvs status -v driver.c backend.c
4461 ===================================================================
4462 File: driver.c Status: Up-to-date
4463
4464 Version: 1.7 Sat Dec 5 18:25:54 1992
4465 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v
4466 Sticky Tag: rel-1-0-patches (branch: 1.7.2)
4467 Sticky Date: (none)
4468 Sticky Options: (none)
4469
4470 Existing Tags:
4471 rel-1-0-patches (branch: 1.7.2)
4472 rel-1-0 (revision: 1.7)
4473
4474 ===================================================================
4475 File: backend.c Status: Up-to-date
4476
4477 Version: 1.4 Tue Dec 1 14:39:01 1992
4478 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v
4479 Sticky Tag: rel-1-0-patches (branch: 1.4.2)
4480 Sticky Date: (none)
4481 Sticky Options: (none)
4482
4483 Existing Tags:
4484 rel-1-0-patches (branch: 1.4.2)
4485 rel-1-0 (revision: 1.4)
4486 rel-0-4 (revision: 1.4)
4487
4488 @end example
4489
4490 Don't be confused by the fact that the branch numbers
4491 for each file are different (@samp{1.7.2} and
4492 @samp{1.4.2} respectively). The branch tag is the
4493 same, @samp{rel-1-0-patches}, and the files are
4494 indeed on the same branch. The numbers simply reflect
4495 the point in each file's revision history at which the
4496 branch was made. In the above example, one can deduce
4497 that @samp{driver.c} had been through more changes than
4498 @samp{backend.c} before this branch was created.
4499
4500 See @ref{Branches and revisions} for details about how
4501 branch numbers are constructed.
4502
4503 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4504 @node Branches and revisions
4505 @section Branches and revisions
4506 @cindex Branch number
4507 @cindex Number, branch
4508 @cindex Revision numbers (branches)
4509
4510 Ordinarily, a file's revision history is a linear
4511 series of increments (@pxref{Revision numbers}):
4512
4513 @example
4514 +-----+ +-----+ +-----+ +-----+ +-----+
4515 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
4516 +-----+ +-----+ +-----+ +-----+ +-----+
4517 @end example
4518
4519 However, @sc{cvs} is not limited to linear development. The
4520 @dfn{revision tree} can be split into @dfn{branches},
4521 where each branch is a self-maintained line of
4522 development. Changes made on one branch can easily be
4523 moved back to the main trunk.
4524
4525 Each branch has a @dfn{branch number}, consisting of an
4526 odd number of period-separated decimal integers. The
4527 branch number is created by appending an integer to the
4528 revision number where the corresponding branch forked
4529 off. Having branch numbers allows more than one branch
4530 to be forked off from a certain revision.
4531
4532 @need 3500
4533 All revisions on a branch have revision numbers formed
4534 by appending an ordinal number to the branch number.
4535 The following figure illustrates branching with an
4536 example.
4537
4538 @example
4539 @c This example used to have a 1.2.2.4 revision, which
4540 @c might help clarify that development can continue on
4541 @c 1.2.2. Might be worth reinstating if it can be done
4542 @c without overfull hboxes.
4543 @group
4544 +-------------+
4545 Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 !
4546 / +-------------+
4547 /
4548 /
4549 +---------+ +---------+ +---------+
4550 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4551 / +---------+ +---------+ +---------+
4552 /
4553 /
4554 +-----+ +-----+ +-----+ +-----+ +-----+
4555 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
4556 +-----+ +-----+ +-----+ +-----+ +-----+
4557 !
4558 !
4559 ! +---------+ +---------+ +---------+
4560 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
4561 +---------+ +---------+ +---------+
4562
4563 @end group
4564 @end example
4565
4566 @c -- However, at least for me the figure is not enough. I suggest more
4567 @c -- text to accompany it. "A picture is worth a thousand words", so you
4568 @c -- have to make sure the reader notices the couple of hundred words
4569 @c -- *you* had in mind more than the others!
4570
4571 @c -- Why an even number of segments? This section implies that this is
4572 @c -- how the main trunk is distinguished from branch roots, but you never
4573 @c -- explicitly say that this is the purpose of the [by itself rather
4574 @c -- surprising] restriction to an even number of segments.
4575
4576 The exact details of how the branch number is
4577 constructed is not something you normally need to be
4578 concerned about, but here is how it works: When
4579 @sc{cvs} creates a branch number it picks the first
4580 unused even integer, starting with 2. So when you want
4581 to create a branch from revision 6.4 it will be
4582 numbered 6.4.2. All branch numbers ending in a zero
4583 (such as 6.4.0) are used internally by @sc{cvs}
4584 (@pxref{Magic branch numbers}). The branch 1.1.1 has a
4585 special meaning. @xref{Tracking sources}.
4586
4587 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4588 @node Magic branch numbers
4589 @section Magic branch numbers
4590
4591 @c Want xref to here from "log"?
4592
4593 This section describes a @sc{cvs} feature called
4594 @dfn{magic branches}. For most purposes, you need not
4595 worry about magic branches; @sc{cvs} handles them for
4596 you. However, they are visible to you in certain
4597 circumstances, so it may be useful to have some idea of
4598 how it works.
4599
4600 Externally, branch numbers consist of an odd number of
4601 dot-separated decimal integers. @xref{Revision
4602 numbers}. That is not the whole truth, however. For
4603 efficiency reasons @sc{cvs} sometimes inserts an extra 0
4604 in the second rightmost position (1.2.4 becomes
4605 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
4606 on).
4607
4608 @sc{cvs} does a pretty good job at hiding these so
4609 called magic branches, but in a few places the hiding
4610 is incomplete:
4611
4612 @itemize @bullet
4613 @ignore
4614 @c This is in ignore as I'm taking their word for it,
4615 @c that this was fixed
4616 @c a long time ago. But before deleting this
4617 @c entirely, I'd rather verify it (and add a test
4618 @c case to the testsuite).
4619 @item
4620 The magic branch can appear in the output from
4621 @code{cvs status} in vanilla @sc{cvs} 1.3. This is
4622 fixed in @sc{cvs} 1.3-s2.
4623
4624 @end ignore
4625 @item
4626 The magic branch number appears in the output from
4627 @code{cvs log}.
4628 @c What output should appear instead?
4629
4630 @item
4631 You cannot specify a symbolic branch name to @code{cvs
4632 admin}.
4633
4634 @end itemize
4635
4636 @c Can CVS do this automatically the first time
4637 @c you check something in to that branch? Should
4638 @c it?
4639 You can use the @code{admin} command to reassign a
4640 symbolic name to a branch the way @sc{rcs} expects it
4641 to be. If @code{R4patches} is assigned to the branch
4642 1.4.2 (magic branch number 1.4.0.2) in file
4643 @file{numbers.c} you can do this:
4644
4645 @example
4646 $ cvs admin -NR4patches:1.4.2 numbers.c
4647 @end example
4648
4649 It only works if at least one revision is already
4650 committed on the branch. Be very careful so that you
4651 do not assign the tag to the wrong number. (There is
4652 no way to see how the tag was assigned yesterday).
4653
4654 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4655 @node Merging a branch
4656 @section Merging an entire branch
4657 @cindex Merging a branch
4658 @cindex -j (merging branches)
4659
4660 You can merge changes made on a branch into your working copy by giving
4661 the @samp{-j @var{branchname}} flag to the @code{update} subcommand. With one
4662 @samp{-j @var{branchname}} option it merges the changes made between the
4663 greatest common ancestor (GCA) of the branch and the destination revision (in
4664 the simple case below the GCA is the point where the branch forked) and the
4665 newest revision on that branch into your working copy.
4666
4667 @cindex Join
4668 The @samp{-j} stands for ``join''.
4669
4670 @cindex Branch merge example
4671 @cindex Example, branch merge
4672 @cindex Merge, branch example
4673 Consider this revision tree:
4674
4675 @example
4676 +-----+ +-----+ +-----+ +-----+
4677 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk
4678 +-----+ +-----+ +-----+ +-----+
4679 !
4680 !
4681 ! +---------+ +---------+
4682 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4683 +---------+ +---------+
4684 @end example
4685
4686 @noindent
4687 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}. The
4688 following example assumes that the module @samp{mod} contains only one
4689 file, @file{m.c}.
4690
4691 @example
4692 $ cvs checkout mod # @r{Retrieve the latest revision, 1.4}
4693
4694 $ cvs update -j R1fix m.c # @r{Merge all changes made on the branch,}
4695 # @r{i.e. the changes between revision 1.2}
4696 # @r{and 1.2.2.2, into your working copy}
4697 # @r{of the file.}
4698
4699 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
4700 @end example
4701
4702 A conflict can result from a merge operation. If that
4703 happens, you should resolve it before committing the
4704 new revision. @xref{Conflicts example}.
4705
4706 If your source files contain keywords (@pxref{Keyword substitution}),
4707 you might be getting more conflicts than strictly necessary. See
4708 @ref{Merging and keywords}, for information on how to avoid this.
4709
4710 The @code{checkout} command also supports the @samp{-j @var{branchname}} flag. The
4711 same effect as above could be achieved with this:
4712
4713 @example
4714 $ cvs checkout -j R1fix mod
4715 $ cvs commit -m "Included R1fix"
4716 @end example
4717
4718 It should be noted that @code{update -j @var{tagname}} will also work but may
4719 not produce the desired result. @xref{Merging adds and removals}, for more.
4720
4721 @node Merging more than once
4722 @section Merging from a branch several times
4723
4724 Continuing our example, the revision tree now looks
4725 like this:
4726
4727 @example
4728 +-----+ +-----+ +-----+ +-----+ +-----+
4729 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
4730 +-----+ +-----+ +-----+ +-----+ +-----+
4731 ! *
4732 ! *
4733 ! +---------+ +---------+
4734 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
4735 +---------+ +---------+
4736 @end example
4737
4738 @noindent
4739 where the starred line represents the merge from the
4740 @samp{R1fix} branch to the main trunk, as just
4741 discussed.
4742
4743 Now suppose that development continues on the
4744 @samp{R1fix} branch:
4745
4746 @example
4747 +-----+ +-----+ +-----+ +-----+ +-----+
4748 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
4749 +-----+ +-----+ +-----+ +-----+ +-----+
4750 ! *
4751 ! *
4752 ! +---------+ +---------+ +---------+
4753 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
4754 +---------+ +---------+ +---------+
4755 @end example
4756
4757 @noindent
4758 and then you want to merge those new changes onto the
4759 main trunk. If you just use the @code{cvs update -j
4760 R1fix m.c} command again, @sc{cvs} will attempt to
4761 merge again the changes which you have already merged,
4762 which can have undesirable side effects.
4763
4764 So instead you need to specify that you only want to
4765 merge the changes on the branch which have not yet been
4766 merged into the trunk. To do that you specify two
4767 @samp{-j} options, and @sc{cvs} merges the changes from
4768 the first revision to the second revision. For
4769 example, in this case the simplest way would be
4770
4771 @example
4772 cvs update -j 1.2.2.2 -j R1fix m.c # @r{Merge changes from 1.2.2.2 to the}
4773 # @r{head of the R1fix branch}
4774 @end example
4775
4776 The problem with this is that you need to specify the
4777 1.2.2.2 revision manually. A slightly better approach
4778 might be to use the date the last merge was done:
4779
4780 @example
4781 cvs update -j R1fix:yesterday -j R1fix m.c
4782 @end example
4783
4784 Better yet, tag the R1fix branch after every merge into
4785 the trunk, and then use that tag for subsequent merges:
4786
4787 @example
4788 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
4789 @end example
4790
4791 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4792 @node Merging two revisions
4793 @section Merging differences between any two revisions
4794 @cindex Merging two revisions
4795 @cindex Revisions, merging differences between
4796 @cindex Differences, merging
4797
4798 With two @samp{-j @var{revision}} flags, the @code{update}
4799 (and @code{checkout}) command can merge the differences
4800 between any two revisions into your working file.
4801
4802 @cindex Undoing a change
4803 @cindex Removing a change
4804 @example
4805 $ cvs update -j 1.5 -j 1.3 backend.c
4806 @end example
4807
4808 @noindent
4809 will undo all changes made between revision
4810 1.3 and 1.5. Note the order of the revisions!
4811
4812 If you try to use this option when operating on
4813 multiple files, remember that the numeric revisions will
4814 probably be very different between the various files.
4815 You almost always use symbolic
4816 tags rather than revision numbers when operating on
4817 multiple files.
4818
4819 @cindex Restoring old version of removed file
4820 @cindex Resurrecting old version of dead file
4821 Specifying two @samp{-j} options can also undo file
4822 removals or additions. For example, suppose you have
4823 a file
4824 named @file{file1} which existed as revision 1.1, and
4825 you then removed it (thus adding a dead revision 1.2).
4826 Now suppose you want to add it again, with the same
4827 contents it had previously. Here is how to do it:
4828
4829 @example
4830 $ cvs update -j 1.2 -j 1.1 file1
4831 U file1
4832 $ cvs commit -m test
4833 Checking in file1;
4834 /tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1
4835 new revision: 1.3; previous revision: 1.2
4836 done
4837 $
4838 @end example
4839
4840 @node Merging adds and removals
4841 @section Merging can add or remove files
4842
4843 If the changes which you are merging involve removing
4844 or adding some files, @code{update -j} will reflect
4845 such additions or removals.
4846
4847 @c FIXME: This example needs a lot more explanation.
4848 @c We also need other examples for some of the other
4849 @c cases (not all--there are too many--as long as we present a
4850 @c coherent general principle).
4851 For example:
4852 @example
4853 cvs update -A
4854 touch a b c
4855 cvs add a b c ; cvs ci -m "added" a b c
4856 cvs tag -b branchtag
4857 cvs update -r branchtag
4858 touch d ; cvs add d
4859 rm a ; cvs rm a
4860 cvs ci -m "added d, removed a"
4861 cvs update -A
4862 cvs update -jbranchtag
4863 @end example
4864
4865 After these commands are executed and a @samp{cvs commit} is done,
4866 file @file{a} will be removed and file @file{d} added in the main branch.
4867 @c (which was determined by trying it)
4868
4869 Note that using a single static tag (@samp{-j @var{tagname}})
4870 rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
4871 changes from a branch will usually not remove files which were removed on the
4872 branch since @sc{cvs} does not automatically add static tags to dead revisions.
4873 The exception to this rule occurs when
4874 a static tag has been attached to a dead revision manually. Use the branch tag
4875 to merge all changes from the branch or use two static tags as merge endpoints
4876 to be sure that all intended changes are propagated in the merge.
4877
4878 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4879 @node Merging and keywords
4880 @section Merging and keywords
4881 @cindex Merging, and keyword substitution
4882 @cindex Keyword substitution, and merging
4883 @cindex -j (merging branches), and keyword substitution
4884 @cindex -kk, to avoid conflicts during a merge
4885
4886 If you merge files containing keywords (@pxref{Keyword
4887 substitution}), you will normally get numerous
4888 conflicts during the merge, because the keywords are
4889 expanded differently in the revisions which you are
4890 merging.
4891
4892 Therefore, you will often want to specify the
4893 @samp{-kk} (@pxref{Substitution modes}) switch to the
4894 merge command line. By substituting just the name of
4895 the keyword, not the expanded value of that keyword,
4896 this option ensures that the revisions which you are
4897 merging will be the same as each other, and avoid
4898 spurious conflicts.
4899
4900 For example, suppose you have a file like this:
4901
4902 @example
4903 +---------+
4904 _! 1.1.2.1 ! <- br1
4905 / +---------+
4906 /
4907 /
4908 +-----+ +-----+
4909 ! 1.1 !----! 1.2 !
4910 +-----+ +-----+
4911 @end example
4912
4913 @noindent
4914 and your working directory is currently on the trunk
4915 (revision 1.2). Then you might get the following
4916 results from a merge:
4917
4918 @example
4919 $ cat file1
4920 key $@splitrcskeyword{Revision}: 1.2 $
4921 . . .
4922 $ cvs update -j br1
4923 U file1
4924 RCS file: /cvsroot/first-dir/file1,v
4925 retrieving revision 1.1
4926 retrieving revision 1.1.2.1
4927 Merging differences between 1.1 and 1.1.2.1 into file1
4928 rcsmerge: warning: conflicts during merge
4929 $ cat file1
4930 @asis{}<<<<<<< file1
4931 key $@splitrcskeyword{Revision}: 1.2 $
4932 @asis{}=======
4933 key $@splitrcskeyword{Revision}: 1.1.2.1 $
4934 @asis{}>>>>>>> 1.1.2.1
4935 . . .
4936 @end example
4937
4938 What happened was that the merge tried to merge the
4939 differences between 1.1 and 1.1.2.1 into your working
4940 directory. So, since the keyword changed from
4941 @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
4942 @sc{cvs} tried to merge that change into your working
4943 directory, which conflicted with the fact that your
4944 working directory had contained @code{Revision: 1.2}.
4945
4946 Here is what happens if you had used @samp{-kk}:
4947
4948 @example
4949 $ cat file1
4950 key $@splitrcskeyword{Revision}: 1.2 $
4951 . . .
4952 $ cvs update -kk -j br1
4953 U file1
4954 RCS file: /cvsroot/first-dir/file1,v
4955 retrieving revision 1.1
4956 retrieving revision 1.1.2.1
4957 Merging differences between 1.1 and 1.1.2.1 into file1
4958 $ cat file1
4959 key $@splitrcskeyword{Revision}$
4960 . . .
4961 @end example
4962
4963 What is going on here is that revision 1.1 and 1.1.2.1
4964 both expand as plain @code{Revision}, and therefore
4965 merging the changes between them into the working
4966 directory need not change anything. Therefore, there
4967 is no conflict.
4968
4969 @emph{WARNING: In versions of @sc{cvs} prior to 1.12.2, there was a
4970 major problem with using @samp{-kk} on merges. Namely, @samp{-kk}
4971 overrode any default keyword expansion mode set in the archive file in
4972 the repository. This could, unfortunately for some users, cause data
4973 corruption in binary files (with a default keyword expansion mode set
4974 to @samp{-kb}). Therefore, when a repository contained binary files,
4975 conflicts had to be dealt with manually rather than using @samp{-kk} in
4976 a merge command.}
4977
4978 In @sc{cvs} version 1.12.2 and later, the keyword expansion mode
4979 provided on the command line to any @sc{cvs} command no longer
4980 overrides the @samp{-kb} keyword expansion mode setting for binary
4981 files, though it will still override other default keyword expansion
4982 modes. You can now safely merge using @samp{-kk} to avoid spurious conflicts
4983 on lines containing RCS keywords, even when your repository contains
4984 binary files.
4985
4986 @c ---------------------------------------------------------------------
4987 @node Recursive behavior
4988 @chapter Recursive behavior
4989 @cindex Recursive (directory descending)
4990 @cindex Directory, descending
4991 @cindex Descending directories
4992 @cindex Subdirectories
4993
4994 Almost all of the subcommands of @sc{cvs} work
4995 recursively when you specify a directory as an
4996 argument. For instance, consider this directory
4997 structure:
4998
4999 @example
5000 @code{$HOME}
5001 |
5002 +--@t{tc}
5003 | |
5004 +--@t{CVS}
5005 | (internal @sc{cvs} files)
5006 +--@t{Makefile}
5007 +--@t{backend.c}
5008 +--@t{driver.c}
5009 +--@t{frontend.c}
5010 +--@t{parser.c}
5011 +--@t{man}
5012 | |
5013 | +--@t{CVS}
5014 | | (internal @sc{cvs} files)
5015 | +--@t{tc.1}
5016 |
5017 +--@t{testing}
5018 |
5019 +--@t{CVS}
5020 | (internal @sc{cvs} files)
5021 +--@t{testpgm.t}
5022 +--@t{test2.t}
5023 @end example
5024
5025 @noindent
5026 If @file{tc} is the current working directory, the
5027 following is true:
5028
5029 @itemize @bullet
5030 @item
5031 @samp{cvs update testing} is equivalent to
5032
5033 @example
5034 cvs update testing/testpgm.t testing/test2.t
5035 @end example
5036
5037 @item
5038 @samp{cvs update testing man} updates all files in the
5039 subdirectories
5040
5041 @item
5042 @samp{cvs update .} or just @samp{cvs update} updates
5043 all files in the @code{tc} directory
5044 @end itemize
5045
5046 If no arguments are given to @code{update} it will
5047 update all files in the current working directory and
5048 all its subdirectories. In other words, @file{.} is a
5049 default argument to @code{update}. This is also true
5050 for most of the @sc{cvs} subcommands, not only the
5051 @code{update} command.
5052
5053 The recursive behavior of the @sc{cvs} subcommands can be
5054 turned off with the @samp{-l} option.
5055 Conversely, the @samp{-R} option can be used to force recursion if
5056 @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
5057
5058 @example
5059 $ cvs update -l # @r{Don't update files in subdirectories}
5060 @end example
5061
5062 @c ---------------------------------------------------------------------
5063 @node Adding and removing
5064 @chapter Adding, removing, and renaming files and directories
5065
5066 In the course of a project, one will often add new
5067 files. Likewise with removing or renaming, or with
5068 directories. The general concept to keep in mind in
5069 all these cases is that instead of making an
5070 irreversible change you want @sc{cvs} to record the
5071 fact that a change has taken place, just as with
5072 modifying an existing file. The exact mechanisms to do
5073 this in @sc{cvs} vary depending on the situation.
5074
5075 @menu
5076 * Adding files:: Adding files
5077 * Removing files:: Removing files
5078 * Removing directories:: Removing directories
5079 * Moving files:: Moving and renaming files
5080 * Moving directories:: Moving and renaming directories
5081 @end menu
5082
5083 @node Adding files
5084 @section Adding files to a directory
5085 @cindex Adding files
5086
5087 To add a new file to a directory, follow these steps.
5088
5089 @itemize @bullet
5090 @item
5091 You must have a working copy of the directory.
5092 @xref{Getting the source}.
5093
5094 @item
5095 Create the new file inside your working copy of the directory.
5096
5097 @item
5098 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
5099 want to version control the file. If the file contains
5100 binary data, specify @samp{-kb} (@pxref{Binary files}).
5101
5102 @item
5103 Use @samp{cvs commit @var{filename}} to actually check
5104 in the file into the repository. Other developers
5105 cannot see the file until you perform this step.
5106 @end itemize
5107
5108 You can also use the @code{add} command to add a new
5109 directory.
5110 @c FIXCVS and/or FIXME: Adding a directory doesn't
5111 @c require the commit step. This probably can be
5112 @c considered a CVS bug, but it is possible we should
5113 @c warn people since this behavior probably won't be
5114 @c changing right away.
5115
5116 Unlike most other commands, the @code{add} command is
5117 not recursive. You have to expcicitly name files and
5118 directories that you wish to add to the repository.
5119 However, each directory will need to be added
5120 separately before you will be able to add new files
5121 to those directories.
5122
5123 @example
5124 $ mkdir -p foo/bar
5125 $ cp ~/myfile foo/bar/myfile
5126 $ cvs add foo foo/bar
5127 $ cvs add foo/bar/myfile
5128 @end example
5129
5130 @cindex add (subcommand)
5131 @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
5132
5133 Schedule @var{files} to be added to the repository.
5134 The files or directories specified with @code{add} must
5135 already exist in the current directory. To add a whole
5136 new directory hierarchy to the source repository (for
5137 example, files received from a third-party vendor), use
5138 the @code{import} command instead. @xref{import}.
5139
5140 The added files are not placed in the source repository
5141 until you use @code{commit} to make the change
5142 permanent. Doing an @code{add} on a file that was
5143 removed with the @code{remove} command will undo the
5144 effect of the @code{remove}, unless a @code{commit}
5145 command intervened. @xref{Removing files}, for an
5146 example.
5147
5148 The @samp{-k} option specifies the default way that
5149 this file will be checked out; for more information see
5150 @ref{Substitution modes}.
5151
5152 @c As noted in BUGS, -m is broken client/server (Nov
5153 @c 96). Also see testsuite log2-* tests.
5154 The @samp{-m} option specifies a description for the
5155 file. This description appears in the history log (if
5156 it is enabled, @pxref{history file}). It will also be
5157 saved in the version history inside the repository when
5158 the file is committed. The @code{log} command displays
5159 this description. The description can be changed using
5160 @samp{admin -t}. @xref{admin}. If you omit the
5161 @samp{-m @var{description}} flag, an empty string will
5162 be used. You will not be prompted for a description.
5163 @end deffn
5164
5165 For example, the following commands add the file
5166 @file{backend.c} to the repository:
5167
5168 @c This example used to specify
5169 @c -m "Optimiser and code generation passes."
5170 @c to the cvs add command, but that doesn't work
5171 @c client/server (see log2 in sanity.sh). Should fix CVS,
5172 @c but also seems strange to document things which
5173 @c don't work...
5174 @example
5175 $ cvs add backend.c
5176 $ cvs commit -m "Early version. Not yet compilable." backend.c
5177 @end example
5178
5179 When you add a file it is added only on the branch
5180 which you are working on (@pxref{Branching and merging}). You can
5181 later merge the additions to another branch if you want
5182 (@pxref{Merging adds and removals}).
5183 @c Should we mention that earlier versions of CVS
5184 @c lacked this feature (1.3) or implemented it in a buggy
5185 @c way (well, 1.8 had many bugs in cvs update -j)?
5186 @c Should we mention the bug/limitation regarding a
5187 @c file being a regular file on one branch and a directory
5188 @c on another?
5189 @c FIXME: This needs an example, or several, here or
5190 @c elsewhere, for it to make much sense.
5191 @c Somewhere we need to discuss the aspects of death
5192 @c support which don't involve branching, I guess.
5193 @c Like the ability to re-create a release from a tag.
5194
5195 @c ---------------------------------------------------------------------
5196 @node Removing files
5197 @section Removing files
5198 @cindex Removing files
5199 @cindex Deleting files
5200
5201 @c FIXME: this node wants to be split into several
5202 @c smaller nodes. Could make these children of
5203 @c "Adding and removing", probably (death support could
5204 @c be its own section, for example, as could the
5205 @c various bits about undoing mistakes in adding and
5206 @c removing).
5207 Directories change. New files are added, and old files
5208 disappear. Still, you want to be able to retrieve an
5209 exact copy of old releases.
5210
5211 Here is what you can do to remove a file,
5212 but remain able to retrieve old revisions:
5213
5214 @itemize @bullet
5215 @c FIXME: should probably be saying something about
5216 @c having a working directory in the first place.
5217 @item
5218 Make sure that you have not made any uncommitted
5219 modifications to the file. @xref{Viewing differences},
5220 for one way to do that. You can also use the
5221 @code{status} or @code{update} command. If you remove
5222 the file without committing your changes, you will of
5223 course not be able to retrieve the file as it was
5224 immediately before you deleted it.
5225
5226 @item
5227 Remove the file from your working copy of the directory.
5228 You can for instance use @code{rm}.
5229
5230 @item
5231 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
5232 you really want to delete the file.
5233
5234 @item
5235 Use @samp{cvs commit @var{filename}} to actually
5236 perform the removal of the file from the repository.
5237 @end itemize
5238
5239 @c FIXME: Somehow this should be linked in with a more
5240 @c general discussion of death support. I don't know
5241 @c whether we want to use the term "death support" or
5242 @c not (we can perhaps get by without it), but we do
5243 @c need to discuss the "dead" state in "cvs log" and
5244 @c related subjects. The current discussion is
5245 @c scattered around, and not xref'd to each other.
5246 @c FIXME: I think this paragraph wants to be moved
5247 @c later down, at least after the first example.
5248 When you commit the removal of the file, @sc{cvs}
5249 records the fact that the file no longer exists. It is
5250 possible for a file to exist on only some branches and
5251 not on others, or to re-add another file with the same
5252 name later. @sc{cvs} will correctly create or not create
5253 the file, based on the @samp{-r} and @samp{-D} options
5254 specified to @code{checkout} or @code{update}.
5255
5256 @c FIXME: This style seems to clash with how we
5257 @c document things in general.
5258 @cindex Remove (subcommand)
5259 @deffn Command {cvs remove} [options] files @dots{}
5260
5261 Schedule file(s) to be removed from the repository
5262 (files which have not already been removed from the
5263 working directory are not processed). This command
5264 does not actually remove the file from the repository
5265 until you commit the removal. For a full list of
5266 options, see @ref{Invoking CVS}.
5267 @end deffn
5268
5269 Here is an example of removing several files:
5270
5271 @example
5272 $ cd test
5273 $ rm *.c
5274 $ cvs remove
5275 cvs remove: Removing .
5276 cvs remove: scheduling a.c for removal
5277 cvs remove: scheduling b.c for removal
5278 cvs remove: use 'cvs commit' to remove these files permanently
5279 $ cvs ci -m "Removed unneeded files"
5280 cvs commit: Examining .
5281 cvs commit: Committing .
5282 @end example
5283
5284 As a convenience you can remove the file and @code{cvs
5285 remove} it in one step, by specifying the @samp{-f}
5286 option. For example, the above example could also be
5287 done like this:
5288
5289 @example
5290 $ cd test
5291 $ cvs remove -f *.c
5292 cvs remove: scheduling a.c for removal
5293 cvs remove: scheduling b.c for removal
5294 cvs remove: use 'cvs commit' to remove these files permanently
5295 $ cvs ci -m "Removed unneeded files"
5296 cvs commit: Examining .
5297 cvs commit: Committing .
5298 @end example
5299
5300 If you execute @code{remove} for a file, and then
5301 change your mind before you commit, you can undo the
5302 @code{remove} with an @code{add} command.
5303 @ignore
5304 @c is this worth saying or not? Somehow it seems
5305 @c confusing to me.
5306 Of course,
5307 since you have removed your copy of file in the working
5308 directory, @sc{cvs} does not necessarily bring back the
5309 contents of the file from right before you executed
5310 @code{remove}; instead it gets the file from the
5311 repository again.
5312 @end ignore
5313
5314 @c FIXME: what if you change your mind after you commit
5315 @c it? (answer is also "cvs add" but we don't say that...).
5316 @c We need some index entries for thinks like "undoing
5317 @c removal" too.
5318
5319 @example
5320 $ ls
5321 CVS ja.h oj.c
5322 $ rm oj.c
5323 $ cvs remove oj.c
5324 cvs remove: scheduling oj.c for removal
5325 cvs remove: use 'cvs commit' to remove this file permanently
5326 $ cvs add oj.c
5327 U oj.c
5328 cvs add: oj.c, version 1.1.1.1, resurrected
5329 @end example
5330
5331 If you realise your mistake before you run the
5332 @code{remove} command you can use @code{update} to
5333 resurrect the file:
5334
5335 @example
5336 $ rm oj.c
5337 $ cvs update oj.c
5338 cvs update: warning: oj.c was lost
5339 U oj.c
5340 @end example
5341
5342 When you remove a file it is removed only on the branch
5343 which you are working on (@pxref{Branching and merging}). You can
5344 later merge the removals to another branch if you want
5345 (@pxref{Merging adds and removals}).
5346
5347 @node Removing directories
5348 @section Removing directories
5349 @cindex Removing directories
5350 @cindex Directories, removing
5351
5352 In concept, removing directories is somewhat similar to
5353 removing files---you want the directory to not exist in
5354 your current working directories, but you also want to
5355 be able to retrieve old releases in which the directory
5356 existed.
5357
5358 The way that you remove a directory is to remove all
5359 the files in it. You don't remove the directory
5360 itself; there is no way to do that.
5361 Instead you specify the @samp{-P} option to
5362 @code{cvs update} or @code{cvs checkout},
5363 which will cause @sc{cvs} to remove empty
5364 directories from working directories.
5365 (Note that @code{cvs export} always removes empty directories.)
5366 Probably the
5367 best way to do this is to always specify @samp{-P}; if
5368 you want an empty directory then put a dummy file (for
5369 example @file{.keepme}) in it to prevent @samp{-P} from
5370 removing it.
5371
5372 @c I'd try to give a rationale for this, but I'm not
5373 @c sure there is a particularly convincing one. What
5374 @c we would _like_ is for CVS to do a better job of version
5375 @c controlling whether directories exist, to eliminate the
5376 @c need for -P and so that a file can be a directory in
5377 @c one revision and a regular file in another.
5378 Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
5379 options of @code{checkout}. This way,
5380 @sc{cvs} will be able to correctly create the directory
5381 or not depending on whether the particular version you
5382 are checking out contains any files in that directory.
5383
5384 @c ---------------------------------------------------------------------
5385 @node Moving files
5386 @section Moving and renaming files
5387 @cindex Moving files
5388 @cindex Renaming files
5389 @cindex Files, moving
5390
5391 Moving files to a different directory or renaming them
5392 is not difficult, but some of the ways in which this
5393 works may be non-obvious. (Moving or renaming a
5394 directory is even harder. @xref{Moving directories}.).
5395
5396 The examples below assume that the file @var{old} is renamed to
5397 @var{new}.
5398
5399 @menu
5400 * Outside:: The normal way to Rename
5401 * Inside:: A tricky, alternative way
5402 * Rename by copying:: Another tricky, alternative way
5403 @end menu
5404
5405 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5406 @node Outside
5407 @subsection The Normal way to Rename
5408
5409 @c More rename issues. Not sure whether these are
5410 @c worth documenting; I'm putting them here because
5411 @c it seems to be as good a place as any to try to
5412 @c set down the issues.
5413 @c * "cvs annotate" will annotate either the new
5414 @c file or the old file; it cannot annotate _each
5415 @c line_ based on whether it was last changed in the
5416 @c new or old file. Unlike "cvs log", where the
5417 @c consequences of having to select either the new
5418 @c or old name seem fairly benign, this may be a
5419 @c real advantage to having CVS know about renames
5420 @c other than as a deletion and an addition.
5421
5422 The normal way to move a file is to copy @var{old} to
5423 @var{new}, and then issue the normal @sc{cvs} commands
5424 to remove @var{old} from the repository, and add
5425 @var{new} to it.
5426 @c The following sentence is not true: one must cd into
5427 @c the directory to run "cvs add".
5428 @c (Both @var{old} and @var{new} could
5429 @c contain relative paths, for example @file{foo/bar.c}).
5430
5431 @example
5432 $ mv @var{old} @var{new}
5433 $ cvs remove @var{old}
5434 $ cvs add @var{new}
5435 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
5436 @end example
5437
5438 This is the simplest way to move a file, it is not
5439 error-prone, and it preserves the history of what was
5440 done. Note that to access the history of the file you
5441 must specify the old or the new name, depending on what
5442 portion of the history you are accessing. For example,
5443 @code{cvs log @var{old}} will give the log up until the
5444 time of the rename.
5445
5446 When @var{new} is committed its revision numbers will
5447 start again, usually at 1.1, so if that bothers you,
5448 use the @samp{-r @var{tag}} option to commit. For more
5449 information see @ref{Assigning revisions}.
5450
5451 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5452 @node Inside
5453 @subsection Moving the history file
5454
5455 This method is more dangerous, since it involves moving
5456 files inside the repository. Read this entire section
5457 before trying it out!
5458
5459 @example
5460 $ cd $CVSROOT/@var{dir}
5461 $ mv @var{old},v @var{new},v
5462 @end example
5463
5464 @noindent
5465 Advantages:
5466
5467 @itemize @bullet
5468 @item
5469 The log of changes is maintained intact.
5470
5471 @item
5472 The revision numbers are not affected.
5473 @end itemize
5474
5475 @noindent
5476 Disadvantages:
5477
5478 @itemize @bullet
5479 @item
5480 Old releases cannot easily be fetched from the
5481 repository. (The file will show up as @var{new} even
5482 in revisions from the time before it was renamed).
5483
5484 @item
5485 There is no log information of when the file was renamed.
5486
5487 @item
5488 Nasty things might happen if someone accesses the history file
5489 while you are moving it. Make sure no one else runs any of the @sc{cvs}
5490 commands while you move it.
5491 @end itemize
5492
5493 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5494 @node Rename by copying
5495 @subsection Copying the history file
5496
5497 This way also involves direct modifications to the
5498 repository. It is safe, but not without drawbacks.
5499
5500 @example
5501 # @r{Copy the @sc{rcs} file inside the repository}
5502 $ cd $CVSROOT/@var{dir}
5503 $ cp @var{old},v @var{new},v
5504 # @r{Remove the old file}
5505 $ cd ~/@var{dir}
5506 $ rm @var{old}
5507 $ cvs remove @var{old}
5508 $ cvs commit @var{old}
5509 # @r{Remove all tags from @var{new}}
5510 $ cvs update @var{new}
5511 $ cvs log @var{new} # @r{Remember the non-branch tag names}
5512 $ cvs tag -d @var{tag1} @var{new}
5513 $ cvs tag -d @var{tag2} @var{new}
5514 @dots{}
5515 @end example
5516
5517 By removing the tags you will be able to check out old
5518 revisions.
5519
5520 @noindent
5521 Advantages:
5522
5523 @itemize @bullet
5524 @item
5525 @c FIXME: Is this true about -D now that we have death
5526 @c support? See 5B.3 in the FAQ.
5527 Checking out old revisions works correctly, as long as
5528 you use @samp{-r @var{tag}} and not @samp{-D @var{date}}
5529 to retrieve the revisions.
5530
5531 @item
5532 The log of changes is maintained intact.
5533
5534 @item
5535 The revision numbers are not affected.
5536 @end itemize
5537
5538 @noindent
5539 Disadvantages:
5540
5541 @itemize @bullet
5542 @item
5543 You cannot easily see the history of the file across the rename.
5544
5545 @ignore
5546 @c Is this true? I don't see how the revision numbers
5547 @c _could_ start over, when new,v is just old,v with
5548 @c the tags deleted.
5549 @c If there is some need to reinstate this text,
5550 @c it is "usually 1.1", not "1.0" and it needs an
5551 @c xref to Assigning revisions
5552 @item
5553 Unless you use the @samp{-r @var{tag}} (@pxref{commit
5554 options}) flag when @var{new} is committed its revision
5555 numbers will start at 1.0 again.
5556 @end ignore
5557 @end itemize
5558
5559 @c ---------------------------------------------------------------------
5560 @node Moving directories
5561 @section Moving and renaming directories
5562 @cindex Moving directories
5563 @cindex Renaming directories
5564 @cindex Directories, moving
5565
5566 The normal way to rename or move a directory is to
5567 rename or move each file within it as described in
5568 @ref{Outside}. Then check out with the @samp{-P}
5569 option, as described in @ref{Removing directories}.
5570
5571 If you really want to hack the repository to rename or
5572 delete a directory in the repository, you can do it
5573 like this:
5574
5575 @enumerate
5576 @item
5577 Inform everyone who has a checked out copy of the directory that the
5578 directory will be renamed. They should commit all their changes in all their
5579 copies of the project containing the directory to be removed, and remove
5580 all their working copies of said project, before you take the steps below.
5581
5582 @item
5583 Rename the directory inside the repository.
5584
5585 @example
5586 $ cd $CVSROOT/@var{parent-dir}
5587 $ mv @var{old-dir} @var{new-dir}
5588 @end example
5589
5590 @item
5591 Fix the @sc{cvs} administrative files, if necessary (for
5592 instance if you renamed an entire module).
5593
5594 @item
5595 Tell everyone that they can check out again and continue
5596 working.
5597
5598 @end enumerate
5599
5600 If someone had a working copy the @sc{cvs} commands will
5601 cease to work for him, until he removes the directory
5602 that disappeared inside the repository.
5603
5604 It is almost always better to move the files in the
5605 directory instead of moving the directory. If you move the
5606 directory you are unlikely to be able to retrieve old
5607 releases correctly, since they probably depend on the
5608 name of the directories.
5609
5610 @c ---------------------------------------------------------------------
5611 @node History browsing
5612 @chapter History browsing
5613 @cindex History browsing
5614 @cindex Traceability
5615 @cindex Isolation
5616
5617 @ignore
5618 @c This is too long for an introduction (goal is
5619 @c one 20x80 character screen), and also mixes up a
5620 @c variety of issues (parallel development, history,
5621 @c maybe even touches on process control).
5622
5623 @c -- @quote{To lose ones history is to lose ones soul.}
5624 @c -- ///
5625 @c -- ///Those who cannot remember the past are condemned to repeat it.
5626 @c -- /// -- George Santayana
5627 @c -- ///
5628
5629 @sc{cvs} tries to make it easy for a group of people to work
5630 together. This is done in two ways:
5631
5632 @itemize @bullet
5633 @item
5634 Isolation---You have your own working copy of the
5635 source. You are not affected by modifications made by
5636 others until you decide to incorporate those changes
5637 (via the @code{update} command---@pxref{update}).
5638
5639 @item
5640 Traceability---When something has changed, you can
5641 always see @emph{exactly} what changed.
5642 @end itemize
5643
5644 There are several features of @sc{cvs} that together lead
5645 to traceability:
5646
5647 @itemize @bullet
5648 @item
5649 Each revision of a file has an accompanying log
5650 message.
5651
5652 @item
5653 All commits are optionally logged to a central history
5654 database.
5655
5656 @item
5657 Logging information can be sent to a user-defined
5658 program (@pxref{loginfo}).
5659 @end itemize
5660
5661 @c -- More text here.
5662
5663 This chapter should talk about the history file, the
5664 @code{log} command, the usefulness of ChangeLogs
5665 even when you run @sc{cvs}, and things like that.
5666
5667 @end ignore
5668
5669 @c kind of lame, in a lot of ways the above text inside
5670 @c the @ignore motivates this chapter better
5671 Once you have used @sc{cvs} to store a version control
5672 history---what files have changed when, how, and by
5673 whom, there are a variety of mechanisms for looking
5674 through the history.
5675
5676 @c FIXME: should also be talking about how you look at
5677 @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
5678 @menu
5679 * log messages:: Log messages
5680 * history database:: The history database
5681 * user-defined logging:: User-defined logging
5682 @end menu
5683
5684 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5685 @node log messages
5686 @section Log messages
5687
5688 @c FIXME: @xref to place where we talk about how to
5689 @c specify message to commit.
5690 Whenever you commit a file you specify a log message.
5691
5692 @c FIXME: bring the information here, and get rid of or
5693 @c greatly shrink the "log" node.
5694 To look through the log messages which have been
5695 specified for every revision which has been committed,
5696 use the @code{cvs log} command (@pxref{log}).
5697
5698 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5699 @node history database
5700 @section The history database
5701
5702 @c FIXME: bring the information from the history file
5703 @c and history nodes here. Rewrite it to be motivated
5704 @c better (start out by clearly explaining what gets
5705 @c logged in history, for example).
5706 You can use the history file (@pxref{history file}) to
5707 log various @sc{cvs} actions. To retrieve the
5708 information from the history file, use the @code{cvs
5709 history} command (@pxref{history}).
5710
5711 Note: you can control what is logged to this file by using the
5712 @samp{LogHistory} keyword in the @file{CVSROOT/config} file
5713 (@pxref{config}).
5714
5715 @c
5716 @c The history database has many problems:
5717 @c * It is very unclear what field means what. This
5718 @c could be improved greatly by better documentation,
5719 @c but there are still non-orthogonalities (for
5720 @c example, tag does not record the "repository"
5721 @c field but most records do).
5722 @c * Confusion about files, directories, and modules.
5723 @c Some commands record one, some record others.
5724 @c * File removal is not logged. There is an 'R'
5725 @c record type documented, but CVS never uses it.
5726 @c * Tags are only logged for the "cvs rtag" command,
5727 @c not "cvs tag". The fix for this is not completely
5728 @c clear (see above about modules vs. files).
5729 @c * Are there other cases of operations that are not
5730 @c logged? One would hope for all changes to the
5731 @c repository to be logged somehow (particularly
5732 @c operations like tagging, "cvs admin -k", and other
5733 @c operations which do not record a history that one
5734 @c can get with "cvs log"). Operations on the working
5735 @c directory, like export, get, and release, are a
5736 @c second category also covered by the current "cvs
5737 @c history".
5738 @c * The history file does not record the options given
5739 @c to a command. The most serious manifestation of
5740 @c this is perhaps that it doesn't record whether a command
5741 @c was recursive. It is not clear to me whether one
5742 @c wants to log at a level very close to the command
5743 @c line, as a sort of way of logging each command
5744 @c (more or less), or whether one wants
5745 @c to log more at the level of what was changed (or
5746 @c something in between), but either way the current
5747 @c information has pretty big gaps.
5748 @c * Further details about a tag--like whether it is a
5749 @c branch tag or, if a non-branch tag, which branch it
5750 @c is on. One can find out this information about the
5751 @c tag as it exists _now_, but if the tag has been
5752 @c moved, one doesn't know what it was like at the time
5753 @c the history record was written.
5754 @c * Whether operating on a particular tag, date, or
5755 @c options was implicit (sticky) or explicit.
5756 @c
5757 @c Another item, only somewhat related to the above, is a
5758 @c way to control what is logged in the history file.
5759 @c This is probably the only good way to handle
5760 @c different people having different ideas about
5761 @c information/space tradeoffs.
5762 @c
5763 @c It isn't really clear that it makes sense to try to
5764 @c patch up the history file format as it exists now to
5765 @c include all that stuff. It might be better to
5766 @c design a whole new CVSROOT/nhistory file and "cvs
5767 @c nhistory" command, or some such, or in some other
5768 @c way trying to come up with a clean break from the
5769 @c past, which can address the above concerns. Another
5770 @c open question is how/whether this relates to
5771 @c taginfo/loginfo/etc.
5772
5773 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5774 @node user-defined logging
5775 @section User-defined logging
5776
5777 @c FIXME: probably should centralise this information
5778 @c here, at least to some extent. Maybe by moving the
5779 @c loginfo, etc., nodes here and replacing
5780 @c the "user-defined logging" node with one node for
5781 @c each method.
5782 You can customise @sc{cvs} to log various kinds of
5783 actions, in whatever manner you choose. These
5784 mechanisms operate by executing a script at various
5785 times. The script might append a message to a file
5786 listing the information and the programmer who created
5787 it, or send mail to a group of developers, or, perhaps,
5788 post a message to a particular newsgroup. To log
5789 commits, use the @file{loginfo} file (@pxref{loginfo}), and
5790 to log tagging operations, use the @file{taginfo} file
5791 (@pxref{taginfo}).
5792
5793 @c FIXME: What is difference between doing it in the
5794 @c modules file and using loginfo/taginfo? Why should
5795 @c user use one or the other?
5796 To log commits, checkouts, exports, and tags,
5797 respectively, you can also use the @samp{-i},
5798 @samp{-o}, @samp{-e}, and @samp{-t} options in the
5799 modules file. For a more flexible way of giving
5800 notifications to various users, which requires less in
5801 the way of keeping centralised scripts up to date, use
5802 the @code{cvs watch add} command (@pxref{Getting
5803 Notified}); this command is useful even if you are not
5804 using @code{cvs watch on}.
5805
5806 @c ---------------------------------------------------------------------
5807 @node Binary files
5808 @chapter Handling binary files
5809 @cindex Binary files
5810
5811 The most common use for @sc{cvs} is to store text
5812 files. With text files, @sc{cvs} can merge revisions,
5813 display the differences between revisions in a
5814 human-visible fashion, and other such operations.
5815 However, if you are willing to give up a few of these
5816 abilities, @sc{cvs} can store binary files. For
5817 example, one might store a web site in @sc{cvs}
5818 including both text files and binary images.
5819
5820 @menu
5821 * Binary why:: More details on issues with binary files
5822 * Binary howto:: How to store them
5823 @end menu
5824
5825 @node Binary why
5826 @section The issues with binary files
5827
5828 While the need to manage binary files may seem obvious
5829 if the files that you customarily work with are binary,
5830 putting them into version control does present some
5831 additional issues.
5832
5833 One basic function of version control is to show the
5834 differences between two revisions. For example, if
5835 someone else checked in a new version of a file, you
5836 may wish to look at what they changed and determine
5837 whether their changes are good. For text files,
5838 @sc{cvs} provides this functionality via the @code{cvs
5839 diff} command. For binary files, it may be possible to
5840 extract the two revisions and then compare them with a
5841 tool external to @sc{cvs} (for example, word processing
5842 software often has such a feature). If there is no
5843 such tool, one must track changes via other mechanisms,
5844 such as urging people to write good log messages, and
5845 hoping that the changes they actually made were the
5846 changes that they intended to make.
5847
5848 Another ability of a version control system is the
5849 ability to merge two revisions. For @sc{cvs} this
5850 happens in two contexts. The first is when users make
5851 changes in separate working directories
5852 (@pxref{Multiple developers}). The second is when one
5853 merges explicitly with the @samp{update -j} command
5854 (@pxref{Branching and merging}).
5855
5856 In the case of text
5857 files, @sc{cvs} can merge changes made independently,
5858 and signal a conflict if the changes conflict. With
5859 binary files, the best that @sc{cvs} can do is present
5860 the two different copies of the file, and leave it to
5861 the user to resolve the conflict. The user may choose
5862 one copy or the other, or may run an external merge
5863 tool which knows about that particular file format, if
5864 one exists.
5865 Note that having the user merge relies primarily on the
5866 user to not accidentally omit some changes, and thus is
5867 potentially error prone.
5868
5869 If this process is thought to be undesirable, the best
5870 choice may be to avoid merging. To avoid the merges
5871 that result from separate working directories, see the
5872 discussion of reserved checkouts (file locking) in
5873 @ref{Multiple developers}. To avoid the merges
5874 resulting from branches, restrict use of branches.
5875
5876 @node Binary howto
5877 @section How to store binary files
5878
5879 There are two issues with using @sc{cvs} to store
5880 binary files. The first is that @sc{cvs} by default
5881 converts line endings between the canonical form in
5882 which they are stored in the repository (linefeed
5883 only), and the form appropriate to the operating system
5884 in use on the client (for example, carriage return
5885 followed by line feed for Windows NT).
5886
5887 The second is that a binary file might happen to
5888 contain data which looks like a keyword (@pxref{Keyword
5889 substitution}), so keyword expansion must be turned
5890 off.
5891
5892 @c FIXME: the third is that one can't do merges with
5893 @c binary files. xref to Multiple Developers and the
5894 @c reserved checkout issues.
5895
5896 The @samp{-kb} option available with some @sc{cvs}
5897 commands insures that neither line ending conversion
5898 nor keyword expansion will be done.
5899
5900 Here is an example of how you can create a new file
5901 using the @samp{-kb} flag:
5902
5903 @example
5904 $ echo '$@splitrcskeyword{Id}$' > kotest
5905 $ cvs add -kb -m"A test file" kotest
5906 $ cvs ci -m"First checkin; contains a keyword" kotest
5907 @end example
5908
5909 If a file accidentally gets added without @samp{-kb},
5910 one can use the @code{cvs admin} command to recover.
5911 For example:
5912
5913 @example
5914 $ echo '$@splitrcskeyword{Id}$' > kotest
5915 $ cvs add -m"A test file" kotest
5916 $ cvs ci -m"First checkin; contains a keyword" kotest
5917 $ cvs admin -kb kotest
5918 $ cvs update -A kotest
5919 # @r{For non-unix systems:}
5920 # @r{Copy in a good copy of the file from outside CVS}
5921 $ cvs commit -m "make it binary" kotest
5922 @end example
5923
5924 @c Trying to describe this for both unix and non-unix
5925 @c in the same description is very confusing. Might
5926 @c want to split the two, or just ditch the unix "shortcut"
5927 @c (unixheads don't do much with binary files, anyway).
5928 @c This used to say "(Try the above example, and do a
5929 @c @code{cat kotest} after every command)". But that
5930 @c only really makes sense for the unix case.
5931 When you check in the file @file{kotest} the file is
5932 not preserved as a binary file, because you did not
5933 check it in as a binary file. The @code{cvs
5934 admin -kb} command sets the default keyword
5935 substitution method for this file, but it does not
5936 alter the working copy of the file that you have. If you need to
5937 cope with line endings (that is, you are using
5938 @sc{cvs} on a non-unix system), then you need to
5939 check in a new copy of the file, as shown by the
5940 @code{cvs commit} command above.
5941 On unix, the @code{cvs update -A} command suffices.
5942 @c FIXME: should also describe what the *other users*
5943 @c need to do, if they have checked out copies which
5944 @c have been corrupted by lack of -kb. I think maybe
5945 @c "cvs update -kb" or "cvs
5946 @c update -A" would suffice, although the user who
5947 @c reported this suggested removing the file, manually
5948 @c removing it from CVS/Entries, and then "cvs update"
5949 (Note that you can use @code{cvs log} to determine the default keyword
5950 substitution method for a file and @code{cvs status} to determine
5951 the keyword substitution method for a working copy.)
5952
5953 However, in using @code{cvs admin -k} to change the
5954 keyword expansion, be aware that the keyword expansion
5955 mode is not version controlled. This means that, for
5956 example, that if you have a text file in old releases,
5957 and a binary file with the same name in new releases,
5958 @sc{cvs} provides no way to check out the file in text
5959 or binary mode depending on what version you are
5960 checking out. There is no good workaround for this
5961 problem.
5962
5963 You can also set a default for whether @code{cvs add}
5964 and @code{cvs import} treat a file as binary based on
5965 its name; for example you could say that files who
5966 names end in @samp{.exe} are binary. @xref{Wrappers}.
5967 There is currently no way to have @sc{cvs} detect
5968 whether a file is binary based on its contents. The
5969 main difficulty with designing such a feature is that
5970 it is not clear how to distinguish between binary and
5971 non-binary files, and the rules to apply would vary
5972 considerably with the operating system.
5973 @c For example, it would be good on MS-DOS-family OSes
5974 @c for anything containing ^Z to be binary. Having
5975 @c characters with the 8th bit set imply binary is almost
5976 @c surely a bad idea in the context of ISO-8859-* and
5977 @c other such character sets. On VMS or the Mac, we
5978 @c could use the OS's file typing. This is a
5979 @c commonly-desired feature, and something of this sort
5980 @c may make sense. But there are a lot of pitfalls here.
5981 @c
5982 @c Another, probably better, way to tell is to read the
5983 @c file in text mode, write it to a temp file in text
5984 @c mode, and then do a binary mode compare of the two
5985 @c files. If they differ, it is a binary file. This
5986 @c might have problems on VMS (or some other system
5987 @c with several different text modes), but in general
5988 @c should be relatively portable. The only other
5989 @c downside I can think of is that it would be fairly
5990 @c slow, but that is perhaps a small price to pay for
5991 @c not having your files corrupted. Another issue is
5992 @c what happens if you import a text file with bare
5993 @c linefeeds on Windows. Such files will show up on
5994 @c Windows sometimes (I think some native windows
5995 @c programs even write them, on occasion). Perhaps it
5996 @c is reasonable to treat such files as binary; after
5997 @c all it is something of a presumption to assume that
5998 @c the user would want the linefeeds converted to CRLF.
5999
6000 @c ---------------------------------------------------------------------
6001 @node Multiple developers
6002 @chapter Multiple developers
6003 @cindex Multiple developers
6004 @cindex Team of developers
6005 @cindex File locking
6006 @cindex Locking files
6007 @cindex Working copy
6008 @cindex Reserved checkouts
6009 @cindex Unreserved checkouts
6010 @cindex RCS-style locking
6011
6012 When more than one person works on a software project
6013 things often get complicated. Often, two people try to
6014 edit the same file simultaneously. One solution, known
6015 as @dfn{file locking} or @dfn{reserved checkouts}, is
6016 to allow only one person to edit each file at a time.
6017 This is the only solution with some version control
6018 systems, including @sc{rcs} and @sc{sccs}. Currently
6019 the usual way to get reserved checkouts with @sc{cvs}
6020 is the @code{cvs admin -l} command (@pxref{admin
6021 options}). This is not as nicely integrated into
6022 @sc{cvs} as the watch features, described below, but it
6023 seems that most people with a need for reserved
6024 checkouts find it adequate.
6025 @c Or "find it better than worrying about implementing
6026 @c nicely integrated reserved checkouts" or ...?
6027
6028 As of @sc{cvs} version 1.12.10, another technique for getting most of the
6029 effect of reserved checkouts is to enable advisory locks. To enable advisory
6030 locks, have all developers put "edit -c", "commit -c" in their
6031 .cvsrc file, and turn on watches in the repository. This
6032 prevents them from doing a @code{cvs edit} if anyone is
6033 already editing the file. It also may
6034 be possible to use plain watches together with suitable
6035 procedures (not enforced by software), to avoid having
6036 two people edit at the same time.
6037
6038 @c Our unreserved checkout model might not
6039 @c be quite the same as others. For example, I
6040 @c think that some systems will tend to create a branch
6041 @c in the case where CVS prints "up-to-date check failed".
6042 @c It isn't clear to me whether we should try to
6043 @c explore these subtleties; it could easily just
6044 @c confuse people.
6045 The default model with @sc{cvs} is known as
6046 @dfn{unreserved checkouts}. In this model, developers
6047 can edit their own @dfn{working copy} of a file
6048 simultaneously. The first person that commits his
6049 changes has no automatic way of knowing that another
6050 has started to edit it. Others will get an error
6051 message when they try to commit the file. They must
6052 then use @sc{cvs} commands to bring their working copy
6053 up to date with the repository revision. This process
6054 is almost automatic.
6055
6056 @c FIXME? should probably use the word "watch" here, to
6057 @c tie this into the text below and above.
6058 @sc{cvs} also supports mechanisms which facilitate
6059 various kinds of communication, without actually
6060 enforcing rules like reserved checkouts do.
6061
6062 The rest of this chapter describes how these various
6063 models work, and some of the issues involved in
6064 choosing between them.
6065
6066 @ignore
6067 Here is a draft reserved checkout design or discussion
6068 of the issues. This seems like as good a place as any
6069 for this.
6070
6071 Might want a cvs lock/cvs unlock--in which the names
6072 differ from edit/unedit because the network must be up
6073 for these to work. unedit gives an error if there is a
6074 reserved checkout in place (so that people don't
6075 accidentally leave locks around); unlock gives an error
6076 if one is not in place (this is more arguable; perhaps
6077 it should act like unedit in that case).
6078
6079 On the other hand, might want it so that emacs,
6080 scripts, etc., can get ready to edit a file without
6081 having to know which model is in use. In that case we
6082 would have a "cvs watch lock" (or .cvsrc?) (that is,
6083 three settings, "on", "off", and "lock"). Having cvs
6084 watch lock set would cause a get to record in the CVS
6085 directory which model is in use, and cause "cvs edit"
6086 to change behaviors. We'd want a way to query which
6087 setting is in effect (this would be handy even if it is
6088 only "on" or "off" as presently). If lock is in
6089 effect, then commit would require a lock before
6090 allowing a checkin; chmod wouldn't suffice (might be
6091 debatable--see chmod comment below, in watches--but it
6092 is the way people expect RCS to work and I can't think
6093 of any significant downside. On the other hand, maybe
6094 it isn't worth bothering, because people who are used
6095 to RCS wouldn't think to use chmod anyway).
6096
6097 Implementation: use file attributes or use RCS
6098 locking. The former avoids more dependence on RCS
6099 behaviors we will need to re-implement as we librarify
6100 RCS, and makes it easier to import/export RCS files (in
6101 that context, want to ignore the locker field). But
6102 note that RCS locks are per-branch, which is the
6103 correct behavior (this is also an issue for the "watch
6104 on" features; they should be per-branch too).
6105
6106 Here are a few more random notes about implementation
6107 details, assuming "cvs watch lock" and
6108
6109 CVS/Watched file? Or try to fit this into CVS/Entries somehow?
6110 Cases: (1) file is checked out (unreserved or with watch on) by old
6111 version of @sc{cvs}, now we do something with new one, (2) file is checked
6112 out by new version, now we do something with old one.
6113
6114 Remote protocol would have a "Watched" analogous to "Mode". Of course
6115 it would apply to all Updated-like requests. How do we keep this
6116 setting up to date? I guess that there wants to be a Watched request,
6117 and the server would send a new one if it isn't up to date? (Ugh--hard
6118 to implement and slows down "cvs -q update"--is there an easier way?)
6119
6120 "cvs edit"--checks CVS/Watched, and if watch lock, then sends
6121 "edit-lock" request. Which comes back with a Checked-in with
6122 appropriate Watched (off, on, lock, locked, or some such?), or error
6123 message if already locked.
6124
6125 "cvs commit"--only will commit if off/on/locked. lock is not OK.
6126
6127 Doc:
6128 note that "cvs edit" must be connected to network if watch lock is in
6129 effect.
6130
6131 Talk about what to do if someone has locked a file and you want to
6132 edit that file. (breaking locks, or lack thereof).
6133
6134
6135 One other idea (which could work along with the
6136 existing "cvs admin -l" reserved checkouts, as well as
6137 the above):
6138
6139 "cvs editors" could show who has the file locked, if
6140 someone does.
6141
6142 @end ignore
6143
6144 @menu
6145 * File status:: A file can be in several states
6146 * Updating a file:: Bringing a file up-to-date
6147 * Conflicts example:: An informative example
6148 * Informing others:: To cooperate you must inform
6149 * Concurrency:: Simultaneous repository access
6150 * Watches:: Mechanisms to track who is editing files
6151 * Choosing a model:: Reserved or unreserved checkouts?
6152 @end menu
6153
6154 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6155 @node File status
6156 @section File status
6157 @cindex File status
6158 @cindex Status of a file
6159
6160 @c Shouldn't this start with an example or something,
6161 @c introducing the unreserved checkout model? Before we
6162 @c dive into listing states?
6163 Based on what operations you have performed on a
6164 checked out file, and what operations others have
6165 performed to that file in the repository, one can
6166 classify a file in a number of states. The states, as
6167 reported by the @code{status} command, are:
6168
6169 @c The order of items is chosen to group logically
6170 @c similar outputs together.
6171 @c People who want alphabetical can use the index...
6172 @table @asis
6173 @cindex Up-to-date
6174 @item Up-to-date
6175 The file is identical with the latest revision in the
6176 repository for the branch in use.
6177 @c FIXME: should we clarify "in use"? The answer is
6178 @c sticky tags, and trying to distinguish branch sticky
6179 @c tags from non-branch sticky tags seems rather awkward
6180 @c here.
6181 @c FIXME: What happens with non-branch sticky tags? Is
6182 @c a stuck file "Up-to-date" or "Needs checkout" or what?
6183
6184 @item Locally Modified
6185 @cindex Locally Modified
6186 You have edited the file, and not yet committed your changes.
6187
6188 @item Locally Added
6189 @cindex Locally Added
6190 You have added the file with @code{add}, and not yet
6191 committed your changes.
6192 @c There are many cases involving the file being
6193 @c added/removed/modified in the working directory, and
6194 @c added/removed/modified in the repository, which we
6195 @c don't try to describe here. I'm not sure that "cvs
6196 @c status" produces a non-confusing output in most of
6197 @c those cases.
6198
6199 @item Locally Removed
6200 @cindex Locally Removed
6201 You have removed the file with @code{remove}, and not yet
6202 committed your changes.
6203
6204 @item Needs Checkout
6205 @cindex Needs Checkout
6206 Someone else has committed a newer revision to the
6207 repository. The name is slightly misleading; you will
6208 ordinarily use @code{update} rather than
6209 @code{checkout} to get that newer revision.
6210
6211 @item Needs Patch
6212 @cindex Needs Patch
6213 @c See also newb-123j0 in sanity.sh (although that case
6214 @c should probably be changed rather than documented).
6215 Like Needs Checkout, but the @sc{cvs} server will send
6216 a patch rather than the entire file. Sending a patch or
6217 sending an entire file accomplishes the same thing.
6218
6219 @item Needs Merge
6220 @cindex Needs Merge
6221 Someone else has committed a newer revision to the repository, and you
6222 have also made modifications to the file.
6223
6224 @item Unresolved Conflict
6225 @cindex Unresolved Conflict
6226 @c FIXCVS - This file status needs to be changed to some more informative
6227 @c text that distinguishes it more clearly from each of the Locally Added,
6228 @c File had conflicts on merge, and Unknown status types, but an exact and
6229 @c succinct wording escapes me at the moment.
6230 A file with the same name as this new file has been added to the repository
6231 from a second workspace. This file will need to be moved out of the way
6232 to allow an @code{update} to complete.
6233
6234 @item File had conflicts on merge
6235 @cindex File had conflicts on merge
6236 @c is it worth saying that this message was "Unresolved
6237 @c Conflict" in CVS 1.9 and earlier? I'm inclined to
6238 @c think that is unnecessarily confusing to new users.
6239 This is like Locally Modified, except that a previous
6240 @code{update} command gave a conflict. If you have not
6241 already done so, you need to
6242 resolve the conflict as described in @ref{Conflicts example}.
6243
6244 @item Unknown
6245 @cindex Unknown
6246 @sc{cvs} doesn't know anything about this file. For
6247 example, you have created a new file and have not run
6248 @code{add}.
6249 @c
6250 @c "Entry Invalid" and "Classify Error" are also in the
6251 @c status.c. The latter definitely indicates a CVS bug
6252 @c (should it be worded more like "internal error" so
6253 @c people submit bug reports if they see it?). The former
6254 @c I'm not as sure; I haven't tracked down whether/when it
6255 @c appears in "cvs status" output.
6256
6257 @end table
6258
6259 To help clarify the file status, @code{status} also
6260 reports the @code{Working revision} which is the
6261 revision that the file in the working directory derives
6262 from, and the @code{Repository revision} which is the
6263 latest revision in the repository for the branch in
6264 use.
6265 The @samp{Commit Identifier} reflects the unique commitid
6266 of the @code{commit}.
6267 @c FIXME: should we clarify "in use"? The answer is
6268 @c sticky tags, and trying to distinguish branch sticky
6269 @c tags from non-branch sticky tags seems rather awkward
6270 @c here.
6271 @c FIXME: What happens with non-branch sticky tags?
6272 @c What is the Repository Revision there? See the
6273 @c comment at vn_rcs in cvs.h, which is kind of
6274 @c confused--we really need to document better what this
6275 @c field contains.
6276 @c Q: Should we document "New file!" and other such
6277 @c outputs or are they self-explanatory?
6278 @c FIXME: what about the date to the right of "Working
6279 @c revision"? It doesn't appear with client/server and
6280 @c seems unnecessary (redundant with "ls -l") so
6281 @c perhaps it should be removed for non-client/server too?
6282 @c FIXME: Need some examples.
6283 @c FIXME: Working revision can also be something like
6284 @c "-1.3" for a locally removed file. Not at all
6285 @c self-explanatory (and it is possible that CVS should
6286 @c be changed rather than documenting this).
6287
6288 @c Would be nice to have an @example showing output
6289 @c from cvs status, with comments showing the xref
6290 @c where each part of the output is described. This
6291 @c might fit in nicely if it is desirable to split this
6292 @c node in two; one to introduce "cvs status" and one
6293 @c to list each of the states.
6294 The options to @code{status} are listed in
6295 @ref{Invoking CVS}. For information on its @code{Sticky tag}
6296 and @code{Sticky date} output, see @ref{Sticky tags}.
6297 For information on its @code{Sticky options} output,
6298 see the @samp{-k} option in @ref{update options}.
6299
6300 You can think of the @code{status} and @code{update}
6301 commands as somewhat complementary. You use
6302 @code{update} to bring your files up to date, and you
6303 can use @code{status} to give you some idea of what an
6304 @code{update} would do (of course, the state of the
6305 repository might change before you actually run
6306 @code{update}). In fact, if you want a command to
6307 display file status in a more brief format than is
6308 displayed by the @code{status} command, you can invoke
6309
6310 @cindex update, to display file status
6311 @example
6312 $ cvs -n -q update
6313 @end example
6314
6315 The @samp{-n} option means to not actually do the
6316 update, but merely to display statuses; the @samp{-q}
6317 option avoids printing the name of each directory. For
6318 more information on the @code{update} command, and
6319 these options, see @ref{Invoking CVS}.
6320
6321 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6322 @node Updating a file
6323 @section Bringing a file up to date
6324 @cindex Bringing a file up to date
6325 @cindex Updating a file
6326 @cindex Merging a file
6327 @cindex Update, introduction
6328
6329 When you want to update or merge a file, use the @code{cvs update -d}
6330 command. For files that are not up to date this is roughly equivalent
6331 to a @code{checkout} command: the newest revision of the file is
6332 extracted from the repository and put in your working directory. The
6333 @code{-d} option, not necessary with @code{checkout}, tells @sc{cvs}
6334 that you wish it to create directories added by other developers.
6335
6336 Your modifications to a file are never lost when you
6337 use @code{update}. If no newer revision exists,
6338 running @code{update} has no effect. If you have
6339 edited the file, and a newer revision is available,
6340 @sc{cvs} will merge all changes into your working copy.
6341
6342 For instance, imagine that you checked out revision 1.4 and started
6343 editing it. In the meantime someone else committed revision 1.5, and
6344 shortly after that revision 1.6. If you run @code{update} on the file
6345 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
6346 your file.
6347
6348 @cindex Overlap
6349 If any of the changes between 1.4 and 1.6 were made too
6350 close to any of the changes you have made, an
6351 @dfn{overlap} occurs. In such cases a warning is
6352 printed, and the resulting file includes both
6353 versions of the lines that overlap, delimited by
6354 special markers.
6355 @xref{update}, for a complete description of the
6356 @code{update} command.
6357
6358 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6359 @node Conflicts example
6360 @section Conflicts example
6361 @cindex Merge, an example
6362 @cindex Example of merge
6363 @cindex driver.c (merge example)
6364
6365 Suppose revision 1.4 of @file{driver.c} contains this:
6366
6367 @example
6368 #include <stdio.h>
6369
6370 void main()
6371 @{
6372 parse();
6373 if (nerr == 0)
6374 gencode();
6375 else
6376 fprintf(stderr, "No code generated.\n");
6377 exit(nerr == 0 ? 0 : 1);
6378 @}
6379 @end example
6380
6381 @noindent
6382 Revision 1.6 of @file{driver.c} contains this:
6383
6384 @example
6385 #include <stdio.h>
6386
6387 int main(int argc,
6388 char **argv)
6389 @{
6390 parse();
6391 if (argc != 1)
6392 @{
6393 fprintf(stderr, "tc: No args expected.\n");
6394 exit(1);
6395 @}
6396 if (nerr == 0)
6397 gencode();
6398 else
6399 fprintf(stderr, "No code generated.\n");
6400 exit(!!nerr);
6401 @}
6402 @end example
6403
6404 @noindent
6405 Your working copy of @file{driver.c}, based on revision
6406 1.4, contains this before you run @samp{cvs update}:
6407 @c -- Really include "cvs"?
6408
6409 @example
6410 #include <stdlib.h>
6411 #include <stdio.h>
6412
6413 void main()
6414 @{
6415 init_scanner();
6416 parse();
6417 if (nerr == 0)
6418 gencode();
6419 else
6420 fprintf(stderr, "No code generated.\n");
6421 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6422 @}
6423 @end example
6424
6425 @noindent
6426 You run @samp{cvs update}:
6427 @c -- Really include "cvs"?
6428
6429 @example
6430 $ cvs update driver.c
6431 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
6432 retrieving revision 1.4
6433 retrieving revision 1.6
6434 Merging differences between 1.4 and 1.6 into driver.c
6435 rcsmerge warning: overlaps during merge
6436 cvs update: conflicts found in driver.c
6437 C driver.c
6438 @end example
6439
6440 @noindent
6441 @cindex Conflicts (merge example)
6442 @sc{cvs} tells you that there were some conflicts.
6443 Your original working file is saved unmodified in
6444 @file{.#driver.c.1.4}. The new version of
6445 @file{driver.c} contains this:
6446
6447 @example
6448 #include <stdlib.h>
6449 #include <stdio.h>
6450
6451 int main(int argc,
6452 char **argv)
6453 @{
6454 init_scanner();
6455 parse();
6456 if (argc != 1)
6457 @{
6458 fprintf(stderr, "tc: No args expected.\n");
6459 exit(1);
6460 @}
6461 if (nerr == 0)
6462 gencode();
6463 else
6464 fprintf(stderr, "No code generated.\n");
6465 @asis{}<<<<<<< driver.c
6466 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6467 @asis{}=======
6468 exit(!!nerr);
6469 @asis{}>>>>>>> 1.6
6470 @}
6471 @end example
6472
6473 @noindent
6474 @cindex Markers, conflict
6475 @cindex Conflict markers
6476 @cindex <<<<<<<
6477 @cindex >>>>>>>
6478 @cindex =======
6479
6480 Note how all non-overlapping modifications are incorporated in your working
6481 copy, and that the overlapping section is clearly marked with
6482 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
6483
6484 @cindex Resolving a conflict
6485 @cindex Conflict resolution
6486 You resolve the conflict by editing the file, removing the markers and
6487 the erroneous line. Suppose you end up with this file:
6488 @c -- Add xref to the pcl-cvs manual when it talks
6489 @c -- about this.
6490 @example
6491 #include <stdlib.h>
6492 #include <stdio.h>
6493
6494 int main(int argc,
6495 char **argv)
6496 @{
6497 init_scanner();
6498 parse();
6499 if (argc != 1)
6500 @{
6501 fprintf(stderr, "tc: No args expected.\n");
6502 exit(1);
6503 @}
6504 if (nerr == 0)
6505 gencode();
6506 else
6507 fprintf(stderr, "No code generated.\n");
6508 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
6509 @}
6510 @end example
6511
6512 @noindent
6513 You can now go ahead and commit this as revision 1.7.
6514
6515 @example
6516 $ cvs commit -m "Initialise scanner. Use symbolic exit values." driver.c
6517 Checking in driver.c;
6518 /usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c
6519 new revision: 1.7; previous revision: 1.6
6520 done
6521 @end example
6522
6523 For your protection, @sc{cvs} will refuse to check in a
6524 file if a conflict occurred and you have not resolved
6525 the conflict. Currently to resolve a conflict, you
6526 must change the timestamp on the file. In previous
6527 versions of @sc{cvs}, you also needed to
6528 insure that the file contains no conflict markers.
6529 Because
6530 your file may legitimately contain conflict markers (that
6531 is, occurrences of @samp{>>>>>>> } at the start of a
6532 line that don't mark a conflict), the current
6533 version of @sc{cvs} will print a warning and proceed to
6534 check in the file.
6535 @c The old behavior was really icky; the only way out
6536 @c was to start hacking on
6537 @c the @code{CVS/Entries} file or other such workarounds.
6538 @c
6539 @c If the timestamp thing isn't considered nice enough,
6540 @c maybe there should be a "cvs resolved" command
6541 @c which clears the conflict indication. For a nice user
6542 @c interface, this should be invoked by an interactive
6543 @c merge tool like emerge rather than by the user
6544 @c directly--such a tool can verify that the user has
6545 @c really dealt with each conflict.
6546
6547 @cindex emerge
6548 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
6549 Emacs front-end for @sc{cvs}) you can use an Emacs
6550 package called emerge to help you resolve conflicts.
6551 See the documentation for pcl-cvs.
6552
6553 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6554 @node Informing others
6555 @section Informing others about commits
6556 @cindex Informing others
6557 @cindex Spreading information
6558 @cindex Mail, automatic mail on commit
6559
6560 It is often useful to inform others when you commit a
6561 new revision of a file. The @samp{-i} option of the
6562 @file{modules} file, or the @file{loginfo} file, can be
6563 used to automate this process. @xref{modules}.
6564 @xref{loginfo}. You can use these features of @sc{cvs}
6565 to, for instance, instruct @sc{cvs} to mail a
6566 message to all developers, or post a message to a local
6567 newsgroup.
6568 @c -- More text would be nice here.
6569
6570 @node Concurrency
6571 @section Several developers simultaneously attempting to run CVS
6572
6573 @cindex Locks, cvs, introduction
6574 @c For a discussion of *why* CVS creates locks, see
6575 @c the comment at the start of src/lock.c
6576 If several developers try to run @sc{cvs} at the same
6577 time, one may get the following message:
6578
6579 @example
6580 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
6581 @end example
6582
6583 @cindex #cvs.rfl, removing
6584 @cindex #cvs.wfl, removing
6585 @cindex #cvs.lock, removing
6586 @sc{cvs} will try again every 30 seconds, and either
6587 continue with the operation or print the message again,
6588 if it still needs to wait. If a lock seems to stick
6589 around for an undue amount of time, find the person
6590 holding the lock and ask them about the cvs command
6591 they are running. If they aren't running a cvs
6592 command, look in the repository directory mentioned in
6593 the message and remove files which they own whose names
6594 start with @file{#cvs.rfl},
6595 @file{#cvs.wfl}, or @file{#cvs.lock}.
6596
6597 Note that these locks are to protect @sc{cvs}'s
6598 internal data structures and have no relationship to
6599 the word @dfn{lock} in the sense used by
6600 @sc{rcs}---which refers to reserved checkouts
6601 (@pxref{Multiple developers}).
6602
6603 Any number of people can be reading from a given
6604 repository at a time; only when someone is writing do
6605 the locks prevent other people from reading or writing.
6606
6607 @cindex Atomic transactions, lack of
6608 @cindex Transactions, atomic, lack of
6609 @c the following talks about what one might call commit/update
6610 @c atomicity.
6611 @c Probably also should say something about
6612 @c commit/commit atomicity, that is, "An update will
6613 @c not get partial versions of more than one commit".
6614 @c CVS currently has this property and I guess we can
6615 @c make it a documented feature.
6616 @c For example one person commits
6617 @c a/one.c and b/four.c and another commits a/two.c and
6618 @c b/three.c. Then an update cannot get the new a/one.c
6619 @c and a/two.c and the old b/four.c and b/three.c.
6620 One might hope for the following property:
6621
6622 @quotation
6623 If someone commits some changes in one cvs command,
6624 then an update by someone else will either get all the
6625 changes, or none of them.
6626 @end quotation
6627
6628 @noindent
6629 but @sc{cvs} does @emph{not} have this property. For
6630 example, given the files
6631
6632 @example
6633 a/one.c
6634 a/two.c
6635 b/three.c
6636 b/four.c
6637 @end example
6638
6639 @noindent
6640 if someone runs
6641
6642 @example
6643 cvs ci a/two.c b/three.c
6644 @end example
6645
6646 @noindent
6647 and someone else runs @code{cvs update} at the same
6648 time, the person running @code{update} might get only
6649 the change to @file{b/three.c} and not the change to
6650 @file{a/two.c}.
6651
6652 @node Watches
6653 @section Mechanisms to track who is editing files
6654 @cindex Watches
6655
6656 For many groups, use of @sc{cvs} in its default mode is
6657 perfectly satisfactory. Users may sometimes go to
6658 check in a modification only to find that another
6659 modification has intervened, but they deal with it and
6660 proceed with their check in. Other groups prefer to be
6661 able to know who is editing what files, so that if two
6662 people try to edit the same file they can choose to
6663 talk about who is doing what when rather than be
6664 surprised at check in time. The features in this
6665 section allow such coordination, while retaining the
6666 ability of two developers to edit the same file at the
6667 same time.
6668
6669 @c Some people might ask why CVS does not enforce the
6670 @c rule on chmod, by requiring a cvs edit before a cvs
6671 @c commit. The main reason is that it could always be
6672 @c circumvented--one could edit the file, and
6673 @c then when ready to check it in, do the cvs edit and put
6674 @c in the new contents and do the cvs commit. One
6675 @c implementation note: if we _do_ want to have cvs commit
6676 @c require a cvs edit, we should store the state on
6677 @c whether the cvs edit has occurred in the working
6678 @c directory, rather than having the server try to keep
6679 @c track of what working directories exist.
6680 @c FIXME: should the above discussion be part of the
6681 @c manual proper, somewhere, not just in a comment?
6682 For maximum benefit developers should use @code{cvs
6683 edit} (not @code{chmod}) to make files read-write to
6684 edit them, and @code{cvs release} (not @code{rm}) to
6685 discard a working directory which is no longer in use,
6686 but @sc{cvs} is not able to enforce this behavior.
6687
6688 If a development team wants stronger enforcement of
6689 watches and all team members are using a @sc{cvs} client version 1.12.10 or
6690 greater to access a @sc{cvs} server version 1.12.10 or greater, they can
6691 enable advisory locks. To enable advisory locks, have all developers
6692 put "edit -c" and "commit -c" into all .cvsrc files,
6693 and make files default to read only by turning on watches
6694 or putting "cvs -r" into all .cvsrc files.
6695 This prevents multiple people from editing a file at
6696 the same time (unless explicitly overriden with @samp{-f}).
6697
6698 @c I'm a little dissatisfied with this presentation,
6699 @c because "watch on"/"edit"/"editors" are one set of
6700 @c functionality, and "watch add"/"watchers" is another
6701 @c which is somewhat orthogonal even though they interact in
6702 @c various ways. But I think it might be
6703 @c confusing to describe them separately (e.g. "watch
6704 @c add" with loginfo). I don't know.
6705
6706 @menu
6707 * Setting a watch:: Telling CVS to watch certain files
6708 * Getting Notified:: Telling CVS to notify you
6709 * Editing files:: How to edit a file which is being watched
6710 * Watch information:: Information about who is watching and editing
6711 * Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier
6712 @end menu
6713
6714 @node Setting a watch
6715 @subsection Telling CVS to watch certain files
6716
6717 To enable the watch features, you first specify that
6718 certain files are to be watched.
6719
6720 @cindex watch on (subcommand)
6721 @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
6722
6723 @cindex Read-only files, and watches
6724 Specify that developers should run @code{cvs edit}
6725 before editing @var{files}. @sc{cvs} will create working
6726 copies of @var{files} read-only, to remind developers
6727 to run the @code{cvs edit} command before working on
6728 them.
6729
6730 If @var{files} includes the name of a directory, @sc{cvs}
6731 arranges to watch all files added to the corresponding
6732 repository directory, and sets a default for files
6733 added in the future; this allows the user to set
6734 notification policies on a per-directory basis. The
6735 contents of the directory are processed recursively,
6736 unless the @code{-l} option is given.
6737 The @code{-R} option can be used to force recursion if the @code{-l}
6738 option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
6739
6740 If @var{files} is omitted, it defaults to the current directory.
6741
6742 @cindex watch off (subcommand)
6743 @end deffn
6744
6745 @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
6746
6747 Do not create @var{files} read-only on checkout; thus,
6748 developers will not be reminded to use @code{cvs edit}
6749 and @code{cvs unedit}.
6750 @ignore
6751 @sc{cvs} will check out @var{files}
6752 read-write as usual, unless other permissions override
6753 due to the @code{PreservePermissions} option being
6754 enabled in the @file{config} administrative file
6755 (@pxref{Special Files}, @pxref{config})
6756 @end ignore
6757
6758 The @var{files} and options are processed as for @code{cvs
6759 watch on}.
6760
6761 @end deffn
6762
6763 @node Getting Notified
6764 @subsection Telling CVS to notify you
6765
6766 You can tell @sc{cvs} that you want to receive
6767 notifications about various actions taken on a file.
6768 You can do this without using @code{cvs watch on} for
6769 the file, but generally you will want to use @code{cvs
6770 watch on}, to remind developers to use the @code{cvs edit}
6771 command.
6772
6773 @cindex watch add (subcommand)
6774 @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6775
6776 Add the current user to the list of people to receive notification of
6777 work done on @var{files}.
6778
6779 The @code{-a} option specifies what kinds of events @sc{cvs} should notify
6780 the user about. @var{action} is one of the following:
6781
6782 @table @code
6783
6784 @item edit
6785 Another user has applied the @code{cvs edit} command (described
6786 below) to a watched file.
6787
6788 @item commit
6789 Another user has committed changes to one of the named @var{files}.
6790
6791 @item unedit
6792 Another user has abandoned editing a file (other than by committing changes).
6793 They can do this in several ways, by:
6794
6795 @itemize @bullet
6796
6797 @item
6798 applying the @code{cvs unedit} command (described below) to the file
6799
6800 @item
6801 applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
6802 (or recursively to a directory more than one level up)
6803
6804 @item
6805 deleting the file and allowing @code{cvs update} to recreate it
6806
6807 @end itemize
6808
6809 @item all
6810 All of the above.
6811
6812 @item none
6813 None of the above. (This is useful with @code{cvs edit},
6814 described below.)
6815
6816 @end table
6817
6818 The @code{-a} option may appear more than once, or not at all. If
6819 omitted, the action defaults to @code{all}.
6820
6821 The @var{files} and options are processed as for
6822 @code{cvs watch on}.
6823
6824 @end deffn
6825
6826
6827 @cindex watch remove (subcommand)
6828 @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6829
6830 Remove a notification request established using @code{cvs watch add};
6831 the arguments are the same. If the @code{-a} option is present, only
6832 watches for the specified actions are removed.
6833
6834 @end deffn
6835
6836 @cindex notify (admin file)
6837 When the conditions exist for notification, @sc{cvs}
6838 calls the @file{notify} administrative file. Edit
6839 @file{notify} as one edits the other administrative
6840 files (@pxref{Intro administrative files}). This
6841 file follows the usual conventions for administrative
6842 files (@pxref{syntax}), where each line is a regular
6843 expression followed by a command to execute. The
6844 command should contain a single occurrence of @samp{%s}
6845 which will be replaced by the user to notify; the rest
6846 of the information regarding the notification will be
6847 supplied to the command on standard input. The
6848 standard thing to put in the @code{notify} file is the
6849 single line:
6850
6851 @example
6852 ALL mail %s -s "CVS notification"
6853 @end example
6854
6855 @noindent
6856 This causes users to be notified by electronic mail.
6857 @c FIXME: should it be this hard to set up this
6858 @c behavior (and the result when one fails to do so,
6859 @c silent failure to notify, so non-obvious)? Should
6860 @c CVS give a warning if no line in notify matches (and
6861 @c document the use of "DEFAULT :" for the case where
6862 @c skipping the notification is indeed desired)?
6863
6864 @cindex users (admin file)
6865 Note that if you set this up in the straightforward
6866 way, users receive notifications on the server machine.
6867 One could of course write a @file{notify} script which
6868 directed notifications elsewhere, but to make this
6869 easy, @sc{cvs} allows you to associate a notification
6870 address for each user. To do so create a file
6871 @file{users} in @file{CVSROOT} with a line for each
6872 user in the format @var{user}:@var{value}. Then
6873 instead of passing the name of the user to be notified
6874 to @file{notify}, @sc{cvs} will pass the @var{value}
6875 (normally an email address on some other machine).
6876
6877 @sc{cvs} does not notify you for your own changes.
6878 Currently this check is done based on whether the user
6879 name of the person taking the action which triggers
6880 notification matches the user name of the person
6881 getting notification. In fact, in general, the watches
6882 features only track one edit by each user. It probably
6883 would be more useful if watches tracked each working
6884 directory separately, so this behavior might be worth
6885 changing.
6886 @c "behavior might be worth changing" is an effort to
6887 @c point to future directions while also not promising
6888 @c that "they" (as in "why don't they fix CVS to....")
6889 @c will do this.
6890 @c one implementation issue is identifying whether a
6891 @c working directory is same or different. Comparing
6892 @c pathnames/hostnames is hopeless, but having the server
6893 @c supply a serial number which the client stores in the
6894 @c CVS directory as a magic cookie should work.
6895
6896 @node Editing files
6897 @subsection How to edit a file which is being watched
6898
6899 @cindex Checkout, as term for getting ready to edit
6900 Since a file which is being watched is checked out
6901 read-only, you cannot simply edit it. To make it
6902 read-write, and inform others that you are planning to
6903 edit it, use the @code{cvs edit} command. Some systems
6904 call this a @dfn{checkout}, but @sc{cvs} uses that term
6905 for obtaining a copy of the sources (@pxref{Getting the
6906 source}), an operation which those systems call a
6907 @dfn{get} or a @dfn{fetch}.
6908 @c Issue to think about: should we transition CVS
6909 @c towards the "get" terminology? "cvs get" is already a
6910 @c synonym for "cvs checkout" and that section of the
6911 @c manual refers to "Getting the source". If this is
6912 @c done, needs to be done gingerly (for example, we should
6913 @c still accept "checkout" in .cvsrc files indefinitely
6914 @c even if the CVS's messages are changed from "cvs checkout: "
6915 @c to "cvs get: ").
6916 @c There is a concern about whether "get" is not as
6917 @c good for novices because it is a more general term
6918 @c than "checkout" (and thus arguably harder to assign
6919 @c a technical meaning for).
6920
6921 @cindex edit (subcommand)
6922 @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
6923
6924 Prepare to edit the working files @var{files}. @sc{cvs} makes the
6925 @var{files} read-write, and notifies users who have requested
6926 @code{edit} notification for any of @var{files}.
6927
6928 The @code{cvs edit} command accepts the same options as the
6929 @code{cvs watch add} command, and establishes a temporary watch for the
6930 user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
6931 @code{unedit}ed or @code{commit}ted. If the user does not wish to
6932 receive notifications, she should specify @code{-a none}.
6933
6934 The @var{files} and the options are processed as for the @code{cvs
6935 watch} commands.
6936
6937 There are two additional options that @code{cvs edit} understands as of
6938 @sc{cvs} client and server versions 1.12.10 but @code{cvs watch} does not.
6939 The first is @code{-c}, which causes @code{cvs edit} to fail if anyone else
6940 is editing the file. This is probably only useful when @samp{edit -c} and
6941 @samp{commit -c} are specified in all developers' @file{.cvsrc} files. This
6942 behavior may be overriden this via the @code{-f} option, which overrides
6943 @code{-c} and allows multiple edits to succeed.
6944
6945 @ignore
6946 @strong{Caution: If the @code{PreservePermissions}
6947 option is enabled in the repository (@pxref{config}),
6948 @sc{cvs} will not change the permissions on any of the
6949 @var{files}. The reason for this change is to ensure
6950 that using @samp{cvs edit} does not interfere with the
6951 ability to store file permissions in the @sc{cvs}
6952 repository.}
6953 @end ignore
6954
6955 @end deffn
6956
6957 Normally when you are done with a set of changes, you
6958 use the @code{cvs commit} command, which checks in your
6959 changes and returns the watched files to their usual
6960 read-only state. But if you instead decide to abandon
6961 your changes, or not to make any changes, you can use
6962 the @code{cvs unedit} command.
6963
6964 @cindex unedit (subcommand)
6965 @cindex Abandoning work
6966 @cindex Reverting to repository version
6967 @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
6968
6969 Abandon work on the working files @var{files}, and revert them to the
6970 repository versions on which they are based. @sc{cvs} makes those
6971 @var{files} read-only for which users have requested notification using
6972 @code{cvs watch on}. @sc{cvs} notifies users who have requested @code{unedit}
6973 notification for any of @var{files}.
6974
6975 The @var{files} and options are processed as for the
6976 @code{cvs watch} commands.
6977
6978 If watches are not in use, the @code{unedit} command
6979 probably does not work, and the way to revert to the
6980 repository version is with the command @code{cvs update -C file}
6981 (@pxref{update}).
6982 The meaning is
6983 not precisely the same; the latter may also
6984 bring in some changes which have been made in the
6985 repository since the last time you updated.
6986 @c It would be a useful enhancement to CVS to make
6987 @c unedit work in the non-watch case as well.
6988 @end deffn
6989
6990 When using client/server @sc{cvs}, you can use the
6991 @code{cvs edit} and @code{cvs unedit} commands even if
6992 @sc{cvs} is unable to successfully communicate with the
6993 server; the notifications will be sent upon the next
6994 successful @sc{cvs} command.
6995
6996 @node Watch information
6997 @subsection Information about who is watching and editing
6998
6999 @cindex watchers (subcommand)
7000 @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
7001
7002 List the users currently watching changes to @var{files}. The report
7003 includes the files being watched, and the mail address of each watcher.
7004
7005 The @var{files} and options are processed as for the
7006 @code{cvs watch} commands.
7007
7008 @end deffn
7009
7010
7011 @cindex editors (subcommand)
7012 @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
7013
7014 List the users currently working on @var{files}. The report
7015 includes the mail address of each user, the time when the user began
7016 working with the file, and the host and path of the working directory
7017 containing the file.
7018
7019 The @var{files} and options are processed as for the
7020 @code{cvs watch} commands.
7021
7022 @end deffn
7023
7024 @node Watches Compatibility
7025 @subsection Using watches with old versions of CVS
7026
7027 @cindex CVS 1.6, and watches
7028 If you use the watch features on a repository, it
7029 creates @file{CVS} directories in the repository and
7030 stores the information about watches in that directory.
7031 If you attempt to use @sc{cvs} 1.6 or earlier with the
7032 repository, you get an error message such as the
7033 following (all on one line):
7034
7035 @example
7036 cvs update: cannot open CVS/Entries for reading:
7037 No such file or directory
7038 @end example
7039
7040 @noindent
7041 and your operation will likely be aborted. To use the
7042 watch features, you must upgrade all copies of @sc{cvs}
7043 which use that repository in local or server mode. If
7044 you cannot upgrade, use the @code{watch off} and
7045 @code{watch remove} commands to remove all watches, and
7046 that will restore the repository to a state which
7047 @sc{cvs} 1.6 can cope with.
7048
7049 @node Choosing a model
7050 @section Choosing between reserved or unreserved checkouts
7051 @cindex Choosing, reserved or unreserved checkouts
7052
7053 Reserved and unreserved checkouts each have pros and
7054 cons. Let it be said that a lot of this is a matter of
7055 opinion or what works given different groups' working
7056 styles, but here is a brief description of some of the
7057 issues. There are many ways to organise a team of
7058 developers. @sc{cvs} does not try to enforce a certain
7059 organization. It is a tool that can be used in several
7060 ways.
7061
7062 Reserved checkouts can be very counter-productive. If
7063 two persons want to edit different parts of a file,
7064 there may be no reason to prevent either of them from
7065 doing so. Also, it is common for someone to take out a
7066 lock on a file, because they are planning to edit it,
7067 but then forget to release the lock.
7068
7069 @c "many groups"? specifics? cites to papers on this?
7070 @c some way to weasel-word it a bit more so we don't
7071 @c need facts :-)?
7072 People, especially people who are familiar with
7073 reserved checkouts, often wonder how often conflicts
7074 occur if unreserved checkouts are used, and how
7075 difficult they are to resolve. The experience with
7076 many groups is that they occur rarely and usually are
7077 relatively straightforward to resolve.
7078
7079 The rarity of serious conflicts may be surprising, until one realises
7080 that they occur only when two developers disagree on the proper design
7081 for a given section of code; such a disagreement suggests that the
7082 team has not been communicating properly in the first place. In order
7083 to collaborate under @emph{any} source management regimen, developers
7084 must agree on the general design of the system; given this agreement,
7085 overlapping changes are usually straightforward to merge.
7086
7087 In some cases unreserved checkouts are clearly
7088 inappropriate. If no merge tool exists for the kind of
7089 file you are managing (for example word processor files
7090 or files edited by Computer Aided Design programs), and
7091 it is not desirable to change to a program which uses a
7092 mergeable data format, then resolving conflicts is
7093 going to be unpleasant enough that you generally will
7094 be better off to simply avoid the conflicts instead, by
7095 using reserved checkouts.
7096
7097 The watches features described above in @ref{Watches}
7098 can be considered to be an intermediate model between
7099 reserved checkouts and unreserved checkouts. When you
7100 go to edit a file, it is possible to find out who else
7101 is editing it. And rather than having the system
7102 simply forbid both people editing the file, it can tell
7103 you what the situation is and let you figure out
7104 whether it is a problem in that particular case or not.
7105 Therefore, for some groups watches can be
7106 considered the best of both the reserved checkout and unreserved
7107 checkout worlds.
7108
7109 As of @sc{cvs} client and server versions 1.12.10, you may also enable
7110 advisory locks by putting @samp{edit -c} and @samp{commit -c} in all
7111 developers' @file{.cvsrc} files. After this is done, @code{cvs edit}
7112 will fail if there are any other editors, and @code{cvs commit} will
7113 fail if the committer has not registered to edit the file via @code{cvs edit}.
7114 This is most effective in conjunction with files checked out read-only by
7115 default, which may be enabled by turning on watches in the repository or by
7116 putting @samp{cvs -r} in all @file{.cvsrc} files.
7117
7118
7119 @c ---------------------------------------------------------------------
7120 @node Revision management
7121 @chapter Revision management
7122 @cindex Revision management
7123
7124 @c -- This chapter could be expanded a lot.
7125 @c -- Experiences are very welcome!
7126
7127 If you have read this far, you probably have a pretty
7128 good grasp on what @sc{cvs} can do for you. This
7129 chapter talks a little about things that you still have
7130 to decide.
7131
7132 If you are doing development on your own using @sc{cvs}
7133 you could probably skip this chapter. The questions
7134 this chapter takes up become more important when more
7135 than one person is working in a repository.
7136
7137 @menu
7138 * When to commit:: Some discussion on the subject
7139 @end menu
7140
7141 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7142 @node When to commit
7143 @section When to commit?
7144 @cindex When to commit
7145 @cindex Committing, when to
7146 @cindex Policy
7147
7148 Your group should decide which policy to use regarding
7149 commits. Several policies are possible, and as your
7150 experience with @sc{cvs} grows you will probably find
7151 out what works for you.
7152
7153 If you commit files too quickly you might commit files
7154 that do not even compile. If your partner updates his
7155 working sources to include your buggy file, he will be
7156 unable to compile the code. On the other hand, other
7157 persons will not be able to benefit from the
7158 improvements you make to the code if you commit very
7159 seldom, and conflicts will probably be more common.
7160
7161 It is common to only commit files after making sure
7162 that they can be compiled. Some sites require that the
7163 files pass a test suite. Policies like this can be
7164 enforced using the commitinfo file
7165 (@pxref{commitinfo}), but you should think twice before
7166 you enforce such a convention. By making the
7167 development environment too controlled it might become
7168 too regimented and thus counter-productive to the real
7169 goal, which is to get software written.
7170
7171 @c ---------------------------------------------------------------------
7172 @node Keyword substitution
7173 @chapter Keyword substitution
7174 @cindex Keyword substitution
7175 @cindex Keyword expansion
7176 @cindex Identifying files
7177
7178 @comment Be careful when editing this chapter.
7179 @comment Remember that this file is kept under
7180 @comment version control, so we must not accidentally
7181 @comment include a valid keyword in the running text.
7182
7183 As long as you edit source files inside a working
7184 directory you can always find out the state of
7185 your files via @samp{cvs status} and @samp{cvs log}.
7186 But as soon as you export the files from your
7187 development environment it becomes harder to identify
7188 which revisions they are.
7189
7190 @sc{cvs} can use a mechanism known as @dfn{keyword
7191 substitution} (or @dfn{keyword expansion}) to help
7192 identifying the files. Embedded strings of the form
7193 @code{$@var{keyword}$} and
7194 @code{$@var{keyword}:@dots{}$} in a file are replaced
7195 with strings of the form
7196 @code{$@var{keyword}:@var{value}$} whenever you obtain
7197 a new revision of the file.
7198
7199 @menu
7200 * Keyword list:: Keywords
7201 * Using keywords:: Using keywords
7202 * Avoiding substitution:: Avoiding substitution
7203 * Substitution modes:: Substitution modes
7204 * Configuring keyword expansion:: Configuring keyword expansion
7205 * Log keyword:: Problems with the $@splitrcskeyword{Log}$ keyword.
7206 @end menu
7207
7208 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7209 @node Keyword list
7210 @section Keyword List
7211 @cindex Keyword List
7212
7213 @c FIXME: need some kind of example here I think,
7214 @c perhaps in a
7215 @c "Keyword intro" node. The intro in the "Keyword
7216 @c substitution" node itself seems OK, but to launch
7217 @c into a list of the keywords somehow seems too abrupt.
7218
7219 This is a list of the keywords:
7220
7221 @table @code
7222 @cindex Author keyword
7223 @item $@splitrcskeyword{Author}$
7224 The login name of the user who checked in the revision.
7225
7226 @cindex CVSHeader keyword
7227 @item $@splitrcskeyword{CVSHeader}$
7228 A standard header (similar to $@splitrcskeyword{Header}$, but with
7229 the CVS root stripped off). It contains the relative
7230 pathname of the @sc{rcs} file to the CVS root, the
7231 revision number, the date (UTC), the author, the state,
7232 and the locker (if locked). Files will normally never
7233 be locked when you use @sc{cvs}.
7234
7235 Note that this keyword has only been recently
7236 introduced to @sc{cvs} and may cause problems with
7237 existing installations if $@splitrcskeyword{CVSHeader}$ is already
7238 in the files for a different purpose. This keyword may
7239 be excluded using the @code{KeywordExpand=eCVSHeader}
7240 in the @file{CVSROOT/config} file.
7241 See @ref{Configuring keyword expansion} for more details.
7242
7243 @cindex Date keyword
7244 @item $@splitrcskeyword{Date}$
7245 The date and time (UTC) the revision was checked in.
7246
7247 @cindex Mdocdate keyword
7248 @item $@splitrcskeyword{Mdocdate}$
7249 The date (UTC) the revision was checked in, in a format suitable
7250 for the Berkeley mdoc macro processing.
7251
7252 @example
7253 $Mdocdate: November 3 2025 $
7254 @end example
7255
7256 @cindex Header keyword
7257 @item $@splitrcskeyword{Header}$
7258 A standard header containing the full pathname of the
7259 @sc{rcs} file, the revision number, the date (UTC), the
7260 author, the state, and the locker (if locked). Files
7261 will normally never be locked when you use @sc{cvs}.
7262
7263 @cindex Id keyword
7264 @item $@splitrcskeyword{Id}$
7265 Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
7266 filename is without a path.
7267
7268 @cindex Name keyword
7269 @item $@splitrcskeyword{Name}$
7270 Tag name used to check out this file. The keyword is
7271 expanded only if one checks out with an explicit tag
7272 name. For example, when running the command @code{cvs
7273 co -r first}, the keyword expands to @samp{Name: first}.
7274
7275 @cindex Locker keyword
7276 @item $@splitrcskeyword{Locker}$
7277 The login name of the user who locked the revision
7278 (empty if not locked, which is the normal case unless
7279 @code{cvs admin -l} is in use).
7280
7281 @cindex Log keyword
7282 @cindex MaxCommentLeaderLength
7283 @cindex UseArchiveCommentLeader
7284 @cindex Log keyword, configuring substitution behavior
7285 @item $@splitrcskeyword{Log}$
7286 The log message supplied during commit, preceded by a
7287 header containing the @sc{rcs} filename, the revision
7288 number, the author, and the date (UTC). Existing log
7289 messages are @emph{not} replaced. Instead, the new log
7290 message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
7291 By default, each new line is prefixed with the same string which
7292 precedes the @code{$@splitrcskeyword{Log}$} keyword, unless it exceeds the
7293 @code{MaxCommentLeaderLength} set in @file{CVSROOT/config}.
7294
7295 For example, if the file contains:
7296
7297 @example
7298 /* Here is what people have been up to:
7299 *
7300 * $@splitrcskeyword{Log}: frob.c,v $
7301 * Revision 1.1 1997/01/03 14:23:51 joe
7302 * Add the superfrobnicate option
7303 *
7304 */
7305 @end example
7306
7307 @noindent
7308 then additional lines which are added when expanding
7309 the @code{$@splitrcskeyword{Log}$} keyword will be preceded by @samp{ * }.
7310 Unlike previous versions of @sc{cvs} and @sc{rcs}, the
7311 @dfn{comment leader} from the @sc{rcs} file is not used.
7312 The @code{$@splitrcskeyword{Log}$} keyword is useful for
7313 accumulating a complete change log in a source file,
7314 but for several reasons it can be problematic.
7315
7316 If the prefix of the @code{$@splitrcskeyword{Log}$} keyword turns out to be
7317 longer than the @file{CVSROOT/config} setting @code{MaxCommentLeaderLength},
7318 CVS will skip expansion of this
7319 keyword unless @code{UseArchiveCommentLeader} is also set in
7320 @file{CVSROOT/config} and a @samp{comment leader} is set in the RCS archive
7321 file, in which case the comment leader will be used instead. For more on
7322 setting the comment leader in the RCS archive file, @xref{admin}. For more
7323 on configuring the default @code{$@splitrcskeyword{Log}$} substitution
7324 behavior, @xref{config}.
7325
7326 @xref{Log keyword}.
7327
7328 @cindex RCSfile keyword
7329 @item $@splitrcskeyword{RCSfile}$
7330 The name of the RCS file without a path.
7331
7332 @cindex Revision keyword
7333 @item $@splitrcskeyword{Revision}$
7334 The revision number assigned to the revision.
7335
7336 @cindex Source keyword
7337 @item $@splitrcskeyword{Source}$
7338 The full pathname of the RCS file.
7339
7340 @cindex State keyword
7341 @item $@splitrcskeyword{State}$
7342 The state assigned to the revision. States can be
7343 assigned with @code{cvs admin -s}---see @ref{admin options}.
7344
7345 @cindex Local keyword
7346 @item Local keyword
7347 The @code{LocalKeyword} option in the @file{CVSROOT/config} file
7348 may be used to specify a local keyword which is to be
7349 used as an alias for one of the keywords: $@splitrcskeyword{Id}$,
7350 $@splitrcskeyword{Header}$, or $@splitrcskeyword{CVSHeader}$. For
7351 example, if the @file{CVSROOT/config} file contains
7352 a line with @code{LocalKeyword=MYBSD=CVSHeader}, then a
7353 file with the local keyword $@splitrcskeyword{MYBSD}$ will be
7354 expanded as if it were a $@splitrcskeyword{CVSHeader}$ keyword. If
7355 the src/frob.c file contained this keyword, it might
7356 look something like this:
7357
7358 @example
7359 /*
7360 * $@splitrcskeyword{MYBSD}: src/frob.c,v 1.1 2003/05/04 09:27:45 john Exp $
7361 */
7362 @end example
7363
7364 Many repositories make use of a such a ``local
7365 keyword'' feature. An old patch to @sc{cvs} provided
7366 the @code{LocalKeyword} feature using a @code{tag=}
7367 option and called this the ``custom tag'' or ``local
7368 tag'' feature. It was used in conjunction with the
7369 what they called the @code{tagexpand=} option. In
7370 @sc{cvs} this other option is known as the
7371 @code{KeywordExpand} option.
7372 See @ref{Configuring keyword expansion} for more
7373 details.
7374
7375 Examples from popular projects include:
7376 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7377 $@splitrcskeyword{OpenBSD}$, $@splitrcskeyword{XFree86}$,
7378 $@splitrcskeyword{Xorg}$.
7379
7380 The advantage of this is that you can include your
7381 local version information in a file using this local
7382 keyword without disrupting the upstream version
7383 information (which may be a different local keyword or
7384 a standard keyword). Allowing bug reports and the like
7385 to more properly identify the source of the original
7386 bug to the third-party and reducing the number of
7387 conflicts that arise during an import of a new version.
7388
7389 All keyword expansion except the local keyword may be
7390 disabled using the @code{KeywordExpand} option in
7391 the @file{CVSROOT/config} file---see
7392 @ref{Configuring keyword expansion} for more details.
7393
7394 @end table
7395
7396 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7397 @node Using keywords
7398 @section Using keywords
7399
7400 To include a keyword string you simply include the
7401 relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
7402 file, and commit the file. @sc{cvs} will automatically (Or,
7403 more accurately, as part of the update run that
7404 automatically happens after a commit.)
7405 expand the string as part of the commit operation.
7406
7407 It is common to embed the @code{$@splitrcskeyword{Id}$} string in
7408 the source files so that it gets passed through to
7409 generated files. For example, if you are managing
7410 computer program source code, you might include a
7411 variable which is initialised to contain that string.
7412 Or some C compilers may provide a @code{#pragma ident}
7413 directive. Or a document management system might
7414 provide a way to pass a string through to generated
7415 files.
7416
7417 @c Would be nice to give an example, but doing this in
7418 @c portable C is not possible and the problem with
7419 @c picking any one language (VMS HELP files, Ada,
7420 @c troff, whatever) is that people use CVS for all
7421 @c kinds of files.
7422
7423 @cindex Ident (shell command)
7424 The @code{ident} command (which is part of the @sc{rcs}
7425 package) can be used to extract keywords and their
7426 values from a file. This can be handy for text files,
7427 but it is even more useful for extracting keywords from
7428 binary files.
7429
7430 @example
7431 $ ident samp.c
7432 samp.c:
7433 $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7434 $ gcc samp.c
7435 $ ident a.out
7436 a.out:
7437 $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
7438 @end example
7439
7440 @cindex What (shell command)
7441 S@sc{ccs} is another popular revision control system.
7442 It has a command, @code{what}, which is very similar to
7443 @code{ident} and used for the same purpose. Many sites
7444 without @sc{rcs} have @sc{sccs}. Since @code{what}
7445 looks for the character sequence @code{@@(#)} it is
7446 easy to include keywords that are detected by either
7447 command. Simply prefix the keyword with the
7448 magic @sc{sccs} phrase, like this:
7449
7450 @example
7451 static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
7452 @end example
7453
7454 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7455 @node Avoiding substitution
7456 @section Avoiding substitution
7457
7458 Keyword substitution has its disadvantages. Sometimes
7459 you might want the literal text string
7460 @samp{$@splitrcskeyword{Author}$} to appear inside a file without
7461 @sc{cvs} interpreting it as a keyword and expanding it
7462 into something like @samp{$@splitrcskeyword{Author}: ceder $}.
7463
7464 There is unfortunately no way to selectively turn off
7465 keyword substitution. You can use @samp{-ko}
7466 (@pxref{Substitution modes}) to turn off keyword
7467 substitution entirely.
7468
7469 In many cases you can avoid using keywords in
7470 the source, even though they appear in the final
7471 product. For example, the source for this manual
7472 contains @samp{$@@asis@{@}Author$} whenever the text
7473 @samp{$@splitrcskeyword{Author}$} should appear. In @code{nroff}
7474 and @code{troff} you can embed the null-character
7475 @code{\&} inside the keyword for a similar effect.
7476
7477 It is also possible to specify an explicit list of
7478 keywords to include or exclude using the
7479 @code{KeywordExpand} option in the
7480 @file{CVSROOT/config} file--see @ref{Configuring keyword expansion}
7481 for more details. This feature is intended primarily
7482 for use with the @code{LocalKeyword} option--see
7483 @ref{Keyword list}.
7484
7485 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7486 @node Substitution modes
7487 @section Substitution modes
7488 @cindex Keyword substitution, changing modes
7489 @cindex -k (keyword substitution)
7490 @cindex Kflag
7491
7492 @c FIXME: This could be made more coherent, by expanding it
7493 @c with more examples or something.
7494 Each file has a stored default substitution mode, and
7495 each working directory copy of a file also has a
7496 substitution mode. The former is set by the @samp{-k}
7497 option to @code{cvs add} and @code{cvs admin}; the
7498 latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
7499 checkout} or @code{cvs update}.
7500 @code{cvs diff} and @code{cvs rdiff} also
7501 have @samp{-k} options.
7502 For some examples,
7503 see @ref{Binary files}, and @ref{Merging and keywords}.
7504 @c The fact that -A is overloaded to mean both reset
7505 @c sticky options and reset sticky tags/dates is
7506 @c somewhat questionable. Perhaps there should be
7507 @c separate options to reset sticky options (e.g. -k
7508 @c A") and tags/dates (someone suggested -r HEAD could
7509 @c do this instead of setting a sticky tag of "HEAD"
7510 @c as in the status quo but I haven't thought much
7511 @c about that idea. Of course -r .reset or something
7512 @c could be coined if this needs to be a new option).
7513 @c On the other hand, having -A mean "get things back
7514 @c into the state after a fresh checkout" has a certain
7515 @c appeal, and maybe there is no sufficient reason for
7516 @c creeping featurism in this area.
7517
7518 The modes available are:
7519
7520 @table @samp
7521 @item -kkv
7522 Generate keyword strings using the default form, e.g.
7523 @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
7524 keyword.
7525
7526 @item -kkvl
7527 Like @samp{-kkv}, except that a locker's name is always
7528 inserted if the given revision is currently locked.
7529 The locker's name is only relevant if @code{cvs admin
7530 -l} is in use.
7531
7532 @item -kk
7533 Generate only keyword names in keyword strings; omit
7534 their values. For example, for the @code{Revision}
7535 keyword, generate the string @code{$@splitrcskeyword{Revision}$}
7536 instead of @code{$@splitrcskeyword{Revision}: 5.7 $}. This option
7537 is useful to ignore differences due to keyword
7538 substitution when comparing different revisions of a
7539 file (@pxref{Merging and keywords}).
7540
7541 @item -ko
7542 Generate the old keyword string, present in the working
7543 file just before it was checked in. For example, for
7544 the @code{Revision} keyword, generate the string
7545 @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
7546 @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
7547 string appeared when the file was checked in.
7548
7549 @item -kb
7550 Like @samp{-ko}, but also inhibit conversion of line
7551 endings between the canonical form in which they are
7552 stored in the repository (linefeed only), and the form
7553 appropriate to the operating system in use on the
7554 client. For systems, like unix, which use linefeed
7555 only to terminate lines, this is very similar to
7556 @samp{-ko}. For more information on binary files, see
7557 @ref{Binary files}. In @sc{cvs} version 1.12.2 and later
7558 @samp{-kb}, as set by @code{cvs add}, @code{cvs admin}, or
7559 @code{cvs import} may not be overridden by a @samp{-k} option
7560 specified on the command line.
7561
7562 @item -kv
7563 Generate only keyword values for keyword strings. For
7564 example, for the @code{Revision} keyword, generate the string
7565 @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
7566 This can help generate files in programming languages
7567 where it is hard to strip keyword delimiters like
7568 @code{$@splitrcskeyword{Revision}: $} from a string. However,
7569 further keyword substitution cannot be performed once
7570 the keyword names are removed, so this option should be
7571 used with care.
7572
7573 One often would like to use @samp{-kv} with @code{cvs
7574 export}---@pxref{export}. But be aware that doesn't
7575 handle an export containing binary files correctly.
7576
7577 @end table
7578
7579 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7580 @node Configuring keyword expansion
7581 @section Configuring Keyword Expansion
7582 @cindex Configuring keyword expansion
7583
7584 In a repository that includes third-party software on
7585 vendor branches, it is sometimes helpful to configure
7586 CVS to use a local keyword instead of the standard
7587 $@splitrcskeyword{Id}$ or $@splitrcskeyword{Header}$ keywords. Examples from
7588 real projects include $@splitrcskeyword{Xorg}$, $@splitrcskeyword{XFree86}$,
7589 $@splitrcskeyword{FreeBSD}$, $@splitrcskeyword{NetBSD}$,
7590 $@splitrcskeyword{OpenBSD}$, and even $@splitrcskeyword{dotat}$.
7591 The advantage of this is that
7592 you can include your local version information in a
7593 file using this local keyword (sometimes called a
7594 ``custom tag'' or a ``local tag'') without disrupting
7595 the upstream version information (which may be a
7596 different local keyword or a standard keyword). In
7597 these cases, it is typically desirable to disable the
7598 expansion of all keywords except the configured local
7599 keyword.
7600
7601 The @code{KeywordExpand} option in the
7602 @file{CVSROOT/config} file is intended to allow for the
7603 either the explicit exclusion of a keyword or list of
7604 keywords, or for the explicit inclusion of a keyword or
7605 a list of keywords. This list may include the
7606 @code{LocalKeyword} that has been configured.
7607
7608 The @code{KeywordExpand} option is followed by
7609 @code{=} and the next character may either be @code{i}
7610 to start an inclusion list or @code{e} to start an
7611 exclusion list. If the following lines were added to
7612 the @file{CVSROOT/config} file:
7613
7614 @example
7615 # Add a "MyBSD" keyword and restrict keyword
7616 # expansion
7617 LocalKeyword=MyBSD=CVSHeader
7618 KeywordExpand=iMyBSD
7619 @end example
7620
7621 then only the $@splitrcskeyword{MyBSD}$ keyword would be expanded.
7622 A list may be used. The this example:
7623
7624 @example
7625 # Add a "MyBSD" keyword and restrict keyword expansion
7626 # to the MyBSD, Name, Date and Mdocdate keywords.
7627 LocalKeyword=MyBSD=CVSHeader
7628 KeywordExpand=iMyBSD,Name,Date,Mdocdate
7629 @end example
7630
7631 would allow $@splitrcskeyword{MyBSD}$, $@splitrcskeyword{Name}$,
7632 $@splitrcskeyword{Mdocdate} and
7633 $@splitrcskeyword{Date}$ to be expanded.
7634
7635 It is also possible to configure an exclusion list
7636 using the following:
7637
7638 @example
7639 # Do not expand the non-RCS keyword CVSHeader
7640 KeywordExpand=eCVSHeader
7641 @end example
7642
7643 This allows @sc{cvs} to ignore the recently introduced
7644 $@splitrcskeyword{CVSHeader}$ keyword and retain all of the
7645 others. The exclusion entry could also contain the
7646 standard RCS keyword list, but this could be confusing
7647 to users that expect RCS keywords to be expanded, so
7648 care should be taken to properly set user expectations
7649 for a repository that is configured in that manner.
7650
7651 If there is a desire to not have any RCS keywords
7652 expanded and not use the @code{-ko} flags everywhere,
7653 an administrator may disable all keyword expansion
7654 using the @file{CVSROOT/config} line:
7655
7656 @example
7657 # Do not expand any RCS keywords
7658 KeywordExpand=i
7659 @end example
7660
7661 this could be confusing to users that expect RCS
7662 keywords like $@splitrcskeyword{Id}$ to be expanded properly,
7663 so care should be taken to properly set user
7664 expectations for a repository so configured.
7665
7666 It should be noted that a patch to provide both the
7667 @code{KeywordExpand} and @code{LocalKeyword} features
7668 has been around a long time. However, that patch
7669 implemented these features using @code{tag=} and
7670 @code{tagexpand=} keywords and those keywords are NOT
7671 recognised.
7672
7673 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7674 @node Log keyword
7675 @section Problems with the $@splitrcskeyword{Log}$ keyword.
7676
7677 The @code{$@splitrcskeyword{Log}$} keyword is somewhat
7678 controversial. As long as you are working on your
7679 development system the information is easily accessible
7680 even if you do not use the @code{$@splitrcskeyword{Log}$}
7681 keyword---just do a @code{cvs log}. Once you export
7682 the file the history information might be useless
7683 anyhow.
7684
7685 A more serious concern is that @sc{cvs} is not good at
7686 handling @code{$@splitrcskeyword{Log}$} entries when a branch is
7687 merged onto the main trunk. Conflicts often result
7688 from the merging operation.
7689 @c Might want to check whether the CVS implementation
7690 @c of RCS_merge has this problem the same way rcsmerge
7691 @c does. I would assume so....
7692
7693 People also tend to "fix" the log entries in the file
7694 (correcting spelling mistakes and maybe even factual
7695 errors). If that is done the information from
7696 @code{cvs log} will not be consistent with the
7697 information inside the file. This may or may not be a
7698 problem in real life.
7699
7700 It has been suggested that the @code{$@splitrcskeyword{Log}$}
7701 keyword should be inserted @emph{last} in the file, and
7702 not in the files header, if it is to be used at all.
7703 That way the long list of change messages will not
7704 interfere with everyday source file browsing.
7705
7706 @c ---------------------------------------------------------------------
7707 @node Tracking sources
7708 @chapter Tracking third-party sources
7709 @cindex Third-party sources
7710 @cindex Tracking sources
7711
7712 @c FIXME: Need discussion of added and removed files.
7713 @c FIXME: This doesn't really adequately introduce the
7714 @c concepts of "vendor" and "you". They don't *have*
7715 @c to be separate organizations or separate people.
7716 @c We want a description which is somewhat more based on
7717 @c the technical issues of which sources go where, but
7718 @c also with enough examples of how this relates to
7719 @c relationships like customer-supplier, developer-QA,
7720 @c maintainer-contributor, or whatever, to make it
7721 @c seem concrete.
7722 If you modify a program to better fit your site, you
7723 probably want to include your modifications when the next
7724 release of the program arrives. @sc{cvs} can help you with
7725 this task.
7726
7727 @cindex Vendor
7728 @cindex Vendor branch
7729 @cindex Branch, vendor-
7730 In the terminology used in @sc{cvs}, the supplier of the
7731 program is called a @dfn{vendor}. The unmodified
7732 distribution from the vendor is checked in on its own
7733 branch, the @dfn{vendor branch}. @sc{cvs} reserves branch
7734 1.1.1 for this use.
7735
7736 When you modify the source and commit it, your revision
7737 will end up on the main trunk. When a new release is
7738 made by the vendor, you commit it on the vendor branch
7739 and copy the modifications onto the main trunk.
7740
7741 Use the @code{import} command to create and update
7742 the vendor branch. When you import a new file,
7743 (usually) the vendor branch is made the `head' revision, so
7744 anyone that checks out a copy of the file gets that
7745 revision. When a local modification is committed it is
7746 placed on the main trunk, and made the `head'
7747 revision.
7748
7749 @menu
7750 * First import:: Importing for the first time
7751 * Update imports:: Updating with the import command
7752 * Reverting local changes:: Reverting to the latest vendor release
7753 * Binary files in imports:: Binary files require special handling
7754 * Keywords in imports:: Keyword substitution might be undesirable
7755 * Multiple vendor branches:: What if you get sources from several places?
7756 @end menu
7757
7758 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7759 @node First import
7760 @section Importing for the first time
7761 @cindex Importing modules
7762
7763 @c Should mention naming conventions for vendor tags,
7764 @c release tags, and perhaps directory names.
7765 Use the @code{import} command to check in the sources
7766 for the first time. When you use the @code{import}
7767 command to track third-party sources, the @dfn{vendor
7768 tag} and @dfn{release tags} are useful. The
7769 @dfn{vendor tag} is a symbolic name for the branch
7770 (which is always 1.1.1, unless you use the @samp{-b
7771 @var{branch}} flag---see @ref{Multiple vendor branches}.). The
7772 @dfn{release tags} are symbolic names for a particular
7773 release, such as @samp{FSF_0_04}.
7774
7775 @c I'm not completely sure this belongs here. But
7776 @c we need to say it _somewhere_ reasonably obvious; it
7777 @c is a common misconception among people first learning CVS
7778 Note that @code{import} does @emph{not} change the
7779 directory in which you invoke it. In particular, it
7780 does not set up that directory as a @sc{cvs} working
7781 directory; if you want to work with the sources import
7782 them first and then check them out into a different
7783 directory (@pxref{Getting the source}).
7784
7785 @cindex wdiff (import example)
7786 Suppose you have the sources to a program called
7787 @code{wdiff} in a directory @file{wdiff-0.04},
7788 and are going to make private modifications that you
7789 want to be able to use even when new releases are made
7790 in the future. You start by importing the source to
7791 your repository:
7792
7793 @example
7794 $ cd wdiff-0.04
7795 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
7796 @end example
7797
7798 The vendor tag is named @samp{FSF_DIST} in the above
7799 example, and the only release tag assigned is
7800 @samp{WDIFF_0_04}.
7801 @c FIXME: Need to say where fsf/wdiff comes from.
7802
7803 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7804 @node Update imports
7805 @section Updating with the import command
7806
7807 When a new release of the source arrives, you import it into the
7808 repository with the same @code{import} command that you used to set up
7809 the repository in the first place. The only difference is that you
7810 specify a different release tag this time:
7811
7812 @example
7813 $ tar xfz wdiff-0.05.tar.gz
7814 $ cd wdiff-0.05
7815 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
7816 @end example
7817
7818 @emph{WARNING: If you use a release tag that already exists in one of the
7819 repository archives, files removed by an import may not be detected.}
7820
7821 For files that have not been modified locally, the newly created
7822 revision becomes the head revision. If you have made local
7823 changes, @code{import} will warn you that you must merge the changes
7824 into the main trunk, and tell you to use @samp{checkout -j} to do so:
7825
7826 @c FIXME: why "wdiff" here and "fsf/wdiff" in the
7827 @c "import"? I think the assumption is that one has
7828 @c "wdiff fsf/wdiff" or some such in modules, but it
7829 @c would be better to not use modules in this example.
7830 @example
7831 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
7832 @end example
7833
7834 @noindent
7835 The above command will check out the latest revision of
7836 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
7837 since yesterday into the working copy. If any conflicts arise during
7838 the merge they should be resolved in the normal way (@pxref{Conflicts
7839 example}). Then, the modified files may be committed.
7840
7841 However, it is much better to use the two release tags rather than using
7842 a date on the branch as suggested above:
7843
7844 @example
7845 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
7846 @end example
7847
7848 @noindent
7849 The reason this is better is that
7850 using a date, as suggested above, assumes that you do
7851 not import more than one release of a product per day.
7852 More importantly, using the release tags allows @sc{cvs} to detect files
7853 that were removed between the two vendor releases and mark them for
7854 removal. Since @code{import} has no way to detect removed files, you
7855 should do a merge like this even if @code{import} doesn't tell you to.
7856
7857 @node Reverting local changes
7858 @section Reverting to the latest vendor release
7859
7860 You can also revert local changes completely and return
7861 to the latest vendor release by changing the `head'
7862 revision back to the vendor branch on all files. This
7863 does, however, produce weird results if you should ever
7864 edit this file again, for anyone looking at the output
7865 from the @code{log} command or CVSweb. To fix this,
7866 first commit a revision of the file which equals the
7867 vendor branch, then use @code{admin} @samp{-b}. For
7868 example, if you have a checked-out copy of the sources
7869 in @file{~/work.d/wdiff}, and you want to revert to the
7870 vendor's version for all the files in that directory,
7871 you would type:
7872
7873 @example
7874 $ cd ~/work.d/wdiff
7875 $ cvs admin -bFSF_DIST .
7876 @end example
7877
7878 @noindent
7879 You must specify the @samp{-bFSF_DIST} without any space
7880 after the @samp{-b}. @xref{admin options}.
7881
7882 @node Binary files in imports
7883 @section How to handle binary files with cvs import
7884
7885 Use the @samp{-k} wrapper option to tell import which
7886 files are binary. @xref{Wrappers}.
7887
7888 @node Keywords in imports
7889 @section How to handle keyword substitution with cvs import
7890
7891 The sources which you are importing may contain
7892 keywords (@pxref{Keyword substitution}). For example,
7893 the vendor may use @sc{cvs} or some other system
7894 which uses similar keyword expansion syntax. If you
7895 just import the files in the default fashion, then
7896 the keyword expansions supplied by the vendor will
7897 be replaced by keyword expansions supplied by your
7898 own copy of @sc{cvs}. It may be more convenient to
7899 maintain the expansions supplied by the vendor, so
7900 that this information can supply information about
7901 the sources that you imported from the vendor.
7902
7903 To maintain the keyword expansions supplied by the
7904 vendor, supply the @samp{-ko} option to @code{cvs
7905 import} the first time you import the file.
7906 This will turn off keyword expansion
7907 for that file entirely, so if you want to be more
7908 selective you'll have to think about what you want
7909 and use the @samp{-k} option to @code{cvs update} or
7910 @code{cvs admin} as appropriate.
7911 @c Supplying -ko to import if the file already existed
7912 @c has no effect. Not clear to me whether it should
7913 @c or not.
7914
7915 @node Multiple vendor branches
7916 @section Multiple vendor branches
7917
7918 All the examples so far assume that there is only one
7919 vendor from which you are getting sources. In some
7920 situations you might get sources from a variety of
7921 places. For example, suppose that you are dealing with
7922 a project where many different people and teams are
7923 modifying the software. There are a variety of ways to
7924 handle this, but in some cases you have a bunch of
7925 source trees lying around and what you want to do more
7926 than anything else is just to all put them in @sc{cvs} so
7927 that you at least have them in one place.
7928
7929 For handling situations in which there may be more than
7930 one vendor, you may specify the @samp{-b} option to
7931 @code{cvs import}. It takes as an argument the vendor
7932 branch to import to. The default is @samp{-b 1.1.1}.
7933
7934 Vendor branches can only be in the format 1.1.x where
7935 @samp{x} is an @emph{uneven} number, because branch
7936 tags use even numbers.
7937
7938 For example, suppose that there are two teams, the red
7939 team and the blue team, that are sending you sources.
7940 You want to import the red team's efforts to branch
7941 1.1.1 and use the vendor tag RED. You want to import
7942 the blue team's efforts to branch 1.1.3 and use the
7943 vendor tag BLUE. So the commands you might use are:
7944
7945 @example
7946 $ cvs import dir RED RED_1-0
7947 $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
7948 @end example
7949
7950 Note that if your vendor tag does not match your
7951 @samp{-b} option, @sc{cvs} will not detect this case! For
7952 example,
7953
7954 @example
7955 $ cvs import -b 1.1.3 dir RED RED_1-0
7956 @end example
7957
7958 @noindent
7959 Be careful; this kind of mismatch is sure to sow
7960 confusion or worse. I can't think of a useful purpose
7961 for the ability to specify a mismatch here, but if you
7962 discover such a use, don't. @sc{cvs} is likely to make this
7963 an error in some future release.
7964
7965 @c Probably should say more about the semantics of
7966 @c multiple branches. What about the default branch?
7967 @c What about joining (perhaps not as useful with
7968 @c multiple branches, or perhaps it is. Either way
7969 @c should be mentioned).
7970
7971 @c I'm not sure about the best location for this. In
7972 @c one sense, it might belong right after we've introduced
7973 @c CVS's basic version control model, because people need
7974 @c to figure out builds right away. The current location
7975 @c is based on the theory that it kind of akin to the
7976 @c "Revision management" section.
7977 @node Builds
7978 @chapter How your build system interacts with CVS
7979 @cindex Builds
7980 @cindex make
7981
7982 As mentioned in the introduction, @sc{cvs} does not
7983 contain software for building your software from source
7984 code. This section describes how various aspects of
7985 your build system might interact with @sc{cvs}.
7986
7987 @c Is there a way to discuss this without reference to
7988 @c tools other than CVS? I'm not sure there is; I
7989 @c wouldn't think that people who learn CVS first would
7990 @c even have this concern.
7991 One common question, especially from people who are
7992 accustomed to @sc{rcs}, is how to make their build get
7993 an up to date copy of the sources. The answer to this
7994 with @sc{cvs} is two-fold. First of all, since
7995 @sc{cvs} itself can recurse through directories, there
7996 is no need to modify your @file{Makefile} (or whatever
7997 configuration file your build tool uses) to make sure
7998 each file is up to date. Instead, just use two
7999 commands, first @code{cvs -q update} and then
8000 @code{make} or whatever the command is to invoke your
8001 build tool. Secondly, you do not necessarily
8002 @emph{want} to get a copy of a change someone else made
8003 until you have finished your own work. One suggested
8004 approach is to first update your sources, then
8005 implement, build and
8006 test the change you were thinking of, and then commit
8007 your sources (updating first if necessary). By
8008 periodically (in between changes, using the approach
8009 just described) updating your entire tree, you ensure
8010 that your sources are sufficiently up to date.
8011
8012 @cindex Bill of materials
8013 One common need is to record which versions of which
8014 source files went into a particular build. This kind
8015 of functionality is sometimes called @dfn{bill of
8016 materials} or something similar. The best way to do
8017 this with @sc{cvs} is to use the @code{tag} command to
8018 record which versions went into a given build
8019 (@pxref{Tags}).
8020
8021 Using @sc{cvs} in the most straightforward manner
8022 possible, each developer will have a copy of the entire
8023 source tree which is used in a particular build. If
8024 the source tree is small, or if developers are
8025 geographically dispersed, this is the preferred
8026 solution. In fact one approach for larger projects is
8027 to break a project down into smaller
8028 @c I say subsystem instead of module because they may or
8029 @c may not use the modules file.
8030 separately-compiled subsystems, and arrange a way of
8031 releasing them internally so that each developer need
8032 check out only those subsystems which they are
8033 actively working on.
8034
8035 Another approach is to set up a structure which allows
8036 developers to have their own copies of some files, and
8037 for other files to access source files from a central
8038 location. Many people have come up with some such a
8039 @c two such people are [email protected] (for
8040 @c a previous employer)
8041 @c and [email protected] (spicm and related tools),
8042 @c but as far as I know
8043 @c no one has nicely packaged or released such a system (or
8044 @c instructions for constructing one).
8045 system using features such as the symbolic link feature
8046 found in many operating systems, or the @code{VPATH}
8047 feature found in many versions of @code{make}. One build
8048 tool which is designed to help with this kind of thing
8049 is Odin (see
8050 @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
8051 @c Should we be saying more about Odin? Or how you use
8052 @c it with CVS? Also, the Prime Time Freeware for Unix
8053 @c disk (see http://www.ptf.com/) has Odin (with a nice
8054 @c paragraph summarizing it on the web), so that might be a
8055 @c semi-"official" place to point people.
8056 @c
8057 @c Of course, many non-CVS systems have this kind of
8058 @c functionality, for example OSF's ODE
8059 @c (http://www.osf.org/ode/) or mk
8060 @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
8061 @c He has changed providers in the past; a search engine search
8062 @c for "Peter Ziobrzynski" probably won't get too many
8063 @c spurious hits :-). A more stable URL might be
8064 @c ftp://ftp.uu.net/pub/cmvc/mk). But I'm not sure
8065 @c there is any point in mentioning them here unless they
8066 @c can work with CVS.
8067
8068 @c ---------------------------------------------------------------------
8069 @node Special Files
8070 @chapter Special Files
8071
8072 @cindex Special files
8073 @cindex Device nodes
8074 @cindex Ownership, saving in CVS
8075 @cindex Permissions, saving in CVS
8076 @cindex Hard links
8077 @cindex Symbolic links
8078
8079 In normal circumstances, @sc{cvs} works only with regular
8080 files. Every file in a project is assumed to be
8081 persistent; it must be possible to open, read and close
8082 them; and so on. @sc{cvs} also ignores file permissions and
8083 ownerships, leaving such issues to be resolved by the
8084 developer at installation time. In other words, it is
8085 not possible to "check in" a device into a repository;
8086 if the device file cannot be opened, @sc{cvs} will refuse to
8087 handle it. Files also lose their ownerships and
8088 permissions during repository transactions.
8089
8090 @ignore
8091 If the configuration variable @code{PreservePermissions}
8092 (@pxref{config}) is set in the repository, @sc{cvs} will
8093 save the following file characteristics in the
8094 repository:
8095
8096 @itemize @bullet
8097 @item user and group ownership
8098 @item permissions
8099 @item major and minor device numbers
8100 @item symbolic links
8101 @item hard link structure
8102 @end itemize
8103
8104 Using the @code{PreservePermissions} option affects the
8105 behavior of @sc{cvs} in several ways. First, some of the
8106 new operations supported by @sc{cvs} are not accessible to
8107 all users. In particular, file ownership and special
8108 file characteristics may only be changed by the
8109 superuser. When the @code{PreservePermissions}
8110 configuration variable is set, therefore, users will
8111 have to be `root' in order to perform @sc{cvs} operations.
8112
8113 When @code{PreservePermissions} is in use, some @sc{cvs}
8114 operations (such as @samp{cvs status}) will not
8115 recognise a file's hard link structure, and so will
8116 emit spurious warnings about mismatching hard links.
8117 The reason is that @sc{cvs}'s internal structure does not
8118 make it easy for these operations to collect all the
8119 necessary data about hard links, so they check for file
8120 conflicts with inaccurate data.
8121
8122 A more subtle difference is that @sc{cvs} considers a file
8123 to have changed only if its contents have changed
8124 (specifically, if the modification time of the working
8125 file does not match that of the repository's file).
8126 Therefore, if only the permissions, ownership or hard
8127 linkage have changed, or if a device's major or minor
8128 numbers have changed, @sc{cvs} will not notice. In order to
8129 commit such a change to the repository, you must force
8130 the commit with @samp{cvs commit -f}. This also means
8131 that if a file's permissions have changed and the
8132 repository file is newer than the working copy,
8133 performing @samp{cvs update} will silently change the
8134 permissions on the working copy.
8135
8136 Changing hard links in a @sc{cvs} repository is particularly
8137 delicate. Suppose that file @file{foo} is linked to
8138 file @file{old}, but is later relinked to file
8139 @file{new}. You can wind up in the unusual situation
8140 where, although @file{foo}, @file{old} and @file{new}
8141 have all had their underlying link patterns changed,
8142 only @file{foo} and @file{new} have been modified, so
8143 @file{old} is not considered a candidate for checking
8144 in. It can be very easy to produce inconsistent
8145 results this way. Therefore, we recommend that when it
8146 is important to save hard links in a repository, the
8147 prudent course of action is to @code{touch} any file
8148 whose linkage or status has changed since the last
8149 checkin. Indeed, it may be wise to @code{touch *}
8150 before each commit in a directory with complex hard
8151 link structures.
8152
8153 It is worth noting that only regular files may
8154 be merged, for reasons that hopefully are obvious. If
8155 @samp{cvs update} or @samp{cvs checkout -j} attempts to
8156 merge a symbolic link with a regular file, or two
8157 device files for different kinds of devices, @sc{cvs} will
8158 report a conflict and refuse to perform the merge. At
8159 the same time, @samp{cvs diff} will not report any
8160 differences between these files, since no meaningful
8161 textual comparisons can be made on files which contain
8162 no text.
8163
8164 The @code{PreservePermissions} features do not work
8165 with client/server @sc{cvs}. Another limitation is
8166 that hard links must be to other files within the same
8167 directory; hard links across directories are not
8168 supported.
8169 @end ignore
8170
8171 @c ---------------------------------------------------------------------
8172 @c ----- START MAN 1 -----
8173 @node CVS commands
8174 @appendix Guide to CVS commands
8175
8176 This appendix describes the overall structure of
8177 @sc{cvs} commands, and describes some commands in
8178 detail (others are described elsewhere; for a quick
8179 reference to @sc{cvs} commands, @pxref{Invoking CVS},
8180 and for an alphabetical list of all @sc{cvs} commands,
8181 @pxref{CVS command list}).
8182 @c The idea is that we want to move the commands which
8183 @c are described here into the main body of the manual,
8184 @c in the process reorganizing the manual to be
8185 @c organised around what the user wants to do, not
8186 @c organised around CVS commands.
8187 @c
8188 @c Note that many users do expect a manual which is
8189 @c organised by command. At least some users do.
8190 @c One good addition to the "organised by command"
8191 @c section (if any) would be "see also" links.
8192 @c The awk manual might be a good example; it has a
8193 @c reference manual which is more verbose than Invoking
8194 @c CVS but probably somewhat less verbose than CVS
8195 @c Commands.
8196
8197 @menu
8198 * Structure:: Overall structure of CVS commands
8199 * Exit status:: Indicating CVS's success or failure
8200 * ~/.cvsrc:: Default options with the ~/.cvsrc file
8201 * Global options:: Options you give to the left of cvs_command
8202 * Common options:: Options you give to the right of cvs_command
8203 * Date input formats:: Acceptable formats for date specifications
8204 * admin:: Administration front-end for RCS
8205 * annotate:: What revision modified each line of a file?
8206 * checkout:: Checkout sources for editing
8207 * commit:: Check files into the repository
8208 * diff:: Show differences between revisions
8209 * export:: Export sources from CVS, similar to checkout
8210 * history:: Show repository access history
8211 * import:: Import sources into CVS, using vendor branches
8212 * log:: Print out history information for files
8213 * ls & rls:: List files in the repository
8214 * rdiff:: Create 'patch' format diffs between revisions
8215 * release:: Indicate that a directory is no longer in use
8216 * server & pserver:: Act as a server for a client on stdin/stdout
8217 * suck:: Download RCS ,v file raw
8218 * update:: Bring work tree in sync with repository
8219 @end menu
8220
8221 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8222 @node Structure
8223 @appendixsec Overall structure of CVS commands
8224 @cindex Structure
8225 @cindex CVS command structure
8226 @cindex Command structure
8227 @cindex Format of CVS commands
8228
8229 The overall format of all @sc{cvs} commands is:
8230
8231 @example
8232 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
8233 @end example
8234
8235 @table @code
8236 @item cvs
8237 The name of the @sc{cvs} program.
8238
8239 @item cvs_options
8240 Some options that affect all sub-commands of @sc{cvs}. These are
8241 described below.
8242
8243 @item cvs_command
8244 One of several different sub-commands. Some of the commands have
8245 aliases that can be used instead; those aliases are noted in the
8246 reference manual for that command. There are only two situations
8247 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
8248 list of available commands, and @samp{cvs -v} displays version
8249 information on @sc{cvs} itself.
8250
8251 @item command_options
8252 Options that are specific for the command.
8253
8254 @item command_args
8255 Arguments to the commands.
8256 @end table
8257
8258 There is unfortunately some confusion between
8259 @code{cvs_options} and @code{command_options}.
8260 When given as a @code{cvs_option}, some options only
8261 affect some of the commands. When given as a
8262 @code{command_option} it may have a different meaning, and
8263 be accepted by more commands. In other words, do not
8264 take the above categorization too seriously. Look at
8265 the documentation instead.
8266
8267 @node Exit status
8268 @appendixsec CVS's exit status
8269 @cindex Exit status, of CVS
8270
8271 @sc{cvs} can indicate to the calling environment whether it
8272 succeeded or failed by setting its @dfn{exit status}.
8273 The exact way of testing the exit status will vary from
8274 one operating system to another. For example in a unix
8275 shell script the @samp{$?} variable will be 0 if the
8276 last command returned a successful exit status, or
8277 greater than 0 if the exit status indicated failure.
8278
8279 If @sc{cvs} is successful, it returns a successful status;
8280 if there is an error, it prints an error message and
8281 returns a failure status. The one exception to this is
8282 the @code{cvs diff} command. It will return a
8283 successful status if it found no differences, or a
8284 failure status if there were differences or if there
8285 was an error. Because this behavior provides no good
8286 way to detect errors, in the future it is possible that
8287 @code{cvs diff} will be changed to behave like the
8288 other @sc{cvs} commands.
8289 @c It might seem like checking whether cvs -q diff
8290 @c produces empty or non-empty output can tell whether
8291 @c there were differences or not. But it seems like
8292 @c there are cases with output but no differences
8293 @c (testsuite basica-8b). It is not clear to me how
8294 @c useful it is for a script to be able to check
8295 @c whether there were differences.
8296 @c FIXCVS? In previous versions of CVS, cvs diff
8297 @c returned 0 for no differences, 1 for differences, or
8298 @c 2 for errors. Is this behavior worth trying to
8299 @c bring back (but what does it mean for VMS?)?
8300
8301 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8302 @node ~/.cvsrc
8303 @appendixsec Default options and the ~/.cvsrc file
8304 @cindex .cvsrc file
8305 @cindex Option defaults
8306
8307 There are some @code{command_options} that are used so
8308 often that you might have set up an alias or some other
8309 means to make sure you always specify that option. One
8310 example (the one that drove the implementation of the
8311 @file{.cvsrc} support, actually) is that many people find the
8312 default output of the @samp{diff} command to be very
8313 hard to read, and that either context diffs or unidiffs
8314 are much easier to understand.
8315
8316 The @file{~/.cvsrc} file is a way that you can add
8317 default options to @code{cvs_commands} within cvs,
8318 instead of relying on aliases or other shell scripts.
8319
8320 The format of the @file{~/.cvsrc} file is simple. The
8321 file is searched for a line that begins with the same
8322 name as the @code{cvs_command} being executed. If a
8323 match is found, then the remainder of the line is split
8324 up (at whitespace characters) into separate options and
8325 added to the command arguments @emph{before} any
8326 options from the command line.
8327
8328 If a command has two names (e.g., @code{checkout} and
8329 @code{co}), the official name, not necessarily the one
8330 used on the command line, will be used to match against
8331 the file. So if this is the contents of the user's
8332 @file{~/.cvsrc} file:
8333
8334 @example
8335 log -N
8336 diff -uN
8337 rdiff -u
8338 update -Pd
8339 checkout -P
8340 release -d
8341 @end example
8342
8343 @noindent
8344 the command @samp{cvs checkout foo} would have the
8345 @samp{-P} option added to the arguments, as well as
8346 @samp{cvs co foo}.
8347
8348 With the example file above, the output from @samp{cvs
8349 diff foobar} will be in unidiff format. @samp{cvs diff
8350 -c foobar} will provide context diffs, as usual.
8351 Getting "old" format diffs would be slightly more
8352 complicated, because @code{diff} doesn't have an option
8353 to specify use of the "old" format, so you would need
8354 @samp{cvs -f diff foobar}.
8355
8356 In place of the command name you can use @code{cvs} to
8357 specify global options (@pxref{Global options}). For
8358 example the following line in @file{.cvsrc}
8359
8360 @example
8361 cvs -z6
8362 @end example
8363
8364 @noindent
8365 causes @sc{cvs} to use compression level 6.
8366
8367 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8368 @node Global options
8369 @appendixsec Global options
8370 @cindex Options, global
8371 @cindex Global options
8372 @cindex Left-hand options
8373
8374 The available @samp{cvs_options} (that are given to the
8375 left of @samp{cvs_command}) are:
8376
8377 @table @code
8378 @item --allow-root=@var{rootdir}
8379 May be invoked multiple times to specify one legal @sc{cvsroot} directory with
8380 each invocation. Also causes CVS to preparse the configuration file for each
8381 specified root, which can be useful when configuring write proxies, See
8382 @ref{Password authentication server} & @ref{Write proxies}.
8383
8384 @cindex Authentication, stream
8385 @cindex Stream authentication
8386 @item -a
8387 Authenticate all communication between the client and
8388 the server. Only has an effect on the @sc{cvs} client.
8389 As of this writing, this is only implemented when using
8390 a GSSAPI connection (@pxref{GSSAPI authenticated}).
8391 Authentication prevents certain sorts of attacks
8392 involving hijacking the active @sc{tcp} connection.
8393 Enabling authentication does not enable encryption.
8394
8395 @cindex RCSBIN, overriding
8396 @cindex Overriding RCSBIN
8397 @item -b @var{bindir}
8398 In @sc{cvs} 1.9.18 and older, this specified that
8399 @sc{rcs} programs are in the @var{bindir} directory.
8400 Current versions of @sc{cvs} do not run @sc{rcs}
8401 programs; for compatibility this option is accepted,
8402 but it does nothing.
8403
8404 @cindex TMPDIR, environment variable
8405 @cindex temporary file directory, set via command line
8406 @cindex temporary file directory, set via environment variable
8407 @cindex temporary file directory, set via config
8408 @cindex temporary files, location of
8409 @item -T @var{tempdir}
8410 Use @var{tempdir} as the directory where temporary files are
8411 located.
8412
8413 The @sc{cvs} client and server store temporary files in a temporary directory.
8414 The path to this temporary directory is set via, in order of precedence:
8415
8416 @itemize @bullet
8417 @item
8418 The argument to the global @samp{-T} option.
8419
8420 @item
8421 The value set for @code{TmpDir} in the config file (server only -
8422 @pxref{config}).
8423
8424 @item
8425 The contents of the @code{$TMPDIR} environment variable (@code{%TMPDIR%} on
8426 Windows - @pxref{Environment variables}).
8427
8428 @item
8429 /tmp
8430
8431 @end itemize
8432
8433 Temporary directories should always be specified as an absolute pathname.
8434 When running a CVS client, @samp{-T} affects only the local process;
8435 specifying @samp{-T} for the client has no effect on the server and
8436 vice versa.
8437
8438 @cindex CVSROOT, overriding
8439 @cindex Overriding CVSROOT
8440 @item -d @var{cvs_root_directory}
8441 Use @var{cvs_root_directory} as the root directory
8442 pathname of the repository. Overrides the setting of
8443 the @code{$CVSROOT} environment variable. @xref{Repository}.
8444
8445 @cindex EDITOR, overriding
8446 @cindex Overriding EDITOR
8447 @item -e @var{editor}
8448 Use @var{editor} to enter revision log information. Overrides the
8449 setting of the @code{$CVSEDITOR} and @code{$EDITOR}
8450 environment variables. For more information, see
8451 @ref{Committing your changes}.
8452
8453 @item -f
8454 Do not read the @file{~/.cvsrc} file. This
8455 option is most often used because of the
8456 non-orthogonality of the @sc{cvs} option set. For
8457 example, the @samp{cvs log} option @samp{-N} (turn off
8458 display of tag names) does not have a corresponding
8459 option to turn the display on. So if you have
8460 @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
8461 you may need to use @samp{-f} to show the tag names.
8462
8463 @item -g
8464 Forges group-writable permissions on files in the working copy.
8465 This option is typically used when you have multiple users sharing
8466 a single checked out source tree, allowing them to operate their
8467 shells with a less dangerous umask at the expense of @sc{cvs} security.
8468 To use this feature, create a directory to hold the checked-out
8469 source tree, set it to a private group, and set up the directory
8470 such that files created under it inherit the gid of the directory.
8471 On BSD systems, this occurs automatically. On SYSV systems and
8472 GNU/Linux, the sgid bit must be set on the directory for this.
8473 The users who are to share the checked out tree must be placed in
8474 that group which owns the directory.
8475
8476 Note that the sharing of a single checked-out source tree is very
8477 different from giving several users access to a common @sc{cvs} repository.
8478 Access to a common @sc{cvs} repository already maintains shared group-write
8479 permissions and does not require this option.
8480
8481 Due to the security implications, setting this option globally in
8482 your @file{.cvsrc} file is strongly discouraged; if you must, ensure
8483 all source checkouts are "firewalled" within a private group or a
8484 private mode 0700 directory.
8485
8486 This option is a MidnightBSD extension merged into Debian and MirBSD @sc{cvs}.
8487
8488 @item -H
8489 @itemx --help
8490 Display usage information about the specified @samp{cvs_command}
8491 (but do not actually execute the command). If you don't specify
8492 a command name, @samp{cvs -H} displays overall help for
8493 @sc{cvs}, including a list of other help options.
8494 @c It seems to me it is better to document it this way
8495 @c rather than trying to update this documentation
8496 @c every time that we add a --help-foo option. But
8497 @c perhaps that is confusing...
8498
8499 @cindex Read-only repository mode
8500 @item -R
8501 Turns on read-only repository mode. This allows one to check out from a
8502 read-only repository, such as within an anoncvs server, or from a @sc{cd-rom}
8503 repository.
8504
8505 Same effect as if the @code{CVSREADONLYFS} environment
8506 variable is set. Using @samp{-R} can also considerably
8507 speed up checkouts over NFS.
8508
8509 @cindex Read-only mode
8510 @item -n
8511 Do not change any files. Attempt to execute the
8512 @samp{cvs_command}, but only to issue reports; do not remove,
8513 update, or merge any existing files, or create any new files.
8514
8515 Note that @sc{cvs} will not necessarily produce exactly
8516 the same output as without @samp{-n}. In some cases
8517 the output will be the same, but in other cases
8518 @sc{cvs} will skip some of the processing that would
8519 have been required to produce the exact same output.
8520
8521 @item -Q
8522 Cause the command to be really quiet; the command will only
8523 generate output for serious problems.
8524
8525 @item -q
8526 Cause the command to be somewhat quiet; informational messages,
8527 such as reports of recursion through subdirectories, are
8528 suppressed.
8529
8530 @cindex Read-only files, and -r
8531 @item -r
8532 Make new working files read-only. Same effect
8533 as if the @code{$CVSREAD} environment variable is set
8534 (@pxref{Environment variables}). The default is to
8535 make working files writable, unless watches are on
8536 (@pxref{Watches}).
8537
8538 @item -s @var{variable}=@var{value}
8539 Set a user variable (@pxref{Variables}).
8540
8541 @cindex Trace
8542 @item -t
8543 Trace program execution; display messages showing the steps of
8544 @sc{cvs} activity. Particularly useful with @samp{-n} to explore the
8545 potential impact of an unfamiliar command.
8546
8547 @item -v
8548 @item --version
8549 Display version and copyright information for @sc{cvs}.
8550
8551 @cindex CVSREAD, overriding
8552 @cindex Overriding CVSREAD
8553 @item -w
8554 Make new working files read-write. Overrides the
8555 setting of the @code{$CVSREAD} environment variable.
8556 Files are created read-write by default, unless @code{$CVSREAD} is
8557 set or @samp{-r} is given.
8558 @c Note that -w only overrides -r and CVSREAD; it has
8559 @c no effect on files which are readonly because of
8560 @c "cvs watch on". My guess is that is the way it
8561 @c should be (or should "cvs -w get" on a watched file
8562 @c be the same as a get and a cvs edit?), but I'm not
8563 @c completely sure whether to document it this way.
8564
8565 @item -x
8566 @cindex Encryption
8567 Encrypt all communication between the client and the
8568 server. Only has an effect on the @sc{cvs} client. As
8569 of this writing, this is only implemented when using a
8570 GSSAPI connection (@pxref{GSSAPI authenticated}) or a
8571 Kerberos connection (@pxref{Kerberos authenticated}).
8572 Enabling encryption implies that message traffic is
8573 also authenticated. Encryption support is not
8574 available by default; it must be enabled using a
8575 special configure option, @file{--enable-encryption},
8576 when you build @sc{cvs}.
8577
8578 @item -z @var{level}
8579 @cindex Compression
8580 @cindex Gzip
8581 Request compression @var{level} for network traffic.
8582 @sc{cvs} interprets @var{level} identically to the @code{gzip} program.
8583 Valid levels are 1 (high speed, low compression) to
8584 9 (low speed, high compression), or 0 to disable
8585 compression (the default). Data sent to the server will
8586 be compressed at the requested level and the client will request
8587 the server use the same compression level for data returned. The
8588 server will use the closest level allowed by the server administrator to
8589 compress returned data. This option only has an effect when passed to
8590 the @sc{cvs} client.
8591 @end table
8592
8593 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8594 @node Common options
8595 @appendixsec Common command options
8596 @cindex Common options
8597 @cindex Right-hand options
8598
8599 This section describes the @samp{command_options} that
8600 are available across several @sc{cvs} commands. These
8601 options are always given to the right of
8602 @samp{cvs_command}. Not all
8603 commands support all of these options; each option is
8604 only supported for commands where it makes sense.
8605 However, when a command has one of these options you
8606 can almost always count on the same behavior of the
8607 option as in other commands. (Other command options,
8608 which are listed with the individual commands, may have
8609 different behavior from one @sc{cvs} command to the other).
8610
8611 @emph{Note: the @samp{history} command is an exception; it supports
8612 many options that conflict even with these standard options.}
8613
8614 @table @code
8615 @cindex Dates
8616 @cindex Time
8617 @cindex Specifying dates
8618 @item -D @var{date_spec}
8619 Use the most recent revision no later than @var{date_spec}.
8620 @var{date_spec} is a single argument, a date description
8621 specifying a date in the past.
8622
8623 The specification is @dfn{sticky} when you use it to make a
8624 private copy of a source file; that is, when you get a working
8625 file using @samp{-D}, @sc{cvs} records the date you specified, so that
8626 further updates in the same directory will use the same date
8627 (for more information on sticky tags/dates, @pxref{Sticky tags}).
8628
8629 @samp{-D} is available with the @code{annotate}, @code{checkout},
8630 @code{diff}, @code{export}, @code{history}, @code{ls},
8631 @code{rdiff}, @code{rls}, @code{rtag}, @code{tag}, and @code{update} commands.
8632 (The @code{history} command uses this option in a
8633 slightly different way; @pxref{history options}).
8634
8635 For a complete description of the date formats accepted by @sc{cvs},
8636 @pxref{Date input formats}.
8637 @c What other formats should we accept? I don't want
8638 @c to start accepting a whole mess of non-standard
8639 @c new formats (there are a lot which are in wide use in
8640 @c one context or another), but practicality does
8641 @c dictate some level of flexibility.
8642 @c * POSIX.2 (e.g. touch, ls output, date) and other
8643 @c POSIX and/or de facto unix standards (e.g. at). The
8644 @c practice here is too inconsistent to be of any use.
8645 @c * VMS dates. This is not a formal standard, but
8646 @c there is a published specification (see SYS$ASCTIM
8647 @c and SYS$BINTIM in the _VMS System Services Reference
8648 @c Manual_), it is implemented consistently in VMS
8649 @c utilities, and VMS users will expect CVS running on
8650 @c VMS to support this format (and if we're going to do
8651 @c that, better to make CVS support it on all
8652 @c platforms. Maybe).
8653 @c
8654 @c One more note: In output, CVS should consistently
8655 @c use one date format, and that format should be one that
8656 @c it accepts in input as well. The former isn't
8657 @c really true (see survey below), and I'm not
8658 @c sure that either of those formats is accepted in
8659 @c input.
8660 @c
8661 @c cvs log
8662 @c current 1996/01/02 13:45:31
8663 @c Internet 02 Jan 1996 13:45:31 UT
8664 @c ISO 1996-01-02 13:45:31
8665 @c cvs ann
8666 @c current 02-Jan-96
8667 @c Internet-like 02 Jan 96
8668 @c ISO 96-01-02
8669 @c cvs status
8670 @c current Tue Jun 11 02:54:53 1996
8671 @c Internet [Tue,] 11 Jun 1996 02:54:53
8672 @c ISO 1996-06-11 02:54:53
8673 @c note: date possibly should be omitted entirely for
8674 @c other reasons.
8675 @c cvs editors
8676 @c current Tue Jun 11 02:54:53 1996 GMT
8677 @c cvs history
8678 @c current 06/11 02:54 +0000
8679 @c any others?
8680 @c There is a good chance the proper solution has to
8681 @c involve at least some level of letting the user
8682 @c decide which format (with the default being the
8683 @c formats CVS has always used; changing these might be
8684 @c _very_ disruptive since scripts may very well be
8685 @c parsing them).
8686 @c
8687 @c Another random bit of prior art concerning dates is
8688 @c the strptime function which takes templates such as
8689 @c "%m/%d/%y", and apparent a variant of getdate()
8690 @c which also honors them. See
8691 @c X/Open CAE Specification, System Interfaces and
8692 @c Headers Issue 4, Version 2 (September 1994), in the
8693 @c entry for getdate() on page 231
8694
8695 Remember to quote the argument to the @samp{-D}
8696 flag so that your shell doesn't interpret spaces as
8697 argument separators. A command using the @samp{-D}
8698 flag can look like this:
8699
8700 @example
8701 $ cvs diff -D "1 hour ago" cvs.texinfo
8702 @end example
8703
8704 @cindex Forcing a tag match
8705 @item -f
8706 When you specify a particular date or tag to @sc{cvs} commands, they
8707 normally ignore files that do not contain the tag (or did not
8708 exist prior to the date) that you specified. Use the @samp{-f} option
8709 if you want files retrieved even when there is no match for the
8710 tag or date. (The most recent revision of the file
8711 will be used).
8712
8713 Note that even with @samp{-f}, a tag that you specify
8714 must exist (that is, in some file, not necessary in
8715 every file). This is so that @sc{cvs} will continue to
8716 give an error if you mistype a tag name.
8717
8718 @need 800
8719 @samp{-f} is available with these commands:
8720 @code{annotate}, @code{checkout}, @code{export},
8721 @code{rdiff}, @code{rtag}, and @code{update}.
8722
8723 @emph{WARNING: The @code{commit} and @code{remove}
8724 commands also have a
8725 @samp{-f} option, but it has a different behavior for
8726 those commands. See @ref{commit options}, and
8727 @ref{Removing files}.}
8728
8729 @item -k @var{kflag}
8730 Override the default processing of RCS keywords other than
8731 @samp{-kb}. @xref{Keyword substitution}, for the meaning of
8732 @var{kflag}. Used with the @code{checkout} and @code{update}
8733 commands, your @var{kflag} specification is
8734 @dfn{sticky}; that is, when you use this option
8735 with a @code{checkout} or @code{update} command,
8736 @sc{cvs} associates your selected @var{kflag} with any files
8737 it operates on, and continues to use that @var{kflag} with future
8738 commands on the same files until you specify otherwise.
8739
8740 The @samp{-k} option is available with the @code{add},
8741 @code{checkout}, @code{diff}, @code{export}, @code{import},
8742 @code{rdiff}, and @code{update} commands.
8743
8744 @emph{WARNING: Prior to CVS version 1.12.2, the @samp{-k} flag
8745 overrode the @samp{-kb} indication for a binary file. This could
8746 sometimes corrupt binary files. @xref{Merging and keywords}, for
8747 more.}
8748
8749 @item -l
8750 Local; run only in current working directory, rather than
8751 recursing through subdirectories.
8752
8753 Available with the following commands: @code{annotate}, @code{checkout},
8754 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8755 @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
8756 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8757 and @code{watchers}.
8758
8759 @cindex Editor, avoiding invocation of
8760 @cindex Avoiding editor invocation
8761 @item -m @var{message}
8762 Use @var{message} as log information, instead of
8763 invoking an editor.
8764
8765 Available with the following commands: @code{add},
8766 @code{commit} and @code{import}.
8767
8768 @item -n
8769 Do not run any tag program. (A program can be
8770 specified to run in the modules
8771 database (@pxref{modules}); this option bypasses it).
8772
8773 @emph{Note: this is not the same as the @samp{cvs -n}
8774 program option, which you can specify to the left of a cvs command!}
8775
8776 Available with the @code{checkout}, @code{commit}, @code{export},
8777 and @code{rtag} commands.
8778
8779 @item -P
8780 Prune empty directories. See @ref{Removing directories}.
8781
8782 @item -p
8783 Pipe the files retrieved from the repository to standard output,
8784 rather than writing them in the current directory. Available
8785 with the @code{checkout} and @code{update} commands.
8786
8787 @item -R
8788 Process directories recursively. This is the default for all @sc{cvs}
8789 commands, with the exception of @code{ls} & @code{rls}.
8790
8791 Available with the following commands: @code{annotate}, @code{checkout},
8792 @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
8793 @code{ls}, @code{rdiff}, @code{remove}, @code{rls}, @code{rtag},
8794 @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
8795 and @code{watchers}.
8796
8797 @item -r @var{tag}
8798 @item -r @var{tag}[:@var{date}]
8799 @cindex HEAD, special tag
8800 @cindex BASE, special tag
8801 @cindex BASE, special date
8802 Use the revision specified by the @var{tag} argument (and the @var{date}
8803 argument for the commands which accept it) instead of the
8804 default @dfn{head} revision. As well as arbitrary tags defined
8805 with the @code{tag} or @code{rtag} command, two special tags are
8806 always available: @samp{HEAD} refers to the most recent version
8807 available in the repository (also known as the tip of the @samp{MAIN}
8808 branch, also known as trunk; the name of a branch refers to its tip;
8809 this version of @sc{cvs} introduces @samp{.bhead}, but only for the
8810 @sc{diff} command, for the same), and @samp{BASE} refers to the
8811 revision you last checked out into the current working directory.
8812
8813 @c fixed: HEAD is changed now; .bhead is the name of the branch,
8814 @c but added for cases where it is unknown.
8815 @c --mirabilos
8816 @c FIXME: What does HEAD really mean? I believe that
8817 @c the current answer is the head of the default branch
8818 @c for all cvs commands except diff. For diff, it
8819 @c seems to be (a) the head of the trunk (or the default
8820 @c branch?) if there is no sticky tag, (b) the head of the
8821 @c branch for the sticky tag, if there is a sticky tag.
8822 @c (b) is ugly as it differs
8823 @c from what HEAD means for other commands, but people
8824 @c and/or scripts are quite possibly used to it.
8825 @c See "head" tests in sanity.sh.
8826 @c Probably the best fix is to introduce two new
8827 @c special tags, ".thead" for the head of the trunk,
8828 @c and ".bhead" for the head of the current branch.
8829 @c Then deprecate HEAD. This has the advantage of
8830 @c not surprising people with a change to HEAD, and a
8831 @c side benefit of also phasing out the poorly-named
8832 @c HEAD (see discussion of reserved tag names in node
8833 @c "Tags"). Of course, .thead and .bhead should be
8834 @c carefully implemented (with the implementation the
8835 @c same for "diff" as for everyone else), test cases
8836 @c written (similar to the ones in "head"), new tests
8837 @c cases written for things like default branches, &c.
8838
8839 The tag specification is sticky when you use this
8840 with @code{checkout} or @code{update} to make your own
8841 copy of a file: @sc{cvs} remembers the tag and continues to use it on
8842 future update commands, until you specify otherwise (for more information
8843 on sticky tags/dates, @pxref{Sticky tags}).
8844
8845 The tag can be either a symbolic or numeric tag, as
8846 described in @ref{Tags}, or the name of a branch, as
8847 described in @ref{Branching and merging}.
8848 When @var{tag} is the name of a
8849 branch, some commands accept the optional @var{date} argument to specify
8850 the revision as of the given date on the branch.
8851 When a command expects a specific revision,
8852 the name of a branch is interpreted as the most recent
8853 revision on that branch.
8854
8855 As a Debian and MirBSD @sc{cvs} extension, specifying @samp{BASE} as the
8856 @var{date} portion of the argument yields the @emph{base revision} of the
8857 branch specified by the @var{tag} portion of the argument, i.e. the revision
8858 on the parent branch the @var{tag} branch split off, or, where both
8859 branches were the same.
8860 This option has not received very much testing, beware!
8861
8862 Specifying the @samp{-q} global option along with the
8863 @samp{-r} command option is often useful, to suppress
8864 the warning messages when the @sc{rcs} file
8865 does not contain the specified tag.
8866
8867 @emph{Note: this is not the same as the overall @samp{cvs -r} option,
8868 which you can specify to the left of a @sc{cvs} command!}
8869
8870 @samp{-r @var{tag}} is available with the @code{commit} and @code{history}
8871 commands.
8872
8873 @samp{-r @var{tag}[:@var{date}]} is available with the @code{annotate},
8874 @code{checkout}, @code{diff}, @code{export}, @code{rdiff}, @code{rtag},
8875 and @code{update} commands.
8876
8877 @item -W
8878 Specify file names that should be filtered. You can
8879 use this option repeatedly. The spec can be a file
8880 name pattern of the same type that you can specify in
8881 the @file{.cvswrappers} file.
8882 Available with the following commands: @code{import},
8883 and @code{update}.
8884
8885 @end table
8886
8887 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8888 @include getdate-cvs.texi
8889
8890 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8891 @node admin, annotate, Date input formats, CVS commands
8892 @appendixsec admin---Administration front-end for RCS
8893 @cindex Admin (subcommand)
8894
8895 @itemize @bullet
8896 @item
8897 Requires: repository, working directory.
8898 @item
8899 Changes: repository.
8900 @item
8901 Synonym: rcs
8902 @end itemize
8903
8904 This is the @sc{cvs} interface to assorted
8905 administrative facilities. Some of them have
8906 questionable usefulness for @sc{cvs} but exist for
8907 historical purposes. Some of the questionable options
8908 are likely to disappear in the future. This command
8909 @emph{does} work recursively, so extreme care should be
8910 used.
8911
8912 @cindex cvsadmin
8913 @cindex UserAdminOptions, in CVSROOT/config
8914 On unix, if there is a group named @code{cvsadmin},
8915 only members of that group can run @code{cvs admin}
8916 commands, except for those specified using the
8917 @code{UserAdminOptions} configuration option in the
8918 @file{CVSROOT/config} file. Options specified using
8919 @code{UserAdminOptions} can be run by any user. See
8920 @ref{config} for more on @code{UserAdminOptions}.
8921
8922 The @code{cvsadmin} group should exist on the server,
8923 or any system running the non-client/server @sc{cvs}.
8924 To disallow @code{cvs admin} for all users, create a
8925 group with no users in it. On NT, the @code{cvsadmin}
8926 feature does not exist and all users
8927 can run @code{cvs admin}.
8928
8929 @menu
8930 * admin options:: admin options
8931 @end menu
8932
8933 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8934 @node admin options
8935 @appendixsubsec admin options
8936
8937 Some of these options have questionable usefulness for
8938 @sc{cvs} but exist for historical purposes. Some even
8939 make it impossible to use @sc{cvs} until you undo the
8940 effect!
8941
8942 @table @code
8943 @item -A@var{oldfile}
8944 Might not work together with @sc{cvs}. Append the
8945 access list of @var{oldfile} to the access list of the
8946 @sc{rcs} file.
8947
8948 @item -a@var{logins}
8949 Might not work together with @sc{cvs}. Append the
8950 login names appearing in the comma-separated list
8951 @var{logins} to the access list of the @sc{rcs} file.
8952
8953 @item -b[@var{rev}]
8954 Set the default branch to @var{rev}. In @sc{cvs}, you
8955 normally do not manipulate default branches; sticky
8956 tags (@pxref{Sticky tags}) are a better way to decide
8957 which branch you want to work on. There is one reason
8958 to run @code{cvs admin -b}: to revert to the vendor's
8959 version when using vendor branches (@pxref{Reverting
8960 local changes}).
8961 There can be no space between @samp{-b} and its argument.
8962 @c Hmm, we don't document the usage where rev is
8963 @c omitted. Maybe that usage can/should be deprecated
8964 @c (and replaced with -bHEAD or something?) (so we can toss
8965 @c the optional argument). Note that -bHEAD does not
8966 @c work, as of 17 Sep 1997, but probably will once "cvs
8967 @c admin" is internal to CVS.
8968
8969 @cindex Comment leader
8970 @item -c@var{string}
8971 Sets the comment leader to @var{string}. The comment
8972 leader is not used by current versions of @sc{cvs} or
8973 @sc{rcs} 5.7. Therefore, you can almost surely not
8974 worry about it. @xref{Keyword substitution}.
8975
8976 @item -e[@var{logins}]
8977 Might not work together with @sc{cvs}. Erase the login
8978 names appearing in the comma-separated list
8979 @var{logins} from the access list of the RCS file. If
8980 @var{logins} is omitted, erase the entire access list.
8981 There can be no space between @samp{-e} and its argument.
8982
8983 @item -I
8984 Run interactively, even if the standard input is not a
8985 terminal. This option does not work with the
8986 client/server @sc{cvs} and is likely to disappear in
8987 a future release of @sc{cvs}.
8988
8989 @item -i
8990 Useless with @sc{cvs}. This creates and initialises a
8991 new @sc{rcs} file, without depositing a revision. With
8992 @sc{cvs}, add files with the @code{cvs add} command
8993 (@pxref{Adding files}).
8994
8995 @item -k@var{subst}
8996 Set the default keyword
8997 substitution to @var{subst}. @xref{Keyword
8998 substitution}. Giving an explicit @samp{-k} option to
8999 @code{cvs update}, @code{cvs export}, or @code{cvs
9000 checkout} overrides this default.
9001
9002 @item -l[@var{rev}]
9003 Lock the revision with number @var{rev}. If a branch
9004 is given, lock the latest revision on that branch. If
9005 @var{rev} is omitted, lock the latest revision on the
9006 default branch. There can be no space between
9007 @samp{-l} and its argument.
9008
9009 This can be used in conjunction with the
9010 @file{rcslock.pl} script in the @file{contrib}
9011 directory of the @sc{cvs} source distribution to
9012 provide reserved checkouts (where only one user can be
9013 editing a given file at a time). See the comments in
9014 that file for details (and see the @file{README} file
9015 in that directory for disclaimers about the unsupported
9016 nature of contrib). According to comments in that
9017 file, locking must set to strict (which is the default).
9018
9019 @item -L
9020 Set locking to strict. Strict locking means that the
9021 owner of an RCS file is not exempt from locking for
9022 checkin. For use with @sc{cvs}, strict locking must be
9023 set; see the discussion under the @samp{-l} option above.
9024
9025 @cindex Changing a log message
9026 @cindex Replacing a log message
9027 @cindex Correcting a log message
9028 @cindex Fixing a log message
9029 @cindex Log message, correcting
9030 @item -m@var{rev}:@var{msg}
9031 Replace the log message of revision @var{rev} with
9032 @var{msg}.
9033
9034 @c The rcs -M option, to suppress sending mail, has never been
9035 @c documented as a cvs admin option.
9036
9037 @item -N@var{name}[:[@var{rev}]]
9038 Act like @samp{-n}, except override any previous
9039 assignment of @var{name}. For use with magic branches,
9040 see @ref{Magic branch numbers}.
9041
9042 @item -n@var{name}[:[@var{rev}]]
9043 Associate the symbolic name @var{name} with the branch
9044 or revision @var{rev}. It is normally better to use
9045 @samp{cvs tag} or @samp{cvs rtag} instead. Delete the
9046 symbolic name if both @samp{:} and @var{rev} are
9047 omitted; otherwise, print an error message if
9048 @var{name} is already associated with another number.
9049 If @var{rev} is symbolic, it is expanded before
9050 association. A @var{rev} consisting of a branch number
9051 followed by a @samp{.} stands for the current latest
9052 revision in the branch. A @samp{:} with an empty
9053 @var{rev} stands for the current latest revision on the
9054 default branch, normally the trunk. For example,
9055 @samp{cvs admin -n@var{name}:} associates @var{name} with the
9056 current latest revision of all the RCS files;
9057 this contrasts with @samp{cvs admin -n@var{name}:$} which
9058 associates @var{name} with the revision numbers
9059 extracted from keyword strings in the corresponding
9060 working files.
9061
9062 @cindex Deleting revisions
9063 @cindex Outdating revisions
9064 @cindex Saving space
9065 @item -o@var{range}
9066 Deletes (@dfn{outdates}) the revisions given by
9067 @var{range}.
9068
9069 Note that this command can be quite dangerous unless
9070 you know @emph{exactly} what you are doing (for example
9071 see the warnings below about how the
9072 @var{rev1}:@var{rev2} syntax is confusing).
9073
9074 If you are short on disc this option might help you.
9075 But think twice before using it---there is no way short
9076 of restoring the latest backup to undo this command!
9077 If you delete different revisions than you planned,
9078 either due to carelessness or (heaven forbid) a @sc{cvs}
9079 bug, there is no opportunity to correct the error
9080 before the revisions are deleted. It probably would be
9081 a good idea to experiment on a copy of the repository
9082 first.
9083
9084 Specify @var{range} in one of the following ways:
9085
9086 @table @code
9087 @item @var{rev1}::@var{rev2}
9088 Collapse all revisions between rev1 and rev2, so that
9089 @sc{cvs} only stores the differences associated with going
9090 from rev1 to rev2, not intermediate steps. For
9091 example, after @samp{-o 1.3::1.5} one can retrieve
9092 revision 1.3, revision 1.5, or the differences to get
9093 from 1.3 to 1.5, but not the revision 1.4, or the
9094 differences between 1.3 and 1.4. Other examples:
9095 @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
9096 effect, because there are no intermediate revisions to
9097 remove.
9098
9099 @item ::@var{rev}
9100 Collapse revisions between the beginning of the branch
9101 containing @var{rev} and @var{rev} itself. The
9102 branchpoint and @var{rev} are left intact. For
9103 example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
9104 revision 1.3.2.5, and everything in between, but leaves
9105 1.3 and 1.3.2.6 intact.
9106
9107 @item @var{rev}::
9108 Collapse revisions between @var{rev} and the end of the
9109 branch containing @var{rev}. Revision @var{rev} is
9110 left intact but the head revision is deleted.
9111
9112 @item @var{rev}
9113 Delete the revision @var{rev}. For example, @samp{-o
9114 1.3} is equivalent to @samp{-o 1.2::1.4}.
9115
9116 @item @var{rev1}:@var{rev2}
9117 Delete the revisions from @var{rev1} to @var{rev2},
9118 inclusive, on the same branch. One will not be able to
9119 retrieve @var{rev1} or @var{rev2} or any of the
9120 revisions in between. For example, the command
9121 @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
9122 It means to delete revisions up to, and including, the
9123 tag R_1_02. But beware! If there are files that have not
9124 changed between R_1_02 and R_1_03 the file will have
9125 @emph{the same} numerical revision number assigned to
9126 the tags R_1_02 and R_1_03. So not only will it be
9127 impossible to retrieve R_1_02; R_1_03 will also have to
9128 be restored from the tapes! In most cases you want to
9129 specify @var{rev1}::@var{rev2} instead.
9130
9131 @item :@var{rev}
9132 Delete revisions from the beginning of the
9133 branch containing @var{rev} up to and including
9134 @var{rev}.
9135
9136 @item @var{rev}:
9137 Delete revisions from revision @var{rev}, including
9138 @var{rev} itself, to the end of the branch containing
9139 @var{rev}.
9140 @end table
9141
9142 None of the revisions to be deleted may have
9143 branches or locks.
9144
9145 If any of the revisions to be deleted have symbolic
9146 names, and one specifies one of the @samp{::} syntaxes,
9147 then @sc{cvs} will give an error and not delete any
9148 revisions. If you really want to delete both the
9149 symbolic names and the revisions, first delete the
9150 symbolic names with @code{cvs tag -d}, then run
9151 @code{cvs admin -o}. If one specifies the
9152 non-@samp{::} syntaxes, then @sc{cvs} will delete the
9153 revisions but leave the symbolic names pointing to
9154 nonexistent revisions. This behavior is preserved for
9155 compatibility with previous versions of @sc{cvs}, but
9156 because it isn't very useful, in the future it may
9157 change to be like the @samp{::} case.
9158
9159 Due to the way @sc{cvs} handles branches @var{rev}
9160 cannot be specified symbolically if it is a branch.
9161 @xref{Magic branch numbers}, for an explanation.
9162 @c FIXME: is this still true? I suspect not.
9163
9164 Make sure that no-one has checked out a copy of the
9165 revision you outdate. Strange things will happen if he
9166 starts to edit it and tries to check it back in. For
9167 this reason, this option is not a good way to take back
9168 a bogus commit; commit a new revision undoing the bogus
9169 change instead (@pxref{Merging two revisions}).
9170
9171 @item -q
9172 Run quietly; do not print diagnostics.
9173
9174 @item -s@var{state}[:@var{rev}]
9175 Useful with @sc{cvs}. Set the state attribute of the
9176 revision @var{rev} to @var{state}. If @var{rev} is a
9177 branch number, assume the latest revision on that
9178 branch. If @var{rev} is omitted, assume the latest
9179 revision on the default branch. Any identifier is
9180 acceptable for @var{state}. A useful set of states is
9181 @samp{Exp} (for experimental), @samp{Stab} (for
9182 stable), and @samp{Rel} (for released). By default,
9183 the state of a new revision is set to @samp{Exp} when
9184 it is created. The state is visible in the output from
9185 @var{cvs log} (@pxref{log}), and in the
9186 @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
9187 (@pxref{Keyword substitution}). Note that @sc{cvs}
9188 uses the @code{dead} state for its own purposes (@pxref{Attic}); to
9189 take a file to or from the @code{dead} state use
9190 commands like @code{cvs remove} and @code{cvs add}
9191 (@pxref{Adding and removing}), not @code{cvs admin -s}.
9192
9193 @item -t[@var{file}]
9194 Useful with @sc{cvs}. Write descriptive text from the
9195 contents of the named @var{file} into the RCS file,
9196 deleting the existing text. The @var{file} pathname
9197 may not begin with @samp{-}. The descriptive text can be seen in the
9198 output from @samp{cvs log} (@pxref{log}).
9199 There can be no space between @samp{-t} and its argument.
9200
9201 If @var{file} is omitted,
9202 obtain the text from standard input, terminated by
9203 end-of-file or by a line containing @samp{.} by itself.
9204 Prompt for the text if interaction is possible; see
9205 @samp{-I}.
9206
9207 @item -t-@var{string}
9208 Similar to @samp{-t@var{file}}. Write descriptive text
9209 from the @var{string} into the @sc{rcs} file, deleting
9210 the existing text.
9211 There can be no space between @samp{-t} and its argument.
9212
9213 @c The rcs -T option, do not update last-mod time for
9214 @c minor changes, has never been documented as a
9215 @c cvs admin option.
9216
9217 @item -U
9218 Set locking to non-strict. Non-strict locking means
9219 that the owner of a file need not lock a revision for
9220 checkin. For use with @sc{cvs}, strict locking must be
9221 set; see the discussion under the @samp{-l} option
9222 above.
9223
9224 @item -u[@var{rev}]
9225 See the option @samp{-l} above, for a discussion of
9226 using this option with @sc{cvs}. Unlock the revision
9227 with number @var{rev}. If a branch is given, unlock
9228 the latest revision on that branch. If @var{rev} is
9229 omitted, remove the latest lock held by the caller.
9230 Normally, only the locker of a revision may unlock it;
9231 somebody else unlocking a revision breaks the lock.
9232 This causes the original locker to be sent a @code{commit}
9233 notification (@pxref{Getting Notified}).
9234 There can be no space between @samp{-u} and its argument.
9235
9236 @item -V@var{n}
9237 In previous versions of @sc{cvs}, this option meant to
9238 write an @sc{rcs} file which would be acceptable to
9239 @sc{rcs} version @var{n}, but it is now obsolete and
9240 specifying it will produce an error.
9241 @c Note that -V without an argument has never been
9242 @c documented as a cvs admin option.
9243
9244 @item -x@var{suffixes}
9245 In previous versions of @sc{cvs}, this was documented
9246 as a way of specifying the names of the @sc{rcs}
9247 files. However, @sc{cvs} has always required that the
9248 @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
9249 this option has never done anything useful.
9250
9251 @c The rcs -z option, to specify the timezone, has
9252 @c never been documented as a cvs admin option.
9253 @end table
9254
9255 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9256 @node annotate, checkout, admin, CVS commands
9257 @appendixsec annotate---What revision modified each line of a file?
9258 @cindex annotate (subcommand)
9259
9260 @itemize @bullet
9261 @item
9262 Synopsis:
9263 annotate [options] files@dots{}
9264
9265 rannotate [options] files@dots{}
9266 @item
9267 Requires: repository.
9268 @item
9269 Changes: nothing.
9270 @end itemize
9271
9272 For each file in @var{files}, print the head revision
9273 of the trunk, together with information on the last
9274 modification for each line. If backwards annotation
9275 is requested, show the first modification after the
9276 specified revision. (Backwards annotation currently
9277 appears to be broken.)
9278
9279 @menu
9280 * annotate options:: annotate options
9281 * annotate example:: annotate example
9282 @end menu
9283
9284 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9285 @node annotate options
9286 @appendixsubsec annotate options
9287
9288 These standard options are supported by @code{annotate}
9289 (@pxref{Common options}, for a complete description of
9290 them):
9291
9292 @table @code
9293 @item -b
9294 Backwards, show when a line was removed.
9295 Currently appears to be broken.
9296
9297 @item -l
9298 Local directory only, no recursion.
9299
9300 @item -R
9301 Process directories recursively.
9302
9303 @item -f
9304 Use head revision if tag/date not found.
9305
9306 @item -F
9307 Annotate binary files.
9308
9309 @item -r @var{tag}[:@var{date}]
9310 Annotate file as of specified revision/tag or, when @var{date} is specified
9311 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9312 existed on @var{date}. See @ref{Common options}.
9313
9314 @item -D @var{date}
9315 Annotate file as of specified date.
9316 @end table
9317
9318 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9319 @node annotate example
9320 @appendixsubsec annotate example
9321
9322 For example:
9323
9324 @example
9325 $ cvs annotate ssfile
9326 Annotations for ssfile
9327 ***************
9328 1.1 (mary 27-Mar-96): ssfile line 1
9329 1.2 (joe 28-Mar-96): ssfile line 2
9330 @end example
9331
9332 The file @file{ssfile} currently contains two lines.
9333 The @code{ssfile line 1} line was checked in by
9334 @code{mary} on March 27. Then, on March 28, @code{joe}
9335 added a line @code{ssfile line 2}, without modifying
9336 the @code{ssfile line 1} line. This report doesn't
9337 tell you anything about lines which have been deleted
9338 or replaced; you need to use @code{cvs diff} for that
9339 (@pxref{diff}).
9340
9341 The options to @code{cvs annotate} are listed in
9342 @ref{Invoking CVS}, and can be used to select the files
9343 and revisions to annotate. The options are described
9344 in more detail there and in @ref{Common options}.
9345
9346 @c FIXME: maybe an example using the options? Just
9347 @c what it means to select a revision might be worth a
9348 @c few words of explanation ("you want to see who
9349 @c changed this line *before* 1.4"...).
9350
9351 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9352 @node checkout, commit, annotate, CVS commands
9353 @appendixsec checkout---Check out sources for editing
9354 @cindex checkout (subcommand)
9355 @cindex co (subcommand)
9356
9357 @itemize @bullet
9358 @item
9359 Synopsis: checkout [options] modules@dots{}
9360 @item
9361 Requires: repository.
9362 @item
9363 Changes: working directory.
9364 @item
9365 Synonyms: co, get
9366 @end itemize
9367
9368 Create or update a working directory containing copies of the
9369 source files specified by @var{modules}. You must execute
9370 @code{checkout} before using most of the other @sc{cvs}
9371 commands, since most of them operate on your working
9372 directory.
9373
9374 The @var{modules} are either
9375 symbolic names for some
9376 collection of source directories and files, or paths to
9377 directories or files in the repository. The symbolic
9378 names are defined in the @samp{modules} file.
9379 @xref{modules}.
9380 @c Needs an example, particularly of the non-"modules"
9381 @c case but probably of both.
9382
9383 @c FIXME: this seems like a very odd place to introduce
9384 @c people to how CVS works. The bit about unreserved
9385 @c checkouts is also misleading as it depends on how
9386 @c things are set up.
9387 Depending on the modules you specify, @code{checkout} may
9388 recursively create directories and populate them with
9389 the appropriate source files. You can then edit these
9390 source files at any time (regardless of whether other
9391 software developers are editing their own copies of the
9392 sources); update them to include new changes applied by
9393 others to the source repository; or commit your work as
9394 a permanent change to the source repository.
9395
9396 Note that @code{checkout} is used to create
9397 directories. The top-level directory created is always
9398 added to the directory where @code{checkout} is
9399 invoked, and usually has the same name as the specified
9400 module. In the case of a module alias, the created
9401 sub-directory may have a different name, but you can be
9402 sure that it will be a sub-directory, and that
9403 @code{checkout} will show the relative path leading to
9404 each file as it is extracted into your private work
9405 area (unless you specify the @samp{-Q} global option).
9406
9407 The files created by @code{checkout} are created
9408 read-write, unless the @samp{-r} option to @sc{cvs}
9409 (@pxref{Global options}) is specified, the
9410 @code{CVSREAD} environment variable is specified
9411 (@pxref{Environment variables}), or a watch is in
9412 effect for that file (@pxref{Watches}).
9413
9414 Note that running @code{checkout} on a directory that was already
9415 built by a prior @code{checkout} is also permitted.
9416 This is similar to specifying the @samp{-d} option
9417 to the @code{update} command in the sense that new
9418 directories that have been created in the repository
9419 will appear in your work area.
9420 However, @code{checkout} takes a module name whereas
9421 @code{update} takes a directory name. Also
9422 to use @code{checkout} this way it must be run from the
9423 top level directory (where you originally ran
9424 @code{checkout} from), so before you run
9425 @code{checkout} to update an existing directory, don't
9426 forget to change your directory to the top level
9427 directory.
9428
9429 For the output produced by the @code{checkout} command
9430 see @ref{update output}.
9431
9432 @menu
9433 * checkout options:: checkout options
9434 * checkout examples:: checkout examples
9435 @end menu
9436
9437 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9438 @node checkout options
9439 @appendixsubsec checkout options
9440
9441 These standard options are supported by @code{checkout}
9442 (@pxref{Common options}, for a complete description of
9443 them):
9444
9445 @table @code
9446 @item -D @var{date}
9447 Use the most recent revision no later than @var{date}.
9448 This option is sticky, and implies @samp{-P}. See
9449 @ref{Sticky tags}, for more information on sticky tags/dates.
9450
9451 @item -f
9452 Only useful with the @samp{-D} or @samp{-r} flags. If no matching revision is
9453 found, retrieve the most recent revision (instead of ignoring the file).
9454
9455 @item -k @var{kflag}
9456 Process keywords according to @var{kflag}. See
9457 @ref{Keyword substitution}.
9458 This option is sticky; future updates of
9459 this file in this working directory will use the same
9460 @var{kflag}. The @code{status} command can be viewed
9461 to see the sticky options. See @ref{Invoking CVS}, for
9462 more information on the @code{status} command.
9463
9464 @item -l
9465 Local; run only in current working directory.
9466
9467 @item -n
9468 Do not run any checkout program (as specified
9469 with the @samp{-o} option in the modules file;
9470 @pxref{modules}).
9471
9472 @item -P
9473 Prune empty directories. See @ref{Moving directories}.
9474
9475 @item -p
9476 Pipe files to the standard output.
9477
9478 @item -R
9479 Checkout directories recursively. This option is on by default.
9480
9481 @item -r @var{tag}[:@var{date}]
9482 Checkout the revision specified by @var{tag} or, when @var{date} is specified
9483 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9484 existed on @var{date}. This option is sticky, and implies @samp{-P}.
9485 See @ref{Sticky tags}, for more information on sticky tags/dates. Also,
9486 see @ref{Common options}.
9487 @end table
9488
9489 In addition to those, you can use these special command
9490 options with @code{checkout}:
9491
9492 @table @code
9493 @item -A
9494 Reset any sticky tags, dates, or @samp{-k} options.
9495 See @ref{Sticky tags}, for more information on sticky tags/dates.
9496
9497 @item -c
9498 Copy the module file, sorted, to the standard output,
9499 instead of creating or modifying any files or
9500 directories in your working directory.
9501
9502 @item -d @var{dir}
9503 Create a directory called @var{dir} for the working
9504 files, instead of using the module name. In general,
9505 using this flag is equivalent to using @samp{mkdir
9506 @var{dir}; cd @var{dir}} followed by the checkout
9507 command without the @samp{-d} flag.
9508
9509 There is an important exception, however. It is very
9510 convenient when checking out a single item to have the
9511 output appear in a directory that doesn't contain empty
9512 intermediate directories. In this case @emph{only},
9513 @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
9514 directories.
9515
9516 For example, given a module @samp{foo} that contains
9517 the file @samp{bar.c}, the command @samp{cvs co -d dir
9518 foo} will create directory @samp{dir} and place
9519 @samp{bar.c} inside. Similarly, given a module
9520 @samp{bar} which has subdirectory @samp{baz} wherein
9521 there is a file @samp{quux.c}, the command @samp{cvs co
9522 -d dir bar/baz} will create directory @samp{dir} and
9523 place @samp{quux.c} inside.
9524
9525 Using the @samp{-N} flag will defeat this behavior.
9526 Given the same module definitions above, @samp{cvs co
9527 -N -d dir foo} will create directories @samp{dir/foo}
9528 and place @samp{bar.c} inside, while @samp{cvs co -N -d
9529 dir bar/baz} will create directories @samp{dir/bar/baz}
9530 and place @samp{quux.c} inside.
9531
9532 @item -j @var{tag}
9533 With two @samp{-j} options, merge changes from the
9534 revision specified with the first @samp{-j} option to
9535 the revision specified with the second @samp{j} option,
9536 into the working directory.
9537
9538 With one @samp{-j} option, merge changes from the
9539 ancestor revision to the revision specified with the
9540 @samp{-j} option, into the working directory. The
9541 ancestor revision is the common ancestor of the
9542 revision which the working directory is based on, and
9543 the revision specified in the @samp{-j} option.
9544
9545 In addition, each -j option can contain an optional
9546 date specification which, when used with branches, can
9547 limit the chosen revision to one within a specific
9548 date. An optional date is specified by adding a colon
9549 (:) to the tag:
9550 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
9551
9552 @xref{Branching and merging}.
9553
9554 @item -N
9555 Only useful together with @samp{-d @var{dir}}. With
9556 this option, @sc{cvs} will not ``shorten'' module paths
9557 in your working directory when you check out a single
9558 module. See the @samp{-d} flag for examples and a
9559 discussion.
9560
9561 @item -s
9562 Like @samp{-c}, but include the status of all modules,
9563 and sort it by the status string. @xref{modules}, for
9564 info about the @samp{-s} option that is used inside the
9565 modules file to set the module status.
9566 @end table
9567
9568 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9569 @node checkout examples
9570 @appendixsubsec checkout examples
9571
9572 Get a copy of the module @samp{tc}:
9573
9574 @example
9575 $ cvs checkout tc
9576 @end example
9577
9578 Get a copy of the module @samp{tc} as it looked one day
9579 ago:
9580
9581 @example
9582 $ cvs checkout -D yesterday tc
9583 @end example
9584
9585 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9586 @node commit, diff, checkout, CVS commands
9587 @appendixsec commit---Check files into the repository
9588 @cindex commit (subcommand)
9589
9590 @itemize @bullet
9591 @item
9592 Synopsis: commit [-lnRf] [-m 'log_message' | -F file] [-r revision] [files@dots{}]
9593 @item
9594 Requires: working directory, repository.
9595 @item
9596 Changes: repository.
9597 @item
9598 Synonym: ci
9599 @end itemize
9600
9601 Use @code{commit} when you want to incorporate changes
9602 from your working source files into the source
9603 repository.
9604
9605 If you don't specify particular files to commit, all of
9606 the files in your working current directory are
9607 examined. @code{commit} is careful to change in the
9608 repository only those files that you have really
9609 changed. By default (or if you explicitly specify the
9610 @samp{-R} option), files in subdirectories are also
9611 examined and committed if they have changed; you can
9612 use the @samp{-l} option to limit @code{commit} to the
9613 current directory only.
9614
9615 @code{commit} verifies that the selected files are up
9616 to date with the current revisions in the source
9617 repository; it will notify you, and exit without
9618 committing, if any of the specified files must be made
9619 current first with @code{update} (@pxref{update}).
9620 @code{commit} does not call the @code{update} command
9621 for you, but rather leaves that for you to do when the
9622 time is right.
9623
9624 When all is well, an editor is invoked to allow you to
9625 enter a log message that will be written to one or more
9626 logging programs (@pxref{modules}, and @pxref{loginfo})
9627 and placed in the @sc{rcs} file inside the
9628 repository. This log message can be retrieved with the
9629 @code{log} command; see @ref{log}. You can specify the
9630 log message on the command line with the @samp{-m
9631 @var{message}} option, and thus avoid the editor invocation,
9632 or use the @samp{-F @var{file}} option to specify
9633 that the argument file contains the log message.
9634
9635 At @code{commit}, a unique commitid is placed in the @sc{rcs}
9636 file inside the repository. All files committed at once
9637 get the same commitid, a string consisting only of hexadecimal
9638 digits (usually 16 in GNU @sc{cvs}, 19 in Debian and MirBSD @sc{cvs}).
9639 FSF GNU @sc{cvs} 1.11 and OpenBSD OpenCVS do not support commitids yet.
9640 The commitid can be retrieved with
9641 the @code{log} and @code{status} command; see @ref{log} and
9642 @ref{File status}.
9643
9644 @menu
9645 * commit options:: commit options
9646 * commit examples:: commit examples
9647 @end menu
9648
9649 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9650 @node commit options
9651 @appendixsubsec commit options
9652
9653 These standard options are supported by @code{commit}
9654 (@pxref{Common options}, for a complete description of
9655 them):
9656
9657 @table @code
9658 @item -l
9659 Local; run only in current working directory.
9660
9661 @item -R
9662 Commit directories recursively. This is on by default.
9663
9664 @item -r @var{revision}
9665 Commit to @var{revision}. @var{revision} must be
9666 either a branch, or a revision on the main trunk that
9667 is higher than any existing revision number
9668 (@pxref{Assigning revisions}). You
9669 cannot commit to a specific revision on a branch.
9670 @c FIXME: Need xref for branch case.
9671 @end table
9672
9673 @code{commit} also supports these options:
9674
9675 @table @code
9676 @item -c
9677 Refuse to commit files unless the user has registered a valid edit on the
9678 file via @code{cvs edit}. This is most useful when @samp{commit -c}
9679 and @samp{edit -c} have been placed in all @file{.cvsrc} files.
9680 A commit can be forced anyways by either regestering an edit retroactively
9681 via @code{cvs edit} (no changes to the file will be lost) or using the
9682 @code{-f} option to commit. Support for @code{commit -c} requires both
9683 client and a server versions 1.12.10 or greater.
9684
9685 @item -F @var{file}
9686 Read the log message from @var{file}, instead
9687 of invoking an editor.
9688
9689 @item -f
9690 Note that this is not the standard behavior of
9691 the @samp{-f} option as defined in @ref{Common options}.
9692
9693 Force @sc{cvs} to commit a new revision even if you haven't
9694 made any changes to the file. As of @sc{cvs} version 1.12.10,
9695 it also causes the @code{-c} option to be ignored. If the current revision
9696 of @var{file} is 1.7, then the following two commands
9697 are equivalent:
9698
9699 @example
9700 $ cvs commit -f @var{file}
9701 $ cvs commit -r 1.8 @var{file}
9702 @end example
9703
9704 @c This is odd, but it's how CVS has worked for some
9705 @c time.
9706 The @samp{-f} option disables recursion (i.e., it
9707 implies @samp{-l}). To force @sc{cvs} to commit a new
9708 revision for all files in all subdirectories, you must
9709 use @samp{-f -R}.
9710
9711 @item -m @var{message}
9712 Use @var{message} as the log message, instead of
9713 invoking an editor.
9714 @end table
9715
9716 @need 2000
9717 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9718 @node commit examples
9719 @appendixsubsec commit examples
9720
9721 @c FIXME: this material wants to be somewhere
9722 @c in "Branching and merging".
9723
9724 @appendixsubsubsec Committing to a branch
9725
9726 You can commit to a branch revision (one that has an
9727 even number of dots) with the @samp{-r} option. To
9728 create a branch revision, use the @samp{-b} option
9729 of the @code{rtag} or @code{tag} commands
9730 (@pxref{Branching and merging}). Then, either @code{checkout} or
9731 @code{update} can be used to base your sources on the
9732 newly created branch. From that point on, all
9733 @code{commit} changes made within these working sources
9734 will be automatically added to a branch revision,
9735 thereby not disturbing main-line development in any
9736 way. For example, if you had to create a patch to the
9737 1.2 version of the product, even though the 2.0 version
9738 is already under development, you might do:
9739
9740 @example
9741 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
9742 $ cvs checkout -r FCS1_2_Patch product_module
9743 $ cd product_module
9744 [[ hack away ]]
9745 $ cvs commit
9746 @end example
9747
9748 @noindent
9749 This works automatically since the @samp{-r} option is
9750 sticky.
9751
9752 @appendixsubsubsec Creating the branch after editing
9753
9754 Say you have been working on some extremely
9755 experimental software, based on whatever revision you
9756 happened to checkout last week. If others in your
9757 group would like to work on this software with you, but
9758 without disturbing main-line development, you could
9759 commit your change to a new branch. Others can then
9760 checkout your experimental stuff and utilise the full
9761 benefit of @sc{cvs} conflict resolution. The scenario might
9762 look like:
9763
9764 @c FIXME: Should we be recommending tagging the branchpoint?
9765 @example
9766 [[ hacked sources are present ]]
9767 $ cvs tag -b EXPR1
9768 $ cvs update -r EXPR1
9769 $ cvs commit
9770 @end example
9771
9772 The @code{update} command will make the @samp{-r
9773 EXPR1} option sticky on all files. Note that your
9774 changes to the files will never be removed by the
9775 @code{update} command. The @code{commit} will
9776 automatically commit to the correct branch, because the
9777 @samp{-r} is sticky. You could also do like this:
9778
9779 @c FIXME: Should we be recommending tagging the branchpoint?
9780 @example
9781 [[ hacked sources are present ]]
9782 $ cvs tag -b EXPR1
9783 $ cvs commit -r EXPR1
9784 @end example
9785
9786 @noindent
9787 but then, only those files that were changed by you
9788 will have the @samp{-r EXPR1} sticky flag. If you hack
9789 away, and commit without specifying the @samp{-r EXPR1}
9790 flag, some files may accidentally end up on the main
9791 trunk.
9792
9793 To work with you on the experimental change, others
9794 would simply do
9795
9796 @example
9797 $ cvs checkout -r EXPR1 whatever_module
9798 @end example
9799
9800 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9801 @node diff, export, commit, CVS commands
9802 @appendixsec diff---Show differences between revisions
9803 @cindex diff (subcommand)
9804
9805 @itemize @bullet
9806 @item
9807 Synopsis: diff [-lR] [-k kflag] [format_options] [(-r rev1[:date1] | -D date1) [-r rev2[:date2] | -D date2]] [files@dots{}]
9808 @item
9809 Requires: working directory, repository.
9810 @item
9811 Changes: nothing.
9812 @end itemize
9813
9814 The @code{diff} command is used to compare different
9815 revisions of files. The default action is to compare
9816 your working files with the revisions they were based
9817 on, and report any differences that are found.
9818
9819 If any file names are given, only those files are
9820 compared. If any directories are given, all files
9821 under them will be compared.
9822
9823 The exit status for diff is different than for other
9824 @sc{cvs} commands; for details @pxref{Exit status}.
9825
9826 @menu
9827 * diff options:: diff options
9828 * diff examples:: diff examples
9829 @end menu
9830
9831 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9832 @node diff options
9833 @appendixsubsec diff options
9834
9835 These standard options are supported by @code{diff}
9836 (@pxref{Common options}, for a complete description of
9837 them):
9838
9839 @table @code
9840 @item -D @var{date}
9841 Use the most recent revision no later than @var{date}.
9842 See @samp{-r} for how this affects the comparison.
9843
9844 @item -k @var{kflag}
9845 Process keywords according to @var{kflag}. See
9846 @ref{Keyword substitution}.
9847
9848 @item -l
9849 Local; run only in current working directory.
9850
9851 @item -R
9852 Examine directories recursively. This option is on by
9853 default.
9854
9855 @item -r @var{tag}[:@var{date}]
9856 Compare with revision specified by @var{tag} or, when @var{date} is specified
9857 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
9858 existed on @var{date}. Zero, one or two
9859 @samp{-r} options can be present. With no @samp{-r}
9860 option, the working file will be compared with the
9861 revision it was based on. With one @samp{-r}, that
9862 revision will be compared to your current working file.
9863 With two @samp{-r} options those two revisions will be
9864 compared (and your working file will not affect the
9865 outcome in any way).
9866 @c We should be a lot more explicit, with examples,
9867 @c about the difference between "cvs diff" and "cvs
9868 @c diff -r HEAD". This often confuses new users.
9869
9870 One or both @samp{-r} options can be replaced by a
9871 @samp{-D @var{date}} option, described above.
9872 @end table
9873
9874 @c Conceptually, this is a disaster. There are 3
9875 @c zillion diff formats that we support via the diff
9876 @c library. It is not obvious to me that we should
9877 @c document them all. Maybe just the most common ones
9878 @c like -c and -u, and think about phasing out the
9879 @c obscure ones.
9880 @c FIXCVS: also should be a way to specify an external
9881 @c diff program (which can be different for different
9882 @c file types) and pass through
9883 @c arbitrary options, so that the user can do
9884 @c "--pass=-Z --pass=foo" or something even if CVS
9885 @c doesn't know about the "-Z foo" option to diff.
9886 @c This would fit nicely with deprecating/eliminating
9887 @c the obscure options of the diff library, because it
9888 @c would let people specify an external GNU diff if
9889 @c they are into that sort of thing.
9890 The following options specify the format of the
9891 output. They have the same meaning as in GNU diff.
9892 Most options have two equivalent names, one of which is a single letter
9893 preceded by @samp{-}, and the other of which is a long name preceded by
9894 @samp{--}.
9895
9896 @table @samp
9897 @item -@var{lines}
9898 Show @var{lines} (an integer) lines of context. This option does not
9899 specify an output format by itself; it has no effect unless it is
9900 combined with @samp{-c} or @samp{-u}. This option is obsolete. For proper
9901 operation, @code{patch} typically needs at least two lines of context.
9902
9903 @item -a
9904 Treat all files as text and compare them line-by-line, even if they
9905 do not seem to be text.
9906
9907 @item -b
9908 Ignore trailing white space and consider all other sequences of one or
9909 more white space characters to be equivalent.
9910
9911 @item -B
9912 Ignore changes that just insert or delete blank lines.
9913
9914 @item --binary
9915 Read and write data in binary mode.
9916
9917 @item --brief
9918 Report only whether the files differ, not the details of the
9919 differences.
9920
9921 @item -c
9922 Use the context output format.
9923
9924 @item -C @var{lines}
9925 @itemx --context@r{[}=@var{lines}@r{]}
9926 Use the context output format, showing @var{lines} (an integer) lines of
9927 context, or three if @var{lines} is not given.
9928 For proper operation, @code{patch} typically needs at least two lines of
9929 context.
9930
9931 @item --changed-group-format=@var{format}
9932 Use @var{format} to output a line group containing differing lines from
9933 both files in if-then-else format. @xref{Line group formats}.
9934
9935 @item -d
9936 Change the algorithm to perhaps find a smaller set of changes. This makes
9937 @code{diff} slower (sometimes much slower).
9938
9939 @item -e
9940 @itemx --ed
9941 Make output that is a valid @code{ed} script.
9942
9943 @item --expand-tabs
9944 Expand tabs to spaces in the output, to preserve the alignment of tabs
9945 in the input files.
9946
9947 @item -f
9948 Make output that looks vaguely like an @code{ed} script but has changes
9949 in the order they appear in the file.
9950
9951 @item -F @var{regexp}
9952 In context and unified format, for each hunk of differences, show some
9953 of the last preceding line that matches @var{regexp}.
9954
9955 @item --forward-ed
9956 Make output that looks vaguely like an @code{ed} script but has changes
9957 in the order they appear in the file.
9958
9959 @item -H
9960 Use heuristics to speed handling of large files that have numerous
9961 scattered small changes.
9962
9963 @item --horizon-lines=@var{lines}
9964 Do not discard the last @var{lines} lines of the common prefix
9965 and the first @var{lines} lines of the common suffix.
9966
9967 @item -i
9968 Ignore changes in case; consider upper- and lower-case letters
9969 equivalent.
9970
9971 @item -I @var{regexp}
9972 Ignore changes that just insert or delete lines that match @var{regexp}.
9973
9974 @item --ifdef=@var{name}
9975 Make merged if-then-else output using @var{name}.
9976
9977 @item --ignore-all-space
9978 Ignore white space when comparing lines.
9979
9980 @item --ignore-blank-lines
9981 Ignore changes that just insert or delete blank lines.
9982
9983 @item --ignore-case
9984 Ignore changes in case; consider upper- and lower-case to be the same.
9985
9986 @item --ignore-matching-lines=@var{regexp}
9987 Ignore changes that just insert or delete lines that match @var{regexp}.
9988
9989 @item --ignore-space-change
9990 Ignore trailing white space and consider all other sequences of one or
9991 more white space characters to be equivalent.
9992
9993 @item --initial-tab
9994 Output a tab rather than a space before the text of a line in normal or
9995 context format. This causes the alignment of tabs in the line to look
9996 normal.
9997
9998 @item -L @var{label}
9999 Use @var{label} instead of the file name in the context format
10000 and unified format headers.
10001
10002 @item --label=@var{label}
10003 Use @var{label} instead of the file name in the context format
10004 and unified format headers.
10005
10006 @item --left-column
10007 Print only the left column of two common lines in side by side format.
10008
10009 @item --line-format=@var{format}
10010 Use @var{format} to output all input lines in if-then-else format.
10011 @xref{Line formats}.
10012
10013 @item --minimal
10014 Change the algorithm to perhaps find a smaller set of changes. This
10015 makes @code{diff} slower (sometimes much slower).
10016
10017 @item -n
10018 Output RCS-format diffs; like @samp{-f} except that each command
10019 specifies the number of lines affected.
10020
10021 @item -N
10022 @itemx --new-file
10023 In directory comparison, if a file is found in only one directory,
10024 treat it as present but empty in the other directory.
10025
10026 @item --new-group-format=@var{format}
10027 Use @var{format} to output a group of lines taken from just the second
10028 file in if-then-else format. @xref{Line group formats}.
10029
10030 @item --new-line-format=@var{format}
10031 Use @var{format} to output a line taken from just the second file in
10032 if-then-else format. @xref{Line formats}.
10033
10034 @item --old-group-format=@var{format}
10035 Use @var{format} to output a group of lines taken from just the first
10036 file in if-then-else format. @xref{Line group formats}.
10037
10038 @item --old-line-format=@var{format}
10039 Use @var{format} to output a line taken from just the first file in
10040 if-then-else format. @xref{Line formats}.
10041
10042 @item -p
10043 Show which C function each change is in.
10044
10045 @item --rcs
10046 Output RCS-format diffs; like @samp{-f} except that each command
10047 specifies the number of lines affected.
10048
10049 @item --report-identical-files
10050 @itemx -s
10051 Report when two files are the same.
10052
10053 @item --show-c-function
10054 Show which C function each change is in.
10055
10056 @item --show-function-line=@var{regexp}
10057 In context and unified format, for each hunk of differences, show some
10058 of the last preceding line that matches @var{regexp}.
10059
10060 @item --side-by-side
10061 Use the side by side output format.
10062
10063 @item --speed-large-files
10064 Use heuristics to speed handling of large files that have numerous
10065 scattered small changes.
10066
10067 @item --suppress-common-lines
10068 Do not print common lines in side by side format.
10069
10070 @item -t
10071 Expand tabs to spaces in the output, to preserve the alignment of tabs
10072 in the input files.
10073
10074 @item -T
10075 Output a tab rather than a space before the text of a line in normal or
10076 context format. This causes the alignment of tabs in the line to look
10077 normal.
10078
10079 @item --text
10080 Treat all files as text and compare them line-by-line, even if they
10081 do not appear to be text.
10082
10083 @item -u
10084 Use the unified output format.
10085
10086 @item --unchanged-group-format=@var{format}
10087 Use @var{format} to output a group of common lines taken from both files
10088 in if-then-else format. @xref{Line group formats}.
10089
10090 @item --unchanged-line-format=@var{format}
10091 Use @var{format} to output a line common to both files in if-then-else
10092 format. @xref{Line formats}.
10093
10094 @item -U @var{lines}
10095 @itemx --unified@r{[}=@var{lines}@r{]}
10096 Use the unified output format, showing @var{lines} (an integer) lines of
10097 context, or three if @var{lines} is not given.
10098 For proper operation, @code{patch} typically needs at least two lines of
10099 context.
10100
10101 @item -w
10102 Ignore white space when comparing lines.
10103
10104 @item -W @var{columns}
10105 @itemx --width=@var{columns}
10106 Use an output width of @var{columns} in side by side format.
10107
10108 @item -y
10109 Use the side by side output format.
10110 @end table
10111
10112 @menu
10113 * Line group formats:: Line group formats
10114 * Line formats:: Line formats
10115 @end menu
10116
10117 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10118 @node Line group formats
10119 @appendixsubsubsec Line group formats
10120
10121 Line group formats let you specify formats suitable for many
10122 applications that allow if-then-else input, including programming
10123 languages and text formatting languages. A line group format specifies
10124 the output format for a contiguous group of similar lines.
10125
10126 For example, the following command compares the TeX file @file{myfile}
10127 with the original version from the repository,
10128 and outputs a merged file in which old regions are
10129 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
10130 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
10131
10132 @example
10133 cvs diff \
10134 --old-group-format='\begin@{em@}
10135 %<\end@{em@}
10136 ' \
10137 --new-group-format='\begin@{bf@}
10138 %>\end@{bf@}
10139 ' \
10140 myfile
10141 @end example
10142
10143 The following command is equivalent to the above example, but it is a
10144 little more verbose, because it spells out the default line group formats.
10145
10146 @example
10147 cvs diff \
10148 --old-group-format='\begin@{em@}
10149 %<\end@{em@}
10150 ' \
10151 --new-group-format='\begin@{bf@}
10152 %>\end@{bf@}
10153 ' \
10154 --unchanged-group-format='%=' \
10155 --changed-group-format='\begin@{em@}
10156 %<\end@{em@}
10157 \begin@{bf@}
10158 %>\end@{bf@}
10159 ' \
10160 myfile
10161 @end example
10162
10163 Here is a more advanced example, which outputs a diff listing with
10164 headers containing line numbers in a ``plain English'' style.
10165
10166 @example
10167 cvs diff \
10168 --unchanged-group-format='' \
10169 --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
10170 %<' \
10171 --new-group-format='-------- %dN line%(N=1?:s) added after %de:
10172 %>' \
10173 --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
10174 %<-------- to:
10175 %>' \
10176 myfile
10177 @end example
10178
10179 To specify a line group format, use one of the options
10180 listed below. You can specify up to four line group formats, one for
10181 each kind of line group. You should quote @var{format}, because it
10182 typically contains shell metacharacters.
10183
10184 @table @samp
10185 @item --old-group-format=@var{format}
10186 These line groups are hunks containing only lines from the first file.
10187 The default old group format is the same as the changed group format if
10188 it is specified; otherwise it is a format that outputs the line group as-is.
10189
10190 @item --new-group-format=@var{format}
10191 These line groups are hunks containing only lines from the second
10192 file. The default new group format is same as the changed group
10193 format if it is specified; otherwise it is a format that outputs the
10194 line group as-is.
10195
10196 @item --changed-group-format=@var{format}
10197 These line groups are hunks containing lines from both files. The
10198 default changed group format is the concatenation of the old and new
10199 group formats.
10200
10201 @item --unchanged-group-format=@var{format}
10202 These line groups contain lines common to both files. The default
10203 unchanged group format is a format that outputs the line group as-is.
10204 @end table
10205
10206 In a line group format, ordinary characters represent themselves;
10207 conversion specifications start with @samp{%} and have one of the
10208 following forms.
10209
10210 @table @samp
10211 @item %<
10212 stands for the lines from the first file, including the trailing newline.
10213 Each line is formatted according to the old line format (@pxref{Line formats}).
10214
10215 @item %>
10216 stands for the lines from the second file, including the trailing newline.
10217 Each line is formatted according to the new line format.
10218
10219 @item %=
10220 stands for the lines common to both files, including the trailing newline.
10221 Each line is formatted according to the unchanged line format.
10222
10223 @item %%
10224 stands for @samp{%}.
10225
10226 @item %c'@var{C}'
10227 where @var{C} is a single character, stands for @var{C}.
10228 @var{C} may not be a backslash or an apostrophe.
10229 For example, @samp{%c':'} stands for a colon, even inside
10230 the then-part of an if-then-else format, which a colon would
10231 normally terminate.
10232
10233 @item %c'\@var{O}'
10234 where @var{O} is a string of 1, 2, or 3 octal digits,
10235 stands for the character with octal code @var{O}.
10236 For example, @samp{%c'\0'} stands for a null character.
10237
10238 @item @var{F}@var{n}
10239 where @var{F} is a @code{printf} conversion specification and @var{n} is one
10240 of the following letters, stands for @var{n}'s value formatted with @var{F}.
10241
10242 @table @samp
10243 @item e
10244 The line number of the line just before the group in the old file.
10245
10246 @item f
10247 The line number of the first line in the group in the old file;
10248 equals @var{e} + 1.
10249
10250 @item l
10251 The line number of the last line in the group in the old file.
10252
10253 @item m
10254 The line number of the line just after the group in the old file;
10255 equals @var{l} + 1.
10256
10257 @item n
10258 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
10259
10260 @item E, F, L, M, N
10261 Likewise, for lines in the new file.
10262
10263 @end table
10264
10265 The @code{printf} conversion specification can be @samp{%d},
10266 @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
10267 lower case hexadecimal, or upper case hexadecimal output
10268 respectively. After the @samp{%} the following options can appear in
10269 sequence: a @samp{-} specifying left-justification; an integer
10270 specifying the minimum field width; and a period followed by an
10271 optional integer specifying the minimum number of digits.
10272 For example, @samp{%5dN} prints the number of new lines in the group
10273 in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
10274
10275 @item (@var{A}=@var{B}?@var{T}:@var{E})
10276 If @var{A} equals @var{B} then @var{T} else @var{E}.
10277 @var{A} and @var{B} are each either a decimal constant
10278 or a single letter interpreted as above.
10279 This format spec is equivalent to @var{T} if
10280 @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
10281
10282 For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
10283 @samp{no lines} if @var{N} (the number of lines in the group in the
10284 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
10285 otherwise.
10286 @end table
10287
10288 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10289 @node Line formats
10290 @appendixsubsubsec Line formats
10291
10292 Line formats control how each line taken from an input file is
10293 output as part of a line group in if-then-else format.
10294
10295 For example, the following command outputs text with a one-column
10296 change indicator to the left of the text. The first column of output
10297 is @samp{-} for deleted lines, @samp{|} for added lines, and a space
10298 for unchanged lines. The formats contain newline characters where
10299 newlines are desired on output.
10300
10301 @example
10302 cvs diff \
10303 --old-line-format='-%l
10304 ' \
10305 --new-line-format='|%l
10306 ' \
10307 --unchanged-line-format=' %l
10308 ' \
10309 myfile
10310 @end example
10311
10312 To specify a line format, use one of the following options. You should
10313 quote @var{format}, since it often contains shell metacharacters.
10314
10315 @table @samp
10316 @item --old-line-format=@var{format}
10317 formats lines just from the first file.
10318
10319 @item --new-line-format=@var{format}
10320 formats lines just from the second file.
10321
10322 @item --unchanged-line-format=@var{format}
10323 formats lines common to both files.
10324
10325 @item --line-format=@var{format}
10326 formats all lines; in effect, it sets all three above options simultaneously.
10327 @end table
10328
10329 In a line format, ordinary characters represent themselves;
10330 conversion specifications start with @samp{%} and have one of the
10331 following forms.
10332
10333 @table @samp
10334 @item %l
10335 stands for the contents of the line, not counting its trailing
10336 newline (if any). This format ignores whether the line is incomplete.
10337
10338 @item %L
10339 stands for the contents of the line, including its trailing newline
10340 (if any). If a line is incomplete, this format preserves its
10341 incompleteness.
10342
10343 @item %%
10344 stands for @samp{%}.
10345
10346 @item %c'@var{C}'
10347 where @var{C} is a single character, stands for @var{C}.
10348 @var{C} may not be a backslash or an apostrophe.
10349 For example, @samp{%c':'} stands for a colon.
10350
10351 @item %c'\@var{O}'
10352 where @var{O} is a string of 1, 2, or 3 octal digits,
10353 stands for the character with octal code @var{O}.
10354 For example, @samp{%c'\0'} stands for a null character.
10355
10356 @item @var{F}n
10357 where @var{F} is a @code{printf} conversion specification,
10358 stands for the line number formatted with @var{F}.
10359 For example, @samp{%.5dn} prints the line number using the
10360 @code{printf} format @code{"%.5d"}. @xref{Line group formats}, for
10361 more about printf conversion specifications.
10362
10363 @end table
10364
10365 The default line format is @samp{%l} followed by a newline character.
10366
10367 If the input contains tab characters and it is important that they line
10368 up on output, you should ensure that @samp{%l} or @samp{%L} in a line
10369 format is just after a tab stop (e.g.@: by preceding @samp{%l} or
10370 @samp{%L} with a tab character), or you should use the @samp{-t} or
10371 @samp{--expand-tabs} option.
10372
10373 Taken together, the line and line group formats let you specify many
10374 different formats. For example, the following command uses a format
10375 similar to @code{diff}'s normal format. You can tailor this command
10376 to get fine control over @code{diff}'s output.
10377
10378 @example
10379 cvs diff \
10380 --old-line-format='< %l
10381 ' \
10382 --new-line-format='> %l
10383 ' \
10384 --old-group-format='%df%(f=l?:,%dl)d%dE
10385 %<' \
10386 --new-group-format='%dea%dF%(F=L?:,%dL)
10387 %>' \
10388 --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
10389 %<---
10390 %>' \
10391 --unchanged-group-format='' \
10392 myfile
10393 @end example
10394
10395 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10396 @node diff examples
10397 @appendixsubsec diff examples
10398
10399 The following line produces a Unidiff (@samp{-u} flag)
10400 between revision 1.14 and 1.19 of
10401 @file{backend.c}. Due to the @samp{-kk} flag no
10402 keywords are substituted, so differences that only depend
10403 on keyword substitution are ignored.
10404
10405 @example
10406 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
10407 @end example
10408
10409 Suppose the experimental branch EXPR1 was based on a
10410 set of files tagged RELEASE_1_0. To see what has
10411 happened on that branch, the following can be used:
10412
10413 @example
10414 $ cvs diff -r RELEASE_1_0 -r EXPR1
10415 @end example
10416
10417 A command like this can be used to produce a context
10418 diff between two releases:
10419
10420 @example
10421 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
10422 @end example
10423
10424 If you are maintaining ChangeLogs, a command like the following
10425 just before you commit your changes may help you write
10426 the ChangeLog entry. All local modifications that have
10427 not yet been committed will be printed.
10428
10429 @example
10430 $ cvs diff -u | less
10431 @end example
10432
10433 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10434 @node export, history, diff, CVS commands
10435 @appendixsec export---Export sources from CVS, similar to checkout
10436 @cindex export (subcommand)
10437
10438 @itemize @bullet
10439 @item
10440 Synopsis: export [-flNnR] (-r rev[:date] | -D date) [-k subst] [-d dir] module@dots{}
10441 @item
10442 Requires: repository.
10443 @item
10444 Changes: current directory.
10445 @end itemize
10446
10447 This command is a variant of @code{checkout}; use it
10448 when you want a copy of the source for module without
10449 the @sc{cvs} administrative directories. For example, you
10450 might use @code{export} to prepare source for shipment
10451 off-site. This command requires that you specify a
10452 date or tag (with @samp{-D} or @samp{-r}), so that you
10453 can count on reproducing the source you ship to others
10454 (and thus it always prunes empty directories).
10455
10456 One often would like to use @samp{-kv} with @code{cvs
10457 export}. This causes any keywords to be
10458 expanded such that an import done at some other site
10459 will not lose the keyword revision information. But be
10460 aware that doesn't handle an export containing binary
10461 files correctly. Also be aware that after having used
10462 @samp{-kv}, one can no longer use the @code{ident}
10463 command (which is part of the @sc{rcs} suite---see
10464 ident(1)) which looks for keyword strings. If
10465 you want to be able to use @code{ident} you must not
10466 use @samp{-kv}.
10467
10468 @menu
10469 * export options:: export options
10470 @end menu
10471
10472 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10473 @node export options
10474 @appendixsubsec export options
10475
10476 These standard options are supported by @code{export}
10477 (@pxref{Common options}, for a complete description of
10478 them):
10479
10480 @table @code
10481 @item -D @var{date}
10482 Use the most recent revision no later than @var{date}.
10483
10484 @item -f
10485 If no matching revision is found, retrieve the most
10486 recent revision (instead of ignoring the file).
10487
10488 @item -l
10489 Local; run only in current working directory.
10490
10491 @item -n
10492 Do not run any checkout program.
10493
10494 @item -R
10495 Export directories recursively. This is on by default.
10496
10497 @item -r @var{tag}[:@var{date}]
10498 Export the revision specified by @var{tag} or, when @var{date} is specified
10499 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
10500 existed on @var{date}. See @ref{Common options}.
10501 @end table
10502
10503 In addition, these options (that are common to
10504 @code{checkout} and @code{export}) are also supported:
10505
10506 @table @code
10507 @item -d @var{dir}
10508 Create a directory called @var{dir} for the working
10509 files, instead of using the module name.
10510 @xref{checkout options}, for complete details on how
10511 @sc{cvs} handles this flag.
10512
10513 @item -k @var{subst}
10514 Set keyword expansion mode (@pxref{Substitution modes}).
10515
10516 @item -N
10517 Only useful together with @samp{-d @var{dir}}.
10518 @xref{checkout options}, for complete details on how
10519 @sc{cvs} handles this flag.
10520 @end table
10521
10522 @ignore
10523 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10524 @c @node export examples
10525 @appendixsubsec export examples
10526
10527 Contributed examples are gratefully accepted.
10528 @c -- Examples here!!
10529 @end ignore
10530
10531 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10532 @node history, import, export, CVS commands
10533 @appendixsec history---Show repository access history
10534 @cindex history (subcommand)
10535
10536 @itemize @bullet
10537 @item
10538 Synopsis: history [-report] [-flags] [-options args] [files@dots{}]
10539 @item
10540 Requires: the file @file{$CVSROOT/CVSROOT/history}
10541 @item
10542 Changes: nothing.
10543 @end itemize
10544
10545 @sc{cvs} can keep a history log that tracks each use of most @sc{cvs}
10546 commands. You can use @code{history} to display this information in
10547 various formats.
10548
10549 To enable logging, the @samp{LogHistory} config option must be set to
10550 some value other than the empty string and the history file specified by
10551 the @samp{HistoryLogPath} option must be writable by all users who may run
10552 the @sc{cvs} executable (@pxref{config}).
10553
10554 To enable the @code{history} command, logging must be enabled as above and
10555 the @samp{HistorySearchPath} config option (@pxref{config}) must be set to
10556 specify some number of the history logs created thereby and these files must
10557 be readable by each user who might run the @code{history} command.
10558
10559 Creating a repository via the @code{cvs init} command will enable logging of
10560 all possible events to a single history log file
10561 (@file{$CVSROOT/CVSROOT/history}) with read and write permissions for all
10562 users (@pxref{Creating a repository}).
10563
10564 @emph{Note: @code{history} uses @samp{-f}, @samp{-l},
10565 @samp{-n}, and @samp{-p} in ways that conflict with the
10566 normal use inside @sc{cvs} (@pxref{Common options}).}
10567
10568 @menu
10569 * history options:: history options
10570 @end menu
10571
10572 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10573 @node history options
10574 @appendixsubsec history options
10575
10576 Several options (shown above as @samp{-report}) control what
10577 kind of report is generated:
10578
10579 @table @code
10580 @item -c
10581 Report on each time commit was used (i.e., each time
10582 the repository was modified).
10583
10584 @item -e
10585 Everything (all record types). Equivalent to
10586 specifying @samp{-x} with all record types. Of course,
10587 @samp{-e} will also include record types which are
10588 added in a future version of @sc{cvs}; if you are
10589 writing a script which can only handle certain record
10590 types, you'll want to specify @samp{-x}.
10591
10592 @item -m @var{module}
10593 Report on a particular module. (You can meaningfully
10594 use @samp{-m} more than once on the command line.)
10595
10596 @item -o
10597 Report on checked-out modules. This is the default report type.
10598
10599 @item -T
10600 Report on all tags.
10601
10602 @item -x @var{type}
10603 Extract a particular set of record types @var{type} from the @sc{cvs}
10604 history. The types are indicated by single letters,
10605 which you may specify in combination.
10606
10607 Certain commands have a single record type:
10608
10609 @table @code
10610 @item F
10611 release
10612 @item O
10613 checkout
10614 @item E
10615 export
10616 @item T
10617 rtag
10618 @end table
10619
10620 @noindent
10621 One of five record types may result from an update:
10622
10623 @table @code
10624 @item C
10625 A merge was necessary but collisions were
10626 detected (requiring manual merging).
10627 @item G
10628 A merge was necessary and it succeeded.
10629 @item U
10630 A working file was copied from the repository.
10631 @item P
10632 A working file was patched to match the repository.
10633 @item W
10634 The working copy of a file was deleted during
10635 update (because it was gone from the repository).
10636 @end table
10637
10638 @noindent
10639 One of three record types results from commit:
10640
10641 @table @code
10642 @item A
10643 A file was added for the first time.
10644 @item M
10645 A file was modified.
10646 @item R
10647 A file was removed.
10648 @end table
10649 @end table
10650
10651 The options shown as @samp{-flags} constrain or expand
10652 the report without requiring option arguments:
10653
10654 @table @code
10655 @item -a
10656 Show data for all users (the default is to show data
10657 only for the user executing @code{history}).
10658
10659 @item -l
10660 Show last modification only.
10661
10662 @item -w
10663 Show only the records for modifications done from the
10664 same working directory where @code{history} is
10665 executing.
10666 @end table
10667
10668 The options shown as @samp{-options @var{args}} constrain the report
10669 based on an argument:
10670
10671 @table @code
10672 @item -b @var{str}
10673 Show data back to a record containing the string
10674 @var{str} in either the module name, the file name, or
10675 the repository path.
10676
10677 @item -D @var{date}
10678 Show data since @var{date}. This is slightly different
10679 from the normal use of @samp{-D @var{date}}, which
10680 selects the newest revision older than @var{date}.
10681
10682 @item -f @var{file}
10683 Show data for a particular file
10684 (you can specify several @samp{-f} options on the same command line).
10685 This is equivalent to specifying the file on the command line.
10686
10687 @item -n @var{module}
10688 Show data for a particular module
10689 (you can specify several @samp{-n} options on the same command line).
10690
10691 @item -p @var{repository}
10692 Show data for a particular source repository (you
10693 can specify several @samp{-p} options on the same command
10694 line).
10695
10696 @item -r @var{rev}
10697 Show records referring to revisions since the revision
10698 or tag named @var{rev} appears in individual @sc{rcs}
10699 files. Each @sc{rcs} file is searched for the revision or
10700 tag.
10701
10702 @item -t @var{tag}
10703 Show records since tag @var{tag} was last added to the
10704 history file. This differs from the @samp{-r} flag
10705 above in that it reads only the history file, not the
10706 @sc{rcs} files, and is much faster.
10707
10708 @item -u @var{name}
10709 Show records for user @var{name}.
10710
10711 @item -z @var{timezone}
10712 Show times in the selected records using the specified
10713 time zone instead of UTC.
10714 @end table
10715
10716 @ignore
10717 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10718 @c @node history examples
10719 @appendixsubsec history examples
10720
10721 Contributed examples will gratefully be accepted.
10722 @c -- Examples here!
10723 @end ignore
10724
10725 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10726 @node import, log, history, CVS commands
10727 @appendixsec import---Import sources into CVS, using vendor branches
10728 @cindex import (subcommand)
10729
10730 @c FIXME: This node is way too long for one which has subnodes.
10731
10732 @itemize @bullet
10733 @item
10734 Synopsis: import [-options] repository vendortag releasetag@dots{}
10735 @item
10736 Requires: Repository, source distribution directory.
10737 @item
10738 Changes: repository.
10739 @end itemize
10740
10741 Use @code{import} to incorporate an entire source
10742 distribution from an outside source (e.g., a source
10743 vendor) into your source repository directory. You can
10744 use this command both for initial creation of a
10745 repository, and for wholesale updates to the module
10746 from the outside source. @xref{Tracking sources}, for
10747 a discussion on this subject.
10748
10749 The @var{repository} argument gives a directory name
10750 (or a path to a directory) under the @sc{cvs} root directory
10751 for repositories; if the directory did not exist,
10752 import creates it.
10753
10754 When you use import for updates to source that has been
10755 modified in your source repository (since a prior
10756 import), it will notify you of any files that conflict
10757 in the two branches of development; use @samp{checkout
10758 -j} to reconcile the differences, as import instructs
10759 you to do.
10760
10761 If @sc{cvs} decides a file should be ignored
10762 (@pxref{cvsignore}), it does not import it and prints
10763 @samp{I } followed by the filename (@pxref{import output}, for a
10764 complete description of the output).
10765
10766 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
10767 any file whose names match the specifications in that
10768 file will be treated as packages and the appropriate
10769 filtering will be performed on the file/directory
10770 before being imported. @xref{Wrappers}.
10771
10772 The outside source is saved in a first-level
10773 branch, by default 1.1.1. Updates are leaves of this
10774 branch; for example, files from the first imported
10775 collection of source will be revision 1.1.1.1, then
10776 files from the first imported update will be revision
10777 1.1.1.2, and so on.
10778
10779 At least three arguments are required.
10780 @var{repository} is needed to identify the collection
10781 of source. @var{vendortag} is a tag for the entire
10782 branch (e.g., for 1.1.1). You must also specify at
10783 least one @var{releasetag} to uniquely identify the files at
10784 the leaves created each time you execute @code{import}. The
10785 @var{releasetag} should be new, not previously existing in the
10786 repository file, and uniquely identify the imported release,
10787
10788 @c I'm not completely sure this belongs here. But
10789 @c we need to say it _somewhere_ reasonably obvious; it
10790 @c is a common misconception among people first learning CVS
10791 Note that @code{import} does @emph{not} change the
10792 directory in which you invoke it. In particular, it
10793 does not set up that directory as a @sc{cvs} working
10794 directory; if you want to work with the sources import
10795 them first and then check them out into a different
10796 directory (@pxref{Getting the source}).
10797
10798 @menu
10799 * import options:: import options
10800 * import output:: import output
10801 * import examples:: import examples
10802 @end menu
10803
10804 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10805 @node import options
10806 @appendixsubsec import options
10807
10808 This standard option is supported by @code{import}
10809 (@pxref{Common options}, for a complete description):
10810
10811 @table @code
10812 @item -m @var{message}
10813 Use @var{message} as log information, instead of
10814 invoking an editor.
10815 @end table
10816
10817 There are the following additional special options.
10818
10819 @table @code
10820 @item -b @var{branch}
10821 See @ref{Multiple vendor branches}.
10822
10823 @item -k @var{subst}
10824 Indicate the keyword expansion mode desired. This
10825 setting will apply to all files created during the
10826 import, but not to any files that previously existed in
10827 the repository. See @ref{Substitution modes}, for a
10828 list of valid @samp{-k} settings.
10829
10830 @item -I @var{name}
10831 Specify file names that should be ignored during
10832 import. You can use this option repeatedly. To avoid
10833 ignoring any files at all (even those ignored by
10834 default), specify `-I !'.
10835
10836 @var{name} can be a file name pattern of the same type
10837 that you can specify in the @file{.cvsignore} file.
10838 @xref{cvsignore}.
10839 @c -- Is this really true?
10840
10841 @item -W @var{spec}
10842 Specify file names that should be filtered during
10843 import. You can use this option repeatedly.
10844
10845 @var{spec} can be a file name pattern of the same type
10846 that you can specify in the @file{.cvswrappers}
10847 file. @xref{Wrappers}.
10848
10849 @item -X
10850 Modify the algorithm used by @sc{cvs} when importing new files
10851 so that new files do not immediately appear on the main trunk.
10852
10853 Specifically, this flag causes @sc{cvs} to mark new files as
10854 if they were deleted on the main trunk, by taking the following
10855 steps for each file in addition to those normally taken on import:
10856 creating a new revision on the main trunk indicating that
10857 the new file is @code{dead}, resetting the new file's default branch,
10858 and placing the file in the Attic (@pxref{Attic}) directory.
10859
10860 Setting the @samp{ImportNewFilesToVendorBranchOnly} option in
10861 CVSROOT/config (@pxref{config}) forces use of this option on
10862 a repository-wide basis.
10863 @end table
10864
10865 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10866 @node import output
10867 @appendixsubsec import output
10868
10869 @code{import} keeps you informed of its progress by printing a line
10870 for each file, preceded by one character indicating the status of the file:
10871
10872 @table @code
10873 @item U @var{file}
10874 The file already exists in the repository and has not been locally
10875 modified; a new revision has been created (if necessary).
10876
10877 @item N @var{file}
10878 The file is a new file which has been added to the repository.
10879
10880 @item C @var{file}
10881 The file already exists in the repository but has been locally modified;
10882 you will have to merge the changes.
10883
10884 @item I @var{file}
10885 The file is being ignored (@pxref{cvsignore}).
10886
10887 @cindex Symbolic link, importing
10888 @cindex Link, symbolic, importing
10889 @c FIXME: also (somewhere else) probably
10890 @c should be documenting what happens if you "cvs add"
10891 @c a symbolic link. Also maybe what happens if
10892 @c you manually create symbolic links within the
10893 @c repository (? - not sure why we'd want to suggest
10894 @c doing that).
10895 @item L @var{file}
10896 The file is a symbolic link; @code{cvs import} ignores symbolic links.
10897 People periodically suggest that this behavior should
10898 be changed, but if there is a consensus on what it
10899 should be changed to, it is not apparent.
10900 (Various options in the @file{modules} file can be used
10901 to recreate symbolic links on checkout, update, etc.;
10902 @pxref{modules}.)
10903 @end table
10904
10905 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10906 @node import examples
10907 @appendixsubsec import examples
10908
10909 See @ref{Tracking sources}, and @ref{From files}.
10910
10911 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10912 @node log, ls & rls, import, CVS commands
10913 @appendixsec log---Print out history information for files
10914 @cindex log (subcommand)
10915
10916 @itemize @bullet
10917 @item
10918 Synopsis: log [options] [files@dots{}]
10919
10920 rlog [options] [files@dots{}]
10921 @item
10922 Requires: repository, working directory.
10923 @item
10924 Changes: nothing.
10925 @end itemize
10926
10927 Display log information for files. @code{log} used to
10928 call the @sc{rcs} utility @code{rlog}. Although this
10929 is no longer true in the current sources, this history
10930 determines the format of the output and the options,
10931 which are not quite in the style of the other @sc{cvs}
10932 commands.
10933
10934 @cindex Timezone, in output
10935 @cindex Zone, time, in output
10936 The output includes the location of the @sc{rcs} file,
10937 the @dfn{head} revision (the latest revision on the
10938 trunk), all symbolic names (tags) and some other
10939 things. For each revision, the revision number, the
10940 date, the author, the number of lines added/deleted, the commitid
10941 and the log message are printed. All dates are displayed
10942 in local time at the client. This is typically specified in
10943 the @code{$TZ} environment variable, which can be set to
10944 govern how @code{log} displays dates.
10945
10946 @emph{Note: @code{log} uses @samp{-R} in a way that conflicts
10947 with the normal use inside @sc{cvs} (@pxref{Common options}).}
10948
10949 @menu
10950 * log options:: log options
10951 * log examples:: log examples
10952 @end menu
10953
10954 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10955 @node log options
10956 @appendixsubsec log options
10957
10958 By default, @code{log} prints all information that is
10959 available. All other options restrict the output. Note that the revision
10960 selection options (@code{-d}, @code{-r}, @code{-s}, and @code{-w}) have no
10961 effect, other than possibly causing a search for files in Attic directories,
10962 when used in conjunction with the options that restrict the output to only
10963 @code{log} header fields (@code{-b}, @code{-h}, @code{-R}, and @code{-t})
10964 unless the @code{-S} option is also specified.
10965
10966 @table @code
10967 @item -b
10968 Print information about the revisions on the default
10969 branch, normally the highest branch on the trunk.
10970
10971 @item -d @var{dates}
10972 Print information about revisions with a checkin
10973 date/time in the range given by the
10974 semicolon-separated list of dates. The date formats
10975 accepted are those accepted by the @samp{-D} option to
10976 many other @sc{cvs} commands (@pxref{Common options}).
10977 Dates can be combined into ranges as follows:
10978
10979 @c Should we be thinking about accepting ISO8601
10980 @c ranges? For example "1972-09-10/1972-09-12".
10981 @table @code
10982 @item @var{d1}<@var{d2}
10983 @itemx @var{d2}>@var{d1}
10984 Select the revisions that were deposited between
10985 @var{d1} and @var{d2}.
10986
10987 @item <@var{d}
10988 @itemx @var{d}>
10989 Select all revisions dated @var{d} or earlier.
10990
10991 @item @var{d}<
10992 @itemx >@var{d}
10993 Select all revisions dated @var{d} or later.
10994
10995 @item @var{d}
10996 Select the single, latest revision dated @var{d} or
10997 earlier.
10998 @end table
10999
11000 The @samp{>} or @samp{<} characters may be followed by
11001 @samp{=} to indicate an inclusive range rather than an
11002 exclusive one.
11003
11004 Note that the separator is a semicolon (;).
11005
11006 @item -h
11007 Print only the name of the @sc{rcs} file, name
11008 of the file in the working directory, head,
11009 default branch, access list, locks, symbolic names, and
11010 suffix.
11011
11012 @item -l
11013 Local; run only in current working directory. (Default
11014 is to run recursively).
11015
11016 @item -N
11017 Do not print the list of tags for this file. This
11018 option can be very useful when your site uses a lot of
11019 tags, so rather than "more"'ing over 3 pages of tag
11020 information, the log information is presented without
11021 tags at all.
11022
11023 @item -R
11024 Print only the name of the @sc{rcs} file.
11025
11026 @c Note that using a bare revision (in addition to not
11027 @c being explicitly documented here) is potentially
11028 @c confusing; it shows the log message to get from the
11029 @c previous revision to that revision. "-r1.3 -r1.6"
11030 @c (equivalent to "-r1.3,1.6") is even worse; it
11031 @c prints the messages to get from 1.2 to 1.3 and 1.5
11032 @c to 1.6. By analogy with "cvs diff", users might
11033 @c expect that it is more like specifying a range.
11034 @c It is not 100% clear to me how much of this should
11035 @c be documented (for example, multiple -r options
11036 @c perhaps could/should be deprecated given the false
11037 @c analogy with "cvs diff").
11038 @c In general, this section should be rewritten to talk
11039 @c about messages to get from revision rev1 to rev2,
11040 @c rather than messages for revision rev2 (that is, the
11041 @c messages are associated with a change not a static
11042 @c revision and failing to make this distinction causes
11043 @c much confusion).
11044 @item -r@var{revisions}
11045 Print information about revisions given in the
11046 comma-separated list @var{revisions} of revisions and
11047 ranges. The following table explains the available
11048 range formats:
11049
11050 @table @code
11051 @item @var{rev1}:@var{rev2}
11052 Revisions @var{rev1} to @var{rev2} (which must be on
11053 the same branch).
11054
11055 @item @var{rev1}::@var{rev2}
11056 The same, but excluding @var{rev1}.
11057
11058 @item :@var{rev}
11059 @itemx ::@var{rev}
11060 Revisions from the beginning of the branch up to
11061 and including @var{rev}.
11062
11063 @item @var{rev}:
11064 Revisions starting with @var{rev} to the end of the
11065 branch containing @var{rev}.
11066
11067 @item @var{rev}::
11068 Revisions starting just after @var{rev} to the end of the
11069 branch containing @var{rev}.
11070
11071 @item @var{branch}
11072 An argument that is a branch means all revisions on
11073 that branch.
11074
11075 @item @var{branch1}:@var{branch2}
11076 @itemx @var{branch1}::@var{branch2}
11077 A range of branches means all revisions
11078 on the branches in that range.
11079
11080 @item @var{branch}.
11081 The latest revision in @var{branch}.
11082 @end table
11083
11084 A bare @samp{-r} with no revisions means the latest
11085 revision on the default branch, normally the trunk.
11086 There can be no space between the @samp{-r} option and
11087 its argument.
11088
11089 @item -S
11090 Suppress the header if no revisions are selected.
11091
11092 @item -s @var{states}
11093 Print information about revisions whose state
11094 attributes match one of the states given in the
11095 comma-separated list @var{states}. Individual states may
11096 be any text string, though @sc{cvs} commonly only uses two
11097 states, @samp{Exp} and @samp{dead}. See @ref{admin options}
11098 for more information.
11099
11100 @item -t
11101 Print the same as @samp{-h}, plus the descriptive text.
11102
11103 @item -w@var{logins}
11104 Print information about revisions checked in by users
11105 with login names appearing in the comma-separated list
11106 @var{logins}. If @var{logins} is omitted, the user's
11107 login is assumed. There can be no space between the
11108 @samp{-w} option and its argument.
11109 @end table
11110
11111 @code{log} prints the intersection of the revisions
11112 selected with the options @samp{-d}, @samp{-s}, and
11113 @samp{-w}, intersected with the union of the revisions
11114 selected by @samp{-b} and @samp{-r}.
11115
11116 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11117 @node log examples
11118 @appendixsubsec log examples
11119
11120 @cindex Timezone, in output
11121 @cindex Zone, time, in output
11122 Since @code{log} shows dates in local time,
11123 you might want to see them in Coordinated Universal Time (UTC) or
11124 some other timezone.
11125 To do this you can set your @code{$TZ} environment
11126 variable before invoking @sc{cvs}:
11127
11128 @example
11129 $ TZ=UTC cvs log foo.c
11130 $ TZ=EST cvs log bar.c
11131 @end example
11132
11133 (If you are using a @code{csh}-style shell, like @code{tcsh},
11134 you would need to prefix the examples above with @code{env}.)
11135
11136 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11137 @node ls & rls
11138 @appendixsec ls & rls---List files in the repository
11139 @cindex ls (subcommand)
11140 @cindex rls (subcommand)
11141
11142 @itemize @bullet
11143 @item
11144 ls [-e | -l] [-RP] [-r tag[:date]] [-D date] [path@dots{}]
11145
11146 rls [-e | -l] [-RP] [-r tag[:date]] [-D date] [path@dots{}]
11147 @item
11148 Requires: repository for @code{rls}, repository & working directory for
11149 @code{ls}.
11150 @item
11151 Changes: nothing.
11152 @item
11153 Synonym: @code{dir} & @code{list} are synonyms for @code{ls} and @code{rdir}
11154 & @code{rlist} are synonyms for @code{rls}.
11155 @end itemize
11156
11157 The @code{ls} and @code{rls} commands are used to list
11158 files and directories in the repository.
11159
11160 By default @code{ls} lists the files and directories
11161 that belong in your working directory, what would be
11162 there after an @code{update}.
11163
11164 By default @code{rls} lists the files and directories
11165 on the tip of the trunk in the topmost directory of the
11166 repository.
11167
11168 Both commands accept an optional list of file and
11169 directory names, relative to the working directory for
11170 @code{ls} and the topmost directory of the repository
11171 for @code{rls}. Neither is recursive by default.
11172
11173 @menu
11174 * ls & rls options:: ls & rls options
11175 * rls examples: rls examples
11176 @end menu
11177
11178 @node ls & rls options
11179 @appendixsubsec ls & rls options
11180
11181 These standard options are supported by @code{ls} & @code{rls}:
11182
11183 @table @code
11184 @item -d
11185 Show dead revisions (with tag when specified).
11186
11187 @item -e
11188 Display in CVS/Entries format. This format is meant to remain easily parsable
11189 by automation.
11190
11191 @item -l
11192 Display all details.
11193
11194 @item -P
11195 Don't list contents of empty directories when recursing.
11196
11197 @item -R
11198 List recursively.
11199
11200 @item -r @var{tag}[:@var{date}]
11201 Show files specified by @var{tag} or, when @var{date} is specified
11202 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11203 existed on @var{date}. See @ref{Common options}.
11204
11205 @item -D @var{date}
11206 Show files from date.
11207 @end table
11208
11209 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11210 @node rls examples
11211 @appendixsubsec rls examples
11212
11213 @example
11214 $ cvs rls
11215 cvs rls: Listing module: `.'
11216 CVSROOT
11217 first-dir
11218 @end example
11219
11220 @example
11221 $ cvs rls CVSROOT
11222 cvs rls: Listing module: `CVSROOT'
11223 checkoutlist
11224 commitinfo
11225 config
11226 cvswrappers
11227 loginfo
11228 modules
11229 notify
11230 rcsinfo
11231 taginfo
11232 verifymsg
11233
11234 @end example
11235
11236 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11237 @node rdiff, release, ls & rls, CVS commands
11238 @appendixsec rdiff---Create 'patch' format diffs between revisions
11239 @cindex rdiff (subcommand)
11240
11241 @itemize @bullet
11242 @item
11243 rdiff [-flags] [-V vn] (-r tag1[:date1] | -D date1) [-r tag2[:date2] | -D date2] modules@dots{}
11244 @item
11245 Requires: repository.
11246 @item
11247 Changes: nothing.
11248 @item
11249 Synonym: patch
11250 @end itemize
11251
11252 Builds a Larry Wall format patch(1) file between two
11253 releases, that can be fed directly into the @code{patch}
11254 program to bring an old release up-to-date with the new
11255 release. (This is one of the few @sc{cvs} commands that
11256 operates directly from the repository, and doesn't
11257 require a prior checkout.) The diff output is sent to
11258 the standard output device.
11259
11260 You can specify (using the standard @samp{-r} and
11261 @samp{-D} options) any combination of one or two
11262 revisions or dates. If only one revision or date is
11263 specified, the patch file reflects differences between
11264 that revision or date and the current head revisions in
11265 the @sc{rcs} file.
11266
11267 Note that if the software release affected is contained
11268 in more than one directory, then it may be necessary to
11269 specify the @samp{-p} option to the @code{patch} command when
11270 patching the old sources, so that @code{patch} is able to find
11271 the files that are located in other directories.
11272
11273 @menu
11274 * rdiff options:: rdiff options
11275 * rdiff examples:: rdiff examples
11276 @end menu
11277
11278 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11279 @node rdiff options
11280 @appendixsubsec rdiff options
11281
11282 These standard options are supported by @code{rdiff}
11283 (@pxref{Common options}, for a complete description of
11284 them):
11285
11286 @table @code
11287 @item -D @var{date}
11288 Use the most recent revision no later than @var{date}.
11289
11290 @item -f
11291 If no matching revision is found, retrieve the most
11292 recent revision (instead of ignoring the file).
11293
11294 @item -k @var{kflag}
11295 Process keywords according to @var{kflag}. See
11296 @ref{Keyword substitution}.
11297
11298 @item -l
11299 Local; don't descend subdirectories.
11300
11301 @item -R
11302 Examine directories recursively. This option is on by default.
11303
11304 @item -r @var{tag}
11305 Use the revision specified by @var{tag}, or when @var{date} is specified
11306 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11307 existed on @var{date}. See @ref{Common options}.
11308 @end table
11309
11310 In addition to the above, these options are available:
11311
11312 @table @code
11313 @item -c
11314 Use the context diff format. This is the default format.
11315
11316 @item -p
11317 Show which C function each change is in.
11318
11319 @item -s
11320 Create a summary change report instead of a patch. The
11321 summary includes information about files that were
11322 changed or added between the releases. It is sent to
11323 the standard output device. This is useful for finding
11324 out, for example, which files have changed between two
11325 dates or revisions.
11326
11327 @item -t
11328 A diff of the top two revisions is sent to the standard
11329 output device. This is most useful for seeing what the
11330 last change to a file was.
11331
11332 @item -u
11333 Use the unidiff format for the context diffs.
11334 Remember that old versions
11335 of the @code{patch} program can't handle the unidiff
11336 format, so if you plan to post this patch to the net
11337 you should probably not use @samp{-u}.
11338
11339 @item -V @var{vn}
11340 Expand keywords according to the rules current in
11341 @sc{rcs} version @var{vn} (the expansion format changed with
11342 @sc{rcs} version 5). Note that this option is no
11343 longer accepted. @sc{cvs} will always expand keywords the
11344 way that @sc{rcs} version 5 does.
11345 @end table
11346
11347 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11348 @node rdiff examples
11349 @appendixsubsec rdiff examples
11350
11351 Suppose you receive mail from @t{foo@@example.net} asking for an
11352 update from release 1.2 to 1.4 of the tc compiler. You
11353 have no such patches on hand, but with @sc{cvs} that can
11354 easily be fixed with a command such as this:
11355
11356 @example
11357 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
11358 $$ Mail -s 'The patches you asked for' foo@@example.net
11359 @end example
11360
11361 Suppose you have made release 1.3, and forked a branch
11362 called @samp{R_1_3fix} for bug fixes. @samp{R_1_3_1}
11363 corresponds to release 1.3.1, which was made some time
11364 ago. Now, you want to see how much development has been
11365 done on the branch. This command can be used:
11366
11367 @example
11368 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
11369 cvs rdiff: Diffing module-name
11370 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
11371 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
11372 File bar.h,v changed from revision 1.29.2.1 to 1.2
11373 @end example
11374
11375 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11376 @node release, server & pserver, rdiff, CVS commands
11377 @appendixsec release---Indicate that a directory is no longer in use
11378 @cindex release (subcommand)
11379
11380 @itemize @bullet
11381 @item
11382 release [-d] directories@dots{}
11383 @item
11384 Requires: Working directory.
11385 @item
11386 Changes: Working directory, history log.
11387 @end itemize
11388
11389 This command is meant to safely cancel the effect of
11390 @samp{cvs checkout}. Since @sc{cvs} doesn't lock files, it
11391 isn't strictly necessary to use this command. You can
11392 always simply delete your working directory, if you
11393 like; but you risk losing changes you may have
11394 forgotten, and you leave no trace in the @sc{cvs} history
11395 file (@pxref{history file}) that you've abandoned your
11396 checkout.
11397
11398 Use @samp{cvs release} to avoid these problems. This
11399 command checks that no uncommitted changes are
11400 present; that you are executing it from immediately
11401 above a @sc{cvs} working directory; and that the repository
11402 recorded for your files is the same as the repository
11403 defined in the module database.
11404
11405 If all these conditions are true, @samp{cvs release}
11406 leaves a record of its execution (attesting to your
11407 intentionally abandoning your checkout) in the @sc{cvs}
11408 history log.
11409
11410 @menu
11411 * release options:: release options
11412 * release output:: release output
11413 * release examples:: release examples
11414 @end menu
11415
11416 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11417 @node release options
11418 @appendixsubsec release options
11419
11420 The @code{release} command supports one command option:
11421
11422 @table @code
11423 @item -d
11424 Delete your working copy of the file if the release
11425 succeeds. If this flag is not given your files will
11426 remain in your working directory.
11427
11428 @emph{WARNING: The @code{release} command deletes
11429 all directories and files recursively. This
11430 has the very serious side-effect that any directory
11431 that you have created inside your checked-out sources,
11432 and not added to the repository (using the @code{add}
11433 command; @pxref{Adding files}) will be silently deleted---even
11434 if it is non-empty!}
11435 @end table
11436
11437 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11438 @node release output
11439 @appendixsubsec release output
11440
11441 Before @code{release} releases your sources it will
11442 print a one-line message for any file that is not
11443 up-to-date.
11444
11445 @table @code
11446 @item U @var{file}
11447 @itemx P @var{file}
11448 There exists a newer revision of this file in the
11449 repository, and you have not modified your local copy
11450 of the file (@samp{U} and @samp{P} mean the same thing).
11451
11452 @item A @var{file}
11453 The file has been added to your private copy of the
11454 sources, but has not yet been committed to the
11455 repository. If you delete your copy of the sources
11456 this file will be lost.
11457
11458 @item R @var{file}
11459 The file has been removed from your private copy of the
11460 sources, but has not yet been removed from the
11461 repository, since you have not yet committed the
11462 removal. @xref{commit}.
11463
11464 @item M @var{file}
11465 The file is modified in your working directory. There
11466 might also be a newer revision inside the repository.
11467
11468 @item ? @var{file}
11469 @var{file} is in your working directory, but does not
11470 correspond to anything in the source repository, and is
11471 not in the list of files for @sc{cvs} to ignore (see the
11472 description of the @samp{-I} option, and
11473 @pxref{cvsignore}). If you remove your working
11474 sources, this file will be lost.
11475 @end table
11476
11477 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11478 @node release examples
11479 @appendixsubsec release examples
11480
11481 Release the @file{tc} directory, and delete your local working copy
11482 of the files.
11483
11484 @example
11485 $ cd .. # @r{You must stand immediately above the}
11486 # @r{sources when you issue @samp{cvs release}.}
11487 $ cvs release -d tc
11488 You have [0] altered files in this repository.
11489 Are you sure you want to release (and delete) directory `tc': y
11490 $
11491 @end example
11492
11493 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11494 @node server & pserver
11495 @appendixsec server & pserver---Act as a server for a client on stdin/stdout
11496 @cindex pserver (subcommand)
11497 @cindex server (subcommand)
11498
11499 @itemize @bullet
11500 @item
11501 pserver [-c path]
11502
11503 server [-c path]
11504 @item
11505 Requires: repository, client conversation on stdin/stdout
11506 @item
11507 Changes: Repository or, indirectly, client working directory.
11508 @end itemize
11509
11510 The @sc{cvs} @code{server} and @code{pserver} commands are used to provide
11511 repository access to remote clients and expect a client conversation on
11512 stdin & stdout. Typically these commands are launched from @code{inetd} or
11513 via @code{ssh} (@pxref{Remote repositories}).
11514
11515 @code{server} expects that the client has already been authenticated somehow,
11516 typically via @sc{ssh}, and @code{pserver} attempts to authenticate the client
11517 itself.
11518
11519 Only one option is available with the @code{server} and @code{pserver}
11520 commands:
11521
11522 @cindex configuration file
11523 @table @code
11524 @item -c path
11525 Load configuration from the given @var{path} rather than from the
11526 default location @file{$CVSROOT/CVSROOT/config} (@pxref{config}).
11527 @var{path} must be @file{/etc/cvs.conf} or prefixed by @file{/etc/cvs/}.
11528 This option is supported beginning with @sc{cvs} release 1.12.13.
11529 @end table
11530
11531 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11532 @node suck, update, server & pserver, CVS commands
11533 @appendixsec suck---Download RCS ,v file raw
11534 @cindex suck (subcommand)
11535
11536 @itemize @bullet
11537 @item
11538 suck module/pa/th
11539 @item
11540 Requires: repository
11541 @end itemize
11542
11543 Locates the file module/pa/th,v or module/pa/Attic/th,v and downloads
11544 it raw as RCS comma-v file.
11545
11546 Output consists of the real pathname of the comma-v file, relative to
11547 the CVS repository, followed by a newline and the binary file content
11548 immediately thereafter.
11549
11550 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11551 @node update, , suck, CVS commands
11552 @appendixsec update---Bring work tree in sync with repository
11553 @cindex update (subcommand)
11554
11555 @itemize @bullet
11556 @item
11557 update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag[:date] | -D date] [-W spec] files@dots{}
11558 @item
11559 Requires: repository, working directory.
11560 @item
11561 Changes: working directory.
11562 @end itemize
11563
11564 After you've run checkout to create your private copy
11565 of source from the common repository, other developers
11566 will continue changing the central source. From time
11567 to time, when it is convenient in your development
11568 process, you can use the @code{update} command from
11569 within your working directory to reconcile your work
11570 with any revisions applied to the source repository
11571 since your last checkout or update. Without the @code{-C}
11572 option, @code{update} will also merge any differences
11573 between the local copy of files and their base revisions
11574 into any destination revisions specified with @code{-r},
11575 @code{-D}, or @code{-A}.
11576
11577 @menu
11578 * update options:: update options
11579 * update output:: update output
11580 @end menu
11581
11582 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11583 @node update options
11584 @appendixsubsec update options
11585
11586 These standard options are available with @code{update}
11587 (@pxref{Common options}, for a complete description of
11588 them):
11589
11590 @table @code
11591 @item -D date
11592 Use the most recent revision no later than @var{date}.
11593 This option is sticky, and implies @samp{-P}.
11594 See @ref{Sticky tags}, for more information on sticky tags/dates.
11595
11596 @item -f
11597 Only useful with the @samp{-D} or @samp{-r} flags. If no matching revision
11598 is found, retrieve the most recent revision (instead of ignoring the file).
11599
11600 @item -k @var{kflag}
11601 Process keywords according to @var{kflag}. See
11602 @ref{Keyword substitution}.
11603 This option is sticky; future updates of
11604 this file in this working directory will use the same
11605 @var{kflag}. The @code{status} command can be viewed
11606 to see the sticky options. See @ref{Invoking CVS}, for
11607 more information on the @code{status} command.
11608
11609 @item -l
11610 Local; run only in current working directory. @xref{Recursive behavior}.
11611
11612 @item -P
11613 Prune empty directories. See @ref{Moving directories}.
11614
11615 @item -p
11616 Pipe files to the standard output.
11617
11618 @item -R
11619 Update directories recursively (default). @xref{Recursive
11620 behavior}.
11621
11622 @item -r @var{tag}[:@var{date}]
11623 Retrieve the revisions specified by @var{tag} or, when @var{date} is specified
11624 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
11625 existed on @var{date}. This option is sticky, and implies @samp{-P}.
11626 See @ref{Sticky tags}, for more information on sticky tags/dates. Also
11627 see @ref{Common options}.
11628 @end table
11629
11630 @need 800
11631 These special options are also available with
11632 @code{update}.
11633
11634 @table @code
11635 @item -A
11636 Reset any sticky tags, dates, or @samp{-k} options.
11637 See @ref{Sticky tags}, for more information on sticky tags/dates.
11638
11639 @item -C
11640 Overwrite locally modified files with clean copies from
11641 the repository (the modified file is saved in
11642 @file{.#@var{file}.@var{revision}}, however).
11643
11644 @item -d
11645 Create any directories that exist in the repository if
11646 they're missing from the working directory. Normally,
11647 @code{update} acts only on directories and files that
11648 were already enrolled in your working directory.
11649
11650 This is useful for updating directories that were
11651 created in the repository since the initial checkout;
11652 but it has an unfortunate side effect. If you
11653 deliberately avoided certain directories in the
11654 repository when you created your working directory
11655 (either through use of a module name or by listing
11656 explicitly the files and directories you wanted on the
11657 command line), then updating with @samp{-d} will create
11658 those directories, which may not be what you want.
11659
11660 @item -I @var{name}
11661 Ignore files whose names match @var{name} (in your
11662 working directory) during the update. You can specify
11663 @samp{-I} more than once on the command line to specify
11664 several files to ignore. Use @samp{-I !} to avoid
11665 ignoring any files at all. @xref{cvsignore}, for other
11666 ways to make @sc{cvs} ignore some files.
11667
11668 @item -W@var{spec}
11669 Specify file names that should be filtered during
11670 update. You can use this option repeatedly.
11671
11672 @var{spec} can be a file name pattern of the same type
11673 that you can specify in the @file{.cvswrappers}
11674 file. @xref{Wrappers}.
11675
11676 @item -j@var{revision}
11677 With two @samp{-j} options, merge changes from the
11678 revision specified with the first @samp{-j} option to
11679 the revision specified with the second @samp{j} option,
11680 into the working directory.
11681
11682 With one @samp{-j} option, merge changes from the
11683 ancestor revision to the revision specified with the
11684 @samp{-j} option, into the working directory. The
11685 ancestor revision is the common ancestor of the
11686 revision which the working directory is based on, and
11687 the revision specified in the @samp{-j} option.
11688
11689 Note that using a single @samp{-j @var{tagname}} option rather than
11690 @samp{-j @var{branchname}} to merge changes from a branch will
11691 often not remove files which were removed on the branch.
11692 @xref{Merging adds and removals}, for more.
11693
11694 In addition, each @samp{-j} option can contain an optional
11695 date specification which, when used with branches, can
11696 limit the chosen revision to one within a specific
11697 date. An optional date is specified by adding a colon
11698 (:) to the tag:
11699 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
11700
11701 @xref{Branching and merging}.
11702
11703 @end table
11704
11705 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11706 @node update output
11707 @appendixsubsec update output
11708
11709 @code{update} and @code{checkout} keep you informed of
11710 their progress by printing a line for each file, preceded
11711 by one character indicating the status of the file:
11712
11713 @table @code
11714 @item U @var{file}
11715 The file was brought up to date with respect to the
11716 repository. This is done for any file that exists in
11717 the repository but not in your working directory, and for files
11718 that you haven't changed but are not the most recent
11719 versions available in the repository.
11720
11721 @item P @var{file}
11722 Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
11723 file. This accomplishes the same thing as @samp{U} using less bandwidth.
11724
11725 @item A @var{file}
11726 The file has been added to your private copy of the
11727 sources, and will be added to the source repository
11728 when you run @code{commit} on the file. This is a
11729 reminder to you that the file needs to be committed.
11730
11731 @item R @var{file}
11732 The file has been removed from your private copy of the
11733 sources, and will be removed from the source repository
11734 when you run @code{commit} on the file. This is a
11735 reminder to you that the file needs to be committed.
11736
11737 @item M @var{file}
11738 The file is modified in your working directory.
11739
11740 @samp{M} can indicate one of two states for a file
11741 you're working on: either there were no modifications
11742 to the same file in the repository, so that your file
11743 remains as you last saw it; or there were modifications
11744 in the repository as well as in your copy, but they
11745 were merged successfully, without conflict, in your
11746 working directory.
11747
11748 @sc{cvs} will print some messages if it merges your work,
11749 and a backup copy of your working file (as it looked
11750 before you ran @code{update}) will be made. The exact
11751 name of that file is printed while @code{update} runs.
11752
11753 @item C @var{file}
11754 @cindex .# files
11755 @cindex __ files (VMS)
11756 A conflict was detected while trying to merge your
11757 changes to @var{file} with changes from the source
11758 repository. @var{file} (the copy in your working
11759 directory) is now the result of attempting to merge
11760 the two revisions; an unmodified copy of your file
11761 is also in your working directory, with the name
11762 @file{.#@var{file}.@var{revision}} where @var{revision}
11763 is the revision that your modified file started
11764 from. Resolve the conflict as described in
11765 @ref{Conflicts example}.
11766 @c "some systems" as in out-of-the-box OSes? Not as
11767 @c far as I know. We need to advise sysadmins as well
11768 @c as users how to set up this kind of purge, if that is
11769 @c what they want.
11770 @c We also might want to think about cleaner solutions,
11771 @c like having CVS remove the .# file once the conflict
11772 @c has been resolved or something like that.
11773 (Note that some systems automatically purge
11774 files that begin with @file{.#} if they have not been
11775 accessed for a few days. If you intend to keep a copy
11776 of your original file, it is a very good idea to rename
11777 it.) Under @sc{vms}, the file name starts with
11778 @file{__} rather than @file{.#}.
11779
11780 @item ? @var{file}
11781 @var{file} is in your working directory, but does not
11782 correspond to anything in the source repository, and is
11783 not in the list of files for @sc{cvs} to ignore (see the
11784 description of the @samp{-I} option, and
11785 @pxref{cvsignore}).
11786 @end table
11787
11788 @c ----- END MAN 1 -----
11789 @c ---------------------------------------------------------------------
11790 @node Invoking CVS
11791 @appendix Quick reference to CVS commands
11792 @cindex Command reference
11793 @cindex Reference, commands
11794 @cindex Invoking CVS
11795
11796 This appendix describes how to invoke @sc{cvs}, with
11797 references to where each command or feature is
11798 described in detail. For other references run the
11799 @code{cvs --help} command, or see @ref{Index}.
11800 For an alphabetical list of all @sc{cvs} commands,
11801 @pxref{CVS command list}).
11802
11803 A @sc{cvs} command looks like:
11804
11805 @example
11806 cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
11807 @end example
11808
11809 Global options:
11810
11811 @table @code
11812 @item --allow-root=@var{rootdir}
11813 Specify acceptable @sc{cvsroot} directory (server only).
11814 Appeared in @sc{cvs} 1.10. See @ref{Password
11815 authentication server}.
11816
11817 @item --allow-root-regexp=@var{rootdir}
11818 Specify a POSIX extended regular expression which matches acceptable
11819 @sc{cvsroot} directories (server only). Appeared in @sc{cvs}
11820 1.12.14. See @ref{Password authentication server}.
11821
11822 @item -a
11823 Authenticate all communication (client only) (not in @sc{cvs}
11824 1.9 and older). See @ref{Global options}.
11825
11826 @item -b
11827 Specify RCS location (@sc{cvs} 1.9 and older). See
11828 @ref{Global options}.
11829
11830 @item -d @var{root}
11831 Specify the @sc{cvsroot}. See @ref{Repository}.
11832
11833 @item -e @var{editor}
11834 Edit messages with @var{editor}. See @ref{Committing
11835 your changes}.
11836
11837 @item -f
11838 Do not read the @file{~/.cvsrc} file. See @ref{Global
11839 options}.
11840
11841 @item -g
11842 Set the umask to allow group writable permissions in
11843 the working copy. See @ref{Global options}.
11844
11845 @item -H
11846 @itemx --help
11847 Print a help message. See @ref{Global options}.
11848
11849 @item -n
11850 Do not change any files. See @ref{Global options}.
11851
11852 @item -Q
11853 Be really quiet. See @ref{Global options}.
11854
11855 @item -q
11856 Be somewhat quiet. See @ref{Global options}.
11857
11858 @item -r
11859 Make new working files read-only. See @ref{Global options}.
11860
11861 @item -s @var{variable}=@var{value}
11862 Set a user variable. See @ref{Variables}.
11863
11864 @item -T @var{tempdir}
11865 Put temporary files in @var{tempdir}. See @ref{Global
11866 options}.
11867
11868 @item -t
11869 Trace @sc{cvs} execution. See @ref{Global options}.
11870
11871 @item -v
11872 @item --version
11873 Display version and copyright information for @sc{cvs}.
11874
11875 @item -w
11876 Make new working files read-write. See @ref{Global
11877 options}.
11878
11879 @item -x
11880 Encrypt all communication (client only).
11881 See @ref{Global options}.
11882
11883 @item -z @var{gzip-level}
11884 @cindex Compression
11885 @cindex Gzip
11886 Set the compression level (client only).
11887 See @ref{Global options}.
11888 @end table
11889
11890 Keyword expansion modes (@pxref{Substitution modes}):
11891
11892 @example
11893 -kkv $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
11894 -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11895 -kk $@splitrcskeyword{Id}$
11896 -kv file1,v 1.1 1993/12/09 03:21:13 joe Exp
11897 -ko @i{no expansion}
11898 -kb @i{no expansion, file is binary}
11899 @end example
11900
11901 Keywords (@pxref{Keyword list}):
11902
11903 @example
11904 $@splitrcskeyword{Author}: joe $
11905 $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
11906 $@splitrcskeyword{Mdocdate}: December 9 1993 $
11907 $@splitrcskeyword{CVSHeader}: files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11908 $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11909 $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
11910 $@splitrcskeyword{Locker}: harry $
11911 $@splitrcskeyword{Name}: snapshot_1_14 $
11912 $@splitrcskeyword{RCSfile}: file1,v $
11913 $@splitrcskeyword{Revision}: 1.1 $
11914 $@splitrcskeyword{Source}: /home/files/file1,v $
11915 $@splitrcskeyword{State}: Exp $
11916 $@splitrcskeyword{Log}: file1,v $
11917 Revision 1.1 1993/12/09 03:30:17 joe
11918 Initial revision
11919
11920 @end example
11921
11922 @c The idea behind this table is that we want each item
11923 @c to be a sentence or two at most. Preferably a
11924 @c single line.
11925 @c
11926 @c In some cases refs to "foo options" are just to get
11927 @c this thing written quickly, not because the "foo
11928 @c options" node is really the best place to point.
11929 Commands, command options, and command arguments:
11930
11931 @table @code
11932 @c ------------------------------------------------------------
11933 @anchor{add}
11934 @item add [@var{options}] [@var{files}@dots{}]
11935 Add a new file/directory. See @ref{Adding files}.
11936
11937 @table @code
11938 @item -k @var{kflag}
11939 Set keyword expansion.
11940
11941 @item -m @var{msg}
11942 Set file description.
11943 @end table
11944
11945 @c ------------------------------------------------------------
11946 @item admin [@var{options}] [@var{files}@dots{}]
11947 Administration of history files in the repository. See
11948 @ref{admin}.
11949 @c This list omits those options which are not
11950 @c documented as being useful with CVS. That might be
11951 @c a mistake...
11952
11953 @table @code
11954 @item -b[@var{rev}]
11955 Set default branch. See @ref{Reverting local changes}.
11956
11957 @item -c@var{string}
11958 Set comment leader.
11959
11960 @item -k@var{subst}
11961 Set keyword substitution. See @ref{Keyword
11962 substitution}.
11963
11964 @item -l[@var{rev}]
11965 Lock revision @var{rev}, or latest revision.
11966
11967 @item -m@var{rev}:@var{msg}
11968 Replace the log message of revision @var{rev} with
11969 @var{msg}.
11970
11971 @item -o@var{range}
11972 Delete revisions from the repository. See
11973 @ref{admin options}.
11974
11975 @item -q
11976 Run quietly; do not print diagnostics.
11977
11978 @item -s@var{state}[:@var{rev}]
11979 Set the state. See @ref{admin options} for more information on possible
11980 states.
11981
11982 @c Does not work for client/server CVS
11983 @item -t
11984 Set file description from standard input.
11985
11986 @item -t@var{file}
11987 Set file description from @var{file}.
11988
11989 @item -t-@var{string}
11990 Set file description to @var{string}.
11991
11992 @item -u[@var{rev}]
11993 Unlock revision @var{rev}, or latest revision.
11994 @end table
11995
11996 @c ------------------------------------------------------------
11997 @item annotate [@var{options}] [@var{files}@dots{}]
11998 Show last revision where each line was modified. See
11999 @ref{annotate}.
12000
12001 @table @code
12002 @item -D @var{date}
12003 Annotate the most recent revision no later than
12004 @var{date}. See @ref{Common options}.
12005
12006 @item -F
12007 Force annotation of binary files. (Without this option,
12008 binary files are skipped with a message.)
12009
12010 @item -f
12011 Use head revision if tag/date not found. See
12012 @ref{Common options}.
12013
12014 @item -l
12015 Local; run only in current working directory. @xref{Recursive behavior}.
12016
12017 @item -R
12018 Operate recursively (default). @xref{Recursive
12019 behavior}.
12020
12021 @item -r @var{tag}[:@var{date}]
12022 Annotate revisions specified by @var{tag} or, when @var{date} is specified
12023 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12024 existed on @var{date}. See @ref{Common options}.
12025 @end table
12026
12027 @c ------------------------------------------------------------
12028 @item checkout [@var{options}] @var{modules}@dots{}
12029 Get a copy of the sources. See @ref{checkout}.
12030
12031 @table @code
12032 @item -A
12033 Reset any sticky tags/date/options. See @ref{Sticky
12034 tags} and @ref{Keyword substitution}.
12035
12036 @item -c
12037 Output the module database. See @ref{checkout options}.
12038
12039 @item -D @var{date}
12040 Check out revisions as of @var{date} (is sticky). See
12041 @ref{Common options}.
12042
12043 @item -d @var{dir}
12044 Check out into @var{dir}. See @ref{checkout options}.
12045
12046 @item -f
12047 Use head revision if tag/date not found. See
12048 @ref{Common options}.
12049
12050 @c Probably want to use rev1/rev2 style like for diff
12051 @c -r. Here and in on-line help.
12052 @item -j @var{tag}[:@var{date}]
12053 Merge in the change specified by @var{tag}, or when @var{date} is specified
12054 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12055 existed on @var{date}. See @ref{checkout options}. Also,
12056 see @ref{Common options}.
12057
12058 @item -k @var{kflag}
12059 Use @var{kflag} keyword expansion. See
12060 @ref{Substitution modes}.
12061
12062 @item -l
12063 Local; run only in current working directory. @xref{Recursive behavior}.
12064
12065 @item -N
12066 Don't ``shorten'' module paths if -d specified. See
12067 @ref{checkout options}.
12068
12069 @item -n
12070 Do not run module program (if any). See @ref{checkout options}.
12071
12072 @item -P
12073 Prune empty directories. See @ref{Moving directories}.
12074
12075 @item -p
12076 Check out files to standard output (avoids
12077 stickiness). See @ref{checkout options}.
12078
12079 @item -R
12080 Operate recursively (default). @xref{Recursive
12081 behavior}.
12082
12083 @item -r @var{tag}[:@var{date}]
12084 Checkout the revision already tagged with @var{tag} or, when @var{date} is
12085 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12086 as it existed on @var{date}. See @ref{Common options}.
12087
12088 @item -s
12089 Like -c, but include module status. See @ref{checkout options}.
12090 @end table
12091
12092 @c ------------------------------------------------------------
12093 @item commit [@var{options}] [@var{files}@dots{}]
12094 Check changes into the repository. See @ref{commit}.
12095
12096 @table @code
12097 @item -c
12098 Check for valid edits before committing. Requires a @sc{cvs} client and server
12099 both version 1.12.10 or greater.
12100
12101 @item -F @var{file}
12102 Read log message from @var{file}. See @ref{commit options}.
12103
12104 @item -f
12105 @c What is this "disables recursion"? It is from the
12106 @c on-line help; is it documented in this manual?
12107 Force the file to be committed; disables recursion.
12108 See @ref{commit options}.
12109
12110 @item -l
12111 Local; run only in current working directory. See @ref{Recursive behavior}.
12112
12113 @item -m @var{msg}
12114 Use @var{msg} as log message. See @ref{commit options}.
12115
12116 @item -n
12117 Do not run module program (if any). See @ref{commit options}.
12118
12119 @item -R
12120 Operate recursively (default). @xref{Recursive
12121 behavior}.
12122
12123 @item -r @var{rev}
12124 Commit to @var{rev}. See @ref{commit options}.
12125 @c FIXME: should be dragging over text from
12126 @c commit options, especially if it can be cleaned up
12127 @c and made concise enough.
12128 @end table
12129
12130 @c ------------------------------------------------------------
12131 @item diff [@var{options}] [@var{files}@dots{}]
12132 Show differences between revisions. See @ref{diff}.
12133 In addition to the options shown below, accepts a wide
12134 variety of options to control output style, for example
12135 @samp{-c} for context diffs.
12136
12137 @table @code
12138 @item -D @var{date1}
12139 Diff revision for date against working file. See
12140 @ref{diff options}.
12141
12142 @item -D @var{date2}
12143 Diff @var{rev1}/@var{date1} against @var{date2}. See
12144 @ref{diff options}.
12145
12146 @item -l
12147 Local; run only in current working directory. See @ref{Recursive behavior}.
12148
12149 @item -N
12150 Include diffs for added and removed files. See
12151 @ref{diff options}.
12152
12153 @item -R
12154 Operate recursively (default). @xref{Recursive
12155 behavior}.
12156
12157 @item -r @var{tag1}[:@var{date1}]
12158 Diff the revisions specified by @var{tag1} or, when @var{date1} is specified
12159 and @var{tag1} is a branch tag, the version from the branch @var{tag1} as it
12160 existed on @var{date1}, against the working file. See @ref{diff options}
12161 and @ref{Common options}.
12162
12163 @item -r @var{tag2}[:@var{date2}]
12164 Diff the revisions specified by @var{tag2} or, when @var{date2} is specified
12165 and @var{tag2} is a branch tag, the version from the branch @var{tag2} as it
12166 existed on @var{date2}, against @var{rev1}/@var{date1}. See @ref{diff options}
12167 and @ref{Common options}.
12168 @end table
12169
12170 @c ------------------------------------------------------------
12171 @anchor{edit}
12172 @item edit [@var{options}] [@var{files}@dots{}]
12173 Get ready to edit a watched file. See @ref{Editing files}.
12174
12175 @table @code
12176 @item -a @var{actions}
12177 Specify actions for temporary watch, where
12178 @var{actions} is @code{edit}, @code{unedit},
12179 @code{commit}, @code{all}, or @code{none}. See
12180 @ref{Editing files}.
12181
12182 @item -c
12183 Check edits: Edit fails if someone else is already editing the file.
12184 Requires a @sc{cvs} client and server both of version 1.12.10 or greater.
12185
12186 @item -f
12187 Force edit; ignore other edits. Added in CVS 1.12.10.
12188
12189 @item -l
12190 Local; run only in current working directory. See @ref{Recursive behavior}.
12191
12192 @item -R
12193 Operate recursively (default). @xref{Recursive
12194 behavior}.
12195 @end table
12196
12197 @c ------------------------------------------------------------
12198 @anchor{editors}
12199 @item editors [@var{options}] [@var{files}@dots{}]
12200 See who is editing a watched file. See @ref{Watch information}.
12201
12202 @table @code
12203 @item -l
12204 Local; run only in current working directory. See @ref{Recursive behavior}.
12205
12206 @item -R
12207 Operate recursively (default). @xref{Recursive
12208 behavior}.
12209 @end table
12210
12211 @c ------------------------------------------------------------
12212 @item export [@var{options}] @var{modules}@dots{}
12213 Export files from @sc{cvs}. See @ref{export}.
12214
12215 @table @code
12216 @item -D @var{date}
12217 Check out revisions as of @var{date}. See
12218 @ref{Common options}.
12219
12220 @item -d @var{dir}
12221 Check out into @var{dir}. See @ref{export options}.
12222
12223 @item -f
12224 Use head revision if tag/date not found. See
12225 @ref{Common options}.
12226
12227 @item -k @var{kflag}
12228 Use @var{kflag} keyword expansion. See
12229 @ref{Substitution modes}.
12230
12231 @item -l
12232 Local; run only in current working directory. @xref{Recursive behavior}.
12233
12234 @item -N
12235 Don't ``shorten'' module paths if -d specified. See
12236 @ref{export options}.
12237
12238 @item -n
12239 Do not run module program (if any). See @ref{export options}.
12240
12241 @item -R
12242 Operate recursively (default). @xref{Recursive
12243 behavior}.
12244
12245 @item -r @var{tag}[:@var{date}]
12246 Export the revisions specified by @var{tag} or, when @var{date} is specified
12247 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12248 existed on @var{date}. See @ref{Common options}.
12249 @end table
12250
12251 @c ------------------------------------------------------------
12252 @item history [@var{options}] [@var{files}@dots{}]
12253 Show repository access history. See @ref{history}.
12254
12255 @table @code
12256 @item -a
12257 All users (default is self). See @ref{history options}.
12258
12259 @item -b @var{str}
12260 Back to record with @var{str} in module/file/repos
12261 field. See @ref{history options}.
12262
12263 @item -c
12264 Report on committed (modified) files. See @ref{history options}.
12265
12266 @item -D @var{date}
12267 Since @var{date}. See @ref{history options}.
12268
12269 @item -e
12270 Report on all record types. See @ref{history options}.
12271
12272 @item -l
12273 Last modified (committed or modified report). See @ref{history options}.
12274
12275 @item -m @var{module}
12276 Report on @var{module} (repeatable). See @ref{history options}.
12277
12278 @item -n @var{module}
12279 In @var{module}. See @ref{history options}.
12280
12281 @item -o
12282 Report on checked out modules. See @ref{history options}.
12283
12284 @item -p @var{repository}
12285 In @var{repository}. See @ref{history options}.
12286
12287 @item -r @var{rev}
12288 Since revision @var{rev}. See @ref{history options}.
12289
12290 @item -T
12291 @c What the @#$@# is a TAG? Same as a tag? This
12292 @c wording is also in the online-line help.
12293 Produce report on all TAGs. See @ref{history options}.
12294
12295 @item -t @var{tag}
12296 Since tag record placed in history file (by anyone).
12297 See @ref{history options}.
12298
12299 @item -u @var{user}
12300 For user @var{user} (repeatable). See @ref{history options}.
12301
12302 @item -w
12303 Working directory must match. See @ref{history options}.
12304
12305 @item -x @var{types}
12306 Report on @var{types}, one or more of
12307 @code{TOEFWUPCGMAR}. See @ref{history options}.
12308
12309 @item -z @var{zone}
12310 Output for time zone @var{zone}. See @ref{history options}.
12311 @end table
12312
12313 @c ------------------------------------------------------------
12314 @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
12315 Import files into @sc{cvs}, using vendor branches. See
12316 @ref{import}.
12317
12318 @table @code
12319 @item -b @var{bra}
12320 Import to vendor branch @var{bra}. See
12321 @ref{Multiple vendor branches}.
12322
12323 @item -d
12324 Use the file's modification time as the time of
12325 import. See @ref{import options}.
12326
12327 @item -k @var{kflag}
12328 Set default keyword substitution mode. See
12329 @ref{import options}.
12330
12331 @item -m @var{msg}
12332 Use @var{msg} for log message. See
12333 @ref{import options}.
12334
12335 @item -I @var{ign}
12336 More files to ignore (! to reset). See
12337 @ref{import options}.
12338
12339 @item -W @var{spec}
12340 More wrappers. See @ref{import options}.
12341 @end table
12342
12343 @c ------------------------------------------------------------
12344 @anchor{init}
12345 @item init
12346 Create a @sc{cvs} repository if it doesn't exist. See
12347 @ref{Creating a repository}.
12348
12349 @c ------------------------------------------------------------
12350 @anchor{kserver}
12351 @item kserver
12352 Kerberos authenticated server.
12353 @xref{server & pserver}.
12354 @xref{Kerberos authenticated}.
12355
12356 @c ------------------------------------------------------------
12357 @item log [@var{options}] [@var{files}@dots{}]
12358 Print out history information for files. See @ref{log}.
12359
12360 @table @code
12361 @item -b
12362 Only list revisions on the default branch. See @ref{log options}.
12363
12364 @item -d @var{dates}
12365 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12366 latest before). See @ref{log options}.
12367
12368 @item -h
12369 Only print header. See @ref{log options}.
12370
12371 @item -l
12372 Local; run only in current working directory. See @ref{Recursive behavior}.
12373
12374 @item -N
12375 Do not list tags. See @ref{log options}.
12376
12377 @item -R
12378 Only print name of RCS file. See @ref{log options}.
12379
12380 @item -r@var{revs}
12381 Only list revisions @var{revs}. See @ref{log options}.
12382
12383 @item -s @var{states}
12384 Only list revisions with specified states. See @ref{log options}.
12385
12386 @item -t
12387 Only print header and descriptive text. See @ref{log
12388 options}.
12389
12390 @item -w@var{logins}
12391 Only list revisions checked in by specified logins. See @ref{log options}.
12392 @end table
12393
12394 @c ------------------------------------------------------------
12395 @anchor{login}
12396 @item login
12397 Prompt for password for authenticating server. See
12398 @ref{Password authentication client}.
12399
12400 @c ------------------------------------------------------------
12401 @anchor{logout}
12402 @item logout
12403 Remove stored password for authenticating server. See
12404 @ref{Password authentication client}.
12405
12406 @c ------------------------------------------------------------
12407 @anchor{ls}
12408 @item ls [@var{options}] [@var{path}@dots{}]
12409 List files available from CVS. See @ref{ls & rls}.
12410
12411 @table @code
12412 @item -d
12413 Show dead revisions (with tag when specified).
12414 See @ref{ls & rls options}.
12415
12416 @item -e
12417 Display in CVS/Entries format.
12418
12419 @item -l
12420 Display all details.
12421
12422 @item -P
12423 Prune empty directories. See @ref{Moving directories}.
12424
12425 @item -R
12426 List recursively. @xref{Recursive behavior}.
12427
12428 @item -D @var{date}
12429 Show files from date. See @ref{Common options}.
12430
12431 @item -r @var{rev}
12432 Show files with revision or tag.
12433 @end table
12434
12435 @c ------------------------------------------------------------
12436 @anchor{pserver}
12437 @item pserver
12438 Password authenticated server.
12439 @xref{server & pserver}.
12440 @xref{Password authentication server}.
12441
12442 @c ------------------------------------------------------------
12443 @anchor{rannotate}
12444 @item rannotate [@var{options}] [@var{modules}@dots{}]
12445 Show last revision where each line was modified. See
12446 @ref{annotate}.
12447
12448 @table @code
12449 @item -D @var{date}
12450 Annotate the most recent revision no later than
12451 @var{date}. See @ref{Common options}.
12452
12453 @item -F
12454 Force annotation of binary files. (Without this option,
12455 binary files are skipped with a message.)
12456
12457 @item -f
12458 Use head revision if tag/date not found. See
12459 @ref{Common options}.
12460
12461 @item -l
12462 Local; run only in current working directory. @xref{Recursive behavior}.
12463
12464 @item -R
12465 Operate recursively (default). @xref{Recursive behavior}.
12466
12467 @item -r @var{tag}[:@var{date}]
12468 Annotate the revision specified by @var{tag} or, when @var{date} is specified
12469 and @var{tag} is a branch tag, the version from the branch @var{tag}
12470 as it existed on @var{date}. See @ref{Common options}.
12471 @end table
12472
12473 @c ------------------------------------------------------------
12474 @item rdiff [@var{options}] @var{modules}@dots{}
12475 Show differences between releases. See @ref{rdiff}.
12476
12477 @table @code
12478 @item -c
12479 Context diff output format (default). See @ref{rdiff options}.
12480
12481 @item -D @var{date}
12482 Select revisions based on @var{date}. See @ref{Common options}.
12483
12484 @item -f
12485 Use head revision if tag/date not found. See
12486 @ref{Common options}.
12487
12488 @item -l
12489 Local; run only in current working directory. See @ref{Recursive behavior}.
12490
12491 @item -R
12492 Operate recursively (default). @xref{Recursive
12493 behavior}.
12494
12495 @item -r @var{tag}[:@var{date}]
12496 Select the revisions specified by @var{tag} or, when @var{date} is specified
12497 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12498 existed on @var{date}. See @ref{diff options} and @ref{Common options}.
12499
12500 @item -s
12501 Short patch - one liner per file. See @ref{rdiff options}.
12502
12503 @item -t
12504 Top two diffs - last change made to the file. See
12505 @ref{diff options}.
12506
12507 @item -u
12508 Unidiff output format. See @ref{rdiff options}.
12509
12510 @item -V @var{vers}
12511 Use RCS Version @var{vers} for keyword expansion (obsolete). See
12512 @ref{rdiff options}.
12513 @end table
12514
12515 @c ------------------------------------------------------------
12516 @item release [@var{options}] @var{directories}@dots{}
12517 Indicate that a directory is no longer in use. See
12518 @ref{release}.
12519
12520 @table @code
12521 @item -d
12522 Delete the given directory. See @ref{release options}.
12523 @end table
12524
12525 @c ------------------------------------------------------------
12526 @anchor{remove}
12527 @item remove [@var{options}] [@var{files}@dots{}]
12528 Remove an entry from the repository. See @ref{Removing files}.
12529
12530 @table @code
12531 @item -f
12532 Delete the file before removing it. See @ref{Removing files}.
12533
12534 @item -l
12535 Local; run only in current working directory. See @ref{Recursive behavior}.
12536
12537 @item -R
12538 Operate recursively (default). @xref{Recursive
12539 behavior}.
12540 @end table
12541
12542 @c ------------------------------------------------------------
12543 @anchor{rlog}
12544 @item rlog [@var{options}] [@var{files}@dots{}]
12545 Print out history information for modules. See @ref{log}.
12546
12547 @table @code
12548 @item -b
12549 Only list revisions on the default branch. See @ref{log options}.
12550
12551 @item -d @var{dates}
12552 Specify dates (@var{d1}<@var{d2} for range, @var{d} for
12553 latest before). See @ref{log options}.
12554
12555 @item -h
12556 Only print header. See @ref{log options}.
12557
12558 @item -l
12559 Local; run only in current working directory. See @ref{Recursive behavior}.
12560
12561 @item -N
12562 Do not list tags. See @ref{log options}.
12563
12564 @item -R
12565 Only print name of RCS file. See @ref{log options}.
12566
12567 @item -r@var{revs}
12568 Only list revisions @var{revs}. See @ref{log options}.
12569
12570 @item -s @var{states}
12571 Only list revisions with specified states. See @ref{log options}.
12572
12573 @item -t
12574 Only print header and descriptive text. See @ref{log options}.
12575
12576 @item -w@var{logins}
12577 Only list revisions checked in by specified logins. See @ref{log options}.
12578 @end table
12579
12580 @c ------------------------------------------------------------
12581 @anchor{rls}
12582 @item rls [@var{options}] [@var{path}@dots{}]
12583 List files in a module. See @ref{ls & rls}.
12584
12585 @table @code
12586 @item -d
12587 Show dead revisions (with tag when specified).
12588 See @ref{ls & rls options}.
12589
12590 @item -e
12591 Display in CVS/Entries format.
12592
12593 @item -l
12594 Display all details.
12595
12596 @item -P
12597 Prune empty directories. See @ref{Moving directories}.
12598
12599 @item -R
12600 List recursively. @xref{Recursive behavior}.
12601
12602 @item -D @var{date}
12603 Show files from date. See @ref{Common options}.
12604
12605 @item -r @var{rev}
12606 Show files with revision or tag.
12607 @end table
12608
12609 @c ------------------------------------------------------------
12610 @anchor{rtag}
12611 @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
12612 Add a symbolic tag to a module.
12613 @xref{Tagging by date/tag}.
12614 @xref{Creating a branch}.
12615
12616 @table @code
12617 @item -a
12618 Clear tag from removed files that would not otherwise
12619 be tagged. See @ref{Tagging add/remove}.
12620
12621 @item -b
12622 Create a branch named @var{tag}. See @ref{Branching and merging}.
12623
12624 @item -B
12625 Used in conjunction with -F or -d, enables movement and deletion of
12626 branch tags. Use with extreme caution.
12627
12628 @item -D @var{date}
12629 Tag revisions as of @var{date}. See @ref{Tagging by date/tag}.
12630
12631 @item -d
12632 Delete @var{tag}. See @ref{Modifying tags}.
12633
12634 @item -F
12635 Move @var{tag} if it already exists. See @ref{Modifying tags}.
12636
12637 @item -f
12638 Force a head revision match if tag/date not found.
12639 See @ref{Tagging by date/tag}.
12640
12641 @item -l
12642 Local; run only in current working directory. See @ref{Recursive behavior}.
12643
12644 @item -n
12645 No execution of tag program. See @ref{Common options}.
12646
12647 @item -R
12648 Operate recursively (default). @xref{Recursive
12649 behavior}.
12650
12651 @item -r @var{tag}[:@var{date}]
12652 Tag the revision already tagged with @var{tag} or, when @var{date} is specified
12653 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12654 existed on @var{date}. See @ref{Tagging by date/tag} and @ref{Common options}.
12655 @end table
12656
12657 @c ------------------------------------------------------------
12658 @anchor{server}
12659 @item server
12660 SSH/rsh server.
12661 @xref{server & pserver}.
12662 @xref{Connecting via rsh}.
12663
12664 @c ------------------------------------------------------------
12665 @item suck @var{module/filename}
12666 Download RCS ,v file raw. See @ref{suck}.
12667
12668 @c ------------------------------------------------------------
12669 @anchor{status}
12670 @item status [@var{options}] @var{files}@dots{}
12671 Display status information in a working directory. See
12672 @ref{File status}.
12673
12674 @table @code
12675 @item -l
12676 Local; run only in current working directory. See @ref{Recursive behavior}.
12677
12678 @item -R
12679 Operate recursively (default). @xref{Recursive behavior}.
12680
12681 @item -v
12682 Include tag information for file. See @ref{Tags}.
12683 @end table
12684
12685 @c ------------------------------------------------------------
12686 @anchor{tag}
12687 @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
12688 Add a symbolic tag to checked out version of files.
12689 @xref{Tagging the working directory}.
12690 @xref{Creating a branch}.
12691
12692 @table @code
12693 @item -b
12694 Create a branch named @var{tag}. See @ref{Branching and merging}.
12695
12696 @item -c
12697 Check that working files are unmodified. See
12698 @ref{Tagging the working directory}.
12699
12700 @item -D @var{date}
12701 Tag revisions as of @var{date}. See @ref{Tagging by date/tag}.
12702
12703 @item -d
12704 Delete @var{tag}. See @ref{Modifying tags}.
12705
12706 @item -F
12707 Move @var{tag} if it already exists. See @ref{Modifying tags}.
12708
12709 @item -f
12710 Force a head revision match if tag/date not found.
12711 See @ref{Tagging by date/tag}.
12712
12713 @item -l
12714 Local; run only in current working directory. See @ref{Recursive behavior}.
12715
12716 @item -R
12717 Operate recursively (default). @xref{Recursive behavior}.
12718
12719 @item -r @var{tag}[:@var{date}]
12720 Tag the revision already tagged with @var{tag}, or when @var{date} is specified
12721 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12722 existed on @var{date}. See @ref{Tagging by date/tag} and @ref{Common options}.
12723 @end table
12724
12725 @c ------------------------------------------------------------
12726 @anchor{unedit}
12727 @item unedit [@var{options}] [@var{files}@dots{}]
12728 Undo an edit command. See @ref{Editing files}.
12729
12730 @table @code
12731 @item -l
12732 Local; run only in current working directory. See @ref{Recursive behavior}.
12733
12734 @item -R
12735 Operate recursively (default). @xref{Recursive behavior}.
12736 @end table
12737
12738 @c ------------------------------------------------------------
12739 @item update [@var{options}] [@var{files}@dots{}]
12740 Bring work tree in sync with repository. See
12741 @ref{update}.
12742
12743 @table @code
12744 @item -A
12745 Reset any sticky tags/date/options. See @ref{Sticky
12746 tags} and @ref{Keyword substitution}.
12747
12748 @item -C
12749 Overwrite locally modified files with clean copies from
12750 the repository (the modified file is saved in
12751 @file{.#@var{file}.@var{revision}}, however).
12752
12753 @item -D @var{date}
12754 Check out revisions as of @var{date} (is sticky). See
12755 @ref{Common options}.
12756
12757 @item -d
12758 Create directories. See @ref{update options}.
12759
12760 @item -f
12761 Use head revision if tag/date not found. See
12762 @ref{Common options}.
12763
12764 @item -I @var{ign}
12765 More files to ignore (! to reset). See
12766 @ref{import options}.
12767
12768 @c Probably want to use rev1/rev2 style like for diff
12769 @c -r. Here and in on-line help.
12770 @item -j @var{tag}[:@var{date}]
12771 Merge in changes from revisions specified by @var{tag} or, when @var{date} is
12772 specified and @var{tag} is a branch tag, the version from the branch @var{tag}
12773 as it existed on @var{date}. See @ref{update options}.
12774
12775 @item -k @var{kflag}
12776 Use @var{kflag} keyword expansion. See
12777 @ref{Substitution modes}.
12778
12779 @item -l
12780 Local; run only in current working directory. @xref{Recursive behavior}.
12781
12782 @item -P
12783 Prune empty directories. See @ref{Moving directories}.
12784
12785 @item -p
12786 Check out files to standard output (avoids
12787 stickiness). See @ref{update options}.
12788
12789 @item -R
12790 Operate recursively (default). @xref{Recursive
12791 behavior}.
12792
12793 @item -r @var{tag}[:@var{date}]
12794 Checkout the revisions specified by @var{tag} or, when @var{date} is specified
12795 and @var{tag} is a branch tag, the version from the branch @var{tag} as it
12796 existed on @var{date}. See @ref{Common options}.
12797
12798 @item -W @var{spec}
12799 More wrappers. See @ref{import options}.
12800 @end table
12801
12802 @c ------------------------------------------------------------
12803 @anchor{version}
12804 @item version
12805 @cindex version (subcommand)
12806
12807 Display the version of @sc{cvs} being used. If the repository
12808 is remote, display both the client and server versions.
12809
12810 @c ------------------------------------------------------------
12811 @anchor{watch}
12812 @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
12813
12814 on/off: turn on/off read-only checkouts of files. See
12815 @ref{Setting a watch}.
12816
12817 add/remove: add or remove notification on actions. See
12818 @ref{Getting Notified}.
12819
12820 @table @code
12821 @item -a @var{actions}
12822 Specify actions for temporary watch, where
12823 @var{actions} is @code{edit}, @code{unedit},
12824 @code{commit}, @code{all}, or @code{none}. See
12825 @ref{Editing files}.
12826
12827 @item -l
12828 Local; run only in current working directory. See @ref{Recursive behavior}.
12829
12830 @item -R
12831 Operate recursively (default). @xref{Recursive
12832 behavior}.
12833 @end table
12834
12835 @c ------------------------------------------------------------
12836 @anchor{watchers}
12837 @item watchers [@var{options}] [@var{files}@dots{}]
12838 See who is watching a file. See @ref{Watch information}.
12839
12840 @table @code
12841 @item -l
12842 Local; run only in current working directory. See @ref{Recursive behavior}.
12843
12844 @item -R
12845 Operate recursively (default). @xref{Recursive
12846 behavior}.
12847 @end table
12848
12849 @end table
12850
12851 @c ---------------------------------------------------------------------
12852 @node Administrative files
12853 @appendix Reference manual for Administrative files
12854 @cindex Administrative files (reference)
12855 @cindex Files, reference manual
12856 @cindex Reference manual (files)
12857 @cindex CVSROOT (file)
12858
12859 Inside the repository, in the directory
12860 @file{$CVSROOT/CVSROOT}, there are a number of
12861 supportive files for @sc{cvs}. You can use @sc{cvs} in a limited
12862 fashion without any of them, but if they are set up
12863 properly they can help make life easier. For a
12864 discussion of how to edit them, see @ref{Intro
12865 administrative files}.
12866
12867 The most important of these files is the @file{modules}
12868 file, which defines the modules inside the repository.
12869
12870 @menu
12871 * modules:: Defining modules
12872 * Wrappers:: Specify binary-ness based on file name
12873 * Trigger Scripts:: Launch scripts in response to server events
12874 * rcsinfo:: Templates for the log messages
12875 * cvsignore:: Ignoring files via cvsignore
12876 * checkoutlist:: Adding your own administrative files
12877 * history file:: History information
12878 * Variables:: Various variables are expanded
12879 * config:: Miscellaneous CVS configuration
12880 @end menu
12881
12882 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12883 @node modules
12884 @appendixsec The modules file
12885 @cindex Modules (admin file)
12886 @cindex Defining modules (reference manual)
12887
12888 The @file{modules} file records your definitions of
12889 names for collections of source code. @sc{cvs} will
12890 use these definitions if you use @sc{cvs} to update the
12891 modules file (use normal commands like @code{add},
12892 @code{commit}, etc).
12893
12894 The @file{modules} file may contain blank lines and
12895 comments (lines beginning with @samp{#}) as well as
12896 module definitions. Long lines can be continued on the
12897 next line by specifying a backslash (@samp{\}) as the
12898 last character on the line.
12899
12900 There are three basic types of modules: alias modules,
12901 regular modules, and ampersand modules. The difference
12902 between them is the way that they map files in the
12903 repository to files in the working directory. In all
12904 of the following examples, the top-level repository
12905 contains a directory called @file{first-dir}, which
12906 contains two files, @file{file1} and @file{file2}, and a
12907 directory @file{sdir}. @file{first-dir/sdir} contains
12908 a file @file{sfile}.
12909
12910 @c FIXME: should test all the examples in this section.
12911
12912 @menu
12913 * Alias modules:: The simplest kind of module
12914 * Regular modules::
12915 * Ampersand modules::
12916 * Excluding directories:: Excluding directories from a module
12917 * Module options:: Regular and ampersand modules can take options
12918 * Module program options:: How the modules ``program options'' programs
12919 are run.
12920 @end menu
12921
12922 @node Alias modules
12923 @appendixsubsec Alias modules
12924 @cindex Alias modules
12925 @cindex -a, in modules file
12926
12927 Alias modules are the simplest kind of module:
12928
12929 @table @code
12930 @item @var{mname} -a @var{aliases}@dots{}
12931 This represents the simplest way of defining a module
12932 @var{mname}. The @samp{-a} flags the definition as a
12933 simple alias: @sc{cvs} will treat any use of @var{mname} (as
12934 a command argument) as if the list of names
12935 @var{aliases} had been specified instead.
12936 @var{aliases} may contain either other module names or
12937 paths. When you use paths in aliases, @code{checkout}
12938 creates all intermediate directories in the working
12939 directory, just as if the path had been specified
12940 explicitly in the @sc{cvs} arguments.
12941 @end table
12942
12943 For example, if the modules file contains:
12944
12945 @example
12946 amodule -a first-dir
12947 @end example
12948
12949 @noindent
12950 then the following two commands are equivalent:
12951
12952 @example
12953 $ cvs co amodule
12954 $ cvs co first-dir
12955 @end example
12956
12957 @noindent
12958 and they each would provide output such as:
12959
12960 @example
12961 cvs checkout: Updating first-dir
12962 U first-dir/file1
12963 U first-dir/file2
12964 cvs checkout: Updating first-dir/sdir
12965 U first-dir/sdir/sfile
12966 @end example
12967
12968 @node Regular modules
12969 @appendixsubsec Regular modules
12970 @cindex Regular modules
12971
12972 @table @code
12973 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
12974 In the simplest case, this form of module definition
12975 reduces to @samp{@var{mname} @var{dir}}. This defines
12976 all the files in directory @var{dir} as module @var{mname}.
12977 @var{dir} is a relative path (from @code{$CVSROOT}) to a
12978 directory of source in the source repository. In this
12979 case, on checkout, a single directory called
12980 @var{mname} is created as a working directory; no
12981 intermediate directory levels are used by default, even
12982 if @var{dir} was a path involving several directory
12983 levels.
12984 @end table
12985
12986 For example, if a module is defined by:
12987
12988 @example
12989 regmodule first-dir
12990 @end example
12991
12992 @noindent
12993 then regmodule will contain the files from first-dir:
12994
12995 @example
12996 $ cvs co regmodule
12997 cvs checkout: Updating regmodule
12998 U regmodule/file1
12999 U regmodule/file2
13000 cvs checkout: Updating regmodule/sdir
13001 U regmodule/sdir/sfile
13002 $
13003 @end example
13004
13005 By explicitly specifying files in the module definition
13006 after @var{dir}, you can select particular files from
13007 directory @var{dir}. Here is
13008 an example:
13009
13010 @example
13011 regfiles first-dir/sdir sfile
13012 @end example
13013
13014 @noindent
13015 With this definition, getting the regfiles module
13016 will create a single working directory
13017 @file{regfiles} containing the file listed, which
13018 comes from a directory deeper
13019 in the @sc{cvs} source repository:
13020
13021 @example
13022 $ cvs co regfiles
13023 U regfiles/sfile
13024 $
13025 @end example
13026
13027 @node Ampersand modules
13028 @appendixsubsec Ampersand modules
13029 @cindex Ampersand modules
13030 @cindex &, in modules file
13031
13032 A module definition can refer to other modules by
13033 including @samp{&@var{module}} in its definition.
13034 @example
13035 @var{mname} [ options ] @var{&module}@dots{}
13036 @end example
13037
13038 Then getting the module creates a subdirectory for each such
13039 module, in the directory containing the module. For
13040 example, if modules contains
13041
13042 @example
13043 ampermod &first-dir
13044 @end example
13045
13046 @noindent
13047 then a checkout will create an @code{ampermod} directory
13048 which contains a directory called @code{first-dir},
13049 which in turns contains all the directories and files
13050 which live there. For example, the command
13051
13052 @example
13053 $ cvs co ampermod
13054 @end example
13055
13056 @noindent
13057 will create the following files:
13058
13059 @example
13060 ampermod/first-dir/file1
13061 ampermod/first-dir/file2
13062 ampermod/first-dir/sdir/sfile
13063 @end example
13064
13065 There is one quirk/bug: the messages that @sc{cvs}
13066 prints omit the @file{ampermod}, and thus do not
13067 correctly display the location to which it is checking
13068 out the files:
13069
13070 @example
13071 $ cvs co ampermod
13072 cvs checkout: Updating first-dir
13073 U first-dir/file1
13074 U first-dir/file2
13075 cvs checkout: Updating first-dir/sdir
13076 U first-dir/sdir/sfile
13077 $
13078 @end example
13079
13080 Do not rely on this buggy behavior; it may get fixed in
13081 a future release of @sc{cvs}.
13082
13083 @c FIXCVS: What happens if regular and & modules are
13084 @c combined, as in "ampermodule first-dir &second-dir"?
13085 @c When I tried it, it seemed to just ignore the
13086 @c "first-dir". I think perhaps it should be an error
13087 @c (but this needs further investigation).
13088 @c In addition to discussing what each one does, we
13089 @c should put in a few words about why you would use one or
13090 @c the other in various situations.
13091
13092 @node Excluding directories
13093 @appendixsubsec Excluding directories
13094 @cindex Excluding directories, in modules file
13095 @cindex !, in modules file
13096
13097 An alias module may exclude particular directories from
13098 other modules by using an exclamation mark (@samp{!})
13099 before the name of each directory to be excluded.
13100
13101 For example, if the modules file contains:
13102
13103 @example
13104 exmodule -a !first-dir/sdir first-dir
13105 @end example
13106
13107 @noindent
13108 then checking out the module @samp{exmodule} will check
13109 out everything in @samp{first-dir} except any files in
13110 the subdirectory @samp{first-dir/sdir}.
13111 @c Note that the "!first-dir/sdir" sometimes must be listed
13112 @c before "first-dir". That seems like a probable bug, in which
13113 @c case perhaps it should be fixed (to allow either
13114 @c order) rather than documented. See modules4 in testsuite.
13115
13116 @node Module options
13117 @appendixsubsec Module options
13118 @cindex Options, in modules file
13119
13120 Either regular modules or ampersand modules can contain
13121 options, which supply additional information concerning
13122 the module.
13123
13124 @table @code
13125 @cindex -d, in modules file
13126 @item -d @var{name}
13127 Name the working directory something other than the
13128 module name.
13129 @c FIXME: Needs a bunch of examples, analogous to the
13130 @c examples for alias, regular, and ampersand modules
13131 @c which show where the files go without -d.
13132
13133 @cindex Export program
13134 @cindex -e, in modules file
13135 @item -e @var{prog}
13136 Specify a program @var{prog} to run whenever files in a
13137 module are exported. @var{prog} runs with a single
13138 argument, the module name.
13139 @c FIXME: Is it run on server? client?
13140
13141 @cindex Checkout program
13142 @cindex -o, in modules file
13143 @item -o @var{prog}
13144 Specify a program @var{prog} to run whenever files in a
13145 module are checked out. @var{prog} runs with a single
13146 argument, the module name. See @ref{Module program options} for
13147 information on how @var{prog} is called.
13148 @c FIXME: Is it run on server? client?
13149
13150 @cindex Status of a module
13151 @cindex Module status
13152 @cindex -s, in modules file
13153 @item -s @var{status}
13154 Assign a status to the module. When the module file is
13155 printed with @samp{cvs checkout -s} the modules are
13156 sorted according to primarily module status, and
13157 secondarily according to the module name. This option
13158 has no other meaning. You can use this option for
13159 several things besides status: for instance, list the
13160 person that is responsible for this module.
13161
13162 @cindex Tag program
13163 @cindex -t, in modules file
13164 @item -t @var{prog}
13165 Specify a program @var{prog} to run whenever files in a
13166 module are tagged with @code{rtag}. @var{prog} runs
13167 with two arguments: the module name and the symbolic
13168 tag specified to @code{rtag}. It is not run
13169 when @code{tag} is executed. Generally you will find
13170 that the @file{taginfo} file is a better solution (@pxref{taginfo}).
13171 @c FIXME: Is it run on server? client?
13172 @c Problems with -t include:
13173 @c * It is run after the tag not before
13174 @c * It doesn't get passed all the information that
13175 @c taginfo does ("mov", &c).
13176 @c * It only is run for rtag, not tag.
13177 @end table
13178
13179 You should also see @pxref{Module program options} about how the
13180 ``program options'' programs are run.
13181
13182 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13183
13184 @node Module program options
13185 @appendixsubsec How the modules file ``program options'' programs are run
13186 @cindex Modules file program options
13187 @cindex -t, in modules file
13188 @cindex -o, in modules file
13189 @cindex -e, in modules file
13190
13191 @noindent
13192 For checkout, rtag, and export, the program is server-based, and as such the
13193 following applies:-
13194
13195 If using remote access methods (pserver, ext, etc.),
13196 @sc{cvs} will execute this program on the server from a temporary
13197 directory. The path is searched for this program.
13198
13199 If using ``local access'' (on a local or remote NFS filesystem, i.e.
13200 repository set just to a path),
13201 the program will be executed from the newly checked-out tree, if
13202 found there, or alternatively searched for in the path if not.
13203
13204 The programs are all run after the operation has effectively
13205 completed.
13206
13207
13208 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13209 @node Wrappers
13210 @appendixsec The cvswrappers file
13211 @cindex cvswrappers (admin file)
13212 @cindex CVSWRAPPERS, environment variable
13213 @cindex Wrappers
13214
13215 @c FIXME: need some better way of separating this out
13216 @c by functionality. -m is
13217 @c one feature, and -k is a another. And this discussion
13218 @c should be better motivated (e.g. start with the
13219 @c problems, then explain how the feature solves it).
13220
13221 Wrappers refers to a @sc{cvs} feature which lets you
13222 control certain settings based on the name of the file
13223 which is being operated on. The settings are @samp{-k}
13224 for binary files, and @samp{-m} for nonmergeable text
13225 files.
13226
13227 The @samp{-m} option
13228 specifies the merge methodology that should be used when
13229 a non-binary file is updated. @code{MERGE} means the usual
13230 @sc{cvs} behavior: try to merge the files. @code{COPY}
13231 means that @code{cvs update} will refuse to merge
13232 files, as it also does for files specified as binary
13233 with @samp{-kb} (but if the file is specified as
13234 binary, there is no need to specify @samp{-m 'COPY'}).
13235 @sc{cvs} will provide the user with the
13236 two versions of the files, and require the user using
13237 mechanisms outside @sc{cvs}, to insert any necessary
13238 changes.
13239
13240 @emph{WARNING: do not use @code{COPY} with
13241 @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
13242 copy one version of your file over the other, wiping
13243 out the previous contents.}
13244 @c Ordinarily we don't document the behavior of old
13245 @c versions. But this one is so dangerous, I think we
13246 @c must. I almost renamed it to -m 'NOMERGE' so we
13247 @c could say "never use -m 'COPY'".
13248 The @samp{-m} wrapper option only affects behavior when
13249 merging is done on update; it does not affect how files
13250 are stored. See @ref{Binary files}, for more on
13251 binary files.
13252
13253 The basic format of the file @file{cvswrappers} is:
13254
13255 @c FIXME: @example is all wrong for this. Use @deffn or
13256 @c something more sensible.
13257 @example
13258 wildcard [option value][option value]...
13259
13260 where option is one of
13261 -m update methodology value: MERGE or COPY
13262 -k keyword expansion value: expansion mode
13263
13264 and value is a single-quote delimited value.
13265 @end example
13266
13267 @ignore
13268 @example
13269 *.nib -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
13270 *.c -t 'indent %s %s'
13271 @end example
13272 @c When does the filter need to be an absolute pathname
13273 @c and when will something like the above work? I
13274 @c suspect it relates to the PATH of the server (which
13275 @c in turn depends on all kinds of stuff, e.g. inetd
13276 @c for pserver). I'm not sure whether/where to discuss
13277 @c this.
13278 @c FIXME: What do the %s's stand for?
13279
13280 @noindent
13281 The above example of a @file{cvswrappers} file
13282 states that all files/directories that end with a @code{.nib}
13283 should be filtered with the @file{wrap} program before
13284 checking the file into the repository. The file should
13285 be filtered though the @file{unwrap} program when the
13286 file is checked out of the repository. The
13287 @file{cvswrappers} file also states that a @code{COPY}
13288 methodology should be used when updating the files in
13289 the repository (that is, no merging should be performed).
13290
13291 @c What pitfalls arise when using indent this way? Is
13292 @c it a winning thing to do? Would be nice to at least
13293 @c hint at those issues; we want our examples to tell
13294 @c how to solve problems, not just to say that cvs can
13295 @c do certain things.
13296 The last example line says that all files that end with
13297 @code{.c} should be filtered with @file{indent}
13298 before being checked into the repository. Unlike the previous
13299 example, no filtering of the @code{.c} file is done when
13300 it is checked out of the repository.
13301 @noindent
13302 The @code{-t} filter is called with two arguments,
13303 the first is the name of the file/directory to filter
13304 and the second is the pathname to where the resulting
13305 filtered file should be placed.
13306
13307 @noindent
13308 The @code{-f} filter is called with one argument,
13309 which is the name of the file to filter from. The end
13310 result of this filter will be a file in the users directory
13311 that they can work on as they normally would.
13312
13313 Note that the @samp{-t}/@samp{-f} features do not
13314 conveniently handle one portion of @sc{cvs}'s operation:
13315 determining when files are modified. @sc{cvs} will still
13316 want a file (or directory) to exist, and it will use
13317 its modification time to determine whether a file is
13318 modified. If @sc{cvs} erroneously thinks a file is
13319 unmodified (for example, a directory is unchanged but
13320 one of the files within it is changed), you can force
13321 it to check in the file anyway by specifying the
13322 @samp{-f} option to @code{cvs commit} (@pxref{commit
13323 options}).
13324 @c This is, of course, a serious design flaw in -t/-f.
13325 @c Probably the whole functionality needs to be
13326 @c redesigned (starting from requirements) to fix this.
13327 @end ignore
13328
13329 @c FIXME: We don't document -W or point to where it is
13330 @c documented. Or .cvswrappers.
13331 For example, the following command imports a
13332 directory, treating files whose name ends in
13333 @samp{.exe} as binary:
13334
13335 @example
13336 cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
13337 @end example
13338
13339 @c Another good example, would be storing files
13340 @c (e.g. binary files) compressed in the repository.
13341 @c ::::::::::::::::::
13342 @c cvswrappers
13343 @c ::::::::::::::::::
13344 @c *.t12 -m 'COPY'
13345 @c *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
13346 @c
13347 @c ::::::::::::::::::
13348 @c gunzipcp
13349 @c ::::::::::::::::::
13350 @c :
13351 @c [ -f $1 ] || exit 1
13352 @c zcat $1 > /tmp/.#$1.$$
13353 @c mv /tmp/.#$1.$$ $1
13354 @c
13355 @c ::::::::::::::::::
13356 @c gzipcp
13357 @c ::::::::::::::::::
13358 @c :
13359 @c DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
13360 @c if [ ! -d $DIRNAME ] ; then
13361 @c DIRNAME=`echo $1 | sed -e "s|.*/||g"`
13362 @c fi
13363 @c gzip -c $DIRNAME > $2
13364 @c One catch--"cvs diff" will not invoke the wrappers
13365 @c (probably a CVS bug, although I haven't thought it out).
13366
13367 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13368 @node Trigger Scripts
13369 @appendixsec The Trigger Scripts
13370 @cindex info files
13371 @cindex trigger scripts
13372 @cindex script hooks
13373
13374 @c FIXME
13375 @c Somewhere there needs to be a more "how-to" guide to writing these.
13376 @c One particular issue that people sometimes are worried about is performance,
13377 @c and the impact of writing in perl or sh or ____. Performance comparisons
13378 @c should probably remain outside the scope of this document, but at least
13379 @c _that_ much could be referenced, perhaps with links to other sources.
13380
13381 Several of the administrative files support triggers, or the launching external
13382 scripts or programs at specific times before or after particular events, during
13383 the execution of @sc{cvs} commands. These hooks can be used to prevent certain
13384 actions, log them, and/or maintain anything else you deem practical.
13385
13386 All the trigger scripts are launched in a copy of the user sandbox being
13387 committed, on the server, in client-server mode. In local mode, the scripts
13388 are actually launched directly from the user sandbox directory being committed.
13389 For most intents and purposes, the same scripts can be run in both locations
13390 without alteration.
13391
13392 @menu
13393 * syntax:: The common syntax
13394 * Trigger Script Security:: Trigger script security
13395
13396 * commit files:: The commit support files (commitinfo,
13397 verifymsg, loginfo)
13398 * commitinfo:: Pre-commit checking
13399 * verifymsg:: How are log messages evaluated?
13400 * loginfo:: Where should log messages be sent?
13401
13402 * postadmin:: Logging admin commands
13403 * taginfo:: Verifying/Logging tags
13404 * posttag:: Logging tags
13405 * postwatch:: Logging watch commands
13406
13407 * preproxy:: Launch a script on a secondary server prior
13408 to becoming a write proxy
13409 * postproxy:: Launch a script on a secondary server after
13410 completing proxy operations
13411 @end menu
13412
13413 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13414 @node syntax
13415 @appendixsubsec The common syntax
13416 @cindex info files, common syntax
13417 @cindex script hooks, common syntax
13418 @cindex trigger script hooks, common syntax
13419 @cindex syntax of trigger script hooks
13420
13421 @c FIXME: having this so totally separate from the
13422 @c Variables node is rather bogus.
13423
13424 The administrative files such as @file{commitinfo},
13425 @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
13426 all have a common format. The purpose of the files are
13427 described later on. The common syntax is described
13428 here.
13429
13430 @cindex Regular expression syntax
13431 Each line contains the following:
13432
13433 @itemize @bullet
13434 @cindex @samp{ALL} keyword, in lieu of regular expressions in script hooks
13435 @cindex @samp{DEFAULT} keyword, in lieu of regular expressions in script hooks
13436 @item
13437 A regular expression or the literal string @samp{DEFAULT}. Some script hooks
13438 also support the literal string @samp{ALL}. Other than the @samp{ALL} and
13439 @samp{DEFAULT} keywords, this is a basic regular expression in the syntax used
13440 by GNU emacs. See the descriptions of the individual script hooks for
13441 information on whether the @samp{ALL} keyword is supported
13442 (@pxref{Trigger Scripts}).
13443 @c FIXME: What we probably should be saying is "POSIX Basic
13444 @c Regular Expression with the following extensions (`\('
13445 @c `\|' '+' etc)"
13446 @c rather than define it with reference to emacs.
13447 @c The reference to emacs is not strictly speaking
13448 @c true, as we don't support \=, \s, or \S. Also it isn't
13449 @c clear we should document and/or promise to continue to
13450 @c support all the obscure emacs extensions like \<.
13451 @c Also need to better cite (or include) full
13452 @c documentation for the syntax.
13453 @c Also see comment in configure.in about what happens to the
13454 @c syntax if we pick up a system-supplied regexp matcher.
13455
13456 @item
13457 A whitespace separator---one or more spaces and/or tabs.
13458
13459 @item
13460 A file name or command-line template.
13461 @end itemize
13462
13463 @noindent
13464 Blank lines are ignored. Lines that start with the
13465 character @samp{#} are treated as comments. Long lines
13466 unfortunately can @emph{not} be broken in two parts in
13467 any way.
13468
13469 The first regular expression that matches the current
13470 directory name in the repository or the first line containing @samp{DEFAULT}
13471 in lieu of a regular expression is used and all lines containing @samp{ALL} is
13472 used for the hooks which support the @samp{ALL} keyword. The rest of the line
13473 is used as a file name or command-line template as appropriate. See the
13474 descriptions of the individual script hooks for information on whether the
13475 @samp{ALL} keyword is supported (@pxref{Trigger Scripts}).
13476
13477 @cindex format strings
13478 @cindex format strings, common syntax
13479 @cindex info files, common syntax, format strings
13480 @cindex Common syntax of info files, format strings
13481 @noindent
13482 @emph{Note: The following information on format strings is valid
13483 as long as the line @code{UseNewInfoFmtStrings=yes} appears in
13484 your repository's config file (@pxref{config}). Otherwise,
13485 default format strings may be appended to the command line and
13486 the @samp{loginfo} file, especially, can exhibit slightly
13487 different behavior. For more information,
13488 @xref{Updating Commit Files}.}
13489
13490 In the cases where the second segment of the matched line is a
13491 command line template (e.g. @file{commitinfo}, @file{loginfo},
13492 & @file{verifymsg}), the command line template may contain format
13493 strings which will be replaced with specific values before the
13494 script is run.
13495 @c FIXCVS then FIXME - it really would make sense to allow %r & maybe even %p
13496 @c to be used in rcsinfo to construct a path, but I haven't
13497 @c coded this yet.
13498
13499 Format strings can represent a single variable or one or more
13500 attributes of a list variable. An example of a list variable
13501 would be the list available to scripts hung on the loginfo hooks
13502 - the list of files which were just committed. In the case of
13503 loginfo, three attributes are available for each list item: file
13504 name, precommit version, and postcommit version.
13505
13506 Format strings consist of a @samp{%} character followed by an optional
13507 @samp{@{} (required in the multiple list attribute case), a
13508 single format character representing a variable or a single attribute of
13509 list elements or multiple format characters representing attributes of
13510 list elements, and a closing @samp{@}} when the open bracket was present.
13511
13512 @emph{Flat format strings}, or single format characters which get replaced
13513 with a single value, will generate a single argument
13514 to the called script, regardless of whether the replacement variable contains
13515 white space or other special characters.
13516
13517 @emph{List attributes} will generate an argument for each attribute
13518 requested for each list item. For example, @samp{%@{sVv@}}
13519 in a @file{loginfo} command template will generate three
13520 arguments (file name, precommit version, postcommit version,
13521 ...) for each file committed. As in the flat format string
13522 case, each attribute will be passed in as a single argument
13523 regardless of whether it contains white space or other
13524 special characters.
13525
13526 @samp{%%} will be replaced with a literal @samp{%}.
13527
13528 The format strings available to all script hooks are:
13529
13530 @table @t
13531 @item c
13532 The canonical name of the command being executed. For instance, in the case of
13533 a hook run from @code{cvs up}, @sc{cvs} would replace @samp{%c} with the string
13534 @samp{update} and, in the case of a hook run from @code{cvs ci}, @sc{cvs} would
13535 replace @samp{%c} with the string @samp{commit}.
13536 @item n
13537 The null, or empty, string.
13538 @item p
13539 The name of the directory being operated on within the repository.
13540 @item r
13541 The name of the repository (the path portion of @code{$CVSROOT}).
13542 @item R
13543 On a server, the name of the referrer, if any. The referrer is the CVSROOT the
13544 client reports it used to contact a server which then referred it to this
13545 server. Should usually be set on a primary server with a write proxy setup.
13546 @end table
13547
13548 Other format strings are file specific. See the docs on the
13549 particular script hooks for more information
13550 (@pxref{Trigger Scripts}).
13551
13552 As an example, the following line in a @file{loginfo} file would
13553 match only the directory @file{module} and any subdirectories of
13554 @file{module}:
13555
13556 @example
13557 ^module\(/\|$\) (echo; echo %p: %@{sVv@}; cat) >>$CVSROOT/CVSROOT/commitlog
13558 @end example
13559
13560 Using this same line and assuming a commit of new revisions
13561 1.5.4.4 and 1.27.4.1 based on old revisions 1.5.4.3 and 1.27,
13562 respectively, of file1 and file2 in module, something like the
13563 following log message should be appended to commitlog:
13564
13565 @example
13566
13567 module
13568 file1 1.5.4.3 1.5.4.4 file2 1.27 1.27.4.1
13569 Update of /cvsroot/module
13570 In directory localhost.localdomain:/home/jrandom/work/module
13571
13572 Modified Files:
13573 file1 file2
13574 Log Message:
13575 A log message.
13576 @end example
13577
13578 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13579 @node Trigger Script Security
13580 @appendixsubsec Security and the Trigger Scripts
13581 @cindex info files, security
13582 @cindex script hooks, security
13583 @cindex trigger scripts, security
13584
13585 Security is a huge subject, and implementing a secure system is a non-trivial
13586 task. This section will barely touch on all the issues involved, but it is
13587 well to note that, as with any script you will be allowing an untrusted
13588 user to run on your server, there are measures you can take to help prevent
13589 your trigger scripts from being abused.
13590
13591 For instance, since the CVS trigger scripts all run in a copy of the user's
13592 sandbox on the server, a naively coded Perl trigger script which attempts to
13593 use a Perl module that is not installed on the system can be hijacked by any
13594 user with commit access who is checking in a file with the correct name. Other
13595 scripting languages may be vulnerable to similar hacks.
13596
13597 One way to make a script more secure, at least with Perl, is to use scripts
13598 which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
13599 In the most basic terms, this causes Perl to avoid running code that may have
13600 come from an external source. Please run the @code{perldoc perlsec} command
13601 for more on Perl security. Again, other languages may implement other security
13602 verification hooks which look more or less like Perl's "taint-check" mechanism.
13603
13604 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13605 @node commit files
13606 @appendixsubsec The commit support files
13607 @cindex Commits, administrative support files
13608 @cindex commit files, see Info files
13609
13610 The @samp{-i} flag in the @file{modules} file can be
13611 used to run a certain program whenever files are
13612 committed (@pxref{modules}). The files described in
13613 this section provide other, more flexible, ways to run
13614 programs whenever something is committed.
13615
13616 There are three kinds of programs that can be run on
13617 commit. They are specified in files in the repository,
13618 as described below. The following table summarises the
13619 file names and the purpose of the corresponding
13620 programs.
13621
13622 @table @file
13623 @item commitinfo
13624 The program is responsible for checking that the commit
13625 is allowed. If it exits with a non-zero exit status
13626 the commit will be aborted. @xref{commitinfo}.
13627
13628 @item verifymsg
13629 The specified program is used to evaluate the log message,
13630 and possibly verify that it contains all required
13631 fields. This is most useful in combination with the
13632 @file{rcsinfo} file, which can hold a log message
13633 template (@pxref{rcsinfo}). @xref{verifymsg}.
13634
13635 @item loginfo
13636 The specified program is called when the commit is
13637 complete. It receives the log message and some
13638 additional information and can store the log message in
13639 a file, or mail it to appropriate persons, or maybe
13640 post it to a local newsgroup, or@dots{} Your
13641 imagination is the limit! @xref{loginfo}.
13642 @end table
13643
13644 @menu
13645 * Updating Commit Files:: Updating legacy repositories to stop using
13646 deprecated command line template formats
13647 @end menu
13648
13649 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13650 @node Updating Commit Files
13651 @appendixsubsubsec Updating legacy repositories to stop using deprecated command line template formats
13652 @cindex info files, common syntax, updating legacy repositories
13653 @cindex Syntax of info files, updating legacy repositories
13654 @cindex Common syntax of info files, updating legacy repositories
13655 New repositories are created set to use the new format strings by default, so
13656 if you are creating a new repository, you shouldn't have to worry about this
13657 section.
13658
13659 If you are attempting to maintain a legacy repository which was
13660 making use of the @file{commitinfo}, @file{editinfo}, @file{verifymsg},
13661 @file{loginfo}, and/or @file{taginfo} script hooks, you should have no
13662 immediate problems with using the current @sc{cvs} executable, but your users
13663 will probably start to see deprecation warnings.
13664
13665 The reason for this is that all of the script hooks have been updated to
13666 use a new command line parser that extensibly supports multiple
13667 @file{loginfo} & @file{notify} style format strings (@pxref{syntax})
13668 and this support is not completely compatible with the old style format
13669 strings.
13670
13671 The quick upgrade method is to stick a @samp{1} after each format string
13672 in your old @file{loginfo} file. For example:
13673
13674 @example
13675 DEFAULT (echo ""; id; echo %@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13676 @end example
13677
13678 would become:
13679
13680 @example
13681 DEFAULT (echo ""; id; echo %1@{sVv@}; date; cat) >> $CVSROOT/CVSROOT/commitlog
13682 @end example
13683
13684 If you were counting on the fact that only the first @samp{%} in the line was
13685 replaced as a format string, you may also have to double up any further
13686 percent signs on the line.
13687
13688 If you did this all at once and checked it in, everything should still be
13689 running properly.
13690
13691 Now add the following line to your config file (@pxref{config}):
13692 @example
13693 UseNewInfoFmtStrings=yes
13694 @end example
13695
13696 Everything should still be running properly, but your users will probably
13697 start seeing new deprecation warnings.
13698
13699 Dealing with the deprecation warnings now generated by @file{commitinfo},
13700 @file{editinfo}, @file{verifymsg}, and @file{taginfo} should be easy. Simply
13701 specify what are currently implicit arguments explicitly. This means appending
13702 the following strings to each active command line template in each file:
13703 @table @code
13704 @item commitinfo
13705 @samp{ %r/%p %s}
13706 @item editinfo
13707 @samp{ %l}
13708 @item taginfo
13709 @samp{ %t %o %p %@{sv@}}
13710 @item verifymsg
13711 @samp{ %l}
13712 @end table
13713
13714 If you don't desire that any of the newly available information be passed to
13715 the scripts hanging off of these hooks, no further modifications to these
13716 files should be necessary to insure current and future compatibility with
13717 @sc{cvs}'s format strings.
13718
13719 Fixing @file{loginfo} could be a little tougher. The old style
13720 @file{loginfo} format strings caused a single space and comma separated
13721 argument to be passed in in place of the format string. This is what will
13722 continue to be generated due to the deprecated @samp{1} you inserted into
13723 the format strings.
13724
13725 Since the new format separates each individual item and passes it into the
13726 script as a separate argument (for a good reason - arguments containing commas
13727 and/or white space are now parsable), to remove the deprecated @samp{1} from
13728 your @file{loginfo} command line templates, you will most likely have to
13729 rewrite any scripts called by the hook to handle the new argument format.
13730
13731 Also note that the way @samp{%} followed by unrecognised characters and by
13732 @samp{@{@}} was treated in past versions of CVS is not strictly adhered to as
13733 there were bugs in the old versions. Specifically, @samp{%@{@}} would eat the
13734 next character and unrecognised strings resolved only to the empty string,
13735 which was counter to what was stated in the documentation. This version will
13736 do what the documentation said it should have (if you were using only some
13737 combination of @samp{%@{sVv@}}, e.g. @samp{%@{sVv@}}, @samp{%@{sV@}}, or
13738 @samp{%v}, you should have no troubles).
13739
13740 On the bright side, you should have plenty of time to do this before all
13741 support for the old format strings is removed from @sc{cvs}, so you can just
13742 put up with the deprecation warnings for awhile if you like.
13743
13744 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13745 @node commitinfo
13746 @appendixsubsec Commitinfo
13747 @cindex @file{commitinfo}
13748 @cindex Commits, precommit verification of
13749 @cindex commitinfo (admin file)
13750 @cindex info files, commitinfo
13751 @cindex script hooks, commitinfo
13752 @cindex trigger scripts, commitinfo
13753 @cindex info files, precommit verification of commits
13754 @cindex script hooks, precommit verification of commits
13755 @cindex trigger scripts, precommit verification of commits
13756
13757 The @file{commitinfo} file defines programs to execute
13758 whenever @samp{cvs commit} is about to execute. These
13759 programs are used for pre-commit checking to verify
13760 that the modified, added and removed files are really
13761 ready to be committed. This could be used, for
13762 instance, to verify that the changed files conform to
13763 to your site's standards for coding practice.
13764
13765 The @file{commitinfo} file has the standard form for script hooks
13766 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13767 a command to execute. It supports only the DEFAULT keywords.
13768
13769 @cindex format strings, commitinfo admin file
13770 In addition to the common format strings (@pxref{syntax}),
13771 @file{commitinfo} supports:
13772
13773 @table @t
13774 @item @{s@}
13775 a list of the names of files to be committed
13776 @end table
13777
13778 @cindex commitinfo (admin file), updating legacy repositories
13779 @cindex compatibility notes, commitinfo admin file
13780 Currently, if no format strings are specified, a default
13781 string of @samp{ %r/%p %@{s@}} will be appended to the command
13782 line template before replacement is performed, but this
13783 feature is deprecated. It is simply in place so that legacy
13784 repositories will remain compatible with the new @sc{cvs} application.
13785 For information on updating, @pxref{Updating Commit Files}.
13786
13787 @cindex Exit status, of commitinfo
13788 @cindex commitinfo (admin file), exit status
13789 The first line with a regular expression matching the
13790 directory within the repository will be used. If the
13791 command returns a non-zero exit status the commit will
13792 be aborted.
13793 @c FIXME: need example(s) of what "directory within the
13794 @c repository" means.
13795
13796 @cindex @file{commitinfo}, working directory
13797 @cindex @file{commitinfo}, command environment
13798 The command will be run in the root of the workspace
13799 containing the new versions of any files the user would like
13800 to modify (commit), @emph{or in a copy of the workspace on
13801 the server (@pxref{Remote repositories})}. If a file is
13802 being removed, there will be no copy of the file under the
13803 current directory. If a file is being added, there will be
13804 no corresponding archive file in the repository unless the
13805 file is being resurrected.
13806
13807 Note that both the repository directory and the corresponding
13808 Attic (@pxref{Attic}) directory may need to be checked to
13809 locate the archive file corresponding to any given file being
13810 committed. Much of the information about the specific commit
13811 request being made, including the destination branch, commit
13812 message, and command line options specified, is not available
13813 to the command.
13814
13815 @c FIXME: should discuss using commitinfo to control
13816 @c who has checkin access to what (e.g. Joe can check into
13817 @c directories a, b, and c, and Mary can check into
13818 @c directories b, c, and d--note this case cannot be
13819 @c conveniently handled with unix groups). Of course,
13820 @c adding a new set of features to CVS might be a more
13821 @c natural way to fix this problem than telling people to
13822 @c use commitinfo.
13823 @c FIXME: Should make some reference, especially in
13824 @c the context of controlling who has access, to the fact
13825 @c that commitinfo can be circumvented. Perhaps
13826 @c mention SETXID (but has it been carefully examined
13827 @c for holes?). This fits in with the discussion of
13828 @c general CVS security in "Password authentication
13829 @c security" (the bit which is not pserver-specific).
13830
13831 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13832 @node verifymsg
13833 @appendixsubsec Verifying log messages
13834 @cindex @file{verifymsg} (admin file)
13835 @cindex Log message, verifying
13836 @cindex logging, commits
13837
13838 Once you have entered a log message, you can evaluate
13839 that message to check for specific content, such as
13840 a bug ID. Use the @file{verifymsg} file to
13841 specify a program that is used to verify the log message.
13842 This program could be a simple script that checks
13843 that the entered message contains the required fields.
13844
13845 The @file{verifymsg} file is often most useful together
13846 with the @file{rcsinfo} file, which can be used to
13847 specify a log message template (@pxref{rcsinfo}).
13848
13849 The @file{verifymsg} file has the standard form for script hooks
13850 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
13851 a command to execute. It supports only the DEFAULT keywords.
13852
13853 @cindex format strings, verifymsg admin file
13854 In addition to the common format strings (@pxref{syntax}),
13855 @file{verifymsg} supports:
13856
13857 @table @t
13858 @item l
13859 the full path to the file containing the log message to be verified
13860 @item @{sV@}
13861 File attributes, where:
13862 @table @t
13863 @item s
13864 file name
13865 @item V
13866 old version number (pre-checkin)
13867 @end table
13868 @end table
13869
13870 @cindex verifymsg (admin/commit file), updating legacy repositories
13871 @cindex compatibility notes, verifymsg admin file
13872 Currently, if no format strings are specified, a default
13873 string of @samp{ %l} will be appended to the command
13874 line template before replacement is performed, but this
13875 feature is deprecated. It is simply in place so that legacy
13876 repositories will remain compatible with the new @sc{cvs} application.
13877 For information on updating, @pxref{Updating Commit Files}.
13878
13879 One thing that should be noted is that the @samp{ALL}
13880 keyword is not supported. If more than one matching
13881 line is found, the first one is used. This can be
13882 useful for specifying a default verification script in a
13883 directory, and then overriding it in a subdirectory.
13884
13885 @cindex Exit status, of @file{verifymsg}
13886 If the verification script exits with a non-zero exit status,
13887 the commit is aborted.
13888
13889 @cindex @file{verifymsg}, changing the log message
13890 In the default configuration, CVS allows the
13891 verification script to change the log message. This is
13892 controlled via the RereadLogAfterVerify CVSROOT/config
13893 option.
13894
13895 When @samp{RereadLogAfterVerify=always} or
13896 @samp{RereadLogAfterVerify=stat}, the log message will
13897 either always be reread after the verification script
13898 is run or reread only if the log message file status
13899 has changed.
13900
13901 @xref{config}, for more on CVSROOT/config options.
13902
13903 It is NOT a good idea for a @file{verifymsg} script to
13904 interact directly with the user in the various
13905 client/server methods. For the @code{pserver} method,
13906 there is no protocol support for communicating between
13907 @file{verifymsg} and the client on the remote end. For the
13908 @code{ext} and @code{server} methods, it is possible
13909 for CVS to become confused by the characters going
13910 along the same channel as the CVS protocol
13911 messages. See @ref{Remote repositories}, for more
13912 information on client/server setups. In addition, at the time
13913 the @file{verifymsg} script runs, the CVS
13914 server has locks in place in the repository. If control is
13915 returned to the user here then other users may be stuck waiting
13916 for access to the repository.
13917
13918 This option can be useful if you find yourself using an
13919 rcstemplate that needs to be modified to remove empty
13920 elements or to fill in default values. It can also be
13921 useful if the rcstemplate has changed in the repository
13922 and the CVS/Template was not updated, but is able to be
13923 adapted to the new format by the verification script
13924 that is run by @file{verifymsg}.
13925
13926 An example of an update might be to change all
13927 occurrences of 'BugId:' to be 'DefectId:' (which can be
13928 useful if the rcstemplate has recently been changed and
13929 there are still checked-out user trees with cached
13930 copies in the CVS/Template file of the older version).
13931
13932 Another example of an update might be to delete a line
13933 that contains 'BugID: none' from the log message after
13934 validation of that value as being allowed is made.
13935
13936 @menu
13937 * verifymsg example:: Verifymsg example
13938 @end menu
13939
13940 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13941 @node verifymsg example
13942 @appendixsubsubsec Verifying log messages
13943 @cindex verifymsg, example
13944 The following is a little silly example of a
13945 @file{verifymsg} file, together with the corresponding
13946 @file{rcsinfo} file, the log message template and a
13947 verification script. We begin with the log message template.
13948 We want to always record a bug-id number on the first
13949 line of the log message. The rest of log message is
13950 free text. The following template is found in the file
13951 @file{/usr/cvssupport/tc.template}.
13952
13953 @example
13954 BugId:
13955 @end example
13956
13957 The script @file{/usr/cvssupport/bugid.verify} is used to
13958 evaluate the log message.
13959
13960 @example
13961 #!/bin/sh
13962 #
13963 # bugid.verify filename
13964 #
13965 # Verify that the log message contains a valid bugid
13966 # on the first line.
13967 #
13968 if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
13969 exit 0
13970 elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
13971 # It is okay to allow commits with 'BugId: none',
13972 # but do not put that text into the real log message.
13973 grep -v '^BugId:[ ]*none$' > $1.rewrite
13974 mv $1.rewrite $1
13975 exit 0
13976 else
13977 echo "No BugId found."
13978 exit 1
13979 fi
13980 @end example
13981
13982 The @file{verifymsg} file contains this line:
13983
13984 @example
13985 ^tc /usr/cvssupport/bugid.verify %l
13986 @end example
13987
13988 The @file{rcsinfo} file contains this line:
13989
13990 @example
13991 ^tc /usr/cvssupport/tc.template
13992 @end example
13993
13994 The @file{config} file contains this line:
13995
13996 @example
13997 RereadLogAfterVerify=always
13998 @end example
13999
14000
14001
14002 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14003 @node loginfo
14004 @appendixsubsec Loginfo
14005 @cindex loginfo (admin file)
14006 @cindex logging, commits
14007 @cindex Storing log messages
14008 @cindex Mailing log messages
14009 @cindex Distributing log messages
14010 @cindex Log messages
14011
14012 The @file{loginfo} file is used to control where log information is sent after
14013 versioned changes are made to repository archive files and after directories
14014 are added to the repository. @ref{posttag} for how to log tagging
14015 information and @ref{postadmin} for how to log changes due to the @code{admin}
14016 command.
14017
14018 The @file{loginfo} file has the standard form for script hooks
14019 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
14020 a command to execute. It supports the ALL and DEFAULT keywords.
14021
14022 Any specified scripts are called:
14023
14024 @table @code
14025 @item commit
14026 Once per directory, immediately after a successfully completing the commit of
14027 all files within that directory.
14028 @item import
14029 Once per import, immediately after completion of all write operations.
14030 @item add
14031 Immediately after the successful @code{add} of a directory.
14032 @end table
14033
14034 Any script called via @file{loginfo} will be fed the log information on its
14035 standard input. Note that the filter program @strong{must} read @strong{all}
14036 of the log information from its standard input or @sc{cvs} may fail with a
14037 broken pipe signal.
14038
14039 @cindex format strings, loginfo admin file
14040 In addition to the common format strings (@pxref{syntax}),
14041 @file{loginfo} supports:
14042
14043 @table @t
14044 @item @{sVv@}
14045 File attributes, where:
14046 @table @t
14047 @item s
14048 file name
14049 @item V
14050 old version number (pre-checkin)
14051 @item v
14052 new version number (post-checkin)
14053 @end table
14054 @end table
14055
14056 For example, some valid format strings are @samp{%%},
14057 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
14058
14059 @cindex loginfo (admin file), updating legacy repositories
14060 @cindex compatibility notes, loginfo admin file
14061 Currently, if @samp{UseNewInfoFmtStrings} is not set in the @file{config}
14062 administration file (@pxref{config}), the format strings will be substituted
14063 as they were in past versions of @sc{cvs}, but this feature is deprecated.
14064 It is simply in place so that legacy repositories will remain compatible with
14065 the new @sc{cvs} application. For information on updating,
14066 please see @ref{Updating Commit Files}.
14067
14068 As an example, if @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%p}
14069 and @samp{%@{sVv@}} are the format strings, and three files (@t{ChangeLog},
14070 @t{Makefile}, @t{foo.c}) were modified, the output might be:
14071
14072 @example
14073 yoyodyne/tc ChangeLog 1.1 1.2 Makefile 1.3 1.4 foo.c 1.12 1.13
14074 @end example
14075
14076 Note: when @sc{cvs} is accessing a remote repository,
14077 @file{loginfo} will be run on the @emph{remote}
14078 (i.e., server) side, not the client side (@pxref{Remote
14079 repositories}).
14080
14081 @menu
14082 * loginfo example:: Loginfo example
14083 * Keeping a checked out copy:: Updating a tree on every checkin
14084 @end menu
14085
14086 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14087 @node loginfo example
14088 @appendixsubsubsec Loginfo example
14089
14090 The following @file{loginfo} file, together with the
14091 tiny shell-script below, appends all log messages
14092 to the file @file{$CVSROOT/CVSROOT/commitlog},
14093 and any commits to the administrative files (inside
14094 the @file{CVSROOT} directory) are also logged in
14095 @file{/usr/adm/cvsroot-log}.
14096 Commits to the @file{prog1} directory are mailed to @t{ceder}.
14097
14098 @c FIXME: is it a CVS feature or bug that only the
14099 @c first matching line is used? It is documented
14100 @c above, but is it useful? For example, if we wanted
14101 @c to run both "cvs-log" and "Mail" for the CVSROOT
14102 @c directory, it is kind of awkward if
14103 @c only the first matching line is used.
14104 @example
14105 ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
14106 ^CVSROOT\(/\|$\) /usr/local/bin/cvs-log /usr/adm/cvsroot-log $USER
14107 ^prog1\(/\|$\) Mail -s "%p %s" ceder
14108 @end example
14109
14110 The shell-script @file{/usr/local/bin/cvs-log} looks
14111 like this:
14112
14113 @example
14114 #!/bin/sh
14115 (echo "------------------------------------------------------";
14116 echo -n "$2 ";
14117 date;
14118 echo;
14119 cat) >> $1
14120 @end example
14121
14122
14123
14124 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14125 @node Keeping a checked out copy
14126 @appendixsubsubsec Keeping a checked out copy
14127
14128 @c What other index entries? It seems like
14129 @c people might want to use a lot of different
14130 @c words for this functionality.
14131 @cindex Keeping a checked out copy
14132 @cindex Checked out copy, keeping
14133 @cindex Web pages, maintaining with CVS
14134
14135 It is often useful to maintain a directory tree which
14136 contains files which correspond to the latest version
14137 in the repository. For example, other developers might
14138 want to refer to the latest sources without having to
14139 check them out, or you might be maintaining a web site
14140 with @sc{cvs} and want every checkin to cause the files
14141 used by the web server to be updated.
14142 @c Can we offer more details on the web example? Or
14143 @c point the user at how to figure it out? This text
14144 @c strikes me as sufficient for someone who already has
14145 @c some idea of what we mean but not enough for the naive
14146 @c user/sysadmin to understand it and set it up.
14147
14148 The way to do this is by having loginfo invoke
14149 @code{cvs update}. Doing so in the naive way will
14150 cause a problem with locks, so the @code{cvs update}
14151 must be run in the background.
14152 @c Should we try to describe the problem with locks?
14153 @c It seems like a digression for someone who just
14154 @c wants to know how to make it work.
14155 @c Another choice which might work for a single file
14156 @c is to use "cvs -n update -p" which doesn't take
14157 @c out locks (I think) but I don't see many advantages
14158 @c of that and we might as well document something which
14159 @c works for multiple files.
14160 Here is an example for unix (this should all be on one line):
14161
14162 @example
14163 ^cyclic-pages\(/\|$\) (date; cat; (sleep 2; cd /u/www/local-docs;
14164 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
14165 @end example
14166
14167 This will cause checkins to repository directory @code{cyclic-pages}
14168 and its subdirectories to update the checked
14169 out tree in @file{/u/www/local-docs}.
14170 @c More info on some of the details? The "sleep 2" is
14171 @c so if we are lucky the lock will be gone by the time
14172 @c we start and we can wait 2 seconds instead of 30.
14173
14174
14175
14176 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14177 @node postadmin
14178 @appendixsubsec Logging admin commands
14179 @cindex postadmin (admin file)
14180 @cindex script hook, postadmin
14181 @cindex Admin commands, logging
14182
14183 The @file{postadmin} file defines programs to execute after an @code{admin}
14184 command modifies files. The @file{postadmin} file has the standard form
14185 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14186 expression followed by a command to execute. It supports the ALL and DEFAULT
14187 keywords.
14188
14189 @cindex format strings, postadmin admin file
14190 The @file{postadmin} file supports no format strings other than the common
14191 ones (@pxref{syntax}),
14192
14193
14194
14195 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14196 @node taginfo
14197 @appendixsubsec Taginfo
14198 @cindex taginfo (admin file)
14199 @cindex script hook, taginfo
14200 @cindex Tags, logging
14201 @cindex Tags, verifying
14202 The @file{taginfo} file defines programs to execute
14203 when someone executes a @code{tag} or @code{rtag}
14204 command. The @file{taginfo} file has the standard form
14205 for script hooks (@pxref{Trigger Scripts}), where each line
14206 is a regular expression followed by a command to execute.
14207 It supports the ALL and DEFAULT keywords.
14208
14209 @cindex format strings, taginfo admin file
14210 In addition to the common format strings (@pxref{syntax}),
14211 @file{taginfo} supports:
14212
14213 @table @t
14214 @item b
14215 tag type (@code{T} for branch, @code{N} for not-branch, or @code{?} for
14216 unknown, as during delete operations)
14217 @item o
14218 operation (@code{add} for @code{tag}, @code{mov} for @code{tag -F}, or
14219 @code{del} for @code{tag -d})
14220 @item t
14221 new tag name
14222 @item @{sTVv@}
14223 file attributes, where:
14224 @table @t
14225 @item s
14226 file name
14227 @item T
14228 tag name of destination, or the empty string when there is no associated
14229 tag name (this usually means the trunk)
14230 @item V
14231 old version number (for a move or delete operation)
14232 @item v
14233 new version number (for an add or move operation)
14234 @end table
14235 @end table
14236
14237 For example, some valid format strings are @samp{%%}, @samp{%p}, @samp{%t},
14238 @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
14239
14240 @cindex taginfo (admin file), updating legacy repositories
14241 @cindex compatibility notes, taginfo admin file
14242 Currently, if no format strings are specified, a default
14243 string of @samp{ %t %o %p %@{sv@}} will be appended to the command
14244 line template before replacement is performed, but this
14245 feature is deprecated. It is simply in place so that legacy
14246 repositories will remain compatible with the new @sc{cvs} application.
14247 For information on updating, @pxref{Updating Commit Files}.
14248
14249 @cindex Exit status, of taginfo admin file
14250 @cindex taginfo (admin file), exit status
14251 A non-zero exit of the filter program will cause the tag to be
14252 aborted.
14253
14254 Here is an example of using @file{taginfo} to log @code{tag} and @code{rtag}
14255 commands. In the @file{taginfo} file put:
14256
14257 @example
14258 ALL /usr/local/cvsroot/CVSROOT/loggit %t %b %o %p %@{sVv@}
14259 @end example
14260
14261 @noindent
14262 Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
14263 following script:
14264
14265 @example
14266 #!/bin/sh
14267 echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
14268 @end example
14269
14270
14271
14272 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14273 @node posttag
14274 @appendixsubsec Logging tags
14275 @cindex posttag (admin file)
14276 @cindex script hook, posttag
14277 @cindex Tags, logging
14278
14279 The @file{posttag} file defines programs to execute after a @code{tag} or
14280 @code{rtag} command modifies files. The @file{posttag} file has the standard
14281 form for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14282 expression followed by a command to execute. It supports the ALL and DEFAULT
14283 keywords.
14284
14285 @cindex format strings, posttag admin file
14286 The @file{posttag} admin file supports the same format strings as the
14287 @file{taginfo} file (@pxref{taginfo}),
14288
14289
14290
14291 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14292 @node postwatch
14293 @appendixsubsec Logging watch commands
14294 @cindex postwatch (admin file)
14295 @cindex script hook, postwatch
14296 @cindex Watch family of commands, logging
14297
14298 The @file{postwatch} file defines programs to execute after any command (for
14299 instance, @code{watch}, @code{edit}, @code{unedit}, or @code{commit}) modifies
14300 any @file{CVS/fileattr} file in the repository (@pxref{Watches}). The
14301 @file{postwatch} file has the standard form for script hooks
14302 (@pxref{Trigger Scripts}), where each line is a regular expression followed by
14303 a command to execute. It supports the ALL and DEFAULT keywords.
14304
14305 @cindex format strings, postwatch admin file
14306 The @file{postwatch} file supports no format strings other than the common
14307 ones (@pxref{syntax}), but it is worth noting that the @code{%c} format string
14308 may not be replaced as you might expect. Client runs of @code{edit} and
14309 @code{unedit} can sometimes skip contacting the @sc{cvs} server and cache the
14310 notification of the file attribute change to be sent the next time the client
14311 contacts the server for whatever other reason,
14312
14313
14314
14315 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14316 @node preproxy
14317 @appendixsubsec Launch a Script before Proxying
14318 @cindex preproxy (admin file)
14319 @cindex script hook, preproxy
14320 @cindex Write proxy, verifying
14321 @cindex Write proxy, logging
14322
14323 The @file{preproxy} file defines programs to execute after a secondary
14324 server receives a write request from a client, just before it starts up the
14325 primary server and becomes a write proxy. This hook could be used to
14326 dial a modem, launch an SSH tunnel, establish a VPN, or anything else that
14327 might be necessary to do before contacting the primary server.
14328
14329 @file{preproxy} scripts are called once, at the time of the write request, with
14330 the repository argument (if requested) set from the topmost directory sent by
14331 the client.
14332
14333 The @file{preproxy} file has the standard form
14334 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14335 expression followed by a command to execute. It supports the ALL and DEFAULT
14336 keywords.
14337
14338 @cindex format strings, preproxy admin file
14339 In addition to the common format strings, the @file{preproxy} file supports the
14340 following format string:
14341
14342 @table @t
14343 @item P
14344 the CVSROOT string which specifies the primary server
14345 @end table
14346
14347
14348
14349 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14350 @node postproxy
14351 @appendixsubsec Launch a Script after Proxying
14352 @cindex postproxy (admin file)
14353 @cindex script hook, postproxy
14354 @cindex Write proxy, logging
14355 @cindex Write proxy, pull updates
14356 @cindex secondary server, pull updates
14357
14358 The @file{postproxy} file defines programs to execute after a secondary
14359 server notes that the connection to the primary server has shut down and before
14360 it releases the client by shutting down the connection to the client.
14361 This could hook could be used to
14362 disconnect a modem, an SSH tunnel, a VPN, or anything else that
14363 might be necessary to do after contacting the primary server. This hook should
14364 also be used to pull updates from the primary server before allowing the client
14365 which did the write to disconnect since otherwise the client's next read
14366 request may generate error messages and fail upon encountering an out of date
14367 repository on the secondary server.
14368
14369 @file{postproxy} scripts are called once per directory.
14370
14371 The @file{postproxy} file has the standard form
14372 for script hooks (@pxref{Trigger Scripts}), where each line is a regular
14373 expression followed by a command to execute. It supports the ALL and DEFAULT
14374 keywords.
14375
14376 @cindex format strings, postproxy admin file
14377 In addition to the common format strings, the @file{postproxy} file supports
14378 the following format string:
14379
14380 @table @t
14381 @item P
14382 the CVSROOT string which specifies the primary server
14383 @end table
14384
14385
14386
14387 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14388 @node rcsinfo
14389 @appendixsec Rcsinfo
14390 @cindex rcsinfo (admin file)
14391 @cindex Form for log message
14392 @cindex Log message template
14393 @cindex Template for log message
14394 @cindex logging, commits
14395
14396 The @file{rcsinfo} file can be used to specify a form to
14397 edit when filling out the commit log. The
14398 @file{rcsinfo} file has a syntax similar to the
14399 @file{verifymsg}, @file{commitinfo} and @file{loginfo}
14400 files. @xref{syntax}. Unlike the other files the second
14401 part is @emph{not} a command-line template. Instead,
14402 the part after the regular expression should be a full pathname to
14403 a file containing the log message template.
14404
14405 If the repository name does not match any of the
14406 regular expressions in this file, the @samp{DEFAULT}
14407 line is used, if it is specified.
14408
14409 All occurrences of the name @samp{ALL} appearing as a
14410 regular expression are used in addition to the first
14411 matching regular expression or @samp{DEFAULT}.
14412
14413 @c FIXME: should be offering advice, somewhere around
14414 @c here, about where to put the template file. The
14415 @c verifymsg example uses /usr/cvssupport but doesn't
14416 @c say anything about what that directory is for or
14417 @c whether it is hardwired into CVS or who creates
14418 @c it or anything. In particular we should say
14419 @c how to version control the template file. A
14420 @c probably better answer than the /usr/cvssupport
14421 @c stuff is to use checkoutlist (with xref to the
14422 @c checkoutlist doc).
14423 @c Also I am starting to see a connection between
14424 @c this and the Keeping a checked out copy node.
14425 @c Probably want to say something about that.
14426 The log message template will be used as a default log
14427 message. If you specify a log message with @samp{cvs
14428 commit -m @var{message}} or @samp{cvs commit -f
14429 @var{file}} that log message will override the
14430 template.
14431
14432 @xref{verifymsg}, for an example @file{rcsinfo}
14433 file.
14434
14435 When @sc{cvs} is accessing a remote repository,
14436 the contents of @file{rcsinfo} at the time a directory
14437 is first checked out will specify a template. This
14438 template will be updated on all @samp{cvs update}
14439 commands. It will also be added to new directories
14440 added with a @samp{cvs add new-directory} command.
14441 In versions of @sc{cvs} prior to version 1.12, the
14442 @file{CVS/Template} file was not updated. If the
14443 @sc{cvs} server is at version 1.12 or higher an older
14444 client may be used and the @file{CVS/Template} will
14445 be updated from the server.
14446
14447 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14448 @node cvsignore
14449 @appendixsec Ignoring files via cvsignore
14450 @cindex cvsignore (admin file), global
14451 @cindex Global cvsignore
14452 @cindex Ignoring files
14453 @c -- This chapter should maybe be moved to the
14454 @c tutorial part of the manual?
14455
14456 There are certain file names that frequently occur
14457 inside your working copy, but that you don't want to
14458 put under @sc{cvs} control. Examples are all the object
14459 files that you get while you compile your sources.
14460 Normally, when you run @samp{cvs update}, it prints a
14461 line for each file it encounters that it doesn't know
14462 about (@pxref{update output}).
14463
14464 @sc{cvs} has a list of files (or sh(1) file name patterns)
14465 that it should ignore while running @code{update},
14466 @code{import} and @code{release}.
14467 @c -- Are those the only three commands affected?
14468 This list is constructed in the following way.
14469
14470 @itemize @bullet
14471 @item
14472 The list is initialised to include certain file name
14473 patterns: names associated with @sc{cvs}
14474 administration, or with other common source control
14475 systems; common names for patch files, object files,
14476 archive files, and editor backup files; and other names
14477 that are usually artifacts of assorted utilities.
14478 Currently, the default list of ignored file name
14479 patterns is:
14480
14481 @cindex Ignored files
14482 @cindex Automatically ignored files
14483 @example
14484 RCS SCCS CVS CVS.adm
14485 RCSLOG cvslog.*
14486 tags TAGS
14487 .make.state .nse_depinfo
14488 *~ #* .#* ,* _$* *$
14489 *.old *.bak *.BAK *.orig *.rej .del-*
14490 *.a *.olb *.o *.obj *.so *.exe
14491 *.Z *.elc *.ln
14492 core
14493 @end example
14494
14495 @item
14496 The per-repository list in
14497 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
14498 the list, if that file exists.
14499
14500 @item
14501 The per-user list in @file{.cvsignore} in your home
14502 directory is appended to the list, if it exists.
14503
14504 @item
14505 Any entries in the environment variable
14506 @code{$CVSIGNORE} is appended to the list.
14507
14508 @item
14509 Any @samp{-I} options given to @sc{cvs} is appended.
14510
14511 @item
14512 As @sc{cvs} traverses through your directories, the contents
14513 of any @file{.cvsignore} will be appended to the list.
14514 The patterns found in @file{.cvsignore} are only valid
14515 for the directory that contains them, not for
14516 any sub-directories.
14517 @end itemize
14518
14519 In any of the 5 places listed above, a single
14520 exclamation mark (@samp{!}) clears the ignore list.
14521 This can be used if you want to store any file which
14522 normally is ignored by @sc{cvs}.
14523
14524 Specifying @samp{-I !} to @code{cvs import} will import
14525 everything, which is generally what you want to do if
14526 you are importing files from a pristine distribution or
14527 any other source which is known to not contain any
14528 extraneous files. However, looking at the rules above
14529 you will see there is a fly in the ointment; if the
14530 distribution contains any @file{.cvsignore} files, then
14531 the patterns from those files will be processed even if
14532 @samp{-I !} is specified. The only workaround is to
14533 remove the @file{.cvsignore} files in order to do the
14534 import. Because this is awkward, in the future
14535 @samp{-I !} might be modified to override
14536 @file{.cvsignore} files in each directory.
14537
14538 Note that the syntax of the ignore files consists of a
14539 series of lines, each of which contains a space
14540 separated list of filenames. This offers no clean way
14541 to specify filenames which contain spaces, but you can
14542 use a workaround like @file{foo?bar} to match a file
14543 named @file{foo bar} (it also matches @file{fooxbar}
14544 and the like). Also note that there is currently no
14545 way to specify comments.
14546 @c FIXCVS? I don't _like_ this syntax at all, but
14547 @c changing it raises all the usual compatibility
14548 @c issues and I'm also not sure what to change it to.
14549
14550 @node checkoutlist
14551 @appendixsec The checkoutlist file
14552 @cindex checkoutlist
14553
14554 It may be helpful to use @sc{cvs} to maintain your own
14555 files in the @file{CVSROOT} directory. For example,
14556 suppose that you have a script @file{logcommit.pl}
14557 which you run by including the following line in the
14558 @file{commitinfo} administrative file:
14559
14560 @example
14561 ALL $CVSROOT/CVSROOT/logcommit.pl %r/%p %s
14562 @end example
14563
14564 To maintain @file{logcommit.pl} with @sc{cvs} you would
14565 add the following line to the @file{checkoutlist}
14566 administrative file:
14567
14568 @example
14569 logcommit.pl
14570 @end example
14571
14572 The format of @file{checkoutlist} is one line for each
14573 file that you want to maintain using @sc{cvs}, giving
14574 the name of the file, followed optionally by more whitespace
14575 and any error message that should print if the file cannot be
14576 checked out into CVSROOT after a commit:
14577
14578 @example
14579 logcommit.pl Could not update CVSROOT/logcommit.pl.
14580 @end example
14581
14582 After setting up @file{checkoutlist} in this fashion,
14583 the files listed there will function just like
14584 @sc{cvs}'s built-in administrative files. For example,
14585 when checking in one of the files you should get a
14586 message such as:
14587
14588 @example
14589 cvs commit: Rebuilding administrative file database
14590 @end example
14591
14592 @noindent
14593 and the checked out copy in the @file{CVSROOT}
14594 directory should be updated.
14595
14596 Note that listing @file{passwd} (@pxref{Password
14597 authentication server}) in @file{checkoutlist} is not
14598 recommended for security reasons.
14599
14600 For information about keeping a checkout out copy in a
14601 more general context than the one provided by
14602 @file{checkoutlist}, see @ref{Keeping a checked out
14603 copy}.
14604
14605 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14606 @node history file
14607 @appendixsec The history file
14608 @cindex History file
14609 @cindex Log information, saving
14610
14611 By default, the file @file{$CVSROOT/CVSROOT/history} is used
14612 to log information for the @code{history} command (@pxref{history}).
14613 This file name may be changed with the @samp{HistoryLogPath} and
14614 @samp{HistorySearchPath} config options (@pxref{config}).
14615
14616 The file format of the @file{history} file is
14617 documented only in comments in the @sc{cvs} source
14618 code, but generally programs should use the @code{cvs
14619 history} command to access it anyway, in case the
14620 format changes with future releases of @sc{cvs}.
14621
14622 @node Variables
14623 @appendixsec Expansions in administrative files
14624 @cindex Internal variables
14625 @cindex Variables
14626
14627 Sometimes in writing an administrative file, you might
14628 want the file to be able to know various things based
14629 on environment @sc{cvs} is running in. There are
14630 several mechanisms to do that.
14631
14632 To find the home directory of the user running @sc{cvs}
14633 (from the @code{HOME} environment variable), use
14634 @samp{~} followed by @samp{/} or the end of the line.
14635 Likewise for the home directory of @var{user}, use
14636 @samp{~@var{user}}. These variables are expanded on
14637 the server machine, and don't get any reasonable
14638 expansion if pserver (@pxref{Password authenticated})
14639 is in use; therefore user variables (see below) may be
14640 a better choice to customise behavior based on the user
14641 running @sc{cvs}.
14642 @c Based on these limitations, should we deprecate ~?
14643 @c What is it good for? Are people using it?
14644
14645 One may want to know about various pieces of
14646 information internal to @sc{cvs}. A @sc{cvs} internal
14647 variable has the syntax @code{$@{@var{variable}@}},
14648 where @var{variable} starts with a letter and consists
14649 of alphanumeric characters and @samp{_}. If the
14650 character following @var{variable} is a
14651 non-alphanumeric character other than @samp{_}, the
14652 @samp{@{} and @samp{@}} can be omitted. The @sc{cvs}
14653 internal variables are:
14654
14655 @table @code
14656 @item CVSROOT
14657 @cindex CVSROOT, internal variable
14658 This is the absolute path to the current @sc{cvs} root directory.
14659 @xref{Repository}, for a description of the various
14660 ways to specify this, but note that the internal
14661 variable contains just the directory and not any
14662 of the access method information.
14663
14664 @item RCSBIN
14665 @cindex RCSBIN, internal variable
14666 In @sc{cvs} 1.9.18 and older, this specified the
14667 directory where @sc{cvs} was looking for @sc{rcs}
14668 programs. Because @sc{cvs} no longer runs @sc{rcs}
14669 programs, specifying this internal variable is now an
14670 error.
14671
14672 @item CVSEDITOR
14673 @cindex CVSEDITOR, internal variable
14674 @itemx EDITOR
14675 @cindex EDITOR, internal variable
14676 @itemx VISUAL
14677 @cindex VISUAL, internal variable
14678 These all expand to the same value, which is the editor
14679 that @sc{cvs} is using. @xref{Global options}, for how
14680 to specify this.
14681
14682 @item USER
14683 @cindex USER, internal variable
14684 Username of the user running @sc{cvs} (on the @sc{cvs}
14685 server machine).
14686 When using pserver, this is the user specified in the repository
14687 specification which need not be the same as the username the
14688 server is running as (@pxref{Password authentication server}).
14689 Do not confuse this with the environment variable of the same name.
14690
14691 @item SESSIONID
14692 @cindex COMMITID, internal variable
14693 Unique Session ID of the @sc{cvs} process. This is a
14694 random string of printable characters of at least 16
14695 characters length. Users should assume that it may
14696 someday grow to at most 256 characters in length.
14697
14698 @item COMMITID
14699 @cindex COMMITID, internal variable
14700 Unique Session ID of the @sc{cvs} process. This is a
14701 random string of printable characters of at least 16
14702 characters length. Users should assume that it may
14703 someday grow to at most 256 characters in length.
14704 Currently, Debian and MirBSD @sc{cvs} uses 19 characters.
14705 @end table
14706
14707 If you want to pass a value to the administrative files
14708 which the user who is running @sc{cvs} can specify,
14709 use a user variable.
14710 @cindex User variables
14711 To expand a user variable, the
14712 administrative file contains
14713 @code{$@{=@var{variable}@}}. To set a user variable,
14714 specify the global option @samp{-s} to @sc{cvs}, with
14715 argument @code{@var{variable}=@var{value}}. It may be
14716 particularly useful to specify this option via
14717 @file{.cvsrc} (@pxref{~/.cvsrc}).
14718
14719 For example, if you want the administrative file to
14720 refer to a test directory you might create a user
14721 variable @code{TESTDIR}. Then if @sc{cvs} is invoked
14722 as
14723
14724 @example
14725 cvs -s TESTDIR=/work/local/tests
14726 @end example
14727
14728 @noindent
14729 and the
14730 administrative file contains @code{sh
14731 $@{=TESTDIR@}/runtests}, then that string is expanded
14732 to @code{sh /work/local/tests/runtests}.
14733
14734 All other strings containing @samp{$} are reserved;
14735 there is no way to quote a @samp{$} character so that
14736 @samp{$} represents itself.
14737
14738 Environment variables passed to administrative files are:
14739
14740 @table @code
14741 @cindex environment variables, passed to administrative files
14742
14743 @item CVS_USER
14744 @cindex CVS_USER, environment variable
14745 The @sc{cvs}-specific username provided by the user, if it
14746 can be provided (currently just for the pserver access
14747 method), and to the empty string otherwise. (@code{CVS_USER}
14748 and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
14749 is used to map @sc{cvs} usernames to system usernames.)
14750
14751 @item LOGNAME
14752 @cindex LOGNAME, environment variable
14753 The username of the system user.
14754
14755 @item USER
14756 @cindex USER, environment variable
14757 Same as @code{LOGNAME}.
14758 Do not confuse this with the internal variable of the same name.
14759 @end table
14760
14761 @node config
14762 @appendixsec The CVSROOT/config configuration file
14763
14764 @cindex configuration file
14765 @cindex config, in CVSROOT
14766 @cindex CVSROOT/config
14767
14768 Usually, the @file{config} file is found at @file{$CVSROOT/CVSROOT/config},
14769 but this may be overridden on the @code{pserver} and @code{server} command
14770 lines (@pxref{server & pserver}).
14771
14772 The administrative file @file{config} contains various
14773 miscellaneous settings which affect the behavior of
14774 @sc{cvs}. The syntax is slightly different from the
14775 other administrative files.
14776
14777 Leading white space on any line is ignored, though the syntax is very strict
14778 and will reject spaces and tabs almost anywhere else.
14779
14780 Empty lines, lines containing nothing but white space, and lines which start
14781 with @samp{#} (discounting any leading white space) are ignored.
14782
14783 @c FIXME: where do we define comments for the other
14784 @c administrative files.
14785 Other lines consist of the optional leading white space, a keyword, @samp{=},
14786 and a value. Please note again that this syntax is very strict.
14787 Extraneous spaces or tabs, other than the leading white space, are not
14788 permitted on these lines.
14789 @c See comments in parseinfo.c:parse_config for more
14790 @c discussion of this strictness.
14791
14792 As of CVS 1.12.13, lines of the form @samp{[@var{CVSROOT}]} mark the subsequent
14793 section of the config file as applying only to certain repositories. Multiple
14794 @samp{[@var{CVSROOT}]} lines without intervening
14795 @samp{@var{KEYWORD}=@var{VALUE}} pairs cause processing to fall through,
14796 processing subsequent keywords for any root in the list. Finally, keywords
14797 and values which appear before any @samp{[@var{CVSROOT}]} lines are defaults,
14798 and may to apply to any repository. For example, consider the following file:
14799
14800 @example
14801 # Defaults
14802 LogHistory=TMAR
14803
14804 [/cvsroots/team1]
14805 LockDir=/locks/team1
14806
14807 [/cvsroots/team2]
14808 LockDir=/locks/team2
14809
14810 [/cvsroots/team3]
14811 LockDir=/locks/team3
14812
14813 [/cvsroots/team4]
14814 LockDir=/locks/team4
14815
14816 [/cvsroots/team3]
14817 [/cvsroots/team4]
14818 # Override logged commands for teams 3 & 4.
14819 LogHistory=all
14820 @end example
14821
14822 This example file sets up separate lock directories for each project, as well
14823 as a default set of logged commands overridden for the example's team 3 &
14824 team 4. This syntax could be useful, for instance, if you wished to share a
14825 single config file, for instance @file{/etc/cvs.conf}, among several
14826 repositories.
14827
14828 Currently defined keywords are:
14829
14830 @table @code
14831 @cindex HistoryLogPath, in CVSROOT/config
14832 @item HistorySearchPath=@var{pattern}
14833 Request that @sc{cvs} look for its history information in files matching
14834 @var{pattern}, which is a standard UNIX file glob. If @var{pattern} matches
14835 multiple files, all will be searched in lexicographically sorted order.
14836 @xref{history}, and @ref{history file}, for more.
14837
14838 If no value is supplied for this option, it defaults to
14839 @file{$CVSROOT/CVSROOT/history}.
14840
14841 @cindex HistorySearchPath, in CVSROOT/config
14842 @item HistoryLogPath=@var{path}
14843 Control where @sc{cvs} logs its history. If the file does not exist, @sc{cvs}
14844 will attempt to create it. Format strings, as available to the GNU C
14845 @code{strftime} function and often the UNIX date command, and the string
14846 @var{$CVSROOT} will be substituted in this path. For example, consider the
14847 line:
14848
14849 @example
14850 HistoryLogPath=$CVSROOT/CVSROOT/history/%Y-%m-%d
14851 @end example
14852
14853 This line would cause @sc{cvs} to attempt to create its history file in a
14854 subdirectory (@file{history}) of the configuration directory (@file{CVSROOT})
14855 with a name equal to the current date representation in the ISO8601 format (for
14856 example, on May 11, 2005, @sc{cvs} would attempt to log its history under the
14857 repository root directory in a file named @file{CVSROOT/history/2005-05-11}).
14858 @xref{history}, and @ref{history file}, for more.
14859
14860 If no value is supplied for this option, it defaults to
14861 @file{$CVSROOT/CVSROOT/history}.
14862
14863 @cindex ImportNewFilesToVendorBranchOnly, in CVSROOT/config
14864 @cindex import, config admin file
14865 @cindex config (admin file), import
14866 @item ImportNewFilesToVendorBranchOnly=@var{value}
14867 Specify whether @code{cvs import} should always behave as if the
14868 @samp{-X} flag was specified on the command line.
14869 @var{value} may be either @samp{yes} or @samp{no}. If set to @samp{yes},
14870 all uses of @code{cvs import} on the repository will behave as if the
14871 @samp{-X} flag was set. The default value is @samp{no}.
14872
14873 @cindex KeywordExpand, in CVSROOT/config
14874 @item KeywordExpand=@var{value}
14875 Specify @samp{i} followed by a list of keywords to be expanded
14876 (for example, @samp{KeywordExpand=iMYCVS,Name,Date,Mdocdate}),
14877 or @samp{e} followed by a list of keywords not to be expanded
14878 (for example, @samp{KeywordExpand=eCVSHeader}).
14879 For more on keyword expansion, see @ref{Configuring keyword expansion}.
14880
14881 @cindex LocalKeyword, in CVSROOT/config
14882 @item LocalKeyword=@var{value}
14883 Specify a local alias for a standard keyword.
14884 See @ref{Keyword substitution} for more information in local keywords.
14885 Example: @samp{LocalKeyword=MYCVS=CVSHeader}
14886
14887 @cindex LockDir, in CVSROOT/config
14888 @item LockDir=@var{directory}
14889 Put @sc{cvs} lock files in @var{directory} rather than
14890 directly in the repository. This is useful if you want
14891 to let users read from the repository while giving them
14892 write access only to @var{directory}, not to the
14893 repository.
14894 It can also be used to put the locks on a very fast
14895 in-memory filesystem to speed up locking and unlocking
14896 the repository.
14897 You need to create @var{directory}, but
14898 @sc{cvs} will create subdirectories of @var{directory} as it
14899 needs them. For information on @sc{cvs} locks, see
14900 @ref{Concurrency}.
14901
14902 @c Mention this in Compatibility section?
14903 Before enabling the LockDir option, make sure that you
14904 have tracked down and removed any copies of @sc{cvs} 1.9 or
14905 older. Such versions neither support LockDir, nor will
14906 give an error indicating that they don't support it.
14907 The result, if this is allowed to happen, is that some
14908 @sc{cvs} users will put the locks one place, and others will
14909 put them another place, and therefore the repository
14910 could become corrupted. @sc{cvs} 1.10 does not support
14911 LockDir but it will print a warning if run on a
14912 repository with LockDir enabled.
14913
14914 @cindex LogHistory, in CVSROOT/config
14915 @item LogHistory=@var{value}
14916 Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
14917 Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
14918 all transactions. Any subset of the default is
14919 legal. (For example, to only log transactions that modify the
14920 @file{*,v} files, use @samp{LogHistory=TMAR} which is nowadays
14921 set by @code{cvs init} by default.)
14922 To disable history logging
14923 completely, use @samp{LogHistory=}.
14924
14925 @cindex MaxCommentLeaderLength, in CVSROOT/config
14926 @cindex Log keyword, configuring substitution behavior
14927 @item MaxCommentLeaderLength=@var{length}
14928 Set to some length, in bytes, where a trailing @samp{k}, @samp{M}, @samp{G},
14929 or @samp{T} causes the preceding nubmer to be interpreted as kilobytes,
14930 megabytes, gigabytes, or terrabytes, respectively, will cause
14931 @code{$@splitrcskeyword{Log}$} keywords (@pxref{Keyword substitution}), with
14932 more than @var{length} bytes preceding it on a line to be ignored (or to fall
14933 back on the comment leader set in the RCS archive file - see
14934 @code{UseArchiveCommentLeader} below). Defaults to 20 bytes to allow checkouts
14935 to proceed normally when they include binary files containing
14936 @code{$@splitrcskeyword{Log}$} keywords and which users have neglected to mark
14937 as binary.
14938
14939 @cindex MinCompressionLevel, in CVSROOT/config
14940 @cindex MaxCompressionLevel, in CVSROOT/config
14941 @cindex Compression levels, restricting on server
14942 @item MinCompressionLevel=@var{value}
14943 @itemx MaxCompressionLevel=@var{value}
14944 Restricts the level of compression used by the @sc{cvs} server to a @var{value}
14945 between 0 and 9. @var{value}s 1 through 9 are the same @sc{zlib} compression
14946 levels accepted by the @samp{-z} option (@pxref{Global options}), and 0 means
14947 no compression. When one or both of these keys are set and a client requests a
14948 level outside the specified range, the server will simply use the closest
14949 permissable level. Clients will continue compressing at the level requested by
14950 the user.
14951
14952 The exception is when level 0 (no compression) is not available and the client
14953 fails to request any compression. The @sc{cvs} server will then exit with an
14954 error message when it becomes apparent that the client is not going to request
14955 compression. This will not happen with clients version 1.12.13 and later since
14956 these client versions allow the server to notify them that they must request
14957 some level of compression.
14958
14959 @ignore
14960 @cindex PreservePermissions, in CVSROOT/config
14961 @item PreservePermissions=@var{value}
14962 Enable support for saving special device files,
14963 symbolic links, file permissions and ownerships in the
14964 repository. The default value is @samp{no}.
14965 @xref{Special Files}, for the full implications of using
14966 this keyword.
14967 @end ignore
14968
14969 @cindex PrimaryServer, in CVSROOT/config
14970 @cindex Primary server
14971 @cindex Secondary server
14972 @cindex proxy, write
14973 @cindex write proxy
14974 @item PrimaryServer=@var{CVSROOT}
14975 When specified, and the repository specified by @var{CVSROOT} is not the one
14976 currently being accessed, then the server will turn itself into a transparent
14977 proxy to @var{CVSROOT} for write requests. The @var{hostname} configured as
14978 part of @var{CVSROOT} must resolve to the same string returned by the
14979 @command{uname} command on the primary server for this to work. Host name
14980 resolution is performed via some combination of @command{named}, a broken out
14981 line from @file{/etc/hosts}, and the Network Information Service (NIS or YP),
14982 depending on the configuration of the particular system.
14983
14984 Only the @samp{:ext:} method is
14985 currently supported for primaries (actually, @samp{:fork:} is supported as
14986 well, but only for testing - if you find another use for accessing a primary
14987 via the @samp{:fork:} method, please send a note to @email{bug-cvs@@nongnu.org}
14988 about it). See @ref{Write proxies} for more on configuring and using write
14989 proxies.
14990
14991 @cindex RCSBIN, in CVSROOT/config
14992 @item RCSBIN=@var{bindir}
14993 For @sc{cvs} 1.9.12 through 1.9.18, this setting told
14994 @sc{cvs} to look for @sc{rcs} programs in the
14995 @var{bindir} directory. Current versions of @sc{cvs}
14996 do not run @sc{rcs} programs; for compatibility this
14997 setting is accepted, but it does nothing.
14998
14999 @cindex RereadLogAfterVerify, in CVSROOT/config
15000 @cindex @file{verifymsg}, changing the log message
15001 @item RereadLogAfterVerify=@var{value}
15002 Modify the @samp{commit} command such that CVS will reread the
15003 log message after running the program specified by @file{verifymsg}.
15004 @var{value} may be one of @samp{yes} or @samp{always}, indicating that
15005 the log message should always be reread; @samp{no}
15006 or @samp{never}, indicating that it should never be
15007 reread; or @var{value} may be @samp{stat}, indicating
15008 that the file should be checked with the filesystem
15009 @samp{stat()} function to see if it has changed (see warning below)
15010 before rereading. The default value is @samp{always}.
15011
15012 @emph{Note: the `stat' mode can cause CVS to pause for up to
15013 one extra second per directory committed. This can be less IO and
15014 CPU intensive but is not recommended for use with large repositories}
15015
15016 @xref{verifymsg}, for more information on how verifymsg
15017 may be used.
15018
15019 @cindex SystemAuth, in CVSROOT/config
15020 @item SystemAuth=@var{value}
15021 If @var{value} is @samp{yes}, then pserver should check
15022 for users in the system's user database if not found in
15023 @file{CVSROOT/passwd}. If it is @samp{no}, then all
15024 pserver users must exist in @file{CVSROOT/passwd}.
15025 The default is @samp{yes}. For more on pserver, see
15026 @ref{Password authenticated}.
15027
15028 @cindex TmpDir, in config
15029 @cindex temporary files, location of
15030 @cindex temporary directory, set in config
15031 @item TmpDir=@var{path}
15032 Specify @var{path} as the directory to create temporary files in.
15033 @xref{Global options}, for more on setting the path to the temporary
15034 directory. This option first appeared with @sc{cvs} release 1.12.13.
15035
15036 @cindex TopLevelAdmin, in CVSROOT/config
15037 @item TopLevelAdmin=@var{value}
15038 Modify the @samp{checkout} command to create a
15039 @samp{CVS} directory at the top level of the new
15040 working directory, in addition to @samp{CVS}
15041 directories created within checked-out directories.
15042 The default value is @samp{no}.
15043
15044 This option is useful if you find yourself performing
15045 many commands at the top level of your working
15046 directory, rather than in one of the checked out
15047 subdirectories. The @file{CVS} directory created there
15048 will mean you don't have to specify @code{CVSROOT} for
15049 each command. It also provides a place for the
15050 @file{CVS/Template} file (@pxref{Working directory
15051 storage}).
15052
15053 @cindex UseArchiveCommentLeader, in CVSROOT/config
15054 @cindex Log keyword, configuring substitution behavior
15055 @item UseArchiveCommentLeader=@var{value}
15056 Set to @code{true}, if the text preceding a @code{$@splitrcskeyword{Log}$}
15057 keyword is found to exceed @code{MaxCommentLeaderLength} (above) bytes, then
15058 the comment leader set in the RCS archive file (@pxref{admin}), if any, will
15059 be used instead. If there is no comment leader set in the archive file or
15060 @var{value} is set to @samp{false}, then the keyword will not be expanded
15061 (@pxref{Keyword list}). To force the comment leader in the RCS archive file to
15062 be used exclusively (and @code{$@splitrcskeyword{Log}$} expansion skipped in
15063 files where the comment leader has not been set in the archive file), set
15064 @var{value} and set @code{MaxCommentLeaderLength} to @code{0}.
15065
15066 @cindex UseNewInfoFmtStrings, in CVSROOT/config
15067 @cindex format strings, config admin file
15068 @cindex config (admin file), updating legacy repositories
15069 @cindex compatibility notes, config admin file
15070 @item UseNewInfoFmtStrings=@var{value}
15071 Specify whether @sc{cvs} should support the new or old command line
15072 template model for the commit support files (@pxref{commit files}).
15073 This configuration variable began life in deprecation and is only here
15074 in order to give people time to update legacy repositories to use the new
15075 format string syntax before support for the old syntax is removed. For
15076 information on updating your repository to support the new model,
15077 please see @ref{Updating Commit Files}.
15078
15079 @emph{Note that new repositories (created with the @code{cvs init} command)
15080 will have this value set to @samp{yes}, but the default value is @samp{no}.}
15081
15082 @cindex UserAdminOptions, in CVSROOT/config
15083 @item UserAdminOptions=@var{value}
15084 Control what options will be allowed with the @code{cvs admin}
15085 command (@pxref{admin}) for users not in the @code{cvsadmin} group.
15086 The @var{value} string is a list of single character options
15087 which should be allowed. If a user who is not a member of the
15088 @code{cvsadmin} group tries to execute any @code{cvs admin}
15089 option which is not listed they will will receive an error message
15090 reporting that the option is restricted.
15091
15092 If no @code{cvsadmin} group exists on the server, @sc{cvs} will
15093 ignore the @code{UserAdminOptions} keyword (@pxref{admin}).
15094
15095 When not specified, @code{UserAdminOptions} defaults to
15096 @samp{k}. In other words, it defaults to allowing
15097 users outside of the @code{cvsadmin} group to use the
15098 @code{cvs admin} command only to change the default keyword
15099 expansion mode for files.
15100
15101 As an example, to restrict users not in the @code{cvsadmin}
15102 group to using @code{cvs admin} to change the default keyword
15103 substitution mode, lock revisions, unlock revisions, and
15104 replace the log message, use @samp{UserAdminOptions=klum}.
15105 @end table
15106
15107
15108
15109 @c ---------------------------------------------------------------------
15110 @node Environment variables
15111 @appendix All environment variables which affect CVS
15112 @cindex Environment variables
15113 @cindex Reference manual for variables
15114
15115 This is a complete list of all environment variables
15116 that affect @sc{cvs} (Windows users, please bear with this list;
15117 $VAR is equivalent to %VAR% at the Windows command prompt).
15118
15119 @table @code
15120 @cindex CVSIGNORE, environment variable
15121 @item $CVSIGNORE
15122 A whitespace-separated list of file name patterns that
15123 @sc{cvs} should ignore. @xref{cvsignore}.
15124
15125 @cindex CVSWRAPPERS, environment variable
15126 @item $CVSWRAPPERS
15127 A whitespace-separated list of file name patterns that
15128 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
15129
15130 @cindex CVSREAD, environment variable
15131 @cindex Read-only files, and CVSREAD
15132 @item $CVSREAD
15133 If this is set, @code{checkout} and @code{update} will
15134 try hard to make the files in your working directory
15135 read-only. When this is not set, the default behavior
15136 is to permit modification of your working files.
15137
15138 @cindex CVSREADONLYFS, environment variable
15139 @item $CVSREADONLYFS
15140 Turns on read-only repository mode. This allows one to
15141 check out from a read-only repository, such as within
15142 an anoncvs server, or from a @sc{cd-rom} repository.
15143
15144 Setting this has the same effect as if the @samp{-R} command-line
15145 option is used. This can also allow the use of
15146 read-only NFS repositories.
15147
15148 @item $CVSUMASK
15149 @anchor{CVSUMASK}
15150 Controls permissions of files in the repository. See
15151 @ref{File permissions}.
15152
15153 @item $CVSROOT
15154 Should contain the full pathname to the root of the @sc{cvs}
15155 source repository (where the @sc{rcs} files are
15156 kept). This information must be available to @sc{cvs} for
15157 most commands to execute; if @code{$CVSROOT} is not set,
15158 or if you wish to override it for one invocation, you
15159 can supply it on the command line: @samp{cvs -d cvsroot
15160 cvs_command@dots{}} Once you have checked out a working
15161 directory, @sc{cvs} stores the appropriate root (in
15162 the file @file{CVS/Root}), so normally you only need to
15163 worry about this when initially checking out a working
15164 directory.
15165
15166 @item $CVSEDITOR
15167 @cindex CVSEDITOR, environment variable
15168 @itemx $EDITOR
15169 @cindex EDITOR, environment variable
15170 @itemx $VISUAL
15171 @cindex VISUAL, environment variable
15172 Specifies the program to use for recording log messages
15173 during commit. @code{$CVSEDITOR} overrides
15174 @code{$EDITOR}, which overrides @code{$VISUAL}.
15175 See @ref{Committing your changes} for more or
15176 @ref{Global options} for alternative ways of specifying a
15177 log editor.
15178
15179 @cindex PATH, environment variable
15180 @item $PATH
15181 If @code{$RCSBIN} is not set, and no path is compiled
15182 into @sc{cvs}, it will use @code{$PATH} to try to find all
15183 programs it uses.
15184
15185 @cindex HOME, environment variable
15186 @item $HOME
15187 @cindex HOMEPATH, environment variable
15188 @item $HOMEPATH
15189 @cindex HOMEDRIVE, environment variable
15190 @item $HOMEDRIVE
15191 Used to locate the directory where the @file{.cvsrc}
15192 file, and other such files, are searched. On Unix, @sc{cvs}
15193 just checks for @code{HOME}. On Windows NT, the system will
15194 set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
15195 for example to @file{\joe}. On Windows 95, you'll
15196 probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
15197 @c We are being vague about whether HOME works on
15198 @c Windows; see long comment in windows-NT/filesubr.c.
15199
15200 @cindex CVS_RSH, environment variable
15201 @item $CVS_RSH
15202 Specifies the external program which @sc{cvs} connects with,
15203 when @code{:ext:} access method is specified.
15204 @pxref{Connecting via rsh}.
15205
15206 @item $CVS_SERVER
15207 Used in client-server mode when accessing a remote
15208 repository using @sc{rsh}. It specifies the name of
15209 the program to start on the server side (and any
15210 necessary arguments) when accessing a remote repository
15211 using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
15212 The default value for @code{:ext:} and @code{:server:} is @code{cvs};
15213 the default value for @code{:fork:} is the name used to run the client.
15214 @pxref{Connecting via rsh}
15215
15216 @item $CVS_PASSFILE
15217 Used in client-server mode when accessing the @code{cvs
15218 login server}. Default value is @file{$HOME/.cvspass}.
15219 @pxref{Password authentication client}
15220
15221 @cindex CVS_CLIENT_PORT
15222 @item $CVS_CLIENT_PORT
15223 Used in client-server mode to set the port to use when accessing the server
15224 via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
15225 if the port is not specified in the CVSROOT.
15226 @pxref{Remote repositories}
15227
15228 @cindex CVS_PROXY_PORT
15229 @item $CVS_PROXY_PORT
15230 Used in client-server mode to set the port to use when accessing a server
15231 via a web proxy, if the port is not specified in the CVSROOT. Works with
15232 GSSAPI, and the password authentication protocol.
15233 @pxref{Remote repositories}
15234
15235 @cindex CVS_RCMD_PORT, environment variable
15236 @item $CVS_RCMD_PORT
15237 Used in client-server mode. If set, specifies the port
15238 number to be used when accessing the @sc{rcmd} demon on
15239 the server side. (Currently not used for Unix clients).
15240
15241 @cindex CVS_CLIENT_LOG, environment variable
15242 @item $CVS_CLIENT_LOG
15243 Used for debugging only in client-server mode.
15244 If set and not empty, everything sent to the server is logged
15245 into @file{@code{$CVS_CLIENT_LOG}.in}, and everything received
15246 from the server is logged into @file{@code{$CVS_CLIENT_LOG}.out}.
15247
15248 @cindex CVS_SECONDARY_LOG, environment variable
15249 @item $CVS_SECONDARY_LOG
15250 Used for debugging only in secondary write proxy mode.
15251 If set and not empty, everything sent to the primary server is logged
15252 into @file{@code{$CVS_SECONDARY_LOG}.in}, and everything received
15253 from the primary server is logged into @file{@code{$CVS_SECONDARY_LOG}.out}.
15254
15255 @cindex CVS_SERVER_LOG, environment variable
15256 @item $CVS_SERVER_LOG
15257 Used for debugging only in client-server mode.
15258 If set and not empty, everything sent to the client is logged
15259 into @file{@code{$CVS_SERVER_LOG}.in}, and everything received
15260 from the client is logged into @file{@code{$CVS_SERVER_LOG}.out}.
15261
15262 @cindex CVS_SERVER_SLEEP, environment variable
15263 @item $CVS_SERVER_SLEEP
15264 Used only for debugging the server side in
15265 client-server mode. If set, delays the start of the
15266 server child process the specified amount of
15267 seconds so that you can attach to it with a debugger.
15268
15269 @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
15270 @item $CVS_IGNORE_REMOTE_ROOT
15271 For @sc{cvs} 1.10 and older, setting this variable
15272 prevents @sc{cvs} from overwriting the @file{CVS/Root}
15273 file when the @samp{-d} global option is specified.
15274 Later versions of @sc{cvs} do not rewrite
15275 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
15276 effect.
15277
15278 @cindex CVS_LOCAL_BRANCH_NUM, environment variable
15279 @item $CVS_LOCAL_BRANCH_NUM
15280 Setting this variable allows some control over the
15281 branch number that is assigned. This is specifically to
15282 support the local commit feature of CVSup. If one sets
15283 @code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
15284 the local repository, the revision numbers will look
15285 like 1.66.1000.xx. There is almost a dead-set certainty
15286 that there will be no conflicts with version numbers.
15287
15288 @cindex COMSPEC, environment variable
15289 @item $COMSPEC
15290 Used under OS/2 only. It specifies the name of the
15291 command interpreter and defaults to @sc{cmd.exe}.
15292
15293 @cindex TMPDIR, environment variable
15294 @cindex temporary file directory, set via environment variable
15295 @cindex temporary files, location of
15296 @item $TMPDIR
15297 Directory in which temporary files are located.
15298 @xref{Global options}, for more on setting the temporary directory.
15299
15300 @cindex CVS_PID, environment variable
15301 @item $CVS_PID
15302 This is the process identification (aka pid) number of
15303 the @sc{cvs} process. It is often useful in the
15304 programs and/or scripts specified by the
15305 @file{commitinfo}, @file{verifymsg}, @file{loginfo}
15306 files.
15307 @end table
15308
15309 @node Compatibility
15310 @appendix Compatibility between CVS Versions
15311
15312 @cindex CVS, versions of
15313 @cindex Versions, of CVS
15314 @cindex Compatibility, between CVS versions
15315 @c We don't mention versions older than CVS 1.3
15316 @c on the theory that it would clutter it up for the vast
15317 @c majority of people, who don't have anything that old.
15318 @c
15319 The repository format is compatible going back to
15320 @sc{cvs} 1.3. But see @ref{Watches Compatibility}, if
15321 you have copies of @sc{cvs} 1.6 or older and you want
15322 to use the optional developer communication features.
15323 @c If you "cvs rm" and commit using 1.3, then you'll
15324 @c want to run "rcs -sdead <file,v>" on each of the
15325 @c files in the Attic if you then want 1.5 and
15326 @c later to recognise those files as dead (I think the
15327 @c symptom if this is not done is that files reappear
15328 @c in joins). (Wait: the above will work but really to
15329 @c be strictly correct we should suggest checking
15330 @c in a new revision rather than just changing the
15331 @c state of the head revision, shouldn't we?).
15332 @c The old convert.sh script was for this, but it never
15333 @c did get updated to reflect use of the RCS "dead"
15334 @c state.
15335 @c Note: this is tricky to document without confusing
15336 @c people--need to carefully say what CVS version we
15337 @c are talking about and keep in mind the distinction
15338 @c between a
15339 @c repository created with 1.3 and on which one now
15340 @c uses 1.5+, and a repository on which one wants to
15341 @c use both versions side by side (e.g. during a
15342 @c transition period).
15343 @c Wait, can't CVS just detect the case in which a file
15344 @c is in the Attic but the head revision is not dead?
15345 @c Not sure whether this should produce a warning or
15346 @c something, and probably needs further thought, but
15347 @c it would appear that the situation can be detected.
15348 @c
15349 @c We might want to separate out the 1.3 compatibility
15350 @c section (for repository & working directory) from the
15351 @c rest--that might help avoid confusing people who
15352 @c are upgrading (for example) from 1.6 to 1.8.
15353 @c
15354 @c A minor incompatibility is if a current version of CVS
15355 @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
15356 @c see this as if there is no tag. Seems to me this is
15357 @c too obscure to mention.
15358
15359 The working directory format is compatible going back
15360 to @sc{cvs} 1.5. It did change between @sc{cvs} 1.3
15361 and @sc{cvs} 1.5. If you run @sc{cvs} 1.5 or newer on
15362 a working directory checked out with @sc{cvs} 1.3,
15363 @sc{cvs} will convert it, but to go back to @sc{cvs}
15364 1.3 you need to check out a new working directory with
15365 @sc{cvs} 1.3.
15366
15367 The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
15368 further (1.5 was the first official release with the remote protocol,
15369 but some older versions might still be floating around). In many
15370 cases you need to upgrade both the client and the server to take
15371 advantage of new features and bug fixes, however.
15372
15373 @c Perhaps should be saying something here about the
15374 @c "D" lines in Entries (written by CVS 1.9; 1.8 and
15375 @c older don't use them). These are supposed to be
15376 @c compatible in both directions, but I'm not sure
15377 @c they quite are 100%. One common gripe is if you
15378 @c "rm -r" a directory and 1.9 gets confused, as it
15379 @c still sees it in Entries. That one is fixed in
15380 @c (say) 1.9.6. Someone else reported problems with
15381 @c starting with a directory which was checked out with
15382 @c an old version, and then using a new version, and
15383 @c some "D" lines appeared, but not for every
15384 @c directory, causing some directories to be skipped.
15385 @c They weren't sure how to reproduce this, though.
15386
15387 @c ---------------------------------------------------------------------
15388 @node Troubleshooting
15389 @appendix Troubleshooting
15390
15391 If you are having trouble with @sc{cvs}, this appendix
15392 may help. If there is a particular error message which
15393 you are seeing, then you can look up the message
15394 alphabetically. If not, you can look through the
15395 section on other problems to see if your problem is
15396 mentioned there.
15397
15398 @menu
15399 * Error messages:: Partial list of CVS errors
15400 * Connection:: Trouble making a connection to a CVS server
15401 * Other problems:: Problems not readily listed by error message
15402 @end menu
15403
15404 @ignore
15405 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15406 @c @node Bad administrative files
15407 @appendixsec Bad administrative files
15408
15409 @c -- Give hints on how to fix them
15410 @end ignore
15411
15412 @node Error messages
15413 @appendixsec Partial list of error messages
15414
15415 Here is a partial list of error messages that you may
15416 see from @sc{cvs}. It is not a complete list---@sc{cvs}
15417 is capable of printing many, many error messages, often
15418 with parts of them supplied by the operating system,
15419 but the intention is to list the common and/or
15420 potentially confusing error messages.
15421
15422 The messages are alphabetical, but introductory text
15423 such as @samp{cvs update: } is not considered in
15424 ordering them.
15425
15426 In some cases the list includes messages printed by old
15427 versions of @sc{cvs} (partly because users may not be
15428 sure which version of @sc{cvs} they are using at any
15429 particular moment).
15430 @c If we want to start retiring messages, perhaps we
15431 @c should pick a cutoff version (for example, no more
15432 @c messages which are specific to versions before 1.9)
15433 @c and then move the old messages to an "old messages"
15434 @c node rather than deleting them completely.
15435
15436 @table @code
15437 @c FIXME: What is the correct way to format a multiline
15438 @c error message here? Maybe @table is the wrong
15439 @c choice? Texinfo gurus?
15440 @item @var{file}:@var{line}: Assertion '@var{text}' failed
15441 The exact format of this message may vary depending on
15442 your system. It indicates a bug in @sc{cvs}, which can
15443 be handled as described in @ref{BUGS}.
15444
15445 @item cvs @var{command}: authorization failed: server @var{host} rejected access
15446 This is a generic response when trying to connect to a
15447 pserver server which chooses not to provide a
15448 specific reason for denying authorization. Check that
15449 the username and password specified are correct and
15450 that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
15451 or @samp{--allow-root-regexp}
15452 in @file{inetd.conf}. See @ref{Password authenticated}.
15453
15454 @item cvs @var{command}: conflict: removed @var{file} was modified by second party
15455 This message indicates that you removed a file, and
15456 someone else modified it. To resolve the conflict,
15457 first run @samp{cvs add @var{file}}. If desired, look
15458 at the other party's modification to decide whether you
15459 still want to remove it. If you don't want to remove
15460 it, stop here. If you do want to remove it, proceed
15461 with @samp{cvs remove @var{file}} and commit your
15462 removal.
15463 @c Tests conflicts2-142b* in sanity.sh test for this.
15464
15465 @item cannot change permissions on temporary directory
15466 @example
15467 Operation not permitted
15468 @end example
15469 This message has been happening in a non-reproducible,
15470 occasional way when we run the client/server testsuite,
15471 both on Red Hat Linux 3.0.3 and 4.1. We haven't been
15472 able to figure out what causes it, nor is it known
15473 whether it is specific to Linux (or even to this
15474 particular machine!). If the problem does occur on
15475 other unices, @samp{Operation not permitted} would be
15476 likely to read @samp{Not owner} or whatever the system
15477 in question uses for the unix @code{EPERM} error. If
15478 you have any information to add, please let us know as
15479 described in @ref{BUGS}. If you experience this error
15480 while using @sc{cvs}, retrying the operation which
15481 produced it should work fine.
15482 @c This has been seen in a variety of tests, including
15483 @c multibranch-2, multibranch-5, and basic1-24-rm-rm,
15484 @c so it doesn't seem particularly specific to any one
15485 @c test.
15486
15487 @item cvs [server aborted]: Cannot check out files into the repository itself
15488 The obvious cause for this message (especially for
15489 non-client/server @sc{cvs}) is that the @sc{cvs} root
15490 is, for example, @file{/usr/local/cvsroot} and you try
15491 to check out files when you are in a subdirectory, such
15492 as @file{/usr/local/cvsroot/test}. However, there is a
15493 more subtle cause, which is that the temporary
15494 directory on the server is set to a subdirectory of the
15495 root (which is also not allowed). If this is the
15496 problem, set the temporary directory to somewhere else,
15497 for example @file{/var/tmp}; see @code{TMPDIR} in
15498 @ref{Environment variables}, for how to set the
15499 temporary directory.
15500
15501 @item cannot commit files as 'root'
15502 See @samp{'root' is not allowed to commit files}.
15503
15504 @c For one example see basica-1a10 in the testsuite
15505 @c For another example, "cvs co ." on NT; see comment
15506 @c at windows-NT/filesubr.c (expand_wild).
15507 @c For another example, "cvs co foo/bar" where foo exists.
15508 @item cannot open CVS/Entries for reading: No such file or directory
15509 This generally indicates a @sc{cvs} internal error, and
15510 can be handled as with other @sc{cvs} bugs
15511 (@pxref{BUGS}). Usually there is a workaround---the
15512 exact nature of which would depend on the situation but
15513 which hopefully could be figured out.
15514
15515 @c This is more obscure than it might sound; it only
15516 @c happens if you run "cvs init" from a directory which
15517 @c contains a CVS/Root file at the start.
15518 @item cvs [init aborted]: cannot open CVS/Root: No such file or directory
15519 This message is harmless. Provided it is not
15520 accompanied by other errors, the operation has
15521 completed successfully. This message should not occur
15522 with current versions of @sc{cvs}, but it is documented
15523 here for the benefit of @sc{cvs} 1.9 and older.
15524
15525 @item cvs server: cannot open /root/.cvsignore: Permission denied
15526 @itemx cvs [server aborted]: can't chdir(/root): Permission denied
15527 See @ref{Connection}.
15528
15529 @item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
15530 This message has been reported as intermittently
15531 happening with @sc{cvs} 1.9 on Solaris 2.5. The cause is
15532 unknown; if you know more about what causes it, let us
15533 know as described in @ref{BUGS}.
15534
15535 @item cvs [@var{command} aborted]: cannot start server via rcmd
15536 This, unfortunately, is a rather nonspecific error
15537 message which @sc{cvs} 1.9 will print if you are
15538 running the @sc{cvs} client and it is having trouble
15539 connecting to the server. Current versions of @sc{cvs}
15540 should print a much more specific error message. If
15541 you get this message when you didn't mean to run the
15542 client at all, you probably forgot to specify
15543 @code{:local:}, as described in @ref{Repository}.
15544
15545 @item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ
15546 @sc{cvs} 1.9 and older will print this message
15547 when trying to check in a binary file if
15548 @sc{rcs} is not correctly installed. Re-read the
15549 instructions that came with your @sc{rcs} distribution
15550 and the @sc{install} file in the @sc{cvs}
15551 distribution. Alternately, upgrade to a current
15552 version of @sc{cvs}, which checks in files itself
15553 rather than via @sc{rcs}.
15554
15555 @item cvs checkout: could not check out @var{file}
15556 With @sc{cvs} 1.9, this can mean that the @code{co} program
15557 (part of @sc{rcs}) returned a failure. It should be
15558 preceded by another error message, however it has been
15559 observed without another error message and the cause is
15560 not well-understood. With the current version of @sc{cvs},
15561 which does not run @code{co}, if this message occurs
15562 without another error message, it is definitely a @sc{cvs}
15563 bug (@pxref{BUGS}).
15564 @c My current suspicion is that the RCS in the rcs (not
15565 @c cvs/winnt/rcs57nt.zip) directory on the _Practical_
15566 @c CD is bad (remains to be confirmed).
15567 @c There is also a report of something which looks
15568 @c very similar on SGI, Irix 5.2, so I dunno.
15569
15570 @item cvs [login aborted]: could not find out home directory
15571 This means that you need to set the environment
15572 variables that @sc{cvs} uses to locate your home directory.
15573 See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in
15574 @ref{Environment variables}.
15575
15576 @item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory
15577 @sc{cvs} 1.9 and older will print this message if there was
15578 a problem finding the @code{rcsmerge} program. Make
15579 sure that it is in your @code{PATH}, or upgrade to a
15580 current version of @sc{cvs}, which does not require
15581 an external @code{rcsmerge} program.
15582
15583 @item cvs [update aborted]: could not patch @var{file}: No such file or directory
15584 This means that there was a problem finding the
15585 @code{patch} program. Make sure that it is in your
15586 @code{PATH}. Note that despite appearances the message
15587 is @emph{not} referring to whether it can find @var{file}.
15588 If both the client and the server are running a current
15589 version of @sc{cvs}, then there is no need for an
15590 external patch program and you should not see this
15591 message. But if either client or server is running
15592 @sc{cvs} 1.9, then you need @code{patch}.
15593
15594 @item cvs update: could not patch @var{file}; will refetch
15595 This means that for whatever reason the client was
15596 unable to apply a patch that the server sent. The
15597 message is nothing to be concerned about, because
15598 inability to apply the patch only slows things down and
15599 has no effect on what @sc{cvs} does.
15600 @c xref to update output. Or File status?
15601 @c Or some place else that
15602 @c explains this whole "patch"/P/Needs Patch thing?
15603
15604 @item dying gasps from @var{server} unexpected
15605 There is a known bug in the server for @sc{cvs} 1.9.18
15606 and older which can cause this. For me, this was
15607 reproducible if I used the @samp{-t} global option. It
15608 was fixed by Andy Piper's 14 Nov 1997 change to
15609 src/filesubr.c, if anyone is curious.
15610 If you see the message,
15611 you probably can just retry the operation which failed,
15612 or if you have discovered information concerning its
15613 cause, please let us know as described in @ref{BUGS}.
15614
15615 @item end of file from server (consult above messages if any)
15616 The most common cause for this message is if you are
15617 using an external @code{rsh} program and it exited with
15618 an error. In this case the @code{rsh} program should
15619 have printed a message, which will appear before the
15620 above message. For more information on setting up a
15621 @sc{cvs} client and server, see @ref{Remote repositories}.
15622
15623 @item cvs [update aborted]: EOF in key in RCS file @var{file},v
15624 @itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v
15625 This means that there is a syntax error in the given
15626 @sc{rcs} file. Note that this might be true even if @sc{rcs} can
15627 read the file OK; @sc{cvs} does more error checking of
15628 errors in the RCS file. That is why you may see this
15629 message when upgrading from @sc{cvs} 1.9 to @sc{cvs}
15630 1.10. The likely cause for the original corruption is
15631 hardware, the operating system, or the like. Of
15632 course, if you find a case in which @sc{cvs} seems to
15633 corrupting the file, by all means report it,
15634 (@pxref{BUGS}).
15635 There are quite a few variations of this error message,
15636 depending on exactly where in the @sc{rcs} file @sc{cvs}
15637 finds the syntax error.
15638
15639 @cindex mkmodules
15640 @item cvs commit: Executing 'mkmodules'
15641 This means that your repository is set up for a version
15642 of @sc{cvs} prior to @sc{cvs} 1.8. When using @sc{cvs}
15643 1.8 or later, the above message will be preceded by
15644
15645 @example
15646 cvs commit: Rebuilding administrative file database
15647 @end example
15648
15649 If you see both messages, the database is being rebuilt
15650 twice, which is unnecessary but harmless. If you wish
15651 to avoid the duplication, and you have no versions of
15652 @sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules}
15653 every place it appears in your @code{modules}
15654 file. For more information on the @code{modules} file,
15655 see @ref{modules}.
15656
15657 @c This message comes from "co", and I believe is
15658 @c possible only with older versions of CVS which call
15659 @c co. The problem with being able to create the bogus
15660 @c RCS file still exists, though (and I think maybe
15661 @c there is a different symptom(s) now).
15662 @c FIXME: Would be nice to have a more exact wording
15663 @c for this message.
15664 @item missing author
15665 Typically this can happen if you created an RCS file
15666 with your username set to empty. @sc{cvs} will, bogusly,
15667 create an illegal RCS file with no value for the author
15668 field. The solution is to make sure your username is
15669 set to a non-empty value and re-create the RCS file.
15670 @c "make sure your username is set" is complicated in
15671 @c and of itself, as there are the environment
15672 @c variables the system login name, &c, and it depends
15673 @c on the version of CVS.
15674
15675 @item cvs [checkout aborted]: no such tag @var{tag}
15676 This message means that @sc{cvs} isn't familiar with
15677 the tag @var{tag}. Usually the root cause is that you have
15678 mistyped a tag name. Ocassionally this can also occur because the
15679 users creating tags do not have permissions to write to the
15680 @file{CVSROOT/val-tags} file (@pxref{File permissions}, for more).
15681
15682 Prior to @sc{cvs} version 1.12.10, there were a few relatively
15683 obscure cases where a given tag could be created in an archive
15684 file in the repository but @sc{cvs} would require the user to
15685 @c Search sanity.sh for "no such tag" to see some of
15686 @c the relatively obscure cases.
15687 try a few other @sc{cvs} commands involving that tag
15688 until one was found whch caused @sc{cvs} to update
15689 @cindex CVSROOT/val-tags file, forcing tags into
15690 @cindex val-tags file, forcing tags into
15691 the @file{val-tags} file, at which point the originally failing command
15692 would begin to work. This same method can be used to repair a @file{val-tags}
15693 file that becomes out of date due to the permissions problem mentioned above.
15694 This updating is only required once per tag - once a tag is listed in
15695 @file{val-tags}, it stays there.
15696
15697 Note that using @samp{tag -f} to not require tag matches did not and
15698 does not override this check (@pxref{Common options}).
15699
15700 @item *PANIC* administration files missing
15701 This typically means that there is a directory named
15702 @sc{cvs} but it does not contain the administrative files
15703 which @sc{cvs} puts in a CVS directory. If the problem is
15704 that you created a CVS directory via some mechanism
15705 other than @sc{cvs}, then the answer is simple, use a name
15706 other than @sc{cvs}. If not, it indicates a @sc{cvs} bug
15707 (@pxref{BUGS}).
15708
15709 @item rcs error: Unknown option: -x,v/
15710 This message will be followed by a usage message for
15711 @sc{rcs}. It means that you have an old version of
15712 @sc{rcs} (probably supplied with your operating
15713 system), as well as an old version of @sc{cvs}.
15714 @sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and
15715 later; current versions of @sc{cvs} do not run @sc{rcs} programs.
15716 @c For more information on installing @sc{cvs}, see
15717 @c (FIXME: where? it depends on whether you are
15718 @c getting binaries or sources or what).
15719 @c The message can also say "ci error" or something
15720 @c instead of "rcs error", I suspect.
15721
15722 @item cvs [server aborted]: received broken pipe signal
15723 This message can be caused by a loginfo program that fails to
15724 read all of the log information from its standard input.
15725 If you find it happening in any other circumstances,
15726 please let us know as described in @ref{BUGS}.
15727
15728 @item 'root' is not allowed to commit files
15729 When committing a permanent change, @sc{cvs} makes a log entry of
15730 who committed the change. If you are committing the change logged
15731 in as "root" (not under "su" or other root-priv giving program),
15732 @sc{cvs} cannot determine who is actually making the change.
15733 As such, by default, @sc{cvs} disallows changes to be committed by users
15734 logged in as "root". (You can disable this option by passing the
15735 @code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}.
15736 On some systems this means editing the appropriate @file{config.h} file
15737 before building @sc{cvs}.)
15738
15739 @item cvs [server aborted]: Secondary out of sync with primary!
15740
15741 This usually means that the version of @sc{cvs} running on a secondary
15742 server is incompatible with the version running on the primary server
15743 (@pxref{Write proxies}).
15744 This will not occur if the client supports redirection.
15745
15746 It is not the version number that is significant here, but the list of
15747 supported requests that the servers provide to the client.
15748 For example, even if both servers were the same version,
15749 if the secondary was compiled with GSSAPI support and the primary was not,
15750 the list of supported requests provided by the two servers
15751 would be different and the secondary would not work as a transparent
15752 proxy to the primary.
15753 Conversely, even if the two servers were radically different versions
15754 but both provided the same list of valid requests to the client,
15755 the transparent proxy would succeed.
15756
15757 @item Terminated with fatal signal 11
15758 This message usually indicates that @sc{cvs} (the server, if you're
15759 using client/server mode) has run out of (virtual) memory.
15760 Although @sc{cvs} tries to catch the error and issue a more meaningful
15761 message, there are many circumstances where that is not possible.
15762 If you appear to have lots of memory available to the system,
15763 the problem is most likely that you're running into a system-wide
15764 limit on the amount of memory a single process can use or a
15765 similar process-specific limit.
15766 The mechanisms for displaying and setting such limits vary from
15767 system to system, so you'll have to consult an expert for your
15768 particular system if you don't know how to do that.
15769
15770 @item Too many arguments!
15771 This message is typically printed by the @file{log.pl}
15772 script which is in the @file{contrib} directory in the
15773 @sc{cvs} source distribution. In some versions of
15774 @sc{cvs}, @file{log.pl} has been part of the default
15775 @sc{cvs} installation. The @file{log.pl} script gets
15776 called from the @file{loginfo} administrative file.
15777 Check that the arguments passed in @file{loginfo} match
15778 what your version of @file{log.pl} expects. In
15779 particular, the @file{log.pl} from @sc{cvs} 1.3 and
15780 older expects the log file as an argument whereas the
15781 @file{log.pl} from @sc{cvs} 1.5 and newer expects the
15782 log file to be specified with a @samp{-f} option. Of
15783 course, if you don't need @file{log.pl} you can just
15784 comment it out of @file{loginfo}.
15785
15786 @item cvs [update aborted]: unexpected EOF reading @var{file},v
15787 See @samp{EOF in key in RCS file}.
15788
15789 @item cvs [login aborted]: unrecognized auth response from @var{server}
15790 This message typically means that the server is not set
15791 up properly. For example, if @file{inetd.conf} points
15792 to a nonexistent cvs executable. To debug it further,
15793 find the log file which inetd writes
15794 (@file{/var/log/messages} or whatever inetd uses on
15795 your system). For details, see @ref{Connection}, and
15796 @ref{Password authentication server}.
15797
15798 @item cvs commit: Up-to-date check failed for `@var{file}'
15799 This means that someone else has committed a change to
15800 that file since the last time that you did a @code{cvs
15801 update}. So before proceeding with your @code{cvs
15802 commit} you need to @code{cvs update}. @sc{cvs} will merge
15803 the changes that you made and the changes that the
15804 other person made. If it does not detect any conflicts
15805 it will report @samp{M @var{file}} and you are ready
15806 to @code{cvs commit}. If it detects conflicts it will
15807 print a message saying so, will report @samp{C @var{file}},
15808 and you need to manually resolve the
15809 conflict. For more details on this process see
15810 @ref{Conflicts example}.
15811
15812 @item Usage: diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3
15813 @example
15814 Only one of [exEX3] allowed
15815 @end example
15816 This indicates a problem with the installation of
15817 @code{diff3} and @code{rcsmerge}. Specifically
15818 @code{rcsmerge} was compiled to look for GNU diff3, but
15819 it is finding unix diff3 instead. The exact text of
15820 the message will vary depending on the system. The
15821 simplest solution is to upgrade to a current version of
15822 @sc{cvs}, which does not rely on external
15823 @code{rcsmerge} or @code{diff3} programs.
15824
15825 @item warning: unrecognized response `@var{text}' from cvs server
15826 If @var{text} contains a valid response (such as
15827 @samp{ok}) followed by an extra carriage return
15828 character (on many systems this will cause the second
15829 part of the message to overwrite the first part), then
15830 it probably means that you are using the @samp{:ext:}
15831 access method with a version of rsh, such as most
15832 non-unix rsh versions, which does not by default
15833 provide a transparent data stream. In such cases you
15834 probably want to try @samp{:server:} instead of
15835 @samp{:ext:}. If @var{text} is something else, this
15836 may signify a problem with your @sc{cvs} server.
15837 Double-check your installation against the instructions
15838 for setting up the @sc{cvs} server.
15839 @c FIXCVS: should be printing CR as \r or \015 or some
15840 @c such, probably.
15841
15842 @item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory}
15843 This is a normal message, not an error. See
15844 @ref{Concurrency}, for more details.
15845
15846 @item cvs commit: warning: editor session failed
15847 @cindex Exit status, of editor
15848 This means that the editor which @sc{cvs} is using exits with a nonzero
15849 exit status. Some versions of vi will do this even when there was not
15850 a problem editing the file. If so, point the
15851 @code{CVSEDITOR} environment variable to a small script
15852 such as:
15853
15854 @example
15855 #!/bin/sh
15856 vi $*
15857 exit 0
15858 @end example
15859
15860 @item cvs update: warning: @var{file} was lost
15861 This means that the working copy of @var{file} has been deleted
15862 but it has not been removed from @sc{cvs}.
15863 This is nothing to be concerned about,
15864 the update will just recreate the local file from the repository.
15865 (This is a convenient way to discard local changes to a file:
15866 just delete it and then run @code{cvs update}.)
15867
15868 @item cvs update: warning: @var{file} is not (any longer) pertinent
15869 This means that the working copy of @var{file} has been deleted,
15870 it has not been removed from @sc{cvs} in the current working directory,
15871 but it has been removed from @sc{cvs} in some other working directory.
15872 This is nothing to be concerned about,
15873 the update would have removed the local file anyway.
15874
15875 @end table
15876
15877 @node Connection
15878 @appendixsec Trouble making a connection to a CVS server
15879
15880 This section concerns what to do if you are having
15881 trouble making a connection to a @sc{cvs} server. If
15882 you are running the @sc{cvs} command line client
15883 running on Windows, first upgrade the client to
15884 @sc{cvs} 1.9.12 or later. The error reporting in
15885 earlier versions provided much less information about
15886 what the problem was. If the client is non-Windows,
15887 @sc{cvs} 1.9 should be fine.
15888
15889 If the error messages are not sufficient to track down
15890 the problem, the next steps depend largely on which
15891 access method you are using.
15892
15893 @table @code
15894 @cindex ext method, troubleshooting
15895 @item :ext:
15896 Try running the rsh program from the command line. For
15897 example: "rsh servername cvs -v" should print @sc{cvs}
15898 version information. If this doesn't work, you need to
15899 fix it before you can worry about @sc{cvs} problems.
15900
15901 @cindex server method, troubleshooting
15902 @item :server:
15903 You don't need a command line rsh program to use this
15904 access method, but if you have an rsh program around,
15905 it may be useful as a debugging tool. Follow the
15906 directions given for :ext:.
15907
15908 @cindex pserver method, troubleshooting
15909 @item :pserver:
15910 Errors along the lines of "connection refused" typically indicate
15911 that inetd isn't even listening for connections on port 2401
15912 whereas errors like "connection reset by peer",
15913 "received broken pipe signal", "recv() from server: EOF",
15914 or "end of file from server"
15915 typically indicate that inetd is listening for
15916 connections but is unable to start @sc{cvs} (this is frequently
15917 caused by having an incorrect path in @file{inetd.conf}
15918 or by firewall software rejecting the connection).
15919 "unrecognized auth response" errors are caused by a bad command
15920 line in @file{inetd.conf}, typically an invalid option or forgetting
15921 to put the @samp{pserver} command at the end of the line.
15922 Another less common problem is invisible control characters that
15923 your editor "helpfully" added without you noticing.
15924
15925 One good debugging tool is to "telnet servername
15926 2401". After connecting, send any text (for example
15927 "foo" followed by return). If @sc{cvs} is working
15928 correctly, it will respond with
15929
15930 @example
15931 cvs [pserver aborted]: bad auth protocol start: foo
15932 @end example
15933
15934 If instead you get:
15935
15936 @example
15937 Usage: cvs [cvs-options] command [command-options-and-arguments]
15938 ...
15939 @end example
15940
15941 @noindent
15942 then you're missing the @samp{pserver} command at the end of the
15943 line in @file{inetd.conf}; check to make sure that the entire command
15944 is on one line and that it's complete.
15945
15946 Likewise, if you get something like:
15947
15948 @example
15949 Unknown command: `pserved'
15950
15951 CVS commands are:
15952 add Add a new file/directory to the repository
15953 ...
15954 @end example
15955
15956 @noindent
15957 then you've misspelled @samp{pserver} in some way. If it isn't
15958 obvious, check for invisible control characters (particularly
15959 carriage returns) in @file{inetd.conf}.
15960
15961 If it fails to work at all, then make sure inetd is working
15962 right. Change the invocation in @file{inetd.conf} to run the
15963 echo program instead of cvs. For example:
15964
15965 @example
15966 2401 stream tcp nowait root /bin/echo echo hello
15967 @end example
15968
15969 After making that change and instructing inetd to
15970 re-read its configuration file, "telnet servername
15971 2401" should show you the text hello and then the
15972 server should close the connection. If this doesn't
15973 work, you need to fix it before you can worry about
15974 @sc{cvs} problems.
15975
15976 On AIX systems, the system will often have its own
15977 program trying to use port 2401. This is AIX's problem
15978 in the sense that port 2401 is registered for use with
15979 @sc{cvs}. I hear that there is an AIX patch available
15980 to address this problem.
15981
15982 Another good debugging tool is the @samp{-d}
15983 (debugging) option to inetd. Consult your system
15984 documentation for more information.
15985
15986 If you seem to be connecting but get errors like:
15987
15988 @example
15989 cvs server: cannot open /root/.cvsignore: Permission denied
15990 cvs [server aborted]: can't chdir(/root): Permission denied
15991 @end example
15992
15993 @noindent
15994 then you probably haven't specified @samp{-f} in @file{inetd.conf}.
15995 (In releases prior to @sc{cvs} 1.11.1, this problem can be caused by
15996 your system setting the @code{$HOME} environment variable
15997 for programs being run by inetd. In this case, you can either
15998 have inetd run a shell script that unsets @code{$HOME} and then runs
15999 @sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine
16000 environment.)
16001
16002 If you can connect successfully for a while but then can't,
16003 you've probably hit inetd's rate limit.
16004 (If inetd receives too many requests for the same service
16005 in a short period of time, it assumes that something is wrong
16006 and temporarily disables the service.)
16007 Check your inetd documentation to find out how to adjust the
16008 rate limit (some versions of inetd have a single rate limit,
16009 others allow you to set the limit for each service separately.)
16010 @end table
16011
16012 @node Other problems
16013 @appendixsec Other common problems
16014
16015 Here is a list of problems which do not fit into the
16016 above categories. They are in no particular order.
16017
16018 @itemize @bullet
16019 @item
16020 On Windows, if there is a 30 second or so delay when
16021 you run a @sc{cvs} command, it may mean that you have
16022 your home directory set to @file{C:/}, for example (see
16023 @code{HOMEDRIVE} and @code{HOMEPATH} in
16024 @ref{Environment variables}). @sc{cvs} expects the home
16025 directory to not end in a slash, for example @file{C:}
16026 or @file{C:\cvs}.
16027 @c FIXCVS: CVS should at least detect this and print an
16028 @c error, presumably.
16029
16030 @item
16031 If you are running @sc{cvs} 1.9.18 or older, and
16032 @code{cvs update} finds a conflict and tries to
16033 merge, as described in @ref{Conflicts example}, but
16034 doesn't tell you there were conflicts, then you may
16035 have an old version of @sc{rcs}. The easiest solution
16036 probably is to upgrade to a current version of
16037 @sc{cvs}, which does not rely on external @sc{rcs}
16038 programs.
16039 @end itemize
16040
16041 @c ---------------------------------------------------------------------
16042 @node Credits
16043 @appendix Credits
16044
16045 @cindex Contributors (manual)
16046 @cindex Credits (manual)
16047 Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}>
16048 wrote the manual pages which were distributed with
16049 @sc{cvs} 1.3. Much of their text was copied into this
16050 manual. He also read an early draft
16051 of this manual and contributed many ideas and
16052 corrections.
16053
16054 The mailing-list @code{info-cvs} is sometimes
16055 informative. I have included information from postings
16056 made by the following persons:
16057 David G. Grubbs <@t{dgg@@think.com}>.
16058
16059 Some text has been extracted from the man pages for
16060 @sc{rcs}.
16061
16062 The @sc{cvs} @sc{faq} by David G. Grubbs has provided
16063 useful material. The @sc{faq} is no longer maintained,
16064 however, and this manual is about the closest thing there
16065 is to a successor (with respect to documenting how to
16066 use @sc{cvs}, at least).
16067
16068 In addition, the following persons have helped by
16069 telling me about mistakes I've made:
16070
16071 @display
16072 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
16073 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
16074 Karl Pingle <@t{pingle@@acuson.com}>,
16075 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
16076 Inge Wallin <@t{ingwa@@signum.se}>,
16077 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
16078 and Michael Brown <@t{brown@@wi.extrel.com}>.
16079 @end display
16080
16081 The list of contributors here is not comprehensive; for a more
16082 complete list of who has contributed to this manual see
16083 the file @file{doc/ChangeLog} in the @sc{cvs} source
16084 distribution.
16085
16086 MirBSD is the de-facto (if not de-iure yet) new upstream of
16087 @sc{gnu} @sc{cvs} since 2012 or so; this version is provided
16088 in Debian as well. Responsible is:
16089
16090 @display
16091 mirabilos <@t{m@@mirbsd.org}>
16092 @end display
16093
16094 CVS Homepage: @url{http://www.nongnu.org/cvs/}
16095
16096 @c ---------------------------------------------------------------------
16097 @node BUGS
16098 @appendix Dealing with bugs in CVS or this manual
16099
16100 @cindex Bugs in this manual or CVS
16101 Neither @sc{cvs} nor this manual is perfect, and they
16102 probably never will be. If you are having trouble
16103 using @sc{cvs}, or think you have found a bug, there
16104 are a number of things you can do about it. Note that
16105 if the manual is unclear, that can be considered a bug
16106 in the manual, so these problems are often worth doing
16107 something about as well as problems with @sc{cvs} itself.
16108
16109 @cindex Reporting bugs
16110 @cindex Bugs, reporting
16111 @cindex Errors, reporting
16112 @itemize @bullet
16113 @item
16114 If you want someone to help you and fix bugs that you
16115 report, there are companies which will do that for a
16116 fee. One such company is:
16117
16118 @cindex Ximbiot
16119 @cindex Support, getting CVS support
16120 @example
16121 Ximbiot
16122 319 S. River St.
16123 Harrisburg, PA 17104-1657
16124 USA
16125 Email: info@@ximbiot.com
16126 Phone: (717) 579-6168
16127 Fax: (717) 234-3125
16128 @url{http://ximbiot.com/}
16129
16130 @end example
16131
16132 @item
16133 If you got @sc{cvs} through a distributor, such as an
16134 operating system vendor or a vendor of freeware
16135 @sc{cd-rom}s, you may wish to see whether the
16136 distributor provides support. Often, they will provide
16137 no support or minimal support, but this may vary from
16138 distributor to distributor.
16139
16140 @item
16141 If you have the skills and time to do so, you may wish
16142 to fix the bug yourself. If you wish to submit your
16143 fix for inclusion in future releases of @sc{cvs}, see
16144 the file @sc{hacking} in the @sc{cvs} source
16145 distribution. It contains much more information on the
16146 process of submitting fixes.
16147
16148 @item
16149 There may be resources on the net which can help. A
16150 good place to start is:
16151
16152 @example
16153 @url{http://cvs.nongnu.org/}
16154 @end example
16155
16156 If you are so inspired, increasing the information
16157 available on the net is likely to be appreciated. For
16158 example, before the standard @sc{cvs} distribution
16159 worked on Windows 95, there was a web page with some
16160 explanation and patches for running @sc{cvs} on Windows
16161 95, and various people helped out by mentioning this
16162 page on mailing lists or newsgroups when the subject
16163 came up.
16164
16165 @item
16166 It is also possible to report bugs to @email{bug-cvs@@nongnu.org}.
16167 Note that someone may or may not want to do anything
16168 with your bug report---if you need a solution consider
16169 one of the options mentioned above. People probably do
16170 want to hear about bugs which are particularly severe
16171 in consequences and/or easy to fix, however. You can
16172 also increase your odds by being as clear as possible
16173 about the exact nature of the bug and any other
16174 relevant information. The way to report bugs is to
16175 send email to @email{bug-cvs@@nongnu.org}. Note
16176 that submissions to @email{bug-cvs@@nongnu.org} may be distributed
16177 under the terms of the @sc{gnu} General Public License, so if
16178 you don't like this, don't submit them. There is
16179 usually no justification for sending mail directly to
16180 one of the @sc{cvs} maintainers rather than to
16181 @email{bug-cvs@@nongnu.org}; those maintainers who want to hear
16182 about such bug reports read @email{bug-cvs@@nongnu.org}. Also note
16183 that sending a bug report to other mailing lists or
16184 newsgroups is @emph{not} a substitute for sending it to
16185 @email{bug-cvs@@nongnu.org}. It is fine to discuss @sc{cvs} bugs on
16186 whatever forum you prefer, but there are not
16187 necessarily any maintainers reading bug reports sent
16188 anywhere except @email{bug-cvs@@nongnu.org}.
16189 @end itemize
16190
16191 @cindex Known bugs in this manual or CVS
16192 People often ask if there is a list of known bugs or
16193 whether a particular bug is a known one. The file
16194 @sc{bugs} in the @sc{cvs} source distribution is one
16195 list of known bugs, but it doesn't necessarily try to
16196 be comprehensive. Perhaps there will never be a
16197 comprehensive, detailed list of known bugs.
16198
16199 @c ---------------------------------------------------------------------
16200 @node CVS command list
16201 @appendix Alphabetical list of all CVS commands
16202
16203 @xref{Cederqvist, the introduction into the manual, CVS manual Table of Contents}.
16204
16205 @menu
16206 * add:: Add a new file/directory to the repository
16207 * admin:: Administration front-end for RCS
16208 * annotate:: Show last revision where each line was modified
16209 * checkout:: Checkout sources for editing
16210 * commit:: Check files into the repository
16211 * diff:: Show differences between revisions
16212 * edit:: Get ready to edit a watched file
16213 * editors:: See who is editing a watched file
16214 * export:: Export sources from CVS, similar to checkout
16215 * history:: Show repository access history
16216 * import:: Import sources into CVS, using vendor branches
16217 * init:: Create a CVS repository
16218 * kserver:: Act in Kerberos server mode
16219 * log:: Print out history information for files
16220 * login:: Prompt for password for authenticating server
16221 * logout:: Removes entry in .cvspass for remote repository
16222 * ls:: List files available from CVS
16223 * pserver:: Act in password server mode
16224 * rannotate:: Show last revision where each line of module was modified
16225 * rdiff:: Create 'patch' format diffs between revisions
16226 * release:: Indicate that a work subdirectory is no longer in use
16227 * remove:: Remove an entry from the repository
16228 * rlog:: Print out history information for a module
16229 * rls:: List files in a module
16230 * rtag:: Add a symbolic tag to a module
16231 * server:: Act in server mode
16232 * suck:: Download RCS ,v file raw
16233 * status:: Display status information on checked out files
16234 * tag:: Add a symbolic tag to checked out version of files
16235 * unedit:: Undo an edit command
16236 * update:: Bring work tree in sync with repository
16237 * version:: Show current CVS version(s)
16238 * watch:: Set watches
16239 * watchers:: See who is watching a file
16240 @end menu
16241
16242 @c ---------------------------------------------------------------------
16243 @node Index
16244 @unnumbered Index
16245 @cindex Index
16246
16247 @printindex cp
16248
16249 @bye
16250
16251 Local Variables:
16252 fill-column: 55
16253 End: