]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/doc/cvs.texinfo
Import of slightly trimmed cvs-1.8 distribution. Generated files
[FreeBSD/FreeBSD.git] / contrib / cvs / doc / cvs.texinfo
1 \input texinfo  @c -*-texinfo-*-
2 @comment cvs.texinfo,v 1.6 1995/10/12 23:39:26 kfogel Exp
3 @comment Documentation for CVS.
4 @comment Copyright (C) 1992, 1993 Signum Support AB
5 @comment Copyright (C) 1993 Free Software Foundation, Inc.
6
7 @comment This file is part of the CVS distribution.
8
9 @comment CVS is free software; you can redistribute it and/or modify
10 @comment it under the terms of the GNU General Public License as published by
11 @comment the Free Software Foundation; either version 1, or (at your option)
12 @comment any later version.
13
14 @comment CVS is distributed in the hope that it will be useful,
15 @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
16 @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 @comment GNU General Public License for more details.
18
19 @comment You should have received a copy of the GNU General Public License
20 @comment along with CVS; see the file COPYING.  If not, write to
21 @comment the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 @afourpaper
24 @setfilename cvs.info
25 @include CVSvn.texi
26 @settitle CVS---Concurrent Versions System
27 @setchapternewpage odd
28
29 @c -- TODO list:
30 @c -- Fix all lines that match "^@c -- "
31 @c -- Document how CVS finds the binaries it executes.
32 @c Things to include in the index:
33 @c Finding RCS binaries
34 @c Path to RCS binaries
35 @c RCS, how CVS finds them
36 @c s/RCS/diff/
37 @c -- More on binary files
38
39 @ifinfo
40 Copyright @copyright{} 1992, 1993 Signum Support AB
41 Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc.
42
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 @ignore
48 Permission is granted to process this file through Tex and print the
49 results, provided the printed document carries copying permission
50 notice identical to this one except for the removal of this paragraph
51 (this paragraph not being relevant to the printed manual).
52
53 @end ignore
54 Permission is granted to copy and distribute modified versions of this
55 manual under the conditions for verbatim copying, provided also that the
56 section entitled ``GNU General Public License'' is included exactly as
57 in the original, and provided that the entire resulting derived work is
58 distributed under the terms of a permission notice identical to this one.
59
60 Permission is granted to copy and distribute translations of this manual
61 into another language, under the above conditions for modified versions,
62 except that the section entitled ``GNU General Public License'' and
63 this permission notice may be included in translations approved by the
64 Free Software Foundation instead of in the original English.
65 @end ifinfo
66
67 @comment The titlepage section does not appear in the Info file.
68 @titlepage
69 @sp 4
70 @comment The title is printed in a large font.
71 @center @titlefont{Version Management}
72 @sp
73 @center @titlefont{with}
74 @sp
75 @center @titlefont{CVS}
76 @sp 2
77 @center for @sc{cvs} @value{CVSVN}
78 @comment -release-
79 @sp 3
80 @center Per Cederqvist et al
81
82 @comment  The following two commands start the copyright page
83 @comment  for the printed manual.  This will not appear in the Info file.
84 @page
85 @vskip 0pt plus 1filll
86 Copyright @copyright{} 1992, 1993 Signum Support AB
87
88 Permission is granted to make and distribute verbatim copies of
89 this manual provided the copyright notice and this permission notice
90 are preserved on all copies.
91
92 Permission is granted to copy and distribute modified versions of this
93 manual under the conditions for verbatim copying, provided also that the
94 section entitled ``GNU General Public License'' is included exactly as
95 in the original, and provided that the entire resulting derived work is
96 distributed under the terms of a permission notice identical to this one.
97
98 Permission is granted to copy and distribute translations of this manual
99 into another language, under the above conditions for modified versions,
100 except that the section entitled ``GNU General Public License'' and
101 this permission notice may be included in translations approved by the
102 Free Software Foundation instead of in the original English.
103 @end titlepage
104
105 @comment ================================================================
106 @comment                   The real text starts here
107 @comment ================================================================
108
109 @ifinfo
110 @c ---------------------------------------------------------------------
111 @node    Top
112 @top 
113 @c Note: there is a space after that @top command.
114 @c The texinfo-format-buffer Emacs function and
115 @c the makeinfo shell command disagree on what arguments
116 @c @top takes; @top followed by a single space is
117 @c something they can both cope with.
118
119 This info manual describes how to use and administer
120 @sc{cvs} version @value{CVSVN}.
121 @end ifinfo
122
123 @menu
124 * Preface::                     About this manual
125 * What is CVS?::                What is CVS?
126 * Basic concepts::              Basic concepts of revision management
127 * A sample session::            A tour of basic CVS usage
128 * Repository::                  Where all your sources are stored
129 * Starting a new project::      Starting a project with CVS
130 * Multiple developers::         How CVS helps a group of developers
131 * Branches::                    Parallel development explained
132 * Merging::                     How to move changes between branches
133 * Recursive behavior::          CVS descends directories
134 * Adding files::                Adding files to a module
135 * Removing files::              Removing files from a module
136 * Tracking sources::            Tracking third-party sources
137 * Moving files::                Moving and renaming files
138 * Moving directories::          Moving and renaming directories
139 * History browsing::            Viewing the history of files in various ways
140 * Keyword substitution::        CVS can include the revision inside the file
141 * Binary files::                CVS can handle binary files
142 * Revision management::         Policy questions for revision management
143 * Invoking CVS::                Reference manual for CVS commands
144 * Administrative files::        Reference manual for the Administrative files
145 * Environment variables::       All environment variables which affect CVS
146 * Troubleshooting::             Some tips when nothing works
147 * Copying::                     GNU GENERAL PUBLIC LICENSE
148 * Index::                       Index
149 @end menu
150
151 @c ---------------------------------------------------------------------
152 @node Preface
153 @unnumbered About this manual
154 @cindex Preface
155 @cindex About this manual
156
157 Up to this point, one of the weakest parts of @sc{cvs}
158 has been the documentation.  @sc{cvs} is a complex
159 program.  Previous versions of the manual were written
160 in the manual page format, which is not really well
161 suited for such a complex program.
162
163 When writing this manual, I had several goals in mind:
164
165 @itemize @bullet
166 @item
167 No knowledge of @sc{rcs} should be necessary.
168
169 @item
170 No previous knowledge of revision control software
171 should be necessary.  All terms, such as @dfn{revision
172 numbers}, @dfn{revision trees} and @dfn{merging} are
173 explained as they are introduced.
174
175 @item
176 The manual should concentrate on the things @sc{cvs} users
177 want to do, instead of what the @sc{cvs} commands can do.
178 The first part of this manual leads you through things
179 you might want to do while doing development, and
180 introduces the relevant @sc{cvs} commands as they are
181 needed.
182
183 @item
184 Information should be easy to find.  In the reference
185 manual in the appendices almost all information about
186 every @sc{cvs} command is gathered together.  There is also
187 an extensive index, and a lot of cross references.
188 @end itemize
189
190 @cindex Signum Support
191 @cindex Support, getting CVS support
192 This manual was contributed by Signum Support AB in
193 Sweden.  Signum is yet another in the growing list of
194 companies that support free software.  You are free to
195 copy both this manual and the @sc{cvs} program.
196 @xref{Copying}, for the details.  Signum Support offers
197 @c -- Check this reference! It has been bogus in the past.
198 support contracts and binary distribution for many
199 programs, such as @sc{cvs}, @sc{gnu} Emacs, the
200 @sc{gnu} C compiler and others.  Write to us for
201 more information.
202
203 @example
204 Signum Support AB
205 Box 2044
206 S-580 02  Linkoping
207 Sweden
208
209 Email: info@@signum.se
210 Phone: +46 (0)13 - 21 46 00
211 Fax:   +46 (0)13 - 21 47 00
212 @end example
213
214 Another company selling support for @sc{cvs} is Cyclic
215 Software, web: @code{http://www.cyclic.com/}, email:
216 @code{info@@cyclic.com}.
217
218 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
219 @menu
220 * Checklist::                   
221 * Credits::                     
222 * BUGS::                        
223 @end menu
224
225 @node Checklist
226 @unnumberedsec Checklist for the impatient reader
227
228 @sc{cvs} is a complex system.  You will need to read
229 the manual to be able to use all of its capabilities.
230 There are dangers that can easily be avoided if you
231 know about them, and this manual tries to warn you
232 about them.  This checklist is intended to help you
233 avoid the dangers without reading the entire manual.
234 If you intend to read the entire manual you can skip
235 this table.
236
237 @table @asis
238 @item Binary files
239 @sc{cvs} can handle binary files, but
240 you must have @sc{rcs} release 5.5 or later and
241 a release of @sc{gnu} diff that supports the @samp{-a}
242 flag (release 1.15 and later are OK).  You must also
243 configure both @sc{rcs} and @sc{cvs} to handle binary
244 files when you install them.
245
246 Keword substitution can be a source of trouble with
247 binary files. @xref{Keyword substitution}, for
248 solutions.
249
250 @item The @code{admin} command
251 Uncareful use of the @code{admin} command can cause
252 @sc{cvs} to cease working.  @xref{admin}, before trying
253 to use it.
254 @end table
255
256 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
257 @node Credits
258 @unnumberedsec Credits
259
260 @cindex Contributors (manual)
261 @cindex Credits (manual)
262 Roland Pesch, Cygnus Support <@t{pesch@@cygnus.com}>
263 wrote the manual pages which were distributed with
264 @sc{cvs} 1.3.  Appendix A and B contain much text that
265 was extracted from them.  He also read an early draft
266 of this manual and contributed many ideas and
267 corrections.
268
269 The mailing-list @code{info-cvs} is sometimes
270 informative. I have included information from postings
271 made by the following persons:
272 David G. Grubbs <@t{dgg@@think.com}>.
273
274 Some text has been extracted from the man pages for
275 @sc{rcs}.
276
277 The @sc{cvs} @sc{faq} (@pxref{What is CVS?}) by David
278 G. Grubbs has been used as a check-list to make sure
279 that this manual is as complete as possible.  (This
280 manual does however not include all of the material in
281 the @sc{faq}).  The @sc{faq} contains a lot of useful
282 information.
283
284 In addition, the following persons have helped by
285 telling me about mistakes I've made:
286 Roxanne Brunskill <@t{rbrunski@@datap.ca}>,
287 Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>,
288 Karl Pingle <@t{pingle@@acuson.com}>,
289 Thomas A Peterson <@t{tap@@src.honeywell.com}>,
290 Inge Wallin <@t{ingwa@@signum.se}>,
291 Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}>
292 and Michael Brown <@t{brown@@wi.extrel.com}>.
293
294 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
295 @node BUGS
296 @unnumberedsec BUGS
297
298 @cindex Bugs, known in this manual
299 @cindex Known bugs in this manual
300 This manual is known to have room for improvement.
301 Here is a list of known deficiencies:
302
303 @itemize @bullet
304 @item
305 In the examples, the output from @sc{cvs} is sometimes
306 displayed, sometimes not.
307
308 @item
309 The input that you are supposed to type in the examples
310 should have a different font than the output from the
311 computer.
312
313 @item
314 This manual should be clearer about what file
315 permissions you should set up in the repository, and
316 about setuid/setgid.
317
318 @item
319 Some of the chapters are not yet complete.  They are
320 noted by comments in the @file{cvs.texinfo} file.
321
322 @item
323 @cindex Reporting bugs (manual)
324 @cindex Bugs, reporting (manual)
325 @cindex Errors, reporting (manual)
326 This list is not complete.  If you notice any error,
327 omission, or something that is unclear, please send
328 mail to @t{bug-cvs@@prep.ai.mit.edu}.
329 @end itemize
330
331 I hope that you will find this manual useful, despite
332 the above-mentioned shortcomings.
333
334 @flushright
335
336 Linkoping, October 1993
337 Per Cederqvist
338 @end flushright
339
340 @c ---------------------------------------------------------------------
341 @node What is CVS?
342 @chapter What is CVS?
343 @cindex What is CVS?
344 @cindex Introduction to CVS
345 @cindex CVS, introduction to
346
347 @sc{cvs} is a version control system.  Using it, you can
348 record the history of your source files.
349
350 @c -- ///
351 @c -- ///Those who cannot remember the past are condemned to repeat it.
352 @c -- ///               -- George Santayana
353 @c -- //////
354
355 @c -- Insert history  quote here!
356 For example, bugs sometimes creep in when
357 software is modified, and you might not detect the bug
358 until a long time after you make the modification.
359 With @sc{cvs}, you can easily retrieve old versions to see
360 exactly which change caused the bug.  This can
361 sometimes be a big help.
362
363 You could of course save every version of every file
364 you have ever created.  This would
365 however waste an enormous amount of disk space.  @sc{cvs}
366 stores all the versions of a file in a single file in a
367 clever way that only stores the differences between
368 versions.
369
370 @sc{cvs} also helps you if you are part of a group of people working
371 on the same project.  It is all too easy to overwrite
372 each others' changes unless you are extremely careful.
373 Some editors, like @sc{gnu} Emacs, try to make sure that
374 the same file is never modified by two people at the
375 same time.  Unfortunately, if someone is using another
376 editor, that safeguard will not work.  @sc{cvs} solves this problem
377 by insulating the different developers from each other.  Every
378 developer works in his own directory, and @sc{cvs} merges
379 the work when each developer is done.
380
381 @cindex History of CVS
382 @cindex CVS, history of
383 @cindex Credits (CVS program)
384 @cindex Contributors (CVS program)
385 @sc{cvs} started out as a bunch of shell scripts written by
386 Dick Grune, posted to @code{comp.sources.unix} in the volume 6
387 release of December, 1986.  While no actual code from
388 these shell scripts is present in the current version
389 of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
390 come from them.
391
392 In April, 1989, Brian Berliner designed and coded @sc{cvs}.
393 Jeff Polk later helped Brian with the design of the @sc{cvs}
394 module and vendor branch support.
395
396 @cindex Source, getting CVS source
397 You can get @sc{cvs} via anonymous ftp from a number of
398 sites, for instance @t{prep.ai.mit.edu} in
399 @file{pub/gnu}.
400
401 @cindex Mailing list
402 @cindex List, mailing list
403 There is a mailing list for @sc{cvs} where bug reports
404 can be sent, questions can be asked, an FAQ is posted,
405 and discussion about future enhancements to @sc{cvs}
406 take place.  To submit a message to the list, write to
407 <@t{info-cvs@@prep.ai.mit.edu}>.  To subscribe or
408 unsubscribe, write to
409 <@t{info-cvs-request@@prep.ai.mit.edu}>. Please be
410 specific about your email address.
411
412
413 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
414 @unnumberedsec CVS is not@dots{}
415
416 @sc{cvs} can do a lot of things for you, but it does
417 not try to be everything for everyone.
418
419 @table @asis
420 @item @sc{cvs} is not a build system.
421
422 Though the structure of your repository and modules
423 file interact with your build system
424 (e.g. @file{Makefile}s), they are essentially
425 independent.
426
427 @sc{cvs} does not dictate how you build anything.  It
428 merely stores files for retrieval in a tree structure
429 you devise.
430
431 @sc{cvs} does not dictate how to use disk space in the
432 checked out working directories.  If you write your
433 @file{Makefile}s or scripts in every directory so they
434 have to know the relative positions of everything else,
435 you wind up requiring the entire repository to be
436 checked out.  That's simply bad planning.
437
438 If you modularize your work, and construct a build
439 system that will share files (via links, mounts,
440 @code{VPATH} in @file{Makefile}s, etc.), you can
441 arrange your disk usage however you like.
442
443 But you have to remember that @emph{any} such system is
444 a lot of work to construct and maintain.  @sc{cvs} does
445 not address the issues involved.  You must use your
446 brain and a collection of other tools to provide a
447 build scheme to match your plans.
448
449 Of course, you should place the tools created to
450 support such a build system (scripts, @file{Makefile}s,
451 etc) under @sc{cvs}.
452
453 @item @sc{cvs} is not a substitute for management.
454
455 Your managers and project leaders are expected to talk
456 to you frequently enough to make certain you are aware
457 of schedules, merge points, branch names and release
458 dates.  If they don't, @sc{cvs} can't help.
459
460 @sc{cvs} is an instrument for making sources dance to
461 your tune.  But you are the piper and the composer.  No
462 instrument plays itself or writes its own music.
463
464 @item @sc{cvs} is not a substitute for developer communication.
465
466 When faced with conflicts within a single file, most
467 developers manage to resolve them without too much
468 effort.  But a more general definition of ``conflict''
469 includes problems too difficult to solve without
470 communication between developers.
471
472 @sc{cvs} cannot determine when simultaneous changes
473 within a single file, or across a whole collection of
474 files, will logically conflict with one another.  Its
475 concept of a @dfn{conflict} is purely textual, arising
476 when two changes to the same base file are near enough
477 to spook the merge (i.e. @code{diff3}) command.
478
479 @sc{cvs} does not claim to help at all in figuring out
480 non-textual or distributed conflicts in program logic.
481
482 For example: Say you change the arguments to function
483 @code{X} defined in file @file{A}.  At the same time,
484 someone edits file @file{B}, adding new calls to
485 function @code{X} using the old arguments.  You are
486 outside the realm of @sc{cvs}'s competence.
487
488 Acquire the habit of reading specs and talking to your
489 peers.
490
491
492 @item @sc{cvs} is not a configuration management system.
493
494 @sc{cvs} is a source control system.  The phrase
495 ``configuration management'' is a marketing term, not
496 an industry-recognized set of functions.
497
498 A true ``configuration management system'' would contain
499 elements of the following:
500
501 @itemize @bullet
502 @item Source control.
503 @item Dependency tracking.
504 @item Build systems (i.e. What to build and how to find
505 things during a build.  What is shared?  What is local?)
506 @item Bug tracking.
507 @item Automated Testing procedures.
508 @item Release Engineering documentation and procedures.
509 @item Tape Construction.
510 @item Customer Installation.
511 @item A way for users to run different versions of the same
512 software on the same host at the same time.
513 @end itemize
514
515 @sc{cvs} provides only the first.
516 @end table
517
518 This section is taken from release 2.3 of the @sc{cvs}
519 @sc{faq}.
520
521 @c ---------------------------------------------------------------------
522 @node Basic concepts
523 @chapter Basic concepts
524 @cindex Modules (intro)
525 @cindex Repository (intro)
526
527 @sc{cvs} stores all files in a centralized
528 @dfn{repository}: a directory (such as
529 @file{/usr/local/cvsroot} or
530 @file{user@@remotehost:/usr/local/cvsroot}) which is
531 populated with a hierarchy of files and directories.
532 (@pxref{Remote repositories} for information about
533 keeping the repository on a remote machine.)
534
535 Normally, you never access any of the files in the
536 repository directly.  Instead, you use @sc{cvs}
537 commands to get your own copy of the files, and then
538 work on that copy.  When you've finished a set of
539 changes, you check (or @dfn{commit}) them back into the
540 repository.
541
542 The files in the repository are organized in
543 @dfn{modules}.  Each module is made up of one or more
544 files, and can include files from several directories.
545 A typical usage is to define one module per project.
546
547 @menu
548 * Revision numbers::            The meaning of a revision number
549 * Versions revisions releases::  Terminology used in this manual
550 @end menu
551
552 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
553 @node Revision numbers
554 @section Revision numbers
555 @cindex Revision numbers
556 @cindex Revision tree
557 @cindex Linear development
558 @cindex Number, revision-
559 @cindex Decimal revision number
560 @cindex Main trunk (intro)
561 @cindex Branch number
562 @cindex Number, branch
563
564 Each version of a file has a unique @dfn{revision
565 number}.  Revision numbers look like @samp{1.1},
566 @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
567 A revision number always has an even number of
568 period-separated decimal integers.  By default revision
569 1.1 is the first revision of a file.  Each successive
570 revision is given a new number by increasing the
571 rightmost number by one.  The following figure displays
572 a few revisions, with newer revisions to the right.
573
574 @example
575        +-----+    +-----+    +-----+    +-----+    +-----+
576        ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
577        +-----+    +-----+    +-----+    +-----+    +-----+
578 @end example
579
580 @sc{cvs} is not limited to linear development.  The
581 @dfn{revision tree} can be split into @dfn{branches},
582 where each branch is a self-maintained line of
583 development.  Changes made on one branch can easily be
584 moved back to the main trunk.  
585
586 Each branch has a @dfn{branch number}, consisting of an
587 odd number of period-separated decimal integers.  The
588 branch number is created by appending an integer to the
589 revision number where the corresponding branch forked
590 off.  Having branch numbers allows more than one branch
591 to be forked off from a certain revision.
592
593 @need 3500
594 All revisions on a branch have revision numbers formed
595 by appending an ordinal number to the branch number.
596 The following figure illustrates branching with an
597 example.
598
599 @example
600 @group
601                                                      +-------------+
602                           Branch 1.2.2.3.2 ->        ! 1.2.2.3.2.1 !
603                                                    / +-------------+
604                                                   /
605                                                  /
606                  +---------+    +---------+    +---------+    +---------+
607 Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !----! 1.2.2.4 !
608                / +---------+    +---------+    +---------+    +---------+
609               /
610              /
611 +-----+    +-----+    +-----+    +-----+    +-----+
612 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !      <- The main trunk
613 +-----+    +-----+    +-----+    +-----+    +-----+
614                 !
615                 !
616                 !   +---------+    +---------+    +---------+
617 Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
618                     +---------+    +---------+    +---------+
619
620 @end group
621 @end example
622
623 @c --   However, at least for me the figure is not enough.  I suggest more
624 @c --   text to accompany it.  "A picture is worth a thousand words", so you
625 @c --   have to make sure the reader notices the couple of hundred words
626 @c --   *you* had in mind more than the others!
627
628 @c --   Why an even number of segments?  This section implies that this is
629 @c --   how the main trunk is distinguished from branch roots, but you never
630 @c --   explicitly say that this is the purpose of the [by itself rather
631 @c --   surprising] restriction to an even number of segments.
632
633 The exact details of how the branch number is
634 constructed is not something you normally need to be
635 concerned about, but here is how it works: When
636 @sc{cvs} creates a branch number it picks the first
637 unused even integer, starting with 2.  So when you want
638 to create a branch from revision 6.4 it will be
639 numbered 6.4.2.  All branch numbers ending in a zero
640 (such as 6.4.0) are used internally by @sc{cvs}
641 (@pxref{Magic branch numbers}).  The branch 1.1.1 has a
642 special meaning.  @xref{Tracking sources}.
643
644 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
645 @node Versions revisions releases
646 @section Versions, revisions and releases
647 @cindex Revisions, versions and releases
648 @cindex Versions, revisions and releases
649 @cindex Releases, revisions and versions
650
651 A file can have several versions, as described above.
652 Likewise, a software product can have several versions.
653 A software product is often given a version number such
654 as @samp{4.1.1}.
655
656 Versions in the first sense are called @dfn{revisions}
657 in this document, and versions in the second sense are
658 called @dfn{releases}.  To avoid confusion, the word
659 @dfn{version} is almost never used in this document.
660
661 @c ---------------------------------------------------------------------
662 @node A sample session
663 @chapter A sample session
664 @cindex A sample session
665 @cindex Example of a work-session
666 @cindex Getting started
667 @cindex Work-session, example of
668 @cindex tc, Trivial Compiler (example)
669 @cindex Trivial Compiler (example)
670
671 This section describes a typical work-session using
672 @sc{cvs}.  It assumes that a repository is set up
673 (@pxref{Repository}).
674
675 Suppose you are working on a simple compiler.  The source
676 consists of a handful of C files and a @file{Makefile}.
677 The compiler is called @samp{tc} (Trivial Compiler),
678 and the repository is set up so that there is a module
679 called @samp{tc}.
680
681 @menu
682 * Getting the source::          Creating a workspace
683 * Committing your changes::     Making your work available to others
684 * Cleaning up::                 Cleaning up
685 * Viewing differences::         Viewing differences
686 @end menu
687
688 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
689 @node Getting the source
690 @section Getting the source
691 @cindex Getting the source
692 @cindex Checking out source
693 @cindex Fetching source
694 @cindex Source, getting from CVS
695 @cindex Checkout, example
696
697 The first thing you must do is to get your own working copy of the
698 source for @samp{tc}.  For this, you use the @code{checkout} command:
699
700 @example
701 $ cvs checkout tc
702 @end example
703
704 @noindent
705 This will create a new directory called @file{tc} and populate it with
706 the source files.
707
708 @example
709 $ cd tc
710 $ ls tc
711 CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
712 @end example
713
714 The @file{CVS} directory is used internally by
715 @sc{cvs}.  Normally, you should not modify or remove
716 any of the files in it.
717
718 You start your favorite editor, hack away at @file{backend.c}, and a couple
719 of hours later you have added an optimization pass to the compiler.
720 A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
721 you want to edit.  @xref{Multiple developers} for an explanation.
722
723 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
724 @node Committing your changes
725 @section Committing your changes
726 @cindex Committing changes
727 @cindex Log message entry
728 @cindex CVSEDITOR, environment variable
729 @cindex EDITOR, environment variable
730
731 When you have checked that the compiler is still compilable you decide
732 to make a new version of @file{backend.c}.
733
734 @example
735 $ cvs commit backend.c
736 @end example
737
738 @noindent
739 @sc{cvs} starts an editor, to allow you to enter a log
740 message.  You type in ``Added an optimization pass.'',
741 save the temporary file, and exit the editor.
742
743 The environment variable @code{$CVSEDITOR} determines
744 which editor is started.  If @code{$CVSEDITOR} is not
745 set, then if the environment variable @code{$EDITOR} is
746 set, it will be used. If both @code{$CVSEDITOR} and
747 @code{$EDITOR} are not set then the editor defaults to
748 @code{vi}.  If you want to avoid the overhead of
749 starting an editor you can specify the log message on
750 the command line using the @samp{-m} flag instead, like
751 this:
752
753 @example
754 $ cvs commit -m "Added an optimization pass" backend.c
755 @end example
756
757 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
758 @node Cleaning up
759 @section Cleaning up
760 @cindex Cleaning up
761 @cindex Working copy, removing
762 @cindex Removing your working copy
763 @cindex Releasing your working copy
764
765 Before you turn to other tasks you decide to remove your working copy of
766 tc.  One acceptable way to do that is of course
767
768 @example
769 $ cd ..
770 $ rm -r tc
771 @end example
772
773 @noindent
774 but a better way is to use the @code{release} command (@pxref{release}):
775
776 @example
777 $ cd ..
778 $ cvs release -d tc
779 M driver.c
780 ? tc
781 You have [1] altered files in this repository.
782 Are you sure you want to release (and delete) module `tc': n
783 ** `release' aborted by user choice.
784 @end example
785
786 The @code{release} command checks that all your modifications have been
787 committed.  If history logging is enabled it also makes a note in the
788 history file.  @xref{history file}.
789
790 When you use the @samp{-d} flag with @code{release}, it
791 also removes your working copy.
792
793 In the example above, the @code{release} command wrote a couple of lines
794 of output.  @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
795 That is nothing to worry about: @file{tc} is the executable compiler,
796 and it should not be stored in the repository.  @xref{cvsignore},
797 for information about how to make that warning go away.
798 @xref{release output}, for a complete explanation of
799 all possible output from @code{release}.
800
801 @samp{M driver.c} is more serious.  It means that the
802 file @file{driver.c} has been modified since it was
803 checked out.
804
805 The @code{release} command always finishes by telling
806 you how many modified files you have in your working
807 copy of the sources, and then asks you for confirmation
808 before deleting any files or making any note in the
809 history file.
810
811 You decide to play it safe and answer @kbd{n @key{RET}}
812 when @code{release} asks for confirmation.
813
814 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
815 @node Viewing differences
816 @section Viewing differences
817 @cindex Viewing differences
818 @cindex Diff
819
820 You do not remember modifying @file{driver.c}, so you want to see what
821 has happened to that file.
822
823 @example
824 $ cd tc
825 $ cvs diff driver.c
826 @end example
827
828 This command runs @code{diff} to compare the version of @file{driver.c}
829 that you checked out with your working copy.  When you see the output
830 you remember that you added a command line option that enabled the
831 optimization pass.  You check it in, and release the module.
832
833 @example
834 $ cvs commit -m "Added an optimization pass" driver.c
835 Checking in driver.c;
836 /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
837 new revision: 1.2; previous revision: 1.1
838 done
839 $ cd ..
840 $ cvs release -d tc
841 ? tc
842 You have [0] altered files in this repository.
843 Are you sure you want to release (and delete) module `tc': y
844 @end example
845
846 @c ---------------------------------------------------------------------
847 @node Repository
848 @chapter The Repository
849 @cindex Repository, example
850 @cindex Layout of repository
851 @cindex Typical repository
852 @cindex CVSROOT, environment variable
853 @cindex .profile
854 @cindex .cshrc
855 @cindex .tcshrc
856 @cindex .bashrc
857 @cindex /usr/local/cvsroot
858 @cindex cvsroot
859
860 Figure 3 below shows a typical setup of a repository.
861 Only directories are shown below.
862
863 @example
864 @t{/usr}
865  |
866  +--@t{local}
867  |   |
868  |   +--@t{cvsroot}
869  |   |    | 
870  |   |    +--@t{CVSROOT}
871           |      (administrative files) 
872           | 
873           +--@t{gnu}
874           |   | 
875           |   +--@t{diff}
876           |   |   (source code to @sc{gnu} diff) 
877           |   | 
878           |   +--@t{rcs}
879           |   |   (source code to @sc{rcs})
880           |   | 
881           |   +--@t{cvs}
882           |       (source code to @sc{cvs}) 
883           | 
884           +--@t{yoyodyne}
885               | 
886               +--@t{tc}
887               |    |
888               |    +--@t{man}
889               |    |
890               |    +--@t{testing}
891               | 
892               +--(other Yoyodyne software)
893 @end example                              
894
895
896 There are a couple of different ways to tell @sc{cvs}
897 where to find the repository.  You can name the
898 repository on the command line explicitly, with the
899 @code{-d} (for "directory") option:
900
901 @example
902 cvs -d /usr/local/cvsroot checkout yoyodyne/tc
903 @end example
904
905         Or you can set the @code{$CVSROOT} environment
906 variable to an absolute path to the root of the
907 repository, @file{/usr/local/cvsroot} in this example.
908 To set @code{$CVSROOT}, all @code{csh} and @code{tcsh}
909 users should have this line in their @file{.cshrc} or
910 @file{.tcshrc} files:
911
912 @example
913 setenv CVSROOT /usr/local/cvsroot
914 @end example
915
916 @noindent
917 @code{sh} and @code{bash} users should instead have these lines in their
918 @file{.profile} or @file{.bashrc}:
919
920 @example
921 CVSROOT=/usr/local/cvsroot
922 export CVSROOT
923 @end example
924
925         A repository specified with @code{-d} will
926 override the @code{$CVSROOT} environment variable.
927 Once you've checked a working copy out from the
928 repository, it will remember where its repository is
929 (the information is recorded in the
930 @file{CVS/Root} file in the working copy).  
931
932 The @code{-d} option and the @file{CVS/Root} file
933 both override the @code{$CVSROOT} environment variable;
934 however, @sc{CVS} will complain if the @file{-d}
935 argument and the @file{CVS/Root} file disagree.
936
937 There is nothing magical about the name
938 @file{/usr/local/cvsroot}.  You can choose to place the
939 repository anywhere you like.  
940 @xref{Remote repositories} to learn how the repository can be on a
941 different machine than your working copy of the sources.
942
943 The repository is split in two parts.  @file{$CVSROOT/CVSROOT} contains
944 administrative files for @sc{cvs}.  The other directories contain the actual
945 user-defined modules.
946
947 @menu
948 * User modules::                The structure of the repository
949 * Intro administrative files::  Defining modules
950 * Multiple repositories::       Multiple repositories
951 * Creating a repository::       Creating a repository
952 * Remote repositories::         Accessing repositories on remote machines
953 @end menu
954
955 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
956 @node User modules
957 @section User modules
958 @cindex User modules
959 @cindex Repository, user parts
960
961 @example
962   @code{$CVSROOT}
963     |
964     +--@t{yoyodyne}
965     |   |
966     |   +--@t{tc}
967     |   |   |
968             +--@t{Makefile,v}
969             +--@t{backend.c,v}
970             +--@t{driver.c,v}
971             +--@t{frontend.c,v}
972             +--@t{parser.c,v}
973             +--@t{man}
974             |    |
975             |    +--@t{tc.1,v}
976             |     
977             +--@t{testing}
978                  |
979                  +--@t{testpgm.t,v}
980                  +--@t{test2.t,v}
981 @end example
982
983 @cindex History files
984 @cindex RCS history files
985 @cindex RCS, CVS uses RCS
986 The figure above shows the contents of the @samp{tc}
987 module inside the repository.  As you can see all file
988 names end in @samp{,v}.  The files are @dfn{history
989 files}.  They contain, among other things, enough
990 information to recreate any revision of the file, a log
991 of all commit messages and the user-name of the person
992 who committed the revision.  @sc{cvs} uses the
993 facilities of @sc{rcs}, a simpler version control
994 system, to maintain these files.  For a full
995 description of the file format, see the @code{man} page
996 @cite{rcsfile(5)}.
997 @c -- Use this format for all references to man pages,
998 @c -- or use something better!
999
1000 @menu
1001 * File permissions::            File permissions
1002 @end menu
1003
1004 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1005 @node File permissions
1006 @subsection File permissions
1007 @c -- Move this to @node Setting up
1008 @cindex Security
1009 @cindex File permissions
1010 @cindex Group
1011 All @samp{,v} files are created read-only, and you
1012 should not change the permission of those files.  The
1013 directories inside the repository should be writable by
1014 the persons that have permission to modify the files in
1015 each directory.  This normally means that you must
1016 create a UNIX group (see group(5)) consisting of the
1017 persons that are to edit the files in a project, and
1018 set up the repository so that it is that group that
1019 owns the directory.
1020
1021 This means that you can only control access to files on
1022 a per-directory basis.
1023
1024 @sc{cvs} tries to set up reasonable file permissions
1025 for new directories that are added inside the tree, but
1026 you must fix the permissions manually when a new
1027 directory should have different permissions than its
1028 parent directory.
1029
1030 @cindex setuid
1031 @cindex setgid
1032 Since @sc{cvs} was not written to be run setuid, it is
1033 unsafe to try to run it setuid.  You cannot use the
1034 setuid features of @sc{rcs} together with @sc{cvs}.
1035
1036 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1037 @node Intro administrative files
1038 @section The administrative files
1039 @cindex Administrative files (intro)
1040 @cindex Modules file
1041 @cindex CVSROOT, module name
1042 @cindex Defining modules (intro)
1043
1044 The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
1045 files}.  @xref{Administrative files}, for a complete description.
1046 You can use @sc{cvs} without any of these files, but
1047 some commands work better when at least the
1048 @file{modules} file is properly set up.
1049
1050 The most important of these files is the @file{modules}
1051 file.  It defines all modules in the repository.  This
1052 is a sample @file{modules} file.
1053
1054 @c FIXME: The CVSROOT line is a goofy example now that
1055 @c mkmodules doesn't exist.
1056 @example
1057 CVSROOT         CVSROOT
1058 modules         CVSROOT modules
1059 cvs             gnu/cvs
1060 rcs             gnu/rcs
1061 diff            gnu/diff
1062 tc              yoyodyne/tc
1063 @end example
1064
1065 The @file{modules} file is line oriented.  In its simplest form each
1066 line contains the name of the module, whitespace, and the directory
1067 where the module resides.  The directory is a path relative to
1068 @code{$CVSROOT}.  The last for lines in the example
1069 above are examples of such lines.
1070
1071 @c FIXME: might want to introduce the concept of options in modules file
1072 @c (the old example which was here, -i mkmodules, is obsolete).
1073
1074 The line that defines the module called @samp{modules}
1075 uses features that are not explained here.
1076 @xref{modules}, for a full explanation of all the
1077 available features.
1078
1079 @subsection Editing administrative files
1080 @cindex Editing administrative files
1081 @cindex Administrative files, editing them
1082
1083 You edit the administrative files in the same way that you would edit
1084 any other module.  Use @samp{cvs checkout CVSROOT} to get a working
1085 copy, edit it, and commit your changes in the normal way.
1086
1087 It is possible to commit an erroneous administrative
1088 file.  You can often fix the error and check in a new
1089 revision, but sometimes a particularly bad error in the
1090 administrative file makes it impossible to commit new
1091 revisions.  
1092 @c @xref{Bad administrative files} for a hint
1093 @c about how to solve such situations.
1094 @c -- administrative file checking--
1095
1096 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1097 @node Multiple repositories
1098 @section Multiple repositories
1099 @cindex Multiple repositories
1100 @cindex Repositories, multiple
1101 @cindex Many repositories
1102 @cindex Parallel repositories
1103 @cindex Disjoint repositories
1104 @cindex CVSROOT, multiple repositories
1105
1106 In some situations it is a good idea to have more than
1107 one repository, for instance if you have two
1108 development groups that work on separate projects
1109 without sharing any code.  All you have to do to have
1110 several repositories is to specify the appropriate
1111 repository, using the @code{CVSROOT} environment
1112 variable, the @samp{-d} option to @sc{cvs}, or (once
1113 you have checked out a working directories) by
1114 simply allowing @sc{cvs} to use the repository that was
1115 used to check out the working directory (@pxref{Repository}).
1116
1117 Notwithstanding, it can be confusing to have two or
1118 more repositories.
1119
1120 None of the examples in this manual show multiple
1121 repositories.
1122
1123 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1124 @node Creating a repository
1125 @section Creating a repository
1126 @c -- Well, how do you do?
1127
1128 See the instructions in the @file{INSTALL} file in the
1129 @sc{cvs} distribution.
1130
1131 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1132 @node Remote repositories
1133 @section Remote repositories
1134 @cindex Repositories, remote
1135 @cindex Remote repositories
1136 @cindex Client/Server Operation
1137
1138         Your working copy of the sources can be on a
1139 different machine than the repository.  Generally,
1140 using a remote repository is just like using a local
1141 one, except that the format of the repository name is:
1142
1143 @example
1144         user@@hostname:/path/to/repository
1145 @end example
1146
1147 The details of exactly what needs to be set up depend
1148 on how you are connecting to the server.
1149
1150 @menu
1151 * Connecting via rsh::          Using the @code{rsh} program to connect
1152 * Password authenticated::      Direct connections using passwords
1153 * Kerberos authenticated::      Direct connections with kerberos
1154 @end menu
1155
1156 @node Connecting via rsh
1157 @subsection Connecting with rsh
1158
1159 @cindex rsh
1160 CVS uses the @file{rsh} protocol to perform these
1161 operations, so the remote user host needs to have a
1162 @file{.rhosts} file which grants access to the local
1163 user.
1164
1165 For example, suppose you are the user @file{mozart} on
1166 the local machine @file{anklet.grunge.com}, and the
1167 server machine is @file{chainsaw.brickyard.com}.  On
1168 chainsaw, put the following line into the file
1169 @file{.rhosts} in @file{bach}'s home directory:
1170
1171 @example
1172 anklet.grunge.com  mozart
1173 @end example
1174
1175 Then test that @code{rsh} is working with
1176
1177 @example
1178 rsh -l bach chainsaw.brickyard.com echo $PATH
1179 @end example
1180
1181 @cindex CVS_SERVER
1182 Next you have to make sure that @code{rsh} will be able
1183 to find the server.  Make sure that the path which
1184 @code{rsh} printed in the above example includes the
1185 directory containing a program named @code{cvs} which
1186 is the server.  You need to set the path in
1187 @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
1188 or @file{.profile}.  Alternately, you can set the
1189 environment variable @code{CVS_SERVER} on the client
1190 machine to the filename of the server you want to use,
1191 for example @file{/usr/local/bin/cvs-1.6}.
1192
1193 There is no need to edit @code{inetd.conf} or start a
1194 @sc{cvs} server daemon.
1195
1196 Continuing our example, supposing you want to access
1197 the module @file{foo} in the repository
1198 @file{/usr/local/cvsroot/}, on machine
1199 @file{chainsaw.brickyard.com}, you are ready to go:
1200
1201 @example
1202 cvs -d bach@@chainsaw.brickyard.com:/user/local/cvsroot checkout foo
1203 @end example
1204
1205 (The @file{bach@@} can be omitted if the username is
1206 the same on both the local and remote hosts.)
1207
1208 @node Password authenticated
1209 @subsection Direct connection with password authentication
1210
1211 The @sc{cvs} client can also connect to the server
1212 using a password protocol.  This is particularly useful
1213 if using @code{rsh} is not feasible (for example,
1214 the server is behind a firewall), and Kerberos also is
1215 not available.
1216
1217         To use this method, it is necessary to make
1218 some adjustments on both the server and client sides.
1219
1220 @menu
1221 * Password authentication server::     Setting up the server
1222 * Password authentication client::     Using the client
1223 * Password authentication security::   What this method does and does not do
1224 @end menu
1225
1226 @node Password authentication server
1227 @subsubsection Setting up the server for password authentication
1228
1229 @cindex Pserver (subcommand)
1230 @cindex password server, setting up
1231 @cindex authenticating server, setting up
1232 On the server side, the file @file{/etc/inetd.conf}
1233 needs to be edited so @code{inetd} knows to run the
1234 command @code{cvs pserver} when it receives a
1235 connection on the right port.  By default, the port
1236 number is 2401; it would be different if your client
1237 were compiled with @code{CVS_AUTH_PORT} defined to
1238 something else, though.
1239
1240         If your @code{inetd} allows raw port numbers in
1241 @file{/etc/inetd.conf}, then the following (all on a
1242 single line in @file{inetd.conf}) should be sufficient:
1243
1244 @example
1245 2401  stream  tcp  nowait  root  /usr/local/bin/cvs
1246 cvs -b /usr/local/bin pserver
1247 @end example
1248
1249 The @samp{-b} option specifies the directory which contains
1250 the @sc{rcs} binaries on the server.
1251
1252         If your @code{inetd} wants a symbolic service
1253 name instead of a raw port number, then put this in
1254 @file{/etc/services}:
1255
1256 @example
1257 cvspserver      2401/tcp
1258 @end example
1259
1260         and put @code{cvspserver} instead of
1261 @code{2401} in @file{inetd.conf}.
1262
1263         Once the above is taken care of, restart your
1264 @code{inetd}, or do whatever is necessary to force it
1265 to reread its initialization files.
1266
1267 @cindex CVS passwd file
1268 @cindex passwd file
1269 Because the client stores and transmits passwords in
1270 cleartext (almost---see @ref{Password authentication
1271 security} for details), a separate @sc{cvs} password
1272 file may be used, so people don't compromise their
1273 regular passwords when they access the repository.
1274 This file is @file{$CVSROOT/CVSROOT/passwd}
1275 (@pxref{Intro administrative files}).  Its format is
1276 similar to @file{/etc/passwd}, except that it only has
1277 two fields, username and password.  For example:
1278
1279 @example
1280 bach:ULtgRLXo7NRxs
1281 cwang:1sOp854gDF3DY
1282 @end example
1283
1284 The password is encrypted according to the standard
1285 Unix @code{crypt()} function, so it is possible to
1286 paste in passwords directly from regular Unix
1287 @file{passwd} files.
1288
1289 When authenticating a password, the server first checks
1290 for the user in the @sc{cvs} @file{passwd} file.  If it
1291 finds the user, it compares against that password.  If
1292 it does not find the user, or if the @sc{cvs}
1293 @file{passwd} file does not exist, then the server
1294 tries to match the password using the system's
1295 user-lookup routine.  When using the @sc{cvs}
1296 @file{passwd} file, the server runs under as the
1297 username specified in the the third argument in the
1298 entry, or as the first argument if there is no third
1299 argument (in this way @sc{cvs} allows imaginary
1300 usernames provided the @sc{cvs} @file{passwd} file
1301 indicates corresponding valid system usernames).  In
1302 any case, @sc{cvs} will have no privileges which the
1303 (valid) user would not have.
1304
1305 Right now, the only way to put a password in the
1306 @sc{cvs} @file{passwd} file is to paste it there from
1307 somewhere else.  Someday, there may be a @code{cvs
1308 passwd} command.
1309
1310 @node Password authentication client
1311 @subsubsection Using the client with password authentication
1312 @cindex Login (subcommand)
1313 @cindex password client, using
1314 @cindex authenticated client, using
1315 Before connecting to the server, the client must @dfn{log
1316 in} with the command @code{cvs login}.  Logging in
1317 verifies a password with the server, and also records
1318 the password for later transactions with the server.
1319 The @code{cvs login} command needs to know the
1320 username, server hostname, and full repository path,
1321 and it gets this information from the repository
1322 argument or the @code{CVSROOT} environment variable.
1323
1324 @code{cvs login} is interactive --- it prompts for a
1325 password:
1326
1327 @example
1328 cvs -d bach@@chainsaw.brickyard.com:/usr/local/cvsroot login 
1329 CVS password: 
1330 @end example
1331
1332 The password is checked with the server; if it is
1333 correct, the @code{login} succeeds, else it fails,
1334 complaining that the password was incorrect.
1335
1336 Once you have logged in, you can force @sc{cvs} to
1337 connect directly to the server and authenticate with
1338 the stored password by prefixing the repository with
1339 @samp{:pserver:}:
1340
1341 @example
1342 cvs -d :pserver:bach@@chainsaw.brickyard.com:/usr/local/cvsroot checkout foo
1343 @end example
1344
1345 The @samp{:pserver:} is necessary because without it,
1346 @sc{cvs} will assume it should use @code{rsh} to
1347 connect with the server (@pxref{Connecting via rsh}).
1348 (Once you have a working copy checked out and are
1349 running @sc{cvs} commands from within it, there is no
1350 longer any need to specify the repository explicitly,
1351 because @sc{cvs} records it in the working copy's
1352 @file{CVS} subdirectory.)
1353
1354 @cindex CVS_PASSFILE, environment variable
1355 Passwords are stored by default in the file
1356 @file{$HOME/.cvspass}.  Its format is human-readable,
1357 but don't edit it unless you know what you are doing.
1358 The passwords are not stored in cleartext, but are
1359 trivially encoded to protect them from "innocent"
1360 compromise (i.e., inadvertently being seen by a system
1361 administrator who happens to look at that file).
1362
1363 The @code{CVS_PASSFILE} environment variable overrides
1364 this default.  If you use this variable, make sure you
1365 set it @emph{before} @code{cvs login} is run.  If you
1366 were to set it after running @code{cvs login}, then
1367 later @sc{cvs} commands would be unable to look up the
1368 password for transmission to the server.
1369
1370 @cindex CVS_PASSWORD, environment variable
1371 The @code{CVS_PASSWORD} environment variable overrides
1372 @emph{all} stored passwords.  If it is set, @sc{cvs}
1373 will use it for all password-authenticated
1374 connections.
1375
1376 @node Password authentication security
1377 @subsubsection Security considerations with password authentication
1378
1379 The passwords are stored on the client side in a
1380 trivial encoding of the cleartext, and transmitted in
1381 the same encoding.  The encoding is done only to
1382 prevent inadvertent password compromises (i.e., a
1383 system administrator accidentally looking at the file),
1384 and will not prevent even a naive attacker from gaining
1385 the password.
1386
1387 The separate @sc{cvs} password file (@pxref{Password
1388 authentication server}) allows people
1389 to use a different password for repository access than
1390 for login access.  On the other hand, once a user has
1391 access to the repository, she can execute programs on
1392 the server system through a variety of means.  Thus, repository
1393 access implies fairly broad system access as well.  It
1394 might be possible to modify @sc{cvs} to prevent that,
1395 but no one has done so as of this writing.
1396 Furthermore, there may be other ways in which having
1397 access to @sc{cvs} allows people to gain more general
1398 access to the system; noone has done a careful audit.
1399
1400 In summary, anyone who gets the password gets
1401 repository access, and some measure of general system
1402 access as well.  The password is available to anyone
1403 who can sniff network packets or read a protected
1404 (i.e., user read-only) file.  If you want real
1405 security, get Kerberos.
1406
1407 @node Kerberos authenticated
1408 @subsection Direct connection with kerberos
1409
1410 @cindex kerberos
1411 The main disadvantage of using rsh is that all the data
1412 needs to pass through additional programs, so it may be
1413 slower.  So if you have kerberos installed you can
1414 connect via a direct @sc{tcp} connection,
1415 authenticating with kerberos (note that the data
1416 transmitted is @emph{not} encrypted).
1417
1418 To do this, @sc{cvs} needs to be compiled with kerberos
1419 support; when configuring @sc{cvs} it tries to detect
1420 whether kerberos is present or you can use the
1421 @file{--with-krb4} flag to configure.
1422
1423 @cindex CVS_CLIENT_PORT
1424 You need to edit @code{inetd.conf} on the server
1425 machine to run @code{cvs kserver}.  The client uses
1426 port 1999 by default; if you want to use another port
1427 specify it in the @code{CVS_CLIENT_PORT} environment
1428 variable on the client.  Set @code{CVS_CLIENT_PORT} to
1429 @samp{-1} to force an rsh connection.
1430
1431 @cindex kinit
1432 When you want to use @sc{cvs}, get a ticket in the
1433 usual way (generally @code{kinit}); it must be a ticket
1434 which allows you to log into the server machine.  Then
1435 you are ready to go:
1436
1437 @example
1438 cvs -d chainsaw.brickyard.com:/user/local/cvsroot checkout foo
1439 @end example
1440
1441 If @sc{cvs} fails to connect, it will fall back to
1442 trying rsh.
1443
1444 @c ---------------------------------------------------------------------
1445 @node Starting a new project
1446 @chapter Starting a project with CVS
1447 @cindex Starting a project with CVS
1448 @cindex Creating a project
1449
1450 @comment --moduledb--
1451 Since @sc{cvs} 1.x is bad at renaming files and moving
1452 them between directories, the first thing you do when
1453 you start a new project should be to think through your
1454 file organization.  It is not impossible---just
1455 awkward---to rename or move files.
1456 @xref{Moving files}.
1457
1458 What to do next depends on the situation at hand.
1459
1460 @menu
1461 * Setting up the files::        Getting the files into the repository
1462 * Defining the module::         How to make a module of the files
1463 @end menu
1464 @c -- File permissions!
1465
1466 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1467 @node Setting up the files
1468 @section Setting up the files
1469
1470 The first step is to create the files inside the repository.  This can
1471 be done in a couple of different ways.
1472
1473 @c -- The contributed scripts
1474 @menu
1475 * From files::                  This method is useful with old projects
1476                                 where files already exists.
1477 * From other version control systems::  Old projects where you want to
1478                                         preserve history from another system.
1479 * From scratch::                Creating a module from scratch.
1480 @end menu
1481
1482 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1483 @node From files
1484 @subsection Creating a module from a number of files
1485 @cindex Importing files
1486
1487 When you begin using @sc{cvs}, you will probably already have several
1488 projects that can be
1489 put under @sc{cvs} control.  In these cases the easiest way is to use the
1490 @code{import} command.  An example is probably the easiest way to
1491 explain how to use it.  If the files you want to install in
1492 @sc{cvs} reside in @file{@var{dir}}, and you want them to appear in the
1493 repository as @file{$CVSROOT/yoyodyne/@var{dir}}, you can do this:
1494
1495 @example
1496 $ cd @var{dir}
1497 $ cvs import -m "Imported sources" yoyodyne/@var{dir} yoyo start
1498 @end example
1499
1500 Unless you supply a log message with the @samp{-m}
1501 flag, @sc{cvs} starts an editor and prompts for a
1502 message.  The string @samp{yoyo} is a @dfn{vendor tag},
1503 and @samp{start} is a @dfn{release tag}.  They may fill
1504 no purpose in this context, but since @sc{cvs} requires
1505 them they must be present.  @xref{Tracking sources}, for
1506 more information about them.
1507
1508 You can now verify that it worked, and remove your
1509 original source directory.
1510
1511 @example
1512 $ cd ..
1513 $ mv @var{dir} @var{dir}.orig
1514 $ cvs checkout yoyodyne/@var{dir}       # @r{Explanation below}
1515 $ ls -R yoyodyne
1516 $ rm -r @var{dir}.orig
1517 @end example
1518
1519 @noindent
1520 Erasing the original sources is a good idea, to make sure that you do
1521 not accidentally edit them in @var{dir}, bypassing @sc{cvs}.
1522 Of course, it would be wise to make sure that you have
1523 a backup of the sources before you remove them.
1524
1525 The @code{checkout} command can either take a module
1526 name as argument (as it has done in all previous
1527 examples) or a path name relative to @code{$CVSROOT},
1528 as it did in the example above.
1529
1530 It is a good idea to check that the permissions
1531 @sc{cvs} sets on the directories inside @samp{$CVSROOT}
1532 are reasonable, and that they belong to the proper
1533 groups.  @xref{File permissions}.
1534
1535 @c The node name is too long, but I am having trouble
1536 @c thinking of something more concise.
1537 @node From other version control systems
1538 @subsection Creating Files From Other Version Control Systems
1539 @cindex Importing files, from other version control systesm
1540
1541 If you have a project which you are maintaining with
1542 another version control system, such as @sc{rcs}, you
1543 may wish to put the files from that project into
1544 @sc{cvs}, and preserve the revision history of the
1545 files.
1546
1547 @table @asis
1548 @cindex RCS, importing files from
1549 @item From RCS
1550 If you have been using @sc{rcs}, find the @sc{rcs}
1551 files---usually a file named @file{foo.c} will have its
1552 @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
1553 other places; consult the @sc{rcs} documentation for
1554 details).  Then create the appropriate directories in
1555 @sc{cvs} if they do not already exist.  Then copy the
1556 files into the appropriate directories in the @sc{cvs}
1557 repository (the name in the repository must be the name
1558 of the source file with @samp{,v} added; the files go
1559 directly in the appopriate directory of the repository,
1560 not in an @file{RCS} subdirectory).  This is one of the
1561 few times when it is a good idea to access the @sc{cvs}
1562 repository directly, rather than using @sc{cvs}
1563 commands.  Then you are ready to check out a new
1564 working directory.
1565 @c Someday there probably should be a "cvs import -t
1566 @c rcs" or some such.  It could even create magic
1567 @c branches.  It could also do something about the case
1568 @c where the RCS file had a (non-magic) "0" branch.
1569
1570 @c How many is "many"? Or do they just import RCS files?
1571 @item From another version control system
1572 Many version control systems have the ability to export
1573 @sc{rcs} files in the standard format.  If yours does,
1574 export the @sc{rcs} files and then follow the above
1575 instructions.
1576
1577 @cindex SCCS, importing files from
1578 @item From SCCS
1579 There is a script in the @file{contrib} directory of
1580 the @sc{cvs} source distribution called @file{sccs2rcs}
1581 which converts @sc{sccs} files to @sc{rcs} files.
1582 Note: you must run it on a machine which has both
1583 @sc{sccs} and @sc{rcs} installed, and like everything
1584 else in contrib it is unsupported (your mileage may
1585 vary).
1586 @end table
1587
1588 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1589 @node From scratch
1590 @subsection Creating a module from scratch
1591
1592 For a new project, the easiest thing to do is probably
1593 to create an empty directory structure, like this:
1594
1595 @example
1596 $ mkdir tc
1597 $ mkdir tc/man
1598 $ mkdir tc/testing
1599 @end example
1600
1601 After that, you use the @code{import} command to create
1602 the corresponding (empty) directory structure inside
1603 the repository:
1604
1605 @example
1606 $ cd tc
1607 $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
1608 @end example
1609
1610 Then, use @code{add} to add files (and new directories)
1611 as they appear.
1612
1613 Check that the permissions @sc{cvs} sets on the
1614 directories inside @samp{$CVSROOT} are reasonable.
1615
1616 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1617 @node Defining the module
1618 @section Defining the module
1619 @cindex Defining a module
1620 @cindex Editing the modules file
1621 @cindex Module, defining
1622 @cindex Modules file, changing
1623
1624 The next step is to define the module in the
1625 @file{modules} file.  This is not strictly necessary,
1626 but modules can be convenient in grouping together
1627 related files and directories.
1628
1629 In simple cases these steps are sufficient to define a module.
1630
1631 @enumerate
1632 @item
1633 Get a working copy of the modules file.
1634
1635 @example
1636 $ cvs checkout modules
1637 $ cd modules
1638 @end example
1639
1640 @item
1641 Edit the file and insert a line that defines the module.  @xref{Intro
1642 administrative files}, for an introduction.  @xref{modules}, for a full
1643 description of the modules file.  You can use the
1644 following line to define the module @samp{tc}:
1645
1646 @example
1647 tc   yoyodyne/tc
1648 @end example
1649
1650 @item
1651 Commit your changes to the modules file.
1652
1653 @example
1654 $ cvs commit -m "Added the tc module." modules
1655 @end example
1656
1657 @item
1658 Release the modules module.
1659
1660 @example
1661 $ cd ..
1662 $ cvs release -d modules
1663 @end example
1664 @end enumerate
1665
1666 @c ---------------------------------------------------------------------
1667 @node Multiple developers
1668 @chapter Multiple developers
1669 @cindex Multiple developers
1670 @cindex Team of developers
1671 @cindex File locking
1672 @cindex Locking files
1673 @cindex Working copy
1674
1675 When more than one person works on a software project
1676 things often get complicated.  Often, two people try to
1677 edit the same file simultaneously.  Some other version
1678 control systems (including @sc{rcs} and @sc{sccs})
1679 try to solve that particular problem by introducing
1680 @dfn{file locking}, so that only one person can edit
1681 each file at a time.  Unfortunately, file locking can
1682 be very counter-productive.  If two persons want
1683 to edit different parts of a file, there may be no
1684 reason to prevent either of them from doing so.
1685
1686 @sc{cvs} does not use file locking.  Instead, it allows many
1687 people to edit their own @dfn{working copy} of a file
1688 simultaneously.  The first person that commits his
1689 changes has no automatic way of knowing that another has started to
1690 edit it.  Others will get an error message when they
1691 try to commit the file.  They must then use @sc{cvs}
1692 commands to bring their working copy up to date with
1693 the repository revision.  This process is almost
1694 automatic, and explained in this chapter.
1695
1696 There are many ways to organize a team of developers.
1697 @sc{cvs} does not try to enforce a certain
1698 organization.  It is a tool that can be used in several
1699 ways.  It is often useful to inform the group of
1700 commits you have done.  @sc{cvs} has several ways of
1701 automating that process.  @xref{Informing others}.
1702 @xref{Revision management}, for more tips on how to use
1703 @sc{cvs}.
1704
1705 @menu
1706 * File status::                 A file can be in several states
1707 * Updating a file::             Bringing a file up-to-date
1708 * Conflicts example::           An informative example
1709 * Informing others::            To cooperate you must inform
1710 * Concurrency::                 Simultaneous repository access
1711 * Watches::                     Mechanisms to track who is editing files
1712 @end menu
1713
1714 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1715 @node File status
1716 @section File status
1717 @cindex File status
1718 @cindex Status of a file
1719 @cindex Four states of a file
1720
1721 After you have checked out a file out from @sc{cvs}, it is in
1722 one of these four states:
1723
1724 @table @asis
1725 @cindex Up-to-date
1726 @item Up-to-date
1727 The file is identical with the latest revision in the
1728 repository.
1729 @c -- The above is not always true if branching is used.
1730
1731 @item Locally modified
1732 @cindex Locally modified
1733 You have edited the file, and not yet committed your changes.
1734
1735 @item Needing update
1736 @cindex Needing update
1737 Someone else has committed a newer revision to the repository.
1738
1739 @item Needing merge
1740 @cindex Needing merge
1741 Someone else have committed a newer revision to the repository, and you
1742 have also made modifications to the file.
1743 @c -- What about "added" "removed" and so on?
1744 @end table
1745
1746 You can use the @code{status} command to find out the status of a given
1747 file.  @xref{status}.
1748
1749 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1750 @node Updating a file
1751 @section Bringing a file up to date
1752 @cindex Bringing a file up to date
1753 @cindex Updating a file
1754 @cindex Merging a file
1755 @cindex update, introduction
1756
1757 When you want to update or merge a file, use the @code{update}
1758 command.  For files that are not up to date this is roughly equivalent
1759 to a @code{checkout} command: the newest revision of the file is
1760 extracted from the repository and put in your working copy of the
1761 module.
1762
1763 Your modifications to a file are never lost when you
1764 use @code{update}.  If no newer revision exists,
1765 running @code{update} has no effect.  If you have
1766 edited the file, and a newer revision is available,
1767 @sc{cvs} will merge all changes into your working copy.
1768
1769 For instance, imagine that you checked out revision 1.4 and started
1770 editing it.  In the meantime someone else committed revision 1.5, and
1771 shortly after that revision 1.6.  If you run @code{update} on the file
1772 now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
1773 your file.
1774
1775 @cindex Overlap
1776 If any of the changes between 1.4 and 1.6 were made too
1777 close to any of the changes you have made, an
1778 @dfn{overlap} occurs.  In such cases a warning is
1779 printed, and the resulting file includes both
1780 versions of the lines that overlap, delimited by
1781 special markers.
1782 @xref{update}, for a complete description of the
1783 @code{update} command.
1784
1785 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1786 @node Conflicts example
1787 @section Conflicts example
1788 @cindex Merge, an example
1789 @cindex Example of merge
1790 @cindex driver.c (merge example)
1791
1792 Suppose revision 1.4 of @file{driver.c} contains this:
1793
1794 @example
1795 #include <stdio.h>
1796
1797 void main()
1798 @{
1799     parse();
1800     if (nerr == 0)
1801         gencode();
1802     else
1803         fprintf(stderr, "No code generated.\n");
1804     exit(nerr == 0 ? 0 : 1);
1805 @}
1806 @end example
1807
1808 @noindent
1809 Revision 1.6 of @file{driver.c} contains this:
1810
1811 @example
1812 #include <stdio.h>
1813
1814 int main(int argc,
1815          char **argv)
1816 @{
1817     parse();
1818     if (argc != 1)
1819     @{
1820         fprintf(stderr, "tc: No args expected.\n");
1821         exit(1);
1822     @}
1823     if (nerr == 0)
1824         gencode();
1825     else
1826         fprintf(stderr, "No code generated.\n");
1827     exit(!!nerr);
1828 @}
1829 @end example
1830
1831 @noindent
1832 Your working copy of @file{driver.c}, based on revision
1833 1.4, contains this before you run @samp{cvs update}:
1834 @c -- Really include "cvs"?
1835
1836 @example
1837 #include <stdlib.h>
1838 #include <stdio.h>
1839
1840 void main()
1841 @{
1842     init_scanner();
1843     parse();
1844     if (nerr == 0)
1845         gencode();
1846     else
1847         fprintf(stderr, "No code generated.\n");
1848     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
1849 @}
1850 @end example
1851
1852 @noindent
1853 You run @samp{cvs update}:
1854 @c -- Really include "cvs"?
1855
1856 @example
1857 $ cvs update driver.c
1858 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
1859 retrieving revision 1.4
1860 retrieving revision 1.6
1861 Merging differences between 1.4 and 1.6 into driver.c
1862 rcsmerge warning: overlaps during merge
1863 cvs update: conflicts found in driver.c
1864 C driver.c
1865 @end example
1866
1867 @noindent
1868 @cindex Conflicts (merge example)
1869 @sc{cvs} tells you that there were some conflicts.
1870 Your original working file is saved unmodified in
1871 @file{.#driver.c.1.4}.  The new version of
1872 @file{driver.c} contains this:
1873
1874 @example
1875 #include <stdlib.h>
1876 #include <stdio.h>
1877
1878 int main(int argc,
1879          char **argv)
1880 @{
1881     init_scanner();
1882     parse();
1883     if (argc != 1)
1884     @{
1885         fprintf(stderr, "tc: No args expected.\n");
1886         exit(1);
1887     @}
1888     if (nerr == 0)
1889         gencode();
1890     else
1891         fprintf(stderr, "No code generated.\n");
1892 <<<<<<< driver.c
1893     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
1894 =======
1895     exit(!!nerr);
1896 >>>>>>> 1.6
1897 @}
1898 @end example
1899
1900 @noindent
1901 @cindex Markers, conflict
1902 @cindex Conflict markers
1903 @cindex <<<<<<<
1904 @cindex >>>>>>>
1905 @cindex =======
1906
1907 Note how all non-overlapping modifications are incorporated in your working
1908 copy, and that the overlapping section is clearly marked with
1909 @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
1910
1911 @cindex Resolving a conflict
1912 @cindex Conflict resolution
1913 You resolve the conflict by editing the file, removing the markers and
1914 the erroneous line.  Suppose you end up with this file:
1915 @c -- Add xref to the pcl-cvs manual when it talks
1916 @c -- about this.
1917 @example
1918 #include <stdlib.h>
1919 #include <stdio.h>
1920
1921 int main(int argc,
1922          char **argv)
1923 @{
1924     init_scanner();
1925     parse();
1926     if (argc != 1)
1927     @{
1928         fprintf(stderr, "tc: No args expected.\n");
1929         exit(1);
1930     @}
1931     if (nerr == 0)
1932         gencode();
1933     else
1934         fprintf(stderr, "No code generated.\n");
1935     exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
1936 @}
1937 @end example
1938
1939 @noindent
1940 You can now go ahead and commit this as revision 1.7.
1941
1942 @example
1943 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
1944 Checking in driver.c;
1945 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
1946 new revision: 1.7; previous revision: 1.6
1947 done
1948 @end example
1949
1950 @cindex emerge
1951 If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
1952 Emacs front-end for @sc{cvs}) you can use an Emacs
1953 package called emerge to help you resolve conflicts.
1954 See the documentation for pcl-cvs.
1955
1956 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1957 @node Informing others
1958 @section Informing others about commits
1959 @cindex Informing others
1960 @cindex Spreading information
1961 @cindex Mail, automatic mail on commit
1962
1963 It is often useful to inform others when you commit a
1964 new revision of a file.  The @samp{-i} option of the
1965 @file{modules} file, or the @file{loginfo} file, can be
1966 used to automate this process.  @xref{modules}.
1967 @xref{loginfo}.  You can use these features of @sc{cvs}
1968 to, for instance, instruct @sc{cvs} to mail a
1969 message to all developers, or post a message to a local
1970 newsgroup.
1971 @c -- More text would be nice here.
1972
1973 @node Concurrency
1974 @section Several developers simultaneously attempting to run CVS
1975
1976 @cindex locks, cvs
1977 If several developers try to run @sc{cvs} at the same
1978 time, one may get the following message:
1979
1980 @example
1981 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
1982 @end example
1983
1984 @sc{cvs} will try again every 30 seconds, and either
1985 continue with the operation or print the message again,
1986 if it still needs to wait.  If a lock seems to stick
1987 around for an undue amount of time, find the person
1988 holding the lock and ask them about the cvs command
1989 they are running.  If they aren't running a cvs
1990 command, look for and remove files starting with
1991 @file{#cvs.tfl}, @file{#cvs.rfl}, or @file{#cvs.wfl}
1992 from the repository.
1993
1994 Note that these locks are to protect @sc{cvs}'s
1995 internal data structures and have no relationship to
1996 the word @dfn{lock} in the sense used by @sc{rcs}--a
1997 way to prevent other developers from working on a
1998 particular file.
1999
2000 Any number of people can be reading from a given
2001 repository at a time; only when someone is writing do
2002 the locks prevent other people from reading or writing.
2003
2004 @cindex Atomic transactions, lack of
2005 @cindex Transactions, atomic, lack of
2006 One might hope for the following property
2007
2008 @example
2009 If someone commits some changes in one cvs command,
2010 then an update by someone else will either get all the
2011 changes, or none of them.
2012 @end example
2013
2014 but @sc{cvs} does @emph{not} have this property.  For
2015 example, given the files
2016
2017 @example
2018 a/one.c
2019 a/two.c
2020 b/three.c
2021 b/four.c
2022 @end example
2023
2024 if someone runs
2025
2026 @example
2027 cvs ci a/two.c b/three.c
2028 @end example
2029
2030 and someone else runs @code{cvs update} at the same
2031 time, the person running @code{update} might get only
2032 the change to @file{b/three.c} and not the change to
2033 @file{a/two.c}.
2034
2035 @node Watches
2036 @section Mechanisms to track who is editing files
2037 @cindex Watches
2038
2039 For many groups, use of @sc{cvs} in its default mode is
2040 perfectly satisfactory.  Users may sometimes go to
2041 check in a modification only to find that another
2042 modification has intervened, but they deal with it and
2043 proceed with their check in.  Other groups prefer to be
2044 able to know who is editing what files, so that if two
2045 people try to edit the same file they can choose to
2046 talk about who is doing what when rather than be
2047 surprised at check in time.  The features in this
2048 section allow such coordination, while retaining the
2049 ability of two developers to edit the same file at the
2050 same time.
2051
2052 For maximum benefit developers should use @code{cvs
2053 edit} (not @code{chmod}) to make files read-write to
2054 edit them, and @code{cvs release} (not @code{rm}) to
2055 discard a working directory which is no longer in use,
2056 but @sc{cvs} is not able to enforce this behavior.
2057
2058 @c I'm a little dissatisfied with this presentation,
2059 @c because "watch on"/"edit"/"editors" are one set of
2060 @c functionality, and "watch add"/"watchers" is another
2061 @c which is somewhat orthogonal even though they interact in
2062 @c various ways.  But I think it might be
2063 @c confusing to describe them separately (e.g. "watch
2064 @c add" with loginfo).  I don't know.
2065
2066 @menu
2067 * Setting a watch::             Telling CVS to watch certain files
2068 * Getting Notified::            Telling CVS to notify you
2069 * Editing files::               How to edit a file which is being watched
2070 * Watch information::           Information about who is watching and editing
2071 * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
2072 @end menu
2073
2074 @node Setting a watch
2075 @subsection Telling CVS to watch certain files
2076
2077 To enable the watch features, you first specify that
2078 certain files are to be watched.
2079
2080 @cindex watch on (subcommand)
2081 @deffn Command {cvs watch on} [@code{-l}] files @dots{}
2082
2083 Specify that developers should run @code{cvs edit}
2084 before editing @var{files}.  CVS will create working
2085 copies of @var{files} read-only, to remind developers
2086 to run the @code{cvs edit} command before working on
2087 them.
2088
2089 If @var{files} includes the name of a directory, CVS
2090 arranges to watch all files added to the corresponding
2091 repository directory, and sets a default for files
2092 added in the future; this allows the user to set
2093 notification policies on a per-directory basis.  The
2094 contents of the directory are processed recursively,
2095 unless the @code{-l} option is given.
2096
2097 If @var{files} is omitted, it defaults to the current directory.
2098
2099 @cindex watch off (subcommand)
2100 @end deffn
2101
2102 @deffn Command {cvs watch off} [@code{-l}] files @dots{}
2103
2104 Do not provide notification about work on @var{files}.  CVS will create
2105 working copies of @var{files} read-write.
2106
2107 The @var{files} and @code{-l} arguments are processed as for @code{cvs
2108 watch on}.
2109
2110 @end deffn
2111
2112 @node Getting Notified
2113 @subsection Telling CVS to notify you
2114
2115 You can tell @sc{cvs} that you want to receive
2116 notifications about various actions taken on a file.
2117 You can do this without using @code{cvs watch on} for
2118 the file, but generally you will want to use @code{cvs
2119 watch on}, so that developers use the @code{cvs edit}
2120 command.
2121
2122 @cindex watch add (subcommand)
2123 @deffn Command {cvs watch add} [@code{-a} action] [@code{-l}] files @dots{}
2124
2125 Add the current user to the list of people to receive notification of
2126 work done on @var{files}.
2127
2128 The @code{-a} option specifies what kinds of events CVS should notify
2129 the user about.  @var{action} is one of the following:
2130
2131 @table @code
2132
2133 @item edit
2134 Another user has applied the @code{cvs edit} command (described
2135 below) to a file.
2136
2137 @item unedit
2138 Another user has applied the @code{cvs unedit} command (described
2139 below) or the @code{cvs release} command to a file, or has deleted
2140 the file and allowed @code{cvs update} to recreate it.
2141
2142 @item commit
2143 Another user has committed changes to a file.
2144
2145 @item all
2146 All of the above.
2147
2148 @item none
2149 None of the above.  (This is useful with @code{cvs edit},
2150 described below.)
2151
2152 @end table
2153
2154 The @code{-a} option may appear more than once, or not at all.  If
2155 omitted, the action defaults to @code{all}.
2156
2157 The @var{files} and @code{-l} option are processed as for the
2158 @code{cvs watch} commands.
2159
2160 @end deffn
2161
2162
2163 @cindex watch remove (subcommand)
2164 @deffn Command {cvs watch remove} [@code{-a} action] [@code{-l}] files @dots{}
2165
2166 Remove a notification request established using @code{cvs watch add};
2167 the arguments are the same.  If the @code{-a} option is present, only
2168 watches for the specified actions are removed.
2169
2170 @end deffn
2171
2172 When the conditions exist for notification, @sc{cvs}
2173 calls the @file{notify} administrative file, passing it
2174 the user to receive the notification and the user who
2175 is taking the action which results in notification.
2176 Normally @file{notify} will just send an email message.
2177
2178 @cindex users (admin file)
2179 Note that if you set this up in the straightforward
2180 way, users receive notifications on the server machine.
2181 One could of course write a @file{notify} script which
2182 directed notifications elsewhere, but to make this
2183 easy, @sc{cvs} allows you to associate a notification
2184 address for each user.  To do so create a file
2185 @file{users} in @file{CVSROOT} with a line for each
2186 user in the format @var{user}:@var{value}.  Then
2187 instead of passing the name of the user to be notified
2188 to @file{notify}, @sc{cvs} will pass the @var{value}
2189 (normally an email address on some other machine).
2190
2191 @node Editing files
2192 @subsection How to edit a file which is being watched
2193
2194 Since a file which is being watched is checked out
2195 read-only, you cannot simply edit it.  To make it
2196 read-write, and inform others that you are planning
2197 to edit it, use the @code{cvs edit} command.
2198
2199 @cindex edit (subcommand)
2200 @deffn Command {cvs edit} [options] files @dots{}
2201
2202 Prepare to edit the working files @var{files}.  CVS makes the
2203 @var{files} read-write, and notifies users who have requested
2204 @code{edit} notification for any of @var{files}.
2205
2206 The @code{cvs edit} command accepts the same @var{options} as the
2207 @code{cvs watch add} command, and establishes a temporary watch for the
2208 user on @var{files}; CVS will remove the watch when @var{files} are
2209 @code{unedit}ed or @code{commit}ted.  If the user does not wish to
2210 receive notifications, she should specify @code{-a none}.
2211
2212 The @var{files} and @code{-l} option are processed as for the @code{cvs
2213 watch} commands.
2214
2215 @end deffn
2216
2217 Normally when you are done with a set of changes, you
2218 use the @code{cvs commit} command, which checks in your
2219 changes and returns the watched files to their usual
2220 read-only state.  But if you instead decide to abandon
2221 your changes, or not to make any changes, you can use
2222 the @code{cvs unedit} command.
2223
2224 @cindex unedit (subcommand)
2225 @deffn Command {cvs unedit} [@code{-l}] files @dots{}
2226
2227 Abandon work on the working files @var{files}, and revert them to the
2228 repository versions on which they are based.  CVS makes those
2229 @var{files} read-only for which users have requested notification using
2230 @code{cvs watch on}.  CVS notifies users who have requested @code{unedit}
2231 notification for any of @var{files}.
2232
2233 The @var{files} and @code{-l} option are processed as for the
2234 @code{cvs watch} commands.
2235
2236 @end deffn
2237
2238 When using client/server @sc{cvs}, you can use the
2239 @code{cvs edit} and @code{cvs unedit} commands even if
2240 @sc{cvs} is unable to succesfully communicate with the
2241 server; the notifications will be sent upon the next
2242 successful @sc{cvs} command.
2243
2244 @node Watch information
2245 @subsection Information about who is watching and editing
2246
2247 @cindex watchers (subcommand)
2248 @deffn Command {cvs watchers} [@code{-l}] files @dots{}
2249
2250 List the users currently watching changes to @var{files}.  The report
2251 includes the files being watched, and the mail address of each watcher.
2252
2253 The @var{files} and @code{-l} arguments are processed as for the
2254 @code{cvs watch} commands.
2255
2256 @end deffn
2257
2258
2259 @cindex editors (subcommand)
2260 @deffn Command {cvs editors} [@code{-l}] files @dots{}
2261
2262 List the users currently working on @var{files}.  The report
2263 includes the mail address of each user, the time when the user began
2264 working with the file, and the host and path of the working directory
2265 containing the file.
2266
2267 The @var{files} and @code{-l} arguments are processed as for the
2268 @code{cvs watch} commands.
2269
2270 @end deffn
2271
2272 @node Watches Compatibility
2273 @subsection Using watches with old versions of CVS
2274
2275 @cindex CVS 1.6, and watches
2276 If you use the watch features on a repository, it
2277 creates @file{CVS} directories in the repository and
2278 stores the information about watches in that directory.
2279 If you attempt to use @sc{cvs} 1.6 or earlier with the
2280 repository, you get an error message such as
2281
2282 @example
2283 cvs update: cannot open CVS/Entries for reading: No such file or directory
2284 @end example
2285
2286 and your operation will likely be aborted.  To use the
2287 watch features, you must upgrade all copies of @sc{cvs}
2288 which use that repository in local or server mode.  If
2289 you cannot upgrade, use the @code{watch off} and
2290 @code{watch remove} commands to remove all watches, and
2291 that will restore the repository to a state which
2292 @sc{cvs} 1.6 can cope with.
2293
2294 @c ---------------------------------------------------------------------
2295 @node Branches
2296 @chapter Branches
2297 @cindex Branches
2298 @cindex Main trunk and branches
2299 @cindex Revision tree, making branches
2300
2301 So far, all revisions shown in this manual have been on
2302 the @dfn{main trunk}
2303 of the revision tree, i.e., all revision numbers
2304 have been of the form @var{x}.@var{y}.  One useful
2305 feature, especially when maintaining several releases
2306 of a software product at once, is the ability to make
2307 branches on the revision tree.  @dfn{Tags}, symbolic
2308 names for revisions, will also be
2309 introduced in this chapter.
2310
2311 @menu
2312 * Tags::                        Tags--Symbolic revisions
2313 * Branches motivation::         What branches are good for
2314 * Creating a branch::           Creating a branch
2315 * Sticky tags::                 Sticky tags
2316 @end menu
2317
2318 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2319 @node Tags
2320 @section Tags--Symbolic revisions
2321 @cindex Tags
2322
2323 The revision numbers live a life of their own.  They
2324 need not have anything at all to do with the release
2325 numbers of your software product.  Depending
2326 on how you use @sc{cvs} the revision numbers might change several times
2327 between two releases.  As an example, some of the
2328 source files that make up @sc{rcs} 5.6 have the following
2329 revision numbers:
2330 @cindex RCS revision numbers
2331
2332 @example
2333 ci.c            5.21
2334 co.c            5.9
2335 ident.c         5.3
2336 rcs.c           5.12
2337 rcsbase.h       5.11
2338 rcsdiff.c       5.10
2339 rcsedit.c       5.11
2340 rcsfcmp.c       5.9
2341 rcsgen.c        5.10
2342 rcslex.c        5.11
2343 rcsmap.c        5.2
2344 rcsutil.c       5.10
2345 @end example
2346
2347 @cindex tag, command, introduction
2348 @cindex Tag, symbolic name
2349 @cindex Symbolic name (tag)
2350 @cindex Name, symbolic (tag)
2351 You can use the @code{tag} command to give a symbolic name to a
2352 certain revision of a file.  You can use the @samp{-v} flag to the
2353 @code{status} command to see all tags that a file has, and
2354 which revision numbers they represent.  Tag names can
2355 contain uppercase and lowercase letters, digits,
2356 @samp{-}, and @samp{_}.  The two tag names @code{BASE}
2357 and @code{HEAD} are reserved for use by @sc{cvs}.  It
2358 is expected that future names which are special to
2359 @sc{cvs} will contain characters such as @samp{%} or
2360 @samp{=}, rather than being named analogously to
2361 @code{BASE} and @code{HEAD}, to avoid conflicts with
2362 actual tag names.
2363 @c FIXME: is the above list of valid characters in tag
2364 @c names complete?
2365
2366 @cindex Adding a tag
2367 @cindex tag, example
2368 The following example shows how you can add a tag to a
2369 file.  The commands must be issued inside your working
2370 copy of the module.  That is, you should issue the
2371 command in the directory where @file{backend.c}
2372 resides.
2373
2374 @example
2375 $ cvs tag release-0-4 backend.c
2376 T backend.c
2377 $ cvs status -v backend.c
2378 ===================================================================
2379 File: backend.c         Status: Up-to-date
2380
2381     Version:            1.4     Tue Dec  1 14:39:01 1992
2382     RCS Version:        1.4     /usr/local/cvsroot/yoyodyne/tc/backend.c,v
2383     Sticky Tag:         (none)
2384     Sticky Date:        (none)
2385     Sticky Options:     (none)
2386
2387     Existing Tags:
2388         release-0-4                     (revision: 1.4)
2389
2390 @end example
2391
2392 There is seldom reason to tag a file in isolation.  A more common use is
2393 to tag all the files that constitute a module with the same tag at
2394 strategic points in the development life-cycle, such as when a release
2395 is made.
2396
2397 @example
2398 $ cvs tag release-1-0 .
2399 cvs tag: Tagging .
2400 T Makefile
2401 T backend.c
2402 T driver.c
2403 T frontend.c
2404 T parser.c
2405 @end example
2406
2407 (When you give @sc{cvs} a directory as argument, it generally applies the
2408 operation to all the files in that directory, and (recursively), to any
2409 subdirectories that it may contain.  @xref{Recursive behavior}.)
2410
2411 @cindex Retrieving an old revision using tags
2412 @cindex Tag, retrieving old revisions
2413 The @code{checkout} command has a flag, @samp{-r}, that lets you check out
2414 a certain revision of a module.  This flag makes it easy to
2415 retrieve the sources that make up release 1.0 of the module @samp{tc} at
2416 any time in the future:
2417
2418 @example
2419 $ cvs checkout -r release-1-0 tc
2420 @end example
2421
2422 @noindent
2423 This is useful, for instance, if someone claims that there is a bug in
2424 that release, but you cannot find the bug in the current working copy.
2425
2426 You can also check out a module as it was at any given date.
2427 @xref{checkout options}.
2428
2429 When you tag more than one file with the same tag you
2430 can think about the tag as "a curve drawn through a
2431 matrix of filename vs. revision number."  Say we have 5
2432 files with the following revisions:
2433
2434 @example
2435 @group
2436         file1   file2   file3   file4   file5
2437
2438         1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
2439         1.2*-   1.2     1.2    -1.2*-
2440         1.3  \- 1.3*-   1.3   / 1.3
2441         1.4          \  1.4  /  1.4
2442                       \-1.5*-   1.5
2443                         1.6
2444 @end group
2445 @end example
2446
2447 At some time in the past, the @code{*} versions were tagged.
2448 You can think of the tag as a handle attached to the curve
2449 drawn through the tagged revisions.  When you pull on
2450 the handle, you get all the tagged revisions.  Another
2451 way to look at it is that you "sight" through a set of
2452 revisions that is "flat" along the tagged revisions,
2453 like this:
2454
2455 @example
2456 @group
2457         file1   file2   file3   file4   file5
2458
2459                         1.1
2460                         1.2
2461                 1.1     1.3                       _
2462         1.1     1.2     1.4     1.1              /
2463         1.2*----1.3*----1.5*----1.2*----1.1     (--- <--- Look here
2464         1.3             1.6     1.3              \_
2465         1.4                     1.4
2466                                 1.5
2467 @end group
2468 @end example
2469
2470 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2471 @node Branches motivation
2472 @section What branches are good for
2473 @cindex Branches motivation
2474 @cindex What branches are good for
2475 @cindex Motivation for branches
2476
2477 Suppose that release 1.0 of tc has been made.  You are continuing to
2478 develop tc, planning to create release 1.1 in a couple of months.  After a
2479 while your customers start to complain about a fatal bug.  You check
2480 out release 1.0 (@pxref{Tags}) and find the bug
2481 (which turns out to have a trivial fix).  However, the current revision
2482 of the sources are in a state of flux and are not expected to be stable
2483 for at least another month.  There is no way to make a
2484 bugfix release based on the newest sources.
2485
2486 The thing to do in a situation like this is to create a @dfn{branch} on
2487 the revision trees for all the files that make up
2488 release 1.0 of tc.  You can then make
2489 modifications to the branch without disturbing the main trunk.  When the
2490 modifications are finished you can select to either incorporate them on
2491 the main trunk, or leave them on the branch.
2492
2493 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2494 @node Creating a branch
2495 @section Creating a branch
2496 @cindex Creating a branch
2497 @cindex Branch, creating a
2498 @cindex rtag, creating a branch using
2499
2500 @c FIXME: should be more explicit about the value of
2501 @c having a tag on the branchpoint.  Also should talk
2502 @c about creating a branch with tag not rtag.
2503 The @code{rtag} command can be used to create a branch.
2504 The @code{rtag} command is much like @code{tag}, but it
2505 does not require that you have a working copy of the
2506 module.  @xref{rtag}.  (You can also use the @code{tag}
2507 command; @pxref{tag}).
2508
2509 @example
2510 $ cvs rtag -b -r release-1-0 release-1-0-patches tc
2511 @end example
2512
2513 The @samp{-b} flag makes @code{rtag} create a branch
2514 (rather than just a symbolic revision name).  @samp{-r
2515 release-1-0} says that this branch should be rooted at the node (in
2516 the revision tree) that corresponds to the tag
2517 @samp{release-1-0}.  Note that the numeric revision number that matches
2518 @samp{release-1-0} will probably be different from file to file.  The
2519 name of the new branch is @samp{release-1-0-patches}, and the
2520 module affected is @samp{tc}.
2521
2522 To fix the problem in release 1.0, you need a working
2523 copy of the branch you just created.
2524
2525 @example
2526 $ cvs checkout -r release-1-0-patches tc
2527 $ cvs status -v driver.c backend.c
2528 ===================================================================
2529 File: driver.c          Status: Up-to-date
2530
2531     Version:            1.7     Sat Dec  5 18:25:54 1992
2532     RCS Version:        1.7     /usr/local/cvsroot/yoyodyne/tc/driver.c,v
2533     Sticky Tag:         release-1-0-patches (branch: 1.7.2)
2534     Sticky Date:        (none)
2535     Sticky Options:     (none)
2536
2537     Existing Tags:
2538         release-1-0-patches             (branch: 1.7.2)
2539         release-1-0                     (revision: 1.7)
2540
2541 ===================================================================
2542 File: backend.c         Status: Up-to-date
2543
2544     Version:            1.4     Tue Dec  1 14:39:01 1992
2545     RCS Version:        1.4     /usr/local/cvsroot/yoyodyne/tc/backend.c,v
2546     Sticky Tag:         release-1-0-patches (branch: 1.4.2)
2547     Sticky Date:        (none)
2548     Sticky Options:     (none)
2549
2550     Existing Tags:
2551         release-1-0-patches             (branch: 1.4.2)
2552         release-1-0                     (revision: 1.4)
2553         release-0-4                     (revision: 1.4)
2554
2555 @end example
2556
2557 @cindex Branch numbers
2558 As the output from the @code{status} command shows the branch
2559 number is created by adding a digit at the tail of the revision number
2560 it is based on.  (If @samp{release-1-0} corresponds to revision 1.4, the
2561 branch's revision number will be 1.4.2.  For obscure reasons @sc{cvs} always
2562 gives branches even numbers, starting at 2.
2563 @xref{Revision numbers}).
2564
2565 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2566 @node Sticky tags
2567 @section Sticky tags
2568 @cindex Sticky tags
2569 @cindex Tags, sticky
2570 @cindex Branches, sticky
2571
2572 @c FIXME: make this stand alone better; many places
2573 @c @xref to this node.
2574 The @samp{-r release-1-0-patches} flag that was given
2575 to @code{checkout} in the previous example
2576 is @dfn{sticky}, that is, it will apply to subsequent commands
2577 in this directory.  If you commit any modifications, they are
2578 committed on the branch.  You can later merge the modifications into
2579 the main trunk.  @xref{Merging}.
2580
2581 You can use the @code{status} command to see what
2582 sticky tags or dates are set:
2583
2584 @c FIXME: This example needs to stand alone better and it
2585 @c would also better if it didn't use -v which only
2586 @c clutters the output in this context.
2587 @example
2588 $ vi driver.c   # @r{Fix the bugs}
2589 $ cvs commit -m "Fixed initialization bug" driver.c
2590 Checking in driver.c;
2591 /usr/local/cvsroot/yoyodyne/tc/driver.c,v  <--  driver.c
2592 new revision: 1.7.2.1; previous revision: 1.7
2593 done
2594 $ cvs status -v driver.c
2595 ===================================================================
2596 File: driver.c          Status: Up-to-date
2597
2598     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
2599     RCS Version:        1.7.2.1 /usr/local/cvsroot/yoyodyne/tc/driver.c,v
2600     Sticky Tag:         release-1-0-patches (branch: 1.7.2)
2601     Sticky Date:        (none)
2602     Sticky Options:     (none)
2603
2604     Existing Tags:
2605         release-1-0-patches             (branch: 1.7.2)
2606         release-1-0                     (revision: 1.7)
2607
2608 @end example
2609
2610 @cindex Resetting sticky tags
2611 @cindex Sticky tags, resetting
2612 @cindex Deleting sticky tags
2613 The sticky tags will remain on your working files until
2614 you delete them with @samp{cvs update -A}.  The
2615 @samp{-A} option retrieves the version of the file from
2616 the head of the trunk, and forgets any sticky tags,
2617 dates, or options.
2618
2619 @c Is the fact that CVS works this way a bug or a
2620 @c feature?  If a feature, describe how you would use
2621 @c it to do something useful.
2622 Sticky tags are not just for branches.  If you check
2623 out a certain revision (such as 1.4) it will also
2624 become sticky.  Subsequent @samp{cvs update} will not
2625 retrieve the latest revision until you reset the tag
2626 with @samp{cvs update -A}.  Likewise, use of the
2627 @samp{-D} option to @code{update} or @code{checkout}
2628 sets a @dfn{sticky date}, which, similarly, causes that
2629 date to be used for future retrievals.
2630
2631 @cindex Restoring old version of removed file
2632 @cindex Resurrecting old version of dead file
2633 Many times you will want to retrieve an old version of
2634 a file without setting a sticky tag.  The way to do
2635 that is with the @samp{-p} option to @code{checkout} or
2636 @code{update}, which sends the contents of the file to
2637 standard output.  For example, suppose you have a file
2638 named @file{file1} which existed as revision 1.1, and
2639 you then removed it (thus adding a dead revision 1.2).
2640 Now suppose you want to add it again, with the same
2641 contents it had previously.  Here is how to do it:
2642
2643 @example
2644 $ cvs update -p -r 1.1 file1 >file1
2645 ===================================================================
2646 Checking out file1
2647 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
2648 VERS: 1.1
2649 ***************
2650 $ cvs add file1
2651 cvs add: version 1.2 of `file1' will be resurrected
2652 cvs add: use 'cvs commit' to add this file permanently
2653 $ cvs commit -m test
2654 Checking in file1;
2655 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
2656 new revision: 1.3; previous revision: 1.2
2657 done
2658
2659 @end example
2660
2661 @c ---------------------------------------------------------------------
2662 @node Merging
2663 @chapter Merging
2664 @cindex Merging
2665 @cindex Copying changes
2666 @cindex Branches, copying changes between
2667 @cindex Changes, copying between branches
2668 @cindex Modifications, copying between branches
2669
2670 You can include the changes made between any two
2671 revisions into your working copy, by @dfn{merging}.
2672 You can then commit that revision, and thus effectively
2673 copy the changes onto another branch.
2674
2675 @menu
2676 * Merging a branch::            Merging an entire branch
2677 * Merging more than once::      Merging from a branch several times
2678 * Merging two revisions::       Merging differences between two revisions
2679 @end menu
2680
2681 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2682 @node Merging a branch
2683 @section Merging an entire branch
2684 @cindex Merging a branch
2685 @cindex -j (merging branches)
2686
2687 You can merge changes made on a branch into your working copy by giving
2688 the @samp{-j @var{branch}} flag to the @code{update} command.  With one
2689 @samp{-j @var{branch}} option it merges the changes made between the
2690 point where the branch forked and newest revision on that branch (into
2691 your working copy).
2692
2693 @cindex Join
2694 The @samp{-j} stands for ``join''.
2695
2696 @cindex Branch merge example
2697 @cindex Example, branch merge
2698 @cindex Merge, branch example
2699 Consider this revision tree:
2700
2701 @example
2702 +-----+    +-----+    +-----+    +-----+
2703 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !      <- The main trunk
2704 +-----+    +-----+    +-----+    +-----+
2705                 !
2706                 !
2707                 !   +---------+    +---------+
2708 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
2709                     +---------+    +---------+
2710 @end example
2711
2712 @noindent
2713 The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}.  The
2714 following example assumes that the module @samp{mod} contains only one
2715 file, @file{m.c}.
2716
2717 @example
2718 $ cvs checkout mod               # @r{Retrieve the latest revision, 1.4}
2719
2720 $ cvs update -j R1fix m.c        # @r{Merge all changes made on the branch,}
2721                                  # @r{i.e. the changes between revision 1.2}
2722                                  # @r{and 1.2.2.2, into your working copy}
2723                                  # @r{of the file.}
2724
2725 $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
2726 @end example
2727
2728 A conflict can result from a merge operation.  If that
2729 happens, you should resolve it before committing the
2730 new revision.  @xref{Conflicts example}.
2731
2732 The @code{checkout} command also supports the @samp{-j @var{branch}} flag.  The
2733 same effect as above could be achieved with this:
2734
2735 @example
2736 $ cvs checkout -j R1fix mod
2737 $ cvs commit -m "Included R1fix"
2738 @end example
2739
2740 @node Merging more than once
2741 @section Merging from a branch several times
2742
2743 Continuing our example, the revision tree now looks
2744 like this:
2745
2746 @example
2747 +-----+    +-----+    +-----+    +-----+    +-----+
2748 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !      <- The main trunk
2749 +-----+    +-----+    +-----+    +-----+    +-----+
2750                 !                           *
2751                 !                          *
2752                 !   +---------+    +---------+
2753 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
2754                     +---------+    +---------+
2755 @end example
2756
2757 where the starred line represents the merge from the
2758 @samp{R1fix} branch to the main trunk, as just
2759 discussed.
2760
2761 Now suppose that development continues on the
2762 @samp{R1fix} branch:
2763
2764 @example
2765 +-----+    +-----+    +-----+    +-----+    +-----+
2766 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !      <- The main trunk
2767 +-----+    +-----+    +-----+    +-----+    +-----+
2768                 !                           *
2769                 !                          *
2770                 !   +---------+    +---------+    +---------+
2771 Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
2772                     +---------+    +---------+    +---------+
2773 @end example
2774
2775 and then you want to merge those new changes onto the
2776 main trunk.  If you just use the @code{cvs update -j
2777 R1fix m.c} command again, @sc{cvs} will attempt to
2778 merge again the changes which you have already merged,
2779 which can have undesirable side effects.
2780
2781 So instead you need to specify that you only want to
2782 merge the changes on the branch which have not yet been
2783 merged into the trunk.  To do that you specify two
2784 @samp{-j} options, and @sc{cvs} merges the changes from
2785 the first revision to the second revision.  For
2786 example, in this case the simplest way would be
2787
2788 @example
2789 cvs update -j 1.2.2.2 -j R1fix m.c    # @r{Merge changes from 1.2.2.2 to the}
2790                                       # @r{head of the R1fix branch}
2791 @end example
2792
2793 The problem with this is that you need to specify the
2794 1.2.2.2 revision manually.  A slightly better approach
2795 might be to use the date the last merge was done:
2796
2797 @example
2798 cvs update -j R1fix:yesterday -j R1fix m.c
2799 @end example
2800
2801 Better yet, tag the R1fix branch after every merge into
2802 the trunk, and then use that tag for subsequent merges:
2803
2804 @example
2805 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
2806 @end example
2807
2808 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2809 @node Merging two revisions
2810 @section Merging differences between any two revisions
2811 @cindex Merging two revisions
2812 @cindex Revisions, merging differences between
2813 @cindex Differences, merging
2814
2815 With two @samp{-j @var{revision}} flags, the @code{update}
2816 (and @code{checkout}) command can merge the differences
2817 between any two revisions into your working file.
2818
2819 @cindex Undoing a change
2820 @cindex Removing a change
2821 @example
2822 $ cvs update -j 1.5 -j 1.3 backend.c
2823 @end example
2824
2825 @noindent
2826 will @emph{remove} all changes made between revision
2827 1.3 and 1.5.  Note the order of the revisions!
2828
2829 If you try to use this option when operating on
2830 multiple files, remember that the numeric revisions will
2831 probably be very different between the various files
2832 that make up a module.  You almost always use symbolic
2833 tags rather than revision numbers when operating on
2834 multiple files.
2835
2836 @c ---------------------------------------------------------------------
2837 @node Recursive behavior
2838 @chapter Recursive behavior
2839 @cindex Recursive (directory descending)
2840 @cindex Directory, descending
2841 @cindex Descending directories
2842 @cindex Subdirectories
2843
2844 Almost all of the subcommands of @sc{cvs} work
2845 recursively when you specify a directory as an
2846 argument.  For instance, consider this directory
2847 structure:
2848
2849 @example
2850       @code{$HOME}
2851         |
2852         +--@t{tc}
2853         |   |
2854             +--@t{CVS}
2855             |      (internal @sc{cvs} files)
2856             +--@t{Makefile}
2857             +--@t{backend.c}
2858             +--@t{driver.c}
2859             +--@t{frontend.c}
2860             +--@t{parser.c}
2861             +--@t{man}
2862             |    |
2863             |    +--@t{CVS}
2864             |    |  (internal @sc{cvs} files)
2865             |    +--@t{tc.1}
2866             |     
2867             +--@t{testing}
2868                  |
2869                  +--@t{CVS}
2870                  |  (internal @sc{cvs} files)
2871                  +--@t{testpgm.t}
2872                  +--@t{test2.t}
2873 @end example
2874
2875 @noindent
2876 If @file{tc} is the current working directory, the
2877 following is true:
2878
2879 @itemize @bullet
2880 @item
2881 @samp{cvs update testing} is equivalent to @samp{cvs
2882 update testing/testpgm.t testing/test2.t}
2883
2884 @item
2885 @samp{cvs update testing man} updates all files in the
2886 subdirectories 
2887
2888 @item
2889 @samp{cvs update .} or just @samp{cvs update} updates
2890 all files in the @code{tc} module
2891 @end itemize
2892
2893 If no arguments are given to @code{update} it will
2894 update all files in the current working directory and
2895 all its subdirectories.  In other words, @file{.} is a
2896 default argument to @code{update}.  This is also true
2897 for most of the @sc{cvs} subcommands, not only the
2898 @code{update} command.
2899
2900 The recursive behavior of the @sc{cvs} subcommands can be
2901 turned off with the @samp{-l} option.
2902
2903 @example
2904 $ cvs update -l         # @r{Don't update files in subdirectories}
2905 @end example
2906
2907 @c ---------------------------------------------------------------------
2908 @node Adding files
2909 @chapter Adding files to a module
2910 @cindex Adding files
2911
2912 To add a new file to a module, follow these steps.
2913
2914 @itemize @bullet
2915 @item
2916 You must have a working copy of the module.
2917 @xref{Getting the source}.
2918
2919 @item
2920 Create the new file inside your working copy of the module.
2921
2922 @item
2923 Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
2924 want to version control the file.
2925
2926 @item
2927 Use @samp{cvs commit @var{filename}} to actually check
2928 in the file into the repository.  Other developers
2929 cannot see the file until you perform this step.
2930
2931 @item
2932 If the file contains binary data it might be necessary
2933 to change the default keyword substitution.
2934 @xref{Keyword substitution}.  @xref{admin examples}.
2935 @end itemize
2936
2937 You can also use the @code{add} command to add a new
2938 directory inside a module.
2939
2940 Unlike most other commands, the @code{add} command is
2941 not recursive.  You cannot even type @samp{cvs add
2942 foo/bar}!  Instead, you have to
2943
2944 @example
2945 $ cd foo
2946 $ cvs add bar
2947 @end example
2948
2949 @xref{add}, for a more complete description of the @code{add}
2950 command.
2951
2952 @c ---------------------------------------------------------------------
2953 @node Removing files
2954 @chapter Removing files from a module
2955 @cindex Removing files
2956 @cindex Deleting files
2957
2958 Modules change.  New files are added, and old files
2959 disappear.  Still, you want to be able to retrieve an
2960 exact copy of old releases of the module.
2961
2962 Here is what you can do to remove a file from a module,
2963 but remain able to retrieve old revisions:
2964
2965 @itemize @bullet
2966 @item
2967 Make sure that you have not made any uncommitted
2968 modifications to the file.  @xref{Viewing differences},
2969 for one way to do that.  You can also use the
2970 @code{status} or @code{update} command.  If you remove
2971 the file without committing your changes, you will of
2972 course not be able to retrieve the file as it was
2973 immediately before you deleted it.
2974
2975 @item
2976 Remove the file from your working copy of the module.
2977 You can for instance use @code{rm}.
2978
2979 @item
2980 Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
2981 you really want to delete the file.
2982
2983 @item
2984 Use @samp{cvs commit @var{filename}} to actually
2985 perform the removal of the file from the repository.
2986 @end itemize
2987
2988 When you commit the removal of the file, @sc{cvs}
2989 records the fact that the file no longer exists.  It is
2990 possible for a file to exist on only some branches and
2991 not on others, or to re-add another file with the same
2992 name later.  CVS will correctly create or not create
2993 the file, based on the @samp{-r} and @samp{-D} options
2994 specified to @code{checkout} or @code{update}.
2995
2996 @cindex Remove (subcommand)
2997 @deffn Command {cvs remove} [@code{-lR}] files @dots{}
2998
2999 Schedule file(s) to be removed from the repository
3000 (files which have not already been removed from the
3001 working directory are not processed).  This command
3002 does not actually remove the file from the repository
3003 until you commit the removal.  The @samp{-R} option
3004 (the default) specifies that it will recurse into
3005 subdirectories; @samp{-l} specifies that it will not.
3006 @end deffn
3007
3008 Here is an example of removing several files:
3009
3010 @example
3011 $ cd test
3012 $ rm ?.c
3013 $ cvs remove
3014 cvs remove: Removing .
3015 cvs remove: scheduling a.c for removal
3016 cvs remove: scheduling b.c for removal
3017 cvs remove: use 'cvs commit' to remove these files permanently
3018 $ cvs ci -m "Removed unneeded files"
3019 cvs commit: Examining .
3020 cvs commit: Committing .
3021 @end example
3022
3023 If you change your mind you can easily resurrect the
3024 file before you commit it, using the @code{add}
3025 command.
3026
3027 @example
3028 $ ls
3029 CVS   ja.h  oj.c
3030 $ rm oj.c
3031 $ cvs remove oj.c
3032 cvs remove: scheduling oj.c for removal
3033 cvs remove: use 'cvs commit' to remove this file permanently
3034 $ cvs add oj.c
3035 U oj.c
3036 cvs add: oj.c, version 1.1.1.1, resurrected
3037 @end example
3038
3039 If you realize your mistake before you run the
3040 @code{remove} command you can use @code{update} to
3041 resurrect the file:
3042
3043 @example
3044 $ rm oj.c
3045 $ cvs update oj.c
3046 cvs update: warning: oj.c was lost
3047 U oj.c
3048 @end example
3049
3050 @c ---------------------------------------------------------------------
3051 @node Tracking sources
3052 @chapter Tracking third-party sources
3053 @cindex Third-party sources
3054 @cindex Tracking sources
3055
3056 If you modify a program to better fit your site, you
3057 probably want to include your modifications when the next
3058 release of the program arrives.  @sc{cvs} can help you with
3059 this task.
3060
3061 @cindex Vendor
3062 @cindex Vendor branch
3063 @cindex Branch, vendor-
3064 In the terminology used in @sc{cvs}, the supplier of the
3065 program is called a @dfn{vendor}.  The unmodified
3066 distribution from the vendor is checked in on its own
3067 branch, the @dfn{vendor branch}.  @sc{cvs} reserves branch
3068 1.1.1 for this use.
3069
3070 When you modify the source and commit it, your revision
3071 will end up on the main trunk.  When a new release is
3072 made by the vendor, you commit it on the vendor branch
3073 and copy the modifications onto the main trunk.
3074
3075 Use the @code{import} command to create and update
3076 the vendor branch.  After a successful @code{import}
3077 the vendor branch is made the `head' revision, so
3078 anyone that checks out a copy of the file gets that
3079 revision.  When a local modification is committed it is
3080 placed on the main trunk, and made the `head'
3081 revision.
3082
3083 @menu
3084 * First import::                Importing a module for the first time
3085 * Update imports::              Updating a module with the import command
3086 @end menu
3087
3088 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3089 @node First import
3090 @section Importing a module for the first time
3091 @cindex Importing modules
3092
3093 Use the @code{import} command to check in the sources
3094 for the first time.  When you use the @code{import}
3095 command to track third-party sources, the @dfn{vendor
3096 tag} and @dfn{release tags} are useful.  The
3097 @dfn{vendor tag} is a symbolic name for the branch
3098 (which is always 1.1.1, unless you use the @samp{-b
3099 @var{branch}} flag---@xref{import options}).  The
3100 @dfn{release tags} are symbolic names for a particular
3101 release, such as @samp{FSF_0_04}.
3102
3103 @cindex Wdiff (import example)
3104 Suppose you use @code{wdiff} (a variant of @code{diff}
3105 that ignores changes that only involve whitespace), and
3106 are going to make private modifications that you want
3107 to be able to use even when new releases are made in
3108 the future.  You start by importing the source to your
3109 repository:
3110
3111 @example
3112 $ tar xfz wdiff-0.04.tar.gz
3113 $ cd wdiff-0.04
3114 $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
3115 @end example
3116
3117 The vendor tag is named @samp{FSF_DIST} in the above
3118 example, and the only release tag assigned is
3119 @samp{WDIFF_0_04}.
3120
3121 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3122 @node Update imports
3123 @section Updating a module with the import command
3124
3125 When a new release of the source arrives, you import it into the
3126 repository with the same @code{import} command that you used to set up
3127 the repository in the first place.  The only difference is that you
3128 specify a different release tag this time.
3129
3130 @example
3131 $ tar xfz wdiff-0.05.tar.gz
3132 $ cd wdiff-0.05
3133 $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
3134 @end example
3135
3136 For files that have not been modified locally, the newly created
3137 revision becomes the head revision.  If you have made local
3138 changes, @code{import} will warn you that you must merge the changes
3139 into the main trunk, and tell you to use @samp{checkout -j} to do so.
3140
3141 @example
3142 $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
3143 @end example
3144
3145 @noindent
3146 The above command will check out the latest revision of
3147 @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
3148 since yesterday into the working copy.  If any conflicts arise during
3149 the merge they should be resolved in the normal way (@pxref{Conflicts
3150 example}).  Then, the modified files may be committed.
3151
3152 Using a date, as suggested above, assumes that you do
3153 not import more than one release of a product per
3154 day. If you do, you can always use something like this
3155 instead:
3156
3157 @example
3158 $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
3159 @end example
3160
3161 @noindent
3162 In this case, the two above commands are equivalent.
3163
3164 @c ---------------------------------------------------------------------
3165 @node Moving files
3166 @chapter Moving and renaming files
3167 @cindex Moving files
3168 @cindex Renaming files
3169 @cindex Files, moving
3170
3171 Moving files to a different directory or renaming them
3172 is not difficult, but some of the ways in which this
3173 works may be non-obvious.  (Moving or renaming a
3174 directory is even harder.  @xref{Moving directories}).
3175
3176 The examples below assume that the file @var{old} is renamed to
3177 @var{new}.
3178
3179 @menu
3180 * Outside::                     The normal way to Rename
3181 * Inside::                      A tricky, alternative way
3182 * Rename by copying::           Another tricky, alternative way
3183 @end menu
3184
3185 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3186 @node Outside
3187 @section The Normal way to Rename
3188
3189 The normal way to move a file is to copy @var{old} to
3190 @var{new}, and then issue the normal @sc{cvs} commands
3191 to remove @var{old} from the repository, and add
3192 @var{new} to it.  (Both @var{old} and @var{new} could
3193 contain relative paths, for example @file{foo/bar.c}).
3194
3195 @example
3196 $ mv @var{old} @var{new}
3197 $ cvs remove @var{old}
3198 $ cvs add @var{new} 
3199 $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
3200 @end example
3201
3202 This is the simplest way to move a file, it is not
3203 error-prone, and it preserves the history of what was
3204 done.  Note that to access the history of the file you
3205 must specify the old or the new name, depending on what
3206 portion of the history you are accessing.  For example,
3207 @code{cvs log @var{old}} will give the log up until the
3208 time of the rename.
3209
3210 When @var{new} is committed its revision numbers will
3211 start at 1.0 again, so if that bothers you, use the
3212 @samp{-r rev} option to commit (@pxref{commit options})
3213
3214 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3215 @node Inside
3216 @section Moving the history file
3217
3218 This method is more dangerous, since it involves moving
3219 files inside the repository.  Read this entire section
3220 before trying it out!
3221
3222 @example
3223 $ cd $CVSROOT/@var{module}
3224 $ mv @var{old},v @var{new},v
3225 @end example
3226
3227 @noindent
3228 Advantages:
3229
3230 @itemize @bullet
3231 @item
3232 The log of changes is maintained intact.
3233
3234 @item
3235 The revision numbers are not affected.
3236 @end itemize
3237
3238 @noindent
3239 Disadvantages:
3240
3241 @itemize @bullet
3242 @item
3243 Old releases of the module cannot easily be fetched from the
3244 repository.  (The file will show up as @var{new} even
3245 in revisions from the time before it was renamed).
3246
3247 @item
3248 There is no log information of when the file was renamed.
3249
3250 @item
3251 Nasty things might happen if someone accesses the history file
3252 while you are moving it.  Make sure no one else runs any of the @sc{cvs}
3253 commands while you move it.
3254 @end itemize
3255
3256 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3257 @node Rename by copying
3258 @section Copying the history file
3259
3260 This way also involves direct modifications to the
3261 repository.  It is safe, but not without drawbacks.
3262
3263 @example
3264 # @r{Copy the @sc{rcs} file inside the repository}
3265 $ cd $CVSROOT/@var{module}
3266 $ cp @var{old},v @var{new},v
3267 # @r{Remove the old file}
3268 $ cd ~/@var{module}
3269 $ rm @var{old}
3270 $ cvs remove @var{old}
3271 $ cvs commit @var{old}
3272 # @r{Remove all tags from @var{new}}
3273 $ cvs update @var{new}
3274 $ cvs log @var{new}             # @r{Remember the tag names}
3275 $ cvs tag -d @var{tag1}
3276 $ cvs tag -d @var{tag2}
3277 @dots{}
3278 @end example
3279
3280 By removing the tags you will be able to check out old
3281 revisions of the module.
3282
3283 @noindent
3284 Advantages:
3285
3286 @itemize @bullet
3287 @item
3288 @c FIXME: Is this true about -D now that we have death
3289 @c support?  See 5B.3 in the FAQ.
3290 Checking out old revisions works correctly, as long as
3291 you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
3292 to retrieve the revisions.
3293
3294 @item
3295 The log of changes is maintained intact.
3296
3297 @item
3298 The revision numbers are not affected.
3299 @end itemize
3300
3301 @noindent
3302 Disadvantages:
3303
3304 @itemize @bullet
3305 @item
3306 You cannot easily see the history of the file across the rename.
3307
3308 @item
3309 Unless you use the @samp{-r rev} (@pxref{commit
3310 options}) flag when @var{new} is committed its revision
3311 numbers will start at 1.0 again.
3312 @end itemize
3313
3314 @c ---------------------------------------------------------------------
3315 @node Moving directories
3316 @chapter Moving and renaming directories
3317 @cindex Moving directories
3318 @cindex Renaming directories
3319 @cindex Directories, moving
3320
3321 If you want to be able to retrieve old versions of the
3322 module, you must move each file in the directory
3323 with the @sc{cvs} commands.  @xref{Outside}.  The old, empty
3324 directory will remain inside the repository, but it
3325 will not appear in your workspace when you check out
3326 the module in the future.
3327 @c -- rephrase
3328
3329 If you really want to rename or delete a directory, you
3330 can do it like this:
3331
3332 @enumerate
3333 @item
3334 Inform everyone who has a copy of the module that the
3335 directory will be renamed.  They should commit all
3336 their changes, and remove their working copies of the
3337 module, before you take the steps below.
3338
3339 @item
3340 Rename the directory inside the repository.
3341
3342 @example
3343 $ cd $CVSROOT/@var{module}
3344 $ mv @var{old-dir} @var{new-dir}
3345 @end example
3346
3347 @item
3348 Fix the @sc{cvs} administrative files, if necessary (for
3349 instance if you renamed an entire module).
3350
3351 @item
3352 Tell everyone that they can check out the module and continue
3353 working.
3354
3355 @end enumerate
3356
3357 If someone had a working copy of the module the @sc{cvs} commands will
3358 cease to work for him, until he removes the directory
3359 that disappeared inside the repository.
3360
3361 It is almost always better to move the files in the
3362 directory instead of moving the directory.  If you move the
3363 directory you are unlikely to be able to retrieve old
3364 releases correctly, since they probably depend on the
3365 name of the directories.
3366
3367 @c ---------------------------------------------------------------------
3368 @node History browsing
3369 @chapter History browsing
3370 @cindex History browsing
3371 @cindex Traceability
3372 @cindex Isolation
3373
3374 @ignore
3375 @c This is too long for an introduction (goal is
3376 @c one 20x80 character screen), and also mixes up a
3377 @c variety of issues (parallel development, history,
3378 @c maybe even touches on process control).
3379
3380 @c -- @quote{To lose ones history is to lose ones soul.}
3381 @c -- ///
3382 @c -- ///Those who cannot remember the past are condemned to repeat it.
3383 @c -- ///               -- George Santayana
3384 @c -- ///
3385
3386 @sc{cvs} tries to make it easy for a group of people to work
3387 together.  This is done in two ways:
3388
3389 @itemize @bullet
3390 @item
3391 Isolation---You have your own working copy of the
3392 source.  You are not affected by modifications made by
3393 others until you decide to incorporate those changes
3394 (via the @code{update} command---@pxref{update}).
3395
3396 @item 
3397 Traceability---When something has changed, you can
3398 always see @emph{exactly} what changed.
3399 @end itemize
3400
3401 There are several features of @sc{cvs} that together lead
3402 to traceability:
3403
3404 @itemize @bullet
3405 @item
3406 Each revision of a file has an accompanying log
3407 message.
3408
3409 @item
3410 All commits are optionally logged to a central history
3411 database.
3412
3413 @item
3414 Logging information can be sent to a user-defined
3415 program (@pxref{loginfo}).
3416 @end itemize
3417
3418 @c -- More text here.
3419
3420 This chapter should talk about the history file, the
3421 @code{log} command, the usefulness of ChangeLogs
3422 even when you run @sc{cvs}, and things like that.
3423
3424 @end ignore
3425
3426 @c kind of lame, in a lot of ways the above text inside
3427 @c the @ignore motivates this chapter better
3428 Once you have used @sc{cvs} to store a version control
3429 history---what files have changed when, how, and by
3430 whom, there are a variety of mechanisms for looking
3431 through the history.
3432
3433 @menu
3434 * log messages::                Log messages
3435 * history database::            The history database
3436 * user-defined logging::        User-defined logging
3437 * annotate::                    What revision modified each line of a file?
3438 @end menu
3439
3440 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3441 @node log messages
3442 @section Log messages
3443
3444 @c FIXME: @xref to place where we talk about how to
3445 @c specify message to commit.
3446 Whenever you commit a file you specify a log message.
3447
3448 @c FIXME: bring the information here, and get rid of or
3449 @c greatly shrink the "log" node.
3450 To look through the log messages which have been
3451 specified for every revision which has been committed,
3452 use the @code{cvs log} command (@pxref{log}).
3453
3454 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3455 @node history database
3456 @section The history database
3457
3458 @c FIXME: bring the information from the history file
3459 @c and history nodes here.  Rewrite it to be motivated
3460 @c better (start out by clearly explaining what gets
3461 @c logged in history, for example).
3462 You can use the history file (@pxref{history file}) to
3463 log various @sc{cvs} actions.  To retrieve the
3464 information from the history file, use the @code{cvs
3465 history} command (@pxref{history}).
3466
3467 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3468 @node user-defined logging
3469 @section User-defined logging
3470
3471 @c FIXME: should probably also mention the fact the -l
3472 @c global option can disable most of the mechanisms
3473 @c discussed here (why?  What is the -l global option for?).
3474 @c
3475 @c FIXME: probably should centralize this information
3476 @c here, at least to some extent.  Maybe by moving the
3477 @c loginfo, etc., nodes here and replacing
3478 @c the "user-defined logging" node with one node for
3479 @c each method.
3480 You can customize @sc{cvs} to log various kinds of
3481 actions, in whatever manner you choose.  These
3482 mechanisms operate by executing a script at various
3483 times.  The script might append a message to a file
3484 listing the information and the programmer who created
3485 it, or send mail to a group of developers, or, perhaps,
3486 post a message to a particular newsgroup.  To log
3487 commits, use the @file{loginfo} file (@pxref{loginfo}).
3488 @c FIXME: What is difference between doing it in the
3489 @c modules file and using loginfo/taginfo?  Why should
3490 @c user use one or the other?
3491 To log commits, checkouts, exports, and tags,
3492 respectively, you can also use the @samp{-i},
3493 @samp{-o}, @samp{-e}, and @samp{-t} options in the
3494 modules file.  For a more flexible way of giving
3495 notifications to various users, which requires less in
3496 the way of keeping centralized scripts up to date, use
3497 the @code{cvs watch add} command (@pxref{Getting
3498 Notified}); this command is useful even if you are not
3499 using @code{cvs watch on}.
3500
3501 @cindex taginfo
3502 The @file{taginfo} file defines programs to execute
3503 when someone executes a @code{tag} or @code{rtag}
3504 command.  The @file{taginfo} file has the standard form
3505 for administrative files (@pxref{Administrative
3506 files}), where each line is a regular expression
3507 followed by a command to execute.  The arguments passed
3508 to the command are, in order, the @var{tagname},
3509 @var{operation} (@code{add} for @code{tag},
3510 @code{mov} for @code{tag -F}, and @code{del} for
3511 @code{tag -d}), @var{repository}, and any remaining are
3512 pairs of @var{filename} @var{revision}.  A non-zero
3513 exit of the filter program will cause the tag to be
3514 aborted.
3515
3516 @node annotate
3517 @section Annotate command
3518 @cindex annotate (subcommand)
3519
3520 @deffn Command {cvs annotate} [@code{-l}] files @dots{}
3521
3522 For each file in @var{files}, print the head revision
3523 of the trunk, together with information on the last
3524 modification for each line.  The @code{-l} option means
3525 to process the local directory only, not to recurse
3526 (@pxref{Common options}).  For example:
3527
3528 @example
3529 $ cvs annotate ssfile
3530 Annotations for ssfile
3531 ***************
3532 1.1          (mary     27-Mar-96): ssfile line 1
3533 1.2          (joe      28-Mar-96): ssfile line 2
3534 @end example
3535
3536 The file @file{ssfile} currently contains two lines.
3537 The @code{ssfile line 1} line was checked in by
3538 @code{mary} on March 27.  Then, on March 28, @code{joe}
3539 added a line @code{ssfile line 2}, without modifying
3540 the @code{ssfile line 1} line.  This report doesn't
3541 tell you anything about lines which have been deleted
3542 or replaced; you need to use @code{cvs diff} for that
3543 (@pxref{diff}).
3544
3545 @end deffn
3546
3547 @c ---------------------------------------------------------------------
3548 @node Keyword substitution
3549 @chapter Keyword substitution
3550 @cindex Keyword substitution
3551 @cindex Keyword expansion
3552 @cindex Identifying files
3553
3554 @comment   Be careful when editing this chapter.
3555 @comment   Remember that this file is kept under
3556 @comment   version control, so we must not accidentally
3557 @comment   include a valid keyword in the running text.
3558
3559 As long as you edit source files inside your working
3560 copy of a module you can always find out the state of
3561 your files via @samp{cvs status} and @samp{cvs log}.
3562 But as soon as you export the files from your
3563 development environment it becomes harder to identify
3564 which revisions they are.
3565
3566 @sc{Rcs} uses a mechanism known as @dfn{keyword
3567 substitution} (or @dfn{keyword expansion}) to help
3568 identifying the files.  Embedded strings of the form
3569 @code{$@var{keyword}$} and
3570 @code{$@var{keyword}:@dots{}$} in a file are replaced
3571 with strings of the form
3572 @code{$@var{keyword}:@var{value}$} whenever you obtain
3573 a new revision of the file.
3574
3575 @menu
3576 * Keyword list::                RCS Keywords
3577 * Using keywords::              Using keywords
3578 * Avoiding substitution::       Avoiding substitution
3579 * Substitution modes::          Substitution modes
3580 * Log keyword::                 Problems with the $@asis{}Log$ keyword.
3581 @end menu
3582
3583 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3584 @node Keyword list
3585 @section RCS Keywords
3586 @cindex RCS keywords
3587
3588 This is a list of the keywords that @sc{rcs} currently
3589 (in release 5.6.0.1) supports:
3590
3591 @table @code
3592 @cindex Author keyword
3593 @item $@asis{Author}$
3594 The login name of the user who checked in the revision.
3595
3596 @cindex Date keyword
3597 @item $@asis{Date}$
3598 The date and time (UTC) the revision was checked in.
3599
3600 @cindex Header keyword
3601 @item $@asis{Header}$
3602 A standard header containing the full pathname of the
3603 @sc{rcs} file, the revision number, the date (UTC), the
3604 author, the state, and the locker (if locked).  Files
3605 will normally never be locked when you use @sc{cvs}.
3606
3607 @cindex Id keyword
3608 @item $@asis{Id}$
3609 Same as @code{$@asis{Header}$}, except that the @sc{rcs}
3610 filename is without a path.
3611
3612 @cindex Locker keyword
3613 @item $@asis{Locker}$
3614 The login name of the user who locked the revision
3615 (empty if not locked, and thus almost always useless
3616 when you are using @sc{cvs}).
3617
3618 @cindex Log keyword
3619 @item $@asis{Log}$
3620 The log message supplied during commit, preceded by a
3621 header containing the @sc{rcs} filename, the revision
3622 number, the author, and the date (UTC).  Existing log
3623 messages are @emph{not} replaced.  Instead, the new log
3624 message is inserted after @code{$@asis{Log:@dots{}}$}.
3625 Each new line is prefixed with a @dfn{comment leader}
3626 which @sc{rcs} guesses from the file name extension.
3627 It can be changed with @code{cvs admin -c}.
3628 @xref{admin options}.  This keyword is useful for
3629 accumulating a complete change log in a source file,
3630 but for several reasons it can be problematic.
3631 @xref{Log keyword}.
3632
3633 @cindex RCSfile keyword
3634 @item $@asis{RCSfile}$
3635 The name of the RCS file without a path.
3636
3637 @cindex Revision keyword
3638 @item $@asis{Revision}$
3639 The revision number assigned to the revision.
3640
3641 @cindex Source keyword
3642 @item $@asis{Source}$
3643 The full pathname of the RCS file.
3644
3645 @cindex State keyword
3646 @item $@asis{State}$
3647 The state assigned to the revision.  States can be
3648 assigned with @code{cvs admin -s}---@xref{admin options}.
3649
3650 @end table
3651
3652 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3653 @node Using keywords
3654 @section Using keywords
3655
3656 To include a keyword string you simply include the
3657 relevant text string, such as @code{$@asis{Id}$}, inside the
3658 file, and commit the file.  @sc{cvs} will automatically
3659 expand the string as part of the commit operation.
3660
3661 @need 800
3662 It is common to embed @code{$@asis{}Id$} string in the
3663 C source code.  This example shows the first few lines
3664 of a typical file, after keyword substitution has been
3665 performed:
3666
3667 @example
3668 static char *rcsid="$@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
3669 /* @r{The following lines will prevent @code{gcc} version 2.@var{x}}
3670    @r{from issuing an "unused variable" warning}. */
3671 #if __GNUC__ == 2
3672 #define USE(var) static void * use_##var = (&use_##var, (void *) &var) 
3673 USE (rcsid);
3674 #endif
3675 @end example
3676
3677 Even though a clever optimizing compiler could remove
3678 the unused variable @code{rcsid}, most compilers tend
3679 to include the string in the binary.  Some compilers
3680 have a @code{#pragma} directive to include literal text
3681 in the binary.
3682
3683 @cindex Ident (shell command)
3684 The @code{ident} command (which is part of the @sc{rcs}
3685 package) can be used to extract keywords and their
3686 values from a file.  This can be handy for text files,
3687 but it is even more useful for extracting keywords from
3688 binary files.
3689
3690 @example
3691 $ ident samp.c
3692 samp.c:
3693      $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
3694 $ gcc samp.c
3695 $ ident a.out
3696 a.out:
3697      $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
3698 @end example
3699
3700 @cindex What (shell command)
3701 S@sc{ccs} is another popular revision control system.
3702 It has a command, @code{what}, which is very similar to
3703 @code{ident} and used for the same purpose.  Many sites
3704 without @sc{rcs} have @sc{sccs}.  Since @code{what}
3705 looks for the character sequence @code{@@(#)} it is
3706 easy to include keywords that are detected by either
3707 command.  Simply prefix the @sc{rcs} keyword with the
3708 magic @sc{sccs} phrase, like this:
3709
3710 @example
3711 static char *id="@@(#) $@asis{}Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
3712 @end example
3713
3714 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3715 @node Avoiding substitution
3716 @section Avoiding substitution
3717
3718 Keyword substitution has its disadvantages.  Sometimes
3719 you might want the literal text string
3720 @samp{$@asis{}Author$} to appear inside a file without
3721 @sc{rcs} interpreting it as a keyword and expanding it
3722 into something like @samp{$@asis{}Author: ceder $}.  
3723
3724 There is unfortunately no way to selectively turn off
3725 keyword substitution.  You can use @samp{-ko}
3726 (@pxref{Substitution modes}) to turn off keyword
3727 substitution entirely.
3728
3729 In many cases you can avoid using @sc{rcs} keywords in
3730 the source, even though they appear in the final
3731 product.  For example, the source for this manual
3732 contains @samp{$@@asis@{@}Author$} whenever the text
3733 @samp{$@asis{}Author$} should appear.  In @code{nroff}
3734 and @code{troff} you can embed the null-character
3735 @code{\&} inside the keyword for a similar effect.
3736
3737 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3738 @node Substitution modes
3739 @section Substitution modes
3740 @cindex -k (RCS kflags)
3741 @cindex Kflag
3742
3743 @c FIXME: This could be made more coherent, by expanding it
3744 @c with more examples or something.
3745 Each file has a stored default substitution mode, and
3746 each working directory copy of a file also has a
3747 substitution mode.  The former is set by the @samp{-k}
3748 option to @code{cvs add} and @code{cvs admin}; the
3749 latter is set by the -k or -A options to @code{cvs
3750 checkout} or @code{cvs update}.  @code{cvs diff} also
3751 has a @samp{-k} option.  For some examples,
3752 @xref{Binary files}.
3753
3754 The modes available are:
3755
3756 @table @samp
3757 @item -kkv
3758 Generate keyword strings using the default form, e.g.
3759 @code{$@asis{}Revision: 5.7 $} for the @code{Revision}
3760 keyword.
3761
3762 @item -kkvl
3763 Like @samp{-kkv}, except that a locker's name is always
3764 inserted if the given revision is currently locked.
3765 This option is normally not useful when @sc{cvs} is used.
3766
3767 @item -kk
3768 Generate only keyword names in keyword strings; omit
3769 their values.  For example, for the @code{Revision}
3770 keyword, generate the string @code{$@asis{}Revision$}
3771 instead of @code{$@asis{}Revision: 5.7 $}.  This option
3772 is useful to ignore differences due to keyword
3773 substitution when comparing different revisions of a
3774 file.
3775
3776 @item -ko
3777 Generate the old keyword string, present in the working
3778 file just before it was checked in.  For example, for
3779 the @code{Revision} keyword, generate the string
3780 @code{$@asis{}Revision: 1.1 $} instead of
3781 @code{$@asis{}Revision: 5.7 $} if that is how the
3782 string appeared when the file was checked in.
3783
3784 @item -kb
3785 Like @samp{-ko}, but also inhibit conversion of line
3786 endings between the canonical form in which they are
3787 stored in the repository (linefeed only), and the form
3788 appropriate to the operating system in use on the
3789 client.  For systems, like unix, which use linefeed
3790 only to terminate lines, this is the same as
3791 @samp{-ko}.  For more information on binary files, see
3792 @ref{Binary files}.
3793
3794 @item -kv
3795 Generate only keyword values for keyword strings.  For
3796 example, for the @code{Revision} keyword, generate the string
3797 @code{5.7} instead of @code{$@asis{}Revision: 5.7 $}.
3798 This can help generate files in programming languages
3799 where it is hard to strip keyword delimiters like
3800 @code{$@asis{}Revision: $} from a string.  However,
3801 further keyword substitution cannot be performed once
3802 the keyword names are removed, so this option should be
3803 used with care.
3804
3805 One often would like to use @samp{-kv} with @code{cvs
3806 export}---@pxref{export}.  But be aware that doesn't
3807 handle an export containing binary files correctly.
3808
3809 @end table
3810
3811 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3812 @node Log keyword
3813 @section Problems with the $@asis{}Log$ keyword.
3814
3815 The @code{$@asis{}Log$} keyword is somewhat
3816 controversial.  As long as you are working on your
3817 development system the information is easily accessible
3818 even if you do not use the @code{$@asis{}Log$}
3819 keyword---just do a @code{cvs log}.  Once you export
3820 the file the history information might be useless
3821 anyhow.
3822
3823 A more serious concern is that @sc{rcs} is not good at
3824 handling @code{$@asis{}Log$} entries when a branch is
3825 merged onto the main trunk.  Conflicts often result
3826 from the merging operation.
3827
3828 People also tend to "fix" the log entries in the file
3829 (correcting spelling mistakes and maybe even factual
3830 errors).  If that is done the information from
3831 @code{cvs log} will not be consistent with the
3832 information inside the file.  This may or may not be a
3833 problem in real life.
3834
3835 It has been suggested that the @code{$@asis{}Log$}
3836 keyword should be inserted @emph{last} in the file, and
3837 not in the files header, if it is to be used at all.
3838 That way the long list of change messages will not
3839 interfere with everyday source file browsing.
3840
3841 @c ---------------------------------------------------------------------
3842 @node Binary files
3843 @chapter Handling binary files
3844 @cindex Binary files
3845
3846 There are two issues with using @sc{cvs} to store
3847 binary files.  The first is that @sc{cvs} by default
3848 convert line endings between the canonical form in
3849 which they are stored in the repository (linefeed
3850 only), and the form appropriate to the operating system
3851 in use on the client (for example, carriage return
3852 followed by line feed for Windows NT).
3853
3854 The second is that a binary file might happen to
3855 contain data which looks like a keyword (@pxref{Keyword
3856 substitution}), so keyword expansion must be turned
3857 off.
3858
3859 The @samp{-kb} option available with some @sc{cvs}
3860 commands insures that neither line ending conversion
3861 nor keyword expansion will be done.  If you are using
3862 an old version of @sc{rcs} without this option, and you
3863 are using an operating system, such as unix, which
3864 terminates lines with linefeeds only, you can use
3865 @samp{-ko} instead; if you are on another operating
3866 system, upgrade to a version of @sc{rcs}, such as 5.7
3867 or later, which supports @samp{-kb}.
3868
3869 Here is an example of how you can create a new file
3870 using the @samp{-kb} flag:
3871
3872 @example
3873 $ echo '$@asis{}Id$' > kotest
3874 $ cvs add -kb -m"A test file" kotest
3875 $ cvs ci -m"First checkin; contains a keyword" kotest
3876 @end example
3877
3878 If a file accidentally gets added without @samp{-kb},
3879 one can use the @code{cvs admin} command to recover.
3880 For example:
3881
3882 @example
3883 $ echo '$@asis{}Id$' > kotest
3884 $ cvs add -m"A test file" kotest
3885 $ cvs ci -m"First checkin; contains a keyword" kotest
3886 $ cvs admin -kb kotest
3887 $ cvs update -A kotest
3888 @end example
3889
3890 When you check in the file @file{kotest} the keywords
3891 are expanded.  (Try the above example, and do a
3892 @code{cat kotest} after every command).  The @code{cvs
3893 admin -kb} command sets the default keyword
3894 substitution method for this file, but it does not
3895 alter the working copy of the file that you have.  The
3896 easiest way to get the unexpanded version of
3897 @file{kotest} is @code{cvs update -A}.
3898
3899 @c ---------------------------------------------------------------------
3900 @node Revision management
3901 @chapter Revision management
3902 @cindex Revision management
3903
3904 @c -- This chapter could be expanded a lot.
3905 @c -- Experiences are very welcome!
3906
3907 If you have read this far, you probably have a pretty
3908 good grasp on what @sc{cvs} can do for you.  This
3909 chapter talks a little about things that you still have
3910 to decide.
3911
3912 If you are doing development on your own using @sc{cvs}
3913 you could probably skip this chapter.  The questions
3914 this chapter takes up become more important when more
3915 than one person is working in a repository.
3916
3917 @menu
3918 * When to commit::              Some discussion on the subject
3919 @end menu
3920
3921 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3922 @node When to commit
3923 @section When to commit?
3924 @cindex When to commit
3925 @cindex Commit, when to
3926 @cindex Policy
3927
3928 Your group should decide which policy to use regarding
3929 commits.  Several policies are possible, and as your
3930 experience with @sc{cvs} grows you will probably find
3931 out what works for you.
3932
3933 If you commit files too quickly you might commit files
3934 that do not even compile.  If your partner updates his
3935 working sources to include your buggy file, he will be
3936 unable to compile the code.  On the other hand, other
3937 persons will not be able to benefit from the
3938 improvements you make to the code if you commit very
3939 seldom, and conflicts will probably be more common.
3940
3941 It is common to only commit files after making sure
3942 that they can be compiled.  Some sites require that the
3943 files pass a test suite.  Policies like this can be
3944 enforced using the commitinfo file
3945 (@pxref{commitinfo}), but you should think twice before
3946 you enforce such a convention.  By making the
3947 development environment too controlled it might become
3948 too regimented and thus counter-productive to the real
3949 goal, which is to get software written.
3950
3951 @c ---------------------------------------------------------------------
3952 @node Invoking CVS
3953 @appendix Reference manual for CVS commands
3954 @cindex Command reference
3955 @cindex Reference, commands
3956 @cindex Invoking CVS
3957
3958 This appendix describes how to invoke @sc{cvs}, and
3959 describes in detail those subcommands of @sc{cvs} which
3960 are not fully described elsewhere.  To look up a
3961 particular subcommand, see @ref{Index}.
3962
3963 @menu
3964 * Structure::                   Overall structure of CVS commands
3965 * ~/.cvsrc::                    Default options with the ~/.csvrc file
3966 * Global options::              Options you give to the left of cvs_command
3967 * Common options::              Options you give to the right of cvs_command
3968 * add::                         Add a new file/directory to the repository
3969 * admin::                       Administration front end for rcs
3970 * checkout::                    Checkout sources for editing
3971 * commit::                      Check files into the repository
3972 * diff::                        Run diffs between revisions
3973 * export::                      Export sources from CVS, similar to checkout
3974 * history::                     Show status of files and users
3975 * import::                      Import sources into CVS, using vendor branches
3976 * log::                         Print out 'rlog' information for files
3977 * rdiff::                       'patch' format diffs between releases
3978 * release::                     Indicate that a Module is no longer in use
3979 * rtag::                        Add a tag to a module
3980 * status::                      Status info on the revisions
3981 * tag::                         Add a tag to checked out version
3982 * update::                      Bring work tree in sync with repository
3983 @end menu
3984
3985 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3986 @node Structure
3987 @appendixsec Overall structure of CVS commands
3988 @cindex Structure
3989 @cindex CVS command structure
3990 @cindex Command structure
3991 @cindex Format of CVS commands
3992
3993 The first release of @sc{cvs} consisted of a number of shell-scripts.
3994 Today @sc{cvs} is implemented as a single program that is a front-end
3995 to @sc{rcs} and @code{diff}. The overall format of all
3996 @sc{cvs} commands is:
3997
3998 @example
3999 cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
4000 @end example
4001
4002 @table @code
4003 @item cvs
4004 The program that is a front-end to @sc{rcs}.
4005
4006 @item cvs_options
4007 Some options that affect all sub-commands of @sc{cvs}.  These are
4008 described below.
4009
4010 @item cvs_command
4011 One of several different sub-commands.  Some of the commands have
4012 aliases that can be used instead; those aliases are noted in the
4013 reference manual for that command.  There are only two situations
4014 where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
4015 list of available commands, and @samp{cvs -v} displays version
4016 information on @sc{cvs} itself.
4017
4018 @item command_options
4019 Options that are specific for the command.
4020
4021 @item command_args
4022 Arguments to the commands.
4023 @end table
4024
4025 There is unfortunately some confusion between
4026 @code{cvs_options} and @code{command_options}.
4027 @samp{-l}, when given as a @code{cvs_option}, only
4028 affects some of the commands.  When it is given as a
4029 @code{command_option} is has a different meaning, and
4030 is accepted by more commands.  In other words, do not
4031 take the above categorization too seriously.  Look at
4032 the documentation instead.
4033
4034 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4035 @node ~/.cvsrc
4036 @appendixsec Default options and the ~/.cvsrc file
4037 @cindex .cvsrc file
4038 @cindex option defaults
4039
4040 There are some @code{command_options} that are used so
4041 often that you might have set up an alias or some other
4042 means to make sure you always specify that option.  One
4043 example (the one that drove the implementation of the
4044 .cvsrc support, actually) is that many people find the
4045 default output of the @samp{diff} command to be very
4046 hard to read, and that either context diffs or unidiffs
4047 are much easier to understand.
4048
4049 The @file{~/.cvsrc} file is a way that you can add
4050 default options to @code{cvs_commands} within cvs,
4051 instead of relying on aliases or other shell scripts.
4052
4053 The format of the @file{~/.cvsrc} file is simple.  The
4054 file is searched for a line that begins with the same
4055 name as the @code{cvs_command} being executed.  If a
4056 match is found, then the remainder of the line is split
4057 up (at whitespace characters) into separate options and
4058 added to the command arguments @emph{before} any
4059 options from the command line.
4060
4061 If a command has two names (e.g., @code{checkout} and
4062 @code{co}), the official name, not necessarily the one
4063 used on the command line, will be used to match against
4064 the file.  So if this is the contents of the user's
4065 @file{~/.cvsrc} file:
4066
4067 @example
4068 log -N
4069 diff -u
4070 update -P
4071 co -P
4072 @end example
4073
4074 @noindent
4075 the command @samp{cvs checkout foo} would have the
4076 @samp{-P} option added to the arguments, as well as
4077 @samp{cvs co foo}.
4078
4079 With the example file above, the output from @samp{cvs
4080 diff foobar} will be in unidiff format.  @samp{cvs diff
4081 -c foobar} will provide context diffs, as usual.
4082 Getting "old" format diffs would be slightly more
4083 complicated, because @code{diff} doesn't have an option
4084 to specify use of the "old" format, so you would need
4085 @samp{cvs -f diff foobar}.
4086
4087 In place of the command name you can use @code{cvs} to
4088 specify global options (@pxref{Global options}).  For
4089 example the following line in @file{.cvsrc}
4090
4091 @example
4092 cvs -z6
4093 @end example
4094
4095 causes @sc{cvs} to use compression level 6
4096
4097 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4098 @node Global options
4099 @appendixsec Global options
4100 @cindex Options, global
4101 @cindex Global options
4102 @cindex Left-hand options
4103
4104 The available @samp{cvs_options} (that are given to the
4105 left of @samp{cvs_command}) are:
4106
4107 @table @code
4108 @cindex RCSBIN, overriding
4109 @cindex Overriding RCSBIN
4110 @item -b @var{bindir}
4111 Use @var{bindir} as the directory where @sc{rcs} programs are
4112 located.  Overrides the setting of the @code{$RCSBIN} environment
4113 variable and any precompiled directory.  This parameter should be
4114 specified as an absolute pathname.
4115
4116 @cindex CVSROOT, overriding
4117 @cindex Overriding CVSROOT
4118 @item -d @var{cvs_root_directory}
4119 Use @var{cvs_root_directory} as the root directory
4120 pathname of the repository.  Overrides the setting of
4121 the @code{$CVSROOT} environment variable.  @xref{Repository}.
4122
4123 @cindex EDITOR, overriding
4124 @cindex Overriding EDITOR
4125 @item -e @var{editor}
4126 Use @var{editor} to enter revision log information.  Overrides the
4127 setting of the @code{$CVSEDITOR} and @code{$EDITOR} environment variables.
4128
4129 @item -f
4130 Do not read the @file{~/.cvsrc} file.  This
4131 option is most often used because of the
4132 non-orthogonality of the @sc{cvs} option set.  For
4133 example, the @samp{cvs log} option @samp{-N} (turn off
4134 display of tag names) does not have a corresponding
4135 option to turn the display on.  So if you have
4136 @samp{-N} in the @file{~/.cvsrc} entry for @samp{diff},
4137 you may need to use @samp{-f} to show the tag names.
4138 @footnote{Yes, this really should be fixed, and it's
4139 being worked on}
4140
4141 @item -H
4142 Display usage information about the specified @samp{cvs_command}
4143 (but do not actually execute the command).  If you don't specify
4144 a command name, @samp{cvs -H} displays a summary of all the
4145 commands available.
4146
4147 @item -l
4148 Do not log the cvs_command in the command history (but execute it
4149 anyway).  @xref{history}, for information on command history.
4150
4151 @cindex Read-only mode
4152 @item -n
4153 Do not change any files.  Attempt to execute the
4154 @samp{cvs_command}, but only to issue reports; do not remove,
4155 update, or merge any existing files, or create any new files.
4156
4157 @item -Q
4158 Cause the command to be really quiet; the command will only
4159 generate output for serious problems.
4160
4161 @item -q
4162 Cause the command to be somewhat quiet; informational messages,
4163 such as reports of recursion through subdirectories, are
4164 suppressed.
4165
4166 @cindex Read-only files
4167 @item -r
4168 Make new working files files read-only.  Same effect
4169 as if the @code{$CVSREAD} environment variable is set
4170 (@pxref{Environment variables}).  The default is to
4171 make working files writable, unless watches are on
4172 (@pxref{Watches}).
4173
4174 @item -s @var{variable}=@var{value}
4175 Set a user variable (@pxref{Variables}).
4176
4177 @cindex Trace
4178 @item -t
4179 Trace program execution; display messages showing the steps of
4180 @sc{cvs} activity.  Particularly useful with @samp{-n} to explore the
4181 potential impact of an unfamiliar command.
4182
4183 @item -v
4184 Display version and copyright information for @sc{cvs}.
4185
4186 @cindex CVSREAD, overriding
4187 @cindex Overriding CVSREAD
4188 @item -w
4189 Make new working files read-write.  Overrides the
4190 setting of the @code{$CVSREAD} environment variable.
4191 Files are created read-write by default, unless @code{$CVSREAD} is
4192 set or @samp{-r} is given.
4193
4194 @item -z @var{gzip-level}
4195 Set the compression level.  Only has an effect on the
4196 @sc{cvs} client.
4197
4198 @end table
4199
4200 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4201 @node Common options
4202 @appendixsec Common command options
4203 @cindex Common options
4204 @cindex Right-hand options
4205
4206 This section describes the @samp{command_options} that
4207 are available across several @sc{cvs} commands.  These
4208 options are always given to the right of
4209 @samp{cvs_command}. Not all
4210 commands support all of these options; each option is
4211 only supported for commands where it makes sense.
4212 However, when a command has one of these options you
4213 can almost always count on the same behavior of the
4214 option as in other commands.  (Other command options,
4215 which are listed with the individual commands, may have
4216 different behavior from one @sc{cvs} command to the other).
4217
4218 @strong{Warning:} the @samp{history} command is an exception; it supports
4219 many options that conflict even with these standard options.
4220
4221 @table @code
4222 @cindex Dates
4223 @cindex Time
4224 @cindex Specifying dates
4225 @item -D @var{date_spec}
4226 Use the most recent revision no later than @var{date_spec}.
4227 @var{date_spec} is a single argument, a date description
4228 specifying a date in the past.
4229
4230 The specification is @dfn{sticky} when you use it to make a
4231 private copy of a source file; that is, when you get a working
4232 file using @samp{-D}, @sc{cvs} records the date you specified, so that
4233 further updates in the same directory will use the same date
4234 (for more information on sticky tags/dates, @pxref{Sticky tags}).
4235
4236 A wide variety of date formats are supported by the underlying
4237 @sc{rcs} facilities, similar to those described in co(1), but not
4238 exactly the same.  The @var{date_spec} is interpreted as being
4239 in the local timezone, unless a specific timezone is specified.
4240 Examples of valid date specifications include:
4241
4242 @example
4243                     1 month ago
4244                     2 hours ago
4245                     400000 seconds ago
4246                     last year
4247                     last Monday
4248                     yesterday
4249                     a fortnight ago
4250                     3/31/92 10:00:07 PST
4251                     January 23, 1987 10:05pm
4252                     22:00 GMT
4253 @end example
4254
4255 @samp{-D} is available with the @code{checkout},
4256 @code{diff}, @code{export}, @code{history},
4257 @code{rdiff}, @code{rtag}, and @code{update} commands.
4258 (The @code{history} command uses this option in a
4259 slightly different way; @pxref{history options}).
4260
4261 Remember to quote the argument to the @samp{-D}
4262 flag so that your shell doesn't interpret spaces as
4263 argument separators.  A command using the @samp{-D}
4264 flag can look like this:
4265
4266 @example
4267 $ cvs diff -D "1 hour ago" cvs.texinfo
4268 @end example
4269
4270 @cindex Forcing a tag match
4271 @item -f
4272 When you specify a particular date or tag to @sc{cvs} commands, they
4273 normally ignore files that do not contain the tag (or did not
4274 exist prior to the date) that you specified.  Use the @samp{-f} option
4275 if you want files retrieved even when there is no match for the
4276 tag or date.  (The most recent revision of the file
4277 will be used). 
4278
4279 @need 800
4280 @samp{-f} is available with these commands: @code{checkout},
4281 @code{export}, @code{rdiff}, @code{rtag}, and @code{update}.
4282
4283 @strong{Warning:}  The @code{commit} command also has a
4284 @samp{-f} option, but it has a different behavior for
4285 that command.  @xref{commit options}.
4286
4287 @item -H
4288 Help; describe the options available for this command.  This is
4289 the only option supported for all @sc{cvs} commands.
4290
4291 @item -k @var{kflag}
4292 Alter the default @sc{rcs} processing of keywords.
4293 @xref{Keyword substitution}, for the meaning of
4294 @var{kflag}.  Your @var{kflag} specification is
4295 @dfn{sticky} when you use it to create a private copy
4296 of a source file; that is, when you use this option
4297 with the @code{checkout} or @code{update} commands,
4298 @sc{cvs} associates your selected @var{kflag} with the
4299 file, and continues to use it with future update
4300 commands on the same file until you specify otherwise.
4301
4302 The @samp{-k} option is available with the @code{add},
4303 @code{checkout}, @code{diff} and
4304 @code{update} commands.
4305
4306 @item -l
4307 Local; run only in current working directory, rather than
4308 recursing through subdirectories.  
4309
4310 @strong{Warning:} this is not the same
4311 as the overall @samp{cvs -l} option, which you can specify to the
4312 left of a cvs command!
4313
4314 Available with the following commands: @code{checkout},
4315 @code{commit}, @code{diff}, @code{export}, @code{log},
4316 @code{remove}, @code{rdiff}, @code{rtag},
4317 @code{status}, @code{tag}, and @code{update}.
4318
4319 @cindex Editor, avoiding invocation of
4320 @cindex Avoiding editor invocation
4321 @item -m @var{message}
4322 Use @var{message} as log information, instead of
4323 invoking an editor.
4324
4325 Available with the following commands: @code{add},
4326 @code{commit} and @code{import}.
4327
4328 @item -n
4329 Do not run any checkout/commit/tag program.  (A program can be
4330 specified to run on each of these activities, in the modules
4331 database (@pxref{modules}); this option bypasses it). 
4332
4333 @strong{Warning:} this is not the same as the overall @samp{cvs -n}
4334 option, which you can specify to the left of a cvs command!
4335
4336 Available with the @code{checkout}, @code{commit}, @code{export},
4337 and @code{rtag} commands.
4338
4339 @item -P
4340 Prune (remove) directories that are empty after being updated, on
4341 @code{checkout}, or @code{update}.  Normally, an empty directory
4342 (one that is void of revision-controlled files) is left alone.
4343 Specifying @samp{-P} will cause these directories to be silently
4344 removed from your checked-out sources.  This does not remove the
4345 directory from the repository, only from your checked out copy.
4346 Note that this option is implied by the @samp{-r} or @samp{-D}
4347 options of @code{checkout} and @code{export}.
4348 @c -- implied--
4349
4350 @item -p
4351 Pipe the files retrieved from the repository to standard output,
4352 rather than writing them in the current directory.  Available
4353 with the @code{checkout} and @code{update} commands.
4354
4355 @item -W
4356 Specify file names that should be filtered.  You can
4357 use this option repeatedly.  The spec can be a file
4358 name pattern of the same type that you can specify in
4359 the @file{.cvswrappers} file.
4360 Avaliable with the following commands: @code{import},
4361 and @code{update}.
4362
4363 @item -r @var{tag}
4364 Use the revision specified by the @var{tag} argument instead of the
4365 default @dfn{head} revision.  As well as arbitrary tags defined
4366 with the @code{tag} or @code{rtag} command, two special tags are
4367 always available: @samp{HEAD} refers to the most recent version
4368 available in the repository, and @samp{BASE} refers to the
4369 revision you last checked out into the current working directory.
4370
4371 The tag specification is sticky when you use this option
4372 with @code{checkout} or @code{update} to make your own
4373 copy of a file: @sc{cvs} remembers the tag and continues to use it on
4374 future update commands, until you specify otherwise (for more information
4375 on sticky tags/dates, @pxref{Sticky tags}).  The
4376 tag can be either a symbolic or numeric tag.
4377 @xref{Tags}.
4378
4379 Specifying the @samp{-q} global option along with the
4380 @samp{-r} command option is often useful, to suppress
4381 the warning messages when the @sc{rcs} history file
4382 does not contain the specified tag.
4383
4384 @strong{Warning:} this is not the same as the overall `cvs -r' option,
4385 which you can specify to the left of a cvs command!
4386
4387 @samp{-r} is available with the @code{checkout}, @code{commit},
4388 @code{diff}, @code{history}, @code{export}, @code{rdiff},
4389 @code{rtag}, and @code{update} commands.
4390
4391 @end table
4392
4393 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4394 @node add
4395 @appendixsec add---Add a new file/directory to the repository
4396 @cindex Add (subcommand)
4397
4398 @itemize @bullet
4399 @item
4400 Synopsis: add [-k kflag] [-m 'message'] files@dots{}
4401 @item
4402 Requires: repository, working directory.
4403 @item
4404 Changes: working directory.
4405 @item
4406 Synonym: new
4407 @end itemize
4408
4409 Use the @code{add} command to create a new file or directory in the 
4410 source repository.  The files or directories specified with @code{add}
4411 must already exist in the current directory (which must have been
4412 created with the @code{checkout} command).  To add a whole new directory
4413 hierarchy to the source repository (for example, files received
4414 from a third-party vendor), use the @code{import} command
4415 instead.  @xref{import}.
4416
4417 If the argument to @code{add} refers to an immediate
4418 sub-directory, the directory is created at the correct place in
4419 the source repository, and the necessary @sc{cvs} administration
4420 files are created in your working directory.  If the directory
4421 already exists in the source repository, @code{add} still creates
4422 the administration files in your version of the directory.
4423 This allows you to use @code{add} to add a particular directory
4424 to your private sources even if someone else created that
4425 directory after your checkout of the sources.  You can do the
4426 following:
4427
4428 @example
4429 $ mkdir new_directory
4430 $ cvs add new_directory
4431 $ cvs update new_directory
4432 @end example
4433
4434 An alternate approach using @code{update} might be:
4435
4436 @example
4437 $ cvs update -d new_directory
4438 @end example
4439
4440 (To add any available new directories to your working directory,
4441 it's probably simpler to use @code{checkout} (@pxref{checkout})
4442 or @samp{update -d} (@pxref{update})).
4443
4444 The added files are not placed in the source repository until you
4445 use @code{commit} to make the change permanent.  Doing an
4446 @code{add} on a file that was removed with the @code{remove}
4447 command will resurrect the file, unless a @code{commit} command
4448 intervened.
4449 @xref{Removing files}, for an example.
4450
4451
4452 Unlike most other commands @code{add} never recurses down
4453 directories.  It cannot yet handle relative paths.  Instead of
4454
4455 @example
4456 $ cvs add foo/bar.c
4457 @end example
4458
4459 you have to do
4460
4461 @example
4462 $ cd foo
4463 $ cvs add bar.c
4464 @end example
4465
4466 @menu
4467 * add options::                 add options
4468 * add examples::                add examples
4469 @end menu
4470
4471 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4472 @node add options
4473 @appendixsubsec add options
4474 @cindex Add options
4475
4476 There are only two options you can give to @samp{add}:
4477
4478 @table @code
4479 @item -k @var{kflag}
4480 This option specifies the default way that this file
4481 will be checked out.  The @var{kflag} argument
4482 (@pxref{Substitution modes}) is stored in the @sc{rcs}
4483 file and can be changed with @code{admin -k}
4484 (@pxref{admin options}).  See @ref{Binary files}, for
4485 information on using this option for binary files.
4486
4487 @item -m @var{description}
4488 Using this option, you can give a description for the file.  This
4489 description appears in the history log (if it is enabled,
4490 @pxref{history file}).  It will also be saved in the @sc{rcs} history
4491 file inside the repository when the file is committed.  The
4492 @code{log} command displays this description.
4493
4494 The description can be changed using @samp{admin -t}.
4495 @xref{admin}.
4496
4497 If you omit the @samp{-m @var{description}} flag, an empty string will be
4498 used.  You will not be prompted for a description.
4499 @end table
4500
4501 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4502 @node add examples
4503 @appendixsubsec add examples
4504
4505 To add the file @file{backend.c} to the repository, with a
4506 description, the following can be used.
4507
4508 @example
4509 $ cvs add -m "Optimizer and code generation passes." backend.c
4510 $ cvs commit -m "Early version. Not yet compilable." backend.c
4511 @end example
4512
4513 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4514 @node admin
4515 @appendixsec admin---Administration front end for rcs
4516 @cindex Admin (subcommand)
4517
4518 @itemize @bullet
4519 @item
4520 Requires: repository, working directory.
4521 @item
4522 Changes: repository.
4523 @item
4524 Synonym: rcs
4525 @end itemize
4526
4527 This is the @sc{cvs} interface to assorted administrative @sc{rcs}
4528 facilities, documented in rcs(1).  @code{admin} simply passes
4529 all its options and arguments to the @code{rcs} command; it does
4530 no filtering or other processing.  This command @emph{does} work
4531 recursively, however, so extreme care should be used.
4532
4533 If there is a group whose name matches a compiled in
4534 value which defaults to @code{cvsadmin}, only members
4535 of that group can use @code{cvs admin}.  To disallow
4536 @code{cvs admin} for all users, create a group with no
4537 users in it.
4538
4539 @menu
4540 * admin options::               admin options
4541 * admin examples::              admin examples
4542 @end menu
4543
4544 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4545 @node admin options
4546 @appendixsubsec admin options
4547
4548 Not all valid @code{rcs} options are useful together
4549 with @sc{cvs}.  Some even makes it impossible to use
4550 @sc{cvs} until you undo the effect!
4551
4552 This description of the available options is based on
4553 the @samp{rcs(1)} man page, but modified to suit
4554 readers that are more interrested in @sc{cvs} than
4555 @sc{rcs}.
4556
4557 @table @code
4558 @item -A@var{oldfile}
4559 Might not work together with @sc{cvs}.  Append the
4560 access list of @var{oldfile} to the access list of the
4561 @sc{rcs} file.
4562
4563 @item -a@var{logins}
4564 Might not work together with @sc{cvs}.  Append the
4565 login names appearing in the comma-separated list
4566 @var{logins} to the access list of the @sc{rcs} file.
4567
4568 @item -b[@var{rev}]
4569 When used with bare @sc{rcs}, this
4570 option sets the default branch to @var{rev}; in
4571 @sc{cvs} sticky tags (@pxref{Sticky tags}) are a better
4572 way to decide which branch you want to work on.  With
4573 @sc{cvs}, this option can be used to control behavior
4574 with respect to the vendor branch.
4575 @c FIXME: document how you use it with the vendor
4576 @c branch (or fix cvs so that there is a more graceful
4577 @c way to handle the case).
4578
4579 @item -c@var{string}
4580 Useful with @sc{cvs}.  Sets the comment leader to
4581 @var{string}.  The comment leader is printed before
4582 every log message line generated by the keyword
4583 @code{$@asis{}Log$} (@pxref{Keyword substitution}).
4584 This is useful for programming languages without
4585 multi-line comments.  @sc{Rcs} initially guesses the
4586 value of the comment leader from the file name
4587 extension when the file is first committed.
4588
4589 @item -e[@var{logins}]
4590 Might not work together with @sc{cvs}.  Erase the login
4591 names appearing in the comma-separated list
4592 @var{logins} from the access list of the RCS file.  If
4593 @var{logins} is omitted, erase the entire access list.
4594
4595 @item -I
4596 Run interactively, even if the standard input is not a
4597 terminal.
4598
4599 @item -i
4600 Useless with @sc{cvs}.  When using bare @sc{rcs}, this
4601 is used to create and initialize a new @sc{rcs} file,
4602 without depositing a revision.
4603
4604 @item -k@var{subst}
4605 Useful with @sc{cvs}.  Set the default keyword
4606 substitution to @var{subst}.  @xref{Keyword
4607 substitution}.  Giving an explicit @samp{-k} option to
4608 @code{cvs update}, @code{cvs export}, or @code{cvs
4609 checkout} overrides this default.
4610
4611 @cindex Reserved checkouts
4612 @cindex RCS-style locking
4613 @item -l[@var{rev}]
4614 Lock the revision with number @var{rev}.  If a branch
4615 is given, lock the latest revision on that branch.  If
4616 @var{rev} is omitted, lock the latest revision on the
4617 default branch.
4618
4619 This can be used in conjunction with the
4620 @file{rcslock.pl} script in the @file{contrib}
4621 directory of the @sc{cvs} source distribution to
4622 provide reserved checkouts (where only one user can be
4623 editing a given file at a time).  See the comments in
4624 that file for details (and see the @file{README} file
4625 in that directory for disclaimers about the unsupported
4626 nature of contrib).  According to comments in that
4627 file, locking must set to strict (which is the default).
4628
4629 @item -L
4630 Set locking to strict.  Strict locking means that the
4631 owner of an RCS file is not exempt from locking for
4632 checkin.  For use with @sc{cvs}, strict locking must be
4633 set; see the discussion under the @samp{-l} option above.
4634
4635 @cindex Changing a log message
4636 @cindex Replacing a log message
4637 @cindex Correcting a log message
4638 @cindex Fixing a log message
4639 @cindex Log message, correcting
4640 @item -m@var{rev}:@var{msg}
4641 Replace the log message of revision @var{rev} with
4642 @var{msg}.
4643
4644 @item -N@var{name}[:[@var{rev}]]
4645 Act like @samp{-n}, except override any previous
4646 assignment of @var{name}.
4647
4648 @item -n@var{name}[:[@var{rev}]]
4649 Associate the symbolic name @var{name} with the branch
4650 or revision @var{rev}.  It is normally better to use
4651 @samp{cvs tag} or @samp{cvs rtag} instead.  Delete the
4652 symbolic name if both @samp{:} and @var{rev} are
4653 omitted; otherwise, print an error message if
4654 @var{name} is already associated with another number.
4655 If @var{rev} is symbolic, it is expanded before
4656 association.  A @var{rev} consisting of a branch number
4657 followed by a @samp{.} stands for the current latest
4658 revision in the branch.  A @samp{:} with an empty
4659 @var{rev} stands for the current latest revision on the
4660 default branch, normally the trunk.  For example,
4661 @samp{rcs -n@var{name}: RCS/*} associates @var{name} with the
4662 current latest revision of all the named RCS files;
4663 this contrasts with @samp{rcs -n@var{name}:$ RCS/*} which
4664 associates @var{name} with the revision numbers
4665 extracted from keyword strings in the corresponding
4666 working files.
4667
4668 @cindex Deleting revisions
4669 @cindex Outdating revisions
4670 @cindex Saving space
4671 @item -o@var{range}
4672 Potentially useful, but dangerous, with @sc{cvs} (see below).
4673 Deletes (@dfn{outdates}) the revisions given by
4674 @var{range}.  A range consisting of a single revision
4675 number means that revision.  A range consisting of a
4676 branch number means the latest revision on that branch.
4677 A range of the form @samp{@var{rev1}:@var{rev2}} means
4678 revisions @var{rev1} to @var{rev2} on the same branch,
4679 @samp{:@var{rev}} means from the beginning of the
4680 branch containing @var{rev} up to and including
4681 @var{rev}, and @samp{@var{rev}:} means from revision
4682 @var{rev} to the end of the branch containing
4683 @var{rev}.  None of the outdated revisions may have
4684 branches or locks.
4685
4686 Due to the way @sc{cvs} handles branches @var{rev}
4687 cannot be specified symbolically if it is a branch.
4688 @xref{Magic branch numbers}, for an explanation.
4689
4690 Make sure that no-one has checked out a copy of the
4691 revision you outdate.  Strange things will happen if he
4692 starts to edit it and tries to check it back in.  For
4693 this reason, this option is not a good way to take back
4694 a bogus commit; commit a new revision undoing the bogus
4695 change instead (@pxref{Merging two revisions}).
4696
4697 @item -q
4698 Run quietly; do not print diagnostics.
4699
4700 @item -s@var{state}[:@var{rev}]
4701 Useful with @sc{cvs}.  Set the state attribute of the
4702 revision @var{rev} to @var{state}.  If @var{rev} is a
4703 branch number, assume the latest revision on that
4704 branch.  If @var{rev} is omitted, assume the latest
4705 revision on the default branch.  Any identifier is
4706 acceptable for @var{state}.  A useful set of states is
4707 @samp{Exp} (for experimental), @samp{Stab} (for
4708 stable), and @samp{Rel} (for released).  By default,
4709 the state of a new revision is set to @samp{Exp} when
4710 it is created.  The state is visible in the output from
4711 @var{cvs log} (@pxref{log}), and in the
4712 @samp{$@asis{}Log$} and @samp{$@asis{}State$} keywords
4713 (@pxref{Keyword substitution}).  Note that @sc{cvs}
4714 uses the @code{dead} state for its own purposes; to
4715 take a file to or from the @code{dead} state use
4716 commands like @code{cvs remove} and @code{cvs add}, not
4717 @code{cvs admin -s}.
4718
4719 @item -t[@var{file}]
4720 Useful with @sc{cvs}.  Write descriptive text from the
4721 contents of the named @var{file} into the RCS file,
4722 deleting the existing text.  The @var{file} pathname
4723 may not begin with @samp{-}.  If @var{file} is omitted,
4724 obtain the text from standard input, terminated by
4725 end-of-file or by a line containing @samp{.} by itself.
4726 Prompt for the text if interaction is possible; see
4727 @samp{-I}.  The descriptive text can be seen in the
4728 output from @samp{cvs log} (@pxref{log}).
4729
4730 @item -t-@var{string}
4731 Similar to @samp{-t@var{file}}. Write descriptive text
4732 from the @var{string} into the @sc{rcs} file, deleting
4733 the existing text.
4734
4735 @item -U
4736 Set locking to non-strict.  Non-strict locking means
4737 that the owner of a file need not lock a revision for
4738 checkin.  For use with @sc{cvs}, strict locking must be
4739 set; see the discussion under the @samp{-l} option
4740 above.
4741
4742 @item -u[@var{rev}]
4743 See the option @samp{-l} above, for a discussion of
4744 using this option with @sc{cvs}.  Unlock the revision
4745 with number @var{rev}.  If a branch is given, unlock
4746 the latest revision on that branch.  If @var{rev} is
4747 omitted, remove the latest lock held by the caller.
4748 Normally, only the locker of a revision may unlock it.
4749 Somebody else unlocking a revision breaks the lock.
4750 This causes a mail message to be sent to the original
4751 locker.  The message contains a commentary solicited
4752 from the breaker.  The commentary is terminated by
4753 end-of-file or by a line containing @code{.} by itself.
4754
4755 @item -V@var{n}
4756 Emulate @sc{rcs} version @var{n}. Use -V@var{n} to make
4757 an @sc{rcs} file acceptable to @sc{rcs} version @var{n}
4758 by discarding information that would confuse version
4759 @var{n}.
4760
4761 @item -x@var{suffixes}
4762 Useless with @sc{cvs}. Use @var{suffixes} to
4763 characterize RCS files.
4764 @end table
4765
4766
4767 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4768 @node admin examples
4769 @appendixsubsec admin examples
4770
4771 @appendixsubsubsec Outdating is dangerous
4772
4773 First, an example of how @emph{not} to use the
4774 @code{admin} command.  It is included to stress the
4775 fact that this command can be quite dangerous unless
4776 you know @emph{exactly} what you are doing.
4777
4778 The @samp{-o} option can be used to @dfn{outdate} old revisions
4779 from the history file.  If you are short on disc this option
4780 might help you.  But think twice before using it---there is no
4781 way short of restoring the latest backup to undo this command!
4782
4783 The next line is an example of a command that you would
4784 @emph{not} like to execute.
4785
4786 @example
4787 $ cvs admin -o:R_1_02 .
4788 @end example
4789
4790 The above command will delete all revisions up to, and
4791 including, the revision that corresponds to the tag
4792 R_1_02.  But beware!  If there are files that have not
4793 changed between R_1_02 and R_1_03 the file will have
4794 @emph{the same} numerical revision number assigned to
4795 the tags R_1_02 and R_1_03.  So not only will it be
4796 impossible to retrieve R_1_02; R_1_03 will also have to
4797 be restored from the tapes!
4798
4799 @appendixsubsubsec Comment leaders
4800 @cindex Comment leader
4801 @cindex Log keyword, selecting comment leader
4802 @cindex Nroff (selecting comment leader)
4803
4804 If you use the @code{$@asis{}Log$} keyword and you do
4805 not agree with the guess for comment leader that
4806 @sc{cvs} has done, you can enforce your will with
4807 @code{cvs admin -c}.  This might be suitable for
4808 @code{nroff} source:
4809
4810 @example
4811 $ cvs admin -c'.\" ' *.man
4812 $ rm *.man
4813 $ cvs update
4814 @end example
4815
4816 The two last steps are to make sure that you get the
4817 versions with correct comment leaders in your working
4818 files.
4819
4820 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4821 @node checkout
4822 @appendixsec checkout---Check out sources for editing
4823 @cindex Checkout (subcommand)
4824 @cindex Co (subcommand)
4825
4826 @itemize @bullet
4827 @item
4828 Synopsis: checkout [options] modules@dots{}
4829 @item
4830 Requires: repository.
4831 @item
4832 Changes: working directory.
4833 @item
4834 Synonyms: co, get
4835 @end itemize
4836
4837 Make a working directory containing copies of the
4838 source files specified by @var{modules}.  You must execute
4839 @code{checkout} before using most of the other @sc{cvs}
4840 commands, since most of them operate on your working
4841 directory.
4842
4843 The @var{modules} part of the command are either
4844 symbolic names for some
4845 collection of source directories and files, or paths to
4846 directories or files in the repository.  The symbolic
4847 names are defined in the @samp{modules} file.
4848 @xref{modules}.
4849
4850 Depending on the modules you specify, @code{checkout} may
4851 recursively create directories and populate them with
4852 the appropriate source files.  You can then edit these
4853 source files at any time (regardless of whether other
4854 software developers are editing their own copies of the
4855 sources); update them to include new changes applied by
4856 others to the source repository; or commit your work as
4857 a permanent change to the source repository.
4858
4859 Note that @code{checkout} is used to create
4860 directories.  The top-level directory created is always
4861 added to the directory where @code{checkout} is
4862 invoked, and usually has the same name as the specified
4863 module.  In the case of a module alias, the created
4864 sub-directory may have a different name, but you can be
4865 sure that it will be a sub-directory, and that
4866 @code{checkout} will show the relative path leading to
4867 each file as it is extracted into your private work
4868 area (unless you specify the @samp{-Q} global option).
4869
4870 The files created by @code{checkout} are created
4871 read-write, unless the @samp{-r} option to @sc{cvs}
4872 (@pxref{Global options}) is specified, the
4873 @code{CVSREAD} environment variable is specified
4874 (@pxref{Environment variables}), or a watch is in
4875 effect for that file (@pxref{Watches}).
4876
4877 @c FIXME: misleading--checkout takes a module as
4878 @c argument, and update does not--so -d behavior is not the only
4879 @c difference.
4880 Running @code{checkout} on a directory that was already
4881 built by a prior @code{checkout} is also permitted, and
4882 has the same effect as specifying the @samp{-d} option
4883 to the @code{update} command, that is, any new
4884 directories that have been created in the repository
4885 will appear in your work area.  @xref{update}.
4886
4887 @menu
4888 * checkout options::            checkout options
4889 * checkout examples::           checkout examples
4890 @end menu
4891
4892 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4893 @node checkout options
4894 @appendixsubsec checkout options
4895
4896 These standard options are supported by @code{checkout}
4897 (@pxref{Common options}, for a complete description of
4898 them):
4899
4900 @table @code
4901 @item -D @var{date}
4902 Use the most recent revision no later than @var{date}.
4903 This option is sticky, and implies @samp{-P}.  See
4904 @ref{Sticky tags}, for more information on sticky tags/dates.
4905
4906 @item -f
4907 Only useful with the @samp{-D @var{date}} or @samp{-r
4908 @var{tag}} flags.  If no matching revision is found,
4909 retrieve the most recent revision (instead of ignoring
4910 the file).
4911
4912 @item -k @var{kflag}
4913 Process @sc{rcs} keywords according to @var{kflag}.  See
4914 co(1).  This option is sticky; future updates of
4915 this file in this working directory will use the same
4916 @var{kflag}.  The @code{status} command can be viewed
4917 to see the sticky options.  @xref{status}.
4918
4919 @item -l
4920 Local; run only in current working directory.
4921
4922 @item -n
4923 Do not run any checkout program (as specified
4924 with the @samp{-o} option in the modules file;
4925 @pxref{modules}).
4926
4927 @item -P
4928 Prune empty directories.
4929
4930 @item -p
4931 Pipe files to the standard output.
4932
4933 @item -r @var{tag}
4934 Use revision @var{tag}.  This option is sticky, and implies @samp{-P}.
4935 See @ref{Sticky tags}, for more information on sticky tags/dates.
4936 @end table
4937
4938 In addition to those, you can use these special command
4939 options with @code{checkout}:
4940
4941 @table @code
4942 @item -A
4943 Reset any sticky tags, dates, or @samp{-k} options.
4944 See @ref{Sticky tags}, for more information on sticky tags/dates.
4945
4946 @item -c
4947 Copy the module file, sorted, to the standard output,
4948 instead of creating or modifying any files or
4949 directories in your working directory.
4950
4951 @item -d @var{dir}
4952 Create a directory called @var{dir} for the working
4953 files, instead of using the module name.  Unless you
4954 also use @samp{-N}, the paths created under @var{dir}
4955 will be as short as possible.
4956
4957 @item -j @var{tag}
4958 With two @samp{-j} options, merge changes from the
4959 revision specified with the first @samp{-j} option to
4960 the revision specified with the second @samp{j} option,
4961 into the working directory.
4962
4963 With one @samp{-j} option, merge changes from the
4964 ancestor revision to the revision specified with the
4965 @samp{-j} option, into the working directory.  The
4966 ancestor revision is the common ancestor of the
4967 revision which the working directory is based on, and
4968 the revision specified in the @samp{-j} option.
4969
4970 In addition, each -j option can contain an optional
4971 date specification which, when used with branches, can
4972 limit the chosen revision to one within a specific
4973 date.  An optional date is specified by adding a colon
4974 (:) to the tag:
4975 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
4976
4977 @xref{Merging}.
4978
4979 @item -N
4980 Only useful together with @samp{-d @var{dir}}.  With this
4981 option, @sc{cvs} will not shorten module paths in your
4982 working directory.  (Normally, @sc{cvs} shortens paths as
4983 much as possible when you specify an explicit target
4984 directory).
4985
4986 @item -s
4987 Like @samp{-c}, but include the status of all modules,
4988 and sort it by the status string.  @xref{modules}, for
4989 info about the @samp{-s} option that is used inside the
4990 modules file to set the module status.
4991 @end table
4992
4993 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4994 @node checkout examples
4995 @appendixsubsec checkout examples
4996
4997 Get a copy of the module @samp{tc}:
4998
4999 @example
5000 $ cvs checkout tc
5001 @end example
5002
5003 Get a copy of the module @samp{tc} as it looked one day
5004 ago:
5005
5006 @example
5007 $ cvs checkout -D yesterday tc
5008 @end example
5009
5010 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5011 @node commit
5012 @appendixsec commit---Check files into the repository
5013 @cindex Commit (subcommand)
5014
5015 @itemize @bullet
5016 @item
5017 Version 1.3 Synopsis: commit [-lnR] [-m 'log_message' |
5018 -f file] [-r revision] [files@dots{}]
5019 @item
5020 Version 1.3.1 Synopsis: commit [-lnRf] [-m 'log_message' |
5021 -F file] [-r revision] [files@dots{}]
5022 @c -- rename-f-F--
5023 @item
5024 Requires: working directory, repository.
5025 @item
5026 Changes: repository.
5027 @item
5028 Synonym: ci
5029 @end itemize
5030
5031 @strong{Warning:} The @samp{-f @var{file}} option will
5032 probably be renamed to @samp{-F @var{file}}, and @samp{-f}
5033 will be given a new behavior in future releases of @sc{cvs}.
5034 @c -- rename-f-F--
5035
5036 Use @code{commit} when you want to incorporate changes
5037 from your working source files into the source
5038 repository.
5039
5040 If you don't specify particular files to commit, all of
5041 the files in your working current directory are
5042 examined.  @code{commit} is careful to change in the
5043 repository only those files that you have really
5044 changed.  By default (or if you explicitly specify the
5045 @samp{-R} option), files in subdirectories are also
5046 examined and committed if they have changed; you can
5047 use the @samp{-l} option to limit @code{commit} to the
5048 current directory only.
5049
5050 @code{commit} verifies that the selected files are up
5051 to date with the current revisions in the source
5052 repository; it will notify you, and exit without
5053 committing, if any of the specified files must be made
5054 current first with @code{update} (@pxref{update}).
5055 @code{commit} does not call the @code{update} command
5056 for you, but rather leaves that for you to do when the
5057 time is right.
5058
5059 When all is well, an editor is invoked to allow you to
5060 enter a log message that will be written to one or more
5061 logging programs (@pxref{modules}, and @pxref{loginfo})
5062 and placed in the @sc{rcs} history file inside the
5063 repository.  This log message can be retrieved with the
5064 @code{log} command; @xref{log}.  You can specify the
5065 log message on the command line with the @samp{-m
5066 @var{message}} option, and thus avoid the editor invocation,
5067 or use the @samp{-f @var{file}} option to specify
5068 @c -- rename-f-F--
5069 that the argument file contains the log message.
5070
5071 @menu
5072 * commit options::              commit options
5073 * commit examples::             commit examples
5074 @end menu
5075
5076 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5077 @node commit options
5078 @appendixsubsec commit options
5079
5080 These standard options are supported by @code{commit}
5081 (@pxref{Common options}, for a complete description of
5082 them):
5083
5084 @table @code
5085 @item -l
5086 Local; run only in current working directory.
5087
5088 @item -n
5089 Do not run any module program.
5090
5091 @item -R
5092 Commit directories recursively.  This is on by default.
5093
5094 @item -r @var{revision}
5095 Commit to @var{revision}.  @var{revision} must be
5096 either a branch, or a revision on the main trunk that
5097 is higher than any existing revision number.  You
5098 cannot commit to a specific revision on a branch.
5099 @end table
5100
5101 @code{commit} also supports these options:
5102
5103 @table @code
5104 @item -F @var{file}
5105 This option is present in @sc{cvs} releases 1.3-s3 and
5106 later.  Read the log message from @var{file}, instead
5107 of invoking an editor.
5108
5109 @item -f
5110 @c -- rename-f-F--
5111 This option is present in @sc{cvs} 1.3-s3 and later releases
5112 of @sc{cvs}.  Note that this is not the standard behavior of
5113 the @samp{-f} option as defined in @xref{Common options}.
5114
5115 Force @sc{cvs} to commit a new revision even if you haven't
5116 made any changes to the file.  If the current revision
5117 of @var{file} is 1.7, then the following two commands
5118 are equivalent:
5119
5120 @example
5121 $ cvs commit -f @var{file}
5122 $ cvs commit -r 1.8 @var{file}
5123 @end example
5124
5125 @item -f @var{file}
5126 @c -- rename-f-F--
5127 This option is present in @sc{cvs} releases 1.3, 1.3-s1 and
5128 1.3-s2.  Note that this is not the standard behavior of
5129 the @samp{-f} option as defined in @xref{Common options}.
5130
5131 Read the log message from @var{file}, instead
5132 of invoking an editor.
5133
5134 @item -m @var{message}
5135 Use @var{message} as the log message, instead of
5136 invoking an editor.
5137 @end table
5138
5139 @need 2000
5140 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5141 @node commit examples
5142 @appendixsubsec commit examples
5143
5144 @appendixsubsubsec New major release number
5145
5146 When you make a major release of your product, you
5147 might want the revision numbers to track your major
5148 release number.  You should normally not care about
5149 the revision numbers, but this is a thing that many
5150 people want to do, and it can be done without doing any
5151 harm.
5152
5153 To bring all your files up to the @sc{rcs} revision 3.0
5154 (including those that haven't changed), you might do:
5155
5156 @example
5157 $ cvs commit -r 3.0
5158 @end example
5159
5160 Note that it is generally a bad idea to try to make the
5161 @sc{rcs} revision number equal to the current release number
5162 of your product.  You should think of the revision
5163 number as an internal number that the @sc{cvs} package
5164 maintains, and that you generally never need to care
5165 much about.  Using the @code{tag} and @code{rtag}
5166 commands you can give symbolic names to the releases
5167 instead.  @xref{tag} and @xref{rtag}.
5168
5169 Note that the number you specify with @samp{-r} must be
5170 larger than any existing revision number.  That is, if
5171 revision 3.0 exists, you cannot @samp{cvs commit
5172 -r 1.3}.
5173
5174 @appendixsubsubsec Committing to a branch
5175
5176 You can commit to a branch revision (one that has an
5177 even number of dots) with the @samp{-r} option.  To
5178 create a branch revision, use the @samp{-b} option
5179 of the @code{rtag} or @code{tag} commands (@pxref{tag}
5180 or @pxref{rtag}).  Then, either @code{checkout} or
5181 @code{update} can be used to base your sources on the
5182 newly created branch.  From that point on, all
5183 @code{commit} changes made within these working sources
5184 will be automatically added to a branch revision,
5185 thereby not disturbing main-line development in any
5186 way.  For example, if you had to create a patch to the
5187 1.2 version of the product, even though the 2.0 version
5188 is already under development, you might do:
5189
5190 @example
5191 $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
5192 $ cvs checkout -r FCS1_2_Patch product_module
5193 $ cd product_module
5194 [[ hack away ]]
5195 $ cvs commit
5196 @end example
5197
5198 @noindent
5199 This works automatically since the @samp{-r} option is
5200 sticky.
5201
5202 @appendixsubsubsec Creating the branch after editing
5203
5204 Say you have been working on some extremely
5205 experimental software, based on whatever revision you
5206 happened to checkout last week.  If others in your
5207 group would like to work on this software with you, but
5208 without disturbing main-line development, you could
5209 commit your change to a new branch.  Others can then
5210 checkout your experimental stuff and utilize the full
5211 benefit of @sc{cvs} conflict resolution.  The scenario might
5212 look like:
5213
5214 @c FIXME: Should we be recommending tagging the branchpoint?
5215 @example
5216 [[ hacked sources are present ]]
5217 $ cvs tag -b EXPR1
5218 $ cvs update -r EXPR1
5219 $ cvs commit
5220 @end example
5221
5222 The @code{update} command will make the @samp{-r
5223 EXPR1} option sticky on all files.  Note that your
5224 changes to the files will never be removed by the
5225 @code{update} command.  The @code{commit} will
5226 automatically commit to the correct branch, because the
5227 @samp{-r} is sticky.  You could also do like this:
5228
5229 @c FIXME: Should we be recommending tagging the branchpoint?
5230 @example
5231 [[ hacked sources are present ]]
5232 $ cvs tag -b EXPR1
5233 $ cvs commit -r EXPR1
5234 @end example
5235
5236 @noindent
5237 but then, only those files that were changed by you
5238 will have the @samp{-r EXPR1} sticky flag.  If you hack
5239 away, and commit without specifying the @samp{-r EXPR1}
5240 flag, some files may accidentally end up on the main
5241 trunk.
5242
5243 To work with you on the experimental change, others
5244 would simply do
5245
5246 @example
5247 $ cvs checkout -r EXPR1 whatever_module
5248 @end example
5249
5250 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5251 @node diff
5252 @appendixsec diff---Run diffs between revisions
5253 @cindex Diff (subcommand)
5254
5255 @itemize @bullet
5256 @item
5257 Synopsis: diff [-l] [rcsdiff_options] [[-r rev1 | -D date1] [-r rev2 |  -D date2]] [files@dots{}]
5258 @item
5259 Requires: working directory, repository.
5260 @item
5261 Changes: nothing.
5262 @end itemize
5263
5264 The @code{diff} command is used to compare different
5265 revisions of files.  The default action is to compare
5266 your working files with the revisions they were based
5267 on, and report any differences that are found.
5268
5269 If any file names are given, only those files are
5270 compared.  If any directories are given, all files
5271 under them will be compared.
5272
5273 The exit status will be 0 if no differences were found,
5274 1 if some differences were found, and 2 if any error
5275 occurred.
5276
5277 @menu
5278 * diff options::                diff options
5279 * diff examples::               diff examples
5280 @end menu
5281
5282 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5283 @node diff options
5284 @appendixsubsec diff options
5285
5286 These standard options are supported by @code{diff}
5287 (@pxref{Common options}, for a complete description of
5288 them):
5289
5290 @table @code
5291 @item -D @var{date}
5292 Use the most recent revision no later than @var{date}.
5293 See @samp{-r} for how this affects the comparison.
5294
5295 @sc{cvs} can be configured to pass the @samp{-D} option
5296 through to @code{rcsdiff} (which in turn passes it on
5297 to @code{diff}.  @sc{Gnu} diff uses @samp{-D} as a way to
5298 put @code{cpp}-style @samp{#define} statements around the output
5299 differences.  There is no way short of testing to
5300 figure out how @sc{cvs} was configured.  In the default
5301 configuration @sc{cvs} will use the @samp{-D @var{date}} option.
5302
5303 @item -k @var{kflag}
5304 Process @sc{rcs} keywords according to @var{kflag}.  See
5305 co(1).
5306
5307 @item -l
5308 Local; run only in current working directory.
5309
5310 @item -R
5311 Examine directories recursively.  This option is on by
5312 default.
5313
5314 @item -r @var{tag}
5315 Compare with revision @var{tag}.  Zero, one or two
5316 @samp{-r} options can be present.  With no @samp{-r}
5317 option, the working file will be compared with the
5318 revision it was based on.  With one @samp{-r}, that
5319 revision will be compared to your current working file.
5320 With two @samp{-r} options those two revisions will be
5321 compared (and your working file will not affect the
5322 outcome in any way).
5323
5324 One or both @samp{-r} options can be replaced by a
5325 @samp{-D @var{date}} option, described above.
5326 @end table
5327
5328 Any other options that are found are passed through to
5329 @code{rcsdiff}, which in turn passes them to
5330 @code{diff}.  The exact meaning of the options depends
5331 on which @code{diff} you are using.  The long options
5332 introduced in @sc{gnu} diff 2.0 are not yet supported in
5333 @sc{cvs}.  See the documentation for your @code{diff} to see
5334 which options are supported.
5335
5336 @c -- Document some common useful diff options, such as
5337 @c -u and -c.
5338 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5339 @node diff examples
5340 @appendixsubsec diff examples
5341
5342 The following line produces a Unidiff (@samp{-u} flag)
5343 between revision 1.14 and 1.19 of
5344 @file{backend.c}.  Due to the @samp{-kk} flag no
5345 keywords are substituted, so differences that only depend
5346 on keyword substitution are ignored.
5347
5348 @example
5349 $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
5350 @end example
5351
5352 Suppose the experimental branch EXPR1 was based on a
5353 set of files tagged RELEASE_1_0.  To see what has
5354 happened on that branch, the following can be used:
5355
5356 @example
5357 $ cvs diff -r RELEASE_1_0 -r EXPR1
5358 @end example
5359
5360 A command like this can be used to produce a context
5361 diff between two releases:
5362
5363 @example
5364 $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
5365 @end example
5366
5367 If you are maintaining ChangeLogs, a command like the following
5368 just before you commit your changes may help you write
5369 the ChangeLog entry.  All local modifications that have
5370 not yet been committed will be printed.
5371
5372 @example
5373 $ cvs diff -u | less
5374 @end example
5375
5376 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5377 @node export
5378 @appendixsec export---Export sources from CVS, similar to checkout
5379 @cindex Export (subcommand)
5380
5381 @itemize @bullet
5382 @item
5383 Synopsis: export [-flNn] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
5384 @item
5385 Requires: repository.
5386 @item
5387 Changes: current directory.
5388 @end itemize
5389
5390 This command is a variant of @code{checkout}; use it
5391 when you want a copy of the source for module without
5392 the @sc{cvs} administrative directories.  For example, you
5393 might use @code{export} to prepare source for shipment
5394 off-site.  This command requires that you specify a
5395 date or tag (with @samp{-D} or @samp{-r}), so that you
5396 can count on reproducing the source you ship to others.
5397
5398 One often would like to use @samp{-kv} with @code{cvs
5399 export}.  This causes any @sc{rcs} keywords to be
5400 expanded such that an import done at some other site
5401 will not lose the keyword revision information.  But be
5402 aware that doesn't handle an export containing binary
5403 files correctly.  Also be aware that after having used
5404 @samp{-kv}, one can no longer use the @code{ident}
5405 command (which is part of the @sc{rcs} suite---see
5406 ident(1)) which looks for @sc{rcs} keyword strings.  If
5407 you want to be able to use @code{ident} you must not
5408 use @samp{-kv}.
5409
5410 @menu
5411 * export options::              export options
5412 @end menu
5413
5414 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5415 @node export options
5416 @appendixsubsec export options
5417
5418 These standard options are supported by @code{export}
5419 (@pxref{Common options}, for a complete description of
5420 them):
5421
5422 @table @code
5423 @item -D @var{date}
5424 Use the most recent revision no later than @var{date}.
5425
5426 @item -f
5427 If no matching revision is found, retrieve the most
5428 recent revision (instead of ignoring the file).
5429
5430 @item -l
5431 Local; run only in current working directory.
5432
5433 @item -n
5434 Do not run any checkout program.
5435
5436 @item -R
5437 Export directories recursively.  This is on by default.
5438
5439 @item -r @var{tag}
5440 Use revision @var{tag}.
5441 @end table
5442
5443 In addition, these options (that are common to
5444 @code{checkout} and @code{export}) are also supported:
5445
5446 @table @code
5447 @item -d @var{dir}
5448 Create a directory called @var{dir} for the working
5449 files, instead of using the module name.  Unless you
5450 also use @samp{-N}, the paths created under @var{dir}
5451 will be as short as possible.
5452
5453 @item -k @var{subst}
5454 Set keyword expansion mode (@pxref{Substitution modes}).
5455
5456 @item -N
5457 Only useful together with @samp{-d @var{dir}}.  With this
5458 option, @sc{cvs} will not shorten module paths in your
5459 working directory.  (Normally, @sc{cvs} shortens paths as
5460 much as possible when you specify an explicit target
5461 directory.)
5462 @end table
5463
5464 @ignore
5465 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5466 @c @node export examples
5467 @appendixsubsec export examples
5468
5469 Contributed examples are gratefully accepted.
5470 @c -- Examples here!!
5471 @end ignore
5472
5473 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5474 @node history
5475 @appendixsec history---Show status of files and users
5476 @cindex History (subcommand)
5477
5478 @itemize @bullet
5479 @item
5480 Synopsis:     history [-report] [-flags] [-options args] [files@dots{}]
5481 @item
5482 Requires: the file @file{$CVSROOT/CVSROOT/history}
5483 @item
5484 Changes: nothing.
5485 @end itemize
5486
5487 @sc{cvs} can keep a history file that tracks each use of the
5488 @code{checkout}, @code{commit}, @code{rtag},
5489 @code{update}, and @code{release} commands.  You can
5490 use @code{history} to display this information in
5491 various formats.
5492
5493 Logging must be enabled by creating the file
5494 @file{$CVSROOT/CVSROOT/history}.
5495
5496 @strong{Warning:} @code{history} uses @samp{-f}, @samp{-l},
5497 @samp{-n}, and @samp{-p} in ways that conflict with the
5498 normal use inside @sc{cvs} (@pxref{Common options}).
5499
5500 @menu
5501 * history options::             history options
5502 @end menu
5503
5504 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5505 @node history options
5506 @appendixsubsec history options
5507
5508 Several options (shown above as @samp{-report})  control  what
5509 kind of report is generated:
5510
5511 @table @code
5512 @item -c
5513 Report on each time commit was used (i.e., each time
5514 the repository was modified).
5515
5516 @item -e 
5517 Everything (all record types); equivalent to specifying
5518 @samp{-xMACFROGWUT}.
5519
5520 @item -m @var{module}
5521 Report on a particular module.  (You can meaningfully
5522 use @samp{-m} more than once on the command line.)
5523
5524 @item -o
5525 Report on checked-out modules.
5526
5527 @item -T
5528 Report on all tags.
5529
5530 @item -x @var{type}
5531 Extract a particular set of record types @var{type} from the @sc{cvs}
5532 history.  The types are indicated by single letters,
5533 which you may specify in combination.  
5534
5535 Certain commands have a single record type: 
5536
5537 @table @code
5538 @item F
5539 release
5540 @item O
5541 checkout
5542 @item T
5543 rtag
5544 @end table
5545
5546 @noindent
5547 One of four record types may result from an update:
5548
5549 @table @code
5550 @item C
5551 A merge was necessary but collisions were
5552 detected (requiring manual merging).  
5553 @item G
5554 A merge was necessary and it succeeded.
5555 @item U
5556 A working file was copied from the repository.
5557 @item W
5558 The working copy of a file was deleted during
5559 update (because it was gone from the repository).
5560 @end table
5561
5562 @noindent
5563 One of three record types results from commit:
5564
5565 @table @code
5566 @item A
5567 A file was added for the first time.
5568 @item M
5569 A file was modified.
5570 @item R
5571 A file was removed.
5572 @end table
5573 @end table
5574
5575 The options shown as @samp{-flags} constrain or expand
5576 the report without requiring option arguments:
5577
5578 @table @code
5579 @item -a
5580 Show data for all users (the default is to show data
5581 only for the user executing @code{history}).
5582
5583 @item -l
5584 Show last modification only.
5585
5586 @item -w
5587 Show only the records for modifications done from the
5588 same working directory where @code{history} is
5589 executing.
5590 @end table
5591
5592 The options shown as @samp{-options @var{args}} constrain the report
5593 based on an argument:
5594
5595 @table @code
5596 @item -b @var{str}
5597 Show data back to a record containing  the  string
5598 @var{str}  in  either the module name, the file name, or
5599 the repository path.
5600
5601 @item -D @var{date}
5602 Show data since @var{date}.  This is slightly different
5603 from the normal use of @samp{-D @var{date}}, which
5604 selects the newest revision older than @var{date}.
5605
5606 @item -p @var{repository}
5607 Show data for a particular source repository  (you
5608 can specify several @samp{-p} options on the same command
5609 line).
5610
5611 @item -r @var{rev}
5612 Show records referring to revisions since the revision
5613 or tag named @var{rev} appears in individual @sc{rcs}
5614 files.  Each @sc{rcs} file is searched for the revision or
5615 tag.
5616
5617 @item -t @var{tag}
5618 Show records since tag @var{tag} was last added to the the
5619 history file.  This differs from the @samp{-r} flag
5620 above in that it reads only the history file, not the
5621 @sc{rcs} files, and is much faster.
5622
5623 @item -u @var{name}
5624 Show records for user @var{name}.
5625 @end table
5626
5627 @ignore
5628 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5629 @c @node history examples
5630 @appendixsubsec history examples
5631
5632 Contributed examples will gratefully be accepted.
5633 @c -- Examples here!
5634 @end ignore
5635
5636 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5637 @node import
5638 @appendixsec import---Import sources into CVS, using vendor branches
5639 @cindex Import (subcommand)
5640
5641 @itemize @bullet
5642 @item
5643 Synopsis: import [-options] repository vendortag releasetag@dots{}
5644 @item
5645 Requires: Repository, source distribution directory.
5646 @item
5647 Changes: repository.
5648 @end itemize
5649
5650 Use @code{import} to incorporate an entire source
5651 distribution from an outside source (e.g., a source
5652 vendor) into your source repository directory.  You can
5653 use this command both for initial creation of a
5654 repository, and for wholesale updates to the module
5655 from the outside source.  @xref{Tracking sources}, for
5656 a discussion on this subject.
5657
5658 The @var{repository} argument gives a directory name
5659 (or a path to a directory) under the @sc{cvs} root directory
5660 for repositories; if the directory did not exist,
5661 import creates it.
5662
5663 When you use import for updates to source that has been
5664 modified in your source repository (since a prior
5665 import), it will notify you of any files that conflict
5666 in the two branches of development; use @samp{checkout
5667 -j} to reconcile the differences, as import instructs
5668 you to do.
5669
5670 If @sc{cvs} decides a file should be ignored
5671 (@pxref{cvsignore}), it does not import it and prints
5672 @samp{I } followed by the filename
5673
5674 If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
5675 any file whose names match the specifications in that
5676 file will be treated as packages and the appropriate
5677 filtering will be performed on the file/directory
5678 before being imported, @xref{Wrappers}.
5679
5680 The outside source is saved in a first-level @sc{rcs}
5681 branch, by default 1.1.1.  Updates are leaves of this
5682 branch; for example, files from the first imported
5683 collection of source will be revision 1.1.1.1, then
5684 files from the first imported update will be revision
5685 1.1.1.2, and so on.
5686
5687 At least three arguments are required.
5688 @var{repository} is needed to identify the collection
5689 of source.  @var{vendortag} is a tag for the entire
5690 branch (e.g., for 1.1.1).  You must also specify at
5691 least one @var{releasetag} to identify the files at
5692 the leaves created each time you execute @code{import}.
5693
5694 @menu
5695 * import options::              import options
5696 * import examples::             import examples
5697 @end menu
5698
5699 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5700 @node import options
5701 @appendixsubsec import options
5702
5703 This standard option is supported by @code{import}
5704 (@pxref{Common options}, for a complete description):
5705
5706 @table @code
5707 @item -m @var{message}
5708 Use @var{message} as log information, instead of
5709 invoking an editor.
5710 @end table
5711
5712 There are three additional special options.
5713
5714 @table @code
5715 @item -b @var{branch}
5716 Specify a first-level branch other than 1.1.1.  Unless
5717 the @samp{-b @var{branch}} flag is given, revisions will
5718 @emph{always} be made to the branch 1.1.1---even if a
5719 @var{vendortag} that matches another branch is given!
5720 What happens in that case, is that the tag will be
5721 reset to 1.1.1.  Warning: This behavior might change
5722 in the future.
5723
5724 @item -k @var{subst}
5725 Indicate the RCS keyword expansion mode desired.  This
5726 setting will apply to all files created during the
5727 import, but not to any files that previously existed in
5728 the repository.  See @ref{Substitution modes} for a
5729 list of valid @samp{-k} settings.
5730
5731 @item -I @var{name}
5732 Specify file names that should be ignored during
5733 import.  You can use this option repeatedly.  To avoid
5734 ignoring any files at all (even those ignored by
5735 default), specify `-I !'.
5736
5737 @var{name} can be a file name pattern of the same type
5738 that you can specify in the @file{.cvsignore} file.
5739 @xref{cvsignore}.
5740 @c -- Is this really true?
5741
5742 @item -W @var{spec}
5743 Specify file names that should be filtered during
5744 import.  You can use this option repeatedly.
5745
5746 @var{spec} can be a file name pattern of the same type
5747 that you can specify in the @file{.cvswrappers}
5748 file. @xref{Wrappers}.
5749 @end table
5750
5751 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5752 @node import examples
5753 @appendixsubsec import examples
5754
5755 @xref{Tracking sources}, and @xref{From files}.
5756
5757 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5758 @node log
5759 @appendixsec log---Print out 'rlog' information for files
5760 @cindex Log (subcommand)
5761
5762 @itemize @bullet
5763 @item
5764 Synopsis: log [-l] rlog-options [files@dots{}]
5765 @item
5766 Requires: repository, working directory.
5767 @item
5768 Changes: nothing.
5769 @item
5770 Synonym: rlog
5771 @end itemize
5772
5773 Display log information for files.  @code{log} calls
5774 the @sc{rcs} utility @code{rlog}, which prints all available
5775 information about the @sc{rcs} history file.  This includes
5776 the location of the @sc{rcs} file, the @dfn{head} revision
5777 (the latest revision on the trunk), all symbolic names (tags)
5778 and some other things.  For each revision, the revision
5779 number, the author, the number of lines added/deleted and
5780 the log message are printed.  All times are displayed in
5781 Coordinated Universal Time (UTC).  (Other parts of @sc{cvs}
5782 print times in the local timezone).
5783 @c -- timezone--
5784
5785 @menu
5786 * log options::                 log options
5787 * log examples::                log examples
5788 @end menu
5789
5790 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5791 @node log options
5792 @appendixsubsec log options
5793
5794 Only one option is interpreted by @sc{cvs} and not passed on to @code{rlog}:
5795
5796 @table @code
5797 @item -l
5798 Local; run only in current working directory.  (Default
5799 is to run recursively).
5800 @end table
5801
5802 By default, @code{rlog} prints all information that is
5803 available.  All other options (including those that
5804 normally behave differently) are passed through to
5805 @code{rlog} and restrict the output.  See rlog(1) for a
5806 complete description of options.  This incomplete list
5807 (which is a slightly edited extract from rlog(1)) lists
5808 all options that are useful in conjunction with @sc{cvs}.
5809
5810 @strong{Please note:}  There can be no space between the option
5811 and its argument, since @code{rlog} parses its options
5812 in a different way than @sc{cvs}.
5813
5814 @table @code
5815 @item -b
5816 Print information about the revisions on the default
5817 branch, normally the highest branch on the trunk.
5818
5819 @item -d@var{dates}
5820 Print information about revisions with a checkin
5821 date/time in the range given by the
5822 semicolon-separated list of dates.  The following table
5823 explains the available range formats:
5824
5825 @table @code
5826 @item @var{d1}<@var{d2}
5827 @itemx @var{d2}>@var{d1}
5828 Select the revisions that were deposited between
5829 @var{d1} and @var{d2} inclusive.
5830
5831 @item <@var{d}
5832 @itemx @var{d}>
5833 Select all revisions dated @var{d} or earlier.
5834
5835 @item @var{d}<
5836 @itemx >@var{d}
5837 Select all revisions dated @var{d} or later.
5838
5839 @item @var{d}
5840 Select the single, latest revision dated @var{d} or
5841 earlier.
5842 @end table
5843
5844 The date/time strings @var{d}, @var{d1}, and @var{d2}
5845 are in the free format explained in co(1).  Quoting is
5846 normally necessary, especially for < and >.  Note that
5847 the separator is a semicolon (;).
5848
5849 @item -h
5850 Print only the @sc{rcs} pathname, working pathname, head,
5851 default branch, access list, locks, symbolic names, and
5852 suffix.
5853
5854 @item -N
5855 Do not print the list of tags for this file.  This
5856 option can be very useful when your site uses a lot of
5857 tags, so rather than "more"'ing over 3 pages of tag
5858 information, the log information is presented without
5859 tags at all.  
5860
5861 @item -R
5862 Print only the name of the @sc{rcs} history file.
5863
5864 @item -r@var{revisions}
5865 Print information about revisions given in the
5866 comma-separated list @var{revisions} of revisions and
5867 ranges.  The following table explains the available
5868 range formats:
5869
5870 @table @code
5871 @item @var{rev1}:@var{rev2}
5872 Revisions @var{rev1} to @var{rev2} (which must be on
5873 the same branch).
5874
5875 @item :@var{rev}
5876 Revisions from the beginning of the branch up to
5877 and including @var{rev}.
5878
5879 @item @var{rev}: 
5880 Revisions starting with @var{rev} to the end of the
5881 branch containing @var{rev}.
5882
5883 @item @var{branch}
5884 An argument that is a branch means all revisions on
5885 that branch.  You can unfortunately not specify a
5886 symbolic branch here.  You must specify the numeric
5887 branch number.  @xref{Magic branch numbers}, for an
5888 explanation.
5889
5890 @item @var{branch1}:@var{branch2}
5891 A range of branches means all revisions
5892 on the branches in that range.
5893
5894 @item @var{branch}.
5895 The latest revision in @var{branch}.
5896 @end table
5897
5898 A bare @samp{-r} with no revisions means the latest
5899 revision on the default branch, normally the trunk.
5900
5901 @item -s@var{states}
5902 Print information about revisions whose state
5903 attributes match one of the states given in the
5904 comma-separated list @var{states}.
5905
5906 @item -t
5907 Print the same as @samp{-h}, plus the descriptive text.
5908
5909 @item -w@var{logins}
5910 Print information about revisions checked in by users
5911 with login names appearing in the comma-separated list
5912 @var{logins}.  If @var{logins} is omitted, the user's
5913 login is assumed.
5914 @end table
5915
5916 @code{rlog} prints the intersection of the revisions
5917 selected with the options @samp{-d}, @samp{-l},
5918 @samp{-s}, and @samp{-w}, intersected with the union of
5919 the revisions selected by @samp{-b} and @samp{-r}.
5920
5921 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5922 @node log examples
5923 @appendixsubsec log examples
5924
5925 Contributed examples are gratefully accepted.
5926
5927 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5928 @node rdiff
5929 @appendixsec rdiff---'patch' format diffs between releases
5930 @cindex Rdiff (subcommand)
5931
5932 @itemize @bullet
5933 @item
5934 rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
5935 @item
5936 Requires: repository.
5937 @item
5938 Changes: nothing.
5939 @item
5940 Synonym: patch
5941 @end itemize
5942
5943 Builds a Larry Wall format patch(1) file between two
5944 releases, that can be fed directly into the patch
5945 program to bring an old release up-to-date with the new
5946 release.  (This is one of the few @sc{cvs} commands that
5947 operates directly from the repository, and doesn't
5948 require a prior checkout.) The diff output is sent to
5949 the standard output device.
5950
5951 You can specify (using the standard @samp{-r} and
5952 @samp{-D} options) any combination of one or two
5953 revisions or dates.  If only one revision or date is
5954 specified, the patch file reflects differences between
5955 that revision or date and the current head revisions in
5956 the @sc{rcs} file.
5957
5958 Note that if the software release affected is contained
5959 in more than one directory, then it may be necessary to
5960 specify the @samp{-p} option to the patch command when
5961 patching the old sources, so that patch is able to find
5962 the files that are located in other directories.
5963
5964 @menu
5965 * rdiff options::               rdiff options
5966 * rdiff examples::              rdiff examples
5967 @end menu
5968
5969 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5970 @node rdiff options
5971 @appendixsubsec rdiff options
5972
5973 These standard options are supported by @code{rdiff}
5974 (@pxref{Common options}, for a complete description of
5975 them):
5976
5977 @table @code
5978 @item -D @var{date}
5979 Use the most recent revision no later than @var{date}.
5980
5981 @item -f
5982 If no matching revision is found, retrieve the most
5983 recent revision (instead of ignoring the file).
5984
5985 @item -l
5986 Local; don't descend subdirectories.
5987
5988 @item -r @var{tag}
5989 Use revision @var{tag}.
5990 @end table
5991
5992 In addition to the above, these options are available:
5993
5994 @table @code
5995 @item -c
5996 Use the context diff format.  This is the default format.
5997
5998 @item -s
5999 Create a summary change report instead of a patch.  The
6000 summary includes information about files that were
6001 changed or added between the releases.  It is sent to
6002 the standard output device.  This is useful for finding
6003 out, for example, which files have changed between two
6004 dates or revisions.
6005
6006 @item -t
6007 A diff of the top two revisions is sent to the standard
6008 output device.  This is most useful for seeing what the
6009 last change to a file was.
6010
6011 @item -u
6012 Use the unidiff format for the context diffs.
6013 This option is not available if your diff does not
6014 support the unidiff format.  Remember that old versions
6015 of the @code{patch} program can't handle the unidiff
6016 format, so if you plan to post this patch to the net
6017 you should probably not use @samp{-u}.
6018
6019 @item -V @var{vn}
6020 Expand @sc{rcs} keywords according to the rules current in
6021 @sc{rcs} version @var{vn} (the expansion format changed with
6022 @sc{rcs} version 5).
6023 @end table
6024
6025 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6026 @node rdiff examples
6027 @appendixsubsec rdiff examples
6028
6029 Suppose you receive mail from @t{foo@@bar.com} asking for an
6030 update from release 1.2 to 1.4 of the tc compiler.  You
6031 have no such patches on hand, but with @sc{cvs} that can
6032 easily be fixed with a command such as this:
6033
6034 @example
6035 $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
6036 $$ Mail -s 'The patches you asked for' foo@@bar.com
6037 @end example
6038
6039 Suppose you have made release 1.3, and forked a branch
6040 called @samp{R_1_3fix} for bugfixes.  @samp{R_1_3_1}
6041 corresponds to release 1.3.1, which was made some time
6042 ago.  Now, you want to see how much development has been
6043 done on the branch.  This command can be used:
6044
6045 @example
6046 $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
6047 cvs rdiff: Diffing module-name
6048 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
6049 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
6050 File bar.h,v changed from revision 1.29.2.1 to 1.2
6051 @end example
6052
6053 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6054 @node release
6055 @appendixsec release---Indicate that a Module is no longer in use
6056 @cindex Release (subcommand)
6057
6058 @itemize @bullet
6059 @item
6060 release [-d] directories@dots{}
6061 @item
6062 Requires: Working directory.
6063 @item
6064 Changes: Working directory, history log.
6065 @end itemize
6066
6067 This command is meant to safely cancel the effect of
6068 @samp{cvs checkout}.  Since @sc{cvs} doesn't lock files, it
6069 isn't strictly necessary to use this command.  You can
6070 always simply delete your working directory, if you
6071 like; but you risk losing changes you may have
6072 forgotten, and you leave no trace in the @sc{cvs} history
6073 file (@pxref{history file}) that you've abandoned your
6074 checkout.
6075
6076 Use @samp{cvs release} to avoid these problems.  This
6077 command checks that no uncommitted changes are
6078 present; that you are executing it from immediately
6079 above a @sc{cvs} working directory; and that the repository
6080 recorded for your files is the same as the repository
6081 defined in the module database.
6082
6083 If all these conditions are true, @samp{cvs release}
6084 leaves a record of its execution (attesting to your
6085 intentionally abandoning your checkout) in the @sc{cvs}
6086 history log.
6087
6088 @menu
6089 * release options::             release options
6090 * release output::              release options
6091 * release examples::            release examples
6092 @end menu
6093
6094 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6095 @node release options
6096 @appendixsubsec release options
6097
6098 The @code{release} command supports one command option:
6099
6100 @table @code
6101 @item -d
6102 Delete your working copy of the file if the release
6103 succeeds.  If this flag is not given your files will
6104 remain in your working directory.
6105
6106 @strong{Warning:}  The @code{release} command uses
6107 @samp{rm -r @file{module}} to delete your file.  This
6108 has the very serious side-effect that any directory
6109 that you have created inside your checked-out sources,
6110 and not added to the repository (using the @code{add}
6111 command; @pxref{add}) will be silently deleted---even
6112 if it is non-empty!
6113 @end table
6114
6115 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6116 @node release output
6117 @appendixsubsec release output
6118
6119 Before @code{release} releases your sources it will
6120 print a one-line message for any file that is not
6121 up-to-date.  
6122
6123 @strong{Warning:}  Any new directories that you have
6124 created, but not added to the @sc{cvs} directory hierarchy
6125 with the @code{add} command (@pxref{add}) will be
6126 silently ignored (and deleted, if @samp{-d} is
6127 specified), even if they contain files.
6128
6129 @table @code
6130 @item U @var{file}
6131 There exists a newer revision of this file in the
6132 repository, and you have not modified your local copy
6133 of the file.
6134
6135 @item A @var{file}
6136 The file has been added to your private copy of the
6137 sources, but has not yet been committed to the
6138 repository.  If you delete your copy of the sources
6139 this file will be lost.
6140
6141 @item R @var{file}
6142 The file has been removed from your private copy of the
6143 sources, but has not yet been removed from the
6144 repository, since you have not yet committed the
6145 removal.  @xref{commit}.
6146
6147 @item M @var{file}
6148 The file is modified in your working directory.  There
6149 might also be a newer revision inside the repository.
6150
6151 @item ? @var{file}
6152 @var{file} is in your working directory, but does not
6153 correspond to anything in the source repository, and is
6154 not in the list of files for @sc{cvs} to ignore (see the
6155 description of the @samp{-I} option, and
6156 @pxref{cvsignore}).  If you remove your working
6157 sources, this file will be lost.
6158
6159 Note that no warning message like this is printed for
6160 spurious directories that @sc{cvs} encounters.  The
6161 directory, and all its contents, are silently ignored.
6162
6163 @c FIXME -- CVS should be fixed to print "? foo" for
6164 @c such spurious directories
6165 @end table
6166
6167 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6168 @node release examples
6169 @appendixsubsec release examples
6170
6171 Release the module, and delete your local working copy
6172 of the files.
6173
6174 @example
6175 $ cd ..         # @r{You must stand immediately above the}
6176                 # @r{sources when you issue @samp{cvs release}.}
6177 $ cvs release -d tc
6178 You have [0] altered files in this repository.
6179 Are you sure you want to release (and delete) module `tc': y
6180 $
6181 @end example
6182
6183 @node rtag
6184 @appendixsec rtag---Add a tag to the RCS file
6185 @cindex Rtag (subcommand)
6186
6187 @itemize @bullet
6188 @item
6189 rtag [-falnR] [-b] [-d] [-r tag | -Ddate] symbolic_tag modules@dots{}
6190 @item
6191 Requires: repository.
6192 @item
6193 Changes: repository.
6194 @item
6195 Synonym: rfreeze
6196 @end itemize
6197
6198 You can use this command to assign symbolic tags to
6199 particular, explicitly specified source revisions in
6200 the repository.  @code{rtag} works directly on the
6201 repository contents (and requires no prior checkout).
6202 Use @code{tag} instead (@pxref{tag}), to base the
6203 selection of revisions on the contents of your
6204 working directory.
6205
6206 If you attempt to use a tag name that already exists,
6207 @sc{cvs} will complain and not overwrite that tag.  Use
6208 the @samp{-F} option to force the new tag value.
6209
6210 @menu
6211 * rtag options::                rtag options
6212 @end menu
6213
6214 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6215 @node rtag options
6216 @appendixsubsec rtag options
6217
6218 These standard options are supported by @code{rtag}
6219 (@pxref{Common options}, for a complete description of
6220 them):
6221
6222 @table @code
6223 @item -D @var{date}
6224 Tag the most recent revision no later than @var{date}.
6225
6226 @item -f
6227 Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
6228 flags.  If no matching revision is found, use the most
6229 recent revision (instead of ignoring the file).
6230
6231 @item -F 
6232 Overwrite an existing tag of the same name on a
6233 different revision.  This option is new in @sc{cvs}
6234 1.4.  The old behavior is matched by @samp{cvs tag -F}.
6235
6236 @item -l
6237 Local; run only in current working directory.
6238
6239 @item -n
6240 Do not run any tag program that was specified with the
6241 @samp{-t} flag inside the @file{modules} file.
6242 (@pxref{modules}).
6243
6244 @item -R
6245 Commit directories recursively.  This is on by default.
6246
6247 @item -r @var{tag}
6248 Only tag those files that contain @var{tag}.  This can
6249 be used to rename a tag: tag only the files identified
6250 by the old tag, then delete the old tag, leaving the
6251 new tag on exactly the same files as the old tag.
6252 @end table
6253
6254 In addition to the above common options, these options
6255 are available:
6256
6257 @table @code
6258 @item -a
6259 Use the @samp{-a} option to have @code{rtag} look in the
6260 @file{Attic} (@pxref{Removing files}) for removed files
6261 that contain the specified tag.  The tag is removed from
6262 these files, which makes it convenient to re-use a
6263 symbolic tag as development continues (and files get
6264 removed from the up-coming distribution).
6265
6266 @item -b
6267 Make the tag a branch tag.  @xref{Branches}.
6268
6269 @item -d
6270 Delete the tag instead of creating it.
6271
6272 In general, tags (often the symbolic names of software
6273 distributions) should not be removed, but the @samp{-d}
6274 option is available as a means to remove completely
6275 obsolete symbolic names if necessary (as might be the
6276 case for an Alpha release, or if you mistagged a
6277 module).
6278 @end table
6279
6280 @ignore
6281 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6282 @c @node rtag examples
6283 @appendixsubsec rtag examples
6284
6285 @c -- Examples here!
6286 @end ignore
6287
6288 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6289 @node status
6290 @appendixsec status---Status info on the revisions
6291 @cindex Status (subcommand)
6292
6293 @itemize @bullet
6294 @item
6295 status [-lR] [-v] [files@dots{}]
6296 @item
6297 Requires: working directory, repository.
6298 @item
6299 Changes: nothing.
6300 @end itemize
6301
6302 Display a brief report on the current status of files
6303 with respect to the source repository, including any
6304 sticky tags, dates, or @samp{-k} options.
6305
6306 You can also use this command to determine the
6307 potential impact of a @samp{cvs update} on your working
6308 source directory---but remember that things might
6309 change in the repository before you run @code{update}.
6310
6311 @menu
6312 * status options::              status options
6313 @end menu
6314
6315 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6316 @node status options
6317 @appendixsubsec status options
6318
6319 These standard options are supported by @code{status}
6320 (@pxref{Common options}, for a complete description of
6321 them):
6322
6323 @table @code
6324 @item -l
6325 Local; run only in current working directory.
6326
6327 @item -R
6328 Commit directories recursively.  This is on by default.
6329 @end table
6330
6331 There is one additional option:
6332
6333 @table @code
6334 @item -v
6335 Verbose.  In addition to the information normally
6336 displayed, print all symbolic tags, together with the
6337 numerical value of the revision or branch they refer
6338 to.
6339 @end table
6340
6341 @ignore
6342 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6343 @c @node status examples
6344 @appendixsubsec status examples
6345
6346 @c -- FIXME
6347 @end ignore
6348
6349 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6350 @node tag
6351 @appendixsec tag---Add a symbolic tag to checked out version of RCS file
6352 @c --                    //////// - unnecessary. Also
6353 @c --                               in a lot of other
6354 @c --                               places.
6355 @cindex Tag (subcommand)
6356
6357 @itemize @bullet
6358 @item
6359 tag [-lR] [-b] [-d] symbolic_tag [files@dots{}]
6360 @item
6361 Requires: working directory, repository.
6362 @item
6363 Changes: repository.
6364 @item
6365 Synonym: freeze
6366 @end itemize
6367
6368 Use this command to assign symbolic tags to the nearest
6369 repository versions to your working sources.  The tags
6370 are applied immediately to the repository, as with
6371 @code{rtag}, but the versions are supplied implicitly by the
6372 @sc{cvs} records of your working files' history rather than
6373 applied explicitly.
6374
6375 One use for tags is to record a snapshot of the
6376 current sources when the software freeze date of a
6377 project arrives.  As bugs are fixed after the freeze
6378 date, only those changed sources that are to be part of
6379 the release need be re-tagged.
6380
6381 The symbolic tags are meant to permanently record which
6382 revisions of which files were used in creating a
6383 software distribution.  The @code{checkout} and
6384 @code{update} commands allow you to extract an exact
6385 copy of a tagged release at any time in the future,
6386 regardless of whether files have been changed, added,
6387 or removed since the release was tagged.
6388
6389 This command can also be used to delete a symbolic tag,
6390 or to create a branch.  See the options section below.
6391
6392 If you attempt to use a tag name that already exists,
6393 @sc{cvs} will complain and not overwrite that tag.  Use
6394 the @samp{-F} option to force the new tag value.
6395
6396
6397 @menu
6398 * tag options::                 tag options
6399 @end menu
6400
6401 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6402 @node tag options
6403 @appendixsubsec tag options
6404
6405 These standard options are supported by @code{tag}
6406 (@pxref{Common options}, for a complete description of
6407 them):
6408
6409 @table @code
6410 @item -F 
6411 Overwrite an existing tag of the same name on a
6412 different revision.  This option is new in @sc{cvs}
6413 1.4.  The old behavior is matched by @samp{cvs tag -F}.
6414
6415 @item -l
6416 Local; run only in current working directory.
6417
6418 @item -R
6419 Commit directories recursively.  This is on by default.
6420 @end table
6421
6422 Two special options are available:
6423
6424 @table @code
6425 @item -b
6426 The -b option makes the tag a branch tag
6427 (@pxref{Branches}), allowing concurrent, isolated
6428 development.  This is most useful for creating a patch
6429 to a previously released software distribution.
6430
6431 @item -d
6432 Delete a tag.
6433
6434 If you use @samp{cvs tag -d symbolic_tag}, the symbolic
6435 tag you specify is deleted instead of being added.
6436 Warning: Be very certain of your ground before you
6437 delete a tag; doing this permanently discards some
6438 historical information, which may later turn out to
6439 be valuable.
6440 @end table
6441
6442 @ignore
6443 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6444 @c @node tag examples
6445 @appendixsubsec tag examples
6446
6447 @c -- FIXME
6448 @end ignore
6449
6450 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6451 @node update
6452 @appendixsec update---Bring work tree in sync with repository
6453 @cindex Update (subcommand)
6454
6455 @itemize @bullet
6456 @item
6457 update [-AdflPpR] [-d] [-r tag|-D date] files@dots{}
6458 @item
6459 Requires: repository, working directory.
6460 @item
6461 Changes: working directory.
6462 @end itemize
6463
6464 After you've run checkout to create your private copy
6465 of source from the common repository, other developers
6466 will continue changing the central source.  From time
6467 to time, when it is convenient in your development
6468 process, you can use the @code{update} command from
6469 within your working directory to reconcile your work
6470 with any revisions applied to the source repository
6471 since your last checkout or update.
6472
6473 @menu
6474 * update options::              update options
6475 * update output::               update output
6476 * update examples::             update examples
6477 @end menu
6478
6479 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6480 @node update options
6481 @appendixsubsec update options
6482
6483 These standard options are available with @code{update}
6484 (@pxref{Common options}, for a complete description of
6485 them):
6486
6487 @table @code
6488 @item -D date
6489 Use the most recent revision no later than @var{date}.
6490 This option is sticky, and implies @samp{-P}.
6491 See @ref{Sticky tags}, for more information on sticky tags/dates.
6492
6493 @item -f
6494 Only useful with the @samp{-D @var{date}} or @samp{-r
6495 @var{tag}} flags.  If no matching revision is found,
6496 retrieve the most recent revision (instead of ignoring
6497 the file).
6498
6499 @item -k @var{kflag}
6500 Process @sc{rcs} keywords according to @var{kflag}.  See
6501 co(1).  This option is sticky; future updates of
6502 this file in this working directory will use the same
6503 @var{kflag}.  The @code{status} command can be viewed
6504 to see the sticky options.  @xref{status}.
6505
6506 @item -l
6507 Local; run only in current working directory.  @xref{Recursive behavior}.
6508
6509 @item -P
6510 Prune empty directories.
6511
6512 @item -p
6513 Pipe files to the standard output.
6514
6515 @item -R
6516 Operate recursively.  This is on by default.
6517 @xref{Recursive behavior}.
6518
6519 @item -r tag
6520 Retrieve revision @var{tag}.  This option is sticky,
6521 and implies @samp{-P}.
6522 See @ref{Sticky tags}, for more information on sticky tags/dates.
6523 @end table
6524
6525 @need 800
6526 These special options are also available with
6527 @code{update}.
6528
6529 @table @code
6530 @item -A
6531 Reset any sticky tags, dates, or @samp{-k} options.
6532 See @ref{Sticky tags}, for more information on sticky tags/dates.
6533
6534 @item -d
6535 Create any directories that exist in the repository if
6536 they're missing from the working directory.  Normally,
6537 @code{update} acts only on directories and files that
6538 were already enrolled in your working directory.  
6539
6540 This is useful for updating directories that were
6541 created in the repository since the initial checkout;
6542 but it has an unfortunate side effect.  If you
6543 deliberately avoided certain directories in the
6544 repository when you created your working directory
6545 (either through use of a module name or by listing
6546 explicitly the files and directories you wanted on the
6547 command line), then updating with @samp{-d} will create
6548 those directories, which may not be what you want.
6549
6550 @item -I @var{name}
6551 Ignore files whose names match @var{name} (in your
6552 working directory) during the update.  You can specify
6553 @samp{-I} more than once on the command line to specify
6554 several files to ignore.  Use @samp{-I !} to avoid
6555 ignoring any files at all.  @xref{cvsignore}, for other
6556 ways to make @sc{cvs} ignore some files.
6557
6558 @item -W@var{spec}
6559 Specify file names that should be filtered during
6560 update.  You can use this option repeatedly.
6561
6562 @var{spec} can be a file name pattern of the same type
6563 that you can specify in the @file{.cvswrappers}
6564 file. @xref{Wrappers}.
6565
6566 @item -j@var{revision}
6567 With two @samp{-j} options, merge changes from the
6568 revision specified with the first @samp{-j} option to
6569 the revision specified with the second @samp{j} option,
6570 into the working directory.
6571
6572 With one @samp{-j} option, merge changes from the
6573 ancestor revision to the revision specified with the
6574 @samp{-j} option, into the working directory.  The
6575 ancestor revision is the common ancestor of the
6576 revision which the working directory is based on, and
6577 the revision specified in the @samp{-j} option.
6578
6579 In addition, each -j option can contain an optional
6580 date specification which, when used with branches, can
6581 limit the chosen revision to one within a specific
6582 date.  An optional date is specified by adding a colon
6583 (:) to the tag:
6584 @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
6585
6586 @xref{Merging}.
6587
6588 @end table
6589
6590 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6591 @node update output
6592 @appendixsubsec update output
6593
6594 @code{update} keeps you informed of its progress by
6595 printing a line for each file, preceded by one
6596 character indicating the status of the file:
6597
6598 @table @code
6599 @item U @var{file}
6600 The file was brought up to date with respect to the
6601 repository.  This is done for any file that exists in
6602 the repository but not in your source, and for files
6603 that you haven't changed but are not the most recent
6604 versions available in the repository.
6605
6606 @item A @var{file}
6607 The file has been added to your private copy of the
6608 sources, and will be added to the source repository
6609 when you run @code{commit} on the file.  This is a
6610 reminder to you that the file needs to be committed.
6611
6612 @item R @var{file}
6613 The file has been removed from your private copy of the
6614 sources, and will be removed from the source repository
6615 when you run @code{commit} on the file.  This is a
6616 reminder to you that the file needs to be committed.
6617
6618 @item M @var{file}
6619 The file is modified in  your  working  directory.
6620
6621 @samp{M} can indicate one of two states for a file
6622 you're working on: either there were no modifications
6623 to the same file in the repository, so that your file
6624 remains as you last saw it; or there were modifications
6625 in the repository as well as in your copy, but they
6626 were merged successfully, without conflict, in your
6627 working directory.
6628
6629 @sc{cvs} will print some messages if it merges your work,
6630 and a backup copy of your working file (as it looked
6631 before you ran @code{update}) will be made.  The exact
6632 name of that file is printed while @code{update} runs.
6633
6634 @item C @var{file}
6635 A conflict was detected while trying to merge your
6636 changes to @var{file} with changes from the source
6637 repository.  @var{file} (the copy in your working
6638 directory) is now the output of the rcsmerge(1) command
6639 on the two revisions; an unmodified copy of your file
6640 is also in your working directory, with the name
6641 @file{.#@var{file}.@var{revision}} where @var{revision}
6642 is the @sc{rcs} revision that your modified file started
6643 from.  (Note that some systems automatically purge
6644 files that begin with @file{.#} if they have not been
6645 accessed for a few days.  If you intend to keep a copy
6646 of your original file, it is a very good idea to rename
6647 it.)
6648
6649 @item ? @var{file}
6650 @var{file} is in your working directory, but does not
6651 correspond to anything in the source repository, and is
6652 not in the list of files for @sc{cvs} to ignore (see the
6653 description of the @samp{-I} option, and
6654 @pxref{cvsignore}).
6655
6656 Note that no warning message like this is printed for
6657 spurious directories that @sc{cvs} encounters.  The
6658 directory, and all its contents, are silently ignored.
6659 @end table
6660
6661 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6662 @node update examples
6663 @appendixsubsec update examples
6664
6665 The following line will display all files which are not
6666 up-to-date without actually change anything in your
6667 working directory.  It can be used to check what has
6668 been going on with the project.
6669
6670 @example
6671 $ cvs -n -q update
6672 @end example
6673
6674 @c ---------------------------------------------------------------------
6675 @node Administrative files
6676 @appendix Reference manual for the Administrative files
6677 @cindex Administrative files (reference)
6678 @cindex Files, reference manual
6679 @cindex Reference manual (files)
6680 @cindex CVSROOT (file)
6681
6682 Inside the repository, in the directory
6683 @file{$CVSROOT/CVSROOT}, there are a number of
6684 supportive files for @sc{cvs}.  You can use @sc{cvs} in a limited
6685 fashion without any of them, but if they are set up
6686 properly they can help make life easier.
6687
6688 The most important of these files is the @file{modules}
6689 file, which defines the modules inside the repository.
6690
6691 @menu
6692 * modules::                     Defining modules
6693 * Wrappers::                    Treat directories as files
6694 * commit files::                The commit support files
6695 * commitinfo::                  Pre-commit checking
6696 * editinfo::                    Specifying how log messages are created
6697 * loginfo::                     Where should log messages be sent?
6698 * rcsinfo::                     Templates for the log messages
6699 * cvsignore::                   Ignoring files via cvsignore
6700 * history file::                History information
6701 * Setting up::                  Setting up the repository
6702 * Variables::                   Various variables are expanded
6703 @end menu
6704
6705 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6706 @node modules
6707 @appendixsec The modules file
6708 @cindex Modules (admin file)
6709 @cindex Defining modules (reference manual)
6710
6711 The @file{modules} file records your definitions of
6712 names for collections of source code.  @sc{cvs} will
6713 use these definitions if you use @sc{cvs} to update the
6714 modules file (use normal commands like @code{add},
6715 @code{commit}, etc).
6716
6717 The @file{modules} file may contain blank lines and
6718 comments (lines beginning with @samp{#}) as well as
6719 module definitions.  Long lines can be continued on the
6720 next line by specifying a backslash (@samp{\}) as the
6721 last character on the line.
6722
6723 A module definition is a single line of the
6724 @file{modules} file, in either of two formats.  In both
6725 cases, @var{mname} represents the symbolic module name,
6726 and the remainder of the line is its definition.
6727
6728 @table @code
6729 @item @var{mname} -a @var{aliases}@dots{}
6730 This represents the simplest way of defining a module
6731 @var{mname}.  The @samp{-a} flags the definition as a
6732 simple alias: @sc{cvs} will treat any use of @var{mname} (as
6733 a command argument) as if the list of names
6734 @var{aliases} had been specified instead.
6735 @var{aliases} may contain either other module names or
6736 paths.  When you use paths in aliases, @code{checkout}
6737 creates all intermediate directories in the working
6738 directory, just as if the path had been specified
6739 explicitly in the @sc{cvs} arguments.
6740
6741 @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ] [ &@var{module}@dots{} ]
6742 In the simplest case, this form of module definition
6743 reduces to @samp{@var{mname} @var{dir}}.  This defines
6744 all the files in directory @var{dir} as module mname.
6745 @var{dir} is a relative path (from @code{$CVSROOT}) to a
6746 directory of source in the source repository.  In this
6747 case, on checkout, a single directory called
6748 @var{mname} is created as a working directory; no
6749 intermediate directory levels are used by default, even
6750 if @var{dir} was a path involving several directory
6751 levels.
6752
6753 By explicitly specifying files in the module definition
6754 after @var{dir}, you can select particular files from
6755 directory @var{dir}.  The sample definition for
6756 @samp{modules} is an example of a module defined with a
6757 single file from a particular directory.  Here is
6758 another example:
6759
6760 @example
6761 m4test  unsupported/gnu/m4 foreach.m4 forloop.m4
6762 @end example
6763
6764 @noindent
6765 With this definition, executing @samp{cvs checkout
6766 m4test} will create a single working directory
6767 @file{m4test} containing the two files listed, which
6768 both come from a common directory several levels deep
6769 in the @sc{cvs} source repository.
6770
6771 A module definition can refer to other modules by
6772 including @samp{&@var{module}} in its definition.
6773 @code{checkout} creates a subdirectory for each such
6774 module, in your working directory.
6775 @c -- Nope. "in your working directory" is wrong. What
6776 @c -- is right?
6777
6778 @table @code
6779 @item -d @var{name}
6780 Name the working directory something other than the
6781 module name.
6782
6783 @cindex Export program
6784 @item -e @var{prog}
6785 Specify a program @var{prog} to run whenever files in a
6786 module are exported.  @var{prog} runs with a single
6787 argument, the module name.
6788
6789 @cindex Checkin program
6790 @item -i @var{prog}
6791 Specify a program @var{prog} to run whenever files in a
6792 module are committed.  @var{prog} runs with a single
6793 argument, the full pathname of the affected directory
6794 in a source repository.  The @file{commitinfo},
6795 @file{loginfo}, and @file{editinfo} files provide other
6796 ways to call a program on commit.
6797
6798 @cindex Checkout program
6799 @item -o @var{prog}
6800 Specify a program @var{prog} to run whenever files in a
6801 module are checked out.  @var{prog} runs with a single
6802 argument, the module name.
6803
6804 @cindex Status of a module
6805 @cindex Module status
6806 @item -s @var{status}
6807 Assign a status to the module.  When the module file is
6808 printed with @samp{cvs checkout -s} the modules are
6809 sorted according to primarily module status, and
6810 secondarily according to the module name.  This option
6811 has no other meaning.  You can use this option for
6812 several things besides status: for instance, list the
6813 person that is responsible for this module.
6814
6815 @cindex Tag program
6816 @item -t @var{prog}
6817 Specify a program @var{prog} to run whenever files in a
6818 module are tagged with @code{rtag}.  @var{prog} runs
6819 with two arguments: the module name and the symbolic
6820 tag specified to @code{rtag}.  There is no way to
6821 specify a program to run when @code{tag} is executed.
6822
6823 @cindex Update program
6824 @item -u @var{prog}
6825 Specify a program @var{prog} to run whenever @samp{cvs
6826 update} is executed from the top-level directory of the
6827 checked-out module.  @var{prog} runs with a single
6828 argument, the full path to the source repository for
6829 this module.
6830 @end table
6831 @end table
6832
6833 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6834 @node Wrappers
6835 @appendixsec The cvswrappers file
6836 @cindex cvswrappers (admin file)
6837 @cindex CVSWRAPPERS, environment variable
6838 @cindex Wrappers
6839
6840 Wrappers allow you to set a hook which transforms files on
6841 their way in and out of @sc{cvs}.  Most or all of the
6842 wrappers features do not work with client/server @sc{cvs}.
6843
6844 The file @file{cvswrappers} defines the script that will be
6845 run on a file when its name matches a regular
6846 expresion. There are two scripts that can be run on a
6847 file or directory. One script is executed on the file/directory
6848 before being checked into the repository (this is denoted
6849 with the @code{-t} flag) and the other when the file is
6850 checked out of the repository (this is denoted with the
6851 @code{-f} flag)
6852
6853 The @file{cvswrappers} also has a @samp{-m} option to
6854 specify the merge methodology that should be used when
6855 the file is updated.  @code{MERGE} means the usual
6856 @sc{cvs} behavior: try to merge the files (this
6857 generally will not work for binary files).  @code{COPY}
6858 means that @code{cvs update} will merely copy one
6859 version over the other, and require the user using
6860 mechanisms outside @sc{cvs}, to insert any necessary
6861 changes.
6862 @c FIXME: which version is copied over which version?
6863 The @samp{-m} wrapper option only affects behavior when
6864 merging is done on update; it does not affect how files
6865 are stored.  See @xref{Binary files}, for more on
6866 binary files.
6867
6868 The basic format of the file @file{cvswrappers} is:
6869
6870 @example
6871 wildcard     [option value][option value]...
6872
6873 where option is one of
6874 -f           from cvs filter         value: path tofilter
6875 -t           to cvs filter           value: path to filter
6876 -m           update methodology      value: MERGE or COPY
6877
6878 and value is a single-quote delimited value.
6879 @end example
6880
6881 @example
6882 *.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
6883 *.c      -t 'indent %s %s'
6884 @end example
6885
6886 @noindent
6887 The above example of a @file{cvswrappers} file
6888 states that all files/directories that end with a @code{.nib}
6889 should be filtered with the @file{wrap} program before
6890 checking the file into the repository. The file should
6891 be filtered though the @file{unwrap} program when the
6892 file is checked out of the repository. The
6893 @file{cvswrappers} file also states that a @code{COPY}
6894 methodology should be used when updating the files in
6895 the repository (that is no merging should be performed).
6896
6897 The last example line says that all files that end with
6898 a @code{*.c} should be filtered with @file{indent}
6899 before being checked into the repository. Unlike the previous
6900 example no filtering of the @code{*.c} file is done when
6901 it is checked out of the repository.
6902 @noindent
6903 The @code{-t} filter is called with two arguments,
6904 the first is the name of the file/directory to filter
6905 and the second is the pathname to where the resulting
6906 filtered file should be placed.
6907
6908 @noindent
6909 The @code{-f} filter is called with one argument,
6910 which is the name of the file to filter from. The end
6911 result of this filter will be a file in the users directory
6912 that they can work on as they normally would.
6913
6914 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6915 @node commit files
6916 @appendixsec The commit support files
6917 @cindex Commit files
6918
6919 The @samp{-i} flag in the @file{modules} file can be
6920 used to run a certain program whenever files are
6921 committed (@pxref{modules}).  The files described in
6922 this section provide other, more flexible, ways to run
6923 programs whenever something is committed.
6924
6925 There are three kind of programs that can be run on
6926 commit.  They are specified in files in the repository,
6927 as described below.  The following table summarizes the
6928 file names and the purpose of the corresponding
6929 programs.
6930
6931 @table @file
6932 @item commitinfo
6933 The program is responsible for checking that the commit
6934 is allowed.  If it exits with a non-zero exit status
6935 the commit will be aborted.
6936
6937 @item editinfo
6938 The specified program is used to edit the log message,
6939 and possibly verify that it contains all required
6940 fields.  This is most useful in combination with the
6941 @file{rcsinfo} file, which can hold a log message
6942 template (@pxref{rcsinfo}).
6943
6944 @item loginfo
6945 The specified program is called when the commit is
6946 complete.  It receives the log message and some
6947 additional information and can store the log message in
6948 a file, or mail it to appropriate persons, or maybe
6949 post it to a local newsgroup, or@dots{}  Your
6950 imagination is the limit!
6951 @end table
6952
6953 @menu
6954 * syntax::                      The common syntax
6955 @end menu
6956
6957 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6958 @node syntax
6959 @appendixsubsec The common syntax
6960 @cindex Info files (syntax)
6961 @cindex Syntax of info files
6962 @cindex Common syntax of info files
6963
6964 The four files @file{commitinfo}, @file{loginfo},
6965 @file{rcsinfo} and @file{editinfo} all have a common
6966 format.  The purpose of the files are described later
6967 on.  The common syntax is described here.
6968
6969 Each line contains the following:
6970 @itemize @bullet
6971 @item
6972 A regular expression
6973
6974 @item
6975 A whitespace separator---one or more spaces and/or tabs.
6976
6977 @item
6978 A file name or command-line template.
6979 @end itemize
6980
6981 @noindent
6982 Blank lines are ignored.  Lines that start with the
6983 character @samp{#} are treated as comments.  Long lines
6984 unfortunately can @emph{not} be broken in two parts in
6985 any way.
6986
6987 The first regular expression that matches the current
6988 directory name in the repository is used.  The rest of the line
6989 is used as a file name or command-line as appropriate.
6990
6991 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6992 @node commitinfo
6993 @appendixsec Commitinfo
6994 @cindex Commitinfo
6995 @cindex Checking commits
6996 @cindex Precommit checking
6997
6998 The @file{commitinfo} file defines programs to execute
6999 whenever @samp{cvs commit} is about to execute.  These
7000 programs are used for pre-commit checking to verify
7001 that the modified, added and removed files are really
7002 ready to be committed.  This could be used, for
7003 instance, to verify that the changed files conform to
7004 to your site's standards for coding practice.
7005
7006 As mentioned earlier, each line in the
7007 @file{commitinfo} file consists of a regular expression
7008 and a command-line template.  The template can include
7009 a program name and any number of arguments you wish to
7010 supply to it.  The full path to the current source
7011 repository is appended to the template, followed by the
7012 file names of any files involved in the commit (added,
7013 removed, and modified files).
7014
7015 The first line with a regular expression matching the
7016 relative path to the module will be used.  If the
7017 command returns a non-zero exit status the commit will
7018 be aborted.
7019
7020 @cindex DEFAULT in commitinfo
7021 If the repository name does not match any of the
7022 regular expressions in this file, the @samp{DEFAULT}
7023 line is used, if it is specified.
7024
7025 @cindex ALL in commitinfo
7026 All occurances of the name @samp{ALL} appearing as a
7027 regular expression are used in addition to the first
7028 matching regular expression or the name @samp{DEFAULT}.
7029
7030 Note: when @sc{CVS} is accessing a remote repository,
7031 @file{commitinfo} will be run on the @emph{remote}
7032 (i.e., server) side, not the client side (@pxref{Remote
7033 repositories}).
7034
7035 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7036 @node editinfo
7037 @appendixsec Editinfo
7038 @cindex Editinfo
7039 @cindex Editor, specifying per module
7040 @cindex Per-module editor
7041 @cindex Log messages, editing
7042
7043 If you want to make sure that all log messages look the
7044 same way, you can use the @file{editinfo} file to
7045 specify a program that is used to edit the log message.
7046 This program could be a custom-made editor that always
7047 enforces a certain style of the log message, or maybe a
7048 simple shell script that calls an editor, and checks
7049 that the entered message contains the required fields.
7050
7051 If no matching line is found in the @file{editinfo}
7052 file, the editor specified in the environment variable
7053 @code{$CVSEDITOR} is used instead.  If that variable is
7054 not set, then the environment variable @code{$EDITOR}
7055 is used instead.  If that variable is not
7056 set a precompiled default, normally @code{vi}, will be
7057 used.
7058
7059 The @file{editinfo} file is often most useful together
7060 with the @file{rcsinfo} file, which can be used to
7061 specify a log message template.
7062
7063 Each line in the @file{editinfo} file consists of a
7064 regular expression and a command-line template.  The
7065 template must include a program name, and can include
7066 any number of arguments.  The full path to the current
7067 log message template file is appended to the template.
7068
7069 One thing that should be noted is that the @samp{ALL}
7070 keyword is not supported.  If more than one matching
7071 line is found, the first one is used.  This can be
7072 useful for specifying a default edit script in a
7073 module, and then overriding it in a subdirectory.
7074
7075 @cindex DEFAULT in editinfo
7076 If the repository name does not match any of the
7077 regular expressions in this file, the @samp{DEFAULT}
7078 line is used, if it is specified.
7079
7080 If the edit script exits with a non-zero exit status,
7081 the commit is aborted.
7082
7083 Note: when @sc{CVS} is accessing a remote repository,
7084 @file{editinfo} will be run on the @emph{remote}
7085 (i.e., server) side, not the client side (@pxref{Remote
7086 repositories}).
7087
7088 @menu
7089 * editinfo example::            Editinfo example
7090 @end menu
7091
7092 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7093 @node editinfo example
7094 @appendixsubsec Editinfo example
7095
7096 The following is a little silly example of a
7097 @file{editinfo} file, together with the corresponding
7098 @file{rcsinfo} file, the log message template and an
7099 editor script.  We begin with the log message template.
7100 We want to always record a bug-id number on the first
7101 line of the log message.  The rest of log message is
7102 free text.  The following template is found in the file
7103 @file{/usr/cvssupport/tc.template}.
7104
7105 @example
7106 BugId:    
7107 @end example
7108
7109 The script @file{/usr/cvssupport/bugid.edit} is used to
7110 edit the log message.
7111
7112 @example
7113 #!/bin/sh
7114 #
7115 #       bugid.edit filename
7116 #
7117 #  Call $EDITOR on FILENAME, and verify that the
7118 #  resulting file contains a valid bugid on the first
7119 #  line.
7120 if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
7121 if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
7122 $CVSEDITOR $1
7123 until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
7124 do  echo -n  "No BugId found.  Edit again? ([y]/n)"
7125     read ans
7126     case $@{ans@} in
7127         n*) exit 1;;
7128     esac
7129     $CVSEDITOR $1
7130 done
7131 @end example
7132
7133 The @file{editinfo} file contains this line:
7134
7135 @example
7136 ^tc     /usr/cvssupport/bugid.edit
7137 @end example
7138
7139 The @file{rcsinfo} file contains this line:
7140
7141 @example
7142 ^tc     /usr/cvssupport/tc.template
7143 @end example
7144
7145 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7146 @node loginfo
7147 @appendixsec Loginfo
7148 @cindex Loginfo
7149 @cindex Storing log messages
7150 @cindex Mailing log messages
7151 @cindex Distributing log messages
7152 @cindex Log messages
7153
7154 The @file{loginfo} file is used to control where
7155 @samp{cvs commit} log information is sent.  The first
7156 entry on a line is a regular expression which is tested
7157 against the directory that the change is being made to,
7158 relative to the @code{$CVSROOT}.  If a match is found, then
7159 the remainder of the line is a filter program that
7160 should expect log information on its standard input.
7161
7162 The filter program may use one and only one % modifier
7163 (a la printf).  If @samp{%s} is specified in the filter
7164 program, a brief title is included (enclosed in single
7165 quotes) showing the modified file names.
7166
7167 If the repository name does not match any of the
7168 regular expressions in this file, the @samp{DEFAULT}
7169 line is used, if it is specified.
7170
7171 All occurances of the name @samp{ALL} appearing as a
7172 regular expression are used in addition to the first
7173 matching regular expression or @samp{DEFAULT}.
7174
7175 The first matching regular expression is used.
7176
7177 @xref{commit files}, for a description of the syntax of
7178 the @file{loginfo} file.  
7179
7180 Note: when @sc{CVS} is accessing a remote repository,
7181 @file{loginfo} will be run on the @emph{remote}
7182 (i.e., server) side, not the client side (@pxref{Remote
7183 repositories}).
7184
7185 @menu
7186 * loginfo example::             Loginfo example
7187 @end menu
7188
7189 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7190 @node loginfo example
7191 @appendixsubsec Loginfo example
7192
7193 The following @file{loginfo} file, together with the
7194 tiny shell-script below, appends all log messages 
7195 to the file @file{$CVSROOT/CVSROOT/commitlog},
7196 and any commits to the administrative files (inside
7197 the @file{CVSROOT} directory) are also logged in
7198 @file{/usr/adm/cvsroot-log}.
7199 @c and mailed to @t{ceder}.
7200
7201 @c FIXME: is it a CVS feature or bug that only the
7202 @c first matching line is used?  It is documented
7203 @c above, but is it useful?  This example (with the
7204 @c mail to ceder put back in) is awkward to write if
7205 @c only the first matching line is used.
7206 @example
7207 ALL             /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog
7208 @c ^CVSROOT        Mail -s %s ceder
7209 ^CVSROOT        /usr/local/bin/cvs-log /usr/adm/cvsroot-log
7210 @end example
7211
7212 The shell-script @file{/usr/local/bin/cvs-log} looks
7213 like this:
7214
7215 @example
7216 #!/bin/sh
7217 (echo "-----------------------------------------------------------------";
7218  echo -n $USER"  ";
7219  date;
7220  echo;
7221  sed '1s+'$@{CVSROOT@}'++') >> $1
7222 @end example
7223
7224 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7225 @node rcsinfo
7226 @appendixsec Rcsinfo
7227 @cindex Rcsinfo
7228 @cindex Form for log message
7229 @cindex Log message template
7230 @cindex Template for log message
7231
7232 The @file{rcsinfo} file can be used to specify a form to
7233 edit when filling out the commit log.  The
7234 @file{rcsinfo} file has a syntax similar to the
7235 @file{editinfo}, @file{commitinfo} and @file{loginfo}
7236 files.  @xref{syntax}.  Unlike the other files the second
7237 part is @emph{not} a command-line template.  Instead,
7238 the part after the regular expression should be a full pathname to
7239 a file containing the log message template.
7240
7241 If the repository name does not match any of the
7242 regular expressions in this file, the @samp{DEFAULT}
7243 line is used, if it is specified.
7244
7245 All occurances of the name @samp{ALL} appearing as a
7246 regular expression are used in addition to the first
7247 matching regular expression or @samp{DEFAULT}.
7248
7249 The log message template will be used as a default log
7250 message.  If you specify a log message with @samp{cvs
7251 commit -m @var{message}} or @samp{cvs commit -f
7252 @var{file}} that log message will override the
7253 template.
7254
7255 @xref{editinfo example}, for an example @file{rcsinfo}
7256 file.
7257
7258 When @sc{CVS} is accessing a remote repository,
7259 the contents of @file{rcsinfo} at the time a directory
7260 is first checked out will specify a template which does
7261 not then change.  If you edit @file{rcsinfo} or its
7262 templates, you may need to check out a new working
7263 directory.
7264 @c Would be nice to fix CVS so this isn't needed.  For
7265 @c example, a mechanism analogous to CVS/Entries, where
7266 @c the client keeps track of what version of the template
7267 @c it has.
7268
7269 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7270 @node cvsignore
7271 @appendixsec Ignoring files via cvsignore
7272 @cindex Cvsignore, global
7273 @cindex Global cvsignore
7274 @cindex Ignoring files
7275 @c -- This chapter should maybe be moved to the
7276 @c tutorial part of the manual?
7277
7278 There are certain file names that frequently occur
7279 inside your working copy, but that you don't want to
7280 put under @sc{cvs} control.  Examples are all the object
7281 files that you get while you compile your sources.
7282 Normally, when you run @samp{cvs update}, it prints a
7283 line for each file it encounters that it doesn't know
7284 about (@pxref{update output}).
7285
7286 @sc{cvs} has a list of files (or sh(1) file name patterns)
7287 that it should ignore while running @code{update},
7288 @code{import} and @code{release}.
7289 @c -- Are those the only three commands affected?
7290 This list is constructed in the following way.
7291
7292 @itemize @bullet
7293 @item
7294 The list is initialized to include certain file name
7295 patterns: names associated with @sc{cvs}
7296 administration, or with other common source control
7297 systems; common names for patch files, object files,
7298 archive files, and editor backup files; and other names
7299 that are usually artifacts of assorted utilities.
7300 Currently, the default list of ignored file name
7301 patterns is:
7302
7303 @cindex Ignored files
7304 @cindex Automatically ignored files
7305 @example
7306     RCS     SCCS    CVS     CVS.adm
7307     RCSLOG  cvslog.*
7308     tags    TAGS
7309     .make.state     .nse_depinfo
7310     *~      #*      .#*     ,*      _$*     *$
7311     *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
7312     *.a     *.olb   *.o     *.obj   *.so    *.exe
7313     *.Z     *.elc   *.ln  
7314     core
7315 @end example
7316
7317 @item
7318 The per-repository list in
7319 @file{$CVSROOT/CVSROOT/cvsignore} is appended to
7320 the list, if that file exists.
7321
7322 @item
7323 The per-user list in @file{.cvsignore} in your home
7324 directory is appended to the list, if it exists.
7325
7326 @item
7327 Any entries in the environment variable
7328 @code{$CVSIGNORE} is appended to the list.
7329
7330 @item
7331 Any @samp{-I} options given to @sc{cvs} is appended.
7332
7333 @item
7334 As @sc{cvs} traverses through your directories, the contents
7335 of any @file{.cvsignore} will be appended to the list.
7336 The patterns found in @file{.cvsignore} are only valid
7337 for the directory that contains them, not for
7338 any sub-directories.
7339 @end itemize
7340
7341 In any of the 5 places listed above, a single
7342 exclamation mark (@samp{!}) clears the ignore list.
7343 This can be used if you want to store any file which
7344 normally is ignored by @sc{cvs}.
7345
7346 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7347 @node history file
7348 @appendixsec The history file
7349 @cindex History file
7350 @cindex Log information, saving
7351
7352 The file @file{$CVSROOT/CVSROOT/history} is used
7353 to log information for the @code{history} command
7354 (@pxref{history}).  This file must be created to turn
7355 on logging.  This is done automatically if the
7356 @code{cvs init} command is used to set up the
7357 repository (@pxref{Setting up}).
7358
7359 The file format of the @file{history} file is
7360 documented only in comments in the @sc{cvs} source
7361 code, but generally programs should use the @code{cvs
7362 history} command to access it anyway, in case the
7363 format changes with future releases of @sc{cvs}.
7364
7365 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7366 @node Setting up
7367 @appendixsec Setting up the repository 
7368 @cindex Repository, setting up
7369 @cindex Creating a repository
7370 @cindex Setting up a repository
7371
7372 To set up a @sc{cvs} repository, choose a directory
7373 with ample disk space available for the revision
7374 history of the source files.  It should be accessable
7375 (directly or via a networked file system) from all
7376 machines which want to use @sc{cvs} in server or local
7377 mode; the client machines need not have any access to
7378 it other than via the @sc{cvs} protocol.
7379
7380 To create a repository, run the @code{cvs init}
7381 command.  It will set up an empty repository in the
7382 @sc{cvs} root specified in the usual way
7383 (@pxref{Repository}).  For example,
7384
7385 @example
7386 cvs -d /usr/local/cvsroot init
7387 @end example
7388
7389 @code{cvs init} is careful to never overwrite any
7390 existing files in the repository, so no harm is done if
7391 you run @code{cvs init} on an already set-up
7392 repository.
7393
7394 @code{cvs init} will enable history logging; if you
7395 don't want that, remove the history file after running
7396 @code{cvs init}.  @xref{history file}.
7397
7398 @node Variables
7399 @appendixsec Expansions in administrative files
7400
7401 Sometimes in writing an administrative file, you might
7402 want the file to be able to know various things based
7403 on environment @sc{cvs} is running in.  There are
7404 several mechanisms to do that.
7405
7406 To find the home directory of the user running @sc{cvs}
7407 (from the @code{HOME} environment variable), use
7408 @samp{~} followed by @samp{/} or the end of the line.
7409 Likewise for the home directory of @var{user}, use
7410 @samp{~@var{user}}.  These variables are expanded on
7411 the server machine, and don't get any resonable
7412 expansion if pserver (@pxref{Password authenticated})
7413 is in used; therefore user variables (see below) may be
7414 a better choice to customize behavior based on the user
7415 running @sc{cvs}.
7416 @c Based on these limitations, should we deprecate ~?
7417 @c What is it good for?  Are people using it?
7418
7419 One may want to know about various pieces of
7420 information internal to @sc{cvs}.  A @sc{cvs} internal
7421 variable has the syntax @code{$@{@var{variable}@}},
7422 where @var{variable} starts with a letter and consists
7423 of alphanumberic characters and @samp{_}.  If the
7424 character following @var{variable} is a
7425 non-alphanumeric character other than @samp{_}, the
7426 @samp{@{} and @samp{@}} can be omitted.  The @sc{cvs}
7427 internal variables are:
7428
7429 @table @code
7430 @item CVSROOT
7431 This is the value of the @sc{cvs} root in use.
7432 @xref{Repository}, for a description of the various
7433 ways to specify this.
7434
7435 @item RCSBIN
7436 This is the value @sc{cvs} is using for where to find
7437 @sc{rcs} binaries.  @xref{Global options}, for a
7438 description of how to specify this.
7439
7440 @item CVSEDITOR
7441 @itemx VISUAL
7442 @itemx EDITOR
7443 These all expand to the same value, which is the editor
7444 that @sc{cvs} is using.  @xref{Global options}, for how
7445 to specify this.
7446
7447 @item USER
7448 Username of the user running @sc{cvs} (on the @sc{cvs}
7449 server machine).
7450 @end table
7451
7452 If you want to pass a value to the administrative files
7453 which the user that is running @sc{cvs} can specify,
7454 use a user variable.  To expand a user variable, the
7455 administrative file contains
7456 @code{$@{=@var{variable}@}}.  To set a user variable,
7457 specify the global option @samp{-s} to @sc{cvs}, with
7458 argument @code{@var{variable}=@var{value}}.  It may be
7459 particularly useful to specify this option via
7460 @file{.cvsrc} (@pxref{~/.cvsrc}).
7461
7462 For example, if you want the administrative file to
7463 refer to a test directory you might create a user
7464 variable @code{TESTDIR}.  Then if @sc{cvs} is invoked
7465 as @code{cvs -s TESTDIR=/work/local/tests}, and the
7466 administrative file contains @code{sh
7467 $@{=TESTDIR@}/runtests}, then that string is expanded
7468 to @code{sh /work/local/tests/runtests}.
7469
7470 All other strings containing @samp{$} are reserved;
7471 there is no way to quote a @samp{$} character so that
7472 @samp{$} represents itself.
7473
7474 @c ---------------------------------------------------------------------
7475 @node Environment variables
7476 @appendix All environment variables which affect CVS
7477 @cindex Environment variables
7478 @cindex Reference manual for variables
7479
7480 This is a complete list of all environment variables
7481 that affect @sc{cvs}.
7482
7483 @table @code
7484 @cindex CVSIGNORE
7485 @item $CVSIGNORE
7486 A whitespace-separated list of file name patterns that
7487 @sc{cvs} should ignore. @xref{cvsignore}.
7488
7489 @cindex CVSWRAPPERS
7490 @item $CVSWRAPPERS
7491 A whitespace-separated list of file name patterns that
7492 @sc{cvs} should treat as wrappers. @xref{Wrappers}.
7493
7494 @cindex CVSREAD
7495 @item $CVSREAD
7496 If this is set, @code{checkout} and @code{update} will
7497 try hard to make the files in your working directory
7498 read-only.  When this is not set, the default behavior
7499 is to permit modification of your working files.
7500
7501 @cindex CVSROOT
7502 @item $CVSROOT
7503 Should contain the full pathname to the root of the @sc{cvs}
7504 source repository (where the @sc{rcs} history files are
7505 kept).  This information must be available to @sc{cvs} for
7506 most commands to execute; if @code{$CVSROOT} is not set,
7507 or if you wish to override it for one invocation, you
7508 can supply it on the command line: @samp{cvs -d cvsroot
7509 cvs_command@dots{}} Once you have checked out a working
7510 directory, @sc{cvs} stores the appropriate root (in
7511 the file @file{CVS/Root}), so normally you only need to
7512 worry about this when initially checking out a working 
7513 directory.
7514
7515 @cindex EDITOR
7516 @cindex CVSEDITOR
7517 @item $EDITOR
7518 @itemx $CVSEDITOR
7519 Specifies the program to use for recording log messages
7520 during commit.  If not set, the default is
7521 @samp{/usr/ucb/vi}.  @code{$CVSEDITOR} overrides
7522 @code{$EDITOR}.  @code{$CVSEDITOR} does not exist in
7523 @sc{cvs} 1.3, but the next release will probably
7524 include it.
7525
7526 @cindex PATH
7527 @item $PATH
7528 If @code{$RCSBIN} is not set, and no path is compiled
7529 into @sc{cvs}, it will use @code{$PATH} to try to find all
7530 programs it uses.
7531
7532 @cindex RCSBIN
7533 @item $RCSBIN
7534 Specifies the full pathname of the location of @sc{rcs} programs,
7535 such as co(1) and ci(1).  If not set, a compiled-in
7536 value is used, or your @code{$PATH} is searched.
7537
7538 @cindex HOME
7539 @item $HOME
7540 @cindex HOMEPATH
7541 @item $HOMEPATH
7542 Used to locate the directory where the @file{.cvsrc}
7543 file is searched (@code{$HOMEPATH} is used for Windows-NT).
7544 @pxref{~/.cvsrc}
7545
7546 @cindex CVS_RSH
7547 @item $CVS_RSH
7548 Used in client-server mode when accessing a remote
7549 repository using @sc{rsh}.  The default value is
7550 @code{rsh}.  You can set it to use another program for
7551 accssing the remote server (e.g. for HP-UX 9, you
7552 should set it to @code{remsh} because @code{rsh}
7553 invokes the restricted shell).  @pxref{Connecting via
7554 rsh}
7555
7556 @item $CVS_SERVER
7557 Used in client-server mode when accessing a remote
7558 repository using @sc{rsh}.  It specifies the name of
7559 the program to start on the server side when accessing
7560 a remote repository using @sc{rsh}.  The default value
7561 is @code{cvs}.  @pxref{Connecting via rsh}
7562
7563 @item $CVS_PASSFILE
7564 Used in client-server mode when accessing the @code{cvs
7565 login server}.  Default value is @file{$HOME/.cvspass}.
7566 @pxref{Password authentication client}
7567
7568 @item $CVS_PASSWORD
7569 Used in client-server mode when accessing the @code{cvs
7570 login server}.
7571 @pxref{Password authentication client}
7572
7573 @item $CVS_CLIENT_PORT
7574 Used in client-server mode when accessing the server
7575 via Kerberos.
7576 @pxref{Kerberos authenticated}
7577
7578 @cindex CVS_RCMD_PORT
7579 @item $CVS_RCMD_PORT
7580 Used in client-server mode.  If set, specifies the port
7581 number to be used when accessing the @sc{rcmd} demon on
7582 the server side. (Currently not used for Unix clients).
7583
7584 @cindex CVS_CLIENT_LOG
7585 @item $CVS_CLIENT_LOG
7586 Used for debugging only in client-server
7587 mode.  If set, everything send to the server is logged
7588 into @file{@code{$CVS_CLIENT_LOG}.in} and everything
7589 send from the server is logged into
7590 @file{@code{$CVS_CLIENT_LOG}.out}.
7591
7592 @cindex CVS_SERVER_SLEEP
7593 @item $CVS_SERVER_SLEEP
7594 Used only for debugging the server side in
7595 client-server mode.  If set, delays the start of the
7596 server child process the the specified amount of
7597 seconds so that you can attach to it with a debugger.
7598
7599 @cindex CVS_IGNORE_REMOTE_ROOT
7600 @item $CVS_IGNORE_REMOTE_ROOT
7601 (What is the purpose of this variable?)
7602
7603 @cindex COMSPEC
7604 @item $COMSPEC
7605 Used under OS/2 only.  It specifies the name of the
7606 command interpreter and defaults to @sc{cmd.exe}.
7607
7608
7609 @end table
7610
7611 @sc{cvs} is a front-end to @sc{rcs}.  The following environment
7612 variables affect @sc{rcs}.  Note that if you are using
7613 the client/server @sc{cvs}, these variables need to be
7614 set on the server side (which may or not may be
7615 possible depending on how you are connecting).  There
7616 is probably not any need to set any of them, however.
7617
7618 @table @code
7619 @cindex LOGNAME
7620 @item $LOGNAME
7621 @cindex USER
7622 @itemx $USER
7623 If set, they affect who @sc{rcs} thinks you are.  If you
7624 have trouble checking in files it might be because your
7625 login name differs from the setting of e.g.
7626 @code{$LOGNAME}.
7627
7628 @cindex RCSINIT
7629 @item $RCSINIT
7630 Options prepended to the argument list, separated by
7631 spaces.  A backslash escapes spaces within an option.
7632 The @code{$RCSINIT} options are prepended to the
7633 argument lists of most @sc{rcs} commands.
7634
7635 @cindex TMPDIR
7636 @item $TMPDIR
7637 @cindex TMP
7638 @itemx $TMP
7639 @cindex TEMP
7640 @itemx $TEMP
7641 Name of the temporary directory.  The environment
7642 variables are inspected in the order they appear above
7643 and the first value found is taken; if none of them are
7644 set, a host-dependent default is used, typically
7645 @file{/tmp}.
7646 @end table
7647
7648 @c ---------------------------------------------------------------------
7649 @node Troubleshooting
7650 @appendix Troubleshooting
7651
7652 @menu
7653 * Magic branch numbers::        Magic branch numbers
7654 @end menu
7655
7656 @ignore
7657 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7658 @c @node Bad administrative files
7659 @appendixsec Bad administrative files
7660
7661 @c -- Give hints on how to fix them
7662 @end ignore
7663
7664 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7665 @node Magic branch numbers
7666 @appendixsec Magic branch numbers
7667
7668 Externally, branch numbers consist of an odd number of
7669 dot-separated decimal integers.  @xref{Revision
7670 numbers}.  That is not the whole truth, however.  For
7671 efficiency reasons @sc{cvs} sometimes inserts an extra 0
7672 in the second rightmost position (1.2.3 becomes
7673 1.2.0.3, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
7674 on).
7675
7676 @sc{cvs} does a pretty good job at hiding these so
7677 called magic branches, but in at least four places the
7678 hiding is incomplete.
7679
7680 @itemize @bullet
7681 @item
7682 The magic branch can appear in the output from
7683 @code{cvs status} in vanilla @sc{cvs} 1.3.  This is
7684 fixed in @sc{cvs} 1.3-s2.
7685
7686 @item
7687 The magic branch number appears in the output from
7688 @code{cvs log}.  This is much harder to fix, since
7689 @code{cvs log} runs @code{rlog} (which is part of the
7690 @sc{rcs} distribution), and modifying @code{rlog} to
7691 know about magic branches would probably break someone's
7692 habits (if they use branch 0 for their own purposes).
7693
7694 @item
7695 You cannot specify a symbolic branch name to @code{cvs log}.
7696
7697 @item
7698 You cannot specify a symbolic branch name to @code{cvs
7699 admin}.
7700
7701 @end itemize
7702
7703 You can use the @code{admin} command to reassign a
7704 symbolic name to a branch the way @sc{rcs} expects it
7705 to be.  If @code{R4patches} is assigned to the branch
7706 1.4.2 (magic branch number 1.4.0.2) in file
7707 @file{numbers.c} you can do this:
7708
7709 @example
7710 $ cvs admin -NR4patches:1.4.2 numbers.c
7711 @end example
7712
7713 It only works if at least one revision is already
7714 committed on the branch.  Be very careful so that you
7715 do not assign the tag to the wrong number.  (There is
7716 no way to see how the tag was assigned yesterday).
7717
7718 @c ---------------------------------------------------------------------
7719 @node Copying
7720 @appendix GNU GENERAL PUBLIC LICENSE
7721 @c @include gpl.texinfo
7722
7723 @c ---------------------------------------------------------------------
7724 @node Index
7725 @unnumbered Index
7726 @cindex Index
7727
7728 @printindex cp
7729
7730 @summarycontents
7731
7732 @contents
7733
7734 @bye
7735 \f
7736 Local Variables:
7737 fill-column: 55
7738 End: