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 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 Source, getting CVS source 250You can get @sc{cvs} in a variety of ways, including 251free download from the internet. For more information 252on downloading @sc{cvs} and other @sc{cvs} topics, see: 253 254@example 255http://www.cvshome.org/ 256http://www.loria.fr/~molli/cvs-index.html 257@end example 258 259@cindex Mailing list 260@cindex List, mailing list 261@cindex Newsgroups 262There is a mailing list, known as @w{@code{info-cvs}}, 263devoted to @sc{cvs}. To subscribe or 264unsubscribe 265write to 266@w{@code{info-cvs-request@@gnu.org}}. 267If you prefer a usenet group, the right 268group is @code{comp.software.config-mgmt} which is for 269@sc{cvs} discussions (along with other configuration 270management systems). In the future, it might be 271possible to create a 272@code{comp.software.config-mgmt.cvs}, but probably only 273if there is sufficient @sc{cvs} traffic on 274@code{comp.software.config-mgmt}. 275@c Other random data is that past attempts to create a 276@c gnu.* group have failed (the relevant authorities 277@c say they'll do it, but don't), and that tale was very 278@c skeptical of comp.software.config-mgmt.cvs when the 279@c subject came up around 1995 or so (for one 280@c thing, because creating it would be a "reorg" which 281@c would need to take a more comprehensive look at the 282@c whole comp.software.config-mgmt.* hierarchy). 283 284You can also subscribe to the bug-cvs mailing list, 285described in more detail in @ref{BUGS}. To subscribe 286send mail to bug-cvs-request@@gnu.org. 287 288@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 289@node What is CVS not? 290@section What is CVS not? 291@cindex What is CVS not? 292 293@sc{cvs} can do a lot of things for you, but it does 294not try to be everything for everyone. 295 296@table @asis 297@item @sc{cvs} is not a build system. 298 299Though the structure of your repository and modules 300file interact with your build system 301(e.g. @file{Makefile}s), they are essentially 302independent. 303 304@sc{cvs} does not dictate how you build anything. It 305merely stores files for retrieval in a tree structure 306you devise. 307 308@sc{cvs} does not dictate how to use disk space in the 309checked out working directories. If you write your 310@file{Makefile}s or scripts in every directory so they 311have to know the relative positions of everything else, 312you wind up requiring the entire repository to be 313checked out. 314 315If you modularize your work, and construct a build 316system that will share files (via links, mounts, 317@code{VPATH} in @file{Makefile}s, etc.), you can 318arrange your disk usage however you like. 319 320But you have to remember that @emph{any} such system is 321a lot of work to construct and maintain. @sc{cvs} does 322not address the issues involved. 323 324Of course, you should place the tools created to 325support such a build system (scripts, @file{Makefile}s, 326etc) under @sc{cvs}. 327 328Figuring out what files need to be rebuilt when 329something changes is, again, something to be handled 330outside the scope of @sc{cvs}. One traditional 331approach is to use @code{make} for building, and use 332some automated tool for generating the dependencies which 333@code{make} uses. 334 335See @ref{Builds}, for more information on doing builds 336in conjunction with @sc{cvs}. 337 338@item @sc{cvs} is not a substitute for management. 339 340Your managers and project leaders are expected to talk 341to you frequently enough to make certain you are aware 342of schedules, merge points, branch names and release 343dates. If they don't, @sc{cvs} can't help. 344 345@sc{cvs} is an instrument for making sources dance to 346your tune. But you are the piper and the composer. No 347instrument plays itself or writes its own music. 348 349@item @sc{cvs} is not a substitute for developer communication. 350 351When faced with conflicts within a single file, most 352developers manage to resolve them without too much 353effort. But a more general definition of ``conflict'' 354includes problems too difficult to solve without 355communication between developers. 356 357@sc{cvs} cannot determine when simultaneous changes 358within a single file, or across a whole collection of 359files, will logically conflict with one another. Its 360concept of a @dfn{conflict} is purely textual, arising 361when two changes to the same base file are near enough 362to spook the merge (i.e. @code{diff3}) command. 363 364@sc{cvs} does not claim to help at all in figuring out 365non-textual or distributed conflicts in program logic. 366 367For example: Say you change the arguments to function 368@code{X} defined in file @file{A}. At the same time, 369someone edits file @file{B}, adding new calls to 370function @code{X} using the old arguments. You are 371outside the realm of @sc{cvs}'s competence. 372 373Acquire the habit of reading specs and talking to your 374peers. 375 376 377@item @sc{cvs} does not have change control 378 379Change control refers to a number of things. First of 380all it can mean @dfn{bug-tracking}, that is being able 381to keep a database of reported bugs and the status of 382each one (is it fixed? in what release? has the bug 383submitter agreed that it is fixed?). For interfacing 384@sc{cvs} to an external bug-tracking system, see the 385@file{rcsinfo} and @file{verifymsg} files 386(@pxref{Administrative files}). 387 388Another aspect of change control is keeping track of 389the fact that changes to several files were in fact 390changed together as one logical change. If you check 391in several files in a single @code{cvs commit} 392operation, @sc{cvs} then forgets that those files were 393checked in together, and the fact that they have the 394same log message is the only thing tying them 395together. Keeping a @sc{gnu} style @file{ChangeLog} 396can help somewhat. 397@c FIXME: should have an xref to a section which talks 398@c more about keeping ChangeLog's with CVS, but that 399@c section hasn't been written yet. 400 401Another aspect of change control, in some systems, is 402the ability to keep track of the status of each 403change. Some changes have been written by a developer, 404others have been reviewed by a second developer, and so 405on. Generally, the way to do this with @sc{cvs} is to 406generate a diff (using @code{cvs diff} or @code{diff}) 407and email it to someone who can then apply it using the 408@code{patch} utility. This is very flexible, but 409depends on mechanisms outside @sc{cvs} to make sure 410nothing falls through the cracks. 411 412@item @sc{cvs} is not an automated testing program 413 414It should be possible to enforce mandatory use of a 415testsuite using the @code{commitinfo} file. I haven't 416heard a lot about projects trying to do that or whether 417there are subtle gotchas, however. 418 419@item @sc{cvs} does not have a builtin process model 420 421Some systems provide ways to ensure that changes or 422releases go through various steps, with various 423approvals as needed. Generally, one can accomplish 424this with @sc{cvs} but it might be a little more work. 425In some cases you'll want to use the @file{commitinfo}, 426@file{loginfo}, @file{rcsinfo}, or @file{verifymsg} 427files, to require that certain steps be performed 428before cvs will allow a checkin. Also consider whether 429features such as branches and tags can be used to 430perform tasks such as doing work in a development tree 431and then merging certain changes over to a stable tree 432only once they have been proven. 433@end table 434 435@c --------------------------------------------------------------------- 436@node A sample session 437@section A sample session 438@cindex Example of a work-session 439@cindex Getting started 440@cindex Work-session, example of 441@cindex tc, Trivial Compiler (example) 442@cindex Trivial Compiler (example) 443 444@c I think an example is a pretty good way to start. But 445@c somewhere in here, maybe after the sample session, 446@c we need something which is kind of 447@c a "roadmap" which is more directed at sketching out 448@c the functionality of CVS and pointing people to 449@c various other parts of the manual. As it stands now 450@c people who read in order get dumped right into all 451@c manner of hair regarding remote repositories, 452@c creating a repository, etc. 453@c 454@c The following was in the old Basic concepts node. I don't 455@c know how good a job it does at introducing modules, 456@c or whether they need to be introduced so soon, but 457@c something of this sort might go into some 458@c introductory material somewhere. 459@ignore 460@cindex Modules (intro) 461The repository contains directories and files, in an 462arbitrary tree. The @dfn{modules} feature can be used 463to group together a set of directories or files into a 464single entity (@pxref{modules}). A typical usage is to 465define one module per project. 466@end ignore 467 468As a way of introducing @sc{cvs}, we'll go through a 469typical work-session using @sc{cvs}. The first thing 470to understand is that @sc{cvs} stores all files in a 471centralized @dfn{repository} (@pxref{Repository}); this 472section assumes that a repository is set up. 473@c I'm not sure that the sentence concerning the 474@c repository quite tells the user what they need to 475@c know at this point. Might need to expand on "centralized" 476@c slightly (maybe not here, maybe further down in the example?) 477 478Suppose you are working on a simple compiler. The source 479consists of a handful of C files and a @file{Makefile}. 480The compiler is called @samp{tc} (Trivial Compiler), 481and the repository is set up so that there is a module 482called @samp{tc}. 483 484@menu 485* Getting the source:: Creating a workspace 486* Committing your changes:: Making your work available to others 487* Cleaning up:: Cleaning up 488* Viewing differences:: Viewing differences 489@end menu 490 491@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 492@node Getting the source 493@subsection Getting the source 494@cindex Getting the source 495@cindex Checking out source 496@cindex Fetching source 497@cindex Source, getting from CVS 498@cindex Checkout, example 499 500The first thing you must do is to get your own working copy of the 501source for @samp{tc}. For this, you use the @code{checkout} command: 502 503@example 504$ cvs checkout tc 505@end example 506 507@noindent 508This will create a new directory called @file{tc} and populate it with 509the source files. 510 511@example 512$ cd tc 513$ ls 514CVS Makefile backend.c driver.c frontend.c parser.c 515@end example 516 517The @file{CVS} directory is used internally by 518@sc{cvs}. Normally, you should not modify or remove 519any of the files in it. 520 521You start your favorite editor, hack away at @file{backend.c}, and a couple 522of hours later you have added an optimization pass to the compiler. 523A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that 524you want to edit. @xref{Multiple developers}, for an explanation. 525 526@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 527@node Committing your changes 528@subsection Committing your changes 529@cindex Committing changes 530@cindex Log message entry 531@cindex CVSEDITOR, environment variable 532@cindex EDITOR, environment variable 533 534When you have checked that the compiler is still compilable you decide 535to make a new version of @file{backend.c}. This will 536store your new @file{backend.c} in the repository and 537make it available to anyone else who is using that same 538repository. 539 540@example 541$ cvs commit backend.c 542@end example 543 544@noindent 545@sc{cvs} starts an editor, to allow you to enter a log 546message. You type in ``Added an optimization pass.'', 547save the temporary file, and exit the editor. 548 549The environment variable @code{$CVSEDITOR} determines 550which editor is started. If @code{$CVSEDITOR} is not 551set, then if the environment variable @code{$EDITOR} is 552set, it will be used. If both @code{$CVSEDITOR} and 553@code{$EDITOR} are not set then there is a default 554which will vary with your operating system, for example 555@code{vi} for unix or @code{notepad} for Windows 556NT/95. 557 558@cindex VISUAL, environment variable 559In addition, @sc{cvs} checks the @code{$VISUAL} environment 560variable. Opinions vary on whether this behavior is desirable and 561whether future releases of @sc{cvs} should check @code{$VISUAL} or 562ignore it. You will be OK either way if you make sure that 563@code{$VISUAL} is either unset or set to the same thing as 564@code{$EDITOR}. 565 566@c This probably should go into some new node 567@c containing detailed info on the editor, rather than 568@c the intro. In fact, perhaps some of the stuff with 569@c CVSEDITOR and -m and so on should too. 570When @sc{cvs} starts the editor, it includes a list of 571files which are modified. For the @sc{cvs} client, 572this list is based on comparing the modification time 573of the file against the modification time that the file 574had when it was last gotten or updated. Therefore, if 575a file's modification time has changed but its contents 576have not, it will show up as modified. The simplest 577way to handle this is simply not to worry about it---if 578you proceed with the commit @sc{cvs} will detect that 579the contents are not modified and treat it as an 580unmodified file. The next @code{update} will clue 581@sc{cvs} in to the fact that the file is unmodified, 582and it will reset its stored timestamp so that the file 583will not show up in future editor sessions. 584@c FIXCVS: Might be nice if "commit" and other commands 585@c would reset that timestamp too, but currently commit 586@c doesn't. 587@c FIXME: Need to talk more about the process of 588@c prompting for the log message. Like show an example 589@c of what it pops up in the editor, for example. Also 590@c a discussion of how to get the "a)bort, c)ontinue, 591@c e)dit" prompt and what to do with it. Might also 592@c work in the suggestion that if you want a diff, you 593@c should make it before running commit (someone 594@c suggested that the diff pop up in the editor. I'm 595@c not sure that is better than telling people to run 596@c "cvs diff" first if that is what they want, but if 597@c we want to tell people that, the manual possibly 598@c should say it). 599 600If you want to avoid 601starting an editor you can specify the log message on 602the command line using the @samp{-m} flag instead, like 603this: 604 605@example 606$ cvs commit -m "Added an optimization pass" backend.c 607@end example 608 609@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 610@node Cleaning up 611@subsection Cleaning up 612@cindex Cleaning up 613@cindex Working copy, removing 614@cindex Removing your working copy 615@cindex Releasing your working copy 616 617Before you turn to other tasks you decide to remove your working copy of 618tc. One acceptable way to do that is of course 619 620@example 621$ cd .. 622$ rm -r tc 623@end example 624 625@noindent 626but a better way is to use the @code{release} command (@pxref{release}): 627 628@example 629$ cd .. 630$ cvs release -d tc 631M driver.c 632? tc 633You have [1] altered files in this repository. 634Are you sure you want to release (and delete) directory `tc': n 635** `release' aborted by user choice. 636@end example 637 638The @code{release} command checks that all your modifications have been 639committed. If history logging is enabled it also makes a note in the 640history file. @xref{history file}. 641 642When you use the @samp{-d} flag with @code{release}, it 643also removes your working copy. 644 645In the example above, the @code{release} command wrote a couple of lines 646of output. @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}. 647That is nothing to worry about: @file{tc} is the executable compiler, 648and it should not be stored in the repository. @xref{cvsignore}, 649for information about how to make that warning go away. 650@xref{release output}, for a complete explanation of 651all possible output from @code{release}. 652 653@samp{M driver.c} is more serious. It means that the 654file @file{driver.c} has been modified since it was 655checked out. 656 657The @code{release} command always finishes by telling 658you how many modified files you have in your working 659copy of the sources, and then asks you for confirmation 660before deleting any files or making any note in the 661history file. 662 663You decide to play it safe and answer @kbd{n @key{RET}} 664when @code{release} asks for confirmation. 665 666@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 667@node Viewing differences 668@subsection Viewing differences 669@cindex Viewing differences 670@cindex Diff 671 672You do not remember modifying @file{driver.c}, so you want to see what 673has happened to that file. 674 675@example 676$ cd tc 677$ cvs diff driver.c 678@end example 679 680This command runs @code{diff} to compare the version of @file{driver.c} 681that you checked out with your working copy. When you see the output 682you remember that you added a command line option that enabled the 683optimization pass. You check it in, and release the module. 684@c FIXME: we haven't yet defined the term "check in". 685 686@example 687$ cvs commit -m "Added an optimization pass" driver.c 688Checking in driver.c; 689/usr/local/cvsroot/tc/driver.c,v <-- driver.c 690new revision: 1.2; previous revision: 1.1 691done 692$ cd .. 693$ cvs release -d tc 694? tc 695You have [0] altered files in this repository. 696Are you sure you want to release (and delete) directory `tc': y 697@end example 698 699@c --------------------------------------------------------------------- 700@node Repository 701@chapter The Repository 702@cindex Repository (intro) 703@cindex Repository, example 704@cindex Layout of repository 705@cindex Typical repository 706@cindex /usr/local/cvsroot, as example repository 707@cindex cvsroot 708 709The @sc{cvs} @dfn{repository} stores a complete copy of 710all the files and directories which are under version 711control. 712 713Normally, you never access any of the files in the 714repository directly. Instead, you use @sc{cvs} 715commands to get your own copy of the files into a 716@dfn{working directory}, and then 717work on that copy. When you've finished a set of 718changes, you check (or @dfn{commit}) them back into the 719repository. The repository then contains the changes 720which you have made, as well as recording exactly what 721you changed, when you changed it, and other such 722information. Note that the repository is not a 723subdirectory of the working directory, or vice versa; 724they should be in separate locations. 725@c Need some example, e.g. repository 726@c /usr/local/cvsroot; working directory 727@c /home/joe/sources. But this node is too long 728@c as it is; need a little reorganization... 729 730@cindex :local:, setting up 731@sc{cvs} can access a repository by a variety of 732means. It might be on the local computer, or it might 733be on a computer across the room or across the world. 734To distinguish various ways to access a repository, the 735repository name can start with an @dfn{access method}. 736For example, the access method @code{:local:} means to 737access a repository directory, so the repository 738@code{:local:/usr/local/cvsroot} means that the 739repository is in @file{/usr/local/cvsroot} on the 740computer running @sc{cvs}. For information on other 741access methods, see @ref{Remote repositories}. 742 743@c Can se say this more concisely? Like by passing 744@c more of the buck to the Remote repositories node? 745If the access method is omitted, then if the repository 746does not contain @samp{:}, then @code{:local:} is 747assumed. If it does contain @samp{:} then either 748@code{:ext:} or @code{:server:} is assumed. For 749example, if you have a local repository in 750@file{/usr/local/cvsroot}, you can use 751@code{/usr/local/cvsroot} instead of 752@code{:local:/usr/local/cvsroot}. But if (under 753Windows NT, for example) your local repository is 754@file{c:\src\cvsroot}, then you must specify the access 755method, as in @code{:local:c:\src\cvsroot}. 756 757@c This might appear to go in Repository storage, but 758@c actually it is describing something which is quite 759@c user-visible, when you do a "cvs co CVSROOT". This 760@c isn't necessary the perfect place for that, though. 761The repository is split in two parts. @file{$CVSROOT/CVSROOT} contains 762administrative files for @sc{cvs}. The other directories contain the actual 763user-defined modules. 764 765@menu 766* Specifying a repository:: Telling CVS where your repository is 767* Repository storage:: The structure of the repository 768* Working directory storage:: The structure of working directories 769* Intro administrative files:: Defining modules 770* Multiple repositories:: Multiple repositories 771* Creating a repository:: Creating a repository 772* Backing up:: Backing up a repository 773* Moving a repository:: Moving a repository 774* Remote repositories:: Accessing repositories on remote machines 775* Read-only access:: Granting read-only access to the repository 776* Server temporary directory:: The server creates temporary directories 777@end menu 778 779@node Specifying a repository 780@section Telling CVS where your repository is 781 782There are several ways to tell @sc{cvs} 783where to find the repository. You can name the 784repository on the command line explicitly, with the 785@code{-d} (for "directory") option: 786 787@example 788cvs -d /usr/local/cvsroot checkout yoyodyne/tc 789@end example 790 791@cindex .profile, setting CVSROOT in 792@cindex .cshrc, setting CVSROOT in 793@cindex .tcshrc, setting CVSROOT in 794@cindex .bashrc, setting CVSROOT in 795@cindex CVSROOT, environment variable 796 Or you can set the @code{$CVSROOT} environment 797variable to an absolute path to the root of the 798repository, @file{/usr/local/cvsroot} in this example. 799To set @code{$CVSROOT}, @code{csh} and @code{tcsh} 800users should have this line in their @file{.cshrc} or 801@file{.tcshrc} files: 802 803@example 804setenv CVSROOT /usr/local/cvsroot 805@end example 806 807@noindent 808@code{sh} and @code{bash} users should instead have these lines in their 809@file{.profile} or @file{.bashrc}: 810 811@example 812CVSROOT=/usr/local/cvsroot 813export CVSROOT 814@end example 815 816@cindex Root file, in CVS directory 817@cindex CVS/Root file 818 A repository specified with @code{-d} will 819override the @code{$CVSROOT} environment variable. 820Once you've checked a working copy out from the 821repository, it will remember where its repository is 822(the information is recorded in the 823@file{CVS/Root} file in the working copy). 824 825The @code{-d} option and the @file{CVS/Root} file both 826override the @code{$CVSROOT} environment variable. If 827@code{-d} option differs from @file{CVS/Root}, the 828former is used. Of course, for proper operation they 829should be two ways of referring to the same repository. 830 831@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 832@node Repository storage 833@section How data is stored in the repository 834@cindex Repository, how data is stored 835 836For most purposes it isn't important @emph{how} 837@sc{cvs} stores information in the repository. In 838fact, the format has changed in the past, and is likely 839to change in the future. Since in almost all cases one 840accesses the repository via @sc{cvs} commands, such 841changes need not be disruptive. 842 843However, in some cases it may be necessary to 844understand how @sc{cvs} stores data in the repository, 845for example you might need to track down @sc{cvs} locks 846(@pxref{Concurrency}) or you might need to deal with 847the file permissions appropriate for the repository. 848 849@menu 850* Repository files:: What files are stored in the repository 851* File permissions:: File permissions 852* Windows permissions:: Issues specific to Windows 853* Attic:: Some files are stored in the Attic 854* CVS in repository:: Additional information in CVS directory 855* Locks:: CVS locks control concurrent accesses 856* CVSROOT storage:: A few things about CVSROOT are different 857@end menu 858 859@node Repository files 860@subsection Where files are stored within the repository 861 862@c @cindex Filenames, legal 863@c @cindex Legal filenames 864@c Somewhere we need to say something about legitimate 865@c characters in filenames in working directory and 866@c repository. Not "/" (not even on non-unix). And 867@c here is a specific set of issues: 868@c Files starting with a - are handled inconsistently. They can not 869@c be added to a repository with an add command, because it they are 870@c interpreted as a switch. They can appear in a repository if they are 871@c part of a tree that is imported. They can not be removed from the tree 872@c once they are there. 873@c Note that "--" *is* supported (as a 874@c consequence of using GNU getopt). Should document 875@c this somewhere ("Common options"?). The other usual technique, 876@c "./-foo", isn't as effective, at least for "cvs add" 877@c which doesn't support pathnames containing "/". 878 879The overall structure of the repository is a directory 880tree corresponding to the directories in the working 881directory. For example, supposing the repository is in 882 883@example 884/usr/local/cvsroot 885@end example 886 887@noindent 888here is a possible directory tree (showing only the 889directories): 890 891@example 892@t{/usr} 893 | 894 +--@t{local} 895 | | 896 | +--@t{cvsroot} 897 | | | 898 | | +--@t{CVSROOT} 899 | (administrative files) 900 | 901 +--@t{gnu} 902 | | 903 | +--@t{diff} 904 | | (source code to @sc{gnu} diff) 905 | | 906 | +--@t{rcs} 907 | | (source code to @sc{rcs}) 908 | | 909 | +--@t{cvs} 910 | (source code to @sc{cvs}) 911 | 912 +--@t{yoyodyne} 913 | 914 +--@t{tc} 915 | | 916 | +--@t{man} 917 | | 918 | +--@t{testing} 919 | 920 +--(other Yoyodyne software) 921@end example 922 923With the directories are @dfn{history files} for each file 924under version control. The name of the history file is 925the name of the corresponding file with @samp{,v} 926appended to the end. Here is what the repository for 927the @file{yoyodyne/tc} directory might look like: 928@c FIXME: Should also mention CVS (CVSREP) 929@c FIXME? Should we introduce Attic with an xref to 930@c Attic? Not sure whether that is a good idea or not. 931@example 932 @code{$CVSROOT} 933 | 934 +--@t{yoyodyne} 935 | | 936 | +--@t{tc} 937 | | | 938 +--@t{Makefile,v} 939 +--@t{backend.c,v} 940 +--@t{driver.c,v} 941 +--@t{frontend.c,v} 942 +--@t{parser.c,v} 943 +--@t{man} 944 | | 945 | +--@t{tc.1,v} 946 | 947 +--@t{testing} 948 | 949 +--@t{testpgm.t,v} 950 +--@t{test2.t,v} 951@end example 952 953@cindex History files 954@cindex RCS history files 955@c The first sentence, about what history files 956@c contain, is kind of redundant with our intro to what the 957@c repository does in node Repository.... 958The history files contain, among other things, enough 959information to recreate any revision of the file, a log 960of all commit messages and the user-name of the person 961who committed the revision. The history files are 962known as @dfn{RCS files}, because the first program to 963store files in that format was a version control system 964known as @sc{rcs}. For a full 965description of the file format, see the @code{man} page 966@cite{rcsfile(5)}, distributed with @sc{rcs}, or the 967file @file{doc/RCSFILES} in the @sc{cvs} source 968distribution. This 969file format has become very common---many systems other 970than @sc{cvs} or @sc{rcs} can at least import history 971files in this format. 972@c FIXME: Think about including documentation for this 973@c rather than citing it? In the long run, getting 974@c this to be a standard (not sure if we can cope with 975@c a standards process as formal as IEEE/ANSI/ISO/etc, 976@c though...) is the way to go, so maybe citing is 977@c better. 978 979The @sc{rcs} files used in @sc{cvs} differ in a few 980ways from the standard format. The biggest difference 981is magic branches; for more information see @ref{Magic 982branch numbers}. Also in @sc{cvs} the valid tag names 983are a subset of what @sc{rcs} accepts; for @sc{cvs}'s 984rules see @ref{Tags}. 985 986@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 987@node File permissions 988@subsection File permissions 989@c -- Move this to @node Creating a repository or similar 990@cindex Security, file permissions in repository 991@cindex File permissions, general 992@cindex Permissions, general 993@c FIXME: we need to somehow reflect "permissions in 994@c repository" versus "permissions in working 995@c directory" in the index entries. 996@cindex Group 997@cindex Read-only files, in repository 998All @samp{,v} files are created read-only, and you 999should not change the permission of those files. The 1000directories inside the repository should be writable by 1001the persons that have permission to modify the files in 1002each directory. This normally means that you must 1003create a UNIX group (see group(5)) consisting of the 1004persons that are to edit the files in a project, and 1005set up the repository so that it is that group that 1006owns the directory. 1007@c See also comment in commitinfo node regarding cases 1008@c which are really awkward with unix groups. 1009 1010This means that you can only control access to files on 1011a per-directory basis. 1012 1013Note that users must also have write access to check 1014out files, because @sc{cvs} needs to create lock files 1015(@pxref{Concurrency}). 1016 1017@c CVS seems to use CVSUMASK in picking permissions for 1018@c val-tags, but maybe we should say more about this. 1019@c Like val-tags gets created by someone who doesn't 1020@c have CVSUMASK set right? 1021Also note that users must have write access to the 1022@file{CVSROOT/val-tags} file. @sc{cvs} uses it to keep 1023track of what tags are valid tag names (it is sometimes 1024updated when tags are used, as well as when they are 1025created). 1026 1027Each @sc{rcs} file will be owned by the user who last 1028checked it in. This has little significance; what 1029really matters is who owns the directories. 1030 1031@cindex CVSUMASK, environment variable 1032@cindex Umask, for repository files 1033@sc{cvs} tries to set up reasonable file permissions 1034for new directories that are added inside the tree, but 1035you must fix the permissions manually when a new 1036directory should have different permissions than its 1037parent directory. If you set the @code{CVSUMASK} 1038environment variable that will control the file 1039permissions which @sc{cvs} uses in creating directories 1040and/or files in the repository. @code{CVSUMASK} does 1041not affect the file permissions in the working 1042directory; such files have the permissions which are 1043typical for newly created files, except that sometimes 1044@sc{cvs} creates them read-only (see the sections on 1045watches, @ref{Setting a watch}; -r, @ref{Global 1046options}; or @code{CVSREAD}, @ref{Environment variables}). 1047@c FIXME: Need more discussion of which 1048@c group should own the file in the repository. 1049@c Include a somewhat detailed example of the usual 1050@c case where CVSUMASK is 007, the developers are all 1051@c in a group, and that group owns stuff in the 1052@c repository. Need to talk about group ownership of 1053@c newly-created directories/files (on some unices, 1054@c such as SunOS4, setting the setgid bit on the 1055@c directories will make files inherit the directory's 1056@c group. On other unices, your mileage may vary. I 1057@c can't remember what POSIX says about this, if 1058@c anything). 1059 1060Note that using the client/server @sc{cvs} 1061(@pxref{Remote repositories}), there is no good way to 1062set @code{CVSUMASK}; the setting on the client machine 1063has no effect. If you are connecting with @code{rsh}, you 1064can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as 1065described in the documentation for your operating 1066system. This behavior might change in future versions 1067of @sc{cvs}; do not rely on the setting of 1068@code{CVSUMASK} on the client having no effect. 1069@c FIXME: need to explain what a umask is or cite 1070@c someplace which does. 1071@c 1072@c There is also a larger (largely separate) issue 1073@c about the meaning of CVSUMASK in a non-unix context. 1074@c For example, whether there is 1075@c an equivalent which fits better into other 1076@c protection schemes like POSIX.6, VMS, &c. 1077@c 1078@c FIXME: Need one place which discusses this 1079@c read-only files thing. Why would one use -r or 1080@c CVSREAD? Why would one use watches? How do they 1081@c interact? 1082@c 1083@c FIXME: We need to state 1084@c whether using CVSUMASK removes the need for manually 1085@c fixing permissions (in fact, if we are going to mention 1086@c manually fixing permission, we better document a lot 1087@c better just what we mean by "fix"). 1088 1089Using pserver, you will generally need stricter 1090permissions on the @sc{cvsroot} directory and 1091directories above it in the tree; see @ref{Password 1092authentication security}. 1093 1094@cindex Setuid 1095@cindex Setgid 1096@cindex Security, setuid 1097@cindex Installed images (VMS) 1098Some operating systems have features which allow a 1099particular program to run with the ability to perform 1100operations which the caller of the program could not. 1101For example, the set user ID (setuid) or set group ID 1102(setgid) features of unix or the installed image 1103feature of VMS. CVS was not written to use such 1104features and therefore attempting to install CVS in 1105this fashion will provide protection against only 1106accidental lapses; anyone who is trying to circumvent 1107the measure will be able to do so, and depending on how 1108you have set it up may gain access to more than just 1109CVS. You may wish to instead consider pserver. It 1110shares some of the same attributes, in terms of 1111possibly providing a false sense of security or opening 1112security holes wider than the ones you are trying to 1113fix, so read the documentation on pserver security 1114carefully if you are considering this option 1115(@ref{Password authentication security}). 1116 1117@node Windows permissions 1118@subsection File Permission issues specific to Windows 1119@cindex Windows, and permissions 1120@cindex File permissions, Windows-specific 1121@cindex Permissions, Windows-specific 1122 1123Some file permission issues are specific to Windows 1124operating systems (Windows 95, Windows NT, and 1125presumably future operating systems in this family. 1126Some of the following might apply to OS/2 but I'm not 1127sure). 1128 1129If you are using local CVS and the repository is on a 1130networked file system which is served by the Samba SMB 1131server, some people have reported problems with 1132permissions. Enabling WRITE=YES in the samba 1133configuration is said to fix/workaround it. 1134Disclaimer: I haven't investigated enough to know the 1135implications of enabling that option, nor do I know 1136whether there is something which CVS could be doing 1137differently in order to avoid the problem. If you find 1138something out, please let us know as described in 1139@ref{BUGS}. 1140 1141@node Attic 1142@subsection The attic 1143@cindex Attic 1144 1145You will notice that sometimes @sc{cvs} stores an 1146@sc{rcs} file in the @code{Attic}. For example, if the 1147@sc{cvsroot} is @file{/usr/local/cvsroot} and we are 1148talking about the file @file{backend.c} in the 1149directory @file{yoyodyne/tc}, then the file normally 1150would be in 1151 1152@example 1153/usr/local/cvsroot/yoyodyne/tc/backend.c,v 1154@end example 1155 1156but if it goes in the attic, it would be in 1157 1158@example 1159/usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v 1160@end example 1161 1162@cindex Dead state 1163instead. It should not matter from a user point of 1164view whether a file is in the attic; @sc{cvs} keeps 1165track of this and looks in the attic when it needs to. 1166But in case you want to know, the rule is that the RCS 1167file is stored in the attic if and only if the head 1168revision on the trunk has state @code{dead}. A 1169@code{dead} state means that file has been removed, or 1170never added, for that revision. For example, if you 1171add a file on a branch, it will have a trunk revision 1172in @code{dead} state, and a branch revision in a 1173non-@code{dead} state. 1174@c Probably should have some more concrete examples 1175@c here, or somewhere (not sure exactly how we should 1176@c arrange the discussion of the dead state, versus 1177@c discussion of the attic). 1178 1179@node CVS in repository 1180@subsection The CVS directory in the repository 1181@cindex CVS directory, in repository 1182 1183The @file{CVS} directory in each repository directory 1184contains information such as file attributes (in a file 1185called @file{CVS/fileattr}. In the 1186future additional files may be added to this directory, 1187so implementations should silently ignore additional 1188files. 1189 1190This behavior is implemented only by @sc{cvs} 1.7 and 1191later; for details see @ref{Watches Compatibility}. 1192 1193The format of the fileattr file is a series of entries 1194of the following form (where @samp{@{} and @samp{@}} 1195means the text between the braces can be repeated zero 1196or more times): 1197 1198@var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval} 1199 @{; @var{attrname} = @var{attrval}@} <linefeed> 1200 1201@var{ent-type} is @samp{F} for a file, in which case the entry specifies the 1202attributes for that file. 1203 1204@var{ent-type} is @samp{D}, 1205and @var{filename} empty, to specify default attributes 1206to be used for newly added files. 1207 1208Other @var{ent-type} are reserved for future expansion. CVS 1.9 and older 1209will delete them any time it writes file attributes. 1210CVS 1.10 and later will preserve them. 1211 1212Note that the order of the lines is not significant; 1213a program writing the fileattr file may 1214rearrange them at its convenience. 1215 1216There is currently no way of quoting tabs or linefeeds in the 1217filename, @samp{=} in @var{attrname}, 1218@samp{;} in @var{attrval}, etc. Note: some implementations also 1219don't handle a NUL character in any of the fields, but 1220implementations are encouraged to allow it. 1221 1222By convention, @var{attrname} starting with @samp{_} is for an attribute given 1223special meaning by CVS; other @var{attrname}s are for user-defined attributes 1224(or will be, once implementations start supporting user-defined attributes). 1225 1226Builtin attributes: 1227 1228@table @code 1229@item _watched 1230Present means the file is watched and should be checked out 1231read-only. 1232 1233@item _watchers 1234Users with watches for this file. Value is 1235@var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @} 1236where @var{watcher} is a username, and @var{type} 1237is zero or more of edit,unedit,commit separated by 1238@samp{+} (that is, nothing if none; there is no "none" or "all" keyword). 1239 1240@item _editors 1241Users editing this file. Value is 1242@var{editor} > @var{val} @{ , @var{editor} > @var{val} @} 1243where @var{editor} is a username, and @var{val} is 1244@var{time}+@var{hostname}+@var{pathname}, where 1245@var{time} is when the @code{cvs edit} command (or 1246equivalent) happened, 1247and @var{hostname} and @var{pathname} are for the working directory. 1248@end table 1249 1250Example: 1251 1252@c FIXME: sanity.sh should contain a similar test case 1253@c so we can compare this example from something from 1254@c Real Life(TM). See cvsclient.texi (under Notify) for more 1255@c discussion of the date format of _editors. 1256@example 1257Ffile1 _watched=;_watchers=joe>edit,mary>commit 1258Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs 1259D _watched= 1260@end example 1261 1262means that the file @file{file1} should be checked out 1263read-only. Furthermore, joe is watching for edits and 1264mary is watching for commits. The file @file{file2} 1265should be checked out read-only; sue started editing it 1266on 8 Jan 1975 in the directory @file{/home/sue/cvs} on 1267the machine @code{workstn1}. Future files which are 1268added should be checked out read-only. To represent 1269this example here, we have shown a space after 1270@samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact 1271there must be a single tab character there and no spaces. 1272 1273@node Locks 1274@subsection CVS locks in the repository 1275 1276@cindex #cvs.rfl, technical details 1277@cindex #cvs.wfl, technical details 1278@cindex #cvs.lock, technical details 1279@cindex Locks, cvs, technical details 1280For an introduction to CVS locks focusing on 1281user-visible behavior, see @ref{Concurrency}. The 1282following section is aimed at people who are writing 1283tools which want to access a CVS repository without 1284interfering with other tools acessing the same 1285repository. If you find yourself confused by concepts 1286described here, like @dfn{read lock}, @dfn{write lock}, 1287and @dfn{deadlock}, you might consult the literature on 1288operating systems or databases. 1289 1290@cindex #cvs.tfl 1291Any file in the repository with a name starting 1292with @file{#cvs.rfl.} is a read lock. Any file in 1293the repository with a name starting with 1294@file{#cvs.wfl} is a write lock. Old versions of CVS 1295(before CVS 1.5) also created files with names starting 1296with @file{#cvs.tfl}, but they are not discussed here. 1297The directory @file{#cvs.lock} serves as a master 1298lock. That is, one must obtain this lock first before 1299creating any of the other locks. 1300 1301To obtain a readlock, first create the @file{#cvs.lock} 1302directory. This operation must be atomic (which should 1303be true for creating a directory under most operating 1304systems). If it fails because the directory already 1305existed, wait for a while and try again. After 1306obtaining the @file{#cvs.lock} lock, create a file 1307whose name is @file{#cvs.rfl.} followed by information 1308of your choice (for example, hostname and process 1309identification number). Then remove the 1310@file{#cvs.lock} directory to release the master lock. 1311Then proceed with reading the repository. When you are 1312done, remove the @file{#cvs.rfl} file to release the 1313read lock. 1314 1315To obtain a writelock, first create the 1316@file{#cvs.lock} directory, as with a readlock. Then 1317check that there are no files whose names start with 1318@file{#cvs.rfl.}. If there are, remove 1319@file{#cvs.lock}, wait for a while, and try again. If 1320there are no readers, then create a file whose name is 1321@file{#cvs.wfl} followed by information of your choice 1322(for example, hostname and process identification 1323number). Hang on to the @file{#cvs.lock} lock. Proceed 1324with writing the repository. When you are done, first 1325remove the @file{#cvs.wfl} file and then the 1326@file{#cvs.lock} directory. Note that unlike the 1327@file{#cvs.rfl} file, the @file{#cvs.wfl} file is just 1328informational; it has no effect on the locking operation 1329beyond what is provided by holding on to the 1330@file{#cvs.lock} lock itself. 1331 1332Note that each lock (writelock or readlock) only locks 1333a single directory in the repository, including 1334@file{Attic} and @file{CVS} but not including 1335subdirectories which represent other directories under 1336version control. To lock an entire tree, you need to 1337lock each directory (note that if you fail to obtain 1338any lock you need, you must release the whole tree 1339before waiting and trying again, to avoid deadlocks). 1340 1341Note also that @sc{cvs} expects writelocks to control 1342access to individual @file{foo,v} files. @sc{rcs} has 1343a scheme where the @file{,foo,} file serves as a lock, 1344but @sc{cvs} does not implement it and so taking out a 1345@sc{cvs} writelock is recommended. See the comments at 1346rcs_internal_lockfile in the @sc{cvs} source code for 1347further discussion/rationale. 1348 1349@node CVSROOT storage 1350@subsection How files are stored in the CVSROOT directory 1351@cindex CVSROOT, storage of files 1352 1353The @file{$CVSROOT/CVSROOT} directory contains the 1354various administrative files. In some ways this 1355directory is just like any other directory in the 1356repository; it contains @sc{rcs} files whose names end 1357in @samp{,v}, and many of the @sc{cvs} commands operate 1358on it the same way. However, there are a few 1359differences. 1360 1361For each administrative file, in addition to the 1362@sc{rcs} file, there is also a checked out copy of the 1363file. For example, there is an @sc{rcs} file 1364@file{loginfo,v} and a file @file{loginfo} which 1365contains the latest revision contained in 1366@file{loginfo,v}. When you check in an administrative 1367file, @sc{cvs} should print 1368 1369@example 1370cvs commit: Rebuilding administrative file database 1371@end example 1372 1373@noindent 1374and update the checked out copy in 1375@file{$CVSROOT/CVSROOT}. If it does not, there is 1376something wrong (@pxref{BUGS}). To add your own files 1377to the files to be updated in this fashion, you can add 1378them to the @file{checkoutlist} administrative file 1379(@pxref{checkoutlist}). 1380 1381@cindex modules.db 1382@cindex modules.pag 1383@cindex modules.dir 1384By default, the @file{modules} file behaves as 1385described above. If the modules file is very large, 1386storing it as a flat text file may make looking up 1387modules slow (I'm not sure whether this is as much of a 1388concern now as when @sc{cvs} first evolved this 1389feature; I haven't seen benchmarks). Therefore, by 1390making appropriate edits to the @sc{cvs} source code 1391one can store the modules file in a database which 1392implements the @code{ndbm} interface, such as Berkeley 1393db or GDBM. If this option is in use, then the modules 1394database will be stored in the files @file{modules.db}, 1395@file{modules.pag}, and/or @file{modules.dir}. 1396@c I think fileattr also will use the database stuff. 1397@c Anything else? 1398 1399For information on the meaning of the various 1400administrative files, see @ref{Administrative files}. 1401 1402@node Working directory storage 1403@section How data is stored in the working directory 1404 1405@c FIXME: Somewhere we should discuss timestamps (test 1406@c case "stamps" in sanity.sh). But not here. Maybe 1407@c in some kind of "working directory" chapter which 1408@c would encompass the "Builds" one? But I'm not sure 1409@c whether that is a good organization (is it based on 1410@c what the user wants to do?). 1411 1412@cindex CVS directory, in working directory 1413While we are discussing @sc{cvs} internals which may 1414become visible from time to time, we might as well talk 1415about what @sc{cvs} puts in the @file{CVS} directories 1416in the working directories. As with the repository, 1417@sc{cvs} handles this information and one can usually 1418access it via @sc{cvs} commands. But in some cases it 1419may be useful to look at it, and other programs, such 1420as the @code{jCVS} graphical user interface or the 1421@code{VC} package for emacs, may need to look at it. 1422Such programs should follow the recommendations in this 1423section if they hope to be able to work with other 1424programs which use those files, including future 1425versions of the programs just mentioned and the 1426command-line @sc{cvs} client. 1427 1428The @file{CVS} directory contains several files. 1429Programs which are reading this directory should 1430silently ignore files which are in the directory but 1431which are not documented here, to allow for future 1432expansion. 1433 1434The files are stored according to the text file 1435convention for the system in question. This means that 1436working directories are not portable between systems 1437with differing conventions for storing text files. 1438This is intentional, on the theory that the files being 1439managed by CVS probably will not be portable between 1440such systems either. 1441 1442@table @file 1443@item Root 1444This file contains the current @sc{cvs} root, as 1445described in @ref{Specifying a repository}. 1446 1447@cindex Repository file, in CVS directory 1448@cindex CVS/Repository file 1449@item Repository 1450This file contains the directory within the repository 1451which the current directory corresponds with. It can 1452be either an absolute pathname or a relative pathname; 1453@sc{cvs} has had the ability to read either format 1454since at least version 1.3 or so. The relative 1455pathname is relative to the root, and is the more 1456sensible approach, but the absolute pathname is quite 1457common and implementations should accept either. For 1458example, after the command 1459 1460@example 1461cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc 1462@end example 1463 1464@file{Root} will contain 1465 1466@example 1467:local:/usr/local/cvsroot 1468@end example 1469 1470and @file{Repository} will contain either 1471 1472@example 1473/usr/local/cvsroot/yoyodyne/tc 1474@end example 1475 1476@noindent 1477or 1478 1479@example 1480yoyodyne/tc 1481@end example 1482 1483If the particular working directory does not correspond 1484to a directory in the repository, then @file{Repository} 1485should contain @file{CVSROOT/Emptydir}. 1486 1487@cindex Entries file, in CVS directory 1488@cindex CVS/Entries file 1489@item Entries 1490This file lists the files and directories in the 1491working directory. 1492The first character of each line indicates what sort of 1493line it is. If the character is unrecognized, programs 1494reading the file should silently skip that line, to 1495allow for future expansion. 1496 1497If the first character is @samp{/}, then the format is: 1498 1499@example 1500/@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate} 1501@end example 1502 1503where @samp{[} and @samp{]} are not part of the entry, 1504but instead indicate that the @samp{+} and conflict 1505marker are optional. @var{name} is the name of the 1506file within the directory. @var{revision} is the 1507revision that the file in the working derives from, or 1508@samp{0} for an added file, or @samp{-} followed by a 1509revision for a removed file. @var{timestamp} is the 1510timestamp of the file at the time that @sc{cvs} created 1511it; if the timestamp differs with the actual 1512modification time of the file it means the file has 1513been modified. It is stored in 1514the format used by the ISO C asctime() function (for 1515example, @samp{Sun Apr 7 01:29:26 1996}). One may 1516write a string which is not in that format, for 1517example, @samp{Result of merge}, to indicate that the 1518file should always be considered to be modified. This 1519is not a special case; to see whether a file is 1520modified a program should take the timestamp of the file 1521and simply do a string compare with @var{timestamp}. 1522If there was a conflict, @var{conflict} can be set to 1523the modification time of the file after the file has been 1524written with conflict markers (@pxref{Conflicts example}). 1525Thus if @var{conflict} is subsequently the same as the actual 1526modification time of the file it means that the user 1527has obviously not resolved the conflict. @var{options} 1528contains sticky options (for example @samp{-kb} for a 1529binary file). @var{tagdate} contains @samp{T} followed 1530by a tag name, or @samp{D} for a date, followed by a 1531sticky tag or date. Note that if @var{timestamp} 1532contains a pair of timestamps separated by a space, 1533rather than a single timestamp, you are dealing with a 1534version of @sc{cvs} earlier than @sc{cvs} 1.5 (not 1535documented here). 1536 1537The timezone on the timestamp in CVS/Entries (local or 1538universal) should be the same as the operating system 1539stores for the timestamp of the file itself. For 1540example, on Unix the file's timestamp is in universal 1541time (UT), so the timestamp in CVS/Entries should be 1542too. On @sc{vms}, the file's timestamp is in local 1543time, so @sc{cvs} on @sc{vms} should use local time. 1544This rule is so that files do not appear to be modified 1545merely because the timezone changed (for example, to or 1546from summer time). 1547@c See comments and calls to gmtime() and friends in 1548@c src/vers_ts.c (function time_stamp). 1549 1550If the first character of a line in @file{Entries} is 1551@samp{D}, then it indicates a subdirectory. @samp{D} 1552on a line all by itself indicates that the program 1553which wrote the @file{Entries} file does record 1554subdirectories (therefore, if there is such a line and 1555no other lines beginning with @samp{D}, one knows there 1556are no subdirectories). Otherwise, the line looks 1557like: 1558 1559@example 1560D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4} 1561@end example 1562 1563where @var{name} is the name of the subdirectory, and 1564all the @var{filler} fields should be silently ignored, 1565for future expansion. Programs which modify 1566@code{Entries} files should preserve these fields. 1567 1568The lines in the @file{Entries} file can be in any order. 1569 1570@cindex Entries.Log file, in CVS directory 1571@cindex CVS/Entries.Log file 1572@item Entries.Log 1573This file does not record any information beyond that 1574in @file{Entries}, but it does provide a way to update 1575the information without having to rewrite the entire 1576@file{Entries} file, including the ability to preserve 1577the information even if the program writing 1578@file{Entries} and @file{Entries.Log} abruptly aborts. 1579Programs which are reading the @file{Entries} file 1580should also check for @file{Entries.Log}. If the latter 1581exists, they should read @file{Entries} and then apply 1582the changes mentioned in @file{Entries.Log}. After 1583applying the changes, the recommended practice is to 1584rewrite @file{Entries} and then delete @file{Entries.Log}. 1585The format of a line in @file{Entries.Log} is a single 1586character command followed by a space followed by a 1587line in the format specified for a line in 1588@file{Entries}. The single character command is 1589@samp{A} to indicate that the entry is being added, 1590@samp{R} to indicate that the entry is being removed, 1591or any other character to indicate that the entire line 1592in @file{Entries.Log} should be silently ignored (for 1593future expansion). If the second character of the line 1594in @file{Entries.Log} is not a space, then it was 1595written by an older version of @sc{cvs} (not documented 1596here). 1597 1598Programs which are writing rather than reading can 1599safely ignore @file{Entries.Log} if they so choose. 1600 1601@cindex Entries.Backup file, in CVS directory 1602@cindex CVS/Entries.Backup file 1603@item Entries.Backup 1604This is a temporary file. Recommended usage is to 1605write a new entries file to @file{Entries.Backup}, and 1606then to rename it (atomically, where possible) to @file{Entries}. 1607 1608@cindex Entries.Static file, in CVS directory 1609@cindex CVS/Entries.Static file 1610@item Entries.Static 1611The only relevant thing about this file is whether it 1612exists or not. If it exists, then it means that only 1613part of a directory was gotten and @sc{cvs} will 1614not create additional files in that directory. To 1615clear it, use the @code{update} command with the 1616@samp{-d} option, which will get the additional files 1617and remove @file{Entries.Static}. 1618@c FIXME: This needs to be better documented, in places 1619@c other than Working Directory Storage. 1620@c FIXCVS: The fact that this setting exists needs to 1621@c be more visible to the user. For example "cvs 1622@c status foo", in the case where the file would be 1623@c gotten except for Entries.Static, might say 1624@c something to distinguish this from other cases. 1625@c One thing that periodically gets suggested is to 1626@c have "cvs update" print something when it skips 1627@c files due to Entries.Static, but IMHO that kind of 1628@c noise pretty much makes the Entries.Static feature 1629@c useless. 1630 1631@cindex Tag file, in CVS directory 1632@cindex CVS/Tag file 1633@cindex Sticky tags/dates, per-directory 1634@cindex Per-directory sticky tags/dates 1635@item Tag 1636This file contains per-directory sticky tags or dates. 1637The first character is @samp{T} for a branch tag, 1638@samp{N} for a non-branch tag, or @samp{D} for a date, 1639or another character to mean the file should be 1640silently ignored, for future expansion. This character 1641is followed by the tag or date. Note that 1642per-directory sticky tags or dates are used for things 1643like applying to files which are newly added; they 1644might not be the same as the sticky tags or dates on 1645individual files. For general information on sticky 1646tags and dates, see @ref{Sticky tags}. 1647@c FIXME: This needs to be much better documented, 1648@c preferably not in the context of "working directory 1649@c storage". 1650@c FIXME: The Sticky tags node needs to discuss, or xref to 1651@c someplace which discusses, per-directory sticky 1652@c tags and the distinction with per-file sticky tags. 1653 1654@cindex Checkin.prog file, in CVS directory 1655@cindex CVS/Checkin.prog file 1656@cindex Update.prog file, in CVS directory 1657@cindex CVS/Update.prog file 1658@item Checkin.prog 1659@itemx Update.prog 1660These files store the programs specified by the 1661@samp{-i} and @samp{-u} options in the modules file, 1662respectively. 1663 1664@cindex Notify file, in CVS directory 1665@cindex CVS/Notify file 1666@item Notify 1667This file stores notifications (for example, for 1668@code{edit} or @code{unedit}) which have not yet been 1669sent to the server. Its format is not yet documented 1670here. 1671 1672@cindex Notify.tmp file, in CVS directory 1673@cindex CVS/Notify.tmp file 1674@item Notify.tmp 1675This file is to @file{Notify} as @file{Entries.Backup} 1676is to @file{Entries}. That is, to write @file{Notify}, 1677first write the new contents to @file{Notify.tmp} and 1678then (atomically where possible), rename it to 1679@file{Notify}. 1680 1681@cindex Base directory, in CVS directory 1682@cindex CVS/Base directory 1683@item Base 1684If watches are in use, then an @code{edit} command 1685stores the original copy of the file in the @file{Base} 1686directory. This allows the @code{unedit} command to 1687operate even if it is unable to communicate with the 1688server. 1689 1690@cindex Baserev file, in CVS directory 1691@cindex CVS/Baserev file 1692@item Baserev 1693The file lists the revision for each of the files in 1694the @file{Base} directory. The format is: 1695 1696@example 1697B@var{name}/@var{rev}/@var{expansion} 1698@end example 1699 1700where @var{expansion} should be ignored, to allow for 1701future expansion. 1702 1703@cindex Baserev.tmp file, in CVS directory 1704@cindex CVS/Baserev.tmp file 1705@item Baserev.tmp 1706This file is to @file{Baserev} as @file{Entries.Backup} 1707is to @file{Entries}. That is, to write @file{Baserev}, 1708first write the new contents to @file{Baserev.tmp} and 1709then (atomically where possible), rename it to 1710@file{Baserev}. 1711 1712@cindex Template file, in CVS directory 1713@cindex CVS/Template file 1714@item Template 1715This file contains the template specified by the 1716@file{rcsinfo} file (@pxref{rcsinfo}). It is only used 1717by the client; the non-client/server @sc{cvs} consults 1718@file{rcsinfo} directly. 1719@end table 1720 1721@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1722@node Intro administrative files 1723@section The administrative files 1724@cindex Administrative files (intro) 1725@cindex Modules file 1726@cindex CVSROOT, module name 1727@cindex Defining modules (intro) 1728 1729@c FIXME: this node should be reorganized into "general 1730@c information about admin files" and put the "editing 1731@c admin files" stuff up front rather than jumping into 1732@c the details of modules right away. Then the 1733@c Administrative files node can go away, the information 1734@c on each admin file distributed to a place appropriate 1735@c to its function, and this node can contain a table 1736@c listing each file and a @ref to its detailed description. 1737 1738The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative 1739files}. @xref{Administrative files}, for a complete description. 1740You can use @sc{cvs} without any of these files, but 1741some commands work better when at least the 1742@file{modules} file is properly set up. 1743 1744The most important of these files is the @file{modules} 1745file. It defines all modules in the repository. This 1746is a sample @file{modules} file. 1747 1748@c FIXME: The CVSROOT line is a goofy example now that 1749@c mkmodules doesn't exist. 1750@example 1751CVSROOT CVSROOT 1752modules CVSROOT modules 1753cvs gnu/cvs 1754rcs gnu/rcs 1755diff gnu/diff 1756tc yoyodyne/tc 1757@end example 1758 1759The @file{modules} file is line oriented. In its 1760simplest form each line contains the name of the 1761module, whitespace, and the directory where the module 1762resides. The directory is a path relative to 1763@code{$CVSROOT}. The last four lines in the example 1764above are examples of such lines. 1765 1766@c FIXME: might want to introduce the concept of options in modules file 1767@c (the old example which was here, -i mkmodules, is obsolete). 1768 1769The line that defines the module called @samp{modules} 1770uses features that are not explained here. 1771@xref{modules}, for a full explanation of all the 1772available features. 1773 1774@c FIXME: subsection without node is bogus 1775@subsection Editing administrative files 1776@cindex Editing administrative files 1777@cindex Administrative files, editing them 1778 1779You edit the administrative files in the same way that you would edit 1780any other module. Use @samp{cvs checkout CVSROOT} to get a working 1781copy, edit it, and commit your changes in the normal way. 1782 1783It is possible to commit an erroneous administrative 1784file. You can often fix the error and check in a new 1785revision, but sometimes a particularly bad error in the 1786administrative file makes it impossible to commit new 1787revisions. 1788@c @xref{Bad administrative files} for a hint 1789@c about how to solve such situations. 1790@c -- administrative file checking-- 1791 1792@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1793@node Multiple repositories 1794@section Multiple repositories 1795@cindex Multiple repositories 1796@cindex Repositories, multiple 1797@cindex Many repositories 1798@cindex Parallel repositories 1799@cindex Disjoint repositories 1800@cindex CVSROOT, multiple repositories 1801 1802In some situations it is a good idea to have more than 1803one repository, for instance if you have two 1804development groups that work on separate projects 1805without sharing any code. All you have to do to have 1806several repositories is to specify the appropriate 1807repository, using the @code{CVSROOT} environment 1808variable, the @samp{-d} option to @sc{cvs}, or (once 1809you have checked out a working directory) by simply 1810allowing @sc{cvs} to use the repository that was used 1811to check out the working directory 1812(@pxref{Specifying a repository}). 1813 1814The big advantage of having multiple repositories is 1815that they can reside on different servers. With @sc{cvs} 1816version 1.10, a single command cannot recurse into 1817directories from different repositories. With development 1818versions of @sc{cvs}, you can check out code from multiple 1819servers into your working directory. @sc{cvs} will 1820recurse and handle all the details of making 1821connections to as many server machines as necessary to 1822perform the requested command. Here is an example of 1823how to set up a working directory: 1824 1825@example 1826cvs -d server1:/cvs co dir1 1827cd dir1 1828cvs -d server2:/root co sdir 1829cvs update 1830@end example 1831 1832The @code{cvs co} commands set up the working 1833directory, and then the @code{cvs update} command will 1834contact server2, to update the dir1/sdir subdirectory, 1835and server1, to update everything else. 1836 1837@c FIXME: Does the FAQ have more about this? I have a 1838@c dim recollection, but I'm too lazy to check right now. 1839 1840@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1841@node Creating a repository 1842@section Creating a repository 1843 1844@cindex Repository, setting up 1845@cindex Creating a repository 1846@cindex Setting up a repository 1847 1848To set up a @sc{cvs} repository, first choose the 1849machine and disk on which you want to store the 1850revision history of the source files. CPU and memory 1851requirements are modest, so most machines should be 1852adequate. For details see @ref{Server requirements}. 1853@c Possible that we should be providing a quick rule of 1854@c thumb, like the 32M memory for the server. That 1855@c might increase the number of people who are happy 1856@c with the answer, without following the xref. 1857 1858To estimate disk space 1859requirements, if you are importing RCS files from 1860another system, the size of those files is the 1861approximate initial size of your repository, or if you 1862are starting without any version history, a rule of 1863thumb is to allow for the server approximately three 1864times the size of the code to be under CVS for the 1865repository (you will eventually outgrow this, but not 1866for a while). On the machines on which the developers 1867will be working, you'll want disk space for 1868approximately one working directory for each developer 1869(either the entire tree or a portion of it, depending 1870on what each developer uses). 1871 1872The repository should be accessible 1873(directly or via a networked file system) from all 1874machines which want to use @sc{cvs} in server or local 1875mode; the client machines need not have any access to 1876it other than via the @sc{cvs} protocol. It is not 1877possible to use @sc{cvs} to read from a repository 1878which one only has read access to; @sc{cvs} needs to be 1879able to create lock files (@pxref{Concurrency}). 1880 1881@cindex init (subcommand) 1882To create a repository, run the @code{cvs init} 1883command. It will set up an empty repository in the 1884@sc{cvs} root specified in the usual way 1885(@pxref{Repository}). For example, 1886 1887@example 1888cvs -d /usr/local/cvsroot init 1889@end example 1890 1891@code{cvs init} is careful to never overwrite any 1892existing files in the repository, so no harm is done if 1893you run @code{cvs init} on an already set-up 1894repository. 1895 1896@code{cvs init} will enable history logging; if you 1897don't want that, remove the history file after running 1898@code{cvs init}. @xref{history file}. 1899 1900@node Backing up 1901@section Backing up a repository 1902@cindex Repository, backing up 1903@cindex Backing up, repository 1904 1905There is nothing particularly magical about the files 1906in the repository; for the most part it is possible to 1907back them up just like any other files. However, there 1908are a few issues to consider. 1909 1910@cindex Locks, cvs, and backups 1911@cindex #cvs.rfl, and backups 1912The first is that to be paranoid, one should either not 1913use @sc{cvs} during the backup, or have the backup 1914program lock @sc{cvs} while doing the backup. To not 1915use @sc{cvs}, you might forbid logins to machines which 1916can access the repository, turn off your @sc{cvs} 1917server, or similar mechanisms. The details would 1918depend on your operating system and how you have 1919@sc{cvs} set up. To lock @sc{cvs}, you would create 1920@file{#cvs.rfl} locks in each repository directory. 1921See @ref{Concurrency}, for more on @sc{cvs} locks. 1922Having said all this, if you just back up without any 1923of these precautions, the results are unlikely to be 1924particularly dire. Restoring from backup, the 1925repository might be in an inconsistent state, but this 1926would not be particularly hard to fix manually. 1927 1928When you restore a repository from backup, assuming 1929that changes in the repository were made after the time 1930of the backup, working directories which were not 1931affected by the failure may refer to revisions which no 1932longer exist in the repository. Trying to run @sc{cvs} 1933in such directories will typically produce an error 1934message. One way to get those changes back into the 1935repository is as follows: 1936 1937@itemize @bullet 1938@item 1939Get a new working directory. 1940 1941@item 1942Copy the files from the working directory from before 1943the failure over to the new working directory (do not 1944copy the contents of the @file{CVS} directories, of 1945course). 1946 1947@item 1948Working in the new working directory, use commands such 1949as @code{cvs update} and @code{cvs diff} to figure out 1950what has changed, and then when you are ready, commit 1951the changes into the repository. 1952@end itemize 1953 1954@node Moving a repository 1955@section Moving a repository 1956@cindex Repository, moving 1957@cindex Moving a repository 1958@cindex Copying a repository 1959 1960Just as backing up the files in the repository is 1961pretty much like backing up any other files, if you 1962need to move a repository from one place to another it 1963is also pretty much like just moving any other 1964collection of files. 1965 1966The main thing to consider is that working directories 1967point to the repository. The simplest way to deal with 1968a moved repository is to just get a fresh working 1969directory after the move. Of course, you'll want to 1970make sure that the old working directory had been 1971checked in before the move, or you figured out some 1972other way to make sure that you don't lose any 1973changes. If you really do want to reuse the existing 1974working directory, it should be possible with manual 1975surgery on the @file{CVS/Repository} files. You can 1976see @ref{Working directory storage}, for information on 1977the @file{CVS/Repository} and @file{CVS/Root} files, but 1978unless you are sure you want to bother, it probably 1979isn't worth it. 1980@c FIXME: Surgery on CVS/Repository should be avoided 1981@c by making RELATIVE_REPOS the default. 1982@c FIXME-maybe: might want some documented way to 1983@c change the CVS/Root files in some particular tree. 1984@c But then again, I don't know, maybe just having 1985@c people do this in perl/shell/&c isn't so bad... 1986 1987@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1988@node Remote repositories 1989@section Remote repositories 1990@cindex Repositories, remote 1991@cindex Remote repositories 1992@cindex Client/Server Operation 1993@cindex Server, CVS 1994 1995 Your working copy of the sources can be on a 1996different machine than the repository. Using @sc{cvs} 1997in this manner is known as @dfn{client/server} 1998operation. You run @sc{cvs} on a machine which can 1999mount your working directory, known as the 2000@dfn{client}, and tell it to communicate to a machine 2001which can mount the repository, known as the 2002@dfn{server}. Generally, using a remote 2003repository is just like using a local one, except that 2004the format of the repository name is: 2005 2006@example 2007:@var{method}:@var{user}@@@var{hostname}:/path/to/repository 2008@end example 2009 2010The details of exactly what needs to be set up depend 2011on how you are connecting to the server. 2012 2013If @var{method} is not specified, and the repository 2014name contains @samp{:}, then the default is @code{ext} 2015or @code{server}, depending on your platform; both are 2016described in @ref{Connecting via rsh}. 2017@c Should we try to explain which platforms are which? 2018@c Platforms like unix and VMS, which only allow 2019@c privileged programs to bind to sockets <1024 lose on 2020@c :server: 2021@c Platforms like Mac and VMS, whose rsh program is 2022@c unusable or nonexistent, lose on :ext: 2023@c Platforms like OS/2 and NT probably could plausibly 2024@c default either way (modulo -b troubles). 2025 2026@c FIXME: We need to have a better way of explaining 2027@c what method to use. This presentation totally 2028@c obscures the fact that :ext: and CVS_RSH is the way to 2029@c use SSH, for example. Plus it incorrectly implies 2030@c that you need an @code{rsh} binary on the client to use 2031@c :server:. 2032@c Also note that rsh not pserver is the right choice if you want 2033@c users to be able to create their own repositories 2034@c (because of the --allow-root related issues). 2035@menu 2036* Server requirements:: Memory and other resources for servers 2037* Connecting via rsh:: Using the @code{rsh} program to connect 2038* Password authenticated:: Direct connections using passwords 2039* GSSAPI authenticated:: Direct connections using GSSAPI 2040* Kerberos authenticated:: Direct connections with kerberos 2041* Connecting via fork:: Using a forked @code{cvs server} to connect 2042@end menu 2043 2044@node Server requirements 2045@subsection Server requirements 2046 2047The quick answer to what sort of machine is suitable as 2048a server is that requirements are modest---a server 2049with 32M of memory or even less can handle a fairly 2050large source tree with a fair amount of activity. 2051@c Say something about CPU speed too? I'm even less sure 2052@c what to say on that subject... 2053 2054The real answer, of course, is more complicated. 2055Estimating the known areas of large memory consumption 2056should be sufficient to estimate memory requirements. 2057There are two such areas documented here; other memory 2058consumption should be small by comparison (if you find 2059that is not the case, let us know, as described in 2060@ref{BUGS}, so we can update this documentation). 2061 2062The first area of big memory consumption is large 2063checkouts, when using the @sc{cvs} server. The server 2064consists of two processes for each client that it is 2065serving. Memory consumption on the child process 2066should remain fairly small. Memory consumption on the 2067parent process, particularly if the network connection 2068to the client is slow, can be expected to grow to 2069slightly more than the size of the sources in a single 2070directory, or two megabytes, whichever is larger. 2071@c "two megabytes" of course is SERVER_HI_WATER. But 2072@c we don't mention that here because we are 2073@c documenting the default configuration of CVS. If it 2074@c is a "standard" thing to change that value, it 2075@c should be some kind of run-time configuration. 2076@c 2077@c See cvsclient.texi for more on the design decision 2078@c to not have locks in place while waiting for the 2079@c client, which is what results in memory consumption 2080@c as high as this. 2081 2082Multiplying the size of each @sc{cvs} server by the 2083number of servers which you expect to have active at 2084one time should give an idea of memory requirements for 2085the server. For the most part, the memory consumed by 2086the parent process probably can be swap space rather 2087than physical memory. 2088@c Has anyone verified that notion about swap space? 2089@c I say it based pretty much on guessing that the 2090@c ->text of the struct buffer_data only gets accessed 2091@c in a first in, first out fashion, but I haven't 2092@c looked very closely. 2093 2094@c What about disk usage in /tmp on the server? I think that 2095@c it can be substantial, but I haven't looked at this 2096@c again and tried to figure it out ("cvs import" is 2097@c probably the worst case...). 2098 2099The second area of large memory consumption is 2100@code{diff}, when checking in large files. This is 2101required even for binary files. The rule of thumb is 2102to allow about ten times the size of the largest file 2103you will want to check in, although five times may be 2104adequate. For example, if you want to check in a file 2105which is 10 megabytes, you should have 100 megabytes of 2106memory on the machine doing the checkin (the server 2107machine for client/server, or the machine running 2108@sc{cvs} for non-client/server). This can be swap 2109space rather than physical memory. Because the memory 2110is only required briefly, there is no particular need 2111to allow memory for more than one such checkin at a 2112time. 2113@c The 5-10 times rule of thumb is from Paul Eggert for 2114@c GNU diff. I don't think it is in the GNU diff 2115@c manual or anyplace like that. 2116@c 2117@c Probably we could be saying more about 2118@c non-client/server CVS. 2119@c I would guess for non-client/server CVS in an NFS 2120@c environment the biggest issues are the network and 2121@c the NFS server. 2122 2123Resource consumption for the client is even more 2124modest---any machine with enough capacity to run the 2125operating system in question should have little 2126trouble. 2127@c Is that true? I think the client still wants to 2128@c (bogusly) store entire files in memory at times. 2129 2130For information on disk space requirements, see 2131@ref{Creating a repository}. 2132 2133@node Connecting via rsh 2134@subsection Connecting with rsh 2135 2136@cindex rsh 2137CVS uses the @file{rsh} protocol to perform these 2138operations, so the remote user host needs to have a 2139@file{.rhosts} file which grants access to the local 2140user. 2141 2142For example, suppose you are the user @file{mozart} on 2143the local machine @file{toe.example.com}, and the 2144server machine is @file{faun.example.org}. On 2145faun, put the following line into the file 2146@file{.rhosts} in @file{bach}'s home directory: 2147 2148@example 2149toe.example.com mozart 2150@end example 2151 2152Then test that @code{rsh} is working with 2153 2154@example 2155rsh -l bach faun.example.org 'echo $PATH' 2156@end example 2157 2158@cindex CVS_SERVER, environment variable 2159Next you have to make sure that @code{rsh} will be able 2160to find the server. Make sure that the path which 2161@code{rsh} printed in the above example includes the 2162directory containing a program named @code{cvs} which 2163is the server. You need to set the path in 2164@file{.bashrc}, @file{.cshrc}, etc., not @file{.login} 2165or @file{.profile}. Alternately, you can set the 2166environment variable @code{CVS_SERVER} on the client 2167machine to the filename of the server you want to use, 2168for example @file{/usr/local/bin/cvs-1.6}. 2169@c FIXME: there should be a way to specify the 2170@c program in CVSROOT, not CVS_SERVER, so that one can use 2171@c different ones for different roots. e.g. ":server;cvs=cvs-1.6:" 2172@c instead of ":server:". 2173 2174There is no need to edit @file{inetd.conf} or start a 2175@sc{cvs} server daemon. 2176 2177@cindex :server:, setting up 2178@cindex :ext:, setting up 2179@cindex Kerberos, using kerberized rsh 2180@cindex SSH (rsh replacement) 2181@cindex rsh replacements (Kerberized, SSH, &c) 2182There are two access methods that you use in @code{CVSROOT} 2183for rsh. @code{:server:} specifies an internal rsh 2184client, which is supported only by some CVS ports. 2185@code{:ext:} specifies an external rsh program. By 2186default this is @code{rsh} but you may set the 2187@code{CVS_RSH} environment variable to invoke another 2188program which can access the remote server (for 2189example, @code{remsh} on HP-UX 9 because @code{rsh} is 2190something different). It must be a program which can 2191transmit data to and from the server without modifying 2192it; for example the Windows NT @code{rsh} is not 2193suitable since it by default translates between CRLF 2194and LF. The OS/2 CVS port has a hack to pass @samp{-b} 2195to @code{rsh} to get around this, but since this could 2196potentially cause problems for programs other than the 2197standard @code{rsh}, it may change in the future. If 2198you set @code{CVS_RSH} to @code{SSH} or some other rsh 2199replacement, the instructions in the rest of this 2200section concerning @file{.rhosts} and so on are likely 2201to be inapplicable; consult the documentation for your rsh 2202replacement. 2203@c FIXME: there should be a way to specify the 2204@c program in CVSROOT, not CVS_RSH, so that one can use 2205@c different ones for different roots. e.g. ":ext;rsh=remsh:" 2206@c instead of ":ext:". 2207@c See also the comment in src/client.c for rationale 2208@c concerning "rsh" being the default and never 2209@c "remsh". 2210 2211Continuing our example, supposing you want to access 2212the module @file{foo} in the repository 2213@file{/usr/local/cvsroot/}, on machine 2214@file{faun.example.org}, you are ready to go: 2215 2216@example 2217cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo 2218@end example 2219 2220(The @file{bach@@} can be omitted if the username is 2221the same on both the local and remote hosts.) 2222 2223@c Should we mention "rsh host echo hi" and "rsh host 2224@c cat" (the latter followed by typing text and ^D) 2225@c as troubleshooting techniques? Probably yes 2226@c (people tend to have trouble setting this up), 2227@c but this kind of thing can be hard to spell out. 2228 2229@node Password authenticated 2230@subsection Direct connection with password authentication 2231 2232The @sc{cvs} client can also connect to the server 2233using a password protocol. This is particularly useful 2234if using @code{rsh} is not feasible (for example, 2235the server is behind a firewall), and Kerberos also is 2236not available. 2237 2238 To use this method, it is necessary to make 2239some adjustments on both the server and client sides. 2240 2241@menu 2242* Password authentication server:: Setting up the server 2243* Password authentication client:: Using the client 2244* Password authentication security:: What this method does and does not do 2245@end menu 2246 2247@node Password authentication server 2248@subsubsection Setting up the server for password authentication 2249 2250First of all, you probably want to tighten the 2251permissions on the @file{$CVSROOT} and 2252@file{$CVSROOT/CVSROOT} directories. See @ref{Password 2253authentication security}, for more details. 2254 2255@cindex pserver (subcommand) 2256@cindex Password server, setting up 2257@cindex Authenticating server, setting up 2258@c FIXME: this isn't quite right regarding port 2259@c numbers; CVS looks up "cvspserver" in 2260@c /etc/services (on unix, but what about non-unix?). 2261On the server side, the file @file{/etc/inetd.conf} 2262needs to be edited so @code{inetd} knows to run the 2263command @code{cvs pserver} when it receives a 2264connection on the right port. By default, the port 2265number is 2401; it would be different if your client 2266were compiled with @code{CVS_AUTH_PORT} defined to 2267something else, though. 2268 2269 If your @code{inetd} allows raw port numbers in 2270@file{/etc/inetd.conf}, then the following (all on a 2271single line in @file{inetd.conf}) should be sufficient: 2272 2273@example 22742401 stream tcp nowait root /usr/local/bin/cvs 2275cvs -f --allow-root=/usr/cvsroot pserver 2276@end example 2277 2278You could also use the 2279@samp{-T} option to specify a temporary directory. 2280 2281The @samp{--allow-root} option specifies the allowable 2282@sc{cvsroot} directory. Clients which attempt to use a 2283different @sc{cvsroot} directory will not be allowed to 2284connect. If there is more than one @sc{cvsroot} 2285directory which you want to allow, repeat the option. 2286(Unfortunately, many versions of @code{inetd} have very small 2287limits on the number of arguments and/or the total length 2288of the command. The usual solution to this problem is 2289to have @code{inetd} run a shell script which then invokes 2290@sc{cvs} with the necessary arguments.) 2291 2292 If your @code{inetd} wants a symbolic service 2293name instead of a raw port number, then put this in 2294@file{/etc/services}: 2295 2296@example 2297cvspserver 2401/tcp 2298@end example 2299 2300 and put @code{cvspserver} instead of 2301@code{2401} in @file{inetd.conf}. 2302 2303 Once the above is taken care of, restart your 2304@code{inetd}, or do whatever is necessary to force it 2305to reread its initialization files. 2306 2307If you are having trouble setting this up, see 2308@ref{Connection}. 2309 2310@cindex CVS passwd file 2311@cindex passwd (admin file) 2312Because the client stores and transmits passwords in 2313cleartext (almost---see @ref{Password authentication 2314security}, for details), a separate @sc{cvs} password 2315file is generally used, so people don't compromise 2316their regular passwords when they access the 2317repository. This file is 2318@file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro 2319administrative files}). It uses a colon-separated 2320format, similar to @file{/etc/passwd} on Unix systems, 2321except that it has fewer fields: @sc{cvs} username, 2322optional password, and an optional system username for 2323@sc{cvs} to run as if authentication succeeds. Here is 2324an example @file{passwd} file with five entries: 2325 2326@example 2327anonymous: 2328bach:ULtgRLXo7NRxs 2329spwang:1sOp854gDF3DY 2330melissa:tGX1fS8sun6rY:pubcvs 2331qproj:XR4EZcEs0szik:pubcvs 2332@end example 2333 2334(The passwords are encrypted according to the standard 2335Unix @code{crypt()} function, so it is possible to 2336paste in passwords directly from regular Unix 2337@file{/etc/passwd} files.) 2338 2339The first line in the example will grant access to any 2340@sc{cvs} client attempting to authenticate as user 2341@code{anonymous}, no matter what password they use, 2342including an empty password. (This is typical for 2343sites granting anonymous read-only access; for 2344information on how to do the "read-only" part, see 2345@xref{Read-only access}.) 2346 2347The second and third lines will grant access to 2348@code{bach} and @code{spwang} if they supply their 2349respective plaintext passwords. 2350 2351@cindex User aliases 2352The fourth line will grant access to @code{melissa}, if 2353she supplies the correct password, but her @sc{cvs} 2354operations will actually run on the server side under 2355the system user @code{pubcvs}. Thus, there need not be 2356any system user named @code{melissa}, but there 2357@emph{must} be one named @code{pubcvs}. 2358 2359The fifth line shows that system user identities can be 2360shared: any client who successfully authenticates as 2361@code{qproj} will actually run as @code{pubcvs}, just 2362as @code{melissa} does. That way you could create a 2363single, shared system user for each project in your 2364repository, and give each developer their own line in 2365the @file{$CVSROOT/CVSROOT/passwd} file. The @sc{cvs} 2366username on each line would be different, but the 2367system username would be the same. The reason to have 2368different @sc{cvs} usernames is that CVS will log their 2369actions under those names: when @code{melissa} commits 2370a change to a project, the checkin is recorded in the 2371project's history under the name @code{melissa}, not 2372@code{pubcvs}. And the reason to have them share a 2373system username is so that you can arrange permissions 2374in the relevant area of the repository such that only 2375that account has write-permission there. 2376 2377If the system-user field is present, all 2378password-authenticated @sc{cvs} commands run as that 2379user; if no system user is specified, @sc{cvs} simply 2380takes the @sc{cvs} username as the system username and 2381runs commands as that user. In either case, if there 2382is no such user on the system, then the @sc{cvs} 2383operation will fail (regardless of whether the client 2384supplied a valid password). 2385 2386The password and system-user fields can both be omitted 2387(and if the system-user field is omitted, then also 2388omit the colon that would have separated it from the 2389encrypted password). For example, this would be a 2390valid @file{$CVSROOT/CVSROOT/passwd} file: 2391 2392@example 2393anonymous::pubcvs 2394fish:rKa5jzULzmhOo:kfogel 2395sussman:1sOp854gDF3DY 2396@end example 2397 2398When the password field is omitted or empty, then the 2399client's authentication attempt will succeed with any 2400password, including the empty string. However, the 2401colon after the @sc{cvs} username is always necessary, 2402even if the password is empty. 2403 2404CVS can also fall back to use system authentication. 2405When authenticating a password, the server first checks 2406for the user in the @file{$CVSROOT/CVSROOT/passwd} 2407file. If it finds the user, it will use that entry for 2408authentication as described above. But if it does not 2409find the user, or if the @sc{cvs} @file{passwd} file 2410does not exist, then the server can try to authenticate 2411the username and password using the operating system's 2412user-lookup routines (this "fallback" behavior can be 2413disabled by setting @code{SystemAuth=no} in the 2414@sc{cvs} @file{config} file, @pxref{config}). Be 2415aware, however, that falling back to system 2416authentication might be a security risk: @sc{cvs} 2417operations would then be authenticated with that user's 2418regular login password, and the password flies across 2419the network in plaintext. See @ref{Password 2420authentication security} for more on this. 2421 2422Right now, the only way to put a password in the 2423@sc{cvs} @file{passwd} file is to paste it there from 2424somewhere else. Someday, there may be a @code{cvs 2425passwd} command. 2426 2427Unlike many of the files in @file{$CVSROOT/CVSROOT}, it 2428is normal to edit the @file{passwd} file in-place, 2429rather than via @sc{cvs}. This is because of the 2430possible security risks of having the @file{passwd} 2431file checked out to people's working copies. If you do 2432want to include the @file{passwd} file in checkouts of 2433@file{$CVSROOT/CVSROOT}, see @xref{checkoutlist}. 2434 2435@c We might also suggest using the @code{htpasswd} command 2436@c from freely available web servers as well, but that 2437@c would open up a can of worms in that the users next 2438@c questions are likely to be "where do I get it?" and 2439@c "how do I use it?" 2440@c Also note that htpasswd, at least the version I had, 2441@c likes to clobber the third field. 2442 2443@node Password authentication client 2444@subsubsection Using the client with password authentication 2445@cindex Login (subcommand) 2446@cindex Password client, using 2447@cindex Authenticated client, using 2448@cindex :pserver:, setting up 2449To run a @sc{cvs} command on a remote repository via 2450the password-authenticating server, one specifies the 2451@code{pserver} protocol, username, repository host, and 2452path to the repository. For example: 2453 2454@example 2455cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout someproj 2456@end example 2457 2458or 2459 2460@example 2461CVSROOT=:pserver:bach@@faun.example.org:/usr/local/cvsroot 2462cvs checkout someproj 2463@end example 2464 2465However, unless you're connecting to a public-access 2466repository (i.e., one where that username doesn't 2467require a password), you'll need to @dfn{log in} first. 2468Logging in verifies your password with the repository. 2469It's done with the @code{login} command, which will 2470prompt you interactively for the password: 2471 2472@example 2473cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login 2474CVS password: 2475@end example 2476 2477After you enter the password, @sc{cvs} verifies it with 2478the server. If the verification succeeds, then that 2479combination of username, host, repository, and password 2480is permanently recorded, so future transactions with 2481that repository won't require you to run @code{cvs 2482login}. (If verification fails, @sc{cvs} will exit 2483complaining that the password was incorrect, and 2484nothing will be recorded.) 2485 2486The records are stored, by default, in the file 2487@file{$HOME/.cvspass}. That file's format is 2488human-readable, and to a degree human-editable, but 2489note that the passwords are not stored in 2490cleartext---they are trivially encoded to protect them 2491from "innocent" compromise (i.e., inadvertent viewing 2492by a system administrator or other non-malicious 2493person). 2494 2495@cindex CVS_PASSFILE, environment variable 2496You can change the default location of this file by 2497setting the @code{CVS_PASSFILE} environment variable. 2498If you use this variable, make sure you set it 2499@emph{before} @code{cvs login} is run. If you were to 2500set it after running @code{cvs login}, then later 2501@sc{cvs} commands would be unable to look up the 2502password for transmission to the server. 2503 2504Once you have logged in, all @sc{cvs} commands using 2505that remote repository and username will authenticate 2506with the stored password. So, for example 2507 2508@example 2509cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo 2510@end example 2511 2512should just work (unless the password changes on the 2513server side, in which case you'll have to re-run 2514@code{cvs login}). 2515 2516Note that if the @samp{:pserver:} were not present in 2517the repository specification, @sc{cvs} would assume it 2518should use @code{rsh} to connect with the server 2519instead (@pxref{Connecting via rsh}). 2520 2521Of course, once you have a working copy checked out and 2522are running @sc{cvs} commands from within it, there is 2523no longer any need to specify the repository 2524explicitly, because @sc{cvs} can deduce the repository 2525from the working copy's @file{CVS} subdirectory. 2526 2527@c FIXME: seems to me this needs somewhat more 2528@c explanation. 2529@cindex Logout (subcommand) 2530The password for a given remote repository can be 2531removed from the @code{CVS_PASSFILE} by using the 2532@code{cvs logout} command. 2533 2534@node Password authentication security 2535@subsubsection Security considerations with password authentication 2536 2537@cindex Security, of pserver 2538The passwords are stored on the client side in a 2539trivial encoding of the cleartext, and transmitted in 2540the same encoding. The encoding is done only to 2541prevent inadvertent password compromises (i.e., a 2542system administrator accidentally looking at the file), 2543and will not prevent even a naive attacker from gaining 2544the password. 2545 2546@c FIXME: The bit about "access to the repository 2547@c implies general access to the system is *not* specific 2548@c to pserver; it applies to kerberos and SSH and 2549@c everything else too. Should reorganize the 2550@c documentation to make this clear. 2551The separate @sc{cvs} password file (@pxref{Password 2552authentication server}) allows people 2553to use a different password for repository access than 2554for login access. On the other hand, once a user has 2555non-read-only 2556access to the repository, she can execute programs on 2557the server system through a variety of means. Thus, repository 2558access implies fairly broad system access as well. It 2559might be possible to modify @sc{cvs} to prevent that, 2560but no one has done so as of this writing. 2561@c OpenBSD uses chroot() and copies the repository to 2562@c provide anonymous read-only access (for details see 2563@c http://www.openbsd.org/anoncvs.shar). While this 2564@c closes the most obvious holes, I'm not sure it 2565@c closes enough holes to recommend it (plus it is 2566@c *very* easy to accidentally screw up a setup of this 2567@c type). 2568 2569Note that because the @file{$CVSROOT/CVSROOT} directory 2570contains @file{passwd} and other files which are used 2571to check security, you must control the permissions on 2572this directory as tightly as the permissions on 2573@file{/etc}. The same applies to the @file{$CVSROOT} 2574directory itself and any directory 2575above it in the tree. Anyone who has write access to 2576such a directory will have the ability to become any 2577user on the system. Note that these permissions are 2578typically tighter than you would use if you are not 2579using pserver. 2580@c TODO: Would be really nice to document/implement a 2581@c scheme where the CVS server can run as some non-root 2582@c user, e.g. "cvs". CVSROOT/passwd would contain a 2583@c bunch of entries of the form foo:xxx:cvs (or the "cvs" 2584@c would be implicit). This would greatly reduce 2585@c security risks such as those hinted at in the 2586@c previous paragraph. I think minor changes to CVS 2587@c might be required but mostly this would just need 2588@c someone who wants to play with it, document it, &c. 2589 2590In summary, anyone who gets the password gets 2591repository access (which may imply some measure of general system 2592access as well). The password is available to anyone 2593who can sniff network packets or read a protected 2594(i.e., user read-only) file. If you want real 2595security, get Kerberos. 2596 2597@node GSSAPI authenticated 2598@subsection Direct connection with GSSAPI 2599 2600@cindex GSSAPI 2601@cindex Security, GSSAPI 2602@cindex :gserver:, setting up 2603@cindex Kerberos, using :gserver: 2604GSSAPI is a generic interface to network security 2605systems such as Kerberos 5. 2606If you have a working GSSAPI library, you can have 2607@sc{cvs} connect via a direct @sc{tcp} connection, 2608authenticating with GSSAPI. 2609 2610To do this, @sc{cvs} needs to be compiled with GSSAPI 2611support; when configuring @sc{cvs} it tries to detect 2612whether GSSAPI libraries using kerberos version 5 are 2613present. You can also use the @file{--with-gssapi} 2614flag to configure. 2615 2616The connection is authenticated using GSSAPI, but the 2617message stream is @emph{not} authenticated by default. 2618You must use the @code{-a} global option to request 2619stream authentication. 2620 2621The data transmitted is @emph{not} encrypted by 2622default. Encryption support must be compiled into both 2623the client and the server; use the 2624@file{--enable-encrypt} configure option to turn it on. 2625You must then use the @code{-x} global option to 2626request encryption. 2627 2628GSSAPI connections are handled on the server side by 2629the same server which handles the password 2630authentication server; see @ref{Password authentication 2631server}. If you are using a GSSAPI mechanism such as 2632Kerberos which provides for strong authentication, you 2633will probably want to disable the ability to 2634authenticate via cleartext passwords. To do so, create 2635an empty @file{CVSROOT/passwd} password file, and set 2636@code{SystemAuth=no} in the config file 2637(@pxref{config}). 2638 2639The GSSAPI server uses a principal name of 2640cvs/@var{hostname}, where @var{hostname} is the 2641canonical name of the server host. You will have to 2642set this up as required by your GSSAPI mechanism. 2643 2644To connect using GSSAPI, use @samp{:gserver:}. For 2645example, 2646 2647@example 2648cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo 2649@end example 2650 2651@node Kerberos authenticated 2652@subsection Direct connection with kerberos 2653 2654@cindex Kerberos, using :kserver: 2655@cindex Security, kerberos 2656@cindex :kserver:, setting up 2657The easiest way to use kerberos is to use the kerberos 2658@code{rsh}, as described in @ref{Connecting via rsh}. 2659The main disadvantage of using rsh is that all the data 2660needs to pass through additional programs, so it may be 2661slower. So if you have kerberos installed you can 2662connect via a direct @sc{tcp} connection, 2663authenticating with kerberos. 2664 2665This section concerns the kerberos network security 2666system, version 4. Kerberos version 5 is supported via 2667the GSSAPI generic network security interface, as 2668described in the previous section. 2669 2670To do this, @sc{cvs} needs to be compiled with kerberos 2671support; when configuring @sc{cvs} it tries to detect 2672whether kerberos is present or you can use the 2673@file{--with-krb4} flag to configure. 2674 2675The data transmitted is @emph{not} encrypted by 2676default. Encryption support must be compiled into both 2677the client and server; use the 2678@file{--enable-encryption} configure option to turn it 2679on. You must then use the @code{-x} global option to 2680request encryption. 2681 2682@cindex CVS_CLIENT_PORT 2683You need to edit @file{inetd.conf} on the server 2684machine to run @code{cvs kserver}. The client uses 2685port 1999 by default; if you want to use another port 2686specify it in the @code{CVS_CLIENT_PORT} environment 2687variable on the client. 2688 2689@cindex kinit 2690When you want to use @sc{cvs}, get a ticket in the 2691usual way (generally @code{kinit}); it must be a ticket 2692which allows you to log into the server machine. Then 2693you are ready to go: 2694 2695@example 2696cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo 2697@end example 2698 2699Previous versions of @sc{cvs} would fall back to a 2700connection via rsh; this version will not do so. 2701 2702@node Connecting via fork 2703@subsection Connecting with fork 2704 2705@cindex fork, access method 2706@cindex :fork:, setting up 2707This access method allows you to connect to a 2708repository on your local disk via the remote protocol. 2709In other words it does pretty much the same thing as 2710@code{:local:}, but various quirks, bugs and the like are 2711those of the remote @sc{cvs} rather than the local 2712@sc{cvs}. 2713 2714For day-to-day operations you might prefer either 2715@code{:local:} or @code{:fork:}, depending on your 2716preferences. Of course @code{:fork:} comes in 2717particularly handy in testing or 2718debugging @code{cvs} and the remote protocol. 2719Specifically, we avoid all of the network-related 2720setup/configuration, timeouts, and authentication 2721inherent in the other remote access methods but still 2722create a connection which uses the remote protocol. 2723 2724To connect using the @code{fork} method, use 2725@samp{:fork:} and the pathname to your local 2726repository. For example: 2727 2728@example 2729cvs -d :fork:/usr/local/cvsroot checkout foo 2730@end example 2731 2732@cindex CVS_SERVER, and :fork: 2733As with @code{:ext:}, the server is called @samp{cvs} 2734by default, or the value of the @code{CVS_SERVER} 2735environment variable. 2736 2737@c --------------------------------------------------------------------- 2738@node Read-only access 2739@section Read-only repository access 2740@cindex Read-only repository access 2741@cindex readers (admin file) 2742@cindex writers (admin file) 2743 2744 It is possible to grant read-only repository 2745access to people using the password-authenticated 2746server (@pxref{Password authenticated}). (The 2747other access methods do not have explicit support for 2748read-only users because those methods all assume login 2749access to the repository machine anyway, and therefore 2750the user can do whatever local file permissions allow 2751her to do.) 2752 2753 A user who has read-only access can do only 2754those @sc{cvs} operations which do not modify the 2755repository, except for certain ``administrative'' files 2756(such as lock files and the history file). It may be 2757desirable to use this feature in conjunction with 2758user-aliasing (@pxref{Password authentication server}). 2759 2760Unlike with previous versions of @sc{cvs}, read-only 2761users should be able merely to read the repository, and 2762not to execute programs on the server or otherwise gain 2763unexpected levels of access. Or to be more accurate, 2764the @emph{known} holes have been plugged. Because this 2765feature is new and has not received a comprehensive 2766security audit, you should use whatever level of 2767caution seems warranted given your attitude concerning 2768security. 2769 2770 There are two ways to specify read-only access 2771for a user: by inclusion, and by exclusion. 2772 2773 "Inclusion" means listing that user 2774specifically in the @file{$CVSROOT/CVSROOT/readers} 2775file, which is simply a newline-separated list of 2776users. Here is a sample @file{readers} file: 2777 2778@example 2779melissa 2780splotnik 2781jrandom 2782@end example 2783 2784 (Don't forget the newline after the last user.) 2785 2786 "Exclusion" means explicitly listing everyone 2787who has @emph{write} access---if the file 2788 2789@example 2790$CVSROOT/CVSROOT/writers 2791@end example 2792 2793@noindent 2794exists, then only 2795those users listed in it have write access, and 2796everyone else has read-only access (of course, even the 2797read-only users still need to be listed in the 2798@sc{cvs} @file{passwd} file). The 2799@file{writers} file has the same format as the 2800@file{readers} file. 2801 2802 Note: if your @sc{cvs} @file{passwd} 2803file maps cvs users onto system users (@pxref{Password 2804authentication server}), make sure you deny or grant 2805read-only access using the @emph{cvs} usernames, not 2806the system usernames. That is, the @file{readers} and 2807@file{writers} files contain cvs usernames, which may 2808or may not be the same as system usernames. 2809 2810 Here is a complete description of the server's 2811behavior in deciding whether to grant read-only or 2812read-write access: 2813 2814 If @file{readers} exists, and this user is 2815listed in it, then she gets read-only access. Or if 2816@file{writers} exists, and this user is NOT listed in 2817it, then she also gets read-only access (this is true 2818even if @file{readers} exists but she is not listed 2819there). Otherwise, she gets full read-write access. 2820 2821 Of course there is a conflict if the user is 2822listed in both files. This is resolved in the more 2823conservative way, it being better to protect the 2824repository too much than too little: such a user gets 2825read-only access. 2826 2827@node Server temporary directory 2828@section Temporary directories for the server 2829@cindex Temporary directories, and server 2830@cindex Server, temporary directories 2831 2832While running, the @sc{cvs} server creates temporary 2833directories. They are named 2834 2835@example 2836cvs-serv@var{pid} 2837@end example 2838 2839@noindent 2840where @var{pid} is the process identification number of 2841the server. They are located in the directory 2842specified by the @code{TMPDIR} environment variable 2843(@pxref{Environment variables}), the @samp{-T} global 2844option (@pxref{Global options}), or failing that 2845@file{/tmp}. 2846 2847In most cases the server will remove the temporary 2848directory when it is done, whether it finishes normally 2849or abnormally. However, there are a few cases in which 2850the server does not or cannot remove the temporary 2851directory, for example: 2852 2853@itemize @bullet 2854@item 2855If the server aborts due to an internal server error, 2856it may preserve the directory to aid in debugging 2857 2858@item 2859If the server is killed in a way that it has no way of 2860cleaning up (most notably, @samp{kill -KILL} on unix). 2861 2862@item 2863If the system shuts down without an orderly shutdown, 2864which tells the server to clean up. 2865@end itemize 2866 2867In cases such as this, you will need to manually remove 2868the @file{cvs-serv@var{pid}} directories. As long as 2869there is no server running with process identification 2870number @var{pid}, it is safe to do so. 2871 2872@c --------------------------------------------------------------------- 2873@node Starting a new project 2874@chapter Starting a project with CVS 2875@cindex Starting a project with CVS 2876@cindex Creating a project 2877 2878@comment --moduledb-- 2879Because renaming files and moving them between 2880directories is somewhat inconvenient, the first thing 2881you do when you start a new project should be to think 2882through your file organization. It is not impossible 2883to rename or move files, but it does increase the 2884potential for confusion and @sc{cvs} does have some 2885quirks particularly in the area of renaming 2886directories. @xref{Moving files}. 2887 2888What to do next depends on the situation at hand. 2889 2890@menu 2891* Setting up the files:: Getting the files into the repository 2892* Defining the module:: How to make a module of the files 2893@end menu 2894@c -- File permissions! 2895 2896@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2897@node Setting up the files 2898@section Setting up the files 2899 2900The first step is to create the files inside the repository. This can 2901be done in a couple of different ways. 2902 2903@c -- The contributed scripts 2904@menu 2905* From files:: This method is useful with old projects 2906 where files already exists. 2907* From other version control systems:: Old projects where you want to 2908 preserve history from another system. 2909* From scratch:: Creating a directory tree from scratch. 2910@end menu 2911 2912@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2913@node From files 2914@subsection Creating a directory tree from a number of files 2915@cindex Importing files 2916 2917When you begin using @sc{cvs}, you will probably already have several 2918projects that can be 2919put under @sc{cvs} control. In these cases the easiest way is to use the 2920@code{import} command. An example is probably the easiest way to 2921explain how to use it. If the files you want to install in 2922@sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the 2923repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this: 2924 2925@example 2926$ cd @var{wdir} 2927$ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start 2928@end example 2929 2930Unless you supply a log message with the @samp{-m} 2931flag, @sc{cvs} starts an editor and prompts for a 2932message. The string @samp{yoyo} is a @dfn{vendor tag}, 2933and @samp{start} is a @dfn{release tag}. They may fill 2934no purpose in this context, but since @sc{cvs} requires 2935them they must be present. @xref{Tracking sources}, for 2936more information about them. 2937 2938You can now verify that it worked, and remove your 2939original source directory. 2940@c FIXME: Need to say more about "verify that it 2941@c worked". What should the user look for in the output 2942@c from "diff -r"? 2943 2944@example 2945$ cd .. 2946$ cvs checkout yoyodyne/@var{rdir} # @r{Explanation below} 2947$ diff -r @var{wdir} yoyodyne/@var{rdir} 2948$ rm -r @var{wdir} 2949@end example 2950 2951@noindent 2952Erasing the original sources is a good idea, to make sure that you do 2953not accidentally edit them in @var{wdir}, bypassing @sc{cvs}. 2954Of course, it would be wise to make sure that you have 2955a backup of the sources before you remove them. 2956 2957The @code{checkout} command can either take a module 2958name as argument (as it has done in all previous 2959examples) or a path name relative to @code{$CVSROOT}, 2960as it did in the example above. 2961 2962It is a good idea to check that the permissions 2963@sc{cvs} sets on the directories inside @code{$CVSROOT} 2964are reasonable, and that they belong to the proper 2965groups. @xref{File permissions}. 2966 2967If some of the files you want to import are binary, you 2968may want to use the wrappers features to specify which 2969files are binary and which are not. @xref{Wrappers}. 2970 2971@c The node name is too long, but I am having trouble 2972@c thinking of something more concise. 2973@node From other version control systems 2974@subsection Creating Files From Other Version Control Systems 2975@cindex Importing files, from other version control systems 2976 2977If you have a project which you are maintaining with 2978another version control system, such as @sc{rcs}, you 2979may wish to put the files from that project into 2980@sc{cvs}, and preserve the revision history of the 2981files. 2982 2983@table @asis 2984@cindex RCS, importing files from 2985@item From RCS 2986If you have been using @sc{rcs}, find the @sc{rcs} 2987files---usually a file named @file{foo.c} will have its 2988@sc{rcs} file in @file{RCS/foo.c,v} (but it could be 2989other places; consult the @sc{rcs} documentation for 2990details). Then create the appropriate directories in 2991@sc{cvs} if they do not already exist. Then copy the 2992files into the appropriate directories in the @sc{cvs} 2993repository (the name in the repository must be the name 2994of the source file with @samp{,v} added; the files go 2995directly in the appropriate directory of the repository, 2996not in an @file{RCS} subdirectory). This is one of the 2997few times when it is a good idea to access the @sc{cvs} 2998repository directly, rather than using @sc{cvs} 2999commands. Then you are ready to check out a new 3000working directory. 3001@c Someday there probably should be a "cvs import -t 3002@c rcs" or some such. It could even create magic 3003@c branches. It could also do something about the case 3004@c where the RCS file had a (non-magic) "0" branch. 3005 3006The @sc{rcs} file should not be locked when you move it 3007into @sc{cvs}; if it is, @sc{cvs} will have trouble 3008letting you operate on it. 3009@c What is the easiest way to unlock your files if you 3010@c have them locked? Especially if you have a lot of them? 3011@c This is a CVS bug/misfeature; importing RCS files 3012@c should ignore whether they are locked and leave them in 3013@c an unlocked state. Yet another reason for a separate 3014@c "import RCS file" command. 3015 3016@c How many is "many"? Or do they just import RCS files? 3017@item From another version control system 3018Many version control systems have the ability to export 3019@sc{rcs} files in the standard format. If yours does, 3020export the @sc{rcs} files and then follow the above 3021instructions. 3022 3023Failing that, probably your best bet is to write a 3024script that will check out the files one revision at a 3025time using the command line interface to the other 3026system, and then check the revisions into @sc{cvs}. 3027The @file{sccs2rcs} script mentioned below may be a 3028useful example to follow. 3029 3030@cindex SCCS, importing files from 3031@item From SCCS 3032There is a script in the @file{contrib} directory of 3033the @sc{cvs} source distribution called @file{sccs2rcs} 3034which converts @sc{sccs} files to @sc{rcs} files. 3035Note: you must run it on a machine which has both 3036@sc{sccs} and @sc{rcs} installed, and like everything 3037else in contrib it is unsupported (your mileage may 3038vary). 3039 3040@cindex PVCS, importing files from 3041@item From PVCS 3042There is a script in the @file{contrib} directory of 3043the @sc{cvs} source distribution called @file{pvcs_to_rcs} 3044which converts @sc{pvcs} archives to @sc{rcs} files. 3045You must run it on a machine which has both 3046@sc{pvcs} and @sc{rcs} installed, and like everything 3047else in contrib it is unsupported (your mileage may 3048vary). See the comments in the script for details. 3049@end table 3050@c CMZ and/or PATCHY were systems that were used in the 3051@c high energy physics community (especially for 3052@c CERNLIB). CERN has replaced them with CVS, but the 3053@c CAR format seems to live on as a way to submit 3054@c changes. There is a program car2cvs which converts 3055@c but I'm not sure where one gets a copy. 3056@c Not sure it is worth mentioning here, since it would 3057@c appear to affect only one particular community. 3058@c Best page for more information is: 3059@c http://wwwcn1.cern.ch/asd/cvs/index.html 3060@c See also: 3061@c http://ecponion.cern.ch/ecpsa/cernlib.html 3062 3063@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3064@node From scratch 3065@subsection Creating a directory tree from scratch 3066 3067@c Also/instead should be documenting 3068@c $ cvs co -l . 3069@c $ mkdir tc 3070@c $ cvs add tc 3071@c $ cd tc 3072@c $ mkdir man 3073@c $ cvs add man 3074@c etc. 3075@c Using import to create the directories only is 3076@c probably a somewhat confusing concept. 3077For a new project, the easiest thing to do is probably 3078to create an empty directory structure, like this: 3079 3080@example 3081$ mkdir tc 3082$ mkdir tc/man 3083$ mkdir tc/testing 3084@end example 3085 3086After that, you use the @code{import} command to create 3087the corresponding (empty) directory structure inside 3088the repository: 3089 3090@example 3091$ cd tc 3092$ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start 3093@end example 3094 3095Then, use @code{add} to add files (and new directories) 3096as they appear. 3097 3098Check that the permissions @sc{cvs} sets on the 3099directories inside @code{$CVSROOT} are reasonable. 3100 3101@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3102@node Defining the module 3103@section Defining the module 3104@cindex Defining a module 3105@cindex Editing the modules file 3106@cindex Module, defining 3107@cindex Modules file, changing 3108 3109The next step is to define the module in the 3110@file{modules} file. This is not strictly necessary, 3111but modules can be convenient in grouping together 3112related files and directories. 3113 3114In simple cases these steps are sufficient to define a module. 3115 3116@enumerate 3117@item 3118Get a working copy of the modules file. 3119 3120@example 3121$ cvs checkout CVSROOT/modules 3122$ cd CVSROOT 3123@end example 3124 3125@item 3126Edit the file and insert a line that defines the module. @xref{Intro 3127administrative files}, for an introduction. @xref{modules}, for a full 3128description of the modules file. You can use the 3129following line to define the module @samp{tc}: 3130 3131@example 3132tc yoyodyne/tc 3133@end example 3134 3135@item 3136Commit your changes to the modules file. 3137 3138@example 3139$ cvs commit -m "Added the tc module." modules 3140@end example 3141 3142@item 3143Release the modules module. 3144 3145@example 3146$ cd .. 3147$ cvs release -d CVSROOT 3148@end example 3149@end enumerate 3150 3151@c --------------------------------------------------------------------- 3152@node Revisions 3153@chapter Revisions 3154 3155For many uses of @sc{cvs}, one doesn't need to worry 3156too much about revision numbers; @sc{cvs} assigns 3157numbers such as @code{1.1}, @code{1.2}, and so on, and 3158that is all one needs to know. However, some people 3159prefer to have more knowledge and control concerning 3160how @sc{cvs} assigns revision numbers. 3161 3162If one wants to keep track of a set of revisions 3163involving more than one file, such as which revisions 3164went into a particular release, one uses a @dfn{tag}, 3165which is a symbolic revision which can be assigned to a 3166numeric revision in each file. 3167 3168@menu 3169* Revision numbers:: The meaning of a revision number 3170* Versions revisions releases:: Terminology used in this manual 3171* Assigning revisions:: Assigning revisions 3172* Tags:: Tags--Symbolic revisions 3173* Tagging the working directory:: The cvs tag command 3174* Tagging by date/tag:: The cvs rtag command 3175* Modifying tags:: Adding, renaming, and deleting tags 3176* Tagging add/remove:: Tags with adding and removing files 3177* Sticky tags:: Certain tags are persistent 3178@end menu 3179 3180@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3181@node Revision numbers 3182@section Revision numbers 3183@cindex Revision numbers 3184@cindex Revision tree 3185@cindex Linear development 3186@cindex Number, revision- 3187@cindex Decimal revision number 3188@cindex Branch number 3189@cindex Number, branch 3190 3191Each version of a file has a unique @dfn{revision 3192number}. Revision numbers look like @samp{1.1}, 3193@samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}. 3194A revision number always has an even number of 3195period-separated decimal integers. By default revision 31961.1 is the first revision of a file. Each successive 3197revision is given a new number by increasing the 3198rightmost number by one. The following figure displays 3199a few revisions, with newer revisions to the right. 3200 3201@example 3202 +-----+ +-----+ +-----+ +-----+ +-----+ 3203 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 3204 +-----+ +-----+ +-----+ +-----+ +-----+ 3205@end example 3206 3207It is also possible to end up with numbers containing 3208more than one period, for example @samp{1.3.2.2}. Such 3209revisions represent revisions on branches 3210(@pxref{Branching and merging}); such revision numbers 3211are explained in detail in @ref{Branches and 3212revisions}. 3213 3214@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3215@node Versions revisions releases 3216@section Versions, revisions and releases 3217@cindex Revisions, versions and releases 3218@cindex Versions, revisions and releases 3219@cindex Releases, revisions and versions 3220 3221A file can have several versions, as described above. 3222Likewise, a software product can have several versions. 3223A software product is often given a version number such 3224as @samp{4.1.1}. 3225 3226Versions in the first sense are called @dfn{revisions} 3227in this document, and versions in the second sense are 3228called @dfn{releases}. To avoid confusion, the word 3229@dfn{version} is almost never used in this document. 3230 3231@node Assigning revisions 3232@section Assigning revisions 3233 3234@c We avoid the "major revision" terminology. It seems 3235@c like jargon. Hopefully "first number" is clear enough. 3236By default, @sc{cvs} will assign numeric revisions by 3237leaving the first number the same and incrementing the 3238second number. For example, @code{1.1}, @code{1.2}, 3239@code{1.3}, etc. 3240 3241When adding a new file, the second number will always 3242be one and the first number will equal the highest 3243first number of any file in that directory. For 3244example, the current directory contains files whose 3245highest numbered revisions are @code{1.7}, @code{3.1}, 3246and @code{4.12}, then an added file will be given the 3247numeric revision @code{4.1}. 3248 3249@c This is sort of redundant with something we said a 3250@c while ago. Somewhere we need a better way of 3251@c introducing how the first number can be anything 3252@c except "1", perhaps. Also I don't think this 3253@c presentation is clear on why we are discussing releases 3254@c and first numbers of numeric revisions in the same 3255@c breath. 3256Normally there is no reason to care 3257about the revision numbers---it is easier to treat them 3258as internal numbers that @sc{cvs} maintains, and tags 3259provide a better way to distinguish between things like 3260release 1 versus release 2 of your product 3261(@pxref{Tags}). However, if you want to set the 3262numeric revisions, the @samp{-r} option to @code{cvs 3263commit} can do that. The @samp{-r} option implies the 3264@samp{-f} option, in the sense that it causes the 3265files to be committed even if they are not modified. 3266 3267For example, to bring all your files up to 3268revision 3.0 (including those that haven't changed), 3269you might invoke: 3270 3271@example 3272$ cvs commit -r 3.0 3273@end example 3274 3275Note that the number you specify with @samp{-r} must be 3276larger than any existing revision number. That is, if 3277revision 3.0 exists, you cannot @samp{cvs commit 3278-r 1.3}. If you want to maintain several releases in 3279parallel, you need to use a branch (@pxref{Branching and merging}). 3280 3281@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3282@node Tags 3283@section Tags--Symbolic revisions 3284@cindex Tags 3285 3286The revision numbers live a life of their own. They 3287need not have anything at all to do with the release 3288numbers of your software product. Depending 3289on how you use @sc{cvs} the revision numbers might change several times 3290between two releases. As an example, some of the 3291source files that make up @sc{rcs} 5.6 have the following 3292revision numbers: 3293@cindex RCS revision numbers 3294 3295@example 3296ci.c 5.21 3297co.c 5.9 3298ident.c 5.3 3299rcs.c 5.12 3300rcsbase.h 5.11 3301rcsdiff.c 5.10 3302rcsedit.c 5.11 3303rcsfcmp.c 5.9 3304rcsgen.c 5.10 3305rcslex.c 5.11 3306rcsmap.c 5.2 3307rcsutil.c 5.10 3308@end example 3309 3310@cindex tag, command, introduction 3311@cindex Tag, symbolic name 3312@cindex Symbolic name (tag) 3313@cindex Name, symbolic (tag) 3314@cindex HEAD, as reserved tag name 3315@cindex BASE, as reserved tag name 3316You can use the @code{tag} command to give a symbolic name to a 3317certain revision of a file. You can use the @samp{-v} flag to the 3318@code{status} command to see all tags that a file has, and 3319which revision numbers they represent. Tag names must 3320start with an uppercase or lowercase letter and can 3321contain uppercase and lowercase letters, digits, 3322@samp{-}, and @samp{_}. The two tag names @code{BASE} 3323and @code{HEAD} are reserved for use by @sc{cvs}. It 3324is expected that future names which are special to 3325@sc{cvs} will be specially named, for example by 3326starting with @samp{.}, rather than being named analogously to 3327@code{BASE} and @code{HEAD}, to avoid conflicts with 3328actual tag names. 3329@c Including a character such as % or = has also been 3330@c suggested as the naming convention for future 3331@c special tag names. Starting with . is nice because 3332@c that is not a legal tag name as far as RCS is concerned. 3333@c FIXME: CVS actually accepts quite a few characters 3334@c in tag names, not just the ones documented above 3335@c (see RCS_check_tag). RCS 3336@c defines legitimate tag names by listing illegal 3337@c characters rather than legal ones. CVS is said to lose its 3338@c mind if you try to use "/" (try making such a tag sticky 3339@c and using "cvs status" client/server--see remote 3340@c protocol format for entries line for probable cause). 3341@c TODO: The testsuite 3342@c should test for whatever are documented above as 3343@c officially-OK tag names, and CVS should at least reject 3344@c characters that won't work, like "/". 3345 3346You'll want to choose some convention for naming tags, 3347based on information such as the name of the program 3348and the version number of the release. For example, 3349one might take the name of the program, immediately 3350followed by the version number with @samp{.} changed to 3351@samp{-}, so that CVS 1.9 would be tagged with the name 3352@code{cvs1-9}. If you choose a consistent convention, 3353then you won't constantly be guessing whether a tag is 3354@code{cvs-1-9} or @code{cvs1_9} or what. You might 3355even want to consider enforcing your convention in the 3356taginfo file (@pxref{user-defined logging}). 3357@c Might be nice to say more about using taginfo this 3358@c way, like giving an example, or pointing out any particular 3359@c issues which arise. 3360 3361@cindex Adding a tag 3362@cindex Tag, example 3363The following example shows how you can add a tag to a 3364file. The commands must be issued inside your working 3365directory. That is, you should issue the 3366command in the directory where @file{backend.c} 3367resides. 3368 3369@example 3370$ cvs tag rel-0-4 backend.c 3371T backend.c 3372$ cvs status -v backend.c 3373=================================================================== 3374File: backend.c Status: Up-to-date 3375 3376 Version: 1.4 Tue Dec 1 14:39:01 1992 3377 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 3378 Sticky Tag: (none) 3379 Sticky Date: (none) 3380 Sticky Options: (none) 3381 3382 Existing Tags: 3383 rel-0-4 (revision: 1.4) 3384 3385@end example 3386 3387For a complete summary of the syntax of @code{cvs tag}, 3388including the various options, see @ref{Invoking CVS}. 3389 3390There is seldom reason to tag a file in isolation. A more common use is 3391to tag all the files that constitute a module with the same tag at 3392strategic points in the development life-cycle, such as when a release 3393is made. 3394 3395@example 3396$ cvs tag rel-1-0 . 3397cvs tag: Tagging . 3398T Makefile 3399T backend.c 3400T driver.c 3401T frontend.c 3402T parser.c 3403@end example 3404 3405(When you give @sc{cvs} a directory as argument, it generally applies the 3406operation to all the files in that directory, and (recursively), to any 3407subdirectories that it may contain. @xref{Recursive behavior}.) 3408 3409@cindex Retrieving an old revision using tags 3410@cindex Tag, retrieving old revisions 3411The @code{checkout} command has a flag, @samp{-r}, that lets you check out 3412a certain revision of a module. This flag makes it easy to 3413retrieve the sources that make up release 1.0 of the module @samp{tc} at 3414any time in the future: 3415 3416@example 3417$ cvs checkout -r rel-1-0 tc 3418@end example 3419 3420@noindent 3421This is useful, for instance, if someone claims that there is a bug in 3422that release, but you cannot find the bug in the current working copy. 3423 3424You can also check out a module as it was at any given date. 3425@xref{checkout options}. When specifying @samp{-r} to 3426any of these commands, you will need beware of sticky 3427tags; see @ref{Sticky tags}. 3428 3429When you tag more than one file with the same tag you 3430can think about the tag as "a curve drawn through a 3431matrix of filename vs. revision number." Say we have 5 3432files with the following revisions: 3433 3434@example 3435@group 3436 file1 file2 file3 file4 file5 3437 3438 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG 3439 1.2*- 1.2 1.2 -1.2*- 3440 1.3 \- 1.3*- 1.3 / 1.3 3441 1.4 \ 1.4 / 1.4 3442 \-1.5*- 1.5 3443 1.6 3444@end group 3445@end example 3446 3447At some time in the past, the @code{*} versions were tagged. 3448You can think of the tag as a handle attached to the curve 3449drawn through the tagged revisions. When you pull on 3450the handle, you get all the tagged revisions. Another 3451way to look at it is that you "sight" through a set of 3452revisions that is "flat" along the tagged revisions, 3453like this: 3454 3455@example 3456@group 3457 file1 file2 file3 file4 file5 3458 3459 1.1 3460 1.2 3461 1.1 1.3 _ 3462 1.1 1.2 1.4 1.1 / 3463 1.2*----1.3*----1.5*----1.2*----1.1 (--- <--- Look here 3464 1.3 1.6 1.3 \_ 3465 1.4 1.4 3466 1.5 3467@end group 3468@end example 3469 3470@node Tagging the working directory 3471@section Specifying what to tag from the working directory 3472 3473@cindex tag (subcommand) 3474The example in the previous section demonstrates one of 3475the most common ways to choose which revisions to tag. 3476Namely, running the @code{cvs tag} command without 3477arguments causes @sc{cvs} to select the revisions which 3478are checked out in the current working directory. For 3479example, if the copy of @file{backend.c} in working 3480directory was checked out from revision 1.4, then 3481@sc{cvs} will tag revision 1.4. Note that the tag is 3482applied immediately to revision 1.4 in the repository; 3483tagging is not like modifying a file, or other 3484operations in which one first modifies the working 3485directory and then runs @code{cvs commit} to transfer 3486that modification to the repository. 3487 3488One potentially surprising aspect of the fact that 3489@code{cvs tag} operates on the repository is that you 3490are tagging the checked-in revisions, which may differ 3491from locally modified files in your working directory. 3492If you want to avoid doing this by mistake, specify the 3493@samp{-c} option to @code{cvs tag}. If there are any 3494locally modified files, @sc{cvs} will abort with an 3495error before it tags any files: 3496 3497@example 3498$ cvs tag -c rel-0-4 3499cvs tag: backend.c is locally modified 3500cvs [tag aborted]: correct the above errors first! 3501@end example 3502 3503@node Tagging by date/tag 3504@section Specifying what to tag by date or revision 3505@cindex rtag (subcommand) 3506 3507The @code{cvs rtag} command tags the repository as of a 3508certain date or time (or can be used to tag the latest 3509revision). @code{rtag} works directly on the 3510repository contents (it requires no prior checkout and 3511does not look for a working directory). 3512 3513The following options specify which date or revision to 3514tag. See @ref{Common options}, for a complete 3515description of them. 3516 3517@table @code 3518@item -D @var{date} 3519Tag the most recent revision no later than @var{date}. 3520 3521@item -f 3522Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}} 3523flags. If no matching revision is found, use the most 3524recent revision (instead of ignoring the file). 3525 3526@item -r @var{tag} 3527Only tag those files that contain existing tag @var{tag}. 3528@end table 3529 3530The @code{cvs tag} command also allows one to specify 3531files by revision or date, using the same @samp{-r}, 3532@samp{-D}, and @samp{-f} options. However, this 3533feature is probably not what you want. The reason is 3534that @code{cvs tag} chooses which files to tag based on 3535the files that exist in the working directory, rather 3536than the files which existed as of the given tag/date. 3537Therefore, you are generally better off using @code{cvs 3538rtag}. The exceptions might be cases like: 3539 3540@example 3541cvs tag -r 1.4 backend.c 3542@end example 3543 3544@node Modifying tags 3545@section Deleting, moving, and renaming tags 3546 3547@c Also see: 3548@c "How do I move or rename a magic branch tag?" 3549@c in the FAQ (I think the issues it talks about still 3550@c apply, but this could use some sanity.sh work). 3551 3552Normally one does not modify tags. They exist in order 3553to record the history of the repository and so deleting 3554them or changing their meaning would, generally, not be 3555what you want. 3556 3557However, there might be cases in which one uses a tag 3558temporarily or accidentally puts one in the wrong 3559place. Therefore, one might delete, move, or rename a 3560tag. Warning: the commands in this section are 3561dangerous; they permanently discard historical 3562information and it can difficult or impossible to 3563recover from errors. If you are a @sc{cvs} 3564administrator, you may consider restricting these 3565commands with taginfo (@pxref{user-defined logging}). 3566 3567@cindex Deleting tags 3568@cindex Removing tags 3569@cindex Tags, deleting 3570To delete a tag, specify the @samp{-d} option to either 3571@code{cvs tag} or @code{cvs rtag}. For example: 3572 3573@example 3574cvs rtag -d rel-0-4 tc 3575@end example 3576 3577deletes the tag @code{rel-0-4} from the module @code{tc}. 3578 3579@cindex Moving tags 3580@cindex Tags, moving 3581When we say @dfn{move} a tag, we mean to make the same 3582name point to different revisions. For example, the 3583@code{stable} tag may currently point to revision 1.4 3584of @file{backend.c} and perhaps we want to make it 3585point to revision 1.6. To move a tag, specify the 3586@samp{-F} option to either @code{cvs tag} or @code{cvs 3587rtag}. For example, the task just mentioned might be 3588accomplished as: 3589 3590@example 3591cvs tag -r 1.6 -F stable backend.c 3592@end example 3593 3594@cindex Renaming tags 3595@cindex Tags, renaming 3596When we say @dfn{rename} a tag, we mean to make a 3597different name point to the same revisions as the old 3598tag. For example, one may have misspelled the tag name 3599and want to correct it (hopefully before others are 3600relying on the old spelling). To rename a tag, first 3601create a new tag using the @samp{-r} option to 3602@code{cvs rtag}, and then delete the old name. This 3603leaves the new tag on exactly the same files as the old 3604tag. For example: 3605 3606@example 3607cvs rtag -r old-name-0-4 rel-0-4 tc 3608cvs rtag -d old-name-0-4 tc 3609@end example 3610 3611@node Tagging add/remove 3612@section Tagging and adding and removing files 3613 3614The subject of exactly how tagging interacts with 3615adding and removing files is somewhat obscure; for the 3616most part @sc{cvs} will keep track of whether files 3617exist or not without too much fussing. By default, 3618tags are applied to only files which have a revision 3619corresponding to what is being tagged. Files which did 3620not exist yet, or which were already removed, simply 3621omit the tag, and @sc{cvs} knows to treat the absence 3622of a tag as meaning that the file didn't exist as of 3623that tag. 3624 3625However, this can lose a small amount of information. 3626For example, suppose a file was added and then removed. 3627Then, if the tag is missing for that file, there is no 3628way to know whether the tag refers to the time before 3629the file was added, or the time after it was removed. 3630If you specify the @samp{-r} option to @code{cvs rtag}, 3631then @sc{cvs} tags the files which have been removed, 3632and thereby avoids this problem. For example, one 3633might specify @code{-r HEAD} to tag the head. 3634 3635On the subject of adding and removing files, the 3636@code{cvs rtag} command has a @samp{-a} option which 3637means to clear the tag from removed files that would 3638not otherwise be tagged. For example, one might 3639specify this option in conjunction with @samp{-F} when 3640moving a tag. If one moved a tag without @samp{-a}, 3641then the tag in the removed files might still refer to 3642the old revision, rather than reflecting the fact that 3643the file had been removed. I don't think this is 3644necessary if @samp{-r} is specified, as noted above. 3645 3646@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3647@node Sticky tags 3648@section Sticky tags 3649@cindex Sticky tags 3650@cindex Tags, sticky 3651 3652@c A somewhat related issue is per-directory sticky 3653@c tags (see comment at CVS/Tag in node Working 3654@c directory storage); we probably want to say 3655@c something like "you can set a sticky tag for only 3656@c some files, but you don't want to" or some such. 3657 3658Sometimes a working copy's revision has extra data 3659associated with it, for example it might be on a branch 3660(@pxref{Branching and merging}), or restricted to 3661versions prior to a certain date by @samp{checkout -D} 3662or @samp{update -D}. Because this data persists -- 3663that is, it applies to subsequent commands in the 3664working copy -- we refer to it as @dfn{sticky}. 3665 3666Most of the time, stickiness is an obscure aspect of 3667@sc{cvs} that you don't need to think about. However, 3668even if you don't want to use the feature, you may need 3669to know @emph{something} about sticky tags (for 3670example, how to avoid them!). 3671 3672You can use the @code{status} command to see if any 3673sticky tags or dates are set: 3674 3675@example 3676$ cvs status driver.c 3677=================================================================== 3678File: driver.c Status: Up-to-date 3679 3680 Version: 1.7.2.1 Sat Dec 5 19:35:03 1992 3681 RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v 3682 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 3683 Sticky Date: (none) 3684 Sticky Options: (none) 3685 3686@end example 3687 3688@cindex Resetting sticky tags 3689@cindex Sticky tags, resetting 3690@cindex Deleting sticky tags 3691The sticky tags will remain on your working files until 3692you delete them with @samp{cvs update -A}. The 3693@samp{-A} option retrieves the version of the file from 3694the head of the trunk, and forgets any sticky tags, 3695dates, or options. 3696 3697@cindex Sticky date 3698The most common use of sticky tags is to identify which 3699branch one is working on, as described in 3700@ref{Accessing branches}. However, non-branch 3701sticky tags have uses as well. For example, 3702suppose that you want to avoid updating your working 3703directory, to isolate yourself from possibly 3704destabilizing changes other people are making. You 3705can, of course, just refrain from running @code{cvs 3706update}. But if you want to avoid updating only a 3707portion of a larger tree, then sticky tags can help. 3708If you check out a certain revision (such as 1.4) it 3709will become sticky. Subsequent @code{cvs update} 3710commands will 3711not retrieve the latest revision until you reset the 3712tag with @code{cvs update -A}. Likewise, use of the 3713@samp{-D} option to @code{update} or @code{checkout} 3714sets a @dfn{sticky date}, which, similarly, causes that 3715date to be used for future retrievals. 3716 3717People often want to retrieve an old version of 3718a file without setting a sticky tag. This can 3719be done with the @samp{-p} option to @code{checkout} or 3720@code{update}, which sends the contents of the file to 3721standard output. For example: 3722@example 3723$ cvs update -p -r 1.1 file1 >file1 3724=================================================================== 3725Checking out file1 3726RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v 3727VERS: 1.1 3728*************** 3729$ 3730@end example 3731 3732However, this isn't the easiest way, if you are asking 3733how to undo a previous checkin (in this example, put 3734@file{file1} back to the way it was as of revision 37351.1). In that case you are better off using the 3736@samp{-j} option to @code{update}; for further 3737discussion see @ref{Merging two revisions}. 3738 3739@c --------------------------------------------------------------------- 3740@node Branching and merging 3741@chapter Branching and merging 3742@cindex Branching 3743@cindex Merging 3744@cindex Copying changes 3745@cindex Main trunk and branches 3746@cindex Revision tree, making branches 3747@cindex Branches, copying changes between 3748@cindex Changes, copying between branches 3749@cindex Modifications, copying between branches 3750 3751CVS allows you to isolate changes onto a separate 3752line of development, known as a @dfn{branch}. When you 3753change files on a branch, those changes do not appear 3754on the main trunk or other branches. 3755 3756Later you can move changes from one branch to another 3757branch (or the main trunk) by @dfn{merging}. Merging 3758involves first running @code{cvs update -j}, to merge 3759the changes into the working directory. 3760You can then commit that revision, and thus effectively 3761copy the changes onto another branch. 3762 3763@menu 3764* Branches motivation:: What branches are good for 3765* Creating a branch:: Creating a branch 3766* Accessing branches:: Checking out and updating branches 3767* Branches and revisions:: Branches are reflected in revision numbers 3768* Magic branch numbers:: Magic branch numbers 3769* Merging a branch:: Merging an entire branch 3770* Merging more than once:: Merging from a branch several times 3771* Merging two revisions:: Merging differences between two revisions 3772* Merging adds and removals:: What if files are added or removed? 3773* Merging and keywords:: Avoiding conflicts due to keyword substitution 3774@end menu 3775 3776@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3777@node Branches motivation 3778@section What branches are good for 3779@cindex Branches motivation 3780@cindex What branches are good for 3781@cindex Motivation for branches 3782 3783@c FIXME: this node mentions one way to use branches, 3784@c but it is by no means the only way. For example, 3785@c the technique of committing a new feature on a branch, 3786@c until it is ready for the main trunk. The whole 3787@c thing is generally speaking more akin to the 3788@c "Revision management" node although it isn't clear to 3789@c me whether policy matters should be centralized or 3790@c distributed throughout the relevant sections. 3791Suppose that release 1.0 of tc has been made. You are continuing to 3792develop tc, planning to create release 1.1 in a couple of months. After a 3793while your customers start to complain about a fatal bug. You check 3794out release 1.0 (@pxref{Tags}) and find the bug 3795(which turns out to have a trivial fix). However, the current revision 3796of the sources are in a state of flux and are not expected to be stable 3797for at least another month. There is no way to make a 3798bugfix release based on the newest sources. 3799 3800The thing to do in a situation like this is to create a @dfn{branch} on 3801the revision trees for all the files that make up 3802release 1.0 of tc. You can then make 3803modifications to the branch without disturbing the main trunk. When the 3804modifications are finished you can elect to either incorporate them on 3805the main trunk, or leave them on the branch. 3806 3807@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3808@node Creating a branch 3809@section Creating a branch 3810@cindex Creating a branch 3811@cindex Branch, creating a 3812@cindex tag, creating a branch using 3813@cindex rtag, creating a branch using 3814 3815You can create a branch with @code{tag -b}; for 3816example, assuming you're in a working copy: 3817 3818@example 3819$ cvs tag -b rel-1-0-patches 3820@end example 3821 3822@c FIXME: we should be more explicit about the value of 3823@c having a tag on the branchpoint. For example 3824@c "cvs tag rel-1-0-patches-branchpoint" before 3825@c the "cvs tag -b". This points out that 3826@c rel-1-0-patches is a pretty awkward name for 3827@c this example (more so than for the rtag example 3828@c below). 3829 3830This splits off a branch based on the current revisions 3831in the working copy, assigning that branch the name 3832@samp{rel-1-0-patches}. 3833 3834It is important to understand that branches get created 3835in the repository, not in the working copy. Creating a 3836branch based on current revisions, as the above example 3837does, will @emph{not} automatically switch the working 3838copy to be on the new branch. For information on how 3839to do that, see @ref{Accessing branches}. 3840 3841You can also create a branch without reference to any 3842working copy, by using @code{rtag}: 3843 3844@example 3845$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc 3846@end example 3847 3848@samp{-r rel-1-0} says that this branch should be 3849rooted at the revision that 3850corresponds to the tag @samp{rel-1-0}. It need not 3851be the most recent revision -- it's often useful to 3852split a branch off an old revision (for example, when 3853fixing a bug in a past release otherwise known to be 3854stable). 3855 3856As with @samp{tag}, the @samp{-b} flag tells 3857@code{rtag} to create a branch (rather than just a 3858symbolic revision name). Note that the numeric 3859revision number that matches @samp{rel-1-0} will 3860probably be different from file to file. 3861 3862So, the full effect of the command is to create a new 3863branch -- named @samp{rel-1-0-patches} -- in module 3864@samp{tc}, rooted in the revision tree at the point tagged 3865by @samp{rel-1-0}. 3866 3867@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3868@node Accessing branches 3869@section Accessing branches 3870@cindex Check out a branch 3871@cindex Retrieve a branch 3872@cindex Access a branch 3873@cindex Identifying a branch 3874@cindex Branch, check out 3875@cindex Branch, retrieving 3876@cindex Branch, accessing 3877@cindex Branch, identifying 3878 3879You can retrieve a branch in one of two ways: by 3880checking it out fresh from the repository, or by 3881switching an existing working copy over to the branch. 3882 3883To check out a branch from the repository, invoke 3884@samp{checkout} with the @samp{-r} flag, followed by 3885the tag name of the branch (@pxref{Creating a branch}): 3886 3887@example 3888$ cvs checkout -r rel-1-0-patches tc 3889@end example 3890 3891Or, if you already have a working copy, you can switch 3892it to a given branch with @samp{update -r}: 3893 3894@example 3895$ cvs update -r rel-1-0-patches tc 3896@end example 3897 3898or equivalently: 3899 3900@example 3901$ cd tc 3902$ cvs update -r rel-1-0-patches 3903@end example 3904 3905It does not matter if the working copy was originally 3906on the main trunk or on some other branch -- the above 3907command will switch it to the named branch. And 3908similarly to a regular @samp{update} command, 3909@samp{update -r} merges any changes you have made, 3910notifying you of conflicts where they occur. 3911 3912Once you have a working copy tied to a particular 3913branch, it remains there until you tell it otherwise. 3914This means that changes checked in from the working 3915copy will add new revisions on that branch, while 3916leaving the main trunk and other branches unaffected. 3917 3918@cindex Branches, sticky 3919To find out what branch a working copy is on, you can 3920use the @samp{status} command. In its output, look for 3921the field named @samp{Sticky tag} (@pxref{Sticky tags}) 3922-- that's @sc{cvs}'s way of telling you the branch, if 3923any, of the current working files: 3924 3925@example 3926$ cvs status -v driver.c backend.c 3927=================================================================== 3928File: driver.c Status: Up-to-date 3929 3930 Version: 1.7 Sat Dec 5 18:25:54 1992 3931 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v 3932 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 3933 Sticky Date: (none) 3934 Sticky Options: (none) 3935 3936 Existing Tags: 3937 rel-1-0-patches (branch: 1.7.2) 3938 rel-1-0 (revision: 1.7) 3939 3940=================================================================== 3941File: backend.c Status: Up-to-date 3942 3943 Version: 1.4 Tue Dec 1 14:39:01 1992 3944 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 3945 Sticky Tag: rel-1-0-patches (branch: 1.4.2) 3946 Sticky Date: (none) 3947 Sticky Options: (none) 3948 3949 Existing Tags: 3950 rel-1-0-patches (branch: 1.4.2) 3951 rel-1-0 (revision: 1.4) 3952 rel-0-4 (revision: 1.4) 3953 3954@end example 3955 3956Don't be confused by the fact that the branch numbers 3957for each file are different (@samp{1.7.2} and 3958@samp{1.4.2} respectively). The branch tag is the 3959same, @samp{rel-1-0-patches}, and the files are 3960indeed on the same branch. The numbers simply reflect 3961the point in each file's revision history at which the 3962branch was made. In the above example, one can deduce 3963that @samp{driver.c} had been through more changes than 3964@samp{backend.c} before this branch was created. 3965 3966See @ref{Branches and revisions} for details about how 3967branch numbers are constructed. 3968 3969@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3970@node Branches and revisions 3971@section Branches and revisions 3972@cindex Branch number 3973@cindex Number, branch 3974@cindex Revision numbers (branches) 3975 3976Ordinarily, a file's revision history is a linear 3977series of increments (@pxref{Revision numbers}): 3978 3979@example 3980 +-----+ +-----+ +-----+ +-----+ +-----+ 3981 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 3982 +-----+ +-----+ +-----+ +-----+ +-----+ 3983@end example 3984 3985However, @sc{cvs} is not limited to linear development. The 3986@dfn{revision tree} can be split into @dfn{branches}, 3987where each branch is a self-maintained line of 3988development. Changes made on one branch can easily be 3989moved back to the main trunk. 3990 3991Each branch has a @dfn{branch number}, consisting of an 3992odd number of period-separated decimal integers. The 3993branch number is created by appending an integer to the 3994revision number where the corresponding branch forked 3995off. Having branch numbers allows more than one branch 3996to be forked off from a certain revision. 3997 3998@need 3500 3999All revisions on a branch have revision numbers formed 4000by appending an ordinal number to the branch number. 4001The following figure illustrates branching with an 4002example. 4003 4004@example 4005@c This example used to have a 1.2.2.4 revision, which 4006@c might help clarify that development can continue on 4007@c 1.2.2. Might be worth reinstating if it can be done 4008@c without overfull hboxes. 4009@group 4010 +-------------+ 4011 Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 ! 4012 / +-------------+ 4013 / 4014 / 4015 +---------+ +---------+ +---------+ 4016Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4017 / +---------+ +---------+ +---------+ 4018 / 4019 / 4020+-----+ +-----+ +-----+ +-----+ +-----+ 4021! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4022+-----+ +-----+ +-----+ +-----+ +-----+ 4023 ! 4024 ! 4025 ! +---------+ +---------+ +---------+ 4026Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 ! 4027 +---------+ +---------+ +---------+ 4028 4029@end group 4030@end example 4031 4032@c -- However, at least for me the figure is not enough. I suggest more 4033@c -- text to accompany it. "A picture is worth a thousand words", so you 4034@c -- have to make sure the reader notices the couple of hundred words 4035@c -- *you* had in mind more than the others! 4036 4037@c -- Why an even number of segments? This section implies that this is 4038@c -- how the main trunk is distinguished from branch roots, but you never 4039@c -- explicitly say that this is the purpose of the [by itself rather 4040@c -- surprising] restriction to an even number of segments. 4041 4042The exact details of how the branch number is 4043constructed is not something you normally need to be 4044concerned about, but here is how it works: When 4045@sc{cvs} creates a branch number it picks the first 4046unused even integer, starting with 2. So when you want 4047to create a branch from revision 6.4 it will be 4048numbered 6.4.2. All branch numbers ending in a zero 4049(such as 6.4.0) are used internally by @sc{cvs} 4050(@pxref{Magic branch numbers}). The branch 1.1.1 has a 4051special meaning. @xref{Tracking sources}. 4052 4053@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4054@node Magic branch numbers 4055@section Magic branch numbers 4056 4057@c Want xref to here from "log"? 4058 4059This section describes a @sc{cvs} feature called 4060@dfn{magic branches}. For most purposes, you need not 4061worry about magic branches; @sc{cvs} handles them for 4062you. However, they are visible to you in certain 4063circumstances, so it may be useful to have some idea of 4064how it works. 4065 4066Externally, branch numbers consist of an odd number of 4067dot-separated decimal integers. @xref{Revision 4068numbers}. That is not the whole truth, however. For 4069efficiency reasons @sc{cvs} sometimes inserts an extra 0 4070in the second rightmost position (1.2.4 becomes 40711.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so 4072on). 4073 4074@sc{cvs} does a pretty good job at hiding these so 4075called magic branches, but in a few places the hiding 4076is incomplete: 4077 4078@itemize @bullet 4079@ignore 4080@c This is in ignore as I'm taking their word for it, 4081@c that this was fixed 4082@c a long time ago. But before deleting this 4083@c entirely, I'd rather verify it (and add a test 4084@c case to the testsuite). 4085@item 4086The magic branch can appear in the output from 4087@code{cvs status} in vanilla @sc{cvs} 1.3. This is 4088fixed in @sc{cvs} 1.3-s2. 4089 4090@end ignore 4091@item 4092The magic branch number appears in the output from 4093@code{cvs log}. 4094@c What output should appear instead? 4095 4096@item 4097You cannot specify a symbolic branch name to @code{cvs 4098admin}. 4099 4100@end itemize 4101 4102@c Can CVS do this automatically the first time 4103@c you check something in to that branch? Should 4104@c it? 4105You can use the @code{admin} command to reassign a 4106symbolic name to a branch the way @sc{rcs} expects it 4107to be. If @code{R4patches} is assigned to the branch 41081.4.2 (magic branch number 1.4.0.2) in file 4109@file{numbers.c} you can do this: 4110 4111@example 4112$ cvs admin -NR4patches:1.4.2 numbers.c 4113@end example 4114 4115It only works if at least one revision is already 4116committed on the branch. Be very careful so that you 4117do not assign the tag to the wrong number. (There is 4118no way to see how the tag was assigned yesterday). 4119 4120@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4121@node Merging a branch 4122@section Merging an entire branch 4123@cindex Merging a branch 4124@cindex -j (merging branches) 4125 4126You can merge changes made on a branch into your working copy by giving 4127the @samp{-j @var{branch}} flag to the @code{update} command. With one 4128@samp{-j @var{branch}} option it merges the changes made between the 4129point where the branch forked and newest revision on that branch (into 4130your working copy). 4131 4132@cindex Join 4133The @samp{-j} stands for ``join''. 4134 4135@cindex Branch merge example 4136@cindex Example, branch merge 4137@cindex Merge, branch example 4138Consider this revision tree: 4139 4140@example 4141+-----+ +-----+ +-----+ +-----+ 4142! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk 4143+-----+ +-----+ +-----+ +-----+ 4144 ! 4145 ! 4146 ! +---------+ +---------+ 4147Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4148 +---------+ +---------+ 4149@end example 4150 4151@noindent 4152The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}. The 4153following example assumes that the module @samp{mod} contains only one 4154file, @file{m.c}. 4155 4156@example 4157$ cvs checkout mod # @r{Retrieve the latest revision, 1.4} 4158 4159$ cvs update -j R1fix m.c # @r{Merge all changes made on the branch,} 4160 # @r{i.e. the changes between revision 1.2} 4161 # @r{and 1.2.2.2, into your working copy} 4162 # @r{of the file.} 4163 4164$ cvs commit -m "Included R1fix" # @r{Create revision 1.5.} 4165@end example 4166 4167A conflict can result from a merge operation. If that 4168happens, you should resolve it before committing the 4169new revision. @xref{Conflicts example}. 4170 4171If your source files contain keywords (@pxref{Keyword substitution}), 4172you might be getting more conflicts than strictly necessary. See 4173@ref{Merging and keywords}, for information on how to avoid this. 4174 4175The @code{checkout} command also supports the @samp{-j @var{branch}} flag. The 4176same effect as above could be achieved with this: 4177 4178@example 4179$ cvs checkout -j R1fix mod 4180$ cvs commit -m "Included R1fix" 4181@end example 4182 4183@node Merging more than once 4184@section Merging from a branch several times 4185 4186Continuing our example, the revision tree now looks 4187like this: 4188 4189@example 4190+-----+ +-----+ +-----+ +-----+ +-----+ 4191! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4192+-----+ +-----+ +-----+ +-----+ +-----+ 4193 ! * 4194 ! * 4195 ! +---------+ +---------+ 4196Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4197 +---------+ +---------+ 4198@end example 4199 4200where the starred line represents the merge from the 4201@samp{R1fix} branch to the main trunk, as just 4202discussed. 4203 4204Now suppose that development continues on the 4205@samp{R1fix} branch: 4206 4207@example 4208+-----+ +-----+ +-----+ +-----+ +-----+ 4209! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4210+-----+ +-----+ +-----+ +-----+ +-----+ 4211 ! * 4212 ! * 4213 ! +---------+ +---------+ +---------+ 4214Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4215 +---------+ +---------+ +---------+ 4216@end example 4217 4218and then you want to merge those new changes onto the 4219main trunk. If you just use the @code{cvs update -j 4220R1fix m.c} command again, @sc{cvs} will attempt to 4221merge again the changes which you have already merged, 4222which can have undesirable side effects. 4223 4224So instead you need to specify that you only want to 4225merge the changes on the branch which have not yet been 4226merged into the trunk. To do that you specify two 4227@samp{-j} options, and @sc{cvs} merges the changes from 4228the first revision to the second revision. For 4229example, in this case the simplest way would be 4230 4231@example 4232cvs update -j 1.2.2.2 -j R1fix m.c # @r{Merge changes from 1.2.2.2 to the} 4233 # @r{head of the R1fix branch} 4234@end example 4235 4236The problem with this is that you need to specify the 42371.2.2.2 revision manually. A slightly better approach 4238might be to use the date the last merge was done: 4239 4240@example 4241cvs update -j R1fix:yesterday -j R1fix m.c 4242@end example 4243 4244Better yet, tag the R1fix branch after every merge into 4245the trunk, and then use that tag for subsequent merges: 4246 4247@example 4248cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c 4249@end example 4250 4251@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4252@node Merging two revisions 4253@section Merging differences between any two revisions 4254@cindex Merging two revisions 4255@cindex Revisions, merging differences between 4256@cindex Differences, merging 4257 4258With two @samp{-j @var{revision}} flags, the @code{update} 4259(and @code{checkout}) command can merge the differences 4260between any two revisions into your working file. 4261 4262@cindex Undoing a change 4263@cindex Removing a change 4264@example 4265$ cvs update -j 1.5 -j 1.3 backend.c 4266@end example 4267 4268@noindent 4269will undo all changes made between revision 42701.3 and 1.5. Note the order of the revisions! 4271 4272If you try to use this option when operating on 4273multiple files, remember that the numeric revisions will 4274probably be very different between the various files. 4275You almost always use symbolic 4276tags rather than revision numbers when operating on 4277multiple files. 4278 4279@cindex Restoring old version of removed file 4280@cindex Resurrecting old version of dead file 4281Specifying two @samp{-j} options can also undo file 4282removals or additions. For example, suppose you have 4283a file 4284named @file{file1} which existed as revision 1.1, and 4285you then removed it (thus adding a dead revision 1.2). 4286Now suppose you want to add it again, with the same 4287contents it had previously. Here is how to do it: 4288 4289@example 4290$ cvs update -j 1.2 -j 1.1 file1 4291U file1 4292$ cvs commit -m test 4293Checking in file1; 4294/tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 4295new revision: 1.3; previous revision: 1.2 4296done 4297$ 4298@end example 4299 4300@node Merging adds and removals 4301@section Merging can add or remove files 4302 4303If the changes which you are merging involve removing 4304or adding some files, @code{update -j} will reflect 4305such additions or removals. 4306 4307@c FIXME: This example needs a lot more explanation. 4308@c We also need other examples for some of the other 4309@c cases (not all--there are too many--as long as we present a 4310@c coherent general principle). 4311For example: 4312@example 4313cvs update -A 4314touch a b c 4315cvs add a b c ; cvs ci -m "added" a b c 4316cvs tag -b branchtag 4317cvs update -r branchtag 4318touch d ; cvs add d 4319rm a ; cvs rm a 4320cvs ci -m "added d, removed a" 4321cvs update -A 4322cvs update -jbranchtag 4323@end example 4324 4325After these commands are executed and a @samp{cvs commit} is done, 4326file @file{a} will be removed and file @file{d} added in the main branch. 4327@c (which was determined by trying it) 4328 4329@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4330@node Merging and keywords 4331@section Merging and keywords 4332@cindex Merging, and keyword substitution 4333@cindex Keyword substitution, and merging 4334@cindex -j (merging branches), and keyword substitution 4335@cindex -kk, to avoid conflicts during a merge 4336 4337If you merge files containing keywords (@pxref{Keyword 4338substitution}), you will normally get numerous 4339conflicts during the merge, because the keywords are 4340expanded differently in the revisions which you are 4341merging. 4342 4343Therefore, you will often want to specify the 4344@samp{-kk} (@pxref{Substitution modes}) switch to the 4345merge command line. By substituting just the name of 4346the keyword, not the expanded value of that keyword, 4347this option ensures that the revisions which you are 4348merging will be the same as each other, and avoid 4349spurious conflicts. 4350 4351For example, suppose you have a file like this: 4352 4353@example 4354 +---------+ 4355 _! 1.1.2.1 ! <- br1 4356 / +---------+ 4357 / 4358 / 4359+-----+ +-----+ 4360! 1.1 !----! 1.2 ! 4361+-----+ +-----+ 4362@end example 4363 4364and your working directory is currently on the trunk 4365(revision 1.2). Then you might get the following 4366results from a merge: 4367 4368@example 4369$ cat file1 4370key $@asis{}Revision: 1.2 $ 4371. . . 4372$ cvs update -j br1 4373U file1 4374RCS file: /cvsroot/first-dir/file1,v 4375retrieving revision 1.1 4376retrieving revision 1.1.2.1 4377Merging differences between 1.1 and 1.1.2.1 into file1 4378rcsmerge: warning: conflicts during merge 4379$ cat file1 4380@asis{}<<<<<<< file1 4381key $@asis{}Revision: 1.2 $ 4382@asis{}======= 4383key $@asis{}Revision: 1.1.2.1 $ 4384@asis{}>>>>>>> 1.1.2.1 4385. . . 4386@end example 4387 4388What happened was that the merge tried to merge the 4389differences between 1.1 and 1.1.2.1 into your working 4390directory. So, since the keyword changed from 4391@code{Revision: 1.1} to @code{Revision: 1.1.2.1}, 4392@sc{cvs} tried to merge that change into your working 4393directory, which conflicted with the fact that your 4394working directory had contained @code{Revision: 1.2}. 4395 4396Here is what happens if you had used @samp{-kk}: 4397 4398@example 4399$ cat file1 4400key $@asis{}Revision: 1.2 $ 4401. . . 4402$ cvs update -kk -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 4408$ cat file1 4409key $@asis{}Revision$ 4410. . . 4411@end example 4412 4413What is going on here is that revision 1.1 and 1.1.2.1 4414both expand as plain @code{Revision}, and therefore 4415merging the changes between them into the working 4416directory need not change anything. Therefore, there 4417is no conflict. 4418 4419There is, however, one major caveat with using 4420@samp{-kk} on merges. Namely, it overrides whatever 4421keyword expansion mode @sc{cvs} would normally have 4422used. In particular, this is a problem if the mode had 4423been @samp{-kb} for a binary file. Therefore, if your 4424repository contains binary files, you will need to deal 4425with the conflicts rather than using @samp{-kk}. 4426 4427@ignore 4428The following seems rather confusing, possibly buggy, 4429and in general, in need of much more thought before it 4430is a recommended technique. For one thing, does it 4431apply on Windows as well as on Unix? 4432 4433Unchanged binary files will undergo the same keyword substitution 4434but will not be checked in on a subsequent 4435@code{cvs commit}. Be aware that binary files containing keyword 4436strings which are present in or below the working directory 4437will most likely remain corrupt until repaired, however. A simple 4438@code{cvs update -A} is sufficient to fix these otherwise unaltered binary files 4439if the merge is being done to the main branch but 4440this must be done after the merge has been committed or the merge itself 4441will be lost. 4442 4443For Example: 4444@example 4445cvs update -Akk -jbranchtag 4446cvs commit 4447cvs update -A 4448@end example 4449 4450@noindent 4451will update the current directory from the main trunk of the 4452repository, substituting the base keyword strings for keywords, 4453and merge changes made on the branch @samp{branchtag} into the new 4454work files, performing the same keyword substitution on that file set before 4455comparing the two sets. The final @code{cvs update -A} will restore any 4456corrupted binary files as well as resetting the sticky @samp{-kk} tags which 4457were present on the files in and below the working directory. 4458Unfortunately, this doesn't work as well with an arbitrary branch tag, as the 4459@samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk} 4460switches attached to the working files as @samp{-A} does. The workaround 4461for this is to release the working directory after the merge has been 4462committed and check it out again. 4463@end ignore 4464 4465@c --------------------------------------------------------------------- 4466@node Recursive behavior 4467@chapter Recursive behavior 4468@cindex Recursive (directory descending) 4469@cindex Directory, descending 4470@cindex Descending directories 4471@cindex Subdirectories 4472 4473Almost all of the subcommands of @sc{cvs} work 4474recursively when you specify a directory as an 4475argument. For instance, consider this directory 4476structure: 4477 4478@example 4479 @code{$HOME} 4480 | 4481 +--@t{tc} 4482 | | 4483 +--@t{CVS} 4484 | (internal @sc{cvs} files) 4485 +--@t{Makefile} 4486 +--@t{backend.c} 4487 +--@t{driver.c} 4488 +--@t{frontend.c} 4489 +--@t{parser.c} 4490 +--@t{man} 4491 | | 4492 | +--@t{CVS} 4493 | | (internal @sc{cvs} files) 4494 | +--@t{tc.1} 4495 | 4496 +--@t{testing} 4497 | 4498 +--@t{CVS} 4499 | (internal @sc{cvs} files) 4500 +--@t{testpgm.t} 4501 +--@t{test2.t} 4502@end example 4503 4504@noindent 4505If @file{tc} is the current working directory, the 4506following is true: 4507 4508@itemize @bullet 4509@item 4510@samp{cvs update testing} is equivalent to 4511 4512@example 4513cvs update testing/testpgm.t testing/test2.t 4514@end example 4515 4516@item 4517@samp{cvs update testing man} updates all files in the 4518subdirectories 4519 4520@item 4521@samp{cvs update .} or just @samp{cvs update} updates 4522all files in the @code{tc} directory 4523@end itemize 4524 4525If no arguments are given to @code{update} it will 4526update all files in the current working directory and 4527all its subdirectories. In other words, @file{.} is a 4528default argument to @code{update}. This is also true 4529for most of the @sc{cvs} subcommands, not only the 4530@code{update} command. 4531 4532The recursive behavior of the @sc{cvs} subcommands can be 4533turned off with the @samp{-l} option. 4534Conversely, the @samp{-R} option can be used to force recursion if 4535@samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 4536 4537@example 4538$ cvs update -l # @r{Don't update files in subdirectories} 4539@end example 4540 4541@c --------------------------------------------------------------------- 4542@node Adding and removing 4543@chapter Adding, removing, and renaming files and directories 4544 4545In the course of a project, one will often add new 4546files. Likewise with removing or renaming, or with 4547directories. The general concept to keep in mind in 4548all these cases is that instead of making an 4549irreversible change you want @sc{cvs} to record the 4550fact that a change has taken place, just as with 4551modifying an existing file. The exact mechanisms to do 4552this in @sc{cvs} vary depending on the situation. 4553 4554@menu 4555* Adding files:: Adding files 4556* Removing files:: Removing files 4557* Removing directories:: Removing directories 4558* Moving files:: Moving and renaming files 4559* Moving directories:: Moving and renaming directories 4560@end menu 4561 4562@node Adding files 4563@section Adding files to a directory 4564@cindex Adding files 4565 4566To add a new file to a directory, follow these steps. 4567 4568@itemize @bullet 4569@item 4570You must have a working copy of the directory. 4571@xref{Getting the source}. 4572 4573@item 4574Create the new file inside your working copy of the directory. 4575 4576@item 4577Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you 4578want to version control the file. If the file contains 4579binary data, specify @samp{-kb} (@pxref{Binary files}). 4580 4581@item 4582Use @samp{cvs commit @var{filename}} to actually check 4583in the file into the repository. Other developers 4584cannot see the file until you perform this step. 4585@end itemize 4586 4587You can also use the @code{add} command to add a new 4588directory. 4589@c FIXCVS and/or FIXME: Adding a directory doesn't 4590@c require the commit step. This probably can be 4591@c considered a CVS bug, but it is possible we should 4592@c warn people since this behavior probably won't be 4593@c changing right away. 4594 4595Unlike most other commands, the @code{add} command is 4596not recursive. You cannot even type @samp{cvs add 4597foo/bar}! Instead, you have to 4598@c FIXCVS: This is, of course, not a feature. It is 4599@c just that no one has gotten around to fixing "cvs add 4600@c foo/bar". 4601 4602@example 4603$ cd foo 4604$ cvs add bar 4605@end example 4606 4607@cindex add (subcommand) 4608@deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{} 4609 4610Schedule @var{files} to be added to the repository. 4611The files or directories specified with @code{add} must 4612already exist in the current directory. To add a whole 4613new directory hierarchy to the source repository (for 4614example, files received from a third-party vendor), use 4615the @code{import} command instead. @xref{import}. 4616 4617The added files are not placed in the source repository 4618until you use @code{commit} to make the change 4619permanent. Doing an @code{add} on a file that was 4620removed with the @code{remove} command will undo the 4621effect of the @code{remove}, unless a @code{commit} 4622command intervened. @xref{Removing files}, for an 4623example. 4624 4625The @samp{-k} option specifies the default way that 4626this file will be checked out; for more information see 4627@ref{Substitution modes}. 4628 4629@c As noted in BUGS, -m is broken client/server (Nov 4630@c 96). Also see testsuite log2-* tests. 4631The @samp{-m} option specifies a description for the 4632file. This description appears in the history log (if 4633it is enabled, @pxref{history file}). It will also be 4634saved in the version history inside the repository when 4635the file is committed. The @code{log} command displays 4636this description. The description can be changed using 4637@samp{admin -t}. @xref{admin}. If you omit the 4638@samp{-m @var{description}} flag, an empty string will 4639be used. You will not be prompted for a description. 4640@end deffn 4641 4642For example, the following commands add the file 4643@file{backend.c} to the repository: 4644 4645@c This example used to specify 4646@c -m "Optimizer and code generation passes." 4647@c to the cvs add command, but that doesn't work 4648@c client/server (see log2 in sanity.sh). Should fix CVS, 4649@c but also seems strange to document things which 4650@c don't work... 4651@example 4652$ cvs add backend.c 4653$ cvs commit -m "Early version. Not yet compilable." backend.c 4654@end example 4655 4656When you add a file it is added only on the branch 4657which you are working on (@pxref{Branching and merging}). You can 4658later merge the additions to another branch if you want 4659(@pxref{Merging adds and removals}). 4660@c Should we mention that earlier versions of CVS 4661@c lacked this feature (1.3) or implemented it in a buggy 4662@c way (well, 1.8 had many bugs in cvs update -j)? 4663@c Should we mention the bug/limitation regarding a 4664@c file being a regular file on one branch and a directory 4665@c on another? 4666@c FIXME: This needs an example, or several, here or 4667@c elsewhere, for it to make much sense. 4668@c Somewhere we need to discuss the aspects of death 4669@c support which don't involve branching, I guess. 4670@c Like the ability to re-create a release from a tag. 4671 4672@c --------------------------------------------------------------------- 4673@node Removing files 4674@section Removing files 4675@cindex Removing files 4676@cindex Deleting files 4677 4678@c FIXME: this node wants to be split into several 4679@c smaller nodes. Could make these children of 4680@c "Adding and removing", probably (death support could 4681@c be its own section, for example, as could the 4682@c various bits about undoing mistakes in adding and 4683@c removing). 4684Directories change. New files are added, and old files 4685disappear. Still, you want to be able to retrieve an 4686exact copy of old releases. 4687 4688Here is what you can do to remove a file, 4689but remain able to retrieve old revisions: 4690 4691@itemize @bullet 4692@c FIXME: should probably be saying something about 4693@c having a working directory in the first place. 4694@item 4695Make sure that you have not made any uncommitted 4696modifications to the file. @xref{Viewing differences}, 4697for one way to do that. You can also use the 4698@code{status} or @code{update} command. If you remove 4699the file without committing your changes, you will of 4700course not be able to retrieve the file as it was 4701immediately before you deleted it. 4702 4703@item 4704Remove the file from your working copy of the directory. 4705You can for instance use @code{rm}. 4706 4707@item 4708Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that 4709you really want to delete the file. 4710 4711@item 4712Use @samp{cvs commit @var{filename}} to actually 4713perform the removal of the file from the repository. 4714@end itemize 4715 4716@c FIXME: Somehow this should be linked in with a more 4717@c general discussion of death support. I don't know 4718@c whether we want to use the term "death support" or 4719@c not (we can perhaps get by without it), but we do 4720@c need to discuss the "dead" state in "cvs log" and 4721@c related subjects. The current discussion is 4722@c scattered around, and not xref'd to each other. 4723@c FIXME: I think this paragraph wants to be moved 4724@c later down, at least after the first example. 4725When you commit the removal of the file, @sc{cvs} 4726records the fact that the file no longer exists. It is 4727possible for a file to exist on only some branches and 4728not on others, or to re-add another file with the same 4729name later. CVS will correctly create or not create 4730the file, based on the @samp{-r} and @samp{-D} options 4731specified to @code{checkout} or @code{update}. 4732 4733@c FIXME: This style seems to clash with how we 4734@c document things in general. 4735@cindex Remove (subcommand) 4736@deffn Command {cvs remove} [options] files @dots{} 4737 4738Schedule file(s) to be removed from the repository 4739(files which have not already been removed from the 4740working directory are not processed). This command 4741does not actually remove the file from the repository 4742until you commit the removal. For a full list of 4743options, see @ref{Invoking CVS}. 4744@end deffn 4745 4746Here is an example of removing several files: 4747 4748@example 4749$ cd test 4750$ rm *.c 4751$ cvs remove 4752cvs remove: Removing . 4753cvs remove: scheduling a.c for removal 4754cvs remove: scheduling b.c for removal 4755cvs remove: use 'cvs commit' to remove these files permanently 4756$ cvs ci -m "Removed unneeded files" 4757cvs commit: Examining . 4758cvs commit: Committing . 4759@end example 4760 4761As a convenience you can remove the file and @code{cvs 4762remove} it in one step, by specifying the @samp{-f} 4763option. For example, the above example could also be 4764done like this: 4765 4766@example 4767$ cd test 4768$ cvs remove -f *.c 4769cvs remove: scheduling a.c for removal 4770cvs remove: scheduling b.c for removal 4771cvs remove: use 'cvs commit' to remove these files permanently 4772$ cvs ci -m "Removed unneeded files" 4773cvs commit: Examining . 4774cvs commit: Committing . 4775@end example 4776 4777If you execute @code{remove} for a file, and then 4778change your mind before you commit, you can undo the 4779@code{remove} with an @code{add} command. 4780@ignore 4781@c is this worth saying or not? Somehow it seems 4782@c confusing to me. 4783Of course, 4784since you have removed your copy of file in the working 4785directory, @sc{cvs} does not necessarily bring back the 4786contents of the file from right before you executed 4787@code{remove}; instead it gets the file from the 4788repository again. 4789@end ignore 4790 4791@c FIXME: what if you change your mind after you commit 4792@c it? (answer is also "cvs add" but we don't say that...). 4793@c We need some index entries for thinks like "undoing 4794@c removal" too. 4795 4796@example 4797$ ls 4798CVS ja.h oj.c 4799$ rm oj.c 4800$ cvs remove oj.c 4801cvs remove: scheduling oj.c for removal 4802cvs remove: use 'cvs commit' to remove this file permanently 4803$ cvs add oj.c 4804U oj.c 4805cvs add: oj.c, version 1.1.1.1, resurrected 4806@end example 4807 4808If you realize your mistake before you run the 4809@code{remove} command you can use @code{update} to 4810resurrect the file: 4811 4812@example 4813$ rm oj.c 4814$ cvs update oj.c 4815cvs update: warning: oj.c was lost 4816U oj.c 4817@end example 4818 4819When you remove a file it is removed only on the branch 4820which you are working on (@pxref{Branching and merging}). You can 4821later merge the removals to another branch if you want 4822(@pxref{Merging adds and removals}). 4823 4824@node Removing directories 4825@section Removing directories 4826@cindex Removing directories 4827@cindex Directories, removing 4828 4829In concept removing directories is somewhat similar to 4830removing files---you want the directory to not exist in 4831your current working directories, but you also want to 4832be able to retrieve old releases in which the directory 4833existed. 4834 4835The way that you remove a directory is to remove all 4836the files in it. You don't remove the directory 4837itself; there is no way to do that. 4838Instead you specify the @samp{-P} option to 4839@code{cvs update} or @code{cvs checkout}, 4840which will cause @sc{cvs} to remove empty 4841directories from working directories. 4842(Note that @code{cvs export} always removes empty directories.) 4843Probably the 4844best way to do this is to always specify @samp{-P}; if 4845you want an empty directory then put a dummy file (for 4846example @file{.keepme}) in it to prevent @samp{-P} from 4847removing it. 4848 4849@c I'd try to give a rationale for this, but I'm not 4850@c sure there is a particularly convincing one. What 4851@c we would _like_ is for CVS to do a better job of version 4852@c controlling whether directories exist, to eliminate the 4853@c need for -P and so that a file can be a directory in 4854@c one revision and a regular file in another. 4855Note that @samp{-P} is implied by the @samp{-r} or @samp{-D} 4856options of @code{checkout}. This way 4857@sc{cvs} will be able to correctly create the directory 4858or not depending on whether the particular version you 4859are checking out contains any files in that directory. 4860 4861@c --------------------------------------------------------------------- 4862@node Moving files 4863@section Moving and renaming files 4864@cindex Moving files 4865@cindex Renaming files 4866@cindex Files, moving 4867 4868Moving files to a different directory or renaming them 4869is not difficult, but some of the ways in which this 4870works may be non-obvious. (Moving or renaming a 4871directory is even harder. @xref{Moving directories}.). 4872 4873The examples below assume that the file @var{old} is renamed to 4874@var{new}. 4875 4876@menu 4877* Outside:: The normal way to Rename 4878* Inside:: A tricky, alternative way 4879* Rename by copying:: Another tricky, alternative way 4880@end menu 4881 4882@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4883@node Outside 4884@subsection The Normal way to Rename 4885 4886@c More rename issues. Not sure whether these are 4887@c worth documenting; I'm putting them here because 4888@c it seems to be as good a place as any to try to 4889@c set down the issues. 4890@c * "cvs annotate" will annotate either the new 4891@c file or the old file; it cannot annotate _each 4892@c line_ based on whether it was last changed in the 4893@c new or old file. Unlike "cvs log", where the 4894@c consequences of having to select either the new 4895@c or old name seem fairly benign, this may be a 4896@c real advantage to having CVS know about renames 4897@c other than as a deletion and an addition. 4898 4899The normal way to move a file is to copy @var{old} to 4900@var{new}, and then issue the normal @sc{cvs} commands 4901to remove @var{old} from the repository, and add 4902@var{new} to it. 4903@c The following sentence is not true: one must cd into 4904@c the directory to run "cvs add". 4905@c (Both @var{old} and @var{new} could 4906@c contain relative paths, for example @file{foo/bar.c}). 4907 4908@example 4909$ mv @var{old} @var{new} 4910$ cvs remove @var{old} 4911$ cvs add @var{new} 4912$ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new} 4913@end example 4914 4915This is the simplest way to move a file, it is not 4916error-prone, and it preserves the history of what was 4917done. Note that to access the history of the file you 4918must specify the old or the new name, depending on what 4919portion of the history you are accessing. For example, 4920@code{cvs log @var{old}} will give the log up until the 4921time of the rename. 4922 4923When @var{new} is committed its revision numbers will 4924start again, usually at 1.1, so if that bothers you, 4925use the @samp{-r rev} option to commit. For more 4926information see @ref{Assigning revisions}. 4927 4928@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4929@node Inside 4930@subsection Moving the history file 4931 4932This method is more dangerous, since it involves moving 4933files inside the repository. Read this entire section 4934before trying it out! 4935 4936@example 4937$ cd $CVSROOT/@var{dir} 4938$ mv @var{old},v @var{new},v 4939@end example 4940 4941@noindent 4942Advantages: 4943 4944@itemize @bullet 4945@item 4946The log of changes is maintained intact. 4947 4948@item 4949The revision numbers are not affected. 4950@end itemize 4951 4952@noindent 4953Disadvantages: 4954 4955@itemize @bullet 4956@item 4957Old releases cannot easily be fetched from the 4958repository. (The file will show up as @var{new} even 4959in revisions from the time before it was renamed). 4960 4961@item 4962There is no log information of when the file was renamed. 4963 4964@item 4965Nasty things might happen if someone accesses the history file 4966while you are moving it. Make sure no one else runs any of the @sc{cvs} 4967commands while you move it. 4968@end itemize 4969 4970@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4971@node Rename by copying 4972@subsection Copying the history file 4973 4974This way also involves direct modifications to the 4975repository. It is safe, but not without drawbacks. 4976 4977@example 4978# @r{Copy the @sc{rcs} file inside the repository} 4979$ cd $CVSROOT/@var{dir} 4980$ cp @var{old},v @var{new},v 4981# @r{Remove the old file} 4982$ cd ~/@var{dir} 4983$ rm @var{old} 4984$ cvs remove @var{old} 4985$ cvs commit @var{old} 4986# @r{Remove all tags from @var{new}} 4987$ cvs update @var{new} 4988$ cvs log @var{new} # @r{Remember the non-branch tag names} 4989$ cvs tag -d @var{tag1} @var{new} 4990$ cvs tag -d @var{tag2} @var{new} 4991@dots{} 4992@end example 4993 4994By removing the tags you will be able to check out old 4995revisions. 4996 4997@noindent 4998Advantages: 4999 5000@itemize @bullet 5001@item 5002@c FIXME: Is this true about -D now that we have death 5003@c support? See 5B.3 in the FAQ. 5004Checking out old revisions works correctly, as long as 5005you use @samp{-r@var{tag}} and not @samp{-D@var{date}} 5006to retrieve the revisions. 5007 5008@item 5009The log of changes is maintained intact. 5010 5011@item 5012The revision numbers are not affected. 5013@end itemize 5014 5015@noindent 5016Disadvantages: 5017 5018@itemize @bullet 5019@item 5020You cannot easily see the history of the file across the rename. 5021 5022@ignore 5023@c Is this true? I don't see how the revision numbers 5024@c _could_ start over, when new,v is just old,v with 5025@c the tags deleted. 5026@c If there is some need to reinstate this text, 5027@c it is "usually 1.1", not "1.0" and it needs an 5028@c xref to Assigning revisions 5029@item 5030Unless you use the @samp{-r rev} (@pxref{commit 5031options}) flag when @var{new} is committed its revision 5032numbers will start at 1.0 again. 5033@end ignore 5034@end itemize 5035 5036@c --------------------------------------------------------------------- 5037@node Moving directories 5038@section Moving and renaming directories 5039@cindex Moving directories 5040@cindex Renaming directories 5041@cindex Directories, moving 5042 5043The normal way to rename or move a directory is to 5044rename or move each file within it as described in 5045@ref{Outside}. Then check out with the @samp{-P} 5046option, as described in @ref{Removing directories}. 5047 5048If you really want to hack the repository to rename or 5049delete a directory in the repository, you can do it 5050like this: 5051 5052@enumerate 5053@item 5054Inform everyone who has a checked out copy of the directory that the 5055directory will be renamed. They should commit all 5056their changes, and remove their working copies, 5057before you take the steps below. 5058 5059@item 5060Rename the directory inside the repository. 5061 5062@example 5063$ cd $CVSROOT/@var{parent-dir} 5064$ mv @var{old-dir} @var{new-dir} 5065@end example 5066 5067@item 5068Fix the @sc{cvs} administrative files, if necessary (for 5069instance if you renamed an entire module). 5070 5071@item 5072Tell everyone that they can check out again and continue 5073working. 5074 5075@end enumerate 5076 5077If someone had a working copy the @sc{cvs} commands will 5078cease to work for him, until he removes the directory 5079that disappeared inside the repository. 5080 5081It is almost always better to move the files in the 5082directory instead of moving the directory. If you move the 5083directory you are unlikely to be able to retrieve old 5084releases correctly, since they probably depend on the 5085name of the directories. 5086 5087@c --------------------------------------------------------------------- 5088@node History browsing 5089@chapter History browsing 5090@cindex History browsing 5091@cindex Traceability 5092@cindex Isolation 5093 5094@ignore 5095@c This is too long for an introduction (goal is 5096@c one 20x80 character screen), and also mixes up a 5097@c variety of issues (parallel development, history, 5098@c maybe even touches on process control). 5099 5100@c -- @quote{To lose ones history is to lose ones soul.} 5101@c -- /// 5102@c -- ///Those who cannot remember the past are condemned to repeat it. 5103@c -- /// -- George Santayana 5104@c -- /// 5105 5106@sc{cvs} tries to make it easy for a group of people to work 5107together. This is done in two ways: 5108 5109@itemize @bullet 5110@item 5111Isolation---You have your own working copy of the 5112source. You are not affected by modifications made by 5113others until you decide to incorporate those changes 5114(via the @code{update} command---@pxref{update}). 5115 5116@item 5117Traceability---When something has changed, you can 5118always see @emph{exactly} what changed. 5119@end itemize 5120 5121There are several features of @sc{cvs} that together lead 5122to traceability: 5123 5124@itemize @bullet 5125@item 5126Each revision of a file has an accompanying log 5127message. 5128 5129@item 5130All commits are optionally logged to a central history 5131database. 5132 5133@item 5134Logging information can be sent to a user-defined 5135program (@pxref{loginfo}). 5136@end itemize 5137 5138@c -- More text here. 5139 5140This chapter should talk about the history file, the 5141@code{log} command, the usefulness of ChangeLogs 5142even when you run @sc{cvs}, and things like that. 5143 5144@end ignore 5145 5146@c kind of lame, in a lot of ways the above text inside 5147@c the @ignore motivates this chapter better 5148Once you have used @sc{cvs} to store a version control 5149history---what files have changed when, how, and by 5150whom, there are a variety of mechanisms for looking 5151through the history. 5152 5153@c FIXME: should also be talking about how you look at 5154@c old revisions (e.g. "cvs update -p -r 1.2 foo.c"). 5155@menu 5156* log messages:: Log messages 5157* history database:: The history database 5158* user-defined logging:: User-defined logging 5159* annotate:: What revision modified each line of a file? 5160@end menu 5161 5162@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5163@node log messages 5164@section Log messages 5165 5166@c FIXME: @xref to place where we talk about how to 5167@c specify message to commit. 5168Whenever you commit a file you specify a log message. 5169 5170@c FIXME: bring the information here, and get rid of or 5171@c greatly shrink the "log" node. 5172To look through the log messages which have been 5173specified for every revision which has been committed, 5174use the @code{cvs log} command (@pxref{log}). 5175 5176@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5177@node history database 5178@section The history database 5179 5180@c FIXME: bring the information from the history file 5181@c and history nodes here. Rewrite it to be motivated 5182@c better (start out by clearly explaining what gets 5183@c logged in history, for example). 5184You can use the history file (@pxref{history file}) to 5185log various @sc{cvs} actions. To retrieve the 5186information from the history file, use the @code{cvs 5187history} command (@pxref{history}). 5188 5189Note: you can control what is logged to this file by using the 5190@samp{LogHistory} keyword in the @file{CVSROOT/config} file 5191(@pxref{config}). 5192 5193@c 5194@c The history database has many problems: 5195@c * It is very unclear what field means what. This 5196@c could be improved greatly by better documentation, 5197@c but there are still non-orthogonalities (for 5198@c example, tag does not record the "repository" 5199@c field but most records do). 5200@c * Confusion about files, directories, and modules. 5201@c Some commands record one, some record others. 5202@c * File removal is not logged. There is an 'R' 5203@c record type documented, but CVS never uses it. 5204@c * Tags are only logged for the "cvs rtag" command, 5205@c not "cvs tag". The fix for this is not completely 5206@c clear (see above about modules vs. files). 5207@c * Are there other cases of operations that are not 5208@c logged? One would hope for all changes to the 5209@c repository to be logged somehow (particularly 5210@c operations like tagging, "cvs admin -k", and other 5211@c operations which do not record a history that one 5212@c can get with "cvs log"). Operations on the working 5213@c directory, like export, get, and release, are a 5214@c second category also covered by the current "cvs 5215@c history". 5216@c * The history file does not record the options given 5217@c to a command. The most serious manifestation of 5218@c this is perhaps that it doesn't record whether a command 5219@c was recursive. It is not clear to me whether one 5220@c wants to log at a level very close to the command 5221@c line, as a sort of way of logging each command 5222@c (more or less), or whether one wants 5223@c to log more at the level of what was changed (or 5224@c something in between), but either way the current 5225@c information has pretty big gaps. 5226@c * Further details about a tag--like whether it is a 5227@c branch tag or, if a non-branch tag, which branch it 5228@c is on. One can find out this information about the 5229@c tag as it exists _now_, but if the tag has been 5230@c moved, one doesn't know what it was like at the time 5231@c the history record was written. 5232@c * Whether operating on a particular tag, date, or 5233@c options was implicit (sticky) or explicit. 5234@c 5235@c Another item, only somewhat related to the above, is a 5236@c way to control what is logged in the history file. 5237@c This is probably the only good way to handle 5238@c different people having different ideas about 5239@c information/space tradeoffs. 5240@c 5241@c It isn't really clear that it makes sense to try to 5242@c patch up the history file format as it exists now to 5243@c include all that stuff. It might be better to 5244@c design a whole new CVSROOT/nhistory file and "cvs 5245@c nhistory" command, or some such, or in some other 5246@c way trying to come up with a clean break from the 5247@c past, which can address the above concerns. Another 5248@c open question is how/whether this relates to 5249@c taginfo/loginfo/etc. 5250 5251@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5252@node user-defined logging 5253@section User-defined logging 5254 5255@c FIXME: should probably also mention the fact the -l 5256@c global option can disable most of the mechanisms 5257@c discussed here (why? What is the -l global option for?). 5258@c 5259@c FIXME: probably should centralize this information 5260@c here, at least to some extent. Maybe by moving the 5261@c loginfo, etc., nodes here and replacing 5262@c the "user-defined logging" node with one node for 5263@c each method. 5264You can customize @sc{cvs} to log various kinds of 5265actions, in whatever manner you choose. These 5266mechanisms operate by executing a script at various 5267times. The script might append a message to a file 5268listing the information and the programmer who created 5269it, or send mail to a group of developers, or, perhaps, 5270post a message to a particular newsgroup. To log 5271commits, use the @file{loginfo} file (@pxref{loginfo}). 5272@c FIXME: What is difference between doing it in the 5273@c modules file and using loginfo/taginfo? Why should 5274@c user use one or the other? 5275To log commits, checkouts, exports, and tags, 5276respectively, you can also use the @samp{-i}, 5277@samp{-o}, @samp{-e}, and @samp{-t} options in the 5278modules file. For a more flexible way of giving 5279notifications to various users, which requires less in 5280the way of keeping centralized scripts up to date, use 5281the @code{cvs watch add} command (@pxref{Getting 5282Notified}); this command is useful even if you are not 5283using @code{cvs watch on}. 5284 5285@cindex taginfo 5286@cindex Exit status, of taginfo 5287The @file{taginfo} file defines programs to execute 5288when someone executes a @code{tag} or @code{rtag} 5289command. The @file{taginfo} file has the standard form 5290for administrative files (@pxref{Administrative 5291files}), where each line is a regular expression 5292followed by a command to execute. The arguments passed 5293to the command are, in order, the @var{tagname}, 5294@var{operation} (@code{add} for @code{tag}, 5295@code{mov} for @code{tag -F}, and @code{del} for 5296@code{tag -d}), @var{repository}, and any remaining are 5297pairs of @var{filename} @var{revision}. A non-zero 5298exit of the filter program will cause the tag to be 5299aborted. 5300 5301Here is an example of using taginfo to log tag and rtag 5302commands. In the taginfo file put: 5303 5304@example 5305ALL /usr/local/cvsroot/CVSROOT/loggit 5306@end example 5307 5308Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the 5309following script: 5310 5311@example 5312#!/bin/sh 5313echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog 5314@end example 5315 5316@node annotate 5317@section Annotate command 5318@cindex annotate (subcommand) 5319 5320@deffn Command {cvs annotate} [@code{-flR}] [@code{-r rev}|@code{-D date}] files @dots{} 5321 5322For each file in @var{files}, print the head revision 5323of the trunk, together with information on the last 5324modification for each line. For example: 5325 5326@example 5327$ cvs annotate ssfile 5328Annotations for ssfile 5329*************** 53301.1 (mary 27-Mar-96): ssfile line 1 53311.2 (joe 28-Mar-96): ssfile line 2 5332@end example 5333 5334The file @file{ssfile} currently contains two lines. 5335The @code{ssfile line 1} line was checked in by 5336@code{mary} on March 27. Then, on March 28, @code{joe} 5337added a line @code{ssfile line 2}, without modifying 5338the @code{ssfile line 1} line. This report doesn't 5339tell you anything about lines which have been deleted 5340or replaced; you need to use @code{cvs diff} for that 5341(@pxref{diff}). 5342 5343@end deffn 5344 5345The options to @code{cvs annotate} are listed in 5346@ref{Invoking CVS}, and can be used to select the files 5347and revisions to annotate. The options are described 5348in more detail in @ref{Common options}. 5349 5350@c FIXME: maybe an example using the options? Just 5351@c what it means to select a revision might be worth a 5352@c few words of explanation ("you want to see who 5353@c changed this line *before* 1.4"...). 5354 5355@c --------------------------------------------------------------------- 5356@node Binary files 5357@chapter Handling binary files 5358@cindex Binary files 5359 5360The most common use for @sc{cvs} is to store text 5361files. With text files, @sc{cvs} can merge revisions, 5362display the differences between revisions in a 5363human-visible fashion, and other such operations. 5364However, if you are willing to give up a few of these 5365abilities, @sc{cvs} can store binary files. For 5366example, one might store a web site in @sc{cvs} 5367including both text files and binary images. 5368 5369@menu 5370* Binary why:: More details on issues with binary files 5371* Binary howto:: How to store them 5372@end menu 5373 5374@node Binary why 5375@section The issues with binary files 5376 5377While the need to manage binary files may seem obvious 5378if the files that you customarily work with are binary, 5379putting them into version control does present some 5380additional issues. 5381 5382One basic function of version control is to show the 5383differences between two revisions. For example, if 5384someone else checked in a new version of a file, you 5385may wish to look at what they changed and determine 5386whether their changes are good. For text files, 5387@sc{cvs} provides this functionality via the @code{cvs 5388diff} command. For binary files, it may be possible to 5389extract the two revisions and then compare them with a 5390tool external to @sc{cvs} (for example, word processing 5391software often has such a feature). If there is no 5392such tool, one must track changes via other mechanisms, 5393such as urging people to write good log messages, and 5394hoping that the changes they actually made were the 5395changes that they intended to make. 5396 5397Another ability of a version control system is the 5398ability to merge two revisions. For @sc{cvs} this 5399happens in two contexts. The first is when users make 5400changes in separate working directories 5401(@pxref{Multiple developers}). The second is when one 5402merges explicitly with the @samp{update -j} command 5403(@pxref{Branching and merging}). 5404 5405In the case of text 5406files, @sc{cvs} can merge changes made independently, 5407and signal a conflict if the changes conflict. With 5408binary files, the best that @sc{cvs} can do is present 5409the two different copies of the file, and leave it to 5410the user to resolve the conflict. The user may choose 5411one copy or the other, or may run an external merge 5412tool which knows about that particular file format, if 5413one exists. 5414Note that having the user merge relies primarily on the 5415user to not accidentally omit some changes, and thus is 5416potentially error prone. 5417 5418If this process is thought to be undesirable, the best 5419choice may be to avoid merging. To avoid the merges 5420that result from separate working directories, see the 5421discussion of reserved checkouts (file locking) in 5422@ref{Multiple developers}. To avoid the merges 5423resulting from branches, restrict use of branches. 5424 5425@node Binary howto 5426@section How to store binary files 5427 5428There are two issues with using @sc{cvs} to store 5429binary files. The first is that @sc{cvs} by default 5430converts line endings between the canonical form in 5431which they are stored in the repository (linefeed 5432only), and the form appropriate to the operating system 5433in use on the client (for example, carriage return 5434followed by line feed for Windows NT). 5435 5436The second is that a binary file might happen to 5437contain data which looks like a keyword (@pxref{Keyword 5438substitution}), so keyword expansion must be turned 5439off. 5440 5441@c FIXME: the third is that one can't do merges with 5442@c binary files. xref to Multiple Developers and the 5443@c reserved checkout issues. 5444 5445The @samp{-kb} option available with some @sc{cvs} 5446commands insures that neither line ending conversion 5447nor keyword expansion will be done. 5448 5449Here is an example of how you can create a new file 5450using the @samp{-kb} flag: 5451 5452@example 5453$ echo '$@asis{}Id$' > kotest 5454$ cvs add -kb -m"A test file" kotest 5455$ cvs ci -m"First checkin; contains a keyword" kotest 5456@end example 5457 5458If a file accidentally gets added without @samp{-kb}, 5459one can use the @code{cvs admin} command to recover. 5460For example: 5461 5462@example 5463$ echo '$@asis{}Id$' > kotest 5464$ cvs add -m"A test file" kotest 5465$ cvs ci -m"First checkin; contains a keyword" kotest 5466$ cvs admin -kb kotest 5467$ cvs update -A kotest 5468# @r{For non-unix systems:} 5469# @r{Copy in a good copy of the file from outside CVS} 5470$ cvs commit -m "make it binary" kotest 5471@end example 5472 5473@c Trying to describe this for both unix and non-unix 5474@c in the same description is very confusing. Might 5475@c want to split the two, or just ditch the unix "shortcut" 5476@c (unixheads don't do much with binary files, anyway). 5477@c This used to say "(Try the above example, and do a 5478@c @code{cat kotest} after every command)". But that 5479@c only really makes sense for the unix case. 5480When you check in the file @file{kotest} the file is 5481not preserved as a binary file, because you did not 5482check it in as a binary file. The @code{cvs 5483admin -kb} command sets the default keyword 5484substitution method for this file, but it does not 5485alter the working copy of the file that you have. If you need to 5486cope with line endings (that is, you are using 5487@sc{cvs} on a non-unix system), then you need to 5488check in a new copy of the file, as shown by the 5489@code{cvs commit} command above. 5490On unix, the @code{cvs update -A} command suffices. 5491@c FIXME: should also describe what the *other users* 5492@c need to do, if they have checked out copies which 5493@c have been corrupted by lack of -kb. I think maybe 5494@c "cvs update -kb" or "cvs 5495@c update -A" would suffice, although the user who 5496@c reported this suggested removing the file, manually 5497@c removing it from CVS/Entries, and then "cvs update" 5498 5499However, in using @code{cvs admin -k} to change the 5500keyword expansion, be aware that the keyword expansion 5501mode is not version controlled. This means that, for 5502example, that if you have a text file in old releases, 5503and a binary file with the same name in new releases, 5504@sc{cvs} provides no way to check out the file in text 5505or binary mode depending on what version you are 5506checking out. There is no good workaround for this 5507problem. 5508 5509You can also set a default for whether @code{cvs add} 5510and @code{cvs import} treat a file as binary based on 5511its name; for example you could say that files who 5512names end in @samp{.exe} are binary. @xref{Wrappers}. 5513There is currently no way to have @sc{cvs} detect 5514whether a file is binary based on its contents. The 5515main difficulty with designing such a feature is that 5516it is not clear how to distinguish between binary and 5517non-binary files, and the rules to apply would vary 5518considerably with the operating system. 5519@c For example, it would be good on MS-DOS-family OSes 5520@c for anything containing ^Z to be binary. Having 5521@c characters with the 8th bit set imply binary is almost 5522@c surely a bad idea in the context of ISO-8859-* and 5523@c other such character sets. On VMS or the Mac, we 5524@c could use the OS's file typing. This is a 5525@c commonly-desired feature, and something of this sort 5526@c may make sense. But there are a lot of pitfalls here. 5527@c 5528@c Another, probably better, way to tell is to read the 5529@c file in text mode, write it to a temp file in text 5530@c mode, and then do a binary mode compare of the two 5531@c files. If they differ, it is a binary file. This 5532@c might have problems on VMS (or some other system 5533@c with several different text modes), but in general 5534@c should be relatively portable. The only other 5535@c downside I can think of is that it would be fairly 5536@c slow, but that is perhaps a small price to pay for 5537@c not having your files corrupted. Another issue is 5538@c what happens if you import a text file with bare 5539@c linefeeds on Windows. Such files will show up on 5540@c Windows sometimes (I think some native windows 5541@c programs even write them, on occasion). Perhaps it 5542@c is reasonable to treat such files as binary; after 5543@c all it is something of a presumption to assume that 5544@c the user would want the linefeeds converted to CRLF. 5545 5546@c --------------------------------------------------------------------- 5547@node Multiple developers 5548@chapter Multiple developers 5549@cindex Multiple developers 5550@cindex Team of developers 5551@cindex File locking 5552@cindex Locking files 5553@cindex Working copy 5554@cindex Reserved checkouts 5555@cindex Unreserved checkouts 5556@cindex RCS-style locking 5557 5558When more than one person works on a software project 5559things often get complicated. Often, two people try to 5560edit the same file simultaneously. One solution, known 5561as @dfn{file locking} or @dfn{reserved checkouts}, is 5562to allow only one person to edit each file at a time. 5563This is the only solution with some version control 5564systems, including @sc{rcs} and @sc{sccs}. Currently 5565the usual way to get reserved checkouts with @sc{cvs} 5566is the @code{cvs admin -l} command (@pxref{admin 5567options}). This is not as nicely integrated into 5568@sc{cvs} as the watch features, described below, but it 5569seems that most people with a need for reserved 5570checkouts find it adequate. 5571@c Or "find it better than worrying about implementing 5572@c nicely integrated reserved checkouts" or ...? 5573It also may be possible to use the watches 5574features described below, together with suitable 5575procedures (not enforced by software), to avoid having 5576two people edit at the same time. 5577 5578@c Our unreserved checkout model might not 5579@c be quite the same as others. For example, I 5580@c think that some systems will tend to create a branch 5581@c in the case where CVS prints "up-to-date check failed". 5582@c It isn't clear to me whether we should try to 5583@c explore these subtleties; it could easily just 5584@c confuse people. 5585The default model with @sc{cvs} is known as 5586@dfn{unreserved checkouts}. In this model, developers 5587can edit their own @dfn{working copy} of a file 5588simultaneously. The first person that commits his 5589changes has no automatic way of knowing that another 5590has started to edit it. Others will get an error 5591message when they try to commit the file. They must 5592then use @sc{cvs} commands to bring their working copy 5593up to date with the repository revision. This process 5594is almost automatic. 5595 5596@c FIXME? should probably use the word "watch" here, to 5597@c tie this into the text below and above. 5598@sc{cvs} also supports mechanisms which facilitate 5599various kinds of communication, without actually 5600enforcing rules like reserved checkouts do. 5601 5602The rest of this chapter describes how these various 5603models work, and some of the issues involved in 5604choosing between them. 5605 5606@ignore 5607Here is a draft reserved checkout design or discussion 5608of the issues. This seems like as good a place as any 5609for this. 5610 5611Might want a cvs lock/cvs unlock--in which the names 5612differ from edit/unedit because the network must be up 5613for these to work. unedit gives an error if there is a 5614reserved checkout in place (so that people don't 5615accidentally leave locks around); unlock gives an error 5616if one is not in place (this is more arguable; perhaps 5617it should act like unedit in that case). 5618 5619On the other hand, might want it so that emacs, 5620scripts, etc., can get ready to edit a file without 5621having to know which model is in use. In that case we 5622would have a "cvs watch lock" (or .cvsrc?) (that is, 5623three settings, "on", "off", and "lock"). Having cvs 5624watch lock set would cause a get to record in the CVS 5625directory which model is in use, and cause "cvs edit" 5626to change behaviors. We'd want a way to query which 5627setting is in effect (this would be handy even if it is 5628only "on" or "off" as presently). If lock is in 5629effect, then commit would require a lock before 5630allowing a checkin; chmod wouldn't suffice (might be 5631debatable--see chmod comment below, in watches--but it 5632is the way people expect RCS to work and I can't think 5633of any significant downside. On the other hand, maybe 5634it isn't worth bothering, because people who are used 5635to RCS wouldn't think to use chmod anyway). 5636 5637Implementation: use file attributes or use RCS 5638locking. The former avoids more dependence on RCS 5639behaviors we will need to reimplement as we librarify 5640RCS, and makes it easier to import/export RCS files (in 5641that context, want to ignore the locker field). But 5642note that RCS locks are per-branch, which is the 5643correct behavior (this is also an issue for the "watch 5644on" features; they should be per-branch too). 5645 5646Here are a few more random notes about implementation 5647details, assuming "cvs watch lock" and 5648 5649CVS/Watched file? Or try to fit this into CVS/Entries somehow? 5650Cases: (1) file is checked out (unreserved or with watch on) by old 5651version of CVS, now we do something with new one, (2) file is checked 5652out by new version, now we do something with old one. 5653 5654Remote protocol would have a "Watched" analogous to "Mode". Of course 5655it would apply to all Updated-like requests. How do we keep this 5656setting up to date? I guess that there wants to be a Watched request, 5657and the server would send a new one if it isn't up to date? (Ugh--hard 5658to implement and slows down "cvs -q update"--is there an easier way?) 5659 5660"cvs edit"--checks CVS/Watched, and if watch lock, then sends 5661"edit-lock" request. Which comes back with a Checked-in with 5662appropriate Watched (off, on, lock, locked, or some such?), or error 5663message if already locked. 5664 5665"cvs commit"--only will commit if off/on/locked. lock is not OK. 5666 5667Doc: 5668note that "cvs edit" must be connected to network if watch lock is in 5669effect. 5670 5671Talk about what to do if someone has locked a file and you want to 5672edit that file. (breaking locks, or lack thereof). 5673 5674 5675One other idea (which could work along with the 5676existing "cvs admin -l" reserved checkouts, as well as 5677the above): 5678 5679"cvs editors" could show who has the file locked, if 5680someone does. 5681 5682@end ignore 5683 5684@menu 5685* File status:: A file can be in several states 5686* Updating a file:: Bringing a file up-to-date 5687* Conflicts example:: An informative example 5688* Informing others:: To cooperate you must inform 5689* Concurrency:: Simultaneous repository access 5690* Watches:: Mechanisms to track who is editing files 5691* Choosing a model:: Reserved or unreserved checkouts? 5692@end menu 5693 5694@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5695@node File status 5696@section File status 5697@cindex File status 5698@cindex Status of a file 5699 5700@c Shouldn't this start with an example or something, 5701@c introducing the unreserved checkout model? Before we 5702@c dive into listing states? 5703Based on what operations you have performed on a 5704checked out file, and what operations others have 5705performed to that file in the repository, one can 5706classify a file in a number of states. The states, as 5707reported by the @code{status} command, are: 5708 5709@c The order of items is chosen to group logically 5710@c similar outputs together. 5711@c People who want alphabetical can use the index... 5712@table @asis 5713@cindex Up-to-date 5714@item Up-to-date 5715The file is identical with the latest revision in the 5716repository for the branch in use. 5717@c FIXME: should we clarify "in use"? The answer is 5718@c sticky tags, and trying to distinguish branch sticky 5719@c tags from non-branch sticky tags seems rather awkward 5720@c here. 5721@c FIXME: What happens with non-branch sticky tags? Is 5722@c a stuck file "Up-to-date" or "Needs checkout" or what? 5723 5724@item Locally Modified 5725@cindex Locally Modified 5726You have edited the file, and not yet committed your changes. 5727 5728@item Locally Added 5729@cindex Locally Added 5730You have added the file with @code{add}, and not yet 5731committed your changes. 5732@c There are many cases involving the file being 5733@c added/removed/modified in the working directory, and 5734@c added/removed/modified in the repository, which we 5735@c don't try to describe here. I'm not sure that "cvs 5736@c status" produces a non-confusing output in most of 5737@c those cases. 5738 5739@item Locally Removed 5740@cindex Locally Removed 5741You have removed the file with @code{remove}, and not yet 5742committed your changes. 5743 5744@item Needs Checkout 5745@cindex Needs Checkout 5746Someone else has committed a newer revision to the 5747repository. The name is slightly misleading; you will 5748ordinarily use @code{update} rather than 5749@code{checkout} to get that newer revision. 5750 5751@item Needs Patch 5752@cindex Needs Patch 5753@c See also newb-123j0 in sanity.sh (although that case 5754@c should probably be changed rather than documented). 5755Like Needs Checkout, but the @sc{cvs} server will send 5756a patch rather than the entire file. Sending a patch or 5757sending an entire file accomplishes the same thing. 5758 5759@item Needs Merge 5760@cindex Needs Merge 5761Someone else has committed a newer revision to the repository, and you 5762have also made modifications to the file. 5763 5764@item File had conflicts on merge 5765@cindex File had conflicts on merge 5766@c is it worth saying that this message was "Unresolved 5767@c Conflict" in CVS 1.9 and earlier? I'm inclined to 5768@c think that is unnecessarily confusing to new users. 5769This is like Locally Modified, except that a previous 5770@code{update} command gave a conflict. If you have not 5771already done so, you need to 5772resolve the conflict as described in @ref{Conflicts example}. 5773 5774@item Unknown 5775@cindex Unknown 5776@sc{cvs} doesn't know anything about this file. For 5777example, you have created a new file and have not run 5778@code{add}. 5779@c 5780@c "Entry Invalid" and "Classify Error" are also in the 5781@c status.c. The latter definitely indicates a CVS bug 5782@c (should it be worded more like "internal error" so 5783@c people submit bug reports if they see it?). The former 5784@c I'm not as sure; I haven't tracked down whether/when it 5785@c appears in "cvs status" output. 5786 5787@end table 5788 5789To help clarify the file status, @code{status} also 5790reports the @code{Working revision} which is the 5791revision that the file in the working directory derives 5792from, and the @code{Repository revision} which is the 5793latest revision in the repository for the branch in 5794use. 5795@c FIXME: should we clarify "in use"? The answer is 5796@c sticky tags, and trying to distinguish branch sticky 5797@c tags from non-branch sticky tags seems rather awkward 5798@c here. 5799@c FIXME: What happens with non-branch sticky tags? 5800@c What is the Repository Revision there? See the 5801@c comment at vn_rcs in cvs.h, which is kind of 5802@c confused--we really need to document better what this 5803@c field contains. 5804@c Q: Should we document "New file!" and other such 5805@c outputs or are they self-explanatory? 5806@c FIXME: what about the date to the right of "Working 5807@c revision"? It doesn't appear with client/server and 5808@c seems unnecessary (redundant with "ls -l") so 5809@c perhaps it should be removed for non-client/server too? 5810@c FIXME: Need some examples. 5811@c FIXME: Working revision can also be something like 5812@c "-1.3" for a locally removed file. Not at all 5813@c self-explanatory (and it is possible that CVS should 5814@c be changed rather than documenting this). 5815 5816@c Would be nice to have an @example showing output 5817@c from cvs status, with comments showing the xref 5818@c where each part of the output is described. This 5819@c might fit in nicely if it is desirable to split this 5820@c node in two; one to introduce "cvs status" and one 5821@c to list each of the states. 5822The options to @code{status} are listed in 5823@ref{Invoking CVS}. For information on its @code{Sticky tag} 5824and @code{Sticky date} output, see @ref{Sticky tags}. 5825For information on its @code{Sticky options} output, 5826see the @samp{-k} option in @ref{update options}. 5827 5828You can think of the @code{status} and @code{update} 5829commands as somewhat complementary. You use 5830@code{update} to bring your files up to date, and you 5831can use @code{status} to give you some idea of what an 5832@code{update} would do (of course, the state of the 5833repository might change before you actually run 5834@code{update}). In fact, if you want a command to 5835display file status in a more brief format than is 5836displayed by the @code{status} command, you can invoke 5837 5838@cindex update, to display file status 5839@example 5840$ cvs -n -q update 5841@end example 5842 5843The @samp{-n} option means to not actually do the 5844update, but merely to display statuses; the @samp{-q} 5845option avoids printing the name of each directory. For 5846more information on the @code{update} command, and 5847these options, see @ref{Invoking CVS}. 5848 5849@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5850@node Updating a file 5851@section Bringing a file up to date 5852@cindex Bringing a file up to date 5853@cindex Updating a file 5854@cindex Merging a file 5855@cindex Update, introduction 5856 5857When you want to update or merge a file, use the @code{update} 5858command. For files that are not up to date this is roughly equivalent 5859to a @code{checkout} command: the newest revision of the file is 5860extracted from the repository and put in your working directory. 5861 5862Your modifications to a file are never lost when you 5863use @code{update}. If no newer revision exists, 5864running @code{update} has no effect. If you have 5865edited the file, and a newer revision is available, 5866@sc{cvs} will merge all changes into your working copy. 5867 5868For instance, imagine that you checked out revision 1.4 and started 5869editing it. In the meantime someone else committed revision 1.5, and 5870shortly after that revision 1.6. If you run @code{update} on the file 5871now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into 5872your file. 5873 5874@cindex Overlap 5875If any of the changes between 1.4 and 1.6 were made too 5876close to any of the changes you have made, an 5877@dfn{overlap} occurs. In such cases a warning is 5878printed, and the resulting file includes both 5879versions of the lines that overlap, delimited by 5880special markers. 5881@xref{update}, for a complete description of the 5882@code{update} command. 5883 5884@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5885@node Conflicts example 5886@section Conflicts example 5887@cindex Merge, an example 5888@cindex Example of merge 5889@cindex driver.c (merge example) 5890 5891Suppose revision 1.4 of @file{driver.c} contains this: 5892 5893@example 5894#include <stdio.h> 5895 5896void main() 5897@{ 5898 parse(); 5899 if (nerr == 0) 5900 gencode(); 5901 else 5902 fprintf(stderr, "No code generated.\n"); 5903 exit(nerr == 0 ? 0 : 1); 5904@} 5905@end example 5906 5907@noindent 5908Revision 1.6 of @file{driver.c} contains this: 5909 5910@example 5911#include <stdio.h> 5912 5913int main(int argc, 5914 char **argv) 5915@{ 5916 parse(); 5917 if (argc != 1) 5918 @{ 5919 fprintf(stderr, "tc: No args expected.\n"); 5920 exit(1); 5921 @} 5922 if (nerr == 0) 5923 gencode(); 5924 else 5925 fprintf(stderr, "No code generated.\n"); 5926 exit(!!nerr); 5927@} 5928@end example 5929 5930@noindent 5931Your working copy of @file{driver.c}, based on revision 59321.4, contains this before you run @samp{cvs update}: 5933@c -- Really include "cvs"? 5934 5935@example 5936#include <stdlib.h> 5937#include <stdio.h> 5938 5939void main() 5940@{ 5941 init_scanner(); 5942 parse(); 5943 if (nerr == 0) 5944 gencode(); 5945 else 5946 fprintf(stderr, "No code generated.\n"); 5947 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 5948@} 5949@end example 5950 5951@noindent 5952You run @samp{cvs update}: 5953@c -- Really include "cvs"? 5954 5955@example 5956$ cvs update driver.c 5957RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v 5958retrieving revision 1.4 5959retrieving revision 1.6 5960Merging differences between 1.4 and 1.6 into driver.c 5961rcsmerge warning: overlaps during merge 5962cvs update: conflicts found in driver.c 5963C driver.c 5964@end example 5965 5966@noindent 5967@cindex Conflicts (merge example) 5968@sc{cvs} tells you that there were some conflicts. 5969Your original working file is saved unmodified in 5970@file{.#driver.c.1.4}. The new version of 5971@file{driver.c} contains this: 5972 5973@example 5974#include <stdlib.h> 5975#include <stdio.h> 5976 5977int main(int argc, 5978 char **argv) 5979@{ 5980 init_scanner(); 5981 parse(); 5982 if (argc != 1) 5983 @{ 5984 fprintf(stderr, "tc: No args expected.\n"); 5985 exit(1); 5986 @} 5987 if (nerr == 0) 5988 gencode(); 5989 else 5990 fprintf(stderr, "No code generated.\n"); 5991@asis{}<<<<<<< driver.c 5992 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 5993@asis{}======= 5994 exit(!!nerr); 5995@asis{}>>>>>>> 1.6 5996@} 5997@end example 5998 5999@noindent 6000@cindex Markers, conflict 6001@cindex Conflict markers 6002@cindex <<<<<<< 6003@cindex >>>>>>> 6004@cindex ======= 6005 6006Note how all non-overlapping modifications are incorporated in your working 6007copy, and that the overlapping section is clearly marked with 6008@samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}. 6009 6010@cindex Resolving a conflict 6011@cindex Conflict resolution 6012You resolve the conflict by editing the file, removing the markers and 6013the erroneous line. Suppose you end up with this file: 6014@c -- Add xref to the pcl-cvs manual when it talks 6015@c -- about this. 6016@example 6017#include <stdlib.h> 6018#include <stdio.h> 6019 6020int main(int argc, 6021 char **argv) 6022@{ 6023 init_scanner(); 6024 parse(); 6025 if (argc != 1) 6026 @{ 6027 fprintf(stderr, "tc: No args expected.\n"); 6028 exit(1); 6029 @} 6030 if (nerr == 0) 6031 gencode(); 6032 else 6033 fprintf(stderr, "No code generated.\n"); 6034 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6035@} 6036@end example 6037 6038@noindent 6039You can now go ahead and commit this as revision 1.7. 6040 6041@example 6042$ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c 6043Checking in driver.c; 6044/usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c 6045new revision: 1.7; previous revision: 1.6 6046done 6047@end example 6048 6049For your protection, @sc{cvs} will refuse to check in a 6050file if a conflict occurred and you have not resolved 6051the conflict. Currently to resolve a conflict, you 6052must change the timestamp on the file. In previous 6053versions of @sc{cvs}, you also needed to 6054insure that the file contains no conflict markers. 6055Because 6056your file may legitimately contain conflict markers (that 6057is, occurrences of @samp{>>>>>>> } at the start of a 6058line that don't mark a conflict), the current 6059version of @sc{cvs} will print a warning and proceed to 6060check in the file. 6061@c The old behavior was really icky; the only way out 6062@c was to start hacking on 6063@c the @code{CVS/Entries} file or other such workarounds. 6064@c 6065@c If the timestamp thing isn't considered nice enough, 6066@c maybe there should be a "cvs resolved" command 6067@c which clears the conflict indication. For a nice user 6068@c interface, this should be invoked by an interactive 6069@c merge tool like emerge rather than by the user 6070@c directly--such a tool can verify that the user has 6071@c really dealt with each conflict. 6072 6073@cindex emerge 6074If you use release 1.04 or later of pcl-cvs (a @sc{gnu} 6075Emacs front-end for @sc{cvs}) you can use an Emacs 6076package called emerge to help you resolve conflicts. 6077See the documentation for pcl-cvs. 6078 6079@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6080@node Informing others 6081@section Informing others about commits 6082@cindex Informing others 6083@cindex Spreading information 6084@cindex Mail, automatic mail on commit 6085 6086It is often useful to inform others when you commit a 6087new revision of a file. The @samp{-i} option of the 6088@file{modules} file, or the @file{loginfo} file, can be 6089used to automate this process. @xref{modules}. 6090@xref{loginfo}. You can use these features of @sc{cvs} 6091to, for instance, instruct @sc{cvs} to mail a 6092message to all developers, or post a message to a local 6093newsgroup. 6094@c -- More text would be nice here. 6095 6096@node Concurrency 6097@section Several developers simultaneously attempting to run CVS 6098 6099@cindex Locks, cvs, introduction 6100@c For a discussion of *why* CVS creates locks, see 6101@c the comment at the start of src/lock.c 6102If several developers try to run @sc{cvs} at the same 6103time, one may get the following message: 6104 6105@example 6106[11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo 6107@end example 6108 6109@cindex #cvs.rfl, removing 6110@cindex #cvs.wfl, removing 6111@cindex #cvs.lock, removing 6112@sc{cvs} will try again every 30 seconds, and either 6113continue with the operation or print the message again, 6114if it still needs to wait. If a lock seems to stick 6115around for an undue amount of time, find the person 6116holding the lock and ask them about the cvs command 6117they are running. If they aren't running a cvs 6118command, look in the repository directory mentioned in 6119the message and remove files which they own whose names 6120start with @file{#cvs.rfl}, 6121@file{#cvs.wfl}, or @file{#cvs.lock}. 6122 6123Note that these locks are to protect @sc{cvs}'s 6124internal data structures and have no relationship to 6125the word @dfn{lock} in the sense used by 6126@sc{rcs}---which refers to reserved checkouts 6127(@pxref{Multiple developers}). 6128 6129Any number of people can be reading from a given 6130repository at a time; only when someone is writing do 6131the locks prevent other people from reading or writing. 6132 6133@cindex Atomic transactions, lack of 6134@cindex Transactions, atomic, lack of 6135@c the following talks about what one might call commit/update 6136@c atomicity. 6137@c Probably also should say something about 6138@c commit/commit atomicity, that is, "An update will 6139@c not get partial versions of more than one commit". 6140@c CVS currently has this property and I guess we can 6141@c make it a documented feature. 6142@c For example one person commits 6143@c a/one.c and b/four.c and another commits a/two.c and 6144@c b/three.c. Then an update cannot get the new a/one.c 6145@c and a/two.c and the old b/four.c and b/three.c. 6146One might hope for the following property 6147 6148@example 6149If someone commits some changes in one cvs command, 6150then an update by someone else will either get all the 6151changes, or none of them. 6152@end example 6153 6154but @sc{cvs} does @emph{not} have this property. For 6155example, given the files 6156 6157@example 6158a/one.c 6159a/two.c 6160b/three.c 6161b/four.c 6162@end example 6163 6164if someone runs 6165 6166@example 6167cvs ci a/two.c b/three.c 6168@end example 6169 6170and someone else runs @code{cvs update} at the same 6171time, the person running @code{update} might get only 6172the change to @file{b/three.c} and not the change to 6173@file{a/two.c}. 6174 6175@node Watches 6176@section Mechanisms to track who is editing files 6177@cindex Watches 6178 6179For many groups, use of @sc{cvs} in its default mode is 6180perfectly satisfactory. Users may sometimes go to 6181check in a modification only to find that another 6182modification has intervened, but they deal with it and 6183proceed with their check in. Other groups prefer to be 6184able to know who is editing what files, so that if two 6185people try to edit the same file they can choose to 6186talk about who is doing what when rather than be 6187surprised at check in time. The features in this 6188section allow such coordination, while retaining the 6189ability of two developers to edit the same file at the 6190same time. 6191 6192@c Some people might ask why CVS does not enforce the 6193@c rule on chmod, by requiring a cvs edit before a cvs 6194@c commit. The main reason is that it could always be 6195@c circumvented--one could edit the file, and 6196@c then when ready to check it in, do the cvs edit and put 6197@c in the new contents and do the cvs commit. One 6198@c implementation note: if we _do_ want to have cvs commit 6199@c require a cvs edit, we should store the state on 6200@c whether the cvs edit has occurred in the working 6201@c directory, rather than having the server try to keep 6202@c track of what working directories exist. 6203@c FIXME: should the above discussion be part of the 6204@c manual proper, somewhere, not just in a comment? 6205For maximum benefit developers should use @code{cvs 6206edit} (not @code{chmod}) to make files read-write to 6207edit them, and @code{cvs release} (not @code{rm}) to 6208discard a working directory which is no longer in use, 6209but @sc{cvs} is not able to enforce this behavior. 6210 6211@c I'm a little dissatisfied with this presentation, 6212@c because "watch on"/"edit"/"editors" are one set of 6213@c functionality, and "watch add"/"watchers" is another 6214@c which is somewhat orthogonal even though they interact in 6215@c various ways. But I think it might be 6216@c confusing to describe them separately (e.g. "watch 6217@c add" with loginfo). I don't know. 6218 6219@menu 6220* Setting a watch:: Telling CVS to watch certain files 6221* Getting Notified:: Telling CVS to notify you 6222* Editing files:: How to edit a file which is being watched 6223* Watch information:: Information about who is watching and editing 6224* Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier 6225@end menu 6226 6227@node Setting a watch 6228@subsection Telling CVS to watch certain files 6229 6230To enable the watch features, you first specify that 6231certain files are to be watched. 6232 6233@cindex watch on (subcommand) 6234@deffn Command {cvs watch on} [@code{-lR}] files @dots{} 6235 6236@cindex Read-only files, and watches 6237Specify that developers should run @code{cvs edit} 6238before editing @var{files}. CVS will create working 6239copies of @var{files} read-only, to remind developers 6240to run the @code{cvs edit} command before working on 6241them. 6242 6243If @var{files} includes the name of a directory, CVS 6244arranges to watch all files added to the corresponding 6245repository directory, and sets a default for files 6246added in the future; this allows the user to set 6247notification policies on a per-directory basis. The 6248contents of the directory are processed recursively, 6249unless the @code{-l} option is given. 6250The @code{-R} option can be used to force recursion if the @code{-l} 6251option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 6252 6253If @var{files} is omitted, it defaults to the current directory. 6254 6255@cindex watch off (subcommand) 6256@end deffn 6257 6258@deffn Command {cvs watch off} [@code{-lR}] files @dots{} 6259 6260Do not create @var{files} read-only on checkout; thus, 6261developers will not be reminded to use @code{cvs edit} 6262and @code{cvs unedit}. 6263@ignore 6264CVS will check out @var{files} 6265read-write as usual, unless other permissions override 6266due to the @code{PreservePermissions} option being 6267enabled in the @file{config} administrative file 6268(@pxref{Special Files}, @pxref{config}) 6269@end ignore 6270 6271The @var{files} and options are processed as for @code{cvs 6272watch on}. 6273 6274@end deffn 6275 6276@node Getting Notified 6277@subsection Telling CVS to notify you 6278 6279You can tell @sc{cvs} that you want to receive 6280notifications about various actions taken on a file. 6281You can do this without using @code{cvs watch on} for 6282the file, but generally you will want to use @code{cvs 6283watch on}, so that developers use the @code{cvs edit} 6284command. 6285 6286@cindex watch add (subcommand) 6287@deffn Command {cvs watch add} [@code{-a} action] [@code{-lR}] files @dots{} 6288 6289Add the current user to the list of people to receive notification of 6290work done on @var{files}. 6291 6292The @code{-a} option specifies what kinds of events CVS should notify 6293the user about. @var{action} is one of the following: 6294 6295@table @code 6296 6297@item edit 6298Another user has applied the @code{cvs edit} command (described 6299below) to a file. 6300 6301@item unedit 6302Another user has applied the @code{cvs unedit} command (described 6303below) or the @code{cvs release} command to a file, or has deleted 6304the file and allowed @code{cvs update} to recreate it. 6305 6306@item commit 6307Another user has committed changes to a file. 6308 6309@item all 6310All of the above. 6311 6312@item none 6313None of the above. (This is useful with @code{cvs edit}, 6314described below.) 6315 6316@end table 6317 6318The @code{-a} option may appear more than once, or not at all. If 6319omitted, the action defaults to @code{all}. 6320 6321The @var{files} and options are processed as for the 6322@code{cvs watch} commands. 6323 6324@end deffn 6325 6326 6327@cindex watch remove (subcommand) 6328@deffn Command {cvs watch remove} [@code{-a} action] [@code{-lR}] files @dots{} 6329 6330Remove a notification request established using @code{cvs watch add}; 6331the arguments are the same. If the @code{-a} option is present, only 6332watches for the specified actions are removed. 6333 6334@end deffn 6335 6336@cindex notify (admin file) 6337When the conditions exist for notification, @sc{cvs} 6338calls the @file{notify} administrative file. Edit 6339@file{notify} as one edits the other administrative 6340files (@pxref{Intro administrative files}). This 6341file follows the usual conventions for administrative 6342files (@pxref{syntax}), where each line is a regular 6343expression followed by a command to execute. The 6344command should contain a single occurrence of @samp{%s} 6345which will be replaced by the user to notify; the rest 6346of the information regarding the notification will be 6347supplied to the command on standard input. The 6348standard thing to put in the @code{notify} file is the 6349single line: 6350 6351@example 6352ALL mail %s -s "CVS notification" 6353@end example 6354 6355This causes users to be notified by electronic mail. 6356@c FIXME: should it be this hard to set up this 6357@c behavior (and the result when one fails to do so, 6358@c silent failure to notify, so non-obvious)? Should 6359@c CVS give a warning if no line in notify matches (and 6360@c document the use of "DEFAULT :" for the case where 6361@c skipping the notification is indeed desired)? 6362 6363@cindex users (admin file) 6364Note that if you set this up in the straightforward 6365way, users receive notifications on the server machine. 6366One could of course write a @file{notify} script which 6367directed notifications elsewhere, but to make this 6368easy, @sc{cvs} allows you to associate a notification 6369address for each user. To do so create a file 6370@file{users} in @file{CVSROOT} with a line for each 6371user in the format @var{user}:@var{value}. Then 6372instead of passing the name of the user to be notified 6373to @file{notify}, @sc{cvs} will pass the @var{value} 6374(normally an email address on some other machine). 6375 6376@sc{cvs} does not notify you for your own changes. 6377Currently this check is done based on whether the user 6378name of the person taking the action which triggers 6379notification matches the user name of the person 6380getting notification. In fact, in general, the watches 6381features only track one edit by each user. It probably 6382would be more useful if watches tracked each working 6383directory separately, so this behavior might be worth 6384changing. 6385@c "behavior might be worth changing" is an effort to 6386@c point to future directions while also not promising 6387@c that "they" (as in "why don't they fix CVS to....") 6388@c will do this. 6389@c one implementation issue is identifying whether a 6390@c working directory is same or different. Comparing 6391@c pathnames/hostnames is hopeless, but having the server 6392@c supply a serial number which the client stores in the 6393@c CVS directory as a magic cookie should work. 6394 6395@node Editing files 6396@subsection How to edit a file which is being watched 6397 6398@cindex Checkout, as term for getting ready to edit 6399Since a file which is being watched is checked out 6400read-only, you cannot simply edit it. To make it 6401read-write, and inform others that you are planning to 6402edit it, use the @code{cvs edit} command. Some systems 6403call this a @dfn{checkout}, but @sc{cvs} uses that term 6404for obtaining a copy of the sources (@pxref{Getting the 6405source}), an operation which those systems call a 6406@dfn{get} or a @dfn{fetch}. 6407@c Issue to think about: should we transition CVS 6408@c towards the "get" terminology? "cvs get" is already a 6409@c synonym for "cvs checkout" and that section of the 6410@c manual refers to "Getting the source". If this is 6411@c done, needs to be done gingerly (for example, we should 6412@c still accept "checkout" in .cvsrc files indefinitely 6413@c even if the CVS's messages are changed from "cvs checkout: " 6414@c to "cvs get: "). 6415@c There is a concern about whether "get" is not as 6416@c good for novices because it is a more general term 6417@c than "checkout" (and thus arguably harder to assign 6418@c a technical meaning for). 6419 6420@cindex edit (subcommand) 6421@deffn Command {cvs edit} [options] files @dots{} 6422 6423Prepare to edit the working files @var{files}. CVS makes the 6424@var{files} read-write, and notifies users who have requested 6425@code{edit} notification for any of @var{files}. 6426 6427The @code{cvs edit} command accepts the same @var{options} as the 6428@code{cvs watch add} command, and establishes a temporary watch for the 6429user on @var{files}; CVS will remove the watch when @var{files} are 6430@code{unedit}ed or @code{commit}ted. If the user does not wish to 6431receive notifications, she should specify @code{-a none}. 6432 6433The @var{files} and options are processed as for the @code{cvs 6434watch} commands. 6435 6436@ignore 6437@strong{Caution:} If the @code{PreservePermissions} 6438option is enabled in the repository (@pxref{config}), 6439CVS will not change the permissions on any of the 6440@var{files}. The reason for this change is to ensure 6441that using @samp{cvs edit} does not interfere with the 6442ability to store file permissions in the CVS 6443repository. 6444@end ignore 6445 6446@end deffn 6447 6448Normally when you are done with a set of changes, you 6449use the @code{cvs commit} command, which checks in your 6450changes and returns the watched files to their usual 6451read-only state. But if you instead decide to abandon 6452your changes, or not to make any changes, you can use 6453the @code{cvs unedit} command. 6454 6455@cindex unedit (subcommand) 6456@cindex Abandoning work 6457@cindex Reverting to repository version 6458@deffn Command {cvs unedit} [@code{-lR}] files @dots{} 6459 6460Abandon work on the working files @var{files}, and revert them to the 6461repository versions on which they are based. CVS makes those 6462@var{files} read-only for which users have requested notification using 6463@code{cvs watch on}. CVS notifies users who have requested @code{unedit} 6464notification for any of @var{files}. 6465 6466The @var{files} and options are processed as for the 6467@code{cvs watch} commands. 6468 6469If watches are not in use, the @code{unedit} command 6470probably does not work, and the way to revert to the 6471repository version is to remove the file and then use 6472@code{cvs update} to get a new copy. The meaning is 6473not precisely the same; removing and updating may also 6474bring in some changes which have been made in the 6475repository since the last time you updated. 6476@c It would be a useful enhancement to CVS to make 6477@c unedit work in the non-watch case as well. 6478@end deffn 6479 6480When using client/server @sc{cvs}, you can use the 6481@code{cvs edit} and @code{cvs unedit} commands even if 6482@sc{cvs} is unable to successfully communicate with the 6483server; the notifications will be sent upon the next 6484successful @sc{cvs} command. 6485 6486@node Watch information 6487@subsection Information about who is watching and editing 6488 6489@cindex watchers (subcommand) 6490@deffn Command {cvs watchers} [@code{-lR}] files @dots{} 6491 6492List the users currently watching changes to @var{files}. The report 6493includes the files being watched, and the mail address of each watcher. 6494 6495The @var{files} and options are processed as for the 6496@code{cvs watch} commands. 6497 6498@end deffn 6499 6500 6501@cindex editors (subcommand) 6502@deffn Command {cvs editors} [@code{-lR}] files @dots{} 6503 6504List the users currently working on @var{files}. The report 6505includes the mail address of each user, the time when the user began 6506working with the file, and the host and path of the working directory 6507containing the file. 6508 6509The @var{files} and options are processed as for the 6510@code{cvs watch} commands. 6511 6512@end deffn 6513 6514@node Watches Compatibility 6515@subsection Using watches with old versions of CVS 6516 6517@cindex CVS 1.6, and watches 6518If you use the watch features on a repository, it 6519creates @file{CVS} directories in the repository and 6520stores the information about watches in that directory. 6521If you attempt to use @sc{cvs} 1.6 or earlier with the 6522repository, you get an error message such as the 6523following (all on one line): 6524 6525@example 6526cvs update: cannot open CVS/Entries for reading: 6527No such file or directory 6528@end example 6529 6530and your operation will likely be aborted. To use the 6531watch features, you must upgrade all copies of @sc{cvs} 6532which use that repository in local or server mode. If 6533you cannot upgrade, use the @code{watch off} and 6534@code{watch remove} commands to remove all watches, and 6535that will restore the repository to a state which 6536@sc{cvs} 1.6 can cope with. 6537 6538@node Choosing a model 6539@section Choosing between reserved or unreserved checkouts 6540@cindex Choosing, reserved or unreserved checkouts 6541 6542Reserved and unreserved checkouts each have pros and 6543cons. Let it be said that a lot of this is a matter of 6544opinion or what works given different groups' working 6545styles, but here is a brief description of some of the 6546issues. There are many ways to organize a team of 6547developers. @sc{cvs} does not try to enforce a certain 6548organization. It is a tool that can be used in several 6549ways. 6550 6551Reserved checkouts can be very counter-productive. If 6552two persons want to edit different parts of a file, 6553there may be no reason to prevent either of them from 6554doing so. Also, it is common for someone to take out a 6555lock on a file, because they are planning to edit it, 6556but then forget to release the lock. 6557 6558@c "many groups"? specifics? cites to papers on this? 6559@c some way to weasel-word it a bit more so we don't 6560@c need facts :-)? 6561People, especially people who are familiar with 6562reserved checkouts, often wonder how often conflicts 6563occur if unreserved checkouts are used, and how 6564difficult they are to resolve. The experience with 6565many groups is that they occur rarely and usually are 6566relatively straightforward to resolve. 6567 6568The rarity of serious conflicts may be surprising, until one realizes 6569that they occur only when two developers disagree on the proper design 6570for a given section of code; such a disagreement suggests that the 6571team has not been communicating properly in the first place. In order 6572to collaborate under @emph{any} source management regimen, developers 6573must agree on the general design of the system; given this agreement, 6574overlapping changes are usually straightforward to merge. 6575 6576In some cases unreserved checkouts are clearly 6577inappropriate. If no merge tool exists for the kind of 6578file you are managing (for example word processor files 6579or files edited by Computer Aided Design programs), and 6580it is not desirable to change to a program which uses a 6581mergeable data format, then resolving conflicts is 6582going to be unpleasant enough that you generally will 6583be better off to simply avoid the conflicts instead, by 6584using reserved checkouts. 6585 6586The watches features described above in @ref{Watches} 6587can be considered to be an intermediate model between 6588reserved checkouts and unreserved checkouts. When you 6589go to edit a file, it is possible to find out who else 6590is editing it. And rather than having the system 6591simply forbid both people editing the file, it can tell 6592you what the situation is and let you figure out 6593whether it is a problem in that particular case or not. 6594Therefore, for some groups it can be considered the 6595best of both the reserved checkout and unreserved 6596checkout worlds. 6597 6598@c --------------------------------------------------------------------- 6599@node Revision management 6600@chapter Revision management 6601@cindex Revision management 6602 6603@c -- This chapter could be expanded a lot. 6604@c -- Experiences are very welcome! 6605 6606If you have read this far, you probably have a pretty 6607good grasp on what @sc{cvs} can do for you. This 6608chapter talks a little about things that you still have 6609to decide. 6610 6611If you are doing development on your own using @sc{cvs} 6612you could probably skip this chapter. The questions 6613this chapter takes up become more important when more 6614than one person is working in a repository. 6615 6616@menu 6617* When to commit:: Some discussion on the subject 6618@end menu 6619 6620@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6621@node When to commit 6622@section When to commit? 6623@cindex When to commit 6624@cindex Commit, when to 6625@cindex Policy 6626 6627Your group should decide which policy to use regarding 6628commits. Several policies are possible, and as your 6629experience with @sc{cvs} grows you will probably find 6630out what works for you. 6631 6632If you commit files too quickly you might commit files 6633that do not even compile. If your partner updates his 6634working sources to include your buggy file, he will be 6635unable to compile the code. On the other hand, other 6636persons will not be able to benefit from the 6637improvements you make to the code if you commit very 6638seldom, and conflicts will probably be more common. 6639 6640It is common to only commit files after making sure 6641that they can be compiled. Some sites require that the 6642files pass a test suite. Policies like this can be 6643enforced using the commitinfo file 6644(@pxref{commitinfo}), but you should think twice before 6645you enforce such a convention. By making the 6646development environment too controlled it might become 6647too regimented and thus counter-productive to the real 6648goal, which is to get software written. 6649 6650@c --------------------------------------------------------------------- 6651@node Keyword substitution 6652@chapter Keyword substitution 6653@cindex Keyword substitution 6654@cindex Keyword expansion 6655@cindex Identifying files 6656 6657@comment Be careful when editing this chapter. 6658@comment Remember that this file is kept under 6659@comment version control, so we must not accidentally 6660@comment include a valid keyword in the running text. 6661 6662As long as you edit source files inside a working 6663directory you can always find out the state of 6664your files via @samp{cvs status} and @samp{cvs log}. 6665But as soon as you export the files from your 6666development environment it becomes harder to identify 6667which revisions they are. 6668 6669CVS can use a mechanism known as @dfn{keyword 6670substitution} (or @dfn{keyword expansion}) to help 6671identifying the files. Embedded strings of the form 6672@code{$@var{keyword}$} and 6673@code{$@var{keyword}:@dots{}$} in a file are replaced 6674with strings of the form 6675@code{$@var{keyword}:@var{value}$} whenever you obtain 6676a new revision of the file. 6677 6678@menu 6679* Keyword list:: Keywords 6680* Using keywords:: Using keywords 6681* Avoiding substitution:: Avoiding substitution 6682* Substitution modes:: Substitution modes 6683* Log keyword:: Problems with the $@asis{}Log$ keyword. 6684@end menu 6685 6686@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6687@node Keyword list 6688@section Keyword List 6689@cindex Keyword List 6690 6691@c FIXME: need some kind of example here I think, 6692@c perhaps in a 6693@c "Keyword intro" node. The intro in the "Keyword 6694@c substitution" node itself seems OK, but to launch 6695@c into a list of the keywords somehow seems too abrupt. 6696 6697This is a list of the keywords: 6698 6699@table @code 6700@cindex Author keyword 6701@item $@asis{Author}$ 6702The login name of the user who checked in the revision. 6703 6704@cindex Date keyword 6705@item $@asis{Date}$ 6706The date and time (UTC) the revision was checked in. 6707 6708@cindex Header keyword 6709@item $@asis{Header}$ 6710A standard header containing the full pathname of the 6711@sc{rcs} file, the revision number, the date (UTC), the 6712author, the state, and the locker (if locked). Files 6713will normally never be locked when you use @sc{cvs}. 6714 6715@cindex Id keyword 6716@item $@asis{Id}$ 6717Same as @code{$@asis{Header}$}, except that the @sc{rcs} 6718filename is without a path. 6719 6720@cindex Name keyword 6721@item $@asis{Name}$ 6722Tag name used to check out this file. The keyword is 6723expanded only if one checks out with an explicit tag 6724name. For example, when running the command @code{cvs 6725co -r first}, the keyword expands to @samp{Name: first}. 6726 6727@cindex Locker keyword 6728@item $@asis{Locker}$ 6729The login name of the user who locked the revision 6730(empty if not locked, which is the normal case unless 6731@code{cvs admin -l} is in use). 6732 6733@cindex Log keyword 6734@item $@asis{Log}$ 6735The log message supplied during commit, preceded by a 6736header containing the @sc{rcs} filename, the revision 6737number, the author, and the date (UTC). Existing log 6738messages are @emph{not} replaced. Instead, the new log 6739message is inserted after @code{$@asis{Log:@dots{}}$}. 6740Each new line is prefixed with the same string which 6741precedes the @code{$Log} keyword. For example, if the 6742file contains 6743 6744@example 6745 /* Here is what people have been up to: 6746 * 6747 * $@asis{}Log: frob.c,v $ 6748 * Revision 1.1 1997/01/03 14:23:51 joe 6749 * Add the superfrobnicate option 6750 * 6751 */ 6752@end example 6753 6754@noindent 6755then additional lines which are added when expanding 6756the @code{$Log} keyword will be preceded by @samp{ * }. 6757Unlike previous versions of @sc{cvs} and @sc{rcs}, the 6758@dfn{comment leader} from the @sc{rcs} file is not used. 6759The @code{$Log} keyword is useful for 6760accumulating a complete change log in a source file, 6761but for several reasons it can be problematic. 6762@xref{Log keyword}. 6763 6764@cindex RCSfile keyword 6765@item $@asis{RCSfile}$ 6766The name of the RCS file without a path. 6767 6768@cindex Revision keyword 6769@item $@asis{Revision}$ 6770The revision number assigned to the revision. 6771 6772@cindex Source keyword 6773@item $@asis{Source}$ 6774The full pathname of the RCS file. 6775 6776@cindex State keyword 6777@item $@asis{State}$ 6778The state assigned to the revision. States can be 6779assigned with @code{cvs admin -s}---see @ref{admin options}. 6780 6781@end table 6782 6783@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6784@node Using keywords 6785@section Using keywords 6786 6787To include a keyword string you simply include the 6788relevant text string, such as @code{$@asis{Id}$}, inside the 6789file, and commit the file. @sc{cvs} will automatically 6790expand the string as part of the commit operation. 6791 6792It is common to embed the @code{$@asis{}Id$} string in 6793the source files so that it gets passed through to 6794generated files. For example, if you are managing 6795computer program source code, you might include a 6796variable which is initialized to contain that string. 6797Or some C compilers may provide a @code{#pragma ident} 6798directive. Or a document management system might 6799provide a way to pass a string through to generated 6800files. 6801 6802@c Would be nice to give an example, but doing this in 6803@c portable C is not possible and the problem with 6804@c picking any one language (VMS HELP files, Ada, 6805@c troff, whatever) is that people use CVS for all 6806@c kinds of files. 6807 6808@cindex Ident (shell command) 6809The @code{ident} command (which is part of the @sc{rcs} 6810package) can be used to extract keywords and their 6811values from a file. This can be handy for text files, 6812but it is even more useful for extracting keywords from 6813binary files. 6814 6815@example 6816$ ident samp.c 6817samp.c: 6818 $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6819$ gcc samp.c 6820$ ident a.out 6821a.out: 6822 $@asis{}Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6823@end example 6824 6825@cindex What (shell command) 6826S@sc{ccs} is another popular revision control system. 6827It has a command, @code{what}, which is very similar to 6828@code{ident} and used for the same purpose. Many sites 6829without @sc{rcs} have @sc{sccs}. Since @code{what} 6830looks for the character sequence @code{@@(#)} it is 6831easy to include keywords that are detected by either 6832command. Simply prefix the keyword with the 6833magic @sc{sccs} phrase, like this: 6834 6835@example 6836static char *id="@@(#) $@asis{}Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $"; 6837@end example 6838 6839@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6840@node Avoiding substitution 6841@section Avoiding substitution 6842 6843Keyword substitution has its disadvantages. Sometimes 6844you might want the literal text string 6845@samp{$@asis{}Author$} to appear inside a file without 6846@sc{cvs} interpreting it as a keyword and expanding it 6847into something like @samp{$@asis{}Author: ceder $}. 6848 6849There is unfortunately no way to selectively turn off 6850keyword substitution. You can use @samp{-ko} 6851(@pxref{Substitution modes}) to turn off keyword 6852substitution entirely. 6853 6854In many cases you can avoid using keywords in 6855the source, even though they appear in the final 6856product. For example, the source for this manual 6857contains @samp{$@@asis@{@}Author$} whenever the text 6858@samp{$@asis{}Author$} should appear. In @code{nroff} 6859and @code{troff} you can embed the null-character 6860@code{\&} inside the keyword for a similar effect. 6861 6862@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6863@node Substitution modes 6864@section Substitution modes 6865@cindex Keyword substitution, changing modes 6866@cindex -k (keyword substitution) 6867@cindex Kflag 6868 6869@c FIXME: This could be made more coherent, by expanding it 6870@c with more examples or something. 6871Each file has a stored default substitution mode, and 6872each working directory copy of a file also has a 6873substitution mode. The former is set by the @samp{-k} 6874option to @code{cvs add} and @code{cvs admin}; the 6875latter is set by the @samp{-k} or @samp{-A} options to @code{cvs 6876checkout} or @code{cvs update}. @code{cvs diff} also 6877has a @samp{-k} option. For some examples, 6878see @ref{Binary files}, and @ref{Merging and keywords}. 6879@c The fact that -A is overloaded to mean both reset 6880@c sticky options and reset sticky tags/dates is 6881@c somewhat questionable. Perhaps there should be 6882@c separate options to reset sticky options (e.g. -k 6883@c A") and tags/dates (someone suggested -r HEAD could 6884@c do this instead of setting a sticky tag of "HEAD" 6885@c as in the status quo but I haven't thought much 6886@c about that idea. Of course -r .reset or something 6887@c could be coined if this needs to be a new option). 6888@c On the other hand, having -A mean "get things back 6889@c into the state after a fresh checkout" has a certain 6890@c appeal, and maybe there is no sufficient reason for 6891@c creeping featurism in this area. 6892 6893The modes available are: 6894 6895@table @samp 6896@item -kkv 6897Generate keyword strings using the default form, e.g. 6898@code{$@asis{}Revision: 5.7 $} for the @code{Revision} 6899keyword. 6900 6901@item -kkvl 6902Like @samp{-kkv}, except that a locker's name is always 6903inserted if the given revision is currently locked. 6904The locker's name is only relevant if @code{cvs admin 6905-l} is in use. 6906 6907@item -kk 6908Generate only keyword names in keyword strings; omit 6909their values. For example, for the @code{Revision} 6910keyword, generate the string @code{$@asis{}Revision$} 6911instead of @code{$@asis{}Revision: 5.7 $}. This option 6912is useful to ignore differences due to keyword 6913substitution when comparing different revisions of a 6914file (@pxref{Merging and keywords}). 6915 6916@item -ko 6917Generate the old keyword string, present in the working 6918file just before it was checked in. For example, for 6919the @code{Revision} keyword, generate the string 6920@code{$@asis{}Revision: 1.1 $} instead of 6921@code{$@asis{}Revision: 5.7 $} if that is how the 6922string appeared when the file was checked in. 6923 6924@item -kb 6925Like @samp{-ko}, but also inhibit conversion of line 6926endings between the canonical form in which they are 6927stored in the repository (linefeed only), and the form 6928appropriate to the operating system in use on the 6929client. For systems, like unix, which use linefeed 6930only to terminate lines, this is the same as 6931@samp{-ko}. For more information on binary files, see 6932@ref{Binary files}. 6933 6934@item -kv 6935Generate only keyword values for keyword strings. For 6936example, for the @code{Revision} keyword, generate the string 6937@code{5.7} instead of @code{$@asis{}Revision: 5.7 $}. 6938This can help generate files in programming languages 6939where it is hard to strip keyword delimiters like 6940@code{$@asis{}Revision: $} from a string. However, 6941further keyword substitution cannot be performed once 6942the keyword names are removed, so this option should be 6943used with care. 6944 6945One often would like to use @samp{-kv} with @code{cvs 6946export}---@pxref{export}. But be aware that doesn't 6947handle an export containing binary files correctly. 6948 6949@end table 6950 6951@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6952@node Log keyword 6953@section Problems with the $@asis{}Log$ keyword. 6954 6955The @code{$@asis{}Log$} keyword is somewhat 6956controversial. As long as you are working on your 6957development system the information is easily accessible 6958even if you do not use the @code{$@asis{}Log$} 6959keyword---just do a @code{cvs log}. Once you export 6960the file the history information might be useless 6961anyhow. 6962 6963A more serious concern is that @sc{cvs} is not good at 6964handling @code{$@asis{}Log$} entries when a branch is 6965merged onto the main trunk. Conflicts often result 6966from the merging operation. 6967@c Might want to check whether the CVS implementation 6968@c of RCS_merge has this problem the same way rcsmerge 6969@c does. I would assume so.... 6970 6971People also tend to "fix" the log entries in the file 6972(correcting spelling mistakes and maybe even factual 6973errors). If that is done the information from 6974@code{cvs log} will not be consistent with the 6975information inside the file. This may or may not be a 6976problem in real life. 6977 6978It has been suggested that the @code{$@asis{}Log$} 6979keyword should be inserted @emph{last} in the file, and 6980not in the files header, if it is to be used at all. 6981That way the long list of change messages will not 6982interfere with everyday source file browsing. 6983 6984@c --------------------------------------------------------------------- 6985@node Tracking sources 6986@chapter Tracking third-party sources 6987@cindex Third-party sources 6988@cindex Tracking sources 6989 6990@c FIXME: Need discussion of added and removed files. 6991@c FIXME: This doesn't really adequately introduce the 6992@c concepts of "vendor" and "you". They don't *have* 6993@c to be separate organizations or separate people. 6994@c We want a description which is somewhat more based on 6995@c the technical issues of which sources go where, but 6996@c also with enough examples of how this relates to 6997@c relationships like customer-supplier, developer-QA, 6998@c maintainer-contributor, or whatever, to make it 6999@c seem concrete. 7000If you modify a program to better fit your site, you 7001probably want to include your modifications when the next 7002release of the program arrives. @sc{cvs} can help you with 7003this task. 7004 7005@cindex Vendor 7006@cindex Vendor branch 7007@cindex Branch, vendor- 7008In the terminology used in @sc{cvs}, the supplier of the 7009program is called a @dfn{vendor}. The unmodified 7010distribution from the vendor is checked in on its own 7011branch, the @dfn{vendor branch}. @sc{cvs} reserves branch 70121.1.1 for this use. 7013 7014When you modify the source and commit it, your revision 7015will end up on the main trunk. When a new release is 7016made by the vendor, you commit it on the vendor branch 7017and copy the modifications onto the main trunk. 7018 7019Use the @code{import} command to create and update 7020the vendor branch. When you import a new file, 7021the vendor branch is made the `head' revision, so 7022anyone that checks out a copy of the file gets that 7023revision. When a local modification is committed it is 7024placed on the main trunk, and made the `head' 7025revision. 7026 7027@menu 7028* First import:: Importing for the first time 7029* Update imports:: Updating with the import command 7030* Reverting local changes:: Reverting to the latest vendor release 7031* Binary files in imports:: Binary files require special handling 7032* Keywords in imports:: Keyword substitution might be undesirable 7033* Multiple vendor branches:: What if you get sources from several places? 7034@end menu 7035 7036@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7037@node First import 7038@section Importing for the first time 7039@cindex Importing modules 7040 7041@c Should mention naming conventions for vendor tags, 7042@c release tags, and perhaps directory names. 7043Use the @code{import} command to check in the sources 7044for the first time. When you use the @code{import} 7045command to track third-party sources, the @dfn{vendor 7046tag} and @dfn{release tags} are useful. The 7047@dfn{vendor tag} is a symbolic name for the branch 7048(which is always 1.1.1, unless you use the @samp{-b 7049@var{branch}} flag---@xref{Multiple vendor branches}.). The 7050@dfn{release tags} are symbolic names for a particular 7051release, such as @samp{FSF_0_04}. 7052 7053@c I'm not completely sure this belongs here. But 7054@c we need to say it _somewhere_ reasonably obvious; it 7055@c is a common misconception among people first learning CVS 7056Note that @code{import} does @emph{not} change the 7057directory in which you invoke it. In particular, it 7058does not set up that directory as a @sc{cvs} working 7059directory; if you want to work with the sources import 7060them first and then check them out into a different 7061directory (@pxref{Getting the source}). 7062 7063@cindex wdiff (import example) 7064Suppose you have the sources to a program called 7065@code{wdiff} in a directory @file{wdiff-0.04}, 7066and are going to make private modifications that you 7067want to be able to use even when new releases are made 7068in the future. You start by importing the source to 7069your repository: 7070 7071@example 7072$ cd wdiff-0.04 7073$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04 7074@end example 7075 7076The vendor tag is named @samp{FSF_DIST} in the above 7077example, and the only release tag assigned is 7078@samp{WDIFF_0_04}. 7079@c FIXME: Need to say where fsf/wdiff comes from. 7080 7081@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7082@node Update imports 7083@section Updating with the import command 7084 7085When a new release of the source arrives, you import it into the 7086repository with the same @code{import} command that you used to set up 7087the repository in the first place. The only difference is that you 7088specify a different release tag this time. 7089 7090@example 7091$ tar xfz wdiff-0.05.tar.gz 7092$ cd wdiff-0.05 7093$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05 7094@end example 7095 7096For files that have not been modified locally, the newly created 7097revision becomes the head revision. If you have made local 7098changes, @code{import} will warn you that you must merge the changes 7099into the main trunk, and tell you to use @samp{checkout -j} to do so. 7100 7101@c FIXME: why "wdiff" here and "fsf/wdiff" in the 7102@c "import"? I think the assumption is that one has 7103@c "wdiff fsf/wdiff" or some such in modules, but it 7104@c would be better to not use modules in this example. 7105@example 7106$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff 7107@end example 7108 7109@noindent 7110The above command will check out the latest revision of 7111@samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST} 7112since yesterday into the working copy. If any conflicts arise during 7113the merge they should be resolved in the normal way (@pxref{Conflicts 7114example}). Then, the modified files may be committed. 7115 7116Using a date, as suggested above, assumes that you do 7117not import more than one release of a product per 7118day. If you do, you can always use something like this 7119instead: 7120 7121@example 7122$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff 7123@end example 7124 7125@noindent 7126In this case, the two above commands are equivalent. 7127 7128@node Reverting local changes 7129@section Reverting to the latest vendor release 7130 7131You can also revert local changes completely and return 7132to the latest vendor release by changing the `head' 7133revision back to the vendor branch on all files. For 7134example, if you have a checked-out copy of the sources 7135in @file{~/work.d/wdiff}, and you want to revert to the 7136vendor's version for all the files in that directory, 7137you would type: 7138 7139@example 7140$ cd ~/work.d/wdiff 7141$ cvs admin -bWDIFF . 7142@end example 7143 7144@noindent 7145You must specify the @samp{-bWDIFF} without any space 7146after the @samp{-b}. @xref{admin options}. 7147 7148@node Binary files in imports 7149@section How to handle binary files with cvs import 7150 7151Use the @samp{-k} wrapper option to tell import which 7152files are binary. @xref{Wrappers}. 7153 7154@node Keywords in imports 7155@section How to handle keyword substitution with cvs import 7156 7157The sources which you are importing may contain 7158keywords (@pxref{Keyword substitution}). For example, 7159the vendor may use @sc{cvs} or some other system 7160which uses similar keyword expansion syntax. If you 7161just import the files in the default fashion, then 7162the keyword expansions supplied by the vendor will 7163be replaced by keyword expansions supplied by your 7164own copy of @sc{cvs}. It may be more convenient to 7165maintain the expansions supplied by the vendor, so 7166that this information can supply information about 7167the sources that you imported from the vendor. 7168 7169To maintain the keyword expansions supplied by the 7170vendor, supply the @samp{-ko} option to @code{cvs 7171import} the first time you import the file. 7172This will turn off keyword expansion 7173for that file entirely, so if you want to be more 7174selective you'll have to think about what you want 7175and use the @samp{-k} option to @code{cvs update} or 7176@code{cvs admin} as appropriate. 7177@c Supplying -ko to import if the file already existed 7178@c has no effect. Not clear to me whether it should 7179@c or not. 7180 7181@node Multiple vendor branches 7182@section Multiple vendor branches 7183 7184All the examples so far assume that there is only one 7185vendor from which you are getting sources. In some 7186situations you might get sources from a variety of 7187places. For example, suppose that you are dealing with 7188a project where many different people and teams are 7189modifying the software. There are a variety of ways to 7190handle this, but in some cases you have a bunch of 7191source trees lying around and what you want to do more 7192than anything else is just to all put them in CVS so 7193that you at least have them in one place. 7194 7195For handling situations in which there may be more than 7196one vendor, you may specify the @samp{-b} option to 7197@code{cvs import}. It takes as an argument the vendor 7198branch to import to. The default is @samp{-b 1.1.1}. 7199 7200For example, suppose that there are two teams, the red 7201team and the blue team, that are sending you sources. 7202You want to import the red team's efforts to branch 72031.1.1 and use the vendor tag RED. You want to import 7204the blue team's efforts to branch 1.1.3 and use the 7205vendor tag BLUE. So the commands you might use are: 7206 7207@example 7208$ cvs import dir RED RED_1-0 7209$ cvs import -b 1.1.3 dir BLUE BLUE_1-5 7210@end example 7211 7212Note that if your vendor tag does not match your 7213@samp{-b} option, CVS will not detect this case! For 7214example, 7215 7216@example 7217$ cvs import -b 1.1.3 dir RED RED_1-0 7218@end example 7219 7220@noindent 7221Be careful; this kind of mismatch is sure to sow 7222confusion or worse. I can't think of a useful purpose 7223for the ability to specify a mismatch here, but if you 7224discover such a use, don't. CVS is likely to make this 7225an error in some future release. 7226 7227@c Probably should say more about the semantics of 7228@c multiple branches. What about the default branch? 7229@c What about joining (perhaps not as useful with 7230@c multiple branches, or perhaps it is. Either way 7231@c should be mentioned). 7232 7233@c I'm not sure about the best location for this. In 7234@c one sense, it might belong right after we've introduced 7235@c CVS's basic version control model, because people need 7236@c to figure out builds right away. The current location 7237@c is based on the theory that it kind of akin to the 7238@c "Revision management" section. 7239@node Builds 7240@chapter How your build system interacts with CVS 7241@cindex Builds 7242@cindex make 7243 7244As mentioned in the introduction, @sc{cvs} does not 7245contain software for building your software from source 7246code. This section describes how various aspects of 7247your build system might interact with @sc{cvs}. 7248 7249@c Is there a way to discuss this without reference to 7250@c tools other than CVS? I'm not sure there is; I 7251@c wouldn't think that people who learn CVS first would 7252@c even have this concern. 7253One common question, especially from people who are 7254accustomed to @sc{rcs}, is how to make their build get 7255an up to date copy of the sources. The answer to this 7256with @sc{cvs} is two-fold. First of all, since 7257@sc{cvs} itself can recurse through directories, there 7258is no need to modify your @file{Makefile} (or whatever 7259configuration file your build tool uses) to make sure 7260each file is up to date. Instead, just use two 7261commands, first @code{cvs -q update} and then 7262@code{make} or whatever the command is to invoke your 7263build tool. Secondly, you do not necessarily 7264@emph{want} to get a copy of a change someone else made 7265until you have finished your own work. One suggested 7266approach is to first update your sources, then 7267implement, build and 7268test the change you were thinking of, and then commit 7269your sources (updating first if necessary). By 7270periodically (in between changes, using the approach 7271just described) updating your entire tree, you ensure 7272that your sources are sufficiently up to date. 7273 7274@cindex Bill of materials 7275One common need is to record which versions of which 7276source files went into a particular build. This kind 7277of functionality is sometimes called @dfn{bill of 7278materials} or something similar. The best way to do 7279this with @sc{cvs} is to use the @code{tag} command to 7280record which versions went into a given build 7281(@pxref{Tags}). 7282 7283Using @sc{cvs} in the most straightforward manner 7284possible, each developer will have a copy of the entire 7285source tree which is used in a particular build. If 7286the source tree is small, or if developers are 7287geographically dispersed, this is the preferred 7288solution. In fact one approach for larger projects is 7289to break a project down into smaller 7290@c I say subsystem instead of module because they may or 7291@c may not use the modules file. 7292separately-compiled subsystems, and arrange a way of 7293releasing them internally so that each developer need 7294check out only those subsystems which are they are 7295actively working on. 7296 7297Another approach is to set up a structure which allows 7298developers to have their own copies of some files, and 7299for other files to access source files from a central 7300location. Many people have come up with some such a 7301@c two such people are paul@sander.cupertino.ca.us (for 7302@c a previous employer) 7303@c and gtornblo@senet.abb.se (spicm and related tools), 7304@c but as far as I know 7305@c no one has nicely packaged or released such a system (or 7306@c instructions for constructing one). 7307system using features such as the symbolic link feature 7308found in many operating systems, or the @code{VPATH} 7309feature found in many versions of @code{make}. One build 7310tool which is designed to help with this kind of thing 7311is Odin (see 7312@code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}). 7313@c Should we be saying more about Odin? Or how you use 7314@c it with CVS? Also, the Prime Time Freeware for Unix 7315@c disk (see http://www.ptf.com/) has Odin (with a nice 7316@c paragraph summarizing it on the web), so that might be a 7317@c semi-"official" place to point people. 7318@c 7319@c Of course, many non-CVS systems have this kind of 7320@c functionality, for example OSF's ODE 7321@c (http://www.osf.org/ode/) or mk 7322@c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html 7323@c He has changed providers in the past; a search engine search 7324@c for "Peter Ziobrzynski" probably won't get too many 7325@c spurious hits :-). A more stable URL might be 7326@c ftp://ftp.uu.net/pub/cmvc/mk). But I'm not sure 7327@c there is any point in mentioning them here unless they 7328@c can work with CVS. 7329 7330@c --------------------------------------------------------------------- 7331@node Special Files 7332@chapter Special Files 7333 7334@cindex Special files 7335@cindex Device nodes 7336@cindex Ownership, saving in CVS 7337@cindex Permissions, saving in CVS 7338@cindex Hard links 7339@cindex Symbolic links 7340 7341In normal circumstances, CVS works only with regular 7342files. Every file in a project is assumed to be 7343persistent; it must be possible to open, read and close 7344them; and so on. CVS also ignores file permissions and 7345ownerships, leaving such issues to be resolved by the 7346developer at installation time. In other words, it is 7347not possible to "check in" a device into a repository; 7348if the device file cannot be opened, CVS will refuse to 7349handle it. Files also lose their ownerships and 7350permissions during repository transactions. 7351 7352@ignore 7353If the configuration variable @code{PreservePermissions} 7354(@pxref{config}) is set in the repository, CVS will 7355save the following file characteristics in the 7356repository: 7357 7358@itemize @bullet 7359@item user and group ownership 7360@item permissions 7361@item major and minor device numbers 7362@item symbolic links 7363@item hard link structure 7364@end itemize 7365 7366Using the @code{PreservePermissions} option affects the 7367behavior of CVS in several ways. First, some of the 7368new operations supported by CVS are not accessible to 7369all users. In particular, file ownership and special 7370file characteristics may only be changed by the 7371superuser. When the @code{PreservePermissions} 7372configuration variable is set, therefore, users will 7373have to be `root' in order to perform CVS operations. 7374 7375When @code{PreservePermissions} is in use, some CVS 7376operations (such as @samp{cvs status}) will not 7377recognize a file's hard link structure, and so will 7378emit spurious warnings about mismatching hard links. 7379The reason is that CVS's internal structure does not 7380make it easy for these operations to collect all the 7381necessary data about hard links, so they check for file 7382conflicts with inaccurate data. 7383 7384A more subtle difference is that CVS considers a file 7385to have changed only if its contents have changed 7386(specifically, if the modification time of the working 7387file does not match that of the repository's file). 7388Therefore, if only the permissions, ownership or hard 7389linkage have changed, or if a device's major or minor 7390numbers have changed, CVS will not notice. In order to 7391commit such a change to the repository, you must force 7392the commit with @samp{cvs commit -f}. This also means 7393that if a file's permissions have changed and the 7394repository file is newer than the working copy, 7395performing @samp{cvs update} will silently change the 7396permissions on the working copy. 7397 7398Changing hard links in a CVS repository is particularly 7399delicate. Suppose that file @file{foo} is linked to 7400file @file{old}, but is later relinked to file 7401@file{new}. You can wind up in the unusual situation 7402where, although @file{foo}, @file{old} and @file{new} 7403have all had their underlying link patterns changed, 7404only @file{foo} and @file{new} have been modified, so 7405@file{old} is not considered a candidate for checking 7406in. It can be very easy to produce inconsistent 7407results this way. Therefore, we recommend that when it 7408is important to save hard links in a repository, the 7409prudent course of action is to @code{touch} any file 7410whose linkage or status has changed since the last 7411checkin. Indeed, it may be wise to @code{touch *} 7412before each commit in a directory with complex hard 7413link structures. 7414 7415It is worth noting that only regular files may 7416be merged, for reasons that hopefully are obvious. If 7417@samp{cvs update} or @samp{cvs checkout -j} attempts to 7418merge a symbolic link with a regular file, or two 7419device files for different kinds of devices, CVS will 7420report a conflict and refuse to perform the merge. At 7421the same time, @samp{cvs diff} will not report any 7422differences between these files, since no meaningful 7423textual comparisons can be made on files which contain 7424no text. 7425 7426The @code{PreservePermissions} features do not work 7427with client/server @sc{cvs}. Another limitation is 7428that hard links must be to other files within the same 7429directory; hard links across directories are not 7430supported. 7431@end ignore 7432 7433@c --------------------------------------------------------------------- 7434@node CVS commands 7435@appendix Guide to CVS commands 7436 7437This appendix describes the overall structure of 7438@sc{cvs} commands, and describes some commands in 7439detail (others are described elsewhere; for a quick 7440reference to @sc{cvs} commands, @pxref{Invoking CVS}). 7441@c The idea is that we want to move the commands which 7442@c are described here into the main body of the manual, 7443@c in the process reorganizing the manual to be 7444@c organized around what the user wants to do, not 7445@c organized around CVS commands. 7446@c 7447@c Note that many users do expect a manual which is 7448@c organized by command. At least some users do. 7449@c One good addition to the "organized by command" 7450@c section (if any) would be "see also" links. 7451@c The awk manual might be a good example; it has a 7452@c reference manual which is more verbose than Invoking 7453@c CVS but probably somewhat less verbose than CVS 7454@c Commands. 7455 7456@menu 7457* Structure:: Overall structure of CVS commands 7458* Exit status:: Indicating CVS's success or failure 7459* ~/.cvsrc:: Default options with the ~/.csvrc file 7460* Global options:: Options you give to the left of cvs_command 7461* Common options:: Options you give to the right of cvs_command 7462* admin:: Administration 7463* checkout:: Checkout sources for editing 7464* commit:: Check files into the repository 7465* diff:: Show differences between revisions 7466* export:: Export sources from CVS, similar to checkout 7467* history:: Show status of files and users 7468* import:: Import sources into CVS, using vendor branches 7469* log:: Show log messages for files 7470* rdiff:: 'patch' format diffs between releases 7471* release:: Indicate that a directory is no longer in use 7472* update:: Bring work tree in sync with repository 7473@end menu 7474 7475@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7476@node Structure 7477@appendixsec Overall structure of CVS commands 7478@cindex Structure 7479@cindex CVS command structure 7480@cindex Command structure 7481@cindex Format of CVS commands 7482 7483The overall format of all @sc{cvs} commands is: 7484 7485@example 7486cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ] 7487@end example 7488 7489@table @code 7490@item cvs 7491The name of the @sc{cvs} program. 7492 7493@item cvs_options 7494Some options that affect all sub-commands of @sc{cvs}. These are 7495described below. 7496 7497@item cvs_command 7498One of several different sub-commands. Some of the commands have 7499aliases that can be used instead; those aliases are noted in the 7500reference manual for that command. There are only two situations 7501where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a 7502list of available commands, and @samp{cvs -v} displays version 7503information on @sc{cvs} itself. 7504 7505@item command_options 7506Options that are specific for the command. 7507 7508@item command_args 7509Arguments to the commands. 7510@end table 7511 7512There is unfortunately some confusion between 7513@code{cvs_options} and @code{command_options}. 7514@samp{-l}, when given as a @code{cvs_option}, only 7515affects some of the commands. When it is given as a 7516@code{command_option} is has a different meaning, and 7517is accepted by more commands. In other words, do not 7518take the above categorization too seriously. Look at 7519the documentation instead. 7520 7521@node Exit status 7522@appendixsec CVS's exit status 7523@cindex Exit status, of CVS 7524 7525CVS can indicate to the calling environment whether it 7526succeeded or failed by setting its @dfn{exit status}. 7527The exact way of testing the exit status will vary from 7528one operating system to another. For example in a unix 7529shell script the @samp{$?} variable will be 0 if the 7530last command returned a successful exit status, or 7531greater than 0 if the exit status indicated failure. 7532 7533If CVS is successful, it returns a successful status; 7534if there is an error, it prints an error message and 7535returns a failure status. The one exception to this is 7536the @code{cvs diff} command. It will return a 7537successful status if it found no differences, or a 7538failure status if there were differences or if there 7539was an error. Because this behavior provides no good 7540way to detect errors, in the future it is possible that 7541@code{cvs diff} will be changed to behave like the 7542other @sc{cvs} commands. 7543@c It might seem like checking whether cvs -q diff 7544@c produces empty or non-empty output can tell whether 7545@c there were differences or not. But it seems like 7546@c there are cases with output but no differences 7547@c (testsuite basica-8b). It is not clear to me how 7548@c useful it is for a script to be able to check 7549@c whether there were differences. 7550@c FIXCVS? In previous versions of CVS, cvs diff 7551@c returned 0 for no differences, 1 for differences, or 7552@c 2 for errors. Is this behavior worth trying to 7553@c bring back (but what does it mean for VMS?)? 7554 7555@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7556@node ~/.cvsrc 7557@appendixsec Default options and the ~/.cvsrc file 7558@cindex .cvsrc file 7559@cindex Option defaults 7560 7561There are some @code{command_options} that are used so 7562often that you might have set up an alias or some other 7563means to make sure you always specify that option. One 7564example (the one that drove the implementation of the 7565@file{.cvsrc} support, actually) is that many people find the 7566default output of the @samp{diff} command to be very 7567hard to read, and that either context diffs or unidiffs 7568are much easier to understand. 7569 7570The @file{~/.cvsrc} file is a way that you can add 7571default options to @code{cvs_commands} within cvs, 7572instead of relying on aliases or other shell scripts. 7573 7574The format of the @file{~/.cvsrc} file is simple. The 7575file is searched for a line that begins with the same 7576name as the @code{cvs_command} being executed. If a 7577match is found, then the remainder of the line is split 7578up (at whitespace characters) into separate options and 7579added to the command arguments @emph{before} any 7580options from the command line. 7581 7582If a command has two names (e.g., @code{checkout} and 7583@code{co}), the official name, not necessarily the one 7584used on the command line, will be used to match against 7585the file. So if this is the contents of the user's 7586@file{~/.cvsrc} file: 7587 7588@example 7589log -N 7590diff -u 7591update -P 7592checkout -P 7593@end example 7594 7595@noindent 7596the command @samp{cvs checkout foo} would have the 7597@samp{-P} option added to the arguments, as well as 7598@samp{cvs co foo}. 7599 7600With the example file above, the output from @samp{cvs 7601diff foobar} will be in unidiff format. @samp{cvs diff 7602-c foobar} will provide context diffs, as usual. 7603Getting "old" format diffs would be slightly more 7604complicated, because @code{diff} doesn't have an option 7605to specify use of the "old" format, so you would need 7606@samp{cvs -f diff foobar}. 7607 7608In place of the command name you can use @code{cvs} to 7609specify global options (@pxref{Global options}). For 7610example the following line in @file{.cvsrc} 7611 7612@example 7613cvs -z6 7614@end example 7615 7616causes @sc{cvs} to use compression level 6. 7617 7618@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7619@node Global options 7620@appendixsec Global options 7621@cindex Options, global 7622@cindex Global options 7623@cindex Left-hand options 7624 7625The available @samp{cvs_options} (that are given to the 7626left of @samp{cvs_command}) are: 7627 7628@table @code 7629@item --allow-root=@var{rootdir} 7630Specify legal @sc{cvsroot} directory. See 7631@ref{Password authentication server}. 7632 7633@cindex Authentication, stream 7634@cindex Stream authentication 7635@item -a 7636Authenticate all communication between the client and 7637the server. Only has an effect on the @sc{cvs} client. 7638As of this writing, this is only implemented when using 7639a GSSAPI connection (@pxref{GSSAPI authenticated}). 7640Authentication prevents certain sorts of attacks 7641involving hijacking the active @sc{tcp} connection. 7642Enabling authentication does not enable encryption. 7643 7644@cindex RCSBIN, overriding 7645@cindex Overriding RCSBIN 7646@item -b @var{bindir} 7647In @sc{cvs} 1.9.18 and older, this specified that 7648@sc{rcs} programs are in the @var{bindir} directory. 7649Current versions of @sc{cvs} do not run @sc{rcs} 7650programs; for compatibility this option is accepted, 7651but it does nothing. 7652 7653@cindex TMPDIR, overriding 7654@cindex Overriding TMPDIR 7655@item -T @var{tempdir} 7656Use @var{tempdir} as the directory where temporary files are 7657located. Overrides the setting of the @code{$TMPDIR} environment 7658variable and any precompiled directory. This parameter should be 7659specified as an absolute pathname. 7660 7661@cindex CVSROOT, overriding 7662@cindex Overriding CVSROOT 7663@item -d @var{cvs_root_directory} 7664Use @var{cvs_root_directory} as the root directory 7665pathname of the repository. Overrides the setting of 7666the @code{$CVSROOT} environment variable. @xref{Repository}. 7667 7668@cindex EDITOR, overriding 7669@cindex Overriding EDITOR 7670@item -e @var{editor} 7671Use @var{editor} to enter revision log information. Overrides the 7672setting of the @code{$CVSEDITOR} and @code{$EDITOR} 7673environment variables. For more information, see 7674@ref{Committing your changes}. 7675 7676@item -f 7677Do not read the @file{~/.cvsrc} file. This 7678option is most often used because of the 7679non-orthogonality of the @sc{cvs} option set. For 7680example, the @samp{cvs log} option @samp{-N} (turn off 7681display of tag names) does not have a corresponding 7682option to turn the display on. So if you have 7683@samp{-N} in the @file{~/.cvsrc} entry for @samp{log}, 7684you may need to use @samp{-f} to show the tag names. 7685 7686@item -H 7687@itemx --help 7688Display usage information about the specified @samp{cvs_command} 7689(but do not actually execute the command). If you don't specify 7690a command name, @samp{cvs -H} displays overall help for 7691@sc{cvs}, including a list of other help options. 7692@c It seems to me it is better to document it this way 7693@c rather than trying to update this documentation 7694@c every time that we add a --help-foo option. But 7695@c perhaps that is confusing... 7696 7697@item -l 7698Do not log the @samp{cvs_command} in the command history (but execute it 7699anyway). @xref{history}, for information on command history. 7700 7701@cindex Read-only mode 7702@item -n 7703Do not change any files. Attempt to execute the 7704@samp{cvs_command}, but only to issue reports; do not remove, 7705update, or merge any existing files, or create any new files. 7706 7707Note that @sc{cvs} will not necessarily produce exactly 7708the same output as without @samp{-n}. In some cases 7709the output will be the same, but in other cases 7710@sc{cvs} will skip some of the processing that would 7711have been required to produce the exact same output. 7712 7713@item -Q 7714Cause the command to be really quiet; the command will only 7715generate output for serious problems. 7716 7717@item -q 7718Cause the command to be somewhat quiet; informational messages, 7719such as reports of recursion through subdirectories, are 7720suppressed. 7721 7722@cindex Read-only files, and -r 7723@item -r 7724Make new working files read-only. Same effect 7725as if the @code{$CVSREAD} environment variable is set 7726(@pxref{Environment variables}). The default is to 7727make working files writable, unless watches are on 7728(@pxref{Watches}). 7729 7730@item -s @var{variable}=@var{value} 7731Set a user variable (@pxref{Variables}). 7732 7733@cindex Trace 7734@item -t 7735Trace program execution; display messages showing the steps of 7736@sc{cvs} activity. Particularly useful with @samp{-n} to explore the 7737potential impact of an unfamiliar command. 7738 7739@item -v 7740@item --version 7741Display version and copyright information for @sc{cvs}. 7742 7743@cindex CVSREAD, overriding 7744@cindex Overriding CVSREAD 7745@item -w 7746Make new working files read-write. Overrides the 7747setting of the @code{$CVSREAD} environment variable. 7748Files are created read-write by default, unless @code{$CVSREAD} is 7749set or @samp{-r} is given. 7750@c Note that -w only overrides -r and CVSREAD; it has 7751@c no effect on files which are readonly because of 7752@c "cvs watch on". My guess is that is the way it 7753@c should be (or should "cvs -w get" on a watched file 7754@c be the same as a get and a cvs edit?), but I'm not 7755@c completely sure whether to document it this way. 7756 7757@item -x 7758@cindex Encryption 7759Encrypt all communication between the client and the 7760server. Only has an effect on the @sc{cvs} client. As 7761of this writing, this is only implemented when using a 7762GSSAPI connection (@pxref{GSSAPI authenticated}) or a 7763Kerberos connection (@pxref{Kerberos authenticated}). 7764Enabling encryption implies that message traffic is 7765also authenticated. Encryption support is not 7766available by default; it must be enabled using a 7767special configure option, @file{--enable-encryption}, 7768when you build @sc{cvs}. 7769 7770@item -z @var{gzip-level} 7771@cindex Compression 7772@cindex Gzip 7773Set the compression level. 7774Valid levels are 1 (high speed, low compression) to 77759 (low speed, high compression), or 0 to disable 7776compression (the default). 7777Only has an effect on the @sc{cvs} client. 7778 7779@end table 7780 7781@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7782@node Common options 7783@appendixsec Common command options 7784@cindex Common options 7785@cindex Right-hand options 7786 7787This section describes the @samp{command_options} that 7788are available across several @sc{cvs} commands. These 7789options are always given to the right of 7790@samp{cvs_command}. Not all 7791commands support all of these options; each option is 7792only supported for commands where it makes sense. 7793However, when a command has one of these options you 7794can almost always count on the same behavior of the 7795option as in other commands. (Other command options, 7796which are listed with the individual commands, may have 7797different behavior from one @sc{cvs} command to the other). 7798 7799@strong{Warning:} the @samp{history} command is an exception; it supports 7800many options that conflict even with these standard options. 7801 7802@table @code 7803@cindex Dates 7804@cindex Time 7805@cindex Specifying dates 7806@item -D @var{date_spec} 7807Use the most recent revision no later than @var{date_spec}. 7808@var{date_spec} is a single argument, a date description 7809specifying a date in the past. 7810 7811The specification is @dfn{sticky} when you use it to make a 7812private copy of a source file; that is, when you get a working 7813file using @samp{-D}, @sc{cvs} records the date you specified, so that 7814further updates in the same directory will use the same date 7815(for more information on sticky tags/dates, @pxref{Sticky tags}). 7816 7817@samp{-D} is available with the @code{checkout}, 7818@code{diff}, @code{export}, @code{history}, 7819@code{rdiff}, @code{rtag}, and @code{update} commands. 7820(The @code{history} command uses this option in a 7821slightly different way; @pxref{history options}). 7822 7823@c What other formats should we accept? I don't want 7824@c to start accepting a whole mess of non-standard 7825@c new formats (there are a lot which are in wide use in 7826@c one context or another), but practicality does 7827@c dictate some level of flexibility. 7828@c * POSIX.2 (e.g. touch, ls output, date) and other 7829@c POSIX and/or de facto unix standards (e.g. at). The 7830@c practice here is too inconsistent to be of any use. 7831@c * VMS dates. This is not a formal standard, but 7832@c there is a published specification (see SYS$ASCTIM 7833@c and SYS$BINTIM in the _VMS System Services Reference 7834@c Manual_), it is implemented consistently in VMS 7835@c utilities, and VMS users will expect CVS running on 7836@c VMS to support this format (and if we're going to do 7837@c that, better to make CVS support it on all 7838@c platforms. Maybe). 7839@c 7840@c NOTE: The tar manual has some documentation for 7841@c getdate.y (just for our info; we don't want to 7842@c attempt to document all the formats accepted by 7843@c getdate.y). 7844@c 7845@c One more note: In output, CVS should consistently 7846@c use one date format, and that format should be one that 7847@c it accepts in input as well. The former isn't 7848@c really true (see survey below), and I'm not 7849@c sure that either of those formats is accepted in 7850@c input. 7851@c 7852@c cvs log 7853@c current 1996/01/02 13:45:31 7854@c Internet 02 Jan 1996 13:45:31 UT 7855@c ISO 1996-01-02 13:45:31 7856@c cvs ann 7857@c current 02-Jan-96 7858@c Internet-like 02 Jan 96 7859@c ISO 96-01-02 7860@c cvs status 7861@c current Tue Jun 11 02:54:53 1996 7862@c Internet [Tue,] 11 Jun 1996 02:54:53 7863@c ISO 1996-06-11 02:54:53 7864@c note: date possibly should be omitted entirely for 7865@c other reasons. 7866@c cvs editors 7867@c current Tue Jun 11 02:54:53 1996 GMT 7868@c cvs history 7869@c current 06/11 02:54 +0000 7870@c any others? 7871@c There is a good chance the proper solution has to 7872@c involve at least some level of letting the user 7873@c decide which format (with the default being the 7874@c formats CVS has always used; changing these might be 7875@c _very_ disruptive since scripts may very well be 7876@c parsing them). 7877@c 7878@c Another random bit of prior art concerning dates is 7879@c the strptime function which takes templates such as 7880@c "%m/%d/%y", and apparent a variant of getdate() 7881@c which also honors them. See 7882@c X/Open CAE Specification, System Interfaces and 7883@c Headers Issue 4, Version 2 (September 1994), in the 7884@c entry for getdate() on page 231 7885 7886@cindex Timezone, in input 7887@cindex Zone, time, in input 7888A wide variety of date formats are supported by 7889@sc{cvs}. The most standard ones are ISO8601 (from the 7890International Standards Organization) and the Internet 7891e-mail standard (specified in RFC822 as amended by 7892RFC1123). 7893 7894@c Probably should be doing more to spell out just what 7895@c the rules are, rather than just giving examples. 7896@c But I want to keep this simple too. 7897@c So I don't know.... 7898@c A few specific issues: (1) Maybe should reassure 7899@c people that years after 2000 7900@c work (they are in the testsuite, so they do indeed 7901@c work). (2) What do two digit years 7902@c mean? Where do we accept them? (3) Local times can 7903@c be ambiguous or nonexistent if they fall during the 7904@c hour when daylight savings time goes into or out of 7905@c effect. Pretty obscure, so I'm not at all sure we 7906@c should be documenting the behavior in that case. 7907ISO8601 dates have many variants but a few examples 7908are: 7909 7910@example 79111972-09-24 79121972-09-24 20:05 7913@end example 7914@c I doubt we really accept all ISO8601 format dates 7915@c (for example, decimal hours like 1972-09-24 20,2) 7916@c I'm not sure we should, many of them are pretty 7917@c bizarre and it has lots of gratuitous multiple ways 7918@c to specify the same thing. 7919 7920There are a lot more ISO8601 date formats, and CVS 7921accepts many of them, but you probably don't want to 7922hear the @emph{whole} long story :-). 7923 7924@c Citing a URL here is kind of problematic given how 7925@c much they change and people who have old versions of 7926@c this manual, but in case we want to reinstate an 7927@c ISO8601 URL, a few are: 7928@c http://www.saqqara.demon.co.uk/datefmt.htm 7929@c http://www.cl.cam.ac.uk/~mgk25/iso-time.html 7930@c Citing some other ISO8601 source is probably even 7931@c worse :-). 7932 7933In addition to the dates allowed in Internet e-mail 7934itself, @sc{cvs} also allows some of the fields to be 7935omitted. For example: 7936@c FIXME: Need to figure out better, and document, 7937@c what we want to allow the user to omit. 7938@c NOTE: "omit" does not imply "reorder". 7939@c FIXME: Need to cite a web page describing how to get 7940@c RFC's. 7941 7942@example 794324 Sep 1972 20:05 794424 Sep 7945@end example 7946 7947The date is interpreted as being in the 7948local timezone, unless a specific timezone is 7949specified. 7950 7951These two date formats are preferred. However, 7952@sc{cvs} currently accepts a wide variety of other date 7953formats. They are intentionally not documented here in 7954any detail, and future versions of @sc{cvs} might not 7955accept all of them. 7956@c We should document and testsuite "now" and 7957@c "yesterday". "now" is mentioned in the FAQ and 7958@c "yesterday" is mentioned in this document (and the 7959@c message from "cvs import" suggesting a merge 7960@c command). What else? Probably some/all of the "3 7961@c weeks ago" family. 7962@c 7963@c Maybe at 7964@c some point have CVS start give warnings on "unofficial" 7965@c formats (many of which might be typos or user 7966@c misunderstandings, and/or formats people never/rarely 7967@c use to specify dates)? 7968 7969One such format is 7970@code{@var{month}/@var{day}/@var{year}}. This may 7971confuse people who are accustomed to having the month 7972and day in the other order; @samp{1/4/96} is January 4, 7973not April 1. 7974 7975Remember to quote the argument to the @samp{-D} 7976flag so that your shell doesn't interpret spaces as 7977argument separators. A command using the @samp{-D} 7978flag can look like this: 7979 7980@example 7981$ cvs diff -D "1 hour ago" cvs.texinfo 7982@end example 7983 7984@cindex Forcing a tag match 7985@item -f 7986When you specify a particular date or tag to @sc{cvs} commands, they 7987normally ignore files that do not contain the tag (or did not 7988exist prior to the date) that you specified. Use the @samp{-f} option 7989if you want files retrieved even when there is no match for the 7990tag or date. (The most recent revision of the file 7991will be used). 7992 7993Note that even with @samp{-f}, a tag that you specify 7994must exist (that is, in some file, not necessary in 7995every file). This is so that @sc{cvs} will continue to 7996give an error if you mistype a tag name. 7997 7998@need 800 7999@samp{-f} is available with these commands: 8000@code{annotate}, @code{checkout}, @code{export}, 8001@code{rdiff}, @code{rtag}, and @code{update}. 8002 8003@strong{Warning:} The @code{commit} and @code{remove} 8004commands also have a 8005@samp{-f} option, but it has a different behavior for 8006those commands. See @ref{commit options}, and 8007@ref{Removing files}. 8008 8009@item -k @var{kflag} 8010Alter the default processing of keywords. 8011@xref{Keyword substitution}, for the meaning of 8012@var{kflag}. Your @var{kflag} specification is 8013@dfn{sticky} when you use it to create a private copy 8014of a source file; that is, when you use this option 8015with the @code{checkout} or @code{update} commands, 8016@sc{cvs} associates your selected @var{kflag} with the 8017file, and continues to use it with future update 8018commands on the same file until you specify otherwise. 8019 8020The @samp{-k} option is available with the @code{add}, 8021@code{checkout}, @code{diff}, @code{import} and 8022@code{update} commands. 8023 8024@item -l 8025Local; run only in current working directory, rather than 8026recursing through subdirectories. 8027 8028@strong{Warning:} this is not the same 8029as the overall @samp{cvs -l} option, which you can specify to the 8030left of a cvs command! 8031 8032Available with the following commands: @code{annotate}, @code{checkout}, 8033@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8034@code{log}, @code{rdiff}, @code{remove}, @code{rtag}, 8035@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8036and @code{watchers}. 8037 8038@cindex Editor, avoiding invocation of 8039@cindex Avoiding editor invocation 8040@item -m @var{message} 8041Use @var{message} as log information, instead of 8042invoking an editor. 8043 8044Available with the following commands: @code{add}, 8045@code{commit} and @code{import}. 8046 8047@item -n 8048Do not run any checkout/commit/tag program. (A program can be 8049specified to run on each of these activities, in the modules 8050database (@pxref{modules}); this option bypasses it). 8051 8052@strong{Warning:} this is not the same as the overall @samp{cvs -n} 8053option, which you can specify to the left of a cvs command! 8054 8055Available with the @code{checkout}, @code{commit}, @code{export}, 8056and @code{rtag} commands. 8057 8058@item -P 8059Prune empty directories. See @ref{Removing directories}. 8060 8061@item -p 8062Pipe the files retrieved from the repository to standard output, 8063rather than writing them in the current directory. Available 8064with the @code{checkout} and @code{update} commands. 8065 8066@item -R 8067Process directories recursively. This is on by default. 8068 8069Available with the following commands: @code{annotate}, @code{checkout}, 8070@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8071@code{rdiff}, @code{remove}, @code{rtag}, 8072@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8073and @code{watchers}. 8074 8075@item -r @var{tag} 8076@cindex HEAD, special tag 8077@cindex BASE, special tag 8078Use the revision specified by the @var{tag} argument instead of the 8079default @dfn{head} revision. As well as arbitrary tags defined 8080with the @code{tag} or @code{rtag} command, two special tags are 8081always available: @samp{HEAD} refers to the most recent version 8082available in the repository, and @samp{BASE} refers to the 8083revision you last checked out into the current working directory. 8084 8085@c FIXME: What does HEAD really mean? I believe that 8086@c the current answer is the head of the default branch 8087@c for all cvs commands except diff. For diff, it 8088@c seems to be (a) the head of the trunk (or the default 8089@c branch?) if there is no sticky tag, (b) the head of the 8090@c branch for the sticky tag, if there is a sticky tag. 8091@c (b) is ugly as it differs 8092@c from what HEAD means for other commands, but people 8093@c and/or scripts are quite possibly used to it. 8094@c See "head" tests in sanity.sh. 8095@c Probably the best fix is to introduce two new 8096@c special tags, ".thead" for the head of the trunk, 8097@c and ".bhead" for the head of the current branch. 8098@c Then deprecate HEAD. This has the advantage of 8099@c not surprising people with a change to HEAD, and a 8100@c side benefit of also phasing out the poorly-named 8101@c HEAD (see discussion of reserved tag names in node 8102@c "Tags"). Of course, .thead and .bhead should be 8103@c carefully implemented (with the implementation the 8104@c same for "diff" as for everyone else), test cases 8105@c written (similar to the ones in "head"), new tests 8106@c cases written for things like default branches, &c. 8107 8108The tag specification is sticky when you use this 8109@c option 8110with @code{checkout} or @code{update} to make your own 8111copy of a file: @sc{cvs} remembers the tag and continues to use it on 8112future update commands, until you specify otherwise (for more information 8113on sticky tags/dates, @pxref{Sticky tags}). 8114 8115The tag can be either a symbolic or numeric tag, as 8116described in @ref{Tags}, or the name of a branch, as 8117described in @ref{Branching and merging}. 8118 8119Specifying the @samp{-q} global option along with the 8120@samp{-r} command option is often useful, to suppress 8121the warning messages when the @sc{rcs} file 8122does not contain the specified tag. 8123 8124@strong{Warning:} this is not the same as the overall @samp{cvs -r} option, 8125which you can specify to the left of a @sc{cvs} command! 8126 8127@samp{-r} is available with the @code{checkout}, @code{commit}, 8128@code{diff}, @code{history}, @code{export}, @code{rdiff}, 8129@code{rtag}, and @code{update} commands. 8130 8131@item -W 8132Specify file names that should be filtered. You can 8133use this option repeatedly. The spec can be a file 8134name pattern of the same type that you can specify in 8135the @file{.cvswrappers} file. 8136Available with the following commands: @code{import}, 8137and @code{update}. 8138 8139@end table 8140 8141@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8142@node admin 8143@appendixsec admin---Administration 8144@cindex Admin (subcommand) 8145 8146@itemize @bullet 8147@item 8148Requires: repository, working directory. 8149@item 8150Changes: repository. 8151@item 8152Synonym: rcs 8153@end itemize 8154 8155This is the @sc{cvs} interface to assorted 8156administrative facilities. Some of them have 8157questionable usefulness for @sc{cvs} but exist for 8158historical purposes. Some of the questionable options 8159are likely to disappear in the future. This command 8160@emph{does} work recursively, so extreme care should be 8161used. 8162 8163@cindex cvsadmin 8164On unix, if there is a group named @code{cvsadmin}, 8165only members of that group can run @code{cvs admin} 8166(except for the @code{cvs admin -k} command, which can 8167be run by anybody). This group should exist on the 8168server, or any system running the non-client/server 8169@sc{cvs}. To disallow @code{cvs admin} for all users, 8170create a group with no users in it. On NT, the 8171@code{cvsadmin} feature does not exist and all users 8172can run @code{cvs admin}. 8173 8174@menu 8175* admin options:: admin options 8176@end menu 8177 8178@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8179@node admin options 8180@appendixsubsec admin options 8181 8182Some of these options have questionable usefulness for 8183@sc{cvs} but exist for historical purposes. Some even 8184make it impossible to use @sc{cvs} until you undo the 8185effect! 8186 8187@table @code 8188@item -A@var{oldfile} 8189Might not work together with @sc{cvs}. Append the 8190access list of @var{oldfile} to the access list of the 8191@sc{rcs} file. 8192 8193@item -a@var{logins} 8194Might not work together with @sc{cvs}. Append the 8195login names appearing in the comma-separated list 8196@var{logins} to the access list of the @sc{rcs} file. 8197 8198@item -b[@var{rev}] 8199Set the default branch to @var{rev}. In @sc{cvs}, you 8200normally do not manipulate default branches; sticky 8201tags (@pxref{Sticky tags}) are a better way to decide 8202which branch you want to work on. There is one reason 8203to run @code{cvs admin -b}: to revert to the vendor's 8204version when using vendor branches (@pxref{Reverting 8205local changes}). 8206There can be no space between @samp{-b} and its argument. 8207@c Hmm, we don't document the usage where rev is 8208@c omitted. Maybe that usage can/should be deprecated 8209@c (and replaced with -bHEAD or something?) (so we can toss 8210@c the optional argument). Note that -bHEAD does not 8211@c work, as of 17 Sep 1997, but probably will once "cvs 8212@c admin" is internal to CVS. 8213 8214@cindex Comment leader 8215@item -c@var{string} 8216Sets the comment leader to @var{string}. The comment 8217leader is not used by current versions of @sc{cvs} or 8218@sc{rcs} 5.7. Therefore, you can almost surely not 8219worry about it. @xref{Keyword substitution}. 8220 8221@item -e[@var{logins}] 8222Might not work together with @sc{cvs}. Erase the login 8223names appearing in the comma-separated list 8224@var{logins} from the access list of the RCS file. If 8225@var{logins} is omitted, erase the entire access list. 8226There can be no space between @samp{-e} and its argument. 8227 8228@item -I 8229Run interactively, even if the standard input is not a 8230terminal. This option does not work with the 8231client/server @sc{cvs} and is likely to disappear in 8232a future release of @sc{cvs}. 8233 8234@item -i 8235Useless with @sc{cvs}. This creates and initializes a 8236new @sc{rcs} file, without depositing a revision. With 8237@sc{cvs}, add files with the @code{cvs add} command 8238(@pxref{Adding files}). 8239 8240@item -k@var{subst} 8241Set the default keyword 8242substitution to @var{subst}. @xref{Keyword 8243substitution}. Giving an explicit @samp{-k} option to 8244@code{cvs update}, @code{cvs export}, or @code{cvs 8245checkout} overrides this default. 8246 8247@item -l[@var{rev}] 8248Lock the revision with number @var{rev}. If a branch 8249is given, lock the latest revision on that branch. If 8250@var{rev} is omitted, lock the latest revision on the 8251default branch. There can be no space between 8252@samp{-l} and its argument. 8253 8254This can be used in conjunction with the 8255@file{rcslock.pl} script in the @file{contrib} 8256directory of the @sc{cvs} source distribution to 8257provide reserved checkouts (where only one user can be 8258editing a given file at a time). See the comments in 8259that file for details (and see the @file{README} file 8260in that directory for disclaimers about the unsupported 8261nature of contrib). According to comments in that 8262file, locking must set to strict (which is the default). 8263 8264@item -L 8265Set locking to strict. Strict locking means that the 8266owner of an RCS file is not exempt from locking for 8267checkin. For use with @sc{cvs}, strict locking must be 8268set; see the discussion under the @samp{-l} option above. 8269 8270@cindex Changing a log message 8271@cindex Replacing a log message 8272@cindex Correcting a log message 8273@cindex Fixing a log message 8274@cindex Log message, correcting 8275@item -m@var{rev}:@var{msg} 8276Replace the log message of revision @var{rev} with 8277@var{msg}. 8278 8279@c The rcs -M option, to suppress sending mail, has never been 8280@c documented as a cvs admin option. 8281 8282@item -N@var{name}[:[@var{rev}]] 8283Act like @samp{-n}, except override any previous 8284assignment of @var{name}. For use with magic branches, 8285see @ref{Magic branch numbers}. 8286 8287@item -n@var{name}[:[@var{rev}]] 8288Associate the symbolic name @var{name} with the branch 8289or revision @var{rev}. It is normally better to use 8290@samp{cvs tag} or @samp{cvs rtag} instead. Delete the 8291symbolic name if both @samp{:} and @var{rev} are 8292omitted; otherwise, print an error message if 8293@var{name} is already associated with another number. 8294If @var{rev} is symbolic, it is expanded before 8295association. A @var{rev} consisting of a branch number 8296followed by a @samp{.} stands for the current latest 8297revision in the branch. A @samp{:} with an empty 8298@var{rev} stands for the current latest revision on the 8299default branch, normally the trunk. For example, 8300@samp{cvs admin -n@var{name}:} associates @var{name} with the 8301current latest revision of all the RCS files; 8302this contrasts with @samp{cvs admin -n@var{name}:$} which 8303associates @var{name} with the revision numbers 8304extracted from keyword strings in the corresponding 8305working files. 8306 8307@cindex Deleting revisions 8308@cindex Outdating revisions 8309@cindex Saving space 8310@item -o@var{range} 8311Deletes (@dfn{outdates}) the revisions given by 8312@var{range}. 8313 8314Note that this command can be quite dangerous unless 8315you know @emph{exactly} what you are doing (for example 8316see the warnings below about how the 8317@var{rev1}:@var{rev2} syntax is confusing). 8318 8319If you are short on disc this option might help you. 8320But think twice before using it---there is no way short 8321of restoring the latest backup to undo this command! 8322If you delete different revisions than you planned, 8323either due to carelessness or (heaven forbid) a CVS 8324bug, there is no opportunity to correct the error 8325before the revisions are deleted. It probably would be 8326a good idea to experiment on a copy of the repository 8327first. 8328 8329Specify @var{range} in one of the following ways: 8330 8331@table @code 8332@item @var{rev1}::@var{rev2} 8333Collapse all revisions between rev1 and rev2, so that 8334CVS only stores the differences associated with going 8335from rev1 to rev2, not intermediate steps. For 8336example, after @samp{-o 1.3::1.5} one can retrieve 8337revision 1.3, revision 1.5, or the differences to get 8338from 1.3 to 1.5, but not the revision 1.4, or the 8339differences between 1.3 and 1.4. Other examples: 8340@samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no 8341effect, because there are no intermediate revisions to 8342remove. 8343 8344@item ::@var{rev} 8345Collapse revisions between the beginning of the branch 8346containing @var{rev} and @var{rev} itself. The 8347branchpoint and @var{rev} are left intact. For 8348example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1, 8349revision 1.3.2.5, and everything in between, but leaves 83501.3 and 1.3.2.6 intact. 8351 8352@item @var{rev}:: 8353Collapse revisions between @var{rev} and the end of the 8354branch containing @var{rev}. Revision @var{rev} is 8355left intact but the head revision is deleted. 8356 8357@item @var{rev} 8358Delete the revision @var{rev}. For example, @samp{-o 83591.3} is equivalent to @samp{-o 1.2::1.4}. 8360 8361@item @var{rev1}:@var{rev2} 8362Delete the revisions from @var{rev1} to @var{rev2}, 8363inclusive, on the same branch. One will not be able to 8364retrieve @var{rev1} or @var{rev2} or any of the 8365revisions in between. For example, the command 8366@samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful. 8367It means to delete revisions up to, and including, the 8368tag R_1_02. But beware! If there are files that have not 8369changed between R_1_02 and R_1_03 the file will have 8370@emph{the same} numerical revision number assigned to 8371the tags R_1_02 and R_1_03. So not only will it be 8372impossible to retrieve R_1_02; R_1_03 will also have to 8373be restored from the tapes! In most cases you want to 8374specify @var{rev1}::@var{rev2} instead. 8375 8376@item :@var{rev} 8377Delete revisions from the beginning of the 8378branch containing @var{rev} up to and including 8379@var{rev}. 8380 8381@item @var{rev}: 8382Delete revisions from revision @var{rev}, including 8383@var{rev} itself, to the end of the branch containing 8384@var{rev}. 8385@end table 8386 8387None of the revisions to be deleted may have 8388branches or locks. 8389 8390If any of the revisions to be deleted have symbolic 8391names, and one specifies one of the @samp{::} syntaxes, 8392then @sc{cvs} will give an error and not delete any 8393revisions. If you really want to delete both the 8394symbolic names and the revisions, first delete the 8395symbolic names with @code{cvs tag -d}, then run 8396@code{cvs admin -o}. If one specifies the 8397non-@samp{::} syntaxes, then @sc{cvs} will delete the 8398revisions but leave the symbolic names pointing to 8399nonexistent revisions. This behavior is preserved for 8400compatibility with previous versions of @sc{cvs}, but 8401because it isn't very useful, in the future it may 8402change to be like the @samp{::} case. 8403 8404Due to the way @sc{cvs} handles branches @var{rev} 8405cannot be specified symbolically if it is a branch. 8406@xref{Magic branch numbers}, for an explanation. 8407@c FIXME: is this still true? I suspect not. 8408 8409Make sure that no-one has checked out a copy of the 8410revision you outdate. Strange things will happen if he 8411starts to edit it and tries to check it back in. For 8412this reason, this option is not a good way to take back 8413a bogus commit; commit a new revision undoing the bogus 8414change instead (@pxref{Merging two revisions}). 8415 8416@item -q 8417Run quietly; do not print diagnostics. 8418 8419@item -s@var{state}[:@var{rev}] 8420Useful with @sc{cvs}. Set the state attribute of the 8421revision @var{rev} to @var{state}. If @var{rev} is a 8422branch number, assume the latest revision on that 8423branch. If @var{rev} is omitted, assume the latest 8424revision on the default branch. Any identifier is 8425acceptable for @var{state}. A useful set of states is 8426@samp{Exp} (for experimental), @samp{Stab} (for 8427stable), and @samp{Rel} (for released). By default, 8428the state of a new revision is set to @samp{Exp} when 8429it is created. The state is visible in the output from 8430@var{cvs log} (@pxref{log}), and in the 8431@samp{$@asis{}Log$} and @samp{$@asis{}State$} keywords 8432(@pxref{Keyword substitution}). Note that @sc{cvs} 8433uses the @code{dead} state for its own purposes; to 8434take a file to or from the @code{dead} state use 8435commands like @code{cvs remove} and @code{cvs add}, not 8436@code{cvs admin -s}. 8437 8438@item -t[@var{file}] 8439Useful with @sc{cvs}. Write descriptive text from the 8440contents of the named @var{file} into the RCS file, 8441deleting the existing text. The @var{file} pathname 8442may not begin with @samp{-}. The descriptive text can be seen in the 8443output from @samp{cvs log} (@pxref{log}). 8444There can be no space between @samp{-t} and its argument. 8445 8446If @var{file} is omitted, 8447obtain the text from standard input, terminated by 8448end-of-file or by a line containing @samp{.} by itself. 8449Prompt for the text if interaction is possible; see 8450@samp{-I}. 8451 8452@item -t-@var{string} 8453Similar to @samp{-t@var{file}}. Write descriptive text 8454from the @var{string} into the @sc{rcs} file, deleting 8455the existing text. 8456There can be no space between @samp{-t} and its argument. 8457 8458@c The rcs -T option, do not update last-mod time for 8459@c minor changes, has never been documented as a 8460@c cvs admin option. 8461 8462@item -U 8463Set locking to non-strict. Non-strict locking means 8464that the owner of a file need not lock a revision for 8465checkin. For use with @sc{cvs}, strict locking must be 8466set; see the discussion under the @samp{-l} option 8467above. 8468 8469@item -u[@var{rev}] 8470See the option @samp{-l} above, for a discussion of 8471using this option with @sc{cvs}. Unlock the revision 8472with number @var{rev}. If a branch is given, unlock 8473the latest revision on that branch. If @var{rev} is 8474omitted, remove the latest lock held by the caller. 8475Normally, only the locker of a revision may unlock it. 8476Somebody else unlocking a revision breaks the lock. 8477This causes a mail message to be sent to the original 8478locker. The message contains a commentary solicited 8479from the breaker. The commentary is terminated by 8480end-of-file or by a line containing @code{.} by itself. 8481There can be no space between @samp{-u} and its argument. 8482@c In the future "send mail" probably will go via the 8483@c CVSROOT/notify mechanism. But for now it means 8484@c whatever it means to "rcs". 8485 8486@item -V@var{n} 8487In previous versions of @sc{cvs}, this option meant to 8488write an @sc{rcs} file which would be acceptable to 8489@sc{rcs} version @var{n}, but it is now obsolete and 8490specifying it will produce an error. 8491@c Note that -V without an argument has never been 8492@c documented as a cvs admin option. 8493 8494@item -x@var{suffixes} 8495In previous versions of @sc{cvs}, this was documented 8496as a way of specifying the names of the @sc{rcs} 8497files. However, @sc{cvs} has always required that the 8498@sc{rcs} files used by @sc{cvs} end in @samp{,v}, so 8499this option has never done anything useful. 8500 8501@c The rcs -z option, to specify the timezone, has 8502@c never been documented as a cvs admin option. 8503@end table 8504 8505 8506@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8507@node checkout 8508@appendixsec checkout---Check out sources for editing 8509@cindex checkout (subcommand) 8510@cindex co (subcommand) 8511 8512@itemize @bullet 8513@item 8514Synopsis: checkout [options] modules@dots{} 8515@item 8516Requires: repository. 8517@item 8518Changes: working directory. 8519@item 8520Synonyms: co, get 8521@end itemize 8522 8523Create or update a working directory containing copies of the 8524source files specified by @var{modules}. You must execute 8525@code{checkout} before using most of the other @sc{cvs} 8526commands, since most of them operate on your working 8527directory. 8528 8529The @var{modules} are either 8530symbolic names for some 8531collection of source directories and files, or paths to 8532directories or files in the repository. The symbolic 8533names are defined in the @samp{modules} file. 8534@xref{modules}. 8535@c Needs an example, particularly of the non-"modules" 8536@c case but probably of both. 8537 8538@c FIXME: this seems like a very odd place to introduce 8539@c people to how CVS works. The bit about unreserved 8540@c checkouts is also misleading as it depends on how 8541@c things are set up. 8542Depending on the modules you specify, @code{checkout} may 8543recursively create directories and populate them with 8544the appropriate source files. You can then edit these 8545source files at any time (regardless of whether other 8546software developers are editing their own copies of the 8547sources); update them to include new changes applied by 8548others to the source repository; or commit your work as 8549a permanent change to the source repository. 8550 8551Note that @code{checkout} is used to create 8552directories. The top-level directory created is always 8553added to the directory where @code{checkout} is 8554invoked, and usually has the same name as the specified 8555module. In the case of a module alias, the created 8556sub-directory may have a different name, but you can be 8557sure that it will be a sub-directory, and that 8558@code{checkout} will show the relative path leading to 8559each file as it is extracted into your private work 8560area (unless you specify the @samp{-Q} global option). 8561 8562The files created by @code{checkout} are created 8563read-write, unless the @samp{-r} option to @sc{cvs} 8564(@pxref{Global options}) is specified, the 8565@code{CVSREAD} environment variable is specified 8566(@pxref{Environment variables}), or a watch is in 8567effect for that file (@pxref{Watches}). 8568 8569Note that running @code{checkout} on a directory that was already 8570built by a prior @code{checkout} is also permitted. 8571This is similar to specifying the @samp{-d} option 8572to the @code{update} command in the sense that new 8573directories that have been created in the repository 8574will appear in your work area. 8575However, @code{checkout} takes a module name whereas 8576@code{update} takes a directory name. Also 8577to use @code{checkout} this way it must be run from the 8578top level directory (where you originally ran 8579@code{checkout} from), so before you run 8580@code{checkout} to update an existing directory, don't 8581forget to change your directory to the top level 8582directory. 8583 8584For the output produced by the @code{checkout} command 8585see @ref{update output}. 8586 8587@menu 8588* checkout options:: checkout options 8589* checkout examples:: checkout examples 8590@end menu 8591 8592@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8593@node checkout options 8594@appendixsubsec checkout options 8595 8596These standard options are supported by @code{checkout} 8597(@pxref{Common options}, for a complete description of 8598them): 8599 8600@table @code 8601@item -D @var{date} 8602Use the most recent revision no later than @var{date}. 8603This option is sticky, and implies @samp{-P}. See 8604@ref{Sticky tags}, for more information on sticky tags/dates. 8605 8606@item -f 8607Only useful with the @samp{-D @var{date}} or @samp{-r 8608@var{tag}} flags. If no matching revision is found, 8609retrieve the most recent revision (instead of ignoring 8610the file). 8611 8612@item -k @var{kflag} 8613Process keywords according to @var{kflag}. See 8614@ref{Keyword substitution}. 8615This option is sticky; future updates of 8616this file in this working directory will use the same 8617@var{kflag}. The @code{status} command can be viewed 8618to see the sticky options. See @ref{Invoking CVS}, for 8619more information on the @code{status} command. 8620 8621@item -l 8622Local; run only in current working directory. 8623 8624@item -n 8625Do not run any checkout program (as specified 8626with the @samp{-o} option in the modules file; 8627@pxref{modules}). 8628 8629@item -P 8630Prune empty directories. See @ref{Moving directories}. 8631 8632@item -p 8633Pipe files to the standard output. 8634 8635@item -R 8636Checkout directories recursively. This option is on by default. 8637 8638@item -r @var{tag} 8639Use revision @var{tag}. This option is sticky, and implies @samp{-P}. 8640See @ref{Sticky tags}, for more information on sticky tags/dates. 8641@end table 8642 8643In addition to those, you can use these special command 8644options with @code{checkout}: 8645 8646@table @code 8647@item -A 8648Reset any sticky tags, dates, or @samp{-k} options. 8649See @ref{Sticky tags}, for more information on sticky tags/dates. 8650 8651@item -c 8652Copy the module file, sorted, to the standard output, 8653instead of creating or modifying any files or 8654directories in your working directory. 8655 8656@item -d @var{dir} 8657Create a directory called @var{dir} for the working 8658files, instead of using the module name. In general, 8659using this flag is equivalent to using @samp{mkdir 8660@var{dir}; cd @var{dir}} followed by the checkout 8661command without the @samp{-d} flag. 8662 8663There is an important exception, however. It is very 8664convenient when checking out a single item to have the 8665output appear in a directory that doesn't contain empty 8666intermediate directories. In this case @emph{only}, 8667CVS tries to ``shorten'' pathnames to avoid those empty 8668directories. 8669 8670For example, given a module @samp{foo} that contains 8671the file @samp{bar.c}, the command @samp{cvs co -d dir 8672foo} will create directory @samp{dir} and place 8673@samp{bar.c} inside. Similarly, given a module 8674@samp{bar} which has subdirectory @samp{baz} wherein 8675there is a file @samp{quux.c}, the command @samp{cvs -d 8676dir co bar/baz} will create directory @samp{dir} and 8677place @samp{quux.c} inside. 8678 8679Using the @samp{-N} flag will defeat this behavior. 8680Given the same module definitions above, @samp{cvs co 8681-N -d dir foo} will create directories @samp{dir/foo} 8682and place @samp{bar.c} inside, while @samp{cvs co -N -d 8683dir bar/baz} will create directories @samp{dir/bar/baz} 8684and place @samp{quux.c} inside. 8685 8686@item -j @var{tag} 8687With two @samp{-j} options, merge changes from the 8688revision specified with the first @samp{-j} option to 8689the revision specified with the second @samp{j} option, 8690into the working directory. 8691 8692With one @samp{-j} option, merge changes from the 8693ancestor revision to the revision specified with the 8694@samp{-j} option, into the working directory. The 8695ancestor revision is the common ancestor of the 8696revision which the working directory is based on, and 8697the revision specified in the @samp{-j} option. 8698 8699In addition, each -j option can contain an optional 8700date specification which, when used with branches, can 8701limit the chosen revision to one within a specific 8702date. An optional date is specified by adding a colon 8703(:) to the tag: 8704@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 8705 8706@xref{Branching and merging}. 8707 8708@item -N 8709Only useful together with @samp{-d @var{dir}}. With 8710this option, @sc{cvs} will not ``shorten'' module paths 8711in your working directory when you check out a single 8712module. See the @samp{-d} flag for examples and a 8713discussion. 8714 8715@item -s 8716Like @samp{-c}, but include the status of all modules, 8717and sort it by the status string. @xref{modules}, for 8718info about the @samp{-s} option that is used inside the 8719modules file to set the module status. 8720@end table 8721 8722@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8723@node checkout examples 8724@appendixsubsec checkout examples 8725 8726Get a copy of the module @samp{tc}: 8727 8728@example 8729$ cvs checkout tc 8730@end example 8731 8732Get a copy of the module @samp{tc} as it looked one day 8733ago: 8734 8735@example 8736$ cvs checkout -D yesterday tc 8737@end example 8738 8739@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8740@node commit 8741@appendixsec commit---Check files into the repository 8742@cindex commit (subcommand) 8743 8744@itemize @bullet 8745@item 8746Synopsis: commit [-lnRf] [-m 'log_message' | 8747-F file] [-r revision] [files@dots{}] 8748@item 8749Requires: working directory, repository. 8750@item 8751Changes: repository. 8752@item 8753Synonym: ci 8754@end itemize 8755 8756Use @code{commit} when you want to incorporate changes 8757from your working source files into the source 8758repository. 8759 8760If you don't specify particular files to commit, all of 8761the files in your working current directory are 8762examined. @code{commit} is careful to change in the 8763repository only those files that you have really 8764changed. By default (or if you explicitly specify the 8765@samp{-R} option), files in subdirectories are also 8766examined and committed if they have changed; you can 8767use the @samp{-l} option to limit @code{commit} to the 8768current directory only. 8769 8770@code{commit} verifies that the selected files are up 8771to date with the current revisions in the source 8772repository; it will notify you, and exit without 8773committing, if any of the specified files must be made 8774current first with @code{update} (@pxref{update}). 8775@code{commit} does not call the @code{update} command 8776for you, but rather leaves that for you to do when the 8777time is right. 8778 8779When all is well, an editor is invoked to allow you to 8780enter a log message that will be written to one or more 8781logging programs (@pxref{modules}, and @pxref{loginfo}) 8782and placed in the @sc{rcs} file inside the 8783repository. This log message can be retrieved with the 8784@code{log} command; see @ref{log}. You can specify the 8785log message on the command line with the @samp{-m 8786@var{message}} option, and thus avoid the editor invocation, 8787or use the @samp{-F @var{file}} option to specify 8788that the argument file contains the log message. 8789 8790@menu 8791* commit options:: commit options 8792* commit examples:: commit examples 8793@end menu 8794 8795@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8796@node commit options 8797@appendixsubsec commit options 8798 8799These standard options are supported by @code{commit} 8800(@pxref{Common options}, for a complete description of 8801them): 8802 8803@table @code 8804@item -l 8805Local; run only in current working directory. 8806 8807@item -n 8808Do not run any module program. 8809 8810@item -R 8811Commit directories recursively. This is on by default. 8812 8813@item -r @var{revision} 8814Commit to @var{revision}. @var{revision} must be 8815either a branch, or a revision on the main trunk that 8816is higher than any existing revision number 8817(@pxref{Assigning revisions}). You 8818cannot commit to a specific revision on a branch. 8819@c FIXME: Need xref for branch case. 8820@end table 8821 8822@code{commit} also supports these options: 8823 8824@table @code 8825@item -F @var{file} 8826Read the log message from @var{file}, instead 8827of invoking an editor. 8828 8829@item -f 8830Note that this is not the standard behavior of 8831the @samp{-f} option as defined in @ref{Common options}. 8832 8833Force @sc{cvs} to commit a new revision even if you haven't 8834made any changes to the file. If the current revision 8835of @var{file} is 1.7, then the following two commands 8836are equivalent: 8837 8838@example 8839$ cvs commit -f @var{file} 8840$ cvs commit -r 1.8 @var{file} 8841@end example 8842 8843@c This is odd, but it's how CVS has worked for some 8844@c time. 8845The @samp{-f} option disables recursion (i.e., it 8846implies @samp{-l}). To force @sc{cvs} to commit a new 8847revision for all files in all subdirectories, you must 8848use @samp{-f -R}. 8849 8850@item -m @var{message} 8851Use @var{message} as the log message, instead of 8852invoking an editor. 8853@end table 8854 8855@need 2000 8856@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8857@node commit examples 8858@appendixsubsec commit examples 8859 8860@c FIXME: this material wants to be somewhere 8861@c in "Branching and merging". 8862 8863@appendixsubsubsec Committing to a branch 8864 8865You can commit to a branch revision (one that has an 8866even number of dots) with the @samp{-r} option. To 8867create a branch revision, use the @samp{-b} option 8868of the @code{rtag} or @code{tag} commands 8869(@pxref{Branching and merging}). Then, either @code{checkout} or 8870@code{update} can be used to base your sources on the 8871newly created branch. From that point on, all 8872@code{commit} changes made within these working sources 8873will be automatically added to a branch revision, 8874thereby not disturbing main-line development in any 8875way. For example, if you had to create a patch to the 88761.2 version of the product, even though the 2.0 version 8877is already under development, you might do: 8878 8879@example 8880$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module 8881$ cvs checkout -r FCS1_2_Patch product_module 8882$ cd product_module 8883[[ hack away ]] 8884$ cvs commit 8885@end example 8886 8887@noindent 8888This works automatically since the @samp{-r} option is 8889sticky. 8890 8891@appendixsubsubsec Creating the branch after editing 8892 8893Say you have been working on some extremely 8894experimental software, based on whatever revision you 8895happened to checkout last week. If others in your 8896group would like to work on this software with you, but 8897without disturbing main-line development, you could 8898commit your change to a new branch. Others can then 8899checkout your experimental stuff and utilize the full 8900benefit of @sc{cvs} conflict resolution. The scenario might 8901look like: 8902 8903@c FIXME: Should we be recommending tagging the branchpoint? 8904@example 8905[[ hacked sources are present ]] 8906$ cvs tag -b EXPR1 8907$ cvs update -r EXPR1 8908$ cvs commit 8909@end example 8910 8911The @code{update} command will make the @samp{-r 8912EXPR1} option sticky on all files. Note that your 8913changes to the files will never be removed by the 8914@code{update} command. The @code{commit} will 8915automatically commit to the correct branch, because the 8916@samp{-r} is sticky. You could also do like this: 8917 8918@c FIXME: Should we be recommending tagging the branchpoint? 8919@example 8920[[ hacked sources are present ]] 8921$ cvs tag -b EXPR1 8922$ cvs commit -r EXPR1 8923@end example 8924 8925@noindent 8926but then, only those files that were changed by you 8927will have the @samp{-r EXPR1} sticky flag. If you hack 8928away, and commit without specifying the @samp{-r EXPR1} 8929flag, some files may accidentally end up on the main 8930trunk. 8931 8932To work with you on the experimental change, others 8933would simply do 8934 8935@example 8936$ cvs checkout -r EXPR1 whatever_module 8937@end example 8938 8939@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8940@node diff 8941@appendixsec diff---Show differences between revisions 8942@cindex diff (subcommand) 8943 8944@itemize @bullet 8945@item 8946Synopsis: diff [-lR] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files@dots{}] 8947@item 8948Requires: working directory, repository. 8949@item 8950Changes: nothing. 8951@end itemize 8952 8953The @code{diff} command is used to compare different 8954revisions of files. The default action is to compare 8955your working files with the revisions they were based 8956on, and report any differences that are found. 8957 8958If any file names are given, only those files are 8959compared. If any directories are given, all files 8960under them will be compared. 8961 8962The exit status for diff is different than for other 8963@sc{cvs} commands; for details @ref{Exit status}. 8964 8965@menu 8966* diff options:: diff options 8967* diff examples:: diff examples 8968@end menu 8969 8970@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8971@node diff options 8972@appendixsubsec diff options 8973 8974These standard options are supported by @code{diff} 8975(@pxref{Common options}, for a complete description of 8976them): 8977 8978@table @code 8979@item -D @var{date} 8980Use the most recent revision no later than @var{date}. 8981See @samp{-r} for how this affects the comparison. 8982 8983@item -k @var{kflag} 8984Process keywords according to @var{kflag}. See 8985@ref{Keyword substitution}. 8986 8987@item -l 8988Local; run only in current working directory. 8989 8990@item -R 8991Examine directories recursively. This option is on by 8992default. 8993 8994@item -r @var{tag} 8995Compare with revision @var{tag}. Zero, one or two 8996@samp{-r} options can be present. With no @samp{-r} 8997option, the working file will be compared with the 8998revision it was based on. With one @samp{-r}, that 8999revision will be compared to your current working file. 9000With two @samp{-r} options those two revisions will be 9001compared (and your working file will not affect the 9002outcome in any way). 9003@c We should be a lot more explicit, with examples, 9004@c about the difference between "cvs diff" and "cvs 9005@c diff -r HEAD". This often confuses new users. 9006 9007One or both @samp{-r} options can be replaced by a 9008@samp{-D @var{date}} option, described above. 9009@end table 9010 9011@c Conceptually, this is a disaster. There are 3 9012@c zillion diff formats that we support via the diff 9013@c library. It is not obvious to me that we should 9014@c document them all. Maybe just the most common ones 9015@c like -c and -u, and think about phasing out the 9016@c obscure ones. 9017@c FIXCVS: also should be a way to specify an external 9018@c diff program (which can be different for different 9019@c file types) and pass through 9020@c arbitrary options, so that the user can do 9021@c "--pass=-Z --pass=foo" or something even if CVS 9022@c doesn't know about the "-Z foo" option to diff. 9023@c This would fit nicely with deprecating/eliminating 9024@c the obscure options of the diff library, because it 9025@c would let people specify an external GNU diff if 9026@c they are into that sort of thing. 9027The following options specify the format of the 9028output. They have the same meaning as in GNU diff. 9029 9030@example 9031-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 9032--binary 9033--brief 9034--changed-group-format=@var{arg} 9035-c 9036 -C @var{nlines} 9037 --context[=@var{lines}] 9038-e --ed 9039-t --expand-tabs 9040-f --forward-ed 9041--horizon-lines=@var{arg} 9042--ifdef=@var{arg} 9043-w --ignore-all-space 9044-B --ignore-blank-lines 9045-i --ignore-case 9046-I @var{regexp} 9047 --ignore-matching-lines=@var{regexp} 9048-h 9049-b --ignore-space-change 9050-T --initial-tab 9051-L @var{label} 9052 --label=@var{label} 9053--left-column 9054-d --minimal 9055-N --new-file 9056--new-line-format=@var{arg} 9057--old-line-format=@var{arg} 9058--paginate 9059-n --rcs 9060-s --report-identical-files 9061-p 9062--show-c-function 9063-y --side-by-side 9064-F @var{regexp} 9065--show-function-line=@var{regexp} 9066-H --speed-large-files 9067--suppress-common-lines 9068-a --text 9069--unchanged-group-format=@var{arg} 9070-u 9071 -U @var{nlines} 9072 --unified[=@var{lines}] 9073@c FIXCVS: This option is accepted by src/diff.c but 9074@c not diff/diff.c; it would appear that any attempt to 9075@c use it would get an error. 9076-V @var{arg} 9077-W @var{columns} 9078 --width=@var{columns} 9079@end example 9080 9081@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9082@node diff examples 9083@appendixsubsec diff examples 9084 9085The following line produces a Unidiff (@samp{-u} flag) 9086between revision 1.14 and 1.19 of 9087@file{backend.c}. Due to the @samp{-kk} flag no 9088keywords are substituted, so differences that only depend 9089on keyword substitution are ignored. 9090 9091@example 9092$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c 9093@end example 9094 9095Suppose the experimental branch EXPR1 was based on a 9096set of files tagged RELEASE_1_0. To see what has 9097happened on that branch, the following can be used: 9098 9099@example 9100$ cvs diff -r RELEASE_1_0 -r EXPR1 9101@end example 9102 9103A command like this can be used to produce a context 9104diff between two releases: 9105 9106@example 9107$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs 9108@end example 9109 9110If you are maintaining ChangeLogs, a command like the following 9111just before you commit your changes may help you write 9112the ChangeLog entry. All local modifications that have 9113not yet been committed will be printed. 9114 9115@example 9116$ cvs diff -u | less 9117@end example 9118 9119@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9120@node export 9121@appendixsec export---Export sources from CVS, similar to checkout 9122@cindex export (subcommand) 9123 9124@itemize @bullet 9125@item 9126Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{} 9127@item 9128Requires: repository. 9129@item 9130Changes: current directory. 9131@end itemize 9132 9133This command is a variant of @code{checkout}; use it 9134when you want a copy of the source for module without 9135the @sc{cvs} administrative directories. For example, you 9136might use @code{export} to prepare source for shipment 9137off-site. This command requires that you specify a 9138date or tag (with @samp{-D} or @samp{-r}), so that you 9139can count on reproducing the source you ship to others 9140(and thus it always prunes empty directories). 9141 9142One often would like to use @samp{-kv} with @code{cvs 9143export}. This causes any keywords to be 9144expanded such that an import done at some other site 9145will not lose the keyword revision information. But be 9146aware that doesn't handle an export containing binary 9147files correctly. Also be aware that after having used 9148@samp{-kv}, one can no longer use the @code{ident} 9149command (which is part of the @sc{rcs} suite---see 9150ident(1)) which looks for keyword strings. If 9151you want to be able to use @code{ident} you must not 9152use @samp{-kv}. 9153 9154@menu 9155* export options:: export options 9156@end menu 9157 9158@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9159@node export options 9160@appendixsubsec export options 9161 9162These standard options are supported by @code{export} 9163(@pxref{Common options}, for a complete description of 9164them): 9165 9166@table @code 9167@item -D @var{date} 9168Use the most recent revision no later than @var{date}. 9169 9170@item -f 9171If no matching revision is found, retrieve the most 9172recent revision (instead of ignoring the file). 9173 9174@item -l 9175Local; run only in current working directory. 9176 9177@item -n 9178Do not run any checkout program. 9179 9180@item -R 9181Export directories recursively. This is on by default. 9182 9183@item -r @var{tag} 9184Use revision @var{tag}. 9185@end table 9186 9187In addition, these options (that are common to 9188@code{checkout} and @code{export}) are also supported: 9189 9190@table @code 9191@item -d @var{dir} 9192Create a directory called @var{dir} for the working 9193files, instead of using the module name. 9194@xref{checkout options}, for complete details on how 9195@sc{cvs} handles this flag. 9196 9197@item -k @var{subst} 9198Set keyword expansion mode (@pxref{Substitution modes}). 9199 9200@item -N 9201Only useful together with @samp{-d @var{dir}}. 9202@xref{checkout options}, for complete details on how 9203@sc{cvs} handles this flag. 9204@end table 9205 9206@ignore 9207@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9208@c @node export examples 9209@appendixsubsec export examples 9210 9211Contributed examples are gratefully accepted. 9212@c -- Examples here!! 9213@end ignore 9214 9215@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9216@node history 9217@appendixsec history---Show status of files and users 9218@cindex history (subcommand) 9219 9220@itemize @bullet 9221@item 9222Synopsis: history [-report] [-flags] [-options args] [files@dots{}] 9223@item 9224Requires: the file @file{$CVSROOT/CVSROOT/history} 9225@item 9226Changes: nothing. 9227@end itemize 9228 9229@sc{cvs} can keep a history file that tracks each use of the 9230@code{checkout}, @code{commit}, @code{rtag}, 9231@code{update}, and @code{release} commands. You can 9232use @code{history} to display this information in 9233various formats. 9234 9235Logging must be enabled by creating the file 9236@file{$CVSROOT/CVSROOT/history}. 9237 9238@strong{Warning:} @code{history} uses @samp{-f}, @samp{-l}, 9239@samp{-n}, and @samp{-p} in ways that conflict with the 9240normal use inside @sc{cvs} (@pxref{Common options}). 9241 9242@menu 9243* history options:: history options 9244@end menu 9245 9246@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9247@node history options 9248@appendixsubsec history options 9249 9250Several options (shown above as @samp{-report}) control what 9251kind of report is generated: 9252 9253@table @code 9254@item -c 9255Report on each time commit was used (i.e., each time 9256the repository was modified). 9257 9258@item -e 9259Everything (all record types). Equivalent to 9260specifying @samp{-x} with all record types. Of course, 9261@samp{-e} will also include record types which are 9262added in a future version of @sc{cvs}; if you are 9263writing a script which can only handle certain record 9264types, you'll want to specify @samp{-x}. 9265 9266@item -m @var{module} 9267Report on a particular module. (You can meaningfully 9268use @samp{-m} more than once on the command line.) 9269 9270@item -o 9271Report on checked-out modules. This is the default report type. 9272 9273@item -T 9274Report on all tags. 9275 9276@item -x @var{type} 9277Extract a particular set of record types @var{type} from the @sc{cvs} 9278history. The types are indicated by single letters, 9279which you may specify in combination. 9280 9281Certain commands have a single record type: 9282 9283@table @code 9284@item F 9285release 9286@item O 9287checkout 9288@item E 9289export 9290@item T 9291rtag 9292@end table 9293 9294@noindent 9295One of four record types may result from an update: 9296 9297@table @code 9298@item C 9299A merge was necessary but collisions were 9300detected (requiring manual merging). 9301@item G 9302A merge was necessary and it succeeded. 9303@item U 9304A working file was copied from the repository. 9305@item W 9306The working copy of a file was deleted during 9307update (because it was gone from the repository). 9308@end table 9309 9310@noindent 9311One of three record types results from commit: 9312 9313@table @code 9314@item A 9315A file was added for the first time. 9316@item M 9317A file was modified. 9318@item R 9319A file was removed. 9320@end table 9321@end table 9322 9323The options shown as @samp{-flags} constrain or expand 9324the report without requiring option arguments: 9325 9326@table @code 9327@item -a 9328Show data for all users (the default is to show data 9329only for the user executing @code{history}). 9330 9331@item -l 9332Show last modification only. 9333 9334@item -w 9335Show only the records for modifications done from the 9336same working directory where @code{history} is 9337executing. 9338@end table 9339 9340The options shown as @samp{-options @var{args}} constrain the report 9341based on an argument: 9342 9343@table @code 9344@item -b @var{str} 9345Show data back to a record containing the string 9346@var{str} in either the module name, the file name, or 9347the repository path. 9348 9349@item -D @var{date} 9350Show data since @var{date}. This is slightly different 9351from the normal use of @samp{-D @var{date}}, which 9352selects the newest revision older than @var{date}. 9353 9354@item -f @var{file} 9355Show data for a particular file 9356(you can specify several @samp{-f} options on the same command line). 9357This is equivalent to specifying the file on the command line. 9358 9359@item -n @var{module} 9360Show data for a particular module 9361(you can specify several @samp{-n} options on the same command line). 9362 9363@item -p @var{repository} 9364Show data for a particular source repository (you 9365can specify several @samp{-p} options on the same command 9366line). 9367 9368@item -r @var{rev} 9369Show records referring to revisions since the revision 9370or tag named @var{rev} appears in individual @sc{rcs} 9371files. Each @sc{rcs} file is searched for the revision or 9372tag. 9373 9374@item -t @var{tag} 9375Show records since tag @var{tag} was last added to the 9376history file. This differs from the @samp{-r} flag 9377above in that it reads only the history file, not the 9378@sc{rcs} files, and is much faster. 9379 9380@item -u @var{name} 9381Show records for user @var{name}. 9382 9383@item -z @var{timezone} 9384Show times in the selected records using the specified 9385time zone instead of UTC. 9386@end table 9387 9388@ignore 9389@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9390@c @node history examples 9391@appendixsubsec history examples 9392 9393Contributed examples will gratefully be accepted. 9394@c -- Examples here! 9395@end ignore 9396 9397@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9398@node import 9399@appendixsec import---Import sources into CVS, using vendor branches 9400@cindex import (subcommand) 9401 9402@c FIXME: This node is way too long for one which has subnodes. 9403 9404@itemize @bullet 9405@item 9406Synopsis: import [-options] repository vendortag releasetag@dots{} 9407@item 9408Requires: Repository, source distribution directory. 9409@item 9410Changes: repository. 9411@end itemize 9412 9413Use @code{import} to incorporate an entire source 9414distribution from an outside source (e.g., a source 9415vendor) into your source repository directory. You can 9416use this command both for initial creation of a 9417repository, and for wholesale updates to the module 9418from the outside source. @xref{Tracking sources}, for 9419a discussion on this subject. 9420 9421The @var{repository} argument gives a directory name 9422(or a path to a directory) under the @sc{cvs} root directory 9423for repositories; if the directory did not exist, 9424import creates it. 9425 9426When you use import for updates to source that has been 9427modified in your source repository (since a prior 9428import), it will notify you of any files that conflict 9429in the two branches of development; use @samp{checkout 9430-j} to reconcile the differences, as import instructs 9431you to do. 9432 9433If @sc{cvs} decides a file should be ignored 9434(@pxref{cvsignore}), it does not import it and prints 9435@samp{I } followed by the filename (@pxref{import output}, for a 9436complete description of the output). 9437 9438If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists, 9439any file whose names match the specifications in that 9440file will be treated as packages and the appropriate 9441filtering will be performed on the file/directory 9442before being imported. @xref{Wrappers}. 9443 9444The outside source is saved in a first-level 9445branch, by default 1.1.1. Updates are leaves of this 9446branch; for example, files from the first imported 9447collection of source will be revision 1.1.1.1, then 9448files from the first imported update will be revision 94491.1.1.2, and so on. 9450 9451At least three arguments are required. 9452@var{repository} is needed to identify the collection 9453of source. @var{vendortag} is a tag for the entire 9454branch (e.g., for 1.1.1). You must also specify at 9455least one @var{releasetag} to identify the files at 9456the leaves created each time you execute @code{import}. 9457 9458@c I'm not completely sure this belongs here. But 9459@c we need to say it _somewhere_ reasonably obvious; it 9460@c is a common misconception among people first learning CVS 9461Note that @code{import} does @emph{not} change the 9462directory in which you invoke it. In particular, it 9463does not set up that directory as a @sc{cvs} working 9464directory; if you want to work with the sources import 9465them first and then check them out into a different 9466directory (@pxref{Getting the source}). 9467 9468@menu 9469* import options:: import options 9470* import output:: import output 9471* import examples:: import examples 9472@end menu 9473 9474@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9475@node import options 9476@appendixsubsec import options 9477 9478This standard option is supported by @code{import} 9479(@pxref{Common options}, for a complete description): 9480 9481@table @code 9482@item -m @var{message} 9483Use @var{message} as log information, instead of 9484invoking an editor. 9485@end table 9486 9487There are the following additional special options. 9488 9489@table @code 9490@item -b @var{branch} 9491See @ref{Multiple vendor branches}. 9492 9493@item -k @var{subst} 9494Indicate the keyword expansion mode desired. This 9495setting will apply to all files created during the 9496import, but not to any files that previously existed in 9497the repository. See @ref{Substitution modes}, for a 9498list of valid @samp{-k} settings. 9499 9500@item -I @var{name} 9501Specify file names that should be ignored during 9502import. You can use this option repeatedly. To avoid 9503ignoring any files at all (even those ignored by 9504default), specify `-I !'. 9505 9506@var{name} can be a file name pattern of the same type 9507that you can specify in the @file{.cvsignore} file. 9508@xref{cvsignore}. 9509@c -- Is this really true? 9510 9511@item -W @var{spec} 9512Specify file names that should be filtered during 9513import. You can use this option repeatedly. 9514 9515@var{spec} can be a file name pattern of the same type 9516that you can specify in the @file{.cvswrappers} 9517file. @xref{Wrappers}. 9518@end table 9519 9520@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9521@node import output 9522@appendixsubsec import output 9523 9524@code{import} keeps you informed of its progress by printing a line 9525for each file, preceded by one character indicating the status of the file: 9526 9527@table @code 9528@item U @var{file} 9529The file already exists in the repository and has not been locally 9530modified; a new revision has been created (if necessary). 9531 9532@item N @var{file} 9533The file is a new file which has been added to the repository. 9534 9535@item C @var{file} 9536The file already exists in the repository but has been locally modified; 9537you will have to merge the changes. 9538 9539@item I @var{file} 9540The file is being ignored (@pxref{cvsignore}). 9541 9542@cindex Symbolic link, importing 9543@cindex Link, symbolic, importing 9544@c FIXME: also (somewhere else) probably 9545@c should be documenting what happens if you "cvs add" 9546@c a symbolic link. Also maybe what happens if 9547@c you manually create symbolic links within the 9548@c repository (? - not sure why we'd want to suggest 9549@c doing that). 9550@item L @var{file} 9551The file is a symbolic link; @code{cvs import} ignores symbolic links. 9552People periodically suggest that this behavior should 9553be changed, but if there is a consensus on what it 9554should be changed to, it doesn't seem to be apparent. 9555(Various options in the @file{modules} file can be used 9556to recreate symbolic links on checkout, update, etc.; 9557@pxref{modules}.) 9558@end table 9559 9560@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9561@node import examples 9562@appendixsubsec import examples 9563 9564See @ref{Tracking sources}, and @ref{From files}. 9565 9566@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9567@node log 9568@appendixsec log---Print out log information for files 9569@cindex log (subcommand) 9570 9571@itemize @bullet 9572@item 9573Synopsis: log [options] [files@dots{}] 9574@item 9575Requires: repository, working directory. 9576@item 9577Changes: nothing. 9578@end itemize 9579 9580Display log information for files. @code{log} used to 9581call the @sc{rcs} utility @code{rlog}. Although this 9582is no longer true in the current sources, this history 9583determines the format of the output and the options, 9584which are not quite in the style of the other @sc{cvs} 9585commands. 9586 9587@cindex Timezone, in output 9588@cindex Zone, time, in output 9589@c Kind of a funny place to document the timezone used 9590@c in output from commands other than @code{log}. 9591@c There is also more we need to say about this, 9592@c including what happens in a client/server environment. 9593The output includes the location of the @sc{rcs} file, 9594the @dfn{head} revision (the latest revision on the 9595trunk), all symbolic names (tags) and some other 9596things. For each revision, the revision number, the 9597author, the number of lines added/deleted and the log 9598message are printed. All times are displayed in 9599Coordinated Universal Time (UTC). (Other parts of 9600@sc{cvs} print times in the local timezone). 9601@c FIXCVS: need a better way to control the timezone 9602@c used in output. Previous/current versions of CVS did/do 9603@c sometimes support -z in RCSINIT, and/or an 9604@c undocumented (except by reference to 'rlog') -z option 9605@c to cvs log, but this has not been a consistent, 9606@c documented feature. Perhaps a new global option, 9607@c where LT means the client's timezone, which the 9608@c client then communicates to the server, is the 9609@c right solution. 9610 9611@strong{Warning:} @code{log} uses @samp{-R} in a way that conflicts 9612with the normal use inside @sc{cvs} (@pxref{Common options}). 9613 9614@menu 9615* log options:: log options 9616* log examples:: log examples 9617@end menu 9618 9619@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9620@node log options 9621@appendixsubsec log options 9622 9623By default, @code{log} prints all information that is 9624available. All other options restrict the output. 9625 9626@table @code 9627@item -b 9628Print information about the revisions on the default 9629branch, normally the highest branch on the trunk. 9630 9631@item -d @var{dates} 9632Print information about revisions with a checkin 9633date/time in the range given by the 9634semicolon-separated list of dates. The date formats 9635accepted are those accepted by the @samp{-D} option to 9636many other @sc{cvs} commands (@pxref{Common options}). 9637Dates can be combined into ranges as follows: 9638 9639@c Should we be thinking about accepting ISO8601 9640@c ranges? For example "1972-09-10/1972-09-12". 9641@table @code 9642@item @var{d1}<@var{d2} 9643@itemx @var{d2}>@var{d1} 9644Select the revisions that were deposited between 9645@var{d1} and @var{d2}. 9646 9647@item <@var{d} 9648@itemx @var{d}> 9649Select all revisions dated @var{d} or earlier. 9650 9651@item @var{d}< 9652@itemx >@var{d} 9653Select all revisions dated @var{d} or later. 9654 9655@item @var{d} 9656Select the single, latest revision dated @var{d} or 9657earlier. 9658@end table 9659 9660The @samp{>} or @samp{<} characters may be followed by 9661@samp{=} to indicate an inclusive range rather than an 9662exclusive one. 9663 9664Note that the separator is a semicolon (;). 9665 9666@item -h 9667Print only the name of the @sc{rcs} file, name 9668of the file in the working directory, head, 9669default branch, access list, locks, symbolic names, and 9670suffix. 9671 9672@item -l 9673Local; run only in current working directory. (Default 9674is to run recursively). 9675 9676@item -N 9677Do not print the list of tags for this file. This 9678option can be very useful when your site uses a lot of 9679tags, so rather than "more"'ing over 3 pages of tag 9680information, the log information is presented without 9681tags at all. 9682 9683@item -R 9684Print only the name of the @sc{rcs} file. 9685 9686@c Note that using a bare revision (in addition to not 9687@c being explicitly documented here) is potentially 9688@c confusing; it shows the log message to get from the 9689@c previous revision to that revision. "-r1.3 -r1.6" 9690@c (equivalent to "-r1.3,1.6") is even worse; it 9691@c prints the messages to get from 1.2 to 1.3 and 1.5 9692@c to 1.6. By analogy with "cvs diff", users might 9693@c expect that it is more like specifying a range. 9694@c It is not 100% clear to me how much of this should 9695@c be documented (for example, multiple -r options 9696@c perhaps could/should be deprecated given the false 9697@c analogy with "cvs diff"). 9698@c In general, this section should be rewritten to talk 9699@c about messages to get from revision rev1 to rev2, 9700@c rather than messages for revision rev2 (that is, the 9701@c messages are associated with a change not a static 9702@c revision and failing to make this distinction causes 9703@c much confusion). 9704@item -r@var{revisions} 9705Print information about revisions given in the 9706comma-separated list @var{revisions} of revisions and 9707ranges. The following table explains the available 9708range formats: 9709 9710@table @code 9711@item @var{rev1}:@var{rev2} 9712Revisions @var{rev1} to @var{rev2} (which must be on 9713the same branch). 9714 9715@item :@var{rev} 9716Revisions from the beginning of the branch up to 9717and including @var{rev}. 9718 9719@item @var{rev}: 9720Revisions starting with @var{rev} to the end of the 9721branch containing @var{rev}. 9722 9723@item @var{branch} 9724An argument that is a branch means all revisions on 9725that branch. 9726 9727@item @var{branch1}:@var{branch2} 9728A range of branches means all revisions 9729on the branches in that range. 9730 9731@item @var{branch}. 9732The latest revision in @var{branch}. 9733@end table 9734 9735A bare @samp{-r} with no revisions means the latest 9736revision on the default branch, normally the trunk. 9737There can be no space between the @samp{-r} option and 9738its argument. 9739 9740@item -s @var{states} 9741Print information about revisions whose state 9742attributes match one of the states given in the 9743comma-separated list @var{states}. 9744 9745@item -t 9746Print the same as @samp{-h}, plus the descriptive text. 9747 9748@item -w@var{logins} 9749Print information about revisions checked in by users 9750with login names appearing in the comma-separated list 9751@var{logins}. If @var{logins} is omitted, the user's 9752login is assumed. There can be no space between the 9753@samp{-w} option and its argument. 9754@end table 9755 9756@code{log} prints the intersection of the revisions 9757selected with the options @samp{-d}, @samp{-s}, and 9758@samp{-w}, intersected with the union of the revisions 9759selected by @samp{-b} and @samp{-r}. 9760 9761@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9762@node log examples 9763@appendixsubsec log examples 9764 9765Contributed examples are gratefully accepted. 9766 9767@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9768@node rdiff 9769@appendixsec rdiff---'patch' format diffs between releases 9770@cindex rdiff (subcommand) 9771 9772@itemize @bullet 9773@item 9774rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{} 9775@item 9776Requires: repository. 9777@item 9778Changes: nothing. 9779@item 9780Synonym: patch 9781@end itemize 9782 9783Builds a Larry Wall format patch(1) file between two 9784releases, that can be fed directly into the @code{patch} 9785program to bring an old release up-to-date with the new 9786release. (This is one of the few @sc{cvs} commands that 9787operates directly from the repository, and doesn't 9788require a prior checkout.) The diff output is sent to 9789the standard output device. 9790 9791You can specify (using the standard @samp{-r} and 9792@samp{-D} options) any combination of one or two 9793revisions or dates. If only one revision or date is 9794specified, the patch file reflects differences between 9795that revision or date and the current head revisions in 9796the @sc{rcs} file. 9797 9798Note that if the software release affected is contained 9799in more than one directory, then it may be necessary to 9800specify the @samp{-p} option to the @code{patch} command when 9801patching the old sources, so that @code{patch} is able to find 9802the files that are located in other directories. 9803 9804@menu 9805* rdiff options:: rdiff options 9806* rdiff examples:: rdiff examples 9807@end menu 9808 9809@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9810@node rdiff options 9811@appendixsubsec rdiff options 9812 9813These standard options are supported by @code{rdiff} 9814(@pxref{Common options}, for a complete description of 9815them): 9816 9817@table @code 9818@item -D @var{date} 9819Use the most recent revision no later than @var{date}. 9820 9821@item -f 9822If no matching revision is found, retrieve the most 9823recent revision (instead of ignoring the file). 9824 9825@item -l 9826Local; don't descend subdirectories. 9827 9828@item -R 9829Examine directories recursively. This option is on by default. 9830 9831@item -r @var{tag} 9832Use revision @var{tag}. 9833@end table 9834 9835In addition to the above, these options are available: 9836 9837@table @code 9838@item -c 9839Use the context diff format. This is the default format. 9840 9841@item -s 9842Create a summary change report instead of a patch. The 9843summary includes information about files that were 9844changed or added between the releases. It is sent to 9845the standard output device. This is useful for finding 9846out, for example, which files have changed between two 9847dates or revisions. 9848 9849@item -t 9850A diff of the top two revisions is sent to the standard 9851output device. This is most useful for seeing what the 9852last change to a file was. 9853 9854@item -u 9855Use the unidiff format for the context diffs. 9856Remember that old versions 9857of the @code{patch} program can't handle the unidiff 9858format, so if you plan to post this patch to the net 9859you should probably not use @samp{-u}. 9860 9861@item -V @var{vn} 9862Expand keywords according to the rules current in 9863@sc{rcs} version @var{vn} (the expansion format changed with 9864@sc{rcs} version 5). Note that this option is no 9865longer accepted. CVS will always expand keywords the 9866way that @sc{rcs} version 5 does. 9867@end table 9868 9869@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9870@node rdiff examples 9871@appendixsubsec rdiff examples 9872 9873Suppose you receive mail from @t{foo@@example.net} asking for an 9874update from release 1.2 to 1.4 of the tc compiler. You 9875have no such patches on hand, but with @sc{cvs} that can 9876easily be fixed with a command such as this: 9877 9878@example 9879$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \ 9880$$ Mail -s 'The patches you asked for' foo@@example.net 9881@end example 9882 9883Suppose you have made release 1.3, and forked a branch 9884called @samp{R_1_3fix} for bugfixes. @samp{R_1_3_1} 9885corresponds to release 1.3.1, which was made some time 9886ago. Now, you want to see how much development has been 9887done on the branch. This command can be used: 9888 9889@example 9890$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name 9891cvs rdiff: Diffing module-name 9892File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6 9893File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4 9894File bar.h,v changed from revision 1.29.2.1 to 1.2 9895@end example 9896 9897@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9898@node release 9899@appendixsec release---Indicate that a Module is no longer in use 9900@cindex release (subcommand) 9901 9902@itemize @bullet 9903@item 9904release [-d] directories@dots{} 9905@item 9906Requires: Working directory. 9907@item 9908Changes: Working directory, history log. 9909@end itemize 9910 9911This command is meant to safely cancel the effect of 9912@samp{cvs checkout}. Since @sc{cvs} doesn't lock files, it 9913isn't strictly necessary to use this command. You can 9914always simply delete your working directory, if you 9915like; but you risk losing changes you may have 9916forgotten, and you leave no trace in the @sc{cvs} history 9917file (@pxref{history file}) that you've abandoned your 9918checkout. 9919 9920Use @samp{cvs release} to avoid these problems. This 9921command checks that no uncommitted changes are 9922present; that you are executing it from immediately 9923above a @sc{cvs} working directory; and that the repository 9924recorded for your files is the same as the repository 9925defined in the module database. 9926 9927If all these conditions are true, @samp{cvs release} 9928leaves a record of its execution (attesting to your 9929intentionally abandoning your checkout) in the @sc{cvs} 9930history log. 9931 9932@menu 9933* release options:: release options 9934* release output:: release output 9935* release examples:: release examples 9936@end menu 9937 9938@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9939@node release options 9940@appendixsubsec release options 9941 9942The @code{release} command supports one command option: 9943 9944@table @code 9945@item -d 9946Delete your working copy of the file if the release 9947succeeds. If this flag is not given your files will 9948remain in your working directory. 9949 9950@strong{Warning:} The @code{release} command deletes 9951all directories and files recursively. This 9952has the very serious side-effect that any directory 9953that you have created inside your checked-out sources, 9954and not added to the repository (using the @code{add} 9955command; @pxref{Adding files}) will be silently deleted---even 9956if it is non-empty! 9957@end table 9958 9959@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9960@node release output 9961@appendixsubsec release output 9962 9963Before @code{release} releases your sources it will 9964print a one-line message for any file that is not 9965up-to-date. 9966 9967@strong{Warning:} Any new directories that you have 9968created, but not added to the @sc{cvs} directory hierarchy 9969with the @code{add} command (@pxref{Adding files}) will be 9970silently ignored (and deleted, if @samp{-d} is 9971specified), even if they contain files. 9972@c FIXCVS: This is a bug. But is it true? I think 9973@c maybe they print "? dir" now. 9974 9975@table @code 9976@item U @var{file} 9977@itemx P @var{file} 9978There exists a newer revision of this file in the 9979repository, and you have not modified your local copy 9980of the file (@samp{U} and @samp{P} mean the same thing). 9981 9982@item A @var{file} 9983The file has been added to your private copy of the 9984sources, but has not yet been committed to the 9985repository. If you delete your copy of the sources 9986this file will be lost. 9987 9988@item R @var{file} 9989The file has been removed from your private copy of the 9990sources, but has not yet been removed from the 9991repository, since you have not yet committed the 9992removal. @xref{commit}. 9993 9994@item M @var{file} 9995The file is modified in your working directory. There 9996might also be a newer revision inside the repository. 9997 9998@item ? @var{file} 9999@var{file} is in your working directory, but does not 10000correspond to anything in the source repository, and is 10001not in the list of files for @sc{cvs} to ignore (see the 10002description of the @samp{-I} option, and 10003@pxref{cvsignore}). If you remove your working 10004sources, this file will be lost. 10005@end table 10006 10007@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10008@node release examples 10009@appendixsubsec release examples 10010 10011Release the @file{tc} directory, and delete your local working copy 10012of the files. 10013 10014@example 10015$ cd .. # @r{You must stand immediately above the} 10016 # @r{sources when you issue @samp{cvs release}.} 10017$ cvs release -d tc 10018You have [0] altered files in this repository. 10019Are you sure you want to release (and delete) directory `tc': y 10020$ 10021@end example 10022 10023@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10024@node update 10025@appendixsec update---Bring work tree in sync with repository 10026@cindex update (subcommand) 10027 10028@itemize @bullet 10029@item 10030update [-AdflPpR] [-d] [-r tag|-D date] files@dots{} 10031@item 10032Requires: repository, working directory. 10033@item 10034Changes: working directory. 10035@end itemize 10036 10037After you've run checkout to create your private copy 10038of source from the common repository, other developers 10039will continue changing the central source. From time 10040to time, when it is convenient in your development 10041process, you can use the @code{update} command from 10042within your working directory to reconcile your work 10043with any revisions applied to the source repository 10044since your last checkout or update. 10045 10046@menu 10047* update options:: update options 10048* update output:: update output 10049@end menu 10050 10051@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10052@node update options 10053@appendixsubsec update options 10054 10055These standard options are available with @code{update} 10056(@pxref{Common options}, for a complete description of 10057them): 10058 10059@table @code 10060@item -D date 10061Use the most recent revision no later than @var{date}. 10062This option is sticky, and implies @samp{-P}. 10063See @ref{Sticky tags}, for more information on sticky tags/dates. 10064 10065@item -f 10066Only useful with the @samp{-D @var{date}} or @samp{-r 10067@var{tag}} flags. If no matching revision is found, 10068retrieve the most recent revision (instead of ignoring 10069the file). 10070 10071@item -k @var{kflag} 10072Process keywords according to @var{kflag}. See 10073@ref{Keyword substitution}. 10074This option is sticky; future updates of 10075this file in this working directory will use the same 10076@var{kflag}. The @code{status} command can be viewed 10077to see the sticky options. See @ref{Invoking CVS}, for 10078more information on the @code{status} command. 10079 10080@item -l 10081Local; run only in current working directory. @xref{Recursive behavior}. 10082 10083@item -P 10084Prune empty directories. See @ref{Moving directories}. 10085 10086@item -p 10087Pipe files to the standard output. 10088 10089@item -R 10090Update directories recursively (default). @xref{Recursive 10091behavior}. 10092 10093@item -r rev 10094Retrieve revision/tag @var{rev}. This option is sticky, 10095and implies @samp{-P}. 10096See @ref{Sticky tags}, for more information on sticky tags/dates. 10097@end table 10098 10099@need 800 10100These special options are also available with 10101@code{update}. 10102 10103@table @code 10104@item -A 10105Reset any sticky tags, dates, or @samp{-k} options. 10106See @ref{Sticky tags}, for more information on sticky tags/dates. 10107 10108@item -C 10109Overwrite locally modified files with clean copies from 10110the repository (the modified file is saved in 10111@file{.#@var{file}.@var{revision}}, however). 10112 10113@item -d 10114Create any directories that exist in the repository if 10115they're missing from the working directory. Normally, 10116@code{update} acts only on directories and files that 10117were already enrolled in your working directory. 10118 10119This is useful for updating directories that were 10120created in the repository since the initial checkout; 10121but it has an unfortunate side effect. If you 10122deliberately avoided certain directories in the 10123repository when you created your working directory 10124(either through use of a module name or by listing 10125explicitly the files and directories you wanted on the 10126command line), then updating with @samp{-d} will create 10127those directories, which may not be what you want. 10128 10129@item -I @var{name} 10130Ignore files whose names match @var{name} (in your 10131working directory) during the update. You can specify 10132@samp{-I} more than once on the command line to specify 10133several files to ignore. Use @samp{-I !} to avoid 10134ignoring any files at all. @xref{cvsignore}, for other 10135ways to make @sc{cvs} ignore some files. 10136 10137@item -W@var{spec} 10138Specify file names that should be filtered during 10139update. You can use this option repeatedly. 10140 10141@var{spec} can be a file name pattern of the same type 10142that you can specify in the @file{.cvswrappers} 10143file. @xref{Wrappers}. 10144 10145@item -j@var{revision} 10146With two @samp{-j} options, merge changes from the 10147revision specified with the first @samp{-j} option to 10148the revision specified with the second @samp{j} option, 10149into the working directory. 10150 10151With one @samp{-j} option, merge changes from the 10152ancestor revision to the revision specified with the 10153@samp{-j} option, into the working directory. The 10154ancestor revision is the common ancestor of the 10155revision which the working directory is based on, and 10156the revision specified in the @samp{-j} option. 10157 10158In addition, each @samp{-j} option can contain an optional 10159date specification which, when used with branches, can 10160limit the chosen revision to one within a specific 10161date. An optional date is specified by adding a colon 10162(:) to the tag: 10163@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 10164 10165@xref{Branching and merging}. 10166 10167@end table 10168 10169@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10170@node update output 10171@appendixsubsec update output 10172 10173@code{update} and @code{checkout} keep you informed of 10174their progress by printing a line for each file, preceded 10175by one character indicating the status of the file: 10176 10177@table @code 10178@item U @var{file} 10179The file was brought up to date with respect to the 10180repository. This is done for any file that exists in 10181the repository but not in your source, and for files 10182that you haven't changed but are not the most recent 10183versions available in the repository. 10184 10185@item P @var{file} 10186Like @samp{U}, but the @sc{cvs} server sends a patch 10187instead of an entire file. These two things accomplish 10188the same thing. 10189 10190@item A @var{file} 10191The file has been added to your private copy of the 10192sources, and will be added to the source repository 10193when you run @code{commit} on the file. This is a 10194reminder to you that the file needs to be committed. 10195 10196@item R @var{file} 10197The file has been removed from your private copy of the 10198sources, and will be removed from the source repository 10199when you run @code{commit} on the file. This is a 10200reminder to you that the file needs to be committed. 10201 10202@item M @var{file} 10203The file is modified in your working directory. 10204 10205@samp{M} can indicate one of two states for a file 10206you're working on: either there were no modifications 10207to the same file in the repository, so that your file 10208remains as you last saw it; or there were modifications 10209in the repository as well as in your copy, but they 10210were merged successfully, without conflict, in your 10211working directory. 10212 10213@sc{cvs} will print some messages if it merges your work, 10214and a backup copy of your working file (as it looked 10215before you ran @code{update}) will be made. The exact 10216name of that file is printed while @code{update} runs. 10217 10218@item C @var{file} 10219@cindex .# files 10220@cindex __ files (VMS) 10221A conflict was detected while trying to merge your 10222changes to @var{file} with changes from the source 10223repository. @var{file} (the copy in your working 10224directory) is now the result of attempting to merge 10225the two revisions; an unmodified copy of your file 10226is also in your working directory, with the name 10227@file{.#@var{file}.@var{revision}} where @var{revision} 10228is the revision that your modified file started 10229from. Resolve the conflict as described in 10230@ref{Conflicts example}. 10231@c "some systems" as in out-of-the-box OSes? Not as 10232@c far as I know. We need to advise sysadmins as well 10233@c as users how to set up this kind of purge, if that is 10234@c what they want. 10235@c We also might want to think about cleaner solutions, 10236@c like having CVS remove the .# file once the conflict 10237@c has been resolved or something like that. 10238(Note that some systems automatically purge 10239files that begin with @file{.#} if they have not been 10240accessed for a few days. If you intend to keep a copy 10241of your original file, it is a very good idea to rename 10242it.) Under @sc{vms}, the file name starts with 10243@file{__} rather than @file{.#}. 10244 10245@item ? @var{file} 10246@var{file} is in your working directory, but does not 10247correspond to anything in the source repository, and is 10248not in the list of files for @sc{cvs} to ignore (see the 10249description of the @samp{-I} option, and 10250@pxref{cvsignore}). 10251@end table 10252 10253@node Invoking CVS 10254@appendix Quick reference to CVS commands 10255@cindex Command reference 10256@cindex Reference, commands 10257@cindex Invoking CVS 10258 10259This appendix describes how to invoke @sc{cvs}, with 10260references to where each command or feature is 10261described in detail. For other references run the 10262@code{cvs --help} command, or see @ref{Index}. 10263 10264A @sc{cvs} command looks like: 10265 10266@example 10267cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ] 10268@end example 10269 10270Global options: 10271 10272@table @code 10273@item --allow-root=@var{rootdir} 10274Specify legal @sc{cvsroot} directory (server only) (not 10275in @sc{cvs} 1.9 and older). See @ref{Password 10276authentication server}. 10277 10278@item -a 10279Authenticate all communication (client only) (not in @sc{cvs} 102801.9 and older). See @ref{Global options}. 10281 10282@item -b 10283Specify RCS location (@sc{cvs} 1.9 and older). See 10284@ref{Global options}. 10285 10286@item -d @var{root} 10287Specify the @sc{cvsroot}. See @ref{Repository}. 10288 10289@item -e @var{editor} 10290Edit messages with @var{editor}. See @ref{Committing 10291your changes}. 10292 10293@item -f 10294Do not read the @file{~/.cvsrc} file. See @ref{Global 10295options}. 10296 10297@item -H 10298@itemx --help 10299Print a help message. See @ref{Global options}. 10300 10301@item -l 10302Do not log in @file{$CVSROOT/CVSROOT/history} file. See @ref{Global 10303options}. 10304 10305@item -n 10306Do not change any files. See @ref{Global options}. 10307 10308@item -Q 10309Be really quiet. See @ref{Global options}. 10310 10311@item -q 10312Be somewhat quiet. See @ref{Global options}. 10313 10314@item -r 10315Make new working files read-only. See @ref{Global options}. 10316 10317@item -s @var{variable}=@var{value} 10318Set a user variable. See @ref{Variables}. 10319 10320@item -T @var{tempdir} 10321Put temporary files in @var{tempdir}. See @ref{Global 10322options}. 10323 10324@item -t 10325Trace @sc{cvs} execution. See @ref{Global options}. 10326 10327@item -v 10328@item --version 10329Display version and copyright information for @sc{cvs}. 10330 10331@item -w 10332Make new working files read-write. See @ref{Global 10333options}. 10334 10335@item -x 10336Encrypt all communication (client only). 10337See @ref{Global options}. 10338 10339@item -z @var{gzip-level} 10340@cindex Compression 10341@cindex Gzip 10342Set the compression level (client only). 10343See @ref{Global options}. 10344@end table 10345 10346Keyword expansion modes (@pxref{Substitution modes}): 10347 10348@example 10349-kkv $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp $ 10350-kkvl $@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10351-kk $@asis{}Id$ 10352-kv file1,v 1.1 1993/12/09 03:21:13 joe Exp 10353-ko @i{no expansion} 10354-kb @i{no expansion, file is binary} 10355@end example 10356 10357Keywords (@pxref{Keyword list}): 10358 10359@example 10360$@asis{}Author: joe $ 10361$@asis{}Date: 1993/12/09 03:21:13 $ 10362$@asis{}Header: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10363$@asis{}Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 10364$@asis{}Locker: harry $ 10365$@asis{}Name: snapshot_1_14 $ 10366$@asis{}RCSfile: file1,v $ 10367$@asis{}Revision: 1.1 $ 10368$@asis{}Source: /home/files/file1,v $ 10369$@asis{}State: Exp $ 10370$@asis{}Log: file1,v $ 10371Revision 1.1 1993/12/09 03:30:17 joe 10372Initial revision 10373 10374@end example 10375 10376@c The idea behind this table is that we want each item 10377@c to be a sentence or two at most. Preferably a 10378@c single line. 10379@c 10380@c In some cases refs to "foo options" are just to get 10381@c this thing written quickly, not because the "foo 10382@c options" node is really the best place to point. 10383Commands, command options, and command arguments: 10384 10385@table @code 10386@item add [@var{options}] [@var{files}@dots{}] 10387Add a new file/directory. See @ref{Adding files}. 10388 10389@table @code 10390@item -k @var{kflag} 10391Set keyword expansion. 10392 10393@item -m @var{msg} 10394Set file description. 10395@end table 10396 10397@item admin [@var{options}] [@var{files}@dots{}] 10398Administration of history files in the repository. See 10399@ref{admin}. 10400@c This list omits those options which are not 10401@c documented as being useful with CVS. That might be 10402@c a mistake... 10403 10404@table @code 10405@item -b[@var{rev}] 10406Set default branch. See @ref{Reverting local changes}. 10407 10408@item -c@var{string} 10409Set comment leader. 10410 10411@item -k@var{subst} 10412Set keyword substitution. See @ref{Keyword 10413substitution}. 10414 10415@item -l[@var{rev}] 10416Lock revision @var{rev}, or latest revision. 10417 10418@item -m@var{rev}:@var{msg} 10419Replace the log message of revision @var{rev} with 10420@var{msg}. 10421 10422@item -o@var{range} 10423Delete revisions from the repository. See 10424@ref{admin options}. 10425 10426@item -q 10427Run quietly; do not print diagnostics. 10428 10429@item -s@var{state}[:@var{rev}] 10430Set the state. 10431 10432@c Does not work for client/server CVS 10433@item -t 10434Set file description from standard input. 10435 10436@item -t@var{file} 10437Set file description from @var{file}. 10438 10439@item -t-@var{string} 10440Set file description to @var{string}. 10441 10442@item -u[@var{rev}] 10443Unlock revision @var{rev}, or latest revision. 10444@end table 10445 10446@item annotate [@var{options}] [@var{files}@dots{}] 10447Show last revision where each line was modified. See 10448@ref{annotate}. 10449 10450@table @code 10451@item -D @var{date} 10452Annotate the most recent revision no later than 10453@var{date}. See @ref{Common options}. 10454 10455@item -f 10456Use head revision if tag/date not found. See 10457@ref{Common options}. 10458 10459@item -l 10460Local; run only in current working directory. @xref{Recursive behavior}. 10461 10462@item -R 10463Operate recursively (default). @xref{Recursive 10464behavior}. 10465 10466@item -r @var{tag} 10467Annotate revision @var{tag}. See @ref{Common options}. 10468@end table 10469 10470@item checkout [@var{options}] @var{modules}@dots{} 10471Get a copy of the sources. See @ref{checkout}. 10472 10473@table @code 10474@item -A 10475Reset any sticky tags/date/options. See @ref{Sticky 10476tags} and @ref{Keyword substitution}. 10477 10478@item -c 10479Output the module database. See @ref{checkout options}. 10480 10481@item -D @var{date} 10482Check out revisions as of @var{date} (is sticky). See 10483@ref{Common options}. 10484 10485@item -d @var{dir} 10486Check out into @var{dir}. See @ref{checkout options}. 10487 10488@item -f 10489Use head revision if tag/date not found. See 10490@ref{Common options}. 10491 10492@c Probably want to use rev1/rev2 style like for diff 10493@c -r. Here and in on-line help. 10494@item -j @var{rev} 10495Merge in changes. See @ref{checkout options}. 10496 10497@item -k @var{kflag} 10498Use @var{kflag} keyword expansion. See 10499@ref{Substitution modes}. 10500 10501@item -l 10502Local; run only in current working directory. @xref{Recursive behavior}. 10503 10504@item -N 10505Don't ``shorten'' module paths if -d specified. See 10506@ref{checkout options}. 10507 10508@item -n 10509Do not run module program (if any). See @ref{checkout options}. 10510 10511@item -P 10512Prune empty directories. See @ref{Moving directories}. 10513 10514@item -p 10515Check out files to standard output (avoids 10516stickiness). See @ref{checkout options}. 10517 10518@item -R 10519Operate recursively (default). @xref{Recursive 10520behavior}. 10521 10522@item -r @var{tag} 10523Checkout revision @var{tag} (is sticky). See @ref{Common options}. 10524 10525@item -s 10526Like -c, but include module status. See @ref{checkout options}. 10527@end table 10528 10529@item commit [@var{options}] [@var{files}@dots{}] 10530Check changes into the repository. See @ref{commit}. 10531 10532@table @code 10533@item -F @var{file} 10534Read log message from @var{file}. See @ref{commit options}. 10535 10536@item -f 10537@c What is this "disables recursion"? It is from the 10538@c on-line help; is it documented in this manual? 10539Force the file to be committed; disables recursion. 10540See @ref{commit options}. 10541 10542@item -l 10543Local; run only in current working directory. See @ref{Recursive behavior}. 10544 10545@item -m @var{msg} 10546Use @var{msg} as log message. See @ref{commit options}. 10547 10548@item -n 10549Do not run module program (if any). See @ref{commit options}. 10550 10551@item -R 10552Operate recursively (default). @xref{Recursive 10553behavior}. 10554 10555@item -r @var{rev} 10556Commit to @var{rev}. See @ref{commit options}. 10557@c FIXME: should be dragging over text from 10558@c commit options, especially if it can be cleaned up 10559@c and made concise enough. 10560@end table 10561 10562@item diff [@var{options}] [@var{files}@dots{}] 10563Show differences between revisions. See @ref{diff}. 10564In addition to the options shown below, accepts a wide 10565variety of options to control output style, for example 10566@samp{-c} for context diffs. 10567 10568@table @code 10569@item -D @var{date1} 10570Diff revision for date against working file. See 10571@ref{diff options}. 10572 10573@item -D @var{date2} 10574Diff @var{rev1}/@var{date1} against @var{date2}. See 10575@ref{diff options}. 10576 10577@item -l 10578Local; run only in current working directory. See @ref{Recursive behavior}. 10579 10580@item -N 10581Include diffs for added and removed files. See 10582@ref{diff options}. 10583 10584@item -R 10585Operate recursively (default). @xref{Recursive 10586behavior}. 10587 10588@item -r @var{rev1} 10589Diff revision for @var{rev1} against working file. See 10590@ref{diff options}. 10591 10592@item -r @var{rev2} 10593Diff @var{rev1}/@var{date1} against @var{rev2}. See @ref{diff options}. 10594@end table 10595 10596@item edit [@var{options}] [@var{files}@dots{}] 10597Get ready to edit a watched file. See @ref{Editing files}. 10598 10599@table @code 10600@item -a @var{actions} 10601Specify actions for temporary watch, where 10602@var{actions} is @code{edit}, @code{unedit}, 10603@code{commit}, @code{all}, or @code{none}. See 10604@ref{Editing files}. 10605 10606@item -l 10607Local; run only in current working directory. See @ref{Recursive behavior}. 10608 10609@item -R 10610Operate recursively (default). @xref{Recursive 10611behavior}. 10612@end table 10613 10614@item editors [@var{options}] [@var{files}@dots{}] 10615See who is editing a watched file. See @ref{Watch information}. 10616 10617@table @code 10618@item -l 10619Local; run only in current working directory. See @ref{Recursive behavior}. 10620 10621@item -R 10622Operate recursively (default). @xref{Recursive 10623behavior}. 10624@end table 10625 10626@item export [@var{options}] @var{modules}@dots{} 10627Export files from CVS. See @ref{export}. 10628 10629@table @code 10630@item -D @var{date} 10631Check out revisions as of @var{date}. See 10632@ref{Common options}. 10633 10634@item -d @var{dir} 10635Check out into @var{dir}. See @ref{export options}. 10636 10637@item -f 10638Use head revision if tag/date not found. See 10639@ref{Common options}. 10640 10641@item -k @var{kflag} 10642Use @var{kflag} keyword expansion. See 10643@ref{Substitution modes}. 10644 10645@item -l 10646Local; run only in current working directory. @xref{Recursive behavior}. 10647 10648@item -N 10649Don't ``shorten'' module paths if -d specified. See 10650@ref{export options}. 10651 10652@item -n 10653Do not run module program (if any). See @ref{export options}. 10654 10655@item -P 10656Prune empty directories. See @ref{Moving directories}. 10657 10658@item -R 10659Operate recursively (default). @xref{Recursive 10660behavior}. 10661 10662@item -r @var{tag} 10663Checkout revision @var{tag}. See @ref{Common options}. 10664@end table 10665 10666@item history [@var{options}] [@var{files}@dots{}] 10667Show repository access history. See @ref{history}. 10668 10669@table @code 10670@item -a 10671All users (default is self). See @ref{history options}. 10672 10673@item -b @var{str} 10674Back to record with @var{str} in module/file/repos 10675field. See @ref{history options}. 10676 10677@item -c 10678Report on committed (modified) files. See @ref{history options}. 10679 10680@item -D @var{date} 10681Since @var{date}. See @ref{history options}. 10682 10683@item -e 10684Report on all record types. See @ref{history options}. 10685 10686@item -l 10687Last modified (committed or modified report). See @ref{history options}. 10688 10689@item -m @var{module} 10690Report on @var{module} (repeatable). See @ref{history 10691options}. 10692 10693@item -n @var{module} 10694In @var{module}. See @ref{history options}. 10695 10696@item -o 10697Report on checked out modules. See @ref{history options}. 10698 10699@item -r @var{rev} 10700Since revision @var{rev}. See @ref{history options}. 10701 10702@item -T 10703@c What the @#$@# is a TAG? Same as a tag? This 10704@c wording is also in the online-line help. 10705Produce report on all TAGs. See @ref{history options}. 10706 10707@item -t @var{tag} 10708Since tag record placed in history file (by anyone). 10709See @ref{history options}. 10710 10711@item -u @var{user} 10712For user @var{user} (repeatable). See @ref{history 10713options}. 10714 10715@item -w 10716Working directory must match. See @ref{history options}. 10717 10718@item -x @var{types} 10719Report on @var{types}, one or more of 10720@code{TOEFWUCGMAR}. See @ref{history options}. 10721 10722@item -z @var{zone} 10723Output for time zone @var{zone}. See @ref{history 10724options}. 10725@end table 10726 10727@item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{} 10728Import files into CVS, using vendor branches. See 10729@ref{import}. 10730 10731@table @code 10732@item -b @var{bra} 10733Import to vendor branch @var{bra}. See 10734@ref{Multiple vendor branches}. 10735 10736@item -d 10737Use the file's modification time as the time of 10738import. See @ref{import options}. 10739 10740@item -k @var{kflag} 10741Set default keyword substitution mode. See 10742@ref{import options}. 10743 10744@item -m @var{msg} 10745Use @var{msg} for log message. See 10746@ref{import options}. 10747 10748@item -I @var{ign} 10749More files to ignore (! to reset). See 10750@ref{import options}. 10751 10752@item -W @var{spec} 10753More wrappers. See @ref{import options}. 10754@end table 10755 10756@item init 10757Create a CVS repository if it doesn't exist. See 10758@ref{Creating a repository}. 10759 10760@item log [@var{options}] [@var{files}@dots{}] 10761Print out history information for files. See @ref{log}. 10762 10763@table @code 10764@item -b 10765Only list revisions on the default branch. See @ref{log options}. 10766 10767@item -d @var{dates} 10768Specify dates (@var{d1}<@var{d2} for range, @var{d} for 10769latest before). See @ref{log options}. 10770 10771@item -h 10772Only print header. See @ref{log options}. 10773 10774@item -l 10775Local; run only in current working directory. See @ref{Recursive behavior}. 10776 10777@item -N 10778Do not list tags. See @ref{log options}. 10779 10780@item -R 10781Only print name of RCS file. See @ref{log options}. 10782 10783@item -r@var{revs} 10784Only list revisions @var{revs}. See @ref{log options}. 10785 10786@item -s @var{states} 10787Only list revisions with specified states. See @ref{log options}. 10788 10789@item -t 10790Only print header and descriptive text. See @ref{log 10791options}. 10792 10793@item -w@var{logins} 10794Only list revisions checked in by specified logins. See @ref{log options}. 10795@end table 10796 10797@item login 10798Prompt for password for authenticating server. See 10799@ref{Password authentication client}. 10800 10801@item logout 10802Remove stored password for authenticating server. See 10803@ref{Password authentication client}. 10804 10805@item rdiff [@var{options}] @var{modules}@dots{} 10806Show differences between releases. See @ref{rdiff}. 10807 10808@table @code 10809@item -c 10810Context diff output format (default). See @ref{rdiff options}. 10811 10812@item -D @var{date} 10813Select revisions based on @var{date}. See @ref{Common options}. 10814 10815@item -f 10816Use head revision if tag/date not found. See 10817@ref{Common options}. 10818 10819@item -l 10820Local; run only in current working directory. See @ref{Recursive behavior}. 10821 10822@item -R 10823Operate recursively (default). @xref{Recursive 10824behavior}. 10825 10826@item -r @var{rev} 10827Select revisions based on @var{rev}. See @ref{Common options}. 10828 10829@item -s 10830Short patch - one liner per file. See @ref{rdiff options}. 10831 10832@item -t 10833Top two diffs - last change made to the file. See 10834@ref{diff options}. 10835 10836@item -u 10837Unidiff output format. See @ref{rdiff options}. 10838 10839@item -V @var{vers} 10840Use RCS Version @var{vers} for keyword expansion (obsolete). See 10841@ref{rdiff options}. 10842@end table 10843 10844@item release [@var{options}] @var{directory} 10845Indicate that a directory is no longer in use. See 10846@ref{release}. 10847 10848@table @code 10849@item -d 10850Delete the given directory. See @ref{release options}. 10851@end table 10852 10853@item remove [@var{options}] [@var{files}@dots{}] 10854Remove an entry from the repository. See @ref{Removing files}. 10855 10856@table @code 10857@item -f 10858Delete the file before removing it. See @ref{Removing files}. 10859 10860@item -l 10861Local; run only in current working directory. See @ref{Recursive behavior}. 10862 10863@item -R 10864Operate recursively (default). @xref{Recursive 10865behavior}. 10866@end table 10867 10868@item rtag [@var{options}] @var{tag} @var{modules}@dots{} 10869Add a symbolic tag to a module. 10870See @ref{Revisions} and @ref{Branching and merging}. 10871 10872@table @code 10873@item -a 10874Clear tag from removed files that would not otherwise 10875be tagged. See @ref{Tagging add/remove}. 10876 10877@item -b 10878Create a branch named @var{tag}. See @ref{Branching and merging}. 10879 10880@item -D @var{date} 10881Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 10882 10883@item -d 10884Delete @var{tag}. See @ref{Modifying tags}. 10885 10886@item -F 10887Move @var{tag} if it already exists. See @ref{Modifying tags}. 10888 10889@item -f 10890Force a head revision match if tag/date not found. 10891See @ref{Tagging by date/tag}. 10892 10893@item -l 10894Local; run only in current working directory. See @ref{Recursive behavior}. 10895 10896@item -n 10897No execution of tag program. See @ref{Common options}. 10898 10899@item -R 10900Operate recursively (default). @xref{Recursive 10901behavior}. 10902 10903@item -r @var{rev} 10904Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 10905@end table 10906 10907@item status [@var{options}] @var{files}@dots{} 10908Display status information in a working directory. See 10909@ref{File status}. 10910 10911@table @code 10912@item -l 10913Local; run only in current working directory. See @ref{Recursive behavior}. 10914 10915@item -R 10916Operate recursively (default). @xref{Recursive 10917behavior}. 10918 10919@item -v 10920Include tag information for file. See @ref{Tags}. 10921@end table 10922 10923@item tag [@var{options}] @var{tag} [@var{files}@dots{}] 10924Add a symbolic tag to checked out version of files. 10925See @ref{Revisions} and @ref{Branching and merging}. 10926 10927@table @code 10928@item -b 10929Create a branch named @var{tag}. See @ref{Branching and merging}. 10930 10931@item -c 10932Check that working files are unmodified. See 10933@ref{Tagging the working directory}. 10934 10935@item -D @var{date} 10936Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 10937 10938@item -d 10939Delete @var{tag}. See @ref{Modifying tags}. 10940 10941@item -F 10942Move @var{tag} if it already exists. See @ref{Modifying tags}. 10943 10944@item -f 10945Force a head revision match if tag/date not found. 10946See @ref{Tagging by date/tag}. 10947 10948@item -l 10949Local; run only in current working directory. See @ref{Recursive behavior}. 10950 10951@item -R 10952Operate recursively (default). @xref{Recursive 10953behavior}. 10954 10955@item -r @var{rev} 10956Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 10957@end table 10958 10959@item unedit [@var{options}] [@var{files}@dots{}] 10960Undo an edit command. See @ref{Editing files}. 10961 10962@table @code 10963@item -a @var{actions} 10964Specify actions for temporary watch, where 10965@var{actions} is @code{edit}, @code{unedit}, 10966@code{commit}, @code{all}, or @code{none}. See 10967@ref{Editing files}. 10968 10969@item -l 10970Local; run only in current working directory. See @ref{Recursive behavior}. 10971 10972@item -R 10973Operate recursively (default). @xref{Recursive 10974behavior}. 10975@end table 10976 10977@item update [@var{options}] [@var{files}@dots{}] 10978Bring work tree in sync with repository. See 10979@ref{update}. 10980 10981@table @code 10982@item -A 10983Reset any sticky tags/date/options. See @ref{Sticky 10984tags} and @ref{Keyword substitution}. 10985 10986@item -C 10987Overwrite locally modified files with clean copies from 10988the repository (the modified file is saved in 10989@file{.#@var{file}.@var{revision}}, however). 10990 10991@item -D @var{date} 10992Check out revisions as of @var{date} (is sticky). See 10993@ref{Common options}. 10994 10995@item -d 10996Create directories. See @ref{update options}. 10997 10998@item -f 10999Use head revision if tag/date not found. See 11000@ref{Common options}. 11001 11002@item -I @var{ign} 11003More files to ignore (! to reset). See 11004@ref{import options}. 11005 11006@c Probably want to use rev1/rev2 style like for diff 11007@c -r. Here and in on-line help. 11008@item -j @var{rev} 11009Merge in changes. See @ref{update options}. 11010 11011@item -k @var{kflag} 11012Use @var{kflag} keyword expansion. See 11013@ref{Substitution modes}. 11014 11015@item -l 11016Local; run only in current working directory. @xref{Recursive behavior}. 11017 11018@item -P 11019Prune empty directories. See @ref{Moving directories}. 11020 11021@item -p 11022Check out files to standard output (avoids 11023stickiness). See @ref{update options}. 11024 11025@item -R 11026Operate recursively (default). @xref{Recursive 11027behavior}. 11028 11029@item -r @var{tag} 11030Checkout revision @var{tag} (is sticky). See @ref{Common options}. 11031 11032@item -W @var{spec} 11033More wrappers. See @ref{import options}. 11034@end table 11035 11036@item version 11037 11038Display the version of @sc{cvs} being used. If the repository 11039is remote, display both the client and server versions. 11040 11041@item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}] 11042 11043on/off: turn on/off read-only checkouts of files. See 11044@ref{Setting a watch}. 11045 11046add/remove: add or remove notification on actions. See 11047@ref{Getting Notified}. 11048 11049@table @code 11050@item -a @var{actions} 11051Specify actions for temporary watch, where 11052@var{actions} is @code{edit}, @code{unedit}, 11053@code{commit}, @code{all}, or @code{none}. See 11054@ref{Editing files}. 11055 11056@item -l 11057Local; run only in current working directory. See @ref{Recursive behavior}. 11058 11059@item -R 11060Operate recursively (default). @xref{Recursive 11061behavior}. 11062@end table 11063 11064@item watchers [@var{options}] [@var{files}@dots{}] 11065See who is watching a file. See @ref{Watch information}. 11066 11067@table @code 11068@item -l 11069Local; run only in current working directory. See @ref{Recursive behavior}. 11070 11071@item -R 11072Operate recursively (default). @xref{Recursive 11073behavior}. 11074@end table 11075 11076@end table 11077 11078@c --------------------------------------------------------------------- 11079@node Administrative files 11080@appendix Reference manual for Administrative files 11081@cindex Administrative files (reference) 11082@cindex Files, reference manual 11083@cindex Reference manual (files) 11084@cindex CVSROOT (file) 11085 11086@c FIXME? Somewhere there needs to be a more "how-to" 11087@c guide to writing these. I think the triggers 11088@c (commitinfo, loginfo, taginfo, &c) are perhaps a 11089@c different case than files like modules. One 11090@c particular issue that people sometimes are 11091@c (unnecessarily?) worried about is performance, and 11092@c the impact of writing in perl or sh or ____. 11093Inside the repository, in the directory 11094@file{$CVSROOT/CVSROOT}, there are a number of 11095supportive files for @sc{cvs}. You can use @sc{cvs} in a limited 11096fashion without any of them, but if they are set up 11097properly they can help make life easier. For a 11098discussion of how to edit them, see @ref{Intro 11099administrative files}. 11100 11101The most important of these files is the @file{modules} 11102file, which defines the modules inside the repository. 11103 11104@menu 11105* modules:: Defining modules 11106* Wrappers:: Specify binary-ness based on file name 11107* commit files:: The commit support files 11108* commitinfo:: Pre-commit checking 11109* verifymsg:: How are log messages evaluated? 11110* editinfo:: Specifying how log messages are created 11111 (obsolete) 11112* loginfo:: Where should log messages be sent? 11113* rcsinfo:: Templates for the log messages 11114* cvsignore:: Ignoring files via cvsignore 11115* checkoutlist:: Adding your own administrative files 11116* history file:: History information 11117* Variables:: Various variables are expanded 11118* config:: Miscellaneous CVS configuration 11119@end menu 11120 11121@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11122@node modules 11123@appendixsec The modules file 11124@cindex Modules (admin file) 11125@cindex Defining modules (reference manual) 11126 11127The @file{modules} file records your definitions of 11128names for collections of source code. @sc{cvs} will 11129use these definitions if you use @sc{cvs} to update the 11130modules file (use normal commands like @code{add}, 11131@code{commit}, etc). 11132 11133The @file{modules} file may contain blank lines and 11134comments (lines beginning with @samp{#}) as well as 11135module definitions. Long lines can be continued on the 11136next line by specifying a backslash (@samp{\}) as the 11137last character on the line. 11138 11139There are three basic types of modules: alias modules, 11140regular modules, and ampersand modules. The difference 11141between them is the way that they map files in the 11142repository to files in the working directory. In all 11143of the following examples, the top-level repository 11144contains a directory called @file{first-dir}, which 11145contains two files, @file{file1} and @file{file2}, and a 11146directory @file{sdir}. @file{first-dir/sdir} contains 11147a file @file{sfile}. 11148 11149@c FIXME: should test all the examples in this section. 11150 11151@menu 11152* Alias modules:: The simplest kind of module 11153* Regular modules:: 11154* Ampersand modules:: 11155* Excluding directories:: Excluding directories from a module 11156* Module options:: Regular and ampersand modules can take options 11157* Module program options:: How the modules ``program options'' programs 11158 are run. 11159@end menu 11160 11161@node Alias modules 11162@appendixsubsec Alias modules 11163@cindex Alias modules 11164@cindex -a, in modules file 11165 11166Alias modules are the simplest kind of module: 11167 11168@table @code 11169@item @var{mname} -a @var{aliases}@dots{} 11170This represents the simplest way of defining a module 11171@var{mname}. The @samp{-a} flags the definition as a 11172simple alias: @sc{cvs} will treat any use of @var{mname} (as 11173a command argument) as if the list of names 11174@var{aliases} had been specified instead. 11175@var{aliases} may contain either other module names or 11176paths. When you use paths in aliases, @code{checkout} 11177creates all intermediate directories in the working 11178directory, just as if the path had been specified 11179explicitly in the @sc{cvs} arguments. 11180@end table 11181 11182For example, if the modules file contains: 11183 11184@example 11185amodule -a first-dir 11186@end example 11187 11188@noindent 11189then the following two commands are equivalent: 11190 11191@example 11192$ cvs co amodule 11193$ cvs co first-dir 11194@end example 11195 11196@noindent 11197and they each would provide output such as: 11198 11199@example 11200cvs checkout: Updating first-dir 11201U first-dir/file1 11202U first-dir/file2 11203cvs checkout: Updating first-dir/sdir 11204U first-dir/sdir/sfile 11205@end example 11206 11207@node Regular modules 11208@appendixsubsec Regular modules 11209@cindex Regular modules 11210 11211@table @code 11212@item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ] 11213In the simplest case, this form of module definition 11214reduces to @samp{@var{mname} @var{dir}}. This defines 11215all the files in directory @var{dir} as module mname. 11216@var{dir} is a relative path (from @code{$CVSROOT}) to a 11217directory of source in the source repository. In this 11218case, on checkout, a single directory called 11219@var{mname} is created as a working directory; no 11220intermediate directory levels are used by default, even 11221if @var{dir} was a path involving several directory 11222levels. 11223@end table 11224 11225For example, if a module is defined by: 11226 11227@example 11228regmodule first-dir 11229@end example 11230 11231@noindent 11232then regmodule will contain the files from first-dir: 11233 11234@example 11235$ cvs co regmodule 11236cvs checkout: Updating regmodule 11237U regmodule/file1 11238U regmodule/file2 11239cvs checkout: Updating regmodule/sdir 11240U regmodule/sdir/sfile 11241$ 11242@end example 11243 11244By explicitly specifying files in the module definition 11245after @var{dir}, you can select particular files from 11246directory @var{dir}. Here is 11247an example: 11248 11249@example 11250regfiles first-dir/sdir sfile 11251@end example 11252 11253@noindent 11254With this definition, getting the regfiles module 11255will create a single working directory 11256@file{regfiles} containing the file listed, which 11257comes from a directory deeper 11258in the @sc{cvs} source repository: 11259 11260@example 11261$ cvs co regfiles 11262U regfiles/sfile 11263$ 11264@end example 11265 11266@node Ampersand modules 11267@appendixsubsec Ampersand modules 11268@cindex Ampersand modules 11269@cindex &, in modules file 11270 11271A module definition can refer to other modules by 11272including @samp{&@var{module}} in its definition. 11273@example 11274@var{mname} [ options ] @var{&module}@dots{} 11275@end example 11276 11277Then getting the module creates a subdirectory for each such 11278module, in the directory containing the module. For 11279example, if modules contains 11280 11281@example 11282ampermod &first-dir 11283@end example 11284 11285then a checkout will create an @code{ampermod} directory 11286which contains a directory called @code{first-dir}, 11287which in turns contains all the directories and files 11288which live there. For example, the command 11289 11290@example 11291$ cvs co ampermod 11292@end example 11293 11294@noindent 11295will create the following files: 11296 11297@example 11298ampermod/first-dir/file1 11299ampermod/first-dir/file2 11300ampermod/first-dir/sdir/sfile 11301@end example 11302 11303There is one quirk/bug: the messages that @sc{cvs} 11304prints omit the @file{ampermod}, and thus do not 11305correctly display the location to which it is checking 11306out the files: 11307 11308@example 11309$ cvs co ampermod 11310cvs checkout: Updating first-dir 11311U first-dir/file1 11312U first-dir/file2 11313cvs checkout: Updating first-dir/sdir 11314U first-dir/sdir/sfile 11315$ 11316@end example 11317 11318Do not rely on this buggy behavior; it may get fixed in 11319a future release of @sc{cvs}. 11320 11321@c FIXCVS: What happens if regular and & modules are 11322@c combined, as in "ampermodule first-dir &second-dir"? 11323@c When I tried it, it seemed to just ignore the 11324@c "first-dir". I think perhaps it should be an error 11325@c (but this needs further investigation). 11326@c In addition to discussing what each one does, we 11327@c should put in a few words about why you would use one or 11328@c the other in various situations. 11329 11330@node Excluding directories 11331@appendixsubsec Excluding directories 11332@cindex Excluding directories, in modules file 11333@cindex !, in modules file 11334 11335An alias module may exclude particular directories from 11336other modules by using an exclamation mark (@samp{!}) 11337before the name of each directory to be excluded. 11338 11339For example, if the modules file contains: 11340 11341@example 11342exmodule -a !first-dir/sdir first-dir 11343@end example 11344 11345then checking out the module @samp{exmodule} will check 11346out everything in @samp{first-dir} except any files in 11347the subdirectory @samp{first-dir/sdir}. 11348@c Note that the "!first-dir/sdir" sometimes must be listed 11349@c before "first-dir". That seems like a probable bug, in which 11350@c case perhaps it should be fixed (to allow either 11351@c order) rather than documented. See modules4 in testsuite. 11352 11353@node Module options 11354@appendixsubsec Module options 11355@cindex Options, in modules file 11356 11357Either regular modules or ampersand modules can contain 11358options, which supply additional information concerning 11359the module. 11360 11361@table @code 11362@cindex -d, in modules file 11363@item -d @var{name} 11364Name the working directory something other than the 11365module name. 11366@c FIXME: Needs a bunch of examples, analogous to the 11367@c examples for alias, regular, and ampersand modules 11368@c which show where the files go without -d. 11369 11370@cindex Export program 11371@cindex -e, in modules file 11372@item -e @var{prog} 11373Specify a program @var{prog} to run whenever files in a 11374module are exported. @var{prog} runs with a single 11375argument, the module name. 11376@c FIXME: Is it run on server? client? 11377 11378@cindex Checkin program 11379@cindex -i, in modules file 11380@item -i @var{prog} 11381Specify a program @var{prog} to run whenever files in a 11382module are committed. @var{prog} runs with a single 11383argument, the full pathname of the affected directory 11384in a source repository. The @file{commitinfo}, 11385@file{loginfo}, and @file{verifymsg} files provide other 11386ways to call a program on commit. 11387@c FIXME: Is it run on server? client? 11388 11389@cindex Checkout program 11390@cindex -o, in modules file 11391@item -o @var{prog} 11392Specify a program @var{prog} to run whenever files in a 11393module are checked out. @var{prog} runs with a single 11394argument, the module name. 11395@c FIXME: Is it run on server? client? 11396 11397@cindex Status of a module 11398@cindex Module status 11399@cindex -s, in modules file 11400@item -s @var{status} 11401Assign a status to the module. When the module file is 11402printed with @samp{cvs checkout -s} the modules are 11403sorted according to primarily module status, and 11404secondarily according to the module name. This option 11405has no other meaning. You can use this option for 11406several things besides status: for instance, list the 11407person that is responsible for this module. 11408 11409@cindex Tag program 11410@cindex -t, in modules file 11411@item -t @var{prog} 11412Specify a program @var{prog} to run whenever files in a 11413module are tagged with @code{rtag}. @var{prog} runs 11414with two arguments: the module name and the symbolic 11415tag specified to @code{rtag}. It is not run 11416when @code{tag} is executed. Generally you will find 11417that taginfo is a better solution (@pxref{user-defined logging}). 11418@c FIXME: Is it run on server? client? 11419@c Problems with -t include: 11420@c * It is run after the tag not before 11421@c * It doesn't get passed all the information that 11422@c taginfo does ("mov", &c). 11423@c * It only is run for rtag, not tag. 11424 11425@cindex Update program 11426@cindex -u, in modules file 11427@item -u @var{prog} 11428Specify a program @var{prog} to run whenever @samp{cvs 11429update} is executed from the top-level directory of the 11430checked-out module. @var{prog} runs with a single 11431argument, the full path to the source repository for 11432this module. 11433@c FIXME: Is it run on server? client? 11434@c One drawback of -u and -i are that CVS/Update.prog 11435@c and CVS/Checkin.prog only get updated on initial 11436@c checkout, and don't get updated if the modules file 11437@c changes. Also, the user can edit them, which means 11438@c they are no good for security-type stuff. 11439@end table 11440 11441You should also see @pxref{Module program options} about how the 11442``program options'' programs are run. 11443 11444@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11445 11446@node Module program options 11447@appendixsubsec How the modules file ``program options'' programs are run 11448@cindex Modules file program options 11449@cindex -u, in modules file 11450@cindex -t, in modules file 11451@cindex -o, in modules file 11452@cindex -i, in modules file 11453@cindex -e, in modules file 11454 11455@noindent 11456For checkout, rtag, and export, the program is server-based, and as such the 11457following applies:- 11458 11459If using remote access methods (pserver, ext, etc.), 11460CVS will execute this program on the server from a temporary 11461directory. The path is searched for this program. 11462 11463If using ``local access'' (on a local or remote NFS filesystem, i.e. 11464repository set just to a path), 11465the program will be executed from the newly checked-out tree, if 11466found there, or alternatively searched for in the path if not. 11467 11468@noindent 11469The commit and update programs are locally-based, and are run as 11470follows:- 11471 11472The program is always run locally. One must 11473re-checkout the tree one is using if these options are updated in the 11474modules administrative file. The file CVS/Checkin.prog contains the 11475value of the option `-i' set in the modules file, and similarly for 11476the file CVS/Update.prog and `-u'. The program is always executed from 11477the top level of the checked-out copy on the client. Again, the program 11478is first searched for in the checked-out copy and then using the path. 11479 11480The programs are all run after the operation has effectively 11481completed. 11482 11483 11484@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11485@node Wrappers 11486@appendixsec The cvswrappers file 11487@cindex cvswrappers (admin file) 11488@cindex CVSWRAPPERS, environment variable 11489@cindex Wrappers 11490 11491@c FIXME: need some better way of separating this out 11492@c by functionality. -t/-f is one feature, -m is 11493@c another, and -k is a third. And this discussion 11494@c should be better motivated (e.g. start with the 11495@c problems, then explain how the feature solves it). 11496 11497Wrappers refers to a @sc{cvs} feature which lets you 11498control certain settings based on the name of the file 11499which is being operated on. The settings are @samp{-k} 11500for binary files, and @samp{-m} for nonmergeable text 11501files. 11502 11503@ignore 11504Wrappers allow you to set a hook which transforms files on 11505their way in and out of @sc{cvs}. 11506 11507The file @file{cvswrappers} defines the script that will be 11508run on a file when its name matches a regular 11509expression. There are two scripts that can be run on a 11510file or directory. One script is executed on the file/directory 11511before being checked into the repository (this is denoted 11512with the @code{-t} flag) and the other when the file is 11513checked out of the repository (this is denoted with the 11514@code{-f} flag). The @samp{-t}/@samp{-f} feature does 11515not work with client/server @sc{cvs}. 11516@c I think maybe -t/-f works client/server if a single 11517@c file converts to/from a single file, as opposed to 11518@c the file<->directory case. Could use more 11519@c investigation... 11520@end ignore 11521 11522The @samp{-m} option 11523specifies the merge methodology that should be used when 11524a non-binary file is updated. @code{MERGE} means the usual 11525@sc{cvs} behavior: try to merge the files. @code{COPY} 11526means that @code{cvs update} will refuse to merge 11527files, as it also does for files specified as binary 11528with @samp{-kb} (but if the file is specified as 11529binary, there is no need to specify @samp{-m 'COPY'}). 11530CVS will provide the user with the 11531two versions of the files, and require the user using 11532mechanisms outside @sc{cvs}, to insert any necessary 11533changes. @strong{WARNING}: do not use @code{COPY} with 11534@sc{cvs} 1.9 or earlier--such versions of @sc{cvs} will 11535copy one version of your file over the other, wiping 11536out the previous contents. 11537@c Ordinarily we don't document the behavior of old 11538@c versions. But this one is so dangerous, I think we 11539@c must. I almost renamed it to -m 'NOMERGE' so we 11540@c could say "never use -m 'COPY'". 11541The @samp{-m} wrapper option only affects behavior when 11542merging is done on update; it does not affect how files 11543are stored. See @ref{Binary files}, for more on 11544binary files. 11545 11546The basic format of the file @file{cvswrappers} is: 11547 11548@c FIXME: @example is all wrong for this. Use @deffn or 11549@c something more sensible. 11550@example 11551wildcard [option value][option value]... 11552 11553where option is one of 11554@ignore 11555-f from cvs filter value: path to filter 11556-t to cvs filter value: path to filter 11557@end ignore 11558-m update methodology value: MERGE or COPY 11559-k keyword expansion value: expansion mode 11560 11561and value is a single-quote delimited value. 11562@end example 11563 11564@ignore 11565@example 11566*.nib -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY' 11567*.c -t 'indent %s %s' 11568@end example 11569@c When does the filter need to be an absolute pathname 11570@c and when will something like the above work? I 11571@c suspect it relates to the PATH of the server (which 11572@c in turn depends on all kinds of stuff, e.g. inetd 11573@c for pserver). I'm not sure whether/where to discuss 11574@c this. 11575@c FIXME: What do the %s's stand for? 11576 11577@noindent 11578The above example of a @file{cvswrappers} file 11579states that all files/directories that end with a @code{.nib} 11580should be filtered with the @file{wrap} program before 11581checking the file into the repository. The file should 11582be filtered though the @file{unwrap} program when the 11583file is checked out of the repository. The 11584@file{cvswrappers} file also states that a @code{COPY} 11585methodology should be used when updating the files in 11586the repository (that is, no merging should be performed). 11587 11588@c What pitfalls arise when using indent this way? Is 11589@c it a winning thing to do? Would be nice to at least 11590@c hint at those issues; we want our examples to tell 11591@c how to solve problems, not just to say that cvs can 11592@c do certain things. 11593The last example line says that all files that end with 11594@code{.c} should be filtered with @file{indent} 11595before being checked into the repository. Unlike the previous 11596example, no filtering of the @code{.c} file is done when 11597it is checked out of the repository. 11598@noindent 11599The @code{-t} filter is called with two arguments, 11600the first is the name of the file/directory to filter 11601and the second is the pathname to where the resulting 11602filtered file should be placed. 11603 11604@noindent 11605The @code{-f} filter is called with one argument, 11606which is the name of the file to filter from. The end 11607result of this filter will be a file in the users directory 11608that they can work on as they normally would. 11609 11610Note that the @samp{-t}/@samp{-f} features do not 11611conveniently handle one portion of CVS's operation: 11612determining when files are modified. CVS will still 11613want a file (or directory) to exist, and it will use 11614its modification time to determine whether a file is 11615modified. If CVS erroneously thinks a file is 11616unmodified (for example, a directory is unchanged but 11617one of the files within it is changed), you can force 11618it to check in the file anyway by specifying the 11619@samp{-f} option to @code{cvs commit} (@pxref{commit 11620options}). 11621@c This is, of course, a serious design flaw in -t/-f. 11622@c Probably the whole functionality needs to be 11623@c redesigned (starting from requirements) to fix this. 11624@end ignore 11625 11626@c FIXME: We don't document -W or point to where it is 11627@c documented. Or .cvswrappers. 11628For example, the following command imports a 11629directory, treating files whose name ends in 11630@samp{.exe} as binary: 11631 11632@example 11633cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag 11634@end example 11635 11636@c Another good example, would be storing files 11637@c (e.g. binary files) compressed in the repository. 11638@c :::::::::::::::::: 11639@c cvswrappers 11640@c :::::::::::::::::: 11641@c *.t12 -m 'COPY' 11642@c *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY' 11643@c 11644@c :::::::::::::::::: 11645@c gunzipcp 11646@c :::::::::::::::::: 11647@c : 11648@c [ -f $1 ] || exit 1 11649@c zcat $1 > /tmp/.#$1.$$ 11650@c mv /tmp/.#$1.$$ $1 11651@c 11652@c :::::::::::::::::: 11653@c gzipcp 11654@c :::::::::::::::::: 11655@c : 11656@c DIRNAME=`echo $1 | sed -e "s|/.*/||g"` 11657@c if [ ! -d $DIRNAME ] ; then 11658@c DIRNAME=`echo $1 | sed -e "s|.*/||g"` 11659@c fi 11660@c gzip -c $DIRNAME > $2 11661@c One catch--"cvs diff" will not invoke the wrappers 11662@c (probably a CVS bug, although I haven't thought it out). 11663 11664@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11665@node commit files 11666@appendixsec The commit support files 11667@cindex Commit files 11668 11669The @samp{-i} flag in the @file{modules} file can be 11670used to run a certain program whenever files are 11671committed (@pxref{modules}). The files described in 11672this section provide other, more flexible, ways to run 11673programs whenever something is committed. 11674 11675There are three kind of programs that can be run on 11676commit. They are specified in files in the repository, 11677as described below. The following table summarizes the 11678file names and the purpose of the corresponding 11679programs. 11680 11681@table @file 11682@item commitinfo 11683The program is responsible for checking that the commit 11684is allowed. If it exits with a non-zero exit status 11685the commit will be aborted. 11686 11687@item verifymsg 11688The specified program is used to evaluate the log message, 11689and possibly verify that it contains all required 11690fields. This is most useful in combination with the 11691@file{rcsinfo} file, which can hold a log message 11692template (@pxref{rcsinfo}). 11693 11694@item editinfo 11695The specified program is used to edit the log message, 11696and possibly verify that it contains all required 11697fields. This is most useful in combination with the 11698@file{rcsinfo} file, which can hold a log message 11699template (@pxref{rcsinfo}). (obsolete) 11700 11701@item loginfo 11702The specified program is called when the commit is 11703complete. It receives the log message and some 11704additional information and can store the log message in 11705a file, or mail it to appropriate persons, or maybe 11706post it to a local newsgroup, or@dots{} Your 11707imagination is the limit! 11708@end table 11709 11710@menu 11711* syntax:: The common syntax 11712@end menu 11713 11714@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11715@node syntax 11716@appendixsubsec The common syntax 11717@cindex Info files (syntax) 11718@cindex Syntax of info files 11719@cindex Common syntax of info files 11720 11721@c FIXME: having this so totally separate from the 11722@c Variables node is rather bogus. 11723 11724The administrative files such as @file{commitinfo}, 11725@file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc., 11726all have a common format. The purpose of the files are 11727described later on. The common syntax is described 11728here. 11729 11730@cindex Regular expression syntax 11731Each line contains the following: 11732@itemize @bullet 11733@item 11734@c Say anything about DEFAULT and ALL? Right now we 11735@c leave that to the description of each file (and in fact 11736@c the practice is inconsistent which is really annoying). 11737A regular expression. This is a basic regular 11738expression in the syntax used by GNU emacs. 11739@c FIXME: What we probably should be saying is "POSIX Basic 11740@c Regular Expression with the following extensions (`\(' 11741@c `\|' '+' etc)" 11742@c rather than define it with reference to emacs. 11743@c The reference to emacs is not strictly speaking 11744@c true, as we don't support \=, \s, or \S. Also it isn't 11745@c clear we should document and/or promise to continue to 11746@c support all the obscure emacs extensions like \<. 11747@c Also need to better cite (or include) full 11748@c documentation for the syntax. 11749@c Also see comment in configure.in about what happens to the 11750@c syntax if we pick up a system-supplied regexp matcher. 11751 11752@item 11753A whitespace separator---one or more spaces and/or tabs. 11754 11755@item 11756A file name or command-line template. 11757@end itemize 11758 11759@noindent 11760Blank lines are ignored. Lines that start with the 11761character @samp{#} are treated as comments. Long lines 11762unfortunately can @emph{not} be broken in two parts in 11763any way. 11764 11765The first regular expression that matches the current 11766directory name in the repository is used. The rest of the line 11767is used as a file name or command-line as appropriate. 11768 11769@c FIXME: need an example. In particular, show what 11770@c the regular expression is matched against (one 11771@c ordinarily clueful person got confused about whether it 11772@c includes the filename--"directory name" above should be 11773@c unambiguous but there is nothing like an example to 11774@c confirm people's understanding of this sort of thing). 11775 11776@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11777@node commitinfo 11778@appendixsec Commitinfo 11779@cindex Commitinfo 11780@cindex Checking commits 11781@cindex Precommit checking 11782 11783The @file{commitinfo} file defines programs to execute 11784whenever @samp{cvs commit} is about to execute. These 11785programs are used for pre-commit checking to verify 11786that the modified, added and removed files are really 11787ready to be committed. This could be used, for 11788instance, to verify that the changed files conform to 11789to your site's standards for coding practice. 11790 11791As mentioned earlier, each line in the 11792@file{commitinfo} file consists of a regular expression 11793and a command-line template. The template can include 11794a program name and any number of arguments you wish to 11795supply to it. The full path to the current source 11796repository is appended to the template, followed by the 11797file names of any files involved in the commit (added, 11798removed, and modified files). 11799 11800@cindex Exit status, of commitinfo 11801The first line with a regular expression matching the 11802directory within the repository will be used. If the 11803command returns a non-zero exit status the commit will 11804be aborted. 11805@c FIXME: need example(s) of what "directory within the 11806@c repository" means. 11807 11808@cindex DEFAULT in commitinfo 11809If the repository name does not match any of the 11810regular expressions in this file, the @samp{DEFAULT} 11811line is used, if it is specified. 11812 11813@cindex ALL in commitinfo 11814All occurrences of the name @samp{ALL} appearing as a 11815regular expression are used in addition to the first 11816matching regular expression or the name @samp{DEFAULT}. 11817 11818Note: when @sc{cvs} is accessing a remote repository, 11819@file{commitinfo} will be run on the @emph{remote} 11820(i.e., server) side, not the client side (@pxref{Remote 11821repositories}). 11822 11823@c FIXME: should discuss using commitinfo to control 11824@c who has checkin access to what (e.g. Joe can check into 11825@c directories a, b, and c, and Mary can check into 11826@c directories b, c, and d--note this case cannot be 11827@c conveniently handled with unix groups). Of course, 11828@c adding a new set of features to CVS might be a more 11829@c natural way to fix this problem than telling people to 11830@c use commitinfo. 11831@c FIXME: Should make some reference, especially in 11832@c the context of controlling who has access, to the fact 11833@c that commitinfo can be circumvented. Perhaps 11834@c mention SETXID (but has it been carefully examined 11835@c for holes?). This fits in with the discussion of 11836@c general CVS security in "Password authentication 11837@c security" (the bit which is not pserver-specific). 11838 11839@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11840@node verifymsg 11841@appendixsec Verifying log messages 11842@cindex verifymsg (admin file) 11843@cindex Log message, verifying 11844 11845Once you have entered a log message, you can evaluate 11846that message to check for specific content, such as 11847a bug ID. Use the @file{verifymsg} file to 11848specify a program that is used to verify the log message. 11849This program could be a simple script that checks 11850that the entered message contains the required fields. 11851 11852The @file{verifymsg} file is often most useful together 11853with the @file{rcsinfo} file, which can be used to 11854specify a log message template. 11855 11856Each line in the @file{verifymsg} file consists of a 11857regular expression and a command-line template. The 11858template must include a program name, and can include 11859any number of arguments. The full path to the current 11860log message template file is appended to the template. 11861 11862One thing that should be noted is that the @samp{ALL} 11863keyword is not supported. If more than one matching 11864line is found, the first one is used. This can be 11865useful for specifying a default verification script in a 11866directory, and then overriding it in a subdirectory. 11867 11868@cindex DEFAULT in verifymsg 11869If the repository name does not match any of the 11870regular expressions in this file, the @samp{DEFAULT} 11871line is used, if it is specified. 11872 11873@cindex Exit status, of verifymsg 11874If the verification script exits with a non-zero exit status, 11875the commit is aborted. 11876 11877Note that the verification script cannot change the log 11878message; it can merely accept it or reject it. 11879@c FIXME? Is this an annoying limitation? It would be 11880@c relatively easy to fix (although it would *not* be a 11881@c good idea for a verifymsg script to interact with the user 11882@c at least in the client/server case because of locks 11883@c and all that jazz). 11884 11885The following is a little silly example of a 11886@file{verifymsg} file, together with the corresponding 11887@file{rcsinfo} file, the log message template and an 11888verification script. We begin with the log message template. 11889We want to always record a bug-id number on the first 11890line of the log message. The rest of log message is 11891free text. The following template is found in the file 11892@file{/usr/cvssupport/tc.template}. 11893 11894@example 11895BugId: 11896@end example 11897 11898The script @file{/usr/cvssupport/bugid.verify} is used to 11899evaluate the log message. 11900 11901@example 11902#!/bin/sh 11903# 11904# bugid.verify filename 11905# 11906# Verify that the log message contains a valid bugid 11907# on the first line. 11908# 11909if head -1 < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then 11910 exit 0 11911else 11912 echo "No BugId found." 11913 exit 1 11914fi 11915@end example 11916 11917The @file{verifymsg} file contains this line: 11918 11919@example 11920^tc /usr/cvssupport/bugid.verify 11921@end example 11922 11923The @file{rcsinfo} file contains this line: 11924 11925@example 11926^tc /usr/cvssupport/tc.template 11927@end example 11928 11929 11930 11931@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11932@node editinfo 11933@appendixsec Editinfo 11934@cindex editinfo (admin file) 11935@cindex Editor, specifying per module 11936@cindex Per-module editor 11937@cindex Log messages, editing 11938 11939@emph{NOTE:} The @file{editinfo} feature has been 11940rendered obsolete. To set a default editor for log 11941messages use the @code{EDITOR} environment variable 11942(@pxref{Environment variables}) or the @samp{-e} global 11943option (@pxref{Global options}). See @ref{verifymsg}, 11944for information on the use of the @file{verifymsg} 11945feature for evaluating log messages. 11946 11947If you want to make sure that all log messages look the 11948same way, you can use the @file{editinfo} file to 11949specify a program that is used to edit the log message. 11950This program could be a custom-made editor that always 11951enforces a certain style of the log message, or maybe a 11952simple shell script that calls an editor, and checks 11953that the entered message contains the required fields. 11954 11955If no matching line is found in the @file{editinfo} 11956file, the editor specified in the environment variable 11957@code{$CVSEDITOR} is used instead. If that variable is 11958not set, then the environment variable @code{$EDITOR} 11959is used instead. If that variable is not 11960set a default will be used. See @ref{Committing your changes}. 11961 11962The @file{editinfo} file is often most useful together 11963with the @file{rcsinfo} file, which can be used to 11964specify a log message template. 11965 11966Each line in the @file{editinfo} file consists of a 11967regular expression and a command-line template. The 11968template must include a program name, and can include 11969any number of arguments. The full path to the current 11970log message template file is appended to the template. 11971 11972One thing that should be noted is that the @samp{ALL} 11973keyword is not supported. If more than one matching 11974line is found, the first one is used. This can be 11975useful for specifying a default edit script in a 11976module, and then overriding it in a subdirectory. 11977 11978@cindex DEFAULT in editinfo 11979If the repository name does not match any of the 11980regular expressions in this file, the @samp{DEFAULT} 11981line is used, if it is specified. 11982 11983If the edit script exits with a non-zero exit status, 11984the commit is aborted. 11985 11986Note: when @sc{cvs} is accessing a remote repository, 11987or when the @samp{-m} or @samp{-F} options to @code{cvs 11988commit} are used, @file{editinfo} will not be consulted. 11989There is no good workaround for this; use 11990@file{verifymsg} instead. 11991 11992@menu 11993* editinfo example:: Editinfo example 11994@end menu 11995 11996@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11997@node editinfo example 11998@appendixsubsec Editinfo example 11999 12000The following is a little silly example of a 12001@file{editinfo} file, together with the corresponding 12002@file{rcsinfo} file, the log message template and an 12003editor script. We begin with the log message template. 12004We want to always record a bug-id number on the first 12005line of the log message. The rest of log message is 12006free text. The following template is found in the file 12007@file{/usr/cvssupport/tc.template}. 12008 12009@example 12010BugId: 12011@end example 12012 12013The script @file{/usr/cvssupport/bugid.edit} is used to 12014edit the log message. 12015 12016@example 12017#!/bin/sh 12018# 12019# bugid.edit filename 12020# 12021# Call $EDITOR on FILENAME, and verify that the 12022# resulting file contains a valid bugid on the first 12023# line. 12024if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi 12025if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi 12026$CVSEDITOR $1 12027until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1 12028do echo -n "No BugId found. Edit again? ([y]/n)" 12029 read ans 12030 case $@{ans@} in 12031 n*) exit 1;; 12032 esac 12033 $CVSEDITOR $1 12034done 12035@end example 12036 12037The @file{editinfo} file contains this line: 12038 12039@example 12040^tc /usr/cvssupport/bugid.edit 12041@end example 12042 12043The @file{rcsinfo} file contains this line: 12044 12045@example 12046^tc /usr/cvssupport/tc.template 12047@end example 12048 12049@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12050@node loginfo 12051@appendixsec Loginfo 12052@cindex loginfo (admin file) 12053@cindex Storing log messages 12054@cindex Mailing log messages 12055@cindex Distributing log messages 12056@cindex Log messages 12057 12058@c "cvs commit" is not quite right. What we 12059@c mean is "when the repository gets changed" which 12060@c also includes "cvs import" and "cvs add" on a directory. 12061The @file{loginfo} file is used to control where 12062@samp{cvs commit} log information is sent. The first 12063entry on a line is a regular expression which is tested 12064against the directory that the change is being made to, 12065relative to the @code{$CVSROOT}. If a match is found, then 12066the remainder of the line is a filter program that 12067should expect log information on its standard input. 12068 12069If the repository name does not match any of the 12070regular expressions in this file, the @samp{DEFAULT} 12071line is used, if it is specified. 12072 12073All occurrences of the name @samp{ALL} appearing as a 12074regular expression are used in addition to the first 12075matching regular expression or @samp{DEFAULT}. 12076 12077The first matching regular expression is used. 12078 12079@xref{commit files}, for a description of the syntax of 12080the @file{loginfo} file. 12081 12082The user may specify a format string as 12083part of the filter. The string is composed of a 12084@samp{%} followed by a space, or followed by a single 12085format character, or followed by a set of format 12086characters surrounded by @samp{@{} and @samp{@}} as 12087separators. The format characters are: 12088 12089@table @t 12090@item s 12091file name 12092@item V 12093old version number (pre-checkin) 12094@item v 12095new version number (post-checkin) 12096@end table 12097 12098All other characters that appear in a format string 12099expand to an empty field (commas separating fields are 12100still provided). 12101 12102For example, some valid format strings are @samp{%}, 12103@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}. 12104 12105The output will be a string of tokens separated by 12106spaces. For backwards compatibility, the first 12107token will be the repository subdirectory. The rest of the 12108tokens will be comma-delimited lists of the information 12109requested in the format string. For example, if 12110@samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}} 12111is the format string, and three files (@t{ChangeLog}, 12112@t{Makefile}, @t{foo.c}) were modified, the output 12113might be: 12114 12115@example 12116yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13 12117@end example 12118 12119As another example, @samp{%@{@}} means that only the 12120name of the repository will be generated. 12121 12122Note: when @sc{cvs} is accessing a remote repository, 12123@file{loginfo} will be run on the @emph{remote} 12124(i.e., server) side, not the client side (@pxref{Remote 12125repositories}). 12126 12127@menu 12128* loginfo example:: Loginfo example 12129* Keeping a checked out copy:: Updating a tree on every checkin 12130@end menu 12131 12132@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12133@node loginfo example 12134@appendixsubsec Loginfo example 12135 12136The following @file{loginfo} file, together with the 12137tiny shell-script below, appends all log messages 12138to the file @file{$CVSROOT/CVSROOT/commitlog}, 12139and any commits to the administrative files (inside 12140the @file{CVSROOT} directory) are also logged in 12141@file{/usr/adm/cvsroot-log}. 12142Commits to the @file{prog1} directory are mailed to @t{ceder}. 12143 12144@c FIXME: is it a CVS feature or bug that only the 12145@c first matching line is used? It is documented 12146@c above, but is it useful? For example, if we wanted 12147@c to run both "cvs-log" and "Mail" for the CVSROOT 12148@c directory, it is kind of awkward if 12149@c only the first matching line is used. 12150@example 12151ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER 12152^CVSROOT /usr/local/bin/cvs-log /usr/adm/cvsroot-log 12153^prog1 Mail -s %s ceder 12154@end example 12155 12156The shell-script @file{/usr/local/bin/cvs-log} looks 12157like this: 12158 12159@example 12160#!/bin/sh 12161(echo "------------------------------------------------------"; 12162 echo -n $2" "; 12163 date; 12164 echo; 12165 cat) >> $1 12166@end example 12167 12168@node Keeping a checked out copy 12169@appendixsubsec Keeping a checked out copy 12170 12171@c What other index entries? It seems like 12172@c people might want to use a lot of different 12173@c words for this functionality. 12174@cindex Keeping a checked out copy 12175@cindex Checked out copy, keeping 12176@cindex Web pages, maintaining with CVS 12177 12178It is often useful to maintain a directory tree which 12179contains files which correspond to the latest version 12180in the repository. For example, other developers might 12181want to refer to the latest sources without having to 12182check them out, or you might be maintaining a web site 12183with @sc{cvs} and want every checkin to cause the files 12184used by the web server to be updated. 12185@c Can we offer more details on the web example? Or 12186@c point the user at how to figure it out? This text 12187@c strikes me as sufficient for someone who already has 12188@c some idea of what we mean but not enough for the naive 12189@c user/sysadmin to understand it and set it up. 12190 12191The way to do this is by having loginfo invoke 12192@code{cvs update}. Doing so in the naive way will 12193cause a problem with locks, so the @code{cvs update} 12194must be run in the background. 12195@c Should we try to describe the problem with locks? 12196@c It seems like a digression for someone who just 12197@c wants to know how to make it work. 12198@c Another choice which might work for a single file 12199@c is to use "cvs -n update -p" which doesn't take 12200@c out locks (I think) but I don't see many advantages 12201@c of that and we might as well document something which 12202@c works for multiple files. 12203Here is an example for unix (this should all be on one line): 12204 12205@example 12206^cyclic-pages (date; cat; (sleep 2; cd /u/www/local-docs; 12207 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1 12208@end example 12209 12210This will cause checkins to repository directories 12211starting with @code{cyclic-pages} to update the checked 12212out tree in @file{/u/www/local-docs}. 12213@c More info on some of the details? The "sleep 2" is 12214@c so if we are lucky the lock will be gone by the time 12215@c we start and we can wait 2 seconds instead of 30. 12216 12217@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12218@node rcsinfo 12219@appendixsec Rcsinfo 12220@cindex rcsinfo (admin file) 12221@cindex Form for log message 12222@cindex Log message template 12223@cindex Template for log message 12224 12225The @file{rcsinfo} file can be used to specify a form to 12226edit when filling out the commit log. The 12227@file{rcsinfo} file has a syntax similar to the 12228@file{verifymsg}, @file{commitinfo} and @file{loginfo} 12229files. @xref{syntax}. Unlike the other files the second 12230part is @emph{not} a command-line template. Instead, 12231the part after the regular expression should be a full pathname to 12232a file containing the log message template. 12233 12234If the repository name does not match any of the 12235regular expressions in this file, the @samp{DEFAULT} 12236line is used, if it is specified. 12237 12238All occurrences of the name @samp{ALL} appearing as a 12239regular expression are used in addition to the first 12240matching regular expression or @samp{DEFAULT}. 12241 12242@c FIXME: should be offering advice, somewhere around 12243@c here, about where to put the template file. The 12244@c verifymsg example uses /usr/cvssupport but doesn't 12245@c say anything about what that directory is for or 12246@c whether it is hardwired into CVS or who creates 12247@c it or anything. In particular we should say 12248@c how to version control the template file. A 12249@c probably better answer than the /usr/cvssupport 12250@c stuff is to use checkoutlist (with xref to the 12251@c checkoutlist doc). 12252@c Also I am starting to see a connection between 12253@c this and the Keeping a checked out copy node. 12254@c Probably want to say something about that. 12255The log message template will be used as a default log 12256message. If you specify a log message with @samp{cvs 12257commit -m @var{message}} or @samp{cvs commit -f 12258@var{file}} that log message will override the 12259template. 12260 12261@xref{verifymsg}, for an example @file{rcsinfo} 12262file. 12263 12264When @sc{cvs} is accessing a remote repository, 12265the contents of @file{rcsinfo} at the time a directory 12266is first checked out will specify a template which does 12267not then change. If you edit @file{rcsinfo} or its 12268templates, you may need to check out a new working 12269directory. 12270@c Would be nice to fix CVS so this isn't needed. For 12271@c example, a mechanism analogous to CVS/Entries, where 12272@c the client keeps track of what version of the template 12273@c it has. 12274 12275@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12276@node cvsignore 12277@appendixsec Ignoring files via cvsignore 12278@cindex cvsignore (admin file), global 12279@cindex Global cvsignore 12280@cindex Ignoring files 12281@c -- This chapter should maybe be moved to the 12282@c tutorial part of the manual? 12283 12284There are certain file names that frequently occur 12285inside your working copy, but that you don't want to 12286put under @sc{cvs} control. Examples are all the object 12287files that you get while you compile your sources. 12288Normally, when you run @samp{cvs update}, it prints a 12289line for each file it encounters that it doesn't know 12290about (@pxref{update output}). 12291 12292@sc{cvs} has a list of files (or sh(1) file name patterns) 12293that it should ignore while running @code{update}, 12294@code{import} and @code{release}. 12295@c -- Are those the only three commands affected? 12296This list is constructed in the following way. 12297 12298@itemize @bullet 12299@item 12300The list is initialized to include certain file name 12301patterns: names associated with @sc{cvs} 12302administration, or with other common source control 12303systems; common names for patch files, object files, 12304archive files, and editor backup files; and other names 12305that are usually artifacts of assorted utilities. 12306Currently, the default list of ignored file name 12307patterns is: 12308 12309@cindex Ignored files 12310@cindex Automatically ignored files 12311@example 12312 RCS SCCS CVS CVS.adm 12313 RCSLOG cvslog.* 12314 tags TAGS 12315 .make.state .nse_depinfo 12316 *~ #* .#* ,* _$* *$ 12317 *.old *.bak *.BAK *.orig *.rej .del-* 12318 *.a *.olb *.o *.obj *.so *.exe 12319 *.Z *.elc *.ln 12320 core 12321@end example 12322 12323@item 12324The per-repository list in 12325@file{$CVSROOT/CVSROOT/cvsignore} is appended to 12326the list, if that file exists. 12327 12328@item 12329The per-user list in @file{.cvsignore} in your home 12330directory is appended to the list, if it exists. 12331 12332@item 12333Any entries in the environment variable 12334@code{$CVSIGNORE} is appended to the list. 12335 12336@item 12337Any @samp{-I} options given to @sc{cvs} is appended. 12338 12339@item 12340As @sc{cvs} traverses through your directories, the contents 12341of any @file{.cvsignore} will be appended to the list. 12342The patterns found in @file{.cvsignore} are only valid 12343for the directory that contains them, not for 12344any sub-directories. 12345@end itemize 12346 12347In any of the 5 places listed above, a single 12348exclamation mark (@samp{!}) clears the ignore list. 12349This can be used if you want to store any file which 12350normally is ignored by @sc{cvs}. 12351 12352Specifying @samp{-I !} to @code{cvs import} will import 12353everything, which is generally what you want to do if 12354you are importing files from a pristine distribution or 12355any other source which is known to not contain any 12356extraneous files. However, looking at the rules above 12357you will see there is a fly in the ointment; if the 12358distribution contains any @file{.cvsignore} files, then 12359the patterns from those files will be processed even if 12360@samp{-I !} is specified. The only workaround is to 12361remove the @file{.cvsignore} files in order to do the 12362import. Because this is awkward, in the future 12363@samp{-I !} might be modified to override 12364@file{.cvsignore} files in each directory. 12365 12366Note that the syntax of the ignore files consists of a 12367series of lines, each of which contains a space 12368separated list of filenames. This offers no clean way 12369to specify filenames which contain spaces, but you can 12370use a workaround like @file{foo?bar} to match a file 12371named @file{foo bar} (it also matches @file{fooxbar} 12372and the like). Also note that there is currently no 12373way to specify comments. 12374@c FIXCVS? I don't _like_ this syntax at all, but 12375@c changing it raises all the usual compatibility 12376@c issues and I'm also not sure what to change it to. 12377 12378@node checkoutlist 12379@appendixsec The checkoutlist file 12380@cindex checkoutlist 12381 12382It may be helpful to use @sc{cvs} to maintain your own 12383files in the @file{CVSROOT} directory. For example, 12384suppose that you have a script @file{logcommit.pl} 12385which you run by including the following line in the 12386@file{commitinfo} administrative file: 12387 12388@example 12389ALL $CVSROOT/CVSROOT/logcommit.pl 12390@end example 12391 12392To maintain @file{logcommit.pl} with @sc{cvs} you would 12393add the following line to the @file{checkoutlist} 12394administrative file: 12395 12396@example 12397logcommit.pl 12398@end example 12399 12400The format of @file{checkoutlist} is one line for each 12401file that you want to maintain using @sc{cvs}, giving 12402the name of the file. 12403 12404After setting up @file{checkoutlist} in this fashion, 12405the files listed there will function just like 12406@sc{cvs}'s built-in administrative files. For example, 12407when checking in one of the files you should get a 12408message such as: 12409 12410@example 12411cvs commit: Rebuilding administrative file database 12412@end example 12413 12414and the checked out copy in the @file{CVSROOT} 12415directory should be updated. 12416 12417Note that listing @file{passwd} (@pxref{Password 12418authentication server}) in @file{checkoutlist} is not 12419recommended for security reasons. 12420 12421For information about keeping a checkout out copy in a 12422more general context than the one provided by 12423@file{checkoutlist}, see @ref{Keeping a checked out 12424copy}. 12425 12426@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12427@node history file 12428@appendixsec The history file 12429@cindex History file 12430@cindex Log information, saving 12431 12432The file @file{$CVSROOT/CVSROOT/history} is used 12433to log information for the @code{history} command 12434(@pxref{history}). This file must be created to turn 12435on logging. This is done automatically if the 12436@code{cvs init} command is used to set up the 12437repository (@pxref{Creating a repository}). 12438 12439The file format of the @file{history} file is 12440documented only in comments in the @sc{cvs} source 12441code, but generally programs should use the @code{cvs 12442history} command to access it anyway, in case the 12443format changes with future releases of @sc{cvs}. 12444 12445@node Variables 12446@appendixsec Expansions in administrative files 12447@cindex Internal variables 12448@cindex Variables 12449 12450Sometimes in writing an administrative file, you might 12451want the file to be able to know various things based 12452on environment @sc{cvs} is running in. There are 12453several mechanisms to do that. 12454 12455To find the home directory of the user running @sc{cvs} 12456(from the @code{HOME} environment variable), use 12457@samp{~} followed by @samp{/} or the end of the line. 12458Likewise for the home directory of @var{user}, use 12459@samp{~@var{user}}. These variables are expanded on 12460the server machine, and don't get any reasonable 12461expansion if pserver (@pxref{Password authenticated}) 12462is in use; therefore user variables (see below) may be 12463a better choice to customize behavior based on the user 12464running @sc{cvs}. 12465@c Based on these limitations, should we deprecate ~? 12466@c What is it good for? Are people using it? 12467 12468One may want to know about various pieces of 12469information internal to @sc{cvs}. A @sc{cvs} internal 12470variable has the syntax @code{$@{@var{variable}@}}, 12471where @var{variable} starts with a letter and consists 12472of alphanumeric characters and @samp{_}. If the 12473character following @var{variable} is a 12474non-alphanumeric character other than @samp{_}, the 12475@samp{@{} and @samp{@}} can be omitted. The @sc{cvs} 12476internal variables are: 12477 12478@table @code 12479@item CVSROOT 12480@cindex CVSROOT, internal variable 12481This is the value of the @sc{cvs} root in use. 12482@xref{Repository}, for a description of the various 12483ways to specify this. 12484 12485@item RCSBIN 12486@cindex RCSBIN, internal variable 12487In @sc{cvs} 1.9.18 and older, this specified the 12488directory where @sc{cvs} was looking for @sc{rcs} 12489programs. Because @sc{cvs} no longer runs @sc{rcs} 12490programs, specifying this internal variable is now an 12491error. 12492 12493@item CVSEDITOR 12494@cindex CVSEDITOR, internal variable 12495@itemx VISUAL 12496@cindex VISUAL, internal variable 12497@itemx EDITOR 12498@cindex EDITOR, internal variable 12499These all expand to the same value, which is the editor 12500that @sc{cvs} is using. @xref{Global options}, for how 12501to specify this. 12502 12503@item USER 12504@cindex USER, internal variable 12505Username of the user running @sc{cvs} (on the @sc{cvs} 12506server machine). 12507When using pserver, this is the user specified in the repository 12508specification which need not be the same as the username the 12509server is running as (@pxref{Password authentication server}). 12510@end table 12511 12512If you want to pass a value to the administrative files 12513which the user who is running @sc{cvs} can specify, 12514use a user variable. 12515@cindex User variables 12516To expand a user variable, the 12517administrative file contains 12518@code{$@{=@var{variable}@}}. To set a user variable, 12519specify the global option @samp{-s} to @sc{cvs}, with 12520argument @code{@var{variable}=@var{value}}. It may be 12521particularly useful to specify this option via 12522@file{.cvsrc} (@pxref{~/.cvsrc}). 12523 12524For example, if you want the administrative file to 12525refer to a test directory you might create a user 12526variable @code{TESTDIR}. Then if @sc{cvs} is invoked 12527as 12528 12529@example 12530cvs -s TESTDIR=/work/local/tests 12531@end example 12532 12533@noindent 12534and the 12535administrative file contains @code{sh 12536$@{=TESTDIR@}/runtests}, then that string is expanded 12537to @code{sh /work/local/tests/runtests}. 12538 12539All other strings containing @samp{$} are reserved; 12540there is no way to quote a @samp{$} character so that 12541@samp{$} represents itself. 12542 12543@node config 12544@appendixsec The CVSROOT/config configuration file 12545 12546@cindex config, in CVSROOT 12547@cindex CVSROOT/config 12548 12549The administrative file @file{config} contains various 12550miscellaneous settings which affect the behavior of 12551@sc{cvs}. The syntax is slightly different from the 12552other administrative files. Variables are not 12553expanded. Lines which start with @samp{#} are 12554considered comments. 12555@c FIXME: where do we define comments for the other 12556@c administrative files. 12557Other lines consist of a keyword, @samp{=}, and a 12558value. Note that this syntax is very strict. 12559Extraneous spaces or tabs are not permitted. 12560@c See comments in parseinfo.c:parse_config for more 12561@c discussion of this strictness. 12562 12563Currently defined keywords are: 12564 12565@table @code 12566@cindex RCSBIN, in CVSROOT/config 12567@item RCSBIN=@var{bindir} 12568For @sc{cvs} 1.9.12 through 1.9.18, this setting told 12569@sc{cvs} to look for @sc{rcs} programs in the 12570@var{bindir} directory. Current versions of @sc{cvs} 12571do not run @sc{rcs} programs; for compatibility this 12572setting is accepted, but it does nothing. 12573 12574@cindex SystemAuth, in CVSROOT/config 12575@item SystemAuth=@var{value} 12576If @var{value} is @samp{yes}, then pserver should check 12577for users in the system's user database if not found in 12578@file{CVSROOT/passwd}. If it is @samp{no}, then all 12579pserver users must exist in @file{CVSROOT/passwd}. 12580The default is @samp{yes}. For more on pserver, see 12581@ref{Password authenticated}. 12582 12583@ignore 12584@cindex PreservePermissions, in CVSROOT/config 12585@item PreservePermissions=@var{value} 12586Enable support for saving special device files, 12587symbolic links, file permissions and ownerships in the 12588repository. The default value is @samp{no}. 12589@xref{Special Files}, for the full implications of using 12590this keyword. 12591@end ignore 12592 12593@cindex TopLevelAdmin, in CVSROOT/config 12594@item TopLevelAdmin=@var{value} 12595Modify the @samp{checkout} command to create a 12596@samp{CVS} directory at the top level of the new 12597working directory, in addition to @samp{CVS} 12598directories created within checked-out directories. 12599The default value is @samp{no}. 12600 12601This option is useful if you find yourself performing 12602many commands at the top level of your working 12603directory, rather than in one of the checked out 12604subdirectories. The @file{CVS} directory created there 12605will mean you don't have to specify @code{CVSROOT} for 12606each command. It also provides a place for the 12607@file{CVS/Template} file (@pxref{Working directory 12608storage}). 12609 12610@cindex LockDir, in CVSROOT/config 12611@item LockDir=@var{directory} 12612Put CVS lock files in @var{directory} rather than 12613directly in the repository. This is useful if you want 12614to let users read from the repository while giving them 12615write access only to @var{directory}, not to the 12616repository. You need to create @var{directory}, but 12617CVS will create subdirectories of @var{directory} as it 12618needs them. For information on CVS locks, see 12619@ref{Concurrency}. 12620 12621@c Mention this in Compatibility section? 12622Before enabling the LockDir option, make sure that you 12623have tracked down and removed any copies of CVS 1.9 or 12624older. Such versions neither support LockDir, nor will 12625give an error indicating that they don't support it. 12626The result, if this is allowed to happen, is that some 12627CVS users will put the locks one place, and others will 12628put them another place, and therefore the repository 12629could become corrupted. CVS 1.10 does not support 12630LockDir but it will print a warning if run on a 12631repository with LockDir enabled. 12632 12633@cindex LogHistory, in CVSROOT/config 12634@item LogHistory=@var{value} 12635Control what is logged to the @file{CVSROOT/history} file. 12636Default of @samp{TOFEWGCMAR} (or simply @samp{all}) will log 12637all transactions. Any subset of the default is 12638legal. (For example, to only log transactions that modify the 12639@file{*,v} files, use @samp{LogHistory=TMAR}.) 12640@end table 12641 12642@c --------------------------------------------------------------------- 12643@node Environment variables 12644@appendix All environment variables which affect CVS 12645@cindex Environment variables 12646@cindex Reference manual for variables 12647 12648This is a complete list of all environment variables 12649that affect @sc{cvs}. 12650 12651@table @code 12652@cindex CVSIGNORE, environment variable 12653@item $CVSIGNORE 12654A whitespace-separated list of file name patterns that 12655@sc{cvs} should ignore. @xref{cvsignore}. 12656 12657@cindex CVSWRAPPERS, environment variable 12658@item $CVSWRAPPERS 12659A whitespace-separated list of file name patterns that 12660@sc{cvs} should treat as wrappers. @xref{Wrappers}. 12661 12662@cindex CVSREAD, environment variable 12663@cindex Read-only files, and CVSREAD 12664@item $CVSREAD 12665If this is set, @code{checkout} and @code{update} will 12666try hard to make the files in your working directory 12667read-only. When this is not set, the default behavior 12668is to permit modification of your working files. 12669 12670@item $CVSUMASK 12671Controls permissions of files in the repository. See 12672@ref{File permissions}. 12673 12674@item $CVSROOT 12675Should contain the full pathname to the root of the @sc{cvs} 12676source repository (where the @sc{rcs} files are 12677kept). This information must be available to @sc{cvs} for 12678most commands to execute; if @code{$CVSROOT} is not set, 12679or if you wish to override it for one invocation, you 12680can supply it on the command line: @samp{cvs -d cvsroot 12681cvs_command@dots{}} Once you have checked out a working 12682directory, @sc{cvs} stores the appropriate root (in 12683the file @file{CVS/Root}), so normally you only need to 12684worry about this when initially checking out a working 12685directory. 12686 12687@item $EDITOR 12688@itemx $CVSEDITOR 12689@itemx $VISUAL 12690Specifies the program to use for recording log messages 12691during commit. @code{$CVSEDITOR} overrides 12692@code{$EDITOR}. See @ref{Committing your changes}. 12693 12694@cindex PATH, environment variable 12695@item $PATH 12696If @code{$RCSBIN} is not set, and no path is compiled 12697into @sc{cvs}, it will use @code{$PATH} to try to find all 12698programs it uses. 12699 12700@cindex HOME, environment variable 12701@item $HOME 12702@cindex HOMEPATH, environment variable 12703@item $HOMEPATH 12704@cindex HOMEDRIVE, environment variable 12705@item $HOMEDRIVE 12706Used to locate the directory where the @file{.cvsrc} 12707file, and other such files, are searched. On Unix, CVS 12708just checks for @code{HOME}. On Windows NT, the system will 12709set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH}, 12710for example to @file{\joe}. On Windows 95, you'll 12711probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself. 12712@c We are being vague about whether HOME works on 12713@c Windows; see long comment in windows-NT/filesubr.c. 12714 12715@cindex CVS_RSH, environment variable 12716@item $CVS_RSH 12717Specifies the external program which CVS connects with, 12718when @code{:ext:} access method is specified. 12719@pxref{Connecting via rsh}. 12720 12721@item $CVS_SERVER 12722Used in client-server mode when accessing a remote 12723repository using @sc{rsh}. It specifies the name of 12724the program to start on the server side when accessing 12725a remote repository using @sc{rsh}. The default value 12726is @code{cvs}. @pxref{Connecting via rsh} 12727 12728@item $CVS_PASSFILE 12729Used in client-server mode when accessing the @code{cvs 12730login server}. Default value is @file{$HOME/.cvspass}. 12731@pxref{Password authentication client} 12732 12733@item $CVS_CLIENT_PORT 12734Used in client-server mode when accessing the server 12735via Kerberos. 12736@pxref{Kerberos authenticated} 12737 12738@cindex CVS_RCMD_PORT, environment variable 12739@item $CVS_RCMD_PORT 12740Used in client-server mode. If set, specifies the port 12741number to be used when accessing the @sc{rcmd} demon on 12742the server side. (Currently not used for Unix clients). 12743 12744@cindex CVS_CLIENT_LOG, environment variable 12745@item $CVS_CLIENT_LOG 12746Used for debugging only in client-server 12747mode. If set, everything sent to the server is logged 12748into @file{@code{$CVS_CLIENT_LOG}.in} and everything 12749sent from the server is logged into 12750@file{@code{$CVS_CLIENT_LOG}.out}. 12751 12752@cindex CVS_SERVER_SLEEP, environment variable 12753@item $CVS_SERVER_SLEEP 12754Used only for debugging the server side in 12755client-server mode. If set, delays the start of the 12756server child process the specified amount of 12757seconds so that you can attach to it with a debugger. 12758 12759@cindex CVS_IGNORE_REMOTE_ROOT, environment variable 12760@item $CVS_IGNORE_REMOTE_ROOT 12761For @sc{cvs} 1.10 and older, setting this variable 12762prevents @sc{cvs} from overwriting the @file{CVS/Root} 12763file when the @samp{-d} global option is specified. 12764Later versions of @sc{cvs} do not rewrite 12765@file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no 12766effect. 12767 12768@cindex COMSPEC, environment variable 12769@item $COMSPEC 12770Used under OS/2 only. It specifies the name of the 12771command interpreter and defaults to @sc{cmd.exe}. 12772 12773@cindex TMPDIR, environment variable 12774@item $TMPDIR 12775@cindex TMP, environment variable 12776@itemx $TMP 12777@cindex TEMP, environment variable 12778@itemx $TEMP 12779@cindex Temporary files, location of 12780@c This is quite nuts. We don't talk about tempnam 12781@c or mkstemp which we sometimes use. The discussion 12782@c of "Global options" is semi-incoherent. 12783@c I'm not even sure those are the only inaccuracies. 12784@c Furthermore, the conventions are 12785@c pretty crazy and they should be simplified. 12786Directory in which temporary files are located. 12787The @sc{cvs} server uses 12788@code{TMPDIR}. @xref{Global options}, for a 12789description of how to specify this. 12790Some parts of @sc{cvs} will always use @file{/tmp} (via 12791the @code{tmpnam} function provided by the system). 12792 12793On Windows NT, @code{TMP} is used (via the @code{_tempnam} 12794function provided by the system). 12795 12796The @code{patch} program which is used by the @sc{cvs} 12797client uses @code{TMPDIR}, and if it is not set, uses 12798@file{/tmp} (at least with GNU patch 2.1). Note that 12799if your server and client are both running @sc{cvs} 128001.9.10 or later, @sc{cvs} will not invoke an external 12801@code{patch} program. 12802@end table 12803 12804@node Compatibility 12805@appendix Compatibility between CVS Versions 12806 12807@cindex CVS, versions of 12808@cindex Versions, of CVS 12809@cindex Compatibility, between CVS versions 12810@c We don't mention versions older than CVS 1.3 12811@c on the theory that it would clutter it up for the vast 12812@c majority of people, who don't have anything that old. 12813@c 12814The repository format is compatible going back to 12815@sc{cvs} 1.3. But see @ref{Watches Compatibility}, if 12816you have copies of @sc{cvs} 1.6 or older and you want 12817to use the optional developer communication features. 12818@c If you "cvs rm" and commit using 1.3, then you'll 12819@c want to run "rcs -sdead <file,v>" on each of the 12820@c files in the Attic if you then want 1.5 and 12821@c later to recognize those files as dead (I think the 12822@c symptom if this is not done is that files reappear 12823@c in joins). (Wait: the above will work but really to 12824@c be strictly correct we should suggest checking 12825@c in a new revision rather than just changing the 12826@c state of the head revision, shouldn't we?). 12827@c The old convert.sh script was for this, but it never 12828@c did get updated to reflect use of the RCS "dead" 12829@c state. 12830@c Note: this is tricky to document without confusing 12831@c people--need to carefully say what CVS version we 12832@c are talking about and keep in mind the distinction 12833@c between a 12834@c repository created with 1.3 and on which one now 12835@c uses 1.5+, and a repository on which one wants to 12836@c use both versions side by side (e.g. during a 12837@c transition period). 12838@c Wait, can't CVS just detect the case in which a file 12839@c is in the Attic but the head revision is not dead? 12840@c Not sure whether this should produce a warning or 12841@c something, and probably needs further thought, but 12842@c it would appear that the situation can be detected. 12843@c 12844@c We might want to separate out the 1.3 compatibility 12845@c section (for repository & working directory) from the 12846@c rest--that might help avoid confusing people who 12847@c are upgrading (for example) from 1.6 to 1.8. 12848@c 12849@c A minor incompatibility is if a current version of CVS 12850@c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will 12851@c see this as if there is no tag. Seems to me this is 12852@c too obscure to mention. 12853 12854The working directory format is compatible going back 12855to @sc{cvs} 1.5. It did change between @sc{cvs} 1.3 12856and @sc{cvs} 1.5. If you run @sc{cvs} 1.5 or newer on 12857a working directory checked out with @sc{cvs} 1.3, 12858@sc{cvs} will convert it, but to go back to @sc{cvs} 128591.3 you need to check out a new working directory with 12860@sc{cvs} 1.3. 12861 12862The remote protocol is interoperable going back to @sc{cvs} 1.5, but no 12863further (1.5 was the first official release with the remote protocol, 12864but some older versions might still be floating around). In many 12865cases you need to upgrade both the client and the server to take 12866advantage of new features and bugfixes, however. 12867 12868@c Perhaps should be saying something here about the 12869@c "D" lines in Entries (written by CVS 1.9; 1.8 and 12870@c older don't use them). These are supposed to be 12871@c compatible in both directions, but I'm not sure 12872@c they quite are 100%. One common gripe is if you 12873@c "rm -r" a directory and 1.9 gets confused, as it 12874@c still sees it in Entries. That one is fixed in 12875@c (say) 1.9.6. Someone else reported problems with 12876@c starting with a directory which was checked out with 12877@c an old version, and then using a new version, and 12878@c some "D" lines appeared, but not for every 12879@c directory, causing some directories to be skipped. 12880@c They weren't sure how to reproduce this, though. 12881 12882@c --------------------------------------------------------------------- 12883@node Troubleshooting 12884@appendix Troubleshooting 12885 12886If you are having trouble with @sc{cvs}, this appendix 12887may help. If there is a particular error message which 12888you are seeing, then you can look up the message 12889alphabetically. If not, you can look through the 12890section on other problems to see if your problem is 12891mentioned there. 12892 12893@menu 12894* Error messages:: Partial list of CVS errors 12895* Connection:: Trouble making a connection to a CVS server 12896* Other problems:: Problems not readily listed by error message 12897@end menu 12898 12899@ignore 12900@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12901@c @node Bad administrative files 12902@appendixsec Bad administrative files 12903 12904@c -- Give hints on how to fix them 12905@end ignore 12906 12907@node Error messages 12908@appendixsec Partial list of error messages 12909 12910Here is a partial list of error messages that you may 12911see from @sc{cvs}. It is not a complete list---@sc{cvs} 12912is capable of printing many, many error messages, often 12913with parts of them supplied by the operating system, 12914but the intention is to list the common and/or 12915potentially confusing error messages. 12916 12917The messages are alphabetical, but introductory text 12918such as @samp{cvs update: } is not considered in 12919ordering them. 12920 12921In some cases the list includes messages printed by old 12922versions of @sc{cvs} (partly because users may not be 12923sure which version of @sc{cvs} they are using at any 12924particular moment). 12925@c If we want to start retiring messages, perhaps we 12926@c should pick a cutoff version (for example, no more 12927@c messages which are specific to versions before 1.9) 12928@c and then move the old messages to an "old messages" 12929@c node rather than deleting them completely. 12930 12931@table @code 12932@c FIXME: What is the correct way to format a multiline 12933@c error message here? Maybe @table is the wrong 12934@c choice? Texinfo gurus? 12935@item cvs @var{command}: authorization failed: server @var{host} rejected access 12936This is a generic response when trying to connect to a 12937pserver server which chooses not to provide a 12938specific reason for denying authorization. Check that 12939the username and password specified are correct and 12940that the @code{CVSROOT} specified is allowed by @samp{--allow-root} 12941in @file{inetd.conf}. See @ref{Password authenticated}. 12942 12943@item @var{file}:@var{line}: Assertion '@var{text}' failed 12944The exact format of this message may vary depending on 12945your system. It indicates a bug in @sc{cvs}, which can 12946be handled as described in @ref{BUGS}. 12947 12948@item cvs @var{command}: conflict: removed @var{file} was modified by second party 12949This message indicates that you removed a file, and 12950someone else modified it. To resolve the conflict, 12951first run @samp{cvs add @var{file}}. If desired, look 12952at the other party's modification to decide whether you 12953still want to remove it. If you don't want to remove 12954it, stop here. If you do want to remove it, proceed 12955with @samp{cvs remove @var{file}} and commit your 12956removal. 12957@c Tests conflicts2-142b* in sanity.sh test for this. 12958 12959@item cannot change permissions on temporary directory 12960@example 12961Operation not permitted 12962@end example 12963This message has been happening in a non-reproducible, 12964occasional way when we run the client/server testsuite, 12965both on Red Hat Linux 3.0.3 and 4.1. We haven't been 12966able to figure out what causes it, nor is it known 12967whether it is specific to linux (or even to this 12968particular machine!). If the problem does occur on 12969other unices, @samp{Operation not permitted} would be 12970likely to read @samp{Not owner} or whatever the system 12971in question uses for the unix @code{EPERM} error. If 12972you have any information to add, please let us know as 12973described in @ref{BUGS}. If you experience this error 12974while using @sc{cvs}, retrying the operation which 12975produced it should work fine. 12976@c This has been seen in a variety of tests, including 12977@c multibranch-2, multibranch-5, and basic1-24-rm-rm, 12978@c so it doesn't seem particularly specific to any one 12979@c test. 12980 12981@item cvs [server aborted]: Cannot check out files into the repository itself 12982The obvious cause for this message (especially for 12983non-client/server @sc{cvs}) is that the @sc{cvs} root 12984is, for example, @file{/usr/local/cvsroot} and you try 12985to check out files when you are in a subdirectory, such 12986as @file{/usr/local/cvsroot/test}. However, there is a 12987more subtle cause, which is that the temporary 12988directory on the server is set to a subdirectory of the 12989root (which is also not allowed). If this is the 12990problem, set the temporary directory to somewhere else, 12991for example @file{/var/tmp}; see @code{TMPDIR} in 12992@ref{Environment variables}, for how to set the 12993temporary directory. 12994 12995@c For one example see basica-1a10 in the testsuite 12996@c For another example, "cvs co ." on NT; see comment 12997@c at windows-NT/filesubr.c (expand_wild). 12998@c For another example, "cvs co foo/bar" where foo exists. 12999@item cannot open CVS/Entries for reading: No such file or directory 13000This generally indicates a @sc{cvs} internal error, and 13001can be handled as with other @sc{cvs} bugs 13002(@pxref{BUGS}). Usually there is a workaround---the 13003exact nature of which would depend on the situation but 13004which hopefully could be figured out. 13005 13006@c This is more obscure than it might sound; it only 13007@c happens if you run "cvs init" from a directory which 13008@c contains a CVS/Root file at the start. 13009@item cvs [init aborted]: cannot open CVS/Root: No such file or directory 13010This message is harmless. Provided it is not 13011accompanied by other errors, the operation has 13012completed successfully. This message should not occur 13013with current versions of @sc{cvs}, but it is documented 13014here for the benefit of @sc{cvs} 1.9 and older. 13015 13016@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument 13017This message has been reported as intermittently 13018happening with CVS 1.9 on Solaris 2.5. The cause is 13019unknown; if you know more about what causes it, let us 13020know as described in @ref{BUGS}. 13021 13022@item cvs [@var{command} aborted]: cannot start server via rcmd 13023This, unfortunately, is a rather nonspecific error 13024message which @sc{cvs} 1.9 will print if you are 13025running the @sc{cvs} client and it is having trouble 13026connecting to the server. Current versions of @sc{cvs} 13027should print a much more specific error message. If 13028you get this message when you didn't mean to run the 13029client at all, you probably forgot to specify 13030@code{:local:}, as described in @ref{Repository}. 13031 13032@item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ 13033CVS 1.9 and older will print this message 13034when trying to check in a binary file if 13035@sc{rcs} is not correctly installed. Re-read the 13036instructions that came with your @sc{rcs} distribution 13037and the @sc{install} file in the @sc{cvs} 13038distribution. Alternately, upgrade to a current 13039version of @sc{cvs}, which checks in files itself 13040rather than via @sc{rcs}. 13041 13042@item cvs checkout: could not check out @var{file} 13043With CVS 1.9, this can mean that the @code{co} program 13044(part of @sc{rcs}) returned a failure. It should be 13045preceded by another error message, however it has been 13046observed without another error message and the cause is 13047not well-understood. With the current version of CVS, 13048which does not run @code{co}, if this message occurs 13049without another error message, it is definitely a CVS 13050bug (@pxref{BUGS}). 13051@c My current suspicion is that the RCS in the rcs (not 13052@c cvs/winnt/rcs57nt.zip) directory on the _Practical_ 13053@c CD is bad (remains to be confirmed). 13054@c There is also a report of something which looks 13055@c very similar on SGI, Irix 5.2, so I dunno. 13056 13057@item cvs [login aborted]: could not find out home directory 13058This means that you need to set the environment 13059variables that CVS uses to locate your home directory. 13060See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in 13061@ref{Environment variables}. 13062 13063@item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory 13064CVS 1.9 and older will print this message if there was 13065a problem finding the @code{rcsmerge} program. Make 13066sure that it is in your @code{PATH}, or upgrade to a 13067current version of CVS, which does not require 13068an external @code{rcsmerge} program. 13069 13070@item cvs [update aborted]: could not patch @var{file}: No such file or directory 13071This means that there was a problem finding the 13072@code{patch} program. Make sure that it is in your 13073@code{PATH}. Note that despite appearances the message 13074is @emph{not} referring to whether it can find @var{file}. 13075If both the client and the server are running a current 13076version of @sc{cvs}, then there is no need for an 13077external patch program and you should not see this 13078message. But if either client or server is running 13079@sc{cvs} 1.9, then you need @code{patch}. 13080 13081@item cvs update: could not patch @var{file}; will refetch 13082This means that for whatever reason the client was 13083unable to apply a patch that the server sent. The 13084message is nothing to be concerned about, because 13085inability to apply the patch only slows things down and 13086has no effect on what @sc{cvs} does. 13087@c xref to update output. Or File status? 13088@c Or some place else that 13089@c explains this whole "patch"/P/Needs Patch thing? 13090 13091@item dying gasps from @var{server} unexpected 13092There is a known bug in the server for @sc{cvs} 1.9.18 13093and older which can cause this. For me, this was 13094reproducible if I used the @samp{-t} global option. It 13095was fixed by Andy Piper's 14 Nov 1997 change to 13096src/filesubr.c, if anyone is curious. 13097If you see the message, 13098you probably can just retry the operation which failed, 13099or if you have discovered information concerning its 13100cause, please let us know as described in @ref{BUGS}. 13101 13102@item end of file from server (consult above messages if any) 13103The most common cause for this message is if you are 13104using an external @code{rsh} program and it exited with 13105an error. In this case the @code{rsh} program should 13106have printed a message, which will appear before the 13107above message. For more information on setting up a 13108@sc{cvs} client and server, see @ref{Remote repositories}. 13109 13110@item cvs [update aborted]: EOF in key in RCS file @var{file},v 13111@itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v 13112This means that there is a syntax error in the given 13113@sc{rcs} file. Note that this might be true even if @sc{rcs} can 13114read the file OK; @sc{cvs} does more error checking of 13115errors in the RCS file. That is why you may see this 13116message when upgrading from @sc{cvs} 1.9 to @sc{cvs} 131171.10. The likely cause for the original corruption is 13118hardware, the operating system, or the like. Of 13119course, if you find a case in which @sc{cvs} seems to 13120corrupting the file, by all means report it, 13121(@pxref{BUGS}). 13122There are quite a few variations of this error message, 13123depending on exactly where in the @sc{rcs} file @sc{cvs} 13124finds the syntax error. 13125 13126@cindex mkmodules 13127@item cvs commit: Executing 'mkmodules' 13128This means that your repository is set up for a version 13129of @sc{cvs} prior to @sc{cvs} 1.8. When using @sc{cvs} 131301.8 or later, the above message will be preceded by 13131 13132@example 13133cvs commit: Rebuilding administrative file database 13134@end example 13135 13136If you see both messages, the database is being rebuilt 13137twice, which is unnecessary but harmless. If you wish 13138to avoid the duplication, and you have no versions of 13139@sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules} 13140every place it appears in your @code{modules} 13141file. For more information on the @code{modules} file, 13142see @ref{modules}. 13143 13144@c This message comes from "co", and I believe is 13145@c possible only with older versions of CVS which call 13146@c co. The problem with being able to create the bogus 13147@c RCS file still exists, though (and I think maybe 13148@c there is a different symptom(s) now). 13149@c FIXME: Would be nice to have a more exact wording 13150@c for this message. 13151@item missing author 13152Typically this can happen if you created an RCS file 13153with your username set to empty. CVS will, bogusly, 13154create an illegal RCS file with no value for the author 13155field. The solution is to make sure your username is 13156set to a non-empty value and re-create the RCS file. 13157@c "make sure your username is set" is complicated in 13158@c and of itself, as there are the environment 13159@c variables the system login name, &c, and it depends 13160@c on the version of CVS. 13161 13162@item cvs [checkout aborted]: no such tag @var{tag} 13163This message means that @sc{cvs} isn't familiar with 13164the tag @var{tag}. Usually this means that you have 13165mistyped a tag name; however there are (relatively 13166obscure) cases in which @sc{cvs} will require you to 13167@c Search sanity.sh for "no such tag" to see some of 13168@c the relatively obscure cases. 13169try a few other @sc{cvs} commands involving that tag, 13170before you find one which will cause @sc{cvs} to update 13171the @file{val-tags} file; see discussion of val-tags in 13172@ref{File permissions}. You only need to worry about 13173this once for a given tag; when a tag is listed in 13174@file{val-tags}, it stays there. Note that using 13175@samp{-f} to not require tag matches does not override 13176this check; see @ref{Common options}. 13177 13178@item *PANIC* administration files missing 13179This typically means that there is a directory named 13180CVS but it does not contain the administrative files 13181which CVS puts in a CVS directory. If the problem is 13182that you created a CVS directory via some mechanism 13183other than CVS, then the answer is simple, use a name 13184other than CVS. If not, it indicates a CVS bug 13185(@pxref{BUGS}). 13186 13187@item rcs error: Unknown option: -x,v/ 13188This message will be followed by a usage message for 13189@sc{rcs}. It means that you have an old version of 13190@sc{rcs} (probably supplied with your operating 13191system), as well as an old version of @sc{cvs}. 13192@sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and 13193later; current versions of @sc{cvs} do not run @sc{rcs} programs. 13194@c For more information on installing @sc{cvs}, see 13195@c (FIXME: where? it depends on whether you are 13196@c getting binaries or sources or what). 13197@c The message can also say "ci error" or something 13198@c instead of "rcs error", I suspect. 13199 13200@item cvs [server aborted]: received broken pipe signal 13201This message seems to be caused by a hard-to-track-down 13202bug in @sc{cvs} or the systems it runs on (we don't 13203know---we haven't tracked it down yet!). It seems to 13204happen only after a @sc{cvs} command has completed, and 13205you should be able to just ignore the message. 13206However, if you have discovered information concerning its 13207cause, please let us know as described in @ref{BUGS}. 13208 13209@item Too many arguments! 13210This message is typically printed by the @file{log.pl} 13211script which is in the @file{contrib} directory in the 13212@sc{cvs} source distribution. In some versions of 13213@sc{cvs}, @file{log.pl} has been part of the default 13214@sc{cvs} installation. The @file{log.pl} script gets 13215called from the @file{loginfo} administrative file. 13216Check that the arguments passed in @file{loginfo} match 13217what your version of @file{log.pl} expects. In 13218particular, the @file{log.pl} from @sc{cvs} 1.3 and 13219older expects the logfile as an argument whereas the 13220@file{log.pl} from @sc{cvs} 1.5 and newer expects the 13221logfile to be specified with a @samp{-f} option. Of 13222course, if you don't need @file{log.pl} you can just 13223comment it out of @file{loginfo}. 13224 13225@item cvs [update aborted]: unexpected EOF reading @var{file},v 13226See @samp{EOF in key in RCS file}. 13227 13228@item cvs [login aborted]: unrecognized auth response from @var{server} 13229This message typically means that the server is not set 13230up properly. For example, if @file{inetd.conf} points 13231to a nonexistent cvs executable. To debug it further, 13232find the log file which inetd writes 13233(@file{/var/log/messages} or whatever inetd uses on 13234your system). For details, see @ref{Connection}, and 13235@ref{Password authentication server}. 13236 13237@item cvs server: cannot open /root/.cvsignore: Permission denied 13238@itemx cvs [server aborted]: can't chdir(/root): Permission denied 13239See @ref{Connection}. 13240 13241@item cvs commit: Up-to-date check failed for `@var{file}' 13242This means that someone else has committed a change to 13243that file since the last time that you did a @code{cvs 13244update}. So before proceeding with your @code{cvs 13245commit} you need to @code{cvs update}. CVS will merge 13246the changes that you made and the changes that the 13247other person made. If it does not detect any conflicts 13248it will report @samp{M @var{file}} and you are ready 13249to @code{cvs commit}. If it detects conflicts it will 13250print a message saying so, will report @samp{C @var{file}}, 13251and you need to manually resolve the 13252conflict. For more details on this process see 13253@ref{Conflicts example}. 13254 13255@item Usage: diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3 13256@example 13257Only one of [exEX3] allowed 13258@end example 13259This indicates a problem with the installation of 13260@code{diff3} and @code{rcsmerge}. Specifically 13261@code{rcsmerge} was compiled to look for GNU diff3, but 13262it is finding unix diff3 instead. The exact text of 13263the message will vary depending on the system. The 13264simplest solution is to upgrade to a current version of 13265@sc{cvs}, which does not rely on external 13266@code{rcsmerge} or @code{diff3} programs. 13267 13268@item warning: unrecognized response `@var{text}' from cvs server 13269If @var{text} contains a valid response (such as 13270@samp{ok}) followed by an extra carriage return 13271character (on many systems this will cause the second 13272part of the message to overwrite the first part), then 13273it probably means that you are using the @samp{:ext:} 13274access method with a version of rsh, such as most 13275non-unix rsh versions, which does not by default 13276provide a transparent data stream. In such cases you 13277probably want to try @samp{:server:} instead of 13278@samp{:ext:}. If @var{text} is something else, this 13279may signify a problem with your CVS server. 13280Double-check your installation against the instructions 13281for setting up the CVS server. 13282@c FIXCVS: should be printing CR as \r or \015 or some 13283@c such, probably. 13284 13285@item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory} 13286This is a normal message, not an error. See 13287@ref{Concurrency}, for more details. 13288 13289@item cvs commit: warning: editor session failed 13290@cindex Exit status, of editor 13291This means that the editor which @sc{cvs} is using exits with a nonzero 13292exit status. Some versions of vi will do this even when there was not 13293a problem editing the file. If so, point the 13294@code{CVSEDITOR} environment variable to a small script 13295such as: 13296 13297@example 13298#!/bin/sh 13299vi $* 13300exit 0 13301@end example 13302 13303@c "warning: foo was lost" and "no longer pertinent" (both normal). 13304@c Would be nice to write these up--they are 13305@c potentially confusing for the new user. 13306@end table 13307 13308@node Connection 13309@appendixsec Trouble making a connection to a CVS server 13310 13311This section concerns what to do if you are having 13312trouble making a connection to a @sc{cvs} server. If 13313you are running the @sc{cvs} command line client 13314running on Windows, first upgrade the client to 13315@sc{cvs} 1.9.12 or later. The error reporting in 13316earlier versions provided much less information about 13317what the problem was. If the client is non-Windows, 13318@sc{cvs} 1.9 should be fine. 13319 13320If the error messages are not sufficient to track down 13321the problem, the next steps depend largely on which 13322access method you are using. 13323 13324@table @code 13325@cindex :ext:, troubleshooting 13326@item :ext: 13327Try running the rsh program from the command line. For 13328example: "rsh servername cvs -v" should print @sc{cvs} 13329version information. If this doesn't work, you need to 13330fix it before you can worry about @sc{cvs} problems. 13331 13332@cindex :server:, troubleshooting 13333@item :server: 13334You don't need a command line rsh program to use this 13335access method, but if you have an rsh program around, 13336it may be useful as a debugging tool. Follow the 13337directions given for :ext:. 13338 13339@cindex :pserver:, troubleshooting 13340@item :pserver: 13341One good debugging tool is to "telnet servername 133422401". After connecting, send any text (for example 13343"foo" followed by return). If @sc{cvs} is working 13344correctly, it will respond with 13345 13346@example 13347cvs [pserver aborted]: bad auth protocol start: foo 13348@end example 13349 13350If this fails to work, then make sure inetd is working 13351right. Change the invocation in @file{inetd.conf} to run the 13352echo program instead of cvs. For example: 13353 13354@example 133552401 stream tcp nowait root /bin/echo echo hello 13356@end example 13357 13358After making that change and instructing inetd to 13359re-read its configuration file, "telnet servername 133602401" should show you the text hello and then the 13361server should close the connection. If this doesn't 13362work, you need to fix it before you can worry about 13363@sc{cvs} problems. 13364 13365On AIX systems, the system will often have its own 13366program trying to use port 2401. This is AIX's problem 13367in the sense that port 2401 is registered for use with 13368@sc{cvs}. I hear that there is an AIX patch available 13369to address this problem. 13370 13371Another good debugging tool is the @samp{-d} 13372(debugging) option to inetd. Consult your system 13373documentation for more information. 13374 13375If you seem to be connecting but get errors like: 13376 13377@example 13378cvs server: cannot open /root/.cvsignore: Permission denied 13379cvs [server aborted]: can't chdir(/root): Permission denied 13380@end example 13381 13382then either you haven't specified @samp{-f} in @file{inetd.conf} 13383or your system is setting the @code{HOME} environment variable 13384for programs being run by inetd. In the latter case, you can either 13385have inetd run a shell script that unsets @code{HOME} and then runs 13386@sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine 13387environment. 13388 13389If you can connect successfully for a while but then can't, 13390you've probably hit inetd's rate limit. 13391(If inetd receives too many requests for the same service 13392in a short period of time, it assumes that something is wrong 13393and temporarily disables the service.) 13394Check your inetd documentation to find out how to adjust the 13395rate limit (some versions of inetd have a single rate limit, 13396others allow you to set the limit for each service separately.) 13397@end table 13398 13399@node Other problems 13400@appendixsec Other common problems 13401 13402Here is a list of problems which do not fit into the 13403above categories. They are in no particular order. 13404 13405@itemize @bullet 13406@item 13407On Windows, if there is a 30 second or so delay when 13408you run a @sc{cvs} command, it may mean that you have 13409your home directory set to @file{C:/}, for example (see 13410@code{HOMEDRIVE} and @code{HOMEPATH} in 13411@ref{Environment variables}). CVS expects the home 13412directory to not end in a slash, for example @file{C:} 13413or @file{C:\cvs}. 13414@c FIXCVS: CVS should at least detect this and print an 13415@c error, presumably. 13416 13417@item 13418If you are running @sc{cvs} 1.9.18 or older, and 13419@code{cvs update} finds a conflict and tries to 13420merge, as described in @ref{Conflicts example}, but 13421doesn't tell you there were conflicts, then you may 13422have an old version of @sc{rcs}. The easiest solution 13423probably is to upgrade to a current version of 13424@sc{cvs}, which does not rely on external @sc{rcs} 13425programs. 13426@end itemize 13427 13428@c --------------------------------------------------------------------- 13429@node Credits 13430@appendix Credits 13431 13432@cindex Contributors (manual) 13433@cindex Credits (manual) 13434Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}> 13435wrote the manual pages which were distributed with 13436@sc{cvs} 1.3. Much of their text was copied into this 13437manual. He also read an early draft 13438of this manual and contributed many ideas and 13439corrections. 13440 13441The mailing-list @code{info-cvs} is sometimes 13442informative. I have included information from postings 13443made by the following persons: 13444David G. Grubbs <@t{dgg@@think.com}>. 13445 13446Some text has been extracted from the man pages for 13447@sc{rcs}. 13448 13449The @sc{cvs} @sc{faq} by David G. Grubbs has provided 13450useful material. The @sc{faq} is no longer maintained, 13451however, and this manual is about the closest thing there 13452is to a successor (with respect to documenting how to 13453use @sc{cvs}, at least). 13454 13455In addition, the following persons have helped by 13456telling me about mistakes I've made: 13457 13458@display 13459Roxanne Brunskill <@t{rbrunski@@datap.ca}>, 13460Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>, 13461Karl Pingle <@t{pingle@@acuson.com}>, 13462Thomas A Peterson <@t{tap@@src.honeywell.com}>, 13463Inge Wallin <@t{ingwa@@signum.se}>, 13464Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}> 13465and Michael Brown <@t{brown@@wi.extrel.com}>. 13466@end display 13467 13468The list of contributors here is not comprehensive; for a more 13469complete list of who has contributed to this manual see 13470the file @file{doc/ChangeLog} in the @sc{cvs} source 13471distribution. 13472 13473@c --------------------------------------------------------------------- 13474@node BUGS 13475@appendix Dealing with bugs in CVS or this manual 13476 13477@cindex Bugs in this manual or CVS 13478Neither @sc{cvs} nor this manual is perfect, and they 13479probably never will be. If you are having trouble 13480using @sc{cvs}, or think you have found a bug, there 13481are a number of things you can do about it. Note that 13482if the manual is unclear, that can be considered a bug 13483in the manual, so these problems are often worth doing 13484something about as well as problems with @sc{cvs} itself. 13485 13486@cindex Reporting bugs 13487@cindex Bugs, reporting 13488@cindex Errors, reporting 13489@itemize @bullet 13490@item 13491If you want someone to help you and fix bugs that you 13492report, there are companies which will do that for a 13493fee. Two such companies are: 13494 13495@cindex Signum Support 13496@cindex Support, getting CVS support 13497@example 13498Signum Support AB 13499Box 2044 13500S-580 02 Linkoping 13501Sweden 13502Email: info@@signum.se 13503Phone: +46 (0)13 - 21 46 00 13504Fax: +46 (0)13 - 21 47 00 13505http://www.signum.se/ 13506 13507@end example 13508 13509@item 13510If you got @sc{cvs} through a distributor, such as an 13511operating system vendor or a vendor of freeware 13512@sc{cd-rom}s, you may wish to see whether the 13513distributor provides support. Often, they will provide 13514no support or minimal support, but this may vary from 13515distributor to distributor. 13516 13517@item 13518If you have the skills and time to do so, you may wish 13519to fix the bug yourself. If you wish to submit your 13520fix for inclusion in future releases of @sc{cvs}, see 13521the file @sc{hacking} in the @sc{cvs} source 13522distribution. It contains much more information on the 13523process of submitting fixes. 13524 13525@item 13526There may be resources on the net which can help. Two 13527good places to start are: 13528 13529@example 13530http://www.cvshome.org 13531http://www.loria.fr/~molli/cvs-index.html 13532@end example 13533 13534If you are so inspired, increasing the information 13535available on the net is likely to be appreciated. For 13536example, before the standard @sc{cvs} distribution 13537worked on Windows 95, there was a web page with some 13538explanation and patches for running @sc{cvs} on Windows 1353995, and various people helped out by mentioning this 13540page on mailing lists or newsgroups when the subject 13541came up. 13542 13543@item 13544It is also possible to report bugs to @code{bug-cvs}. 13545Note that someone may or may not want to do anything 13546with your bug report---if you need a solution consider 13547one of the options mentioned above. People probably do 13548want to hear about bugs which are particularly severe 13549in consequences and/or easy to fix, however. You can 13550also increase your odds by being as clear as possible 13551about the exact nature of the bug and any other 13552relevant information. The way to report bugs is to 13553send email to @code{bug-cvs@@gnu.org}. Note 13554that submissions to @code{bug-cvs} may be distributed 13555under the terms of the @sc{gnu} Public License, so if 13556you don't like this, don't submit them. There is 13557usually no justification for sending mail directly to 13558one of the @sc{cvs} maintainers rather than to 13559@code{bug-cvs}; those maintainers who want to hear 13560about such bug reports read @code{bug-cvs}. Also note 13561that sending a bug report to other mailing lists or 13562newsgroups is @emph{not} a substitute for sending it to 13563@code{bug-cvs}. It is fine to discuss @sc{cvs} bugs on 13564whatever forum you prefer, but there are not 13565necessarily any maintainers reading bug reports sent 13566anywhere except @code{bug-cvs}. 13567@end itemize 13568 13569@cindex Known bugs in this manual or CVS 13570People often ask if there is a list of known bugs or 13571whether a particular bug is a known one. The file 13572@sc{bugs} in the @sc{cvs} source distribution is one 13573list of known bugs, but it doesn't necessarily try to 13574be comprehensive. Perhaps there will never be a 13575comprehensive, detailed list of known bugs. 13576 13577@c --------------------------------------------------------------------- 13578@node Index 13579@unnumbered Index 13580@cindex Index 13581 13582@printindex cp 13583 13584@summarycontents 13585 13586@contents 13587 13588@bye 13589 13590Local Variables: 13591fill-column: 55 13592End: 13593