1\input texinfo @c -*-texinfo-*- 2@comment Documentation for CVS. 3@comment Copyright (C) 1992, 1993, 1999 Signum Support AB 4@comment Copyright (C) 1993 Free Software Foundation, Inc. 5 6@comment This file is part of the CVS distribution. 7 8@comment CVS is free software; you can redistribute it and/or modify 9@comment it under the terms of the GNU General Public License as published by 10@comment the Free Software Foundation; either version 2, or (at your option) 11@comment any later version. 12 13@comment CVS is distributed in the hope that it will be useful, 14@comment but WITHOUT ANY WARRANTY; without even the implied warranty of 15@comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16@comment GNU General Public License for more details. 17 18@c See ../README for A4 vs. US letter size. 19@c When we provided A4 postscript, and people tried to 20@c print it on US letter, the usual complaint was that the 21@c page numbers would get cut off. 22@c If one prints US letter on A4, reportedly there is 23@c some extra space at the top and/or bottom, and the side 24@c margins are a bit narrow, but no text is lost. 25@c 26@c See 27@c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html 28@c for more on paper sizes. Insuring that margins are 29@c big enough to print on either A4 or US letter does 30@c indeed seem to be the usual approach (RFC2346). 31 32@c This document seems to get overfull hboxes with some 33@c frequency (probably because the tendency is to 34@c sanity-check it with "make info" and run TeX less 35@c often). The big ugly boxes just seem to add insult 36@c to injury, and I'm not aware of them helping to fix 37@c the overfull hboxes at all. 38@finalout 39 40@setfilename cvs.info 41@include CVSvn.texi 42@settitle CVS---Concurrent Versions System v@value{CVSVN} 43@setchapternewpage odd 44 45@c -- TODO list: 46@c -- Fix all lines that match "^@c -- " 47@c -- Also places marked with FIXME should be manual 48@c problems (as opposed to FIXCVS for CVS problems). 49 50@ifinfo 51@format 52START-INFO-DIR-ENTRY 53* CVS: (cvs). Concurrent Versions System 54END-INFO-DIR-ENTRY 55@end format 56@end ifinfo 57 58@ifinfo 59Copyright @copyright{} 1992, 1993 Signum Support AB 60Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc. 61 62Permission is granted to make and distribute verbatim copies of 63this manual provided the copyright notice and this permission notice 64are preserved on all copies. 65 66@ignore 67Permission is granted to process this file through Tex and print the 68results, provided the printed document carries copying permission 69notice identical to this one except for the removal of this paragraph 70(this paragraph not being relevant to the printed manual). 71 72@end ignore 73Permission is granted to copy and distribute modified versions of this 74manual under the conditions for verbatim copying, provided also that the 75entire resulting derived work is distributed under the terms of a 76permission notice identical to this one. 77 78Permission is granted to copy and distribute translations of this manual 79into another language, under the above conditions for modified versions, 80except that this permission notice may be stated in a translation 81approved by the Free Software Foundation. 82@end ifinfo 83 84@comment The titlepage section does not appear in the Info file. 85@titlepage 86@sp 4 87@comment The title is printed in a large font. 88@center @titlefont{Version Management} 89@sp 90@center @titlefont{with} 91@sp 92@center @titlefont{CVS} 93@sp 2 94@center for @sc{cvs} @value{CVSVN} 95@comment -release- 96@sp 3 97@center Per Cederqvist et al 98 99@comment The following two commands start the copyright page 100@comment for the printed manual. This will not appear in the Info file. 101@page 102@vskip 0pt plus 1filll 103Copyright @copyright{} 1992, 1993 Signum Support AB 104 105Permission is granted to make and distribute verbatim copies of 106this manual provided the copyright notice and this permission notice 107are preserved on all copies. 108 109Permission is granted to copy and distribute modified versions of this 110manual under the conditions for verbatim copying, provided also that the 111entire resulting derived work is distributed under the terms of a 112permission notice identical to this one. 113 114Permission is granted to copy and distribute translations of this manual 115into another language, under the above conditions for modified versions, 116except that this permission notice may be stated in a translation 117approved by the Free Software Foundation. 118@end titlepage 119 120@comment ================================================================ 121@comment The real text starts here 122@comment ================================================================ 123 124@ifinfo 125@c --------------------------------------------------------------------- 126@node Top 127@top 128@c Note: there is a space after that @top command. 129@c The texinfo-format-buffer Emacs function and 130@c the makeinfo shell command disagree on what arguments 131@c @top takes; @top followed by a single space is 132@c something they can both cope with. 133 134This info manual describes how to use and administer 135@sc{cvs} version @value{CVSVN}. 136@end ifinfo 137 138@c This menu is pretty long. Not sure how easily that 139@c can be fixed (no brilliant ideas right away)... 140@menu 141* Overview:: An introduction to CVS 142* Repository:: Where all your sources are stored 143* Starting a new project:: Starting a project with CVS 144* Revisions:: Numeric and symbolic names for revisions 145* Branching and merging:: Diverging/rejoining branches of development 146* Recursive behavior:: CVS descends directories 147* Adding and removing:: Adding/removing/renaming files/directories 148* History browsing:: Viewing the history of files in various ways 149 150CVS and the Real World. 151----------------------- 152* Binary files:: CVS can handle binary files 153* Multiple developers:: How CVS helps a group of developers 154* Revision management:: Policy questions for revision management 155* Keyword substitution:: CVS can include the revision inside the file 156* Tracking sources:: Tracking third-party sources 157* Builds:: Issues related to CVS and builds 158* Special Files:: Devices, links and other non-regular files 159 160References. 161----------- 162* CVS commands:: CVS commands share some things 163* Invoking CVS:: Quick reference to CVS commands 164* Administrative files:: Reference manual for the Administrative files 165* Environment variables:: All environment variables which affect CVS 166* Compatibility:: Upgrading CVS versions 167* Troubleshooting:: Some tips when nothing works 168* Credits:: Some of the contributors to this manual 169* BUGS:: Dealing with bugs in CVS or this manual 170* Index:: Index 171@end menu 172 173@c --------------------------------------------------------------------- 174@node Overview 175@chapter Overview 176@cindex Overview 177 178This chapter is for people who have never used 179@sc{cvs}, and perhaps have never used version control 180software before. 181 182If you are already familiar with @sc{cvs} and are just 183trying to learn a particular feature or remember a 184certain command, you can probably skip everything here. 185 186@menu 187* What is CVS?:: What you can do with @sc{cvs} 188* What is CVS not?:: Problems @sc{cvs} doesn't try to solve 189* A sample session:: A tour of basic @sc{cvs} usage 190@end menu 191 192@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 193@node What is CVS? 194@section What is CVS? 195@cindex What is CVS? 196@cindex Introduction to CVS 197@cindex CVS, introduction to 198 199@sc{cvs} is a version control system. Using it, you can 200record the history of your source files. 201 202@c -- /// 203@c -- ///Those who cannot remember the past are condemned to repeat it. 204@c -- /// -- George Santayana 205@c -- ////// 206 207@c -- Insert history quote here! 208For example, bugs sometimes creep in when 209software is modified, and you might not detect the bug 210until a long time after you make the modification. 211With @sc{cvs}, you can easily retrieve old versions to see 212exactly which change caused the bug. This can 213sometimes be a big help. 214 215You could of course save every version of every file 216you have ever created. This would 217however waste an enormous amount of disk space. @sc{cvs} 218stores all the versions of a file in a single file in a 219clever way that only stores the differences between 220versions. 221 222@sc{cvs} also helps you if you are part of a group of people working 223on the same project. It is all too easy to overwrite 224each others' changes unless you are extremely careful. 225Some editors, like @sc{gnu} Emacs, try to make sure that 226the same file is never modified by two people at the 227same time. Unfortunately, if someone is using another 228editor, that safeguard will not work. @sc{cvs} solves this problem 229by insulating the different developers from each other. Every 230developer works in his own directory, and @sc{cvs} merges 231the work when each developer is done. 232 233@cindex History of CVS 234@cindex CVS, history of 235@cindex Credits (CVS program) 236@cindex Contributors (CVS program) 237@sc{cvs} started out as a bunch of shell scripts written by 238Dick Grune, posted to the newsgroup 239@code{comp.sources.unix} in the volume 6 240release of December, 1986. While no actual code from 241these shell scripts is present in the current version 242of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms 243come from them. 244 245In April, 1989, Brian Berliner designed and coded @sc{cvs}. 246Jeff Polk later helped Brian with the design of the @sc{cvs} 247module and vendor branch support. 248 249@cindex Mailing list 250@cindex List, mailing list 251@cindex Newsgroups 252There is a mailing list, known as @w{@code{info-cvs}}, 253devoted to @sc{cvs}. To subscribe or 254unsubscribe 255write to 256@w{@code{info-cvs-request@@gnu.org}}. 257If you prefer a usenet group, the right 258group is @code{comp.software.config-mgmt} which is for 259@sc{cvs} discussions (along with other configuration 260management systems). In the future, it might be 261possible to create a 262@code{comp.software.config-mgmt.cvs}, but probably only 263if there is sufficient @sc{cvs} traffic on 264@code{comp.software.config-mgmt}. 265@c Other random data is that past attempts to create a 266@c gnu.* group have failed (the relevant authorities 267@c say they'll do it, but don't), and that tale was very 268@c skeptical of comp.software.config-mgmt.cvs when the 269@c subject came up around 1995 or so (for one 270@c thing, because creating it would be a "reorg" which 271@c would need to take a more comprehensive look at the 272@c whole comp.software.config-mgmt.* hierarchy). 273 274You can also subscribe to the bug-cvs mailing list, 275described in more detail in @ref{BUGS}. To subscribe 276send mail to bug-cvs-request@@gnu.org. 277 278@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 279@node What is CVS not? 280@section What is CVS not? 281@cindex What is CVS not? 282 283@sc{cvs} can do a lot of things for you, but it does 284not try to be everything for everyone. 285 286@table @asis 287@item @sc{cvs} is not a build system. 288 289Though the structure of your repository and modules 290file interact with your build system 291(e.g. @file{Makefile}s), they are essentially 292independent. 293 294@sc{cvs} does not dictate how you build anything. It 295merely stores files for retrieval in a tree structure 296you devise. 297 298@sc{cvs} does not dictate how to use disk space in the 299checked out working directories. If you write your 300@file{Makefile}s or scripts in every directory so they 301have to know the relative positions of everything else, 302you wind up requiring the entire repository to be 303checked out. 304 305If you modularize your work, and construct a build 306system that will share files (via links, mounts, 307@code{VPATH} in @file{Makefile}s, etc.), you can 308arrange your disk usage however you like. 309 310But you have to remember that @emph{any} such system is 311a lot of work to construct and maintain. @sc{cvs} does 312not address the issues involved. 313 314Of course, you should place the tools created to 315support such a build system (scripts, @file{Makefile}s, 316etc) under @sc{cvs}. 317 318Figuring out what files need to be rebuilt when 319something changes is, again, something to be handled 320outside the scope of @sc{cvs}. One traditional 321approach is to use @code{make} for building, and use 322some automated tool for generating the dependencies which 323@code{make} uses. 324 325See @ref{Builds}, for more information on doing builds 326in conjunction with @sc{cvs}. 327 328@item @sc{cvs} is not a substitute for management. 329 330Your managers and project leaders are expected to talk 331to you frequently enough to make certain you are aware 332of schedules, merge points, branch names and release 333dates. If they don't, @sc{cvs} can't help. 334 335@sc{cvs} is an instrument for making sources dance to 336your tune. But you are the piper and the composer. No 337instrument plays itself or writes its own music. 338 339@item @sc{cvs} is not a substitute for developer communication. 340 341When faced with conflicts within a single file, most 342developers manage to resolve them without too much 343effort. But a more general definition of ``conflict'' 344includes problems too difficult to solve without 345communication between developers. 346 347@sc{cvs} cannot determine when simultaneous changes 348within a single file, or across a whole collection of 349files, will logically conflict with one another. Its 350concept of a @dfn{conflict} is purely textual, arising 351when two changes to the same base file are near enough 352to spook the merge (i.e. @code{diff3}) command. 353 354@sc{cvs} does not claim to help at all in figuring out 355non-textual or distributed conflicts in program logic. 356 357For example: Say you change the arguments to function 358@code{X} defined in file @file{A}. At the same time, 359someone edits file @file{B}, adding new calls to 360function @code{X} using the old arguments. You are 361outside the realm of @sc{cvs}'s competence. 362 363Acquire the habit of reading specs and talking to your 364peers. 365 366 367@item @sc{cvs} does not have change control 368 369Change control refers to a number of things. First of 370all it can mean @dfn{bug-tracking}, that is being able 371to keep a database of reported bugs and the status of 372each one (is it fixed? in what release? has the bug 373submitter agreed that it is fixed?). For interfacing 374@sc{cvs} to an external bug-tracking system, see the 375@file{rcsinfo} and @file{verifymsg} files 376(@pxref{Administrative files}). 377 378Another aspect of change control is keeping track of 379the fact that changes to several files were in fact 380changed together as one logical change. If you check 381in several files in a single @code{cvs commit} 382operation, @sc{cvs} then forgets that those files were 383checked in together, and the fact that they have the 384same log message is the only thing tying them 385together. Keeping a @sc{gnu} style @file{ChangeLog} 386can help somewhat. 387@c FIXME: should have an xref to a section which talks 388@c more about keeping ChangeLog's with CVS, but that 389@c section hasn't been written yet. 390 391Another aspect of change control, in some systems, is 392the ability to keep track of the status of each 393change. Some changes have been written by a developer, 394others have been reviewed by a second developer, and so 395on. Generally, the way to do this with @sc{cvs} is to 396generate a diff (using @code{cvs diff} or @code{diff}) 397and email it to someone who can then apply it using the 398@code{patch} utility. This is very flexible, but 399depends on mechanisms outside @sc{cvs} to make sure 400nothing falls through the cracks. 401 402@item @sc{cvs} is not an automated testing program 403 404It should be possible to enforce mandatory use of a 405testsuite using the @code{commitinfo} file. I haven't 406heard a lot about projects trying to do that or whether 407there are subtle gotchas, however. 408 409@item @sc{cvs} does not have a builtin process model 410 411Some systems provide ways to ensure that changes or 412releases go through various steps, with various 413approvals as needed. Generally, one can accomplish 414this with @sc{cvs} but it might be a little more work. 415In some cases you'll want to use the @file{commitinfo}, 416@file{loginfo}, @file{rcsinfo}, or @file{verifymsg} 417files, to require that certain steps be performed 418before cvs will allow a checkin. Also consider whether 419features such as branches and tags can be used to 420perform tasks such as doing work in a development tree 421and then merging certain changes over to a stable tree 422only once they have been proven. 423@end table 424 425@c --------------------------------------------------------------------- 426@node A sample session 427@section A sample session 428@cindex Example of a work-session 429@cindex Getting started 430@cindex Work-session, example of 431@cindex tc, Trivial Compiler (example) 432@cindex Trivial Compiler (example) 433 434@c I think an example is a pretty good way to start. But 435@c somewhere in here, maybe after the sample session, 436@c we need something which is kind of 437@c a "roadmap" which is more directed at sketching out 438@c the functionality of CVS and pointing people to 439@c various other parts of the manual. As it stands now 440@c people who read in order get dumped right into all 441@c manner of hair regarding remote repositories, 442@c creating a repository, etc. 443@c 444@c The following was in the old Basic concepts node. I don't 445@c know how good a job it does at introducing modules, 446@c or whether they need to be introduced so soon, but 447@c something of this sort might go into some 448@c introductory material somewhere. 449@ignore 450@cindex Modules (intro) 451The repository contains directories and files, in an 452arbitrary tree. The @dfn{modules} feature can be used 453to group together a set of directories or files into a 454single entity (@pxref{modules}). A typical usage is to 455define one module per project. 456@end ignore 457 458As a way of introducing @sc{cvs}, we'll go through a 459typical work-session using @sc{cvs}. The first thing 460to understand is that @sc{cvs} stores all files in a 461centralized @dfn{repository} (@pxref{Repository}); this 462section assumes that a repository is set up. 463@c I'm not sure that the sentence concerning the 464@c repository quite tells the user what they need to 465@c know at this point. Might need to expand on "centralized" 466@c slightly (maybe not here, maybe further down in the example?) 467 468Suppose you are working on a simple compiler. The source 469consists of a handful of C files and a @file{Makefile}. 470The compiler is called @samp{tc} (Trivial Compiler), 471and the repository is set up so that there is a module 472called @samp{tc}. 473 474@menu 475* Getting the source:: Creating a workspace 476* Committing your changes:: Making your work available to others 477* Cleaning up:: Cleaning up 478* Viewing differences:: Viewing differences 479@end menu 480 481@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 482@node Getting the source 483@subsection Getting the source 484@cindex Getting the source 485@cindex Checking out source 486@cindex Fetching source 487@cindex Source, getting from CVS 488@cindex Checkout, example 489 490The first thing you must do is to get your own working copy of the 491source for @samp{tc}. For this, you use the @code{checkout} command: 492 493@example 494$ cvs checkout tc 495@end example 496 497@noindent 498This will create a new directory called @file{tc} and populate it with 499the source files. 500 501@example 502$ cd tc 503$ ls 504CVS Makefile backend.c driver.c frontend.c parser.c 505@end example 506 507The @file{CVS} directory is used internally by 508@sc{cvs}. Normally, you should not modify or remove 509any of the files in it. 510 511You start your favorite editor, hack away at @file{backend.c}, and a couple 512of hours later you have added an optimization pass to the compiler. 513A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that 514you want to edit. @xref{Multiple developers}, for an explanation. 515 516@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 517@node Committing your changes 518@subsection Committing your changes 519@cindex Committing changes 520@cindex Log message entry 521@cindex CVSEDITOR, environment variable 522@cindex EDITOR, environment variable 523 524When you have checked that the compiler is still compilable you decide 525to make a new version of @file{backend.c}. This will 526store your new @file{backend.c} in the repository and 527make it available to anyone else who is using that same 528repository. 529 530@example 531$ cvs commit backend.c 532@end example 533 534@noindent 535@sc{cvs} starts an editor, to allow you to enter a log 536message. You type in ``Added an optimization pass.'', 537save the temporary file, and exit the editor. 538 539The environment variable @code{$CVSEDITOR} determines 540which editor is started. If @code{$CVSEDITOR} is not 541set, then if the environment variable @code{$EDITOR} is 542set, it will be used. If both @code{$CVSEDITOR} and 543@code{$EDITOR} are not set then there is a default 544which will vary with your operating system, for example 545@code{vi} for unix or @code{notepad} for Windows 546NT/95. 547 548@cindex VISUAL, environment variable 549In addition, @sc{cvs} checks the @code{$VISUAL} environment 550variable. Opinions vary on whether this behavior is desirable and 551whether future releases of @sc{cvs} should check @code{$VISUAL} or 552ignore it. You will be OK either way if you make sure that 553@code{$VISUAL} is either unset or set to the same thing as 554@code{$EDITOR}. 555 556@c This probably should go into some new node 557@c containing detailed info on the editor, rather than 558@c the intro. In fact, perhaps some of the stuff with 559@c CVSEDITOR and -m and so on should too. 560When @sc{cvs} starts the editor, it includes a list of 561files which are modified. For the @sc{cvs} client, 562this list is based on comparing the modification time 563of the file against the modification time that the file 564had when it was last gotten or updated. Therefore, if 565a file's modification time has changed but its contents 566have not, it will show up as modified. The simplest 567way to handle this is simply not to worry about it---if 568you proceed with the commit @sc{cvs} will detect that 569the contents are not modified and treat it as an 570unmodified file. The next @code{update} will clue 571@sc{cvs} in to the fact that the file is unmodified, 572and it will reset its stored timestamp so that the file 573will not show up in future editor sessions. 574@c FIXCVS: Might be nice if "commit" and other commands 575@c would reset that timestamp too, but currently commit 576@c doesn't. 577@c FIXME: Need to talk more about the process of 578@c prompting for the log message. Like show an example 579@c of what it pops up in the editor, for example. Also 580@c a discussion of how to get the "a)bort, c)ontinue, 581@c e)dit" prompt and what to do with it. Might also 582@c work in the suggestion that if you want a diff, you 583@c should make it before running commit (someone 584@c suggested that the diff pop up in the editor. I'm 585@c not sure that is better than telling people to run 586@c "cvs diff" first if that is what they want, but if 587@c we want to tell people that, the manual possibly 588@c should say it). 589 590If you want to avoid 591starting an editor you can specify the log message on 592the command line using the @samp{-m} flag instead, like 593this: 594 595@example 596$ cvs commit -m "Added an optimization pass" backend.c 597@end example 598 599@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 600@node Cleaning up 601@subsection Cleaning up 602@cindex Cleaning up 603@cindex Working copy, removing 604@cindex Removing your working copy 605@cindex Releasing your working copy 606 607Before you turn to other tasks you decide to remove your working copy of 608tc. One acceptable way to do that is of course 609 610@example 611$ cd .. 612$ rm -r tc 613@end example 614 615@noindent 616but a better way is to use the @code{release} command (@pxref{release}): 617 618@example 619$ cd .. 620$ cvs release -d tc 621M driver.c 622? tc 623You have [1] altered files in this repository. 624Are you sure you want to release (and delete) directory `tc': n 625** `release' aborted by user choice. 626@end example 627 628The @code{release} command checks that all your modifications have been 629committed. If history logging is enabled it also makes a note in the 630history file. @xref{history file}. 631 632When you use the @samp{-d} flag with @code{release}, it 633also removes your working copy. 634 635In the example above, the @code{release} command wrote a couple of lines 636of output. @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}. 637That is nothing to worry about: @file{tc} is the executable compiler, 638and it should not be stored in the repository. @xref{cvsignore}, 639for information about how to make that warning go away. 640@xref{release output}, for a complete explanation of 641all possible output from @code{release}. 642 643@samp{M driver.c} is more serious. It means that the 644file @file{driver.c} has been modified since it was 645checked out. 646 647The @code{release} command always finishes by telling 648you how many modified files you have in your working 649copy of the sources, and then asks you for confirmation 650before deleting any files or making any note in the 651history file. 652 653You decide to play it safe and answer @kbd{n @key{RET}} 654when @code{release} asks for confirmation. 655 656@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 657@node Viewing differences 658@subsection Viewing differences 659@cindex Viewing differences 660@cindex Diff 661 662You do not remember modifying @file{driver.c}, so you want to see what 663has happened to that file. 664 665@example 666$ cd tc 667$ cvs diff driver.c 668@end example 669 670This command runs @code{diff} to compare the version of @file{driver.c} 671that you checked out with your working copy. When you see the output 672you remember that you added a command line option that enabled the 673optimization pass. You check it in, and release the module. 674@c FIXME: we haven't yet defined the term "check in". 675 676@example 677$ cvs commit -m "Added an optimization pass" driver.c 678Checking in driver.c; 679/usr/local/cvsroot/tc/driver.c,v <-- driver.c 680new revision: 1.2; previous revision: 1.1 681done 682$ cd .. 683$ cvs release -d tc 684? tc 685You have [0] altered files in this repository. 686Are you sure you want to release (and delete) directory `tc': y 687@end example 688 689@c --------------------------------------------------------------------- 690@node Repository 691@chapter The Repository 692@cindex Repository (intro) 693@cindex Repository, example 694@cindex Layout of repository 695@cindex Typical repository 696@cindex /usr/local/cvsroot, as example repository 697@cindex cvsroot 698 699The @sc{cvs} @dfn{repository} stores a complete copy of 700all the files and directories which are under version 701control. 702 703Normally, you never access any of the files in the 704repository directly. Instead, you use @sc{cvs} 705commands to get your own copy of the files into a 706@dfn{working directory}, and then 707work on that copy. When you've finished a set of 708changes, you check (or @dfn{commit}) them back into the 709repository. The repository then contains the changes 710which you have made, as well as recording exactly what 711you changed, when you changed it, and other such 712information. Note that the repository is not a 713subdirectory of the working directory, or vice versa; 714they should be in separate locations. 715@c Need some example, e.g. repository 716@c /usr/local/cvsroot; working directory 717@c /home/joe/sources. But this node is too long 718@c as it is; need a little reorganization... 719 720@cindex :local:, setting up 721@sc{cvs} can access a repository by a variety of 722means. It might be on the local computer, or it might 723be on a computer across the room or across the world. 724To distinguish various ways to access a repository, the 725repository name can start with an @dfn{access method}. 726For example, the access method @code{:local:} means to 727access a repository directory, so the repository 728@code{:local:/usr/local/cvsroot} means that the 729repository is in @file{/usr/local/cvsroot} on the 730computer running @sc{cvs}. For information on other 731access methods, see @ref{Remote repositories}. 732 733@c Can se say this more concisely? Like by passing 734@c more of the buck to the Remote repositories node? 735If the access method is omitted, then if the repository 736does not contain @samp{:}, then @code{:local:} is 737assumed. If it does contain @samp{:} then either 738@code{:ext:} or @code{:server:} is assumed. For 739example, if you have a local repository in 740@file{/usr/local/cvsroot}, you can use 741@code{/usr/local/cvsroot} instead of 742@code{:local:/usr/local/cvsroot}. But if (under 743Windows NT, for example) your local repository is 744@file{c:\src\cvsroot}, then you must specify the access 745method, as in @code{:local:c:\src\cvsroot}. 746 747@c This might appear to go in Repository storage, but 748@c actually it is describing something which is quite 749@c user-visible, when you do a "cvs co CVSROOT". This 750@c isn't necessary the perfect place for that, though. 751The repository is split in two parts. @file{$CVSROOT/CVSROOT} contains 752administrative files for @sc{cvs}. The other directories contain the actual 753user-defined modules. 754 755@menu 756* Specifying a repository:: Telling CVS where your repository is 757* Repository storage:: The structure of the repository 758* Working directory storage:: The structure of working directories 759* Intro administrative files:: Defining modules 760* Multiple repositories:: Multiple repositories 761* Creating a repository:: Creating a repository 762* Backing up:: Backing up a repository 763* Moving a repository:: Moving a repository 764* Remote repositories:: Accessing repositories on remote machines 765* Read-only access:: Granting read-only access to the repository 766* Server temporary directory:: The server creates temporary directories 767@end menu 768 769@node Specifying a repository 770@section Telling CVS where your repository is 771 772There are several ways to tell @sc{cvs} 773where to find the repository. You can name the 774repository on the command line explicitly, with the 775@code{-d} (for "directory") option: 776 777@example 778cvs -d /usr/local/cvsroot checkout yoyodyne/tc 779@end example 780 781@cindex .profile, setting CVSROOT in 782@cindex .cshrc, setting CVSROOT in 783@cindex .tcshrc, setting CVSROOT in 784@cindex .bashrc, setting CVSROOT in 785@cindex CVSROOT, environment variable 786 Or you can set the @code{$CVSROOT} environment 787variable to an absolute path to the root of the 788repository, @file{/usr/local/cvsroot} in this example. 789To set @code{$CVSROOT}, @code{csh} and @code{tcsh} 790users should have this line in their @file{.cshrc} or 791@file{.tcshrc} files: 792 793@example 794setenv CVSROOT /usr/local/cvsroot 795@end example 796 797@noindent 798@code{sh} and @code{bash} users should instead have these lines in their 799@file{.profile} or @file{.bashrc}: 800 801@example 802CVSROOT=/usr/local/cvsroot 803export CVSROOT 804@end example 805 806@cindex Root file, in CVS directory 807@cindex CVS/Root file 808 A repository specified with @code{-d} will 809override the @code{$CVSROOT} environment variable. 810Once you've checked a working copy out from the 811repository, it will remember where its repository is 812(the information is recorded in the 813@file{CVS/Root} file in the working copy). 814 815The @code{-d} option and the @file{CVS/Root} file both 816override the @code{$CVSROOT} environment variable. If 817@code{-d} option differs from @file{CVS/Root}, the 818former is used. Of course, for proper operation they 819should be two ways of referring to the same repository. 820 821@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 822@node Repository storage 823@section How data is stored in the repository 824@cindex Repository, how data is stored 825 826For most purposes it isn't important @emph{how} 827@sc{cvs} stores information in the repository. In 828fact, the format has changed in the past, and is likely 829to change in the future. Since in almost all cases one 830accesses the repository via @sc{cvs} commands, such 831changes need not be disruptive. 832 833However, in some cases it may be necessary to 834understand how @sc{cvs} stores data in the repository, 835for example you might need to track down @sc{cvs} locks 836(@pxref{Concurrency}) or you might need to deal with 837the file permissions appropriate for the repository. 838 839@menu 840* Repository files:: What files are stored in the repository 841* File permissions:: File permissions 842* Windows permissions:: Issues specific to Windows 843* Attic:: Some files are stored in the Attic 844* CVS in repository:: Additional information in CVS directory 845* Locks:: CVS locks control concurrent accesses 846* CVSROOT storage:: A few things about CVSROOT are different 847@end menu 848 849@node Repository files 850@subsection Where files are stored within the repository 851 852@c @cindex Filenames, legal 853@c @cindex Legal filenames 854@c Somewhere we need to say something about legitimate 855@c characters in filenames in working directory and 856@c repository. Not "/" (not even on non-unix). And 857@c here is a specific set of issues: 858@c Files starting with a - are handled inconsistently. They can not 859@c be added to a repository with an add command, because it they are 860@c interpreted as a switch. They can appear in a repository if they are 861@c part of a tree that is imported. They can not be removed from the tree 862@c once they are there. 863@c Note that "--" *is* supported (as a 864@c consequence of using GNU getopt). Should document 865@c this somewhere ("Common options"?). The other usual technique, 866@c "./-foo", isn't as effective, at least for "cvs add" 867@c which doesn't support pathnames containing "/". 868 869The overall structure of the repository is a directory 870tree corresponding to the directories in the working 871directory. For example, supposing the repository is in 872 873@example 874/usr/local/cvsroot 875@end example 876 877@noindent 878here is a possible directory tree (showing only the 879directories): 880 881@example 882@t{/usr} 883 | 884 +--@t{local} 885 | | 886 | +--@t{cvsroot} 887 | | | 888 | | +--@t{CVSROOT} 889 | (administrative files) 890 | 891 +--@t{gnu} 892 | | 893 | +--@t{diff} 894 | | (source code to @sc{gnu} diff) 895 | | 896 | +--@t{rcs} 897 | | (source code to @sc{rcs}) 898 | | 899 | +--@t{cvs} 900 | (source code to @sc{cvs}) 901 | 902 +--@t{yoyodyne} 903 | 904 +--@t{tc} 905 | | 906 | +--@t{man} 907 | | 908 | +--@t{testing} 909 | 910 +--(other Yoyodyne software) 911@end example 912 913With the directories are @dfn{history files} for each file 914under version control. The name of the history file is 915the name of the corresponding file with @samp{,v} 916appended to the end. Here is what the repository for 917the @file{yoyodyne/tc} directory might look like: 918@c FIXME: Should also mention CVS (CVSREP) 919@c FIXME? Should we introduce Attic with an xref to 920@c Attic? Not sure whether that is a good idea or not. 921@example 922 @code{$CVSROOT} 923 | 924 +--@t{yoyodyne} 925 | | 926 | +--@t{tc} 927 | | | 928 +--@t{Makefile,v} 929 +--@t{backend.c,v} 930 +--@t{driver.c,v} 931 +--@t{frontend.c,v} 932 +--@t{parser.c,v} 933 +--@t{man} 934 | | 935 | +--@t{tc.1,v} 936 | 937 +--@t{testing} 938 | 939 +--@t{testpgm.t,v} 940 +--@t{test2.t,v} 941@end example 942 943@cindex History files 944@cindex RCS history files 945@c The first sentence, about what history files 946@c contain, is kind of redundant with our intro to what the 947@c repository does in node Repository.... 948The history files contain, among other things, enough 949information to recreate any revision of the file, a log 950of all commit messages and the user-name of the person 951who committed the revision. The history files are 952known as @dfn{RCS files}, because the first program to 953store files in that format was a version control system 954known as @sc{rcs}. For a full 955description of the file format, see the @code{man} page 956@cite{rcsfile(5)}, distributed with @sc{rcs}, or the 957file @file{doc/RCSFILES} in the @sc{cvs} source 958distribution. This 959file format has become very common---many systems other 960than @sc{cvs} or @sc{rcs} can at least import history 961files in this format. 962@c FIXME: Think about including documentation for this 963@c rather than citing it? In the long run, getting 964@c this to be a standard (not sure if we can cope with 965@c a standards process as formal as IEEE/ANSI/ISO/etc, 966@c though...) is the way to go, so maybe citing is 967@c better. 968 969The @sc{rcs} files used in @sc{cvs} differ in a few 970ways from the standard format. The biggest difference 971is magic branches; for more information see @ref{Magic 972branch numbers}. Also in @sc{cvs} the valid tag names 973are a subset of what @sc{rcs} accepts; for @sc{cvs}'s 974rules see @ref{Tags}. 975 976@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977@node File permissions 978@subsection File permissions 979@c -- Move this to @node Creating a repository or similar 980@cindex Security, file permissions in repository 981@cindex File permissions, general 982@cindex Permissions, general 983@c FIXME: we need to somehow reflect "permissions in 984@c repository" versus "permissions in working 985@c directory" in the index entries. 986@cindex Group 987@cindex Read-only files, in repository 988All @samp{,v} files are created read-only, and you 989should not change the permission of those files. The 990directories inside the repository should be writable by 991the persons that have permission to modify the files in 992each directory. This normally means that you must 993create a UNIX group (see group(5)) consisting of the 994persons that are to edit the files in a project, and 995set up the repository so that it is that group that 996owns the directory. 997@c See also comment in commitinfo node regarding cases 998@c which are really awkward with unix groups. 999 1000This means that you can only control access to files on 1001a per-directory basis. 1002 1003Note that users must also have write access to check 1004out files, because @sc{cvs} needs to create lock files 1005(@pxref{Concurrency}). 1006 1007@c CVS seems to use CVSUMASK in picking permissions for 1008@c val-tags, but maybe we should say more about this. 1009@c Like val-tags gets created by someone who doesn't 1010@c have CVSUMASK set right? 1011Also note that users must have write access to the 1012@file{CVSROOT/val-tags} file. @sc{cvs} uses it to keep 1013track of what tags are valid tag names (it is sometimes 1014updated when tags are used, as well as when they are 1015created). 1016 1017Each @sc{rcs} file will be owned by the user who last 1018checked it in. This has little significance; what 1019really matters is who owns the directories. 1020 1021@cindex CVSUMASK, environment variable 1022@cindex Umask, for repository files 1023@sc{cvs} tries to set up reasonable file permissions 1024for new directories that are added inside the tree, but 1025you must fix the permissions manually when a new 1026directory should have different permissions than its 1027parent directory. If you set the @code{CVSUMASK} 1028environment variable that will control the file 1029permissions which @sc{cvs} uses in creating directories 1030and/or files in the repository. @code{CVSUMASK} does 1031not affect the file permissions in the working 1032directory; such files have the permissions which are 1033typical for newly created files, except that sometimes 1034@sc{cvs} creates them read-only (see the sections on 1035watches, @ref{Setting a watch}; -r, @ref{Global 1036options}; or @code{CVSREAD}, @ref{Environment variables}). 1037@c FIXME: Need more discussion of which 1038@c group should own the file in the repository. 1039@c Include a somewhat detailed example of the usual 1040@c case where CVSUMASK is 007, the developers are all 1041@c in a group, and that group owns stuff in the 1042@c repository. Need to talk about group ownership of 1043@c newly-created directories/files (on some unices, 1044@c such as SunOS4, setting the setgid bit on the 1045@c directories will make files inherit the directory's 1046@c group. On other unices, your mileage may vary. I 1047@c can't remember what POSIX says about this, if 1048@c anything). 1049 1050Note that using the client/server @sc{cvs} 1051(@pxref{Remote repositories}), there is no good way to 1052set @code{CVSUMASK}; the setting on the client machine 1053has no effect. If you are connecting with @code{rsh}, you 1054can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as 1055described in the documentation for your operating 1056system. This behavior might change in future versions 1057of @sc{cvs}; do not rely on the setting of 1058@code{CVSUMASK} on the client having no effect. 1059@c FIXME: need to explain what a umask is or cite 1060@c someplace which does. 1061@c 1062@c There is also a larger (largely separate) issue 1063@c about the meaning of CVSUMASK in a non-unix context. 1064@c For example, whether there is 1065@c an equivalent which fits better into other 1066@c protection schemes like POSIX.6, VMS, &c. 1067@c 1068@c FIXME: Need one place which discusses this 1069@c read-only files thing. Why would one use -r or 1070@c CVSREAD? Why would one use watches? How do they 1071@c interact? 1072@c 1073@c FIXME: We need to state 1074@c whether using CVSUMASK removes the need for manually 1075@c fixing permissions (in fact, if we are going to mention 1076@c manually fixing permission, we better document a lot 1077@c better just what we mean by "fix"). 1078 1079Using pserver, you will generally need stricter 1080permissions on the @sc{cvsroot} directory and 1081directories above it in the tree; see @ref{Password 1082authentication security}. 1083 1084@cindex Setuid 1085@cindex Setgid 1086@cindex Security, setuid 1087@cindex Installed images (VMS) 1088Some operating systems have features which allow a 1089particular program to run with the ability to perform 1090operations which the caller of the program could not. 1091For example, the set user ID (setuid) or set group ID 1092(setgid) features of unix or the installed image 1093feature of VMS. @sc{cvs} was not written to use such 1094features and therefore attempting to install @sc{cvs} in 1095this fashion will provide protection against only 1096accidental lapses; anyone who is trying to circumvent 1097the measure will be able to do so, and depending on how 1098you have set it up may gain access to more than just 1099@sc{cvs}. You may wish to instead consider pserver. It 1100shares some of the same attributes, in terms of 1101possibly providing a false sense of security or opening 1102security holes wider than the ones you are trying to 1103fix, so read the documentation on pserver security 1104carefully if you are considering this option 1105(@ref{Password authentication security}). 1106 1107@node Windows permissions 1108@subsection File Permission issues specific to Windows 1109@cindex Windows, and permissions 1110@cindex File permissions, Windows-specific 1111@cindex Permissions, Windows-specific 1112 1113Some file permission issues are specific to Windows 1114operating systems (Windows 95, Windows NT, and 1115presumably future operating systems in this family. 1116Some of the following might apply to OS/2 but I'm not 1117sure). 1118 1119If you are using local @sc{cvs} and the repository is on a 1120networked file system which is served by the Samba SMB 1121server, some people have reported problems with 1122permissions. Enabling WRITE=YES in the samba 1123configuration is said to fix/workaround it. 1124Disclaimer: I haven't investigated enough to know the 1125implications of enabling that option, nor do I know 1126whether there is something which @sc{cvs} could be doing 1127differently in order to avoid the problem. If you find 1128something out, please let us know as described in 1129@ref{BUGS}. 1130 1131@node Attic 1132@subsection The attic 1133@cindex Attic 1134 1135You will notice that sometimes @sc{cvs} stores an 1136@sc{rcs} file in the @code{Attic}. For example, if the 1137@sc{cvsroot} is @file{/usr/local/cvsroot} and we are 1138talking about the file @file{backend.c} in the 1139directory @file{yoyodyne/tc}, then the file normally 1140would be in 1141 1142@example 1143/usr/local/cvsroot/yoyodyne/tc/backend.c,v 1144@end example 1145 1146but if it goes in the attic, it would be in 1147 1148@example 1149/usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v 1150@end example 1151 1152@cindex Dead state 1153instead. It should not matter from a user point of 1154view whether a file is in the attic; @sc{cvs} keeps 1155track of this and looks in the attic when it needs to. 1156But in case you want to know, the rule is that the RCS 1157file is stored in the attic if and only if the head 1158revision on the trunk has state @code{dead}. A 1159@code{dead} state means that file has been removed, or 1160never added, for that revision. For example, if you 1161add a file on a branch, it will have a trunk revision 1162in @code{dead} state, and a branch revision in a 1163non-@code{dead} state. 1164@c Probably should have some more concrete examples 1165@c here, or somewhere (not sure exactly how we should 1166@c arrange the discussion of the dead state, versus 1167@c discussion of the attic). 1168 1169@node CVS in repository 1170@subsection The CVS directory in the repository 1171@cindex CVS directory, in repository 1172 1173The @file{CVS} directory in each repository directory 1174contains information such as file attributes (in a file 1175called @file{CVS/fileattr}. In the 1176future additional files may be added to this directory, 1177so implementations should silently ignore additional 1178files. 1179 1180This behavior is implemented only by @sc{cvs} 1.7 and 1181later; for details see @ref{Watches Compatibility}. 1182 1183The format of the fileattr file is a series of entries 1184of the following form (where @samp{@{} and @samp{@}} 1185means the text between the braces can be repeated zero 1186or more times): 1187 1188@var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval} 1189 @{; @var{attrname} = @var{attrval}@} <linefeed> 1190 1191@var{ent-type} is @samp{F} for a file, in which case the entry specifies the 1192attributes for that file. 1193 1194@var{ent-type} is @samp{D}, 1195and @var{filename} empty, to specify default attributes 1196to be used for newly added files. 1197 1198Other @var{ent-type} are reserved for future expansion. @sc{cvs} 1.9 and older 1199will delete them any time it writes file attributes. 1200@sc{cvs} 1.10 and later will preserve them. 1201 1202Note that the order of the lines is not significant; 1203a program writing the fileattr file may 1204rearrange them at its convenience. 1205 1206There is currently no way of quoting tabs or linefeeds in the 1207filename, @samp{=} in @var{attrname}, 1208@samp{;} in @var{attrval}, etc. Note: some implementations also 1209don't handle a NUL character in any of the fields, but 1210implementations are encouraged to allow it. 1211 1212By convention, @var{attrname} starting with @samp{_} is for an attribute given 1213special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes 1214(or will be, once implementations start supporting user-defined attributes). 1215 1216Builtin attributes: 1217 1218@table @code 1219@item _watched 1220Present means the file is watched and should be checked out 1221read-only. 1222 1223@item _watchers 1224Users with watches for this file. Value is 1225@var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @} 1226where @var{watcher} is a username, and @var{type} 1227is zero or more of edit,unedit,commit separated by 1228@samp{+} (that is, nothing if none; there is no "none" or "all" keyword). 1229 1230@item _editors 1231Users editing this file. Value is 1232@var{editor} > @var{val} @{ , @var{editor} > @var{val} @} 1233where @var{editor} is a username, and @var{val} is 1234@var{time}+@var{hostname}+@var{pathname}, where 1235@var{time} is when the @code{cvs edit} command (or 1236equivalent) happened, 1237and @var{hostname} and @var{pathname} are for the working directory. 1238@end table 1239 1240Example: 1241 1242@c FIXME: sanity.sh should contain a similar test case 1243@c so we can compare this example from something from 1244@c Real Life(TM). See cvsclient.texi (under Notify) for more 1245@c discussion of the date format of _editors. 1246@example 1247Ffile1 _watched=;_watchers=joe>edit,mary>commit 1248Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs 1249D _watched= 1250@end example 1251 1252means that the file @file{file1} should be checked out 1253read-only. Furthermore, joe is watching for edits and 1254mary is watching for commits. The file @file{file2} 1255should be checked out read-only; sue started editing it 1256on 8 Jan 1975 in the directory @file{/home/sue/cvs} on 1257the machine @code{workstn1}. Future files which are 1258added should be checked out read-only. To represent 1259this example here, we have shown a space after 1260@samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact 1261there must be a single tab character there and no spaces. 1262 1263@node Locks 1264@subsection CVS locks in the repository 1265 1266@cindex #cvs.rfl, technical details 1267@cindex #cvs.wfl, technical details 1268@cindex #cvs.lock, technical details 1269@cindex Locks, cvs, technical details 1270For an introduction to @sc{cvs} locks focusing on 1271user-visible behavior, see @ref{Concurrency}. The 1272following section is aimed at people who are writing 1273tools which want to access a @sc{cvs} repository without 1274interfering with other tools acessing the same 1275repository. If you find yourself confused by concepts 1276described here, like @dfn{read lock}, @dfn{write lock}, 1277and @dfn{deadlock}, you might consult the literature on 1278operating systems or databases. 1279 1280@cindex #cvs.tfl 1281Any file in the repository with a name starting 1282with @file{#cvs.rfl.} is a read lock. Any file in 1283the repository with a name starting with 1284@file{#cvs.wfl} is a write lock. Old versions of @sc{cvs} 1285(before @sc{cvs} 1.5) also created files with names starting 1286with @file{#cvs.tfl}, but they are not discussed here. 1287The directory @file{#cvs.lock} serves as a master 1288lock. That is, one must obtain this lock first before 1289creating any of the other locks. 1290 1291To obtain a readlock, first create the @file{#cvs.lock} 1292directory. This operation must be atomic (which should 1293be true for creating a directory under most operating 1294systems). If it fails because the directory already 1295existed, wait for a while and try again. After 1296obtaining the @file{#cvs.lock} lock, create a file 1297whose name is @file{#cvs.rfl.} followed by information 1298of your choice (for example, hostname and process 1299identification number). Then remove the 1300@file{#cvs.lock} directory to release the master lock. 1301Then proceed with reading the repository. When you are 1302done, remove the @file{#cvs.rfl} file to release the 1303read lock. 1304 1305To obtain a writelock, first create the 1306@file{#cvs.lock} directory, as with a readlock. Then 1307check that there are no files whose names start with 1308@file{#cvs.rfl.}. If there are, remove 1309@file{#cvs.lock}, wait for a while, and try again. If 1310there are no readers, then create a file whose name is 1311@file{#cvs.wfl} followed by information of your choice 1312(for example, hostname and process identification 1313number). Hang on to the @file{#cvs.lock} lock. Proceed 1314with writing the repository. When you are done, first 1315remove the @file{#cvs.wfl} file and then the 1316@file{#cvs.lock} directory. Note that unlike the 1317@file{#cvs.rfl} file, the @file{#cvs.wfl} file is just 1318informational; it has no effect on the locking operation 1319beyond what is provided by holding on to the 1320@file{#cvs.lock} lock itself. 1321 1322Note that each lock (writelock or readlock) only locks 1323a single directory in the repository, including 1324@file{Attic} and @file{CVS} but not including 1325subdirectories which represent other directories under 1326version control. To lock an entire tree, you need to 1327lock each directory (note that if you fail to obtain 1328any lock you need, you must release the whole tree 1329before waiting and trying again, to avoid deadlocks). 1330 1331Note also that @sc{cvs} expects writelocks to control 1332access to individual @file{foo,v} files. @sc{rcs} has 1333a scheme where the @file{,foo,} file serves as a lock, 1334but @sc{cvs} does not implement it and so taking out a 1335@sc{cvs} writelock is recommended. See the comments at 1336rcs_internal_lockfile in the @sc{cvs} source code for 1337further discussion/rationale. 1338 1339@node CVSROOT storage 1340@subsection How files are stored in the CVSROOT directory 1341@cindex CVSROOT, storage of files 1342 1343The @file{$CVSROOT/CVSROOT} directory contains the 1344various administrative files. In some ways this 1345directory is just like any other directory in the 1346repository; it contains @sc{rcs} files whose names end 1347in @samp{,v}, and many of the @sc{cvs} commands operate 1348on it the same way. However, there are a few 1349differences. 1350 1351For each administrative file, in addition to the 1352@sc{rcs} file, there is also a checked out copy of the 1353file. For example, there is an @sc{rcs} file 1354@file{loginfo,v} and a file @file{loginfo} which 1355contains the latest revision contained in 1356@file{loginfo,v}. When you check in an administrative 1357file, @sc{cvs} should print 1358 1359@example 1360cvs commit: Rebuilding administrative file database 1361@end example 1362 1363@noindent 1364and update the checked out copy in 1365@file{$CVSROOT/CVSROOT}. If it does not, there is 1366something wrong (@pxref{BUGS}). To add your own files 1367to the files to be updated in this fashion, you can add 1368them to the @file{checkoutlist} administrative file 1369(@pxref{checkoutlist}). 1370 1371@cindex modules.db 1372@cindex modules.pag 1373@cindex modules.dir 1374By default, the @file{modules} file behaves as 1375described above. If the modules file is very large, 1376storing it as a flat text file may make looking up 1377modules slow (I'm not sure whether this is as much of a 1378concern now as when @sc{cvs} first evolved this 1379feature; I haven't seen benchmarks). Therefore, by 1380making appropriate edits to the @sc{cvs} source code 1381one can store the modules file in a database which 1382implements the @code{ndbm} interface, such as Berkeley 1383db or GDBM. If this option is in use, then the modules 1384database will be stored in the files @file{modules.db}, 1385@file{modules.pag}, and/or @file{modules.dir}. 1386@c I think fileattr also will use the database stuff. 1387@c Anything else? 1388 1389For information on the meaning of the various 1390administrative files, see @ref{Administrative files}. 1391 1392@node Working directory storage 1393@section How data is stored in the working directory 1394 1395@c FIXME: Somewhere we should discuss timestamps (test 1396@c case "stamps" in sanity.sh). But not here. Maybe 1397@c in some kind of "working directory" chapter which 1398@c would encompass the "Builds" one? But I'm not sure 1399@c whether that is a good organization (is it based on 1400@c what the user wants to do?). 1401 1402@cindex CVS directory, in working directory 1403While we are discussing @sc{cvs} internals which may 1404become visible from time to time, we might as well talk 1405about what @sc{cvs} puts in the @file{CVS} directories 1406in the working directories. As with the repository, 1407@sc{cvs} handles this information and one can usually 1408access it via @sc{cvs} commands. But in some cases it 1409may be useful to look at it, and other programs, such 1410as the @code{jCVS} graphical user interface or the 1411@code{VC} package for emacs, may need to look at it. 1412Such programs should follow the recommendations in this 1413section if they hope to be able to work with other 1414programs which use those files, including future 1415versions of the programs just mentioned and the 1416command-line @sc{cvs} client. 1417 1418The @file{CVS} directory contains several files. 1419Programs which are reading this directory should 1420silently ignore files which are in the directory but 1421which are not documented here, to allow for future 1422expansion. 1423 1424The files are stored according to the text file 1425convention for the system in question. This means that 1426working directories are not portable between systems 1427with differing conventions for storing text files. 1428This is intentional, on the theory that the files being 1429managed by @sc{cvs} probably will not be portable between 1430such systems either. 1431 1432@table @file 1433@item Root 1434This file contains the current @sc{cvs} root, as 1435described in @ref{Specifying a repository}. 1436 1437@cindex Repository file, in CVS directory 1438@cindex CVS/Repository file 1439@item Repository 1440This file contains the directory within the repository 1441which the current directory corresponds with. It can 1442be either an absolute pathname or a relative pathname; 1443@sc{cvs} has had the ability to read either format 1444since at least version 1.3 or so. The relative 1445pathname is relative to the root, and is the more 1446sensible approach, but the absolute pathname is quite 1447common and implementations should accept either. For 1448example, after the command 1449 1450@example 1451cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc 1452@end example 1453 1454@file{Root} will contain 1455 1456@example 1457:local:/usr/local/cvsroot 1458@end example 1459 1460and @file{Repository} will contain either 1461 1462@example 1463/usr/local/cvsroot/yoyodyne/tc 1464@end example 1465 1466@noindent 1467or 1468 1469@example 1470yoyodyne/tc 1471@end example 1472 1473If the particular working directory does not correspond 1474to a directory in the repository, then @file{Repository} 1475should contain @file{CVSROOT/Emptydir}. 1476 1477@cindex Entries file, in CVS directory 1478@cindex CVS/Entries file 1479@item Entries 1480This file lists the files and directories in the 1481working directory. 1482The first character of each line indicates what sort of 1483line it is. If the character is unrecognized, programs 1484reading the file should silently skip that line, to 1485allow for future expansion. 1486 1487If the first character is @samp{/}, then the format is: 1488 1489@example 1490/@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate} 1491@end example 1492 1493where @samp{[} and @samp{]} are not part of the entry, 1494but instead indicate that the @samp{+} and conflict 1495marker are optional. @var{name} is the name of the 1496file within the directory. @var{revision} is the 1497revision that the file in the working derives from, or 1498@samp{0} for an added file, or @samp{-} followed by a 1499revision for a removed file. @var{timestamp} is the 1500timestamp of the file at the time that @sc{cvs} created 1501it; if the timestamp differs with the actual 1502modification time of the file it means the file has 1503been modified. It is stored in 1504the format used by the ISO C asctime() function (for 1505example, @samp{Sun Apr 7 01:29:26 1996}). One may 1506write a string which is not in that format, for 1507example, @samp{Result of merge}, to indicate that the 1508file should always be considered to be modified. This 1509is not a special case; to see whether a file is 1510modified a program should take the timestamp of the file 1511and simply do a string compare with @var{timestamp}. 1512If there was a conflict, @var{conflict} can be set to 1513the modification time of the file after the file has been 1514written with conflict markers (@pxref{Conflicts example}). 1515Thus if @var{conflict} is subsequently the same as the actual 1516modification time of the file it means that the user 1517has obviously not resolved the conflict. @var{options} 1518contains sticky options (for example @samp{-kb} for a 1519binary file). @var{tagdate} contains @samp{T} followed 1520by a tag name, or @samp{D} for a date, followed by a 1521sticky tag or date. Note that if @var{timestamp} 1522contains a pair of timestamps separated by a space, 1523rather than a single timestamp, you are dealing with a 1524version of @sc{cvs} earlier than @sc{cvs} 1.5 (not 1525documented here). 1526 1527The timezone on the timestamp in CVS/Entries (local or 1528universal) should be the same as the operating system 1529stores for the timestamp of the file itself. For 1530example, on Unix the file's timestamp is in universal 1531time (UT), so the timestamp in CVS/Entries should be 1532too. On @sc{vms}, the file's timestamp is in local 1533time, so @sc{cvs} on @sc{vms} should use local time. 1534This rule is so that files do not appear to be modified 1535merely because the timezone changed (for example, to or 1536from summer time). 1537@c See comments and calls to gmtime() and friends in 1538@c src/vers_ts.c (function time_stamp). 1539 1540If the first character of a line in @file{Entries} is 1541@samp{D}, then it indicates a subdirectory. @samp{D} 1542on a line all by itself indicates that the program 1543which wrote the @file{Entries} file does record 1544subdirectories (therefore, if there is such a line and 1545no other lines beginning with @samp{D}, one knows there 1546are no subdirectories). Otherwise, the line looks 1547like: 1548 1549@example 1550D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4} 1551@end example 1552 1553where @var{name} is the name of the subdirectory, and 1554all the @var{filler} fields should be silently ignored, 1555for future expansion. Programs which modify 1556@code{Entries} files should preserve these fields. 1557 1558The lines in the @file{Entries} file can be in any order. 1559 1560@cindex Entries.Log file, in CVS directory 1561@cindex CVS/Entries.Log file 1562@item Entries.Log 1563This file does not record any information beyond that 1564in @file{Entries}, but it does provide a way to update 1565the information without having to rewrite the entire 1566@file{Entries} file, including the ability to preserve 1567the information even if the program writing 1568@file{Entries} and @file{Entries.Log} abruptly aborts. 1569Programs which are reading the @file{Entries} file 1570should also check for @file{Entries.Log}. If the latter 1571exists, they should read @file{Entries} and then apply 1572the changes mentioned in @file{Entries.Log}. After 1573applying the changes, the recommended practice is to 1574rewrite @file{Entries} and then delete @file{Entries.Log}. 1575The format of a line in @file{Entries.Log} is a single 1576character command followed by a space followed by a 1577line in the format specified for a line in 1578@file{Entries}. The single character command is 1579@samp{A} to indicate that the entry is being added, 1580@samp{R} to indicate that the entry is being removed, 1581or any other character to indicate that the entire line 1582in @file{Entries.Log} should be silently ignored (for 1583future expansion). If the second character of the line 1584in @file{Entries.Log} is not a space, then it was 1585written by an older version of @sc{cvs} (not documented 1586here). 1587 1588Programs which are writing rather than reading can 1589safely ignore @file{Entries.Log} if they so choose. 1590 1591@cindex Entries.Backup file, in CVS directory 1592@cindex CVS/Entries.Backup file 1593@item Entries.Backup 1594This is a temporary file. Recommended usage is to 1595write a new entries file to @file{Entries.Backup}, and 1596then to rename it (atomically, where possible) to @file{Entries}. 1597 1598@cindex Entries.Static file, in CVS directory 1599@cindex CVS/Entries.Static file 1600@item Entries.Static 1601The only relevant thing about this file is whether it 1602exists or not. If it exists, then it means that only 1603part of a directory was gotten and @sc{cvs} will 1604not create additional files in that directory. To 1605clear it, use the @code{update} command with the 1606@samp{-d} option, which will get the additional files 1607and remove @file{Entries.Static}. 1608@c FIXME: This needs to be better documented, in places 1609@c other than Working Directory Storage. 1610@c FIXCVS: The fact that this setting exists needs to 1611@c be more visible to the user. For example "cvs 1612@c status foo", in the case where the file would be 1613@c gotten except for Entries.Static, might say 1614@c something to distinguish this from other cases. 1615@c One thing that periodically gets suggested is to 1616@c have "cvs update" print something when it skips 1617@c files due to Entries.Static, but IMHO that kind of 1618@c noise pretty much makes the Entries.Static feature 1619@c useless. 1620 1621@cindex Tag file, in CVS directory 1622@cindex CVS/Tag file 1623@cindex Sticky tags/dates, per-directory 1624@cindex Per-directory sticky tags/dates 1625@item Tag 1626This file contains per-directory sticky tags or dates. 1627The first character is @samp{T} for a branch tag, 1628@samp{N} for a non-branch tag, or @samp{D} for a date, 1629or another character to mean the file should be 1630silently ignored, for future expansion. This character 1631is followed by the tag or date. Note that 1632per-directory sticky tags or dates are used for things 1633like applying to files which are newly added; they 1634might not be the same as the sticky tags or dates on 1635individual files. For general information on sticky 1636tags and dates, see @ref{Sticky tags}. 1637@c FIXME: This needs to be much better documented, 1638@c preferably not in the context of "working directory 1639@c storage". 1640@c FIXME: The Sticky tags node needs to discuss, or xref to 1641@c someplace which discusses, per-directory sticky 1642@c tags and the distinction with per-file sticky tags. 1643 1644@cindex Checkin.prog file, in CVS directory 1645@cindex CVS/Checkin.prog file 1646@cindex Update.prog file, in CVS directory 1647@cindex CVS/Update.prog file 1648@item Checkin.prog 1649@itemx Update.prog 1650These files store the programs specified by the 1651@samp{-i} and @samp{-u} options in the modules file, 1652respectively. 1653 1654@cindex Notify file, in CVS directory 1655@cindex CVS/Notify file 1656@item Notify 1657This file stores notifications (for example, for 1658@code{edit} or @code{unedit}) which have not yet been 1659sent to the server. Its format is not yet documented 1660here. 1661 1662@cindex Notify.tmp file, in CVS directory 1663@cindex CVS/Notify.tmp file 1664@item Notify.tmp 1665This file is to @file{Notify} as @file{Entries.Backup} 1666is to @file{Entries}. That is, to write @file{Notify}, 1667first write the new contents to @file{Notify.tmp} and 1668then (atomically where possible), rename it to 1669@file{Notify}. 1670 1671@cindex Base directory, in CVS directory 1672@cindex CVS/Base directory 1673@item Base 1674If watches are in use, then an @code{edit} command 1675stores the original copy of the file in the @file{Base} 1676directory. This allows the @code{unedit} command to 1677operate even if it is unable to communicate with the 1678server. 1679 1680@cindex Baserev file, in CVS directory 1681@cindex CVS/Baserev file 1682@item Baserev 1683The file lists the revision for each of the files in 1684the @file{Base} directory. The format is: 1685 1686@example 1687B@var{name}/@var{rev}/@var{expansion} 1688@end example 1689 1690where @var{expansion} should be ignored, to allow for 1691future expansion. 1692 1693@cindex Baserev.tmp file, in CVS directory 1694@cindex CVS/Baserev.tmp file 1695@item Baserev.tmp 1696This file is to @file{Baserev} as @file{Entries.Backup} 1697is to @file{Entries}. That is, to write @file{Baserev}, 1698first write the new contents to @file{Baserev.tmp} and 1699then (atomically where possible), rename it to 1700@file{Baserev}. 1701 1702@cindex Template file, in CVS directory 1703@cindex CVS/Template file 1704@item Template 1705This file contains the template specified by the 1706@file{rcsinfo} file (@pxref{rcsinfo}). It is only used 1707by the client; the non-client/server @sc{cvs} consults 1708@file{rcsinfo} directly. 1709@end table 1710 1711@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1712@node Intro administrative files 1713@section The administrative files 1714@cindex Administrative files (intro) 1715@cindex Modules file 1716@cindex CVSROOT, module name 1717@cindex Defining modules (intro) 1718 1719@c FIXME: this node should be reorganized into "general 1720@c information about admin files" and put the "editing 1721@c admin files" stuff up front rather than jumping into 1722@c the details of modules right away. Then the 1723@c Administrative files node can go away, the information 1724@c on each admin file distributed to a place appropriate 1725@c to its function, and this node can contain a table 1726@c listing each file and a @ref to its detailed description. 1727 1728The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative 1729files}. @xref{Administrative files}, for a complete description. 1730You can use @sc{cvs} without any of these files, but 1731some commands work better when at least the 1732@file{modules} file is properly set up. 1733 1734The most important of these files is the @file{modules} 1735file. It defines all modules in the repository. This 1736is a sample @file{modules} file. 1737 1738@c FIXME: The CVSROOT line is a goofy example now that 1739@c mkmodules doesn't exist. 1740@example 1741CVSROOT CVSROOT 1742modules CVSROOT modules 1743cvs gnu/cvs 1744rcs gnu/rcs 1745diff gnu/diff 1746tc yoyodyne/tc 1747@end example 1748 1749The @file{modules} file is line oriented. In its 1750simplest form each line contains the name of the 1751module, whitespace, and the directory where the module 1752resides. The directory is a path relative to 1753@code{$CVSROOT}. The last four lines in the example 1754above are examples of such lines. 1755 1756@c FIXME: might want to introduce the concept of options in modules file 1757@c (the old example which was here, -i mkmodules, is obsolete). 1758 1759The line that defines the module called @samp{modules} 1760uses features that are not explained here. 1761@xref{modules}, for a full explanation of all the 1762available features. 1763 1764@c FIXME: subsection without node is bogus 1765@subsection Editing administrative files 1766@cindex Editing administrative files 1767@cindex Administrative files, editing them 1768 1769You edit the administrative files in the same way that you would edit 1770any other module. Use @samp{cvs checkout CVSROOT} to get a working 1771copy, edit it, and commit your changes in the normal way. 1772 1773It is possible to commit an erroneous administrative 1774file. You can often fix the error and check in a new 1775revision, but sometimes a particularly bad error in the 1776administrative file makes it impossible to commit new 1777revisions. 1778@c @xref{Bad administrative files} for a hint 1779@c about how to solve such situations. 1780@c -- administrative file checking-- 1781 1782@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1783@node Multiple repositories 1784@section Multiple repositories 1785@cindex Multiple repositories 1786@cindex Repositories, multiple 1787@cindex Many repositories 1788@cindex Parallel repositories 1789@cindex Disjoint repositories 1790@cindex CVSROOT, multiple repositories 1791 1792In some situations it is a good idea to have more than 1793one repository, for instance if you have two 1794development groups that work on separate projects 1795without sharing any code. All you have to do to have 1796several repositories is to specify the appropriate 1797repository, using the @code{CVSROOT} environment 1798variable, the @samp{-d} option to @sc{cvs}, or (once 1799you have checked out a working directory) by simply 1800allowing @sc{cvs} to use the repository that was used 1801to check out the working directory 1802(@pxref{Specifying a repository}). 1803 1804The big advantage of having multiple repositories is 1805that they can reside on different servers. With @sc{cvs} 1806version 1.10, a single command cannot recurse into 1807directories from different repositories. With development 1808versions of @sc{cvs}, you can check out code from multiple 1809servers into your working directory. @sc{cvs} will 1810recurse and handle all the details of making 1811connections to as many server machines as necessary to 1812perform the requested command. Here is an example of 1813how to set up a working directory: 1814 1815@example 1816cvs -d server1:/cvs co dir1 1817cd dir1 1818cvs -d server2:/root co sdir 1819cvs update 1820@end example 1821 1822The @code{cvs co} commands set up the working 1823directory, and then the @code{cvs update} command will 1824contact server2, to update the dir1/sdir subdirectory, 1825and server1, to update everything else. 1826 1827@c FIXME: Does the FAQ have more about this? I have a 1828@c dim recollection, but I'm too lazy to check right now. 1829 1830@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1831@node Creating a repository 1832@section Creating a repository 1833 1834@cindex Repository, setting up 1835@cindex Creating a repository 1836@cindex Setting up a repository 1837 1838To set up a @sc{cvs} repository, first choose the 1839machine and disk on which you want to store the 1840revision history of the source files. CPU and memory 1841requirements are modest, so most machines should be 1842adequate. For details see @ref{Server requirements}. 1843@c Possible that we should be providing a quick rule of 1844@c thumb, like the 32M memory for the server. That 1845@c might increase the number of people who are happy 1846@c with the answer, without following the xref. 1847 1848To estimate disk space 1849requirements, if you are importing RCS files from 1850another system, the size of those files is the 1851approximate initial size of your repository, or if you 1852are starting without any version history, a rule of 1853thumb is to allow for the server approximately three 1854times the size of the code to be under @sc{cvs} for the 1855repository (you will eventually outgrow this, but not 1856for a while). On the machines on which the developers 1857will be working, you'll want disk space for 1858approximately one working directory for each developer 1859(either the entire tree or a portion of it, depending 1860on what each developer uses). 1861 1862The repository should be accessible 1863(directly or via a networked file system) from all 1864machines which want to use @sc{cvs} in server or local 1865mode; the client machines need not have any access to 1866it other than via the @sc{cvs} protocol. It is not 1867possible to use @sc{cvs} to read from a repository 1868which one only has read access to; @sc{cvs} needs to be 1869able to create lock files (@pxref{Concurrency}). 1870 1871@cindex init (subcommand) 1872To create a repository, run the @code{cvs init} 1873command. It will set up an empty repository in the 1874@sc{cvs} root specified in the usual way 1875(@pxref{Repository}). For example, 1876 1877@example 1878cvs -d /usr/local/cvsroot init 1879@end example 1880 1881@code{cvs init} is careful to never overwrite any 1882existing files in the repository, so no harm is done if 1883you run @code{cvs init} on an already set-up 1884repository. 1885 1886@code{cvs init} will enable history logging; if you 1887don't want that, remove the history file after running 1888@code{cvs init}. @xref{history file}. 1889 1890@node Backing up 1891@section Backing up a repository 1892@cindex Repository, backing up 1893@cindex Backing up, repository 1894 1895There is nothing particularly magical about the files 1896in the repository; for the most part it is possible to 1897back them up just like any other files. However, there 1898are a few issues to consider. 1899 1900@cindex Locks, cvs, and backups 1901@cindex #cvs.rfl, and backups 1902The first is that to be paranoid, one should either not 1903use @sc{cvs} during the backup, or have the backup 1904program lock @sc{cvs} while doing the backup. To not 1905use @sc{cvs}, you might forbid logins to machines which 1906can access the repository, turn off your @sc{cvs} 1907server, or similar mechanisms. The details would 1908depend on your operating system and how you have 1909@sc{cvs} set up. To lock @sc{cvs}, you would create 1910@file{#cvs.rfl} locks in each repository directory. 1911See @ref{Concurrency}, for more on @sc{cvs} locks. 1912Having said all this, if you just back up without any 1913of these precautions, the results are unlikely to be 1914particularly dire. Restoring from backup, the 1915repository might be in an inconsistent state, but this 1916would not be particularly hard to fix manually. 1917 1918When you restore a repository from backup, assuming 1919that changes in the repository were made after the time 1920of the backup, working directories which were not 1921affected by the failure may refer to revisions which no 1922longer exist in the repository. Trying to run @sc{cvs} 1923in such directories will typically produce an error 1924message. One way to get those changes back into the 1925repository is as follows: 1926 1927@itemize @bullet 1928@item 1929Get a new working directory. 1930 1931@item 1932Copy the files from the working directory from before 1933the failure over to the new working directory (do not 1934copy the contents of the @file{CVS} directories, of 1935course). 1936 1937@item 1938Working in the new working directory, use commands such 1939as @code{cvs update} and @code{cvs diff} to figure out 1940what has changed, and then when you are ready, commit 1941the changes into the repository. 1942@end itemize 1943 1944@node Moving a repository 1945@section Moving a repository 1946@cindex Repository, moving 1947@cindex Moving a repository 1948@cindex Copying a repository 1949 1950Just as backing up the files in the repository is 1951pretty much like backing up any other files, if you 1952need to move a repository from one place to another it 1953is also pretty much like just moving any other 1954collection of files. 1955 1956The main thing to consider is that working directories 1957point to the repository. The simplest way to deal with 1958a moved repository is to just get a fresh working 1959directory after the move. Of course, you'll want to 1960make sure that the old working directory had been 1961checked in before the move, or you figured out some 1962other way to make sure that you don't lose any 1963changes. If you really do want to reuse the existing 1964working directory, it should be possible with manual 1965surgery on the @file{CVS/Repository} files. You can 1966see @ref{Working directory storage}, for information on 1967the @file{CVS/Repository} and @file{CVS/Root} files, but 1968unless you are sure you want to bother, it probably 1969isn't worth it. 1970@c FIXME: Surgery on CVS/Repository should be avoided 1971@c by making RELATIVE_REPOS the default. 1972@c FIXME-maybe: might want some documented way to 1973@c change the CVS/Root files in some particular tree. 1974@c But then again, I don't know, maybe just having 1975@c people do this in perl/shell/&c isn't so bad... 1976 1977@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1978@node Remote repositories 1979@section Remote repositories 1980@cindex Repositories, remote 1981@cindex Remote repositories 1982@cindex Client/Server Operation 1983@cindex Server, CVS 1984@cindex Remote repositories, port specification 1985@cindex Repositories, remote, port specification 1986@cindex Client/Server Operation, port specification 1987@cindex pserver (client/server connection method), port specification 1988@cindex kserver (client/server connection method), port specification 1989@cindex gserver (client/server connection method), port specification 1990@cindex port, specifying for remote repositories 1991 1992 Your working copy of the sources can be on a 1993different machine than the repository. Using @sc{cvs} 1994in this manner is known as @dfn{client/server} 1995operation. You run @sc{cvs} on a machine which can 1996mount your working directory, known as the 1997@dfn{client}, and tell it to communicate to a machine 1998which can mount the repository, known as the 1999@dfn{server}. Generally, using a remote 2000repository is just like using a local one, except that 2001the format of the repository name is: 2002 2003@example 2004:@var{method}:[[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository 2005@end example 2006 2007Specifying a password in the repository name is not recommended during 2008checkout, since this will cause @sc{cvs} to store a cleartext copy of the 2009password in each created directory. @code{cvs login} first instead 2010(@pxref{Password authentication client}). 2011 2012The details of exactly what needs to be set up depend 2013on how you are connecting to the server. 2014 2015If @var{method} is not specified, and the repository 2016name contains @samp{:}, then the default is @code{ext} 2017or @code{server}, depending on your platform; both are 2018described in @ref{Connecting via rsh}. 2019@c Should we try to explain which platforms are which? 2020@c Platforms like unix and VMS, which only allow 2021@c privileged programs to bind to sockets <1024 lose on 2022@c :server: 2023@c Platforms like Mac and VMS, whose rsh program is 2024@c unusable or nonexistent, lose on :ext: 2025@c Platforms like OS/2 and NT probably could plausibly 2026@c default either way (modulo -b troubles). 2027 2028@c FIXME: We need to have a better way of explaining 2029@c what method to use. This presentation totally 2030@c obscures the fact that :ext: and CVS_RSH is the way to 2031@c use SSH, for example. Plus it incorrectly implies 2032@c that you need an @code{rsh} binary on the client to use 2033@c :server:. 2034@c Also note that rsh not pserver is the right choice if you want 2035@c users to be able to create their own repositories 2036@c (because of the --allow-root related issues). 2037@menu 2038* Server requirements:: Memory and other resources for servers 2039* Connecting via rsh:: Using the @code{rsh} program to connect 2040* Password authenticated:: Direct connections using passwords 2041* GSSAPI authenticated:: Direct connections using GSSAPI 2042* Kerberos authenticated:: Direct connections with kerberos 2043* Connecting via fork:: Using a forked @code{cvs server} to connect 2044@end menu 2045 2046@node Server requirements 2047@subsection Server requirements 2048 2049The quick answer to what sort of machine is suitable as 2050a server is that requirements are modest---a server 2051with 32M of memory or even less can handle a fairly 2052large source tree with a fair amount of activity. 2053@c Say something about CPU speed too? I'm even less sure 2054@c what to say on that subject... 2055 2056The real answer, of course, is more complicated. 2057Estimating the known areas of large memory consumption 2058should be sufficient to estimate memory requirements. 2059There are two such areas documented here; other memory 2060consumption should be small by comparison (if you find 2061that is not the case, let us know, as described in 2062@ref{BUGS}, so we can update this documentation). 2063 2064The first area of big memory consumption is large 2065checkouts, when using the @sc{cvs} server. The server 2066consists of two processes for each client that it is 2067serving. Memory consumption on the child process 2068should remain fairly small. Memory consumption on the 2069parent process, particularly if the network connection 2070to the client is slow, can be expected to grow to 2071slightly more than the size of the sources in a single 2072directory, or two megabytes, whichever is larger. 2073@c "two megabytes" of course is SERVER_HI_WATER. But 2074@c we don't mention that here because we are 2075@c documenting the default configuration of CVS. If it 2076@c is a "standard" thing to change that value, it 2077@c should be some kind of run-time configuration. 2078@c 2079@c See cvsclient.texi for more on the design decision 2080@c to not have locks in place while waiting for the 2081@c client, which is what results in memory consumption 2082@c as high as this. 2083 2084Multiplying the size of each @sc{cvs} server by the 2085number of servers which you expect to have active at 2086one time should give an idea of memory requirements for 2087the server. For the most part, the memory consumed by 2088the parent process probably can be swap space rather 2089than physical memory. 2090@c Has anyone verified that notion about swap space? 2091@c I say it based pretty much on guessing that the 2092@c ->text of the struct buffer_data only gets accessed 2093@c in a first in, first out fashion, but I haven't 2094@c looked very closely. 2095 2096@c What about disk usage in /tmp on the server? I think that 2097@c it can be substantial, but I haven't looked at this 2098@c again and tried to figure it out ("cvs import" is 2099@c probably the worst case...). 2100 2101The second area of large memory consumption is 2102@code{diff}, when checking in large files. This is 2103required even for binary files. The rule of thumb is 2104to allow about ten times the size of the largest file 2105you will want to check in, although five times may be 2106adequate. For example, if you want to check in a file 2107which is 10 megabytes, you should have 100 megabytes of 2108memory on the machine doing the checkin (the server 2109machine for client/server, or the machine running 2110@sc{cvs} for non-client/server). This can be swap 2111space rather than physical memory. Because the memory 2112is only required briefly, there is no particular need 2113to allow memory for more than one such checkin at a 2114time. 2115@c The 5-10 times rule of thumb is from Paul Eggert for 2116@c GNU diff. I don't think it is in the GNU diff 2117@c manual or anyplace like that. 2118@c 2119@c Probably we could be saying more about 2120@c non-client/server CVS. 2121@c I would guess for non-client/server CVS in an NFS 2122@c environment the biggest issues are the network and 2123@c the NFS server. 2124 2125Resource consumption for the client is even more 2126modest---any machine with enough capacity to run the 2127operating system in question should have little 2128trouble. 2129@c Is that true? I think the client still wants to 2130@c (bogusly) store entire files in memory at times. 2131 2132For information on disk space requirements, see 2133@ref{Creating a repository}. 2134 2135@node Connecting via rsh 2136@subsection Connecting with rsh 2137 2138@cindex rsh 2139@sc{cvs} uses the @file{rsh} protocol to perform these 2140operations, so the remote user host needs to have a 2141@file{.rhosts} file which grants access to the local 2142user. 2143 2144For example, suppose you are the user @file{mozart} on 2145the local machine @file{toe.example.com}, and the 2146server machine is @file{faun.example.org}. On 2147faun, put the following line into the file 2148@file{.rhosts} in @file{bach}'s home directory: 2149 2150@example 2151toe.example.com mozart 2152@end example 2153 2154Then test that @code{rsh} is working with 2155 2156@example 2157rsh -l bach faun.example.org 'echo $PATH' 2158@end example 2159 2160@cindex CVS_SERVER, environment variable 2161Next you have to make sure that @code{rsh} will be able 2162to find the server. Make sure that the path which 2163@code{rsh} printed in the above example includes the 2164directory containing a program named @code{cvs} which 2165is the server. You need to set the path in 2166@file{.bashrc}, @file{.cshrc}, etc., not @file{.login} 2167or @file{.profile}. Alternately, you can set the 2168environment variable @code{CVS_SERVER} on the client 2169machine to the filename of the server you want to use, 2170for example @file{/usr/local/bin/cvs-1.6}. 2171@c FIXME: there should be a way to specify the 2172@c program in CVSROOT, not CVS_SERVER, so that one can use 2173@c different ones for different roots. e.g. ":server;cvs=cvs-1.6:" 2174@c instead of ":server:". 2175 2176There is no need to edit @file{inetd.conf} or start a 2177@sc{cvs} server daemon. 2178 2179@cindex :server:, setting up 2180@cindex :ext:, setting up 2181@cindex Kerberos, using kerberized rsh 2182@cindex SSH (rsh replacement) 2183@cindex rsh replacements (Kerberized, SSH, &c) 2184There are two access methods that you use in @code{CVSROOT} 2185for rsh. @code{:server:} specifies an internal rsh 2186client, which is supported only by some @sc{cvs} ports. 2187@code{:ext:} specifies an external rsh program. By 2188default this is @code{rsh} but you may set the 2189@code{CVS_RSH} environment variable to invoke another 2190program which can access the remote server (for 2191example, @code{remsh} on HP-UX 9 because @code{rsh} is 2192something different). It must be a program which can 2193transmit data to and from the server without modifying 2194it; for example the Windows NT @code{rsh} is not 2195suitable since it by default translates between CRLF 2196and LF. The OS/2 @sc{cvs} port has a hack to pass @samp{-b} 2197to @code{rsh} to get around this, but since this could 2198potentially cause problems for programs other than the 2199standard @code{rsh}, it may change in the future. If 2200you set @code{CVS_RSH} to @code{SSH} or some other rsh 2201replacement, the instructions in the rest of this 2202section concerning @file{.rhosts} and so on are likely 2203to be inapplicable; consult the documentation for your rsh 2204replacement. 2205@c FIXME: there should be a way to specify the 2206@c program in CVSROOT, not CVS_RSH, so that one can use 2207@c different ones for different roots. e.g. ":ext;rsh=remsh:" 2208@c instead of ":ext:". 2209@c See also the comment in src/client.c for rationale 2210@c concerning "rsh" being the default and never 2211@c "remsh". 2212 2213Continuing our example, supposing you want to access 2214the module @file{foo} in the repository 2215@file{/usr/local/cvsroot/}, on machine 2216@file{faun.example.org}, you are ready to go: 2217 2218@example 2219cvs -d :ext:bach@@faun.example.org/usr/local/cvsroot checkout foo 2220@end example 2221 2222(The @file{bach@@} can be omitted if the username is 2223the same on both the local and remote hosts.) 2224 2225@c Should we mention "rsh host echo hi" and "rsh host 2226@c cat" (the latter followed by typing text and ^D) 2227@c as troubleshooting techniques? Probably yes 2228@c (people tend to have trouble setting this up), 2229@c but this kind of thing can be hard to spell out. 2230 2231@node Password authenticated 2232@subsection Direct connection with password authentication 2233 2234The @sc{cvs} client can also connect to the server 2235using a password protocol. This is particularly useful 2236if using @code{rsh} is not feasible (for example, 2237the server is behind a firewall), and Kerberos also is 2238not available. 2239 2240 To use this method, it is necessary to make 2241some adjustments on both the server and client sides. 2242 2243@menu 2244* Password authentication server:: Setting up the server 2245* Password authentication client:: Using the client 2246* Password authentication security:: What this method does and does not do 2247@end menu 2248 2249@node Password authentication server 2250@subsubsection Setting up the server for password authentication 2251 2252First of all, you probably want to tighten the 2253permissions on the @file{$CVSROOT} and 2254@file{$CVSROOT/CVSROOT} directories. See @ref{Password 2255authentication security}, for more details. 2256 2257@cindex pserver (subcommand) 2258@cindex Remote repositories, port specification 2259@cindex Repositories, remote, port specification 2260@cindex Client/Server Operation, port specification 2261@cindex pserver (client/server connection method), port specification 2262@cindex kserver (client/server connection method), port specification 2263@cindex gserver (client/server connection method), port specification 2264@cindex port, specifying for remote repositories 2265@cindex Password server, setting up 2266@cindex Authenticating server, setting up 2267@c FIXME: this isn't quite right regarding port 2268@c numbers; CVS looks up "cvspserver" in 2269@c /etc/services (on unix, but what about non-unix?). 2270On the server side, the file @file{/etc/inetd.conf} 2271needs to be edited so @code{inetd} knows to run the 2272command @code{cvs pserver} when it receives a 2273connection on the right port. By default, the port 2274number is 2401; it would be different if your client 2275were compiled with @code{CVS_AUTH_PORT} defined to 2276something else, though. This can also be sepcified in the CVSROOT variable 2277(@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT 2278environment variable (@pxref{Environment variables}). 2279 2280 If your @code{inetd} allows raw port numbers in 2281@file{/etc/inetd.conf}, then the following (all on a 2282single line in @file{inetd.conf}) should be sufficient: 2283 2284@example 22852401 stream tcp nowait root /usr/local/bin/cvs 2286cvs -f --allow-root=/usr/cvsroot pserver 2287@end example 2288 2289You could also use the 2290@samp{-T} option to specify a temporary directory. 2291 2292The @samp{--allow-root} option specifies the allowable 2293@sc{cvsroot} directory. Clients which attempt to use a 2294different @sc{cvsroot} directory will not be allowed to 2295connect. If there is more than one @sc{cvsroot} 2296directory which you want to allow, repeat the option. 2297(Unfortunately, many versions of @code{inetd} have very small 2298limits on the number of arguments and/or the total length 2299of the command. The usual solution to this problem is 2300to have @code{inetd} run a shell script which then invokes 2301@sc{cvs} with the necessary arguments.) 2302 2303 If your @code{inetd} wants a symbolic service 2304name instead of a raw port number, then put this in 2305@file{/etc/services}: 2306 2307@example 2308cvspserver 2401/tcp 2309@end example 2310 2311 and put @code{cvspserver} instead of 2312@code{2401} in @file{inetd.conf}. 2313 2314 Once the above is taken care of, restart your 2315@code{inetd}, or do whatever is necessary to force it 2316to reread its initialization files. 2317 2318If you are having trouble setting this up, see 2319@ref{Connection}. 2320 2321@cindex CVS passwd file 2322@cindex passwd (admin file) 2323Because the client stores and transmits passwords in 2324cleartext (almost---see @ref{Password authentication 2325security}, for details), a separate @sc{cvs} password 2326file is generally used, so people don't compromise 2327their regular passwords when they access the 2328repository. This file is 2329@file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro 2330administrative files}). It uses a colon-separated 2331format, similar to @file{/etc/passwd} on Unix systems, 2332except that it has fewer fields: @sc{cvs} username, 2333optional password, and an optional system username for 2334@sc{cvs} to run as if authentication succeeds. Here is 2335an example @file{passwd} file with five entries: 2336 2337@example 2338anonymous: 2339bach:ULtgRLXo7NRxs 2340spwang:1sOp854gDF3DY 2341melissa:tGX1fS8sun6rY:pubcvs 2342qproj:XR4EZcEs0szik:pubcvs 2343@end example 2344 2345(The passwords are encrypted according to the standard 2346Unix @code{crypt()} function, so it is possible to 2347paste in passwords directly from regular Unix 2348@file{/etc/passwd} files.) 2349 2350The first line in the example will grant access to any 2351@sc{cvs} client attempting to authenticate as user 2352@code{anonymous}, no matter what password they use, 2353including an empty password. (This is typical for 2354sites granting anonymous read-only access; for 2355information on how to do the "read-only" part, see 2356@ref{Read-only access}.) 2357 2358The second and third lines will grant access to 2359@code{bach} and @code{spwang} if they supply their 2360respective plaintext passwords. 2361 2362@cindex User aliases 2363The fourth line will grant access to @code{melissa}, if 2364she supplies the correct password, but her @sc{cvs} 2365operations will actually run on the server side under 2366the system user @code{pubcvs}. Thus, there need not be 2367any system user named @code{melissa}, but there 2368@emph{must} be one named @code{pubcvs}. 2369 2370The fifth line shows that system user identities can be 2371shared: any client who successfully authenticates as 2372@code{qproj} will actually run as @code{pubcvs}, just 2373as @code{melissa} does. That way you could create a 2374single, shared system user for each project in your 2375repository, and give each developer their own line in 2376the @file{$CVSROOT/CVSROOT/passwd} file. The @sc{cvs} 2377username on each line would be different, but the 2378system username would be the same. The reason to have 2379different @sc{cvs} usernames is that @sc{cvs} will log their 2380actions under those names: when @code{melissa} commits 2381a change to a project, the checkin is recorded in the 2382project's history under the name @code{melissa}, not 2383@code{pubcvs}. And the reason to have them share a 2384system username is so that you can arrange permissions 2385in the relevant area of the repository such that only 2386that account has write-permission there. 2387 2388If the system-user field is present, all 2389password-authenticated @sc{cvs} commands run as that 2390user; if no system user is specified, @sc{cvs} simply 2391takes the @sc{cvs} username as the system username and 2392runs commands as that user. In either case, if there 2393is no such user on the system, then the @sc{cvs} 2394operation will fail (regardless of whether the client 2395supplied a valid password). 2396 2397The password and system-user fields can both be omitted 2398(and if the system-user field is omitted, then also 2399omit the colon that would have separated it from the 2400encrypted password). For example, this would be a 2401valid @file{$CVSROOT/CVSROOT/passwd} file: 2402 2403@example 2404anonymous::pubcvs 2405fish:rKa5jzULzmhOo:kfogel 2406sussman:1sOp854gDF3DY 2407@end example 2408 2409When the password field is omitted or empty, then the 2410client's authentication attempt will succeed with any 2411password, including the empty string. However, the 2412colon after the @sc{cvs} username is always necessary, 2413even if the password is empty. 2414 2415@sc{cvs} can also fall back to use system authentication. 2416When authenticating a password, the server first checks 2417for the user in the @file{$CVSROOT/CVSROOT/passwd} 2418file. If it finds the user, it will use that entry for 2419authentication as described above. But if it does not 2420find the user, or if the @sc{cvs} @file{passwd} file 2421does not exist, then the server can try to authenticate 2422the username and password using the operating system's 2423user-lookup routines (this "fallback" behavior can be 2424disabled by setting @code{SystemAuth=no} in the 2425@sc{cvs} @file{config} file, @pxref{config}). Be 2426aware, however, that falling back to system 2427authentication might be a security risk: @sc{cvs} 2428operations would then be authenticated with that user's 2429regular login password, and the password flies across 2430the network in plaintext. See @ref{Password 2431authentication security} for more on this. 2432 2433Right now, the only way to put a password in the 2434@sc{cvs} @file{passwd} file is to paste it there from 2435somewhere else. Someday, there may be a @code{cvs 2436passwd} command. 2437 2438Unlike many of the files in @file{$CVSROOT/CVSROOT}, it 2439is normal to edit the @file{passwd} file in-place, 2440rather than via @sc{cvs}. This is because of the 2441possible security risks of having the @file{passwd} 2442file checked out to people's working copies. If you do 2443want to include the @file{passwd} file in checkouts of 2444@file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}. 2445 2446@c We might also suggest using the @code{htpasswd} command 2447@c from freely available web servers as well, but that 2448@c would open up a can of worms in that the users next 2449@c questions are likely to be "where do I get it?" and 2450@c "how do I use it?" 2451@c Also note that htpasswd, at least the version I had, 2452@c likes to clobber the third field. 2453 2454@node Password authentication client 2455@subsubsection Using the client with password authentication 2456@cindex Login (subcommand) 2457@cindex Password client, using 2458@cindex Authenticated client, using 2459@cindex :pserver:, setting up 2460To run a @sc{cvs} command on a remote repository via 2461the password-authenticating server, one specifies the 2462@code{pserver} protocol, optional username, repository host, an 2463optional port number, and path to the repository. For example: 2464 2465@example 2466cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj 2467@end example 2468 2469or 2470 2471@example 2472CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot 2473cvs checkout someproj 2474@end example 2475 2476However, unless you're connecting to a public-access 2477repository (i.e., one where that username doesn't 2478require a password), you'll need to supply a password or @dfn{log in} first. 2479Logging in verifies your password with the repository and stores it in a file. 2480It's done with the @code{login} command, which will 2481prompt you interactively for the password if you didn't supply one as part of 2482@var{$CVSROOT}: 2483 2484@example 2485cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login 2486CVS password: 2487@end example 2488 2489or 2490 2491@example 2492cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login 2493@end example 2494 2495After you enter the password, @sc{cvs} verifies it with 2496the server. If the verification succeeds, then that 2497combination of username, host, repository, and password 2498is permanently recorded, so future transactions with 2499that repository won't require you to run @code{cvs 2500login}. (If verification fails, @sc{cvs} will exit 2501complaining that the password was incorrect, and 2502nothing will be recorded.) 2503 2504The records are stored, by default, in the file 2505@file{$HOME/.cvspass}. That file's format is 2506human-readable, and to a degree human-editable, but 2507note that the passwords are not stored in 2508cleartext---they are trivially encoded to protect them 2509from "innocent" compromise (i.e., inadvertent viewing 2510by a system administrator or other non-malicious 2511person). 2512 2513@cindex CVS_PASSFILE, environment variable 2514You can change the default location of this file by 2515setting the @code{CVS_PASSFILE} environment variable. 2516If you use this variable, make sure you set it 2517@emph{before} @code{cvs login} is run. If you were to 2518set it after running @code{cvs login}, then later 2519@sc{cvs} commands would be unable to look up the 2520password for transmission to the server. 2521 2522Once you have logged in, all @sc{cvs} commands using 2523that remote repository and username will authenticate 2524with the stored password. So, for example 2525 2526@example 2527cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo 2528@end example 2529 2530should just work (unless the password changes on the 2531server side, in which case you'll have to re-run 2532@code{cvs login}). 2533 2534Note that if the @samp{:pserver:} were not present in 2535the repository specification, @sc{cvs} would assume it 2536should use @code{rsh} to connect with the server 2537instead (@pxref{Connecting via rsh}). 2538 2539Of course, once you have a working copy checked out and 2540are running @sc{cvs} commands from within it, there is 2541no longer any need to specify the repository 2542explicitly, because @sc{cvs} can deduce the repository 2543from the working copy's @file{CVS} subdirectory. 2544 2545@c FIXME: seems to me this needs somewhat more 2546@c explanation. 2547@cindex Logout (subcommand) 2548The password for a given remote repository can be 2549removed from the @code{CVS_PASSFILE} by using the 2550@code{cvs logout} command. 2551 2552@node Password authentication security 2553@subsubsection Security considerations with password authentication 2554 2555@cindex Security, of pserver 2556The passwords are stored on the client side in a 2557trivial encoding of the cleartext, and transmitted in 2558the same encoding. The encoding is done only to 2559prevent inadvertent password compromises (i.e., a 2560system administrator accidentally looking at the file), 2561and will not prevent even a naive attacker from gaining 2562the password. 2563 2564@c FIXME: The bit about "access to the repository 2565@c implies general access to the system is *not* specific 2566@c to pserver; it applies to kerberos and SSH and 2567@c everything else too. Should reorganize the 2568@c documentation to make this clear. 2569The separate @sc{cvs} password file (@pxref{Password 2570authentication server}) allows people 2571to use a different password for repository access than 2572for login access. On the other hand, once a user has 2573non-read-only 2574access to the repository, she can execute programs on 2575the server system through a variety of means. Thus, repository 2576access implies fairly broad system access as well. It 2577might be possible to modify @sc{cvs} to prevent that, 2578but no one has done so as of this writing. 2579@c OpenBSD uses chroot() and copies the repository to 2580@c provide anonymous read-only access (for details see 2581@c https://www.openbsd.org/anoncvs.shar). While this 2582@c closes the most obvious holes, I'm not sure it 2583@c closes enough holes to recommend it (plus it is 2584@c *very* easy to accidentally screw up a setup of this 2585@c type). 2586 2587Note that because the @file{$CVSROOT/CVSROOT} directory 2588contains @file{passwd} and other files which are used 2589to check security, you must control the permissions on 2590this directory as tightly as the permissions on 2591@file{/etc}. The same applies to the @file{$CVSROOT} 2592directory itself and any directory 2593above it in the tree. Anyone who has write access to 2594such a directory will have the ability to become any 2595user on the system. Note that these permissions are 2596typically tighter than you would use if you are not 2597using pserver. 2598@c TODO: Would be really nice to document/implement a 2599@c scheme where the CVS server can run as some non-root 2600@c user, e.g. "cvs". CVSROOT/passwd would contain a 2601@c bunch of entries of the form foo:xxx:cvs (or the "cvs" 2602@c would be implicit). This would greatly reduce 2603@c security risks such as those hinted at in the 2604@c previous paragraph. I think minor changes to CVS 2605@c might be required but mostly this would just need 2606@c someone who wants to play with it, document it, &c. 2607 2608In summary, anyone who gets the password gets 2609repository access (which may imply some measure of general system 2610access as well). The password is available to anyone 2611who can sniff network packets or read a protected 2612(i.e., user read-only) file. If you want real 2613security, get Kerberos. 2614 2615@node GSSAPI authenticated 2616@subsection Direct connection with GSSAPI 2617 2618@cindex GSSAPI 2619@cindex Security, GSSAPI 2620@cindex :gserver:, setting up 2621@cindex Kerberos, using :gserver: 2622GSSAPI is a generic interface to network security 2623systems such as Kerberos 5. 2624If you have a working GSSAPI library, you can have 2625@sc{cvs} connect via a direct @sc{tcp} connection, 2626authenticating with GSSAPI. 2627 2628To do this, @sc{cvs} needs to be compiled with GSSAPI 2629support; when configuring @sc{cvs} it tries to detect 2630whether GSSAPI libraries using kerberos version 5 are 2631present. You can also use the @file{--with-gssapi} 2632flag to configure. 2633 2634The connection is authenticated using GSSAPI, but the 2635message stream is @emph{not} authenticated by default. 2636You must use the @code{-a} global option to request 2637stream authentication. 2638 2639The data transmitted is @emph{not} encrypted by 2640default. Encryption support must be compiled into both 2641the client and the server; use the 2642@file{--enable-encrypt} configure option to turn it on. 2643You must then use the @code{-x} global option to 2644request encryption. 2645 2646GSSAPI connections are handled on the server side by 2647the same server which handles the password 2648authentication server; see @ref{Password authentication 2649server}. If you are using a GSSAPI mechanism such as 2650Kerberos which provides for strong authentication, you 2651will probably want to disable the ability to 2652authenticate via cleartext passwords. To do so, create 2653an empty @file{CVSROOT/passwd} password file, and set 2654@code{SystemAuth=no} in the config file 2655(@pxref{config}). 2656 2657The GSSAPI server uses a principal name of 2658cvs/@var{hostname}, where @var{hostname} is the 2659canonical name of the server host. You will have to 2660set this up as required by your GSSAPI mechanism. 2661 2662To connect using GSSAPI, use @samp{:gserver:}. For 2663example, 2664 2665@example 2666cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo 2667@end example 2668 2669@node Kerberos authenticated 2670@subsection Direct connection with kerberos 2671 2672@cindex Kerberos, using :kserver: 2673@cindex Security, kerberos 2674@cindex :kserver:, setting up 2675The easiest way to use kerberos is to use the kerberos 2676@code{rsh}, as described in @ref{Connecting via rsh}. 2677The main disadvantage of using rsh is that all the data 2678needs to pass through additional programs, so it may be 2679slower. So if you have kerberos installed you can 2680connect via a direct @sc{tcp} connection, 2681authenticating with kerberos. 2682 2683This section concerns the kerberos network security 2684system, version 4. Kerberos version 5 is supported via 2685the GSSAPI generic network security interface, as 2686described in the previous section. 2687 2688To do this, @sc{cvs} needs to be compiled with kerberos 2689support; when configuring @sc{cvs} it tries to detect 2690whether kerberos is present or you can use the 2691@file{--with-krb4} flag to configure. 2692 2693The data transmitted is @emph{not} encrypted by 2694default. Encryption support must be compiled into both 2695the client and server; use the 2696@file{--enable-encryption} configure option to turn it 2697on. You must then use the @code{-x} global option to 2698request encryption. 2699 2700@cindex CVS_CLIENT_PORT 2701You need to edit @file{inetd.conf} on the server 2702machine to run @code{cvs kserver}. The client uses 2703port 1999 by default; if you want to use another port 2704specify it in the @code{CVSROOT} (@pxref{Remote repositories}) 2705or the @code{CVS_CLIENT_PORT} environment variable on the client. 2706 2707@cindex kinit 2708When you want to use @sc{cvs}, get a ticket in the 2709usual way (generally @code{kinit}); it must be a ticket 2710which allows you to log into the server machine. Then 2711you are ready to go: 2712 2713@example 2714cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo 2715@end example 2716 2717Previous versions of @sc{cvs} would fall back to a 2718connection via rsh; this version will not do so. 2719 2720@node Connecting via fork 2721@subsection Connecting with fork 2722 2723@cindex fork, access method 2724@cindex :fork:, setting up 2725This access method allows you to connect to a 2726repository on your local disk via the remote protocol. 2727In other words it does pretty much the same thing as 2728@code{:local:}, but various quirks, bugs and the like are 2729those of the remote @sc{cvs} rather than the local 2730@sc{cvs}. 2731 2732For day-to-day operations you might prefer either 2733@code{:local:} or @code{:fork:}, depending on your 2734preferences. Of course @code{:fork:} comes in 2735particularly handy in testing or 2736debugging @code{cvs} and the remote protocol. 2737Specifically, we avoid all of the network-related 2738setup/configuration, timeouts, and authentication 2739inherent in the other remote access methods but still 2740create a connection which uses the remote protocol. 2741 2742To connect using the @code{fork} method, use 2743@samp{:fork:} and the pathname to your local 2744repository. For example: 2745 2746@example 2747cvs -d :fork:/usr/local/cvsroot checkout foo 2748@end example 2749 2750@cindex CVS_SERVER, and :fork: 2751As with @code{:ext:}, the server is called @samp{cvs} 2752by default, or the value of the @code{CVS_SERVER} 2753environment variable. 2754 2755@c --------------------------------------------------------------------- 2756@node Read-only access 2757@section Read-only repository access 2758@cindex Read-only repository access 2759@cindex readers (admin file) 2760@cindex writers (admin file) 2761 2762 It is possible to grant read-only repository 2763access to people using the password-authenticated 2764server (@pxref{Password authenticated}). (The 2765other access methods do not have explicit support for 2766read-only users because those methods all assume login 2767access to the repository machine anyway, and therefore 2768the user can do whatever local file permissions allow 2769her to do.) 2770 2771 A user who has read-only access can do only 2772those @sc{cvs} operations which do not modify the 2773repository, except for certain ``administrative'' files 2774(such as lock files and the history file). It may be 2775desirable to use this feature in conjunction with 2776user-aliasing (@pxref{Password authentication server}). 2777 2778Unlike with previous versions of @sc{cvs}, read-only 2779users should be able merely to read the repository, and 2780not to execute programs on the server or otherwise gain 2781unexpected levels of access. Or to be more accurate, 2782the @emph{known} holes have been plugged. Because this 2783feature is new and has not received a comprehensive 2784security audit, you should use whatever level of 2785caution seems warranted given your attitude concerning 2786security. 2787 2788 There are two ways to specify read-only access 2789for a user: by inclusion, and by exclusion. 2790 2791 "Inclusion" means listing that user 2792specifically in the @file{$CVSROOT/CVSROOT/readers} 2793file, which is simply a newline-separated list of 2794users. Here is a sample @file{readers} file: 2795 2796@example 2797melissa 2798splotnik 2799jrandom 2800@end example 2801 2802 (Don't forget the newline after the last user.) 2803 2804 "Exclusion" means explicitly listing everyone 2805who has @emph{write} access---if the file 2806 2807@example 2808$CVSROOT/CVSROOT/writers 2809@end example 2810 2811@noindent 2812exists, then only 2813those users listed in it have write access, and 2814everyone else has read-only access (of course, even the 2815read-only users still need to be listed in the 2816@sc{cvs} @file{passwd} file). The 2817@file{writers} file has the same format as the 2818@file{readers} file. 2819 2820 Note: if your @sc{cvs} @file{passwd} 2821file maps cvs users onto system users (@pxref{Password 2822authentication server}), make sure you deny or grant 2823read-only access using the @emph{cvs} usernames, not 2824the system usernames. That is, the @file{readers} and 2825@file{writers} files contain cvs usernames, which may 2826or may not be the same as system usernames. 2827 2828 Here is a complete description of the server's 2829behavior in deciding whether to grant read-only or 2830read-write access: 2831 2832 If @file{readers} exists, and this user is 2833listed in it, then she gets read-only access. Or if 2834@file{writers} exists, and this user is NOT listed in 2835it, then she also gets read-only access (this is true 2836even if @file{readers} exists but she is not listed 2837there). Otherwise, she gets full read-write access. 2838 2839 Of course there is a conflict if the user is 2840listed in both files. This is resolved in the more 2841conservative way, it being better to protect the 2842repository too much than too little: such a user gets 2843read-only access. 2844 2845@node Server temporary directory 2846@section Temporary directories for the server 2847@cindex Temporary directories, and server 2848@cindex Server, temporary directories 2849 2850While running, the @sc{cvs} server creates temporary 2851directories. They are named 2852 2853@example 2854cvs-serv@var{pid} 2855@end example 2856 2857@noindent 2858where @var{pid} is the process identification number of 2859the server. They are located in the directory 2860specified by the @code{TMPDIR} environment variable 2861(@pxref{Environment variables}), the @samp{-T} global 2862option (@pxref{Global options}), or failing that 2863@file{/tmp}. 2864 2865In most cases the server will remove the temporary 2866directory when it is done, whether it finishes normally 2867or abnormally. However, there are a few cases in which 2868the server does not or cannot remove the temporary 2869directory, for example: 2870 2871@itemize @bullet 2872@item 2873If the server aborts due to an internal server error, 2874it may preserve the directory to aid in debugging 2875 2876@item 2877If the server is killed in a way that it has no way of 2878cleaning up (most notably, @samp{kill -KILL} on unix). 2879 2880@item 2881If the system shuts down without an orderly shutdown, 2882which tells the server to clean up. 2883@end itemize 2884 2885In cases such as this, you will need to manually remove 2886the @file{cvs-serv@var{pid}} directories. As long as 2887there is no server running with process identification 2888number @var{pid}, it is safe to do so. 2889 2890@c --------------------------------------------------------------------- 2891@node Starting a new project 2892@chapter Starting a project with CVS 2893@cindex Starting a project with CVS 2894@cindex Creating a project 2895 2896@comment --moduledb-- 2897Because renaming files and moving them between 2898directories is somewhat inconvenient, the first thing 2899you do when you start a new project should be to think 2900through your file organization. It is not impossible 2901to rename or move files, but it does increase the 2902potential for confusion and @sc{cvs} does have some 2903quirks particularly in the area of renaming 2904directories. @xref{Moving files}. 2905 2906What to do next depends on the situation at hand. 2907 2908@menu 2909* Setting up the files:: Getting the files into the repository 2910* Defining the module:: How to make a module of the files 2911@end menu 2912@c -- File permissions! 2913 2914@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2915@node Setting up the files 2916@section Setting up the files 2917 2918The first step is to create the files inside the repository. This can 2919be done in a couple of different ways. 2920 2921@c -- The contributed scripts 2922@menu 2923* From files:: This method is useful with old projects 2924 where files already exists. 2925* From other version control systems:: Old projects where you want to 2926 preserve history from another system. 2927* From scratch:: Creating a directory tree from scratch. 2928@end menu 2929 2930@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2931@node From files 2932@subsection Creating a directory tree from a number of files 2933@cindex Importing files 2934 2935When you begin using @sc{cvs}, you will probably already have several 2936projects that can be 2937put under @sc{cvs} control. In these cases the easiest way is to use the 2938@code{import} command. An example is probably the easiest way to 2939explain how to use it. If the files you want to install in 2940@sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the 2941repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this: 2942 2943@example 2944$ cd @var{wdir} 2945$ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start 2946@end example 2947 2948Unless you supply a log message with the @samp{-m} 2949flag, @sc{cvs} starts an editor and prompts for a 2950message. The string @samp{yoyo} is a @dfn{vendor tag}, 2951and @samp{start} is a @dfn{release tag}. They may fill 2952no purpose in this context, but since @sc{cvs} requires 2953them they must be present. @xref{Tracking sources}, for 2954more information about them. 2955 2956You can now verify that it worked, and remove your 2957original source directory. 2958@c FIXME: Need to say more about "verify that it 2959@c worked". What should the user look for in the output 2960@c from "diff -r"? 2961 2962@example 2963$ cd .. 2964$ cvs checkout yoyodyne/@var{rdir} # @r{Explanation below} 2965$ diff -r @var{wdir} yoyodyne/@var{rdir} 2966$ rm -r @var{wdir} 2967@end example 2968 2969@noindent 2970Erasing the original sources is a good idea, to make sure that you do 2971not accidentally edit them in @var{wdir}, bypassing @sc{cvs}. 2972Of course, it would be wise to make sure that you have 2973a backup of the sources before you remove them. 2974 2975The @code{checkout} command can either take a module 2976name as argument (as it has done in all previous 2977examples) or a path name relative to @code{$CVSROOT}, 2978as it did in the example above. 2979 2980It is a good idea to check that the permissions 2981@sc{cvs} sets on the directories inside @code{$CVSROOT} 2982are reasonable, and that they belong to the proper 2983groups. @xref{File permissions}. 2984 2985If some of the files you want to import are binary, you 2986may want to use the wrappers features to specify which 2987files are binary and which are not. @xref{Wrappers}. 2988 2989@c The node name is too long, but I am having trouble 2990@c thinking of something more concise. 2991@node From other version control systems 2992@subsection Creating Files From Other Version Control Systems 2993@cindex Importing files, from other version control systems 2994 2995If you have a project which you are maintaining with 2996another version control system, such as @sc{rcs}, you 2997may wish to put the files from that project into 2998@sc{cvs}, and preserve the revision history of the 2999files. 3000 3001@table @asis 3002@cindex RCS, importing files from 3003@item From RCS 3004If you have been using @sc{rcs}, find the @sc{rcs} 3005files---usually a file named @file{foo.c} will have its 3006@sc{rcs} file in @file{RCS/foo.c,v} (but it could be 3007other places; consult the @sc{rcs} documentation for 3008details). Then create the appropriate directories in 3009@sc{cvs} if they do not already exist. Then copy the 3010files into the appropriate directories in the @sc{cvs} 3011repository (the name in the repository must be the name 3012of the source file with @samp{,v} added; the files go 3013directly in the appropriate directory of the repository, 3014not in an @file{RCS} subdirectory). This is one of the 3015few times when it is a good idea to access the @sc{cvs} 3016repository directly, rather than using @sc{cvs} 3017commands. Then you are ready to check out a new 3018working directory. 3019@c Someday there probably should be a "cvs import -t 3020@c rcs" or some such. It could even create magic 3021@c branches. It could also do something about the case 3022@c where the RCS file had a (non-magic) "0" branch. 3023 3024The @sc{rcs} file should not be locked when you move it 3025into @sc{cvs}; if it is, @sc{cvs} will have trouble 3026letting you operate on it. 3027@c What is the easiest way to unlock your files if you 3028@c have them locked? Especially if you have a lot of them? 3029@c This is a CVS bug/misfeature; importing RCS files 3030@c should ignore whether they are locked and leave them in 3031@c an unlocked state. Yet another reason for a separate 3032@c "import RCS file" command. 3033 3034@c How many is "many"? Or do they just import RCS files? 3035@item From another version control system 3036Many version control systems have the ability to export 3037@sc{rcs} files in the standard format. If yours does, 3038export the @sc{rcs} files and then follow the above 3039instructions. 3040 3041Failing that, probably your best bet is to write a 3042script that will check out the files one revision at a 3043time using the command line interface to the other 3044system, and then check the revisions into @sc{cvs}. 3045The @file{sccs2rcs} script mentioned below may be a 3046useful example to follow. 3047 3048@cindex SCCS, importing files from 3049@item From SCCS 3050There is a script in the @file{contrib} directory of 3051the @sc{cvs} source distribution called @file{sccs2rcs} 3052which converts @sc{sccs} files to @sc{rcs} files. 3053Note: you must run it on a machine which has both 3054@sc{sccs} and @sc{rcs} installed, and like everything 3055else in contrib it is unsupported (your mileage may 3056vary). 3057 3058@cindex PVCS, importing files from 3059@item From PVCS 3060There is a script in the @file{contrib} directory of 3061the @sc{cvs} source distribution called @file{pvcs_to_rcs} 3062which converts @sc{pvcs} archives to @sc{rcs} files. 3063You must run it on a machine which has both 3064@sc{pvcs} and @sc{rcs} installed, and like everything 3065else in contrib it is unsupported (your mileage may 3066vary). See the comments in the script for details. 3067@end table 3068@c CMZ and/or PATCHY were systems that were used in the 3069@c high energy physics community (especially for 3070@c CERNLIB). CERN has replaced them with CVS, but the 3071@c CAR format seems to live on as a way to submit 3072@c changes. There is a program car2cvs which converts 3073@c but I'm not sure where one gets a copy. 3074@c Not sure it is worth mentioning here, since it would 3075@c appear to affect only one particular community. 3076@c Best page for more information is: 3077@c http://wwwcn1.cern.ch/asd/cvs/index.html 3078@c See also: 3079@c http://ecponion.cern.ch/ecpsa/cernlib.html 3080 3081@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3082@node From scratch 3083@subsection Creating a directory tree from scratch 3084 3085@c Also/instead should be documenting 3086@c $ cvs co -l . 3087@c $ mkdir tc 3088@c $ cvs add tc 3089@c $ cd tc 3090@c $ mkdir man 3091@c $ cvs add man 3092@c etc. 3093@c Using import to create the directories only is 3094@c probably a somewhat confusing concept. 3095For a new project, the easiest thing to do is probably 3096to create an empty directory structure, like this: 3097 3098@example 3099$ mkdir tc 3100$ mkdir tc/man 3101$ mkdir tc/testing 3102@end example 3103 3104After that, you use the @code{import} command to create 3105the corresponding (empty) directory structure inside 3106the repository: 3107 3108@example 3109$ cd tc 3110$ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start 3111@end example 3112 3113Then, use @code{add} to add files (and new directories) 3114as they appear. 3115 3116Check that the permissions @sc{cvs} sets on the 3117directories inside @code{$CVSROOT} are reasonable. 3118 3119@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3120@node Defining the module 3121@section Defining the module 3122@cindex Defining a module 3123@cindex Editing the modules file 3124@cindex Module, defining 3125@cindex Modules file, changing 3126 3127The next step is to define the module in the 3128@file{modules} file. This is not strictly necessary, 3129but modules can be convenient in grouping together 3130related files and directories. 3131 3132In simple cases these steps are sufficient to define a module. 3133 3134@enumerate 3135@item 3136Get a working copy of the modules file. 3137 3138@example 3139$ cvs checkout CVSROOT/modules 3140$ cd CVSROOT 3141@end example 3142 3143@item 3144Edit the file and insert a line that defines the module. @xref{Intro 3145administrative files}, for an introduction. @xref{modules}, for a full 3146description of the modules file. You can use the 3147following line to define the module @samp{tc}: 3148 3149@example 3150tc yoyodyne/tc 3151@end example 3152 3153@item 3154Commit your changes to the modules file. 3155 3156@example 3157$ cvs commit -m "Added the tc module." modules 3158@end example 3159 3160@item 3161Release the modules module. 3162 3163@example 3164$ cd .. 3165$ cvs release -d CVSROOT 3166@end example 3167@end enumerate 3168 3169@c --------------------------------------------------------------------- 3170@node Revisions 3171@chapter Revisions 3172 3173For many uses of @sc{cvs}, one doesn't need to worry 3174too much about revision numbers; @sc{cvs} assigns 3175numbers such as @code{1.1}, @code{1.2}, and so on, and 3176that is all one needs to know. However, some people 3177prefer to have more knowledge and control concerning 3178how @sc{cvs} assigns revision numbers. 3179 3180If one wants to keep track of a set of revisions 3181involving more than one file, such as which revisions 3182went into a particular release, one uses a @dfn{tag}, 3183which is a symbolic revision which can be assigned to a 3184numeric revision in each file. 3185 3186@menu 3187* Revision numbers:: The meaning of a revision number 3188* Versions revisions releases:: Terminology used in this manual 3189* Assigning revisions:: Assigning revisions 3190* Tags:: Tags--Symbolic revisions 3191* Tagging the working directory:: The cvs tag command 3192* Tagging by date/tag:: The cvs rtag command 3193* Modifying tags:: Adding, renaming, and deleting tags 3194* Tagging add/remove:: Tags with adding and removing files 3195* Sticky tags:: Certain tags are persistent 3196@end menu 3197 3198@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3199@node Revision numbers 3200@section Revision numbers 3201@cindex Revision numbers 3202@cindex Revision tree 3203@cindex Linear development 3204@cindex Number, revision- 3205@cindex Decimal revision number 3206@cindex Branch number 3207@cindex Number, branch 3208 3209Each version of a file has a unique @dfn{revision 3210number}. Revision numbers look like @samp{1.1}, 3211@samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}. 3212A revision number always has an even number of 3213period-separated decimal integers. By default revision 32141.1 is the first revision of a file. Each successive 3215revision is given a new number by increasing the 3216rightmost number by one. The following figure displays 3217a few revisions, with newer revisions to the right. 3218 3219@example 3220 +-----+ +-----+ +-----+ +-----+ +-----+ 3221 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 3222 +-----+ +-----+ +-----+ +-----+ +-----+ 3223@end example 3224 3225It is also possible to end up with numbers containing 3226more than one period, for example @samp{1.3.2.2}. Such 3227revisions represent revisions on branches 3228(@pxref{Branching and merging}); such revision numbers 3229are explained in detail in @ref{Branches and 3230revisions}. 3231 3232@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3233@node Versions revisions releases 3234@section Versions, revisions and releases 3235@cindex Revisions, versions and releases 3236@cindex Versions, revisions and releases 3237@cindex Releases, revisions and versions 3238 3239A file can have several versions, as described above. 3240Likewise, a software product can have several versions. 3241A software product is often given a version number such 3242as @samp{4.1.1}. 3243 3244Versions in the first sense are called @dfn{revisions} 3245in this document, and versions in the second sense are 3246called @dfn{releases}. To avoid confusion, the word 3247@dfn{version} is almost never used in this document. 3248 3249@node Assigning revisions 3250@section Assigning revisions 3251 3252@c We avoid the "major revision" terminology. It seems 3253@c like jargon. Hopefully "first number" is clear enough. 3254By default, @sc{cvs} will assign numeric revisions by 3255leaving the first number the same and incrementing the 3256second number. For example, @code{1.1}, @code{1.2}, 3257@code{1.3}, etc. 3258 3259When adding a new file, the second number will always 3260be one and the first number will equal the highest 3261first number of any file in that directory. For 3262example, the current directory contains files whose 3263highest numbered revisions are @code{1.7}, @code{3.1}, 3264and @code{4.12}, then an added file will be given the 3265numeric revision @code{4.1}. 3266 3267@c This is sort of redundant with something we said a 3268@c while ago. Somewhere we need a better way of 3269@c introducing how the first number can be anything 3270@c except "1", perhaps. Also I don't think this 3271@c presentation is clear on why we are discussing releases 3272@c and first numbers of numeric revisions in the same 3273@c breath. 3274Normally there is no reason to care 3275about the revision numbers---it is easier to treat them 3276as internal numbers that @sc{cvs} maintains, and tags 3277provide a better way to distinguish between things like 3278release 1 versus release 2 of your product 3279(@pxref{Tags}). However, if you want to set the 3280numeric revisions, the @samp{-r} option to @code{cvs 3281commit} can do that. The @samp{-r} option implies the 3282@samp{-f} option, in the sense that it causes the 3283files to be committed even if they are not modified. 3284 3285For example, to bring all your files up to 3286revision 3.0 (including those that haven't changed), 3287you might invoke: 3288 3289@example 3290$ cvs commit -r 3.0 3291@end example 3292 3293Note that the number you specify with @samp{-r} must be 3294larger than any existing revision number. That is, if 3295revision 3.0 exists, you cannot @samp{cvs commit 3296-r 1.3}. If you want to maintain several releases in 3297parallel, you need to use a branch (@pxref{Branching and merging}). 3298 3299@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3300@node Tags 3301@section Tags--Symbolic revisions 3302@cindex Tags 3303 3304The revision numbers live a life of their own. They 3305need not have anything at all to do with the release 3306numbers of your software product. Depending 3307on how you use @sc{cvs} the revision numbers might change several times 3308between two releases. As an example, some of the 3309source files that make up @sc{rcs} 5.6 have the following 3310revision numbers: 3311@cindex RCS revision numbers 3312 3313@example 3314ci.c 5.21 3315co.c 5.9 3316ident.c 5.3 3317rcs.c 5.12 3318rcsbase.h 5.11 3319rcsdiff.c 5.10 3320rcsedit.c 5.11 3321rcsfcmp.c 5.9 3322rcsgen.c 5.10 3323rcslex.c 5.11 3324rcsmap.c 5.2 3325rcsutil.c 5.10 3326@end example 3327 3328@cindex tag, command, introduction 3329@cindex Tag, symbolic name 3330@cindex Symbolic name (tag) 3331@cindex Name, symbolic (tag) 3332@cindex HEAD, as reserved tag name 3333@cindex BASE, as reserved tag name 3334You can use the @code{tag} command to give a symbolic name to a 3335certain revision of a file. You can use the @samp{-v} flag to the 3336@code{status} command to see all tags that a file has, and 3337which revision numbers they represent. Tag names must 3338start with an uppercase or lowercase letter and can 3339contain uppercase and lowercase letters, digits, 3340@samp{-}, and @samp{_}. The two tag names @code{BASE} 3341and @code{HEAD} are reserved for use by @sc{cvs}. It 3342is expected that future names which are special to 3343@sc{cvs} will be specially named, for example by 3344starting with @samp{.}, rather than being named analogously to 3345@code{BASE} and @code{HEAD}, to avoid conflicts with 3346actual tag names. 3347@c Including a character such as % or = has also been 3348@c suggested as the naming convention for future 3349@c special tag names. Starting with . is nice because 3350@c that is not a legal tag name as far as RCS is concerned. 3351@c FIXME: CVS actually accepts quite a few characters 3352@c in tag names, not just the ones documented above 3353@c (see RCS_check_tag). RCS 3354@c defines legitimate tag names by listing illegal 3355@c characters rather than legal ones. CVS is said to lose its 3356@c mind if you try to use "/" (try making such a tag sticky 3357@c and using "cvs status" client/server--see remote 3358@c protocol format for entries line for probable cause). 3359@c TODO: The testsuite 3360@c should test for whatever are documented above as 3361@c officially-OK tag names, and CVS should at least reject 3362@c characters that won't work, like "/". 3363 3364You'll want to choose some convention for naming tags, 3365based on information such as the name of the program 3366and the version number of the release. For example, 3367one might take the name of the program, immediately 3368followed by the version number with @samp{.} changed to 3369@samp{-}, so that @sc{cvs} 1.9 would be tagged with the name 3370@code{cvs1-9}. If you choose a consistent convention, 3371then you won't constantly be guessing whether a tag is 3372@code{cvs-1-9} or @code{cvs1_9} or what. You might 3373even want to consider enforcing your convention in the 3374taginfo file (@pxref{user-defined logging}). 3375@c Might be nice to say more about using taginfo this 3376@c way, like giving an example, or pointing out any particular 3377@c issues which arise. 3378 3379@cindex Adding a tag 3380@cindex Tag, example 3381The following example shows how you can add a tag to a 3382file. The commands must be issued inside your working 3383directory. That is, you should issue the 3384command in the directory where @file{backend.c} 3385resides. 3386 3387@example 3388$ cvs tag rel-0-4 backend.c 3389T backend.c 3390$ cvs status -v backend.c 3391=================================================================== 3392File: backend.c Status: Up-to-date 3393 3394 Version: 1.4 Tue Dec 1 14:39:01 1992 3395 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 3396 Sticky Tag: (none) 3397 Sticky Date: (none) 3398 Sticky Options: (none) 3399 3400 Existing Tags: 3401 rel-0-4 (revision: 1.4) 3402 3403@end example 3404 3405For a complete summary of the syntax of @code{cvs tag}, 3406including the various options, see @ref{Invoking CVS}. 3407 3408There is seldom reason to tag a file in isolation. A more common use is 3409to tag all the files that constitute a module with the same tag at 3410strategic points in the development life-cycle, such as when a release 3411is made. 3412 3413@example 3414$ cvs tag rel-1-0 . 3415cvs tag: Tagging . 3416T Makefile 3417T backend.c 3418T driver.c 3419T frontend.c 3420T parser.c 3421@end example 3422 3423(When you give @sc{cvs} a directory as argument, it generally applies the 3424operation to all the files in that directory, and (recursively), to any 3425subdirectories that it may contain. @xref{Recursive behavior}.) 3426 3427@cindex Retrieving an old revision using tags 3428@cindex Tag, retrieving old revisions 3429The @code{checkout} command has a flag, @samp{-r}, that lets you check out 3430a certain revision of a module. This flag makes it easy to 3431retrieve the sources that make up release 1.0 of the module @samp{tc} at 3432any time in the future: 3433 3434@example 3435$ cvs checkout -r rel-1-0 tc 3436@end example 3437 3438@noindent 3439This is useful, for instance, if someone claims that there is a bug in 3440that release, but you cannot find the bug in the current working copy. 3441 3442You can also check out a module as it was at any given date. 3443@xref{checkout options}. When specifying @samp{-r} to 3444any of these commands, you will need beware of sticky 3445tags; see @ref{Sticky tags}. 3446 3447When you tag more than one file with the same tag you 3448can think about the tag as "a curve drawn through a 3449matrix of filename vs. revision number." Say we have 5 3450files with the following revisions: 3451 3452@example 3453@group 3454 file1 file2 file3 file4 file5 3455 3456 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG 3457 1.2*- 1.2 1.2 -1.2*- 3458 1.3 \- 1.3*- 1.3 / 1.3 3459 1.4 \ 1.4 / 1.4 3460 \-1.5*- 1.5 3461 1.6 3462@end group 3463@end example 3464 3465At some time in the past, the @code{*} versions were tagged. 3466You can think of the tag as a handle attached to the curve 3467drawn through the tagged revisions. When you pull on 3468the handle, you get all the tagged revisions. Another 3469way to look at it is that you "sight" through a set of 3470revisions that is "flat" along the tagged revisions, 3471like this: 3472 3473@example 3474@group 3475 file1 file2 file3 file4 file5 3476 3477 1.1 3478 1.2 3479 1.1 1.3 _ 3480 1.1 1.2 1.4 1.1 / 3481 1.2*----1.3*----1.5*----1.2*----1.1 (--- <--- Look here 3482 1.3 1.6 1.3 \_ 3483 1.4 1.4 3484 1.5 3485@end group 3486@end example 3487 3488@node Tagging the working directory 3489@section Specifying what to tag from the working directory 3490 3491@cindex tag (subcommand) 3492The example in the previous section demonstrates one of 3493the most common ways to choose which revisions to tag. 3494Namely, running the @code{cvs tag} command without 3495arguments causes @sc{cvs} to select the revisions which 3496are checked out in the current working directory. For 3497example, if the copy of @file{backend.c} in working 3498directory was checked out from revision 1.4, then 3499@sc{cvs} will tag revision 1.4. Note that the tag is 3500applied immediately to revision 1.4 in the repository; 3501tagging is not like modifying a file, or other 3502operations in which one first modifies the working 3503directory and then runs @code{cvs commit} to transfer 3504that modification to the repository. 3505 3506One potentially surprising aspect of the fact that 3507@code{cvs tag} operates on the repository is that you 3508are tagging the checked-in revisions, which may differ 3509from locally modified files in your working directory. 3510If you want to avoid doing this by mistake, specify the 3511@samp{-c} option to @code{cvs tag}. If there are any 3512locally modified files, @sc{cvs} will abort with an 3513error before it tags any files: 3514 3515@example 3516$ cvs tag -c rel-0-4 3517cvs tag: backend.c is locally modified 3518cvs [tag aborted]: correct the above errors first! 3519@end example 3520 3521@node Tagging by date/tag 3522@section Specifying what to tag by date or revision 3523@cindex rtag (subcommand) 3524 3525The @code{cvs rtag} command tags the repository as of a 3526certain date or time (or can be used to tag the latest 3527revision). @code{rtag} works directly on the 3528repository contents (it requires no prior checkout and 3529does not look for a working directory). 3530 3531The following options specify which date or revision to 3532tag. See @ref{Common options}, for a complete 3533description of them. 3534 3535@table @code 3536@item -D @var{date} 3537Tag the most recent revision no later than @var{date}. 3538 3539@item -f 3540Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}} 3541flags. If no matching revision is found, use the most 3542recent revision (instead of ignoring the file). 3543 3544@item -r @var{tag} 3545Only tag those files that contain existing tag @var{tag}. 3546@end table 3547 3548The @code{cvs tag} command also allows one to specify 3549files by revision or date, using the same @samp{-r}, 3550@samp{-D}, and @samp{-f} options. However, this 3551feature is probably not what you want. The reason is 3552that @code{cvs tag} chooses which files to tag based on 3553the files that exist in the working directory, rather 3554than the files which existed as of the given tag/date. 3555Therefore, you are generally better off using @code{cvs 3556rtag}. The exceptions might be cases like: 3557 3558@example 3559cvs tag -r 1.4 backend.c 3560@end example 3561 3562@node Modifying tags 3563@section Deleting, moving, and renaming tags 3564 3565@c Also see: 3566@c "How do I move or rename a magic branch tag?" 3567@c in the FAQ (I think the issues it talks about still 3568@c apply, but this could use some sanity.sh work). 3569 3570Normally one does not modify tags. They exist in order 3571to record the history of the repository and so deleting 3572them or changing their meaning would, generally, not be 3573what you want. 3574 3575However, there might be cases in which one uses a tag 3576temporarily or accidentally puts one in the wrong 3577place. Therefore, one might delete, move, or rename a 3578tag. Warning: the commands in this section are 3579dangerous; they permanently discard historical 3580information and it can difficult or impossible to 3581recover from errors. If you are a @sc{cvs} 3582administrator, you may consider restricting these 3583commands with taginfo (@pxref{user-defined logging}). 3584 3585@cindex Deleting tags 3586@cindex Removing tags 3587@cindex Tags, deleting 3588To delete a tag, specify the @samp{-d} option to either 3589@code{cvs tag} or @code{cvs rtag}. For example: 3590 3591@example 3592cvs rtag -d rel-0-4 tc 3593@end example 3594 3595deletes the tag @code{rel-0-4} from the module @code{tc}. 3596 3597@cindex Moving tags 3598@cindex Tags, moving 3599When we say @dfn{move} a tag, we mean to make the same 3600name point to different revisions. For example, the 3601@code{stable} tag may currently point to revision 1.4 3602of @file{backend.c} and perhaps we want to make it 3603point to revision 1.6. To move a tag, specify the 3604@samp{-F} option to either @code{cvs tag} or @code{cvs 3605rtag}. For example, the task just mentioned might be 3606accomplished as: 3607 3608@example 3609cvs tag -r 1.6 -F stable backend.c 3610@end example 3611 3612@cindex Renaming tags 3613@cindex Tags, renaming 3614When we say @dfn{rename} a tag, we mean to make a 3615different name point to the same revisions as the old 3616tag. For example, one may have misspelled the tag name 3617and want to correct it (hopefully before others are 3618relying on the old spelling). To rename a tag, first 3619create a new tag using the @samp{-r} option to 3620@code{cvs rtag}, and then delete the old name. This 3621leaves the new tag on exactly the same files as the old 3622tag. For example: 3623 3624@example 3625cvs rtag -r old-name-0-4 rel-0-4 tc 3626cvs rtag -d old-name-0-4 tc 3627@end example 3628 3629@node Tagging add/remove 3630@section Tagging and adding and removing files 3631 3632The subject of exactly how tagging interacts with 3633adding and removing files is somewhat obscure; for the 3634most part @sc{cvs} will keep track of whether files 3635exist or not without too much fussing. By default, 3636tags are applied to only files which have a revision 3637corresponding to what is being tagged. Files which did 3638not exist yet, or which were already removed, simply 3639omit the tag, and @sc{cvs} knows to treat the absence 3640of a tag as meaning that the file didn't exist as of 3641that tag. 3642 3643However, this can lose a small amount of information. 3644For example, suppose a file was added and then removed. 3645Then, if the tag is missing for that file, there is no 3646way to know whether the tag refers to the time before 3647the file was added, or the time after it was removed. 3648If you specify the @samp{-r} option to @code{cvs rtag}, 3649then @sc{cvs} tags the files which have been removed, 3650and thereby avoids this problem. For example, one 3651might specify @code{-r HEAD} to tag the head. 3652 3653On the subject of adding and removing files, the 3654@code{cvs rtag} command has a @samp{-a} option which 3655means to clear the tag from removed files that would 3656not otherwise be tagged. For example, one might 3657specify this option in conjunction with @samp{-F} when 3658moving a tag. If one moved a tag without @samp{-a}, 3659then the tag in the removed files might still refer to 3660the old revision, rather than reflecting the fact that 3661the file had been removed. I don't think this is 3662necessary if @samp{-r} is specified, as noted above. 3663 3664@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3665@node Sticky tags 3666@section Sticky tags 3667@cindex Sticky tags 3668@cindex Tags, sticky 3669 3670@c A somewhat related issue is per-directory sticky 3671@c tags (see comment at CVS/Tag in node Working 3672@c directory storage); we probably want to say 3673@c something like "you can set a sticky tag for only 3674@c some files, but you don't want to" or some such. 3675 3676Sometimes a working copy's revision has extra data 3677associated with it, for example it might be on a branch 3678(@pxref{Branching and merging}), or restricted to 3679versions prior to a certain date by @samp{checkout -D} 3680or @samp{update -D}. Because this data persists -- 3681that is, it applies to subsequent commands in the 3682working copy -- we refer to it as @dfn{sticky}. 3683 3684Most of the time, stickiness is an obscure aspect of 3685@sc{cvs} that you don't need to think about. However, 3686even if you don't want to use the feature, you may need 3687to know @emph{something} about sticky tags (for 3688example, how to avoid them!). 3689 3690You can use the @code{status} command to see if any 3691sticky tags or dates are set: 3692 3693@example 3694$ cvs status driver.c 3695=================================================================== 3696File: driver.c Status: Up-to-date 3697 3698 Version: 1.7.2.1 Sat Dec 5 19:35:03 1992 3699 RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v 3700 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 3701 Sticky Date: (none) 3702 Sticky Options: (none) 3703 3704@end example 3705 3706@cindex Resetting sticky tags 3707@cindex Sticky tags, resetting 3708@cindex Deleting sticky tags 3709The sticky tags will remain on your working files until 3710you delete them with @samp{cvs update -A}. The 3711@samp{-A} option retrieves the version of the file from 3712the head of the trunk, and forgets any sticky tags, 3713dates, or options. 3714 3715@cindex Sticky date 3716The most common use of sticky tags is to identify which 3717branch one is working on, as described in 3718@ref{Accessing branches}. However, non-branch 3719sticky tags have uses as well. For example, 3720suppose that you want to avoid updating your working 3721directory, to isolate yourself from possibly 3722destabilizing changes other people are making. You 3723can, of course, just refrain from running @code{cvs 3724update}. But if you want to avoid updating only a 3725portion of a larger tree, then sticky tags can help. 3726If you check out a certain revision (such as 1.4) it 3727will become sticky. Subsequent @code{cvs update} 3728commands will 3729not retrieve the latest revision until you reset the 3730tag with @code{cvs update -A}. Likewise, use of the 3731@samp{-D} option to @code{update} or @code{checkout} 3732sets a @dfn{sticky date}, which, similarly, causes that 3733date to be used for future retrievals. 3734 3735People often want to retrieve an old version of 3736a file without setting a sticky tag. This can 3737be done with the @samp{-p} option to @code{checkout} or 3738@code{update}, which sends the contents of the file to 3739standard output. For example: 3740@example 3741$ cvs update -p -r 1.1 file1 >file1 3742=================================================================== 3743Checking out file1 3744RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v 3745VERS: 1.1 3746*************** 3747$ 3748@end example 3749 3750However, this isn't the easiest way, if you are asking 3751how to undo a previous checkin (in this example, put 3752@file{file1} back to the way it was as of revision 37531.1). In that case you are better off using the 3754@samp{-j} option to @code{update}; for further 3755discussion see @ref{Merging two revisions}. 3756 3757@c --------------------------------------------------------------------- 3758@node Branching and merging 3759@chapter Branching and merging 3760@cindex Branching 3761@cindex Merging 3762@cindex Copying changes 3763@cindex Main trunk and branches 3764@cindex Revision tree, making branches 3765@cindex Branches, copying changes between 3766@cindex Changes, copying between branches 3767@cindex Modifications, copying between branches 3768 3769@sc{cvs} allows you to isolate changes onto a separate 3770line of development, known as a @dfn{branch}. When you 3771change files on a branch, those changes do not appear 3772on the main trunk or other branches. 3773 3774Later you can move changes from one branch to another 3775branch (or the main trunk) by @dfn{merging}. Merging 3776involves first running @code{cvs update -j}, to merge 3777the changes into the working directory. 3778You can then commit that revision, and thus effectively 3779copy the changes onto another branch. 3780 3781@menu 3782* Branches motivation:: What branches are good for 3783* Creating a branch:: Creating a branch 3784* Accessing branches:: Checking out and updating branches 3785* Branches and revisions:: Branches are reflected in revision numbers 3786* Magic branch numbers:: Magic branch numbers 3787* Merging a branch:: Merging an entire branch 3788* Merging more than once:: Merging from a branch several times 3789* Merging two revisions:: Merging differences between two revisions 3790* Merging adds and removals:: What if files are added or removed? 3791* Merging and keywords:: Avoiding conflicts due to keyword substitution 3792@end menu 3793 3794@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3795@node Branches motivation 3796@section What branches are good for 3797@cindex Branches motivation 3798@cindex What branches are good for 3799@cindex Motivation for branches 3800 3801@c FIXME: this node mentions one way to use branches, 3802@c but it is by no means the only way. For example, 3803@c the technique of committing a new feature on a branch, 3804@c until it is ready for the main trunk. The whole 3805@c thing is generally speaking more akin to the 3806@c "Revision management" node although it isn't clear to 3807@c me whether policy matters should be centralized or 3808@c distributed throughout the relevant sections. 3809Suppose that release 1.0 of tc has been made. You are continuing to 3810develop tc, planning to create release 1.1 in a couple of months. After a 3811while your customers start to complain about a fatal bug. You check 3812out release 1.0 (@pxref{Tags}) and find the bug 3813(which turns out to have a trivial fix). However, the current revision 3814of the sources are in a state of flux and are not expected to be stable 3815for at least another month. There is no way to make a 3816bugfix release based on the newest sources. 3817 3818The thing to do in a situation like this is to create a @dfn{branch} on 3819the revision trees for all the files that make up 3820release 1.0 of tc. You can then make 3821modifications to the branch without disturbing the main trunk. When the 3822modifications are finished you can elect to either incorporate them on 3823the main trunk, or leave them on the branch. 3824 3825@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3826@node Creating a branch 3827@section Creating a branch 3828@cindex Creating a branch 3829@cindex Branch, creating a 3830@cindex tag, creating a branch using 3831@cindex rtag, creating a branch using 3832 3833You can create a branch with @code{tag -b}; for 3834example, assuming you're in a working copy: 3835 3836@example 3837$ cvs tag -b rel-1-0-patches 3838@end example 3839 3840@c FIXME: we should be more explicit about the value of 3841@c having a tag on the branchpoint. For example 3842@c "cvs tag rel-1-0-patches-branchpoint" before 3843@c the "cvs tag -b". This points out that 3844@c rel-1-0-patches is a pretty awkward name for 3845@c this example (more so than for the rtag example 3846@c below). 3847 3848This splits off a branch based on the current revisions 3849in the working copy, assigning that branch the name 3850@samp{rel-1-0-patches}. 3851 3852It is important to understand that branches get created 3853in the repository, not in the working copy. Creating a 3854branch based on current revisions, as the above example 3855does, will @emph{not} automatically switch the working 3856copy to be on the new branch. For information on how 3857to do that, see @ref{Accessing branches}. 3858 3859You can also create a branch without reference to any 3860working copy, by using @code{rtag}: 3861 3862@example 3863$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc 3864@end example 3865 3866@samp{-r rel-1-0} says that this branch should be 3867rooted at the revision that 3868corresponds to the tag @samp{rel-1-0}. It need not 3869be the most recent revision -- it's often useful to 3870split a branch off an old revision (for example, when 3871fixing a bug in a past release otherwise known to be 3872stable). 3873 3874As with @samp{tag}, the @samp{-b} flag tells 3875@code{rtag} to create a branch (rather than just a 3876symbolic revision name). Note that the numeric 3877revision number that matches @samp{rel-1-0} will 3878probably be different from file to file. 3879 3880So, the full effect of the command is to create a new 3881branch -- named @samp{rel-1-0-patches} -- in module 3882@samp{tc}, rooted in the revision tree at the point tagged 3883by @samp{rel-1-0}. 3884 3885@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3886@node Accessing branches 3887@section Accessing branches 3888@cindex Check out a branch 3889@cindex Retrieve a branch 3890@cindex Access a branch 3891@cindex Identifying a branch 3892@cindex Branch, check out 3893@cindex Branch, retrieving 3894@cindex Branch, accessing 3895@cindex Branch, identifying 3896 3897You can retrieve a branch in one of two ways: by 3898checking it out fresh from the repository, or by 3899switching an existing working copy over to the branch. 3900 3901To check out a branch from the repository, invoke 3902@samp{checkout} with the @samp{-r} flag, followed by 3903the tag name of the branch (@pxref{Creating a branch}): 3904 3905@example 3906$ cvs checkout -r rel-1-0-patches tc 3907@end example 3908 3909Or, if you already have a working copy, you can switch 3910it to a given branch with @samp{update -r}: 3911 3912@example 3913$ cvs update -r rel-1-0-patches tc 3914@end example 3915 3916or equivalently: 3917 3918@example 3919$ cd tc 3920$ cvs update -r rel-1-0-patches 3921@end example 3922 3923It does not matter if the working copy was originally 3924on the main trunk or on some other branch -- the above 3925command will switch it to the named branch. And 3926similarly to a regular @samp{update} command, 3927@samp{update -r} merges any changes you have made, 3928notifying you of conflicts where they occur. 3929 3930Once you have a working copy tied to a particular 3931branch, it remains there until you tell it otherwise. 3932This means that changes checked in from the working 3933copy will add new revisions on that branch, while 3934leaving the main trunk and other branches unaffected. 3935 3936@cindex Branches, sticky 3937To find out what branch a working copy is on, you can 3938use the @samp{status} command. In its output, look for 3939the field named @samp{Sticky tag} (@pxref{Sticky tags}) 3940-- that's @sc{cvs}'s way of telling you the branch, if 3941any, of the current working files: 3942 3943@example 3944$ cvs status -v driver.c backend.c 3945=================================================================== 3946File: driver.c Status: Up-to-date 3947 3948 Version: 1.7 Sat Dec 5 18:25:54 1992 3949 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v 3950 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 3951 Sticky Date: (none) 3952 Sticky Options: (none) 3953 3954 Existing Tags: 3955 rel-1-0-patches (branch: 1.7.2) 3956 rel-1-0 (revision: 1.7) 3957 3958=================================================================== 3959File: backend.c Status: Up-to-date 3960 3961 Version: 1.4 Tue Dec 1 14:39:01 1992 3962 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 3963 Sticky Tag: rel-1-0-patches (branch: 1.4.2) 3964 Sticky Date: (none) 3965 Sticky Options: (none) 3966 3967 Existing Tags: 3968 rel-1-0-patches (branch: 1.4.2) 3969 rel-1-0 (revision: 1.4) 3970 rel-0-4 (revision: 1.4) 3971 3972@end example 3973 3974Don't be confused by the fact that the branch numbers 3975for each file are different (@samp{1.7.2} and 3976@samp{1.4.2} respectively). The branch tag is the 3977same, @samp{rel-1-0-patches}, and the files are 3978indeed on the same branch. The numbers simply reflect 3979the point in each file's revision history at which the 3980branch was made. In the above example, one can deduce 3981that @samp{driver.c} had been through more changes than 3982@samp{backend.c} before this branch was created. 3983 3984See @ref{Branches and revisions} for details about how 3985branch numbers are constructed. 3986 3987@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3988@node Branches and revisions 3989@section Branches and revisions 3990@cindex Branch number 3991@cindex Number, branch 3992@cindex Revision numbers (branches) 3993 3994Ordinarily, a file's revision history is a linear 3995series of increments (@pxref{Revision numbers}): 3996 3997@example 3998 +-----+ +-----+ +-----+ +-----+ +-----+ 3999 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 4000 +-----+ +-----+ +-----+ +-----+ +-----+ 4001@end example 4002 4003However, @sc{cvs} is not limited to linear development. The 4004@dfn{revision tree} can be split into @dfn{branches}, 4005where each branch is a self-maintained line of 4006development. Changes made on one branch can easily be 4007moved back to the main trunk. 4008 4009Each branch has a @dfn{branch number}, consisting of an 4010odd number of period-separated decimal integers. The 4011branch number is created by appending an integer to the 4012revision number where the corresponding branch forked 4013off. Having branch numbers allows more than one branch 4014to be forked off from a certain revision. 4015 4016@need 3500 4017All revisions on a branch have revision numbers formed 4018by appending an ordinal number to the branch number. 4019The following figure illustrates branching with an 4020example. 4021 4022@example 4023@c This example used to have a 1.2.2.4 revision, which 4024@c might help clarify that development can continue on 4025@c 1.2.2. Might be worth reinstating if it can be done 4026@c without overfull hboxes. 4027@group 4028 +-------------+ 4029 Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 ! 4030 / +-------------+ 4031 / 4032 / 4033 +---------+ +---------+ +---------+ 4034Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4035 / +---------+ +---------+ +---------+ 4036 / 4037 / 4038+-----+ +-----+ +-----+ +-----+ +-----+ 4039! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4040+-----+ +-----+ +-----+ +-----+ +-----+ 4041 ! 4042 ! 4043 ! +---------+ +---------+ +---------+ 4044Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 ! 4045 +---------+ +---------+ +---------+ 4046 4047@end group 4048@end example 4049 4050@c -- However, at least for me the figure is not enough. I suggest more 4051@c -- text to accompany it. "A picture is worth a thousand words", so you 4052@c -- have to make sure the reader notices the couple of hundred words 4053@c -- *you* had in mind more than the others! 4054 4055@c -- Why an even number of segments? This section implies that this is 4056@c -- how the main trunk is distinguished from branch roots, but you never 4057@c -- explicitly say that this is the purpose of the [by itself rather 4058@c -- surprising] restriction to an even number of segments. 4059 4060The exact details of how the branch number is 4061constructed is not something you normally need to be 4062concerned about, but here is how it works: When 4063@sc{cvs} creates a branch number it picks the first 4064unused even integer, starting with 2. So when you want 4065to create a branch from revision 6.4 it will be 4066numbered 6.4.2. All branch numbers ending in a zero 4067(such as 6.4.0) are used internally by @sc{cvs} 4068(@pxref{Magic branch numbers}). The branch 1.1.1 has a 4069special meaning. @xref{Tracking sources}. 4070 4071@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4072@node Magic branch numbers 4073@section Magic branch numbers 4074 4075@c Want xref to here from "log"? 4076 4077This section describes a @sc{cvs} feature called 4078@dfn{magic branches}. For most purposes, you need not 4079worry about magic branches; @sc{cvs} handles them for 4080you. However, they are visible to you in certain 4081circumstances, so it may be useful to have some idea of 4082how it works. 4083 4084Externally, branch numbers consist of an odd number of 4085dot-separated decimal integers. @xref{Revision 4086numbers}. That is not the whole truth, however. For 4087efficiency reasons @sc{cvs} sometimes inserts an extra 0 4088in the second rightmost position (1.2.4 becomes 40891.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so 4090on). 4091 4092@sc{cvs} does a pretty good job at hiding these so 4093called magic branches, but in a few places the hiding 4094is incomplete: 4095 4096@itemize @bullet 4097@ignore 4098@c This is in ignore as I'm taking their word for it, 4099@c that this was fixed 4100@c a long time ago. But before deleting this 4101@c entirely, I'd rather verify it (and add a test 4102@c case to the testsuite). 4103@item 4104The magic branch can appear in the output from 4105@code{cvs status} in vanilla @sc{cvs} 1.3. This is 4106fixed in @sc{cvs} 1.3-s2. 4107 4108@end ignore 4109@item 4110The magic branch number appears in the output from 4111@code{cvs log}. 4112@c What output should appear instead? 4113 4114@item 4115You cannot specify a symbolic branch name to @code{cvs 4116admin}. 4117 4118@end itemize 4119 4120@c Can CVS do this automatically the first time 4121@c you check something in to that branch? Should 4122@c it? 4123You can use the @code{admin} command to reassign a 4124symbolic name to a branch the way @sc{rcs} expects it 4125to be. If @code{R4patches} is assigned to the branch 41261.4.2 (magic branch number 1.4.0.2) in file 4127@file{numbers.c} you can do this: 4128 4129@example 4130$ cvs admin -NR4patches:1.4.2 numbers.c 4131@end example 4132 4133It only works if at least one revision is already 4134committed on the branch. Be very careful so that you 4135do not assign the tag to the wrong number. (There is 4136no way to see how the tag was assigned yesterday). 4137 4138@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4139@node Merging a branch 4140@section Merging an entire branch 4141@cindex Merging a branch 4142@cindex -j (merging branches) 4143 4144You can merge changes made on a branch into your working copy by giving 4145the @samp{-j @var{branchname}} flag to the @code{update} subcommand. With one 4146@samp{-j @var{branchname}} option it merges the changes made between the 4147point where the branch forked and newest revision on that branch (into 4148your working copy). 4149 4150@cindex Join 4151The @samp{-j} stands for ``join''. 4152 4153@cindex Branch merge example 4154@cindex Example, branch merge 4155@cindex Merge, branch example 4156Consider this revision tree: 4157 4158@example 4159+-----+ +-----+ +-----+ +-----+ 4160! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk 4161+-----+ +-----+ +-----+ +-----+ 4162 ! 4163 ! 4164 ! +---------+ +---------+ 4165Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4166 +---------+ +---------+ 4167@end example 4168 4169@noindent 4170The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}. The 4171following example assumes that the module @samp{mod} contains only one 4172file, @file{m.c}. 4173 4174@example 4175$ cvs checkout mod # @r{Retrieve the latest revision, 1.4} 4176 4177$ cvs update -j R1fix m.c # @r{Merge all changes made on the branch,} 4178 # @r{i.e. the changes between revision 1.2} 4179 # @r{and 1.2.2.2, into your working copy} 4180 # @r{of the file.} 4181 4182$ cvs commit -m "Included R1fix" # @r{Create revision 1.5.} 4183@end example 4184 4185A conflict can result from a merge operation. If that 4186happens, you should resolve it before committing the 4187new revision. @xref{Conflicts example}. 4188 4189If your source files contain keywords (@pxref{Keyword substitution}), 4190you might be getting more conflicts than strictly necessary. See 4191@ref{Merging and keywords}, for information on how to avoid this. 4192 4193The @code{checkout} command also supports the @samp{-j @var{branchname}} flag. The 4194same effect as above could be achieved with this: 4195 4196@example 4197$ cvs checkout -j R1fix mod 4198$ cvs commit -m "Included R1fix" 4199@end example 4200 4201It should be noted that @code{update -j @var{tagname}} will also work but may 4202not produce the desired result. @xref{Merging adds and removals}, for more. 4203 4204@node Merging more than once 4205@section Merging from a branch several times 4206 4207Continuing our example, the revision tree now looks 4208like this: 4209 4210@example 4211+-----+ +-----+ +-----+ +-----+ +-----+ 4212! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4213+-----+ +-----+ +-----+ +-----+ +-----+ 4214 ! * 4215 ! * 4216 ! +---------+ +---------+ 4217Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4218 +---------+ +---------+ 4219@end example 4220 4221where the starred line represents the merge from the 4222@samp{R1fix} branch to the main trunk, as just 4223discussed. 4224 4225Now suppose that development continues on the 4226@samp{R1fix} branch: 4227 4228@example 4229+-----+ +-----+ +-----+ +-----+ +-----+ 4230! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4231+-----+ +-----+ +-----+ +-----+ +-----+ 4232 ! * 4233 ! * 4234 ! +---------+ +---------+ +---------+ 4235Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4236 +---------+ +---------+ +---------+ 4237@end example 4238 4239and then you want to merge those new changes onto the 4240main trunk. If you just use the @code{cvs update -j 4241R1fix m.c} command again, @sc{cvs} will attempt to 4242merge again the changes which you have already merged, 4243which can have undesirable side effects. 4244 4245So instead you need to specify that you only want to 4246merge the changes on the branch which have not yet been 4247merged into the trunk. To do that you specify two 4248@samp{-j} options, and @sc{cvs} merges the changes from 4249the first revision to the second revision. For 4250example, in this case the simplest way would be 4251 4252@example 4253cvs update -j 1.2.2.2 -j R1fix m.c # @r{Merge changes from 1.2.2.2 to the} 4254 # @r{head of the R1fix branch} 4255@end example 4256 4257The problem with this is that you need to specify the 42581.2.2.2 revision manually. A slightly better approach 4259might be to use the date the last merge was done: 4260 4261@example 4262cvs update -j R1fix:yesterday -j R1fix m.c 4263@end example 4264 4265Better yet, tag the R1fix branch after every merge into 4266the trunk, and then use that tag for subsequent merges: 4267 4268@example 4269cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c 4270@end example 4271 4272@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4273@node Merging two revisions 4274@section Merging differences between any two revisions 4275@cindex Merging two revisions 4276@cindex Revisions, merging differences between 4277@cindex Differences, merging 4278 4279With two @samp{-j @var{revision}} flags, the @code{update} 4280(and @code{checkout}) command can merge the differences 4281between any two revisions into your working file. 4282 4283@cindex Undoing a change 4284@cindex Removing a change 4285@example 4286$ cvs update -j 1.5 -j 1.3 backend.c 4287@end example 4288 4289@noindent 4290will undo all changes made between revision 42911.3 and 1.5. Note the order of the revisions! 4292 4293If you try to use this option when operating on 4294multiple files, remember that the numeric revisions will 4295probably be very different between the various files. 4296You almost always use symbolic 4297tags rather than revision numbers when operating on 4298multiple files. 4299 4300@cindex Restoring old version of removed file 4301@cindex Resurrecting old version of dead file 4302Specifying two @samp{-j} options can also undo file 4303removals or additions. For example, suppose you have 4304a file 4305named @file{file1} which existed as revision 1.1, and 4306you then removed it (thus adding a dead revision 1.2). 4307Now suppose you want to add it again, with the same 4308contents it had previously. Here is how to do it: 4309 4310@example 4311$ cvs update -j 1.2 -j 1.1 file1 4312U file1 4313$ cvs commit -m test 4314Checking in file1; 4315/tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 4316new revision: 1.3; previous revision: 1.2 4317done 4318$ 4319@end example 4320 4321@node Merging adds and removals 4322@section Merging can add or remove files 4323 4324If the changes which you are merging involve removing 4325or adding some files, @code{update -j} will reflect 4326such additions or removals. 4327 4328@c FIXME: This example needs a lot more explanation. 4329@c We also need other examples for some of the other 4330@c cases (not all--there are too many--as long as we present a 4331@c coherent general principle). 4332For example: 4333@example 4334cvs update -A 4335touch a b c 4336cvs add a b c ; cvs ci -m "added" a b c 4337cvs tag -b branchtag 4338cvs update -r branchtag 4339touch d ; cvs add d 4340rm a ; cvs rm a 4341cvs ci -m "added d, removed a" 4342cvs update -A 4343cvs update -jbranchtag 4344@end example 4345 4346After these commands are executed and a @samp{cvs commit} is done, 4347file @file{a} will be removed and file @file{d} added in the main branch. 4348@c (which was determined by trying it) 4349 4350Note that using a single static tag (@samp{-j @var{tagname}}) 4351rather than a dynamic tag (@samp{-j @var{branchname}}) to merge 4352changes from a branch will usually not remove files which were removed on the 4353branch since @sc{cvs} does not automatically add static tags to dead revisions. 4354The exception to this rule occurs when 4355a static tag has been attached to a dead revision manually. Use the branch tag 4356to merge all changes from the branch or use two static tags as merge endpoints 4357to be sure that all intended changes are propogated in the merge. 4358 4359@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4360@node Merging and keywords 4361@section Merging and keywords 4362@cindex Merging, and keyword substitution 4363@cindex Keyword substitution, and merging 4364@cindex -j (merging branches), and keyword substitution 4365@cindex -kk, to avoid conflicts during a merge 4366 4367If you merge files containing keywords (@pxref{Keyword 4368substitution}), you will normally get numerous 4369conflicts during the merge, because the keywords are 4370expanded differently in the revisions which you are 4371merging. 4372 4373Therefore, you will often want to specify the 4374@samp{-kk} (@pxref{Substitution modes}) switch to the 4375merge command line. By substituting just the name of 4376the keyword, not the expanded value of that keyword, 4377this option ensures that the revisions which you are 4378merging will be the same as each other, and avoid 4379spurious conflicts. 4380 4381For example, suppose you have a file like this: 4382 4383@example 4384 +---------+ 4385 _! 1.1.2.1 ! <- br1 4386 / +---------+ 4387 / 4388 / 4389+-----+ +-----+ 4390! 1.1 !----! 1.2 ! 4391+-----+ +-----+ 4392@end example 4393 4394and your working directory is currently on the trunk 4395(revision 1.2). Then you might get the following 4396results from a merge: 4397 4398@example 4399$ cat file1 4400key $@asis{}Revision: 1.2 $ 4401. . . 4402$ cvs update -j br1 4403U file1 4404RCS file: /cvsroot/first-dir/file1,v 4405retrieving revision 1.1 4406retrieving revision 1.1.2.1 4407Merging differences between 1.1 and 1.1.2.1 into file1 4408rcsmerge: warning: conflicts during merge 4409$ cat file1 4410@asis{}<<<<<<< file1 4411key $@asis{}Revision: 1.2 $ 4412@asis{}======= 4413key $@asis{}Revision: 1.1.2.1 $ 4414@asis{}>>>>>>> 1.1.2.1 4415. . . 4416@end example 4417 4418What happened was that the merge tried to merge the 4419differences between 1.1 and 1.1.2.1 into your working 4420directory. So, since the keyword changed from 4421@code{Revision: 1.1} to @code{Revision: 1.1.2.1}, 4422@sc{cvs} tried to merge that change into your working 4423directory, which conflicted with the fact that your 4424working directory had contained @code{Revision: 1.2}. 4425 4426Here is what happens if you had used @samp{-kk}: 4427 4428@example 4429$ cat file1 4430key $@asis{}Revision: 1.2 $ 4431. . . 4432$ cvs update -kk -j br1 4433U file1 4434RCS file: /cvsroot/first-dir/file1,v 4435retrieving revision 1.1 4436retrieving revision 1.1.2.1 4437Merging differences between 1.1 and 1.1.2.1 into file1 4438$ cat file1 4439key $@asis{}Revision$ 4440. . . 4441@end example 4442 4443What is going on here is that revision 1.1 and 1.1.2.1 4444both expand as plain @code{Revision}, and therefore 4445merging the changes between them into the working 4446directory need not change anything. Therefore, there 4447is no conflict. 4448 4449There is, however, one major caveat with using 4450@samp{-kk} on merges. Namely, it overrides whatever 4451keyword expansion mode @sc{cvs} would normally have 4452used. In particular, this is a problem if the mode had 4453been @samp{-kb} for a binary file. Therefore, if your 4454repository contains binary files, you will need to deal 4455with the conflicts rather than using @samp{-kk}. 4456 4457@ignore 4458The following seems rather confusing, possibly buggy, 4459and in general, in need of much more thought before it 4460is a recommended technique. For one thing, does it 4461apply on Windows as well as on Unix? 4462 4463Unchanged binary files will undergo the same keyword substitution 4464but will not be checked in on a subsequent 4465@code{cvs commit}. Be aware that binary files containing keyword 4466strings which are present in or below the working directory 4467will most likely remain corrupt until repaired, however. A simple 4468@code{cvs update -A} is sufficient to fix these otherwise unaltered binary files 4469if the merge is being done to the main branch but 4470this must be done after the merge has been committed or the merge itself 4471will be lost. 4472 4473For Example: 4474@example 4475cvs update -Akk -jbranchtag 4476cvs commit 4477cvs update -A 4478@end example 4479 4480@noindent 4481will update the current directory from the main trunk of the 4482repository, substituting the base keyword strings for keywords, 4483and merge changes made on the branch @samp{branchtag} into the new 4484work files, performing the same keyword substitution on that file set before 4485comparing the two sets. The final @code{cvs update -A} will restore any 4486corrupted binary files as well as resetting the sticky @samp{-kk} tags which 4487were present on the files in and below the working directory. 4488Unfortunately, this doesn't work as well with an arbitrary branch tag, as the 4489@samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk} 4490switches attached to the working files as @samp{-A} does. The workaround 4491for this is to release the working directory after the merge has been 4492committed and check it out again. 4493@end ignore 4494 4495@c --------------------------------------------------------------------- 4496@node Recursive behavior 4497@chapter Recursive behavior 4498@cindex Recursive (directory descending) 4499@cindex Directory, descending 4500@cindex Descending directories 4501@cindex Subdirectories 4502 4503Almost all of the subcommands of @sc{cvs} work 4504recursively when you specify a directory as an 4505argument. For instance, consider this directory 4506structure: 4507 4508@example 4509 @code{$HOME} 4510 | 4511 +--@t{tc} 4512 | | 4513 +--@t{CVS} 4514 | (internal @sc{cvs} files) 4515 +--@t{Makefile} 4516 +--@t{backend.c} 4517 +--@t{driver.c} 4518 +--@t{frontend.c} 4519 +--@t{parser.c} 4520 +--@t{man} 4521 | | 4522 | +--@t{CVS} 4523 | | (internal @sc{cvs} files) 4524 | +--@t{tc.1} 4525 | 4526 +--@t{testing} 4527 | 4528 +--@t{CVS} 4529 | (internal @sc{cvs} files) 4530 +--@t{testpgm.t} 4531 +--@t{test2.t} 4532@end example 4533 4534@noindent 4535If @file{tc} is the current working directory, the 4536following is true: 4537 4538@itemize @bullet 4539@item 4540@samp{cvs update testing} is equivalent to 4541 4542@example 4543cvs update testing/testpgm.t testing/test2.t 4544@end example 4545 4546@item 4547@samp{cvs update testing man} updates all files in the 4548subdirectories 4549 4550@item 4551@samp{cvs update .} or just @samp{cvs update} updates 4552all files in the @code{tc} directory 4553@end itemize 4554 4555If no arguments are given to @code{update} it will 4556update all files in the current working directory and 4557all its subdirectories. In other words, @file{.} is a 4558default argument to @code{update}. This is also true 4559for most of the @sc{cvs} subcommands, not only the 4560@code{update} command. 4561 4562The recursive behavior of the @sc{cvs} subcommands can be 4563turned off with the @samp{-l} option. 4564Conversely, the @samp{-R} option can be used to force recursion if 4565@samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 4566 4567@example 4568$ cvs update -l # @r{Don't update files in subdirectories} 4569@end example 4570 4571@c --------------------------------------------------------------------- 4572@node Adding and removing 4573@chapter Adding, removing, and renaming files and directories 4574 4575In the course of a project, one will often add new 4576files. Likewise with removing or renaming, or with 4577directories. The general concept to keep in mind in 4578all these cases is that instead of making an 4579irreversible change you want @sc{cvs} to record the 4580fact that a change has taken place, just as with 4581modifying an existing file. The exact mechanisms to do 4582this in @sc{cvs} vary depending on the situation. 4583 4584@menu 4585* Adding files:: Adding files 4586* Removing files:: Removing files 4587* Removing directories:: Removing directories 4588* Moving files:: Moving and renaming files 4589* Moving directories:: Moving and renaming directories 4590@end menu 4591 4592@node Adding files 4593@section Adding files to a directory 4594@cindex Adding files 4595 4596To add a new file to a directory, follow these steps. 4597 4598@itemize @bullet 4599@item 4600You must have a working copy of the directory. 4601@xref{Getting the source}. 4602 4603@item 4604Create the new file inside your working copy of the directory. 4605 4606@item 4607Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you 4608want to version control the file. If the file contains 4609binary data, specify @samp{-kb} (@pxref{Binary files}). 4610 4611@item 4612Use @samp{cvs commit @var{filename}} to actually check 4613in the file into the repository. Other developers 4614cannot see the file until you perform this step. 4615@end itemize 4616 4617You can also use the @code{add} command to add a new 4618directory. 4619@c FIXCVS and/or FIXME: Adding a directory doesn't 4620@c require the commit step. This probably can be 4621@c considered a CVS bug, but it is possible we should 4622@c warn people since this behavior probably won't be 4623@c changing right away. 4624 4625Unlike most other commands, the @code{add} command is 4626not recursive. You cannot even type @samp{cvs add 4627foo/bar}! Instead, you have to 4628@c FIXCVS: This is, of course, not a feature. It is 4629@c just that no one has gotten around to fixing "cvs add 4630@c foo/bar". 4631 4632@example 4633$ cd foo 4634$ cvs add bar 4635@end example 4636 4637@cindex add (subcommand) 4638@deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{} 4639 4640Schedule @var{files} to be added to the repository. 4641The files or directories specified with @code{add} must 4642already exist in the current directory. To add a whole 4643new directory hierarchy to the source repository (for 4644example, files received from a third-party vendor), use 4645the @code{import} command instead. @xref{import}. 4646 4647The added files are not placed in the source repository 4648until you use @code{commit} to make the change 4649permanent. Doing an @code{add} on a file that was 4650removed with the @code{remove} command will undo the 4651effect of the @code{remove}, unless a @code{commit} 4652command intervened. @xref{Removing files}, for an 4653example. 4654 4655The @samp{-k} option specifies the default way that 4656this file will be checked out; for more information see 4657@ref{Substitution modes}. 4658 4659@c As noted in BUGS, -m is broken client/server (Nov 4660@c 96). Also see testsuite log2-* tests. 4661The @samp{-m} option specifies a description for the 4662file. This description appears in the history log (if 4663it is enabled, @pxref{history file}). It will also be 4664saved in the version history inside the repository when 4665the file is committed. The @code{log} command displays 4666this description. The description can be changed using 4667@samp{admin -t}. @xref{admin}. If you omit the 4668@samp{-m @var{description}} flag, an empty string will 4669be used. You will not be prompted for a description. 4670@end deffn 4671 4672For example, the following commands add the file 4673@file{backend.c} to the repository: 4674 4675@c This example used to specify 4676@c -m "Optimizer and code generation passes." 4677@c to the cvs add command, but that doesn't work 4678@c client/server (see log2 in sanity.sh). Should fix CVS, 4679@c but also seems strange to document things which 4680@c don't work... 4681@example 4682$ cvs add backend.c 4683$ cvs commit -m "Early version. Not yet compilable." backend.c 4684@end example 4685 4686When you add a file it is added only on the branch 4687which you are working on (@pxref{Branching and merging}). You can 4688later merge the additions to another branch if you want 4689(@pxref{Merging adds and removals}). 4690@c Should we mention that earlier versions of CVS 4691@c lacked this feature (1.3) or implemented it in a buggy 4692@c way (well, 1.8 had many bugs in cvs update -j)? 4693@c Should we mention the bug/limitation regarding a 4694@c file being a regular file on one branch and a directory 4695@c on another? 4696@c FIXME: This needs an example, or several, here or 4697@c elsewhere, for it to make much sense. 4698@c Somewhere we need to discuss the aspects of death 4699@c support which don't involve branching, I guess. 4700@c Like the ability to re-create a release from a tag. 4701 4702@c --------------------------------------------------------------------- 4703@node Removing files 4704@section Removing files 4705@cindex Removing files 4706@cindex Deleting files 4707 4708@c FIXME: this node wants to be split into several 4709@c smaller nodes. Could make these children of 4710@c "Adding and removing", probably (death support could 4711@c be its own section, for example, as could the 4712@c various bits about undoing mistakes in adding and 4713@c removing). 4714Directories change. New files are added, and old files 4715disappear. Still, you want to be able to retrieve an 4716exact copy of old releases. 4717 4718Here is what you can do to remove a file, 4719but remain able to retrieve old revisions: 4720 4721@itemize @bullet 4722@c FIXME: should probably be saying something about 4723@c having a working directory in the first place. 4724@item 4725Make sure that you have not made any uncommitted 4726modifications to the file. @xref{Viewing differences}, 4727for one way to do that. You can also use the 4728@code{status} or @code{update} command. If you remove 4729the file without committing your changes, you will of 4730course not be able to retrieve the file as it was 4731immediately before you deleted it. 4732 4733@item 4734Remove the file from your working copy of the directory. 4735You can for instance use @code{rm}. 4736 4737@item 4738Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that 4739you really want to delete the file. 4740 4741@item 4742Use @samp{cvs commit @var{filename}} to actually 4743perform the removal of the file from the repository. 4744@end itemize 4745 4746@c FIXME: Somehow this should be linked in with a more 4747@c general discussion of death support. I don't know 4748@c whether we want to use the term "death support" or 4749@c not (we can perhaps get by without it), but we do 4750@c need to discuss the "dead" state in "cvs log" and 4751@c related subjects. The current discussion is 4752@c scattered around, and not xref'd to each other. 4753@c FIXME: I think this paragraph wants to be moved 4754@c later down, at least after the first example. 4755When you commit the removal of the file, @sc{cvs} 4756records the fact that the file no longer exists. It is 4757possible for a file to exist on only some branches and 4758not on others, or to re-add another file with the same 4759name later. @sc{cvs} will correctly create or not create 4760the file, based on the @samp{-r} and @samp{-D} options 4761specified to @code{checkout} or @code{update}. 4762 4763@c FIXME: This style seems to clash with how we 4764@c document things in general. 4765@cindex Remove (subcommand) 4766@deffn Command {cvs remove} [options] files @dots{} 4767 4768Schedule file(s) to be removed from the repository 4769(files which have not already been removed from the 4770working directory are not processed). This command 4771does not actually remove the file from the repository 4772until you commit the removal. For a full list of 4773options, see @ref{Invoking CVS}. 4774@end deffn 4775 4776Here is an example of removing several files: 4777 4778@example 4779$ cd test 4780$ rm *.c 4781$ cvs remove 4782cvs remove: Removing . 4783cvs remove: scheduling a.c for removal 4784cvs remove: scheduling b.c for removal 4785cvs remove: use 'cvs commit' to remove these files permanently 4786$ cvs ci -m "Removed unneeded files" 4787cvs commit: Examining . 4788cvs commit: Committing . 4789@end example 4790 4791As a convenience you can remove the file and @code{cvs 4792remove} it in one step, by specifying the @samp{-f} 4793option. For example, the above example could also be 4794done like this: 4795 4796@example 4797$ cd test 4798$ cvs remove -f *.c 4799cvs remove: scheduling a.c for removal 4800cvs remove: scheduling b.c for removal 4801cvs remove: use 'cvs commit' to remove these files permanently 4802$ cvs ci -m "Removed unneeded files" 4803cvs commit: Examining . 4804cvs commit: Committing . 4805@end example 4806 4807If you execute @code{remove} for a file, and then 4808change your mind before you commit, you can undo the 4809@code{remove} with an @code{add} command. 4810@ignore 4811@c is this worth saying or not? Somehow it seems 4812@c confusing to me. 4813Of course, 4814since you have removed your copy of file in the working 4815directory, @sc{cvs} does not necessarily bring back the 4816contents of the file from right before you executed 4817@code{remove}; instead it gets the file from the 4818repository again. 4819@end ignore 4820 4821@c FIXME: what if you change your mind after you commit 4822@c it? (answer is also "cvs add" but we don't say that...). 4823@c We need some index entries for thinks like "undoing 4824@c removal" too. 4825 4826@example 4827$ ls 4828CVS ja.h oj.c 4829$ rm oj.c 4830$ cvs remove oj.c 4831cvs remove: scheduling oj.c for removal 4832cvs remove: use 'cvs commit' to remove this file permanently 4833$ cvs add oj.c 4834U oj.c 4835cvs add: oj.c, version 1.1.1.1, resurrected 4836@end example 4837 4838If you realize your mistake before you run the 4839@code{remove} command you can use @code{update} to 4840resurrect the file: 4841 4842@example 4843$ rm oj.c 4844$ cvs update oj.c 4845cvs update: warning: oj.c was lost 4846U oj.c 4847@end example 4848 4849When you remove a file it is removed only on the branch 4850which you are working on (@pxref{Branching and merging}). You can 4851later merge the removals to another branch if you want 4852(@pxref{Merging adds and removals}). 4853 4854@node Removing directories 4855@section Removing directories 4856@cindex Removing directories 4857@cindex Directories, removing 4858 4859In concept removing directories is somewhat similar to 4860removing files---you want the directory to not exist in 4861your current working directories, but you also want to 4862be able to retrieve old releases in which the directory 4863existed. 4864 4865The way that you remove a directory is to remove all 4866the files in it. You don't remove the directory 4867itself; there is no way to do that. 4868Instead you specify the @samp{-P} option to 4869@code{cvs update} or @code{cvs checkout}, 4870which will cause @sc{cvs} to remove empty 4871directories from working directories. 4872(Note that @code{cvs export} always removes empty directories.) 4873Probably the 4874best way to do this is to always specify @samp{-P}; if 4875you want an empty directory then put a dummy file (for 4876example @file{.keepme}) in it to prevent @samp{-P} from 4877removing it. 4878 4879@c I'd try to give a rationale for this, but I'm not 4880@c sure there is a particularly convincing one. What 4881@c we would _like_ is for CVS to do a better job of version 4882@c controlling whether directories exist, to eliminate the 4883@c need for -P and so that a file can be a directory in 4884@c one revision and a regular file in another. 4885Note that @samp{-P} is implied by the @samp{-r} or @samp{-D} 4886options of @code{checkout}. This way 4887@sc{cvs} will be able to correctly create the directory 4888or not depending on whether the particular version you 4889are checking out contains any files in that directory. 4890 4891@c --------------------------------------------------------------------- 4892@node Moving files 4893@section Moving and renaming files 4894@cindex Moving files 4895@cindex Renaming files 4896@cindex Files, moving 4897 4898Moving files to a different directory or renaming them 4899is not difficult, but some of the ways in which this 4900works may be non-obvious. (Moving or renaming a 4901directory is even harder. @xref{Moving directories}.). 4902 4903The examples below assume that the file @var{old} is renamed to 4904@var{new}. 4905 4906@menu 4907* Outside:: The normal way to Rename 4908* Inside:: A tricky, alternative way 4909* Rename by copying:: Another tricky, alternative way 4910@end menu 4911 4912@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4913@node Outside 4914@subsection The Normal way to Rename 4915 4916@c More rename issues. Not sure whether these are 4917@c worth documenting; I'm putting them here because 4918@c it seems to be as good a place as any to try to 4919@c set down the issues. 4920@c * "cvs annotate" will annotate either the new 4921@c file or the old file; it cannot annotate _each 4922@c line_ based on whether it was last changed in the 4923@c new or old file. Unlike "cvs log", where the 4924@c consequences of having to select either the new 4925@c or old name seem fairly benign, this may be a 4926@c real advantage to having CVS know about renames 4927@c other than as a deletion and an addition. 4928 4929The normal way to move a file is to copy @var{old} to 4930@var{new}, and then issue the normal @sc{cvs} commands 4931to remove @var{old} from the repository, and add 4932@var{new} to it. 4933@c The following sentence is not true: one must cd into 4934@c the directory to run "cvs add". 4935@c (Both @var{old} and @var{new} could 4936@c contain relative paths, for example @file{foo/bar.c}). 4937 4938@example 4939$ mv @var{old} @var{new} 4940$ cvs remove @var{old} 4941$ cvs add @var{new} 4942$ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new} 4943@end example 4944 4945This is the simplest way to move a file, it is not 4946error-prone, and it preserves the history of what was 4947done. Note that to access the history of the file you 4948must specify the old or the new name, depending on what 4949portion of the history you are accessing. For example, 4950@code{cvs log @var{old}} will give the log up until the 4951time of the rename. 4952 4953When @var{new} is committed its revision numbers will 4954start again, usually at 1.1, so if that bothers you, 4955use the @samp{-r rev} option to commit. For more 4956information see @ref{Assigning revisions}. 4957 4958@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4959@node Inside 4960@subsection Moving the history file 4961 4962This method is more dangerous, since it involves moving 4963files inside the repository. Read this entire section 4964before trying it out! 4965 4966@example 4967$ cd $CVSROOT/@var{dir} 4968$ mv @var{old},v @var{new},v 4969@end example 4970 4971@noindent 4972Advantages: 4973 4974@itemize @bullet 4975@item 4976The log of changes is maintained intact. 4977 4978@item 4979The revision numbers are not affected. 4980@end itemize 4981 4982@noindent 4983Disadvantages: 4984 4985@itemize @bullet 4986@item 4987Old releases cannot easily be fetched from the 4988repository. (The file will show up as @var{new} even 4989in revisions from the time before it was renamed). 4990 4991@item 4992There is no log information of when the file was renamed. 4993 4994@item 4995Nasty things might happen if someone accesses the history file 4996while you are moving it. Make sure no one else runs any of the @sc{cvs} 4997commands while you move it. 4998@end itemize 4999 5000@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5001@node Rename by copying 5002@subsection Copying the history file 5003 5004This way also involves direct modifications to the 5005repository. It is safe, but not without drawbacks. 5006 5007@example 5008# @r{Copy the @sc{rcs} file inside the repository} 5009$ cd $CVSROOT/@var{dir} 5010$ cp @var{old},v @var{new},v 5011# @r{Remove the old file} 5012$ cd ~/@var{dir} 5013$ rm @var{old} 5014$ cvs remove @var{old} 5015$ cvs commit @var{old} 5016# @r{Remove all tags from @var{new}} 5017$ cvs update @var{new} 5018$ cvs log @var{new} # @r{Remember the non-branch tag names} 5019$ cvs tag -d @var{tag1} @var{new} 5020$ cvs tag -d @var{tag2} @var{new} 5021@dots{} 5022@end example 5023 5024By removing the tags you will be able to check out old 5025revisions. 5026 5027@noindent 5028Advantages: 5029 5030@itemize @bullet 5031@item 5032@c FIXME: Is this true about -D now that we have death 5033@c support? See 5B.3 in the FAQ. 5034Checking out old revisions works correctly, as long as 5035you use @samp{-r@var{tag}} and not @samp{-D@var{date}} 5036to retrieve the revisions. 5037 5038@item 5039The log of changes is maintained intact. 5040 5041@item 5042The revision numbers are not affected. 5043@end itemize 5044 5045@noindent 5046Disadvantages: 5047 5048@itemize @bullet 5049@item 5050You cannot easily see the history of the file across the rename. 5051 5052@ignore 5053@c Is this true? I don't see how the revision numbers 5054@c _could_ start over, when new,v is just old,v with 5055@c the tags deleted. 5056@c If there is some need to reinstate this text, 5057@c it is "usually 1.1", not "1.0" and it needs an 5058@c xref to Assigning revisions 5059@item 5060Unless you use the @samp{-r rev} (@pxref{commit 5061options}) flag when @var{new} is committed its revision 5062numbers will start at 1.0 again. 5063@end ignore 5064@end itemize 5065 5066@c --------------------------------------------------------------------- 5067@node Moving directories 5068@section Moving and renaming directories 5069@cindex Moving directories 5070@cindex Renaming directories 5071@cindex Directories, moving 5072 5073The normal way to rename or move a directory is to 5074rename or move each file within it as described in 5075@ref{Outside}. Then check out with the @samp{-P} 5076option, as described in @ref{Removing directories}. 5077 5078If you really want to hack the repository to rename or 5079delete a directory in the repository, you can do it 5080like this: 5081 5082@enumerate 5083@item 5084Inform everyone who has a checked out copy of the directory that the 5085directory will be renamed. They should commit all 5086their changes, and remove their working copies, 5087before you take the steps below. 5088 5089@item 5090Rename the directory inside the repository. 5091 5092@example 5093$ cd $CVSROOT/@var{parent-dir} 5094$ mv @var{old-dir} @var{new-dir} 5095@end example 5096 5097@item 5098Fix the @sc{cvs} administrative files, if necessary (for 5099instance if you renamed an entire module). 5100 5101@item 5102Tell everyone that they can check out again and continue 5103working. 5104 5105@end enumerate 5106 5107If someone had a working copy the @sc{cvs} commands will 5108cease to work for him, until he removes the directory 5109that disappeared inside the repository. 5110 5111It is almost always better to move the files in the 5112directory instead of moving the directory. If you move the 5113directory you are unlikely to be able to retrieve old 5114releases correctly, since they probably depend on the 5115name of the directories. 5116 5117@c --------------------------------------------------------------------- 5118@node History browsing 5119@chapter History browsing 5120@cindex History browsing 5121@cindex Traceability 5122@cindex Isolation 5123 5124@ignore 5125@c This is too long for an introduction (goal is 5126@c one 20x80 character screen), and also mixes up a 5127@c variety of issues (parallel development, history, 5128@c maybe even touches on process control). 5129 5130@c -- @quote{To lose ones history is to lose ones soul.} 5131@c -- /// 5132@c -- ///Those who cannot remember the past are condemned to repeat it. 5133@c -- /// -- George Santayana 5134@c -- /// 5135 5136@sc{cvs} tries to make it easy for a group of people to work 5137together. This is done in two ways: 5138 5139@itemize @bullet 5140@item 5141Isolation---You have your own working copy of the 5142source. You are not affected by modifications made by 5143others until you decide to incorporate those changes 5144(via the @code{update} command---@pxref{update}). 5145 5146@item 5147Traceability---When something has changed, you can 5148always see @emph{exactly} what changed. 5149@end itemize 5150 5151There are several features of @sc{cvs} that together lead 5152to traceability: 5153 5154@itemize @bullet 5155@item 5156Each revision of a file has an accompanying log 5157message. 5158 5159@item 5160All commits are optionally logged to a central history 5161database. 5162 5163@item 5164Logging information can be sent to a user-defined 5165program (@pxref{loginfo}). 5166@end itemize 5167 5168@c -- More text here. 5169 5170This chapter should talk about the history file, the 5171@code{log} command, the usefulness of ChangeLogs 5172even when you run @sc{cvs}, and things like that. 5173 5174@end ignore 5175 5176@c kind of lame, in a lot of ways the above text inside 5177@c the @ignore motivates this chapter better 5178Once you have used @sc{cvs} to store a version control 5179history---what files have changed when, how, and by 5180whom, there are a variety of mechanisms for looking 5181through the history. 5182 5183@c FIXME: should also be talking about how you look at 5184@c old revisions (e.g. "cvs update -p -r 1.2 foo.c"). 5185@menu 5186* log messages:: Log messages 5187* history database:: The history database 5188* user-defined logging:: User-defined logging 5189* annotate:: What revision modified each line of a file? 5190@end menu 5191 5192@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5193@node log messages 5194@section Log messages 5195 5196@c FIXME: @xref to place where we talk about how to 5197@c specify message to commit. 5198Whenever you commit a file you specify a log message. 5199 5200@c FIXME: bring the information here, and get rid of or 5201@c greatly shrink the "log" node. 5202To look through the log messages which have been 5203specified for every revision which has been committed, 5204use the @code{cvs log} command (@pxref{log}). 5205 5206@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5207@node history database 5208@section The history database 5209 5210@c FIXME: bring the information from the history file 5211@c and history nodes here. Rewrite it to be motivated 5212@c better (start out by clearly explaining what gets 5213@c logged in history, for example). 5214You can use the history file (@pxref{history file}) to 5215log various @sc{cvs} actions. To retrieve the 5216information from the history file, use the @code{cvs 5217history} command (@pxref{history}). 5218 5219Note: you can control what is logged to this file by using the 5220@samp{LogHistory} keyword in the @file{CVSROOT/config} file 5221(@pxref{config}). 5222 5223@c 5224@c The history database has many problems: 5225@c * It is very unclear what field means what. This 5226@c could be improved greatly by better documentation, 5227@c but there are still non-orthogonalities (for 5228@c example, tag does not record the "repository" 5229@c field but most records do). 5230@c * Confusion about files, directories, and modules. 5231@c Some commands record one, some record others. 5232@c * File removal is not logged. There is an 'R' 5233@c record type documented, but CVS never uses it. 5234@c * Tags are only logged for the "cvs rtag" command, 5235@c not "cvs tag". The fix for this is not completely 5236@c clear (see above about modules vs. files). 5237@c * Are there other cases of operations that are not 5238@c logged? One would hope for all changes to the 5239@c repository to be logged somehow (particularly 5240@c operations like tagging, "cvs admin -k", and other 5241@c operations which do not record a history that one 5242@c can get with "cvs log"). Operations on the working 5243@c directory, like export, get, and release, are a 5244@c second category also covered by the current "cvs 5245@c history". 5246@c * The history file does not record the options given 5247@c to a command. The most serious manifestation of 5248@c this is perhaps that it doesn't record whether a command 5249@c was recursive. It is not clear to me whether one 5250@c wants to log at a level very close to the command 5251@c line, as a sort of way of logging each command 5252@c (more or less), or whether one wants 5253@c to log more at the level of what was changed (or 5254@c something in between), but either way the current 5255@c information has pretty big gaps. 5256@c * Further details about a tag--like whether it is a 5257@c branch tag or, if a non-branch tag, which branch it 5258@c is on. One can find out this information about the 5259@c tag as it exists _now_, but if the tag has been 5260@c moved, one doesn't know what it was like at the time 5261@c the history record was written. 5262@c * Whether operating on a particular tag, date, or 5263@c options was implicit (sticky) or explicit. 5264@c 5265@c Another item, only somewhat related to the above, is a 5266@c way to control what is logged in the history file. 5267@c This is probably the only good way to handle 5268@c different people having different ideas about 5269@c information/space tradeoffs. 5270@c 5271@c It isn't really clear that it makes sense to try to 5272@c patch up the history file format as it exists now to 5273@c include all that stuff. It might be better to 5274@c design a whole new CVSROOT/nhistory file and "cvs 5275@c nhistory" command, or some such, or in some other 5276@c way trying to come up with a clean break from the 5277@c past, which can address the above concerns. Another 5278@c open question is how/whether this relates to 5279@c taginfo/loginfo/etc. 5280 5281@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5282@node user-defined logging 5283@section User-defined logging 5284 5285@c FIXME: should probably also mention the fact the -l 5286@c global option can disable most of the mechanisms 5287@c discussed here (why? What is the -l global option for?). 5288@c 5289@c FIXME: probably should centralize this information 5290@c here, at least to some extent. Maybe by moving the 5291@c loginfo, etc., nodes here and replacing 5292@c the "user-defined logging" node with one node for 5293@c each method. 5294You can customize @sc{cvs} to log various kinds of 5295actions, in whatever manner you choose. These 5296mechanisms operate by executing a script at various 5297times. The script might append a message to a file 5298listing the information and the programmer who created 5299it, or send mail to a group of developers, or, perhaps, 5300post a message to a particular newsgroup. To log 5301commits, use the @file{loginfo} file (@pxref{loginfo}). 5302@c FIXME: What is difference between doing it in the 5303@c modules file and using loginfo/taginfo? Why should 5304@c user use one or the other? 5305To log commits, checkouts, exports, and tags, 5306respectively, you can also use the @samp{-i}, 5307@samp{-o}, @samp{-e}, and @samp{-t} options in the 5308modules file. For a more flexible way of giving 5309notifications to various users, which requires less in 5310the way of keeping centralized scripts up to date, use 5311the @code{cvs watch add} command (@pxref{Getting 5312Notified}); this command is useful even if you are not 5313using @code{cvs watch on}. 5314 5315@cindex taginfo 5316@cindex Exit status, of taginfo 5317The @file{taginfo} file defines programs to execute 5318when someone executes a @code{tag} or @code{rtag} 5319command. The @file{taginfo} file has the standard form 5320for administrative files (@pxref{Administrative 5321files}), where each line is a regular expression 5322followed by a command to execute. The arguments passed 5323to the command are, in order, the @var{tagname}, 5324@var{operation} (@code{add} for @code{tag}, 5325@code{mov} for @code{tag -F}, and @code{del} for 5326@code{tag -d}), @var{repository}, and any remaining are 5327pairs of @var{filename} @var{revision}. A non-zero 5328exit of the filter program will cause the tag to be 5329aborted. 5330 5331Here is an example of using taginfo to log tag and rtag 5332commands. In the taginfo file put: 5333 5334@example 5335ALL /usr/local/cvsroot/CVSROOT/loggit 5336@end example 5337 5338Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the 5339following script: 5340 5341@example 5342#!/bin/sh 5343echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog 5344@end example 5345 5346@node annotate 5347@section Annotate command 5348@cindex annotate (subcommand) 5349 5350@deffn Command {cvs annotate} [@code{-flR}] [@code{-r rev}|@code{-D date}] files @dots{} 5351 5352For each file in @var{files}, print the head revision 5353of the trunk, together with information on the last 5354modification for each line. For example: 5355 5356@example 5357$ cvs annotate ssfile 5358Annotations for ssfile 5359*************** 53601.1 (mary 27-Mar-96): ssfile line 1 53611.2 (joe 28-Mar-96): ssfile line 2 5362@end example 5363 5364The file @file{ssfile} currently contains two lines. 5365The @code{ssfile line 1} line was checked in by 5366@code{mary} on March 27. Then, on March 28, @code{joe} 5367added a line @code{ssfile line 2}, without modifying 5368the @code{ssfile line 1} line. This report doesn't 5369tell you anything about lines which have been deleted 5370or replaced; you need to use @code{cvs diff} for that 5371(@pxref{diff}). 5372 5373@end deffn 5374 5375The options to @code{cvs annotate} are listed in 5376@ref{Invoking CVS}, and can be used to select the files 5377and revisions to annotate. The options are described 5378in more detail in @ref{Common options}. 5379 5380@c FIXME: maybe an example using the options? Just 5381@c what it means to select a revision might be worth a 5382@c few words of explanation ("you want to see who 5383@c changed this line *before* 1.4"...). 5384 5385@c --------------------------------------------------------------------- 5386@node Binary files 5387@chapter Handling binary files 5388@cindex Binary files 5389 5390The most common use for @sc{cvs} is to store text 5391files. With text files, @sc{cvs} can merge revisions, 5392display the differences between revisions in a 5393human-visible fashion, and other such operations. 5394However, if you are willing to give up a few of these 5395abilities, @sc{cvs} can store binary files. For 5396example, one might store a web site in @sc{cvs} 5397including both text files and binary images. 5398 5399@menu 5400* Binary why:: More details on issues with binary files 5401* Binary howto:: How to store them 5402@end menu 5403 5404@node Binary why 5405@section The issues with binary files 5406 5407While the need to manage binary files may seem obvious 5408if the files that you customarily work with are binary, 5409putting them into version control does present some 5410additional issues. 5411 5412One basic function of version control is to show the 5413differences between two revisions. For example, if 5414someone else checked in a new version of a file, you 5415may wish to look at what they changed and determine 5416whether their changes are good. For text files, 5417@sc{cvs} provides this functionality via the @code{cvs 5418diff} command. For binary files, it may be possible to 5419extract the two revisions and then compare them with a 5420tool external to @sc{cvs} (for example, word processing 5421software often has such a feature). If there is no 5422such tool, one must track changes via other mechanisms, 5423such as urging people to write good log messages, and 5424hoping that the changes they actually made were the 5425changes that they intended to make. 5426 5427Another ability of a version control system is the 5428ability to merge two revisions. For @sc{cvs} this 5429happens in two contexts. The first is when users make 5430changes in separate working directories 5431(@pxref{Multiple developers}). The second is when one 5432merges explicitly with the @samp{update -j} command 5433(@pxref{Branching and merging}). 5434 5435In the case of text 5436files, @sc{cvs} can merge changes made independently, 5437and signal a conflict if the changes conflict. With 5438binary files, the best that @sc{cvs} can do is present 5439the two different copies of the file, and leave it to 5440the user to resolve the conflict. The user may choose 5441one copy or the other, or may run an external merge 5442tool which knows about that particular file format, if 5443one exists. 5444Note that having the user merge relies primarily on the 5445user to not accidentally omit some changes, and thus is 5446potentially error prone. 5447 5448If this process is thought to be undesirable, the best 5449choice may be to avoid merging. To avoid the merges 5450that result from separate working directories, see the 5451discussion of reserved checkouts (file locking) in 5452@ref{Multiple developers}. To avoid the merges 5453resulting from branches, restrict use of branches. 5454 5455@node Binary howto 5456@section How to store binary files 5457 5458There are two issues with using @sc{cvs} to store 5459binary files. The first is that @sc{cvs} by default 5460converts line endings between the canonical form in 5461which they are stored in the repository (linefeed 5462only), and the form appropriate to the operating system 5463in use on the client (for example, carriage return 5464followed by line feed for Windows NT). 5465 5466The second is that a binary file might happen to 5467contain data which looks like a keyword (@pxref{Keyword 5468substitution}), so keyword expansion must be turned 5469off. 5470 5471@c FIXME: the third is that one can't do merges with 5472@c binary files. xref to Multiple Developers and the 5473@c reserved checkout issues. 5474 5475The @samp{-kb} option available with some @sc{cvs} 5476commands insures that neither line ending conversion 5477nor keyword expansion will be done. 5478 5479Here is an example of how you can create a new file 5480using the @samp{-kb} flag: 5481 5482@example 5483$ echo '$@asis{}Id$' > kotest 5484$ cvs add -kb -m"A test file" kotest 5485$ cvs ci -m"First checkin; contains a keyword" kotest 5486@end example 5487 5488If a file accidentally gets added without @samp{-kb}, 5489one can use the @code{cvs admin} command to recover. 5490For example: 5491 5492@example 5493$ echo '$@asis{}Id$' > kotest 5494$ cvs add -m"A test file" kotest 5495$ cvs ci -m"First checkin; contains a keyword" kotest 5496$ cvs admin -kb kotest 5497$ cvs update -A kotest 5498# @r{For non-unix systems:} 5499# @r{Copy in a good copy of the file from outside CVS} 5500$ cvs commit -m "make it binary" kotest 5501@end example 5502 5503@c Trying to describe this for both unix and non-unix 5504@c in the same description is very confusing. Might 5505@c want to split the two, or just ditch the unix "shortcut" 5506@c (unixheads don't do much with binary files, anyway). 5507@c This used to say "(Try the above example, and do a 5508@c @code{cat kotest} after every command)". But that 5509@c only really makes sense for the unix case. 5510When you check in the file @file{kotest} the file is 5511not preserved as a binary file, because you did not 5512check it in as a binary file. The @code{cvs 5513admin -kb} command sets the default keyword 5514substitution method for this file, but it does not 5515alter the working copy of the file that you have. If you need to 5516cope with line endings (that is, you are using 5517@sc{cvs} on a non-unix system), then you need to 5518check in a new copy of the file, as shown by the 5519@code{cvs commit} command above. 5520On unix, the @code{cvs update -A} command suffices. 5521@c FIXME: should also describe what the *other users* 5522@c need to do, if they have checked out copies which 5523@c have been corrupted by lack of -kb. I think maybe 5524@c "cvs update -kb" or "cvs 5525@c update -A" would suffice, although the user who 5526@c reported this suggested removing the file, manually 5527@c removing it from CVS/Entries, and then "cvs update" 5528 5529However, in using @code{cvs admin -k} to change the 5530keyword expansion, be aware that the keyword expansion 5531mode is not version controlled. This means that, for 5532example, that if you have a text file in old releases, 5533and a binary file with the same name in new releases, 5534@sc{cvs} provides no way to check out the file in text 5535or binary mode depending on what version you are 5536checking out. There is no good workaround for this 5537problem. 5538 5539You can also set a default for whether @code{cvs add} 5540and @code{cvs import} treat a file as binary based on 5541its name; for example you could say that files who 5542names end in @samp{.exe} are binary. @xref{Wrappers}. 5543There is currently no way to have @sc{cvs} detect 5544whether a file is binary based on its contents. The 5545main difficulty with designing such a feature is that 5546it is not clear how to distinguish between binary and 5547non-binary files, and the rules to apply would vary 5548considerably with the operating system. 5549@c For example, it would be good on MS-DOS-family OSes 5550@c for anything containing ^Z to be binary. Having 5551@c characters with the 8th bit set imply binary is almost 5552@c surely a bad idea in the context of ISO-8859-* and 5553@c other such character sets. On VMS or the Mac, we 5554@c could use the OS's file typing. This is a 5555@c commonly-desired feature, and something of this sort 5556@c may make sense. But there are a lot of pitfalls here. 5557@c 5558@c Another, probably better, way to tell is to read the 5559@c file in text mode, write it to a temp file in text 5560@c mode, and then do a binary mode compare of the two 5561@c files. If they differ, it is a binary file. This 5562@c might have problems on VMS (or some other system 5563@c with several different text modes), but in general 5564@c should be relatively portable. The only other 5565@c downside I can think of is that it would be fairly 5566@c slow, but that is perhaps a small price to pay for 5567@c not having your files corrupted. Another issue is 5568@c what happens if you import a text file with bare 5569@c linefeeds on Windows. Such files will show up on 5570@c Windows sometimes (I think some native windows 5571@c programs even write them, on occasion). Perhaps it 5572@c is reasonable to treat such files as binary; after 5573@c all it is something of a presumption to assume that 5574@c the user would want the linefeeds converted to CRLF. 5575 5576@c --------------------------------------------------------------------- 5577@node Multiple developers 5578@chapter Multiple developers 5579@cindex Multiple developers 5580@cindex Team of developers 5581@cindex File locking 5582@cindex Locking files 5583@cindex Working copy 5584@cindex Reserved checkouts 5585@cindex Unreserved checkouts 5586@cindex RCS-style locking 5587 5588When more than one person works on a software project 5589things often get complicated. Often, two people try to 5590edit the same file simultaneously. One solution, known 5591as @dfn{file locking} or @dfn{reserved checkouts}, is 5592to allow only one person to edit each file at a time. 5593This is the only solution with some version control 5594systems, including @sc{rcs} and @sc{sccs}. Currently 5595the usual way to get reserved checkouts with @sc{cvs} 5596is the @code{cvs admin -l} command (@pxref{admin 5597options}). This is not as nicely integrated into 5598@sc{cvs} as the watch features, described below, but it 5599seems that most people with a need for reserved 5600checkouts find it adequate. 5601@c Or "find it better than worrying about implementing 5602@c nicely integrated reserved checkouts" or ...? 5603It also may be possible to use the watches 5604features described below, together with suitable 5605procedures (not enforced by software), to avoid having 5606two people edit at the same time. 5607 5608@c Our unreserved checkout model might not 5609@c be quite the same as others. For example, I 5610@c think that some systems will tend to create a branch 5611@c in the case where CVS prints "up-to-date check failed". 5612@c It isn't clear to me whether we should try to 5613@c explore these subtleties; it could easily just 5614@c confuse people. 5615The default model with @sc{cvs} is known as 5616@dfn{unreserved checkouts}. In this model, developers 5617can edit their own @dfn{working copy} of a file 5618simultaneously. The first person that commits his 5619changes has no automatic way of knowing that another 5620has started to edit it. Others will get an error 5621message when they try to commit the file. They must 5622then use @sc{cvs} commands to bring their working copy 5623up to date with the repository revision. This process 5624is almost automatic. 5625 5626@c FIXME? should probably use the word "watch" here, to 5627@c tie this into the text below and above. 5628@sc{cvs} also supports mechanisms which facilitate 5629various kinds of communication, without actually 5630enforcing rules like reserved checkouts do. 5631 5632The rest of this chapter describes how these various 5633models work, and some of the issues involved in 5634choosing between them. 5635 5636@ignore 5637Here is a draft reserved checkout design or discussion 5638of the issues. This seems like as good a place as any 5639for this. 5640 5641Might want a cvs lock/cvs unlock--in which the names 5642differ from edit/unedit because the network must be up 5643for these to work. unedit gives an error if there is a 5644reserved checkout in place (so that people don't 5645accidentally leave locks around); unlock gives an error 5646if one is not in place (this is more arguable; perhaps 5647it should act like unedit in that case). 5648 5649On the other hand, might want it so that emacs, 5650scripts, etc., can get ready to edit a file without 5651having to know which model is in use. In that case we 5652would have a "cvs watch lock" (or .cvsrc?) (that is, 5653three settings, "on", "off", and "lock"). Having cvs 5654watch lock set would cause a get to record in the CVS 5655directory which model is in use, and cause "cvs edit" 5656to change behaviors. We'd want a way to query which 5657setting is in effect (this would be handy even if it is 5658only "on" or "off" as presently). If lock is in 5659effect, then commit would require a lock before 5660allowing a checkin; chmod wouldn't suffice (might be 5661debatable--see chmod comment below, in watches--but it 5662is the way people expect RCS to work and I can't think 5663of any significant downside. On the other hand, maybe 5664it isn't worth bothering, because people who are used 5665to RCS wouldn't think to use chmod anyway). 5666 5667Implementation: use file attributes or use RCS 5668locking. The former avoids more dependence on RCS 5669behaviors we will need to reimplement as we librarify 5670RCS, and makes it easier to import/export RCS files (in 5671that context, want to ignore the locker field). But 5672note that RCS locks are per-branch, which is the 5673correct behavior (this is also an issue for the "watch 5674on" features; they should be per-branch too). 5675 5676Here are a few more random notes about implementation 5677details, assuming "cvs watch lock" and 5678 5679CVS/Watched file? Or try to fit this into CVS/Entries somehow? 5680Cases: (1) file is checked out (unreserved or with watch on) by old 5681version of @sc{cvs}, now we do something with new one, (2) file is checked 5682out by new version, now we do something with old one. 5683 5684Remote protocol would have a "Watched" analogous to "Mode". Of course 5685it would apply to all Updated-like requests. How do we keep this 5686setting up to date? I guess that there wants to be a Watched request, 5687and the server would send a new one if it isn't up to date? (Ugh--hard 5688to implement and slows down "cvs -q update"--is there an easier way?) 5689 5690"cvs edit"--checks CVS/Watched, and if watch lock, then sends 5691"edit-lock" request. Which comes back with a Checked-in with 5692appropriate Watched (off, on, lock, locked, or some such?), or error 5693message if already locked. 5694 5695"cvs commit"--only will commit if off/on/locked. lock is not OK. 5696 5697Doc: 5698note that "cvs edit" must be connected to network if watch lock is in 5699effect. 5700 5701Talk about what to do if someone has locked a file and you want to 5702edit that file. (breaking locks, or lack thereof). 5703 5704 5705One other idea (which could work along with the 5706existing "cvs admin -l" reserved checkouts, as well as 5707the above): 5708 5709"cvs editors" could show who has the file locked, if 5710someone does. 5711 5712@end ignore 5713 5714@menu 5715* File status:: A file can be in several states 5716* Updating a file:: Bringing a file up-to-date 5717* Conflicts example:: An informative example 5718* Informing others:: To cooperate you must inform 5719* Concurrency:: Simultaneous repository access 5720* Watches:: Mechanisms to track who is editing files 5721* Choosing a model:: Reserved or unreserved checkouts? 5722@end menu 5723 5724@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5725@node File status 5726@section File status 5727@cindex File status 5728@cindex Status of a file 5729 5730@c Shouldn't this start with an example or something, 5731@c introducing the unreserved checkout model? Before we 5732@c dive into listing states? 5733Based on what operations you have performed on a 5734checked out file, and what operations others have 5735performed to that file in the repository, one can 5736classify a file in a number of states. The states, as 5737reported by the @code{status} command, are: 5738 5739@c The order of items is chosen to group logically 5740@c similar outputs together. 5741@c People who want alphabetical can use the index... 5742@table @asis 5743@cindex Up-to-date 5744@item Up-to-date 5745The file is identical with the latest revision in the 5746repository for the branch in use. 5747@c FIXME: should we clarify "in use"? The answer is 5748@c sticky tags, and trying to distinguish branch sticky 5749@c tags from non-branch sticky tags seems rather awkward 5750@c here. 5751@c FIXME: What happens with non-branch sticky tags? Is 5752@c a stuck file "Up-to-date" or "Needs checkout" or what? 5753 5754@item Locally Modified 5755@cindex Locally Modified 5756You have edited the file, and not yet committed your changes. 5757 5758@item Locally Added 5759@cindex Locally Added 5760You have added the file with @code{add}, and not yet 5761committed your changes. 5762@c There are many cases involving the file being 5763@c added/removed/modified in the working directory, and 5764@c added/removed/modified in the repository, which we 5765@c don't try to describe here. I'm not sure that "cvs 5766@c status" produces a non-confusing output in most of 5767@c those cases. 5768 5769@item Locally Removed 5770@cindex Locally Removed 5771You have removed the file with @code{remove}, and not yet 5772committed your changes. 5773 5774@item Needs Checkout 5775@cindex Needs Checkout 5776Someone else has committed a newer revision to the 5777repository. The name is slightly misleading; you will 5778ordinarily use @code{update} rather than 5779@code{checkout} to get that newer revision. 5780 5781@item Needs Patch 5782@cindex Needs Patch 5783@c See also newb-123j0 in sanity.sh (although that case 5784@c should probably be changed rather than documented). 5785Like Needs Checkout, but the @sc{cvs} server will send 5786a patch rather than the entire file. Sending a patch or 5787sending an entire file accomplishes the same thing. 5788 5789@item Needs Merge 5790@cindex Needs Merge 5791Someone else has committed a newer revision to the repository, and you 5792have also made modifications to the file. 5793 5794@item File had conflicts on merge 5795@cindex File had conflicts on merge 5796@c is it worth saying that this message was "Unresolved 5797@c Conflict" in CVS 1.9 and earlier? I'm inclined to 5798@c think that is unnecessarily confusing to new users. 5799This is like Locally Modified, except that a previous 5800@code{update} command gave a conflict. If you have not 5801already done so, you need to 5802resolve the conflict as described in @ref{Conflicts example}. 5803 5804@item Unknown 5805@cindex Unknown 5806@sc{cvs} doesn't know anything about this file. For 5807example, you have created a new file and have not run 5808@code{add}. 5809@c 5810@c "Entry Invalid" and "Classify Error" are also in the 5811@c status.c. The latter definitely indicates a CVS bug 5812@c (should it be worded more like "internal error" so 5813@c people submit bug reports if they see it?). The former 5814@c I'm not as sure; I haven't tracked down whether/when it 5815@c appears in "cvs status" output. 5816 5817@end table 5818 5819To help clarify the file status, @code{status} also 5820reports the @code{Working revision} which is the 5821revision that the file in the working directory derives 5822from, and the @code{Repository revision} which is the 5823latest revision in the repository for the branch in 5824use. 5825@c FIXME: should we clarify "in use"? The answer is 5826@c sticky tags, and trying to distinguish branch sticky 5827@c tags from non-branch sticky tags seems rather awkward 5828@c here. 5829@c FIXME: What happens with non-branch sticky tags? 5830@c What is the Repository Revision there? See the 5831@c comment at vn_rcs in cvs.h, which is kind of 5832@c confused--we really need to document better what this 5833@c field contains. 5834@c Q: Should we document "New file!" and other such 5835@c outputs or are they self-explanatory? 5836@c FIXME: what about the date to the right of "Working 5837@c revision"? It doesn't appear with client/server and 5838@c seems unnecessary (redundant with "ls -l") so 5839@c perhaps it should be removed for non-client/server too? 5840@c FIXME: Need some examples. 5841@c FIXME: Working revision can also be something like 5842@c "-1.3" for a locally removed file. Not at all 5843@c self-explanatory (and it is possible that CVS should 5844@c be changed rather than documenting this). 5845 5846@c Would be nice to have an @example showing output 5847@c from cvs status, with comments showing the xref 5848@c where each part of the output is described. This 5849@c might fit in nicely if it is desirable to split this 5850@c node in two; one to introduce "cvs status" and one 5851@c to list each of the states. 5852The options to @code{status} are listed in 5853@ref{Invoking CVS}. For information on its @code{Sticky tag} 5854and @code{Sticky date} output, see @ref{Sticky tags}. 5855For information on its @code{Sticky options} output, 5856see the @samp{-k} option in @ref{update options}. 5857 5858You can think of the @code{status} and @code{update} 5859commands as somewhat complementary. You use 5860@code{update} to bring your files up to date, and you 5861can use @code{status} to give you some idea of what an 5862@code{update} would do (of course, the state of the 5863repository might change before you actually run 5864@code{update}). In fact, if you want a command to 5865display file status in a more brief format than is 5866displayed by the @code{status} command, you can invoke 5867 5868@cindex update, to display file status 5869@example 5870$ cvs -n -q update 5871@end example 5872 5873The @samp{-n} option means to not actually do the 5874update, but merely to display statuses; the @samp{-q} 5875option avoids printing the name of each directory. For 5876more information on the @code{update} command, and 5877these options, see @ref{Invoking CVS}. 5878 5879@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5880@node Updating a file 5881@section Bringing a file up to date 5882@cindex Bringing a file up to date 5883@cindex Updating a file 5884@cindex Merging a file 5885@cindex Update, introduction 5886 5887When you want to update or merge a file, use the @code{update} 5888command. For files that are not up to date this is roughly equivalent 5889to a @code{checkout} command: the newest revision of the file is 5890extracted from the repository and put in your working directory. 5891 5892Your modifications to a file are never lost when you 5893use @code{update}. If no newer revision exists, 5894running @code{update} has no effect. If you have 5895edited the file, and a newer revision is available, 5896@sc{cvs} will merge all changes into your working copy. 5897 5898For instance, imagine that you checked out revision 1.4 and started 5899editing it. In the meantime someone else committed revision 1.5, and 5900shortly after that revision 1.6. If you run @code{update} on the file 5901now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into 5902your file. 5903 5904@cindex Overlap 5905If any of the changes between 1.4 and 1.6 were made too 5906close to any of the changes you have made, an 5907@dfn{overlap} occurs. In such cases a warning is 5908printed, and the resulting file includes both 5909versions of the lines that overlap, delimited by 5910special markers. 5911@xref{update}, for a complete description of the 5912@code{update} command. 5913 5914@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5915@node Conflicts example 5916@section Conflicts example 5917@cindex Merge, an example 5918@cindex Example of merge 5919@cindex driver.c (merge example) 5920 5921Suppose revision 1.4 of @file{driver.c} contains this: 5922 5923@example 5924#include <stdio.h> 5925 5926void main() 5927@{ 5928 parse(); 5929 if (nerr == 0) 5930 gencode(); 5931 else 5932 fprintf(stderr, "No code generated.\n"); 5933 exit(nerr == 0 ? 0 : 1); 5934@} 5935@end example 5936 5937@noindent 5938Revision 1.6 of @file{driver.c} contains this: 5939 5940@example 5941#include <stdio.h> 5942 5943int main(int argc, 5944 char **argv) 5945@{ 5946 parse(); 5947 if (argc != 1) 5948 @{ 5949 fprintf(stderr, "tc: No args expected.\n"); 5950 exit(1); 5951 @} 5952 if (nerr == 0) 5953 gencode(); 5954 else 5955 fprintf(stderr, "No code generated.\n"); 5956 exit(!!nerr); 5957@} 5958@end example 5959 5960@noindent 5961Your working copy of @file{driver.c}, based on revision 59621.4, contains this before you run @samp{cvs update}: 5963@c -- Really include "cvs"? 5964 5965@example 5966#include <stdlib.h> 5967#include <stdio.h> 5968 5969void main() 5970@{ 5971 init_scanner(); 5972 parse(); 5973 if (nerr == 0) 5974 gencode(); 5975 else 5976 fprintf(stderr, "No code generated.\n"); 5977 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 5978@} 5979@end example 5980 5981@noindent 5982You run @samp{cvs update}: 5983@c -- Really include "cvs"? 5984 5985@example 5986$ cvs update driver.c 5987RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v 5988retrieving revision 1.4 5989retrieving revision 1.6 5990Merging differences between 1.4 and 1.6 into driver.c 5991rcsmerge warning: overlaps during merge 5992cvs update: conflicts found in driver.c 5993C driver.c 5994@end example 5995 5996@noindent 5997@cindex Conflicts (merge example) 5998@sc{cvs} tells you that there were some conflicts. 5999Your original working file is saved unmodified in 6000@file{.#driver.c.1.4}. The new version of 6001@file{driver.c} contains this: 6002 6003@example 6004#include <stdlib.h> 6005#include <stdio.h> 6006 6007int main(int argc, 6008 char **argv) 6009@{ 6010 init_scanner(); 6011 parse(); 6012 if (argc != 1) 6013 @{ 6014 fprintf(stderr, "tc: No args expected.\n"); 6015 exit(1); 6016 @} 6017 if (nerr == 0) 6018 gencode(); 6019 else 6020 fprintf(stderr, "No code generated.\n"); 6021@asis{}<<<<<<< driver.c 6022 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6023@asis{}======= 6024 exit(!!nerr); 6025@asis{}>>>>>>> 1.6 6026@} 6027@end example 6028 6029@noindent 6030@cindex Markers, conflict 6031@cindex Conflict markers 6032@cindex <<<<<<< 6033@cindex >>>>>>> 6034@cindex ======= 6035 6036Note how all non-overlapping modifications are incorporated in your working 6037copy, and that the overlapping section is clearly marked with 6038@samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}. 6039 6040@cindex Resolving a conflict 6041@cindex Conflict resolution 6042You resolve the conflict by editing the file, removing the markers and 6043the erroneous line. Suppose you end up with this file: 6044@c -- Add xref to the pcl-cvs manual when it talks 6045@c -- about this. 6046@example 6047#include <stdlib.h> 6048#include <stdio.h> 6049 6050int main(int argc, 6051 char **argv) 6052@{ 6053 init_scanner(); 6054 parse(); 6055 if (argc != 1) 6056 @{ 6057 fprintf(stderr, "tc: No args expected.\n"); 6058 exit(1); 6059 @} 6060 if (nerr == 0) 6061 gencode(); 6062 else 6063 fprintf(stderr, "No code generated.\n"); 6064 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6065@} 6066@end example 6067 6068@noindent 6069You can now go ahead and commit this as revision 1.7. 6070 6071@example 6072$ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c 6073Checking in driver.c; 6074/usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c 6075new revision: 1.7; previous revision: 1.6 6076done 6077@end example 6078 6079For your protection, @sc{cvs} will refuse to check in a 6080file if a conflict occurred and you have not resolved 6081the conflict. Currently to resolve a conflict, you 6082must change the timestamp on the file. In previous 6083versions of @sc{cvs}, you also needed to 6084insure that the file contains no conflict markers. 6085Because 6086your file may legitimately contain conflict markers (that 6087is, occurrences of @samp{>>>>>>> } at the start of a 6088line that don't mark a conflict), the current 6089version of @sc{cvs} will print a warning and proceed to 6090check in the file. 6091@c The old behavior was really icky; the only way out 6092@c was to start hacking on 6093@c the @code{CVS/Entries} file or other such workarounds. 6094@c 6095@c If the timestamp thing isn't considered nice enough, 6096@c maybe there should be a "cvs resolved" command 6097@c which clears the conflict indication. For a nice user 6098@c interface, this should be invoked by an interactive 6099@c merge tool like emerge rather than by the user 6100@c directly--such a tool can verify that the user has 6101@c really dealt with each conflict. 6102 6103@cindex emerge 6104If you use release 1.04 or later of pcl-cvs (a @sc{gnu} 6105Emacs front-end for @sc{cvs}) you can use an Emacs 6106package called emerge to help you resolve conflicts. 6107See the documentation for pcl-cvs. 6108 6109@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6110@node Informing others 6111@section Informing others about commits 6112@cindex Informing others 6113@cindex Spreading information 6114@cindex Mail, automatic mail on commit 6115 6116It is often useful to inform others when you commit a 6117new revision of a file. The @samp{-i} option of the 6118@file{modules} file, or the @file{loginfo} file, can be 6119used to automate this process. @xref{modules}. 6120@xref{loginfo}. You can use these features of @sc{cvs} 6121to, for instance, instruct @sc{cvs} to mail a 6122message to all developers, or post a message to a local 6123newsgroup. 6124@c -- More text would be nice here. 6125 6126@node Concurrency 6127@section Several developers simultaneously attempting to run CVS 6128 6129@cindex Locks, cvs, introduction 6130@c For a discussion of *why* CVS creates locks, see 6131@c the comment at the start of src/lock.c 6132If several developers try to run @sc{cvs} at the same 6133time, one may get the following message: 6134 6135@example 6136[11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo 6137@end example 6138 6139@cindex #cvs.rfl, removing 6140@cindex #cvs.wfl, removing 6141@cindex #cvs.lock, removing 6142@sc{cvs} will try again every 30 seconds, and either 6143continue with the operation or print the message again, 6144if it still needs to wait. If a lock seems to stick 6145around for an undue amount of time, find the person 6146holding the lock and ask them about the cvs command 6147they are running. If they aren't running a cvs 6148command, look in the repository directory mentioned in 6149the message and remove files which they own whose names 6150start with @file{#cvs.rfl}, 6151@file{#cvs.wfl}, or @file{#cvs.lock}. 6152 6153Note that these locks are to protect @sc{cvs}'s 6154internal data structures and have no relationship to 6155the word @dfn{lock} in the sense used by 6156@sc{rcs}---which refers to reserved checkouts 6157(@pxref{Multiple developers}). 6158 6159Any number of people can be reading from a given 6160repository at a time; only when someone is writing do 6161the locks prevent other people from reading or writing. 6162 6163@cindex Atomic transactions, lack of 6164@cindex Transactions, atomic, lack of 6165@c the following talks about what one might call commit/update 6166@c atomicity. 6167@c Probably also should say something about 6168@c commit/commit atomicity, that is, "An update will 6169@c not get partial versions of more than one commit". 6170@c CVS currently has this property and I guess we can 6171@c make it a documented feature. 6172@c For example one person commits 6173@c a/one.c and b/four.c and another commits a/two.c and 6174@c b/three.c. Then an update cannot get the new a/one.c 6175@c and a/two.c and the old b/four.c and b/three.c. 6176One might hope for the following property 6177 6178@example 6179If someone commits some changes in one cvs command, 6180then an update by someone else will either get all the 6181changes, or none of them. 6182@end example 6183 6184but @sc{cvs} does @emph{not} have this property. For 6185example, given the files 6186 6187@example 6188a/one.c 6189a/two.c 6190b/three.c 6191b/four.c 6192@end example 6193 6194if someone runs 6195 6196@example 6197cvs ci a/two.c b/three.c 6198@end example 6199 6200and someone else runs @code{cvs update} at the same 6201time, the person running @code{update} might get only 6202the change to @file{b/three.c} and not the change to 6203@file{a/two.c}. 6204 6205@node Watches 6206@section Mechanisms to track who is editing files 6207@cindex Watches 6208 6209For many groups, use of @sc{cvs} in its default mode is 6210perfectly satisfactory. Users may sometimes go to 6211check in a modification only to find that another 6212modification has intervened, but they deal with it and 6213proceed with their check in. Other groups prefer to be 6214able to know who is editing what files, so that if two 6215people try to edit the same file they can choose to 6216talk about who is doing what when rather than be 6217surprised at check in time. The features in this 6218section allow such coordination, while retaining the 6219ability of two developers to edit the same file at the 6220same time. 6221 6222@c Some people might ask why CVS does not enforce the 6223@c rule on chmod, by requiring a cvs edit before a cvs 6224@c commit. The main reason is that it could always be 6225@c circumvented--one could edit the file, and 6226@c then when ready to check it in, do the cvs edit and put 6227@c in the new contents and do the cvs commit. One 6228@c implementation note: if we _do_ want to have cvs commit 6229@c require a cvs edit, we should store the state on 6230@c whether the cvs edit has occurred in the working 6231@c directory, rather than having the server try to keep 6232@c track of what working directories exist. 6233@c FIXME: should the above discussion be part of the 6234@c manual proper, somewhere, not just in a comment? 6235For maximum benefit developers should use @code{cvs 6236edit} (not @code{chmod}) to make files read-write to 6237edit them, and @code{cvs release} (not @code{rm}) to 6238discard a working directory which is no longer in use, 6239but @sc{cvs} is not able to enforce this behavior. 6240 6241@c I'm a little dissatisfied with this presentation, 6242@c because "watch on"/"edit"/"editors" are one set of 6243@c functionality, and "watch add"/"watchers" is another 6244@c which is somewhat orthogonal even though they interact in 6245@c various ways. But I think it might be 6246@c confusing to describe them separately (e.g. "watch 6247@c add" with loginfo). I don't know. 6248 6249@menu 6250* Setting a watch:: Telling CVS to watch certain files 6251* Getting Notified:: Telling CVS to notify you 6252* Editing files:: How to edit a file which is being watched 6253* Watch information:: Information about who is watching and editing 6254* Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier 6255@end menu 6256 6257@node Setting a watch 6258@subsection Telling CVS to watch certain files 6259 6260To enable the watch features, you first specify that 6261certain files are to be watched. 6262 6263@cindex watch on (subcommand) 6264@deffn Command {cvs watch on} [@code{-lR}] files @dots{} 6265 6266@cindex Read-only files, and watches 6267Specify that developers should run @code{cvs edit} 6268before editing @var{files}. @sc{cvs} will create working 6269copies of @var{files} read-only, to remind developers 6270to run the @code{cvs edit} command before working on 6271them. 6272 6273If @var{files} includes the name of a directory, @sc{cvs} 6274arranges to watch all files added to the corresponding 6275repository directory, and sets a default for files 6276added in the future; this allows the user to set 6277notification policies on a per-directory basis. The 6278contents of the directory are processed recursively, 6279unless the @code{-l} option is given. 6280The @code{-R} option can be used to force recursion if the @code{-l} 6281option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 6282 6283If @var{files} is omitted, it defaults to the current directory. 6284 6285@cindex watch off (subcommand) 6286@end deffn 6287 6288@deffn Command {cvs watch off} [@code{-lR}] files @dots{} 6289 6290Do not create @var{files} read-only on checkout; thus, 6291developers will not be reminded to use @code{cvs edit} 6292and @code{cvs unedit}. 6293@ignore 6294@sc{cvs} will check out @var{files} 6295read-write as usual, unless other permissions override 6296due to the @code{PreservePermissions} option being 6297enabled in the @file{config} administrative file 6298(@pxref{Special Files}, @pxref{config}) 6299@end ignore 6300 6301The @var{files} and options are processed as for @code{cvs 6302watch on}. 6303 6304@end deffn 6305 6306@node Getting Notified 6307@subsection Telling CVS to notify you 6308 6309You can tell @sc{cvs} that you want to receive 6310notifications about various actions taken on a file. 6311You can do this without using @code{cvs watch on} for 6312the file, but generally you will want to use @code{cvs 6313watch on}, so that developers use the @code{cvs edit} 6314command. 6315 6316@cindex watch add (subcommand) 6317@deffn Command {cvs watch add} [@code{-a} action] [@code{-lR}] files @dots{} 6318 6319Add the current user to the list of people to receive notification of 6320work done on @var{files}. 6321 6322The @code{-a} option specifies what kinds of events @sc{cvs} should notify 6323the user about. @var{action} is one of the following: 6324 6325@table @code 6326 6327@item edit 6328Another user has applied the @code{cvs edit} command (described 6329below) to a file. 6330 6331@item unedit 6332Another user has applied the @code{cvs unedit} command (described 6333below) or the @code{cvs release} command to a file, or has deleted 6334the file and allowed @code{cvs update} to recreate it. 6335 6336@item commit 6337Another user has committed changes to a file. 6338 6339@item all 6340All of the above. 6341 6342@item none 6343None of the above. (This is useful with @code{cvs edit}, 6344described below.) 6345 6346@end table 6347 6348The @code{-a} option may appear more than once, or not at all. If 6349omitted, the action defaults to @code{all}. 6350 6351The @var{files} and options are processed as for the 6352@code{cvs watch} commands. 6353 6354@end deffn 6355 6356 6357@cindex watch remove (subcommand) 6358@deffn Command {cvs watch remove} [@code{-a} action] [@code{-lR}] files @dots{} 6359 6360Remove a notification request established using @code{cvs watch add}; 6361the arguments are the same. If the @code{-a} option is present, only 6362watches for the specified actions are removed. 6363 6364@end deffn 6365 6366@cindex notify (admin file) 6367When the conditions exist for notification, @sc{cvs} 6368calls the @file{notify} administrative file. Edit 6369@file{notify} as one edits the other administrative 6370files (@pxref{Intro administrative files}). This 6371file follows the usual conventions for administrative 6372files (@pxref{syntax}), where each line is a regular 6373expression followed by a command to execute. The 6374command should contain a single occurrence of @samp{%s} 6375which will be replaced by the user to notify; the rest 6376of the information regarding the notification will be 6377supplied to the command on standard input. The 6378standard thing to put in the @code{notify} file is the 6379single line: 6380 6381@example 6382ALL mail %s -s "CVS notification" 6383@end example 6384 6385This causes users to be notified by electronic mail. 6386@c FIXME: should it be this hard to set up this 6387@c behavior (and the result when one fails to do so, 6388@c silent failure to notify, so non-obvious)? Should 6389@c CVS give a warning if no line in notify matches (and 6390@c document the use of "DEFAULT :" for the case where 6391@c skipping the notification is indeed desired)? 6392 6393@cindex users (admin file) 6394Note that if you set this up in the straightforward 6395way, users receive notifications on the server machine. 6396One could of course write a @file{notify} script which 6397directed notifications elsewhere, but to make this 6398easy, @sc{cvs} allows you to associate a notification 6399address for each user. To do so create a file 6400@file{users} in @file{CVSROOT} with a line for each 6401user in the format @var{user}:@var{value}. Then 6402instead of passing the name of the user to be notified 6403to @file{notify}, @sc{cvs} will pass the @var{value} 6404(normally an email address on some other machine). 6405 6406@sc{cvs} does not notify you for your own changes. 6407Currently this check is done based on whether the user 6408name of the person taking the action which triggers 6409notification matches the user name of the person 6410getting notification. In fact, in general, the watches 6411features only track one edit by each user. It probably 6412would be more useful if watches tracked each working 6413directory separately, so this behavior might be worth 6414changing. 6415@c "behavior might be worth changing" is an effort to 6416@c point to future directions while also not promising 6417@c that "they" (as in "why don't they fix CVS to....") 6418@c will do this. 6419@c one implementation issue is identifying whether a 6420@c working directory is same or different. Comparing 6421@c pathnames/hostnames is hopeless, but having the server 6422@c supply a serial number which the client stores in the 6423@c CVS directory as a magic cookie should work. 6424 6425@node Editing files 6426@subsection How to edit a file which is being watched 6427 6428@cindex Checkout, as term for getting ready to edit 6429Since a file which is being watched is checked out 6430read-only, you cannot simply edit it. To make it 6431read-write, and inform others that you are planning to 6432edit it, use the @code{cvs edit} command. Some systems 6433call this a @dfn{checkout}, but @sc{cvs} uses that term 6434for obtaining a copy of the sources (@pxref{Getting the 6435source}), an operation which those systems call a 6436@dfn{get} or a @dfn{fetch}. 6437@c Issue to think about: should we transition CVS 6438@c towards the "get" terminology? "cvs get" is already a 6439@c synonym for "cvs checkout" and that section of the 6440@c manual refers to "Getting the source". If this is 6441@c done, needs to be done gingerly (for example, we should 6442@c still accept "checkout" in .cvsrc files indefinitely 6443@c even if the CVS's messages are changed from "cvs checkout: " 6444@c to "cvs get: "). 6445@c There is a concern about whether "get" is not as 6446@c good for novices because it is a more general term 6447@c than "checkout" (and thus arguably harder to assign 6448@c a technical meaning for). 6449 6450@cindex edit (subcommand) 6451@deffn Command {cvs edit} [options] files @dots{} 6452 6453Prepare to edit the working files @var{files}. @sc{cvs} makes the 6454@var{files} read-write, and notifies users who have requested 6455@code{edit} notification for any of @var{files}. 6456 6457The @code{cvs edit} command accepts the same @var{options} as the 6458@code{cvs watch add} command, and establishes a temporary watch for the 6459user on @var{files}; @sc{cvs} will remove the watch when @var{files} are 6460@code{unedit}ed or @code{commit}ted. If the user does not wish to 6461receive notifications, she should specify @code{-a none}. 6462 6463The @var{files} and options are processed as for the @code{cvs 6464watch} commands. 6465 6466@ignore 6467@strong{Caution:} If the @code{PreservePermissions} 6468option is enabled in the repository (@pxref{config}), 6469@sc{cvs} will not change the permissions on any of the 6470@var{files}. The reason for this change is to ensure 6471that using @samp{cvs edit} does not interfere with the 6472ability to store file permissions in the @sc{cvs} 6473repository. 6474@end ignore 6475 6476@end deffn 6477 6478Normally when you are done with a set of changes, you 6479use the @code{cvs commit} command, which checks in your 6480changes and returns the watched files to their usual 6481read-only state. But if you instead decide to abandon 6482your changes, or not to make any changes, you can use 6483the @code{cvs unedit} command. 6484 6485@cindex unedit (subcommand) 6486@cindex Abandoning work 6487@cindex Reverting to repository version 6488@deffn Command {cvs unedit} [@code{-lR}] files @dots{} 6489 6490Abandon work on the working files @var{files}, and revert them to the 6491repository versions on which they are based. @sc{cvs} makes those 6492@var{files} read-only for which users have requested notification using 6493@code{cvs watch on}. @sc{cvs} notifies users who have requested @code{unedit} 6494notification for any of @var{files}. 6495 6496The @var{files} and options are processed as for the 6497@code{cvs watch} commands. 6498 6499If watches are not in use, the @code{unedit} command 6500probably does not work, and the way to revert to the 6501repository version is to remove the file and then use 6502@code{cvs update} to get a new copy. The meaning is 6503not precisely the same; removing and updating may also 6504bring in some changes which have been made in the 6505repository since the last time you updated. 6506@c It would be a useful enhancement to CVS to make 6507@c unedit work in the non-watch case as well. 6508@end deffn 6509 6510When using client/server @sc{cvs}, you can use the 6511@code{cvs edit} and @code{cvs unedit} commands even if 6512@sc{cvs} is unable to successfully communicate with the 6513server; the notifications will be sent upon the next 6514successful @sc{cvs} command. 6515 6516@node Watch information 6517@subsection Information about who is watching and editing 6518 6519@cindex watchers (subcommand) 6520@deffn Command {cvs watchers} [@code{-lR}] files @dots{} 6521 6522List the users currently watching changes to @var{files}. The report 6523includes the files being watched, and the mail address of each watcher. 6524 6525The @var{files} and options are processed as for the 6526@code{cvs watch} commands. 6527 6528@end deffn 6529 6530 6531@cindex editors (subcommand) 6532@deffn Command {cvs editors} [@code{-lR}] files @dots{} 6533 6534List the users currently working on @var{files}. The report 6535includes the mail address of each user, the time when the user began 6536working with the file, and the host and path of the working directory 6537containing the file. 6538 6539The @var{files} and options are processed as for the 6540@code{cvs watch} commands. 6541 6542@end deffn 6543 6544@node Watches Compatibility 6545@subsection Using watches with old versions of CVS 6546 6547@cindex CVS 1.6, and watches 6548If you use the watch features on a repository, it 6549creates @file{CVS} directories in the repository and 6550stores the information about watches in that directory. 6551If you attempt to use @sc{cvs} 1.6 or earlier with the 6552repository, you get an error message such as the 6553following (all on one line): 6554 6555@example 6556cvs update: cannot open CVS/Entries for reading: 6557No such file or directory 6558@end example 6559 6560and your operation will likely be aborted. To use the 6561watch features, you must upgrade all copies of @sc{cvs} 6562which use that repository in local or server mode. If 6563you cannot upgrade, use the @code{watch off} and 6564@code{watch remove} commands to remove all watches, and 6565that will restore the repository to a state which 6566@sc{cvs} 1.6 can cope with. 6567 6568@node Choosing a model 6569@section Choosing between reserved or unreserved checkouts 6570@cindex Choosing, reserved or unreserved checkouts 6571 6572Reserved and unreserved checkouts each have pros and 6573cons. Let it be said that a lot of this is a matter of 6574opinion or what works given different groups' working 6575styles, but here is a brief description of some of the 6576issues. There are many ways to organize a team of 6577developers. @sc{cvs} does not try to enforce a certain 6578organization. It is a tool that can be used in several 6579ways. 6580 6581Reserved checkouts can be very counter-productive. If 6582two persons want to edit different parts of a file, 6583there may be no reason to prevent either of them from 6584doing so. Also, it is common for someone to take out a 6585lock on a file, because they are planning to edit it, 6586but then forget to release the lock. 6587 6588@c "many groups"? specifics? cites to papers on this? 6589@c some way to weasel-word it a bit more so we don't 6590@c need facts :-)? 6591People, especially people who are familiar with 6592reserved checkouts, often wonder how often conflicts 6593occur if unreserved checkouts are used, and how 6594difficult they are to resolve. The experience with 6595many groups is that they occur rarely and usually are 6596relatively straightforward to resolve. 6597 6598The rarity of serious conflicts may be surprising, until one realizes 6599that they occur only when two developers disagree on the proper design 6600for a given section of code; such a disagreement suggests that the 6601team has not been communicating properly in the first place. In order 6602to collaborate under @emph{any} source management regimen, developers 6603must agree on the general design of the system; given this agreement, 6604overlapping changes are usually straightforward to merge. 6605 6606In some cases unreserved checkouts are clearly 6607inappropriate. If no merge tool exists for the kind of 6608file you are managing (for example word processor files 6609or files edited by Computer Aided Design programs), and 6610it is not desirable to change to a program which uses a 6611mergeable data format, then resolving conflicts is 6612going to be unpleasant enough that you generally will 6613be better off to simply avoid the conflicts instead, by 6614using reserved checkouts. 6615 6616The watches features described above in @ref{Watches} 6617can be considered to be an intermediate model between 6618reserved checkouts and unreserved checkouts. When you 6619go to edit a file, it is possible to find out who else 6620is editing it. And rather than having the system 6621simply forbid both people editing the file, it can tell 6622you what the situation is and let you figure out 6623whether it is a problem in that particular case or not. 6624Therefore, for some groups it can be considered the 6625best of both the reserved checkout and unreserved 6626checkout worlds. 6627 6628@c --------------------------------------------------------------------- 6629@node Revision management 6630@chapter Revision management 6631@cindex Revision management 6632 6633@c -- This chapter could be expanded a lot. 6634@c -- Experiences are very welcome! 6635 6636If you have read this far, you probably have a pretty 6637good grasp on what @sc{cvs} can do for you. This 6638chapter talks a little about things that you still have 6639to decide. 6640 6641If you are doing development on your own using @sc{cvs} 6642you could probably skip this chapter. The questions 6643this chapter takes up become more important when more 6644than one person is working in a repository. 6645 6646@menu 6647* When to commit:: Some discussion on the subject 6648@end menu 6649 6650@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6651@node When to commit 6652@section When to commit? 6653@cindex When to commit 6654@cindex Commit, when to 6655@cindex Policy 6656 6657Your group should decide which policy to use regarding 6658commits. Several policies are possible, and as your 6659experience with @sc{cvs} grows you will probably find 6660out what works for you. 6661 6662If you commit files too quickly you might commit files 6663that do not even compile. If your partner updates his 6664working sources to include your buggy file, he will be 6665unable to compile the code. On the other hand, other 6666persons will not be able to benefit from the 6667improvements you make to the code if you commit very 6668seldom, and conflicts will probably be more common. 6669 6670It is common to only commit files after making sure 6671that they can be compiled. Some sites require that the 6672files pass a test suite. Policies like this can be 6673enforced using the commitinfo file 6674(@pxref{commitinfo}), but you should think twice before 6675you enforce such a convention. By making the 6676development environment too controlled it might become 6677too regimented and thus counter-productive to the real 6678goal, which is to get software written. 6679 6680@c --------------------------------------------------------------------- 6681@node Keyword substitution 6682@chapter Keyword substitution 6683@cindex Keyword substitution 6684@cindex Keyword expansion 6685@cindex Identifying files 6686 6687@comment Be careful when editing this chapter. 6688@comment Remember that this file is kept under 6689@comment version control, so we must not accidentally 6690@comment include a valid keyword in the running text. 6691 6692As long as you edit source files inside a working 6693directory you can always find out the state of 6694your files via @samp{cvs status} and @samp{cvs log}. 6695But as soon as you export the files from your 6696development environment it becomes harder to identify 6697which revisions they are. 6698 6699@sc{cvs} can use a mechanism known as @dfn{keyword 6700substitution} (or @dfn{keyword expansion}) to help 6701identifying the files. Embedded strings of the form 6702@code{$@var{keyword}$} and 6703@code{$@var{keyword}:@dots{}$} in a file are replaced 6704with strings of the form 6705@code{$@var{keyword}:@var{value}$} whenever you obtain 6706a new revision of the file. 6707 6708@menu 6709* Keyword list:: Keywords 6710* Using keywords:: Using keywords 6711* Avoiding substitution:: Avoiding substitution 6712* Substitution modes:: Substitution modes 6713* Log keyword:: Problems with the $@asis{}Log$ keyword. 6714@end menu 6715 6716@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6717@node Keyword list 6718@section Keyword List 6719@cindex Keyword List 6720 6721@c FIXME: need some kind of example here I think, 6722@c perhaps in a 6723@c "Keyword intro" node. The intro in the "Keyword 6724@c substitution" node itself seems OK, but to launch 6725@c into a list of the keywords somehow seems too abrupt. 6726 6727This is a list of the keywords: 6728 6729@table @code 6730@cindex Author keyword 6731@item $@asis{Author}$ 6732The login name of the user who checked in the revision. 6733 6734@cindex Date keyword 6735@item $@asis{Date}$ 6736The date and time (UTC) the revision was checked in. 6737 6738@cindex Header keyword 6739@item $@asis{Header}$ 6740A standard header containing the full pathname of the 6741@sc{rcs} file, the revision number, the date (UTC), the 6742author, the state, and the locker (if locked). Files 6743will normally never be locked when you use @sc{cvs}. 6744 6745@cindex Id keyword 6746@item $@asis{Id}$ 6747Same as @code{$@asis{Header}$}, except that the @sc{rcs} 6748filename is without a path. 6749 6750@cindex Name keyword 6751@item $@asis{Name}$ 6752Tag name used to check out this file. The keyword is 6753expanded only if one checks out with an explicit tag 6754name. For example, when running the command @code{cvs 6755co -r first}, the keyword expands to @samp{Name: first}. 6756 6757@cindex Locker keyword 6758@item $@asis{Locker}$ 6759The login name of the user who locked the revision 6760(empty if not locked, which is the normal case unless 6761@code{cvs admin -l} is in use). 6762 6763@cindex Log keyword 6764@item $@asis{Log}$ 6765The log message supplied during commit, preceded by a 6766header containing the @sc{rcs} filename, the revision 6767number, the author, and the date (UTC). Existing log 6768messages are @emph{not} replaced. Instead, the new log 6769message is inserted after @code{$@asis{Log:@dots{}}$}. 6770Each new line is prefixed with the same string which 6771precedes the @code{$Log} keyword. For example, if the 6772file contains 6773 6774@example 6775 /* Here is what people have been up to: 6776 * 6777 * $@asis{}Log: frob.c,v $ 6778 * Revision 1.1 1997/01/03 14:23:51 joe 6779 * Add the superfrobnicate option 6780 * 6781 */ 6782@end example 6783 6784@noindent 6785then additional lines which are added when expanding 6786the @code{$Log} keyword will be preceded by @samp{ * }. 6787Unlike previous versions of @sc{cvs} and @sc{rcs}, the 6788@dfn{comment leader} from the @sc{rcs} file is not used. 6789The @code{$Log} keyword is useful for 6790accumulating a complete change log in a source file, 6791but for several reasons it can be problematic. 6792@xref{Log keyword}. 6793 6794@cindex RCSfile keyword 6795@item $@asis{RCSfile}$ 6796The name of the RCS file without a path. 6797 6798@cindex Revision keyword 6799@item $@asis{Revision}$ 6800The revision number assigned to the revision. 6801 6802@cindex Source keyword 6803@item $@asis{Source}$ 6804The full pathname of the RCS file. 6805 6806@cindex State keyword 6807@item $@asis{State}$ 6808The state assigned to the revision. States can be 6809assigned with @code{cvs admin -s}---see @ref{admin options}. 6810 6811@end table 6812 6813@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6814@node Using keywords 6815@section Using keywords 6816 6817To include a keyword string you simply include the 6818relevant text string, such as @code{$@asis{Id}$}, inside the 6819file, and commit the file. @sc{cvs} will automatically 6820expand the string as part of the commit operation. 6821 6822It is common to embed the @code{$@asis{}Id$} string in 6823the source files so that it gets passed through to 6824generated files. For example, if you are managing 6825computer program source code, you might include a 6826variable which is initialized to contain that string. 6827Or some C compilers may provide a @code{#pragma ident} 6828directive. Or a document management system might 6829provide a way to pass a string through to generated 6830files. 6831 6832@c Would be nice to give an example, but doing this in 6833@c portable C is not possible and the problem with 6834@c picking any one language (VMS HELP files, Ada, 6835@c troff, whatever) is that people use CVS for all 6836@c kinds of files. 6837 6838@cindex Ident (shell command) 6839The @code{ident} command (which is part of the @sc{rcs} 6840package) can be used to extract keywords and their 6841values from a file. This can be handy for text files, 6842but it is even more useful for extracting keywords from 6843binary files. 6844 6845@example 6846$ ident samp.c 6847samp.c: 6848 $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6849$ gcc samp.c 6850$ ident a.out 6851a.out: 6852 $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6853@end example 6854 6855@cindex What (shell command) 6856S@sc{ccs} is another popular revision control system. 6857It has a command, @code{what}, which is very similar to 6858@code{ident} and used for the same purpose. Many sites 6859without @sc{rcs} have @sc{sccs}. Since @code{what} 6860looks for the character sequence @code{@@(#)} it is 6861easy to include keywords that are detected by either 6862command. Simply prefix the keyword with the 6863magic @sc{sccs} phrase, like this: 6864 6865@example 6866static char *id="@@(#) $@asis{}Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $"; 6867@end example 6868 6869@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6870@node Avoiding substitution 6871@section Avoiding substitution 6872 6873Keyword substitution has its disadvantages. Sometimes 6874you might want the literal text string 6875@samp{$@asis{}Author$} to appear inside a file without 6876@sc{cvs} interpreting it as a keyword and expanding it 6877into something like @samp{$@asis{}Author: ceder $}. 6878 6879There is unfortunately no way to selectively turn off 6880keyword substitution. You can use @samp{-ko} 6881(@pxref{Substitution modes}) to turn off keyword 6882substitution entirely. 6883 6884In many cases you can avoid using keywords in 6885the source, even though they appear in the final 6886product. For example, the source for this manual 6887contains @samp{$@@asis@{@}Author$} whenever the text 6888@samp{$@asis{}Author$} should appear. In @code{nroff} 6889and @code{troff} you can embed the null-character 6890@code{\&} inside the keyword for a similar effect. 6891 6892@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6893@node Substitution modes 6894@section Substitution modes 6895@cindex Keyword substitution, changing modes 6896@cindex -k (keyword substitution) 6897@cindex Kflag 6898 6899@c FIXME: This could be made more coherent, by expanding it 6900@c with more examples or something. 6901Each file has a stored default substitution mode, and 6902each working directory copy of a file also has a 6903substitution mode. The former is set by the @samp{-k} 6904option to @code{cvs add} and @code{cvs admin}; the 6905latter is set by the @samp{-k} or @samp{-A} options to @code{cvs 6906checkout} or @code{cvs update}. @code{cvs diff} also 6907has a @samp{-k} option. For some examples, 6908see @ref{Binary files}, and @ref{Merging and keywords}. 6909@c The fact that -A is overloaded to mean both reset 6910@c sticky options and reset sticky tags/dates is 6911@c somewhat questionable. Perhaps there should be 6912@c separate options to reset sticky options (e.g. -k 6913@c A") and tags/dates (someone suggested -r HEAD could 6914@c do this instead of setting a sticky tag of "HEAD" 6915@c as in the status quo but I haven't thought much 6916@c about that idea. Of course -r .reset or something 6917@c could be coined if this needs to be a new option). 6918@c On the other hand, having -A mean "get things back 6919@c into the state after a fresh checkout" has a certain 6920@c appeal, and maybe there is no sufficient reason for 6921@c creeping featurism in this area. 6922 6923The modes available are: 6924 6925@table @samp 6926@item -kkv 6927Generate keyword strings using the default form, e.g. 6928@code{$@asis{}Revision: 5.7 $} for the @code{Revision} 6929keyword. 6930 6931@item -kkvl 6932Like @samp{-kkv}, except that a locker's name is always 6933inserted if the given revision is currently locked. 6934The locker's name is only relevant if @code{cvs admin 6935-l} is in use. 6936 6937@item -kk 6938Generate only keyword names in keyword strings; omit 6939their values. For example, for the @code{Revision} 6940keyword, generate the string @code{$@asis{}Revision$} 6941instead of @code{$@asis{}Revision: 5.7 $}. This option 6942is useful to ignore differences due to keyword 6943substitution when comparing different revisions of a 6944file (@pxref{Merging and keywords}). 6945 6946@item -ko 6947Generate the old keyword string, present in the working 6948file just before it was checked in. For example, for 6949the @code{Revision} keyword, generate the string 6950@code{$@asis{}Revision: 1.1 $} instead of 6951@code{$@asis{}Revision: 5.7 $} if that is how the 6952string appeared when the file was checked in. 6953 6954@item -kb 6955Like @samp{-ko}, but also inhibit conversion of line 6956endings between the canonical form in which they are 6957stored in the repository (linefeed only), and the form 6958appropriate to the operating system in use on the 6959client. For systems, like unix, which use linefeed 6960only to terminate lines, this is the same as 6961@samp{-ko}. For more information on binary files, see 6962@ref{Binary files}. 6963 6964@item -kv 6965Generate only keyword values for keyword strings. For 6966example, for the @code{Revision} keyword, generate the string 6967@code{5.7} instead of @code{$@asis{}Revision: 5.7 $}. 6968This can help generate files in programming languages 6969where it is hard to strip keyword delimiters like 6970@code{$@asis{}Revision: $} from a string. However, 6971further keyword substitution cannot be performed once 6972the keyword names are removed, so this option should be 6973used with care. 6974 6975One often would like to use @samp{-kv} with @code{cvs 6976export}---@pxref{export}. But be aware that doesn't 6977handle an export containing binary files correctly. 6978 6979@end table 6980 6981@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6982@node Log keyword 6983@section Problems with the $@asis{}Log$ keyword. 6984 6985The @code{$@asis{}Log$} keyword is somewhat 6986controversial. As long as you are working on your 6987development system the information is easily accessible 6988even if you do not use the @code{$@asis{}Log$} 6989keyword---just do a @code{cvs log}. Once you export 6990the file the history information might be useless 6991anyhow. 6992 6993A more serious concern is that @sc{cvs} is not good at 6994handling @code{$@asis{}Log$} entries when a branch is 6995merged onto the main trunk. Conflicts often result 6996from the merging operation. 6997@c Might want to check whether the CVS implementation 6998@c of RCS_merge has this problem the same way rcsmerge 6999@c does. I would assume so.... 7000 7001People also tend to "fix" the log entries in the file 7002(correcting spelling mistakes and maybe even factual 7003errors). If that is done the information from 7004@code{cvs log} will not be consistent with the 7005information inside the file. This may or may not be a 7006problem in real life. 7007 7008It has been suggested that the @code{$@asis{}Log$} 7009keyword should be inserted @emph{last} in the file, and 7010not in the files header, if it is to be used at all. 7011That way the long list of change messages will not 7012interfere with everyday source file browsing. 7013 7014@c --------------------------------------------------------------------- 7015@node Tracking sources 7016@chapter Tracking third-party sources 7017@cindex Third-party sources 7018@cindex Tracking sources 7019 7020@c FIXME: Need discussion of added and removed files. 7021@c FIXME: This doesn't really adequately introduce the 7022@c concepts of "vendor" and "you". They don't *have* 7023@c to be separate organizations or separate people. 7024@c We want a description which is somewhat more based on 7025@c the technical issues of which sources go where, but 7026@c also with enough examples of how this relates to 7027@c relationships like customer-supplier, developer-QA, 7028@c maintainer-contributor, or whatever, to make it 7029@c seem concrete. 7030If you modify a program to better fit your site, you 7031probably want to include your modifications when the next 7032release of the program arrives. @sc{cvs} can help you with 7033this task. 7034 7035@cindex Vendor 7036@cindex Vendor branch 7037@cindex Branch, vendor- 7038In the terminology used in @sc{cvs}, the supplier of the 7039program is called a @dfn{vendor}. The unmodified 7040distribution from the vendor is checked in on its own 7041branch, the @dfn{vendor branch}. @sc{cvs} reserves branch 70421.1.1 for this use. 7043 7044When you modify the source and commit it, your revision 7045will end up on the main trunk. When a new release is 7046made by the vendor, you commit it on the vendor branch 7047and copy the modifications onto the main trunk. 7048 7049Use the @code{import} command to create and update 7050the vendor branch. When you import a new file, 7051the vendor branch is made the `head' revision, so 7052anyone that checks out a copy of the file gets that 7053revision. When a local modification is committed it is 7054placed on the main trunk, and made the `head' 7055revision. 7056 7057@menu 7058* First import:: Importing for the first time 7059* Update imports:: Updating with the import command 7060* Reverting local changes:: Reverting to the latest vendor release 7061* Binary files in imports:: Binary files require special handling 7062* Keywords in imports:: Keyword substitution might be undesirable 7063* Multiple vendor branches:: What if you get sources from several places? 7064@end menu 7065 7066@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7067@node First import 7068@section Importing for the first time 7069@cindex Importing modules 7070 7071@c Should mention naming conventions for vendor tags, 7072@c release tags, and perhaps directory names. 7073Use the @code{import} command to check in the sources 7074for the first time. When you use the @code{import} 7075command to track third-party sources, the @dfn{vendor 7076tag} and @dfn{release tags} are useful. The 7077@dfn{vendor tag} is a symbolic name for the branch 7078(which is always 1.1.1, unless you use the @samp{-b 7079@var{branch}} flag---see @ref{Multiple vendor branches}.). The 7080@dfn{release tags} are symbolic names for a particular 7081release, such as @samp{FSF_0_04}. 7082 7083@c I'm not completely sure this belongs here. But 7084@c we need to say it _somewhere_ reasonably obvious; it 7085@c is a common misconception among people first learning CVS 7086Note that @code{import} does @emph{not} change the 7087directory in which you invoke it. In particular, it 7088does not set up that directory as a @sc{cvs} working 7089directory; if you want to work with the sources import 7090them first and then check them out into a different 7091directory (@pxref{Getting the source}). 7092 7093@cindex wdiff (import example) 7094Suppose you have the sources to a program called 7095@code{wdiff} in a directory @file{wdiff-0.04}, 7096and are going to make private modifications that you 7097want to be able to use even when new releases are made 7098in the future. You start by importing the source to 7099your repository: 7100 7101@example 7102$ cd wdiff-0.04 7103$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04 7104@end example 7105 7106The vendor tag is named @samp{FSF_DIST} in the above 7107example, and the only release tag assigned is 7108@samp{WDIFF_0_04}. 7109@c FIXME: Need to say where fsf/wdiff comes from. 7110 7111@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7112@node Update imports 7113@section Updating with the import command 7114 7115When a new release of the source arrives, you import it into the 7116repository with the same @code{import} command that you used to set up 7117the repository in the first place. The only difference is that you 7118specify a different release tag this time. 7119 7120@example 7121$ tar xfz wdiff-0.05.tar.gz 7122$ cd wdiff-0.05 7123$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05 7124@end example 7125 7126For files that have not been modified locally, the newly created 7127revision becomes the head revision. If you have made local 7128changes, @code{import} will warn you that you must merge the changes 7129into the main trunk, and tell you to use @samp{checkout -j} to do so. 7130 7131@c FIXME: why "wdiff" here and "fsf/wdiff" in the 7132@c "import"? I think the assumption is that one has 7133@c "wdiff fsf/wdiff" or some such in modules, but it 7134@c would be better to not use modules in this example. 7135@example 7136$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff 7137@end example 7138 7139@noindent 7140The above command will check out the latest revision of 7141@samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST} 7142since yesterday into the working copy. If any conflicts arise during 7143the merge they should be resolved in the normal way (@pxref{Conflicts 7144example}). Then, the modified files may be committed. 7145 7146Using a date, as suggested above, assumes that you do 7147not import more than one release of a product per 7148day. If you do, you can always use something like this 7149instead: 7150 7151@example 7152$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff 7153@end example 7154 7155@noindent 7156In this case, the two above commands are equivalent. 7157 7158@node Reverting local changes 7159@section Reverting to the latest vendor release 7160 7161You can also revert local changes completely and return 7162to the latest vendor release by changing the `head' 7163revision back to the vendor branch on all files. For 7164example, if you have a checked-out copy of the sources 7165in @file{~/work.d/wdiff}, and you want to revert to the 7166vendor's version for all the files in that directory, 7167you would type: 7168 7169@example 7170$ cd ~/work.d/wdiff 7171$ cvs admin -bWDIFF . 7172@end example 7173 7174@noindent 7175You must specify the @samp{-bWDIFF} without any space 7176after the @samp{-b}. @xref{admin options}. 7177 7178@node Binary files in imports 7179@section How to handle binary files with cvs import 7180 7181Use the @samp{-k} wrapper option to tell import which 7182files are binary. @xref{Wrappers}. 7183 7184@node Keywords in imports 7185@section How to handle keyword substitution with cvs import 7186 7187The sources which you are importing may contain 7188keywords (@pxref{Keyword substitution}). For example, 7189the vendor may use @sc{cvs} or some other system 7190which uses similar keyword expansion syntax. If you 7191just import the files in the default fashion, then 7192the keyword expansions supplied by the vendor will 7193be replaced by keyword expansions supplied by your 7194own copy of @sc{cvs}. It may be more convenient to 7195maintain the expansions supplied by the vendor, so 7196that this information can supply information about 7197the sources that you imported from the vendor. 7198 7199To maintain the keyword expansions supplied by the 7200vendor, supply the @samp{-ko} option to @code{cvs 7201import} the first time you import the file. 7202This will turn off keyword expansion 7203for that file entirely, so if you want to be more 7204selective you'll have to think about what you want 7205and use the @samp{-k} option to @code{cvs update} or 7206@code{cvs admin} as appropriate. 7207@c Supplying -ko to import if the file already existed 7208@c has no effect. Not clear to me whether it should 7209@c or not. 7210 7211@node Multiple vendor branches 7212@section Multiple vendor branches 7213 7214All the examples so far assume that there is only one 7215vendor from which you are getting sources. In some 7216situations you might get sources from a variety of 7217places. For example, suppose that you are dealing with 7218a project where many different people and teams are 7219modifying the software. There are a variety of ways to 7220handle this, but in some cases you have a bunch of 7221source trees lying around and what you want to do more 7222than anything else is just to all put them in @sc{cvs} so 7223that you at least have them in one place. 7224 7225For handling situations in which there may be more than 7226one vendor, you may specify the @samp{-b} option to 7227@code{cvs import}. It takes as an argument the vendor 7228branch to import to. The default is @samp{-b 1.1.1}. 7229 7230For example, suppose that there are two teams, the red 7231team and the blue team, that are sending you sources. 7232You want to import the red team's efforts to branch 72331.1.1 and use the vendor tag RED. You want to import 7234the blue team's efforts to branch 1.1.3 and use the 7235vendor tag BLUE. So the commands you might use are: 7236 7237@example 7238$ cvs import dir RED RED_1-0 7239$ cvs import -b 1.1.3 dir BLUE BLUE_1-5 7240@end example 7241 7242Note that if your vendor tag does not match your 7243@samp{-b} option, @sc{cvs} will not detect this case! For 7244example, 7245 7246@example 7247$ cvs import -b 1.1.3 dir RED RED_1-0 7248@end example 7249 7250@noindent 7251Be careful; this kind of mismatch is sure to sow 7252confusion or worse. I can't think of a useful purpose 7253for the ability to specify a mismatch here, but if you 7254discover such a use, don't. @sc{cvs} is likely to make this 7255an error in some future release. 7256 7257@c Probably should say more about the semantics of 7258@c multiple branches. What about the default branch? 7259@c What about joining (perhaps not as useful with 7260@c multiple branches, or perhaps it is. Either way 7261@c should be mentioned). 7262 7263@c I'm not sure about the best location for this. In 7264@c one sense, it might belong right after we've introduced 7265@c CVS's basic version control model, because people need 7266@c to figure out builds right away. The current location 7267@c is based on the theory that it kind of akin to the 7268@c "Revision management" section. 7269@node Builds 7270@chapter How your build system interacts with CVS 7271@cindex Builds 7272@cindex make 7273 7274As mentioned in the introduction, @sc{cvs} does not 7275contain software for building your software from source 7276code. This section describes how various aspects of 7277your build system might interact with @sc{cvs}. 7278 7279@c Is there a way to discuss this without reference to 7280@c tools other than CVS? I'm not sure there is; I 7281@c wouldn't think that people who learn CVS first would 7282@c even have this concern. 7283One common question, especially from people who are 7284accustomed to @sc{rcs}, is how to make their build get 7285an up to date copy of the sources. The answer to this 7286with @sc{cvs} is two-fold. First of all, since 7287@sc{cvs} itself can recurse through directories, there 7288is no need to modify your @file{Makefile} (or whatever 7289configuration file your build tool uses) to make sure 7290each file is up to date. Instead, just use two 7291commands, first @code{cvs -q update} and then 7292@code{make} or whatever the command is to invoke your 7293build tool. Secondly, you do not necessarily 7294@emph{want} to get a copy of a change someone else made 7295until you have finished your own work. One suggested 7296approach is to first update your sources, then 7297implement, build and 7298test the change you were thinking of, and then commit 7299your sources (updating first if necessary). By 7300periodically (in between changes, using the approach 7301just described) updating your entire tree, you ensure 7302that your sources are sufficiently up to date. 7303 7304@cindex Bill of materials 7305One common need is to record which versions of which 7306source files went into a particular build. This kind 7307of functionality is sometimes called @dfn{bill of 7308materials} or something similar. The best way to do 7309this with @sc{cvs} is to use the @code{tag} command to 7310record which versions went into a given build 7311(@pxref{Tags}). 7312 7313Using @sc{cvs} in the most straightforward manner 7314possible, each developer will have a copy of the entire 7315source tree which is used in a particular build. If 7316the source tree is small, or if developers are 7317geographically dispersed, this is the preferred 7318solution. In fact one approach for larger projects is 7319to break a project down into smaller 7320@c I say subsystem instead of module because they may or 7321@c may not use the modules file. 7322separately-compiled subsystems, and arrange a way of 7323releasing them internally so that each developer need 7324check out only those subsystems which are they are 7325actively working on. 7326 7327Another approach is to set up a structure which allows 7328developers to have their own copies of some files, and 7329for other files to access source files from a central 7330location. Many people have come up with some such a 7331@c two such people are paul@sander.cupertino.ca.us (for 7332@c a previous employer) 7333@c and gtornblo@senet.abb.se (spicm and related tools), 7334@c but as far as I know 7335@c no one has nicely packaged or released such a system (or 7336@c instructions for constructing one). 7337system using features such as the symbolic link feature 7338found in many operating systems, or the @code{VPATH} 7339feature found in many versions of @code{make}. One build 7340tool which is designed to help with this kind of thing 7341is Odin (see 7342@code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}). 7343@c Should we be saying more about Odin? Or how you use 7344@c it with CVS? Also, the Prime Time Freeware for Unix 7345@c disk (see http://www.ptf.com/) has Odin (with a nice 7346@c paragraph summarizing it on the web), so that might be a 7347@c semi-"official" place to point people. 7348@c 7349@c Of course, many non-CVS systems have this kind of 7350@c functionality, for example OSF's ODE 7351@c (http://www.osf.org/ode/) or mk 7352@c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html 7353@c He has changed providers in the past; a search engine search 7354@c for "Peter Ziobrzynski" probably won't get too many 7355@c spurious hits :-). A more stable URL might be 7356@c ftp://ftp.uu.net/pub/cmvc/mk). But I'm not sure 7357@c there is any point in mentioning them here unless they 7358@c can work with CVS. 7359 7360@c --------------------------------------------------------------------- 7361@node Special Files 7362@chapter Special Files 7363 7364@cindex Special files 7365@cindex Device nodes 7366@cindex Ownership, saving in CVS 7367@cindex Permissions, saving in CVS 7368@cindex Hard links 7369@cindex Symbolic links 7370 7371In normal circumstances, @sc{cvs} works only with regular 7372files. Every file in a project is assumed to be 7373persistent; it must be possible to open, read and close 7374them; and so on. @sc{cvs} also ignores file permissions and 7375ownerships, leaving such issues to be resolved by the 7376developer at installation time. In other words, it is 7377not possible to "check in" a device into a repository; 7378if the device file cannot be opened, @sc{cvs} will refuse to 7379handle it. Files also lose their ownerships and 7380permissions during repository transactions. 7381 7382@ignore 7383If the configuration variable @code{PreservePermissions} 7384(@pxref{config}) is set in the repository, @sc{cvs} will 7385save the following file characteristics in the 7386repository: 7387 7388@itemize @bullet 7389@item user and group ownership 7390@item permissions 7391@item major and minor device numbers 7392@item symbolic links 7393@item hard link structure 7394@end itemize 7395 7396Using the @code{PreservePermissions} option affects the 7397behavior of @sc{cvs} in several ways. First, some of the 7398new operations supported by @sc{cvs} are not accessible to 7399all users. In particular, file ownership and special 7400file characteristics may only be changed by the 7401superuser. When the @code{PreservePermissions} 7402configuration variable is set, therefore, users will 7403have to be `root' in order to perform @sc{cvs} operations. 7404 7405When @code{PreservePermissions} is in use, some @sc{cvs} 7406operations (such as @samp{cvs status}) will not 7407recognize a file's hard link structure, and so will 7408emit spurious warnings about mismatching hard links. 7409The reason is that @sc{cvs}'s internal structure does not 7410make it easy for these operations to collect all the 7411necessary data about hard links, so they check for file 7412conflicts with inaccurate data. 7413 7414A more subtle difference is that @sc{cvs} considers a file 7415to have changed only if its contents have changed 7416(specifically, if the modification time of the working 7417file does not match that of the repository's file). 7418Therefore, if only the permissions, ownership or hard 7419linkage have changed, or if a device's major or minor 7420numbers have changed, @sc{cvs} will not notice. In order to 7421commit such a change to the repository, you must force 7422the commit with @samp{cvs commit -f}. This also means 7423that if a file's permissions have changed and the 7424repository file is newer than the working copy, 7425performing @samp{cvs update} will silently change the 7426permissions on the working copy. 7427 7428Changing hard links in a @sc{cvs} repository is particularly 7429delicate. Suppose that file @file{foo} is linked to 7430file @file{old}, but is later relinked to file 7431@file{new}. You can wind up in the unusual situation 7432where, although @file{foo}, @file{old} and @file{new} 7433have all had their underlying link patterns changed, 7434only @file{foo} and @file{new} have been modified, so 7435@file{old} is not considered a candidate for checking 7436in. It can be very easy to produce inconsistent 7437results this way. Therefore, we recommend that when it 7438is important to save hard links in a repository, the 7439prudent course of action is to @code{touch} any file 7440whose linkage or status has changed since the last 7441checkin. Indeed, it may be wise to @code{touch *} 7442before each commit in a directory with complex hard 7443link structures. 7444 7445It is worth noting that only regular files may 7446be merged, for reasons that hopefully are obvious. If 7447@samp{cvs update} or @samp{cvs checkout -j} attempts to 7448merge a symbolic link with a regular file, or two 7449device files for different kinds of devices, @sc{cvs} will 7450report a conflict and refuse to perform the merge. At 7451the same time, @samp{cvs diff} will not report any 7452differences between these files, since no meaningful 7453textual comparisons can be made on files which contain 7454no text. 7455 7456The @code{PreservePermissions} features do not work 7457with client/server @sc{cvs}. Another limitation is 7458that hard links must be to other files within the same 7459directory; hard links across directories are not 7460supported. 7461@end ignore 7462 7463@c --------------------------------------------------------------------- 7464@node CVS commands 7465@appendix Guide to CVS commands 7466 7467This appendix describes the overall structure of 7468@sc{cvs} commands, and describes some commands in 7469detail (others are described elsewhere; for a quick 7470reference to @sc{cvs} commands, @pxref{Invoking CVS}). 7471@c The idea is that we want to move the commands which 7472@c are described here into the main body of the manual, 7473@c in the process reorganizing the manual to be 7474@c organized around what the user wants to do, not 7475@c organized around CVS commands. 7476@c 7477@c Note that many users do expect a manual which is 7478@c organized by command. At least some users do. 7479@c One good addition to the "organized by command" 7480@c section (if any) would be "see also" links. 7481@c The awk manual might be a good example; it has a 7482@c reference manual which is more verbose than Invoking 7483@c CVS but probably somewhat less verbose than CVS 7484@c Commands. 7485 7486@menu 7487* Structure:: Overall structure of CVS commands 7488* Exit status:: Indicating CVS's success or failure 7489* ~/.cvsrc:: Default options with the ~/.csvrc file 7490* Global options:: Options you give to the left of cvs_command 7491* Common options:: Options you give to the right of cvs_command 7492* admin:: Administration 7493* checkout:: Checkout sources for editing 7494* commit:: Check files into the repository 7495* diff:: Show differences between revisions 7496* export:: Export sources from CVS, similar to checkout 7497* history:: Show status of files and users 7498* import:: Import sources into CVS, using vendor branches 7499* log:: Show log messages for files 7500* rdiff:: 'patch' format diffs between releases 7501* release:: Indicate that a directory is no longer in use 7502* update:: Bring work tree in sync with repository 7503@end menu 7504 7505@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7506@node Structure 7507@appendixsec Overall structure of CVS commands 7508@cindex Structure 7509@cindex CVS command structure 7510@cindex Command structure 7511@cindex Format of CVS commands 7512 7513The overall format of all @sc{cvs} commands is: 7514 7515@example 7516cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ] 7517@end example 7518 7519@table @code 7520@item cvs 7521The name of the @sc{cvs} program. 7522 7523@item cvs_options 7524Some options that affect all sub-commands of @sc{cvs}. These are 7525described below. 7526 7527@item cvs_command 7528One of several different sub-commands. Some of the commands have 7529aliases that can be used instead; those aliases are noted in the 7530reference manual for that command. There are only two situations 7531where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a 7532list of available commands, and @samp{cvs -v} displays version 7533information on @sc{cvs} itself. 7534 7535@item command_options 7536Options that are specific for the command. 7537 7538@item command_args 7539Arguments to the commands. 7540@end table 7541 7542There is unfortunately some confusion between 7543@code{cvs_options} and @code{command_options}. 7544@samp{-l}, when given as a @code{cvs_option}, only 7545affects some of the commands. When it is given as a 7546@code{command_option} is has a different meaning, and 7547is accepted by more commands. In other words, do not 7548take the above categorization too seriously. Look at 7549the documentation instead. 7550 7551@node Exit status 7552@appendixsec CVS's exit status 7553@cindex Exit status, of CVS 7554 7555@sc{cvs} can indicate to the calling environment whether it 7556succeeded or failed by setting its @dfn{exit status}. 7557The exact way of testing the exit status will vary from 7558one operating system to another. For example in a unix 7559shell script the @samp{$?} variable will be 0 if the 7560last command returned a successful exit status, or 7561greater than 0 if the exit status indicated failure. 7562 7563If @sc{cvs} is successful, it returns a successful status; 7564if there is an error, it prints an error message and 7565returns a failure status. The one exception to this is 7566the @code{cvs diff} command. It will return a 7567successful status if it found no differences, or a 7568failure status if there were differences or if there 7569was an error. Because this behavior provides no good 7570way to detect errors, in the future it is possible that 7571@code{cvs diff} will be changed to behave like the 7572other @sc{cvs} commands. 7573@c It might seem like checking whether cvs -q diff 7574@c produces empty or non-empty output can tell whether 7575@c there were differences or not. But it seems like 7576@c there are cases with output but no differences 7577@c (testsuite basica-8b). It is not clear to me how 7578@c useful it is for a script to be able to check 7579@c whether there were differences. 7580@c FIXCVS? In previous versions of CVS, cvs diff 7581@c returned 0 for no differences, 1 for differences, or 7582@c 2 for errors. Is this behavior worth trying to 7583@c bring back (but what does it mean for VMS?)? 7584 7585@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7586@node ~/.cvsrc 7587@appendixsec Default options and the ~/.cvsrc file 7588@cindex .cvsrc file 7589@cindex Option defaults 7590 7591There are some @code{command_options} that are used so 7592often that you might have set up an alias or some other 7593means to make sure you always specify that option. One 7594example (the one that drove the implementation of the 7595@file{.cvsrc} support, actually) is that many people find the 7596default output of the @samp{diff} command to be very 7597hard to read, and that either context diffs or unidiffs 7598are much easier to understand. 7599 7600The @file{~/.cvsrc} file is a way that you can add 7601default options to @code{cvs_commands} within cvs, 7602instead of relying on aliases or other shell scripts. 7603 7604The format of the @file{~/.cvsrc} file is simple. The 7605file is searched for a line that begins with the same 7606name as the @code{cvs_command} being executed. If a 7607match is found, then the remainder of the line is split 7608up (at whitespace characters) into separate options and 7609added to the command arguments @emph{before} any 7610options from the command line. 7611 7612If a command has two names (e.g., @code{checkout} and 7613@code{co}), the official name, not necessarily the one 7614used on the command line, will be used to match against 7615the file. So if this is the contents of the user's 7616@file{~/.cvsrc} file: 7617 7618@example 7619log -N 7620diff -u 7621update -P 7622checkout -P 7623@end example 7624 7625@noindent 7626the command @samp{cvs checkout foo} would have the 7627@samp{-P} option added to the arguments, as well as 7628@samp{cvs co foo}. 7629 7630With the example file above, the output from @samp{cvs 7631diff foobar} will be in unidiff format. @samp{cvs diff 7632-c foobar} will provide context diffs, as usual. 7633Getting "old" format diffs would be slightly more 7634complicated, because @code{diff} doesn't have an option 7635to specify use of the "old" format, so you would need 7636@samp{cvs -f diff foobar}. 7637 7638In place of the command name you can use @code{cvs} to 7639specify global options (@pxref{Global options}). For 7640example the following line in @file{.cvsrc} 7641 7642@example 7643cvs -z6 7644@end example 7645 7646causes @sc{cvs} to use compression level 6. 7647 7648@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7649@node Global options 7650@appendixsec Global options 7651@cindex Options, global 7652@cindex Global options 7653@cindex Left-hand options 7654 7655The available @samp{cvs_options} (that are given to the 7656left of @samp{cvs_command}) are: 7657 7658@table @code 7659@item --allow-root=@var{rootdir} 7660Specify legal @sc{cvsroot} directory. See 7661@ref{Password authentication server}. 7662 7663@cindex Authentication, stream 7664@cindex Stream authentication 7665@item -a 7666Authenticate all communication between the client and 7667the server. Only has an effect on the @sc{cvs} client. 7668As of this writing, this is only implemented when using 7669a GSSAPI connection (@pxref{GSSAPI authenticated}). 7670Authentication prevents certain sorts of attacks 7671involving hijacking the active @sc{tcp} connection. 7672Enabling authentication does not enable encryption. 7673 7674@cindex RCSBIN, overriding 7675@cindex Overriding RCSBIN 7676@item -b @var{bindir} 7677In @sc{cvs} 1.9.18 and older, this specified that 7678@sc{rcs} programs are in the @var{bindir} directory. 7679Current versions of @sc{cvs} do not run @sc{rcs} 7680programs; for compatibility this option is accepted, 7681but it does nothing. 7682 7683@cindex TMPDIR, overriding 7684@cindex Overriding TMPDIR 7685@item -T @var{tempdir} 7686Use @var{tempdir} as the directory where temporary files are 7687located. Overrides the setting of the @code{$TMPDIR} environment 7688variable and any precompiled directory. This parameter should be 7689specified as an absolute pathname. 7690 7691@cindex CVSROOT, overriding 7692@cindex Overriding CVSROOT 7693@item -d @var{cvs_root_directory} 7694Use @var{cvs_root_directory} as the root directory 7695pathname of the repository. Overrides the setting of 7696the @code{$CVSROOT} environment variable. @xref{Repository}. 7697 7698@cindex EDITOR, overriding 7699@cindex Overriding EDITOR 7700@item -e @var{editor} 7701Use @var{editor} to enter revision log information. Overrides the 7702setting of the @code{$CVSEDITOR} and @code{$EDITOR} 7703environment variables. For more information, see 7704@ref{Committing your changes}. 7705 7706@item -f 7707Do not read the @file{~/.cvsrc} file. This 7708option is most often used because of the 7709non-orthogonality of the @sc{cvs} option set. For 7710example, the @samp{cvs log} option @samp{-N} (turn off 7711display of tag names) does not have a corresponding 7712option to turn the display on. So if you have 7713@samp{-N} in the @file{~/.cvsrc} entry for @samp{log}, 7714you may need to use @samp{-f} to show the tag names. 7715 7716@item -H 7717@itemx --help 7718Display usage information about the specified @samp{cvs_command} 7719(but do not actually execute the command). If you don't specify 7720a command name, @samp{cvs -H} displays overall help for 7721@sc{cvs}, including a list of other help options. 7722@c It seems to me it is better to document it this way 7723@c rather than trying to update this documentation 7724@c every time that we add a --help-foo option. But 7725@c perhaps that is confusing... 7726 7727@item -l 7728Do not log the @samp{cvs_command} in the command history (but execute it 7729anyway). @xref{history}, for information on command history. 7730 7731@cindex Read-only mode 7732@item -n 7733Do not change any files. Attempt to execute the 7734@samp{cvs_command}, but only to issue reports; do not remove, 7735update, or merge any existing files, or create any new files. 7736 7737Note that @sc{cvs} will not necessarily produce exactly 7738the same output as without @samp{-n}. In some cases 7739the output will be the same, but in other cases 7740@sc{cvs} will skip some of the processing that would 7741have been required to produce the exact same output. 7742 7743@item -Q 7744Cause the command to be really quiet; the command will only 7745generate output for serious problems. 7746 7747@item -q 7748Cause the command to be somewhat quiet; informational messages, 7749such as reports of recursion through subdirectories, are 7750suppressed. 7751 7752@cindex Read-only files, and -r 7753@item -r 7754Make new working files read-only. Same effect 7755as if the @code{$CVSREAD} environment variable is set 7756(@pxref{Environment variables}). The default is to 7757make working files writable, unless watches are on 7758(@pxref{Watches}). 7759 7760@item -s @var{variable}=@var{value} 7761Set a user variable (@pxref{Variables}). 7762 7763@cindex Trace 7764@item -t 7765Trace program execution; display messages showing the steps of 7766@sc{cvs} activity. Particularly useful with @samp{-n} to explore the 7767potential impact of an unfamiliar command. 7768 7769@item -v 7770@item --version 7771Display version and copyright information for @sc{cvs}. 7772 7773@cindex CVSREAD, overriding 7774@cindex Overriding CVSREAD 7775@item -w 7776Make new working files read-write. Overrides the 7777setting of the @code{$CVSREAD} environment variable. 7778Files are created read-write by default, unless @code{$CVSREAD} is 7779set or @samp{-r} is given. 7780@c Note that -w only overrides -r and CVSREAD; it has 7781@c no effect on files which are readonly because of 7782@c "cvs watch on". My guess is that is the way it 7783@c should be (or should "cvs -w get" on a watched file 7784@c be the same as a get and a cvs edit?), but I'm not 7785@c completely sure whether to document it this way. 7786 7787@item -x 7788@cindex Encryption 7789Encrypt all communication between the client and the 7790server. Only has an effect on the @sc{cvs} client. As 7791of this writing, this is only implemented when using a 7792GSSAPI connection (@pxref{GSSAPI authenticated}) or a 7793Kerberos connection (@pxref{Kerberos authenticated}). 7794Enabling encryption implies that message traffic is 7795also authenticated. Encryption support is not 7796available by default; it must be enabled using a 7797special configure option, @file{--enable-encryption}, 7798when you build @sc{cvs}. 7799 7800@item -z @var{gzip-level} 7801@cindex Compression 7802@cindex Gzip 7803Set the compression level. 7804Valid levels are 1 (high speed, low compression) to 78059 (low speed, high compression), or 0 to disable 7806compression (the default). 7807Only has an effect on the @sc{cvs} client. 7808 7809@end table 7810 7811@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7812@node Common options 7813@appendixsec Common command options 7814@cindex Common options 7815@cindex Right-hand options 7816 7817This section describes the @samp{command_options} that 7818are available across several @sc{cvs} commands. These 7819options are always given to the right of 7820@samp{cvs_command}. Not all 7821commands support all of these options; each option is 7822only supported for commands where it makes sense. 7823However, when a command has one of these options you 7824can almost always count on the same behavior of the 7825option as in other commands. (Other command options, 7826which are listed with the individual commands, may have 7827different behavior from one @sc{cvs} command to the other). 7828 7829@strong{Warning:} the @samp{history} command is an exception; it supports 7830many options that conflict even with these standard options. 7831 7832@table @code 7833@cindex Dates 7834@cindex Time 7835@cindex Specifying dates 7836@item -D @var{date_spec} 7837Use the most recent revision no later than @var{date_spec}. 7838@var{date_spec} is a single argument, a date description 7839specifying a date in the past. 7840 7841The specification is @dfn{sticky} when you use it to make a 7842private copy of a source file; that is, when you get a working 7843file using @samp{-D}, @sc{cvs} records the date you specified, so that 7844further updates in the same directory will use the same date 7845(for more information on sticky tags/dates, @pxref{Sticky tags}). 7846 7847@samp{-D} is available with the @code{checkout}, 7848@code{diff}, @code{export}, @code{history}, 7849@code{rdiff}, @code{rtag}, and @code{update} commands. 7850(The @code{history} command uses this option in a 7851slightly different way; @pxref{history options}). 7852 7853@c What other formats should we accept? I don't want 7854@c to start accepting a whole mess of non-standard 7855@c new formats (there are a lot which are in wide use in 7856@c one context or another), but practicality does 7857@c dictate some level of flexibility. 7858@c * POSIX.2 (e.g. touch, ls output, date) and other 7859@c POSIX and/or de facto unix standards (e.g. at). The 7860@c practice here is too inconsistent to be of any use. 7861@c * VMS dates. This is not a formal standard, but 7862@c there is a published specification (see SYS$ASCTIM 7863@c and SYS$BINTIM in the _VMS System Services Reference 7864@c Manual_), it is implemented consistently in VMS 7865@c utilities, and VMS users will expect CVS running on 7866@c VMS to support this format (and if we're going to do 7867@c that, better to make CVS support it on all 7868@c platforms. Maybe). 7869@c 7870@c NOTE: The tar manual has some documentation for 7871@c getdate.y (just for our info; we don't want to 7872@c attempt to document all the formats accepted by 7873@c getdate.y). 7874@c 7875@c One more note: In output, CVS should consistently 7876@c use one date format, and that format should be one that 7877@c it accepts in input as well. The former isn't 7878@c really true (see survey below), and I'm not 7879@c sure that either of those formats is accepted in 7880@c input. 7881@c 7882@c cvs log 7883@c current 1996/01/02 13:45:31 7884@c Internet 02 Jan 1996 13:45:31 UT 7885@c ISO 1996-01-02 13:45:31 7886@c cvs ann 7887@c current 02-Jan-96 7888@c Internet-like 02 Jan 96 7889@c ISO 96-01-02 7890@c cvs status 7891@c current Tue Jun 11 02:54:53 1996 7892@c Internet [Tue,] 11 Jun 1996 02:54:53 7893@c ISO 1996-06-11 02:54:53 7894@c note: date possibly should be omitted entirely for 7895@c other reasons. 7896@c cvs editors 7897@c current Tue Jun 11 02:54:53 1996 GMT 7898@c cvs history 7899@c current 06/11 02:54 +0000 7900@c any others? 7901@c There is a good chance the proper solution has to 7902@c involve at least some level of letting the user 7903@c decide which format (with the default being the 7904@c formats CVS has always used; changing these might be 7905@c _very_ disruptive since scripts may very well be 7906@c parsing them). 7907@c 7908@c Another random bit of prior art concerning dates is 7909@c the strptime function which takes templates such as 7910@c "%m/%d/%y", and apparent a variant of getdate() 7911@c which also honors them. See 7912@c X/Open CAE Specification, System Interfaces and 7913@c Headers Issue 4, Version 2 (September 1994), in the 7914@c entry for getdate() on page 231 7915 7916@cindex Timezone, in input 7917@cindex Zone, time, in input 7918A wide variety of date formats are supported by 7919@sc{cvs}. The most standard ones are ISO8601 (from the 7920International Standards Organization) and the Internet 7921e-mail standard (specified in RFC822 as amended by 7922RFC1123). 7923 7924@c Probably should be doing more to spell out just what 7925@c the rules are, rather than just giving examples. 7926@c But I want to keep this simple too. 7927@c So I don't know.... 7928@c A few specific issues: (1) Maybe should reassure 7929@c people that years after 2000 7930@c work (they are in the testsuite, so they do indeed 7931@c work). (2) What do two digit years 7932@c mean? Where do we accept them? (3) Local times can 7933@c be ambiguous or nonexistent if they fall during the 7934@c hour when daylight savings time goes into or out of 7935@c effect. Pretty obscure, so I'm not at all sure we 7936@c should be documenting the behavior in that case. 7937ISO8601 dates have many variants but a few examples 7938are: 7939 7940@example 79411972-09-24 79421972-09-24 20:05 7943@end example 7944@c I doubt we really accept all ISO8601 format dates 7945@c (for example, decimal hours like 1972-09-24 20,2) 7946@c I'm not sure we should, many of them are pretty 7947@c bizarre and it has lots of gratuitous multiple ways 7948@c to specify the same thing. 7949 7950There are a lot more ISO8601 date formats, and @sc{cvs} 7951accepts many of them, but you probably don't want to 7952hear the @emph{whole} long story :-). 7953 7954@c Citing a URL here is kind of problematic given how 7955@c much they change and people who have old versions of 7956@c this manual, but in case we want to reinstate an 7957@c ISO8601 URL, a few are: 7958@c http://www.saqqara.demon.co.uk/datefmt.htm 7959@c http://www.cl.cam.ac.uk/~mgk25/iso-time.html 7960@c Citing some other ISO8601 source is probably even 7961@c worse :-). 7962 7963In addition to the dates allowed in Internet e-mail 7964itself, @sc{cvs} also allows some of the fields to be 7965omitted. For example: 7966@c FIXME: Need to figure out better, and document, 7967@c what we want to allow the user to omit. 7968@c NOTE: "omit" does not imply "reorder". 7969@c FIXME: Need to cite a web page describing how to get 7970@c RFC's. 7971 7972@example 797324 Sep 1972 20:05 797424 Sep 7975@end example 7976 7977The date is interpreted as being in the 7978local timezone, unless a specific timezone is 7979specified. 7980 7981These two date formats are preferred. However, 7982@sc{cvs} currently accepts a wide variety of other date 7983formats. They are intentionally not documented here in 7984any detail, and future versions of @sc{cvs} might not 7985accept all of them. 7986@c We should document and testsuite "now" and 7987@c "yesterday". "now" is mentioned in the FAQ and 7988@c "yesterday" is mentioned in this document (and the 7989@c message from "cvs import" suggesting a merge 7990@c command). What else? Probably some/all of the "3 7991@c weeks ago" family. 7992@c 7993@c Maybe at 7994@c some point have CVS start give warnings on "unofficial" 7995@c formats (many of which might be typos or user 7996@c misunderstandings, and/or formats people never/rarely 7997@c use to specify dates)? 7998 7999One such format is 8000@code{@var{month}/@var{day}/@var{year}}. This may 8001confuse people who are accustomed to having the month 8002and day in the other order; @samp{1/4/96} is January 4, 8003not April 1. 8004 8005Remember to quote the argument to the @samp{-D} 8006flag so that your shell doesn't interpret spaces as 8007argument separators. A command using the @samp{-D} 8008flag can look like this: 8009 8010@example 8011$ cvs diff -D "1 hour ago" cvs.texinfo 8012@end example 8013 8014@cindex Forcing a tag match 8015@item -f 8016When you specify a particular date or tag to @sc{cvs} commands, they 8017normally ignore files that do not contain the tag (or did not 8018exist prior to the date) that you specified. Use the @samp{-f} option 8019if you want files retrieved even when there is no match for the 8020tag or date. (The most recent revision of the file 8021will be used). 8022 8023Note that even with @samp{-f}, a tag that you specify 8024must exist (that is, in some file, not necessary in 8025every file). This is so that @sc{cvs} will continue to 8026give an error if you mistype a tag name. 8027 8028@need 800 8029@samp{-f} is available with these commands: 8030@code{annotate}, @code{checkout}, @code{export}, 8031@code{rdiff}, @code{rtag}, and @code{update}. 8032 8033@strong{Warning:} The @code{commit} and @code{remove} 8034commands also have a 8035@samp{-f} option, but it has a different behavior for 8036those commands. See @ref{commit options}, and 8037@ref{Removing files}. 8038 8039@item -k @var{kflag} 8040Alter the default processing of keywords. 8041@xref{Keyword substitution}, for the meaning of 8042@var{kflag}. Your @var{kflag} specification is 8043@dfn{sticky} when you use it to create a private copy 8044of a source file; that is, when you use this option 8045with the @code{checkout} or @code{update} commands, 8046@sc{cvs} associates your selected @var{kflag} with the 8047file, and continues to use it with future update 8048commands on the same file until you specify otherwise. 8049 8050The @samp{-k} option is available with the @code{add}, 8051@code{checkout}, @code{diff}, @code{import} and 8052@code{update} commands. 8053 8054@item -l 8055Local; run only in current working directory, rather than 8056recursing through subdirectories. 8057 8058@strong{Warning:} this is not the same 8059as the overall @samp{cvs -l} option, which you can specify to the 8060left of a cvs command! 8061 8062Available with the following commands: @code{annotate}, @code{checkout}, 8063@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8064@code{log}, @code{rdiff}, @code{remove}, @code{rtag}, 8065@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8066and @code{watchers}. 8067 8068@cindex Editor, avoiding invocation of 8069@cindex Avoiding editor invocation 8070@item -m @var{message} 8071Use @var{message} as log information, instead of 8072invoking an editor. 8073 8074Available with the following commands: @code{add}, 8075@code{commit} and @code{import}. 8076 8077@item -n 8078Do not run any checkout/commit/tag program. (A program can be 8079specified to run on each of these activities, in the modules 8080database (@pxref{modules}); this option bypasses it). 8081 8082@strong{Warning:} this is not the same as the overall @samp{cvs -n} 8083option, which you can specify to the left of a cvs command! 8084 8085Available with the @code{checkout}, @code{commit}, @code{export}, 8086and @code{rtag} commands. 8087 8088@item -P 8089Prune empty directories. See @ref{Removing directories}. 8090 8091@item -p 8092Pipe the files retrieved from the repository to standard output, 8093rather than writing them in the current directory. Available 8094with the @code{checkout} and @code{update} commands. 8095 8096@item -R 8097Process directories recursively. This is on by default. 8098 8099Available with the following commands: @code{annotate}, @code{checkout}, 8100@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8101@code{rdiff}, @code{remove}, @code{rtag}, 8102@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8103and @code{watchers}. 8104 8105@item -r @var{tag} 8106@cindex HEAD, special tag 8107@cindex BASE, special tag 8108Use the revision specified by the @var{tag} argument instead of the 8109default @dfn{head} revision. As well as arbitrary tags defined 8110with the @code{tag} or @code{rtag} command, two special tags are 8111always available: @samp{HEAD} refers to the most recent version 8112available in the repository, and @samp{BASE} refers to the 8113revision you last checked out into the current working directory. 8114 8115@c FIXME: What does HEAD really mean? I believe that 8116@c the current answer is the head of the default branch 8117@c for all cvs commands except diff. For diff, it 8118@c seems to be (a) the head of the trunk (or the default 8119@c branch?) if there is no sticky tag, (b) the head of the 8120@c branch for the sticky tag, if there is a sticky tag. 8121@c (b) is ugly as it differs 8122@c from what HEAD means for other commands, but people 8123@c and/or scripts are quite possibly used to it. 8124@c See "head" tests in sanity.sh. 8125@c Probably the best fix is to introduce two new 8126@c special tags, ".thead" for the head of the trunk, 8127@c and ".bhead" for the head of the current branch. 8128@c Then deprecate HEAD. This has the advantage of 8129@c not surprising people with a change to HEAD, and a 8130@c side benefit of also phasing out the poorly-named 8131@c HEAD (see discussion of reserved tag names in node 8132@c "Tags"). Of course, .thead and .bhead should be 8133@c carefully implemented (with the implementation the 8134@c same for "diff" as for everyone else), test cases 8135@c written (similar to the ones in "head"), new tests 8136@c cases written for things like default branches, &c. 8137 8138The tag specification is sticky when you use this 8139@c option 8140with @code{checkout} or @code{update} to make your own 8141copy of a file: @sc{cvs} remembers the tag and continues to use it on 8142future update commands, until you specify otherwise (for more information 8143on sticky tags/dates, @pxref{Sticky tags}). 8144 8145The tag can be either a symbolic or numeric tag, as 8146described in @ref{Tags}, or the name of a branch, as 8147described in @ref{Branching and merging}. 8148 8149Specifying the @samp{-q} global option along with the 8150@samp{-r} command option is often useful, to suppress 8151the warning messages when the @sc{rcs} file 8152does not contain the specified tag. 8153 8154@strong{Warning:} this is not the same as the overall @samp{cvs -r} option, 8155which you can specify to the left of a @sc{cvs} command! 8156 8157@samp{-r} is available with the @code{checkout}, @code{commit}, 8158@code{diff}, @code{history}, @code{export}, @code{rdiff}, 8159@code{rtag}, and @code{update} commands. 8160 8161@item -W 8162Specify file names that should be filtered. You can 8163use this option repeatedly. The spec can be a file 8164name pattern of the same type that you can specify in 8165the @file{.cvswrappers} file. 8166Available with the following commands: @code{import}, 8167and @code{update}. 8168 8169@end table 8170 8171@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8172@node admin 8173@appendixsec admin---Administration 8174@cindex Admin (subcommand) 8175 8176@itemize @bullet 8177@item 8178Requires: repository, working directory. 8179@item 8180Changes: repository. 8181@item 8182Synonym: rcs 8183@end itemize 8184 8185This is the @sc{cvs} interface to assorted 8186administrative facilities. Some of them have 8187questionable usefulness for @sc{cvs} but exist for 8188historical purposes. Some of the questionable options 8189are likely to disappear in the future. This command 8190@emph{does} work recursively, so extreme care should be 8191used. 8192 8193@cindex cvsadmin 8194On unix, if there is a group named @code{cvsadmin}, 8195only members of that group can run @code{cvs admin} 8196(except for the @code{cvs admin -k} command, which can 8197be run by anybody). This group should exist on the 8198server, or any system running the non-client/server 8199@sc{cvs}. To disallow @code{cvs admin} for all users, 8200create a group with no users in it. On NT, the 8201@code{cvsadmin} feature does not exist and all users 8202can run @code{cvs admin}. 8203 8204@menu 8205* admin options:: admin options 8206@end menu 8207 8208@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8209@node admin options 8210@appendixsubsec admin options 8211 8212Some of these options have questionable usefulness for 8213@sc{cvs} but exist for historical purposes. Some even 8214make it impossible to use @sc{cvs} until you undo the 8215effect! 8216 8217@table @code 8218@item -A@var{oldfile} 8219Might not work together with @sc{cvs}. Append the 8220access list of @var{oldfile} to the access list of the 8221@sc{rcs} file. 8222 8223@item -a@var{logins} 8224Might not work together with @sc{cvs}. Append the 8225login names appearing in the comma-separated list 8226@var{logins} to the access list of the @sc{rcs} file. 8227 8228@item -b[@var{rev}] 8229Set the default branch to @var{rev}. In @sc{cvs}, you 8230normally do not manipulate default branches; sticky 8231tags (@pxref{Sticky tags}) are a better way to decide 8232which branch you want to work on. There is one reason 8233to run @code{cvs admin -b}: to revert to the vendor's 8234version when using vendor branches (@pxref{Reverting 8235local changes}). 8236There can be no space between @samp{-b} and its argument. 8237@c Hmm, we don't document the usage where rev is 8238@c omitted. Maybe that usage can/should be deprecated 8239@c (and replaced with -bHEAD or something?) (so we can toss 8240@c the optional argument). Note that -bHEAD does not 8241@c work, as of 17 Sep 1997, but probably will once "cvs 8242@c admin" is internal to CVS. 8243 8244@cindex Comment leader 8245@item -c@var{string} 8246Sets the comment leader to @var{string}. The comment 8247leader is not used by current versions of @sc{cvs} or 8248@sc{rcs} 5.7. Therefore, you can almost surely not 8249worry about it. @xref{Keyword substitution}. 8250 8251@item -e[@var{logins}] 8252Might not work together with @sc{cvs}. Erase the login 8253names appearing in the comma-separated list 8254@var{logins} from the access list of the RCS file. If 8255@var{logins} is omitted, erase the entire access list. 8256There can be no space between @samp{-e} and its argument. 8257 8258@item -I 8259Run interactively, even if the standard input is not a 8260terminal. This option does not work with the 8261client/server @sc{cvs} and is likely to disappear in 8262a future release of @sc{cvs}. 8263 8264@item -i 8265Useless with @sc{cvs}. This creates and initializes a 8266new @sc{rcs} file, without depositing a revision. With 8267@sc{cvs}, add files with the @code{cvs add} command 8268(@pxref{Adding files}). 8269 8270@item -k@var{subst} 8271Set the default keyword 8272substitution to @var{subst}. @xref{Keyword 8273substitution}. Giving an explicit @samp{-k} option to 8274@code{cvs update}, @code{cvs export}, or @code{cvs 8275checkout} overrides this default. 8276 8277@item -l[@var{rev}] 8278Lock the revision with number @var{rev}. If a branch 8279is given, lock the latest revision on that branch. If 8280@var{rev} is omitted, lock the latest revision on the 8281default branch. There can be no space between 8282@samp{-l} and its argument. 8283 8284This can be used in conjunction with the 8285@file{rcslock.pl} script in the @file{contrib} 8286directory of the @sc{cvs} source distribution to 8287provide reserved checkouts (where only one user can be 8288editing a given file at a time). See the comments in 8289that file for details (and see the @file{README} file 8290in that directory for disclaimers about the unsupported 8291nature of contrib). According to comments in that 8292file, locking must set to strict (which is the default). 8293 8294@item -L 8295Set locking to strict. Strict locking means that the 8296owner of an RCS file is not exempt from locking for 8297checkin. For use with @sc{cvs}, strict locking must be 8298set; see the discussion under the @samp{-l} option above. 8299 8300@cindex Changing a log message 8301@cindex Replacing a log message 8302@cindex Correcting a log message 8303@cindex Fixing a log message 8304@cindex Log message, correcting 8305@item -m@var{rev}:@var{msg} 8306Replace the log message of revision @var{rev} with 8307@var{msg}. 8308 8309@c The rcs -M option, to suppress sending mail, has never been 8310@c documented as a cvs admin option. 8311 8312@item -N@var{name}[:[@var{rev}]] 8313Act like @samp{-n}, except override any previous 8314assignment of @var{name}. For use with magic branches, 8315see @ref{Magic branch numbers}. 8316 8317@item -n@var{name}[:[@var{rev}]] 8318Associate the symbolic name @var{name} with the branch 8319or revision @var{rev}. It is normally better to use 8320@samp{cvs tag} or @samp{cvs rtag} instead. Delete the 8321symbolic name if both @samp{:} and @var{rev} are 8322omitted; otherwise, print an error message if 8323@var{name} is already associated with another number. 8324If @var{rev} is symbolic, it is expanded before 8325association. A @var{rev} consisting of a branch number 8326followed by a @samp{.} stands for the current latest 8327revision in the branch. A @samp{:} with an empty 8328@var{rev} stands for the current latest revision on the 8329default branch, normally the trunk. For example, 8330@samp{cvs admin -n@var{name}:} associates @var{name} with the 8331current latest revision of all the RCS files; 8332this contrasts with @samp{cvs admin -n@var{name}:$} which 8333associates @var{name} with the revision numbers 8334extracted from keyword strings in the corresponding 8335working files. 8336 8337@cindex Deleting revisions 8338@cindex Outdating revisions 8339@cindex Saving space 8340@item -o@var{range} 8341Deletes (@dfn{outdates}) the revisions given by 8342@var{range}. 8343 8344Note that this command can be quite dangerous unless 8345you know @emph{exactly} what you are doing (for example 8346see the warnings below about how the 8347@var{rev1}:@var{rev2} syntax is confusing). 8348 8349If you are short on disc this option might help you. 8350But think twice before using it---there is no way short 8351of restoring the latest backup to undo this command! 8352If you delete different revisions than you planned, 8353either due to carelessness or (heaven forbid) a @sc{cvs} 8354bug, there is no opportunity to correct the error 8355before the revisions are deleted. It probably would be 8356a good idea to experiment on a copy of the repository 8357first. 8358 8359Specify @var{range} in one of the following ways: 8360 8361@table @code 8362@item @var{rev1}::@var{rev2} 8363Collapse all revisions between rev1 and rev2, so that 8364@sc{cvs} only stores the differences associated with going 8365from rev1 to rev2, not intermediate steps. For 8366example, after @samp{-o 1.3::1.5} one can retrieve 8367revision 1.3, revision 1.5, or the differences to get 8368from 1.3 to 1.5, but not the revision 1.4, or the 8369differences between 1.3 and 1.4. Other examples: 8370@samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no 8371effect, because there are no intermediate revisions to 8372remove. 8373 8374@item ::@var{rev} 8375Collapse revisions between the beginning of the branch 8376containing @var{rev} and @var{rev} itself. The 8377branchpoint and @var{rev} are left intact. For 8378example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1, 8379revision 1.3.2.5, and everything in between, but leaves 83801.3 and 1.3.2.6 intact. 8381 8382@item @var{rev}:: 8383Collapse revisions between @var{rev} and the end of the 8384branch containing @var{rev}. Revision @var{rev} is 8385left intact but the head revision is deleted. 8386 8387@item @var{rev} 8388Delete the revision @var{rev}. For example, @samp{-o 83891.3} is equivalent to @samp{-o 1.2::1.4}. 8390 8391@item @var{rev1}:@var{rev2} 8392Delete the revisions from @var{rev1} to @var{rev2}, 8393inclusive, on the same branch. One will not be able to 8394retrieve @var{rev1} or @var{rev2} or any of the 8395revisions in between. For example, the command 8396@samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful. 8397It means to delete revisions up to, and including, the 8398tag R_1_02. But beware! If there are files that have not 8399changed between R_1_02 and R_1_03 the file will have 8400@emph{the same} numerical revision number assigned to 8401the tags R_1_02 and R_1_03. So not only will it be 8402impossible to retrieve R_1_02; R_1_03 will also have to 8403be restored from the tapes! In most cases you want to 8404specify @var{rev1}::@var{rev2} instead. 8405 8406@item :@var{rev} 8407Delete revisions from the beginning of the 8408branch containing @var{rev} up to and including 8409@var{rev}. 8410 8411@item @var{rev}: 8412Delete revisions from revision @var{rev}, including 8413@var{rev} itself, to the end of the branch containing 8414@var{rev}. 8415@end table 8416 8417None of the revisions to be deleted may have 8418branches or locks. 8419 8420If any of the revisions to be deleted have symbolic 8421names, and one specifies one of the @samp{::} syntaxes, 8422then @sc{cvs} will give an error and not delete any 8423revisions. If you really want to delete both the 8424symbolic names and the revisions, first delete the 8425symbolic names with @code{cvs tag -d}, then run 8426@code{cvs admin -o}. If one specifies the 8427non-@samp{::} syntaxes, then @sc{cvs} will delete the 8428revisions but leave the symbolic names pointing to 8429nonexistent revisions. This behavior is preserved for 8430compatibility with previous versions of @sc{cvs}, but 8431because it isn't very useful, in the future it may 8432change to be like the @samp{::} case. 8433 8434Due to the way @sc{cvs} handles branches @var{rev} 8435cannot be specified symbolically if it is a branch. 8436@xref{Magic branch numbers}, for an explanation. 8437@c FIXME: is this still true? I suspect not. 8438 8439Make sure that no-one has checked out a copy of the 8440revision you outdate. Strange things will happen if he 8441starts to edit it and tries to check it back in. For 8442this reason, this option is not a good way to take back 8443a bogus commit; commit a new revision undoing the bogus 8444change instead (@pxref{Merging two revisions}). 8445 8446@item -q 8447Run quietly; do not print diagnostics. 8448 8449@item -s@var{state}[:@var{rev}] 8450Useful with @sc{cvs}. Set the state attribute of the 8451revision @var{rev} to @var{state}. If @var{rev} is a 8452branch number, assume the latest revision on that 8453branch. If @var{rev} is omitted, assume the latest 8454revision on the default branch. Any identifier is 8455acceptable for @var{state}. A useful set of states is 8456@samp{Exp} (for experimental), @samp{Stab} (for 8457stable), and @samp{Rel} (for released). By default, 8458the state of a new revision is set to @samp{Exp} when 8459it is created. The state is visible in the output from 8460@var{cvs log} (@pxref{log}), and in the 8461@samp{$@asis{}Log$} and @samp{$@asis{}State$} keywords 8462(@pxref{Keyword substitution}). Note that @sc{cvs} 8463uses the @code{dead} state for its own purposes; to 8464take a file to or from the @code{dead} state use 8465commands like @code{cvs remove} and @code{cvs add}, not 8466@code{cvs admin -s}. 8467 8468@item -t[@var{file}] 8469Useful with @sc{cvs}. Write descriptive text from the 8470contents of the named @var{file} into the RCS file, 8471deleting the existing text. The @var{file} pathname 8472may not begin with @samp{-}. The descriptive text can be seen in the 8473output from @samp{cvs log} (@pxref{log}). 8474There can be no space between @samp{-t} and its argument. 8475 8476If @var{file} is omitted, 8477obtain the text from standard input, terminated by 8478end-of-file or by a line containing @samp{.} by itself. 8479Prompt for the text if interaction is possible; see 8480@samp{-I}. 8481 8482@item -t-@var{string} 8483Similar to @samp{-t@var{file}}. Write descriptive text 8484from the @var{string} into the @sc{rcs} file, deleting 8485the existing text. 8486There can be no space between @samp{-t} and its argument. 8487 8488@c The rcs -T option, do not update last-mod time for 8489@c minor changes, has never been documented as a 8490@c cvs admin option. 8491 8492@item -U 8493Set locking to non-strict. Non-strict locking means 8494that the owner of a file need not lock a revision for 8495checkin. For use with @sc{cvs}, strict locking must be 8496set; see the discussion under the @samp{-l} option 8497above. 8498 8499@item -u[@var{rev}] 8500See the option @samp{-l} above, for a discussion of 8501using this option with @sc{cvs}. Unlock the revision 8502with number @var{rev}. If a branch is given, unlock 8503the latest revision on that branch. If @var{rev} is 8504omitted, remove the latest lock held by the caller. 8505Normally, only the locker of a revision may unlock it; 8506somebody else unlocking a revision breaks the lock. 8507This causes the original locker to be sent a @code{commit} 8508notification (@pxref{Getting Notified}). 8509There can be no space between @samp{-u} and its argument. 8510 8511@item -V@var{n} 8512In previous versions of @sc{cvs}, this option meant to 8513write an @sc{rcs} file which would be acceptable to 8514@sc{rcs} version @var{n}, but it is now obsolete and 8515specifying it will produce an error. 8516@c Note that -V without an argument has never been 8517@c documented as a cvs admin option. 8518 8519@item -x@var{suffixes} 8520In previous versions of @sc{cvs}, this was documented 8521as a way of specifying the names of the @sc{rcs} 8522files. However, @sc{cvs} has always required that the 8523@sc{rcs} files used by @sc{cvs} end in @samp{,v}, so 8524this option has never done anything useful. 8525 8526@c The rcs -z option, to specify the timezone, has 8527@c never been documented as a cvs admin option. 8528@end table 8529 8530 8531@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8532@node checkout 8533@appendixsec checkout---Check out sources for editing 8534@cindex checkout (subcommand) 8535@cindex co (subcommand) 8536 8537@itemize @bullet 8538@item 8539Synopsis: checkout [options] modules@dots{} 8540@item 8541Requires: repository. 8542@item 8543Changes: working directory. 8544@item 8545Synonyms: co, get 8546@end itemize 8547 8548Create or update a working directory containing copies of the 8549source files specified by @var{modules}. You must execute 8550@code{checkout} before using most of the other @sc{cvs} 8551commands, since most of them operate on your working 8552directory. 8553 8554The @var{modules} are either 8555symbolic names for some 8556collection of source directories and files, or paths to 8557directories or files in the repository. The symbolic 8558names are defined in the @samp{modules} file. 8559@xref{modules}. 8560@c Needs an example, particularly of the non-"modules" 8561@c case but probably of both. 8562 8563@c FIXME: this seems like a very odd place to introduce 8564@c people to how CVS works. The bit about unreserved 8565@c checkouts is also misleading as it depends on how 8566@c things are set up. 8567Depending on the modules you specify, @code{checkout} may 8568recursively create directories and populate them with 8569the appropriate source files. You can then edit these 8570source files at any time (regardless of whether other 8571software developers are editing their own copies of the 8572sources); update them to include new changes applied by 8573others to the source repository; or commit your work as 8574a permanent change to the source repository. 8575 8576Note that @code{checkout} is used to create 8577directories. The top-level directory created is always 8578added to the directory where @code{checkout} is 8579invoked, and usually has the same name as the specified 8580module. In the case of a module alias, the created 8581sub-directory may have a different name, but you can be 8582sure that it will be a sub-directory, and that 8583@code{checkout} will show the relative path leading to 8584each file as it is extracted into your private work 8585area (unless you specify the @samp{-Q} global option). 8586 8587The files created by @code{checkout} are created 8588read-write, unless the @samp{-r} option to @sc{cvs} 8589(@pxref{Global options}) is specified, the 8590@code{CVSREAD} environment variable is specified 8591(@pxref{Environment variables}), or a watch is in 8592effect for that file (@pxref{Watches}). 8593 8594Note that running @code{checkout} on a directory that was already 8595built by a prior @code{checkout} is also permitted. 8596This is similar to specifying the @samp{-d} option 8597to the @code{update} command in the sense that new 8598directories that have been created in the repository 8599will appear in your work area. 8600However, @code{checkout} takes a module name whereas 8601@code{update} takes a directory name. Also 8602to use @code{checkout} this way it must be run from the 8603top level directory (where you originally ran 8604@code{checkout} from), so before you run 8605@code{checkout} to update an existing directory, don't 8606forget to change your directory to the top level 8607directory. 8608 8609For the output produced by the @code{checkout} command 8610see @ref{update output}. 8611 8612@menu 8613* checkout options:: checkout options 8614* checkout examples:: checkout examples 8615@end menu 8616 8617@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8618@node checkout options 8619@appendixsubsec checkout options 8620 8621These standard options are supported by @code{checkout} 8622(@pxref{Common options}, for a complete description of 8623them): 8624 8625@table @code 8626@item -D @var{date} 8627Use the most recent revision no later than @var{date}. 8628This option is sticky, and implies @samp{-P}. See 8629@ref{Sticky tags}, for more information on sticky tags/dates. 8630 8631@item -f 8632Only useful with the @samp{-D @var{date}} or @samp{-r 8633@var{tag}} flags. If no matching revision is found, 8634retrieve the most recent revision (instead of ignoring 8635the file). 8636 8637@item -k @var{kflag} 8638Process keywords according to @var{kflag}. See 8639@ref{Keyword substitution}. 8640This option is sticky; future updates of 8641this file in this working directory will use the same 8642@var{kflag}. The @code{status} command can be viewed 8643to see the sticky options. See @ref{Invoking CVS}, for 8644more information on the @code{status} command. 8645 8646@item -l 8647Local; run only in current working directory. 8648 8649@item -n 8650Do not run any checkout program (as specified 8651with the @samp{-o} option in the modules file; 8652@pxref{modules}). 8653 8654@item -P 8655Prune empty directories. See @ref{Moving directories}. 8656 8657@item -p 8658Pipe files to the standard output. 8659 8660@item -R 8661Checkout directories recursively. This option is on by default. 8662 8663@item -r @var{tag} 8664Use revision @var{tag}. This option is sticky, and implies @samp{-P}. 8665See @ref{Sticky tags}, for more information on sticky tags/dates. 8666@end table 8667 8668In addition to those, you can use these special command 8669options with @code{checkout}: 8670 8671@table @code 8672@item -A 8673Reset any sticky tags, dates, or @samp{-k} options. 8674See @ref{Sticky tags}, for more information on sticky tags/dates. 8675 8676@item -c 8677Copy the module file, sorted, to the standard output, 8678instead of creating or modifying any files or 8679directories in your working directory. 8680 8681@item -d @var{dir} 8682Create a directory called @var{dir} for the working 8683files, instead of using the module name. In general, 8684using this flag is equivalent to using @samp{mkdir 8685@var{dir}; cd @var{dir}} followed by the checkout 8686command without the @samp{-d} flag. 8687 8688There is an important exception, however. It is very 8689convenient when checking out a single item to have the 8690output appear in a directory that doesn't contain empty 8691intermediate directories. In this case @emph{only}, 8692@sc{cvs} tries to ``shorten'' pathnames to avoid those empty 8693directories. 8694 8695For example, given a module @samp{foo} that contains 8696the file @samp{bar.c}, the command @samp{cvs co -d dir 8697foo} will create directory @samp{dir} and place 8698@samp{bar.c} inside. Similarly, given a module 8699@samp{bar} which has subdirectory @samp{baz} wherein 8700there is a file @samp{quux.c}, the command @samp{cvs -d 8701dir co bar/baz} will create directory @samp{dir} and 8702place @samp{quux.c} inside. 8703 8704Using the @samp{-N} flag will defeat this behavior. 8705Given the same module definitions above, @samp{cvs co 8706-N -d dir foo} will create directories @samp{dir/foo} 8707and place @samp{bar.c} inside, while @samp{cvs co -N -d 8708dir bar/baz} will create directories @samp{dir/bar/baz} 8709and place @samp{quux.c} inside. 8710 8711@item -j @var{tag} 8712With two @samp{-j} options, merge changes from the 8713revision specified with the first @samp{-j} option to 8714the revision specified with the second @samp{j} option, 8715into the working directory. 8716 8717With one @samp{-j} option, merge changes from the 8718ancestor revision to the revision specified with the 8719@samp{-j} option, into the working directory. The 8720ancestor revision is the common ancestor of the 8721revision which the working directory is based on, and 8722the revision specified in the @samp{-j} option. 8723 8724In addition, each -j option can contain an optional 8725date specification which, when used with branches, can 8726limit the chosen revision to one within a specific 8727date. An optional date is specified by adding a colon 8728(:) to the tag: 8729@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 8730 8731@xref{Branching and merging}. 8732 8733@item -N 8734Only useful together with @samp{-d @var{dir}}. With 8735this option, @sc{cvs} will not ``shorten'' module paths 8736in your working directory when you check out a single 8737module. See the @samp{-d} flag for examples and a 8738discussion. 8739 8740@item -s 8741Like @samp{-c}, but include the status of all modules, 8742and sort it by the status string. @xref{modules}, for 8743info about the @samp{-s} option that is used inside the 8744modules file to set the module status. 8745@end table 8746 8747@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8748@node checkout examples 8749@appendixsubsec checkout examples 8750 8751Get a copy of the module @samp{tc}: 8752 8753@example 8754$ cvs checkout tc 8755@end example 8756 8757Get a copy of the module @samp{tc} as it looked one day 8758ago: 8759 8760@example 8761$ cvs checkout -D yesterday tc 8762@end example 8763 8764@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8765@node commit 8766@appendixsec commit---Check files into the repository 8767@cindex commit (subcommand) 8768 8769@itemize @bullet 8770@item 8771Synopsis: commit [-lnRf] [-m 'log_message' | 8772-F file] [-r revision] [files@dots{}] 8773@item 8774Requires: working directory, repository. 8775@item 8776Changes: repository. 8777@item 8778Synonym: ci 8779@end itemize 8780 8781Use @code{commit} when you want to incorporate changes 8782from your working source files into the source 8783repository. 8784 8785If you don't specify particular files to commit, all of 8786the files in your working current directory are 8787examined. @code{commit} is careful to change in the 8788repository only those files that you have really 8789changed. By default (or if you explicitly specify the 8790@samp{-R} option), files in subdirectories are also 8791examined and committed if they have changed; you can 8792use the @samp{-l} option to limit @code{commit} to the 8793current directory only. 8794 8795@code{commit} verifies that the selected files are up 8796to date with the current revisions in the source 8797repository; it will notify you, and exit without 8798committing, if any of the specified files must be made 8799current first with @code{update} (@pxref{update}). 8800@code{commit} does not call the @code{update} command 8801for you, but rather leaves that for you to do when the 8802time is right. 8803 8804When all is well, an editor is invoked to allow you to 8805enter a log message that will be written to one or more 8806logging programs (@pxref{modules}, and @pxref{loginfo}) 8807and placed in the @sc{rcs} file inside the 8808repository. This log message can be retrieved with the 8809@code{log} command; see @ref{log}. You can specify the 8810log message on the command line with the @samp{-m 8811@var{message}} option, and thus avoid the editor invocation, 8812or use the @samp{-F @var{file}} option to specify 8813that the argument file contains the log message. 8814 8815@menu 8816* commit options:: commit options 8817* commit examples:: commit examples 8818@end menu 8819 8820@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8821@node commit options 8822@appendixsubsec commit options 8823 8824These standard options are supported by @code{commit} 8825(@pxref{Common options}, for a complete description of 8826them): 8827 8828@table @code 8829@item -l 8830Local; run only in current working directory. 8831 8832@item -n 8833Do not run any module program. 8834 8835@item -R 8836Commit directories recursively. This is on by default. 8837 8838@item -r @var{revision} 8839Commit to @var{revision}. @var{revision} must be 8840either a branch, or a revision on the main trunk that 8841is higher than any existing revision number 8842(@pxref{Assigning revisions}). You 8843cannot commit to a specific revision on a branch. 8844@c FIXME: Need xref for branch case. 8845@end table 8846 8847@code{commit} also supports these options: 8848 8849@table @code 8850@item -F @var{file} 8851Read the log message from @var{file}, instead 8852of invoking an editor. 8853 8854@item -f 8855Note that this is not the standard behavior of 8856the @samp{-f} option as defined in @ref{Common options}. 8857 8858Force @sc{cvs} to commit a new revision even if you haven't 8859made any changes to the file. If the current revision 8860of @var{file} is 1.7, then the following two commands 8861are equivalent: 8862 8863@example 8864$ cvs commit -f @var{file} 8865$ cvs commit -r 1.8 @var{file} 8866@end example 8867 8868@c This is odd, but it's how CVS has worked for some 8869@c time. 8870The @samp{-f} option disables recursion (i.e., it 8871implies @samp{-l}). To force @sc{cvs} to commit a new 8872revision for all files in all subdirectories, you must 8873use @samp{-f -R}. 8874 8875@item -m @var{message} 8876Use @var{message} as the log message, instead of 8877invoking an editor. 8878@end table 8879 8880@need 2000 8881@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8882@node commit examples 8883@appendixsubsec commit examples 8884 8885@c FIXME: this material wants to be somewhere 8886@c in "Branching and merging". 8887 8888@appendixsubsubsec Committing to a branch 8889 8890You can commit to a branch revision (one that has an 8891even number of dots) with the @samp{-r} option. To 8892create a branch revision, use the @samp{-b} option 8893of the @code{rtag} or @code{tag} commands 8894(@pxref{Branching and merging}). Then, either @code{checkout} or 8895@code{update} can be used to base your sources on the 8896newly created branch. From that point on, all 8897@code{commit} changes made within these working sources 8898will be automatically added to a branch revision, 8899thereby not disturbing main-line development in any 8900way. For example, if you had to create a patch to the 89011.2 version of the product, even though the 2.0 version 8902is already under development, you might do: 8903 8904@example 8905$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module 8906$ cvs checkout -r FCS1_2_Patch product_module 8907$ cd product_module 8908[[ hack away ]] 8909$ cvs commit 8910@end example 8911 8912@noindent 8913This works automatically since the @samp{-r} option is 8914sticky. 8915 8916@appendixsubsubsec Creating the branch after editing 8917 8918Say you have been working on some extremely 8919experimental software, based on whatever revision you 8920happened to checkout last week. If others in your 8921group would like to work on this software with you, but 8922without disturbing main-line development, you could 8923commit your change to a new branch. Others can then 8924checkout your experimental stuff and utilize the full 8925benefit of @sc{cvs} conflict resolution. The scenario might 8926look like: 8927 8928@c FIXME: Should we be recommending tagging the branchpoint? 8929@example 8930[[ hacked sources are present ]] 8931$ cvs tag -b EXPR1 8932$ cvs update -r EXPR1 8933$ cvs commit 8934@end example 8935 8936The @code{update} command will make the @samp{-r 8937EXPR1} option sticky on all files. Note that your 8938changes to the files will never be removed by the 8939@code{update} command. The @code{commit} will 8940automatically commit to the correct branch, because the 8941@samp{-r} is sticky. You could also do like this: 8942 8943@c FIXME: Should we be recommending tagging the branchpoint? 8944@example 8945[[ hacked sources are present ]] 8946$ cvs tag -b EXPR1 8947$ cvs commit -r EXPR1 8948@end example 8949 8950@noindent 8951but then, only those files that were changed by you 8952will have the @samp{-r EXPR1} sticky flag. If you hack 8953away, and commit without specifying the @samp{-r EXPR1} 8954flag, some files may accidentally end up on the main 8955trunk. 8956 8957To work with you on the experimental change, others 8958would simply do 8959 8960@example 8961$ cvs checkout -r EXPR1 whatever_module 8962@end example 8963 8964@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8965@node diff 8966@appendixsec diff---Show differences between revisions 8967@cindex diff (subcommand) 8968 8969@itemize @bullet 8970@item 8971Synopsis: diff [-lR] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files@dots{}] 8972@item 8973Requires: working directory, repository. 8974@item 8975Changes: nothing. 8976@end itemize 8977 8978The @code{diff} command is used to compare different 8979revisions of files. The default action is to compare 8980your working files with the revisions they were based 8981on, and report any differences that are found. 8982 8983If any file names are given, only those files are 8984compared. If any directories are given, all files 8985under them will be compared. 8986 8987The exit status for diff is different than for other 8988@sc{cvs} commands; for details @ref{Exit status}. 8989 8990@menu 8991* diff options:: diff options 8992* diff examples:: diff examples 8993@end menu 8994 8995@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8996@node diff options 8997@appendixsubsec diff options 8998 8999These standard options are supported by @code{diff} 9000(@pxref{Common options}, for a complete description of 9001them): 9002 9003@table @code 9004@item -D @var{date} 9005Use the most recent revision no later than @var{date}. 9006See @samp{-r} for how this affects the comparison. 9007 9008@item -k @var{kflag} 9009Process keywords according to @var{kflag}. See 9010@ref{Keyword substitution}. 9011 9012@item -l 9013Local; run only in current working directory. 9014 9015@item -R 9016Examine directories recursively. This option is on by 9017default. 9018 9019@item -r @var{tag} 9020Compare with revision @var{tag}. Zero, one or two 9021@samp{-r} options can be present. With no @samp{-r} 9022option, the working file will be compared with the 9023revision it was based on. With one @samp{-r}, that 9024revision will be compared to your current working file. 9025With two @samp{-r} options those two revisions will be 9026compared (and your working file will not affect the 9027outcome in any way). 9028@c We should be a lot more explicit, with examples, 9029@c about the difference between "cvs diff" and "cvs 9030@c diff -r HEAD". This often confuses new users. 9031 9032One or both @samp{-r} options can be replaced by a 9033@samp{-D @var{date}} option, described above. 9034@end table 9035 9036@c Conceptually, this is a disaster. There are 3 9037@c zillion diff formats that we support via the diff 9038@c library. It is not obvious to me that we should 9039@c document them all. Maybe just the most common ones 9040@c like -c and -u, and think about phasing out the 9041@c obscure ones. 9042@c FIXCVS: also should be a way to specify an external 9043@c diff program (which can be different for different 9044@c file types) and pass through 9045@c arbitrary options, so that the user can do 9046@c "--pass=-Z --pass=foo" or something even if CVS 9047@c doesn't know about the "-Z foo" option to diff. 9048@c This would fit nicely with deprecating/eliminating 9049@c the obscure options of the diff library, because it 9050@c would let people specify an external GNU diff if 9051@c they are into that sort of thing. 9052The following options specify the format of the 9053output. They have the same meaning as in GNU diff. 9054 9055@example 9056-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 9057--binary 9058--brief 9059--changed-group-format=@var{arg} 9060-c 9061 -C @var{nlines} 9062 --context[=@var{lines}] 9063-e --ed 9064-t --expand-tabs 9065-f --forward-ed 9066--horizon-lines=@var{arg} 9067--ifdef=@var{arg} 9068-w --ignore-all-space 9069-B --ignore-blank-lines 9070-i --ignore-case 9071-I @var{regexp} 9072 --ignore-matching-lines=@var{regexp} 9073-h 9074-b --ignore-space-change 9075-T --initial-tab 9076-L @var{label} 9077 --label=@var{label} 9078--left-column 9079-d --minimal 9080-N --new-file 9081--new-line-format=@var{arg} 9082--old-line-format=@var{arg} 9083--paginate 9084-n --rcs 9085-s --report-identical-files 9086-p 9087--show-c-function 9088-y --side-by-side 9089-F @var{regexp} 9090--show-function-line=@var{regexp} 9091-H --speed-large-files 9092--suppress-common-lines 9093-a --text 9094--unchanged-group-format=@var{arg} 9095-u 9096 -U @var{nlines} 9097 --unified[=@var{lines}] 9098@c FIXCVS: This option is accepted by src/diff.c but 9099@c not diff/diff.c; it would appear that any attempt to 9100@c use it would get an error. 9101-V @var{arg} 9102-W @var{columns} 9103 --width=@var{columns} 9104@end example 9105 9106@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9107@node diff examples 9108@appendixsubsec diff examples 9109 9110The following line produces a Unidiff (@samp{-u} flag) 9111between revision 1.14 and 1.19 of 9112@file{backend.c}. Due to the @samp{-kk} flag no 9113keywords are substituted, so differences that only depend 9114on keyword substitution are ignored. 9115 9116@example 9117$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c 9118@end example 9119 9120Suppose the experimental branch EXPR1 was based on a 9121set of files tagged RELEASE_1_0. To see what has 9122happened on that branch, the following can be used: 9123 9124@example 9125$ cvs diff -r RELEASE_1_0 -r EXPR1 9126@end example 9127 9128A command like this can be used to produce a context 9129diff between two releases: 9130 9131@example 9132$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs 9133@end example 9134 9135If you are maintaining ChangeLogs, a command like the following 9136just before you commit your changes may help you write 9137the ChangeLog entry. All local modifications that have 9138not yet been committed will be printed. 9139 9140@example 9141$ cvs diff -u | less 9142@end example 9143 9144@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9145@node export 9146@appendixsec export---Export sources from CVS, similar to checkout 9147@cindex export (subcommand) 9148 9149@itemize @bullet 9150@item 9151Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{} 9152@item 9153Requires: repository. 9154@item 9155Changes: current directory. 9156@end itemize 9157 9158This command is a variant of @code{checkout}; use it 9159when you want a copy of the source for module without 9160the @sc{cvs} administrative directories. For example, you 9161might use @code{export} to prepare source for shipment 9162off-site. This command requires that you specify a 9163date or tag (with @samp{-D} or @samp{-r}), so that you 9164can count on reproducing the source you ship to others 9165(and thus it always prunes empty directories). 9166 9167One often would like to use @samp{-kv} with @code{cvs 9168export}. This causes any keywords to be 9169expanded such that an import done at some other site 9170will not lose the keyword revision information. But be 9171aware that doesn't handle an export containing binary 9172files correctly. Also be aware that after having used 9173@samp{-kv}, one can no longer use the @code{ident} 9174command (which is part of the @sc{rcs} suite---see 9175ident(1)) which looks for keyword strings. If 9176you want to be able to use @code{ident} you must not 9177use @samp{-kv}. 9178 9179@menu 9180* export options:: export options 9181@end menu 9182 9183@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9184@node export options 9185@appendixsubsec export options 9186 9187These standard options are supported by @code{export} 9188(@pxref{Common options}, for a complete description of 9189them): 9190 9191@table @code 9192@item -D @var{date} 9193Use the most recent revision no later than @var{date}. 9194 9195@item -f 9196If no matching revision is found, retrieve the most 9197recent revision (instead of ignoring the file). 9198 9199@item -l 9200Local; run only in current working directory. 9201 9202@item -n 9203Do not run any checkout program. 9204 9205@item -R 9206Export directories recursively. This is on by default. 9207 9208@item -r @var{tag} 9209Use revision @var{tag}. 9210@end table 9211 9212In addition, these options (that are common to 9213@code{checkout} and @code{export}) are also supported: 9214 9215@table @code 9216@item -d @var{dir} 9217Create a directory called @var{dir} for the working 9218files, instead of using the module name. 9219@xref{checkout options}, for complete details on how 9220@sc{cvs} handles this flag. 9221 9222@item -k @var{subst} 9223Set keyword expansion mode (@pxref{Substitution modes}). 9224 9225@item -N 9226Only useful together with @samp{-d @var{dir}}. 9227@xref{checkout options}, for complete details on how 9228@sc{cvs} handles this flag. 9229@end table 9230 9231@ignore 9232@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9233@c @node export examples 9234@appendixsubsec export examples 9235 9236Contributed examples are gratefully accepted. 9237@c -- Examples here!! 9238@end ignore 9239 9240@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9241@node history 9242@appendixsec history---Show status of files and users 9243@cindex history (subcommand) 9244 9245@itemize @bullet 9246@item 9247Synopsis: history [-report] [-flags] [-options args] [files@dots{}] 9248@item 9249Requires: the file @file{$CVSROOT/CVSROOT/history} 9250@item 9251Changes: nothing. 9252@end itemize 9253 9254@sc{cvs} can keep a history file that tracks each use of the 9255@code{checkout}, @code{commit}, @code{rtag}, 9256@code{update}, and @code{release} commands. You can 9257use @code{history} to display this information in 9258various formats. 9259 9260Logging must be enabled by creating the file 9261@file{$CVSROOT/CVSROOT/history}. 9262 9263@strong{Warning:} @code{history} uses @samp{-f}, @samp{-l}, 9264@samp{-n}, and @samp{-p} in ways that conflict with the 9265normal use inside @sc{cvs} (@pxref{Common options}). 9266 9267@menu 9268* history options:: history options 9269@end menu 9270 9271@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9272@node history options 9273@appendixsubsec history options 9274 9275Several options (shown above as @samp{-report}) control what 9276kind of report is generated: 9277 9278@table @code 9279@item -c 9280Report on each time commit was used (i.e., each time 9281the repository was modified). 9282 9283@item -e 9284Everything (all record types). Equivalent to 9285specifying @samp{-x} with all record types. Of course, 9286@samp{-e} will also include record types which are 9287added in a future version of @sc{cvs}; if you are 9288writing a script which can only handle certain record 9289types, you'll want to specify @samp{-x}. 9290 9291@item -m @var{module} 9292Report on a particular module. (You can meaningfully 9293use @samp{-m} more than once on the command line.) 9294 9295@item -o 9296Report on checked-out modules. This is the default report type. 9297 9298@item -T 9299Report on all tags. 9300 9301@item -x @var{type} 9302Extract a particular set of record types @var{type} from the @sc{cvs} 9303history. The types are indicated by single letters, 9304which you may specify in combination. 9305 9306Certain commands have a single record type: 9307 9308@table @code 9309@item F 9310release 9311@item O 9312checkout 9313@item E 9314export 9315@item T 9316rtag 9317@end table 9318 9319@noindent 9320One of four record types may result from an update: 9321 9322@table @code 9323@item C 9324A merge was necessary but collisions were 9325detected (requiring manual merging). 9326@item G 9327A merge was necessary and it succeeded. 9328@item U 9329A working file was copied from the repository. 9330@item W 9331The working copy of a file was deleted during 9332update (because it was gone from the repository). 9333@end table 9334 9335@noindent 9336One of three record types results from commit: 9337 9338@table @code 9339@item A 9340A file was added for the first time. 9341@item M 9342A file was modified. 9343@item R 9344A file was removed. 9345@end table 9346@end table 9347 9348The options shown as @samp{-flags} constrain or expand 9349the report without requiring option arguments: 9350 9351@table @code 9352@item -a 9353Show data for all users (the default is to show data 9354only for the user executing @code{history}). 9355 9356@item -l 9357Show last modification only. 9358 9359@item -w 9360Show only the records for modifications done from the 9361same working directory where @code{history} is 9362executing. 9363@end table 9364 9365The options shown as @samp{-options @var{args}} constrain the report 9366based on an argument: 9367 9368@table @code 9369@item -b @var{str} 9370Show data back to a record containing the string 9371@var{str} in either the module name, the file name, or 9372the repository path. 9373 9374@item -D @var{date} 9375Show data since @var{date}. This is slightly different 9376from the normal use of @samp{-D @var{date}}, which 9377selects the newest revision older than @var{date}. 9378 9379@item -f @var{file} 9380Show data for a particular file 9381(you can specify several @samp{-f} options on the same command line). 9382This is equivalent to specifying the file on the command line. 9383 9384@item -n @var{module} 9385Show data for a particular module 9386(you can specify several @samp{-n} options on the same command line). 9387 9388@item -p @var{repository} 9389Show data for a particular source repository (you 9390can specify several @samp{-p} options on the same command 9391line). 9392 9393@item -r @var{rev} 9394Show records referring to revisions since the revision 9395or tag named @var{rev} appears in individual @sc{rcs} 9396files. Each @sc{rcs} file is searched for the revision or 9397tag. 9398 9399@item -t @var{tag} 9400Show records since tag @var{tag} was last added to the 9401history file. This differs from the @samp{-r} flag 9402above in that it reads only the history file, not the 9403@sc{rcs} files, and is much faster. 9404 9405@item -u @var{name} 9406Show records for user @var{name}. 9407 9408@item -z @var{timezone} 9409Show times in the selected records using the specified 9410time zone instead of UTC. 9411@end table 9412 9413@ignore 9414@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9415@c @node history examples 9416@appendixsubsec history examples 9417 9418Contributed examples will gratefully be accepted. 9419@c -- Examples here! 9420@end ignore 9421 9422@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9423@node import 9424@appendixsec import---Import sources into CVS, using vendor branches 9425@cindex import (subcommand) 9426 9427@c FIXME: This node is way too long for one which has subnodes. 9428 9429@itemize @bullet 9430@item 9431Synopsis: import [-options] repository vendortag releasetag@dots{} 9432@item 9433Requires: Repository, source distribution directory. 9434@item 9435Changes: repository. 9436@end itemize 9437 9438Use @code{import} to incorporate an entire source 9439distribution from an outside source (e.g., a source 9440vendor) into your source repository directory. You can 9441use this command both for initial creation of a 9442repository, and for wholesale updates to the module 9443from the outside source. @xref{Tracking sources}, for 9444a discussion on this subject. 9445 9446The @var{repository} argument gives a directory name 9447(or a path to a directory) under the @sc{cvs} root directory 9448for repositories; if the directory did not exist, 9449import creates it. 9450 9451When you use import for updates to source that has been 9452modified in your source repository (since a prior 9453import), it will notify you of any files that conflict 9454in the two branches of development; use @samp{checkout 9455-j} to reconcile the differences, as import instructs 9456you to do. 9457 9458If @sc{cvs} decides a file should be ignored 9459(@pxref{cvsignore}), it does not import it and prints 9460@samp{I } followed by the filename (@pxref{import output}, for a 9461complete description of the output). 9462 9463If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists, 9464any file whose names match the specifications in that 9465file will be treated as packages and the appropriate 9466filtering will be performed on the file/directory 9467before being imported. @xref{Wrappers}. 9468 9469The outside source is saved in a first-level 9470branch, by default 1.1.1. Updates are leaves of this 9471branch; for example, files from the first imported 9472collection of source will be revision 1.1.1.1, then 9473files from the first imported update will be revision 94741.1.1.2, and so on. 9475 9476At least three arguments are required. 9477@var{repository} is needed to identify the collection 9478of source. @var{vendortag} is a tag for the entire 9479branch (e.g., for 1.1.1). You must also specify at 9480least one @var{releasetag} to identify the files at 9481the leaves created each time you execute @code{import}. 9482 9483@c I'm not completely sure this belongs here. But 9484@c we need to say it _somewhere_ reasonably obvious; it 9485@c is a common misconception among people first learning CVS 9486Note that @code{import} does @emph{not} change the 9487directory in which you invoke it. In particular, it 9488does not set up that directory as a @sc{cvs} working 9489directory; if you want to work with the sources import 9490them first and then check them out into a different 9491directory (@pxref{Getting the source}). 9492 9493@menu 9494* import options:: import options 9495* import output:: import output 9496* import examples:: import examples 9497@end menu 9498 9499@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9500@node import options 9501@appendixsubsec import options 9502 9503This standard option is supported by @code{import} 9504(@pxref{Common options}, for a complete description): 9505 9506@table @code 9507@item -m @var{message} 9508Use @var{message} as log information, instead of 9509invoking an editor. 9510@end table 9511 9512There are the following additional special options. 9513 9514@table @code 9515@item -b @var{branch} 9516See @ref{Multiple vendor branches}. 9517 9518@item -k @var{subst} 9519Indicate the keyword expansion mode desired. This 9520setting will apply to all files created during the 9521import, but not to any files that previously existed in 9522the repository. See @ref{Substitution modes}, for a 9523list of valid @samp{-k} settings. 9524 9525@item -I @var{name} 9526Specify file names that should be ignored during 9527import. You can use this option repeatedly. To avoid 9528ignoring any files at all (even those ignored by 9529default), specify `-I !'. 9530 9531@var{name} can be a file name pattern of the same type 9532that you can specify in the @file{.cvsignore} file. 9533@xref{cvsignore}. 9534@c -- Is this really true? 9535 9536@item -W @var{spec} 9537Specify file names that should be filtered during 9538import. You can use this option repeatedly. 9539 9540@var{spec} can be a file name pattern of the same type 9541that you can specify in the @file{.cvswrappers} 9542file. @xref{Wrappers}. 9543@end table 9544 9545@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9546@node import output 9547@appendixsubsec import output 9548 9549@code{import} keeps you informed of its progress by printing a line 9550for each file, preceded by one character indicating the status of the file: 9551 9552@table @code 9553@item U @var{file} 9554The file already exists in the repository and has not been locally 9555modified; a new revision has been created (if necessary). 9556 9557@item N @var{file} 9558The file is a new file which has been added to the repository. 9559 9560@item C @var{file} 9561The file already exists in the repository but has been locally modified; 9562you will have to merge the changes. 9563 9564@item I @var{file} 9565The file is being ignored (@pxref{cvsignore}). 9566 9567@cindex Symbolic link, importing 9568@cindex Link, symbolic, importing 9569@c FIXME: also (somewhere else) probably 9570@c should be documenting what happens if you "cvs add" 9571@c a symbolic link. Also maybe what happens if 9572@c you manually create symbolic links within the 9573@c repository (? - not sure why we'd want to suggest 9574@c doing that). 9575@item L @var{file} 9576The file is a symbolic link; @code{cvs import} ignores symbolic links. 9577People periodically suggest that this behavior should 9578be changed, but if there is a consensus on what it 9579should be changed to, it doesn't seem to be apparent. 9580(Various options in the @file{modules} file can be used 9581to recreate symbolic links on checkout, update, etc.; 9582@pxref{modules}.) 9583@end table 9584 9585@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9586@node import examples 9587@appendixsubsec import examples 9588 9589See @ref{Tracking sources}, and @ref{From files}. 9590 9591@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9592@node log 9593@appendixsec log---Print out log information for files 9594@cindex log (subcommand) 9595 9596@itemize @bullet 9597@item 9598Synopsis: log [options] [files@dots{}] 9599@item 9600Requires: repository, working directory. 9601@item 9602Changes: nothing. 9603@end itemize 9604 9605Display log information for files. @code{log} used to 9606call the @sc{rcs} utility @code{rlog}. Although this 9607is no longer true in the current sources, this history 9608determines the format of the output and the options, 9609which are not quite in the style of the other @sc{cvs} 9610commands. 9611 9612@cindex Timezone, in output 9613@cindex Zone, time, in output 9614@c Kind of a funny place to document the timezone used 9615@c in output from commands other than @code{log}. 9616@c There is also more we need to say about this, 9617@c including what happens in a client/server environment. 9618The output includes the location of the @sc{rcs} file, 9619the @dfn{head} revision (the latest revision on the 9620trunk), all symbolic names (tags) and some other 9621things. For each revision, the revision number, the 9622author, the number of lines added/deleted and the log 9623message are printed. All times are displayed in 9624Coordinated Universal Time (UTC). (Other parts of 9625@sc{cvs} print times in the local timezone). 9626@c FIXCVS: need a better way to control the timezone 9627@c used in output. Previous/current versions of CVS did/do 9628@c sometimes support -z in RCSINIT, and/or an 9629@c undocumented (except by reference to 'rlog') -z option 9630@c to cvs log, but this has not been a consistent, 9631@c documented feature. Perhaps a new global option, 9632@c where LT means the client's timezone, which the 9633@c client then communicates to the server, is the 9634@c right solution. 9635 9636@strong{Warning:} @code{log} uses @samp{-R} in a way that conflicts 9637with the normal use inside @sc{cvs} (@pxref{Common options}). 9638 9639@menu 9640* log options:: log options 9641* log examples:: log examples 9642@end menu 9643 9644@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9645@node log options 9646@appendixsubsec log options 9647 9648By default, @code{log} prints all information that is 9649available. All other options restrict the output. 9650 9651@table @code 9652@item -b 9653Print information about the revisions on the default 9654branch, normally the highest branch on the trunk. 9655 9656@item -d @var{dates} 9657Print information about revisions with a checkin 9658date/time in the range given by the 9659semicolon-separated list of dates. The date formats 9660accepted are those accepted by the @samp{-D} option to 9661many other @sc{cvs} commands (@pxref{Common options}). 9662Dates can be combined into ranges as follows: 9663 9664@c Should we be thinking about accepting ISO8601 9665@c ranges? For example "1972-09-10/1972-09-12". 9666@table @code 9667@item @var{d1}<@var{d2} 9668@itemx @var{d2}>@var{d1} 9669Select the revisions that were deposited between 9670@var{d1} and @var{d2}. 9671 9672@item <@var{d} 9673@itemx @var{d}> 9674Select all revisions dated @var{d} or earlier. 9675 9676@item @var{d}< 9677@itemx >@var{d} 9678Select all revisions dated @var{d} or later. 9679 9680@item @var{d} 9681Select the single, latest revision dated @var{d} or 9682earlier. 9683@end table 9684 9685The @samp{>} or @samp{<} characters may be followed by 9686@samp{=} to indicate an inclusive range rather than an 9687exclusive one. 9688 9689Note that the separator is a semicolon (;). 9690 9691@item -h 9692Print only the name of the @sc{rcs} file, name 9693of the file in the working directory, head, 9694default branch, access list, locks, symbolic names, and 9695suffix. 9696 9697@item -l 9698Local; run only in current working directory. (Default 9699is to run recursively). 9700 9701@item -N 9702Do not print the list of tags for this file. This 9703option can be very useful when your site uses a lot of 9704tags, so rather than "more"'ing over 3 pages of tag 9705information, the log information is presented without 9706tags at all. 9707 9708@item -R 9709Print only the name of the @sc{rcs} file. 9710 9711@c Note that using a bare revision (in addition to not 9712@c being explicitly documented here) is potentially 9713@c confusing; it shows the log message to get from the 9714@c previous revision to that revision. "-r1.3 -r1.6" 9715@c (equivalent to "-r1.3,1.6") is even worse; it 9716@c prints the messages to get from 1.2 to 1.3 and 1.5 9717@c to 1.6. By analogy with "cvs diff", users might 9718@c expect that it is more like specifying a range. 9719@c It is not 100% clear to me how much of this should 9720@c be documented (for example, multiple -r options 9721@c perhaps could/should be deprecated given the false 9722@c analogy with "cvs diff"). 9723@c In general, this section should be rewritten to talk 9724@c about messages to get from revision rev1 to rev2, 9725@c rather than messages for revision rev2 (that is, the 9726@c messages are associated with a change not a static 9727@c revision and failing to make this distinction causes 9728@c much confusion). 9729@item -r@var{revisions} 9730Print information about revisions given in the 9731comma-separated list @var{revisions} of revisions and 9732ranges. The following table explains the available 9733range formats: 9734 9735@table @code 9736@item @var{rev1}:@var{rev2} 9737Revisions @var{rev1} to @var{rev2} (which must be on 9738the same branch). 9739 9740@item @var{rev1}::@var{rev2} 9741Revisions between, but not including, @var{rev1} and @var{rev2}. 9742 9743@item :@var{rev} 9744Revisions from the beginning of the branch up to 9745and including @var{rev}. 9746 9747@item ::@var{rev} 9748Revisions from the beginning of the branch up to, 9749but not including, @var{rev}. 9750 9751@item @var{rev}: 9752Revisions starting with @var{rev} to the end of the 9753branch containing @var{rev}. 9754 9755@item @var{rev}: 9756Revisions starting just after @var{rev} to the end of the 9757branch containing @var{rev}. 9758 9759@item @var{branch} 9760An argument that is a branch means all revisions on 9761that branch. 9762 9763@item @var{branch1}:@var{branch2} 9764@itemx @var{branch1}::@var{branch2} 9765A range of branches means all revisions 9766on the branches in that range. 9767 9768@item @var{branch}. 9769The latest revision in @var{branch}. 9770@end table 9771 9772A bare @samp{-r} with no revisions means the latest 9773revision on the default branch, normally the trunk. 9774There can be no space between the @samp{-r} option and 9775its argument. 9776 9777@item -s @var{states} 9778Print information about revisions whose state 9779attributes match one of the states given in the 9780comma-separated list @var{states}. 9781 9782@item -t 9783Print the same as @samp{-h}, plus the descriptive text. 9784 9785@item -w@var{logins} 9786Print information about revisions checked in by users 9787with login names appearing in the comma-separated list 9788@var{logins}. If @var{logins} is omitted, the user's 9789login is assumed. There can be no space between the 9790@samp{-w} option and its argument. 9791@end table 9792 9793@code{log} prints the intersection of the revisions 9794selected with the options @samp{-d}, @samp{-s}, and 9795@samp{-w}, intersected with the union of the revisions 9796selected by @samp{-b} and @samp{-r}. 9797 9798@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9799@node log examples 9800@appendixsubsec log examples 9801 9802Contributed examples are gratefully accepted. 9803 9804@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9805@node rdiff 9806@appendixsec rdiff---'patch' format diffs between releases 9807@cindex rdiff (subcommand) 9808 9809@itemize @bullet 9810@item 9811rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{} 9812@item 9813Requires: repository. 9814@item 9815Changes: nothing. 9816@item 9817Synonym: patch 9818@end itemize 9819 9820Builds a Larry Wall format patch(1) file between two 9821releases, that can be fed directly into the @code{patch} 9822program to bring an old release up-to-date with the new 9823release. (This is one of the few @sc{cvs} commands that 9824operates directly from the repository, and doesn't 9825require a prior checkout.) The diff output is sent to 9826the standard output device. 9827 9828You can specify (using the standard @samp{-r} and 9829@samp{-D} options) any combination of one or two 9830revisions or dates. If only one revision or date is 9831specified, the patch file reflects differences between 9832that revision or date and the current head revisions in 9833the @sc{rcs} file. 9834 9835Note that if the software release affected is contained 9836in more than one directory, then it may be necessary to 9837specify the @samp{-p} option to the @code{patch} command when 9838patching the old sources, so that @code{patch} is able to find 9839the files that are located in other directories. 9840 9841@menu 9842* rdiff options:: rdiff options 9843* rdiff examples:: rdiff examples 9844@end menu 9845 9846@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9847@node rdiff options 9848@appendixsubsec rdiff options 9849 9850These standard options are supported by @code{rdiff} 9851(@pxref{Common options}, for a complete description of 9852them): 9853 9854@table @code 9855@item -D @var{date} 9856Use the most recent revision no later than @var{date}. 9857 9858@item -f 9859If no matching revision is found, retrieve the most 9860recent revision (instead of ignoring the file). 9861 9862@item -l 9863Local; don't descend subdirectories. 9864 9865@item -R 9866Examine directories recursively. This option is on by default. 9867 9868@item -r @var{tag} 9869Use revision @var{tag}. 9870@end table 9871 9872In addition to the above, these options are available: 9873 9874@table @code 9875@item -c 9876Use the context diff format. This is the default format. 9877 9878@item -s 9879Create a summary change report instead of a patch. The 9880summary includes information about files that were 9881changed or added between the releases. It is sent to 9882the standard output device. This is useful for finding 9883out, for example, which files have changed between two 9884dates or revisions. 9885 9886@item -t 9887A diff of the top two revisions is sent to the standard 9888output device. This is most useful for seeing what the 9889last change to a file was. 9890 9891@item -u 9892Use the unidiff format for the context diffs. 9893Remember that old versions 9894of the @code{patch} program can't handle the unidiff 9895format, so if you plan to post this patch to the net 9896you should probably not use @samp{-u}. 9897 9898@item -V @var{vn} 9899Expand keywords according to the rules current in 9900@sc{rcs} version @var{vn} (the expansion format changed with 9901@sc{rcs} version 5). Note that this option is no 9902longer accepted. @sc{cvs} will always expand keywords the 9903way that @sc{rcs} version 5 does. 9904@end table 9905 9906@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9907@node rdiff examples 9908@appendixsubsec rdiff examples 9909 9910Suppose you receive mail from @t{foo@@example.net} asking for an 9911update from release 1.2 to 1.4 of the tc compiler. You 9912have no such patches on hand, but with @sc{cvs} that can 9913easily be fixed with a command such as this: 9914 9915@example 9916$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \ 9917$$ Mail -s 'The patches you asked for' foo@@example.net 9918@end example 9919 9920Suppose you have made release 1.3, and forked a branch 9921called @samp{R_1_3fix} for bugfixes. @samp{R_1_3_1} 9922corresponds to release 1.3.1, which was made some time 9923ago. Now, you want to see how much development has been 9924done on the branch. This command can be used: 9925 9926@example 9927$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name 9928cvs rdiff: Diffing module-name 9929File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6 9930File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4 9931File bar.h,v changed from revision 1.29.2.1 to 1.2 9932@end example 9933 9934@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9935@node release 9936@appendixsec release---Indicate that a Module is no longer in use 9937@cindex release (subcommand) 9938 9939@itemize @bullet 9940@item 9941release [-d] directories@dots{} 9942@item 9943Requires: Working directory. 9944@item 9945Changes: Working directory, history log. 9946@end itemize 9947 9948This command is meant to safely cancel the effect of 9949@samp{cvs checkout}. Since @sc{cvs} doesn't lock files, it 9950isn't strictly necessary to use this command. You can 9951always simply delete your working directory, if you 9952like; but you risk losing changes you may have 9953forgotten, and you leave no trace in the @sc{cvs} history 9954file (@pxref{history file}) that you've abandoned your 9955checkout. 9956 9957Use @samp{cvs release} to avoid these problems. This 9958command checks that no uncommitted changes are 9959present; that you are executing it from immediately 9960above a @sc{cvs} working directory; and that the repository 9961recorded for your files is the same as the repository 9962defined in the module database. 9963 9964If all these conditions are true, @samp{cvs release} 9965leaves a record of its execution (attesting to your 9966intentionally abandoning your checkout) in the @sc{cvs} 9967history log. 9968 9969@menu 9970* release options:: release options 9971* release output:: release output 9972* release examples:: release examples 9973@end menu 9974 9975@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9976@node release options 9977@appendixsubsec release options 9978 9979The @code{release} command supports one command option: 9980 9981@table @code 9982@item -d 9983Delete your working copy of the file if the release 9984succeeds. If this flag is not given your files will 9985remain in your working directory. 9986 9987@strong{Warning:} The @code{release} command deletes 9988all directories and files recursively. This 9989has the very serious side-effect that any directory 9990that you have created inside your checked-out sources, 9991and not added to the repository (using the @code{add} 9992command; @pxref{Adding files}) will be silently deleted---even 9993if it is non-empty! 9994@end table 9995 9996@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9997@node release output 9998@appendixsubsec release output 9999 10000Before @code{release} releases your sources it will 10001print a one-line message for any file that is not 10002up-to-date. 10003 10004@strong{Warning:} Any new directories that you have 10005created, but not added to the @sc{cvs} directory hierarchy 10006with the @code{add} command (@pxref{Adding files}) will be 10007silently ignored (and deleted, if @samp{-d} is 10008specified), even if they contain files. 10009@c FIXCVS: This is a bug. But is it true? I think 10010@c maybe they print "? dir" now. 10011 10012@table @code 10013@item U @var{file} 10014@itemx P @var{file} 10015There exists a newer revision of this file in the 10016repository, and you have not modified your local copy 10017of the file (@samp{U} and @samp{P} mean the same thing). 10018 10019@item A @var{file} 10020The file has been added to your private copy of the 10021sources, but has not yet been committed to the 10022repository. If you delete your copy of the sources 10023this file will be lost. 10024 10025@item R @var{file} 10026The file has been removed from your private copy of the 10027sources, but has not yet been removed from the 10028repository, since you have not yet committed the 10029removal. @xref{commit}. 10030 10031@item M @var{file} 10032The file is modified in your working directory. There 10033might also be a newer revision inside the repository. 10034 10035@item ? @var{file} 10036@var{file} is in your working directory, but does not 10037correspond to anything in the source repository, and is 10038not in the list of files for @sc{cvs} to ignore (see the 10039description of the @samp{-I} option, and 10040@pxref{cvsignore}). If you remove your working 10041sources, this file will be lost. 10042@end table 10043 10044@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10045@node release examples 10046@appendixsubsec release examples 10047 10048Release the @file{tc} directory, and delete your local working copy 10049of the files. 10050 10051@example 10052$ cd .. # @r{You must stand immediately above the} 10053 # @r{sources when you issue @samp{cvs release}.} 10054$ cvs release -d tc 10055You have [0] altered files in this repository. 10056Are you sure you want to release (and delete) directory `tc': y 10057$ 10058@end example 10059 10060@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10061@node update 10062@appendixsec update---Bring work tree in sync with repository 10063@cindex update (subcommand) 10064 10065@itemize @bullet 10066@item 10067update [-AdflPpR] [-d] [-r tag|-D date] files@dots{} 10068@item 10069Requires: repository, working directory. 10070@item 10071Changes: working directory. 10072@end itemize 10073 10074After you've run checkout to create your private copy 10075of source from the common repository, other developers 10076will continue changing the central source. From time 10077to time, when it is convenient in your development 10078process, you can use the @code{update} command from 10079within your working directory to reconcile your work 10080with any revisions applied to the source repository 10081since your last checkout or update. 10082 10083@menu 10084* update options:: update options 10085* update output:: update output 10086@end menu 10087 10088@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10089@node update options 10090@appendixsubsec update options 10091 10092These standard options are available with @code{update} 10093(@pxref{Common options}, for a complete description of 10094them): 10095 10096@table @code 10097@item -D date 10098Use the most recent revision no later than @var{date}. 10099This option is sticky, and implies @samp{-P}. 10100See @ref{Sticky tags}, for more information on sticky tags/dates. 10101 10102@item -f 10103Only useful with the @samp{-D @var{date}} or @samp{-r 10104@var{tag}} flags. If no matching revision is found, 10105retrieve the most recent revision (instead of ignoring 10106the file). 10107 10108@item -k @var{kflag} 10109Process keywords according to @var{kflag}. See 10110@ref{Keyword substitution}. 10111This option is sticky; future updates of 10112this file in this working directory will use the same 10113@var{kflag}. The @code{status} command can be viewed 10114to see the sticky options. See @ref{Invoking CVS}, for 10115more information on the @code{status} command. 10116 10117@item -l 10118Local; run only in current working directory. @xref{Recursive behavior}. 10119 10120@item -P 10121Prune empty directories. See @ref{Moving directories}. 10122 10123@item -p 10124Pipe files to the standard output. 10125 10126@item -R 10127Update directories recursively (default). @xref{Recursive 10128behavior}. 10129 10130@item -r rev 10131Retrieve revision/tag @var{rev}. This option is sticky, 10132and implies @samp{-P}. 10133See @ref{Sticky tags}, for more information on sticky tags/dates. 10134@end table 10135 10136@need 800 10137These special options are also available with 10138@code{update}. 10139 10140@table @code 10141@item -A 10142Reset any sticky tags, dates, or @samp{-k} options. 10143See @ref{Sticky tags}, for more information on sticky tags/dates. 10144 10145@item -C 10146Overwrite locally modified files with clean copies from 10147the repository (the modified file is saved in 10148@file{.#@var{file}.@var{revision}}, however). 10149 10150@item -d 10151Create any directories that exist in the repository if 10152they're missing from the working directory. Normally, 10153@code{update} acts only on directories and files that 10154were already enrolled in your working directory. 10155 10156This is useful for updating directories that were 10157created in the repository since the initial checkout; 10158but it has an unfortunate side effect. If you 10159deliberately avoided certain directories in the 10160repository when you created your working directory 10161(either through use of a module name or by listing 10162explicitly the files and directories you wanted on the 10163command line), then updating with @samp{-d} will create 10164those directories, which may not be what you want. 10165 10166@item -I @var{name} 10167Ignore files whose names match @var{name} (in your 10168working directory) during the update. You can specify 10169@samp{-I} more than once on the command line to specify 10170several files to ignore. Use @samp{-I !} to avoid 10171ignoring any files at all. @xref{cvsignore}, for other 10172ways to make @sc{cvs} ignore some files. 10173 10174@item -W@var{spec} 10175Specify file names that should be filtered during 10176update. You can use this option repeatedly. 10177 10178@var{spec} can be a file name pattern of the same type 10179that you can specify in the @file{.cvswrappers} 10180file. @xref{Wrappers}. 10181 10182@item -j@var{revision} 10183With two @samp{-j} options, merge changes from the 10184revision specified with the first @samp{-j} option to 10185the revision specified with the second @samp{j} option, 10186into the working directory. 10187 10188With one @samp{-j} option, merge changes from the 10189ancestor revision to the revision specified with the 10190@samp{-j} option, into the working directory. The 10191ancestor revision is the common ancestor of the 10192revision which the working directory is based on, and 10193the revision specified in the @samp{-j} option. 10194 10195Note that using a single @samp{-j @var{tagname}} option rather than 10196@samp{-j @var{branchname}} to merge changes from a branch will 10197often not remove files which were removed on the branch. 10198@xref{Merging adds and removals}, for more. 10199 10200In addition, each @samp{-j} option can contain an optional 10201date specification which, when used with branches, can 10202limit the chosen revision to one within a specific 10203date. An optional date is specified by adding a colon 10204(:) to the tag: 10205@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 10206 10207@xref{Branching and merging}. 10208 10209@end table 10210 10211@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10212@node update output 10213@appendixsubsec update output 10214 10215@code{update} and @code{checkout} keep you informed of 10216their progress by printing a line for each file, preceded 10217by one character indicating the status of the file: 10218 10219@table @code 10220@item U @var{file} 10221The file was brought up to date with respect to the 10222repository. This is done for any file that exists in 10223the repository but not in your source, and for files 10224that you haven't changed but are not the most recent 10225versions available in the repository. 10226 10227@item P @var{file} 10228Like @samp{U}, but the @sc{cvs} server sends a patch 10229instead of an entire file. These two things accomplish 10230the same thing. 10231 10232@item A @var{file} 10233The file has been added to your private copy of the 10234sources, and will be added to the source repository 10235when you run @code{commit} on the file. This is a 10236reminder to you that the file needs to be committed. 10237 10238@item R @var{file} 10239The file has been removed from your private copy of the 10240sources, and will be removed from the source repository 10241when you run @code{commit} on the file. This is a 10242reminder to you that the file needs to be committed. 10243 10244@item M @var{file} 10245The file is modified in your working directory. 10246 10247@samp{M} can indicate one of two states for a file 10248you're working on: either there were no modifications 10249to the same file in the repository, so that your file 10250remains as you last saw it; or there were modifications 10251in the repository as well as in your copy, but they 10252were merged successfully, without conflict, in your 10253working directory. 10254 10255@sc{cvs} will print some messages if it merges your work, 10256and a backup copy of your working file (as it looked 10257before you ran @code{update}) will be made. The exact 10258name of that file is printed while @code{update} runs. 10259 10260@item C @var{file} 10261@cindex .# files 10262@cindex __ files (VMS) 10263A conflict was detected while trying to merge your 10264changes to @var{file} with changes from the source 10265repository. @var{file} (the copy in your working 10266directory) is now the result of attempting to merge 10267the two revisions; an unmodified copy of your file 10268is also in your working directory, with the name 10269@file{.#@var{file}.@var{revision}} where @var{revision} 10270is the revision that your modified file started 10271from. Resolve the conflict as described in 10272@ref{Conflicts example}. 10273@c "some systems" as in out-of-the-box OSes? Not as 10274@c far as I know. We need to advise sysadmins as well 10275@c as users how to set up this kind of purge, if that is 10276@c what they want. 10277@c We also might want to think about cleaner solutions, 10278@c like having CVS remove the .# file once the conflict 10279@c has been resolved or something like that. 10280(Note that some systems automatically purge 10281files that begin with @file{.#} if they have not been 10282accessed for a few days. If you intend to keep a copy 10283of your original file, it is a very good idea to rename 10284it.) Under @sc{vms}, the file name starts with 10285@file{__} rather than @file{.#}. 10286 10287@item ? @var{file} 10288@var{file} is in your working directory, but does not 10289correspond to anything in the source repository, and is 10290not in the list of files for @sc{cvs} to ignore (see the 10291description of the @samp{-I} option, and 10292@pxref{cvsignore}). 10293@end table 10294 10295@node Invoking CVS 10296@appendix Quick reference to CVS commands 10297@cindex Command reference 10298@cindex Reference, commands 10299@cindex Invoking CVS 10300 10301This appendix describes how to invoke @sc{cvs}, with 10302references to where each command or feature is 10303described in detail. For other references run the 10304@code{cvs --help} command, or see @ref{Index}. 10305 10306A @sc{cvs} command looks like: 10307 10308@example 10309cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ] 10310@end example 10311 10312Global options: 10313 10314@table @code 10315@item --allow-root=@var{rootdir} 10316Specify legal @sc{cvsroot} directory (server only) (not 10317in @sc{cvs} 1.9 and older). See @ref{Password 10318authentication server}. 10319 10320@item -a 10321Authenticate all communication (client only) (not in @sc{cvs} 103221.9 and older). See @ref{Global options}. 10323 10324@item -b 10325Specify RCS location (@sc{cvs} 1.9 and older). See 10326@ref{Global options}. 10327 10328@item -d @var{root} 10329Specify the @sc{cvsroot}. See @ref{Repository}. 10330 10331@item -e @var{editor} 10332Edit messages with @var{editor}. See @ref{Committing 10333your changes}. 10334 10335@item -f 10336Do not read the @file{~/.cvsrc} file. See @ref{Global 10337options}. 10338 10339@item -H 10340@itemx --help 10341Print a help message. See @ref{Global options}. 10342 10343@item -l 10344Do not log in @file{$CVSROOT/CVSROOT/history} file. See @ref{Global 10345options}. 10346 10347@item -n 10348Do not change any files. See @ref{Global options}. 10349 10350@item -Q 10351Be really quiet. See @ref{Global options}. 10352 10353@item -q 10354Be somewhat quiet. See @ref{Global options}. 10355 10356@item -r 10357Make new working files read-only. See @ref{Global options}. 10358 10359@item -s @var{variable}=@var{value} 10360Set a user variable. See @ref{Variables}. 10361 10362@item -T @var{tempdir} 10363Put temporary files in @var{tempdir}. See @ref{Global 10364options}. 10365 10366@item -t 10367Trace @sc{cvs} execution. See @ref{Global options}. 10368 10369@item -v 10370@item --version 10371Display version and copyright information for @sc{cvs}. 10372 10373@item -w 10374Make new working files read-write. See @ref{Global 10375options}. 10376 10377@item -x 10378Encrypt all communication (client only). 10379See @ref{Global options}. 10380 10381@item -z @var{gzip-level} 10382@cindex Compression 10383@cindex Gzip 10384Set the compression level (client only). 10385See @ref{Global options}. 10386@end table 10387 10388Keyword expansion modes (@pxref{Substitution modes}): 10389 10390@example 10391-kkv $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp $ 10392-kkvl $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10393-kk $@asis{}Id$ 10394-kv file1,v 1.1 1993/12/09 03:21:13 joe Exp 10395-ko @i{no expansion} 10396-kb @i{no expansion, file is binary} 10397@end example 10398 10399Keywords (@pxref{Keyword list}): 10400 10401@example 10402$@asis{}Author: joe $ 10403$@asis{}Date: 1993/12/09 03:21:13 $ 10404$@asis{}Header: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10405$@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10406$@asis{}Locker: harry $ 10407$@asis{}Name: snapshot_1_14 $ 10408$@asis{}RCSfile: file1,v $ 10409$@asis{}Revision: 1.1 $ 10410$@asis{}Source: /home/files/file1,v $ 10411$@asis{}State: Exp $ 10412$@asis{}Log: file1,v $ 10413Revision 1.1 1993/12/09 03:30:17 joe 10414Initial revision 10415 10416@end example 10417 10418@c The idea behind this table is that we want each item 10419@c to be a sentence or two at most. Preferably a 10420@c single line. 10421@c 10422@c In some cases refs to "foo options" are just to get 10423@c this thing written quickly, not because the "foo 10424@c options" node is really the best place to point. 10425Commands, command options, and command arguments: 10426 10427@table @code 10428@item add [@var{options}] [@var{files}@dots{}] 10429Add a new file/directory. See @ref{Adding files}. 10430 10431@table @code 10432@item -k @var{kflag} 10433Set keyword expansion. 10434 10435@item -m @var{msg} 10436Set file description. 10437@end table 10438 10439@item admin [@var{options}] [@var{files}@dots{}] 10440Administration of history files in the repository. See 10441@ref{admin}. 10442@c This list omits those options which are not 10443@c documented as being useful with CVS. That might be 10444@c a mistake... 10445 10446@table @code 10447@item -b[@var{rev}] 10448Set default branch. See @ref{Reverting local changes}. 10449 10450@item -c@var{string} 10451Set comment leader. 10452 10453@item -k@var{subst} 10454Set keyword substitution. See @ref{Keyword 10455substitution}. 10456 10457@item -l[@var{rev}] 10458Lock revision @var{rev}, or latest revision. 10459 10460@item -m@var{rev}:@var{msg} 10461Replace the log message of revision @var{rev} with 10462@var{msg}. 10463 10464@item -o@var{range} 10465Delete revisions from the repository. See 10466@ref{admin options}. 10467 10468@item -q 10469Run quietly; do not print diagnostics. 10470 10471@item -s@var{state}[:@var{rev}] 10472Set the state. 10473 10474@c Does not work for client/server CVS 10475@item -t 10476Set file description from standard input. 10477 10478@item -t@var{file} 10479Set file description from @var{file}. 10480 10481@item -t-@var{string} 10482Set file description to @var{string}. 10483 10484@item -u[@var{rev}] 10485Unlock revision @var{rev}, or latest revision. 10486@end table 10487 10488@item annotate [@var{options}] [@var{files}@dots{}] 10489Show last revision where each line was modified. See 10490@ref{annotate}. 10491 10492@table @code 10493@item -D @var{date} 10494Annotate the most recent revision no later than 10495@var{date}. See @ref{Common options}. 10496 10497@item -f 10498Use head revision if tag/date not found. See 10499@ref{Common options}. 10500 10501@item -l 10502Local; run only in current working directory. @xref{Recursive behavior}. 10503 10504@item -R 10505Operate recursively (default). @xref{Recursive 10506behavior}. 10507 10508@item -r @var{tag} 10509Annotate revision @var{tag}. See @ref{Common options}. 10510@end table 10511 10512@item checkout [@var{options}] @var{modules}@dots{} 10513Get a copy of the sources. See @ref{checkout}. 10514 10515@table @code 10516@item -A 10517Reset any sticky tags/date/options. See @ref{Sticky 10518tags} and @ref{Keyword substitution}. 10519 10520@item -c 10521Output the module database. See @ref{checkout options}. 10522 10523@item -D @var{date} 10524Check out revisions as of @var{date} (is sticky). See 10525@ref{Common options}. 10526 10527@item -d @var{dir} 10528Check out into @var{dir}. See @ref{checkout options}. 10529 10530@item -f 10531Use head revision if tag/date not found. See 10532@ref{Common options}. 10533 10534@c Probably want to use rev1/rev2 style like for diff 10535@c -r. Here and in on-line help. 10536@item -j @var{rev} 10537Merge in changes. See @ref{checkout options}. 10538 10539@item -k @var{kflag} 10540Use @var{kflag} keyword expansion. See 10541@ref{Substitution modes}. 10542 10543@item -l 10544Local; run only in current working directory. @xref{Recursive behavior}. 10545 10546@item -N 10547Don't ``shorten'' module paths if -d specified. See 10548@ref{checkout options}. 10549 10550@item -n 10551Do not run module program (if any). See @ref{checkout options}. 10552 10553@item -P 10554Prune empty directories. See @ref{Moving directories}. 10555 10556@item -p 10557Check out files to standard output (avoids 10558stickiness). See @ref{checkout options}. 10559 10560@item -R 10561Operate recursively (default). @xref{Recursive 10562behavior}. 10563 10564@item -r @var{tag} 10565Checkout revision @var{tag} (is sticky). See @ref{Common options}. 10566 10567@item -s 10568Like -c, but include module status. See @ref{checkout options}. 10569@end table 10570 10571@item commit [@var{options}] [@var{files}@dots{}] 10572Check changes into the repository. See @ref{commit}. 10573 10574@table @code 10575@item -F @var{file} 10576Read log message from @var{file}. See @ref{commit options}. 10577 10578@item -f 10579@c What is this "disables recursion"? It is from the 10580@c on-line help; is it documented in this manual? 10581Force the file to be committed; disables recursion. 10582See @ref{commit options}. 10583 10584@item -l 10585Local; run only in current working directory. See @ref{Recursive behavior}. 10586 10587@item -m @var{msg} 10588Use @var{msg} as log message. See @ref{commit options}. 10589 10590@item -n 10591Do not run module program (if any). See @ref{commit options}. 10592 10593@item -R 10594Operate recursively (default). @xref{Recursive 10595behavior}. 10596 10597@item -r @var{rev} 10598Commit to @var{rev}. See @ref{commit options}. 10599@c FIXME: should be dragging over text from 10600@c commit options, especially if it can be cleaned up 10601@c and made concise enough. 10602@end table 10603 10604@item diff [@var{options}] [@var{files}@dots{}] 10605Show differences between revisions. See @ref{diff}. 10606In addition to the options shown below, accepts a wide 10607variety of options to control output style, for example 10608@samp{-c} for context diffs. 10609 10610@table @code 10611@item -D @var{date1} 10612Diff revision for date against working file. See 10613@ref{diff options}. 10614 10615@item -D @var{date2} 10616Diff @var{rev1}/@var{date1} against @var{date2}. See 10617@ref{diff options}. 10618 10619@item -l 10620Local; run only in current working directory. See @ref{Recursive behavior}. 10621 10622@item -N 10623Include diffs for added and removed files. See 10624@ref{diff options}. 10625 10626@item -R 10627Operate recursively (default). @xref{Recursive 10628behavior}. 10629 10630@item -r @var{rev1} 10631Diff revision for @var{rev1} against working file. See 10632@ref{diff options}. 10633 10634@item -r @var{rev2} 10635Diff @var{rev1}/@var{date1} against @var{rev2}. See @ref{diff options}. 10636@end table 10637 10638@item edit [@var{options}] [@var{files}@dots{}] 10639Get ready to edit a watched file. See @ref{Editing files}. 10640 10641@table @code 10642@item -a @var{actions} 10643Specify actions for temporary watch, where 10644@var{actions} is @code{edit}, @code{unedit}, 10645@code{commit}, @code{all}, or @code{none}. See 10646@ref{Editing files}. 10647 10648@item -l 10649Local; run only in current working directory. See @ref{Recursive behavior}. 10650 10651@item -R 10652Operate recursively (default). @xref{Recursive 10653behavior}. 10654@end table 10655 10656@item editors [@var{options}] [@var{files}@dots{}] 10657See who is editing a watched file. See @ref{Watch information}. 10658 10659@table @code 10660@item -l 10661Local; run only in current working directory. See @ref{Recursive behavior}. 10662 10663@item -R 10664Operate recursively (default). @xref{Recursive 10665behavior}. 10666@end table 10667 10668@item export [@var{options}] @var{modules}@dots{} 10669Export files from @sc{cvs}. See @ref{export}. 10670 10671@table @code 10672@item -D @var{date} 10673Check out revisions as of @var{date}. See 10674@ref{Common options}. 10675 10676@item -d @var{dir} 10677Check out into @var{dir}. See @ref{export options}. 10678 10679@item -f 10680Use head revision if tag/date not found. See 10681@ref{Common options}. 10682 10683@item -k @var{kflag} 10684Use @var{kflag} keyword expansion. See 10685@ref{Substitution modes}. 10686 10687@item -l 10688Local; run only in current working directory. @xref{Recursive behavior}. 10689 10690@item -N 10691Don't ``shorten'' module paths if -d specified. See 10692@ref{export options}. 10693 10694@item -n 10695Do not run module program (if any). See @ref{export options}. 10696 10697@item -P 10698Prune empty directories. See @ref{Moving directories}. 10699 10700@item -R 10701Operate recursively (default). @xref{Recursive 10702behavior}. 10703 10704@item -r @var{tag} 10705Checkout revision @var{tag}. See @ref{Common options}. 10706@end table 10707 10708@item history [@var{options}] [@var{files}@dots{}] 10709Show repository access history. See @ref{history}. 10710 10711@table @code 10712@item -a 10713All users (default is self). See @ref{history options}. 10714 10715@item -b @var{str} 10716Back to record with @var{str} in module/file/repos 10717field. See @ref{history options}. 10718 10719@item -c 10720Report on committed (modified) files. See @ref{history options}. 10721 10722@item -D @var{date} 10723Since @var{date}. See @ref{history options}. 10724 10725@item -e 10726Report on all record types. See @ref{history options}. 10727 10728@item -l 10729Last modified (committed or modified report). See @ref{history options}. 10730 10731@item -m @var{module} 10732Report on @var{module} (repeatable). See @ref{history 10733options}. 10734 10735@item -n @var{module} 10736In @var{module}. See @ref{history options}. 10737 10738@item -o 10739Report on checked out modules. See @ref{history options}. 10740 10741@item -r @var{rev} 10742Since revision @var{rev}. See @ref{history options}. 10743 10744@item -T 10745@c What the @#$@# is a TAG? Same as a tag? This 10746@c wording is also in the online-line help. 10747Produce report on all TAGs. See @ref{history options}. 10748 10749@item -t @var{tag} 10750Since tag record placed in history file (by anyone). 10751See @ref{history options}. 10752 10753@item -u @var{user} 10754For user @var{user} (repeatable). See @ref{history 10755options}. 10756 10757@item -w 10758Working directory must match. See @ref{history options}. 10759 10760@item -x @var{types} 10761Report on @var{types}, one or more of 10762@code{TOEFWUCGMAR}. See @ref{history options}. 10763 10764@item -z @var{zone} 10765Output for time zone @var{zone}. See @ref{history 10766options}. 10767@end table 10768 10769@item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{} 10770Import files into @sc{cvs}, using vendor branches. See 10771@ref{import}. 10772 10773@table @code 10774@item -b @var{bra} 10775Import to vendor branch @var{bra}. See 10776@ref{Multiple vendor branches}. 10777 10778@item -d 10779Use the file's modification time as the time of 10780import. See @ref{import options}. 10781 10782@item -k @var{kflag} 10783Set default keyword substitution mode. See 10784@ref{import options}. 10785 10786@item -m @var{msg} 10787Use @var{msg} for log message. See 10788@ref{import options}. 10789 10790@item -I @var{ign} 10791More files to ignore (! to reset). See 10792@ref{import options}. 10793 10794@item -W @var{spec} 10795More wrappers. See @ref{import options}. 10796@end table 10797 10798@item init 10799Create a @sc{cvs} repository if it doesn't exist. See 10800@ref{Creating a repository}. 10801 10802@item log [@var{options}] [@var{files}@dots{}] 10803Print out history information for files. See @ref{log}. 10804 10805@table @code 10806@item -b 10807Only list revisions on the default branch. See @ref{log options}. 10808 10809@item -d @var{dates} 10810Specify dates (@var{d1}<@var{d2} for range, @var{d} for 10811latest before). See @ref{log options}. 10812 10813@item -h 10814Only print header. See @ref{log options}. 10815 10816@item -l 10817Local; run only in current working directory. See @ref{Recursive behavior}. 10818 10819@item -N 10820Do not list tags. See @ref{log options}. 10821 10822@item -R 10823Only print name of RCS file. See @ref{log options}. 10824 10825@item -r@var{revs} 10826Only list revisions @var{revs}. See @ref{log options}. 10827 10828@item -s @var{states} 10829Only list revisions with specified states. See @ref{log options}. 10830 10831@item -t 10832Only print header and descriptive text. See @ref{log 10833options}. 10834 10835@item -w@var{logins} 10836Only list revisions checked in by specified logins. See @ref{log options}. 10837@end table 10838 10839@item login 10840Prompt for password for authenticating server. See 10841@ref{Password authentication client}. 10842 10843@item logout 10844Remove stored password for authenticating server. See 10845@ref{Password authentication client}. 10846 10847@item rdiff [@var{options}] @var{modules}@dots{} 10848Show differences between releases. See @ref{rdiff}. 10849 10850@table @code 10851@item -c 10852Context diff output format (default). See @ref{rdiff options}. 10853 10854@item -D @var{date} 10855Select revisions based on @var{date}. See @ref{Common options}. 10856 10857@item -f 10858Use head revision if tag/date not found. See 10859@ref{Common options}. 10860 10861@item -l 10862Local; run only in current working directory. See @ref{Recursive behavior}. 10863 10864@item -R 10865Operate recursively (default). @xref{Recursive 10866behavior}. 10867 10868@item -r @var{rev} 10869Select revisions based on @var{rev}. See @ref{Common options}. 10870 10871@item -s 10872Short patch - one liner per file. See @ref{rdiff options}. 10873 10874@item -t 10875Top two diffs - last change made to the file. See 10876@ref{diff options}. 10877 10878@item -u 10879Unidiff output format. See @ref{rdiff options}. 10880 10881@item -V @var{vers} 10882Use RCS Version @var{vers} for keyword expansion (obsolete). See 10883@ref{rdiff options}. 10884@end table 10885 10886@item release [@var{options}] @var{directory} 10887Indicate that a directory is no longer in use. See 10888@ref{release}. 10889 10890@table @code 10891@item -d 10892Delete the given directory. See @ref{release options}. 10893@end table 10894 10895@item remove [@var{options}] [@var{files}@dots{}] 10896Remove an entry from the repository. See @ref{Removing files}. 10897 10898@table @code 10899@item -f 10900Delete the file before removing it. See @ref{Removing files}. 10901 10902@item -l 10903Local; run only in current working directory. See @ref{Recursive behavior}. 10904 10905@item -R 10906Operate recursively (default). @xref{Recursive 10907behavior}. 10908@end table 10909 10910@item rtag [@var{options}] @var{tag} @var{modules}@dots{} 10911Add a symbolic tag to a module. 10912See @ref{Revisions} and @ref{Branching and merging}. 10913 10914@table @code 10915@item -a 10916Clear tag from removed files that would not otherwise 10917be tagged. See @ref{Tagging add/remove}. 10918 10919@item -b 10920Create a branch named @var{tag}. See @ref{Branching and merging}. 10921 10922@item -D @var{date} 10923Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 10924 10925@item -d 10926Delete @var{tag}. See @ref{Modifying tags}. 10927 10928@item -F 10929Move @var{tag} if it already exists. See @ref{Modifying tags}. 10930 10931@item -f 10932Force a head revision match if tag/date not found. 10933See @ref{Tagging by date/tag}. 10934 10935@item -l 10936Local; run only in current working directory. See @ref{Recursive behavior}. 10937 10938@item -n 10939No execution of tag program. See @ref{Common options}. 10940 10941@item -R 10942Operate recursively (default). @xref{Recursive 10943behavior}. 10944 10945@item -r @var{rev} 10946Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 10947@end table 10948 10949@item status [@var{options}] @var{files}@dots{} 10950Display status information in a working directory. See 10951@ref{File status}. 10952 10953@table @code 10954@item -l 10955Local; run only in current working directory. See @ref{Recursive behavior}. 10956 10957@item -R 10958Operate recursively (default). @xref{Recursive 10959behavior}. 10960 10961@item -v 10962Include tag information for file. See @ref{Tags}. 10963@end table 10964 10965@item tag [@var{options}] @var{tag} [@var{files}@dots{}] 10966Add a symbolic tag to checked out version of files. 10967See @ref{Revisions} and @ref{Branching and merging}. 10968 10969@table @code 10970@item -b 10971Create a branch named @var{tag}. See @ref{Branching and merging}. 10972 10973@item -c 10974Check that working files are unmodified. See 10975@ref{Tagging the working directory}. 10976 10977@item -D @var{date} 10978Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 10979 10980@item -d 10981Delete @var{tag}. See @ref{Modifying tags}. 10982 10983@item -F 10984Move @var{tag} if it already exists. See @ref{Modifying tags}. 10985 10986@item -f 10987Force a head revision match if tag/date not found. 10988See @ref{Tagging by date/tag}. 10989 10990@item -l 10991Local; run only in current working directory. See @ref{Recursive behavior}. 10992 10993@item -R 10994Operate recursively (default). @xref{Recursive 10995behavior}. 10996 10997@item -r @var{rev} 10998Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 10999@end table 11000 11001@item unedit [@var{options}] [@var{files}@dots{}] 11002Undo an edit command. See @ref{Editing files}. 11003 11004@table @code 11005@item -a @var{actions} 11006Specify actions for temporary watch, where 11007@var{actions} is @code{edit}, @code{unedit}, 11008@code{commit}, @code{all}, or @code{none}. See 11009@ref{Editing files}. 11010 11011@item -l 11012Local; run only in current working directory. See @ref{Recursive behavior}. 11013 11014@item -R 11015Operate recursively (default). @xref{Recursive 11016behavior}. 11017@end table 11018 11019@item update [@var{options}] [@var{files}@dots{}] 11020Bring work tree in sync with repository. See 11021@ref{update}. 11022 11023@table @code 11024@item -A 11025Reset any sticky tags/date/options. See @ref{Sticky 11026tags} and @ref{Keyword substitution}. 11027 11028@item -C 11029Overwrite locally modified files with clean copies from 11030the repository (the modified file is saved in 11031@file{.#@var{file}.@var{revision}}, however). 11032 11033@item -D @var{date} 11034Check out revisions as of @var{date} (is sticky). See 11035@ref{Common options}. 11036 11037@item -d 11038Create directories. See @ref{update options}. 11039 11040@item -f 11041Use head revision if tag/date not found. See 11042@ref{Common options}. 11043 11044@item -I @var{ign} 11045More files to ignore (! to reset). See 11046@ref{import options}. 11047 11048@c Probably want to use rev1/rev2 style like for diff 11049@c -r. Here and in on-line help. 11050@item -j @var{rev} 11051Merge in changes. See @ref{update options}. 11052 11053@item -k @var{kflag} 11054Use @var{kflag} keyword expansion. See 11055@ref{Substitution modes}. 11056 11057@item -l 11058Local; run only in current working directory. @xref{Recursive behavior}. 11059 11060@item -P 11061Prune empty directories. See @ref{Moving directories}. 11062 11063@item -p 11064Check out files to standard output (avoids 11065stickiness). See @ref{update options}. 11066 11067@item -R 11068Operate recursively (default). @xref{Recursive 11069behavior}. 11070 11071@item -r @var{tag} 11072Checkout revision @var{tag} (is sticky). See @ref{Common options}. 11073 11074@item -W @var{spec} 11075More wrappers. See @ref{import options}. 11076@end table 11077 11078@item version 11079@cindex version (subcommand) 11080 11081Display the version of @sc{cvs} being used. If the repository 11082is remote, display both the client and server versions. 11083 11084@item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}] 11085 11086on/off: turn on/off read-only checkouts of files. See 11087@ref{Setting a watch}. 11088 11089add/remove: add or remove notification on actions. See 11090@ref{Getting Notified}. 11091 11092@table @code 11093@item -a @var{actions} 11094Specify actions for temporary watch, where 11095@var{actions} is @code{edit}, @code{unedit}, 11096@code{commit}, @code{all}, or @code{none}. See 11097@ref{Editing files}. 11098 11099@item -l 11100Local; run only in current working directory. See @ref{Recursive behavior}. 11101 11102@item -R 11103Operate recursively (default). @xref{Recursive 11104behavior}. 11105@end table 11106 11107@item watchers [@var{options}] [@var{files}@dots{}] 11108See who is watching a file. See @ref{Watch information}. 11109 11110@table @code 11111@item -l 11112Local; run only in current working directory. See @ref{Recursive behavior}. 11113 11114@item -R 11115Operate recursively (default). @xref{Recursive 11116behavior}. 11117@end table 11118 11119@end table 11120 11121@c --------------------------------------------------------------------- 11122@node Administrative files 11123@appendix Reference manual for Administrative files 11124@cindex Administrative files (reference) 11125@cindex Files, reference manual 11126@cindex Reference manual (files) 11127@cindex CVSROOT (file) 11128 11129@c FIXME? Somewhere there needs to be a more "how-to" 11130@c guide to writing these. I think the triggers 11131@c (commitinfo, loginfo, taginfo, &c) are perhaps a 11132@c different case than files like modules. One 11133@c particular issue that people sometimes are 11134@c (unnecessarily?) worried about is performance, and 11135@c the impact of writing in perl or sh or ____. 11136Inside the repository, in the directory 11137@file{$CVSROOT/CVSROOT}, there are a number of 11138supportive files for @sc{cvs}. You can use @sc{cvs} in a limited 11139fashion without any of them, but if they are set up 11140properly they can help make life easier. For a 11141discussion of how to edit them, see @ref{Intro 11142administrative files}. 11143 11144The most important of these files is the @file{modules} 11145file, which defines the modules inside the repository. 11146 11147@menu 11148* modules:: Defining modules 11149* Wrappers:: Specify binary-ness based on file name 11150* commit files:: The commit support files 11151* commitinfo:: Pre-commit checking 11152* verifymsg:: How are log messages evaluated? 11153* editinfo:: Specifying how log messages are created 11154 (obsolete) 11155* loginfo:: Where should log messages be sent? 11156* rcsinfo:: Templates for the log messages 11157* cvsignore:: Ignoring files via cvsignore 11158* checkoutlist:: Adding your own administrative files 11159* history file:: History information 11160* Variables:: Various variables are expanded 11161* config:: Miscellaneous CVS configuration 11162@end menu 11163 11164@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11165@node modules 11166@appendixsec The modules file 11167@cindex Modules (admin file) 11168@cindex Defining modules (reference manual) 11169 11170The @file{modules} file records your definitions of 11171names for collections of source code. @sc{cvs} will 11172use these definitions if you use @sc{cvs} to update the 11173modules file (use normal commands like @code{add}, 11174@code{commit}, etc). 11175 11176The @file{modules} file may contain blank lines and 11177comments (lines beginning with @samp{#}) as well as 11178module definitions. Long lines can be continued on the 11179next line by specifying a backslash (@samp{\}) as the 11180last character on the line. 11181 11182There are three basic types of modules: alias modules, 11183regular modules, and ampersand modules. The difference 11184between them is the way that they map files in the 11185repository to files in the working directory. In all 11186of the following examples, the top-level repository 11187contains a directory called @file{first-dir}, which 11188contains two files, @file{file1} and @file{file2}, and a 11189directory @file{sdir}. @file{first-dir/sdir} contains 11190a file @file{sfile}. 11191 11192@c FIXME: should test all the examples in this section. 11193 11194@menu 11195* Alias modules:: The simplest kind of module 11196* Regular modules:: 11197* Ampersand modules:: 11198* Excluding directories:: Excluding directories from a module 11199* Module options:: Regular and ampersand modules can take options 11200* Module program options:: How the modules ``program options'' programs 11201 are run. 11202@end menu 11203 11204@node Alias modules 11205@appendixsubsec Alias modules 11206@cindex Alias modules 11207@cindex -a, in modules file 11208 11209Alias modules are the simplest kind of module: 11210 11211@table @code 11212@item @var{mname} -a @var{aliases}@dots{} 11213This represents the simplest way of defining a module 11214@var{mname}. The @samp{-a} flags the definition as a 11215simple alias: @sc{cvs} will treat any use of @var{mname} (as 11216a command argument) as if the list of names 11217@var{aliases} had been specified instead. 11218@var{aliases} may contain either other module names or 11219paths. When you use paths in aliases, @code{checkout} 11220creates all intermediate directories in the working 11221directory, just as if the path had been specified 11222explicitly in the @sc{cvs} arguments. 11223@end table 11224 11225For example, if the modules file contains: 11226 11227@example 11228amodule -a first-dir 11229@end example 11230 11231@noindent 11232then the following two commands are equivalent: 11233 11234@example 11235$ cvs co amodule 11236$ cvs co first-dir 11237@end example 11238 11239@noindent 11240and they each would provide output such as: 11241 11242@example 11243cvs checkout: Updating first-dir 11244U first-dir/file1 11245U first-dir/file2 11246cvs checkout: Updating first-dir/sdir 11247U first-dir/sdir/sfile 11248@end example 11249 11250@node Regular modules 11251@appendixsubsec Regular modules 11252@cindex Regular modules 11253 11254@table @code 11255@item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ] 11256In the simplest case, this form of module definition 11257reduces to @samp{@var{mname} @var{dir}}. This defines 11258all the files in directory @var{dir} as module mname. 11259@var{dir} is a relative path (from @code{$CVSROOT}) to a 11260directory of source in the source repository. In this 11261case, on checkout, a single directory called 11262@var{mname} is created as a working directory; no 11263intermediate directory levels are used by default, even 11264if @var{dir} was a path involving several directory 11265levels. 11266@end table 11267 11268For example, if a module is defined by: 11269 11270@example 11271regmodule first-dir 11272@end example 11273 11274@noindent 11275then regmodule will contain the files from first-dir: 11276 11277@example 11278$ cvs co regmodule 11279cvs checkout: Updating regmodule 11280U regmodule/file1 11281U regmodule/file2 11282cvs checkout: Updating regmodule/sdir 11283U regmodule/sdir/sfile 11284$ 11285@end example 11286 11287By explicitly specifying files in the module definition 11288after @var{dir}, you can select particular files from 11289directory @var{dir}. Here is 11290an example: 11291 11292@example 11293regfiles first-dir/sdir sfile 11294@end example 11295 11296@noindent 11297With this definition, getting the regfiles module 11298will create a single working directory 11299@file{regfiles} containing the file listed, which 11300comes from a directory deeper 11301in the @sc{cvs} source repository: 11302 11303@example 11304$ cvs co regfiles 11305U regfiles/sfile 11306$ 11307@end example 11308 11309@node Ampersand modules 11310@appendixsubsec Ampersand modules 11311@cindex Ampersand modules 11312@cindex &, in modules file 11313 11314A module definition can refer to other modules by 11315including @samp{&@var{module}} in its definition. 11316@example 11317@var{mname} [ options ] @var{&module}@dots{} 11318@end example 11319 11320Then getting the module creates a subdirectory for each such 11321module, in the directory containing the module. For 11322example, if modules contains 11323 11324@example 11325ampermod &first-dir 11326@end example 11327 11328then a checkout will create an @code{ampermod} directory 11329which contains a directory called @code{first-dir}, 11330which in turns contains all the directories and files 11331which live there. For example, the command 11332 11333@example 11334$ cvs co ampermod 11335@end example 11336 11337@noindent 11338will create the following files: 11339 11340@example 11341ampermod/first-dir/file1 11342ampermod/first-dir/file2 11343ampermod/first-dir/sdir/sfile 11344@end example 11345 11346There is one quirk/bug: the messages that @sc{cvs} 11347prints omit the @file{ampermod}, and thus do not 11348correctly display the location to which it is checking 11349out the files: 11350 11351@example 11352$ cvs co ampermod 11353cvs checkout: Updating first-dir 11354U first-dir/file1 11355U first-dir/file2 11356cvs checkout: Updating first-dir/sdir 11357U first-dir/sdir/sfile 11358$ 11359@end example 11360 11361Do not rely on this buggy behavior; it may get fixed in 11362a future release of @sc{cvs}. 11363 11364@c FIXCVS: What happens if regular and & modules are 11365@c combined, as in "ampermodule first-dir &second-dir"? 11366@c When I tried it, it seemed to just ignore the 11367@c "first-dir". I think perhaps it should be an error 11368@c (but this needs further investigation). 11369@c In addition to discussing what each one does, we 11370@c should put in a few words about why you would use one or 11371@c the other in various situations. 11372 11373@node Excluding directories 11374@appendixsubsec Excluding directories 11375@cindex Excluding directories, in modules file 11376@cindex !, in modules file 11377 11378An alias module may exclude particular directories from 11379other modules by using an exclamation mark (@samp{!}) 11380before the name of each directory to be excluded. 11381 11382For example, if the modules file contains: 11383 11384@example 11385exmodule -a !first-dir/sdir first-dir 11386@end example 11387 11388then checking out the module @samp{exmodule} will check 11389out everything in @samp{first-dir} except any files in 11390the subdirectory @samp{first-dir/sdir}. 11391@c Note that the "!first-dir/sdir" sometimes must be listed 11392@c before "first-dir". That seems like a probable bug, in which 11393@c case perhaps it should be fixed (to allow either 11394@c order) rather than documented. See modules4 in testsuite. 11395 11396@node Module options 11397@appendixsubsec Module options 11398@cindex Options, in modules file 11399 11400Either regular modules or ampersand modules can contain 11401options, which supply additional information concerning 11402the module. 11403 11404@table @code 11405@cindex -d, in modules file 11406@item -d @var{name} 11407Name the working directory something other than the 11408module name. 11409@c FIXME: Needs a bunch of examples, analogous to the 11410@c examples for alias, regular, and ampersand modules 11411@c which show where the files go without -d. 11412 11413@cindex Export program 11414@cindex -e, in modules file 11415@item -e @var{prog} 11416Specify a program @var{prog} to run whenever files in a 11417module are exported. @var{prog} runs with a single 11418argument, the module name. 11419@c FIXME: Is it run on server? client? 11420 11421@cindex Checkin program 11422@cindex -i, in modules file 11423@item -i @var{prog} 11424Specify a program @var{prog} to run whenever files in a 11425module are committed. @var{prog} runs with a single 11426argument, the full pathname of the affected directory 11427in a source repository. The @file{commitinfo}, 11428@file{loginfo}, and @file{verifymsg} files provide other 11429ways to call a program on commit. 11430@c FIXME: Is it run on server? client? 11431 11432@cindex Checkout program 11433@cindex -o, in modules file 11434@item -o @var{prog} 11435Specify a program @var{prog} to run whenever files in a 11436module are checked out. @var{prog} runs with a single 11437argument, the module name. 11438@c FIXME: Is it run on server? client? 11439 11440@cindex Status of a module 11441@cindex Module status 11442@cindex -s, in modules file 11443@item -s @var{status} 11444Assign a status to the module. When the module file is 11445printed with @samp{cvs checkout -s} the modules are 11446sorted according to primarily module status, and 11447secondarily according to the module name. This option 11448has no other meaning. You can use this option for 11449several things besides status: for instance, list the 11450person that is responsible for this module. 11451 11452@cindex Tag program 11453@cindex -t, in modules file 11454@item -t @var{prog} 11455Specify a program @var{prog} to run whenever files in a 11456module are tagged with @code{rtag}. @var{prog} runs 11457with two arguments: the module name and the symbolic 11458tag specified to @code{rtag}. It is not run 11459when @code{tag} is executed. Generally you will find 11460that taginfo is a better solution (@pxref{user-defined logging}). 11461@c FIXME: Is it run on server? client? 11462@c Problems with -t include: 11463@c * It is run after the tag not before 11464@c * It doesn't get passed all the information that 11465@c taginfo does ("mov", &c). 11466@c * It only is run for rtag, not tag. 11467 11468@cindex Update program 11469@cindex -u, in modules file 11470@item -u @var{prog} 11471Specify a program @var{prog} to run whenever @samp{cvs 11472update} is executed from the top-level directory of the 11473checked-out module. @var{prog} runs with a single 11474argument, the full path to the source repository for 11475this module. 11476@c FIXME: Is it run on server? client? 11477@c One drawback of -u and -i are that CVS/Update.prog 11478@c and CVS/Checkin.prog only get updated on initial 11479@c checkout, and don't get updated if the modules file 11480@c changes. Also, the user can edit them, which means 11481@c they are no good for security-type stuff. 11482@end table 11483 11484You should also see @pxref{Module program options} about how the 11485``program options'' programs are run. 11486 11487@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11488 11489@node Module program options 11490@appendixsubsec How the modules file ``program options'' programs are run 11491@cindex Modules file program options 11492@cindex -u, in modules file 11493@cindex -t, in modules file 11494@cindex -o, in modules file 11495@cindex -i, in modules file 11496@cindex -e, in modules file 11497 11498@noindent 11499For checkout, rtag, and export, the program is server-based, and as such the 11500following applies:- 11501 11502If using remote access methods (pserver, ext, etc.), 11503@sc{cvs} will execute this program on the server from a temporary 11504directory. The path is searched for this program. 11505 11506If using ``local access'' (on a local or remote NFS filesystem, i.e. 11507repository set just to a path), 11508the program will be executed from the newly checked-out tree, if 11509found there, or alternatively searched for in the path if not. 11510 11511@noindent 11512The commit and update programs are locally-based, and are run as 11513follows:- 11514 11515The program is always run locally. One must 11516re-checkout the tree one is using if these options are updated in the 11517modules administrative file. The file CVS/Checkin.prog contains the 11518value of the option `-i' set in the modules file, and similarly for 11519the file CVS/Update.prog and `-u'. The program is always executed from 11520the top level of the checked-out copy on the client. Again, the program 11521is first searched for in the checked-out copy and then using the path. 11522 11523The programs are all run after the operation has effectively 11524completed. 11525 11526 11527@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11528@node Wrappers 11529@appendixsec The cvswrappers file 11530@cindex cvswrappers (admin file) 11531@cindex CVSWRAPPERS, environment variable 11532@cindex Wrappers 11533 11534@c FIXME: need some better way of separating this out 11535@c by functionality. -t/-f is one feature, -m is 11536@c another, and -k is a third. And this discussion 11537@c should be better motivated (e.g. start with the 11538@c problems, then explain how the feature solves it). 11539 11540Wrappers refers to a @sc{cvs} feature which lets you 11541control certain settings based on the name of the file 11542which is being operated on. The settings are @samp{-k} 11543for binary files, and @samp{-m} for nonmergeable text 11544files. 11545 11546@ignore 11547Wrappers allow you to set a hook which transforms files on 11548their way in and out of @sc{cvs}. 11549 11550The file @file{cvswrappers} defines the script that will be 11551run on a file when its name matches a regular 11552expression. There are two scripts that can be run on a 11553file or directory. One script is executed on the file/directory 11554before being checked into the repository (this is denoted 11555with the @code{-t} flag) and the other when the file is 11556checked out of the repository (this is denoted with the 11557@code{-f} flag). The @samp{-t}/@samp{-f} feature does 11558not work with client/server @sc{cvs}. 11559@c I think maybe -t/-f works client/server if a single 11560@c file converts to/from a single file, as opposed to 11561@c the file<->directory case. Could use more 11562@c investigation... 11563@end ignore 11564 11565The @samp{-m} option 11566specifies the merge methodology that should be used when 11567a non-binary file is updated. @code{MERGE} means the usual 11568@sc{cvs} behavior: try to merge the files. @code{COPY} 11569means that @code{cvs update} will refuse to merge 11570files, as it also does for files specified as binary 11571with @samp{-kb} (but if the file is specified as 11572binary, there is no need to specify @samp{-m 'COPY'}). 11573@sc{cvs} will provide the user with the 11574two versions of the files, and require the user using 11575mechanisms outside @sc{cvs}, to insert any necessary 11576changes. @strong{WARNING}: do not use @code{COPY} with 11577@sc{cvs} 1.9 or earlier--such versions of @sc{cvs} will 11578copy one version of your file over the other, wiping 11579out the previous contents. 11580@c Ordinarily we don't document the behavior of old 11581@c versions. But this one is so dangerous, I think we 11582@c must. I almost renamed it to -m 'NOMERGE' so we 11583@c could say "never use -m 'COPY'". 11584The @samp{-m} wrapper option only affects behavior when 11585merging is done on update; it does not affect how files 11586are stored. See @ref{Binary files}, for more on 11587binary files. 11588 11589The basic format of the file @file{cvswrappers} is: 11590 11591@c FIXME: @example is all wrong for this. Use @deffn or 11592@c something more sensible. 11593@example 11594wildcard [option value][option value]... 11595 11596where option is one of 11597@ignore 11598-f from cvs filter value: path to filter 11599-t to cvs filter value: path to filter 11600@end ignore 11601-m update methodology value: MERGE or COPY 11602-k keyword expansion value: expansion mode 11603 11604and value is a single-quote delimited value. 11605@end example 11606 11607@ignore 11608@example 11609*.nib -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY' 11610*.c -t 'indent %s %s' 11611@end example 11612@c When does the filter need to be an absolute pathname 11613@c and when will something like the above work? I 11614@c suspect it relates to the PATH of the server (which 11615@c in turn depends on all kinds of stuff, e.g. inetd 11616@c for pserver). I'm not sure whether/where to discuss 11617@c this. 11618@c FIXME: What do the %s's stand for? 11619 11620@noindent 11621The above example of a @file{cvswrappers} file 11622states that all files/directories that end with a @code{.nib} 11623should be filtered with the @file{wrap} program before 11624checking the file into the repository. The file should 11625be filtered though the @file{unwrap} program when the 11626file is checked out of the repository. The 11627@file{cvswrappers} file also states that a @code{COPY} 11628methodology should be used when updating the files in 11629the repository (that is, no merging should be performed). 11630 11631@c What pitfalls arise when using indent this way? Is 11632@c it a winning thing to do? Would be nice to at least 11633@c hint at those issues; we want our examples to tell 11634@c how to solve problems, not just to say that cvs can 11635@c do certain things. 11636The last example line says that all files that end with 11637@code{.c} should be filtered with @file{indent} 11638before being checked into the repository. Unlike the previous 11639example, no filtering of the @code{.c} file is done when 11640it is checked out of the repository. 11641@noindent 11642The @code{-t} filter is called with two arguments, 11643the first is the name of the file/directory to filter 11644and the second is the pathname to where the resulting 11645filtered file should be placed. 11646 11647@noindent 11648The @code{-f} filter is called with one argument, 11649which is the name of the file to filter from. The end 11650result of this filter will be a file in the users directory 11651that they can work on as they normally would. 11652 11653Note that the @samp{-t}/@samp{-f} features do not 11654conveniently handle one portion of @sc{cvs}'s operation: 11655determining when files are modified. @sc{cvs} will still 11656want a file (or directory) to exist, and it will use 11657its modification time to determine whether a file is 11658modified. If @sc{cvs} erroneously thinks a file is 11659unmodified (for example, a directory is unchanged but 11660one of the files within it is changed), you can force 11661it to check in the file anyway by specifying the 11662@samp{-f} option to @code{cvs commit} (@pxref{commit 11663options}). 11664@c This is, of course, a serious design flaw in -t/-f. 11665@c Probably the whole functionality needs to be 11666@c redesigned (starting from requirements) to fix this. 11667@end ignore 11668 11669@c FIXME: We don't document -W or point to where it is 11670@c documented. Or .cvswrappers. 11671For example, the following command imports a 11672directory, treating files whose name ends in 11673@samp{.exe} as binary: 11674 11675@example 11676cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag 11677@end example 11678 11679@c Another good example, would be storing files 11680@c (e.g. binary files) compressed in the repository. 11681@c :::::::::::::::::: 11682@c cvswrappers 11683@c :::::::::::::::::: 11684@c *.t12 -m 'COPY' 11685@c *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY' 11686@c 11687@c :::::::::::::::::: 11688@c gunzipcp 11689@c :::::::::::::::::: 11690@c : 11691@c [ -f $1 ] || exit 1 11692@c zcat $1 > /tmp/.#$1.$$ 11693@c mv /tmp/.#$1.$$ $1 11694@c 11695@c :::::::::::::::::: 11696@c gzipcp 11697@c :::::::::::::::::: 11698@c : 11699@c DIRNAME=`echo $1 | sed -e "s|/.*/||g"` 11700@c if [ ! -d $DIRNAME ] ; then 11701@c DIRNAME=`echo $1 | sed -e "s|.*/||g"` 11702@c fi 11703@c gzip -c $DIRNAME > $2 11704@c One catch--"cvs diff" will not invoke the wrappers 11705@c (probably a CVS bug, although I haven't thought it out). 11706 11707@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11708@node commit files 11709@appendixsec The commit support files 11710@cindex Commit files 11711 11712The @samp{-i} flag in the @file{modules} file can be 11713used to run a certain program whenever files are 11714committed (@pxref{modules}). The files described in 11715this section provide other, more flexible, ways to run 11716programs whenever something is committed. 11717 11718There are three kind of programs that can be run on 11719commit. They are specified in files in the repository, 11720as described below. The following table summarizes the 11721file names and the purpose of the corresponding 11722programs. 11723 11724@table @file 11725@item commitinfo 11726The program is responsible for checking that the commit 11727is allowed. If it exits with a non-zero exit status 11728the commit will be aborted. 11729 11730@item verifymsg 11731The specified program is used to evaluate the log message, 11732and possibly verify that it contains all required 11733fields. This is most useful in combination with the 11734@file{rcsinfo} file, which can hold a log message 11735template (@pxref{rcsinfo}). 11736 11737@item editinfo 11738The specified program is used to edit the log message, 11739and possibly verify that it contains all required 11740fields. This is most useful in combination with the 11741@file{rcsinfo} file, which can hold a log message 11742template (@pxref{rcsinfo}). (obsolete) 11743 11744@item loginfo 11745The specified program is called when the commit is 11746complete. It receives the log message and some 11747additional information and can store the log message in 11748a file, or mail it to appropriate persons, or maybe 11749post it to a local newsgroup, or@dots{} Your 11750imagination is the limit! 11751@end table 11752 11753@menu 11754* syntax:: The common syntax 11755@end menu 11756 11757@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11758@node syntax 11759@appendixsubsec The common syntax 11760@cindex Info files (syntax) 11761@cindex Syntax of info files 11762@cindex Common syntax of info files 11763 11764@c FIXME: having this so totally separate from the 11765@c Variables node is rather bogus. 11766 11767The administrative files such as @file{commitinfo}, 11768@file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc., 11769all have a common format. The purpose of the files are 11770described later on. The common syntax is described 11771here. 11772 11773@cindex Regular expression syntax 11774Each line contains the following: 11775@itemize @bullet 11776@item 11777@c Say anything about DEFAULT and ALL? Right now we 11778@c leave that to the description of each file (and in fact 11779@c the practice is inconsistent which is really annoying). 11780A regular expression. This is a basic regular 11781expression in the syntax used by GNU emacs. 11782@c FIXME: What we probably should be saying is "POSIX Basic 11783@c Regular Expression with the following extensions (`\(' 11784@c `\|' '+' etc)" 11785@c rather than define it with reference to emacs. 11786@c The reference to emacs is not strictly speaking 11787@c true, as we don't support \=, \s, or \S. Also it isn't 11788@c clear we should document and/or promise to continue to 11789@c support all the obscure emacs extensions like \<. 11790@c Also need to better cite (or include) full 11791@c documentation for the syntax. 11792@c Also see comment in configure.in about what happens to the 11793@c syntax if we pick up a system-supplied regexp matcher. 11794 11795@item 11796A whitespace separator---one or more spaces and/or tabs. 11797 11798@item 11799A file name or command-line template. 11800@end itemize 11801 11802@noindent 11803Blank lines are ignored. Lines that start with the 11804character @samp{#} are treated as comments. Long lines 11805unfortunately can @emph{not} be broken in two parts in 11806any way. 11807 11808The first regular expression that matches the current 11809directory name in the repository is used. The rest of the line 11810is used as a file name or command-line as appropriate. 11811 11812@c FIXME: need an example. In particular, show what 11813@c the regular expression is matched against (one 11814@c ordinarily clueful person got confused about whether it 11815@c includes the filename--"directory name" above should be 11816@c unambiguous but there is nothing like an example to 11817@c confirm people's understanding of this sort of thing). 11818 11819@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11820@node commitinfo 11821@appendixsec Commitinfo 11822@cindex Commitinfo 11823@cindex Checking commits 11824@cindex Precommit checking 11825 11826The @file{commitinfo} file defines programs to execute 11827whenever @samp{cvs commit} is about to execute. These 11828programs are used for pre-commit checking to verify 11829that the modified, added and removed files are really 11830ready to be committed. This could be used, for 11831instance, to verify that the changed files conform to 11832to your site's standards for coding practice. 11833 11834As mentioned earlier, each line in the 11835@file{commitinfo} file consists of a regular expression 11836and a command-line template. The template can include 11837a program name and any number of arguments you wish to 11838supply to it. The full path to the current source 11839repository is appended to the template, followed by the 11840file names of any files involved in the commit (added, 11841removed, and modified files). 11842 11843@cindex Exit status, of commitinfo 11844The first line with a regular expression matching the 11845directory within the repository will be used. If the 11846command returns a non-zero exit status the commit will 11847be aborted. 11848@c FIXME: need example(s) of what "directory within the 11849@c repository" means. 11850 11851@cindex DEFAULT in commitinfo 11852If the repository name does not match any of the 11853regular expressions in this file, the @samp{DEFAULT} 11854line is used, if it is specified. 11855 11856@cindex ALL in commitinfo 11857All occurrences of the name @samp{ALL} appearing as a 11858regular expression are used in addition to the first 11859matching regular expression or the name @samp{DEFAULT}. 11860 11861Note: when @sc{cvs} is accessing a remote repository, 11862@file{commitinfo} will be run on the @emph{remote} 11863(i.e., server) side, not the client side (@pxref{Remote 11864repositories}). 11865 11866@c FIXME: should discuss using commitinfo to control 11867@c who has checkin access to what (e.g. Joe can check into 11868@c directories a, b, and c, and Mary can check into 11869@c directories b, c, and d--note this case cannot be 11870@c conveniently handled with unix groups). Of course, 11871@c adding a new set of features to CVS might be a more 11872@c natural way to fix this problem than telling people to 11873@c use commitinfo. 11874@c FIXME: Should make some reference, especially in 11875@c the context of controlling who has access, to the fact 11876@c that commitinfo can be circumvented. Perhaps 11877@c mention SETXID (but has it been carefully examined 11878@c for holes?). This fits in with the discussion of 11879@c general CVS security in "Password authentication 11880@c security" (the bit which is not pserver-specific). 11881 11882@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11883@node verifymsg 11884@appendixsec Verifying log messages 11885@cindex verifymsg (admin file) 11886@cindex Log message, verifying 11887 11888Once you have entered a log message, you can evaluate 11889that message to check for specific content, such as 11890a bug ID. Use the @file{verifymsg} file to 11891specify a program that is used to verify the log message. 11892This program could be a simple script that checks 11893that the entered message contains the required fields. 11894 11895The @file{verifymsg} file is often most useful together 11896with the @file{rcsinfo} file, which can be used to 11897specify a log message template. 11898 11899Each line in the @file{verifymsg} file consists of a 11900regular expression and a command-line template. The 11901template must include a program name, and can include 11902any number of arguments. The full path to the current 11903log message template file is appended to the template. 11904 11905One thing that should be noted is that the @samp{ALL} 11906keyword is not supported. If more than one matching 11907line is found, the first one is used. This can be 11908useful for specifying a default verification script in a 11909directory, and then overriding it in a subdirectory. 11910 11911@cindex DEFAULT in verifymsg 11912If the repository name does not match any of the 11913regular expressions in this file, the @samp{DEFAULT} 11914line is used, if it is specified. 11915 11916@cindex Exit status, of verifymsg 11917If the verification script exits with a non-zero exit status, 11918the commit is aborted. 11919 11920Note that the verification script cannot change the log 11921message; it can merely accept it or reject it. 11922@c FIXME? Is this an annoying limitation? It would be 11923@c relatively easy to fix (although it would *not* be a 11924@c good idea for a verifymsg script to interact with the user 11925@c at least in the client/server case because of locks 11926@c and all that jazz). 11927 11928The following is a little silly example of a 11929@file{verifymsg} file, together with the corresponding 11930@file{rcsinfo} file, the log message template and an 11931verification script. We begin with the log message template. 11932We want to always record a bug-id number on the first 11933line of the log message. The rest of log message is 11934free text. The following template is found in the file 11935@file{/usr/cvssupport/tc.template}. 11936 11937@example 11938BugId: 11939@end example 11940 11941The script @file{/usr/cvssupport/bugid.verify} is used to 11942evaluate the log message. 11943 11944@example 11945#!/bin/sh 11946# 11947# bugid.verify filename 11948# 11949# Verify that the log message contains a valid bugid 11950# on the first line. 11951# 11952if head -1 < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then 11953 exit 0 11954else 11955 echo "No BugId found." 11956 exit 1 11957fi 11958@end example 11959 11960The @file{verifymsg} file contains this line: 11961 11962@example 11963^tc /usr/cvssupport/bugid.verify 11964@end example 11965 11966The @file{rcsinfo} file contains this line: 11967 11968@example 11969^tc /usr/cvssupport/tc.template 11970@end example 11971 11972 11973 11974@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11975@node editinfo 11976@appendixsec Editinfo 11977@cindex editinfo (admin file) 11978@cindex Editor, specifying per module 11979@cindex Per-module editor 11980@cindex Log messages, editing 11981 11982@emph{NOTE:} The @file{editinfo} feature has been 11983rendered obsolete. To set a default editor for log 11984messages use the @code{EDITOR} environment variable 11985(@pxref{Environment variables}) or the @samp{-e} global 11986option (@pxref{Global options}). See @ref{verifymsg}, 11987for information on the use of the @file{verifymsg} 11988feature for evaluating log messages. 11989 11990If you want to make sure that all log messages look the 11991same way, you can use the @file{editinfo} file to 11992specify a program that is used to edit the log message. 11993This program could be a custom-made editor that always 11994enforces a certain style of the log message, or maybe a 11995simple shell script that calls an editor, and checks 11996that the entered message contains the required fields. 11997 11998If no matching line is found in the @file{editinfo} 11999file, the editor specified in the environment variable 12000@code{$CVSEDITOR} is used instead. If that variable is 12001not set, then the environment variable @code{$EDITOR} 12002is used instead. If that variable is not 12003set a default will be used. See @ref{Committing your changes}. 12004 12005The @file{editinfo} file is often most useful together 12006with the @file{rcsinfo} file, which can be used to 12007specify a log message template. 12008 12009Each line in the @file{editinfo} file consists of a 12010regular expression and a command-line template. The 12011template must include a program name, and can include 12012any number of arguments. The full path to the current 12013log message template file is appended to the template. 12014 12015One thing that should be noted is that the @samp{ALL} 12016keyword is not supported. If more than one matching 12017line is found, the first one is used. This can be 12018useful for specifying a default edit script in a 12019module, and then overriding it in a subdirectory. 12020 12021@cindex DEFAULT in editinfo 12022If the repository name does not match any of the 12023regular expressions in this file, the @samp{DEFAULT} 12024line is used, if it is specified. 12025 12026If the edit script exits with a non-zero exit status, 12027the commit is aborted. 12028 12029Note: when @sc{cvs} is accessing a remote repository, 12030or when the @samp{-m} or @samp{-F} options to @code{cvs 12031commit} are used, @file{editinfo} will not be consulted. 12032There is no good workaround for this; use 12033@file{verifymsg} instead. 12034 12035@menu 12036* editinfo example:: Editinfo example 12037@end menu 12038 12039@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12040@node editinfo example 12041@appendixsubsec Editinfo example 12042 12043The following is a little silly example of a 12044@file{editinfo} file, together with the corresponding 12045@file{rcsinfo} file, the log message template and an 12046editor script. We begin with the log message template. 12047We want to always record a bug-id number on the first 12048line of the log message. The rest of log message is 12049free text. The following template is found in the file 12050@file{/usr/cvssupport/tc.template}. 12051 12052@example 12053BugId: 12054@end example 12055 12056The script @file{/usr/cvssupport/bugid.edit} is used to 12057edit the log message. 12058 12059@example 12060#!/bin/sh 12061# 12062# bugid.edit filename 12063# 12064# Call $EDITOR on FILENAME, and verify that the 12065# resulting file contains a valid bugid on the first 12066# line. 12067if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi 12068if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi 12069$CVSEDITOR $1 12070until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1 12071do echo -n "No BugId found. Edit again? ([y]/n)" 12072 read ans 12073 case $@{ans@} in 12074 n*) exit 1;; 12075 esac 12076 $CVSEDITOR $1 12077done 12078@end example 12079 12080The @file{editinfo} file contains this line: 12081 12082@example 12083^tc /usr/cvssupport/bugid.edit 12084@end example 12085 12086The @file{rcsinfo} file contains this line: 12087 12088@example 12089^tc /usr/cvssupport/tc.template 12090@end example 12091 12092@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12093@node loginfo 12094@appendixsec Loginfo 12095@cindex loginfo (admin file) 12096@cindex Storing log messages 12097@cindex Mailing log messages 12098@cindex Distributing log messages 12099@cindex Log messages 12100 12101@c "cvs commit" is not quite right. What we 12102@c mean is "when the repository gets changed" which 12103@c also includes "cvs import" and "cvs add" on a directory. 12104The @file{loginfo} file is used to control where 12105@samp{cvs commit} log information is sent. The first 12106entry on a line is a regular expression which is tested 12107against the directory that the change is being made to, 12108relative to the @code{$CVSROOT}. If a match is found, then 12109the remainder of the line is a filter program that 12110should expect log information on its standard input. 12111 12112If the repository name does not match any of the 12113regular expressions in this file, the @samp{DEFAULT} 12114line is used, if it is specified. 12115 12116All occurrences of the name @samp{ALL} appearing as a 12117regular expression are used in addition to the first 12118matching regular expression or @samp{DEFAULT}. 12119 12120The first matching regular expression is used. 12121 12122@xref{commit files}, for a description of the syntax of 12123the @file{loginfo} file. 12124 12125The user may specify a format string as 12126part of the filter. The string is composed of a 12127@samp{%} followed by a space, or followed by a single 12128format character, or followed by a set of format 12129characters surrounded by @samp{@{} and @samp{@}} as 12130separators. The format characters are: 12131 12132@table @t 12133@item s 12134file name 12135@item V 12136old version number (pre-checkin) 12137@item v 12138new version number (post-checkin) 12139@end table 12140 12141All other characters that appear in a format string 12142expand to an empty field (commas separating fields are 12143still provided). 12144 12145For example, some valid format strings are @samp{%}, 12146@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}. 12147 12148The output will be a string of tokens separated by 12149spaces. For backwards compatibility, the first 12150token will be the repository subdirectory. The rest of the 12151tokens will be comma-delimited lists of the information 12152requested in the format string. For example, if 12153@samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}} 12154is the format string, and three files (@t{ChangeLog}, 12155@t{Makefile}, @t{foo.c}) were modified, the output 12156might be: 12157 12158@example 12159yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13 12160@end example 12161 12162As another example, @samp{%@{@}} means that only the 12163name of the repository will be generated. 12164 12165Note: when @sc{cvs} is accessing a remote repository, 12166@file{loginfo} will be run on the @emph{remote} 12167(i.e., server) side, not the client side (@pxref{Remote 12168repositories}). 12169 12170@menu 12171* loginfo example:: Loginfo example 12172* Keeping a checked out copy:: Updating a tree on every checkin 12173@end menu 12174 12175@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12176@node loginfo example 12177@appendixsubsec Loginfo example 12178 12179The following @file{loginfo} file, together with the 12180tiny shell-script below, appends all log messages 12181to the file @file{$CVSROOT/CVSROOT/commitlog}, 12182and any commits to the administrative files (inside 12183the @file{CVSROOT} directory) are also logged in 12184@file{/usr/adm/cvsroot-log}. 12185Commits to the @file{prog1} directory are mailed to @t{ceder}. 12186 12187@c FIXME: is it a CVS feature or bug that only the 12188@c first matching line is used? It is documented 12189@c above, but is it useful? For example, if we wanted 12190@c to run both "cvs-log" and "Mail" for the CVSROOT 12191@c directory, it is kind of awkward if 12192@c only the first matching line is used. 12193@example 12194ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER 12195^CVSROOT /usr/local/bin/cvs-log /usr/adm/cvsroot-log 12196^prog1 Mail -s %s ceder 12197@end example 12198 12199The shell-script @file{/usr/local/bin/cvs-log} looks 12200like this: 12201 12202@example 12203#!/bin/sh 12204(echo "------------------------------------------------------"; 12205 echo -n $2" "; 12206 date; 12207 echo; 12208 cat) >> $1 12209@end example 12210 12211@node Keeping a checked out copy 12212@appendixsubsec Keeping a checked out copy 12213 12214@c What other index entries? It seems like 12215@c people might want to use a lot of different 12216@c words for this functionality. 12217@cindex Keeping a checked out copy 12218@cindex Checked out copy, keeping 12219@cindex Web pages, maintaining with CVS 12220 12221It is often useful to maintain a directory tree which 12222contains files which correspond to the latest version 12223in the repository. For example, other developers might 12224want to refer to the latest sources without having to 12225check them out, or you might be maintaining a web site 12226with @sc{cvs} and want every checkin to cause the files 12227used by the web server to be updated. 12228@c Can we offer more details on the web example? Or 12229@c point the user at how to figure it out? This text 12230@c strikes me as sufficient for someone who already has 12231@c some idea of what we mean but not enough for the naive 12232@c user/sysadmin to understand it and set it up. 12233 12234The way to do this is by having loginfo invoke 12235@code{cvs update}. Doing so in the naive way will 12236cause a problem with locks, so the @code{cvs update} 12237must be run in the background. 12238@c Should we try to describe the problem with locks? 12239@c It seems like a digression for someone who just 12240@c wants to know how to make it work. 12241@c Another choice which might work for a single file 12242@c is to use "cvs -n update -p" which doesn't take 12243@c out locks (I think) but I don't see many advantages 12244@c of that and we might as well document something which 12245@c works for multiple files. 12246Here is an example for unix (this should all be on one line): 12247 12248@example 12249^cyclic-pages (date; cat; (sleep 2; cd /u/www/local-docs; 12250 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1 12251@end example 12252 12253This will cause checkins to repository directories 12254starting with @code{cyclic-pages} to update the checked 12255out tree in @file{/u/www/local-docs}. 12256@c More info on some of the details? The "sleep 2" is 12257@c so if we are lucky the lock will be gone by the time 12258@c we start and we can wait 2 seconds instead of 30. 12259 12260@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12261@node rcsinfo 12262@appendixsec Rcsinfo 12263@cindex rcsinfo (admin file) 12264@cindex Form for log message 12265@cindex Log message template 12266@cindex Template for log message 12267 12268The @file{rcsinfo} file can be used to specify a form to 12269edit when filling out the commit log. The 12270@file{rcsinfo} file has a syntax similar to the 12271@file{verifymsg}, @file{commitinfo} and @file{loginfo} 12272files. @xref{syntax}. Unlike the other files the second 12273part is @emph{not} a command-line template. Instead, 12274the part after the regular expression should be a full pathname to 12275a file containing the log message template. 12276 12277If the repository name does not match any of the 12278regular expressions in this file, the @samp{DEFAULT} 12279line is used, if it is specified. 12280 12281All occurrences of the name @samp{ALL} appearing as a 12282regular expression are used in addition to the first 12283matching regular expression or @samp{DEFAULT}. 12284 12285@c FIXME: should be offering advice, somewhere around 12286@c here, about where to put the template file. The 12287@c verifymsg example uses /usr/cvssupport but doesn't 12288@c say anything about what that directory is for or 12289@c whether it is hardwired into CVS or who creates 12290@c it or anything. In particular we should say 12291@c how to version control the template file. A 12292@c probably better answer than the /usr/cvssupport 12293@c stuff is to use checkoutlist (with xref to the 12294@c checkoutlist doc). 12295@c Also I am starting to see a connection between 12296@c this and the Keeping a checked out copy node. 12297@c Probably want to say something about that. 12298The log message template will be used as a default log 12299message. If you specify a log message with @samp{cvs 12300commit -m @var{message}} or @samp{cvs commit -f 12301@var{file}} that log message will override the 12302template. 12303 12304@xref{verifymsg}, for an example @file{rcsinfo} 12305file. 12306 12307When @sc{cvs} is accessing a remote repository, 12308the contents of @file{rcsinfo} at the time a directory 12309is first checked out will specify a template which does 12310not then change. If you edit @file{rcsinfo} or its 12311templates, you may need to check out a new working 12312directory. 12313@c Would be nice to fix CVS so this isn't needed. For 12314@c example, a mechanism analogous to CVS/Entries, where 12315@c the client keeps track of what version of the template 12316@c it has. 12317 12318@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12319@node cvsignore 12320@appendixsec Ignoring files via cvsignore 12321@cindex cvsignore (admin file), global 12322@cindex Global cvsignore 12323@cindex Ignoring files 12324@c -- This chapter should maybe be moved to the 12325@c tutorial part of the manual? 12326 12327There are certain file names that frequently occur 12328inside your working copy, but that you don't want to 12329put under @sc{cvs} control. Examples are all the object 12330files that you get while you compile your sources. 12331Normally, when you run @samp{cvs update}, it prints a 12332line for each file it encounters that it doesn't know 12333about (@pxref{update output}). 12334 12335@sc{cvs} has a list of files (or sh(1) file name patterns) 12336that it should ignore while running @code{update}, 12337@code{import} and @code{release}. 12338@c -- Are those the only three commands affected? 12339This list is constructed in the following way. 12340 12341@itemize @bullet 12342@item 12343The list is initialized to include certain file name 12344patterns: names associated with @sc{cvs} 12345administration, or with other common source control 12346systems; common names for patch files, object files, 12347archive files, and editor backup files; and other names 12348that are usually artifacts of assorted utilities. 12349Currently, the default list of ignored file name 12350patterns is: 12351 12352@cindex Ignored files 12353@cindex Automatically ignored files 12354@example 12355 RCS SCCS CVS CVS.adm 12356 RCSLOG cvslog.* .git 12357 tags TAGS 12358 .make.state .nse_depinfo .*.swp 12359 *~ #* .#* ,* _$* *$ 12360 *.old *.bak *.BAK *.orig *.rej .del-* 12361 *.a *.olb *.o *.obj *.so *.exe 12362 *.Z *.elc *.ln *.depend 12363 *.core 12364@end example 12365 12366@item 12367The per-repository list in 12368@file{$CVSROOT/CVSROOT/cvsignore} is appended to 12369the list, if that file exists. 12370 12371@item 12372The per-user list in @file{.cvsignore} in your home 12373directory is appended to the list, if it exists. 12374 12375@item 12376Any entries in the environment variable 12377@code{$CVSIGNORE} is appended to the list. 12378 12379@item 12380Any @samp{-I} options given to @sc{cvs} is appended. 12381 12382@item 12383As @sc{cvs} traverses through your directories, the contents 12384of any @file{.cvsignore} will be appended to the list. 12385The patterns found in @file{.cvsignore} are only valid 12386for the directory that contains them, not for 12387any sub-directories. 12388@end itemize 12389 12390In any of the 5 places listed above, a single 12391exclamation mark (@samp{!}) clears the ignore list. 12392This can be used if you want to store any file which 12393normally is ignored by @sc{cvs}. 12394 12395Specifying @samp{-I !} to @code{cvs import} will import 12396everything, which is generally what you want to do if 12397you are importing files from a pristine distribution or 12398any other source which is known to not contain any 12399extraneous files. However, looking at the rules above 12400you will see there is a fly in the ointment; if the 12401distribution contains any @file{.cvsignore} files, then 12402the patterns from those files will be processed even if 12403@samp{-I !} is specified. The only workaround is to 12404remove the @file{.cvsignore} files in order to do the 12405import. Because this is awkward, in the future 12406@samp{-I !} might be modified to override 12407@file{.cvsignore} files in each directory. 12408 12409Note that the syntax of the ignore files consists of a 12410series of lines, each of which contains a space 12411separated list of filenames. This offers no clean way 12412to specify filenames which contain spaces, but you can 12413use a workaround like @file{foo?bar} to match a file 12414named @file{foo bar} (it also matches @file{fooxbar} 12415and the like). Also note that there is currently no 12416way to specify comments. 12417@c FIXCVS? I don't _like_ this syntax at all, but 12418@c changing it raises all the usual compatibility 12419@c issues and I'm also not sure what to change it to. 12420 12421@node checkoutlist 12422@appendixsec The checkoutlist file 12423@cindex checkoutlist 12424 12425It may be helpful to use @sc{cvs} to maintain your own 12426files in the @file{CVSROOT} directory. For example, 12427suppose that you have a script @file{logcommit.pl} 12428which you run by including the following line in the 12429@file{commitinfo} administrative file: 12430 12431@example 12432ALL $CVSROOT/CVSROOT/logcommit.pl 12433@end example 12434 12435To maintain @file{logcommit.pl} with @sc{cvs} you would 12436add the following line to the @file{checkoutlist} 12437administrative file: 12438 12439@example 12440logcommit.pl 12441@end example 12442 12443The format of @file{checkoutlist} is one line for each 12444file that you want to maintain using @sc{cvs}, giving 12445the name of the file. 12446 12447After setting up @file{checkoutlist} in this fashion, 12448the files listed there will function just like 12449@sc{cvs}'s built-in administrative files. For example, 12450when checking in one of the files you should get a 12451message such as: 12452 12453@example 12454cvs commit: Rebuilding administrative file database 12455@end example 12456 12457and the checked out copy in the @file{CVSROOT} 12458directory should be updated. 12459 12460Note that listing @file{passwd} (@pxref{Password 12461authentication server}) in @file{checkoutlist} is not 12462recommended for security reasons. 12463 12464For information about keeping a checkout out copy in a 12465more general context than the one provided by 12466@file{checkoutlist}, see @ref{Keeping a checked out 12467copy}. 12468 12469@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12470@node history file 12471@appendixsec The history file 12472@cindex History file 12473@cindex Log information, saving 12474 12475The file @file{$CVSROOT/CVSROOT/history} is used 12476to log information for the @code{history} command 12477(@pxref{history}). This file must be created to turn 12478on logging. This is done automatically if the 12479@code{cvs init} command is used to set up the 12480repository (@pxref{Creating a repository}). 12481 12482The file format of the @file{history} file is 12483documented only in comments in the @sc{cvs} source 12484code, but generally programs should use the @code{cvs 12485history} command to access it anyway, in case the 12486format changes with future releases of @sc{cvs}. 12487 12488@node Variables 12489@appendixsec Expansions in administrative files 12490@cindex Internal variables 12491@cindex Variables 12492 12493Sometimes in writing an administrative file, you might 12494want the file to be able to know various things based 12495on environment @sc{cvs} is running in. There are 12496several mechanisms to do that. 12497 12498To find the home directory of the user running @sc{cvs} 12499(from the @code{HOME} environment variable), use 12500@samp{~} followed by @samp{/} or the end of the line. 12501Likewise for the home directory of @var{user}, use 12502@samp{~@var{user}}. These variables are expanded on 12503the server machine, and don't get any reasonable 12504expansion if pserver (@pxref{Password authenticated}) 12505is in use; therefore user variables (see below) may be 12506a better choice to customize behavior based on the user 12507running @sc{cvs}. 12508@c Based on these limitations, should we deprecate ~? 12509@c What is it good for? Are people using it? 12510 12511One may want to know about various pieces of 12512information internal to @sc{cvs}. A @sc{cvs} internal 12513variable has the syntax @code{$@{@var{variable}@}}, 12514where @var{variable} starts with a letter and consists 12515of alphanumeric characters and @samp{_}. If the 12516character following @var{variable} is a 12517non-alphanumeric character other than @samp{_}, the 12518@samp{@{} and @samp{@}} can be omitted. The @sc{cvs} 12519internal variables are: 12520 12521@table @code 12522@item CVSROOT 12523@cindex CVSROOT, internal variable 12524This is the value of the @sc{cvs} root in use. 12525@xref{Repository}, for a description of the various 12526ways to specify this. 12527 12528@item RCSBIN 12529@cindex RCSBIN, internal variable 12530In @sc{cvs} 1.9.18 and older, this specified the 12531directory where @sc{cvs} was looking for @sc{rcs} 12532programs. Because @sc{cvs} no longer runs @sc{rcs} 12533programs, specifying this internal variable is now an 12534error. 12535 12536@item CVSEDITOR 12537@cindex CVSEDITOR, internal variable 12538@itemx VISUAL 12539@cindex VISUAL, internal variable 12540@itemx EDITOR 12541@cindex EDITOR, internal variable 12542These all expand to the same value, which is the editor 12543that @sc{cvs} is using. @xref{Global options}, for how 12544to specify this. 12545 12546@item USER 12547@cindex USER, internal variable 12548Username of the user running @sc{cvs} (on the @sc{cvs} 12549server machine). 12550When using pserver, this is the user specified in the repository 12551specification which need not be the same as the username the 12552server is running as (@pxref{Password authentication server}). 12553@end table 12554 12555If you want to pass a value to the administrative files 12556which the user who is running @sc{cvs} can specify, 12557use a user variable. 12558@cindex User variables 12559To expand a user variable, the 12560administrative file contains 12561@code{$@{=@var{variable}@}}. To set a user variable, 12562specify the global option @samp{-s} to @sc{cvs}, with 12563argument @code{@var{variable}=@var{value}}. It may be 12564particularly useful to specify this option via 12565@file{.cvsrc} (@pxref{~/.cvsrc}). 12566 12567For example, if you want the administrative file to 12568refer to a test directory you might create a user 12569variable @code{TESTDIR}. Then if @sc{cvs} is invoked 12570as 12571 12572@example 12573cvs -s TESTDIR=/work/local/tests 12574@end example 12575 12576@noindent 12577and the 12578administrative file contains @code{sh 12579$@{=TESTDIR@}/runtests}, then that string is expanded 12580to @code{sh /work/local/tests/runtests}. 12581 12582All other strings containing @samp{$} are reserved; 12583there is no way to quote a @samp{$} character so that 12584@samp{$} represents itself. 12585 12586Environment variables passed to administrative files are: 12587 12588@table @code 12589@cindex environment variables, passed to administrative files 12590@c FIXME: should document USER, LOGNAME, and whatever else is 12591@c available both in internal variables and environment variables. 12592 12593@item CVS_USER 12594The @sc{cvs}-specific username provided by the user, if it 12595can be provided (currently just for the pserver access 12596method), and to the empty string otherwise. (CVS_USER 12597and USER may differ when @file{$CVSROOT/CVSROOT/passwd} 12598is used to map cvs usernames to system usernames.) 12599@end table 12600 12601@node config 12602@appendixsec The CVSROOT/config configuration file 12603 12604@cindex config, in CVSROOT 12605@cindex CVSROOT/config 12606 12607The administrative file @file{config} contains various 12608miscellaneous settings which affect the behavior of 12609@sc{cvs}. The syntax is slightly different from the 12610other administrative files. Variables are not 12611expanded. Lines which start with @samp{#} are 12612considered comments. 12613@c FIXME: where do we define comments for the other 12614@c administrative files. 12615Other lines consist of a keyword, @samp{=}, and a 12616value. Note that this syntax is very strict. 12617Extraneous spaces or tabs are not permitted. 12618@c See comments in parseinfo.c:parse_config for more 12619@c discussion of this strictness. 12620 12621Currently defined keywords are: 12622 12623@table @code 12624@cindex RCSBIN, in CVSROOT/config 12625@item RCSBIN=@var{bindir} 12626For @sc{cvs} 1.9.12 through 1.9.18, this setting told 12627@sc{cvs} to look for @sc{rcs} programs in the 12628@var{bindir} directory. Current versions of @sc{cvs} 12629do not run @sc{rcs} programs; for compatibility this 12630setting is accepted, but it does nothing. 12631 12632@cindex SystemAuth, in CVSROOT/config 12633@item SystemAuth=@var{value} 12634If @var{value} is @samp{yes}, then pserver should check 12635for users in the system's user database if not found in 12636@file{CVSROOT/passwd}. If it is @samp{no}, then all 12637pserver users must exist in @file{CVSROOT/passwd}. 12638The default is @samp{yes}. For more on pserver, see 12639@ref{Password authenticated}. 12640 12641@ignore 12642@cindex PreservePermissions, in CVSROOT/config 12643@item PreservePermissions=@var{value} 12644Enable support for saving special device files, 12645symbolic links, file permissions and ownerships in the 12646repository. The default value is @samp{no}. 12647@xref{Special Files}, for the full implications of using 12648this keyword. 12649@end ignore 12650 12651@cindex TopLevelAdmin, in CVSROOT/config 12652@item TopLevelAdmin=@var{value} 12653Modify the @samp{checkout} command to create a 12654@samp{CVS} directory at the top level of the new 12655working directory, in addition to @samp{CVS} 12656directories created within checked-out directories. 12657The default value is @samp{no}. 12658 12659This option is useful if you find yourself performing 12660many commands at the top level of your working 12661directory, rather than in one of the checked out 12662subdirectories. The @file{CVS} directory created there 12663will mean you don't have to specify @code{CVSROOT} for 12664each command. It also provides a place for the 12665@file{CVS/Template} file (@pxref{Working directory 12666storage}). 12667 12668@cindex LockDir, in CVSROOT/config 12669@item LockDir=@var{directory} 12670Put @sc{cvs} lock files in @var{directory} rather than 12671directly in the repository. This is useful if you want 12672to let users read from the repository while giving them 12673write access only to @var{directory}, not to the 12674repository. You need to create @var{directory}, but 12675@sc{cvs} will create subdirectories of @var{directory} as it 12676needs them. For information on @sc{cvs} locks, see 12677@ref{Concurrency}. 12678 12679@c Mention this in Compatibility section? 12680Before enabling the LockDir option, make sure that you 12681have tracked down and removed any copies of @sc{cvs} 1.9 or 12682older. Such versions neither support LockDir, nor will 12683give an error indicating that they don't support it. 12684The result, if this is allowed to happen, is that some 12685@sc{cvs} users will put the locks one place, and others will 12686put them another place, and therefore the repository 12687could become corrupted. @sc{cvs} 1.10 does not support 12688LockDir but it will print a warning if run on a 12689repository with LockDir enabled. 12690 12691@cindex LogHistory, in CVSROOT/config 12692@item LogHistory=@var{value} 12693Control what is logged to the @file{CVSROOT/history} file. 12694Default of @samp{TOFEWGCMAR} (or simply @samp{all}) will log 12695all transactions. Any subset of the default is 12696legal. (For example, to only log transactions that modify the 12697@file{*,v} files, use @samp{LogHistory=TMAR}.) 12698@end table 12699 12700@c --------------------------------------------------------------------- 12701@node Environment variables 12702@appendix All environment variables which affect CVS 12703@cindex Environment variables 12704@cindex Reference manual for variables 12705 12706This is a complete list of all environment variables 12707that affect @sc{cvs}. 12708 12709@table @code 12710@cindex CVSIGNORE, environment variable 12711@item $CVSIGNORE 12712A whitespace-separated list of file name patterns that 12713@sc{cvs} should ignore. @xref{cvsignore}. 12714 12715@cindex CVSWRAPPERS, environment variable 12716@item $CVSWRAPPERS 12717A whitespace-separated list of file name patterns that 12718@sc{cvs} should treat as wrappers. @xref{Wrappers}. 12719 12720@cindex CVSREAD, environment variable 12721@cindex Read-only files, and CVSREAD 12722@item $CVSREAD 12723If this is set, @code{checkout} and @code{update} will 12724try hard to make the files in your working directory 12725read-only. When this is not set, the default behavior 12726is to permit modification of your working files. 12727 12728@item $CVSUMASK 12729Controls permissions of files in the repository. See 12730@ref{File permissions}. 12731 12732@item $CVSROOT 12733Should contain the full pathname to the root of the @sc{cvs} 12734source repository (where the @sc{rcs} files are 12735kept). This information must be available to @sc{cvs} for 12736most commands to execute; if @code{$CVSROOT} is not set, 12737or if you wish to override it for one invocation, you 12738can supply it on the command line: @samp{cvs -d cvsroot 12739cvs_command@dots{}} Once you have checked out a working 12740directory, @sc{cvs} stores the appropriate root (in 12741the file @file{CVS/Root}), so normally you only need to 12742worry about this when initially checking out a working 12743directory. 12744 12745@item $EDITOR 12746@itemx $CVSEDITOR 12747@itemx $VISUAL 12748Specifies the program to use for recording log messages 12749during commit. @code{$CVSEDITOR} overrides 12750@code{$EDITOR}. See @ref{Committing your changes}. 12751 12752@cindex PATH, environment variable 12753@item $PATH 12754If @code{$RCSBIN} is not set, and no path is compiled 12755into @sc{cvs}, it will use @code{$PATH} to try to find all 12756programs it uses. 12757 12758@cindex HOME, environment variable 12759@item $HOME 12760@cindex HOMEPATH, environment variable 12761@item $HOMEPATH 12762@cindex HOMEDRIVE, environment variable 12763@item $HOMEDRIVE 12764Used to locate the directory where the @file{.cvsrc} 12765file, and other such files, are searched. On Unix, @sc{cvs} 12766just checks for @code{HOME}. On Windows NT, the system will 12767set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH}, 12768for example to @file{\joe}. On Windows 95, you'll 12769probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself. 12770@c We are being vague about whether HOME works on 12771@c Windows; see long comment in windows-NT/filesubr.c. 12772 12773@cindex CVS_RSH, environment variable 12774@item $CVS_RSH 12775Specifies the external program which @sc{cvs} connects with, 12776when @code{:ext:} access method is specified. 12777@pxref{Connecting via rsh}. 12778 12779@item $CVS_SERVER 12780Used in client-server mode when accessing a remote 12781repository using @sc{rsh}. It specifies the name of 12782the program to start on the server side when accessing 12783a remote repository using @sc{rsh}. The default value 12784is @code{cvs}. @pxref{Connecting via rsh} 12785 12786@item $CVS_PASSFILE 12787Used in client-server mode when accessing the @code{cvs 12788login server}. Default value is @file{$HOME/.cvspass}. 12789@pxref{Password authentication client} 12790 12791@item $CVS_CLIENT_PORT 12792Used in client-server mode when accessing the server 12793via Kerberos, GSSAPI, or @sc{cvs}'s password authentication if the port is not 12794specified in $CVSROOT. 12795@pxref{Remote repositories} 12796 12797@cindex CVS_RCMD_PORT, environment variable 12798@item $CVS_RCMD_PORT 12799Used in client-server mode. If set, specifies the port 12800number to be used when accessing the @sc{rcmd} demon on 12801the server side. (Currently not used for Unix clients). 12802 12803@cindex CVS_CLIENT_LOG, environment variable 12804@item $CVS_CLIENT_LOG 12805Used for debugging only in client-server 12806mode. If set, everything sent to the server is logged 12807into @file{@code{$CVS_CLIENT_LOG}.in} and everything 12808sent from the server is logged into 12809@file{@code{$CVS_CLIENT_LOG}.out}. 12810 12811@cindex CVS_SERVER_SLEEP, environment variable 12812@item $CVS_SERVER_SLEEP 12813Used only for debugging the server side in 12814client-server mode. If set, delays the start of the 12815server child process the specified amount of 12816seconds so that you can attach to it with a debugger. 12817 12818@cindex CVS_IGNORE_REMOTE_ROOT, environment variable 12819@item $CVS_IGNORE_REMOTE_ROOT 12820For @sc{cvs} 1.10 and older, setting this variable 12821prevents @sc{cvs} from overwriting the @file{CVS/Root} 12822file when the @samp{-d} global option is specified. 12823Later versions of @sc{cvs} do not rewrite 12824@file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no 12825effect. 12826 12827@cindex COMSPEC, environment variable 12828@item $COMSPEC 12829Used under OS/2 only. It specifies the name of the 12830command interpreter and defaults to @sc{cmd.exe}. 12831 12832@cindex TMPDIR, environment variable 12833@item $TMPDIR 12834@cindex TMP, environment variable 12835@itemx $TMP 12836@cindex TEMP, environment variable 12837@itemx $TEMP 12838@cindex Temporary files, location of 12839@c This is quite nuts. We don't talk about tempnam 12840@c or mkstemp which we sometimes use. The discussion 12841@c of "Global options" is semi-incoherent. 12842@c I'm not even sure those are the only inaccuracies. 12843@c Furthermore, the conventions are 12844@c pretty crazy and they should be simplified. 12845Directory in which temporary files are located. 12846The @sc{cvs} server uses 12847@code{TMPDIR}. @xref{Global options}, for a 12848description of how to specify this. 12849Some parts of @sc{cvs} will always use @file{/tmp} (via 12850the @code{tmpnam} function provided by the system). 12851 12852On Windows NT, @code{TMP} is used (via the @code{_tempnam} 12853function provided by the system). 12854 12855The @code{patch} program which is used by the @sc{cvs} 12856client uses @code{TMPDIR}, and if it is not set, uses 12857@file{/tmp} (at least with GNU patch 2.1). Note that 12858if your server and client are both running @sc{cvs} 128591.9.10 or later, @sc{cvs} will not invoke an external 12860@code{patch} program. 12861@end table 12862 12863@node Compatibility 12864@appendix Compatibility between CVS Versions 12865 12866@cindex CVS, versions of 12867@cindex Versions, of CVS 12868@cindex Compatibility, between CVS versions 12869@c We don't mention versions older than CVS 1.3 12870@c on the theory that it would clutter it up for the vast 12871@c majority of people, who don't have anything that old. 12872@c 12873The repository format is compatible going back to 12874@sc{cvs} 1.3. But see @ref{Watches Compatibility}, if 12875you have copies of @sc{cvs} 1.6 or older and you want 12876to use the optional developer communication features. 12877@c If you "cvs rm" and commit using 1.3, then you'll 12878@c want to run "rcs -sdead <file,v>" on each of the 12879@c files in the Attic if you then want 1.5 and 12880@c later to recognize those files as dead (I think the 12881@c symptom if this is not done is that files reappear 12882@c in joins). (Wait: the above will work but really to 12883@c be strictly correct we should suggest checking 12884@c in a new revision rather than just changing the 12885@c state of the head revision, shouldn't we?). 12886@c The old convert.sh script was for this, but it never 12887@c did get updated to reflect use of the RCS "dead" 12888@c state. 12889@c Note: this is tricky to document without confusing 12890@c people--need to carefully say what CVS version we 12891@c are talking about and keep in mind the distinction 12892@c between a 12893@c repository created with 1.3 and on which one now 12894@c uses 1.5+, and a repository on which one wants to 12895@c use both versions side by side (e.g. during a 12896@c transition period). 12897@c Wait, can't CVS just detect the case in which a file 12898@c is in the Attic but the head revision is not dead? 12899@c Not sure whether this should produce a warning or 12900@c something, and probably needs further thought, but 12901@c it would appear that the situation can be detected. 12902@c 12903@c We might want to separate out the 1.3 compatibility 12904@c section (for repository & working directory) from the 12905@c rest--that might help avoid confusing people who 12906@c are upgrading (for example) from 1.6 to 1.8. 12907@c 12908@c A minor incompatibility is if a current version of CVS 12909@c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will 12910@c see this as if there is no tag. Seems to me this is 12911@c too obscure to mention. 12912 12913The working directory format is compatible going back 12914to @sc{cvs} 1.5. It did change between @sc{cvs} 1.3 12915and @sc{cvs} 1.5. If you run @sc{cvs} 1.5 or newer on 12916a working directory checked out with @sc{cvs} 1.3, 12917@sc{cvs} will convert it, but to go back to @sc{cvs} 129181.3 you need to check out a new working directory with 12919@sc{cvs} 1.3. 12920 12921The remote protocol is interoperable going back to @sc{cvs} 1.5, but no 12922further (1.5 was the first official release with the remote protocol, 12923but some older versions might still be floating around). In many 12924cases you need to upgrade both the client and the server to take 12925advantage of new features and bugfixes, however. 12926 12927@c Perhaps should be saying something here about the 12928@c "D" lines in Entries (written by CVS 1.9; 1.8 and 12929@c older don't use them). These are supposed to be 12930@c compatible in both directions, but I'm not sure 12931@c they quite are 100%. One common gripe is if you 12932@c "rm -r" a directory and 1.9 gets confused, as it 12933@c still sees it in Entries. That one is fixed in 12934@c (say) 1.9.6. Someone else reported problems with 12935@c starting with a directory which was checked out with 12936@c an old version, and then using a new version, and 12937@c some "D" lines appeared, but not for every 12938@c directory, causing some directories to be skipped. 12939@c They weren't sure how to reproduce this, though. 12940 12941@c --------------------------------------------------------------------- 12942@node Troubleshooting 12943@appendix Troubleshooting 12944 12945If you are having trouble with @sc{cvs}, this appendix 12946may help. If there is a particular error message which 12947you are seeing, then you can look up the message 12948alphabetically. If not, you can look through the 12949section on other problems to see if your problem is 12950mentioned there. 12951 12952@menu 12953* Error messages:: Partial list of CVS errors 12954* Connection:: Trouble making a connection to a CVS server 12955* Other problems:: Problems not readily listed by error message 12956@end menu 12957 12958@ignore 12959@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12960@c @node Bad administrative files 12961@appendixsec Bad administrative files 12962 12963@c -- Give hints on how to fix them 12964@end ignore 12965 12966@node Error messages 12967@appendixsec Partial list of error messages 12968 12969Here is a partial list of error messages that you may 12970see from @sc{cvs}. It is not a complete list---@sc{cvs} 12971is capable of printing many, many error messages, often 12972with parts of them supplied by the operating system, 12973but the intention is to list the common and/or 12974potentially confusing error messages. 12975 12976The messages are alphabetical, but introductory text 12977such as @samp{cvs update: } is not considered in 12978ordering them. 12979 12980In some cases the list includes messages printed by old 12981versions of @sc{cvs} (partly because users may not be 12982sure which version of @sc{cvs} they are using at any 12983particular moment). 12984@c If we want to start retiring messages, perhaps we 12985@c should pick a cutoff version (for example, no more 12986@c messages which are specific to versions before 1.9) 12987@c and then move the old messages to an "old messages" 12988@c node rather than deleting them completely. 12989 12990@table @code 12991@c FIXME: What is the correct way to format a multiline 12992@c error message here? Maybe @table is the wrong 12993@c choice? Texinfo gurus? 12994@item cvs @var{command}: authorization failed: server @var{host} rejected access 12995This is a generic response when trying to connect to a 12996pserver server which chooses not to provide a 12997specific reason for denying authorization. Check that 12998the username and password specified are correct and 12999that the @code{CVSROOT} specified is allowed by @samp{--allow-root} 13000in @file{inetd.conf}. See @ref{Password authenticated}. 13001 13002@item @var{file}:@var{line}: Assertion '@var{text}' failed 13003The exact format of this message may vary depending on 13004your system. It indicates a bug in @sc{cvs}, which can 13005be handled as described in @ref{BUGS}. 13006 13007@item cvs @var{command}: conflict: removed @var{file} was modified by second party 13008This message indicates that you removed a file, and 13009someone else modified it. To resolve the conflict, 13010first run @samp{cvs add @var{file}}. If desired, look 13011at the other party's modification to decide whether you 13012still want to remove it. If you don't want to remove 13013it, stop here. If you do want to remove it, proceed 13014with @samp{cvs remove @var{file}} and commit your 13015removal. 13016@c Tests conflicts2-142b* in sanity.sh test for this. 13017 13018@item cannot change permissions on temporary directory 13019@example 13020Operation not permitted 13021@end example 13022This message has been happening in a non-reproducible, 13023occasional way when we run the client/server testsuite, 13024both on Red Hat Linux 3.0.3 and 4.1. We haven't been 13025able to figure out what causes it, nor is it known 13026whether it is specific to linux (or even to this 13027particular machine!). If the problem does occur on 13028other unices, @samp{Operation not permitted} would be 13029likely to read @samp{Not owner} or whatever the system 13030in question uses for the unix @code{EPERM} error. If 13031you have any information to add, please let us know as 13032described in @ref{BUGS}. If you experience this error 13033while using @sc{cvs}, retrying the operation which 13034produced it should work fine. 13035@c This has been seen in a variety of tests, including 13036@c multibranch-2, multibranch-5, and basic1-24-rm-rm, 13037@c so it doesn't seem particularly specific to any one 13038@c test. 13039 13040@item cvs [server aborted]: Cannot check out files into the repository itself 13041The obvious cause for this message (especially for 13042non-client/server @sc{cvs}) is that the @sc{cvs} root 13043is, for example, @file{/usr/local/cvsroot} and you try 13044to check out files when you are in a subdirectory, such 13045as @file{/usr/local/cvsroot/test}. However, there is a 13046more subtle cause, which is that the temporary 13047directory on the server is set to a subdirectory of the 13048root (which is also not allowed). If this is the 13049problem, set the temporary directory to somewhere else, 13050for example @file{/var/tmp}; see @code{TMPDIR} in 13051@ref{Environment variables}, for how to set the 13052temporary directory. 13053 13054@c For one example see basica-1a10 in the testsuite 13055@c For another example, "cvs co ." on NT; see comment 13056@c at windows-NT/filesubr.c (expand_wild). 13057@c For another example, "cvs co foo/bar" where foo exists. 13058@item cannot open CVS/Entries for reading: No such file or directory 13059This generally indicates a @sc{cvs} internal error, and 13060can be handled as with other @sc{cvs} bugs 13061(@pxref{BUGS}). Usually there is a workaround---the 13062exact nature of which would depend on the situation but 13063which hopefully could be figured out. 13064 13065@c This is more obscure than it might sound; it only 13066@c happens if you run "cvs init" from a directory which 13067@c contains a CVS/Root file at the start. 13068@item cvs [init aborted]: cannot open CVS/Root: No such file or directory 13069This message is harmless. Provided it is not 13070accompanied by other errors, the operation has 13071completed successfully. This message should not occur 13072with current versions of @sc{cvs}, but it is documented 13073here for the benefit of @sc{cvs} 1.9 and older. 13074 13075@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument 13076This message has been reported as intermittently 13077happening with @sc{cvs} 1.9 on Solaris 2.5. The cause is 13078unknown; if you know more about what causes it, let us 13079know as described in @ref{BUGS}. 13080 13081@item cvs [@var{command} aborted]: cannot start server via rcmd 13082This, unfortunately, is a rather nonspecific error 13083message which @sc{cvs} 1.9 will print if you are 13084running the @sc{cvs} client and it is having trouble 13085connecting to the server. Current versions of @sc{cvs} 13086should print a much more specific error message. If 13087you get this message when you didn't mean to run the 13088client at all, you probably forgot to specify 13089@code{:local:}, as described in @ref{Repository}. 13090 13091@item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ 13092@sc{cvs} 1.9 and older will print this message 13093when trying to check in a binary file if 13094@sc{rcs} is not correctly installed. Re-read the 13095instructions that came with your @sc{rcs} distribution 13096and the @sc{install} file in the @sc{cvs} 13097distribution. Alternately, upgrade to a current 13098version of @sc{cvs}, which checks in files itself 13099rather than via @sc{rcs}. 13100 13101@item cvs checkout: could not check out @var{file} 13102With @sc{cvs} 1.9, this can mean that the @code{co} program 13103(part of @sc{rcs}) returned a failure. It should be 13104preceded by another error message, however it has been 13105observed without another error message and the cause is 13106not well-understood. With the current version of @sc{cvs}, 13107which does not run @code{co}, if this message occurs 13108without another error message, it is definitely a @sc{cvs} 13109bug (@pxref{BUGS}). 13110@c My current suspicion is that the RCS in the rcs (not 13111@c cvs/winnt/rcs57nt.zip) directory on the _Practical_ 13112@c CD is bad (remains to be confirmed). 13113@c There is also a report of something which looks 13114@c very similar on SGI, Irix 5.2, so I dunno. 13115 13116@item cvs [login aborted]: could not find out home directory 13117This means that you need to set the environment 13118variables that @sc{cvs} uses to locate your home directory. 13119See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in 13120@ref{Environment variables}. 13121 13122@item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory 13123@sc{cvs} 1.9 and older will print this message if there was 13124a problem finding the @code{rcsmerge} program. Make 13125sure that it is in your @code{PATH}, or upgrade to a 13126current version of @sc{cvs}, which does not require 13127an external @code{rcsmerge} program. 13128 13129@item cvs [update aborted]: could not patch @var{file}: No such file or directory 13130This means that there was a problem finding the 13131@code{patch} program. Make sure that it is in your 13132@code{PATH}. Note that despite appearances the message 13133is @emph{not} referring to whether it can find @var{file}. 13134If both the client and the server are running a current 13135version of @sc{cvs}, then there is no need for an 13136external patch program and you should not see this 13137message. But if either client or server is running 13138@sc{cvs} 1.9, then you need @code{patch}. 13139 13140@item cvs update: could not patch @var{file}; will refetch 13141This means that for whatever reason the client was 13142unable to apply a patch that the server sent. The 13143message is nothing to be concerned about, because 13144inability to apply the patch only slows things down and 13145has no effect on what @sc{cvs} does. 13146@c xref to update output. Or File status? 13147@c Or some place else that 13148@c explains this whole "patch"/P/Needs Patch thing? 13149 13150@item dying gasps from @var{server} unexpected 13151There is a known bug in the server for @sc{cvs} 1.9.18 13152and older which can cause this. For me, this was 13153reproducible if I used the @samp{-t} global option. It 13154was fixed by Andy Piper's 14 Nov 1997 change to 13155src/filesubr.c, if anyone is curious. 13156If you see the message, 13157you probably can just retry the operation which failed, 13158or if you have discovered information concerning its 13159cause, please let us know as described in @ref{BUGS}. 13160 13161@item end of file from server (consult above messages if any) 13162The most common cause for this message is if you are 13163using an external @code{rsh} program and it exited with 13164an error. In this case the @code{rsh} program should 13165have printed a message, which will appear before the 13166above message. For more information on setting up a 13167@sc{cvs} client and server, see @ref{Remote repositories}. 13168 13169@item cvs [update aborted]: EOF in key in RCS file @var{file},v 13170@itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v 13171This means that there is a syntax error in the given 13172@sc{rcs} file. Note that this might be true even if @sc{rcs} can 13173read the file OK; @sc{cvs} does more error checking of 13174errors in the RCS file. That is why you may see this 13175message when upgrading from @sc{cvs} 1.9 to @sc{cvs} 131761.10. The likely cause for the original corruption is 13177hardware, the operating system, or the like. Of 13178course, if you find a case in which @sc{cvs} seems to 13179corrupting the file, by all means report it, 13180(@pxref{BUGS}). 13181There are quite a few variations of this error message, 13182depending on exactly where in the @sc{rcs} file @sc{cvs} 13183finds the syntax error. 13184 13185@cindex mkmodules 13186@item cvs commit: Executing 'mkmodules' 13187This means that your repository is set up for a version 13188of @sc{cvs} prior to @sc{cvs} 1.8. When using @sc{cvs} 131891.8 or later, the above message will be preceded by 13190 13191@example 13192cvs commit: Rebuilding administrative file database 13193@end example 13194 13195If you see both messages, the database is being rebuilt 13196twice, which is unnecessary but harmless. If you wish 13197to avoid the duplication, and you have no versions of 13198@sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules} 13199every place it appears in your @code{modules} 13200file. For more information on the @code{modules} file, 13201see @ref{modules}. 13202 13203@c This message comes from "co", and I believe is 13204@c possible only with older versions of CVS which call 13205@c co. The problem with being able to create the bogus 13206@c RCS file still exists, though (and I think maybe 13207@c there is a different symptom(s) now). 13208@c FIXME: Would be nice to have a more exact wording 13209@c for this message. 13210@item missing author 13211Typically this can happen if you created an RCS file 13212with your username set to empty. @sc{cvs} will, bogusly, 13213create an illegal RCS file with no value for the author 13214field. The solution is to make sure your username is 13215set to a non-empty value and re-create the RCS file. 13216@c "make sure your username is set" is complicated in 13217@c and of itself, as there are the environment 13218@c variables the system login name, &c, and it depends 13219@c on the version of CVS. 13220 13221@item cvs [checkout aborted]: no such tag @var{tag} 13222This message means that @sc{cvs} isn't familiar with 13223the tag @var{tag}. Usually this means that you have 13224mistyped a tag name; however there are (relatively 13225obscure) cases in which @sc{cvs} will require you to 13226@c Search sanity.sh for "no such tag" to see some of 13227@c the relatively obscure cases. 13228try a few other @sc{cvs} commands involving that tag, 13229before you find one which will cause @sc{cvs} to update 13230the @file{val-tags} file; see discussion of val-tags in 13231@ref{File permissions}. You only need to worry about 13232this once for a given tag; when a tag is listed in 13233@file{val-tags}, it stays there. Note that using 13234@samp{-f} to not require tag matches does not override 13235this check; see @ref{Common options}. 13236 13237@item *PANIC* administration files missing 13238This typically means that there is a directory named 13239@sc{cvs} but it does not contain the administrative files 13240which @sc{cvs} puts in a CVS directory. If the problem is 13241that you created a CVS directory via some mechanism 13242other than @sc{cvs}, then the answer is simple, use a name 13243other than @sc{cvs}. If not, it indicates a @sc{cvs} bug 13244(@pxref{BUGS}). 13245 13246@item rcs error: Unknown option: -x,v/ 13247This message will be followed by a usage message for 13248@sc{rcs}. It means that you have an old version of 13249@sc{rcs} (probably supplied with your operating 13250system), as well as an old version of @sc{cvs}. 13251@sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and 13252later; current versions of @sc{cvs} do not run @sc{rcs} programs. 13253@c For more information on installing @sc{cvs}, see 13254@c (FIXME: where? it depends on whether you are 13255@c getting binaries or sources or what). 13256@c The message can also say "ci error" or something 13257@c instead of "rcs error", I suspect. 13258 13259@item cvs [server aborted]: received broken pipe signal 13260This message seems to be caused by a hard-to-track-down 13261bug in @sc{cvs} or the systems it runs on (we don't 13262know---we haven't tracked it down yet!). It seems to 13263happen only after a @sc{cvs} command has completed, and 13264you should be able to just ignore the message. 13265However, if you have discovered information concerning its 13266cause, please let us know as described in @ref{BUGS}. 13267 13268@item Too many arguments! 13269This message is typically printed by the @file{log.pl} 13270script which is in the @file{contrib} directory in the 13271@sc{cvs} source distribution. In some versions of 13272@sc{cvs}, @file{log.pl} has been part of the default 13273@sc{cvs} installation. The @file{log.pl} script gets 13274called from the @file{loginfo} administrative file. 13275Check that the arguments passed in @file{loginfo} match 13276what your version of @file{log.pl} expects. In 13277particular, the @file{log.pl} from @sc{cvs} 1.3 and 13278older expects the logfile as an argument whereas the 13279@file{log.pl} from @sc{cvs} 1.5 and newer expects the 13280logfile to be specified with a @samp{-f} option. Of 13281course, if you don't need @file{log.pl} you can just 13282comment it out of @file{loginfo}. 13283 13284@item cvs [update aborted]: unexpected EOF reading @var{file},v 13285See @samp{EOF in key in RCS file}. 13286 13287@item cvs [login aborted]: unrecognized auth response from @var{server} 13288This message typically means that the server is not set 13289up properly. For example, if @file{inetd.conf} points 13290to a nonexistent cvs executable. To debug it further, 13291find the log file which inetd writes 13292(@file{/var/log/messages} or whatever inetd uses on 13293your system). For details, see @ref{Connection}, and 13294@ref{Password authentication server}. 13295 13296@item cvs server: cannot open /root/.cvsignore: Permission denied 13297@itemx cvs [server aborted]: can't chdir(/root): Permission denied 13298See @ref{Connection}. 13299 13300@item cvs commit: Up-to-date check failed for `@var{file}' 13301This means that someone else has committed a change to 13302that file since the last time that you did a @code{cvs 13303update}. So before proceeding with your @code{cvs 13304commit} you need to @code{cvs update}. @sc{cvs} will merge 13305the changes that you made and the changes that the 13306other person made. If it does not detect any conflicts 13307it will report @samp{M @var{file}} and you are ready 13308to @code{cvs commit}. If it detects conflicts it will 13309print a message saying so, will report @samp{C @var{file}}, 13310and you need to manually resolve the 13311conflict. For more details on this process see 13312@ref{Conflicts example}. 13313 13314@item Usage: diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3 13315@example 13316Only one of [exEX3] allowed 13317@end example 13318This indicates a problem with the installation of 13319@code{diff3} and @code{rcsmerge}. Specifically 13320@code{rcsmerge} was compiled to look for GNU diff3, but 13321it is finding unix diff3 instead. The exact text of 13322the message will vary depending on the system. The 13323simplest solution is to upgrade to a current version of 13324@sc{cvs}, which does not rely on external 13325@code{rcsmerge} or @code{diff3} programs. 13326 13327@item warning: unrecognized response `@var{text}' from cvs server 13328If @var{text} contains a valid response (such as 13329@samp{ok}) followed by an extra carriage return 13330character (on many systems this will cause the second 13331part of the message to overwrite the first part), then 13332it probably means that you are using the @samp{:ext:} 13333access method with a version of rsh, such as most 13334non-unix rsh versions, which does not by default 13335provide a transparent data stream. In such cases you 13336probably want to try @samp{:server:} instead of 13337@samp{:ext:}. If @var{text} is something else, this 13338may signify a problem with your @sc{cvs} server. 13339Double-check your installation against the instructions 13340for setting up the @sc{cvs} server. 13341@c FIXCVS: should be printing CR as \r or \015 or some 13342@c such, probably. 13343 13344@item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory} 13345This is a normal message, not an error. See 13346@ref{Concurrency}, for more details. 13347 13348@item cvs commit: warning: editor session failed 13349@cindex Exit status, of editor 13350This means that the editor which @sc{cvs} is using exits with a nonzero 13351exit status. Some versions of vi will do this even when there was not 13352a problem editing the file. If so, point the 13353@code{CVSEDITOR} environment variable to a small script 13354such as: 13355 13356@example 13357#!/bin/sh 13358vi $* 13359exit 0 13360@end example 13361 13362@c "warning: foo was lost" and "no longer pertinent" (both normal). 13363@c Would be nice to write these up--they are 13364@c potentially confusing for the new user. 13365@end table 13366 13367@node Connection 13368@appendixsec Trouble making a connection to a CVS server 13369 13370This section concerns what to do if you are having 13371trouble making a connection to a @sc{cvs} server. If 13372you are running the @sc{cvs} command line client 13373running on Windows, first upgrade the client to 13374@sc{cvs} 1.9.12 or later. The error reporting in 13375earlier versions provided much less information about 13376what the problem was. If the client is non-Windows, 13377@sc{cvs} 1.9 should be fine. 13378 13379If the error messages are not sufficient to track down 13380the problem, the next steps depend largely on which 13381access method you are using. 13382 13383@table @code 13384@cindex :ext:, troubleshooting 13385@item :ext: 13386Try running the rsh program from the command line. For 13387example: "rsh servername cvs -v" should print @sc{cvs} 13388version information. If this doesn't work, you need to 13389fix it before you can worry about @sc{cvs} problems. 13390 13391@cindex :server:, troubleshooting 13392@item :server: 13393You don't need a command line rsh program to use this 13394access method, but if you have an rsh program around, 13395it may be useful as a debugging tool. Follow the 13396directions given for :ext:. 13397 13398@cindex :pserver:, troubleshooting 13399@item :pserver: 13400Errors along the lines of "connection refused" typically indicate 13401that inetd isn't even listening for connections on port 2401 13402whereas errors like "connection reset by peer" or "recv() from 13403server: EOF" typically indicate that inetd is listening for 13404connections but is unable to start @sc{cvs} (this is frequently 13405caused by having an incorrect path in @file{inetd.conf}). 13406"unrecognized auth response" errors are caused by a bad command 13407line in @file{inetd.conf}, typically an invalid option or forgetting 13408to put the @samp{pserver} command at the end of the line. 13409Another less common problem is invisible control characters that 13410your editor "helpfully" added without you noticing. 13411 13412One good debugging tool is to "telnet servername 134132401". After connecting, send any text (for example 13414"foo" followed by return). If @sc{cvs} is working 13415correctly, it will respond with 13416 13417@example 13418cvs [pserver aborted]: bad auth protocol start: foo 13419@end example 13420 13421If instead you get: 13422 13423@example 13424Usage: cvs [cvs-options] command [command-options-and-arguments] 13425... 13426@end example 13427 13428then you're missing the @samp{pserver} command at the end of the 13429line in @file{inetd.conf}; check to make sure that the entire command 13430is on one line and that it's complete. 13431 13432Likewise, if you get something like: 13433 13434@example 13435Unknown command: `pserved' 13436 13437CVS commands are: 13438 add Add a new file/directory to the repository 13439... 13440@end example 13441 13442then you've misspelled @samp{pserver} in some way. If it isn't 13443obvious, check for invisible control characters (particularly 13444carriage returns) in @file{inetd.conf}. 13445 13446If it fails to work at all, then make sure inetd is working 13447right. Change the invocation in @file{inetd.conf} to run the 13448echo program instead of cvs. For example: 13449 13450@example 134512401 stream tcp nowait root /bin/echo echo hello 13452@end example 13453 13454After making that change and instructing inetd to 13455re-read its configuration file, "telnet servername 134562401" should show you the text hello and then the 13457server should close the connection. If this doesn't 13458work, you need to fix it before you can worry about 13459@sc{cvs} problems. 13460 13461On AIX systems, the system will often have its own 13462program trying to use port 2401. This is AIX's problem 13463in the sense that port 2401 is registered for use with 13464@sc{cvs}. I hear that there is an AIX patch available 13465to address this problem. 13466 13467Another good debugging tool is the @samp{-d} 13468(debugging) option to inetd. Consult your system 13469documentation for more information. 13470 13471If you seem to be connecting but get errors like: 13472 13473@example 13474cvs server: cannot open /root/.cvsignore: Permission denied 13475cvs [server aborted]: can't chdir(/root): Permission denied 13476@end example 13477 13478then you probably haven't specified @samp{-f} in @file{inetd.conf}. 13479 13480If you can connect successfully for a while but then can't, 13481you've probably hit inetd's rate limit. 13482(If inetd receives too many requests for the same service 13483in a short period of time, it assumes that something is wrong 13484and temporarily disables the service.) 13485Check your inetd documentation to find out how to adjust the 13486rate limit (some versions of inetd have a single rate limit, 13487others allow you to set the limit for each service separately.) 13488@end table 13489 13490@node Other problems 13491@appendixsec Other common problems 13492 13493Here is a list of problems which do not fit into the 13494above categories. They are in no particular order. 13495 13496@itemize @bullet 13497@item 13498On Windows, if there is a 30 second or so delay when 13499you run a @sc{cvs} command, it may mean that you have 13500your home directory set to @file{C:/}, for example (see 13501@code{HOMEDRIVE} and @code{HOMEPATH} in 13502@ref{Environment variables}). @sc{cvs} expects the home 13503directory to not end in a slash, for example @file{C:} 13504or @file{C:\cvs}. 13505@c FIXCVS: CVS should at least detect this and print an 13506@c error, presumably. 13507 13508@item 13509If you are running @sc{cvs} 1.9.18 or older, and 13510@code{cvs update} finds a conflict and tries to 13511merge, as described in @ref{Conflicts example}, but 13512doesn't tell you there were conflicts, then you may 13513have an old version of @sc{rcs}. The easiest solution 13514probably is to upgrade to a current version of 13515@sc{cvs}, which does not rely on external @sc{rcs} 13516programs. 13517@end itemize 13518 13519@c --------------------------------------------------------------------- 13520@node Credits 13521@appendix Credits 13522 13523@cindex Contributors (manual) 13524@cindex Credits (manual) 13525Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}> 13526wrote the manual pages which were distributed with 13527@sc{cvs} 1.3. Much of their text was copied into this 13528manual. He also read an early draft 13529of this manual and contributed many ideas and 13530corrections. 13531 13532The mailing-list @code{info-cvs} is sometimes 13533informative. I have included information from postings 13534made by the following persons: 13535David G. Grubbs <@t{dgg@@think.com}>. 13536 13537Some text has been extracted from the man pages for 13538@sc{rcs}. 13539 13540The @sc{cvs} @sc{faq} by David G. Grubbs has provided 13541useful material. The @sc{faq} is no longer maintained, 13542however, and this manual is about the closest thing there 13543is to a successor (with respect to documenting how to 13544use @sc{cvs}, at least). 13545 13546In addition, the following persons have helped by 13547telling me about mistakes I've made: 13548 13549@display 13550Roxanne Brunskill <@t{rbrunski@@datap.ca}>, 13551Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>, 13552Karl Pingle <@t{pingle@@acuson.com}>, 13553Thomas A Peterson <@t{tap@@src.honeywell.com}>, 13554Inge Wallin <@t{ingwa@@signum.se}>, 13555Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}> 13556and Michael Brown <@t{brown@@wi.extrel.com}>. 13557@end display 13558 13559The list of contributors here is not comprehensive; for a more 13560complete list of who has contributed to this manual see 13561the file @file{doc/ChangeLog} in the @sc{cvs} source 13562distribution. 13563 13564@c --------------------------------------------------------------------- 13565@node BUGS 13566@appendix Dealing with bugs in CVS or this manual 13567 13568@cindex Bugs in this manual or CVS 13569Neither @sc{cvs} nor this manual is perfect, and they 13570probably never will be. If you are having trouble 13571using @sc{cvs}, or think you have found a bug, there 13572are a number of things you can do about it. Note that 13573if the manual is unclear, that can be considered a bug 13574in the manual, so these problems are often worth doing 13575something about as well as problems with @sc{cvs} itself. 13576 13577@cindex Reporting bugs 13578@cindex Bugs, reporting 13579@cindex Errors, reporting 13580@itemize @bullet 13581@item 13582If you want someone to help you and fix bugs that you 13583report, there are companies which will do that for a 13584fee. One such company is: 13585 13586@cindex Signum Support 13587@cindex Support, getting CVS support 13588@example 13589Signum Support AB 13590Box 2044 13591S-580 02 Linkoping 13592Sweden 13593Email: info@@signum.se 13594Phone: +46 (0)13 - 21 46 00 13595Fax: +46 (0)13 - 21 47 00 13596http://www.signum.se/ 13597 13598@end example 13599 13600@item 13601If you got @sc{cvs} through a distributor, such as an 13602operating system vendor or a vendor of freeware 13603@sc{cd-rom}s, you may wish to see whether the 13604distributor provides support. Often, they will provide 13605no support or minimal support, but this may vary from 13606distributor to distributor. 13607 13608@item 13609If you have the skills and time to do so, you may wish 13610to fix the bug yourself. If you wish to submit your 13611fix for inclusion in future releases of @sc{cvs}, see 13612the file @sc{hacking} in the @sc{cvs} source 13613distribution. It contains much more information on the 13614process of submitting fixes. 13615 13616@item 13617It is also possible to report bugs to @code{bug-cvs}. 13618Note that someone may or may not want to do anything 13619with your bug report---if you need a solution consider 13620one of the options mentioned above. People probably do 13621want to hear about bugs which are particularly severe 13622in consequences and/or easy to fix, however. You can 13623also increase your odds by being as clear as possible 13624about the exact nature of the bug and any other 13625relevant information. The way to report bugs is to 13626send email to @code{bug-cvs@@gnu.org}. Note 13627that submissions to @code{bug-cvs} may be distributed 13628under the terms of the @sc{gnu} Public License, so if 13629you don't like this, don't submit them. There is 13630usually no justification for sending mail directly to 13631one of the @sc{cvs} maintainers rather than to 13632@code{bug-cvs}; those maintainers who want to hear 13633about such bug reports read @code{bug-cvs}. Also note 13634that sending a bug report to other mailing lists or 13635newsgroups is @emph{not} a substitute for sending it to 13636@code{bug-cvs}. It is fine to discuss @sc{cvs} bugs on 13637whatever forum you prefer, but there are not 13638necessarily any maintainers reading bug reports sent 13639anywhere except @code{bug-cvs}. 13640@end itemize 13641 13642@cindex Known bugs in this manual or CVS 13643People often ask if there is a list of known bugs or 13644whether a particular bug is a known one. The file 13645@sc{bugs} in the @sc{cvs} source distribution is one 13646list of known bugs, but it doesn't necessarily try to 13647be comprehensive. Perhaps there will never be a 13648comprehensive, detailed list of known bugs. 13649 13650@c --------------------------------------------------------------------- 13651@node Index 13652@unnumbered Index 13653@cindex Index 13654 13655@printindex cp 13656 13657@summarycontents 13658 13659@contents 13660 13661@bye 13662 13663Local Variables: 13664fill-column: 55 13665End: 13666