1\input texinfo @c -*-texinfo-*- 2@comment Documentation for CVS. 3@setfilename cvs.info 4@macro copyleftnotice 5@noindent 6Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 7 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 8 Free Software Foundation, Inc. 9 10@multitable @columnfractions .12 .88 11@item Portions 12@item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 13 2006, 2007 Derek R. Price, 14@item @tab Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007 15 Ximbiot @url{http://ximbiot.com}, 16@item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB, 17@item @tab and Copyright @copyright{} others. 18@end multitable 19 20@ignore 21Permission is granted to process this file through Tex and print the 22results, provided the printed document carries copying permission 23notice identical to this one except for the removal of this paragraph 24(this paragraph not being relevant to the printed manual). 25 26@end ignore 27Permission is granted to make and distribute verbatim copies of 28this manual provided the copyright notice and this permission notice 29are preserved on all copies. 30 31Permission is granted to copy and distribute modified versions of this 32manual under the conditions for verbatim copying, provided also that the 33entire resulting derived work is distributed under the terms of a 34permission notice identical to this one. 35 36Permission is granted to copy and distribute translations of this manual 37into another language, under the above conditions for modified versions, 38except that this permission notice may be stated in a translation 39approved by the Free Software Foundation. 40@end macro 41 42@comment This file is part of the CVS distribution. 43 44@comment CVS is free software; you can redistribute it and/or modify 45@comment it under the terms of the GNU General Public License as published by 46@comment the Free Software Foundation; either version 2, or (at your option) 47@comment any later version. 48 49@comment CVS is distributed in the hope that it will be useful, 50@comment but WITHOUT ANY WARRANTY; without even the implied warranty of 51@comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 52@comment GNU General Public License for more details. 53 54@c See ../README for A4 vs. US letter size. 55@c When we provided A4 postscript, and people tried to 56@c print it on US letter, the usual complaint was that the 57@c page numbers would get cut off. 58@c If one prints US letter on A4, reportedly there is 59@c some extra space at the top and/or bottom, and the side 60@c margins are a bit narrow, but no text is lost. 61@c 62@c See 63@c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html 64@c for more on paper sizes. Insuring that margins are 65@c big enough to print on either A4 or US letter does 66@c indeed seem to be the usual approach (RFC2346). 67 68@c This document seems to get overfull hboxes with some 69@c frequency (probably because the tendency is to 70@c sanity-check it with "make info" and run TeX less 71@c often). The big ugly boxes just seem to add insult 72@c to injury, and I'm not aware of them helping to fix 73@c the overfull hboxes at all. 74@finalout 75 76@include version.texi 77@settitle CVS---Concurrent Versions System v@value{VERSION} 78@setchapternewpage odd 79 80@c -- TODO list: 81@c -- Fix all lines that match "^@c -- " 82@c -- Also places marked with FIXME should be manual 83@c problems (as opposed to FIXCVS for CVS problems). 84 85@c @splitrcskeyword{} is used to avoid keyword expansion. It is replaced by 86@c @asis when generating info and dvi, and by <i></i> in the generated html, 87@c such that keywords are not expanded in the generated html. 88@ifnothtml 89@macro splitrcskeyword {arg} 90@asis{}\arg\ 91@end macro 92@end ifnothtml 93 94@ifhtml 95@macro splitrcskeyword {arg} 96@i{}\arg\ 97@end macro 98@end ifhtml 99 100@dircategory GNU Packages 101@direntry 102* CVS: (cvs). Concurrent Versions System 103@end direntry 104@dircategory Individual utilities 105@direntry 106* cvs: (cvs)CVS commands. Concurrent Versions System 107@end direntry 108 109@comment The titlepage section does not appear in the Info file. 110@titlepage 111@sp 4 112@comment The title is printed in a large font. 113@center @titlefont{Version Management} 114@sp 115@center @titlefont{with} 116@sp 117@center @titlefont{CVS} 118@sp 2 119@center for @sc{cvs} @value{VERSION} 120@comment -release- 121@sp 3 122@center Per Cederqvist et al 123 124@comment The following two commands start the copyright page 125@comment for the printed manual. This will not appear in the Info file. 126@page 127@vskip 0pt plus 1filll 128@copyleftnotice 129@end titlepage 130 131@summarycontents 132 133@contents 134 135@comment ================================================================ 136@comment The real text starts here 137@comment ================================================================ 138 139@ifnottex 140@c --------------------------------------------------------------------- 141@node Top 142@top 143 144This info manual describes how to use and administer 145@sc{cvs} version @value{VERSION}. 146@end ifnottex 147 148@ifinfo 149@copyleftnotice 150@end ifinfo 151 152@c This menu is pretty long. Not sure how easily that 153@c can be fixed (no brilliant ideas right away)... 154@menu 155* Overview:: An introduction to CVS 156* Repository:: Where all your sources are stored 157* Starting a new project:: Starting a project with CVS 158* Revisions:: Numeric and symbolic names for revisions 159* Branching and merging:: Diverging/rejoining branches of development 160* Recursive behavior:: CVS descends directories 161* Adding and removing:: Adding/removing/renaming files/directories 162* History browsing:: Viewing the history of files in various ways 163 164CVS and the Real World. 165----------------------- 166* Binary files:: CVS can handle binary files 167* Multiple developers:: How CVS helps a group of developers 168* Revision management:: Policy questions for revision management 169* Keyword substitution:: CVS can include the revision inside the file 170* Tracking sources:: Tracking third-party sources 171* Builds:: Issues related to CVS and builds 172* Special Files:: Devices, links and other non-regular files 173 174References. 175----------- 176* CVS commands:: CVS commands share some things 177* Invoking CVS:: Quick reference to CVS commands 178* Administrative files:: Reference manual for the Administrative files 179* Environment variables:: All environment variables which affect CVS 180* Compatibility:: Upgrading CVS versions 181* Troubleshooting:: Some tips when nothing works 182* Credits:: Some of the contributors to this manual 183* BUGS:: Dealing with bugs in CVS or this manual 184* Index:: Index 185@end menu 186 187@c --------------------------------------------------------------------- 188@node Overview 189@chapter Overview 190@cindex Overview 191 192This chapter is for people who have never used 193@sc{cvs}, and perhaps have never used version control 194software before. 195 196If you are already familiar with @sc{cvs} and are just 197trying to learn a particular feature or remember a 198certain command, you can probably skip everything here. 199 200@menu 201* What is CVS?:: What you can do with @sc{cvs} 202* What is CVS not?:: Problems @sc{cvs} doesn't try to solve 203* A sample session:: A tour of basic @sc{cvs} usage 204@end menu 205 206@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 207@node What is CVS? 208@section What is CVS? 209@cindex What is CVS? 210@cindex Introduction to CVS 211@cindex CVS, introduction to 212 213@sc{cvs} is a version control system. Using it, you can 214record the history of your source files. 215 216@c -- /// 217@c -- ///Those who cannot remember the past are condemned to repeat it. 218@c -- /// -- George Santayana 219@c -- ////// 220 221@c -- Insert history quote here! 222For example, bugs sometimes creep in when 223software is modified, and you might not detect the bug 224until a long time after you make the modification. 225With @sc{cvs}, you can easily retrieve old versions to see 226exactly which change caused the bug. This can 227sometimes be a big help. 228 229You could of course save every version of every file 230you have ever created. This would 231however waste an enormous amount of disk space. @sc{cvs} 232stores all the versions of a file in a single file in a 233clever way that only stores the differences between 234versions. 235 236@sc{cvs} also helps you if you are part of a group of people working 237on the same project. It is all too easy to overwrite 238each others' changes unless you are extremely careful. 239Some editors, like @sc{gnu} Emacs, try to make sure that 240two people never modify the same file at the 241same time. Unfortunately, if someone is using another 242editor, that safeguard will not work. @sc{cvs} solves this problem 243by insulating the different developers from each other. Every 244developer works in his own directory, and @sc{cvs} merges 245the work when each developer is done. 246 247@cindex History of CVS 248@cindex CVS, history of 249@cindex Credits (CVS program) 250@cindex Contributors (CVS program) 251@sc{cvs} started out as a bunch of shell scripts written by 252Dick Grune, posted to the newsgroup 253@code{comp.sources.unix} in the volume 6 254release of July, 1986. While no actual code from 255these shell scripts is present in the current version 256of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms 257come from them. 258 259In April, 1989, Brian Berliner designed and coded @sc{cvs}. 260Jeff Polk later helped Brian with the design of the @sc{cvs} 261module and vendor branch support. 262 263@cindex Source, getting CVS source 264You can get @sc{cvs} in a variety of ways, including 265free download from the Internet. For more information 266on downloading @sc{cvs} and other @sc{cvs} topics, see: 267 268@example 269@url{http://cvs.nongnu.org/} 270@end example 271 272@cindex Mailing list 273@cindex List, mailing list 274@cindex Newsgroups 275There is a mailing list, known as @email{info-cvs@@nongnu.org}, 276devoted to @sc{cvs}. To subscribe or 277unsubscribe 278write to 279@email{info-cvs-request@@nongnu.org}. 280If you prefer a Usenet group, there is a one-way mirror (posts to the email 281list are usually sent to the news group, but not vice versa) of 282@email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}. The right 283Usenet group for posts is @url{news:comp.software.config-mgmt} which is for 284@sc{cvs} discussions (along with other configuration 285management systems). In the future, it might be 286possible to create a 287@code{comp.software.config-mgmt.cvs}, but probably only 288if there is sufficient @sc{cvs} traffic on 289@url{news:comp.software.config-mgmt}. 290@c Other random data is that the tale was very 291@c skeptical of comp.software.config-mgmt.cvs when the 292@c subject came up around 1995 or so (for one 293@c thing, because creating it would be a "reorg" which 294@c would need to take a more comprehensive look at the 295@c whole comp.software.config-mgmt.* hierarchy). 296 297You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list, 298described in more detail in @ref{BUGS}. To subscribe 299send mail to @email{bug-cvs-request@@nongnu.org}. There is a two-way 300Usenet mirror (posts to the Usenet group are usually sent to the email list and 301vice versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}. 302 303@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 304@node What is CVS not? 305@section What is CVS not? 306@cindex What is CVS not? 307 308@sc{cvs} can do a lot of things for you, but it does 309not try to be everything for everyone. 310 311@table @asis 312@item @sc{cvs} is not a build system. 313 314Though the structure of your repository and modules 315file interact with your build system 316(e.g. @file{Makefile}s), they are essentially 317independent. 318 319@sc{cvs} does not dictate how you build anything. It 320merely stores files for retrieval in a tree structure 321you devise. 322 323@sc{cvs} does not dictate how to use disk space in the 324checked out working directories. If you write your 325@file{Makefile}s or scripts in every directory so they 326have to know the relative positions of everything else, 327you wind up requiring the entire repository to be 328checked out. 329 330If you modularize your work, and construct a build 331system that will share files (via links, mounts, 332@code{VPATH} in @file{Makefile}s, etc.), you can 333arrange your disk usage however you like. 334 335But you have to remember that @emph{any} such system is 336a lot of work to construct and maintain. @sc{cvs} does 337not address the issues involved. 338 339Of course, you should place the tools created to 340support such a build system (scripts, @file{Makefile}s, 341etc.) under @sc{cvs}. 342 343Figuring out what files need to be rebuilt when 344something changes is, again, something to be handled 345outside the scope of @sc{cvs}. One traditional 346approach is to use @code{make} for building, and use 347some automated tool for generating the dependencies which 348@code{make} uses. 349 350See @ref{Builds}, for more information on doing builds 351in conjunction with @sc{cvs}. 352 353@item @sc{cvs} is not a substitute for management. 354 355Your managers and project leaders are expected to talk 356to you frequently enough to make certain you are aware 357of schedules, merge points, branch names and release 358dates. If they don't, @sc{cvs} can't help. 359 360@sc{cvs} is an instrument for making sources dance to 361your tune. But you are the piper and the composer. No 362instrument plays itself or writes its own music. 363 364@item @sc{cvs} is not a substitute for developer communication. 365 366When faced with conflicts within a single file, most 367developers manage to resolve them without too much 368effort. But a more general definition of ``conflict'' 369includes problems too difficult to solve without 370communication between developers. 371 372@sc{cvs} cannot determine when simultaneous changes 373within a single file, or across a whole collection of 374files, will logically conflict with one another. Its 375concept of a @dfn{conflict} is purely textual, arising 376when two changes to the same base file are near enough 377to spook the merge (i.e., @code{diff3}) command. 378 379@sc{cvs} does not claim to help at all in figuring out 380non-textual or distributed conflicts in program logic. 381 382For example: Say you change the arguments to function 383@code{X} defined in file @file{A}. At the same time, 384someone edits file @file{B}, adding new calls to 385function @code{X} using the old arguments. You are 386outside the realm of @sc{cvs}'s competence. 387 388Acquire the habit of reading specs and talking to your 389peers. 390 391 392@item @sc{cvs} does not have change control 393 394Change control refers to a number of things. First of 395all it can mean @dfn{bug-tracking}, that is being able 396to keep a database of reported bugs and the status of 397each one (Is it fixed? In what release? Has the bug 398submitter agreed that it is fixed?). For interfacing 399@sc{cvs} to an external bug-tracking system, see the 400@file{rcsinfo} and @file{verifymsg} files 401(@pxref{Administrative files}). 402 403Another aspect of change control is keeping track of 404the fact that changes to several files were in fact 405changed together as one logical change. If you check 406in several files in a single @code{cvs commit} 407operation, @sc{cvs} then forgets that those files were 408checked in together, and the fact that they have the 409same log message is the only thing tying them 410together. Keeping a @sc{gnu} style @file{ChangeLog} 411can help somewhat. 412@c FIXME: should have an xref to a section which talks 413@c more about keeping ChangeLog's with CVS, but that 414@c section hasn't been written yet. 415 416Another aspect of change control, in some systems, is 417the ability to keep track of the status of each 418change. Some changes have been written by a developer, 419others have been reviewed by a second developer, and so 420on. Generally, the way to do this with @sc{cvs} is to 421generate a diff (using @code{cvs diff} or @code{diff}) 422and email it to someone who can then apply it using the 423@code{patch} utility. This is very flexible, but 424depends on mechanisms outside @sc{cvs} to make sure 425nothing falls through the cracks. 426 427@item @sc{cvs} is not an automated testing program 428 429It should be possible to enforce mandatory use of a 430test suite using the @code{commitinfo} file. I haven't 431heard a lot about projects trying to do that or whether 432there are subtle gotchas, however. 433 434@item @sc{cvs} does not have a built-in process model 435 436Some systems provide ways to ensure that changes or 437releases go through various steps, with various 438approvals as needed. Generally, one can accomplish 439this with @sc{cvs} but it might be a little more work. 440In some cases you'll want to use the @file{commitinfo}, 441@file{loginfo}, @file{rcsinfo}, or @file{verifymsg} 442files, to require that certain steps be performed 443before cvs will allow a checkin. Also consider whether 444features such as branches and tags can be used to 445perform tasks such as doing work in a development tree 446and then merging certain changes over to a stable tree 447only once they have been proven. 448@end table 449 450@c --------------------------------------------------------------------- 451@node A sample session 452@section A sample session 453@cindex Example of a work-session 454@cindex Getting started 455@cindex Work-session, example of 456@cindex tc, Trivial Compiler (example) 457@cindex Trivial Compiler (example) 458 459@c I think an example is a pretty good way to start. But 460@c somewhere in here, maybe after the sample session, 461@c we need something which is kind of 462@c a "roadmap" which is more directed at sketching out 463@c the functionality of CVS and pointing people to 464@c various other parts of the manual. As it stands now 465@c people who read in order get dumped right into all 466@c manner of hair regarding remote repositories, 467@c creating a repository, etc. 468@c 469@c The following was in the old Basic concepts node. I don't 470@c know how good a job it does at introducing modules, 471@c or whether they need to be introduced so soon, but 472@c something of this sort might go into some 473@c introductory material somewhere. 474@ignore 475@cindex Modules (intro) 476The repository contains directories and files, in an 477arbitrary tree. The @dfn{modules} feature can be used 478to group together a set of directories or files into a 479single entity (@pxref{modules}). A typical usage is to 480define one module per project. 481@end ignore 482 483As a way of introducing @sc{cvs}, we'll go through a 484typical work-session using @sc{cvs}. The first thing 485to understand is that @sc{cvs} stores all files in a 486centralized @dfn{repository} (@pxref{Repository}); this 487section assumes that a repository is set up. 488@c I'm not sure that the sentence concerning the 489@c repository quite tells the user what they need to 490@c know at this point. Might need to expand on "centralized" 491@c slightly (maybe not here, maybe further down in the example?) 492 493Suppose you are working on a simple compiler. The source 494consists of a handful of C files and a @file{Makefile}. 495The compiler is called @samp{tc} (Trivial Compiler), 496and the repository is set up so that there is a module 497called @samp{tc}. 498 499@menu 500* Getting the source:: Creating a workspace 501* Committing your changes:: Making your work available to others 502* Cleaning up:: Cleaning up 503* Viewing differences:: Viewing differences 504@end menu 505 506@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 507@node Getting the source 508@subsection Getting the source 509@cindex Getting the source 510@cindex Checking out source 511@cindex Fetching source 512@cindex Source, getting from CVS 513@cindex Checkout, example 514 515The first thing you must do is to get your own working copy of the 516source for @samp{tc}. For this, you use the @code{checkout} command: 517 518@example 519$ cvs checkout tc 520@end example 521 522@noindent 523This will create a new directory called @file{tc} and populate it with 524the source files. 525 526@example 527$ cd tc 528$ ls 529CVS Makefile backend.c driver.c frontend.c parser.c 530@end example 531 532The @file{CVS} directory is used internally by 533@sc{cvs}. Normally, you should not modify or remove 534any of the files in it. 535 536You start your favorite editor, hack away at @file{backend.c}, and a couple 537of hours later you have added an optimization pass to the compiler. 538A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that 539you want to edit. @xref{Multiple developers}, for an explanation. 540 541@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 542@node Committing your changes 543@subsection Committing your changes 544@cindex Committing changes to files 545@cindex Log message entry 546 547When you have checked that the compiler is still compilable you decide 548to make a new version of @file{backend.c}. This will 549store your new @file{backend.c} in the repository and 550make it available to anyone else who is using that same 551repository. 552 553@example 554$ cvs commit backend.c 555@end example 556 557@noindent 558@sc{cvs} starts an editor, to allow you to enter a log 559message. You type in ``Added an optimization pass.'', 560save the temporary file, and exit the editor. 561 562@cindex CVSEDITOR, environment variable 563@cindex EDITOR, environment variable 564The environment variable @code{$CVSEDITOR} determines 565which editor is started. If @code{$CVSEDITOR} is not 566set, then if the environment variable @code{$EDITOR} is 567set, it will be used. If both @code{$CVSEDITOR} and 568@code{$EDITOR} are not set then there is a default 569which will vary with your operating system, for example 570@code{vi} for unix or @code{notepad} for Windows 571NT/95. 572 573@cindex VISUAL, environment variable 574In addition, @sc{cvs} checks the @code{$VISUAL} environment 575variable. Opinions vary on whether this behavior is desirable and 576whether future releases of @sc{cvs} should check @code{$VISUAL} or 577ignore it. You will be OK either way if you make sure that 578@code{$VISUAL} is either unset or set to the same thing as 579@code{$EDITOR}. 580 581@c This probably should go into some new node 582@c containing detailed info on the editor, rather than 583@c the intro. In fact, perhaps some of the stuff with 584@c CVSEDITOR and -m and so on should too. 585When @sc{cvs} starts the editor, it includes a list of 586files which are modified. For the @sc{cvs} client, 587this list is based on comparing the modification time 588of the file against the modification time that the file 589had when it was last gotten or updated. Therefore, if 590a file's modification time has changed but its contents 591have not, it will show up as modified. The simplest 592way to handle this is simply not to worry about it---if 593you proceed with the commit @sc{cvs} will detect that 594the contents are not modified and treat it as an 595unmodified file. The next @code{update} will clue 596@sc{cvs} in to the fact that the file is unmodified, 597and it will reset its stored timestamp so that the file 598will not show up in future editor sessions. 599@c FIXCVS: Might be nice if "commit" and other commands 600@c would reset that timestamp too, but currently commit 601@c doesn't. 602@c FIXME: Need to talk more about the process of 603@c prompting for the log message. Like show an example 604@c of what it pops up in the editor, for example. Also 605@c a discussion of how to get the "a)bort, c)ontinue, 606@c e)dit" prompt and what to do with it. Might also 607@c work in the suggestion that if you want a diff, you 608@c should make it before running commit (someone 609@c suggested that the diff pop up in the editor. I'm 610@c not sure that is better than telling people to run 611@c "cvs diff" first if that is what they want, but if 612@c we want to tell people that, the manual possibly 613@c should say it). 614 615If you want to avoid 616starting an editor you can specify the log message on 617the command line using the @samp{-m} flag instead, like 618this: 619 620@example 621$ cvs commit -m "Added an optimization pass" backend.c 622@end example 623 624@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 625@node Cleaning up 626@subsection Cleaning up 627@cindex Cleaning up 628@cindex Working copy, removing 629@cindex Removing your working copy 630@cindex Releasing your working copy 631 632Before you turn to other tasks you decide to remove your working copy of 633tc. One acceptable way to do that is of course 634 635@example 636$ cd .. 637$ rm -r tc 638@end example 639 640@noindent 641but a better way is to use the @code{release} command (@pxref{release}): 642 643@example 644$ cd .. 645$ cvs release -d tc 646M driver.c 647? tc 648You have [1] altered files in this repository. 649Are you sure you want to release (and delete) directory `tc': n 650** `release' aborted by user choice. 651@end example 652 653The @code{release} command checks that all your modifications have been 654committed. If history logging is enabled it also makes a note in the 655history file. @xref{history file}. 656 657When you use the @samp{-d} flag with @code{release}, it 658also removes your working copy. 659 660In the example above, the @code{release} command wrote a couple of lines 661of output. @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}. 662That is nothing to worry about: @file{tc} is the executable compiler, 663and it should not be stored in the repository. @xref{cvsignore}, 664for information about how to make that warning go away. 665@xref{release output}, for a complete explanation of 666all possible output from @code{release}. 667 668@samp{M driver.c} is more serious. It means that the 669file @file{driver.c} has been modified since it was 670checked out. 671 672The @code{release} command always finishes by telling 673you how many modified files you have in your working 674copy of the sources, and then asks you for confirmation 675before deleting any files or making any note in the 676history file. 677 678You decide to play it safe and answer @kbd{n @key{RET}} 679when @code{release} asks for confirmation. 680 681@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 682@node Viewing differences 683@subsection Viewing differences 684@cindex Viewing differences 685@cindex Diff 686 687You do not remember modifying @file{driver.c}, so you want to see what 688has happened to that file. 689 690@example 691$ cd tc 692$ cvs diff driver.c 693@end example 694 695This command runs @code{diff} to compare the version of @file{driver.c} 696that you checked out with your working copy. When you see the output 697you remember that you added a command line option that enabled the 698optimization pass. You check it in, and release the module. 699@c FIXME: we haven't yet defined the term "check in". 700 701@example 702$ cvs commit -m "Added an optimization pass" driver.c 703Checking in driver.c; 704/usr/local/cvsroot/tc/driver.c,v <-- driver.c 705new revision: 1.2; previous revision: 1.1 706done 707$ cd .. 708$ cvs release -d tc 709? tc 710You have [0] altered files in this repository. 711Are you sure you want to release (and delete) directory `tc': y 712@end example 713 714@c --------------------------------------------------------------------- 715@node Repository 716@chapter The Repository 717@cindex Repository (intro) 718@cindex Repository, example 719@cindex Layout of repository 720@cindex Typical repository 721@cindex /usr/local/cvsroot, as example repository 722@cindex cvsroot 723 724The @sc{cvs} @dfn{repository} stores a complete copy of 725all the files and directories which are under version 726control. 727 728Normally, you never access any of the files in the 729repository directly. Instead, you use @sc{cvs} 730commands to get your own copy of the files into a 731@dfn{working directory}, and then 732work on that copy. When you've finished a set of 733changes, you check (or @dfn{commit}) them back into the 734repository. The repository then contains the changes 735which you have made, as well as recording exactly what 736you changed, when you changed it, and other such 737information. Note that the repository is not a 738subdirectory of the working directory, or vice versa; 739they should be in separate locations. 740@c Need some example, e.g. repository 741@c /usr/local/cvsroot; working directory 742@c /home/joe/sources. But this node is too long 743@c as it is; need a little reorganization... 744 745@cindex :local:, setting up 746@sc{cvs} can access a repository by a variety of 747means. It might be on the local computer, or it might 748be on a computer across the room or across the world. 749To distinguish various ways to access a repository, the 750repository name can start with an @dfn{access method}. 751For example, the access method @code{:local:} means to 752access a repository directory, so the repository 753@code{:local:/usr/local/cvsroot} means that the 754repository is in @file{/usr/local/cvsroot} on the 755computer running @sc{cvs}. For information on other 756access methods, see @ref{Remote repositories}. 757 758@c Can se say this more concisely? Like by passing 759@c more of the buck to the Remote repositories node? 760If the access method is omitted, then if the repository 761starts with @samp{/}, then @code{:local:} is 762assumed. If it does not start with @samp{/} then either 763@code{:ext:} or @code{:server:} is assumed. For 764example, if you have a local repository in 765@file{/usr/local/cvsroot}, you can use 766@code{/usr/local/cvsroot} instead of 767@code{:local:/usr/local/cvsroot}. But if (under 768Windows NT, for example) your local repository is 769@file{c:\src\cvsroot}, then you must specify the access 770method, as in @code{:local:c:/src/cvsroot}. 771 772@c This might appear to go in Repository storage, but 773@c actually it is describing something which is quite 774@c user-visible, when you do a "cvs co CVSROOT". This 775@c isn't necessary the perfect place for that, though. 776The repository is split in two parts. @file{$CVSROOT/CVSROOT} contains 777administrative files for @sc{cvs}. The other directories contain the actual 778user-defined modules. 779 780@menu 781* Specifying a repository:: Telling CVS where your repository is 782* Repository storage:: The structure of the repository 783* Working directory storage:: The structure of working directories 784* Intro administrative files:: Defining modules 785* Multiple repositories:: Multiple repositories 786* Creating a repository:: Creating a repository 787* Backing up:: Backing up a repository 788* Moving a repository:: Moving a repository 789* Remote repositories:: Accessing repositories on remote machines 790* Read-only access:: Granting read-only access to the repository 791* Server temporary directory:: The server creates temporary directories 792@end menu 793 794@node Specifying a repository 795@section Telling CVS where your repository is 796 797There are several ways to tell @sc{cvs} 798where to find the repository. You can name the 799repository on the command line explicitly, with the 800@code{-d} (for "directory") option: 801 802@example 803cvs -d /usr/local/cvsroot checkout yoyodyne/tc 804@end example 805 806@cindex .profile, setting CVSROOT in 807@cindex .cshrc, setting CVSROOT in 808@cindex .tcshrc, setting CVSROOT in 809@cindex .bashrc, setting CVSROOT in 810@cindex CVSROOT, environment variable 811 Or you can set the @code{$CVSROOT} environment 812variable to an absolute path to the root of the 813repository, @file{/usr/local/cvsroot} in this example. 814To set @code{$CVSROOT}, @code{csh} and @code{tcsh} 815users should have this line in their @file{.cshrc} or 816@file{.tcshrc} files: 817 818@example 819setenv CVSROOT /usr/local/cvsroot 820@end example 821 822@noindent 823@code{sh} and @code{bash} users should instead have these lines in their 824@file{.profile} or @file{.bashrc}: 825 826@example 827CVSROOT=/usr/local/cvsroot 828export CVSROOT 829@end example 830 831@cindex Root file, in CVS directory 832@cindex CVS/Root file 833 A repository specified with @code{-d} will 834override the @code{$CVSROOT} environment variable. 835Once you've checked a working copy out from the 836repository, it will remember where its repository is 837(the information is recorded in the 838@file{CVS/Root} file in the working copy). 839 840The @code{-d} option and the @file{CVS/Root} file both 841override the @code{$CVSROOT} environment variable. If 842@code{-d} option differs from @file{CVS/Root}, the 843former is used. Of course, for proper operation they 844should be two ways of referring to the same repository. 845 846@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 847@node Repository storage 848@section How data is stored in the repository 849@cindex Repository, how data is stored 850 851For most purposes it isn't important @emph{how} 852@sc{cvs} stores information in the repository. In 853fact, the format has changed in the past, and is likely 854to change in the future. Since in almost all cases one 855accesses the repository via @sc{cvs} commands, such 856changes need not be disruptive. 857 858However, in some cases it may be necessary to 859understand how @sc{cvs} stores data in the repository, 860for example you might need to track down @sc{cvs} locks 861(@pxref{Concurrency}) or you might need to deal with 862the file permissions appropriate for the repository. 863 864@menu 865* Repository files:: What files are stored in the repository 866* File permissions:: File permissions 867* Windows permissions:: Issues specific to Windows 868* Attic:: Some files are stored in the Attic 869* CVS in repository:: Additional information in CVS directory 870* Locks:: CVS locks control concurrent accesses 871* CVSROOT storage:: A few things about CVSROOT are different 872@end menu 873 874@node Repository files 875@subsection Where files are stored within the repository 876 877@c @cindex Filenames, legal 878@c @cindex Legal filenames 879@c Somewhere we need to say something about legitimate 880@c characters in filenames in working directory and 881@c repository. Not "/" (not even on non-unix). And 882@c here is a specific set of issues: 883@c Files starting with a - are handled inconsistently. They can not 884@c be added to a repository with an add command, because it they are 885@c interpreted as a switch. They can appear in a repository if they are 886@c part of a tree that is imported. They can not be removed from the tree 887@c once they are there. 888@c Note that "--" *is* supported (as a 889@c consequence of using GNU getopt). Should document 890@c this somewhere ("Common options"?). The other usual technique, 891@c "./-foo", isn't as effective, at least for "cvs add" 892@c which doesn't support pathnames containing "/". 893 894The overall structure of the repository is a directory 895tree corresponding to the directories in the working 896directory. For example, supposing the repository is in 897 898@example 899/usr/local/cvsroot 900@end example 901 902@noindent 903here is a possible directory tree (showing only the 904directories): 905 906@example 907@t{/usr} 908 | 909 +--@t{local} 910 | | 911 | +--@t{cvsroot} 912 | | | 913 | | +--@t{CVSROOT} 914 | (administrative files) 915 | 916 +--@t{gnu} 917 | | 918 | +--@t{diff} 919 | | (source code to @sc{gnu} diff) 920 | | 921 | +--@t{rcs} 922 | | (source code to @sc{rcs}) 923 | | 924 | +--@t{cvs} 925 | (source code to @sc{cvs}) 926 | 927 +--@t{yoyodyne} 928 | 929 +--@t{tc} 930 | | 931 | +--@t{man} 932 | | 933 | +--@t{testing} 934 | 935 +--(other Yoyodyne software) 936@end example 937 938With the directories are @dfn{history files} for each file 939under version control. The name of the history file is 940the name of the corresponding file with @samp{,v} 941appended to the end. Here is what the repository for 942the @file{yoyodyne/tc} directory might look like: 943@c FIXME: Should also mention CVS (CVSREP) 944@c FIXME? Should we introduce Attic with an xref to 945@c Attic? Not sure whether that is a good idea or not. 946@example 947 @code{$CVSROOT} 948 | 949 +--@t{yoyodyne} 950 | | 951 | +--@t{tc} 952 | | | 953 +--@t{Makefile,v} 954 +--@t{backend.c,v} 955 +--@t{driver.c,v} 956 +--@t{frontend.c,v} 957 +--@t{parser.c,v} 958 +--@t{man} 959 | | 960 | +--@t{tc.1,v} 961 | 962 +--@t{testing} 963 | 964 +--@t{testpgm.t,v} 965 +--@t{test2.t,v} 966@end example 967 968@cindex History files 969@cindex RCS history files 970@c The first sentence, about what history files 971@c contain, is kind of redundant with our intro to what the 972@c repository does in node Repository.... 973The history files contain, among other things, enough 974information to recreate any revision of the file, a log 975of all commit messages and the user-name of the person 976who committed the revision. The history files are 977known as @dfn{RCS files}, because the first program to 978store files in that format was a version control system 979known as @sc{rcs}. For a full 980description of the file format, see the @code{man} page 981@cite{rcsfile(5)}, distributed with @sc{rcs}, or the 982file @file{doc/RCSFILES} in the @sc{cvs} source 983distribution. This 984file format has become very common---many systems other 985than @sc{cvs} or @sc{rcs} can at least import history 986files in this format. 987@c FIXME: Think about including documentation for this 988@c rather than citing it? In the long run, getting 989@c this to be a standard (not sure if we can cope with 990@c a standards process as formal as IEEE/ANSI/ISO/etc, 991@c though...) is the way to go, so maybe citing is 992@c better. 993 994The @sc{rcs} files used in @sc{cvs} differ in a few 995ways from the standard format. The biggest difference 996is magic branches; for more information see @ref{Magic 997branch numbers}. Also in @sc{cvs} the valid tag names 998are a subset of what @sc{rcs} accepts; for @sc{cvs}'s 999rules see @ref{Tags}. 1000 1001@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002@node File permissions 1003@subsection File permissions 1004@c -- Move this to @node Creating a repository or similar 1005@cindex Security, file permissions in repository 1006@cindex File permissions, general 1007@cindex Permissions, general 1008@c FIXME: we need to somehow reflect "permissions in 1009@c repository" versus "permissions in working 1010@c directory" in the index entries. 1011@cindex Group, UNIX file permissions, in repository 1012@cindex Read-only files, in repository 1013All @samp{,v} files are created read-only, and you 1014should not change the permission of those files. The 1015directories inside the repository should be writable by 1016the persons that have permission to modify the files in 1017each directory. This normally means that you must 1018create a UNIX group (see group(5)) consisting of the 1019persons that are to edit the files in a project, and 1020set up the repository so that it is that group that 1021owns the directory. 1022(On some systems, you also need to set the set-group-ID-on-execution bit 1023on the repository directories (see chmod(1)) so that newly-created files 1024and directories get the group-ID of the parent directory rather than 1025that of the current process.) 1026 1027@c See also comment in commitinfo node regarding cases 1028@c which are really awkward with unix groups. 1029 1030This means that you can only control access to files on 1031a per-directory basis. 1032 1033Note that users must also have write access to check 1034out files, because @sc{cvs} needs to create lock files 1035(@pxref{Concurrency}). You can use LockDir in CVSROOT/config 1036to put the lock files somewhere other than in the repository 1037if you want to allow read-only access to some directories 1038(@pxref{config}). 1039 1040@c CVS seems to use CVSUMASK in picking permissions for 1041@c val-tags, but maybe we should say more about this. 1042@c Like val-tags gets created by someone who doesn't 1043@c have CVSUMASK set right? 1044@cindex CVSROOT/val-tags file, and read-only access to projects 1045@cindex val-tags file, and read-only access to projects 1046Also note that users must have write access to the 1047@file{CVSROOT/val-tags} file. @sc{cvs} uses it to keep 1048track of what tags are valid tag names (it is sometimes 1049updated when tags are used, as well as when they are 1050created). 1051 1052Each @sc{rcs} file will be owned by the user who last 1053checked it in. This has little significance; what 1054really matters is who owns the directories. 1055 1056@cindex CVSUMASK, environment variable 1057@cindex Umask, for repository files 1058@sc{cvs} tries to set up reasonable file permissions 1059for new directories that are added inside the tree, but 1060you must fix the permissions manually when a new 1061directory should have different permissions than its 1062parent directory. If you set the @code{CVSUMASK} 1063environment variable, that will control the file 1064permissions which @sc{cvs} uses in creating directories 1065and/or files in the repository. @code{CVSUMASK} does 1066not affect the file permissions in the working 1067directory; such files have the permissions which are 1068typical for newly created files, except that sometimes 1069@sc{cvs} creates them read-only (see the sections on 1070watches, @ref{Setting a watch}; -r, @ref{Global 1071options}; or @code{CVSREAD}, @ref{Environment variables}). 1072@c FIXME: Need more discussion of which 1073@c group should own the file in the repository. 1074@c Include a somewhat detailed example of the usual 1075@c case where CVSUMASK is 007, the developers are all 1076@c in a group, and that group owns stuff in the 1077@c repository. Need to talk about group ownership of 1078@c newly-created directories/files (on some unices, 1079@c such as SunOS4, setting the setgid bit on the 1080@c directories will make files inherit the directory's 1081@c group. On other unices, your mileage may vary. I 1082@c can't remember what POSIX says about this, if 1083@c anything). 1084 1085Note that using the client/server @sc{cvs} 1086(@pxref{Remote repositories}), there is no good way to 1087set @code{CVSUMASK}; the setting on the client machine 1088has no effect. If you are connecting with @code{rsh}, you 1089can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as 1090described in the documentation for your operating 1091system. This behavior might change in future versions 1092of @sc{cvs}; do not rely on the setting of 1093@code{CVSUMASK} on the client having no effect. 1094@c FIXME: need to explain what a umask is or cite 1095@c someplace which does. 1096@c 1097@c There is also a larger (largely separate) issue 1098@c about the meaning of CVSUMASK in a non-unix context. 1099@c For example, whether there is 1100@c an equivalent which fits better into other 1101@c protection schemes like POSIX.6, VMS, &c. 1102@c 1103@c FIXME: Need one place which discusses this 1104@c read-only files thing. Why would one use -r or 1105@c CVSREAD? Why would one use watches? How do they 1106@c interact? 1107@c 1108@c FIXME: We need to state 1109@c whether using CVSUMASK removes the need for manually 1110@c fixing permissions (in fact, if we are going to mention 1111@c manually fixing permission, we better document a lot 1112@c better just what we mean by "fix"). 1113 1114Using pserver, you will generally need stricter 1115permissions on the @sc{cvsroot} directory and 1116directories above it in the tree; see @ref{Password 1117authentication security}. 1118 1119@cindex Setuid 1120@cindex Setgid 1121@cindex Security, setuid 1122@cindex Installed images (VMS) 1123Some operating systems have features which allow a 1124particular program to run with the ability to perform 1125operations which the caller of the program could not. 1126For example, the set user ID (setuid) or set group ID 1127(setgid) features of unix or the installed image 1128feature of VMS. @sc{cvs} was not written to use such 1129features and therefore attempting to install @sc{cvs} in 1130this fashion will provide protection against only 1131accidental lapses; anyone who is trying to circumvent 1132the measure will be able to do so, and depending on how 1133you have set it up may gain access to more than just 1134@sc{cvs}. You may wish to instead consider pserver. It 1135shares some of the same attributes, in terms of 1136possibly providing a false sense of security or opening 1137security holes wider than the ones you are trying to 1138fix, so read the documentation on pserver security 1139carefully if you are considering this option 1140(@ref{Password authentication security}). 1141 1142@node Windows permissions 1143@subsection File Permission issues specific to Windows 1144@cindex Windows, and permissions 1145@cindex File permissions, Windows-specific 1146@cindex Permissions, Windows-specific 1147 1148Some file permission issues are specific to Windows 1149operating systems (Windows 95, Windows NT, and 1150presumably future operating systems in this family. 1151Some of the following might apply to OS/2 but I'm not 1152sure). 1153 1154If you are using local @sc{cvs} and the repository is on a 1155networked file system which is served by the Samba SMB 1156server, some people have reported problems with 1157permissions. Enabling WRITE=YES in the samba 1158configuration is said to fix/workaround it. 1159Disclaimer: I haven't investigated enough to know the 1160implications of enabling that option, nor do I know 1161whether there is something which @sc{cvs} could be doing 1162differently in order to avoid the problem. If you find 1163something out, please let us know as described in 1164@ref{BUGS}. 1165 1166@node Attic 1167@subsection The attic 1168@cindex Attic 1169 1170You will notice that sometimes @sc{cvs} stores an 1171@sc{rcs} file in the @code{Attic}. For example, if the 1172@sc{cvsroot} is @file{/usr/local/cvsroot} and we are 1173talking about the file @file{backend.c} in the 1174directory @file{yoyodyne/tc}, then the file normally 1175would be in 1176 1177@example 1178/usr/local/cvsroot/yoyodyne/tc/backend.c,v 1179@end example 1180 1181@noindent 1182but if it goes in the attic, it would be in 1183 1184@example 1185/usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v 1186@end example 1187 1188@noindent 1189@cindex Dead state 1190instead. It should not matter from a user point of 1191view whether a file is in the attic; @sc{cvs} keeps 1192track of this and looks in the attic when it needs to. 1193But in case you want to know, the rule is that the RCS 1194file is stored in the attic if and only if the head 1195revision on the trunk has state @code{dead}. A 1196@code{dead} state means that file has been removed, or 1197never added, for that revision. For example, if you 1198add a file on a branch, it will have a trunk revision 1199in @code{dead} state, and a branch revision in a 1200non-@code{dead} state. 1201@c Probably should have some more concrete examples 1202@c here, or somewhere (not sure exactly how we should 1203@c arrange the discussion of the dead state, versus 1204@c discussion of the attic). 1205 1206@node CVS in repository 1207@subsection The CVS directory in the repository 1208@cindex CVS directory, in repository 1209 1210The @file{CVS} directory in each repository directory 1211contains information such as file attributes (in a file 1212called @file{CVS/fileattr}. In the 1213future additional files may be added to this directory, 1214so implementations should silently ignore additional 1215files. 1216 1217This behavior is implemented only by @sc{cvs} 1.7 and 1218later; for details see @ref{Watches Compatibility}. 1219 1220The format of the @file{fileattr} file is a series of entries 1221of the following form (where @samp{@{} and @samp{@}} 1222means the text between the braces can be repeated zero 1223or more times): 1224 1225@var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval} 1226 @{; @var{attrname} = @var{attrval}@} <linefeed> 1227 1228@var{ent-type} is @samp{F} for a file, in which case the entry specifies the 1229attributes for that file. 1230 1231@var{ent-type} is @samp{D}, 1232and @var{filename} empty, to specify default attributes 1233to be used for newly added files. 1234 1235Other @var{ent-type} are reserved for future expansion. @sc{cvs} 1.9 and older 1236will delete them any time it writes file attributes. 1237@sc{cvs} 1.10 and later will preserve them. 1238 1239Note that the order of the lines is not significant; 1240a program writing the fileattr file may 1241rearrange them at its convenience. 1242 1243There is currently no way of quoting tabs or line feeds in the 1244filename, @samp{=} in @var{attrname}, 1245@samp{;} in @var{attrval}, etc. Note: some implementations also 1246don't handle a NUL character in any of the fields, but 1247implementations are encouraged to allow it. 1248 1249By convention, @var{attrname} starting with @samp{_} is for an attribute given 1250special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes 1251(or will be, once implementations start supporting user-defined attributes). 1252 1253Built-in attributes: 1254 1255@table @code 1256@item _watched 1257Present means the file is watched and should be checked out 1258read-only. 1259 1260@item _watchers 1261Users with watches for this file. Value is 1262@var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @} 1263where @var{watcher} is a username, and @var{type} 1264is zero or more of edit,unedit,commit separated by 1265@samp{+} (that is, nothing if none; there is no "none" or "all" keyword). 1266 1267@item _editors 1268Users editing this file. Value is 1269@var{editor} > @var{val} @{ , @var{editor} > @var{val} @} 1270where @var{editor} is a username, and @var{val} is 1271@var{time}+@var{hostname}+@var{pathname}, where 1272@var{time} is when the @code{cvs edit} command (or 1273equivalent) happened, 1274and @var{hostname} and @var{pathname} are for the working directory. 1275@end table 1276 1277Example: 1278 1279@c FIXME: sanity.sh should contain a similar test case 1280@c so we can compare this example from something from 1281@c Real Life(TM). See cvsclient.texi (under Notify) for more 1282@c discussion of the date format of _editors. 1283@example 1284Ffile1 _watched=;_watchers=joe>edit,mary>commit 1285Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs 1286D _watched= 1287@end example 1288 1289@noindent 1290means that the file @file{file1} should be checked out 1291read-only. Furthermore, joe is watching for edits and 1292mary is watching for commits. The file @file{file2} 1293should be checked out read-only; sue started editing it 1294on 8 Jan 1975 in the directory @file{/home/sue/cvs} on 1295the machine @code{workstn1}. Future files which are 1296added should be checked out read-only. To represent 1297this example here, we have shown a space after 1298@samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact 1299there must be a single tab character there and no spaces. 1300 1301@node Locks 1302@subsection CVS locks in the repository 1303 1304@cindex #cvs.rfl, technical details 1305@cindex #cvs.wfl, technical details 1306@cindex #cvs.lock, technical details 1307@cindex Locks, cvs, technical details 1308For an introduction to @sc{cvs} locks focusing on 1309user-visible behavior, see @ref{Concurrency}. The 1310following section is aimed at people who are writing 1311tools which want to access a @sc{cvs} repository without 1312interfering with other tools accessing the same 1313repository. If you find yourself confused by concepts 1314described here, like @dfn{read lock}, @dfn{write lock}, 1315and @dfn{deadlock}, you might consult the literature on 1316operating systems or databases. 1317 1318@cindex #cvs.tfl 1319Any file in the repository with a name starting 1320with @file{#cvs.rfl.} is a read lock. Any file in 1321the repository with a name starting with 1322@file{#cvs.wfl} is a write lock. Old versions of @sc{cvs} 1323(before @sc{cvs} 1.5) also created files with names starting 1324with @file{#cvs.tfl}, but they are not discussed here. 1325The directory @file{#cvs.lock} serves as a master 1326lock. That is, one must obtain this lock first before 1327creating any of the other locks. 1328 1329To obtain a read lock, first create the @file{#cvs.lock} 1330directory. This operation must be atomic (which should 1331be true for creating a directory under most operating 1332systems). If it fails because the directory already 1333existed, wait for a while and try again. After 1334obtaining the @file{#cvs.lock} lock, create a file 1335whose name is @file{#cvs.rfl.} followed by information 1336of your choice (for example, hostname and process 1337identification number). Then remove the 1338@file{#cvs.lock} directory to release the master lock. 1339Then proceed with reading the repository. When you are 1340done, remove the @file{#cvs.rfl} file to release the 1341read lock. 1342 1343To obtain a write lock, first create the 1344@file{#cvs.lock} directory, as with read locks. Then 1345check that there are no files whose names start with 1346@file{#cvs.rfl.}. If there are, remove 1347@file{#cvs.lock}, wait for a while, and try again. If 1348there are no readers, then create a file whose name is 1349@file{#cvs.wfl} followed by information of your choice 1350(for example, hostname and process identification 1351number). Hang on to the @file{#cvs.lock} lock. Proceed 1352with writing the repository. When you are done, first 1353remove the @file{#cvs.wfl} file and then the 1354@file{#cvs.lock} directory. Note that unlike the 1355@file{#cvs.rfl} file, the @file{#cvs.wfl} file is just 1356informational; it has no effect on the locking operation 1357beyond what is provided by holding on to the 1358@file{#cvs.lock} lock itself. 1359 1360Note that each lock (write lock or read lock) only locks 1361a single directory in the repository, including 1362@file{Attic} and @file{CVS} but not including 1363subdirectories which represent other directories under 1364version control. To lock an entire tree, you need to 1365lock each directory (note that if you fail to obtain 1366any lock you need, you must release the whole tree 1367before waiting and trying again, to avoid deadlocks). 1368 1369Note also that @sc{cvs} expects write locks to control 1370access to individual @file{foo,v} files. @sc{rcs} has 1371a scheme where the @file{,foo,} file serves as a lock, 1372but @sc{cvs} does not implement it and so taking out a 1373@sc{cvs} write lock is recommended. See the comments at 1374rcs_internal_lockfile in the @sc{cvs} source code for 1375further discussion/rationale. 1376 1377@node CVSROOT storage 1378@subsection How files are stored in the CVSROOT directory 1379@cindex CVSROOT, storage of files 1380 1381The @file{$CVSROOT/CVSROOT} directory contains the 1382various administrative files. In some ways this 1383directory is just like any other directory in the 1384repository; it contains @sc{rcs} files whose names end 1385in @samp{,v}, and many of the @sc{cvs} commands operate 1386on it the same way. However, there are a few 1387differences. 1388 1389For each administrative file, in addition to the 1390@sc{rcs} file, there is also a checked out copy of the 1391file. For example, there is an @sc{rcs} file 1392@file{loginfo,v} and a file @file{loginfo} which 1393contains the latest revision contained in 1394@file{loginfo,v}. When you check in an administrative 1395file, @sc{cvs} should print 1396 1397@example 1398cvs commit: Rebuilding administrative file database 1399@end example 1400 1401@noindent 1402and update the checked out copy in 1403@file{$CVSROOT/CVSROOT}. If it does not, there is 1404something wrong (@pxref{BUGS}). To add your own files 1405to the files to be updated in this fashion, you can add 1406them to the @file{checkoutlist} administrative file 1407(@pxref{checkoutlist}). 1408 1409@cindex modules.db 1410@cindex modules.pag 1411@cindex modules.dir 1412By default, the @file{modules} file behaves as 1413described above. If the modules file is very large, 1414storing it as a flat text file may make looking up 1415modules slow (I'm not sure whether this is as much of a 1416concern now as when @sc{cvs} first evolved this 1417feature; I haven't seen benchmarks). Therefore, by 1418making appropriate edits to the @sc{cvs} source code 1419one can store the modules file in a database which 1420implements the @code{ndbm} interface, such as Berkeley 1421db or GDBM. If this option is in use, then the modules 1422database will be stored in the files @file{modules.db}, 1423@file{modules.pag}, and/or @file{modules.dir}. 1424@c I think fileattr also will use the database stuff. 1425@c Anything else? 1426 1427For information on the meaning of the various 1428administrative files, see @ref{Administrative files}. 1429 1430@node Working directory storage 1431@section How data is stored in the working directory 1432 1433@c FIXME: Somewhere we should discuss timestamps (test 1434@c case "stamps" in sanity.sh). But not here. Maybe 1435@c in some kind of "working directory" chapter which 1436@c would encompass the "Builds" one? But I'm not sure 1437@c whether that is a good organization (is it based on 1438@c what the user wants to do?). 1439 1440@cindex CVS directory, in working directory 1441While we are discussing @sc{cvs} internals which may 1442become visible from time to time, we might as well talk 1443about what @sc{cvs} puts in the @file{CVS} directories 1444in the working directories. As with the repository, 1445@sc{cvs} handles this information and one can usually 1446access it via @sc{cvs} commands. But in some cases it 1447may be useful to look at it, and other programs, such 1448as the @code{jCVS} graphical user interface or the 1449@code{VC} package for emacs, may need to look at it. 1450Such programs should follow the recommendations in this 1451section if they hope to be able to work with other 1452programs which use those files, including future 1453versions of the programs just mentioned and the 1454command-line @sc{cvs} client. 1455 1456The @file{CVS} directory contains several files. 1457Programs which are reading this directory should 1458silently ignore files which are in the directory but 1459which are not documented here, to allow for future 1460expansion. 1461 1462The files are stored according to the text file 1463convention for the system in question. This means that 1464working directories are not portable between systems 1465with differing conventions for storing text files. 1466This is intentional, on the theory that the files being 1467managed by @sc{cvs} probably will not be portable between 1468such systems either. 1469 1470@table @file 1471@item Root 1472This file contains the current @sc{cvs} root, as 1473described in @ref{Specifying a repository}. 1474 1475@cindex Repository file, in CVS directory 1476@cindex CVS/Repository file 1477@item Repository 1478This file contains the directory within the repository 1479which the current directory corresponds with. It can 1480be either an absolute pathname or a relative pathname; 1481@sc{cvs} has had the ability to read either format 1482since at least version 1.3 or so. The relative 1483pathname is relative to the root, and is the more 1484sensible approach, but the absolute pathname is quite 1485common and implementations should accept either. For 1486example, after the command 1487 1488@example 1489cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc 1490@end example 1491 1492@noindent 1493@file{Root} will contain 1494 1495@example 1496:local:/usr/local/cvsroot 1497@end example 1498 1499@noindent 1500and @file{Repository} will contain either 1501 1502@example 1503/usr/local/cvsroot/yoyodyne/tc 1504@end example 1505 1506@noindent 1507or 1508 1509@example 1510yoyodyne/tc 1511@end example 1512 1513If the particular working directory does not correspond 1514to a directory in the repository, then @file{Repository} 1515should contain @file{CVSROOT/Emptydir}. 1516@cindex Emptydir, in CVSROOT directory 1517@cindex CVSROOT/Emptydir directory 1518 1519@cindex Entries file, in CVS directory 1520@cindex CVS/Entries file 1521@item Entries 1522This file lists the files and directories in the 1523working directory. 1524The first character of each line indicates what sort of 1525line it is. If the character is unrecognized, programs 1526reading the file should silently skip that line, to 1527allow for future expansion. 1528 1529If the first character is @samp{/}, then the format is: 1530 1531@example 1532/@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate} 1533@end example 1534 1535@noindent 1536where @samp{[} and @samp{]} are not part of the entry, 1537but instead indicate that the @samp{+} and conflict 1538marker are optional. @var{name} is the name of the 1539file within the directory. @var{revision} is the 1540revision that the file in the working derives from, or 1541@samp{0} for an added file, or @samp{-} followed by a 1542revision for a removed file. @var{timestamp} is the 1543timestamp of the file at the time that @sc{cvs} created 1544it; if the timestamp differs with the actual 1545modification time of the file it means the file has 1546been modified. It is stored in 1547the format used by the ISO C asctime() function (for 1548example, @samp{Sun Apr 7 01:29:26 1996}). One may 1549write a string which is not in that format, for 1550example, @samp{Result of merge}, to indicate that the 1551file should always be considered to be modified. This 1552is not a special case; to see whether a file is 1553modified a program should take the timestamp of the file 1554and simply do a string compare with @var{timestamp}. 1555If there was a conflict, @var{conflict} can be set to 1556the modification time of the file after the file has been 1557written with conflict markers (@pxref{Conflicts example}). 1558Thus if @var{conflict} is subsequently the same as the actual 1559modification time of the file it means that the user 1560has obviously not resolved the conflict. @var{options} 1561contains sticky options (for example @samp{-kb} for a 1562binary file). @var{tagdate} contains @samp{T} followed 1563by a tag name, or @samp{D} for a date, followed by a 1564sticky tag or date. Note that if @var{timestamp} 1565contains a pair of timestamps separated by a space, 1566rather than a single timestamp, you are dealing with a 1567version of @sc{cvs} earlier than @sc{cvs} 1.5 (not 1568documented here). 1569 1570The timezone on the timestamp in CVS/Entries (local or 1571universal) should be the same as the operating system 1572stores for the timestamp of the file itself. For 1573example, on Unix the file's timestamp is in universal 1574time (UT), so the timestamp in CVS/Entries should be 1575too. On @sc{vms}, the file's timestamp is in local 1576time, so @sc{cvs} on @sc{vms} should use local time. 1577This rule is so that files do not appear to be modified 1578merely because the timezone changed (for example, to or 1579from summer time). 1580@c See comments and calls to gmtime() and friends in 1581@c src/vers_ts.c (function time_stamp). 1582 1583If the first character of a line in @file{Entries} is 1584@samp{D}, then it indicates a subdirectory. @samp{D} 1585on a line all by itself indicates that the program 1586which wrote the @file{Entries} file does record 1587subdirectories (therefore, if there is such a line and 1588no other lines beginning with @samp{D}, one knows there 1589are no subdirectories). Otherwise, the line looks 1590like: 1591 1592@example 1593D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4} 1594@end example 1595 1596@noindent 1597where @var{name} is the name of the subdirectory, and 1598all the @var{filler} fields should be silently ignored, 1599for future expansion. Programs which modify 1600@code{Entries} files should preserve these fields. 1601 1602The lines in the @file{Entries} file can be in any order. 1603 1604@cindex Entries.Log file, in CVS directory 1605@cindex CVS/Entries.Log file 1606@item Entries.Log 1607This file does not record any information beyond that 1608in @file{Entries}, but it does provide a way to update 1609the information without having to rewrite the entire 1610@file{Entries} file, including the ability to preserve 1611the information even if the program writing 1612@file{Entries} and @file{Entries.Log} abruptly aborts. 1613Programs which are reading the @file{Entries} file 1614should also check for @file{Entries.Log}. If the latter 1615exists, they should read @file{Entries} and then apply 1616the changes mentioned in @file{Entries.Log}. After 1617applying the changes, the recommended practice is to 1618rewrite @file{Entries} and then delete @file{Entries.Log}. 1619The format of a line in @file{Entries.Log} is a single 1620character command followed by a space followed by a 1621line in the format specified for a line in 1622@file{Entries}. The single character command is 1623@samp{A} to indicate that the entry is being added, 1624@samp{R} to indicate that the entry is being removed, 1625or any other character to indicate that the entire line 1626in @file{Entries.Log} should be silently ignored (for 1627future expansion). If the second character of the line 1628in @file{Entries.Log} is not a space, then it was 1629written by an older version of @sc{cvs} (not documented 1630here). 1631 1632Programs which are writing rather than reading can 1633safely ignore @file{Entries.Log} if they so choose. 1634 1635@cindex Entries.Backup file, in CVS directory 1636@cindex CVS/Entries.Backup file 1637@item Entries.Backup 1638This is a temporary file. Recommended usage is to 1639write a new entries file to @file{Entries.Backup}, and 1640then to rename it (atomically, where possible) to @file{Entries}. 1641 1642@cindex Entries.Static file, in CVS directory 1643@cindex CVS/Entries.Static file 1644@item Entries.Static 1645The only relevant thing about this file is whether it 1646exists or not. If it exists, then it means that only 1647part of a directory was gotten and @sc{cvs} will 1648not create additional files in that directory. To 1649clear it, use the @code{update} command with the 1650@samp{-d} option, which will get the additional files 1651and remove @file{Entries.Static}. 1652@c FIXME: This needs to be better documented, in places 1653@c other than Working Directory Storage. 1654@c FIXCVS: The fact that this setting exists needs to 1655@c be more visible to the user. For example "cvs 1656@c status foo", in the case where the file would be 1657@c gotten except for Entries.Static, might say 1658@c something to distinguish this from other cases. 1659@c One thing that periodically gets suggested is to 1660@c have "cvs update" print something when it skips 1661@c files due to Entries.Static, but IMHO that kind of 1662@c noise pretty much makes the Entries.Static feature 1663@c useless. 1664 1665@cindex Tag file, in CVS directory 1666@cindex CVS/Tag file 1667@cindex Sticky tags/dates, per-directory 1668@cindex Per-directory sticky tags/dates 1669@item Tag 1670This file contains per-directory sticky tags or dates. 1671The first character is @samp{T} for a branch tag, 1672@samp{N} for a non-branch tag, or @samp{D} for a date, 1673or another character to mean the file should be 1674silently ignored, for future expansion. This character 1675is followed by the tag or date. Note that 1676per-directory sticky tags or dates are used for things 1677like applying to files which are newly added; they 1678might not be the same as the sticky tags or dates on 1679individual files. For general information on sticky 1680tags and dates, see @ref{Sticky tags}. 1681@c FIXME: This needs to be much better documented, 1682@c preferably not in the context of "working directory 1683@c storage". 1684@c FIXME: The Sticky tags node needs to discuss, or xref to 1685@c someplace which discusses, per-directory sticky 1686@c tags and the distinction with per-file sticky tags. 1687 1688@cindex Notify file, in CVS directory 1689@cindex CVS/Notify file 1690@item Notify 1691This file stores notifications (for example, for 1692@code{edit} or @code{unedit}) which have not yet been 1693sent to the server. Its format is not yet documented 1694here. 1695 1696@cindex Notify.tmp file, in CVS directory 1697@cindex CVS/Notify.tmp file 1698@item Notify.tmp 1699This file is to @file{Notify} as @file{Entries.Backup} 1700is to @file{Entries}. That is, to write @file{Notify}, 1701first write the new contents to @file{Notify.tmp} and 1702then (atomically where possible), rename it to 1703@file{Notify}. 1704 1705@cindex Base directory, in CVS directory 1706@cindex CVS/Base directory 1707@item Base 1708If watches are in use, then an @code{edit} command 1709stores the original copy of the file in the @file{Base} 1710directory. This allows the @code{unedit} command to 1711operate even if it is unable to communicate with the 1712server. 1713 1714@cindex Baserev file, in CVS directory 1715@cindex CVS/Baserev file 1716@item Baserev 1717The file lists the revision for each of the files in 1718the @file{Base} directory. The format is: 1719 1720@example 1721B@var{name}/@var{rev}/@var{expansion} 1722@end example 1723 1724@noindent 1725where @var{expansion} should be ignored, to allow for 1726future expansion. 1727 1728@cindex Baserev.tmp file, in CVS directory 1729@cindex CVS/Baserev.tmp file 1730@item Baserev.tmp 1731This file is to @file{Baserev} as @file{Entries.Backup} 1732is to @file{Entries}. That is, to write @file{Baserev}, 1733first write the new contents to @file{Baserev.tmp} and 1734then (atomically where possible), rename it to 1735@file{Baserev}. 1736 1737@cindex Template file, in CVS directory 1738@cindex CVS/Template file 1739@item Template 1740This file contains the template specified by the 1741@file{rcsinfo} file (@pxref{rcsinfo}). It is only used 1742by the client; the non-client/server @sc{cvs} consults 1743@file{rcsinfo} directly. 1744@end table 1745 1746@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1747@node Intro administrative files 1748@section The administrative files 1749@cindex Administrative files (intro) 1750@cindex Modules file 1751@cindex CVSROOT, module name 1752@cindex Defining modules (intro) 1753 1754@c FIXME: this node should be reorganized into "general 1755@c information about admin files" and put the "editing 1756@c admin files" stuff up front rather than jumping into 1757@c the details of modules right away. Then the 1758@c Administrative files node can go away, the information 1759@c on each admin file distributed to a place appropriate 1760@c to its function, and this node can contain a table 1761@c listing each file and a @ref to its detailed description. 1762 1763The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative 1764files}. @xref{Administrative files}, for a complete description. 1765You can use @sc{cvs} without any of these files, but 1766some commands work better when at least the 1767@file{modules} file is properly set up. 1768 1769The most important of these files is the @file{modules} 1770file. It defines all modules in the repository. This 1771is a sample @file{modules} file. 1772 1773@c FIXME: The CVSROOT line is a goofy example now that 1774@c mkmodules doesn't exist. 1775@example 1776CVSROOT CVSROOT 1777modules CVSROOT modules 1778cvs gnu/cvs 1779rcs gnu/rcs 1780diff gnu/diff 1781tc yoyodyne/tc 1782@end example 1783 1784The @file{modules} file is line oriented. In its 1785simplest form each line contains the name of the 1786module, whitespace, and the directory where the module 1787resides. The directory is a path relative to 1788@code{$CVSROOT}. The last four lines in the example 1789above are examples of such lines. 1790 1791@c FIXME: might want to introduce the concept of options in modules file 1792@c (the old example which was here, -i mkmodules, is obsolete). 1793 1794The line that defines the module called @samp{modules} 1795uses features that are not explained here. 1796@xref{modules}, for a full explanation of all the 1797available features. 1798 1799@c FIXME: subsection without node is bogus 1800@subsection Editing administrative files 1801@cindex Editing administrative files 1802@cindex Administrative files, editing them 1803 1804You edit the administrative files in the same way that you would edit 1805any other module. Use @samp{cvs checkout CVSROOT} to get a working 1806copy, edit it, and commit your changes in the normal way. 1807 1808It is possible to commit an erroneous administrative 1809file. You can often fix the error and check in a new 1810revision, but sometimes a particularly bad error in the 1811administrative file makes it impossible to commit new 1812revisions. If and when this happens, you can correct 1813the problem by temporarily copying a corrected administrative file 1814directly into the @code{$CVSROOT/CVSROOT} repository directory, 1815then committing the same correction via a checkout of the @file{CVSROOT} 1816module. It is important that the correction also be made via the 1817checked out copy, or the next checkout and commit to the 1818<code>CVSROOT</code> module will overwrite the correction that was 1819copied directly into the repository, possibly breaking things in such 1820a way as to prevent commits again. 1821@c @xref{Bad administrative files} for a hint 1822@c about how to solve such situations. 1823@c -- administrative file checking-- 1824 1825@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1826@node Multiple repositories 1827@section Multiple repositories 1828@cindex Multiple repositories 1829@cindex Repositories, multiple 1830@cindex Many repositories 1831@cindex Parallel repositories 1832@cindex Disjoint repositories 1833@cindex CVSROOT, multiple repositories 1834 1835In some situations it is a good idea to have more than 1836one repository, for instance if you have two 1837development groups that work on separate projects 1838without sharing any code. All you have to do to have 1839several repositories is to specify the appropriate 1840repository, using the @code{CVSROOT} environment 1841variable, the @samp{-d} option to @sc{cvs}, or (once 1842you have checked out a working directory) by simply 1843allowing @sc{cvs} to use the repository that was used 1844to check out the working directory 1845(@pxref{Specifying a repository}). 1846 1847The big advantage of having multiple repositories is 1848that they can reside on different servers. With @sc{cvs} 1849version 1.10, a single command cannot recurse into 1850directories from different repositories. With development 1851versions of @sc{cvs}, you can check out code from multiple 1852servers into your working directory. @sc{cvs} will 1853recurse and handle all the details of making 1854connections to as many server machines as necessary to 1855perform the requested command. Here is an example of 1856how to set up a working directory: 1857 1858@example 1859cvs -d server1:/cvs co dir1 1860cd dir1 1861cvs -d server2:/root co sdir 1862cvs update 1863@end example 1864 1865The @code{cvs co} commands set up the working 1866directory, and then the @code{cvs update} command will 1867contact server2, to update the dir1/sdir subdirectory, 1868and server1, to update everything else. 1869 1870@c FIXME: Does the FAQ have more about this? I have a 1871@c dim recollection, but I'm too lazy to check right now. 1872 1873@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1874@node Creating a repository 1875@section Creating a repository 1876 1877@cindex Repository, setting up 1878@cindex Creating a repository 1879@cindex Setting up a repository 1880 1881This section describes how to set up a @sc{cvs} repository for any 1882sort of access method. After completing the setup described in this 1883section, you should be able to access your @sc{cvs} repository immediately 1884via the local access method and several remote access methods. For 1885more information on setting up remote access to the repository you create 1886in this section, please read the section on @xref{Remote repositories}. 1887 1888To set up a @sc{cvs} repository, first choose the 1889machine and disk on which you want to store the 1890revision history of the source files. CPU and memory 1891requirements are modest, so most machines should be 1892adequate. For details see @ref{Server requirements}. 1893@c Possible that we should be providing a quick rule of 1894@c thumb, like the 32M memory for the server. That 1895@c might increase the number of people who are happy 1896@c with the answer, without following the xref. 1897 1898To estimate disk space 1899requirements, if you are importing RCS files from 1900another system, the size of those files is the 1901approximate initial size of your repository, or if you 1902are starting without any version history, a rule of 1903thumb is to allow for the server approximately three 1904times the size of the code to be under @sc{cvs} for the 1905repository (you will eventually outgrow this, but not 1906for a while). On the machines on which the developers 1907will be working, you'll want disk space for 1908approximately one working directory for each developer 1909(either the entire tree or a portion of it, depending 1910on what each developer uses). 1911 1912The repository should be accessible 1913(directly or via a networked file system) from all 1914machines which want to use @sc{cvs} in server or local 1915mode; the client machines need not have any access to 1916it other than via the @sc{cvs} protocol. It is not 1917possible to use @sc{cvs} to read from a repository 1918which one only has read access to; @sc{cvs} needs to be 1919able to create lock files (@pxref{Concurrency}). 1920 1921@cindex init (subcommand) 1922To create a repository, run the @code{cvs init} 1923command. It will set up an empty repository in the 1924@sc{cvs} root specified in the usual way 1925(@pxref{Repository}). For example, 1926 1927@example 1928cvs -d /usr/local/cvsroot init 1929@end example 1930 1931@code{cvs init} is careful to never overwrite any 1932existing files in the repository, so no harm is done if 1933you run @code{cvs init} on an already set-up 1934repository. 1935 1936@code{cvs init} will enable history logging; if you 1937don't want that, remove the history file after running 1938@code{cvs init}. @xref{history file}. 1939 1940@node Backing up 1941@section Backing up a repository 1942@cindex Repository, backing up 1943@cindex Backing up, repository 1944 1945There is nothing particularly magical about the files 1946in the repository; for the most part it is possible to 1947back them up just like any other files. However, there 1948are a few issues to consider. 1949 1950@cindex Locks, cvs, and backups 1951@cindex #cvs.rfl, and backups 1952The first is that to be paranoid, one should either not 1953use @sc{cvs} during the backup, or have the backup 1954program lock @sc{cvs} while doing the backup. To not 1955use @sc{cvs}, you might forbid logins to machines which 1956can access the repository, turn off your @sc{cvs} 1957server, or similar mechanisms. The details would 1958depend on your operating system and how you have 1959@sc{cvs} set up. To lock @sc{cvs}, you would create 1960@file{#cvs.rfl} locks in each repository directory. 1961See @ref{Concurrency}, for more on @sc{cvs} locks. 1962Having said all this, if you just back up without any 1963of these precautions, the results are unlikely to be 1964particularly dire. Restoring from backup, the 1965repository might be in an inconsistent state, but this 1966would not be particularly hard to fix manually. 1967 1968When you restore a repository from backup, assuming 1969that changes in the repository were made after the time 1970of the backup, working directories which were not 1971affected by the failure may refer to revisions which no 1972longer exist in the repository. Trying to run @sc{cvs} 1973in such directories will typically produce an error 1974message. One way to get those changes back into the 1975repository is as follows: 1976 1977@itemize @bullet 1978@item 1979Get a new working directory. 1980 1981@item 1982Copy the files from the working directory from before 1983the failure over to the new working directory (do not 1984copy the contents of the @file{CVS} directories, of 1985course). 1986 1987@item 1988Working in the new working directory, use commands such 1989as @code{cvs update} and @code{cvs diff} to figure out 1990what has changed, and then when you are ready, commit 1991the changes into the repository. 1992@end itemize 1993 1994@node Moving a repository 1995@section Moving a repository 1996@cindex Repository, moving 1997@cindex Moving a repository 1998@cindex Copying a repository 1999 2000Just as backing up the files in the repository is 2001pretty much like backing up any other files, if you 2002need to move a repository from one place to another it 2003is also pretty much like just moving any other 2004collection of files. 2005 2006The main thing to consider is that working directories 2007point to the repository. The simplest way to deal with 2008a moved repository is to just get a fresh working 2009directory after the move. Of course, you'll want to 2010make sure that the old working directory had been 2011checked in before the move, or you figured out some 2012other way to make sure that you don't lose any 2013changes. If you really do want to reuse the existing 2014working directory, it should be possible with manual 2015surgery on the @file{CVS/Repository} files. You can 2016see @ref{Working directory storage}, for information on 2017the @file{CVS/Repository} and @file{CVS/Root} files, but 2018unless you are sure you want to bother, it probably 2019isn't worth it. 2020@c FIXME: Surgery on CVS/Repository should be avoided 2021@c by making RELATIVE_REPOS the default. 2022@c FIXME-maybe: might want some documented way to 2023@c change the CVS/Root files in some particular tree. 2024@c But then again, I don't know, maybe just having 2025@c people do this in perl/shell/&c isn't so bad... 2026 2027@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2028@node Remote repositories 2029@section Remote repositories 2030@cindex Repositories, remote 2031@cindex Remote repositories 2032@cindex Client/Server Operation 2033@cindex Server, CVS 2034@cindex Remote repositories, port specification 2035@cindex Repositories, remote, port specification 2036@cindex Client/Server Operation, port specification 2037@cindex pserver (client/server connection method), port specification 2038@cindex kserver (client/server connection method), port specification 2039@cindex gserver (client/server connection method), port specification 2040@cindex port, specifying for remote repositories 2041 2042 Your working copy of the sources can be on a 2043different machine than the repository. Using @sc{cvs} 2044in this manner is known as @dfn{client/server} 2045operation. You run @sc{cvs} on a machine which can 2046mount your working directory, known as the 2047@dfn{client}, and tell it to communicate to a machine 2048which can mount the repository, known as the 2049@dfn{server}. Generally, using a remote 2050repository is just like using a local one, except that 2051the format of the repository name is: 2052 2053@example 2054[:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository 2055@end example 2056 2057Specifying a password in the repository name is not recommended during 2058checkout, since this will cause @sc{cvs} to store a cleartext copy of the 2059password in each created directory. @code{cvs login} first instead 2060(@pxref{Password authentication client}). 2061 2062The details of exactly what needs to be set up depend 2063on how you are connecting to the server. 2064 2065If @var{method} is not specified, and the repository 2066name contains @samp{:}, then the default is @code{ext} 2067or @code{server}, depending on your platform; both are 2068described in @ref{Connecting via rsh}. 2069@c Should we try to explain which platforms are which? 2070@c Platforms like unix and VMS, which only allow 2071@c privileged programs to bind to sockets <1024 lose on 2072@c :server: 2073@c Platforms like Mac and VMS, whose rsh program is 2074@c unusable or nonexistent, lose on :ext: 2075@c Platforms like OS/2 and NT probably could plausibly 2076@c default either way (modulo -b troubles). 2077 2078@c FIXME: We need to have a better way of explaining 2079@c what method to use. This presentation totally 2080@c obscures the fact that :ext: and CVS_RSH is the way to 2081@c use SSH, for example. Plus it incorrectly implies 2082@c that you need an @code{rsh} binary on the client to use 2083@c :server:. 2084@c Also note that rsh not pserver is the right choice if you want 2085@c users to be able to create their own repositories 2086@c (because of the --allow-root related issues). 2087@menu 2088* Server requirements:: Memory and other resources for servers 2089* Connecting via rsh:: Using the @code{rsh} program to connect 2090* Password authenticated:: Direct connections using passwords 2091* GSSAPI authenticated:: Direct connections using GSSAPI 2092* Kerberos authenticated:: Direct connections with Kerberos 2093* Connecting via fork:: Using a forked @code{cvs server} to connect 2094@end menu 2095 2096@node Server requirements 2097@subsection Server requirements 2098 2099The quick answer to what sort of machine is suitable as 2100a server is that requirements are modest---a server 2101with 32M of memory or even less can handle a fairly 2102large source tree with a fair amount of activity. 2103@c Say something about CPU speed too? I'm even less sure 2104@c what to say on that subject... 2105 2106The real answer, of course, is more complicated. 2107Estimating the known areas of large memory consumption 2108should be sufficient to estimate memory requirements. 2109There are two such areas documented here; other memory 2110consumption should be small by comparison (if you find 2111that is not the case, let us know, as described in 2112@ref{BUGS}, so we can update this documentation). 2113 2114The first area of big memory consumption is large 2115checkouts, when using the @sc{cvs} server. The server 2116consists of two processes for each client that it is 2117serving. Memory consumption on the child process 2118should remain fairly small. Memory consumption on the 2119parent process, particularly if the network connection 2120to the client is slow, can be expected to grow to 2121slightly more than the size of the sources in a single 2122directory, or two megabytes, whichever is larger. 2123@c "two megabytes" of course is SERVER_HI_WATER. But 2124@c we don't mention that here because we are 2125@c documenting the default configuration of CVS. If it 2126@c is a "standard" thing to change that value, it 2127@c should be some kind of run-time configuration. 2128@c 2129@c See cvsclient.texi for more on the design decision 2130@c to not have locks in place while waiting for the 2131@c client, which is what results in memory consumption 2132@c as high as this. 2133 2134Multiplying the size of each @sc{cvs} server by the 2135number of servers which you expect to have active at 2136one time should give an idea of memory requirements for 2137the server. For the most part, the memory consumed by 2138the parent process probably can be swap space rather 2139than physical memory. 2140@c Has anyone verified that notion about swap space? 2141@c I say it based pretty much on guessing that the 2142@c ->text of the struct buffer_data only gets accessed 2143@c in a first in, first out fashion, but I haven't 2144@c looked very closely. 2145 2146@c What about disk usage in /tmp on the server? I think that 2147@c it can be substantial, but I haven't looked at this 2148@c again and tried to figure it out ("cvs import" is 2149@c probably the worst case...). 2150 2151The second area of large memory consumption is 2152@code{diff}, when checking in large files. This is 2153required even for binary files. The rule of thumb is 2154to allow about ten times the size of the largest file 2155you will want to check in, although five times may be 2156adequate. For example, if you want to check in a file 2157which is 10 megabytes, you should have 100 megabytes of 2158memory on the machine doing the checkin (the server 2159machine for client/server, or the machine running 2160@sc{cvs} for non-client/server). This can be swap 2161space rather than physical memory. Because the memory 2162is only required briefly, there is no particular need 2163to allow memory for more than one such checkin at a 2164time. 2165@c The 5-10 times rule of thumb is from Paul Eggert for 2166@c GNU diff. I don't think it is in the GNU diff 2167@c manual or anyplace like that. 2168@c 2169@c Probably we could be saying more about 2170@c non-client/server CVS. 2171@c I would guess for non-client/server CVS in an NFS 2172@c environment the biggest issues are the network and 2173@c the NFS server. 2174 2175Resource consumption for the client is even more 2176modest---any machine with enough capacity to run the 2177operating system in question should have little 2178trouble. 2179@c Is that true? I think the client still wants to 2180@c (bogusly) store entire files in memory at times. 2181 2182For information on disk space requirements, see 2183@ref{Creating a repository}. 2184 2185@node Connecting via rsh 2186@subsection Connecting with rsh or ssh 2187 2188@cindex ssh 2189@sc{cvs} may use the @samp{ssh} protocol to perform 2190these operations, so the remote user host needs to have 2191a either an agent like @code{ssh-agent} to hold 2192credentials or a @file{.shosts} file which grants 2193access to the local user. Note that the program that 2194@sc{cvs} uses for this purpose may be specified using 2195the @file{--with-ssh} flag to configure. 2196 2197@cindex rsh 2198@sc{cvs} uses the @samp{rsh} protocol to perform these 2199operations, so the remote user host needs to have a 2200@file{.rhosts} file which grants access to the local 2201user. Note that the program that @sc{cvs} uses for this 2202purpose may be specified using the @file{--with-rsh} 2203flag to configure. 2204 2205For example, suppose you are the user @samp{mozart} on 2206the local machine @samp{toe.example.com}, and the 2207server machine is @samp{faun.example.org}. On 2208faun, put the following line into the file 2209@file{.rhosts} in @samp{bach}'s home directory: 2210 2211@example 2212toe.example.com mozart 2213@end example 2214 2215@noindent 2216Then test that @samp{rsh} is working with 2217 2218@example 2219rsh -l bach faun.example.org 'echo $PATH' 2220@end example 2221 2222@noindent 2223To test that @samp{ssh} is working use 2224 2225@example 2226ssh -l bach faun.example.org 'echo $PATH' 2227@end example 2228 2229@cindex CVS_SERVER, environment variable 2230Next you have to make sure that @code{rsh} will be able 2231to find the server. Make sure that the path which 2232@code{rsh} printed in the above example includes the 2233directory containing a program named @code{cvs} which 2234is the server. You need to set the path in 2235@file{.bashrc}, @file{.cshrc}, etc., not @file{.login} 2236or @file{.profile}. Alternately, you can set the 2237environment variable @code{CVS_SERVER} on the client 2238machine to the filename of the server you want to use, 2239for example @file{/usr/local/bin/cvs-1.6}. 2240@c FIXME: there should be a way to specify the 2241@c program in CVSROOT, not CVS_SERVER, so that one can use 2242@c different ones for different roots. e.g. ":server;cvs=cvs-1.6:" 2243@c instead of ":server:". 2244 2245There is no need to edit @file{inetd.conf} or start a 2246@sc{cvs} server daemon. 2247 2248@cindex :server:, setting up 2249@cindex :ext:, setting up 2250@cindex :extssh:, setting up 2251@cindex Kerberos, using kerberized rsh 2252@cindex SSH (rsh replacement) 2253@cindex rsh replacements (Kerberized, SSH, &c) 2254There are three access methods that you use in @code{CVSROOT} 2255for rsh or ssh. @code{:server:} specifies an internal rsh 2256client, which is supported only by some @sc{cvs} ports. 2257@code{:extssh:} specifies an external ssh program. By 2258default this is @code{ssh} (unless otherwise specified 2259by the @file{--with-ssh} flag to configure) but you may set the 2260@code{CVS_SSH} environment variable to invoke another 2261program or wrapper script. 2262@code{:ext:} specifies an external rsh program. By 2263default this is @code{rsh} (unless otherwise specified 2264by the @file{--with-rsh} flag to configure) but you may set the 2265@code{CVS_RSH} environment variable to invoke another 2266program which can access the remote server (for 2267example, @code{remsh} on HP-UX 9 because @code{rsh} is 2268something different). It must be a program which can 2269transmit data to and from the server without modifying 2270it; for example the Windows NT @code{rsh} is not 2271suitable since it by default translates between CRLF 2272and LF. The OS/2 @sc{cvs} port has a hack to pass @samp{-b} 2273to @code{rsh} to get around this, but since this could 2274potentially cause problems for programs other than the 2275standard @code{rsh}, it may change in the future. If 2276you set @code{CVS_RSH} to @code{SSH} or some other rsh 2277replacement, the instructions in the rest of this 2278section concerning @file{.rhosts} and so on are likely 2279to be inapplicable; consult the documentation for your rsh 2280replacement. 2281@c FIXME: there should be a way to specify the 2282@c program in CVSROOT, not CVS_RSH, so that one can use 2283@c different ones for different roots. e.g. 2284@c ":ext;CVS_RSH=remsh:" instead of ":ext:". 2285@c See also the comment in src/client.c for rationale 2286@c concerning "rsh" being the default and never 2287@c "remsh". 2288 2289Continuing our example, supposing you want to access 2290the module @file{foo} in the repository 2291@file{/usr/local/cvsroot/}, on machine 2292@file{faun.example.org}, you are ready to go: 2293 2294@example 2295cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo 2296@end example 2297 2298@noindent 2299(The @file{bach@@} can be omitted if the username is 2300the same on both the local and remote hosts.) 2301 2302@c Should we mention "rsh host echo hi" and "rsh host 2303@c cat" (the latter followed by typing text and ^D) 2304@c as troubleshooting techniques? Probably yes 2305@c (people tend to have trouble setting this up), 2306@c but this kind of thing can be hard to spell out. 2307 2308@node Password authenticated 2309@subsection Direct connection with password authentication 2310 2311The @sc{cvs} client can also connect to the server 2312using a password protocol. This is particularly useful 2313if using @code{rsh} is not feasible (for example, 2314the server is behind a firewall), and Kerberos also is 2315not available. 2316 2317 To use this method, it is necessary to make 2318some adjustments on both the server and client sides. 2319 2320@menu 2321* Password authentication server:: Setting up the server 2322* Password authentication client:: Using the client 2323* Password authentication security:: What this method does and does not do 2324@end menu 2325 2326@node Password authentication server 2327@subsubsection Setting up the server for password authentication 2328 2329First of all, you probably want to tighten the 2330permissions on the @file{$CVSROOT} and 2331@file{$CVSROOT/CVSROOT} directories. See @ref{Password 2332authentication security}, for more details. 2333 2334@cindex pserver (subcommand) 2335@cindex Remote repositories, port specification 2336@cindex Repositories, remote, port specification 2337@cindex Client/Server Operation, port specification 2338@cindex pserver (client/server connection method), port specification 2339@cindex kserver (client/server connection method), port specification 2340@cindex gserver (client/server connection method), port specification 2341@cindex port, specifying for remote repositories 2342@cindex Password server, setting up 2343@cindex Authenticating server, setting up 2344@cindex inetd, configuring for pserver 2345@cindex xinetd, configuring for pserver 2346@c FIXME: this isn't quite right regarding port 2347@c numbers; CVS looks up "cvspserver" in 2348@c /etc/services (on unix, but what about non-unix?). 2349On the server side, the file @file{/etc/inetd.conf} 2350needs to be edited so @code{inetd} knows to run the 2351command @code{cvs pserver} when it receives a 2352connection on the right port. By default, the port 2353number is 2401; it would be different if your client 2354were compiled with @code{CVS_AUTH_PORT} defined to 2355something else, though. This can also be specified in the CVSROOT variable 2356(@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT 2357environment variable (@pxref{Environment variables}). 2358 2359 If your @code{inetd} allows raw port numbers in 2360@file{/etc/inetd.conf}, then the following (all on a 2361single line in @file{inetd.conf}) should be sufficient: 2362 2363@example 23642401 stream tcp nowait root /usr/local/bin/cvs 2365cvs -f --allow-root=/usr/cvsroot pserver 2366@end example 2367 2368@noindent 2369(You could also use the 2370@samp{-T} option to specify a temporary directory.) 2371 2372The @samp{--allow-root} option specifies the allowable 2373@sc{cvsroot} directory. Clients which attempt to use a 2374different @sc{cvsroot} directory will not be allowed to 2375connect. If there is more than one @sc{cvsroot} 2376directory which you want to allow, repeat the option. 2377(Unfortunately, many versions of @code{inetd} have very small 2378limits on the number of arguments and/or the total length 2379of the command. The usual solution to this problem is 2380to have @code{inetd} run a shell script which then invokes 2381@sc{cvs} with the necessary arguments.) 2382 2383 If your @code{inetd} wants a symbolic service 2384name instead of a raw port number, then put this in 2385@file{/etc/services}: 2386 2387@example 2388cvspserver 2401/tcp 2389@end example 2390 2391@noindent 2392and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}. 2393 2394If your system uses @code{xinetd} instead of @code{inetd}, 2395the procedure is slightly different. 2396Create a file called @file{/etc/xinetd.d/cvspserver} containing the following: 2397 2398@example 2399service cvspserver 2400@{ 2401 port = 2401 2402 socket_type = stream 2403 protocol = tcp 2404 wait = no 2405 user = root 2406 passenv = PATH 2407 server = /usr/local/bin/cvs 2408 server_args = -f --allow-root=/usr/cvsroot pserver 2409@} 2410@end example 2411 2412@noindent 2413(If @code{cvspserver} is defined in @file{/etc/services}, you can omit 2414the @code{port} line.) 2415 2416 Once the above is taken care of, restart your 2417@code{inetd}, or do whatever is necessary to force it 2418to reread its initialization files. 2419 2420If you are having trouble setting this up, see 2421@ref{Connection}. 2422 2423@cindex CVS passwd file 2424@cindex passwd (admin file) 2425Because the client stores and transmits passwords in 2426cleartext (almost---see @ref{Password authentication 2427security}, for details), a separate @sc{cvs} password 2428file is generally used, so people don't compromise 2429their regular passwords when they access the 2430repository. This file is 2431@file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro 2432administrative files}). It uses a colon-separated 2433format, similar to @file{/etc/passwd} on Unix systems, 2434except that it has fewer fields: @sc{cvs} username, 2435optional password, and an optional system username for 2436@sc{cvs} to run as if authentication succeeds. Here is 2437an example @file{passwd} file with five entries: 2438 2439@example 2440anonymous: 2441bach:ULtgRLXo7NRxs 2442spwang:1sOp854gDF3DY 2443melissa:tGX1fS8sun6rY:pubcvs 2444qproj:XR4EZcEs0szik:pubcvs 2445@end example 2446 2447@noindent 2448(The passwords are encrypted according to the standard 2449Unix @code{crypt()} function, so it is possible to 2450paste in passwords directly from regular Unix 2451@file{/etc/passwd} files.) 2452 2453The first line in the example will grant access to any 2454@sc{cvs} client attempting to authenticate as user 2455@code{anonymous}, no matter what password they use, 2456including an empty password. (This is typical for 2457sites granting anonymous read-only access; for 2458information on how to do the "read-only" part, see 2459@ref{Read-only access}.) 2460 2461The second and third lines will grant access to 2462@code{bach} and @code{spwang} if they supply their 2463respective plaintext passwords. 2464 2465@cindex User aliases 2466The fourth line will grant access to @code{melissa}, if 2467she supplies the correct password, but her @sc{cvs} 2468operations will actually run on the server side under 2469the system user @code{pubcvs}. Thus, there need not be 2470any system user named @code{melissa}, but there 2471@emph{must} be one named @code{pubcvs}. 2472 2473The fifth line shows that system user identities can be 2474shared: any client who successfully authenticates as 2475@code{qproj} will actually run as @code{pubcvs}, just 2476as @code{melissa} does. That way you could create a 2477single, shared system user for each project in your 2478repository, and give each developer their own line in 2479the @file{$CVSROOT/CVSROOT/passwd} file. The @sc{cvs} 2480username on each line would be different, but the 2481system username would be the same. The reason to have 2482different @sc{cvs} usernames is that @sc{cvs} will log their 2483actions under those names: when @code{melissa} commits 2484a change to a project, the checkin is recorded in the 2485project's history under the name @code{melissa}, not 2486@code{pubcvs}. And the reason to have them share a 2487system username is so that you can arrange permissions 2488in the relevant area of the repository such that only 2489that account has write-permission there. 2490 2491If the system-user field is present, all 2492password-authenticated @sc{cvs} commands run as that 2493user; if no system user is specified, @sc{cvs} simply 2494takes the @sc{cvs} username as the system username and 2495runs commands as that user. In either case, if there 2496is no such user on the system, then the @sc{cvs} 2497operation will fail (regardless of whether the client 2498supplied a valid password). 2499 2500The password and system-user fields can both be omitted 2501(and if the system-user field is omitted, then also 2502omit the colon that would have separated it from the 2503encrypted password). For example, this would be a 2504valid @file{$CVSROOT/CVSROOT/passwd} file: 2505 2506@example 2507anonymous::pubcvs 2508fish:rKa5jzULzmhOo:kfogel 2509sussman:1sOp854gDF3DY 2510@end example 2511 2512@noindent 2513When the password field is omitted or empty, then the 2514client's authentication attempt will succeed with any 2515password, including the empty string. However, the 2516colon after the @sc{cvs} username is always necessary, 2517even if the password is empty. 2518 2519@sc{cvs} can also fall back to use system authentication. 2520When authenticating a password, the server first checks 2521for the user in the @file{$CVSROOT/CVSROOT/passwd} 2522file. If it finds the user, it will use that entry for 2523authentication as described above. But if it does not 2524find the user, or if the @sc{cvs} @file{passwd} file 2525does not exist, then the server can try to authenticate 2526the username and password using the operating system's 2527user-lookup routines (this "fallback" behavior can be 2528disabled by setting @code{SystemAuth=no} in the 2529@sc{cvs} @file{config} file, @pxref{config}). Be 2530aware, however, that falling back to system 2531authentication might be a security risk: @sc{cvs} 2532operations would then be authenticated with that user's 2533regular login password, and the password flies across 2534the network in plaintext. See @ref{Password 2535authentication security} for more on this. 2536 2537Right now, the only way to put a password in the 2538@sc{cvs} @file{passwd} file is to paste it there from 2539somewhere else. Someday, there may be a @code{cvs 2540passwd} command. 2541 2542Unlike many of the files in @file{$CVSROOT/CVSROOT}, it 2543is normal to edit the @file{passwd} file in-place, 2544rather than via @sc{cvs}. This is because of the 2545possible security risks of having the @file{passwd} 2546file checked out to people's working copies. If you do 2547want to include the @file{passwd} file in checkouts of 2548@file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}. 2549 2550@c We might also suggest using the @code{htpasswd} command 2551@c from freely available web servers as well, but that 2552@c would open up a can of worms in that the users next 2553@c questions are likely to be "where do I get it?" and 2554@c "how do I use it?" 2555@c Also note that htpasswd, at least the version I had, 2556@c likes to clobber the third field. 2557 2558@node Password authentication client 2559@subsubsection Using the client with password authentication 2560@cindex Login (subcommand) 2561@cindex Password client, using 2562@cindex Authenticated client, using 2563@cindex :pserver:, setting up 2564To run a @sc{cvs} command on a remote repository via 2565the password-authenticating server, one specifies the 2566@code{pserver} protocol, optional username, repository host, an 2567optional port number, and path to the repository. For example: 2568 2569@example 2570cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj 2571@end example 2572 2573@noindent 2574or 2575 2576@example 2577CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot 2578cvs checkout someproj 2579@end example 2580 2581However, unless you're connecting to a public-access 2582repository (i.e., one where that username doesn't 2583require a password), you'll need to supply a password or @dfn{log in} first. 2584Logging in verifies your password with the repository and stores it in a file. 2585It's done with the @code{login} command, which will 2586prompt you interactively for the password if you didn't supply one as part of 2587@var{$CVSROOT}: 2588 2589@example 2590cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login 2591CVS password: 2592@end example 2593 2594@noindent 2595or 2596 2597@example 2598cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login 2599@end example 2600 2601After you enter the password, @sc{cvs} verifies it with 2602the server. If the verification succeeds, then that 2603combination of username, host, repository, and password 2604is permanently recorded, so future transactions with 2605that repository won't require you to run @code{cvs 2606login}. (If verification fails, @sc{cvs} will exit 2607complaining that the password was incorrect, and 2608nothing will be recorded.) 2609 2610The records are stored, by default, in the file 2611@file{$HOME/.cvspass}. That file's format is 2612human-readable, and to a degree human-editable, but 2613note that the passwords are not stored in 2614cleartext---they are trivially encoded to protect them 2615from "innocent" compromise (i.e., inadvertent viewing 2616by a system administrator or other non-malicious 2617person). 2618 2619@cindex CVS_PASSFILE, environment variable 2620You can change the default location of this file by 2621setting the @code{CVS_PASSFILE} environment variable. 2622If you use this variable, make sure you set it 2623@emph{before} @code{cvs login} is run. If you were to 2624set it after running @code{cvs login}, then later 2625@sc{cvs} commands would be unable to look up the 2626password for transmission to the server. 2627 2628Once you have logged in, all @sc{cvs} commands using 2629that remote repository and username will authenticate 2630with the stored password. So, for example 2631 2632@example 2633cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo 2634@end example 2635 2636@noindent 2637should just work (unless the password changes on the 2638server side, in which case you'll have to re-run 2639@code{cvs login}). 2640 2641Note that if the @samp{:pserver:} were not present in 2642the repository specification, @sc{cvs} would assume it 2643should use @code{rsh} to connect with the server 2644instead (@pxref{Connecting via rsh}). 2645 2646Of course, once you have a working copy checked out and 2647are running @sc{cvs} commands from within it, there is 2648no longer any need to specify the repository 2649explicitly, because @sc{cvs} can deduce the repository 2650from the working copy's @file{CVS} subdirectory. 2651 2652@c FIXME: seems to me this needs somewhat more 2653@c explanation. 2654@cindex Logout (subcommand) 2655The password for a given remote repository can be 2656removed from the @code{CVS_PASSFILE} by using the 2657@code{cvs logout} command. 2658 2659@node Password authentication security 2660@subsubsection Security considerations with password authentication 2661 2662@cindex Security, of pserver 2663The passwords are stored on the client side in a 2664trivial encoding of the cleartext, and transmitted in 2665the same encoding. The encoding is done only to 2666prevent inadvertent password compromises (i.e., a 2667system administrator accidentally looking at the file), 2668and will not prevent even a naive attacker from gaining 2669the password. 2670 2671@c FIXME: The bit about "access to the repository 2672@c implies general access to the system is *not* specific 2673@c to pserver; it applies to kerberos and SSH and 2674@c everything else too. Should reorganize the 2675@c documentation to make this clear. 2676The separate @sc{cvs} password file (@pxref{Password 2677authentication server}) allows people 2678to use a different password for repository access than 2679for login access. On the other hand, once a user has 2680non-read-only 2681access to the repository, she can execute programs on 2682the server system through a variety of means. Thus, repository 2683access implies fairly broad system access as well. It 2684might be possible to modify @sc{cvs} to prevent that, 2685but no one has done so as of this writing. 2686@c OpenBSD uses chroot() and copies the repository to 2687@c provide anonymous read-only access (for details see 2688@c http://www.openbsd.org/anoncvs.shar). While this 2689@c closes the most obvious holes, I'm not sure it 2690@c closes enough holes to recommend it (plus it is 2691@c *very* easy to accidentally screw up a setup of this 2692@c type). 2693 2694Note that because the @file{$CVSROOT/CVSROOT} directory 2695contains @file{passwd} and other files which are used 2696to check security, you must control the permissions on 2697this directory as tightly as the permissions on 2698@file{/etc}. The same applies to the @file{$CVSROOT} 2699directory itself and any directory 2700above it in the tree. Anyone who has write access to 2701such a directory will have the ability to become any 2702user on the system. Note that these permissions are 2703typically tighter than you would use if you are not 2704using pserver. 2705@c TODO: Would be really nice to document/implement a 2706@c scheme where the CVS server can run as some non-root 2707@c user, e.g. "cvs". CVSROOT/passwd would contain a 2708@c bunch of entries of the form foo:xxx:cvs (or the "cvs" 2709@c would be implicit). This would greatly reduce 2710@c security risks such as those hinted at in the 2711@c previous paragraph. I think minor changes to CVS 2712@c might be required but mostly this would just need 2713@c someone who wants to play with it, document it, &c. 2714 2715In summary, anyone who gets the password gets 2716repository access (which may imply some measure of general system 2717access as well). The password is available to anyone 2718who can sniff network packets or read a protected 2719(i.e., user read-only) file. If you want real 2720security, get Kerberos. 2721 2722@node GSSAPI authenticated 2723@subsection Direct connection with GSSAPI 2724 2725@cindex GSSAPI 2726@cindex Security, GSSAPI 2727@cindex :gserver:, setting up 2728@cindex Kerberos, using :gserver: 2729GSSAPI is a generic interface to network security 2730systems such as Kerberos 5. 2731If you have a working GSSAPI library, you can have 2732@sc{cvs} connect via a direct @sc{tcp} connection, 2733authenticating with GSSAPI. 2734 2735To do this, @sc{cvs} needs to be compiled with GSSAPI 2736support; when configuring @sc{cvs} it tries to detect 2737whether GSSAPI libraries using Kerberos version 5 are 2738present. You can also use the @file{--with-gssapi} 2739flag to configure. 2740 2741The connection is authenticated using GSSAPI, but the 2742message stream is @emph{not} authenticated by default. 2743You must use the @code{-a} global option to request 2744stream authentication. 2745 2746The data transmitted is @emph{not} encrypted by 2747default. Encryption support must be compiled into both 2748the client and the server; use the 2749@file{--enable-encrypt} configure option to turn it on. 2750You must then use the @code{-x} global option to 2751request encryption. 2752 2753GSSAPI connections are handled on the server side by 2754the same server which handles the password 2755authentication server; see @ref{Password authentication 2756server}. If you are using a GSSAPI mechanism such as 2757Kerberos which provides for strong authentication, you 2758will probably want to disable the ability to 2759authenticate via cleartext passwords. To do so, create 2760an empty @file{CVSROOT/passwd} password file, and set 2761@code{SystemAuth=no} in the config file 2762(@pxref{config}). 2763 2764The GSSAPI server uses a principal name of 2765cvs/@var{hostname}, where @var{hostname} is the 2766canonical name of the server host. You will have to 2767set this up as required by your GSSAPI mechanism. 2768 2769To connect using GSSAPI, use the @samp{:gserver:} method. For 2770example, 2771 2772@example 2773cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo 2774@end example 2775 2776@node Kerberos authenticated 2777@subsection Direct connection with Kerberos 2778 2779@cindex Kerberos, using :kserver: 2780@cindex Security, Kerberos 2781@cindex :kserver:, setting up 2782The easiest way to use Kerberos is to use the Kerberos 2783@code{rsh}, as described in @ref{Connecting via rsh}. 2784The main disadvantage of using rsh is that all the data 2785needs to pass through additional programs, so it may be 2786slower. So if you have Kerberos installed you can 2787connect via a direct @sc{tcp} connection, 2788authenticating with Kerberos. 2789 2790This section concerns the Kerberos network security 2791system, version 4. Kerberos version 5 is supported via 2792the GSSAPI generic network security interface, as 2793described in the previous section. 2794 2795To do this, @sc{cvs} needs to be compiled with Kerberos 2796support; when configuring @sc{cvs} it tries to detect 2797whether Kerberos is present or you can use the 2798@file{--with-krb4} flag to configure. 2799 2800The data transmitted is @emph{not} encrypted by 2801default. Encryption support must be compiled into both 2802the client and server; use the 2803@file{--enable-encryption} configure option to turn it 2804on. You must then use the @code{-x} global option to 2805request encryption. 2806 2807@cindex CVS_CLIENT_PORT 2808You need to edit @file{inetd.conf} on the server 2809machine to run @code{cvs kserver}. The client uses 2810port 1999 by default; if you want to use another port 2811specify it in the @code{CVSROOT} (@pxref{Remote repositories}) 2812or the @code{CVS_CLIENT_PORT} environment variable 2813(@pxref{Environment variables}) on the client. 2814 2815@cindex kinit 2816When you want to use @sc{cvs}, get a ticket in the 2817usual way (generally @code{kinit}); it must be a ticket 2818which allows you to log into the server machine. Then 2819you are ready to go: 2820 2821@example 2822cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo 2823@end example 2824 2825Previous versions of @sc{cvs} would fall back to a 2826connection via rsh; this version will not do so. 2827 2828@node Connecting via fork 2829@subsection Connecting with fork 2830 2831@cindex fork, access method 2832@cindex :fork:, setting up 2833This access method allows you to connect to a 2834repository on your local disk via the remote protocol. 2835In other words it does pretty much the same thing as 2836@code{:local:}, but various quirks, bugs and the like are 2837those of the remote @sc{cvs} rather than the local 2838@sc{cvs}. 2839 2840For day-to-day operations you might prefer either 2841@code{:local:} or @code{:fork:}, depending on your 2842preferences. Of course @code{:fork:} comes in 2843particularly handy in testing or 2844debugging @code{cvs} and the remote protocol. 2845Specifically, we avoid all of the network-related 2846setup/configuration, timeouts, and authentication 2847inherent in the other remote access methods but still 2848create a connection which uses the remote protocol. 2849 2850To connect using the @code{fork} method, use 2851@samp{:fork:} and the pathname to your local 2852repository. For example: 2853 2854@example 2855cvs -d :fork:/usr/local/cvsroot checkout foo 2856@end example 2857 2858@cindex CVS_SERVER, and :fork: 2859As with @code{:ext:}, the server is called @samp{cvs} 2860by default, or the value of the @code{CVS_SERVER} 2861environment variable. 2862 2863@c --------------------------------------------------------------------- 2864@node Read-only access 2865@section Read-only repository access 2866@cindex Read-only repository access 2867@cindex readers (admin file) 2868@cindex writers (admin file) 2869 2870 It is possible to grant read-only repository 2871access to people using the password-authenticated 2872server (@pxref{Password authenticated}). (The 2873other access methods do not have explicit support for 2874read-only users because those methods all assume login 2875access to the repository machine anyway, and therefore 2876the user can do whatever local file permissions allow 2877her to do.) 2878 2879 A user who has read-only access can do only 2880those @sc{cvs} operations which do not modify the 2881repository, except for certain ``administrative'' files 2882(such as lock files and the history file). It may be 2883desirable to use this feature in conjunction with 2884user-aliasing (@pxref{Password authentication server}). 2885 2886Unlike with previous versions of @sc{cvs}, read-only 2887users should be able merely to read the repository, and 2888not to execute programs on the server or otherwise gain 2889unexpected levels of access. Or to be more accurate, 2890the @emph{known} holes have been plugged. Because this 2891feature is new and has not received a comprehensive 2892security audit, you should use whatever level of 2893caution seems warranted given your attitude concerning 2894security. 2895 2896 There are two ways to specify read-only access 2897for a user: by inclusion, and by exclusion. 2898 2899 "Inclusion" means listing that user 2900specifically in the @file{$CVSROOT/CVSROOT/readers} 2901file, which is simply a newline-separated list of 2902users. Here is a sample @file{readers} file: 2903 2904@example 2905melissa 2906splotnik 2907jrandom 2908@end example 2909 2910@noindent 2911 (Don't forget the newline after the last user.) 2912 2913 "Exclusion" means explicitly listing everyone 2914who has @emph{write} access---if the file 2915 2916@example 2917$CVSROOT/CVSROOT/writers 2918@end example 2919 2920@noindent 2921exists, then only 2922those users listed in it have write access, and 2923everyone else has read-only access (of course, even the 2924read-only users still need to be listed in the 2925@sc{cvs} @file{passwd} file). The 2926@file{writers} file has the same format as the 2927@file{readers} file. 2928 2929 Note: if your @sc{cvs} @file{passwd} 2930file maps cvs users onto system users (@pxref{Password 2931authentication server}), make sure you deny or grant 2932read-only access using the @emph{cvs} usernames, not 2933the system usernames. That is, the @file{readers} and 2934@file{writers} files contain cvs usernames, which may 2935or may not be the same as system usernames. 2936 2937 Here is a complete description of the server's 2938behavior in deciding whether to grant read-only or 2939read-write access: 2940 2941 If @file{readers} exists, and this user is 2942listed in it, then she gets read-only access. Or if 2943@file{writers} exists, and this user is NOT listed in 2944it, then she also gets read-only access (this is true 2945even if @file{readers} exists but she is not listed 2946there). Otherwise, she gets full read-write access. 2947 2948 Of course there is a conflict if the user is 2949listed in both files. This is resolved in the more 2950conservative way, it being better to protect the 2951repository too much than too little: such a user gets 2952read-only access. 2953 2954@node Server temporary directory 2955@section Temporary directories for the server 2956@cindex Temporary directories, and server 2957@cindex Server, temporary directories 2958 2959While running, the @sc{cvs} server creates temporary 2960directories. They are named 2961 2962@example 2963cvs-serv@var{pid} 2964@end example 2965 2966@noindent 2967where @var{pid} is the process identification number of 2968the server. 2969They are located in the directory specified by 2970the @samp{-T} global option (@pxref{Global options}), 2971the @code{TMPDIR} environment variable (@pxref{Environment variables}), 2972or, failing that, @file{/tmp}. 2973 2974In most cases the server will remove the temporary 2975directory when it is done, whether it finishes normally 2976or abnormally. However, there are a few cases in which 2977the server does not or cannot remove the temporary 2978directory, for example: 2979 2980@itemize @bullet 2981@item 2982If the server aborts due to an internal server error, 2983it may preserve the directory to aid in debugging 2984 2985@item 2986If the server is killed in a way that it has no way of 2987cleaning up (most notably, @samp{kill -KILL} on unix). 2988 2989@item 2990If the system shuts down without an orderly shutdown, 2991which tells the server to clean up. 2992@end itemize 2993 2994In cases such as this, you will need to manually remove 2995the @file{cvs-serv@var{pid}} directories. As long as 2996there is no server running with process identification 2997number @var{pid}, it is safe to do so. 2998 2999@c --------------------------------------------------------------------- 3000@node Starting a new project 3001@chapter Starting a project with CVS 3002@cindex Starting a project with CVS 3003@cindex Creating a project 3004 3005@comment --moduledb-- 3006Because renaming files and moving them between 3007directories is somewhat inconvenient, the first thing 3008you do when you start a new project should be to think 3009through your file organization. It is not impossible 3010to rename or move files, but it does increase the 3011potential for confusion and @sc{cvs} does have some 3012quirks particularly in the area of renaming 3013directories. @xref{Moving files}. 3014 3015What to do next depends on the situation at hand. 3016 3017@menu 3018* Setting up the files:: Getting the files into the repository 3019* Defining the module:: How to make a module of the files 3020@end menu 3021@c -- File permissions! 3022 3023@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3024@node Setting up the files 3025@section Setting up the files 3026 3027The first step is to create the files inside the repository. This can 3028be done in a couple of different ways. 3029 3030@c -- The contributed scripts 3031@menu 3032* From files:: This method is useful with old projects 3033 where files already exists. 3034* From other version control systems:: Old projects where you want to 3035 preserve history from another system. 3036* From scratch:: Creating a directory tree from scratch. 3037@end menu 3038 3039@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3040@node From files 3041@subsection Creating a directory tree from a number of files 3042@cindex Importing files 3043 3044When you begin using @sc{cvs}, you will probably already have several 3045projects that can be 3046put under @sc{cvs} control. In these cases the easiest way is to use the 3047@code{import} command. An example is probably the easiest way to 3048explain how to use it. If the files you want to install in 3049@sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the 3050repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this: 3051 3052@example 3053$ cd @var{wdir} 3054$ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start 3055@end example 3056 3057Unless you supply a log message with the @samp{-m} 3058flag, @sc{cvs} starts an editor and prompts for a 3059message. The string @samp{yoyo} is a @dfn{vendor tag}, 3060and @samp{start} is a @dfn{release tag}. They may fill 3061no purpose in this context, but since @sc{cvs} requires 3062them they must be present. @xref{Tracking sources}, for 3063more information about them. 3064 3065You can now verify that it worked, and remove your 3066original source directory. 3067@c FIXME: Need to say more about "verify that it 3068@c worked". What should the user look for in the output 3069@c from "diff -r"? 3070 3071@example 3072$ cd .. 3073$ cvs checkout yoyodyne/@var{rdir} # @r{Explanation below} 3074$ diff -r @var{wdir} yoyodyne/@var{rdir} 3075$ rm -r @var{wdir} 3076@end example 3077 3078@noindent 3079Erasing the original sources is a good idea, to make sure that you do 3080not accidentally edit them in @var{wdir}, bypassing @sc{cvs}. 3081Of course, it would be wise to make sure that you have 3082a backup of the sources before you remove them. 3083 3084The @code{checkout} command can either take a module 3085name as argument (as it has done in all previous 3086examples) or a path name relative to @code{$CVSROOT}, 3087as it did in the example above. 3088 3089It is a good idea to check that the permissions 3090@sc{cvs} sets on the directories inside @code{$CVSROOT} 3091are reasonable, and that they belong to the proper 3092groups. @xref{File permissions}. 3093 3094If some of the files you want to import are binary, you 3095may want to use the wrappers features to specify which 3096files are binary and which are not. @xref{Wrappers}. 3097 3098@c The node name is too long, but I am having trouble 3099@c thinking of something more concise. 3100@node From other version control systems 3101@subsection Creating Files From Other Version Control Systems 3102@cindex Importing files, from other version control systems 3103 3104If you have a project which you are maintaining with 3105another version control system, such as @sc{rcs}, you 3106may wish to put the files from that project into 3107@sc{cvs}, and preserve the revision history of the 3108files. 3109 3110@table @asis 3111@cindex RCS, importing files from 3112@item From RCS 3113If you have been using @sc{rcs}, find the @sc{rcs} 3114files---usually a file named @file{foo.c} will have its 3115@sc{rcs} file in @file{RCS/foo.c,v} (but it could be 3116other places; consult the @sc{rcs} documentation for 3117details). Then create the appropriate directories in 3118@sc{cvs} if they do not already exist. Then copy the 3119files into the appropriate directories in the @sc{cvs} 3120repository (the name in the repository must be the name 3121of the source file with @samp{,v} added; the files go 3122directly in the appropriate directory of the repository, 3123not in an @file{RCS} subdirectory). This is one of the 3124few times when it is a good idea to access the @sc{cvs} 3125repository directly, rather than using @sc{cvs} 3126commands. Then you are ready to check out a new 3127working directory. 3128@c Someday there probably should be a "cvs import -t 3129@c rcs" or some such. It could even create magic 3130@c branches. It could also do something about the case 3131@c where the RCS file had a (non-magic) "0" branch. 3132 3133The @sc{rcs} file should not be locked when you move it 3134into @sc{cvs}; if it is, @sc{cvs} will have trouble 3135letting you operate on it. 3136@c What is the easiest way to unlock your files if you 3137@c have them locked? Especially if you have a lot of them? 3138@c This is a CVS bug/misfeature; importing RCS files 3139@c should ignore whether they are locked and leave them in 3140@c an unlocked state. Yet another reason for a separate 3141@c "import RCS file" command. 3142 3143@c How many is "many"? Or do they just import RCS files? 3144@item From another version control system 3145Many version control systems have the ability to export 3146@sc{rcs} files in the standard format. If yours does, 3147export the @sc{rcs} files and then follow the above 3148instructions. 3149 3150Failing that, probably your best bet is to write a 3151script that will check out the files one revision at a 3152time using the command line interface to the other 3153system, and then check the revisions into @sc{cvs}. 3154The @file{sccs2rcs} script mentioned below may be a 3155useful example to follow. 3156 3157@cindex SCCS, importing files from 3158@item From SCCS 3159There is a script in the @file{contrib} directory of 3160the @sc{cvs} source distribution called @file{sccs2rcs} 3161which converts @sc{sccs} files to @sc{rcs} files. 3162Note: you must run it on a machine which has both 3163@sc{sccs} and @sc{rcs} installed, and like everything 3164else in contrib it is unsupported (your mileage may 3165vary). 3166 3167@cindex PVCS, importing files from 3168@item From PVCS 3169There is a script in the @file{contrib} directory of 3170the @sc{cvs} source distribution called @file{pvcs_to_rcs} 3171which converts @sc{pvcs} archives to @sc{rcs} files. 3172You must run it on a machine which has both 3173@sc{pvcs} and @sc{rcs} installed, and like everything 3174else in contrib it is unsupported (your mileage may 3175vary). See the comments in the script for details. 3176@end table 3177@c CMZ and/or PATCHY were systems that were used in the 3178@c high energy physics community (especially for 3179@c CERNLIB). CERN has replaced them with CVS, but the 3180@c CAR format seems to live on as a way to submit 3181@c changes. There is a program car2cvs which converts 3182@c but I'm not sure where one gets a copy. 3183@c Not sure it is worth mentioning here, since it would 3184@c appear to affect only one particular community. 3185@c Best page for more information is: 3186@c http://wwwcn1.cern.ch/asd/cvs/index.html 3187@c See also: 3188@c http://ecponion.cern.ch/ecpsa/cernlib.html 3189 3190@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3191@node From scratch 3192@subsection Creating a directory tree from scratch 3193 3194@c Also/instead should be documenting 3195@c $ cvs co -l . 3196@c $ mkdir tc 3197@c $ cvs add tc 3198@c $ cd tc 3199@c $ mkdir man 3200@c $ cvs add man 3201@c etc. 3202@c Using import to create the directories only is 3203@c probably a somewhat confusing concept. 3204For a new project, the easiest thing to do is probably 3205to create an empty directory structure, like this: 3206 3207@example 3208$ mkdir tc 3209$ mkdir tc/man 3210$ mkdir tc/testing 3211@end example 3212 3213After that, you use the @code{import} command to create 3214the corresponding (empty) directory structure inside 3215the repository: 3216 3217@example 3218$ cd tc 3219$ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start 3220@end example 3221 3222This will add yoyodyne/@var{dir} as a directory under 3223@code{$CVSROOT}. 3224 3225Use @code{checkout} to get the new project. Then, use @code{add} 3226to add files (and new directories) as needed. 3227 3228@example 3229$ cd .. 3230$ cvs co yoyodyne/@var{dir} 3231@end example 3232 3233Check that the permissions @sc{cvs} sets on the 3234directories inside @code{$CVSROOT} are reasonable. 3235 3236@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3237@node Defining the module 3238@section Defining the module 3239@cindex Defining a module 3240@cindex Editing the modules file 3241@cindex Module, defining 3242@cindex Modules file, changing 3243 3244The next step is to define the module in the 3245@file{modules} file. This is not strictly necessary, 3246but modules can be convenient in grouping together 3247related files and directories. 3248 3249In simple cases these steps are sufficient to define a module. 3250 3251@enumerate 3252@item 3253Get a working copy of the modules file. 3254 3255@example 3256$ cvs checkout CVSROOT/modules 3257$ cd CVSROOT 3258@end example 3259 3260@item 3261Edit the file and insert a line that defines the module. @xref{Intro 3262administrative files}, for an introduction. @xref{modules}, for a full 3263description of the modules file. You can use the 3264following line to define the module @samp{tc}: 3265 3266@example 3267tc yoyodyne/tc 3268@end example 3269 3270@item 3271Commit your changes to the modules file. 3272 3273@example 3274$ cvs commit -m "Added the tc module." modules 3275@end example 3276 3277@item 3278Release the modules module. 3279 3280@example 3281$ cd .. 3282$ cvs release -d CVSROOT 3283@end example 3284@end enumerate 3285 3286@c --------------------------------------------------------------------- 3287@node Revisions 3288@chapter Revisions 3289 3290For many uses of @sc{cvs}, one doesn't need to worry 3291too much about revision numbers; @sc{cvs} assigns 3292numbers such as @code{1.1}, @code{1.2}, and so on, and 3293that is all one needs to know. However, some people 3294prefer to have more knowledge and control concerning 3295how @sc{cvs} assigns revision numbers. 3296 3297If one wants to keep track of a set of revisions 3298involving more than one file, such as which revisions 3299went into a particular release, one uses a @dfn{tag}, 3300which is a symbolic revision which can be assigned to a 3301numeric revision in each file. 3302 3303@menu 3304* Revision numbers:: The meaning of a revision number 3305* Versions revisions releases:: Terminology used in this manual 3306* Assigning revisions:: Assigning revisions 3307* Tags:: Tags--Symbolic revisions 3308* Tagging the working directory:: The cvs tag command 3309* Tagging by date/tag:: The cvs rtag command 3310* Modifying tags:: Adding, renaming, and deleting tags 3311* Tagging add/remove:: Tags with adding and removing files 3312* Sticky tags:: Certain tags are persistent 3313@end menu 3314 3315@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3316@node Revision numbers 3317@section Revision numbers 3318@cindex Revision numbers 3319@cindex Revision tree 3320@cindex Linear development 3321@cindex Number, revision- 3322@cindex Decimal revision number 3323@cindex Branch number 3324@cindex Number, branch 3325 3326Each version of a file has a unique @dfn{revision 3327number}. Revision numbers look like @samp{1.1}, 3328@samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}. 3329A revision number always has an even number of 3330period-separated decimal integers. By default revision 33311.1 is the first revision of a file. Each successive 3332revision is given a new number by increasing the 3333rightmost number by one. The following figure displays 3334a few revisions, with newer revisions to the right. 3335 3336@example 3337 +-----+ +-----+ +-----+ +-----+ +-----+ 3338 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 3339 +-----+ +-----+ +-----+ +-----+ +-----+ 3340@end example 3341 3342It is also possible to end up with numbers containing 3343more than one period, for example @samp{1.3.2.2}. Such 3344revisions represent revisions on branches 3345(@pxref{Branching and merging}); such revision numbers 3346are explained in detail in @ref{Branches and 3347revisions}. 3348 3349@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3350@node Versions revisions releases 3351@section Versions, revisions and releases 3352@cindex Revisions, versions and releases 3353@cindex Versions, revisions and releases 3354@cindex Releases, revisions and versions 3355 3356A file can have several versions, as described above. 3357Likewise, a software product can have several versions. 3358A software product is often given a version number such 3359as @samp{4.1.1}. 3360 3361Versions in the first sense are called @dfn{revisions} 3362in this document, and versions in the second sense are 3363called @dfn{releases}. To avoid confusion, the word 3364@dfn{version} is almost never used in this document. 3365 3366@node Assigning revisions 3367@section Assigning revisions 3368 3369@c We avoid the "major revision" terminology. It seems 3370@c like jargon. Hopefully "first number" is clear enough. 3371By default, @sc{cvs} will assign numeric revisions by 3372leaving the first number the same and incrementing the 3373second number. For example, @code{1.1}, @code{1.2}, 3374@code{1.3}, etc. 3375 3376When adding a new file, the second number will always 3377be one and the first number will equal the highest 3378first number of any file in that directory. For 3379example, the current directory contains files whose 3380highest numbered revisions are @code{1.7}, @code{3.1}, 3381and @code{4.12}, then an added file will be given the 3382numeric revision @code{4.1}. 3383(When using client/server @sc{cvs}, 3384only files that are actually sent to the server are considered.) 3385 3386@c This is sort of redundant with something we said a 3387@c while ago. Somewhere we need a better way of 3388@c introducing how the first number can be anything 3389@c except "1", perhaps. Also I don't think this 3390@c presentation is clear on why we are discussing releases 3391@c and first numbers of numeric revisions in the same 3392@c breath. 3393Normally there is no reason to care 3394about the revision numbers---it is easier to treat them 3395as internal numbers that @sc{cvs} maintains, and tags 3396provide a better way to distinguish between things like 3397release 1 versus release 2 of your product 3398(@pxref{Tags}). However, if you want to set the 3399numeric revisions, the @samp{-r} option to @code{cvs 3400commit} can do that. The @samp{-r} option implies the 3401@samp{-f} option, in the sense that it causes the 3402files to be committed even if they are not modified. 3403 3404For example, to bring all your files up to 3405revision 3.0 (including those that haven't changed), 3406you might invoke: 3407 3408@example 3409$ cvs commit -r 3.0 3410@end example 3411 3412Note that the number you specify with @samp{-r} must be 3413larger than any existing revision number. That is, if 3414revision 3.0 exists, you cannot @samp{cvs commit 3415-r 1.3}. If you want to maintain several releases in 3416parallel, you need to use a branch (@pxref{Branching and merging}). 3417 3418@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3419@node Tags 3420@section Tags--Symbolic revisions 3421@cindex Tags 3422 3423The revision numbers live a life of their own. They 3424need not have anything at all to do with the release 3425numbers of your software product. Depending 3426on how you use @sc{cvs} the revision numbers might change several times 3427between two releases. As an example, some of the 3428source files that make up @sc{rcs} 5.6 have the following 3429revision numbers: 3430@cindex RCS revision numbers 3431 3432@example 3433ci.c 5.21 3434co.c 5.9 3435ident.c 5.3 3436rcs.c 5.12 3437rcsbase.h 5.11 3438rcsdiff.c 5.10 3439rcsedit.c 5.11 3440rcsfcmp.c 5.9 3441rcsgen.c 5.10 3442rcslex.c 5.11 3443rcsmap.c 5.2 3444rcsutil.c 5.10 3445@end example 3446 3447@cindex tag, command, introduction 3448@cindex Tag, symbolic name 3449@cindex Symbolic name (tag) 3450@cindex Name, symbolic (tag) 3451@cindex HEAD, as reserved tag name 3452@cindex BASE, as reserved tag name 3453You can use the @code{tag} command to give a symbolic name to a 3454certain revision of a file. You can use the @samp{-v} flag to the 3455@code{status} command to see all tags that a file has, and 3456which revision numbers they represent. Tag names must 3457start with an uppercase or lowercase letter and can 3458contain uppercase and lowercase letters, digits, 3459@samp{-}, and @samp{_}. The two tag names @code{BASE} 3460and @code{HEAD} are reserved for use by @sc{cvs}. It 3461is expected that future names which are special to 3462@sc{cvs} will be specially named, for example by 3463starting with @samp{.}, rather than being named analogously to 3464@code{BASE} and @code{HEAD}, to avoid conflicts with 3465actual tag names. 3466@c Including a character such as % or = has also been 3467@c suggested as the naming convention for future 3468@c special tag names. Starting with . is nice because 3469@c that is not a legal tag name as far as RCS is concerned. 3470@c FIXME: CVS actually accepts quite a few characters 3471@c in tag names, not just the ones documented above 3472@c (see RCS_check_tag). RCS 3473@c defines legitimate tag names by listing illegal 3474@c characters rather than legal ones. CVS is said to lose its 3475@c mind if you try to use "/" (try making such a tag sticky 3476@c and using "cvs status" client/server--see remote 3477@c protocol format for entries line for probable cause). 3478@c TODO: The testsuite 3479@c should test for whatever are documented above as 3480@c officially-OK tag names, and CVS should at least reject 3481@c characters that won't work, like "/". 3482 3483You'll want to choose some convention for naming tags, 3484based on information such as the name of the program 3485and the version number of the release. For example, 3486one might take the name of the program, immediately 3487followed by the version number with @samp{.} changed to 3488@samp{-}, so that @sc{cvs} 1.9 would be tagged with the name 3489@code{cvs1-9}. If you choose a consistent convention, 3490then you won't constantly be guessing whether a tag is 3491@code{cvs-1-9} or @code{cvs1_9} or what. You might 3492even want to consider enforcing your convention in the 3493@file{taginfo} file (@pxref{taginfo}). 3494@c Might be nice to say more about using taginfo this 3495@c way, like giving an example, or pointing out any particular 3496@c issues which arise. 3497 3498@cindex Adding a tag 3499@cindex Tag, example 3500The following example shows how you can add a tag to a 3501file. The commands must be issued inside your working 3502directory. That is, you should issue the 3503command in the directory where @file{backend.c} 3504resides. 3505 3506@example 3507$ cvs tag rel-0-4 backend.c 3508T backend.c 3509$ cvs status -v backend.c 3510=================================================================== 3511File: backend.c Status: Up-to-date 3512 3513 Version: 1.4 Tue Dec 1 14:39:01 1992 3514 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 3515 Sticky Tag: (none) 3516 Sticky Date: (none) 3517 Sticky Options: (none) 3518 3519 Existing Tags: 3520 rel-0-4 (revision: 1.4) 3521 3522@end example 3523 3524For a complete summary of the syntax of @code{cvs tag}, 3525including the various options, see @ref{Invoking CVS}. 3526 3527There is seldom reason to tag a file in isolation. A more common use is 3528to tag all the files that constitute a module with the same tag at 3529strategic points in the development life-cycle, such as when a release 3530is made. 3531 3532@example 3533$ cvs tag rel-1-0 . 3534cvs tag: Tagging . 3535T Makefile 3536T backend.c 3537T driver.c 3538T frontend.c 3539T parser.c 3540@end example 3541 3542@noindent 3543(When you give @sc{cvs} a directory as argument, it generally applies the 3544operation to all the files in that directory, and (recursively), to any 3545subdirectories that it may contain. @xref{Recursive behavior}.) 3546 3547@cindex Retrieving an old revision using tags 3548@cindex Tag, retrieving old revisions 3549The @code{checkout} command has a flag, @samp{-r}, that lets you check out 3550a certain revision of a module. This flag makes it easy to 3551retrieve the sources that make up release 1.0 of the module @samp{tc} at 3552any time in the future: 3553 3554@example 3555$ cvs checkout -r rel-1-0 tc 3556@end example 3557 3558@noindent 3559This is useful, for instance, if someone claims that there is a bug in 3560that release, but you cannot find the bug in the current working copy. 3561 3562You can also check out a module as it was at any given date. 3563@xref{checkout options}. When specifying @samp{-r} to 3564any of these commands, you will need beware of sticky 3565tags; see @ref{Sticky tags}. 3566 3567When you tag more than one file with the same tag you 3568can think about the tag as "a curve drawn through a 3569matrix of filename vs.@: revision number." Say we have 5 3570files with the following revisions: 3571 3572@example 3573@group 3574 file1 file2 file3 file4 file5 3575 3576 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG 3577 1.2*- 1.2 1.2 -1.2*- 3578 1.3 \- 1.3*- 1.3 / 1.3 3579 1.4 \ 1.4 / 1.4 3580 \-1.5*- 1.5 3581 1.6 3582@end group 3583@end example 3584 3585At some time in the past, the @code{*} versions were tagged. 3586You can think of the tag as a handle attached to the curve 3587drawn through the tagged revisions. When you pull on 3588the handle, you get all the tagged revisions. Another 3589way to look at it is that you "sight" through a set of 3590revisions that is "flat" along the tagged revisions, 3591like this: 3592 3593@example 3594@group 3595 file1 file2 file3 file4 file5 3596 3597 1.1 3598 1.2 3599 1.1 1.3 _ 3600 1.1 1.2 1.4 1.1 / 3601 1.2*----1.3*----1.5*----1.2*----1.1 (--- <--- Look here 3602 1.3 1.6 1.3 \_ 3603 1.4 1.4 3604 1.5 3605@end group 3606@end example 3607 3608@node Tagging the working directory 3609@section Specifying what to tag from the working directory 3610 3611@cindex tag (subcommand) 3612The example in the previous section demonstrates one of 3613the most common ways to choose which revisions to tag. 3614Namely, running the @code{cvs tag} command without 3615arguments causes @sc{cvs} to select the revisions which 3616are checked out in the current working directory. For 3617example, if the copy of @file{backend.c} in working 3618directory was checked out from revision 1.4, then 3619@sc{cvs} will tag revision 1.4. Note that the tag is 3620applied immediately to revision 1.4 in the repository; 3621tagging is not like modifying a file, or other 3622operations in which one first modifies the working 3623directory and then runs @code{cvs commit} to transfer 3624that modification to the repository. 3625 3626One potentially surprising aspect of the fact that 3627@code{cvs tag} operates on the repository is that you 3628are tagging the checked-in revisions, which may differ 3629from locally modified files in your working directory. 3630If you want to avoid doing this by mistake, specify the 3631@samp{-c} option to @code{cvs tag}. If there are any 3632locally modified files, @sc{cvs} will abort with an 3633error before it tags any files: 3634 3635@example 3636$ cvs tag -c rel-0-4 3637cvs tag: backend.c is locally modified 3638cvs [tag aborted]: correct the above errors first! 3639@end example 3640 3641@node Tagging by date/tag 3642@section Specifying what to tag by date or revision 3643@cindex rtag (subcommand) 3644 3645The @code{cvs rtag} command tags the repository as of a 3646certain date or time (or can be used to tag the latest 3647revision). @code{rtag} works directly on the 3648repository contents (it requires no prior checkout and 3649does not look for a working directory). 3650 3651The following options specify which date or revision to 3652tag. See @ref{Common options}, for a complete 3653description of them. 3654 3655@table @code 3656@item -D @var{date} 3657Tag the most recent revision no later than @var{date}. 3658 3659@item -f 3660Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}} 3661flags. If no matching revision is found, use the most 3662recent revision (instead of ignoring the file). 3663 3664@item -r @var{tag} 3665Only tag those files that contain existing tag @var{tag}. 3666@end table 3667 3668The @code{cvs tag} command also allows one to specify 3669files by revision or date, using the same @samp{-r}, 3670@samp{-D}, and @samp{-f} options. However, this 3671feature is probably not what you want. The reason is 3672that @code{cvs tag} chooses which files to tag based on 3673the files that exist in the working directory, rather 3674than the files which existed as of the given tag/date. 3675Therefore, you are generally better off using @code{cvs 3676rtag}. The exceptions might be cases like: 3677 3678@example 3679cvs tag -r 1.4 backend.c 3680@end example 3681 3682@node Modifying tags 3683@section Deleting, moving, and renaming tags 3684 3685@c Also see: 3686@c "How do I move or rename a magic branch tag?" 3687@c in the FAQ (I think the issues it talks about still 3688@c apply, but this could use some sanity.sh work). 3689 3690Normally one does not modify tags. They exist in order 3691to record the history of the repository and so deleting 3692them or changing their meaning would, generally, not be 3693what you want. 3694 3695However, there might be cases in which one uses a tag 3696temporarily or accidentally puts one in the wrong 3697place. Therefore, one might delete, move, or rename a 3698tag. 3699 3700@noindent 3701@strong{WARNING: The commands in this section are 3702dangerous; they permanently discard historical 3703information and it can be difficult or impossible to 3704recover from errors. If you are a @sc{cvs} 3705administrator, you may consider restricting these 3706commands with the @file{taginfo} file (@pxref{taginfo}).} 3707 3708@cindex Deleting tags 3709@cindex Deleting branch tags 3710@cindex Removing tags 3711@cindex Removing branch tags 3712@cindex Tags, deleting 3713@cindex Branch tags, deleting 3714To delete a tag, specify the @samp{-d} option to either 3715@code{cvs tag} or @code{cvs rtag}. For example: 3716 3717@example 3718cvs rtag -d rel-0-4 tc 3719@end example 3720 3721@noindent 3722deletes the non-branch tag @code{rel-0-4} from the module @code{tc}. 3723In the event that branch tags are encountered within the repository 3724with the given name, a warning message will be issued and the branch 3725tag will not be deleted. If you are absolutely certain you know what 3726you are doing, the @code{-B} option may be specified to allow deletion 3727of branch tags. In that case, any non-branch tags encountered will 3728trigger warnings and will not be deleted. 3729 3730@noindent 3731@strong{WARNING: Moving branch tags is very dangerous! If you think 3732you need the @code{-B} option, think again and ask your @sc{cvs} 3733administrator about it (if that isn't you). There is almost certainly 3734another way to accomplish what you want to accomplish.} 3735 3736@cindex Moving tags 3737@cindex Moving branch tags 3738@cindex Tags, moving 3739@cindex Branch tags, moving 3740When we say @dfn{move} a tag, we mean to make the same 3741name point to different revisions. For example, the 3742@code{stable} tag may currently point to revision 1.4 3743of @file{backend.c} and perhaps we want to make it 3744point to revision 1.6. To move a non-branch tag, specify the 3745@samp{-F} option to either @code{cvs tag} or @code{cvs 3746rtag}. For example, the task just mentioned might be 3747accomplished as: 3748 3749@example 3750cvs tag -r 1.6 -F stable backend.c 3751@end example 3752 3753@noindent 3754If any branch tags are encountered in the repository 3755with the given name, a warning is issued and the branch 3756tag is not disturbed. If you are absolutely certain you 3757wish to move the branch tag, the @code{-B} option may be specified. 3758In that case, non-branch tags encountered with the given 3759name are ignored with a warning message. 3760 3761@noindent 3762@strong{WARNING: Moving branch tags is very dangerous! If you think you 3763need the @code{-B} option, think again and ask your @sc{cvs} 3764administrator about it (if that isn't you). There is almost certainly 3765another way to accomplish what you want to accomplish.} 3766 3767@cindex Renaming tags 3768@cindex Tags, renaming 3769When we say @dfn{rename} a tag, we mean to make a 3770different name point to the same revisions as the old 3771tag. For example, one may have misspelled the tag name 3772and want to correct it (hopefully before others are 3773relying on the old spelling). To rename a tag, first 3774create a new tag using the @samp{-r} option to 3775@code{cvs rtag}, and then delete the old name. (Caution: 3776this method will not work with branch tags.) 3777This leaves the new tag on exactly the 3778same files as the old tag. For example: 3779 3780@example 3781cvs rtag -r old-name-0-4 rel-0-4 tc 3782cvs rtag -d old-name-0-4 tc 3783@end example 3784 3785@node Tagging add/remove 3786@section Tagging and adding and removing files 3787 3788The subject of exactly how tagging interacts with 3789adding and removing files is somewhat obscure; for the 3790most part @sc{cvs} will keep track of whether files 3791exist or not without too much fussing. By default, 3792tags are applied to only files which have a revision 3793corresponding to what is being tagged. Files which did 3794not exist yet, or which were already removed, simply 3795omit the tag, and @sc{cvs} knows to treat the absence 3796of a tag as meaning that the file didn't exist as of 3797that tag. 3798 3799However, this can lose a small amount of information. 3800For example, suppose a file was added and then removed. 3801Then, if the tag is missing for that file, there is no 3802way to know whether the tag refers to the time before 3803the file was added, or the time after it was removed. 3804If you specify the @samp{-r} option to @code{cvs rtag}, 3805then @sc{cvs} tags the files which have been removed, 3806and thereby avoids this problem. For example, one 3807might specify @code{-r HEAD} to tag the head. 3808 3809On the subject of adding and removing files, the 3810@code{cvs rtag} command has a @samp{-a} option which 3811means to clear the tag from removed files that would 3812not otherwise be tagged. For example, one might 3813specify this option in conjunction with @samp{-F} when 3814moving a tag. If one moved a tag without @samp{-a}, 3815then the tag in the removed files might still refer to 3816the old revision, rather than reflecting the fact that 3817the file had been removed. I don't think this is 3818necessary if @samp{-r} is specified, as noted above. 3819 3820@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3821@node Sticky tags 3822@section Sticky tags 3823@cindex Sticky tags 3824@cindex Tags, sticky 3825 3826@c A somewhat related issue is per-directory sticky 3827@c tags (see comment at CVS/Tag in node Working 3828@c directory storage); we probably want to say 3829@c something like "you can set a sticky tag for only 3830@c some files, but you don't want to" or some such. 3831 3832Sometimes a working copy's revision has extra data 3833associated with it, for example it might be on a branch 3834(@pxref{Branching and merging}), or restricted to 3835versions prior to a certain date by @samp{checkout -D} 3836or @samp{update -D}. Because this data persists -- 3837that is, it applies to subsequent commands in the 3838working copy -- we refer to it as @dfn{sticky}. 3839 3840Most of the time, stickiness is an obscure aspect of 3841@sc{cvs} that you don't need to think about. However, 3842even if you don't want to use the feature, you may need 3843to know @emph{something} about sticky tags (for 3844example, how to avoid them!). 3845 3846You can use the @code{status} command to see if any 3847sticky tags or dates are set: 3848 3849@example 3850$ cvs status driver.c 3851=================================================================== 3852File: driver.c Status: Up-to-date 3853 3854 Version: 1.7.2.1 Sat Dec 5 19:35:03 1992 3855 RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v 3856 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 3857 Sticky Date: (none) 3858 Sticky Options: (none) 3859 3860@end example 3861 3862@cindex Resetting sticky tags 3863@cindex Sticky tags, resetting 3864@cindex Deleting sticky tags 3865The sticky tags will remain on your working files until 3866you delete them with @samp{cvs update -A}. The 3867@samp{-A} option merges local changes into the version of the 3868file from the head of the trunk, removing any sticky tags, 3869dates, or options (other than sticky @samp{-k} options on locally 3870modified files). See @ref{update} for more on the operation 3871of @code{cvs update}. 3872 3873@cindex Sticky date 3874The most common use of sticky tags is to identify which 3875branch one is working on, as described in 3876@ref{Accessing branches}. However, non-branch 3877sticky tags have uses as well. For example, 3878suppose that you want to avoid updating your working 3879directory, to isolate yourself from possibly 3880destabilizing changes other people are making. You 3881can, of course, just refrain from running @code{cvs 3882update}. But if you want to avoid updating only a 3883portion of a larger tree, then sticky tags can help. 3884If you check out a certain revision (such as 1.4) it 3885will become sticky. Subsequent @code{cvs update} 3886commands will 3887not retrieve the latest revision until you reset the 3888tag with @code{cvs update -A}. Likewise, use of the 3889@samp{-D} option to @code{update} or @code{checkout} 3890sets a @dfn{sticky date}, which, similarly, causes that 3891date to be used for future retrievals. 3892 3893People often want to retrieve an old version of 3894a file without setting a sticky tag. This can 3895be done with the @samp{-p} option to @code{checkout} or 3896@code{update}, which sends the contents of the file to 3897standard output. For example: 3898@example 3899$ cvs update -p -r 1.1 file1 >file1 3900=================================================================== 3901Checking out file1 3902RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v 3903VERS: 1.1 3904*************** 3905$ 3906@end example 3907 3908However, this isn't the easiest way, if you are asking 3909how to undo a previous checkin (in this example, put 3910@file{file1} back to the way it was as of revision 39111.1). In that case you are better off using the 3912@samp{-j} option to @code{update}; for further 3913discussion see @ref{Merging two revisions}. 3914 3915@c --------------------------------------------------------------------- 3916@node Branching and merging 3917@chapter Branching and merging 3918@cindex Branching 3919@cindex Merging 3920@cindex Copying changes 3921@cindex Main trunk and branches 3922@cindex Revision tree, making branches 3923@cindex Branches, copying changes between 3924@cindex Changes, copying between branches 3925@cindex Modifications, copying between branches 3926 3927@sc{cvs} allows you to isolate changes onto a separate 3928line of development, known as a @dfn{branch}. When you 3929change files on a branch, those changes do not appear 3930on the main trunk or other branches. 3931 3932Later you can move changes from one branch to another 3933branch (or the main trunk) by @dfn{merging}. Merging 3934involves first running @code{cvs update -j}, to merge 3935the changes into the working directory. 3936You can then commit that revision, and thus effectively 3937copy the changes onto another branch. 3938 3939@menu 3940* Branches motivation:: What branches are good for 3941* Creating a branch:: Creating a branch 3942* Accessing branches:: Checking out and updating branches 3943* Branches and revisions:: Branches are reflected in revision numbers 3944* Magic branch numbers:: Magic branch numbers 3945* Merging a branch:: Merging an entire branch 3946* Merging more than once:: Merging from a branch several times 3947* Merging two revisions:: Merging differences between two revisions 3948* Merging adds and removals:: What if files are added or removed? 3949* Merging and keywords:: Avoiding conflicts due to keyword substitution 3950@end menu 3951 3952@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3953@node Branches motivation 3954@section What branches are good for 3955@cindex Branches motivation 3956@cindex What branches are good for 3957@cindex Motivation for branches 3958 3959@c FIXME: this node mentions one way to use branches, 3960@c but it is by no means the only way. For example, 3961@c the technique of committing a new feature on a branch, 3962@c until it is ready for the main trunk. The whole 3963@c thing is generally speaking more akin to the 3964@c "Revision management" node although it isn't clear to 3965@c me whether policy matters should be centralized or 3966@c distributed throughout the relevant sections. 3967Suppose that release 1.0 of tc has been made. You are continuing to 3968develop tc, planning to create release 1.1 in a couple of months. After a 3969while your customers start to complain about a fatal bug. You check 3970out release 1.0 (@pxref{Tags}) and find the bug 3971(which turns out to have a trivial fix). However, the current revision 3972of the sources are in a state of flux and are not expected to be stable 3973for at least another month. There is no way to make a 3974bug fix release based on the newest sources. 3975 3976The thing to do in a situation like this is to create a @dfn{branch} on 3977the revision trees for all the files that make up 3978release 1.0 of tc. You can then make 3979modifications to the branch without disturbing the main trunk. When the 3980modifications are finished you can elect to either incorporate them on 3981the main trunk, or leave them on the branch. 3982 3983@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3984@node Creating a branch 3985@section Creating a branch 3986@cindex Creating a branch 3987@cindex Branch, creating a 3988@cindex tag, creating a branch using 3989@cindex rtag, creating a branch using 3990 3991You can create a branch with @code{tag -b}; for 3992example, assuming you're in a working copy: 3993 3994@example 3995$ cvs tag -b rel-1-0-patches 3996@end example 3997 3998@c FIXME: we should be more explicit about the value of 3999@c having a tag on the branchpoint. For example 4000@c "cvs tag rel-1-0-patches-branchpoint" before 4001@c the "cvs tag -b". This points out that 4002@c rel-1-0-patches is a pretty awkward name for 4003@c this example (more so than for the rtag example 4004@c below). 4005 4006This splits off a branch based on the current revisions 4007in the working copy, assigning that branch the name 4008@samp{rel-1-0-patches}. 4009 4010It is important to understand that branches get created 4011in the repository, not in the working copy. Creating a 4012branch based on current revisions, as the above example 4013does, will @emph{not} automatically switch the working 4014copy to be on the new branch. For information on how 4015to do that, see @ref{Accessing branches}. 4016 4017You can also create a branch without reference to any 4018working copy, by using @code{rtag}: 4019 4020@example 4021$ cvs rtag -b -r rel-1-0 rel-1-0-patches tc 4022@end example 4023 4024@samp{-r rel-1-0} says that this branch should be 4025rooted at the revision that 4026corresponds to the tag @samp{rel-1-0}. It need not 4027be the most recent revision -- it's often useful to 4028split a branch off an old revision (for example, when 4029fixing a bug in a past release otherwise known to be 4030stable). 4031 4032As with @samp{tag}, the @samp{-b} flag tells 4033@code{rtag} to create a branch (rather than just a 4034symbolic revision name). Note that the numeric 4035revision number that matches @samp{rel-1-0} will 4036probably be different from file to file. 4037 4038So, the full effect of the command is to create a new 4039branch -- named @samp{rel-1-0-patches} -- in module 4040@samp{tc}, rooted in the revision tree at the point tagged 4041by @samp{rel-1-0}. 4042 4043@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4044@node Accessing branches 4045@section Accessing branches 4046@cindex Check out a branch 4047@cindex Retrieve a branch 4048@cindex Access a branch 4049@cindex Identifying a branch 4050@cindex Branch, check out 4051@cindex Branch, retrieving 4052@cindex Branch, accessing 4053@cindex Branch, identifying 4054 4055You can retrieve a branch in one of two ways: by 4056checking it out fresh from the repository, or by 4057switching an existing working copy over to the branch. 4058 4059To check out a branch from the repository, invoke 4060@samp{checkout} with the @samp{-r} flag, followed by 4061the tag name of the branch (@pxref{Creating a branch}): 4062 4063@example 4064$ cvs checkout -r rel-1-0-patches tc 4065@end example 4066 4067Or, if you already have a working copy, you can switch 4068it to a given branch with @samp{update -r}: 4069 4070@example 4071$ cvs update -r rel-1-0-patches tc 4072@end example 4073 4074@noindent 4075or equivalently: 4076 4077@example 4078$ cd tc 4079$ cvs update -r rel-1-0-patches 4080@end example 4081 4082It does not matter if the working copy was originally 4083on the main trunk or on some other branch -- the above 4084command will switch it to the named branch. And 4085similarly to a regular @samp{update} command, 4086@samp{update -r} merges any changes you have made, 4087notifying you of conflicts where they occur. 4088 4089Once you have a working copy tied to a particular 4090branch, it remains there until you tell it otherwise. 4091This means that changes checked in from the working 4092copy will add new revisions on that branch, while 4093leaving the main trunk and other branches unaffected. 4094 4095@cindex Branches, sticky 4096To find out what branch a working copy is on, you can 4097use the @samp{status} command. In its output, look for 4098the field named @samp{Sticky tag} (@pxref{Sticky tags}) 4099-- that's @sc{cvs}'s way of telling you the branch, if 4100any, of the current working files: 4101 4102@example 4103$ cvs status -v driver.c backend.c 4104=================================================================== 4105File: driver.c Status: Up-to-date 4106 4107 Version: 1.7 Sat Dec 5 18:25:54 1992 4108 RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v 4109 Sticky Tag: rel-1-0-patches (branch: 1.7.2) 4110 Sticky Date: (none) 4111 Sticky Options: (none) 4112 4113 Existing Tags: 4114 rel-1-0-patches (branch: 1.7.2) 4115 rel-1-0 (revision: 1.7) 4116 4117=================================================================== 4118File: backend.c Status: Up-to-date 4119 4120 Version: 1.4 Tue Dec 1 14:39:01 1992 4121 RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v 4122 Sticky Tag: rel-1-0-patches (branch: 1.4.2) 4123 Sticky Date: (none) 4124 Sticky Options: (none) 4125 4126 Existing Tags: 4127 rel-1-0-patches (branch: 1.4.2) 4128 rel-1-0 (revision: 1.4) 4129 rel-0-4 (revision: 1.4) 4130 4131@end example 4132 4133Don't be confused by the fact that the branch numbers 4134for each file are different (@samp{1.7.2} and 4135@samp{1.4.2} respectively). The branch tag is the 4136same, @samp{rel-1-0-patches}, and the files are 4137indeed on the same branch. The numbers simply reflect 4138the point in each file's revision history at which the 4139branch was made. In the above example, one can deduce 4140that @samp{driver.c} had been through more changes than 4141@samp{backend.c} before this branch was created. 4142 4143See @ref{Branches and revisions} for details about how 4144branch numbers are constructed. 4145 4146@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4147@node Branches and revisions 4148@section Branches and revisions 4149@cindex Branch number 4150@cindex Number, branch 4151@cindex Revision numbers (branches) 4152 4153Ordinarily, a file's revision history is a linear 4154series of increments (@pxref{Revision numbers}): 4155 4156@example 4157 +-----+ +-----+ +-----+ +-----+ +-----+ 4158 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! 4159 +-----+ +-----+ +-----+ +-----+ +-----+ 4160@end example 4161 4162However, @sc{cvs} is not limited to linear development. The 4163@dfn{revision tree} can be split into @dfn{branches}, 4164where each branch is a self-maintained line of 4165development. Changes made on one branch can easily be 4166moved back to the main trunk. 4167 4168Each branch has a @dfn{branch number}, consisting of an 4169odd number of period-separated decimal integers. The 4170branch number is created by appending an integer to the 4171revision number where the corresponding branch forked 4172off. Having branch numbers allows more than one branch 4173to be forked off from a certain revision. 4174 4175@need 3500 4176All revisions on a branch have revision numbers formed 4177by appending an ordinal number to the branch number. 4178The following figure illustrates branching with an 4179example. 4180 4181@example 4182@c This example used to have a 1.2.2.4 revision, which 4183@c might help clarify that development can continue on 4184@c 1.2.2. Might be worth reinstating if it can be done 4185@c without overfull hboxes. 4186@group 4187 +-------------+ 4188 Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 ! 4189 / +-------------+ 4190 / 4191 / 4192 +---------+ +---------+ +---------+ 4193Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4194 / +---------+ +---------+ +---------+ 4195 / 4196 / 4197+-----+ +-----+ +-----+ +-----+ +-----+ 4198! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4199+-----+ +-----+ +-----+ +-----+ +-----+ 4200 ! 4201 ! 4202 ! +---------+ +---------+ +---------+ 4203Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 ! 4204 +---------+ +---------+ +---------+ 4205 4206@end group 4207@end example 4208 4209@c -- However, at least for me the figure is not enough. I suggest more 4210@c -- text to accompany it. "A picture is worth a thousand words", so you 4211@c -- have to make sure the reader notices the couple of hundred words 4212@c -- *you* had in mind more than the others! 4213 4214@c -- Why an even number of segments? This section implies that this is 4215@c -- how the main trunk is distinguished from branch roots, but you never 4216@c -- explicitly say that this is the purpose of the [by itself rather 4217@c -- surprising] restriction to an even number of segments. 4218 4219The exact details of how the branch number is 4220constructed is not something you normally need to be 4221concerned about, but here is how it works: When 4222@sc{cvs} creates a branch number it picks the first 4223unused even integer, starting with 2. So when you want 4224to create a branch from revision 6.4 it will be 4225numbered 6.4.2. All branch numbers ending in a zero 4226(such as 6.4.0) are used internally by @sc{cvs} 4227(@pxref{Magic branch numbers}). The branch 1.1.1 has a 4228special meaning. @xref{Tracking sources}. 4229 4230@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4231@node Magic branch numbers 4232@section Magic branch numbers 4233 4234@c Want xref to here from "log"? 4235 4236This section describes a @sc{cvs} feature called 4237@dfn{magic branches}. For most purposes, you need not 4238worry about magic branches; @sc{cvs} handles them for 4239you. However, they are visible to you in certain 4240circumstances, so it may be useful to have some idea of 4241how it works. 4242 4243Externally, branch numbers consist of an odd number of 4244dot-separated decimal integers. @xref{Revision 4245numbers}. That is not the whole truth, however. For 4246efficiency reasons @sc{cvs} sometimes inserts an extra 0 4247in the second rightmost position (1.2.4 becomes 42481.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so 4249on). 4250 4251@sc{cvs} does a pretty good job at hiding these so 4252called magic branches, but in a few places the hiding 4253is incomplete: 4254 4255@itemize @bullet 4256@ignore 4257@c This is in ignore as I'm taking their word for it, 4258@c that this was fixed 4259@c a long time ago. But before deleting this 4260@c entirely, I'd rather verify it (and add a test 4261@c case to the testsuite). 4262@item 4263The magic branch can appear in the output from 4264@code{cvs status} in vanilla @sc{cvs} 1.3. This is 4265fixed in @sc{cvs} 1.3-s2. 4266 4267@end ignore 4268@item 4269The magic branch number appears in the output from 4270@code{cvs log}. 4271@c What output should appear instead? 4272 4273@item 4274You cannot specify a symbolic branch name to @code{cvs 4275admin}. 4276 4277@end itemize 4278 4279@c Can CVS do this automatically the first time 4280@c you check something in to that branch? Should 4281@c it? 4282You can use the @code{admin} command to reassign a 4283symbolic name to a branch the way @sc{rcs} expects it 4284to be. If @code{R4patches} is assigned to the branch 42851.4.2 (magic branch number 1.4.0.2) in file 4286@file{numbers.c} you can do this: 4287 4288@example 4289$ cvs admin -NR4patches:1.4.2 numbers.c 4290@end example 4291 4292It only works if at least one revision is already 4293committed on the branch. Be very careful so that you 4294do not assign the tag to the wrong number. (There is 4295no way to see how the tag was assigned yesterday). 4296 4297@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4298@node Merging a branch 4299@section Merging an entire branch 4300@cindex Merging a branch 4301@cindex -j (merging branches) 4302 4303You can merge changes made on a branch into your working copy by giving 4304the @samp{-j @var{branchname}} flag to the @code{update} subcommand. With one 4305@samp{-j @var{branchname}} option it merges the changes made between the 4306greatest common ancestor (GCA) of the branch and the destination revision (in 4307the simple case below the GCA is the point where the branch forked) and the 4308newest revision on that branch into your working copy. 4309 4310@cindex Join 4311The @samp{-j} stands for ``join''. 4312 4313@cindex Branch merge example 4314@cindex Example, branch merge 4315@cindex Merge, branch example 4316Consider this revision tree: 4317 4318@example 4319+-----+ +-----+ +-----+ +-----+ 4320! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk 4321+-----+ +-----+ +-----+ +-----+ 4322 ! 4323 ! 4324 ! +---------+ +---------+ 4325Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4326 +---------+ +---------+ 4327@end example 4328 4329@noindent 4330The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}. The 4331following example assumes that the module @samp{mod} contains only one 4332file, @file{m.c}. 4333 4334@example 4335$ cvs checkout mod # @r{Retrieve the latest revision, 1.4} 4336 4337$ cvs update -j R1fix m.c # @r{Merge all changes made on the branch,} 4338 # @r{i.e. the changes between revision 1.2} 4339 # @r{and 1.2.2.2, into your working copy} 4340 # @r{of the file.} 4341 4342$ cvs commit -m "Included R1fix" # @r{Create revision 1.5.} 4343@end example 4344 4345A conflict can result from a merge operation. If that 4346happens, you should resolve it before committing the 4347new revision. @xref{Conflicts example}. 4348 4349If your source files contain keywords (@pxref{Keyword substitution}), 4350you might be getting more conflicts than strictly necessary. See 4351@ref{Merging and keywords}, for information on how to avoid this. 4352 4353The @code{checkout} command also supports the @samp{-j @var{branchname}} flag. The 4354same effect as above could be achieved with this: 4355 4356@example 4357$ cvs checkout -j R1fix mod 4358$ cvs commit -m "Included R1fix" 4359@end example 4360 4361It should be noted that @code{update -j @var{tagname}} will also work but may 4362not produce the desired result. @xref{Merging adds and removals}, for more. 4363 4364@node Merging more than once 4365@section Merging from a branch several times 4366 4367Continuing our example, the revision tree now looks 4368like this: 4369 4370@example 4371+-----+ +-----+ +-----+ +-----+ +-----+ 4372! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4373+-----+ +-----+ +-----+ +-----+ +-----+ 4374 ! * 4375 ! * 4376 ! +---------+ +---------+ 4377Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 ! 4378 +---------+ +---------+ 4379@end example 4380 4381@noindent 4382where the starred line represents the merge from the 4383@samp{R1fix} branch to the main trunk, as just 4384discussed. 4385 4386Now suppose that development continues on the 4387@samp{R1fix} branch: 4388 4389@example 4390+-----+ +-----+ +-----+ +-----+ +-----+ 4391! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk 4392+-----+ +-----+ +-----+ +-----+ +-----+ 4393 ! * 4394 ! * 4395 ! +---------+ +---------+ +---------+ 4396Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 ! 4397 +---------+ +---------+ +---------+ 4398@end example 4399 4400@noindent 4401and then you want to merge those new changes onto the 4402main trunk. If you just use the @code{cvs update -j 4403R1fix m.c} command again, @sc{cvs} will attempt to 4404merge again the changes which you have already merged, 4405which can have undesirable side effects. 4406 4407So instead you need to specify that you only want to 4408merge the changes on the branch which have not yet been 4409merged into the trunk. To do that you specify two 4410@samp{-j} options, and @sc{cvs} merges the changes from 4411the first revision to the second revision. For 4412example, in this case the simplest way would be 4413 4414@example 4415cvs update -j 1.2.2.2 -j R1fix m.c # @r{Merge changes from 1.2.2.2 to the} 4416 # @r{head of the R1fix branch} 4417@end example 4418 4419The problem with this is that you need to specify the 44201.2.2.2 revision manually. A slightly better approach 4421might be to use the date the last merge was done: 4422 4423@example 4424cvs update -j R1fix:yesterday -j R1fix m.c 4425@end example 4426 4427Better yet, tag the R1fix branch after every merge into 4428the trunk, and then use that tag for subsequent merges: 4429 4430@example 4431cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c 4432@end example 4433 4434@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4435@node Merging two revisions 4436@section Merging differences between any two revisions 4437@cindex Merging two revisions 4438@cindex Revisions, merging differences between 4439@cindex Differences, merging 4440 4441With two @samp{-j @var{revision}} flags, the @code{update} 4442(and @code{checkout}) command can merge the differences 4443between any two revisions into your working file. 4444 4445@cindex Undoing a change 4446@cindex Removing a change 4447@example 4448$ cvs update -j 1.5 -j 1.3 backend.c 4449@end example 4450 4451@noindent 4452will undo all changes made between revision 44531.3 and 1.5. Note the order of the revisions! 4454 4455If you try to use this option when operating on 4456multiple files, remember that the numeric revisions will 4457probably be very different between the various files. 4458You almost always use symbolic 4459tags rather than revision numbers when operating on 4460multiple files. 4461 4462@cindex Restoring old version of removed file 4463@cindex Resurrecting old version of dead file 4464Specifying two @samp{-j} options can also undo file 4465removals or additions. For example, suppose you have 4466a file 4467named @file{file1} which existed as revision 1.1, and 4468you then removed it (thus adding a dead revision 1.2). 4469Now suppose you want to add it again, with the same 4470contents it had previously. Here is how to do it: 4471 4472@example 4473$ cvs update -j 1.2 -j 1.1 file1 4474U file1 4475$ cvs commit -m test 4476Checking in file1; 4477/tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 4478new revision: 1.3; previous revision: 1.2 4479done 4480$ 4481@end example 4482 4483@node Merging adds and removals 4484@section Merging can add or remove files 4485 4486If the changes which you are merging involve removing 4487or adding some files, @code{update -j} will reflect 4488such additions or removals. 4489 4490@c FIXME: This example needs a lot more explanation. 4491@c We also need other examples for some of the other 4492@c cases (not all--there are too many--as long as we present a 4493@c coherent general principle). 4494For example: 4495@example 4496cvs update -A 4497touch a b c 4498cvs add a b c ; cvs ci -m "added" a b c 4499cvs tag -b branchtag 4500cvs update -r branchtag 4501touch d ; cvs add d 4502rm a ; cvs rm a 4503cvs ci -m "added d, removed a" 4504cvs update -A 4505cvs update -jbranchtag 4506@end example 4507 4508After these commands are executed and a @samp{cvs commit} is done, 4509file @file{a} will be removed and file @file{d} added in the main branch. 4510@c (which was determined by trying it) 4511 4512Note that using a single static tag (@samp{-j @var{tagname}}) 4513rather than a dynamic tag (@samp{-j @var{branchname}}) to merge 4514changes from a branch will usually not remove files which were removed on the 4515branch since @sc{cvs} does not automatically add static tags to dead revisions. 4516The exception to this rule occurs when 4517a static tag has been attached to a dead revision manually. Use the branch tag 4518to merge all changes from the branch or use two static tags as merge endpoints 4519to be sure that all intended changes are propagated in the merge. 4520 4521@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4522@node Merging and keywords 4523@section Merging and keywords 4524@cindex Merging, and keyword substitution 4525@cindex Keyword substitution, and merging 4526@cindex -j (merging branches), and keyword substitution 4527@cindex -kk, to avoid conflicts during a merge 4528 4529If you merge files containing keywords (@pxref{Keyword 4530substitution}), you will normally get numerous 4531conflicts during the merge, because the keywords are 4532expanded differently in the revisions which you are 4533merging. 4534 4535Therefore, you will often want to specify the 4536@samp{-kk} (@pxref{Substitution modes}) switch to the 4537merge command line. By substituting just the name of 4538the keyword, not the expanded value of that keyword, 4539this option ensures that the revisions which you are 4540merging will be the same as each other, and avoid 4541spurious conflicts. 4542 4543For example, suppose you have a file like this: 4544 4545@example 4546 +---------+ 4547 _! 1.1.2.1 ! <- br1 4548 / +---------+ 4549 / 4550 / 4551+-----+ +-----+ 4552! 1.1 !----! 1.2 ! 4553+-----+ +-----+ 4554@end example 4555 4556@noindent 4557and your working directory is currently on the trunk 4558(revision 1.2). Then you might get the following 4559results from a merge: 4560 4561@example 4562$ cat file1 4563key $@splitrcskeyword{Revision}: 1.2 $ 4564. . . 4565$ cvs update -j br1 4566U file1 4567RCS file: /cvsroot/first-dir/file1,v 4568retrieving revision 1.1 4569retrieving revision 1.1.2.1 4570Merging differences between 1.1 and 1.1.2.1 into file1 4571rcsmerge: warning: conflicts during merge 4572$ cat file1 4573@asis{}<<<<<<< file1 4574key $@splitrcskeyword{Revision}: 1.2 $ 4575@asis{}======= 4576key $@splitrcskeyword{Revision}: 1.1.2.1 $ 4577@asis{}>>>>>>> 1.1.2.1 4578. . . 4579@end example 4580 4581What happened was that the merge tried to merge the 4582differences between 1.1 and 1.1.2.1 into your working 4583directory. So, since the keyword changed from 4584@code{Revision: 1.1} to @code{Revision: 1.1.2.1}, 4585@sc{cvs} tried to merge that change into your working 4586directory, which conflicted with the fact that your 4587working directory had contained @code{Revision: 1.2}. 4588 4589Here is what happens if you had used @samp{-kk}: 4590 4591@example 4592$ cat file1 4593key $@splitrcskeyword{Revision}: 1.2 $ 4594. . . 4595$ cvs update -kk -j br1 4596U file1 4597RCS file: /cvsroot/first-dir/file1,v 4598retrieving revision 1.1 4599retrieving revision 1.1.2.1 4600Merging differences between 1.1 and 1.1.2.1 into file1 4601$ cat file1 4602key $@splitrcskeyword{Revision}$ 4603. . . 4604@end example 4605 4606What is going on here is that revision 1.1 and 1.1.2.1 4607both expand as plain @code{Revision}, and therefore 4608merging the changes between them into the working 4609directory need not change anything. Therefore, there 4610is no conflict. 4611 4612There is, however, one major caveat with using 4613@samp{-kk} on merges. Namely, it overrides whatever 4614keyword expansion mode @sc{cvs} would normally have 4615used. In particular, this is a problem if the mode had 4616been @samp{-kb} for a binary file. Therefore, if your 4617repository contains binary files, you will need to deal 4618with the conflicts rather than using @samp{-kk}. 4619 4620@ignore 4621The following seems rather confusing, possibly buggy, 4622and in general, in need of much more thought before it 4623is a recommended technique. For one thing, does it 4624apply on Windows as well as on Unix? 4625 4626Unchanged binary files will undergo the same keyword substitution 4627but will not be checked in on a subsequent 4628@code{cvs commit}. Be aware that binary files containing keyword 4629strings which are present in or below the working directory 4630will most likely remain corrupt until repaired, however. A simple 4631@code{cvs update -A} is sufficient to fix these otherwise unaltered binary files 4632if the merge is being done to the main branch but 4633this must be done after the merge has been committed or the merge itself 4634will be lost. 4635 4636For Example: 4637@example 4638cvs update -Akk -jbranchtag 4639cvs commit 4640cvs update -A 4641@end example 4642 4643@noindent 4644will update the current directory from the main trunk of the 4645repository, substituting the base keyword strings for keywords, 4646and merge changes made on the branch @samp{branchtag} into the new 4647work files, performing the same keyword substitution on that file set before 4648comparing the two sets. The final @code{cvs update -A} will restore any 4649corrupted binary files as well as resetting the sticky @samp{-kk} tags which 4650were present on the files in and below the working directory. 4651Unfortunately, this doesn't work as well with an arbitrary branch tag, as the 4652@samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk} 4653switches attached to the working files as @samp{-A} does. The workaround 4654for this is to release the working directory after the merge has been 4655committed and check it out again. 4656@end ignore 4657 4658As a result of using @samp{-kk} during the merge, each file examined by the 4659update will have @samp{-kk} set as sticky options. Running @code{update -A} 4660will clear the sticky options on unmodified files, but it will not clear 4661the sticky options on modified files. To get back to the default keyword 4662substitution for modified files, you must commit the results of the merge 4663and then run @code{update -A}. 4664 4665@c --------------------------------------------------------------------- 4666@node Recursive behavior 4667@chapter Recursive behavior 4668@cindex Recursive (directory descending) 4669@cindex Directory, descending 4670@cindex Descending directories 4671@cindex Subdirectories 4672 4673Almost all of the subcommands of @sc{cvs} work 4674recursively when you specify a directory as an 4675argument. For instance, consider this directory 4676structure: 4677 4678@example 4679 @code{$HOME} 4680 | 4681 +--@t{tc} 4682 | | 4683 +--@t{CVS} 4684 | (internal @sc{cvs} files) 4685 +--@t{Makefile} 4686 +--@t{backend.c} 4687 +--@t{driver.c} 4688 +--@t{frontend.c} 4689 +--@t{parser.c} 4690 +--@t{man} 4691 | | 4692 | +--@t{CVS} 4693 | | (internal @sc{cvs} files) 4694 | +--@t{tc.1} 4695 | 4696 +--@t{testing} 4697 | 4698 +--@t{CVS} 4699 | (internal @sc{cvs} files) 4700 +--@t{testpgm.t} 4701 +--@t{test2.t} 4702@end example 4703 4704@noindent 4705If @file{tc} is the current working directory, the 4706following is true: 4707 4708@itemize @bullet 4709@item 4710@samp{cvs update testing} is equivalent to 4711 4712@example 4713cvs update testing/testpgm.t testing/test2.t 4714@end example 4715 4716@item 4717@samp{cvs update testing man} updates all files in the 4718subdirectories 4719 4720@item 4721@samp{cvs update .} or just @samp{cvs update} updates 4722all files in the @code{tc} directory 4723@end itemize 4724 4725If no arguments are given to @code{update} it will 4726update all files in the current working directory and 4727all its subdirectories. In other words, @file{.} is a 4728default argument to @code{update}. This is also true 4729for most of the @sc{cvs} subcommands, not only the 4730@code{update} command. 4731 4732The recursive behavior of the @sc{cvs} subcommands can be 4733turned off with the @samp{-l} option. 4734Conversely, the @samp{-R} option can be used to force recursion if 4735@samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 4736 4737@example 4738$ cvs update -l # @r{Don't update files in subdirectories} 4739@end example 4740 4741@c --------------------------------------------------------------------- 4742@node Adding and removing 4743@chapter Adding, removing, and renaming files and directories 4744 4745In the course of a project, one will often add new 4746files. Likewise with removing or renaming, or with 4747directories. The general concept to keep in mind in 4748all these cases is that instead of making an 4749irreversible change you want @sc{cvs} to record the 4750fact that a change has taken place, just as with 4751modifying an existing file. The exact mechanisms to do 4752this in @sc{cvs} vary depending on the situation. 4753 4754@menu 4755* Adding files:: Adding files 4756* Removing files:: Removing files 4757* Removing directories:: Removing directories 4758* Moving files:: Moving and renaming files 4759* Moving directories:: Moving and renaming directories 4760@end menu 4761 4762@node Adding files 4763@section Adding files to a directory 4764@cindex Adding files 4765 4766To add a new file to a directory, follow these steps. 4767 4768@itemize @bullet 4769@item 4770You must have a working copy of the directory. 4771@xref{Getting the source}. 4772 4773@item 4774Create the new file inside your working copy of the directory. 4775 4776@item 4777Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you 4778want to version control the file. If the file contains 4779binary data, specify @samp{-kb} (@pxref{Binary files}). 4780 4781@item 4782Use @samp{cvs commit @var{filename}} to actually check 4783in the file into the repository. Other developers 4784cannot see the file until you perform this step. 4785@end itemize 4786 4787You can also use the @code{add} command to add a new 4788directory. 4789@c FIXCVS and/or FIXME: Adding a directory doesn't 4790@c require the commit step. This probably can be 4791@c considered a CVS bug, but it is possible we should 4792@c warn people since this behavior probably won't be 4793@c changing right away. 4794 4795Unlike most other commands, the @code{add} command is 4796not recursive. You have to explicitly name files and 4797directories that you wish to add to the repository. 4798However, each directory will need to be added 4799separately before you will be able to add new files 4800to those directories. 4801 4802@example 4803$ mkdir -p foo/bar 4804$ cp ~/myfile foo/bar/myfile 4805$ cvs add foo foo/bar 4806$ cvs add foo/bar/myfile 4807@end example 4808 4809@cindex add (subcommand) 4810@deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{} 4811 4812Schedule @var{files} to be added to the repository. 4813The files or directories specified with @code{add} must 4814already exist in the current directory. To add a whole 4815new directory hierarchy to the source repository (for 4816example, files received from a third-party vendor), use 4817the @code{import} command instead. @xref{import}. 4818 4819The added files are not placed in the source repository 4820until you use @code{commit} to make the change 4821permanent. Doing an @code{add} on a file that was 4822removed with the @code{remove} command will undo the 4823effect of the @code{remove}, unless a @code{commit} 4824command intervened. @xref{Removing files}, for an 4825example. 4826 4827The @samp{-k} option specifies the default way that 4828this file will be checked out; for more information see 4829@ref{Substitution modes}. 4830 4831@c As noted in BUGS, -m is broken client/server (Nov 4832@c 96). Also see testsuite log2-* tests. 4833The @samp{-m} option specifies a description for the 4834file. This description appears in the history log (if 4835it is enabled, @pxref{history file}). It will also be 4836saved in the version history inside the repository when 4837the file is committed. The @code{log} command displays 4838this description. The description can be changed using 4839@samp{admin -t}. @xref{admin}. If you omit the 4840@samp{-m @var{description}} flag, an empty string will 4841be used. You will not be prompted for a description. 4842@end deffn 4843 4844For example, the following commands add the file 4845@file{backend.c} to the repository: 4846 4847@c This example used to specify 4848@c -m "Optimizer and code generation passes." 4849@c to the cvs add command, but that doesn't work 4850@c client/server (see log2 in sanity.sh). Should fix CVS, 4851@c but also seems strange to document things which 4852@c don't work... 4853@example 4854$ cvs add backend.c 4855$ cvs commit -m "Early version. Not yet compilable." backend.c 4856@end example 4857 4858When you add a file it is added only on the branch 4859which you are working on (@pxref{Branching and merging}). You can 4860later merge the additions to another branch if you want 4861(@pxref{Merging adds and removals}). 4862@c Should we mention that earlier versions of CVS 4863@c lacked this feature (1.3) or implemented it in a buggy 4864@c way (well, 1.8 had many bugs in cvs update -j)? 4865@c Should we mention the bug/limitation regarding a 4866@c file being a regular file on one branch and a directory 4867@c on another? 4868@c FIXME: This needs an example, or several, here or 4869@c elsewhere, for it to make much sense. 4870@c Somewhere we need to discuss the aspects of death 4871@c support which don't involve branching, I guess. 4872@c Like the ability to re-create a release from a tag. 4873 4874@c --------------------------------------------------------------------- 4875@node Removing files 4876@section Removing files 4877@cindex Removing files 4878@cindex Deleting files 4879 4880@c FIXME: this node wants to be split into several 4881@c smaller nodes. Could make these children of 4882@c "Adding and removing", probably (death support could 4883@c be its own section, for example, as could the 4884@c various bits about undoing mistakes in adding and 4885@c removing). 4886Directories change. New files are added, and old files 4887disappear. Still, you want to be able to retrieve an 4888exact copy of old releases. 4889 4890Here is what you can do to remove a file, 4891but remain able to retrieve old revisions: 4892 4893@itemize @bullet 4894@c FIXME: should probably be saying something about 4895@c having a working directory in the first place. 4896@item 4897Make sure that you have not made any uncommitted 4898modifications to the file. @xref{Viewing differences}, 4899for one way to do that. You can also use the 4900@code{status} or @code{update} command. If you remove 4901the file without committing your changes, you will of 4902course not be able to retrieve the file as it was 4903immediately before you deleted it. 4904 4905@item 4906Remove the file from your working copy of the directory. 4907You can for instance use @code{rm}. 4908 4909@item 4910Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that 4911you really want to delete the file. 4912 4913@item 4914Use @samp{cvs commit @var{filename}} to actually 4915perform the removal of the file from the repository. 4916@end itemize 4917 4918@c FIXME: Somehow this should be linked in with a more 4919@c general discussion of death support. I don't know 4920@c whether we want to use the term "death support" or 4921@c not (we can perhaps get by without it), but we do 4922@c need to discuss the "dead" state in "cvs log" and 4923@c related subjects. The current discussion is 4924@c scattered around, and not xref'd to each other. 4925@c FIXME: I think this paragraph wants to be moved 4926@c later down, at least after the first example. 4927When you commit the removal of the file, @sc{cvs} 4928records the fact that the file no longer exists. It is 4929possible for a file to exist on only some branches and 4930not on others, or to re-add another file with the same 4931name later. @sc{cvs} will correctly create or not create 4932the file, based on the @samp{-r} and @samp{-D} options 4933specified to @code{checkout} or @code{update}. 4934 4935@c FIXME: This style seems to clash with how we 4936@c document things in general. 4937@cindex Remove (subcommand) 4938@deffn Command {cvs remove} [options] files @dots{} 4939 4940Schedule file(s) to be removed from the repository 4941(files which have not already been removed from the 4942working directory are not processed). This command 4943does not actually remove the file from the repository 4944until you commit the removal. For a full list of 4945options, see @ref{Invoking CVS}. 4946@end deffn 4947 4948Here is an example of removing several files: 4949 4950@example 4951$ cd test 4952$ rm *.c 4953$ cvs remove 4954cvs remove: Removing . 4955cvs remove: scheduling a.c for removal 4956cvs remove: scheduling b.c for removal 4957cvs remove: use 'cvs commit' to remove these files permanently 4958$ cvs ci -m "Removed unneeded files" 4959cvs commit: Examining . 4960cvs commit: Committing . 4961@end example 4962 4963As a convenience you can remove the file and @code{cvs 4964remove} it in one step, by specifying the @samp{-f} 4965option. For example, the above example could also be 4966done like this: 4967 4968@example 4969$ cd test 4970$ cvs remove -f *.c 4971cvs remove: scheduling a.c for removal 4972cvs remove: scheduling b.c for removal 4973cvs remove: use 'cvs commit' to remove these files permanently 4974$ cvs ci -m "Removed unneeded files" 4975cvs commit: Examining . 4976cvs commit: Committing . 4977@end example 4978 4979If you execute @code{remove} for a file, and then 4980change your mind before you commit, you can undo the 4981@code{remove} with an @code{add} command. 4982@ignore 4983@c is this worth saying or not? Somehow it seems 4984@c confusing to me. 4985Of course, 4986since you have removed your copy of file in the working 4987directory, @sc{cvs} does not necessarily bring back the 4988contents of the file from right before you executed 4989@code{remove}; instead it gets the file from the 4990repository again. 4991@end ignore 4992 4993@c FIXME: what if you change your mind after you commit 4994@c it? (answer is also "cvs add" but we don't say that...). 4995@c We need some index entries for thinks like "undoing 4996@c removal" too. 4997 4998@example 4999$ ls 5000CVS ja.h oj.c 5001$ rm oj.c 5002$ cvs remove oj.c 5003cvs remove: scheduling oj.c for removal 5004cvs remove: use 'cvs commit' to remove this file permanently 5005$ cvs add oj.c 5006U oj.c 5007cvs add: oj.c, version 1.1.1.1, resurrected 5008@end example 5009 5010If you realize your mistake before you run the 5011@code{remove} command you can use @code{update} to 5012resurrect the file: 5013 5014@example 5015$ rm oj.c 5016$ cvs update oj.c 5017cvs update: warning: oj.c was lost 5018U oj.c 5019@end example 5020 5021When you remove a file it is removed only on the branch 5022which you are working on (@pxref{Branching and merging}). You can 5023later merge the removals to another branch if you want 5024(@pxref{Merging adds and removals}). 5025 5026@node Removing directories 5027@section Removing directories 5028@cindex Removing directories 5029@cindex Directories, removing 5030 5031In concept, removing directories is somewhat similar to 5032removing files---you want the directory to not exist in 5033your current working directories, but you also want to 5034be able to retrieve old releases in which the directory 5035existed. 5036 5037The way that you remove a directory is to remove all 5038the files in it. You don't remove the directory 5039itself; there is no way to do that. 5040Instead you specify the @samp{-P} option to 5041@code{cvs update} or @code{cvs checkout}, 5042which will cause @sc{cvs} to remove empty 5043directories from working directories. 5044(Note that @code{cvs export} always removes empty directories.) 5045Probably the 5046best way to do this is to always specify @samp{-P}; if 5047you want an empty directory then put a dummy file (for 5048example @file{.keepme}) in it to prevent @samp{-P} from 5049removing it. 5050 5051@c I'd try to give a rationale for this, but I'm not 5052@c sure there is a particularly convincing one. What 5053@c we would _like_ is for CVS to do a better job of version 5054@c controlling whether directories exist, to eliminate the 5055@c need for -P and so that a file can be a directory in 5056@c one revision and a regular file in another. 5057Note that @samp{-P} is implied by the @samp{-r} or @samp{-D} 5058options of @code{checkout}. This way, 5059@sc{cvs} will be able to correctly create the directory 5060or not depending on whether the particular version you 5061are checking out contains any files in that directory. 5062 5063@c --------------------------------------------------------------------- 5064@node Moving files 5065@section Moving and renaming files 5066@cindex Moving files 5067@cindex Renaming files 5068@cindex Files, moving 5069 5070Moving files to a different directory or renaming them 5071is not difficult, but some of the ways in which this 5072works may be non-obvious. (Moving or renaming a 5073directory is even harder. @xref{Moving directories}.). 5074 5075The examples below assume that the file @var{old} is renamed to 5076@var{new}. 5077 5078@menu 5079* Outside:: The normal way to Rename 5080* Inside:: A tricky, alternative way 5081* Rename by copying:: Another tricky, alternative way 5082@end menu 5083 5084@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5085@node Outside 5086@subsection The Normal way to Rename 5087 5088@c More rename issues. Not sure whether these are 5089@c worth documenting; I'm putting them here because 5090@c it seems to be as good a place as any to try to 5091@c set down the issues. 5092@c * "cvs annotate" will annotate either the new 5093@c file or the old file; it cannot annotate _each 5094@c line_ based on whether it was last changed in the 5095@c new or old file. Unlike "cvs log", where the 5096@c consequences of having to select either the new 5097@c or old name seem fairly benign, this may be a 5098@c real advantage to having CVS know about renames 5099@c other than as a deletion and an addition. 5100 5101The normal way to move a file is to copy @var{old} to 5102@var{new}, and then issue the normal @sc{cvs} commands 5103to remove @var{old} from the repository, and add 5104@var{new} to it. 5105@c The following sentence is not true: one must cd into 5106@c the directory to run "cvs add". 5107@c (Both @var{old} and @var{new} could 5108@c contain relative paths, for example @file{foo/bar.c}). 5109 5110@example 5111$ mv @var{old} @var{new} 5112$ cvs remove @var{old} 5113$ cvs add @var{new} 5114$ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new} 5115@end example 5116 5117This is the simplest way to move a file, it is not 5118error-prone, and it preserves the history of what was 5119done. Note that to access the history of the file you 5120must specify the old or the new name, depending on what 5121portion of the history you are accessing. For example, 5122@code{cvs log @var{old}} will give the log up until the 5123time of the rename. 5124 5125When @var{new} is committed its revision numbers will 5126start again, usually at 1.1, so if that bothers you, 5127use the @samp{-r rev} option to commit. For more 5128information see @ref{Assigning revisions}. 5129 5130@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5131@node Inside 5132@subsection Moving the history file 5133 5134This method is more dangerous, since it involves moving 5135files inside the repository. Read this entire section 5136before trying it out! 5137 5138@example 5139$ cd $CVSROOT/@var{dir} 5140$ mv @var{old},v @var{new},v 5141@end example 5142 5143@noindent 5144Advantages: 5145 5146@itemize @bullet 5147@item 5148The log of changes is maintained intact. 5149 5150@item 5151The revision numbers are not affected. 5152@end itemize 5153 5154@noindent 5155Disadvantages: 5156 5157@itemize @bullet 5158@item 5159Old releases cannot easily be fetched from the 5160repository. (The file will show up as @var{new} even 5161in revisions from the time before it was renamed). 5162 5163@item 5164There is no log information of when the file was renamed. 5165 5166@item 5167Nasty things might happen if someone accesses the history file 5168while you are moving it. Make sure no one else runs any of the @sc{cvs} 5169commands while you move it. 5170@end itemize 5171 5172@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5173@node Rename by copying 5174@subsection Copying the history file 5175 5176This way also involves direct modifications to the 5177repository. It is safe, but not without drawbacks. 5178 5179@example 5180# @r{Copy the @sc{rcs} file inside the repository} 5181$ cd $CVSROOT/@var{dir} 5182$ cp @var{old},v @var{new},v 5183# @r{Remove the old file} 5184$ cd ~/@var{dir} 5185$ rm @var{old} 5186$ cvs remove @var{old} 5187$ cvs commit @var{old} 5188# @r{Remove all tags from @var{new}} 5189$ cvs update @var{new} 5190$ cvs log @var{new} # @r{Remember the non-branch tag names} 5191$ cvs tag -d @var{tag1} @var{new} 5192$ cvs tag -d @var{tag2} @var{new} 5193@dots{} 5194@end example 5195 5196By removing the tags you will be able to check out old 5197revisions. 5198 5199@noindent 5200Advantages: 5201 5202@itemize @bullet 5203@item 5204@c FIXME: Is this true about -D now that we have death 5205@c support? See 5B.3 in the FAQ. 5206Checking out old revisions works correctly, as long as 5207you use @samp{-r@var{tag}} and not @samp{-D@var{date}} 5208to retrieve the revisions. 5209 5210@item 5211The log of changes is maintained intact. 5212 5213@item 5214The revision numbers are not affected. 5215@end itemize 5216 5217@noindent 5218Disadvantages: 5219 5220@itemize @bullet 5221@item 5222You cannot easily see the history of the file across the rename. 5223 5224@ignore 5225@c Is this true? I don't see how the revision numbers 5226@c _could_ start over, when new,v is just old,v with 5227@c the tags deleted. 5228@c If there is some need to reinstate this text, 5229@c it is "usually 1.1", not "1.0" and it needs an 5230@c xref to Assigning revisions 5231@item 5232Unless you use the @samp{-r rev} (@pxref{commit 5233options}) flag when @var{new} is committed its revision 5234numbers will start at 1.0 again. 5235@end ignore 5236@end itemize 5237 5238@c --------------------------------------------------------------------- 5239@node Moving directories 5240@section Moving and renaming directories 5241@cindex Moving directories 5242@cindex Renaming directories 5243@cindex Directories, moving 5244 5245The normal way to rename or move a directory is to 5246rename or move each file within it as described in 5247@ref{Outside}. Then check out with the @samp{-P} 5248option, as described in @ref{Removing directories}. 5249 5250If you really want to hack the repository to rename or 5251delete a directory in the repository, you can do it 5252like this: 5253 5254@enumerate 5255@item 5256Inform everyone who has a checked out copy of the directory that the 5257directory will be renamed. They should commit all their changes in all their 5258copies of the project containing the directory to be removed, and remove 5259all their working copies of said project, before you take the steps below. 5260 5261@item 5262Rename the directory inside the repository. 5263 5264@example 5265$ cd $CVSROOT/@var{parent-dir} 5266$ mv @var{old-dir} @var{new-dir} 5267@end example 5268 5269@item 5270Fix the @sc{cvs} administrative files, if necessary (for 5271instance if you renamed an entire module). 5272 5273@item 5274Tell everyone that they can check out again and continue 5275working. 5276 5277@end enumerate 5278 5279If someone had a working copy the @sc{cvs} commands will 5280cease to work for him, until he removes the directory 5281that disappeared inside the repository. 5282 5283It is almost always better to move the files in the 5284directory instead of moving the directory. If you move the 5285directory you are unlikely to be able to retrieve old 5286releases correctly, since they probably depend on the 5287name of the directories. 5288 5289@c --------------------------------------------------------------------- 5290@node History browsing 5291@chapter History browsing 5292@cindex History browsing 5293@cindex Traceability 5294@cindex Isolation 5295 5296@ignore 5297@c This is too long for an introduction (goal is 5298@c one 20x80 character screen), and also mixes up a 5299@c variety of issues (parallel development, history, 5300@c maybe even touches on process control). 5301 5302@c -- @quote{To lose ones history is to lose ones soul.} 5303@c -- /// 5304@c -- ///Those who cannot remember the past are condemned to repeat it. 5305@c -- /// -- George Santayana 5306@c -- /// 5307 5308@sc{cvs} tries to make it easy for a group of people to work 5309together. This is done in two ways: 5310 5311@itemize @bullet 5312@item 5313Isolation---You have your own working copy of the 5314source. You are not affected by modifications made by 5315others until you decide to incorporate those changes 5316(via the @code{update} command---@pxref{update}). 5317 5318@item 5319Traceability---When something has changed, you can 5320always see @emph{exactly} what changed. 5321@end itemize 5322 5323There are several features of @sc{cvs} that together lead 5324to traceability: 5325 5326@itemize @bullet 5327@item 5328Each revision of a file has an accompanying log 5329message. 5330 5331@item 5332All commits are optionally logged to a central history 5333database. 5334 5335@item 5336Logging information can be sent to a user-defined 5337program (@pxref{loginfo}). 5338@end itemize 5339 5340@c -- More text here. 5341 5342This chapter should talk about the history file, the 5343@code{log} command, the usefulness of ChangeLogs 5344even when you run @sc{cvs}, and things like that. 5345 5346@end ignore 5347 5348@c kind of lame, in a lot of ways the above text inside 5349@c the @ignore motivates this chapter better 5350Once you have used @sc{cvs} to store a version control 5351history---what files have changed when, how, and by 5352whom, there are a variety of mechanisms for looking 5353through the history. 5354 5355@c FIXME: should also be talking about how you look at 5356@c old revisions (e.g. "cvs update -p -r 1.2 foo.c"). 5357@menu 5358* log messages:: Log messages 5359* history database:: The history database 5360* user-defined logging:: User-defined logging 5361@end menu 5362 5363@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5364@node log messages 5365@section Log messages 5366 5367@c FIXME: @xref to place where we talk about how to 5368@c specify message to commit. 5369Whenever you commit a file you specify a log message. 5370 5371@c FIXME: bring the information here, and get rid of or 5372@c greatly shrink the "log" node. 5373To look through the log messages which have been 5374specified for every revision which has been committed, 5375use the @code{cvs log} command (@pxref{log}). 5376 5377@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5378@node history database 5379@section The history database 5380 5381@c FIXME: bring the information from the history file 5382@c and history nodes here. Rewrite it to be motivated 5383@c better (start out by clearly explaining what gets 5384@c logged in history, for example). 5385You can use the history file (@pxref{history file}) to 5386log various @sc{cvs} actions. To retrieve the 5387information from the history file, use the @code{cvs 5388history} command (@pxref{history}). 5389 5390Note: you can control what is logged to this file by using the 5391@samp{LogHistory} keyword in the @file{CVSROOT/config} file 5392(@pxref{config}). 5393 5394@c 5395@c The history database has many problems: 5396@c * It is very unclear what field means what. This 5397@c could be improved greatly by better documentation, 5398@c but there are still non-orthogonalities (for 5399@c example, tag does not record the "repository" 5400@c field but most records do). 5401@c * Confusion about files, directories, and modules. 5402@c Some commands record one, some record others. 5403@c * File removal is not logged. There is an 'R' 5404@c record type documented, but CVS never uses it. 5405@c * Tags are only logged for the "cvs rtag" command, 5406@c not "cvs tag". The fix for this is not completely 5407@c clear (see above about modules vs. files). 5408@c * Are there other cases of operations that are not 5409@c logged? One would hope for all changes to the 5410@c repository to be logged somehow (particularly 5411@c operations like tagging, "cvs admin -k", and other 5412@c operations which do not record a history that one 5413@c can get with "cvs log"). Operations on the working 5414@c directory, like export, get, and release, are a 5415@c second category also covered by the current "cvs 5416@c history". 5417@c * The history file does not record the options given 5418@c to a command. The most serious manifestation of 5419@c this is perhaps that it doesn't record whether a command 5420@c was recursive. It is not clear to me whether one 5421@c wants to log at a level very close to the command 5422@c line, as a sort of way of logging each command 5423@c (more or less), or whether one wants 5424@c to log more at the level of what was changed (or 5425@c something in between), but either way the current 5426@c information has pretty big gaps. 5427@c * Further details about a tag--like whether it is a 5428@c branch tag or, if a non-branch tag, which branch it 5429@c is on. One can find out this information about the 5430@c tag as it exists _now_, but if the tag has been 5431@c moved, one doesn't know what it was like at the time 5432@c the history record was written. 5433@c * Whether operating on a particular tag, date, or 5434@c options was implicit (sticky) or explicit. 5435@c 5436@c Another item, only somewhat related to the above, is a 5437@c way to control what is logged in the history file. 5438@c This is probably the only good way to handle 5439@c different people having different ideas about 5440@c information/space tradeoffs. 5441@c 5442@c It isn't really clear that it makes sense to try to 5443@c patch up the history file format as it exists now to 5444@c include all that stuff. It might be better to 5445@c design a whole new CVSROOT/nhistory file and "cvs 5446@c nhistory" command, or some such, or in some other 5447@c way trying to come up with a clean break from the 5448@c past, which can address the above concerns. Another 5449@c open question is how/whether this relates to 5450@c taginfo/loginfo/etc. 5451 5452@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5453@node user-defined logging 5454@section User-defined logging 5455 5456@c FIXME: probably should centralize this information 5457@c here, at least to some extent. Maybe by moving the 5458@c loginfo, etc., nodes here and replacing 5459@c the "user-defined logging" node with one node for 5460@c each method. 5461You can customize @sc{cvs} to log various kinds of 5462actions, in whatever manner you choose. These 5463mechanisms operate by executing a script at various 5464times. The script might append a message to a file 5465listing the information and the programmer who created 5466it, or send mail to a group of developers, or, perhaps, 5467post a message to a particular newsgroup. To log 5468commits, use the @file{loginfo} file (@pxref{loginfo}). 5469To log tags, use the @file{taginfo} file (@pxref{taginfo}). 5470@c FIXME: What is difference between doing it in the 5471@c modules file and using loginfo/taginfo? Why should 5472@c user use one or the other? 5473To log checkouts, exports, and tags, 5474respectively, you can also use the 5475@samp{-o}, @samp{-e}, and @samp{-t} options in the 5476modules file. For a more flexible way of giving 5477notifications to various users, which requires less in 5478the way of keeping centralized scripts up to date, use 5479the @code{cvs watch add} command (@pxref{Getting 5480Notified}); this command is useful even if you are not 5481using @code{cvs watch on}. 5482 5483@c --------------------------------------------------------------------- 5484@node Binary files 5485@chapter Handling binary files 5486@cindex Binary files 5487 5488The most common use for @sc{cvs} is to store text 5489files. With text files, @sc{cvs} can merge revisions, 5490display the differences between revisions in a 5491human-visible fashion, and other such operations. 5492However, if you are willing to give up a few of these 5493abilities, @sc{cvs} can store binary files. For 5494example, one might store a web site in @sc{cvs} 5495including both text files and binary images. 5496 5497@menu 5498* Binary why:: More details on issues with binary files 5499* Binary howto:: How to store them 5500@end menu 5501 5502@node Binary why 5503@section The issues with binary files 5504 5505While the need to manage binary files may seem obvious 5506if the files that you customarily work with are binary, 5507putting them into version control does present some 5508additional issues. 5509 5510One basic function of version control is to show the 5511differences between two revisions. For example, if 5512someone else checked in a new version of a file, you 5513may wish to look at what they changed and determine 5514whether their changes are good. For text files, 5515@sc{cvs} provides this functionality via the @code{cvs 5516diff} command. For binary files, it may be possible to 5517extract the two revisions and then compare them with a 5518tool external to @sc{cvs} (for example, word processing 5519software often has such a feature). If there is no 5520such tool, one must track changes via other mechanisms, 5521such as urging people to write good log messages, and 5522hoping that the changes they actually made were the 5523changes that they intended to make. 5524 5525Another ability of a version control system is the 5526ability to merge two revisions. For @sc{cvs} this 5527happens in two contexts. The first is when users make 5528changes in separate working directories 5529(@pxref{Multiple developers}). The second is when one 5530merges explicitly with the @samp{update -j} command 5531(@pxref{Branching and merging}). 5532 5533In the case of text 5534files, @sc{cvs} can merge changes made independently, 5535and signal a conflict if the changes conflict. With 5536binary files, the best that @sc{cvs} can do is present 5537the two different copies of the file, and leave it to 5538the user to resolve the conflict. The user may choose 5539one copy or the other, or may run an external merge 5540tool which knows about that particular file format, if 5541one exists. 5542Note that having the user merge relies primarily on the 5543user to not accidentally omit some changes, and thus is 5544potentially error prone. 5545 5546If this process is thought to be undesirable, the best 5547choice may be to avoid merging. To avoid the merges 5548that result from separate working directories, see the 5549discussion of reserved checkouts (file locking) in 5550@ref{Multiple developers}. To avoid the merges 5551resulting from branches, restrict use of branches. 5552 5553@node Binary howto 5554@section How to store binary files 5555 5556There are two issues with using @sc{cvs} to store 5557binary files. The first is that @sc{cvs} by default 5558converts line endings between the canonical form in 5559which they are stored in the repository (linefeed 5560only), and the form appropriate to the operating system 5561in use on the client (for example, carriage return 5562followed by line feed for Windows NT). 5563 5564The second is that a binary file might happen to 5565contain data which looks like a keyword (@pxref{Keyword 5566substitution}), so keyword expansion must be turned 5567off. 5568 5569@c FIXME: the third is that one can't do merges with 5570@c binary files. xref to Multiple Developers and the 5571@c reserved checkout issues. 5572 5573The @samp{-kb} option available with some @sc{cvs} 5574commands insures that neither line ending conversion 5575nor keyword expansion will be done. 5576 5577Here is an example of how you can create a new file 5578using the @samp{-kb} flag: 5579 5580@example 5581$ echo '$@splitrcskeyword{Id}$' > kotest 5582$ cvs add -kb -m"A test file" kotest 5583$ cvs ci -m"First checkin; contains a keyword" kotest 5584@end example 5585 5586If a file accidentally gets added without @samp{-kb}, 5587one can use the @code{cvs admin} command to recover. 5588For example: 5589 5590@example 5591$ echo '$@splitrcskeyword{Id}$' > kotest 5592$ cvs add -m"A test file" kotest 5593$ cvs ci -m"First checkin; contains a keyword" kotest 5594$ cvs admin -kb kotest 5595$ cvs update -A kotest 5596# @r{For non-unix systems:} 5597# @r{Copy in a good copy of the file from outside CVS} 5598$ cvs commit -m "make it binary" kotest 5599@end example 5600 5601@c Trying to describe this for both unix and non-unix 5602@c in the same description is very confusing. Might 5603@c want to split the two, or just ditch the unix "shortcut" 5604@c (unixheads don't do much with binary files, anyway). 5605@c This used to say "(Try the above example, and do a 5606@c @code{cat kotest} after every command)". But that 5607@c only really makes sense for the unix case. 5608When you check in the file @file{kotest} the file is 5609not preserved as a binary file, because you did not 5610check it in as a binary file. The @code{cvs 5611admin -kb} command sets the default keyword 5612substitution method for this file, but it does not 5613alter the working copy of the file that you have. If you need to 5614cope with line endings (that is, you are using 5615@sc{cvs} on a non-unix system), then you need to 5616check in a new copy of the file, as shown by the 5617@code{cvs commit} command above. 5618On unix, the @code{cvs update -A} command suffices. 5619@c FIXME: should also describe what the *other users* 5620@c need to do, if they have checked out copies which 5621@c have been corrupted by lack of -kb. I think maybe 5622@c "cvs update -kb" or "cvs 5623@c update -A" would suffice, although the user who 5624@c reported this suggested removing the file, manually 5625@c removing it from CVS/Entries, and then "cvs update" 5626(Note that you can use @code{cvs log} to determine the default keyword 5627substitution method for a file and @code{cvs status} to determine 5628the keyword substitution method for a working copy.) 5629 5630However, in using @code{cvs admin -k} to change the 5631keyword expansion, be aware that the keyword expansion 5632mode is not version controlled. This means that, for 5633example, that if you have a text file in old releases, 5634and a binary file with the same name in new releases, 5635@sc{cvs} provides no way to check out the file in text 5636or binary mode depending on what version you are 5637checking out. There is no good workaround for this 5638problem. 5639 5640You can also set a default for whether @code{cvs add} 5641and @code{cvs import} treat a file as binary based on 5642its name; for example you could say that files who 5643names end in @samp{.exe} are binary. @xref{Wrappers}. 5644There is currently no way to have @sc{cvs} detect 5645whether a file is binary based on its contents. The 5646main difficulty with designing such a feature is that 5647it is not clear how to distinguish between binary and 5648non-binary files, and the rules to apply would vary 5649considerably with the operating system. 5650@c For example, it would be good on MS-DOS-family OSes 5651@c for anything containing ^Z to be binary. Having 5652@c characters with the 8th bit set imply binary is almost 5653@c surely a bad idea in the context of ISO-8859-* and 5654@c other such character sets. On VMS or the Mac, we 5655@c could use the OS's file typing. This is a 5656@c commonly-desired feature, and something of this sort 5657@c may make sense. But there are a lot of pitfalls here. 5658@c 5659@c Another, probably better, way to tell is to read the 5660@c file in text mode, write it to a temp file in text 5661@c mode, and then do a binary mode compare of the two 5662@c files. If they differ, it is a binary file. This 5663@c might have problems on VMS (or some other system 5664@c with several different text modes), but in general 5665@c should be relatively portable. The only other 5666@c downside I can think of is that it would be fairly 5667@c slow, but that is perhaps a small price to pay for 5668@c not having your files corrupted. Another issue is 5669@c what happens if you import a text file with bare 5670@c linefeeds on Windows. Such files will show up on 5671@c Windows sometimes (I think some native windows 5672@c programs even write them, on occasion). Perhaps it 5673@c is reasonable to treat such files as binary; after 5674@c all it is something of a presumption to assume that 5675@c the user would want the linefeeds converted to CRLF. 5676 5677@c --------------------------------------------------------------------- 5678@node Multiple developers 5679@chapter Multiple developers 5680@cindex Multiple developers 5681@cindex Team of developers 5682@cindex File locking 5683@cindex Locking files 5684@cindex Working copy 5685@cindex Reserved checkouts 5686@cindex Unreserved checkouts 5687@cindex RCS-style locking 5688 5689When more than one person works on a software project 5690things often get complicated. Often, two people try to 5691edit the same file simultaneously. One solution, known 5692as @dfn{file locking} or @dfn{reserved checkouts}, is 5693to allow only one person to edit each file at a time. 5694This is the only solution with some version control 5695systems, including @sc{rcs} and @sc{sccs}. Currently 5696the usual way to get reserved checkouts with @sc{cvs} 5697is the @code{cvs admin -l} command (@pxref{admin 5698options}). This is not as nicely integrated into 5699@sc{cvs} as the watch features, described below, but it 5700seems that most people with a need for reserved 5701checkouts find it adequate. 5702@c Or "find it better than worrying about implementing 5703@c nicely integrated reserved checkouts" or ...? 5704It also may be possible to use the watches 5705features described below, together with suitable 5706procedures (not enforced by software), to avoid having 5707two people edit at the same time. 5708 5709@c Our unreserved checkout model might not 5710@c be quite the same as others. For example, I 5711@c think that some systems will tend to create a branch 5712@c in the case where CVS prints "up-to-date check failed". 5713@c It isn't clear to me whether we should try to 5714@c explore these subtleties; it could easily just 5715@c confuse people. 5716The default model with @sc{cvs} is known as 5717@dfn{unreserved checkouts}. In this model, developers 5718can edit their own @dfn{working copy} of a file 5719simultaneously. The first person that commits his 5720changes has no automatic way of knowing that another 5721has started to edit it. Others will get an error 5722message when they try to commit the file. They must 5723then use @sc{cvs} commands to bring their working copy 5724up to date with the repository revision. This process 5725is almost automatic. 5726 5727@c FIXME? should probably use the word "watch" here, to 5728@c tie this into the text below and above. 5729@sc{cvs} also supports mechanisms which facilitate 5730various kinds of communication, without actually 5731enforcing rules like reserved checkouts do. 5732 5733The rest of this chapter describes how these various 5734models work, and some of the issues involved in 5735choosing between them. 5736 5737@ignore 5738Here is a draft reserved checkout design or discussion 5739of the issues. This seems like as good a place as any 5740for this. 5741 5742Might want a cvs lock/cvs unlock--in which the names 5743differ from edit/unedit because the network must be up 5744for these to work. unedit gives an error if there is a 5745reserved checkout in place (so that people don't 5746accidentally leave locks around); unlock gives an error 5747if one is not in place (this is more arguable; perhaps 5748it should act like unedit in that case). 5749 5750On the other hand, might want it so that emacs, 5751scripts, etc., can get ready to edit a file without 5752having to know which model is in use. In that case we 5753would have a "cvs watch lock" (or .cvsrc?) (that is, 5754three settings, "on", "off", and "lock"). Having cvs 5755watch lock set would cause a get to record in the CVS 5756directory which model is in use, and cause "cvs edit" 5757to change behaviors. We'd want a way to query which 5758setting is in effect (this would be handy even if it is 5759only "on" or "off" as presently). If lock is in 5760effect, then commit would require a lock before 5761allowing a checkin; chmod wouldn't suffice (might be 5762debatable--see chmod comment below, in watches--but it 5763is the way people expect RCS to work and I can't think 5764of any significant downside. On the other hand, maybe 5765it isn't worth bothering, because people who are used 5766to RCS wouldn't think to use chmod anyway). 5767 5768Implementation: use file attributes or use RCS 5769locking. The former avoids more dependence on RCS 5770behaviors we will need to re-implement as we librarify 5771RCS, and makes it easier to import/export RCS files (in 5772that context, want to ignore the locker field). But 5773note that RCS locks are per-branch, which is the 5774correct behavior (this is also an issue for the "watch 5775on" features; they should be per-branch too). 5776 5777Here are a few more random notes about implementation 5778details, assuming "cvs watch lock" and 5779 5780CVS/Watched file? Or try to fit this into CVS/Entries somehow? 5781Cases: (1) file is checked out (unreserved or with watch on) by old 5782version of @sc{cvs}, now we do something with new one, (2) file is checked 5783out by new version, now we do something with old one. 5784 5785Remote protocol would have a "Watched" analogous to "Mode". Of course 5786it would apply to all Updated-like requests. How do we keep this 5787setting up to date? I guess that there wants to be a Watched request, 5788and the server would send a new one if it isn't up to date? (Ugh--hard 5789to implement and slows down "cvs -q update"--is there an easier way?) 5790 5791"cvs edit"--checks CVS/Watched, and if watch lock, then sends 5792"edit-lock" request. Which comes back with a Checked-in with 5793appropriate Watched (off, on, lock, locked, or some such?), or error 5794message if already locked. 5795 5796"cvs commit"--only will commit if off/on/locked. lock is not OK. 5797 5798Doc: 5799note that "cvs edit" must be connected to network if watch lock is in 5800effect. 5801 5802Talk about what to do if someone has locked a file and you want to 5803edit that file. (breaking locks, or lack thereof). 5804 5805 5806One other idea (which could work along with the 5807existing "cvs admin -l" reserved checkouts, as well as 5808the above): 5809 5810"cvs editors" could show who has the file locked, if 5811someone does. 5812 5813@end ignore 5814 5815@menu 5816* File status:: A file can be in several states 5817* Updating a file:: Bringing a file up-to-date 5818* Conflicts example:: An informative example 5819* Informing others:: To cooperate you must inform 5820* Concurrency:: Simultaneous repository access 5821* Watches:: Mechanisms to track who is editing files 5822* Choosing a model:: Reserved or unreserved checkouts? 5823@end menu 5824 5825@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5826@node File status 5827@section File status 5828@cindex File status 5829@cindex Status of a file 5830 5831@c Shouldn't this start with an example or something, 5832@c introducing the unreserved checkout model? Before we 5833@c dive into listing states? 5834Based on what operations you have performed on a 5835checked out file, and what operations others have 5836performed to that file in the repository, one can 5837classify a file in a number of states. The states, as 5838reported by the @code{status} command, are: 5839 5840@c The order of items is chosen to group logically 5841@c similar outputs together. 5842@c People who want alphabetical can use the index... 5843@table @asis 5844@cindex Up-to-date 5845@item Up-to-date 5846The file is identical with the latest revision in the 5847repository for the branch in use. 5848@c FIXME: should we clarify "in use"? The answer is 5849@c sticky tags, and trying to distinguish branch sticky 5850@c tags from non-branch sticky tags seems rather awkward 5851@c here. 5852@c FIXME: What happens with non-branch sticky tags? Is 5853@c a stuck file "Up-to-date" or "Needs checkout" or what? 5854 5855@item Locally Modified 5856@cindex Locally Modified 5857You have edited the file, and not yet committed your changes. 5858 5859@item Locally Added 5860@cindex Locally Added 5861You have added the file with @code{add}, and not yet 5862committed your changes. 5863@c There are many cases involving the file being 5864@c added/removed/modified in the working directory, and 5865@c added/removed/modified in the repository, which we 5866@c don't try to describe here. I'm not sure that "cvs 5867@c status" produces a non-confusing output in most of 5868@c those cases. 5869 5870@item Locally Removed 5871@cindex Locally Removed 5872You have removed the file with @code{remove}, and not yet 5873committed your changes. 5874 5875@item Needs Checkout 5876@cindex Needs Checkout 5877Someone else has committed a newer revision to the 5878repository. The name is slightly misleading; you will 5879ordinarily use @code{update} rather than 5880@code{checkout} to get that newer revision. 5881 5882@item Needs Patch 5883@cindex Needs Patch 5884@c See also newb-123j0 in sanity.sh (although that case 5885@c should probably be changed rather than documented). 5886Like Needs Checkout, but the @sc{cvs} server will send 5887a patch rather than the entire file. Sending a patch or 5888sending an entire file accomplishes the same thing. 5889 5890@item Needs Merge 5891@cindex Needs Merge 5892Someone else has committed a newer revision to the repository, and you 5893have also made modifications to the file. 5894 5895@item Unresolved Conflict 5896@cindex Unresolved Conflict 5897@c FIXCVS - This file status needs to be changed to some more informative 5898@c text that distinguishes it more clearly from each of the Locally Added, 5899@c File had conflicts on merge, and Unknown status types, but an exact and 5900@c succinct wording escapes me at the moment. 5901A file with the same name as this new file has been added to the repository 5902from a second workspace. This file will need to be moved out of the way 5903to allow an @code{update} to complete. 5904 5905@item File had conflicts on merge 5906@cindex File had conflicts on merge 5907@c is it worth saying that this message was "Unresolved 5908@c Conflict" in CVS 1.9 and earlier? I'm inclined to 5909@c think that is unnecessarily confusing to new users. 5910This is like Locally Modified, except that a previous 5911@code{update} command gave a conflict. If you have not 5912already done so, you need to 5913resolve the conflict as described in @ref{Conflicts example}. 5914 5915@item Unknown 5916@cindex Unknown 5917@sc{cvs} doesn't know anything about this file. For 5918example, you have created a new file and have not run 5919@code{add}. 5920@c 5921@c "Entry Invalid" and "Classify Error" are also in the 5922@c status.c. The latter definitely indicates a CVS bug 5923@c (should it be worded more like "internal error" so 5924@c people submit bug reports if they see it?). The former 5925@c I'm not as sure; I haven't tracked down whether/when it 5926@c appears in "cvs status" output. 5927 5928@end table 5929 5930To help clarify the file status, @code{status} also 5931reports the @code{Working revision} which is the 5932revision that the file in the working directory derives 5933from, and the @code{Repository revision} which is the 5934latest revision in the repository for the branch in 5935use. 5936@c FIXME: should we clarify "in use"? The answer is 5937@c sticky tags, and trying to distinguish branch sticky 5938@c tags from non-branch sticky tags seems rather awkward 5939@c here. 5940@c FIXME: What happens with non-branch sticky tags? 5941@c What is the Repository Revision there? See the 5942@c comment at vn_rcs in cvs.h, which is kind of 5943@c confused--we really need to document better what this 5944@c field contains. 5945@c Q: Should we document "New file!" and other such 5946@c outputs or are they self-explanatory? 5947@c FIXME: what about the date to the right of "Working 5948@c revision"? It doesn't appear with client/server and 5949@c seems unnecessary (redundant with "ls -l") so 5950@c perhaps it should be removed for non-client/server too? 5951@c FIXME: Need some examples. 5952@c FIXME: Working revision can also be something like 5953@c "-1.3" for a locally removed file. Not at all 5954@c self-explanatory (and it is possible that CVS should 5955@c be changed rather than documenting this). 5956 5957@c Would be nice to have an @example showing output 5958@c from cvs status, with comments showing the xref 5959@c where each part of the output is described. This 5960@c might fit in nicely if it is desirable to split this 5961@c node in two; one to introduce "cvs status" and one 5962@c to list each of the states. 5963The options to @code{status} are listed in 5964@ref{Invoking CVS}. For information on its @code{Sticky tag} 5965and @code{Sticky date} output, see @ref{Sticky tags}. 5966For information on its @code{Sticky options} output, 5967see the @samp{-k} option in @ref{update options}. 5968 5969You can think of the @code{status} and @code{update} 5970commands as somewhat complementary. You use 5971@code{update} to bring your files up to date, and you 5972can use @code{status} to give you some idea of what an 5973@code{update} would do (of course, the state of the 5974repository might change before you actually run 5975@code{update}). In fact, if you want a command to 5976display file status in a more brief format than is 5977displayed by the @code{status} command, you can invoke 5978 5979@cindex update, to display file status 5980@example 5981$ cvs -n -q update 5982@end example 5983 5984The @samp{-n} option means to not actually do the 5985update, but merely to display statuses; the @samp{-q} 5986option avoids printing the name of each directory. For 5987more information on the @code{update} command, and 5988these options, see @ref{Invoking CVS}. 5989 5990@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5991@node Updating a file 5992@section Bringing a file up to date 5993@cindex Bringing a file up to date 5994@cindex Updating a file 5995@cindex Merging a file 5996@cindex Update, introduction 5997 5998When you want to update or merge a file, use the @code{cvs update -d} 5999command. For files that are not up to date this is roughly equivalent 6000to a @code{checkout} command: the newest revision of the file is 6001extracted from the repository and put in your working directory. The 6002@code{-d} option, not necessary with @code{checkout}, tells @sc{cvs} 6003that you wish it to create directories added by other developers. 6004 6005Your modifications to a file are never lost when you 6006use @code{update}. If no newer revision exists, 6007running @code{update} has no effect. If you have 6008edited the file, and a newer revision is available, 6009@sc{cvs} will merge all changes into your working copy. 6010 6011For instance, imagine that you checked out revision 1.4 and started 6012editing it. In the meantime someone else committed revision 1.5, and 6013shortly after that revision 1.6. If you run @code{update} on the file 6014now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into 6015your file. 6016 6017@cindex Overlap 6018If any of the changes between 1.4 and 1.6 were made too 6019close to any of the changes you have made, an 6020@dfn{overlap} occurs. In such cases a warning is 6021printed, and the resulting file includes both 6022versions of the lines that overlap, delimited by 6023special markers. 6024@xref{update}, for a complete description of the 6025@code{update} command. 6026 6027@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6028@node Conflicts example 6029@section Conflicts example 6030@cindex Merge, an example 6031@cindex Example of merge 6032@cindex driver.c (merge example) 6033 6034Suppose revision 1.4 of @file{driver.c} contains this: 6035 6036@example 6037#include <stdio.h> 6038 6039void main() 6040@{ 6041 parse(); 6042 if (nerr == 0) 6043 gencode(); 6044 else 6045 fprintf(stderr, "No code generated.\n"); 6046 exit(nerr == 0 ? 0 : 1); 6047@} 6048@end example 6049 6050@noindent 6051Revision 1.6 of @file{driver.c} contains this: 6052 6053@example 6054#include <stdio.h> 6055 6056int main(int argc, 6057 char **argv) 6058@{ 6059 parse(); 6060 if (argc != 1) 6061 @{ 6062 fprintf(stderr, "tc: No args expected.\n"); 6063 exit(1); 6064 @} 6065 if (nerr == 0) 6066 gencode(); 6067 else 6068 fprintf(stderr, "No code generated.\n"); 6069 exit(!!nerr); 6070@} 6071@end example 6072 6073@noindent 6074Your working copy of @file{driver.c}, based on revision 60751.4, contains this before you run @samp{cvs update}: 6076@c -- Really include "cvs"? 6077 6078@example 6079#include <stdlib.h> 6080#include <stdio.h> 6081 6082void main() 6083@{ 6084 init_scanner(); 6085 parse(); 6086 if (nerr == 0) 6087 gencode(); 6088 else 6089 fprintf(stderr, "No code generated.\n"); 6090 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6091@} 6092@end example 6093 6094@noindent 6095You run @samp{cvs update}: 6096@c -- Really include "cvs"? 6097 6098@example 6099$ cvs update driver.c 6100RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v 6101retrieving revision 1.4 6102retrieving revision 1.6 6103Merging differences between 1.4 and 1.6 into driver.c 6104rcsmerge warning: overlaps during merge 6105cvs update: conflicts found in driver.c 6106C driver.c 6107@end example 6108 6109@noindent 6110@cindex Conflicts (merge example) 6111@sc{cvs} tells you that there were some conflicts. 6112Your original working file is saved unmodified in 6113@file{.#driver.c.1.4}. The new version of 6114@file{driver.c} contains this: 6115 6116@example 6117#include <stdlib.h> 6118#include <stdio.h> 6119 6120int main(int argc, 6121 char **argv) 6122@{ 6123 init_scanner(); 6124 parse(); 6125 if (argc != 1) 6126 @{ 6127 fprintf(stderr, "tc: No args expected.\n"); 6128 exit(1); 6129 @} 6130 if (nerr == 0) 6131 gencode(); 6132 else 6133 fprintf(stderr, "No code generated.\n"); 6134@asis{}<<<<<<< driver.c 6135 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6136@asis{}======= 6137 exit(!!nerr); 6138@asis{}>>>>>>> 1.6 6139@} 6140@end example 6141 6142@noindent 6143@cindex Markers, conflict 6144@cindex Conflict markers 6145@cindex <<<<<<< 6146@cindex >>>>>>> 6147@cindex ======= 6148 6149Note how all non-overlapping modifications are incorporated in your working 6150copy, and that the overlapping section is clearly marked with 6151@samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}. 6152 6153@cindex Resolving a conflict 6154@cindex Conflict resolution 6155You resolve the conflict by editing the file, removing the markers and 6156the erroneous line. Suppose you end up with this file: 6157@c -- Add xref to the pcl-cvs manual when it talks 6158@c -- about this. 6159@example 6160#include <stdlib.h> 6161#include <stdio.h> 6162 6163int main(int argc, 6164 char **argv) 6165@{ 6166 init_scanner(); 6167 parse(); 6168 if (argc != 1) 6169 @{ 6170 fprintf(stderr, "tc: No args expected.\n"); 6171 exit(1); 6172 @} 6173 if (nerr == 0) 6174 gencode(); 6175 else 6176 fprintf(stderr, "No code generated.\n"); 6177 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 6178@} 6179@end example 6180 6181@noindent 6182You can now go ahead and commit this as revision 1.7. 6183 6184@example 6185$ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c 6186Checking in driver.c; 6187/usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c 6188new revision: 1.7; previous revision: 1.6 6189done 6190@end example 6191 6192For your protection, @sc{cvs} will refuse to check in a 6193file if a conflict occurred and you have not resolved 6194the conflict. Currently to resolve a conflict, you 6195must change the timestamp on the file. In previous 6196versions of @sc{cvs}, you also needed to 6197insure that the file contains no conflict markers. 6198Because 6199your file may legitimately contain conflict markers (that 6200is, occurrences of @samp{>>>>>>> } at the start of a 6201line that don't mark a conflict), the current 6202version of @sc{cvs} will print a warning and proceed to 6203check in the file. 6204@c The old behavior was really icky; the only way out 6205@c was to start hacking on 6206@c the @code{CVS/Entries} file or other such workarounds. 6207@c 6208@c If the timestamp thing isn't considered nice enough, 6209@c maybe there should be a "cvs resolved" command 6210@c which clears the conflict indication. For a nice user 6211@c interface, this should be invoked by an interactive 6212@c merge tool like emerge rather than by the user 6213@c directly--such a tool can verify that the user has 6214@c really dealt with each conflict. 6215 6216@cindex emerge 6217If you use release 1.04 or later of pcl-cvs (a @sc{gnu} 6218Emacs front-end for @sc{cvs}) you can use an Emacs 6219package called emerge to help you resolve conflicts. 6220See the documentation for pcl-cvs. 6221 6222@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6223@node Informing others 6224@section Informing others about commits 6225@cindex Informing others 6226@cindex Spreading information 6227@cindex Mail, automatic mail on commit 6228 6229It is often useful to inform others when you commit a 6230new revision of a file. The @file{loginfo} file can be 6231used to automate this process. 6232@xref{loginfo}. You can use these features of @sc{cvs} 6233to, for instance, instruct @sc{cvs} to mail a 6234message to all developers, or post a message to a local 6235newsgroup. 6236@c -- More text would be nice here. 6237 6238@node Concurrency 6239@section Several developers simultaneously attempting to run CVS 6240 6241@cindex Locks, cvs, introduction 6242@c For a discussion of *why* CVS creates locks, see 6243@c the comment at the start of src/lock.c 6244If several developers try to run @sc{cvs} at the same 6245time, one may get the following message: 6246 6247@example 6248[11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo 6249@end example 6250 6251@cindex #cvs.rfl, removing 6252@cindex #cvs.wfl, removing 6253@cindex #cvs.lock, removing 6254@sc{cvs} will try again every 30 seconds, and either 6255continue with the operation or print the message again, 6256if it still needs to wait. If a lock seems to stick 6257around for an undue amount of time, find the person 6258holding the lock and ask them about the cvs command 6259they are running. If they aren't running a cvs 6260command, look in the repository directory mentioned in 6261the message and remove files which they own whose names 6262start with @file{#cvs.rfl}, 6263@file{#cvs.wfl}, or @file{#cvs.lock}. 6264 6265Note that these locks are to protect @sc{cvs}'s 6266internal data structures and have no relationship to 6267the word @dfn{lock} in the sense used by 6268@sc{rcs}---which refers to reserved checkouts 6269(@pxref{Multiple developers}). 6270 6271Any number of people can be reading from a given 6272repository at a time; only when someone is writing do 6273the locks prevent other people from reading or writing. 6274 6275@cindex Atomic transactions, lack of 6276@cindex Transactions, atomic, lack of 6277@c the following talks about what one might call commit/update 6278@c atomicity. 6279@c Probably also should say something about 6280@c commit/commit atomicity, that is, "An update will 6281@c not get partial versions of more than one commit". 6282@c CVS currently has this property and I guess we can 6283@c make it a documented feature. 6284@c For example one person commits 6285@c a/one.c and b/four.c and another commits a/two.c and 6286@c b/three.c. Then an update cannot get the new a/one.c 6287@c and a/two.c and the old b/four.c and b/three.c. 6288One might hope for the following property: 6289 6290@quotation 6291If someone commits some changes in one cvs command, 6292then an update by someone else will either get all the 6293changes, or none of them. 6294@end quotation 6295 6296@noindent 6297but @sc{cvs} does @emph{not} have this property. For 6298example, given the files 6299 6300@example 6301a/one.c 6302a/two.c 6303b/three.c 6304b/four.c 6305@end example 6306 6307@noindent 6308if someone runs 6309 6310@example 6311cvs ci a/two.c b/three.c 6312@end example 6313 6314@noindent 6315and someone else runs @code{cvs update} at the same 6316time, the person running @code{update} might get only 6317the change to @file{b/three.c} and not the change to 6318@file{a/two.c}. 6319 6320@node Watches 6321@section Mechanisms to track who is editing files 6322@cindex Watches 6323 6324For many groups, use of @sc{cvs} in its default mode is 6325perfectly satisfactory. Users may sometimes go to 6326check in a modification only to find that another 6327modification has intervened, but they deal with it and 6328proceed with their check in. Other groups prefer to be 6329able to know who is editing what files, so that if two 6330people try to edit the same file they can choose to 6331talk about who is doing what when rather than be 6332surprised at check in time. The features in this 6333section allow such coordination, while retaining the 6334ability of two developers to edit the same file at the 6335same time. 6336 6337@c Some people might ask why CVS does not enforce the 6338@c rule on chmod, by requiring a cvs edit before a cvs 6339@c commit. The main reason is that it could always be 6340@c circumvented--one could edit the file, and 6341@c then when ready to check it in, do the cvs edit and put 6342@c in the new contents and do the cvs commit. One 6343@c implementation note: if we _do_ want to have cvs commit 6344@c require a cvs edit, we should store the state on 6345@c whether the cvs edit has occurred in the working 6346@c directory, rather than having the server try to keep 6347@c track of what working directories exist. 6348@c FIXME: should the above discussion be part of the 6349@c manual proper, somewhere, not just in a comment? 6350For maximum benefit developers should use @code{cvs 6351edit} (not @code{chmod}) to make files read-write to 6352edit them, and @code{cvs release} (not @code{rm}) to 6353discard a working directory which is no longer in use, 6354but @sc{cvs} is not able to enforce this behavior. 6355 6356@c I'm a little dissatisfied with this presentation, 6357@c because "watch on"/"edit"/"editors" are one set of 6358@c functionality, and "watch add"/"watchers" is another 6359@c which is somewhat orthogonal even though they interact in 6360@c various ways. But I think it might be 6361@c confusing to describe them separately (e.g. "watch 6362@c add" with loginfo). I don't know. 6363 6364@menu 6365* Setting a watch:: Telling CVS to watch certain files 6366* Getting Notified:: Telling CVS to notify you 6367* Editing files:: How to edit a file which is being watched 6368* Watch information:: Information about who is watching and editing 6369* Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier 6370@end menu 6371 6372@node Setting a watch 6373@subsection Telling CVS to watch certain files 6374 6375To enable the watch features, you first specify that 6376certain files are to be watched. 6377 6378@cindex watch on (subcommand) 6379@deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{} 6380 6381@cindex Read-only files, and watches 6382Specify that developers should run @code{cvs edit} 6383before editing @var{files}. @sc{cvs} will create working 6384copies of @var{files} read-only, to remind developers 6385to run the @code{cvs edit} command before working on 6386them. 6387 6388If @var{files} includes the name of a directory, @sc{cvs} 6389arranges to watch all files added to the corresponding 6390repository directory, and sets a default for files 6391added in the future; this allows the user to set 6392notification policies on a per-directory basis. The 6393contents of the directory are processed recursively, 6394unless the @code{-l} option is given. 6395The @code{-R} option can be used to force recursion if the @code{-l} 6396option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}). 6397 6398If @var{files} is omitted, it defaults to the current directory. 6399 6400@cindex watch off (subcommand) 6401@end deffn 6402 6403@deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{} 6404 6405Do not create @var{files} read-only on checkout; thus, 6406developers will not be reminded to use @code{cvs edit} 6407and @code{cvs unedit}. 6408@ignore 6409@sc{cvs} will check out @var{files} 6410read-write as usual, unless other permissions override 6411due to the @code{PreservePermissions} option being 6412enabled in the @file{config} administrative file 6413(@pxref{Special Files}, @pxref{config}) 6414@end ignore 6415 6416The @var{files} and options are processed as for @code{cvs 6417watch on}. 6418 6419@end deffn 6420 6421@node Getting Notified 6422@subsection Telling CVS to notify you 6423 6424You can tell @sc{cvs} that you want to receive 6425notifications about various actions taken on a file. 6426You can do this without using @code{cvs watch on} for 6427the file, but generally you will want to use @code{cvs 6428watch on}, to remind developers to use the @code{cvs edit} 6429command. 6430 6431@cindex watch add (subcommand) 6432@deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{} 6433 6434Add the current user to the list of people to receive notification of 6435work done on @var{files}. 6436 6437The @code{-a} option specifies what kinds of events @sc{cvs} should notify 6438the user about. @var{action} is one of the following: 6439 6440@table @code 6441 6442@item edit 6443Another user has applied the @code{cvs edit} command (described 6444below) to a watched file. 6445 6446@item commit 6447Another user has committed changes to one of the named @var{files}. 6448 6449@item unedit 6450Another user has abandoned editing a file (other than by committing changes). 6451They can do this in several ways, by: 6452 6453@itemize @bullet 6454 6455@item 6456applying the @code{cvs unedit} command (described below) to the file 6457 6458@item 6459applying the @code{cvs release} command (@pxref{release}) to the file's parent directory 6460(or recursively to a directory more than one level up) 6461 6462@item 6463deleting the file and allowing @code{cvs update} to recreate it 6464 6465@end itemize 6466 6467@item all 6468All of the above. 6469 6470@item none 6471None of the above. (This is useful with @code{cvs edit}, 6472described below.) 6473 6474@end table 6475 6476The @code{-a} option may appear more than once, or not at all. If 6477omitted, the action defaults to @code{all}. 6478 6479The @var{files} and options are processed as for 6480@code{cvs watch on}. 6481 6482@end deffn 6483 6484 6485@cindex watch remove (subcommand) 6486@deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{} 6487 6488Remove a notification request established using @code{cvs watch add}; 6489the arguments are the same. If the @code{-a} option is present, only 6490watches for the specified actions are removed. 6491 6492@end deffn 6493 6494@cindex notify (admin file) 6495When the conditions exist for notification, @sc{cvs} 6496calls the @file{notify} administrative file. Edit 6497@file{notify} as one edits the other administrative 6498files (@pxref{Intro administrative files}). This 6499file follows the usual conventions for administrative 6500files (@pxref{syntax}), where each line is a regular 6501expression followed by a command to execute. The 6502command should contain a single occurrence of @samp{%s} 6503which will be replaced by the user to notify; the rest 6504of the information regarding the notification will be 6505supplied to the command on standard input. The 6506standard thing to put in the @code{notify} file is the 6507single line: 6508 6509@example 6510ALL mail %s -s "CVS notification" 6511@end example 6512 6513@noindent 6514This causes users to be notified by electronic mail. 6515@c FIXME: should it be this hard to set up this 6516@c behavior (and the result when one fails to do so, 6517@c silent failure to notify, so non-obvious)? Should 6518@c CVS give a warning if no line in notify matches (and 6519@c document the use of "DEFAULT :" for the case where 6520@c skipping the notification is indeed desired)? 6521 6522@cindex users (admin file) 6523Note that if you set this up in the straightforward 6524way, users receive notifications on the server machine. 6525One could of course write a @file{notify} script which 6526directed notifications elsewhere, but to make this 6527easy, @sc{cvs} allows you to associate a notification 6528address for each user. To do so create a file 6529@file{users} in @file{CVSROOT} with a line for each 6530user in the format @var{user}:@var{value}. Then 6531instead of passing the name of the user to be notified 6532to @file{notify}, @sc{cvs} will pass the @var{value} 6533(normally an email address on some other machine). 6534 6535@sc{cvs} does not notify you for your own changes. 6536Currently this check is done based on whether the user 6537name of the person taking the action which triggers 6538notification matches the user name of the person 6539getting notification. In fact, in general, the watches 6540features only track one edit by each user. It probably 6541would be more useful if watches tracked each working 6542directory separately, so this behavior might be worth 6543changing. 6544@c "behavior might be worth changing" is an effort to 6545@c point to future directions while also not promising 6546@c that "they" (as in "why don't they fix CVS to....") 6547@c will do this. 6548@c one implementation issue is identifying whether a 6549@c working directory is same or different. Comparing 6550@c pathnames/hostnames is hopeless, but having the server 6551@c supply a serial number which the client stores in the 6552@c CVS directory as a magic cookie should work. 6553 6554@node Editing files 6555@subsection How to edit a file which is being watched 6556 6557@cindex Checkout, as term for getting ready to edit 6558Since a file which is being watched is checked out 6559read-only, you cannot simply edit it. To make it 6560read-write, and inform others that you are planning to 6561edit it, use the @code{cvs edit} command. Some systems 6562call this a @dfn{checkout}, but @sc{cvs} uses that term 6563for obtaining a copy of the sources (@pxref{Getting the 6564source}), an operation which those systems call a 6565@dfn{get} or a @dfn{fetch}. 6566@c Issue to think about: should we transition CVS 6567@c towards the "get" terminology? "cvs get" is already a 6568@c synonym for "cvs checkout" and that section of the 6569@c manual refers to "Getting the source". If this is 6570@c done, needs to be done gingerly (for example, we should 6571@c still accept "checkout" in .cvsrc files indefinitely 6572@c even if the CVS's messages are changed from "cvs checkout: " 6573@c to "cvs get: "). 6574@c There is a concern about whether "get" is not as 6575@c good for novices because it is a more general term 6576@c than "checkout" (and thus arguably harder to assign 6577@c a technical meaning for). 6578 6579@cindex edit (subcommand) 6580@deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{} 6581 6582Prepare to edit the working files @var{files}. @sc{cvs} makes the 6583@var{files} read-write, and notifies users who have requested 6584@code{edit} notification for any of @var{files}. 6585 6586The @code{cvs edit} command accepts the same options as the 6587@code{cvs watch add} command, and establishes a temporary watch for the 6588user on @var{files}; @sc{cvs} will remove the watch when @var{files} are 6589@code{unedit}ed or @code{commit}ted. If the user does not wish to 6590receive notifications, she should specify @code{-a none}. 6591 6592The @var{files} and the options are processed as for the @code{cvs 6593watch} commands. 6594 6595@ignore 6596@strong{Caution: If the @code{PreservePermissions} 6597option is enabled in the repository (@pxref{config}), 6598@sc{cvs} will not change the permissions on any of the 6599@var{files}. The reason for this change is to ensure 6600that using @samp{cvs edit} does not interfere with the 6601ability to store file permissions in the @sc{cvs} 6602repository.} 6603@end ignore 6604 6605@end deffn 6606 6607Normally when you are done with a set of changes, you 6608use the @code{cvs commit} command, which checks in your 6609changes and returns the watched files to their usual 6610read-only state. But if you instead decide to abandon 6611your changes, or not to make any changes, you can use 6612the @code{cvs unedit} command. 6613 6614@cindex unedit (subcommand) 6615@cindex Abandoning work 6616@cindex Reverting to repository version 6617@deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{} 6618 6619Abandon work on the working files @var{files}, and revert them to the 6620repository versions on which they are based. @sc{cvs} makes those 6621@var{files} read-only for which users have requested notification using 6622@code{cvs watch on}. @sc{cvs} notifies users who have requested @code{unedit} 6623notification for any of @var{files}. 6624 6625The @var{files} and options are processed as for the 6626@code{cvs watch} commands. 6627 6628If watches are not in use, the @code{unedit} command 6629probably does not work, and the way to revert to the 6630repository version is with the command @code{cvs update -C file} 6631(@pxref{update}). 6632The meaning is 6633not precisely the same; the latter may also 6634bring in some changes which have been made in the 6635repository since the last time you updated. 6636@c It would be a useful enhancement to CVS to make 6637@c unedit work in the non-watch case as well. 6638@end deffn 6639 6640When using client/server @sc{cvs}, you can use the 6641@code{cvs edit} and @code{cvs unedit} commands even if 6642@sc{cvs} is unable to successfully communicate with the 6643server; the notifications will be sent upon the next 6644successful @sc{cvs} command. 6645 6646@node Watch information 6647@subsection Information about who is watching and editing 6648 6649@cindex watchers (subcommand) 6650@deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{} 6651 6652List the users currently watching changes to @var{files}. The report 6653includes the files being watched, and the mail address of each watcher. 6654 6655The @var{files} and options are processed as for the 6656@code{cvs watch} commands. 6657 6658@end deffn 6659 6660 6661@cindex editors (subcommand) 6662@deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{} 6663 6664List the users currently working on @var{files}. The report 6665includes the mail address of each user, the time when the user began 6666working with the file, and the host and path of the working directory 6667containing the file. 6668 6669The @var{files} and options are processed as for the 6670@code{cvs watch} commands. 6671 6672@end deffn 6673 6674@node Watches Compatibility 6675@subsection Using watches with old versions of CVS 6676 6677@cindex CVS 1.6, and watches 6678If you use the watch features on a repository, it 6679creates @file{CVS} directories in the repository and 6680stores the information about watches in that directory. 6681If you attempt to use @sc{cvs} 1.6 or earlier with the 6682repository, you get an error message such as the 6683following (all on one line): 6684 6685@example 6686cvs update: cannot open CVS/Entries for reading: 6687No such file or directory 6688@end example 6689 6690@noindent 6691and your operation will likely be aborted. To use the 6692watch features, you must upgrade all copies of @sc{cvs} 6693which use that repository in local or server mode. If 6694you cannot upgrade, use the @code{watch off} and 6695@code{watch remove} commands to remove all watches, and 6696that will restore the repository to a state which 6697@sc{cvs} 1.6 can cope with. 6698 6699@node Choosing a model 6700@section Choosing between reserved or unreserved checkouts 6701@cindex Choosing, reserved or unreserved checkouts 6702 6703Reserved and unreserved checkouts each have pros and 6704cons. Let it be said that a lot of this is a matter of 6705opinion or what works given different groups' working 6706styles, but here is a brief description of some of the 6707issues. There are many ways to organize a team of 6708developers. @sc{cvs} does not try to enforce a certain 6709organization. It is a tool that can be used in several 6710ways. 6711 6712Reserved checkouts can be very counter-productive. If 6713two persons want to edit different parts of a file, 6714there may be no reason to prevent either of them from 6715doing so. Also, it is common for someone to take out a 6716lock on a file, because they are planning to edit it, 6717but then forget to release the lock. 6718 6719@c "many groups"? specifics? cites to papers on this? 6720@c some way to weasel-word it a bit more so we don't 6721@c need facts :-)? 6722People, especially people who are familiar with 6723reserved checkouts, often wonder how often conflicts 6724occur if unreserved checkouts are used, and how 6725difficult they are to resolve. The experience with 6726many groups is that they occur rarely and usually are 6727relatively straightforward to resolve. 6728 6729The rarity of serious conflicts may be surprising, until one realizes 6730that they occur only when two developers disagree on the proper design 6731for a given section of code; such a disagreement suggests that the 6732team has not been communicating properly in the first place. In order 6733to collaborate under @emph{any} source management regimen, developers 6734must agree on the general design of the system; given this agreement, 6735overlapping changes are usually straightforward to merge. 6736 6737In some cases unreserved checkouts are clearly 6738inappropriate. If no merge tool exists for the kind of 6739file you are managing (for example word processor files 6740or files edited by Computer Aided Design programs), and 6741it is not desirable to change to a program which uses a 6742mergeable data format, then resolving conflicts is 6743going to be unpleasant enough that you generally will 6744be better off to simply avoid the conflicts instead, by 6745using reserved checkouts. 6746 6747The watches features described above in @ref{Watches} 6748can be considered to be an intermediate model between 6749reserved checkouts and unreserved checkouts. When you 6750go to edit a file, it is possible to find out who else 6751is editing it. And rather than having the system 6752simply forbid both people editing the file, it can tell 6753you what the situation is and let you figure out 6754whether it is a problem in that particular case or not. 6755Therefore, for some groups it can be considered the 6756best of both the reserved checkout and unreserved 6757checkout worlds. 6758 6759@c --------------------------------------------------------------------- 6760@node Revision management 6761@chapter Revision management 6762@cindex Revision management 6763 6764@c -- This chapter could be expanded a lot. 6765@c -- Experiences are very welcome! 6766 6767If you have read this far, you probably have a pretty 6768good grasp on what @sc{cvs} can do for you. This 6769chapter talks a little about things that you still have 6770to decide. 6771 6772If you are doing development on your own using @sc{cvs} 6773you could probably skip this chapter. The questions 6774this chapter takes up become more important when more 6775than one person is working in a repository. 6776 6777@menu 6778* When to commit:: Some discussion on the subject 6779@end menu 6780 6781@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6782@node When to commit 6783@section When to commit? 6784@cindex When to commit 6785@cindex Committing, when to 6786@cindex Policy 6787 6788Your group should decide which policy to use regarding 6789commits. Several policies are possible, and as your 6790experience with @sc{cvs} grows you will probably find 6791out what works for you. 6792 6793If you commit files too quickly you might commit files 6794that do not even compile. If your partner updates his 6795working sources to include your buggy file, he will be 6796unable to compile the code. On the other hand, other 6797persons will not be able to benefit from the 6798improvements you make to the code if you commit very 6799seldom, and conflicts will probably be more common. 6800 6801It is common to only commit files after making sure 6802that they can be compiled. Some sites require that the 6803files pass a test suite. Policies like this can be 6804enforced using the commitinfo file 6805(@pxref{commitinfo}), but you should think twice before 6806you enforce such a convention. By making the 6807development environment too controlled it might become 6808too regimented and thus counter-productive to the real 6809goal, which is to get software written. 6810 6811@c --------------------------------------------------------------------- 6812@node Keyword substitution 6813@chapter Keyword substitution 6814@cindex Keyword substitution 6815@cindex Keyword expansion 6816@cindex Identifying files 6817 6818@comment Be careful when editing this chapter. 6819@comment Remember that this file is kept under 6820@comment version control, so we must not accidentally 6821@comment include a valid keyword in the running text. 6822 6823As long as you edit source files inside a working 6824directory you can always find out the state of 6825your files via @samp{cvs status} and @samp{cvs log}. 6826But as soon as you export the files from your 6827development environment it becomes harder to identify 6828which revisions they are. 6829 6830@sc{cvs} can use a mechanism known as @dfn{keyword 6831substitution} (or @dfn{keyword expansion}) to help 6832identifying the files. Embedded strings of the form 6833@code{$@var{keyword}$} and 6834@code{$@var{keyword}:@dots{}$} in a file are replaced 6835with strings of the form 6836@code{$@var{keyword}:@var{value}$} whenever you obtain 6837a new revision of the file. 6838 6839@menu 6840* Keyword list:: Keywords 6841* Using keywords:: Using keywords 6842* Avoiding substitution:: Avoiding substitution 6843* Substitution modes:: Substitution modes 6844* Log keyword:: Problems with the $@splitrcskeyword{Log}$ keyword. 6845@end menu 6846 6847@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6848@node Keyword list 6849@section Keyword List 6850@cindex Keyword List 6851 6852@c FIXME: need some kind of example here I think, 6853@c perhaps in a 6854@c "Keyword intro" node. The intro in the "Keyword 6855@c substitution" node itself seems OK, but to launch 6856@c into a list of the keywords somehow seems too abrupt. 6857 6858This is a list of the keywords: 6859 6860@table @code 6861@cindex Author keyword 6862@item $@splitrcskeyword{Author}$ 6863The login name of the user who checked in the revision. 6864 6865@cindex Date keyword 6866@item $@splitrcskeyword{Date}$ 6867The date and time (UTC) the revision was checked in. 6868 6869@cindex Header keyword 6870@item $@splitrcskeyword{Header}$ 6871A standard header containing the full pathname of the 6872@sc{rcs} file, the revision number, the date (UTC), the 6873author, the state, and the locker (if locked). Files 6874will normally never be locked when you use @sc{cvs}. 6875 6876@cindex Id keyword 6877@item $@splitrcskeyword{Id}$ 6878Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs} 6879filename is without a path. 6880 6881@cindex Name keyword 6882@item $@splitrcskeyword{Name}$ 6883Tag name used to check out this file. The keyword is 6884expanded only if one checks out with an explicit tag 6885name. For example, when running the command @code{cvs 6886co -r first}, the keyword expands to @samp{Name: first}. 6887 6888@cindex Locker keyword 6889@item $@splitrcskeyword{Locker}$ 6890The login name of the user who locked the revision 6891(empty if not locked, which is the normal case unless 6892@code{cvs admin -l} is in use). 6893 6894@cindex Log keyword 6895@item $@splitrcskeyword{Log}$ 6896The log message supplied during commit, preceded by a 6897header containing the @sc{rcs} filename, the revision 6898number, the author, and the date (UTC). Existing log 6899messages are @emph{not} replaced. Instead, the new log 6900message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}. 6901Each new line is prefixed with the same string which 6902precedes the @code{$Log} keyword. For example, if the 6903file contains: 6904 6905@example 6906 /* Here is what people have been up to: 6907 * 6908 * $@splitrcskeyword{Log}: frob.c,v $ 6909 * Revision 1.1 1997/01/03 14:23:51 joe 6910 * Add the superfrobnicate option 6911 * 6912 */ 6913@end example 6914 6915@noindent 6916then additional lines which are added when expanding 6917the @code{$Log} keyword will be preceded by @samp{ * }. 6918Unlike previous versions of @sc{cvs} and @sc{rcs}, the 6919@dfn{comment leader} from the @sc{rcs} file is not used. 6920The @code{$Log} keyword is useful for 6921accumulating a complete change log in a source file, 6922but for several reasons it can be problematic. 6923@xref{Log keyword}. 6924 6925@cindex RCSfile keyword 6926@item $@splitrcskeyword{RCSfile}$ 6927The name of the RCS file without a path. 6928 6929@cindex Revision keyword 6930@item $@splitrcskeyword{Revision}$ 6931The revision number assigned to the revision. 6932 6933@cindex Source keyword 6934@item $@splitrcskeyword{Source}$ 6935The full pathname of the RCS file. 6936 6937@cindex State keyword 6938@item $@splitrcskeyword{State}$ 6939The state assigned to the revision. States can be 6940assigned with @code{cvs admin -s}---see @ref{admin options}. 6941 6942@end table 6943 6944@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6945@node Using keywords 6946@section Using keywords 6947 6948To include a keyword string you simply include the 6949relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the 6950file, and commit the file. @sc{cvs} will automatically (Or, 6951more accurately, as part of the update run that 6952automatically happens after a commit.) 6953expand the string as part of the commit operation. 6954 6955It is common to embed the @code{$@splitrcskeyword{Id}$} string in 6956the source files so that it gets passed through to 6957generated files. For example, if you are managing 6958computer program source code, you might include a 6959variable which is initialized to contain that string. 6960Or some C compilers may provide a @code{#pragma ident} 6961directive. Or a document management system might 6962provide a way to pass a string through to generated 6963files. 6964 6965@c Would be nice to give an example, but doing this in 6966@c portable C is not possible and the problem with 6967@c picking any one language (VMS HELP files, Ada, 6968@c troff, whatever) is that people use CVS for all 6969@c kinds of files. 6970 6971@cindex Ident (shell command) 6972The @code{ident} command (which is part of the @sc{rcs} 6973package) can be used to extract keywords and their 6974values from a file. This can be handy for text files, 6975but it is even more useful for extracting keywords from 6976binary files. 6977 6978@example 6979$ ident samp.c 6980samp.c: 6981 $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6982$ gcc samp.c 6983$ ident a.out 6984a.out: 6985 $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $ 6986@end example 6987 6988@cindex What (shell command) 6989S@sc{ccs} is another popular revision control system. 6990It has a command, @code{what}, which is very similar to 6991@code{ident} and used for the same purpose. Many sites 6992without @sc{rcs} have @sc{sccs}. Since @code{what} 6993looks for the character sequence @code{@@(#)} it is 6994easy to include keywords that are detected by either 6995command. Simply prefix the keyword with the 6996magic @sc{sccs} phrase, like this: 6997 6998@example 6999static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $"; 7000@end example 7001 7002@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7003@node Avoiding substitution 7004@section Avoiding substitution 7005 7006Keyword substitution has its disadvantages. Sometimes 7007you might want the literal text string 7008@samp{$@splitrcskeyword{Author}$} to appear inside a file without 7009@sc{cvs} interpreting it as a keyword and expanding it 7010into something like @samp{$@splitrcskeyword{Author}: ceder $}. 7011 7012There is unfortunately no way to selectively turn off 7013keyword substitution. You can use @samp{-ko} 7014(@pxref{Substitution modes}) to turn off keyword 7015substitution entirely. 7016 7017In many cases you can avoid using keywords in 7018the source, even though they appear in the final 7019product. For example, the source for this manual 7020contains @samp{$@@asis@{@}Author$} whenever the text 7021@samp{$@splitrcskeyword{Author}$} should appear. In @code{nroff} 7022and @code{troff} you can embed the null-character 7023@code{\&} inside the keyword for a similar effect. 7024 7025@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7026@node Substitution modes 7027@section Substitution modes 7028@cindex Keyword substitution, changing modes 7029@cindex -k (keyword substitution) 7030@cindex Kflag 7031 7032@c FIXME: This could be made more coherent, by expanding it 7033@c with more examples or something. 7034Each file has a stored default substitution mode, and 7035each working directory copy of a file also has a 7036substitution mode. The former is set by the @samp{-k} 7037option to @code{cvs add} and @code{cvs admin}; the 7038latter is set by the @samp{-k} or @samp{-A} options to @code{cvs 7039checkout} or @code{cvs update}. 7040@code{cvs diff} and @code{cvs rdiff} also 7041have @samp{-k} options. 7042For some examples, 7043see @ref{Binary files}, and @ref{Merging and keywords}. 7044@c The fact that -A is overloaded to mean both reset 7045@c sticky options and reset sticky tags/dates is 7046@c somewhat questionable. Perhaps there should be 7047@c separate options to reset sticky options (e.g. -k 7048@c A") and tags/dates (someone suggested -r HEAD could 7049@c do this instead of setting a sticky tag of "HEAD" 7050@c as in the status quo but I haven't thought much 7051@c about that idea. Of course -r .reset or something 7052@c could be coined if this needs to be a new option). 7053@c On the other hand, having -A mean "get things back 7054@c into the state after a fresh checkout" has a certain 7055@c appeal, and maybe there is no sufficient reason for 7056@c creeping featurism in this area. 7057 7058The modes available are: 7059 7060@table @samp 7061@item -kkv 7062Generate keyword strings using the default form, e.g. 7063@code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision} 7064keyword. 7065 7066@item -kkvl 7067Like @samp{-kkv}, except that a locker's name is always 7068inserted if the given revision is currently locked. 7069The locker's name is only relevant if @code{cvs admin 7070-l} is in use. 7071 7072@item -kk 7073Generate only keyword names in keyword strings; omit 7074their values. For example, for the @code{Revision} 7075keyword, generate the string @code{$@splitrcskeyword{Revision}$} 7076instead of @code{$@splitrcskeyword{Revision}: 5.7 $}. This option 7077is useful to ignore differences due to keyword 7078substitution when comparing different revisions of a 7079file (@pxref{Merging and keywords}). 7080 7081@item -ko 7082Generate the old keyword string, present in the working 7083file just before it was checked in. For example, for 7084the @code{Revision} keyword, generate the string 7085@code{$@splitrcskeyword{Revision}: 1.1 $} instead of 7086@code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the 7087string appeared when the file was checked in. 7088 7089@item -kb 7090Like @samp{-ko}, but also inhibit conversion of line 7091endings between the canonical form in which they are 7092stored in the repository (linefeed only), and the form 7093appropriate to the operating system in use on the 7094client. For systems, like unix, which use linefeed 7095only to terminate lines, this is the same as 7096@samp{-ko}. For more information on binary files, see 7097@ref{Binary files}. 7098 7099@item -kv 7100Generate only keyword values for keyword strings. For 7101example, for the @code{Revision} keyword, generate the string 7102@code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}. 7103This can help generate files in programming languages 7104where it is hard to strip keyword delimiters like 7105@code{$@splitrcskeyword{Revision}: $} from a string. However, 7106further keyword substitution cannot be performed once 7107the keyword names are removed, so this option should be 7108used with care. 7109 7110One often would like to use @samp{-kv} with @code{cvs 7111export}---@pxref{export}. But be aware that doesn't 7112handle an export containing binary files correctly. 7113 7114@end table 7115 7116@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7117@node Log keyword 7118@section Problems with the $@splitrcskeyword{Log}$ keyword. 7119 7120The @code{$@splitrcskeyword{Log}$} keyword is somewhat 7121controversial. As long as you are working on your 7122development system the information is easily accessible 7123even if you do not use the @code{$@splitrcskeyword{Log}$} 7124keyword---just do a @code{cvs log}. Once you export 7125the file the history information might be useless 7126anyhow. 7127 7128A more serious concern is that @sc{cvs} is not good at 7129handling @code{$@splitrcskeyword{Log}$} entries when a branch is 7130merged onto the main trunk. Conflicts often result 7131from the merging operation. 7132@c Might want to check whether the CVS implementation 7133@c of RCS_merge has this problem the same way rcsmerge 7134@c does. I would assume so.... 7135 7136People also tend to "fix" the log entries in the file 7137(correcting spelling mistakes and maybe even factual 7138errors). If that is done the information from 7139@code{cvs log} will not be consistent with the 7140information inside the file. This may or may not be a 7141problem in real life. 7142 7143It has been suggested that the @code{$@splitrcskeyword{Log}$} 7144keyword should be inserted @emph{last} in the file, and 7145not in the files header, if it is to be used at all. 7146That way the long list of change messages will not 7147interfere with everyday source file browsing. 7148 7149@c --------------------------------------------------------------------- 7150@node Tracking sources 7151@chapter Tracking third-party sources 7152@cindex Third-party sources 7153@cindex Tracking sources 7154 7155@c FIXME: Need discussion of added and removed files. 7156@c FIXME: This doesn't really adequately introduce the 7157@c concepts of "vendor" and "you". They don't *have* 7158@c to be separate organizations or separate people. 7159@c We want a description which is somewhat more based on 7160@c the technical issues of which sources go where, but 7161@c also with enough examples of how this relates to 7162@c relationships like customer-supplier, developer-QA, 7163@c maintainer-contributor, or whatever, to make it 7164@c seem concrete. 7165If you modify a program to better fit your site, you 7166probably want to include your modifications when the next 7167release of the program arrives. @sc{cvs} can help you with 7168this task. 7169 7170@cindex Vendor 7171@cindex Vendor branch 7172@cindex Branch, vendor- 7173In the terminology used in @sc{cvs}, the supplier of the 7174program is called a @dfn{vendor}. The unmodified 7175distribution from the vendor is checked in on its own 7176branch, the @dfn{vendor branch}. @sc{cvs} reserves branch 71771.1.1 for this use. 7178 7179When you modify the source and commit it, your revision 7180will end up on the main trunk. When a new release is 7181made by the vendor, you commit it on the vendor branch 7182and copy the modifications onto the main trunk. 7183 7184Use the @code{import} command to create and update 7185the vendor branch. When you import a new file, 7186the vendor branch is made the `head' revision, so 7187anyone that checks out a copy of the file gets that 7188revision. When a local modification is committed it is 7189placed on the main trunk, and made the `head' 7190revision. 7191 7192@menu 7193* First import:: Importing for the first time 7194* Update imports:: Updating with the import command 7195* Reverting local changes:: Reverting to the latest vendor release 7196* Binary files in imports:: Binary files require special handling 7197* Keywords in imports:: Keyword substitution might be undesirable 7198* Multiple vendor branches:: What if you get sources from several places? 7199@end menu 7200 7201@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7202@node First import 7203@section Importing for the first time 7204@cindex Importing modules 7205 7206@c Should mention naming conventions for vendor tags, 7207@c release tags, and perhaps directory names. 7208Use the @code{import} command to check in the sources 7209for the first time. When you use the @code{import} 7210command to track third-party sources, the @dfn{vendor 7211tag} and @dfn{release tags} are useful. The 7212@dfn{vendor tag} is a symbolic name for the branch 7213(which is always 1.1.1, unless you use the @samp{-b 7214@var{branch}} flag---see @ref{Multiple vendor branches}.). The 7215@dfn{release tags} are symbolic names for a particular 7216release, such as @samp{FSF_0_04}. 7217 7218@c I'm not completely sure this belongs here. But 7219@c we need to say it _somewhere_ reasonably obvious; it 7220@c is a common misconception among people first learning CVS 7221Note that @code{import} does @emph{not} change the 7222directory in which you invoke it. In particular, it 7223does not set up that directory as a @sc{cvs} working 7224directory; if you want to work with the sources import 7225them first and then check them out into a different 7226directory (@pxref{Getting the source}). 7227 7228@cindex wdiff (import example) 7229Suppose you have the sources to a program called 7230@code{wdiff} in a directory @file{wdiff-0.04}, 7231and are going to make private modifications that you 7232want to be able to use even when new releases are made 7233in the future. You start by importing the source to 7234your repository: 7235 7236@example 7237$ cd wdiff-0.04 7238$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04 7239@end example 7240 7241The vendor tag is named @samp{FSF_DIST} in the above 7242example, and the only release tag assigned is 7243@samp{WDIFF_0_04}. 7244@c FIXME: Need to say where fsf/wdiff comes from. 7245 7246@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7247@node Update imports 7248@section Updating with the import command 7249 7250When a new release of the source arrives, you import it into the 7251repository with the same @code{import} command that you used to set up 7252the repository in the first place. The only difference is that you 7253specify a different release tag this time: 7254 7255@example 7256$ tar xfz wdiff-0.05.tar.gz 7257$ cd wdiff-0.05 7258$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05 7259@end example 7260 7261@strong{WARNING: If you use a release tag that already exists in one of the 7262repository archives, files removed by an import may not be detected.} 7263 7264For files that have not been modified locally, the newly created 7265revision becomes the head revision. If you have made local 7266changes, @code{import} will warn you that you must merge the changes 7267into the main trunk, and tell you to use @samp{checkout -j} to do so: 7268 7269@c FIXME: why "wdiff" here and "fsf/wdiff" in the 7270@c "import"? I think the assumption is that one has 7271@c "wdiff fsf/wdiff" or some such in modules, but it 7272@c would be better to not use modules in this example. 7273@example 7274$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff 7275@end example 7276 7277@noindent 7278The above command will check out the latest revision of 7279@samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST} 7280since yesterday into the working copy. If any conflicts arise during 7281the merge they should be resolved in the normal way (@pxref{Conflicts 7282example}). Then, the modified files may be committed. 7283 7284However, it is much better to use the two release tags rather than using 7285a date on the branch as suggested above: 7286 7287@example 7288$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff 7289@end example 7290 7291@noindent 7292The reason this is better is that 7293using a date, as suggested above, assumes that you do 7294not import more than one release of a product per day. 7295More importantly, using the release tags allows @sc{cvs} to detect files 7296that were removed between the two vendor releases and mark them for 7297removal. Since @code{import} has no way to detect removed files, you 7298should do a merge like this even if @code{import} doesn't tell you to. 7299 7300@node Reverting local changes 7301@section Reverting to the latest vendor release 7302 7303You can also revert local changes completely and return 7304to the latest vendor release by changing the `head' 7305revision back to the vendor branch on all files. For 7306example, if you have a checked-out copy of the sources 7307in @file{~/work.d/wdiff}, and you want to revert to the 7308vendor's version for all the files in that directory, 7309you would type: 7310 7311@example 7312$ cd ~/work.d/wdiff 7313$ cvs admin -bFSF_DIST . 7314@end example 7315 7316@noindent 7317You must specify the @samp{-bFSF_DIST} without any space 7318after the @samp{-b}. @xref{admin options}. 7319 7320@node Binary files in imports 7321@section How to handle binary files with cvs import 7322 7323Use the @samp{-k} wrapper option to tell import which 7324files are binary. @xref{Wrappers}. 7325 7326@node Keywords in imports 7327@section How to handle keyword substitution with cvs import 7328 7329The sources which you are importing may contain 7330keywords (@pxref{Keyword substitution}). For example, 7331the vendor may use @sc{cvs} or some other system 7332which uses similar keyword expansion syntax. If you 7333just import the files in the default fashion, then 7334the keyword expansions supplied by the vendor will 7335be replaced by keyword expansions supplied by your 7336own copy of @sc{cvs}. It may be more convenient to 7337maintain the expansions supplied by the vendor, so 7338that this information can supply information about 7339the sources that you imported from the vendor. 7340 7341To maintain the keyword expansions supplied by the 7342vendor, supply the @samp{-ko} option to @code{cvs 7343import} the first time you import the file. 7344This will turn off keyword expansion 7345for that file entirely, so if you want to be more 7346selective you'll have to think about what you want 7347and use the @samp{-k} option to @code{cvs update} or 7348@code{cvs admin} as appropriate. 7349@c Supplying -ko to import if the file already existed 7350@c has no effect. Not clear to me whether it should 7351@c or not. 7352 7353@node Multiple vendor branches 7354@section Multiple vendor branches 7355 7356All the examples so far assume that there is only one 7357vendor from which you are getting sources. In some 7358situations you might get sources from a variety of 7359places. For example, suppose that you are dealing with 7360a project where many different people and teams are 7361modifying the software. There are a variety of ways to 7362handle this, but in some cases you have a bunch of 7363source trees lying around and what you want to do more 7364than anything else is just to all put them in @sc{cvs} so 7365that you at least have them in one place. 7366 7367For handling situations in which there may be more than 7368one vendor, you may specify the @samp{-b} option to 7369@code{cvs import}. It takes as an argument the vendor 7370branch to import to. The default is @samp{-b 1.1.1}. 7371 7372For example, suppose that there are two teams, the red 7373team and the blue team, that are sending you sources. 7374You want to import the red team's efforts to branch 73751.1.1 and use the vendor tag RED. You want to import 7376the blue team's efforts to branch 1.1.3 and use the 7377vendor tag BLUE. So the commands you might use are: 7378 7379@example 7380$ cvs import dir RED RED_1-0 7381$ cvs import -b 1.1.3 dir BLUE BLUE_1-5 7382@end example 7383 7384Note that if your vendor tag does not match your 7385@samp{-b} option, @sc{cvs} will not detect this case! For 7386example, 7387 7388@example 7389$ cvs import -b 1.1.3 dir RED RED_1-0 7390@end example 7391 7392@noindent 7393Be careful; this kind of mismatch is sure to sow 7394confusion or worse. I can't think of a useful purpose 7395for the ability to specify a mismatch here, but if you 7396discover such a use, don't. @sc{cvs} is likely to make this 7397an error in some future release. 7398 7399@c Probably should say more about the semantics of 7400@c multiple branches. What about the default branch? 7401@c What about joining (perhaps not as useful with 7402@c multiple branches, or perhaps it is. Either way 7403@c should be mentioned). 7404 7405@c I'm not sure about the best location for this. In 7406@c one sense, it might belong right after we've introduced 7407@c CVS's basic version control model, because people need 7408@c to figure out builds right away. The current location 7409@c is based on the theory that it kind of akin to the 7410@c "Revision management" section. 7411@node Builds 7412@chapter How your build system interacts with CVS 7413@cindex Builds 7414@cindex make 7415 7416As mentioned in the introduction, @sc{cvs} does not 7417contain software for building your software from source 7418code. This section describes how various aspects of 7419your build system might interact with @sc{cvs}. 7420 7421@c Is there a way to discuss this without reference to 7422@c tools other than CVS? I'm not sure there is; I 7423@c wouldn't think that people who learn CVS first would 7424@c even have this concern. 7425One common question, especially from people who are 7426accustomed to @sc{rcs}, is how to make their build get 7427an up to date copy of the sources. The answer to this 7428with @sc{cvs} is two-fold. First of all, since 7429@sc{cvs} itself can recurse through directories, there 7430is no need to modify your @file{Makefile} (or whatever 7431configuration file your build tool uses) to make sure 7432each file is up to date. Instead, just use two 7433commands, first @code{cvs -q update} and then 7434@code{make} or whatever the command is to invoke your 7435build tool. Secondly, you do not necessarily 7436@emph{want} to get a copy of a change someone else made 7437until you have finished your own work. One suggested 7438approach is to first update your sources, then 7439implement, build and 7440test the change you were thinking of, and then commit 7441your sources (updating first if necessary). By 7442periodically (in between changes, using the approach 7443just described) updating your entire tree, you ensure 7444that your sources are sufficiently up to date. 7445 7446@cindex Bill of materials 7447One common need is to record which versions of which 7448source files went into a particular build. This kind 7449of functionality is sometimes called @dfn{bill of 7450materials} or something similar. The best way to do 7451this with @sc{cvs} is to use the @code{tag} command to 7452record which versions went into a given build 7453(@pxref{Tags}). 7454 7455Using @sc{cvs} in the most straightforward manner 7456possible, each developer will have a copy of the entire 7457source tree which is used in a particular build. If 7458the source tree is small, or if developers are 7459geographically dispersed, this is the preferred 7460solution. In fact one approach for larger projects is 7461to break a project down into smaller 7462@c I say subsystem instead of module because they may or 7463@c may not use the modules file. 7464separately-compiled subsystems, and arrange a way of 7465releasing them internally so that each developer need 7466check out only those subsystems which they are 7467actively working on. 7468 7469Another approach is to set up a structure which allows 7470developers to have their own copies of some files, and 7471for other files to access source files from a central 7472location. Many people have come up with some such a 7473@c two such people are paul@sander.cupertino.ca.us (for 7474@c a previous employer) 7475@c and gunnar.tornblom@se.abb.com (spicm and related tools), 7476@c but as far as I know 7477@c no one has nicely packaged or released such a system (or 7478@c instructions for constructing one). 7479system using features such as the symbolic link feature 7480found in many operating systems, or the @code{VPATH} 7481feature found in many versions of @code{make}. One build 7482tool which is designed to help with this kind of thing 7483is Odin (see 7484@code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}). 7485@c Should we be saying more about Odin? Or how you use 7486@c it with CVS? Also, the Prime Time Freeware for Unix 7487@c disk (see http://www.ptf.com/) has Odin (with a nice 7488@c paragraph summarizing it on the web), so that might be a 7489@c semi-"official" place to point people. 7490@c 7491@c Of course, many non-CVS systems have this kind of 7492@c functionality, for example OSF's ODE 7493@c (http://www.osf.org/ode/) or mk 7494@c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html 7495@c He has changed providers in the past; a search engine search 7496@c for "Peter Ziobrzynski" probably won't get too many 7497@c spurious hits :-). A more stable URL might be 7498@c ftp://ftp.uu.net/pub/cmvc/mk). But I'm not sure 7499@c there is any point in mentioning them here unless they 7500@c can work with CVS. 7501 7502@c --------------------------------------------------------------------- 7503@node Special Files 7504@chapter Special Files 7505 7506@cindex Special files 7507@cindex Device nodes 7508@cindex Ownership, saving in CVS 7509@cindex Permissions, saving in CVS 7510@cindex Hard links 7511@cindex Symbolic links 7512 7513In normal circumstances, @sc{cvs} works only with regular 7514files. Every file in a project is assumed to be 7515persistent; it must be possible to open, read and close 7516them; and so on. @sc{cvs} also ignores file permissions and 7517ownerships, leaving such issues to be resolved by the 7518developer at installation time. In other words, it is 7519not possible to "check in" a device into a repository; 7520if the device file cannot be opened, @sc{cvs} will refuse to 7521handle it. Files also lose their ownerships and 7522permissions during repository transactions. 7523 7524@ignore 7525If the configuration variable @code{PreservePermissions} 7526(@pxref{config}) is set in the repository, @sc{cvs} will 7527save the following file characteristics in the 7528repository: 7529 7530@itemize @bullet 7531@item user and group ownership 7532@item permissions 7533@item major and minor device numbers 7534@item symbolic links 7535@item hard link structure 7536@end itemize 7537 7538Using the @code{PreservePermissions} option affects the 7539behavior of @sc{cvs} in several ways. First, some of the 7540new operations supported by @sc{cvs} are not accessible to 7541all users. In particular, file ownership and special 7542file characteristics may only be changed by the 7543superuser. When the @code{PreservePermissions} 7544configuration variable is set, therefore, users will 7545have to be `root' in order to perform @sc{cvs} operations. 7546 7547When @code{PreservePermissions} is in use, some @sc{cvs} 7548operations (such as @samp{cvs status}) will not 7549recognize a file's hard link structure, and so will 7550emit spurious warnings about mismatching hard links. 7551The reason is that @sc{cvs}'s internal structure does not 7552make it easy for these operations to collect all the 7553necessary data about hard links, so they check for file 7554conflicts with inaccurate data. 7555 7556A more subtle difference is that @sc{cvs} considers a file 7557to have changed only if its contents have changed 7558(specifically, if the modification time of the working 7559file does not match that of the repository's file). 7560Therefore, if only the permissions, ownership or hard 7561linkage have changed, or if a device's major or minor 7562numbers have changed, @sc{cvs} will not notice. In order to 7563commit such a change to the repository, you must force 7564the commit with @samp{cvs commit -f}. This also means 7565that if a file's permissions have changed and the 7566repository file is newer than the working copy, 7567performing @samp{cvs update} will silently change the 7568permissions on the working copy. 7569 7570Changing hard links in a @sc{cvs} repository is particularly 7571delicate. Suppose that file @file{foo} is linked to 7572file @file{old}, but is later relinked to file 7573@file{new}. You can wind up in the unusual situation 7574where, although @file{foo}, @file{old} and @file{new} 7575have all had their underlying link patterns changed, 7576only @file{foo} and @file{new} have been modified, so 7577@file{old} is not considered a candidate for checking 7578in. It can be very easy to produce inconsistent 7579results this way. Therefore, we recommend that when it 7580is important to save hard links in a repository, the 7581prudent course of action is to @code{touch} any file 7582whose linkage or status has changed since the last 7583checkin. Indeed, it may be wise to @code{touch *} 7584before each commit in a directory with complex hard 7585link structures. 7586 7587It is worth noting that only regular files may 7588be merged, for reasons that hopefully are obvious. If 7589@samp{cvs update} or @samp{cvs checkout -j} attempts to 7590merge a symbolic link with a regular file, or two 7591device files for different kinds of devices, @sc{cvs} will 7592report a conflict and refuse to perform the merge. At 7593the same time, @samp{cvs diff} will not report any 7594differences between these files, since no meaningful 7595textual comparisons can be made on files which contain 7596no text. 7597 7598The @code{PreservePermissions} features do not work 7599with client/server @sc{cvs}. Another limitation is 7600that hard links must be to other files within the same 7601directory; hard links across directories are not 7602supported. 7603@end ignore 7604 7605@c --------------------------------------------------------------------- 7606@c ----- START MAN 1 ----- 7607@node CVS commands 7608@appendix Guide to CVS commands 7609 7610This appendix describes the overall structure of 7611@sc{cvs} commands, and describes some commands in 7612detail (others are described elsewhere; for a quick 7613reference to @sc{cvs} commands, @pxref{Invoking CVS}). 7614@c The idea is that we want to move the commands which 7615@c are described here into the main body of the manual, 7616@c in the process reorganizing the manual to be 7617@c organized around what the user wants to do, not 7618@c organized around CVS commands. 7619@c 7620@c Note that many users do expect a manual which is 7621@c organized by command. At least some users do. 7622@c One good addition to the "organized by command" 7623@c section (if any) would be "see also" links. 7624@c The awk manual might be a good example; it has a 7625@c reference manual which is more verbose than Invoking 7626@c CVS but probably somewhat less verbose than CVS 7627@c Commands. 7628 7629@menu 7630* Structure:: Overall structure of CVS commands 7631* Exit status:: Indicating CVS's success or failure 7632* ~/.cvsrc:: Default options with the ~/.cvsrc file 7633* Global options:: Options you give to the left of cvs_command 7634* Common options:: Options you give to the right of cvs_command 7635* add:: Add files and directories to the repository 7636* admin:: Administration 7637* annotate:: What revision modified each line of a file? 7638* checkout:: Checkout sources for editing 7639* commit:: Check files into the repository 7640* diff:: Show differences between revisions 7641* export:: Export sources from CVS, similar to checkout 7642* history:: Show status of files and users 7643* import:: Import sources into CVS, using vendor branches 7644* log:: Show log messages for files 7645* rdiff:: 'patch' format diffs between releases 7646* release:: Indicate that a directory is no longer in use 7647* remove:: Remove files from active development 7648* update:: Bring work tree in sync with repository 7649@end menu 7650 7651@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7652@node Structure 7653@appendixsec Overall structure of CVS commands 7654@cindex Structure 7655@cindex CVS command structure 7656@cindex Command structure 7657@cindex Format of CVS commands 7658 7659The overall format of all @sc{cvs} commands is: 7660 7661@example 7662cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ] 7663@end example 7664 7665@table @code 7666@item cvs 7667The name of the @sc{cvs} program. 7668 7669@item cvs_options 7670Some options that affect all sub-commands of @sc{cvs}. These are 7671described below. 7672 7673@item cvs_command 7674One of several different sub-commands. Some of the commands have 7675aliases that can be used instead; those aliases are noted in the 7676reference manual for that command. There are only two situations 7677where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a 7678list of available commands, and @samp{cvs -v} displays version 7679information on @sc{cvs} itself. 7680 7681@item command_options 7682Options that are specific for the command. 7683 7684@item command_args 7685Arguments to the commands. 7686@end table 7687 7688There is unfortunately some confusion between 7689@code{cvs_options} and @code{command_options}. 7690When given as a @code{cvs_option}, some options only 7691affect some of the commands. When given as a 7692@code{command_option} it may have a different meaning, and 7693be accepted by more commands. In other words, do not 7694take the above categorization too seriously. Look at 7695the documentation instead. 7696 7697@node Exit status 7698@appendixsec CVS's exit status 7699@cindex Exit status, of CVS 7700 7701@sc{cvs} can indicate to the calling environment whether it 7702succeeded or failed by setting its @dfn{exit status}. 7703The exact way of testing the exit status will vary from 7704one operating system to another. For example in a unix 7705shell script the @samp{$?} variable will be 0 if the 7706last command returned a successful exit status, or 7707greater than 0 if the exit status indicated failure. 7708 7709If @sc{cvs} is successful, it returns a successful status; 7710if there is an error, it prints an error message and 7711returns a failure status. The one exception to this is 7712the @code{cvs diff} command. It will return a 7713successful status if it found no differences, or a 7714failure status if there were differences or if there 7715was an error. Because this behavior provides no good 7716way to detect errors, in the future it is possible that 7717@code{cvs diff} will be changed to behave like the 7718other @sc{cvs} commands. 7719@c It might seem like checking whether cvs -q diff 7720@c produces empty or non-empty output can tell whether 7721@c there were differences or not. But it seems like 7722@c there are cases with output but no differences 7723@c (testsuite basica-8b). It is not clear to me how 7724@c useful it is for a script to be able to check 7725@c whether there were differences. 7726@c FIXCVS? In previous versions of CVS, cvs diff 7727@c returned 0 for no differences, 1 for differences, or 7728@c 2 for errors. Is this behavior worth trying to 7729@c bring back (but what does it mean for VMS?)? 7730 7731@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7732@node ~/.cvsrc 7733@appendixsec Default options and the ~/.cvsrc file 7734@cindex .cvsrc file 7735@cindex Option defaults 7736 7737There are some @code{command_options} that are used so 7738often that you might have set up an alias or some other 7739means to make sure you always specify that option. One 7740example (the one that drove the implementation of the 7741@file{.cvsrc} support, actually) is that many people find the 7742default output of the @samp{diff} command to be very 7743hard to read, and that either context diffs or unidiffs 7744are much easier to understand. 7745 7746The @file{~/.cvsrc} file is a way that you can add 7747default options to @code{cvs_commands} within cvs, 7748instead of relying on aliases or other shell scripts. 7749 7750The format of the @file{~/.cvsrc} file is simple. The 7751file is searched for a line that begins with the same 7752name as the @code{cvs_command} being executed. If a 7753match is found, then the remainder of the line is split 7754up (at whitespace characters) into separate options and 7755added to the command arguments @emph{before} any 7756options from the command line. 7757 7758If a command has two names (e.g., @code{checkout} and 7759@code{co}), the official name, not necessarily the one 7760used on the command line, will be used to match against 7761the file. So if this is the contents of the user's 7762@file{~/.cvsrc} file: 7763 7764@example 7765log -N 7766diff -uN 7767rdiff -u 7768update -Pd 7769checkout -P 7770release -d 7771@end example 7772 7773@noindent 7774the command @samp{cvs checkout foo} would have the 7775@samp{-P} option added to the arguments, as well as 7776@samp{cvs co foo}. 7777 7778With the example file above, the output from @samp{cvs 7779diff foobar} will be in unidiff format. @samp{cvs diff 7780-c foobar} will provide context diffs, as usual. 7781Getting "old" format diffs would be slightly more 7782complicated, because @code{diff} doesn't have an option 7783to specify use of the "old" format, so you would need 7784@samp{cvs -f diff foobar}. 7785 7786In place of the command name you can use @code{cvs} to 7787specify global options (@pxref{Global options}). For 7788example the following line in @file{.cvsrc} 7789 7790@example 7791cvs -z6 7792@end example 7793 7794@noindent 7795causes @sc{cvs} to use compression level 6. 7796 7797@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7798@node Global options 7799@appendixsec Global options 7800@cindex Options, global 7801@cindex Global options 7802@cindex Left-hand options 7803 7804The available @samp{cvs_options} (that are given to the 7805left of @samp{cvs_command}) are: 7806 7807@table @code 7808@item --allow-root=@var{rootdir} 7809Specify legal @sc{cvsroot} directory. See 7810@ref{Password authentication server}. 7811 7812@cindex Authentication, stream 7813@cindex Stream authentication 7814@item -a 7815Authenticate all communication between the client and 7816the server. Only has an effect on the @sc{cvs} client. 7817As of this writing, this is only implemented when using 7818a GSSAPI connection (@pxref{GSSAPI authenticated}). 7819Authentication prevents certain sorts of attacks 7820involving hijacking the active @sc{tcp} connection. 7821Enabling authentication does not enable encryption. 7822 7823@cindex RCSBIN, overriding 7824@cindex Overriding RCSBIN 7825@item -b @var{bindir} 7826In @sc{cvs} 1.9.18 and older, this specified that 7827@sc{rcs} programs are in the @var{bindir} directory. 7828Current versions of @sc{cvs} do not run @sc{rcs} 7829programs; for compatibility this option is accepted, 7830but it does nothing. 7831 7832@cindex TMPDIR, overriding 7833@cindex Overriding TMPDIR 7834@item -T @var{tempdir} 7835Use @var{tempdir} as the directory where temporary files are 7836located. Overrides the setting of the @code{$TMPDIR} environment 7837variable and any precompiled directory. This parameter should be 7838specified as an absolute pathname. 7839(When running client/server, @samp{-T} affects only the local process; 7840specifying @samp{-T} for the client has no effect on the server and 7841vice versa.) 7842 7843@cindex CVSROOT, overriding 7844@cindex Overriding CVSROOT 7845@item -d @var{cvs_root_directory} 7846Use @var{cvs_root_directory} as the root directory 7847pathname of the repository. Overrides the setting of 7848the @code{$CVSROOT} environment variable. See @ref{Repository}. 7849 7850@cindex EDITOR, overriding 7851@cindex Overriding EDITOR 7852@item -e @var{editor} 7853Use @var{editor} to enter revision log information. Overrides the 7854setting of the @code{$CVSEDITOR} and @code{$EDITOR} 7855environment variables. For more information, see 7856@ref{Committing your changes}. 7857 7858@item -f 7859Do not read the @file{~/.cvsrc} file. This 7860option is most often used because of the 7861non-orthogonality of the @sc{cvs} option set. For 7862example, the @samp{cvs log} option @samp{-N} (turn off 7863display of tag names) does not have a corresponding 7864option to turn the display on. So if you have 7865@samp{-N} in the @file{~/.cvsrc} entry for @samp{log}, 7866you may need to use @samp{-f} to show the tag names. 7867 7868@item -H 7869@itemx --help 7870Display usage information about the specified @samp{cvs_command} 7871(but do not actually execute the command). If you don't specify 7872a command name, @samp{cvs -H} displays overall help for 7873@sc{cvs}, including a list of other help options. 7874@c It seems to me it is better to document it this way 7875@c rather than trying to update this documentation 7876@c every time that we add a --help-foo option. But 7877@c perhaps that is confusing... 7878 7879@cindex Read-only mode 7880@item -n 7881Do not change any files. Attempt to execute the 7882@samp{cvs_command}, but only to issue reports; do not remove, 7883update, or merge any existing files, or create any new files. 7884 7885Note that @sc{cvs} will not necessarily produce exactly 7886the same output as without @samp{-n}. In some cases 7887the output will be the same, but in other cases 7888@sc{cvs} will skip some of the processing that would 7889have been required to produce the exact same output. 7890 7891@item -Q 7892Cause the command to be really quiet; the command will only 7893generate output for serious problems. 7894 7895@item -q 7896Cause the command to be somewhat quiet; informational messages, 7897such as reports of recursion through subdirectories, are 7898suppressed. 7899 7900@cindex Read-only files, and -r 7901@item -r 7902Make new working files read-only. Same effect 7903as if the @code{$CVSREAD} environment variable is set 7904(@pxref{Environment variables}). The default is to 7905make working files writable, unless watches are on 7906(@pxref{Watches}). 7907 7908@item -s @var{variable}=@var{value} 7909Set a user variable (@pxref{Variables}). 7910 7911@cindex Trace 7912@item -t 7913Trace program execution; display messages showing the steps of 7914@sc{cvs} activity. Particularly useful with @samp{-n} to explore the 7915potential impact of an unfamiliar command. 7916 7917@item -v 7918@item --version 7919Display version and copyright information for @sc{cvs}. 7920 7921@cindex CVSREAD, overriding 7922@cindex Overriding CVSREAD 7923@item -w 7924Make new working files read-write. Overrides the 7925setting of the @code{$CVSREAD} environment variable. 7926Files are created read-write by default, unless @code{$CVSREAD} is 7927set or @samp{-r} is given. 7928@c Note that -w only overrides -r and CVSREAD; it has 7929@c no effect on files which are readonly because of 7930@c "cvs watch on". My guess is that is the way it 7931@c should be (or should "cvs -w get" on a watched file 7932@c be the same as a get and a cvs edit?), but I'm not 7933@c completely sure whether to document it this way. 7934 7935@item -x 7936@cindex Encryption 7937Encrypt all communication between the client and the 7938server. Only has an effect on the @sc{cvs} client. As 7939of this writing, this is only implemented when using a 7940GSSAPI connection (@pxref{GSSAPI authenticated}) or a 7941Kerberos connection (@pxref{Kerberos authenticated}). 7942Enabling encryption implies that message traffic is 7943also authenticated. Encryption support is not 7944available by default; it must be enabled using a 7945special configure option, @file{--enable-encryption}, 7946when you build @sc{cvs}. 7947 7948@item -z @var{gzip-level} 7949@cindex Compression 7950@cindex Gzip 7951Set the compression level. 7952Valid levels are 1 (high speed, low compression) to 79539 (low speed, high compression), or 0 to disable 7954compression (the default). 7955Only has an effect on the @sc{cvs} client. 7956 7957@end table 7958 7959@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7960@node Common options 7961@appendixsec Common command options 7962@cindex Common options 7963@cindex Right-hand options 7964 7965This section describes the @samp{command_options} that 7966are available across several @sc{cvs} commands. These 7967options are always given to the right of 7968@samp{cvs_command}. Not all 7969commands support all of these options; each option is 7970only supported for commands where it makes sense. 7971However, when a command has one of these options you 7972can almost always count on the same behavior of the 7973option as in other commands. (Other command options, 7974which are listed with the individual commands, may have 7975different behavior from one @sc{cvs} command to the other). 7976 7977@strong{The @samp{history} command is an exception; it supports 7978many options that conflict even with these standard options.} 7979 7980@table @code 7981@cindex Dates 7982@cindex Time 7983@cindex Specifying dates 7984@item -D @var{date_spec} 7985Use the most recent revision no later than @var{date_spec}. 7986@var{date_spec} is a single argument, a date description 7987specifying a date in the past. 7988 7989The specification is @dfn{sticky} when you use it to make a 7990private copy of a source file; that is, when you get a working 7991file using @samp{-D}, @sc{cvs} records the date you specified, so that 7992further updates in the same directory will use the same date 7993(for more information on sticky tags/dates, @pxref{Sticky tags}). 7994 7995@samp{-D} is available with the @code{annotate}, @code{checkout}, 7996@code{diff}, @code{export}, @code{history}, 7997@code{rdiff}, @code{rtag}, and @code{update} commands. 7998(The @code{history} command uses this option in a 7999slightly different way; @pxref{history options}). 8000 8001@c What other formats should we accept? I don't want 8002@c to start accepting a whole mess of non-standard 8003@c new formats (there are a lot which are in wide use in 8004@c one context or another), but practicality does 8005@c dictate some level of flexibility. 8006@c * POSIX.2 (e.g. touch, ls output, date) and other 8007@c POSIX and/or de facto unix standards (e.g. at). The 8008@c practice here is too inconsistent to be of any use. 8009@c * VMS dates. This is not a formal standard, but 8010@c there is a published specification (see SYS$ASCTIM 8011@c and SYS$BINTIM in the _VMS System Services Reference 8012@c Manual_), it is implemented consistently in VMS 8013@c utilities, and VMS users will expect CVS running on 8014@c VMS to support this format (and if we're going to do 8015@c that, better to make CVS support it on all 8016@c platforms. Maybe). 8017@c 8018@c NOTE: The tar manual has some documentation for 8019@c getdate.y (just for our info; we don't want to 8020@c attempt to document all the formats accepted by 8021@c getdate.y). 8022@c 8023@c One more note: In output, CVS should consistently 8024@c use one date format, and that format should be one that 8025@c it accepts in input as well. The former isn't 8026@c really true (see survey below), and I'm not 8027@c sure that either of those formats is accepted in 8028@c input. 8029@c 8030@c cvs log 8031@c current 1996/01/02 13:45:31 8032@c Internet 02 Jan 1996 13:45:31 UT 8033@c ISO 1996-01-02 13:45:31 8034@c cvs ann 8035@c current 02-Jan-96 8036@c Internet-like 02 Jan 96 8037@c ISO 96-01-02 8038@c cvs status 8039@c current Tue Jun 11 02:54:53 1996 8040@c Internet [Tue,] 11 Jun 1996 02:54:53 8041@c ISO 1996-06-11 02:54:53 8042@c note: date possibly should be omitted entirely for 8043@c other reasons. 8044@c cvs editors 8045@c current Tue Jun 11 02:54:53 1996 GMT 8046@c cvs history 8047@c current 06/11 02:54 +0000 8048@c any others? 8049@c There is a good chance the proper solution has to 8050@c involve at least some level of letting the user 8051@c decide which format (with the default being the 8052@c formats CVS has always used; changing these might be 8053@c _very_ disruptive since scripts may very well be 8054@c parsing them). 8055@c 8056@c Another random bit of prior art concerning dates is 8057@c the strptime function which takes templates such as 8058@c "%m/%d/%y", and apparent a variant of getdate() 8059@c which also honors them. See 8060@c X/Open CAE Specification, System Interfaces and 8061@c Headers Issue 4, Version 2 (September 1994), in the 8062@c entry for getdate() on page 231 8063 8064@cindex Timezone, in input 8065@cindex Zone, time, in input 8066A wide variety of date formats are supported by 8067@sc{cvs}. The most standard ones are ISO8601 (from the 8068International Standards Organization) and the Internet 8069e-mail standard (specified in RFC822 as amended by 8070RFC1123). 8071 8072@c Probably should be doing more to spell out just what 8073@c the rules are, rather than just giving examples. 8074@c But I want to keep this simple too. 8075@c So I don't know.... 8076@c A few specific issues: (1) Maybe should reassure 8077@c people that years after 2000 8078@c work (they are in the testsuite, so they do indeed 8079@c work). (2) What do two digit years 8080@c mean? Where do we accept them? (3) Local times can 8081@c be ambiguous or nonexistent if they fall during the 8082@c hour when daylight savings time goes into or out of 8083@c effect. Pretty obscure, so I'm not at all sure we 8084@c should be documenting the behavior in that case. 8085ISO8601 dates have many variants but a few examples 8086are: 8087 8088@example 80891972-09-24 80901972-09-24 20:05 8091@end example 8092@c I doubt we really accept all ISO8601 format dates 8093@c (for example, decimal hours like 1972-09-24 20,2) 8094@c I'm not sure we should, many of them are pretty 8095@c bizarre and it has lots of gratuitous multiple ways 8096@c to specify the same thing. 8097 8098There are a lot more ISO8601 date formats, and @sc{cvs} 8099accepts many of them, but you probably don't want to 8100hear the @emph{whole} long story :-). 8101 8102@c Citing a URL here is kind of problematic given how 8103@c much they change and people who have old versions of 8104@c this manual, but in case we want to reinstate an 8105@c ISO8601 URL, a few are: 8106@c http://www.saqqara.demon.co.uk/datefmt.htm 8107@c http://www.cl.cam.ac.uk/~mgk25/iso-time.html 8108@c Citing some other ISO8601 source is probably even 8109@c worse :-). 8110 8111In addition to the dates allowed in Internet e-mail 8112itself, @sc{cvs} also allows some of the fields to be 8113omitted. For example: 8114@c FIXME: Need to figure out better, and document, 8115@c what we want to allow the user to omit. 8116@c NOTE: "omit" does not imply "reorder". 8117@c FIXME: Need to cite a web page describing how to get 8118@c RFC's. 8119 8120@example 812124 Sep 1972 20:05 812224 Sep 8123@end example 8124 8125The date is interpreted as being in the 8126local timezone, unless a specific timezone is 8127specified. 8128 8129These two date formats are preferred. However, 8130@sc{cvs} currently accepts a wide variety of other date 8131formats. They are intentionally not documented here in 8132any detail, and future versions of @sc{cvs} might not 8133accept all of them. 8134@c We should document and testsuite "now" and 8135@c "yesterday". "now" is mentioned in the FAQ and 8136@c "yesterday" is mentioned in this document (and the 8137@c message from "cvs import" suggesting a merge 8138@c command). What else? Probably some/all of the "3 8139@c weeks ago" family. 8140@c 8141@c Maybe at 8142@c some point have CVS start give warnings on "unofficial" 8143@c formats (many of which might be typos or user 8144@c misunderstandings, and/or formats people never/rarely 8145@c use to specify dates)? 8146 8147One such format is 8148@code{@var{month}/@var{day}/@var{year}}. This may 8149confuse people who are accustomed to having the month 8150and day in the other order; @samp{1/4/96} is January 4, 8151not April 1. 8152 8153Remember to quote the argument to the @samp{-D} 8154flag so that your shell doesn't interpret spaces as 8155argument separators. A command using the @samp{-D} 8156flag can look like this: 8157 8158@example 8159$ cvs diff -D "1 hour ago" cvs.texinfo 8160@end example 8161 8162@cindex Forcing a tag match 8163@item -f 8164When you specify a particular date or tag to @sc{cvs} commands, they 8165normally ignore files that do not contain the tag (or did not 8166exist prior to the date) that you specified. Use the @samp{-f} option 8167if you want files retrieved even when there is no match for the 8168tag or date. (The most recent revision of the file 8169will be used). 8170 8171Note that even with @samp{-f}, a tag that you specify 8172must exist (that is, in some file, not necessary in 8173every file). This is so that @sc{cvs} will continue to 8174give an error if you mistype a tag name. 8175 8176@need 800 8177@samp{-f} is available with these commands: 8178@code{annotate}, @code{checkout}, @code{export}, 8179@code{rdiff}, @code{rtag}, and @code{update}. 8180 8181@strong{WARNING: The @code{commit} and @code{remove} 8182commands also have a 8183@samp{-f} option, but it has a different behavior for 8184those commands. See @ref{commit options}, and 8185@ref{Removing files}.} 8186 8187@item -k @var{kflag} 8188Alter the default processing of keywords. 8189See @ref{Keyword substitution}, for the meaning of 8190@var{kflag}. Your @var{kflag} specification is 8191@dfn{sticky} when you use it to create a private copy 8192of a source file; that is, when you use this option 8193with the @code{checkout} or @code{update} commands, 8194@sc{cvs} associates your selected @var{kflag} with the 8195file, and continues to use it with future update 8196commands on the same file until you specify otherwise. 8197 8198The @samp{-k} option is available with the @code{add}, 8199@code{checkout}, @code{diff}, @code{rdiff}, @code{import} and 8200@code{update} commands. 8201 8202@item -l 8203Local; run only in current working directory, rather than 8204recursing through subdirectories. 8205 8206Available with the following commands: @code{annotate}, @code{checkout}, 8207@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8208@code{log}, @code{rdiff}, @code{remove}, @code{rtag}, 8209@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8210and @code{watchers}. 8211 8212@cindex Editor, avoiding invocation of 8213@cindex Avoiding editor invocation 8214@item -m @var{message} 8215Use @var{message} as log information, instead of 8216invoking an editor. 8217 8218Available with the following commands: @code{add}, 8219@code{commit} and @code{import}. 8220 8221@item -n 8222Do not run any tag program. (A program can be 8223specified to run in the modules 8224database (@pxref{modules}); this option bypasses it). 8225 8226@strong{This is not the same as the @samp{cvs -n} 8227program option, which you can specify to the left of a cvs command!} 8228 8229Available with the @code{checkout}, @code{export}, 8230and @code{rtag} commands. 8231 8232@item -P 8233Prune empty directories. See @ref{Removing directories}. 8234 8235@item -p 8236Pipe the files retrieved from the repository to standard output, 8237rather than writing them in the current directory. Available 8238with the @code{checkout} and @code{update} commands. 8239 8240@item -R 8241Process directories recursively. This is on by default. 8242 8243Available with the following commands: @code{annotate}, @code{checkout}, 8244@code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export}, 8245@code{rdiff}, @code{remove}, @code{rtag}, 8246@code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch}, 8247and @code{watchers}. 8248 8249@item -r @var{tag} 8250@cindex HEAD, special tag 8251@cindex BASE, special tag 8252Use the revision specified by the @var{tag} argument instead of the 8253default @dfn{head} revision. As well as arbitrary tags defined 8254with the @code{tag} or @code{rtag} command, two special tags are 8255always available: @samp{HEAD} refers to the most recent version 8256available in the repository, and @samp{BASE} refers to the 8257revision you last checked out into the current working directory. 8258 8259@c FIXME: What does HEAD really mean? I believe that 8260@c the current answer is the head of the default branch 8261@c for all cvs commands except diff. For diff, it 8262@c seems to be (a) the head of the trunk (or the default 8263@c branch?) if there is no sticky tag, (b) the head of the 8264@c branch for the sticky tag, if there is a sticky tag. 8265@c (b) is ugly as it differs 8266@c from what HEAD means for other commands, but people 8267@c and/or scripts are quite possibly used to it. 8268@c See "head" tests in sanity.sh. 8269@c Probably the best fix is to introduce two new 8270@c special tags, ".thead" for the head of the trunk, 8271@c and ".bhead" for the head of the current branch. 8272@c Then deprecate HEAD. This has the advantage of 8273@c not surprising people with a change to HEAD, and a 8274@c side benefit of also phasing out the poorly-named 8275@c HEAD (see discussion of reserved tag names in node 8276@c "Tags"). Of course, .thead and .bhead should be 8277@c carefully implemented (with the implementation the 8278@c same for "diff" as for everyone else), test cases 8279@c written (similar to the ones in "head"), new tests 8280@c cases written for things like default branches, &c. 8281 8282The tag specification is sticky when you use this 8283@c option 8284with @code{checkout} or @code{update} to make your own 8285copy of a file: @sc{cvs} remembers the tag and continues to use it on 8286future update commands, until you specify otherwise (for more information 8287on sticky tags/dates, @pxref{Sticky tags}). 8288 8289The tag can be either a symbolic or numeric tag, as 8290described in @ref{Tags}, or the name of a branch, as 8291described in @ref{Branching and merging}. 8292When a command expects a specific revision, 8293the name of a branch is interpreted as the most recent 8294revision on that branch. 8295 8296Specifying the @samp{-q} global option along with the 8297@samp{-r} command option is often useful, to suppress 8298the warning messages when the @sc{rcs} file 8299does not contain the specified tag. 8300 8301@strong{This is not the same as the overall @samp{cvs -r} option, 8302which you can specify to the left of a @sc{cvs} command!} 8303 8304@samp{-r} is available with the @code{annotate}, @code{checkout}, 8305@code{commit}, @code{diff}, @code{history}, @code{export}, @code{rdiff}, 8306@code{rtag}, and @code{update} commands. 8307 8308@item -W 8309Specify file names that should be filtered. You can 8310use this option repeatedly. The spec can be a file 8311name pattern of the same type that you can specify in 8312the @file{.cvswrappers} file. 8313Available with the following commands: @code{import}, 8314and @code{update}. 8315 8316@end table 8317 8318@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8319@node add 8320@appendixsec add---Add files and directories to the repository 8321@cindex add (subcommand) 8322 8323@itemize @bullet 8324@item 8325Synopsis: add [-k rcs-kflag] [-m message] files... 8326@item 8327Requires: repository, working directory. 8328@item 8329Changes: repository, working directory. 8330@end itemize 8331 8332The @code{add} command is used to present new files 8333and directories for addition into the @sc{cvs} 8334repository. When @code{add} is used on a directory, 8335a new directory is created in the repository 8336immediately. When used on a file, only the working 8337directory is updated. Changes to the repository are 8338not made until the @code{commit} command is used on 8339the newly added file. 8340 8341The @code{add} command also resurrects files that 8342have been previously removed. This can be done 8343before or after the @code{commit} command is used 8344to finalize the removal of files. Resurrected files 8345are restored into the working directory at the time 8346the @code{add} command is executed. 8347 8348@menu 8349* add options:: add options 8350* add examples:: add examples 8351@end menu 8352 8353@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8354@node add options 8355@appendixsubsec add options 8356 8357These standard options are supported by @code{add} 8358(@pxref{Common options}, for a complete description of 8359them): 8360 8361@table @code 8362@item -k @var{kflag} 8363Process keywords according to @var{kflag}. See 8364@ref{Keyword substitution}. 8365This option is sticky; future updates of 8366this file in this working directory will use the same 8367@var{kflag}. The @code{status} command can be viewed 8368to see the sticky options. For more information on 8369the @code{status} command, @xref{Invoking CVS}. 8370 8371@item -m @var{message} 8372Use @var{message} as the log message, instead of 8373invoking an editor. 8374@end table 8375 8376@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8377@node add examples 8378@appendixsubsec add examples 8379 8380@appendixsubsubsec Adding a directory 8381 8382@example 8383$ mkdir doc 8384$ cvs add doc 8385Directory /path/to/repository/doc added to the repository 8386@end example 8387 8388@appendixsubsubsec Adding a file 8389 8390@example 8391 8392$ >TODO 8393$ cvs add TODO 8394cvs add: scheduling file `TODO' for addition 8395cvs add: use 'cvs commit' to add this file permanently 8396@end example 8397 8398@appendixsubsubsec Undoing a @code{remove} command 8399 8400@example 8401$ rm -f makefile 8402$ cvs remove makefile 8403cvs remove: scheduling `makefile' for removal 8404cvs remove: use 'cvs commit' to remove this file permanently 8405$ cvs add makefile 8406U makefile 8407cvs add: makefile, version 1.2, resurrected 8408@end example 8409 8410@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8411@node admin 8412@appendixsec admin---Administration 8413@cindex Admin (subcommand) 8414 8415@itemize @bullet 8416@item 8417Requires: repository, working directory. 8418@item 8419Changes: repository. 8420@item 8421Synonym: rcs 8422@end itemize 8423 8424This is the @sc{cvs} interface to assorted 8425administrative facilities. Some of them have 8426questionable usefulness for @sc{cvs} but exist for 8427historical purposes. Some of the questionable options 8428are likely to disappear in the future. This command 8429@emph{does} work recursively, so extreme care should be 8430used. 8431 8432@cindex cvsadmin 8433On unix, if there is a group named @code{cvsadmin}, 8434only members of that group can run @code{cvs admin} 8435(except for the @code{cvs admin -k} command, which can 8436be run by anybody). This group should exist on the 8437server, or any system running the non-client/server 8438@sc{cvs}. To disallow @code{cvs admin} for all users, 8439create a group with no users in it. On NT, the 8440@code{cvsadmin} feature does not exist and all users 8441can run @code{cvs admin}. 8442 8443@menu 8444* admin options:: admin options 8445@end menu 8446 8447@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8448@node admin options 8449@appendixsubsec admin options 8450 8451Some of these options have questionable usefulness for 8452@sc{cvs} but exist for historical purposes. Some even 8453make it impossible to use @sc{cvs} until you undo the 8454effect! 8455 8456@table @code 8457@item -A@var{oldfile} 8458Might not work together with @sc{cvs}. Append the 8459access list of @var{oldfile} to the access list of the 8460@sc{rcs} file. 8461 8462@item -a@var{logins} 8463Might not work together with @sc{cvs}. Append the 8464login names appearing in the comma-separated list 8465@var{logins} to the access list of the @sc{rcs} file. 8466 8467@item -b[@var{rev}] 8468Set the default branch to @var{rev}. In @sc{cvs}, you 8469normally do not manipulate default branches; sticky 8470tags (@pxref{Sticky tags}) are a better way to decide 8471which branch you want to work on. There is one reason 8472to run @code{cvs admin -b}: to revert to the vendor's 8473version when using vendor branches (@pxref{Reverting 8474local changes}). 8475There can be no space between @samp{-b} and its argument. 8476@c Hmm, we don't document the usage where rev is 8477@c omitted. Maybe that usage can/should be deprecated 8478@c (and replaced with -bHEAD or something?) (so we can toss 8479@c the optional argument). Note that -bHEAD does not 8480@c work, as of 17 Sep 1997, but probably will once "cvs 8481@c admin" is internal to CVS. 8482 8483@cindex Comment leader 8484@item -c@var{string} 8485Sets the comment leader to @var{string}. The comment 8486leader is not used by current versions of @sc{cvs} or 8487@sc{rcs} 5.7. Therefore, you can almost surely not 8488worry about it. See @ref{Keyword substitution}. 8489 8490@item -e[@var{logins}] 8491Might not work together with @sc{cvs}. Erase the login 8492names appearing in the comma-separated list 8493@var{logins} from the access list of the RCS file. If 8494@var{logins} is omitted, erase the entire access list. 8495There can be no space between @samp{-e} and its argument. 8496 8497@item -I 8498Run interactively, even if the standard input is not a 8499terminal. This option does not work with the 8500client/server @sc{cvs} and is likely to disappear in 8501a future release of @sc{cvs}. 8502 8503@item -i 8504Useless with @sc{cvs}. This creates and initializes a 8505new @sc{rcs} file, without depositing a revision. With 8506@sc{cvs}, add files with the @code{cvs add} command 8507(@pxref{Adding files}). 8508 8509@item -k@var{subst} 8510Set the default keyword 8511substitution to @var{subst}. See @ref{Keyword 8512substitution}. Giving an explicit @samp{-k} option to 8513@code{cvs update}, @code{cvs export}, or @code{cvs 8514checkout} overrides this default. 8515 8516@item -l[@var{rev}] 8517Lock the revision with number @var{rev}. If a branch 8518is given, lock the latest revision on that branch. If 8519@var{rev} is omitted, lock the latest revision on the 8520default branch. There can be no space between 8521@samp{-l} and its argument. 8522 8523This can be used in conjunction with the 8524@file{rcslock.pl} script in the @file{contrib} 8525directory of the @sc{cvs} source distribution to 8526provide reserved checkouts (where only one user can be 8527editing a given file at a time). See the comments in 8528that file for details (and see the @file{README} file 8529in that directory for disclaimers about the unsupported 8530nature of contrib). According to comments in that 8531file, locking must set to strict (which is the default). 8532 8533@item -L 8534Set locking to strict. Strict locking means that the 8535owner of an RCS file is not exempt from locking for 8536checkin. For use with @sc{cvs}, strict locking must be 8537set; see the discussion under the @samp{-l} option above. 8538 8539@cindex Changing a log message 8540@cindex Replacing a log message 8541@cindex Correcting a log message 8542@cindex Fixing a log message 8543@cindex Log message, correcting 8544@item -m@var{rev}:@var{msg} 8545Replace the log message of revision @var{rev} with 8546@var{msg}. 8547 8548@c The rcs -M option, to suppress sending mail, has never been 8549@c documented as a cvs admin option. 8550 8551@item -N@var{name}[:[@var{rev}]] 8552Act like @samp{-n}, except override any previous 8553assignment of @var{name}. For use with magic branches, 8554see @ref{Magic branch numbers}. 8555 8556@item -n@var{name}[:[@var{rev}]] 8557Associate the symbolic name @var{name} with the branch 8558or revision @var{rev}. It is normally better to use 8559@samp{cvs tag} or @samp{cvs rtag} instead. Delete the 8560symbolic name if both @samp{:} and @var{rev} are 8561omitted; otherwise, print an error message if 8562@var{name} is already associated with another number. 8563If @var{rev} is symbolic, it is expanded before 8564association. A @var{rev} consisting of a branch number 8565followed by a @samp{.} stands for the current latest 8566revision in the branch. A @samp{:} with an empty 8567@var{rev} stands for the current latest revision on the 8568default branch, normally the trunk. For example, 8569@samp{cvs admin -n@var{name}:} associates @var{name} with the 8570current latest revision of all the RCS files; 8571this contrasts with @samp{cvs admin -n@var{name}:$} which 8572associates @var{name} with the revision numbers 8573extracted from keyword strings in the corresponding 8574working files. 8575 8576@cindex Deleting revisions 8577@cindex Outdating revisions 8578@cindex Saving space 8579@item -o@var{range} 8580Deletes (@dfn{outdates}) the revisions given by 8581@var{range}. 8582 8583Note that this command can be quite dangerous unless 8584you know @emph{exactly} what you are doing (for example 8585see the warnings below about how the 8586@var{rev1}:@var{rev2} syntax is confusing). 8587 8588If you are short on disc this option might help you. 8589But think twice before using it---there is no way short 8590of restoring the latest backup to undo this command! 8591If you delete different revisions than you planned, 8592either due to carelessness or (heaven forbid) a @sc{cvs} 8593bug, there is no opportunity to correct the error 8594before the revisions are deleted. It probably would be 8595a good idea to experiment on a copy of the repository 8596first. 8597 8598Specify @var{range} in one of the following ways: 8599 8600@table @code 8601@item @var{rev1}::@var{rev2} 8602Collapse all revisions between rev1 and rev2, so that 8603@sc{cvs} only stores the differences associated with going 8604from rev1 to rev2, not intermediate steps. For 8605example, after @samp{-o 1.3::1.5} one can retrieve 8606revision 1.3, revision 1.5, or the differences to get 8607from 1.3 to 1.5, but not the revision 1.4, or the 8608differences between 1.3 and 1.4. Other examples: 8609@samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no 8610effect, because there are no intermediate revisions to 8611remove. 8612 8613@item ::@var{rev} 8614Collapse revisions between the beginning of the branch 8615containing @var{rev} and @var{rev} itself. The 8616branchpoint and @var{rev} are left intact. For 8617example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1, 8618revision 1.3.2.5, and everything in between, but leaves 86191.3 and 1.3.2.6 intact. 8620 8621@item @var{rev}:: 8622Collapse revisions between @var{rev} and the end of the 8623branch containing @var{rev}. Revision @var{rev} is 8624left intact but the head revision is deleted. 8625 8626@item @var{rev} 8627Delete the revision @var{rev}. For example, @samp{-o 86281.3} is equivalent to @samp{-o 1.2::1.4}. 8629 8630@item @var{rev1}:@var{rev2} 8631Delete the revisions from @var{rev1} to @var{rev2}, 8632inclusive, on the same branch. One will not be able to 8633retrieve @var{rev1} or @var{rev2} or any of the 8634revisions in between. For example, the command 8635@samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful. 8636It means to delete revisions up to, and including, the 8637tag R_1_02. But beware! If there are files that have not 8638changed between R_1_02 and R_1_03 the file will have 8639@emph{the same} numerical revision number assigned to 8640the tags R_1_02 and R_1_03. So not only will it be 8641impossible to retrieve R_1_02; R_1_03 will also have to 8642be restored from the tapes! In most cases you want to 8643specify @var{rev1}::@var{rev2} instead. 8644 8645@item :@var{rev} 8646Delete revisions from the beginning of the 8647branch containing @var{rev} up to and including 8648@var{rev}. 8649 8650@item @var{rev}: 8651Delete revisions from revision @var{rev}, including 8652@var{rev} itself, to the end of the branch containing 8653@var{rev}. 8654@end table 8655 8656None of the revisions to be deleted may have 8657branches or locks. 8658 8659If any of the revisions to be deleted have symbolic 8660names, and one specifies one of the @samp{::} syntaxes, 8661then @sc{cvs} will give an error and not delete any 8662revisions. If you really want to delete both the 8663symbolic names and the revisions, first delete the 8664symbolic names with @code{cvs tag -d}, then run 8665@code{cvs admin -o}. If one specifies the 8666non-@samp{::} syntaxes, then @sc{cvs} will delete the 8667revisions but leave the symbolic names pointing to 8668nonexistent revisions. This behavior is preserved for 8669compatibility with previous versions of @sc{cvs}, but 8670because it isn't very useful, in the future it may 8671change to be like the @samp{::} case. 8672 8673Due to the way @sc{cvs} handles branches @var{rev} 8674cannot be specified symbolically if it is a branch. 8675See @ref{Magic branch numbers} for an explanation. 8676@c FIXME: is this still true? I suspect not. 8677 8678Make sure that no-one has checked out a copy of the 8679revision you outdate. Strange things will happen if he 8680starts to edit it and tries to check it back in. For 8681this reason, this option is not a good way to take back 8682a bogus commit; commit a new revision undoing the bogus 8683change instead (@pxref{Merging two revisions}). 8684 8685@item -q 8686Run quietly; do not print diagnostics. 8687 8688@item -s@var{state}[:@var{rev}] 8689Useful with @sc{cvs}. Set the state attribute of the 8690revision @var{rev} to @var{state}. If @var{rev} is a 8691branch number, assume the latest revision on that 8692branch. If @var{rev} is omitted, assume the latest 8693revision on the default branch. Any identifier is 8694acceptable for @var{state}. A useful set of states is 8695@samp{Exp} (for experimental), @samp{Stab} (for 8696stable), and @samp{Rel} (for released). By default, 8697the state of a new revision is set to @samp{Exp} when 8698it is created. The state is visible in the output from 8699@var{cvs log} (@pxref{log}), and in the 8700@samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords 8701(@pxref{Keyword substitution}). Note that @sc{cvs} 8702uses the @code{dead} state for its own purposes (@pxref{Attic}); to 8703take a file to or from the @code{dead} state use 8704commands like @code{cvs remove} and @code{cvs add} 8705(@pxref{Adding and removing}), not @code{cvs admin -s}. 8706 8707@item -t[@var{file}] 8708Useful with @sc{cvs}. Write descriptive text from the 8709contents of the named @var{file} into the RCS file, 8710deleting the existing text. The @var{file} pathname 8711may not begin with @samp{-}. The descriptive text can be seen in the 8712output from @samp{cvs log} (@pxref{log}). 8713There can be no space between @samp{-t} and its argument. 8714 8715If @var{file} is omitted, 8716obtain the text from standard input, terminated by 8717end-of-file or by a line containing @samp{.} by itself. 8718Prompt for the text if interaction is possible; see 8719@samp{-I}. 8720 8721@item -t-@var{string} 8722Similar to @samp{-t@var{file}}. Write descriptive text 8723from the @var{string} into the @sc{rcs} file, deleting 8724the existing text. 8725There can be no space between @samp{-t} and its argument. 8726 8727@c The rcs -T option, do not update last-mod time for 8728@c minor changes, has never been documented as a 8729@c cvs admin option. 8730 8731@item -U 8732Set locking to non-strict. Non-strict locking means 8733that the owner of a file need not lock a revision for 8734checkin. For use with @sc{cvs}, strict locking must be 8735set; see the discussion under the @samp{-l} option 8736above. 8737 8738@item -u[@var{rev}] 8739See the option @samp{-l} above, for a discussion of 8740using this option with @sc{cvs}. Unlock the revision 8741with number @var{rev}. If a branch is given, unlock 8742the latest revision on that branch. If @var{rev} is 8743omitted, remove the latest lock held by the caller. 8744Normally, only the locker of a revision may unlock it; 8745somebody else unlocking a revision breaks the lock. 8746This causes the original locker to be sent a @code{commit} 8747notification (@pxref{Getting Notified}). 8748There can be no space between @samp{-u} and its argument. 8749 8750@item -V@var{n} 8751In previous versions of @sc{cvs}, this option meant to 8752write an @sc{rcs} file which would be acceptable to 8753@sc{rcs} version @var{n}, but it is now obsolete and 8754specifying it will produce an error. 8755@c Note that -V without an argument has never been 8756@c documented as a cvs admin option. 8757 8758@item -x@var{suffixes} 8759In previous versions of @sc{cvs}, this was documented 8760as a way of specifying the names of the @sc{rcs} 8761files. However, @sc{cvs} has always required that the 8762@sc{rcs} files used by @sc{cvs} end in @samp{,v}, so 8763this option has never done anything useful. 8764 8765@c The rcs -z option, to specify the timezone, has 8766@c never been documented as a cvs admin option. 8767@end table 8768 8769 8770@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8771@node annotate 8772@appendixsec annotate---What revision modified each line of a file? 8773@cindex annotate (subcommand) 8774 8775@itemize @bullet 8776@item 8777Synopsis: annotate [options] files@dots{} 8778@item 8779Requires: repository. 8780@item 8781Synonym: blame 8782@item 8783Changes: nothing. 8784@end itemize 8785 8786For each file in @var{files}, print the head revision 8787of the trunk, together with information on the last 8788modification for each line. 8789 8790@menu 8791* annotate options:: annotate options 8792* annotate example:: annotate example 8793@end menu 8794 8795@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8796@node annotate options 8797@appendixsubsec annotate options 8798 8799These standard options are supported by @code{annotate} 8800(@pxref{Common options} for a complete description of 8801them): 8802 8803@table @code 8804@item -l 8805Local directory only, no recursion. 8806 8807@item -R 8808Process directories recursively. 8809 8810@item -f 8811Use head revision if tag/date not found. 8812 8813@item -F 8814Annotate binary files. 8815 8816@item -r @var{revision} 8817Annotate file as of specified revision/tag. 8818 8819@item -D @var{date} 8820Annotate file as of specified date. 8821@end table 8822 8823@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8824@node annotate example 8825@appendixsubsec annotate example 8826 8827For example: 8828 8829@example 8830$ cvs annotate ssfile 8831Annotations for ssfile 8832*************** 88331.1 (mary 27-Mar-96): ssfile line 1 88341.2 (joe 28-Mar-96): ssfile line 2 8835@end example 8836 8837The file @file{ssfile} currently contains two lines. 8838The @code{ssfile line 1} line was checked in by 8839@code{mary} on March 27. Then, on March 28, @code{joe} 8840added a line @code{ssfile line 2}, without modifying 8841the @code{ssfile line 1} line. This report doesn't 8842tell you anything about lines which have been deleted 8843or replaced; you need to use @code{cvs diff} for that 8844(@pxref{diff}). 8845 8846The options to @code{cvs annotate} are listed in 8847@ref{Invoking CVS}, and can be used to select the files 8848and revisions to annotate. The options are described 8849in more detail there and in @ref{Common options}. 8850 8851@c FIXME: maybe an example using the options? Just 8852@c what it means to select a revision might be worth a 8853@c few words of explanation ("you want to see who 8854@c changed this line *before* 1.4"...). 8855 8856 8857@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8858@node checkout 8859@appendixsec checkout---Check out sources for editing 8860@cindex checkout (subcommand) 8861@cindex co (subcommand) 8862 8863@itemize @bullet 8864@item 8865Synopsis: checkout [options] modules@dots{} 8866@item 8867Requires: repository. 8868@item 8869Changes: working directory. 8870@item 8871Synonyms: co, get 8872@end itemize 8873 8874Create or update a working directory containing copies of the 8875source files specified by @var{modules}. You must execute 8876@code{checkout} before using most of the other @sc{cvs} 8877commands, since most of them operate on your working 8878directory. 8879 8880The @var{modules} are either 8881symbolic names for some 8882collection of source directories and files, or paths to 8883directories or files in the repository. The symbolic 8884names are defined in the @samp{modules} file. 8885See @ref{modules}. 8886@c Needs an example, particularly of the non-"modules" 8887@c case but probably of both. 8888 8889@c FIXME: this seems like a very odd place to introduce 8890@c people to how CVS works. The bit about unreserved 8891@c checkouts is also misleading as it depends on how 8892@c things are set up. 8893Depending on the modules you specify, @code{checkout} may 8894recursively create directories and populate them with 8895the appropriate source files. You can then edit these 8896source files at any time (regardless of whether other 8897software developers are editing their own copies of the 8898sources); update them to include new changes applied by 8899others to the source repository; or commit your work as 8900a permanent change to the source repository. 8901 8902Note that @code{checkout} is used to create 8903directories. The top-level directory created is always 8904added to the directory where @code{checkout} is 8905invoked, and usually has the same name as the specified 8906module. In the case of a module alias, the created 8907sub-directory may have a different name, but you can be 8908sure that it will be a sub-directory, and that 8909@code{checkout} will show the relative path leading to 8910each file as it is extracted into your private work 8911area (unless you specify the @samp{-Q} global option). 8912 8913The files created by @code{checkout} are created 8914read-write, unless the @samp{-r} option to @sc{cvs} 8915(@pxref{Global options}) is specified, the 8916@code{CVSREAD} environment variable is specified 8917(@pxref{Environment variables}), or a watch is in 8918effect for that file (@pxref{Watches}). 8919 8920Note that running @code{checkout} on a directory that was already 8921built by a prior @code{checkout} is also permitted. 8922This is similar to specifying the @samp{-d} option 8923to the @code{update} command in the sense that new 8924directories that have been created in the repository 8925will appear in your work area. 8926However, @code{checkout} takes a module name whereas 8927@code{update} takes a directory name. Also 8928to use @code{checkout} this way it must be run from the 8929top level directory (where you originally ran 8930@code{checkout} from), so before you run 8931@code{checkout} to update an existing directory, don't 8932forget to change your directory to the top level 8933directory. 8934 8935For the output produced by the @code{checkout} command, 8936@xref{update output}. 8937 8938@menu 8939* checkout options:: checkout options 8940* checkout examples:: checkout examples 8941@end menu 8942 8943@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8944@node checkout options 8945@appendixsubsec checkout options 8946 8947These standard options are supported by @code{checkout} 8948(@pxref{Common options} for a complete description of 8949them): 8950 8951@table @code 8952@item -D @var{date} 8953Use the most recent revision no later than @var{date}. 8954This option is sticky, and implies @samp{-P}. See 8955@ref{Sticky tags} for more information on sticky tags/dates. 8956 8957@item -f 8958Only useful with the @samp{-D @var{date}} or @samp{-r 8959@var{tag}} flags. If no matching revision is found, 8960retrieve the most recent revision (instead of ignoring 8961the file). 8962 8963@item -k @var{kflag} 8964Process keywords according to @var{kflag}. See 8965@ref{Keyword substitution}. 8966This option is sticky; future updates of 8967this file in this working directory will use the same 8968@var{kflag}. The @code{status} command can be viewed 8969to see the sticky options. See @ref{Invoking CVS} for 8970more information on the @code{status} command. 8971 8972@item -l 8973Local; run only in current working directory. 8974 8975@item -n 8976Do not run any checkout program (as specified 8977with the @samp{-o} option in the modules file; 8978@pxref{modules}). 8979 8980@item -P 8981Prune empty directories. See @ref{Moving directories}. 8982 8983@item -p 8984Pipe files to the standard output. 8985 8986@item -R 8987Checkout directories recursively. This option is on by default. 8988 8989@item -r @var{tag} 8990Use revision @var{tag}. This option is sticky, and implies @samp{-P}. 8991See @ref{Sticky tags}, for more information on sticky tags/dates. 8992@end table 8993 8994In addition to those, you can use these special command 8995options with @code{checkout}: 8996 8997@table @code 8998@item -A 8999Reset any sticky tags, dates, or @samp{-k} options. 9000Does not reset sticky @samp{-k} options on modified files. 9001See @ref{Sticky tags} for more information on sticky tags/dates. 9002 9003@item -c 9004Copy the module file, sorted, to the standard output, 9005instead of creating or modifying any files or 9006directories in your working directory. 9007 9008@item -d @var{dir} 9009Create a directory called @var{dir} for the working 9010files, instead of using the module name. In general, 9011using this flag is equivalent to using @samp{mkdir 9012@var{dir}; cd @var{dir}} followed by the checkout 9013command without the @samp{-d} flag. 9014 9015There is an important exception, however. It is very 9016convenient when checking out a single item to have the 9017output appear in a directory that doesn't contain empty 9018intermediate directories. In this case @emph{only}, 9019@sc{cvs} tries to ``shorten'' pathnames to avoid those empty 9020directories. 9021 9022For example, given a module @samp{foo} that contains 9023the file @samp{bar.c}, the command @samp{cvs co -d dir 9024foo} will create directory @samp{dir} and place 9025@samp{bar.c} inside. Similarly, given a module 9026@samp{bar} which has subdirectory @samp{baz} wherein 9027there is a file @samp{quux.c}, the command @samp{cvs co 9028-d dir bar/baz} will create directory @samp{dir} and 9029place @samp{quux.c} inside. 9030 9031Using the @samp{-N} flag will defeat this behavior. 9032Given the same module definitions above, @samp{cvs co 9033-N -d dir foo} will create directories @samp{dir/foo} 9034and place @samp{bar.c} inside, while @samp{cvs co -N -d 9035dir bar/baz} will create directories @samp{dir/bar/baz} 9036and place @samp{quux.c} inside. 9037 9038@item -j @var{tag} 9039With two @samp{-j} options, merge changes from the 9040revision specified with the first @samp{-j} option to 9041the revision specified with the second @samp{j} option, 9042into the working directory. 9043 9044With one @samp{-j} option, merge changes from the 9045ancestor revision to the revision specified with the 9046@samp{-j} option, into the working directory. The 9047ancestor revision is the common ancestor of the 9048revision which the working directory is based on, and 9049the revision specified in the @samp{-j} option. 9050 9051In addition, each -j option can contain an optional 9052date specification which, when used with branches, can 9053limit the chosen revision to one within a specific 9054date. An optional date is specified by adding a colon 9055(:) to the tag: 9056@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 9057 9058See @ref{Branching and merging}. 9059 9060@item -N 9061Only useful together with @samp{-d @var{dir}}. With 9062this option, @sc{cvs} will not ``shorten'' module paths 9063in your working directory when you check out a single 9064module. See the @samp{-d} flag for examples and a 9065discussion. 9066 9067@item -s 9068Like @samp{-c}, but include the status of all modules, 9069and sort it by the status string. See @ref{modules}, for 9070info about the @samp{-s} option that is used inside the 9071modules file to set the module status. 9072@end table 9073 9074@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9075@node checkout examples 9076@appendixsubsec checkout examples 9077 9078Get a copy of the module @samp{tc}: 9079 9080@example 9081$ cvs checkout tc 9082@end example 9083 9084Get a copy of the module @samp{tc} as it looked one day 9085ago: 9086 9087@example 9088$ cvs checkout -D yesterday tc 9089@end example 9090 9091@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9092@node commit 9093@appendixsec commit---Check files into the repository 9094@cindex commit (subcommand) 9095 9096@itemize @bullet 9097@item 9098Synopsis: commit [-lRf] [-m 'log_message' | 9099-F file] [-r revision] [files@dots{}] 9100@item 9101Requires: working directory, repository. 9102@item 9103Changes: repository. 9104@item 9105Synonym: ci 9106@end itemize 9107 9108Use @code{commit} when you want to incorporate changes 9109from your working source files into the source 9110repository. 9111 9112If you don't specify particular files to commit, all of 9113the files in your working current directory are 9114examined. @code{commit} is careful to change in the 9115repository only those files that you have really 9116changed. By default (or if you explicitly specify the 9117@samp{-R} option), files in subdirectories are also 9118examined and committed if they have changed; you can 9119use the @samp{-l} option to limit @code{commit} to the 9120current directory only. 9121 9122@code{commit} verifies that the selected files are up 9123to date with the current revisions in the source 9124repository; it will notify you, and exit without 9125committing, if any of the specified files must be made 9126current first with @code{update} (@pxref{update}). 9127@code{commit} does not call the @code{update} command 9128for you, but rather leaves that for you to do when the 9129time is right. 9130 9131When all is well, an editor is invoked to allow you to 9132enter a log message that will be written to one or more 9133logging programs (@pxref{modules}, and @pxref{loginfo}) 9134and placed in the @sc{rcs} file inside the 9135repository. This log message can be retrieved with the 9136@code{log} command; @xref{log}. You can specify the 9137log message on the command line with the @samp{-m 9138@var{message}} option, and thus avoid the editor invocation, 9139or use the @samp{-F @var{file}} option to specify 9140that the argument file contains the log message. 9141 9142@menu 9143* commit options:: commit options 9144* commit examples:: commit examples 9145@end menu 9146 9147@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9148@node commit options 9149@appendixsubsec commit options 9150 9151These standard options are supported by @code{commit} 9152(@pxref{Common options} for a complete description of 9153them): 9154 9155@table @code 9156@item -l 9157Local; run only in current working directory. 9158 9159@item -R 9160Commit directories recursively. This is on by default. 9161 9162@item -r @var{revision} 9163Commit to @var{revision}. @var{revision} must be 9164either a branch, or a revision on the main trunk that 9165is higher than any existing revision number 9166(@pxref{Assigning revisions}). You 9167cannot commit to a specific revision on a branch. 9168@c FIXME: Need xref for branch case. 9169@end table 9170 9171@code{commit} also supports these options: 9172 9173@table @code 9174@item -F @var{file} 9175Read the log message from @var{file}, instead 9176of invoking an editor. 9177 9178@item -f 9179Note that this is not the standard behavior of 9180the @samp{-f} option as defined in @ref{Common options}. 9181 9182Force @sc{cvs} to commit a new revision even if you haven't 9183made any changes to the file. If the current revision 9184of @var{file} is 1.7, then the following two commands 9185are equivalent: 9186 9187@example 9188$ cvs commit -f @var{file} 9189$ cvs commit -r 1.8 @var{file} 9190@end example 9191 9192@c This is odd, but it's how CVS has worked for some 9193@c time. 9194The @samp{-f} option disables recursion (i.e., it 9195implies @samp{-l}). To force @sc{cvs} to commit a new 9196revision for all files in all subdirectories, you must 9197use @samp{-f -R}. 9198 9199@item -m @var{message} 9200Use @var{message} as the log message, instead of 9201invoking an editor. 9202@end table 9203 9204@need 2000 9205@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9206@node commit examples 9207@appendixsubsec commit examples 9208 9209@c FIXME: this material wants to be somewhere 9210@c in "Branching and merging". 9211 9212@appendixsubsubsec Committing to a branch 9213 9214You can commit to a branch revision (one that has an 9215even number of dots) with the @samp{-r} option. To 9216create a branch revision, use the @samp{-b} option 9217of the @code{rtag} or @code{tag} commands 9218(@pxref{Branching and merging}). Then, either @code{checkout} or 9219@code{update} can be used to base your sources on the 9220newly created branch. From that point on, all 9221@code{commit} changes made within these working sources 9222will be automatically added to a branch revision, 9223thereby not disturbing main-line development in any 9224way. For example, if you had to create a patch to the 92251.2 version of the product, even though the 2.0 version 9226is already under development, you might do: 9227 9228@example 9229$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module 9230$ cvs checkout -r FCS1_2_Patch product_module 9231$ cd product_module 9232[[ hack away ]] 9233$ cvs commit 9234@end example 9235 9236@noindent 9237This works automatically since the @samp{-r} option is 9238sticky. 9239 9240@appendixsubsubsec Creating the branch after editing 9241 9242Say you have been working on some extremely 9243experimental software, based on whatever revision you 9244happened to checkout last week. If others in your 9245group would like to work on this software with you, but 9246without disturbing main-line development, you could 9247commit your change to a new branch. Others can then 9248checkout your experimental stuff and utilize the full 9249benefit of @sc{cvs} conflict resolution. The scenario might 9250look like: 9251 9252@c FIXME: Should we be recommending tagging the branchpoint? 9253@example 9254[[ hacked sources are present ]] 9255$ cvs tag -b EXPR1 9256$ cvs update -r EXPR1 9257$ cvs commit 9258@end example 9259 9260The @code{update} command will make the @samp{-r 9261EXPR1} option sticky on all files. Note that your 9262changes to the files will never be removed by the 9263@code{update} command. The @code{commit} will 9264automatically commit to the correct branch, because the 9265@samp{-r} is sticky. You could also do like this: 9266 9267@c FIXME: Should we be recommending tagging the branchpoint? 9268@example 9269[[ hacked sources are present ]] 9270$ cvs tag -b EXPR1 9271$ cvs commit -r EXPR1 9272@end example 9273 9274@noindent 9275but then, only those files that were changed by you 9276will have the @samp{-r EXPR1} sticky flag. If you hack 9277away, and commit without specifying the @samp{-r EXPR1} 9278flag, some files may accidentally end up on the main 9279trunk. 9280 9281To work with you on the experimental change, others 9282would simply do 9283 9284@example 9285$ cvs checkout -r EXPR1 whatever_module 9286@end example 9287 9288@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9289@node diff 9290@appendixsec diff---Show differences between revisions 9291@cindex diff (subcommand) 9292 9293@itemize @bullet 9294@item 9295Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files@dots{}] 9296@item 9297Requires: working directory, repository. 9298@item 9299Changes: nothing. 9300@end itemize 9301 9302The @code{diff} command is used to compare different 9303revisions of files. The default action is to compare 9304your working files with the revisions they were based 9305on, and report any differences that are found. 9306 9307If any file names are given, only those files are 9308compared. If any directories are given, all files 9309under them will be compared. 9310 9311The exit status for diff is different than for other 9312@sc{cvs} commands; for details @xref{Exit status}. 9313 9314@menu 9315* diff options:: diff options 9316* diff examples:: diff examples 9317@end menu 9318 9319@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9320@node diff options 9321@appendixsubsec diff options 9322 9323These standard options are supported by @code{diff} 9324(@pxref{Common options} for a complete description of 9325them): 9326 9327@table @code 9328@item -D @var{date} 9329Use the most recent revision no later than @var{date}. 9330See @samp{-r} for how this affects the comparison. 9331 9332@item -k @var{kflag} 9333Process keywords according to @var{kflag}. See 9334@ref{Keyword substitution}. 9335 9336@item -l 9337Local; run only in current working directory. 9338 9339@item -R 9340Examine directories recursively. This option is on by 9341default. 9342 9343@item -r @var{tag} 9344Compare with revision @var{tag}. Zero, one or two 9345@samp{-r} options can be present. With no @samp{-r} 9346option, the working file will be compared with the 9347revision it was based on. With one @samp{-r}, that 9348revision will be compared to your current working file. 9349With two @samp{-r} options those two revisions will be 9350compared (and your working file will not affect the 9351outcome in any way). 9352@c We should be a lot more explicit, with examples, 9353@c about the difference between "cvs diff" and "cvs 9354@c diff -r HEAD". This often confuses new users. 9355 9356One or both @samp{-r} options can be replaced by a 9357@samp{-D @var{date}} option, described above. 9358@end table 9359 9360@c Conceptually, this is a disaster. There are 3 9361@c zillion diff formats that we support via the diff 9362@c library. It is not obvious to me that we should 9363@c document them all. Maybe just the most common ones 9364@c like -c and -u, and think about phasing out the 9365@c obscure ones. 9366@c FIXCVS: also should be a way to specify an external 9367@c diff program (which can be different for different 9368@c file types) and pass through 9369@c arbitrary options, so that the user can do 9370@c "--pass=-Z --pass=foo" or something even if CVS 9371@c doesn't know about the "-Z foo" option to diff. 9372@c This would fit nicely with deprecating/eliminating 9373@c the obscure options of the diff library, because it 9374@c would let people specify an external GNU diff if 9375@c they are into that sort of thing. 9376The following options specify the format of the 9377output. They have the same meaning as in GNU diff. 9378Most options have two equivalent names, one of which is a single letter 9379preceded by @samp{-}, and the other of which is a long name preceded by 9380@samp{--}. 9381 9382@table @samp 9383@item -@var{lines} 9384Show @var{lines} (an integer) lines of context. This option does not 9385specify an output format by itself; it has no effect unless it is 9386combined with @samp{-c} or @samp{-u}. This option is obsolete. For proper 9387operation, @code{patch} typically needs at least two lines of context. 9388 9389@item -a 9390Treat all files as text and compare them line-by-line, even if they 9391do not seem to be text. 9392 9393@item -b 9394Ignore trailing white space and consider all other sequences of one or 9395more white space characters to be equivalent. 9396 9397@item -B 9398Ignore changes that just insert or delete blank lines. 9399 9400@item --binary 9401Read and write data in binary mode. 9402 9403@item --brief 9404Report only whether the files differ, not the details of the 9405differences. 9406 9407@item -c 9408Use the context output format. 9409 9410@item -C @var{lines} 9411@itemx --context@r{[}=@var{lines}@r{]} 9412Use the context output format, showing @var{lines} (an integer) lines of 9413context, or three if @var{lines} is not given. 9414For proper operation, @code{patch} typically needs at least two lines of 9415context. 9416 9417@item --changed-group-format=@var{format} 9418Use @var{format} to output a line group containing differing lines from 9419both files in if-then-else format. See @ref{Line group formats}. 9420 9421@item -d 9422Change the algorithm to perhaps find a smaller set of changes. This makes 9423@code{diff} slower (sometimes much slower). 9424 9425@item -e 9426@itemx --ed 9427Make output that is a valid @code{ed} script. 9428 9429@item --expand-tabs 9430Expand tabs to spaces in the output, to preserve the alignment of tabs 9431in the input files. 9432 9433@item -f 9434Make output that looks vaguely like an @code{ed} script but has changes 9435in the order they appear in the file. 9436 9437@item -F @var{regexp} 9438In context and unified format, for each hunk of differences, show some 9439of the last preceding line that matches @var{regexp}. 9440 9441@item --forward-ed 9442Make output that looks vaguely like an @code{ed} script but has changes 9443in the order they appear in the file. 9444 9445@item -H 9446Use heuristics to speed handling of large files that have numerous 9447scattered small changes. 9448 9449@item --horizon-lines=@var{lines} 9450Do not discard the last @var{lines} lines of the common prefix 9451and the first @var{lines} lines of the common suffix. 9452 9453@item -i 9454Ignore changes in case; consider upper- and lower-case letters 9455equivalent. 9456 9457@item -I @var{regexp} 9458Ignore changes that just insert or delete lines that match @var{regexp}. 9459 9460@item --ifdef=@var{name} 9461Make merged if-then-else output using @var{name}. 9462 9463@item --ignore-all-space 9464Ignore white space when comparing lines. 9465 9466@item --ignore-blank-lines 9467Ignore changes that just insert or delete blank lines. 9468 9469@item --ignore-case 9470Ignore changes in case; consider upper- and lower-case to be the same. 9471 9472@item --ignore-matching-lines=@var{regexp} 9473Ignore changes that just insert or delete lines that match @var{regexp}. 9474 9475@item --ignore-space-change 9476Ignore trailing white space and consider all other sequences of one or 9477more white space characters to be equivalent. 9478 9479@item --initial-tab 9480Output a tab rather than a space before the text of a line in normal or 9481context format. This causes the alignment of tabs in the line to look 9482normal. 9483 9484@item -L @var{label} 9485Use @var{label} instead of the file name in the context format 9486and unified format headers. 9487 9488@item --label=@var{label} 9489Use @var{label} instead of the file name in the context format 9490and unified format headers. 9491 9492@item --left-column 9493Print only the left column of two common lines in side by side format. 9494 9495@item --line-format=@var{format} 9496Use @var{format} to output all input lines in if-then-else format. 9497See @ref{Line formats}. 9498 9499@item --minimal 9500Change the algorithm to perhaps find a smaller set of changes. This 9501makes @code{diff} slower (sometimes much slower). 9502 9503@item -n 9504Output RCS-format diffs; like @samp{-f} except that each command 9505specifies the number of lines affected. 9506 9507@item -N 9508@itemx --new-file 9509In directory comparison, if a file is found in only one directory, 9510treat it as present but empty in the other directory. 9511 9512@item --new-group-format=@var{format} 9513Use @var{format} to output a group of lines taken from just the second 9514file in if-then-else format. See @ref{Line group formats}. 9515 9516@item --new-line-format=@var{format} 9517Use @var{format} to output a line taken from just the second file in 9518if-then-else format. See @ref{Line formats}. 9519 9520@item --old-group-format=@var{format} 9521Use @var{format} to output a group of lines taken from just the first 9522file in if-then-else format. See @ref{Line group formats}. 9523 9524@item --old-line-format=@var{format} 9525Use @var{format} to output a line taken from just the first file in 9526if-then-else format. See @ref{Line formats}. 9527 9528@item -p 9529Show which C function each change is in. 9530 9531@item --rcs 9532Output RCS-format diffs; like @samp{-f} except that each command 9533specifies the number of lines affected. 9534 9535@item --report-identical-files 9536@itemx -s 9537Report when two files are the same. 9538 9539@item --show-c-function 9540Show which C function each change is in. 9541 9542@item --show-function-line=@var{regexp} 9543In context and unified format, for each hunk of differences, show some 9544of the last preceding line that matches @var{regexp}. 9545 9546@item --side-by-side 9547Use the side by side output format. 9548 9549@item --speed-large-files 9550Use heuristics to speed handling of large files that have numerous 9551scattered small changes. 9552 9553@item --suppress-common-lines 9554Do not print common lines in side by side format. 9555 9556@item -t 9557Expand tabs to spaces in the output, to preserve the alignment of tabs 9558in the input files. 9559 9560@item -T 9561Output a tab rather than a space before the text of a line in normal or 9562context format. This causes the alignment of tabs in the line to look 9563normal. 9564 9565@item --text 9566Treat all files as text and compare them line-by-line, even if they 9567do not appear to be text. 9568 9569@item -u 9570Use the unified output format. 9571 9572@item --unchanged-group-format=@var{format} 9573Use @var{format} to output a group of common lines taken from both files 9574in if-then-else format. @xref{Line group formats}. 9575 9576@item --unchanged-line-format=@var{format} 9577Use @var{format} to output a line common to both files in if-then-else 9578format. @xref{Line formats}. 9579 9580@item -U @var{lines} 9581@itemx --unified@r{[}=@var{lines}@r{]} 9582Use the unified output format, showing @var{lines} (an integer) lines of 9583context, or three if @var{lines} is not given. 9584For proper operation, @code{patch} typically needs at least two lines of 9585context. 9586 9587@item -w 9588Ignore white space when comparing lines. 9589 9590@item -W @var{columns} 9591@itemx --width=@var{columns} 9592Use an output width of @var{columns} in side by side format. 9593 9594@item -y 9595Use the side by side output format. 9596@end table 9597 9598@menu 9599* Line group formats:: Line group formats 9600* Line formats:: Line formats 9601@end menu 9602 9603@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9604@node Line group formats 9605@appendixsubsubsec Line group formats 9606 9607Line group formats let you specify formats suitable for many 9608applications that allow if-then-else input, including programming 9609languages and text formatting languages. A line group format specifies 9610the output format for a contiguous group of similar lines. 9611 9612For example, the following command compares the TeX file @file{myfile} 9613with the original version from the repository, 9614and outputs a merged file in which old regions are 9615surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new 9616regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines. 9617 9618@example 9619cvs diff \ 9620 --old-group-format='\begin@{em@} 9621%<\end@{em@} 9622' \ 9623 --new-group-format='\begin@{bf@} 9624%>\end@{bf@} 9625' \ 9626 myfile 9627@end example 9628 9629The following command is equivalent to the above example, but it is a 9630little more verbose, because it spells out the default line group formats. 9631 9632@example 9633cvs diff \ 9634 --old-group-format='\begin@{em@} 9635%<\end@{em@} 9636' \ 9637 --new-group-format='\begin@{bf@} 9638%>\end@{bf@} 9639' \ 9640 --unchanged-group-format='%=' \ 9641 --changed-group-format='\begin@{em@} 9642%<\end@{em@} 9643\begin@{bf@} 9644%>\end@{bf@} 9645' \ 9646 myfile 9647@end example 9648 9649Here is a more advanced example, which outputs a diff listing with 9650headers containing line numbers in a ``plain English'' style. 9651 9652@example 9653cvs diff \ 9654 --unchanged-group-format='' \ 9655 --old-group-format='-------- %dn line%(n=1?:s) deleted at %df: 9656%<' \ 9657 --new-group-format='-------- %dN line%(N=1?:s) added after %de: 9658%>' \ 9659 --changed-group-format='-------- %dn line%(n=1?:s) changed at %df: 9660%<-------- to: 9661%>' \ 9662 myfile 9663@end example 9664 9665To specify a line group format, use one of the options 9666listed below. You can specify up to four line group formats, one for 9667each kind of line group. You should quote @var{format}, because it 9668typically contains shell metacharacters. 9669 9670@table @samp 9671@item --old-group-format=@var{format} 9672These line groups are hunks containing only lines from the first file. 9673The default old group format is the same as the changed group format if 9674it is specified; otherwise it is a format that outputs the line group as-is. 9675 9676@item --new-group-format=@var{format} 9677These line groups are hunks containing only lines from the second 9678file. The default new group format is same as the changed group 9679format if it is specified; otherwise it is a format that outputs the 9680line group as-is. 9681 9682@item --changed-group-format=@var{format} 9683These line groups are hunks containing lines from both files. The 9684default changed group format is the concatenation of the old and new 9685group formats. 9686 9687@item --unchanged-group-format=@var{format} 9688These line groups contain lines common to both files. The default 9689unchanged group format is a format that outputs the line group as-is. 9690@end table 9691 9692In a line group format, ordinary characters represent themselves; 9693conversion specifications start with @samp{%} and have one of the 9694following forms. 9695 9696@table @samp 9697@item %< 9698stands for the lines from the first file, including the trailing newline. 9699Each line is formatted according to the old line format (@pxref{Line formats}). 9700 9701@item %> 9702stands for the lines from the second file, including the trailing newline. 9703Each line is formatted according to the new line format. 9704 9705@item %= 9706stands for the lines common to both files, including the trailing newline. 9707Each line is formatted according to the unchanged line format. 9708 9709@item %% 9710stands for @samp{%}. 9711 9712@item %c'@var{C}' 9713where @var{C} is a single character, stands for @var{C}. 9714@var{C} may not be a backslash or an apostrophe. 9715For example, @samp{%c':'} stands for a colon, even inside 9716the then-part of an if-then-else format, which a colon would 9717normally terminate. 9718 9719@item %c'\@var{O}' 9720where @var{O} is a string of 1, 2, or 3 octal digits, 9721stands for the character with octal code @var{O}. 9722For example, @samp{%c'\0'} stands for a null character. 9723 9724@item @var{F}@var{n} 9725where @var{F} is a @code{printf} conversion specification and @var{n} is one 9726of the following letters, stands for @var{n}'s value formatted with @var{F}. 9727 9728@table @samp 9729@item e 9730The line number of the line just before the group in the old file. 9731 9732@item f 9733The line number of the first line in the group in the old file; 9734equals @var{e} + 1. 9735 9736@item l 9737The line number of the last line in the group in the old file. 9738 9739@item m 9740The line number of the line just after the group in the old file; 9741equals @var{l} + 1. 9742 9743@item n 9744The number of lines in the group in the old file; equals @var{l} - @var{f} + 1. 9745 9746@item E, F, L, M, N 9747Likewise, for lines in the new file. 9748 9749@end table 9750 9751The @code{printf} conversion specification can be @samp{%d}, 9752@samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal, 9753lower case hexadecimal, or upper case hexadecimal output 9754respectively. After the @samp{%} the following options can appear in 9755sequence: a @samp{-} specifying left-justification; an integer 9756specifying the minimum field width; and a period followed by an 9757optional integer specifying the minimum number of digits. 9758For example, @samp{%5dN} prints the number of new lines in the group 9759in a field of width 5 characters, using the @code{printf} format @code{"%5d"}. 9760 9761@item (@var{A}=@var{B}?@var{T}:@var{E}) 9762If @var{A} equals @var{B} then @var{T} else @var{E}. 9763@var{A} and @var{B} are each either a decimal constant 9764or a single letter interpreted as above. 9765This format spec is equivalent to @var{T} if 9766@var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}. 9767 9768For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to 9769@samp{no lines} if @var{N} (the number of lines in the group in the 9770new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines} 9771otherwise. 9772@end table 9773 9774@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9775@node Line formats 9776@appendixsubsubsec Line formats 9777 9778Line formats control how each line taken from an input file is 9779output as part of a line group in if-then-else format. 9780 9781For example, the following command outputs text with a one-column 9782change indicator to the left of the text. The first column of output 9783is @samp{-} for deleted lines, @samp{|} for added lines, and a space 9784for unchanged lines. The formats contain newline characters where 9785newlines are desired on output. 9786 9787@example 9788cvs diff \ 9789 --old-line-format='-%l 9790' \ 9791 --new-line-format='|%l 9792' \ 9793 --unchanged-line-format=' %l 9794' \ 9795 myfile 9796@end example 9797 9798To specify a line format, use one of the following options. You should 9799quote @var{format}, since it often contains shell metacharacters. 9800 9801@table @samp 9802@item --old-line-format=@var{format} 9803formats lines just from the first file. 9804 9805@item --new-line-format=@var{format} 9806formats lines just from the second file. 9807 9808@item --unchanged-line-format=@var{format} 9809formats lines common to both files. 9810 9811@item --line-format=@var{format} 9812formats all lines; in effect, it sets all three above options simultaneously. 9813@end table 9814 9815In a line format, ordinary characters represent themselves; 9816conversion specifications start with @samp{%} and have one of the 9817following forms. 9818 9819@table @samp 9820@item %l 9821stands for the contents of the line, not counting its trailing 9822newline (if any). This format ignores whether the line is incomplete. 9823 9824@item %L 9825stands for the contents of the line, including its trailing newline 9826(if any). If a line is incomplete, this format preserves its 9827incompleteness. 9828 9829@item %% 9830stands for @samp{%}. 9831 9832@item %c'@var{C}' 9833where @var{C} is a single character, stands for @var{C}. 9834@var{C} may not be a backslash or an apostrophe. 9835For example, @samp{%c':'} stands for a colon. 9836 9837@item %c'\@var{O}' 9838where @var{O} is a string of 1, 2, or 3 octal digits, 9839stands for the character with octal code @var{O}. 9840For example, @samp{%c'\0'} stands for a null character. 9841 9842@item @var{F}n 9843where @var{F} is a @code{printf} conversion specification, 9844stands for the line number formatted with @var{F}. 9845For example, @samp{%.5dn} prints the line number using the 9846@code{printf} format @code{"%.5d"}. @xref{Line group formats}, for 9847more about printf conversion specifications. 9848 9849@end table 9850 9851The default line format is @samp{%l} followed by a newline character. 9852 9853If the input contains tab characters and it is important that they line 9854up on output, you should ensure that @samp{%l} or @samp{%L} in a line 9855format is just after a tab stop (e.g.@: by preceding @samp{%l} or 9856@samp{%L} with a tab character), or you should use the @samp{-t} or 9857@samp{--expand-tabs} option. 9858 9859Taken together, the line and line group formats let you specify many 9860different formats. For example, the following command uses a format 9861similar to @code{diff}'s normal format. You can tailor this command 9862to get fine control over @code{diff}'s output. 9863 9864@example 9865cvs diff \ 9866 --old-line-format='< %l 9867' \ 9868 --new-line-format='> %l 9869' \ 9870 --old-group-format='%df%(f=l?:,%dl)d%dE 9871%<' \ 9872 --new-group-format='%dea%dF%(F=L?:,%dL) 9873%>' \ 9874 --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL) 9875%<--- 9876%>' \ 9877 --unchanged-group-format='' \ 9878 myfile 9879@end example 9880 9881@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9882@node diff examples 9883@appendixsubsec diff examples 9884 9885The following line produces a Unidiff (@samp{-u} flag) 9886between revision 1.14 and 1.19 of 9887@file{backend.c}. Due to the @samp{-kk} flag no 9888keywords are substituted, so differences that only depend 9889on keyword substitution are ignored. 9890 9891@example 9892$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c 9893@end example 9894 9895Suppose the experimental branch EXPR1 was based on a 9896set of files tagged RELEASE_1_0. To see what has 9897happened on that branch, the following can be used: 9898 9899@example 9900$ cvs diff -r RELEASE_1_0 -r EXPR1 9901@end example 9902 9903A command like this can be used to produce a context 9904diff between two releases: 9905 9906@example 9907$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs 9908@end example 9909 9910If you are maintaining ChangeLogs, a command like the following 9911just before you commit your changes may help you write 9912the ChangeLog entry. All local modifications that have 9913not yet been committed will be printed. 9914 9915@example 9916$ cvs diff -u | less 9917@end example 9918 9919@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9920@node export 9921@appendixsec export---Export sources from CVS, similar to checkout 9922@cindex export (subcommand) 9923 9924@itemize @bullet 9925@item 9926Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{} 9927@item 9928Requires: repository. 9929@item 9930Changes: current directory. 9931@end itemize 9932 9933This command is a variant of @code{checkout}; use it 9934when you want a copy of the source for module without 9935the @sc{cvs} administrative directories. For example, you 9936might use @code{export} to prepare source for shipment 9937off-site. This command requires that you specify a 9938date or tag (with @samp{-D} or @samp{-r}), so that you 9939can count on reproducing the source you ship to others 9940(and thus it always prunes empty directories). 9941 9942One often would like to use @samp{-kv} with @code{cvs 9943export}. This causes any keywords to be 9944expanded such that an import done at some other site 9945will not lose the keyword revision information. But be 9946aware that doesn't handle an export containing binary 9947files correctly. Also be aware that after having used 9948@samp{-kv}, one can no longer use the @code{ident} 9949command (which is part of the @sc{rcs} suite---see 9950ident(1)) which looks for keyword strings. If 9951you want to be able to use @code{ident} you must not 9952use @samp{-kv}. 9953 9954@menu 9955* export options:: export options 9956@end menu 9957 9958@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9959@node export options 9960@appendixsubsec export options 9961 9962These standard options are supported by @code{export} 9963(@pxref{Common options}, for a complete description of 9964them): 9965 9966@table @code 9967@item -D @var{date} 9968Use the most recent revision no later than @var{date}. 9969 9970@item -f 9971If no matching revision is found, retrieve the most 9972recent revision (instead of ignoring the file). 9973 9974@item -l 9975Local; run only in current working directory. 9976 9977@item -n 9978Do not run any checkout program. 9979 9980@item -R 9981Export directories recursively. This is on by default. 9982 9983@item -r @var{tag} 9984Use revision @var{tag}. 9985@end table 9986 9987In addition, these options (that are common to 9988@code{checkout} and @code{export}) are also supported: 9989 9990@table @code 9991@item -d @var{dir} 9992Create a directory called @var{dir} for the working 9993files, instead of using the module name. 9994See @ref{checkout options} for complete details on how 9995@sc{cvs} handles this flag. 9996 9997@item -k @var{subst} 9998Set keyword expansion mode (@pxref{Substitution modes}). 9999 10000@item -N 10001Only useful together with @samp{-d @var{dir}}. 10002See @ref{checkout options} for complete details on how 10003@sc{cvs} handles this flag. 10004@end table 10005 10006@ignore 10007@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10008@c @node export examples 10009@appendixsubsec export examples 10010 10011Contributed examples are gratefully accepted. 10012@c -- Examples here!! 10013@end ignore 10014 10015@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10016@node history 10017@appendixsec history---Show status of files and users 10018@cindex history (subcommand) 10019 10020@itemize @bullet 10021@item 10022Synopsis: history [-report] [-flags] [-options args] [files@dots{}] 10023@item 10024Requires: the file @file{$CVSROOT/CVSROOT/history} 10025@item 10026Changes: nothing. 10027@end itemize 10028 10029@sc{cvs} can keep a history file that tracks each use of the 10030@code{checkout}, @code{commit}, @code{rtag}, 10031@code{update}, and @code{release} commands. You can 10032use @code{history} to display this information in 10033various formats. 10034 10035Logging must be enabled by creating the file 10036@file{$CVSROOT/CVSROOT/history}. 10037 10038@strong{@code{history} uses @samp{-f}, @samp{-l}, 10039@samp{-n}, and @samp{-p} in ways that conflict with the 10040normal use inside @sc{cvs} (@pxref{Common options}).} 10041 10042@menu 10043* history options:: history options 10044@end menu 10045 10046@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10047@node history options 10048@appendixsubsec history options 10049 10050Several options (shown above as @samp{-report}) control what 10051kind of report is generated: 10052 10053@table @code 10054@item -c 10055Report on each time commit was used (i.e., each time 10056the repository was modified). 10057 10058@item -e 10059Everything (all record types). Equivalent to 10060specifying @samp{-x} with all record types. Of course, 10061@samp{-e} will also include record types which are 10062added in a future version of @sc{cvs}; if you are 10063writing a script which can only handle certain record 10064types, you'll want to specify @samp{-x}. 10065 10066@item -m @var{module} 10067Report on a particular module. (You can meaningfully 10068use @samp{-m} more than once on the command line.) 10069 10070@item -o 10071Report on checked-out modules. This is the default report type. 10072 10073@item -T 10074Report on all tags. 10075 10076@item -x @var{type} 10077Extract a particular set of record types @var{type} from the @sc{cvs} 10078history. The types are indicated by single letters, 10079which you may specify in combination. 10080 10081Certain commands have a single record type: 10082 10083@table @code 10084@item F 10085release 10086@item O 10087checkout 10088@item E 10089export 10090@item T 10091rtag 10092@end table 10093 10094@noindent 10095One of five record types may result from an update: 10096 10097@table @code 10098@item C 10099A merge was necessary but collisions were 10100detected (requiring manual merging). 10101@item G 10102A merge was necessary and it succeeded. 10103@item U 10104A working file was copied from the repository. 10105@item P 10106A working file was patched to match the repository. 10107@item W 10108The working copy of a file was deleted during 10109update (because it was gone from the repository). 10110@end table 10111 10112@noindent 10113One of three record types results from commit: 10114 10115@table @code 10116@item A 10117A file was added for the first time. 10118@item M 10119A file was modified. 10120@item R 10121A file was removed. 10122@end table 10123@end table 10124 10125The options shown as @samp{-flags} constrain or expand 10126the report without requiring option arguments: 10127 10128@table @code 10129@item -a 10130Show data for all users (the default is to show data 10131only for the user executing @code{history}). 10132 10133@item -l 10134Show last modification only. 10135 10136@item -w 10137Show only the records for modifications done from the 10138same working directory where @code{history} is 10139executing. 10140@end table 10141 10142The options shown as @samp{-options @var{args}} constrain the report 10143based on an argument: 10144 10145@table @code 10146@item -b @var{str} 10147Show data back to a record containing the string 10148@var{str} in either the module name, the file name, or 10149the repository path. 10150 10151@item -D @var{date} 10152Show data since @var{date}. This is slightly different 10153from the normal use of @samp{-D @var{date}}, which 10154selects the newest revision older than @var{date}. 10155 10156@item -f @var{file} 10157Show data for a particular file 10158(you can specify several @samp{-f} options on the same command line). 10159This is equivalent to specifying the file on the command line. 10160 10161@item -n @var{module} 10162Show data for a particular module 10163(you can specify several @samp{-n} options on the same command line). 10164 10165@item -p @var{repository} 10166Show data for a particular source repository (you 10167can specify several @samp{-p} options on the same command 10168line). 10169 10170@item -r @var{rev} 10171Show records referring to revisions since the revision 10172or tag named @var{rev} appears in individual @sc{rcs} 10173files. Each @sc{rcs} file is searched for the revision or 10174tag. 10175 10176@item -t @var{tag} 10177Show records since tag @var{tag} was last added to the 10178history file. This differs from the @samp{-r} flag 10179above in that it reads only the history file, not the 10180@sc{rcs} files, and is much faster. 10181 10182@item -u @var{name} 10183Show records for user @var{name}. 10184 10185@item -z @var{timezone} 10186Show times in the selected records using the specified 10187time zone instead of UTC. 10188@end table 10189 10190@ignore 10191@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10192@c @node history examples 10193@appendixsubsec history examples 10194 10195Contributed examples will gratefully be accepted. 10196@c -- Examples here! 10197@end ignore 10198 10199@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10200@node import 10201@appendixsec import---Import sources into CVS, using vendor branches 10202@cindex import (subcommand) 10203 10204@c FIXME: This node is way too long for one which has subnodes. 10205 10206@itemize @bullet 10207@item 10208Synopsis: import [-options] repository vendortag releasetag@dots{} 10209@item 10210Requires: Repository, source distribution directory. 10211@item 10212Changes: repository. 10213@end itemize 10214 10215Use @code{import} to incorporate an entire source 10216distribution from an outside source (e.g., a source 10217vendor) into your source repository directory. You can 10218use this command both for initial creation of a 10219repository, and for wholesale updates to the module 10220from the outside source. See @ref{Tracking sources} for 10221a discussion on this subject. 10222 10223The @var{repository} argument gives a directory name 10224(or a path to a directory) under the @sc{cvs} root directory 10225for repositories; if the directory did not exist, 10226import creates it. 10227 10228When you use import for updates to source that has been 10229modified in your source repository (since a prior 10230import), it will notify you of any files that conflict 10231in the two branches of development; use @samp{checkout 10232-j} to reconcile the differences, as import instructs 10233you to do. 10234 10235If @sc{cvs} decides a file should be ignored 10236(@pxref{cvsignore}), it does not import it and prints 10237@samp{I } followed by the filename (@pxref{import output} for a 10238complete description of the output). 10239 10240If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists, 10241any file whose names match the specifications in that 10242file will be treated as packages and the appropriate 10243filtering will be performed on the file/directory 10244before being imported. See @ref{Wrappers}. 10245 10246The outside source is saved in a first-level 10247branch, by default 1.1.1. Updates are leaves of this 10248branch; for example, files from the first imported 10249collection of source will be revision 1.1.1.1, then 10250files from the first imported update will be revision 102511.1.1.2, and so on. 10252 10253At least three arguments are required. 10254@var{repository} is needed to identify the collection 10255of source. @var{vendortag} is a tag for the entire 10256branch (e.g., for 1.1.1). You must also specify at 10257least one @var{releasetag} to uniquely identify the files at 10258the leaves created each time you execute @code{import}. The 10259@var{releasetag} should be new, not previously existing in the 10260repository file, and uniquely identify the imported release, 10261 10262@c I'm not completely sure this belongs here. But 10263@c we need to say it _somewhere_ reasonably obvious; it 10264@c is a common misconception among people first learning CVS 10265Note that @code{import} does @emph{not} change the 10266directory in which you invoke it. In particular, it 10267does not set up that directory as a @sc{cvs} working 10268directory; if you want to work with the sources import 10269them first and then check them out into a different 10270directory (@pxref{Getting the source}). 10271 10272@menu 10273* import options:: import options 10274* import output:: import output 10275* import examples:: import examples 10276@end menu 10277 10278@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10279@node import options 10280@appendixsubsec import options 10281 10282This standard option is supported by @code{import} 10283(@pxref{Common options} for a complete description): 10284 10285@table @code 10286@item -m @var{message} 10287Use @var{message} as log information, instead of 10288invoking an editor. 10289@end table 10290 10291There are the following additional special options. 10292 10293@table @code 10294@item -b @var{branch} 10295See @ref{Multiple vendor branches}. 10296 10297@item -k @var{subst} 10298Indicate the keyword expansion mode desired. This 10299setting will apply to all files created during the 10300import, but not to any files that previously existed in 10301the repository. See @ref{Substitution modes} for a 10302list of valid @samp{-k} settings. 10303 10304@item -I @var{name} 10305Specify file names that should be ignored during 10306import. You can use this option repeatedly. To avoid 10307ignoring any files at all (even those ignored by 10308default), specify `-I !'. 10309 10310@var{name} can be a file name pattern of the same type 10311that you can specify in the @file{.cvsignore} file. 10312See @ref{cvsignore}. 10313@c -- Is this really true? 10314 10315@item -W @var{spec} 10316Specify file names that should be filtered during 10317import. You can use this option repeatedly. 10318 10319@var{spec} can be a file name pattern of the same type 10320that you can specify in the @file{.cvswrappers} 10321file. @xref{Wrappers}. 10322@end table 10323 10324@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10325@node import output 10326@appendixsubsec import output 10327 10328@code{import} keeps you informed of its progress by printing a line 10329for each file, preceded by one character indicating the status of the file: 10330 10331@table @code 10332@item U @var{file} 10333The file already exists in the repository and has not been locally 10334modified; a new revision has been created (if necessary). 10335 10336@item N @var{file} 10337The file is a new file which has been added to the repository. 10338 10339@item C @var{file} 10340The file already exists in the repository but has been locally modified; 10341you will have to merge the changes. 10342 10343@item I @var{file} 10344The file is being ignored (@pxref{cvsignore}). 10345 10346@cindex Symbolic link, importing 10347@cindex Link, symbolic, importing 10348@c FIXME: also (somewhere else) probably 10349@c should be documenting what happens if you "cvs add" 10350@c a symbolic link. Also maybe what happens if 10351@c you manually create symbolic links within the 10352@c repository (? - not sure why we'd want to suggest 10353@c doing that). 10354@item L @var{file} 10355The file is a symbolic link; @code{cvs import} ignores symbolic links. 10356People periodically suggest that this behavior should 10357be changed, but if there is a consensus on what it 10358should be changed to, it doesn't seem to be apparent. 10359(Various options in the @file{modules} file can be used 10360to recreate symbolic links on checkout, update, etc.; 10361@pxref{modules}.) 10362@end table 10363 10364@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10365@node import examples 10366@appendixsubsec import examples 10367 10368See @ref{Tracking sources}, and @ref{From files}. 10369 10370@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10371@node log 10372@appendixsec log---Print out log information for files 10373@cindex log (subcommand) 10374 10375@itemize @bullet 10376@item 10377Synopsis: log [options] [files@dots{}] 10378@item 10379Requires: repository, working directory. 10380@item 10381Changes: nothing. 10382@end itemize 10383 10384Display log information for files. @code{log} used to 10385call the @sc{rcs} utility @code{rlog}. Although this 10386is no longer true in the current sources, this history 10387determines the format of the output and the options, 10388which are not quite in the style of the other @sc{cvs} 10389commands. 10390 10391@cindex Timezone, in output 10392@cindex Zone, time, in output 10393@c Kind of a funny place to document the timezone used 10394@c in output from commands other than @code{log}. 10395@c There is also more we need to say about this, 10396@c including what happens in a client/server environment. 10397The output includes the location of the @sc{rcs} file, 10398the @dfn{head} revision (the latest revision on the 10399trunk), all symbolic names (tags) and some other 10400things. For each revision, the revision number, the 10401author, the number of lines added/deleted and the log 10402message are printed. All times are displayed in 10403Coordinated Universal Time (UTC). (Other parts of 10404@sc{cvs} print times in the local timezone). 10405@c FIXCVS: need a better way to control the timezone 10406@c used in output. Previous/current versions of CVS did/do 10407@c sometimes support -z in RCSINIT, and/or an 10408@c undocumented (except by reference to 'rlog') -z option 10409@c to cvs log, but this has not been a consistent, 10410@c documented feature. Perhaps a new global option, 10411@c where LT means the client's timezone, which the 10412@c client then communicates to the server, is the 10413@c right solution. 10414 10415@strong{@code{log} uses @samp{-R} in a way that conflicts 10416with the normal use inside @sc{cvs} (@pxref{Common options}).} 10417 10418@menu 10419* log options:: log options 10420* log examples:: log examples 10421@end menu 10422 10423@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10424@node log options 10425@appendixsubsec log options 10426 10427By default, @code{log} prints all information that is 10428available. All other options restrict the output. Note that the revision 10429selection options (@code{-b}, @code{-d}, @code{-r}, @code{-s}, and @code{-w}) 10430have no 10431effect, other than possibly causing a search for files in Attic directories, 10432when used in conjunction with the options that restrict the output to only 10433@code{log} header fields (@code{-h}, @code{-R}, and @code{-t}) 10434unless the @code{-S} option is also specified. 10435 10436@table @code 10437@item -b 10438Print information about the revisions on the default 10439branch, normally the highest branch on the trunk. 10440 10441@item -d @var{dates} 10442Print information about revisions with a checkin 10443date/time in the range given by the 10444semicolon-separated list of dates. The date formats 10445accepted are those accepted by the @samp{-D} option to 10446many other @sc{cvs} commands (@pxref{Common options}). 10447Dates can be combined into ranges as follows: 10448 10449@c Should we be thinking about accepting ISO8601 10450@c ranges? For example "1972-09-10/1972-09-12". 10451@table @code 10452@item @var{d1}<@var{d2} 10453@itemx @var{d2}>@var{d1} 10454Select the revisions that were deposited between 10455@var{d1} and @var{d2}. 10456 10457@item <@var{d} 10458@itemx @var{d}> 10459Select all revisions dated @var{d} or earlier. 10460 10461@item @var{d}< 10462@itemx >@var{d} 10463Select all revisions dated @var{d} or later. 10464 10465@item @var{d} 10466Select the single, latest revision dated @var{d} or 10467earlier. 10468@end table 10469 10470The @samp{>} or @samp{<} characters may be followed by 10471@samp{=} to indicate an inclusive range rather than an 10472exclusive one. 10473 10474Note that the separator is a semicolon (;). 10475 10476@item -h 10477Print only the name of the @sc{rcs} file, name 10478of the file in the working directory, head, 10479default branch, access list, locks, symbolic names, and 10480suffix. 10481 10482@item -l 10483Local; run only in current working directory. (Default 10484is to run recursively). 10485 10486@item -N 10487Do not print the list of tags for this file. This 10488option can be very useful when your site uses a lot of 10489tags, so rather than "more"'ing over 3 pages of tag 10490information, the log information is presented without 10491tags at all. 10492 10493@item -n 10494Print the list of tags for this file. This option can 10495be very useful when your @file{.cvsrc} file has a 10496@samp{log -N} entry as a way to get a full list of all 10497of the tags. 10498 10499@item -R 10500Print only the name of the @sc{rcs} file. 10501 10502@c Note that using a bare revision (in addition to not 10503@c being explicitly documented here) is potentially 10504@c confusing; it shows the log message to get from the 10505@c previous revision to that revision. "-r1.3 -r1.6" 10506@c (equivalent to "-r1.3,1.6") is even worse; it 10507@c prints the messages to get from 1.2 to 1.3 and 1.5 10508@c to 1.6. By analogy with "cvs diff", users might 10509@c expect that it is more like specifying a range. 10510@c It is not 100% clear to me how much of this should 10511@c be documented (for example, multiple -r options 10512@c perhaps could/should be deprecated given the false 10513@c analogy with "cvs diff"). 10514@c In general, this section should be rewritten to talk 10515@c about messages to get from revision rev1 to rev2, 10516@c rather than messages for revision rev2 (that is, the 10517@c messages are associated with a change not a static 10518@c revision and failing to make this distinction causes 10519@c much confusion). 10520@item -r@var{revisions} 10521Print information about revisions given in the 10522comma-separated list @var{revisions} of revisions and 10523ranges. The following table explains the available 10524range formats: 10525 10526@table @code 10527@item @var{rev1}:@var{rev2} 10528Revisions @var{rev1} to @var{rev2} (which must be on 10529the same branch). 10530 10531@item @var{rev1}::@var{rev2} 10532The same, but excluding @var{rev1}. 10533 10534@item :@var{rev} 10535@itemx ::@var{rev} 10536Revisions from the beginning of the branch up to 10537and including @var{rev}. 10538 10539@item @var{rev}: 10540Revisions starting with @var{rev} to the end of the 10541branch containing @var{rev}. 10542 10543@item @var{rev}:: 10544Revisions starting just after @var{rev} to the end of the 10545branch containing @var{rev}. 10546 10547@item @var{branch} 10548An argument that is a branch means all revisions on 10549that branch. 10550 10551@item @var{branch1}:@var{branch2} 10552@itemx @var{branch1}::@var{branch2} 10553A range of branches means all revisions 10554on the branches in that range. 10555 10556@item @var{branch}. 10557The latest revision in @var{branch}. 10558@end table 10559 10560A bare @samp{-r} with no revisions means the latest 10561revision on the default branch, normally the trunk. 10562There can be no space between the @samp{-r} option and 10563its argument. 10564 10565@item -S 10566Suppress the header if no revisions are selected. 10567 10568@item -s @var{states} 10569Print information about revisions whose state 10570attributes match one of the states given in the 10571comma-separated list @var{states}. Individual states may 10572be any text string, though @sc{cvs} commonly only uses two 10573states, @samp{Exp} and @samp{dead}. See @ref{admin options} 10574for more information. 10575 10576@item -t 10577Print the same as @samp{-h}, plus the descriptive text. 10578 10579@item -w@var{logins} 10580Print information about revisions checked in by users 10581with login names appearing in the comma-separated list 10582@var{logins}. If @var{logins} is omitted, the user's 10583login is assumed. There can be no space between the 10584@samp{-w} option and its argument. 10585@end table 10586 10587@code{log} prints the intersection of the revisions 10588selected with the options @samp{-d}, @samp{-s}, and 10589@samp{-w}, intersected with the union of the revisions 10590selected by @samp{-b} and @samp{-r}. 10591 10592@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10593@node log examples 10594@appendixsubsec log examples 10595 10596Contributed examples are gratefully accepted. 10597 10598@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10599@node rdiff 10600@appendixsec rdiff---'patch' format diffs between releases 10601@cindex rdiff (subcommand) 10602 10603@itemize @bullet 10604@item 10605rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{} 10606@item 10607Requires: repository. 10608@item 10609Changes: nothing. 10610@item 10611Synonym: patch 10612@end itemize 10613 10614Builds a Larry Wall format patch(1) file between two 10615releases, that can be fed directly into the @code{patch} 10616program to bring an old release up-to-date with the new 10617release. (This is one of the few @sc{cvs} commands that 10618operates directly from the repository, and doesn't 10619require a prior checkout.) The diff output is sent to 10620the standard output device. 10621 10622You can specify (using the standard @samp{-r} and 10623@samp{-D} options) any combination of one or two 10624revisions or dates. If only one revision or date is 10625specified, the patch file reflects differences between 10626that revision or date and the current head revisions in 10627the @sc{rcs} file. 10628 10629Note that if the software release affected is contained 10630in more than one directory, then it may be necessary to 10631specify the @samp{-p} option to the @code{patch} command when 10632patching the old sources, so that @code{patch} is able to find 10633the files that are located in other directories. 10634 10635@menu 10636* rdiff options:: rdiff options 10637* rdiff examples:: rdiff examples 10638@end menu 10639 10640@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10641@node rdiff options 10642@appendixsubsec rdiff options 10643 10644These standard options are supported by @code{rdiff} 10645(@pxref{Common options} for a complete description of 10646them): 10647 10648@table @code 10649@item -D @var{date} 10650Use the most recent revision no later than @var{date}. 10651 10652@item -f 10653If no matching revision is found, retrieve the most 10654recent revision (instead of ignoring the file). 10655 10656@item -k @var{kflag} 10657Process keywords according to @var{kflag}. See 10658@ref{Keyword substitution}. 10659 10660@item -l 10661Local; don't descend subdirectories. 10662 10663@item -R 10664Examine directories recursively. This option is on by default. 10665 10666@item -r @var{tag} 10667Use revision @var{tag}. 10668@end table 10669 10670In addition to the above, these options are available: 10671 10672@table @code 10673@item -c 10674Use the context diff format. This is the default format. 10675 10676@item -s 10677Create a summary change report instead of a patch. The 10678summary includes information about files that were 10679changed or added between the releases. It is sent to 10680the standard output device. This is useful for finding 10681out, for example, which files have changed between two 10682dates or revisions. 10683 10684@item -t 10685A diff of the top two revisions is sent to the standard 10686output device. This is most useful for seeing what the 10687last change to a file was. 10688 10689@item -u 10690Use the unidiff format for the context diffs. 10691Remember that old versions 10692of the @code{patch} program can't handle the unidiff 10693format, so if you plan to post this patch to the net 10694you should probably not use @samp{-u}. 10695 10696@item -V @var{vn} 10697Expand keywords according to the rules current in 10698@sc{rcs} version @var{vn} (the expansion format changed with 10699@sc{rcs} version 5). Note that this option is no 10700longer accepted. @sc{cvs} will always expand keywords the 10701way that @sc{rcs} version 5 does. 10702@end table 10703 10704@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10705@node rdiff examples 10706@appendixsubsec rdiff examples 10707 10708Suppose you receive mail from @t{foo@@example.net} asking for an 10709update from release 1.2 to 1.4 of the tc compiler. You 10710have no such patches on hand, but with @sc{cvs} that can 10711easily be fixed with a command such as this: 10712 10713@example 10714$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \ 10715> Mail -s 'The patches you asked for' foo@@example.net 10716@end example 10717 10718Suppose you have made release 1.3, and forked a branch 10719called @samp{R_1_3fix} for bug fixes. @samp{R_1_3_1} 10720corresponds to release 1.3.1, which was made some time 10721ago. Now, you want to see how much development has been 10722done on the branch. This command can be used: 10723 10724@example 10725$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name 10726cvs rdiff: Diffing module-name 10727File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6 10728File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4 10729File bar.h,v changed from revision 1.29.2.1 to 1.2 10730@end example 10731 10732@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10733@node release 10734@appendixsec release---Indicate that a Module is no longer in use 10735@cindex release (subcommand) 10736 10737@itemize @bullet 10738@item 10739release [-d] directories@dots{} 10740@item 10741Requires: Working directory. 10742@item 10743Changes: Working directory, history log. 10744@end itemize 10745 10746This command is meant to safely cancel the effect of 10747@samp{cvs checkout}. Since @sc{cvs} doesn't lock files, it 10748isn't strictly necessary to use this command. You can 10749always simply delete your working directory, if you 10750like; but you risk losing changes you may have 10751forgotten, and you leave no trace in the @sc{cvs} history 10752file (@pxref{history file}) that you've abandoned your 10753checkout. 10754 10755Use @samp{cvs release} to avoid these problems. This 10756command checks that no uncommitted changes are 10757present; that you are executing it from immediately 10758above a @sc{cvs} working directory; and that the repository 10759recorded for your files is the same as the repository 10760defined in the module database. 10761 10762If all these conditions are true, @samp{cvs release} 10763leaves a record of its execution (attesting to your 10764intentionally abandoning your checkout) in the @sc{cvs} 10765history log. 10766 10767@menu 10768* release options:: release options 10769* release output:: release output 10770* release examples:: release examples 10771@end menu 10772 10773@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10774@node release options 10775@appendixsubsec release options 10776 10777The @code{release} command supports one command option: 10778 10779@table @code 10780@item -d 10781Delete your working copy of the file if the release 10782succeeds. If this flag is not given your files will 10783remain in your working directory. 10784 10785@strong{WARNING: The @code{release} command deletes 10786all directories and files recursively. This 10787has the very serious side-effect that any directory 10788created inside checked-out sources, and not added to 10789the repository (using the @code{add} command; 10790@pxref{Adding files}) will be silently deleted---even 10791if it is non-empty!} 10792@end table 10793 10794@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10795@node release output 10796@appendixsubsec release output 10797 10798Before @code{release} releases your sources it will 10799print a one-line message for any file that is not 10800up-to-date. 10801 10802@table @code 10803@item U @var{file} 10804@itemx P @var{file} 10805There exists a newer revision of this file in the 10806repository, and you have not modified your local copy 10807of the file (@samp{U} and @samp{P} mean the same thing). 10808 10809@item A @var{file} 10810The file has been added to your private copy of the 10811sources, but has not yet been committed to the 10812repository. If you delete your copy of the sources 10813this file will be lost. 10814 10815@item R @var{file} 10816The file has been removed from your private copy of the 10817sources, but has not yet been removed from the 10818repository, since you have not yet committed the 10819removal. See @ref{commit}. 10820 10821@item M @var{file} 10822The file is modified in your working directory. There 10823might also be a newer revision inside the repository. 10824 10825@item ? @var{file} 10826@var{file} is in your working directory, but does not 10827correspond to anything in the source repository, and is 10828not in the list of files for @sc{cvs} to ignore (see the 10829description of the @samp{-I} option, and 10830@pxref{cvsignore}). If you remove your working 10831sources, this file will be lost. 10832@end table 10833 10834@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10835@node release examples 10836@appendixsubsec release examples 10837 10838Release the @file{tc} directory, and delete your local working copy 10839of the files. 10840 10841@example 10842$ cd .. # @r{You must stand immediately above the} 10843 # @r{sources when you issue @samp{cvs release}.} 10844$ cvs release -d tc 10845You have [0] altered files in this repository. 10846Are you sure you want to release (and delete) directory `tc': y 10847$ 10848@end example 10849 10850@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10851@node remove 10852@appendixsec remove---Remove files from active use 10853@cindex remove (subcommand) 10854 10855@itemize @bullet 10856@item 10857Synopsis: remove [-flR] [files...] 10858@item 10859Requires: repository, working directory. 10860@item 10861Changes: working directory. 10862@end itemize 10863 10864The @code{remove} command is used to remove unwanted 10865files from active use. The user normally deletes the 10866files from the working directory prior to invocation 10867of the @code{remove} command. Only the working 10868directory is updated. Changes to the repository are 10869not made until the @code{commit} command is run. 10870 10871The @code{remove} command does not delete files from 10872from the repository. @sc{cvs} keeps all historical 10873data in the repository so that it is possible to 10874reconstruct previous states of the projects under 10875revision control. 10876 10877To undo @sc{cvs} @code{remove} or to resurrect files 10878that were previously removed, @xref{add}. 10879 10880@menu 10881* remove options:: remove options 10882* remove examples:: remove examples 10883@end menu 10884 10885@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10886@node remove options 10887@appendixsubsec remove options 10888 10889These standard options are supported by @code{remove} 10890(@pxref{Common options} for a complete description of 10891them): 10892 10893@table @code 10894@item -l 10895Local; run only in current working directory. See @ref{Recursive behavior}. 10896 10897@item -R 10898Process directories recursively. See @ref{Recursive behavior}. 10899 10900@end table 10901 10902In addition, these options are also supported: 10903 10904@table @code 10905@item -f 10906Note that this is not the standard behavior of 10907the @samp{-f} option as defined in @ref{Common options}. 10908 10909Delete files before removing them. 10910 10911Entire directory hierarchies are easily removed 10912using @samp{-f}, but take note that it is not as 10913easy to resurrect directory hierarchies as it is 10914to remove them. 10915 10916@end table 10917 10918@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10919@node remove examples 10920@appendixsubsec remove examples 10921 10922@appendixsubsubsec Removing a file 10923 10924@example 10925$ cvs remove remove.me 10926cvs remove: file `remove.me' still in working directory 10927cvs remove: 1 file exists; remove it first 10928$ rm -f remove.me 10929$ cvs remove remove.me 10930cvs remove: scheduling `remove.me' for removal 10931cvs remove: use 'cvs commit' to remove this file permanently 10932 10933$ ls remove.it 10934remove.it 10935$ cvs remove -f remove.it 10936cvs remove: scheduling `remove.it' for removal 10937cvs remove: use 'cvs commit' to remove this file permanently 10938@end example 10939 10940@appendixsubsubsec Removing entire directories 10941@example 10942$ tree -d a 10943a 10944|-- CVS 10945`-- b 10946 `-- CVS 10947 109483 directories 10949$ cvs remove -f a 10950cvs remove: Removing a 10951cvs remove: Removing a/b 10952cvs remove: scheduling `a/b/c' for removal 10953cvs remove: use 'cvs commit' to remove this file permanently 10954@end example 10955 10956@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10957@node update 10958@appendixsec update---Bring work tree in sync with repository 10959@cindex update (subcommand) 10960 10961@itemize @bullet 10962@item 10963update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files@dots{} 10964@item 10965Requires: repository, working directory. 10966@item 10967Changes: working directory. 10968@end itemize 10969 10970After you've run checkout to create your private copy 10971of source from the common repository, other developers 10972will continue changing the central source. From time 10973to time, when it is convenient in your development 10974process, you can use the @code{update} command from 10975within your working directory to reconcile your work 10976with any revisions applied to the source repository 10977since your last checkout or update. 10978 10979@menu 10980* update options:: update options 10981* update output:: update output 10982@end menu 10983 10984@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10985@node update options 10986@appendixsubsec update options 10987 10988These standard options are available with @code{update} 10989(@pxref{Common options} for a complete description of 10990them): 10991 10992@table @code 10993@item -D date 10994Use the most recent revision no later than @var{date}. 10995This option is sticky, and implies @samp{-P}. 10996See @ref{Sticky tags} for more information on sticky tags/dates. 10997 10998@item -f 10999Only useful with the @samp{-D @var{date}} or @samp{-r 11000@var{tag}} flags. If no matching revision is found, 11001retrieve the most recent revision (instead of ignoring 11002the file). 11003 11004@item -k @var{kflag} 11005Process keywords according to @var{kflag}. See 11006@ref{Keyword substitution}. 11007This option is sticky; future updates of 11008this file in this working directory will use the same 11009@var{kflag}. The @code{status} command can be viewed 11010to see the sticky options. See @ref{Invoking CVS} for 11011more information on the @code{status} command. 11012 11013@item -l 11014Local; run only in current working directory. See @ref{Recursive behavior}. 11015 11016@item -P 11017Prune empty directories. See @ref{Moving directories}. 11018 11019@item -p 11020Pipe files to the standard output. 11021 11022@item -R 11023Update directories recursively (default). See @ref{Recursive 11024behavior}. 11025 11026@item -r rev 11027Retrieve revision/tag @var{rev}. This option is sticky, 11028and implies @samp{-P}. 11029See @ref{Sticky tags}, for more information on sticky tags/dates. 11030@end table 11031 11032@need 800 11033These special options are also available with 11034@code{update}. 11035 11036@table @code 11037@item -A 11038Reset any sticky tags, dates, or @samp{-k} options. 11039Does not reset sticky @samp{-k} options on modified files. 11040See @ref{Sticky tags} for more information on sticky tags/dates. 11041 11042@item -C 11043Overwrite locally modified files with clean copies from 11044the repository (the modified file is saved in 11045@file{.#@var{file}.@var{revision}}, however). 11046 11047@item -d 11048Create any directories that exist in the repository if 11049they're missing from the working directory. Normally, 11050@code{update} acts only on directories and files that 11051were already enrolled in your working directory. 11052 11053This is useful for updating directories that were 11054created in the repository since the initial checkout; 11055but it has an unfortunate side effect. If you 11056deliberately avoided certain directories in the 11057repository when you created your working directory 11058(either through use of a module name or by listing 11059explicitly the files and directories you wanted on the 11060command line), then updating with @samp{-d} will create 11061those directories, which may not be what you want. 11062 11063@item -I @var{name} 11064Ignore files whose names match @var{name} (in your 11065working directory) during the update. You can specify 11066@samp{-I} more than once on the command line to specify 11067several files to ignore. Use @samp{-I !} to avoid 11068ignoring any files at all. See @ref{cvsignore} for other 11069ways to make @sc{cvs} ignore some files. 11070 11071@item -W@var{spec} 11072Specify file names that should be filtered during 11073update. You can use this option repeatedly. 11074 11075@var{spec} can be a file name pattern of the same type 11076that you can specify in the @file{.cvswrappers} 11077file. See @ref{Wrappers}. 11078 11079@item -j@var{revision} 11080With two @samp{-j} options, merge changes from the 11081revision specified with the first @samp{-j} option to 11082the revision specified with the second @samp{j} option, 11083into the working directory. 11084 11085With one @samp{-j} option, merge changes from the 11086ancestor revision to the revision specified with the 11087@samp{-j} option, into the working directory. The 11088ancestor revision is the common ancestor of the 11089revision which the working directory is based on, and 11090the revision specified in the @samp{-j} option. 11091 11092Note that using a single @samp{-j @var{tagname}} option rather than 11093@samp{-j @var{branchname}} to merge changes from a branch will 11094often not remove files which were removed on the branch. 11095See @ref{Merging adds and removals} for more information. 11096 11097In addition, each @samp{-j} option can contain an optional 11098date specification which, when used with branches, can 11099limit the chosen revision to one within a specific 11100date. An optional date is specified by adding a colon 11101(:) to the tag: 11102@samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}. 11103 11104See @ref{Branching and merging}. 11105 11106@end table 11107 11108@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11109@node update output 11110@appendixsubsec update output 11111 11112@code{update} and @code{checkout} keep you informed of 11113their progress by printing a line for each file, preceded 11114by one character indicating the status of the file: 11115 11116@table @code 11117@item U @var{file} 11118The file was brought up to date with respect to the 11119repository. This is done for any file that exists in 11120the repository but not in your working directory, and for files 11121that you haven't changed but are not the most recent 11122versions available in the repository. 11123 11124@item P @var{file} 11125Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire 11126file. This accomplishes the same thing as @samp{U} using less bandwidth. 11127 11128@item A @var{file} 11129The file has been added to your private copy of the 11130sources, and will be added to the source repository 11131when you run @code{commit} on the file. This is a 11132reminder to you that the file needs to be committed. 11133 11134@item R @var{file} 11135The file has been removed from your private copy of the 11136sources, and will be removed from the source repository 11137when you run @code{commit} on the file. This is a 11138reminder to you that the file needs to be committed. 11139 11140@item M @var{file} 11141The file is modified in your working directory. 11142 11143@samp{M} can indicate one of two states for a file 11144you're working on: either there were no modifications 11145to the same file in the repository, so that your file 11146remains as you last saw it; or there were modifications 11147in the repository as well as in your copy, but they 11148were merged successfully, without conflict, in your 11149working directory. 11150 11151@sc{cvs} will print some messages if it merges your work, 11152and a backup copy of your working file (as it looked 11153before you ran @code{update}) will be made. The exact 11154name of that file is printed while @code{update} runs. 11155 11156@item C @var{file} 11157@cindex .# files 11158@cindex __ files (VMS) 11159A conflict was detected while trying to merge your 11160changes to @var{file} with changes from the source 11161repository. @var{file} (the copy in your working 11162directory) is now the result of attempting to merge 11163the two revisions; an unmodified copy of your file 11164is also in your working directory, with the name 11165@file{.#@var{file}.@var{revision}} where @var{revision} 11166is the revision that your modified file started 11167from. Resolve the conflict as described in 11168@ref{Conflicts example}. 11169@c "some systems" as in out-of-the-box OSes? Not as 11170@c far as I know. We need to advise sysadmins as well 11171@c as users how to set up this kind of purge, if that is 11172@c what they want. 11173@c We also might want to think about cleaner solutions, 11174@c like having CVS remove the .# file once the conflict 11175@c has been resolved or something like that. 11176(Note that some systems automatically purge 11177files that begin with @file{.#} if they have not been 11178accessed for a few days. If you intend to keep a copy 11179of your original file, it is a very good idea to rename 11180it.) Under @sc{vms}, the file name starts with 11181@file{__} rather than @file{.#}. 11182 11183@item ? @var{file} 11184@var{file} is in your working directory, but does not 11185correspond to anything in the source repository, and is 11186not in the list of files for @sc{cvs} to ignore (see the 11187description of the @samp{-I} option, and 11188@pxref{cvsignore}). 11189@end table 11190 11191@c ----- END MAN 1 ----- 11192@c --------------------------------------------------------------------- 11193@node Invoking CVS 11194@appendix Quick reference to CVS commands 11195@cindex Command reference 11196@cindex Reference, commands 11197@cindex Invoking CVS 11198 11199This appendix describes how to invoke @sc{cvs}, with 11200references to where each command or feature is 11201described in detail. For other references run the 11202@code{cvs --help} command, or see @ref{Index}. 11203 11204A @sc{cvs} command looks like: 11205 11206@example 11207cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ] 11208@end example 11209 11210Global options: 11211 11212@table @code 11213@item --allow-root=@var{rootdir} 11214Specify legal @sc{cvsroot} directory (server only) (not 11215in @sc{cvs} 1.9 and older). See @ref{Password 11216authentication server}. 11217 11218@item -a 11219Authenticate all communication (client only) (not in @sc{cvs} 112201.9 and older). See @ref{Global options}. 11221 11222@item -b 11223Specify RCS location (@sc{cvs} 1.9 and older). See 11224@ref{Global options}. 11225 11226@item -d @var{root} 11227Specify the @sc{cvsroot}. See @ref{Repository}. 11228 11229@item -e @var{editor} 11230Edit messages with @var{editor}. See @ref{Committing 11231your changes}. 11232 11233@item -f 11234Do not read the @file{~/.cvsrc} file. See @ref{Global 11235options}. 11236 11237@item -H 11238@itemx --help 11239Print a help message. See @ref{Global options}. 11240 11241@item -n 11242Do not change any files. See @ref{Global options}. 11243 11244@item -Q 11245Be really quiet. See @ref{Global options}. 11246 11247@item -q 11248Be somewhat quiet. See @ref{Global options}. 11249 11250@item -r 11251Make new working files read-only. See @ref{Global options}. 11252 11253@item -s @var{variable}=@var{value} 11254Set a user variable. See @ref{Variables}. 11255 11256@item -T @var{tempdir} 11257Put temporary files in @var{tempdir}. See @ref{Global 11258options}. 11259 11260@item -t 11261Trace @sc{cvs} execution. See @ref{Global options}. 11262 11263@item -v 11264@item --version 11265Display version and copyright information for @sc{cvs}. 11266 11267@item -w 11268Make new working files read-write. See @ref{Global 11269options}. 11270 11271@item -x 11272Encrypt all communication (client only). 11273See @ref{Global options}. 11274 11275@item -z @var{gzip-level} 11276@cindex Compression 11277@cindex Gzip 11278Set the compression level (client only). 11279See @ref{Global options}. 11280@end table 11281 11282Keyword expansion modes (@pxref{Substitution modes}): 11283 11284@example 11285-kkv $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $ 11286-kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 11287-kk $@splitrcskeyword{Id}$ 11288-kv file1,v 1.1 1993/12/09 03:21:13 joe Exp 11289-ko @i{no expansion} 11290-kb @i{no expansion, file is binary} 11291@end example 11292 11293Keywords (@pxref{Keyword list}): 11294 11295@example 11296$@splitrcskeyword{Author}: joe $ 11297$@splitrcskeyword{Date}: 1993/12/09 03:21:13 $ 11298$@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 11299$@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $ 11300$@splitrcskeyword{Locker}: harry $ 11301$@splitrcskeyword{Name}: snapshot_1_14 $ 11302$@splitrcskeyword{RCSfile}: file1,v $ 11303$@splitrcskeyword{Revision}: 1.1 $ 11304$@splitrcskeyword{Source}: /home/files/file1,v $ 11305$@splitrcskeyword{State}: Exp $ 11306$@splitrcskeyword{Log}: file1,v $ 11307Revision 1.1 1993/12/09 03:30:17 joe 11308Initial revision 11309 11310@end example 11311 11312@c The idea behind this table is that we want each item 11313@c to be a sentence or two at most. Preferably a 11314@c single line. 11315@c 11316@c In some cases refs to "foo options" are just to get 11317@c this thing written quickly, not because the "foo 11318@c options" node is really the best place to point. 11319Commands, command options, and command arguments: 11320 11321@table @code 11322@c ------------------------------------------------------------ 11323@item add [@var{options}] [@var{files}@dots{}] 11324Add a new file/directory. See @ref{Adding files}. 11325 11326@table @code 11327@item -k @var{kflag} 11328Set keyword expansion. 11329 11330@item -m @var{msg} 11331Set file description. 11332@end table 11333 11334@c ------------------------------------------------------------ 11335@item admin [@var{options}] [@var{files}@dots{}] 11336Administration of history files in the repository. See 11337@ref{admin}. 11338@c This list omits those options which are not 11339@c documented as being useful with CVS. That might be 11340@c a mistake... 11341 11342@table @code 11343@item -b[@var{rev}] 11344Set default branch. See @ref{Reverting local changes}. 11345 11346@item -c@var{string} 11347Set comment leader. 11348 11349@item -k@var{subst} 11350Set keyword substitution. See @ref{Keyword 11351substitution}. 11352 11353@item -l[@var{rev}] 11354Lock revision @var{rev}, or latest revision. 11355 11356@item -m@var{rev}:@var{msg} 11357Replace the log message of revision @var{rev} with 11358@var{msg}. 11359 11360@item -o@var{range} 11361Delete revisions from the repository. See 11362@ref{admin options}. 11363 11364@item -q 11365Run quietly; do not print diagnostics. 11366 11367@item -s@var{state}[:@var{rev}] 11368Set the state. See @ref{admin options} for more information on possible 11369states. 11370 11371@c Does not work for client/server CVS 11372@item -t 11373Set file description from standard input. 11374 11375@item -t@var{file} 11376Set file description from @var{file}. 11377 11378@item -t-@var{string} 11379Set file description to @var{string}. 11380 11381@item -u[@var{rev}] 11382Unlock revision @var{rev}, or latest revision. 11383@end table 11384 11385@c ------------------------------------------------------------ 11386@item annotate [@var{options}] [@var{files}@dots{}] 11387Show last revision where each line was modified. See 11388@ref{annotate}. 11389 11390@table @code 11391@item -D @var{date} 11392Annotate the most recent revision no later than 11393@var{date}. See @ref{Common options}. 11394 11395@item -F 11396Force annotation of binary files. (Without this option, 11397binary files are skipped with a message.) 11398 11399@item -f 11400Use head revision if tag/date not found. See 11401@ref{Common options}. 11402 11403@item -l 11404Local; run only in current working directory. @xref{Recursive behavior}. 11405 11406@item -R 11407Operate recursively (default). @xref{Recursive 11408behavior}. 11409 11410@item -r @var{tag} 11411Annotate revision @var{tag}. See @ref{Common options}. 11412@end table 11413 11414@c ------------------------------------------------------------ 11415@item checkout [@var{options}] @var{modules}@dots{} 11416Get a copy of the sources. See @ref{checkout}. 11417 11418@table @code 11419@item -A 11420Reset any sticky tags/date/options. See @ref{Sticky 11421tags} and @ref{Keyword substitution}. 11422 11423@item -c 11424Output the module database. See @ref{checkout options}. 11425 11426@item -D @var{date} 11427Check out revisions as of @var{date} (is sticky). See 11428@ref{Common options}. 11429 11430@item -d @var{dir} 11431Check out into @var{dir}. See @ref{checkout options}. 11432 11433@item -f 11434Use head revision if tag/date not found. See 11435@ref{Common options}. 11436 11437@c Probably want to use rev1/rev2 style like for diff 11438@c -r. Here and in on-line help. 11439@item -j @var{rev} 11440Merge in changes. See @ref{checkout options}. 11441 11442@item -k @var{kflag} 11443Use @var{kflag} keyword expansion. See 11444@ref{Substitution modes}. 11445 11446@item -l 11447Local; run only in current working directory. @xref{Recursive behavior}. 11448 11449@item -N 11450Don't ``shorten'' module paths if -d specified. See 11451@ref{checkout options}. 11452 11453@item -n 11454Do not run module program (if any). See @ref{checkout options}. 11455 11456@item -P 11457Prune empty directories. See @ref{Moving directories}. 11458 11459@item -p 11460Check out files to standard output (avoids 11461stickiness). See @ref{checkout options}. 11462 11463@item -R 11464Operate recursively (default). @xref{Recursive 11465behavior}. 11466 11467@item -r @var{tag} 11468Checkout revision @var{tag} (is sticky). See @ref{Common options}. 11469 11470@item -s 11471Like -c, but include module status. See @ref{checkout options}. 11472@end table 11473 11474@c ------------------------------------------------------------ 11475@item commit [@var{options}] [@var{files}@dots{}] 11476Check changes into the repository. See @ref{commit}. 11477 11478@table @code 11479@item -F @var{file} 11480Read log message from @var{file}. See @ref{commit options}. 11481 11482@item -f 11483@c What is this "disables recursion"? It is from the 11484@c on-line help; is it documented in this manual? 11485Force the file to be committed; disables recursion. 11486See @ref{commit options}. 11487 11488@item -l 11489Local; run only in current working directory. See @ref{Recursive behavior}. 11490 11491@item -m @var{msg} 11492Use @var{msg} as log message. See @ref{commit options}. 11493 11494@item -n 11495Do not run module program (if any). See @ref{commit options}. 11496 11497@item -R 11498Operate recursively (default). @xref{Recursive 11499behavior}. 11500 11501@item -r @var{rev} 11502Commit to @var{rev}. See @ref{commit options}. 11503@c FIXME: should be dragging over text from 11504@c commit options, especially if it can be cleaned up 11505@c and made concise enough. 11506@end table 11507 11508@c ------------------------------------------------------------ 11509@item diff [@var{options}] [@var{files}@dots{}] 11510Show differences between revisions. See @ref{diff}. 11511In addition to the options shown below, accepts a wide 11512variety of options to control output style, for example 11513@samp{-c} for context diffs. 11514 11515@table @code 11516@item -D @var{date1} 11517Diff revision for date against working file. See 11518@ref{diff options}. 11519 11520@item -D @var{date2} 11521Diff @var{rev1}/@var{date1} against @var{date2}. See 11522@ref{diff options}. 11523 11524@item -l 11525Local; run only in current working directory. See @ref{Recursive behavior}. 11526 11527@item -N 11528Include diffs for added and removed files. See 11529@ref{diff options}. 11530 11531@item -R 11532Operate recursively (default). @xref{Recursive 11533behavior}. 11534 11535@item -r @var{rev1} 11536Diff revision for @var{rev1} against working file. See 11537@ref{diff options}. 11538 11539@item -r @var{rev2} 11540Diff @var{rev1}/@var{date1} against @var{rev2}. See @ref{diff options}. 11541@end table 11542 11543@c ------------------------------------------------------------ 11544@item edit [@var{options}] [@var{files}@dots{}] 11545Get ready to edit a watched file. See @ref{Editing files}. 11546 11547@table @code 11548@item -a @var{actions} 11549Specify actions for temporary watch, where 11550@var{actions} is @code{edit}, @code{unedit}, 11551@code{commit}, @code{all}, or @code{none}. See 11552@ref{Editing files}. 11553 11554@item -l 11555Local; run only in current working directory. See @ref{Recursive behavior}. 11556 11557@item -R 11558Operate recursively (default). @xref{Recursive 11559behavior}. 11560@end table 11561 11562@c ------------------------------------------------------------ 11563@item editors [@var{options}] [@var{files}@dots{}] 11564See who is editing a watched file. See @ref{Watch information}. 11565 11566@table @code 11567@item -l 11568Local; run only in current working directory. See @ref{Recursive behavior}. 11569 11570@item -R 11571Operate recursively (default). @xref{Recursive 11572behavior}. 11573@end table 11574 11575@c ------------------------------------------------------------ 11576@item export [@var{options}] @var{modules}@dots{} 11577Export files from @sc{cvs}. See @ref{export}. 11578 11579@table @code 11580@item -D @var{date} 11581Check out revisions as of @var{date}. See 11582@ref{Common options}. 11583 11584@item -d @var{dir} 11585Check out into @var{dir}. See @ref{export options}. 11586 11587@item -f 11588Use head revision if tag/date not found. See 11589@ref{Common options}. 11590 11591@item -k @var{kflag} 11592Use @var{kflag} keyword expansion. See 11593@ref{Substitution modes}. 11594 11595@item -l 11596Local; run only in current working directory. @xref{Recursive behavior}. 11597 11598@item -N 11599Don't ``shorten'' module paths if -d specified. See 11600@ref{export options}. 11601 11602@item -n 11603Do not run module program (if any). See @ref{export options}. 11604 11605@item -R 11606Operate recursively (default). @xref{Recursive 11607behavior}. 11608 11609@item -r @var{tag} 11610Checkout revision @var{tag}. See @ref{Common options}. 11611@end table 11612 11613@c ------------------------------------------------------------ 11614@item history [@var{options}] [@var{files}@dots{}] 11615Show repository access history. See @ref{history}. 11616 11617@table @code 11618@item -a 11619All users (default is self). See @ref{history options}. 11620 11621@item -b @var{str} 11622Back to record with @var{str} in module/file/repos 11623field. See @ref{history options}. 11624 11625@item -c 11626Report on committed (modified) files. See @ref{history options}. 11627 11628@item -D @var{date} 11629Since @var{date}. See @ref{history options}. 11630 11631@item -e 11632Report on all record types. See @ref{history options}. 11633 11634@item -l 11635Last modified (committed or modified report). See @ref{history options}. 11636 11637@item -m @var{module} 11638Report on @var{module} (repeatable). See @ref{history options}. 11639 11640@item -n @var{module} 11641In @var{module}. See @ref{history options}. 11642 11643@item -o 11644Report on checked out modules. See @ref{history options}. 11645 11646@item -p @var{repository} 11647In @var{repository}. See @ref{history options}. 11648 11649@item -r @var{rev} 11650Since revision @var{rev}. See @ref{history options}. 11651 11652@item -T 11653@c What the @#$@# is a TAG? Same as a tag? This 11654@c wording is also in the online-line help. 11655Produce report on all TAGs. See @ref{history options}. 11656 11657@item -t @var{tag} 11658Since tag record placed in history file (by anyone). 11659See @ref{history options}. 11660 11661@item -u @var{user} 11662For user @var{user} (repeatable). See @ref{history options}. 11663 11664@item -w 11665Working directory must match. See @ref{history options}. 11666 11667@item -x @var{types} 11668Report on @var{types}, one or more of 11669@code{TOEFWUPCGMAR}. See @ref{history options}. 11670 11671@item -z @var{zone} 11672Output for time zone @var{zone}. See @ref{history options}. 11673@end table 11674 11675@c ------------------------------------------------------------ 11676@item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{} 11677Import files into @sc{cvs}, using vendor branches. See 11678@ref{import}. 11679 11680@table @code 11681@item -b @var{bra} 11682Import to vendor branch @var{bra}. See 11683@ref{Multiple vendor branches}. 11684 11685@item -d 11686Use the file's modification time as the time of 11687import. See @ref{import options}. 11688 11689@item -k @var{kflag} 11690Set default keyword substitution mode. See 11691@ref{import options}. 11692 11693@item -m @var{msg} 11694Use @var{msg} for log message. See 11695@ref{import options}. 11696 11697@item -I @var{ign} 11698More files to ignore (! to reset). See 11699@ref{import options}. 11700 11701@item -W @var{spec} 11702More wrappers. See @ref{import options}. 11703@end table 11704 11705@c ------------------------------------------------------------ 11706@item init 11707Create a @sc{cvs} repository if it doesn't exist. See 11708@ref{Creating a repository}. 11709 11710@c ------------------------------------------------------------ 11711@item kserver 11712Kerberos authenticated server. 11713See @ref{Kerberos authenticated}. 11714 11715@c ------------------------------------------------------------ 11716@item log [@var{options}] [@var{files}@dots{}] 11717Print out history information for files. See @ref{log}. 11718 11719@table @code 11720@item -b 11721Only list revisions on the default branch. See @ref{log options}. 11722 11723@item -d @var{dates} 11724Specify dates (@var{d1}<@var{d2} for range, @var{d} for 11725latest before). See @ref{log options}. 11726 11727@item -h 11728Only print header. See @ref{log options}. 11729 11730@item -l 11731Local; run only in current working directory. See @ref{Recursive behavior}. 11732 11733@item -N 11734Do not list tags. See @ref{log options}. 11735 11736@item -R 11737Only print name of RCS file. See @ref{log options}. 11738 11739@item -r@var{revs} 11740Only list revisions @var{revs}. See @ref{log options}. 11741 11742@item -s @var{states} 11743Only list revisions with specified states. See @ref{log options}. 11744 11745@item -t 11746Only print header and descriptive text. See @ref{log 11747options}. 11748 11749@item -w@var{logins} 11750Only list revisions checked in by specified logins. See @ref{log options}. 11751@end table 11752 11753@c ------------------------------------------------------------ 11754@item login 11755Prompt for password for authenticating server. See 11756@ref{Password authentication client}. 11757 11758@c ------------------------------------------------------------ 11759@item logout 11760Remove stored password for authenticating server. See 11761@ref{Password authentication client}. 11762 11763@c ------------------------------------------------------------ 11764@item pserver 11765Password authenticated server. 11766See @ref{Password authentication server}. 11767 11768@c ------------------------------------------------------------ 11769@item rannotate [@var{options}] [@var{modules}@dots{}] 11770Show last revision where each line was modified. See 11771@ref{annotate}. 11772 11773@table @code 11774@item -D @var{date} 11775Annotate the most recent revision no later than 11776@var{date}. See @ref{Common options}. 11777 11778@item -F 11779Force annotation of binary files. (Without this option, 11780binary files are skipped with a message.) 11781 11782@item -f 11783Use head revision if tag/date not found. See 11784@ref{Common options}. 11785 11786@item -l 11787Local; run only in current working directory. @xref{Recursive behavior}. 11788 11789@item -R 11790Operate recursively (default). @xref{Recursive behavior}. 11791 11792@item -r @var{tag} 11793Annotate revision @var{tag}. See @ref{Common options}. 11794@end table 11795 11796@c ------------------------------------------------------------ 11797@item rdiff [@var{options}] @var{modules}@dots{} 11798Show differences between releases. See @ref{rdiff}. 11799 11800@table @code 11801@item -c 11802Context diff output format (default). See @ref{rdiff options}. 11803 11804@item -D @var{date} 11805Select revisions based on @var{date}. See @ref{Common options}. 11806 11807@item -f 11808Use head revision if tag/date not found. See 11809@ref{Common options}. 11810 11811@item -l 11812Local; run only in current working directory. See @ref{Recursive behavior}. 11813 11814@item -R 11815Operate recursively (default). @xref{Recursive 11816behavior}. 11817 11818@item -r @var{rev} 11819Select revisions based on @var{rev}. See @ref{Common options}. 11820 11821@item -s 11822Short patch - one liner per file. See @ref{rdiff options}. 11823 11824@item -t 11825Top two diffs - last change made to the file. See 11826@ref{diff options}. 11827 11828@item -u 11829Unidiff output format. See @ref{rdiff options}. 11830 11831@item -V @var{vers} 11832Use RCS Version @var{vers} for keyword expansion (obsolete). See 11833@ref{rdiff options}. 11834@end table 11835 11836@c ------------------------------------------------------------ 11837@item release [@var{options}] @var{directory} 11838Indicate that a directory is no longer in use. See 11839@ref{release}. 11840 11841@table @code 11842@item -d 11843Delete the given directory. See @ref{release options}. 11844@end table 11845 11846@c ------------------------------------------------------------ 11847@item remove [@var{options}] [@var{files}@dots{}] 11848Remove an entry from the repository. See @ref{Removing files}. 11849 11850@table @code 11851@item -f 11852Delete the file before removing it. See @ref{Removing files}. 11853 11854@item -l 11855Local; run only in current working directory. See @ref{Recursive behavior}. 11856 11857@item -R 11858Operate recursively (default). @xref{Recursive 11859behavior}. 11860@end table 11861 11862@c ------------------------------------------------------------ 11863@item rlog [@var{options}] [@var{files}@dots{}] 11864Print out history information for modules. See @ref{log}. 11865 11866@table @code 11867@item -b 11868Only list revisions on the default branch. See @ref{log options}. 11869 11870@item -d @var{dates} 11871Specify dates (@var{d1}<@var{d2} for range, @var{d} for 11872latest before). See @ref{log options}. 11873 11874@item -h 11875Only print header. See @ref{log options}. 11876 11877@item -l 11878Local; run only in current working directory. See @ref{Recursive behavior}. 11879 11880@item -N 11881Do not list tags. See @ref{log options}. 11882 11883@item -R 11884Only print name of RCS file. See @ref{log options}. 11885 11886@item -r@var{revs} 11887Only list revisions @var{revs}. See @ref{log options}. 11888 11889@item -s @var{states} 11890Only list revisions with specified states. See @ref{log options}. 11891 11892@item -t 11893Only print header and descriptive text. See @ref{log options}. 11894 11895@item -w@var{logins} 11896Only list revisions checked in by specified logins. See @ref{log options}. 11897@end table 11898 11899@c ------------------------------------------------------------ 11900@item rtag [@var{options}] @var{tag} @var{modules}@dots{} 11901Add a symbolic tag to a module. 11902See @ref{Revisions} and @ref{Branching and merging}. 11903 11904@table @code 11905@item -a 11906Clear tag from removed files that would not otherwise 11907be tagged. See @ref{Tagging add/remove}. 11908 11909@item -b 11910Create a branch named @var{tag}. See @ref{Branching and merging}. 11911 11912@item -B 11913Used in conjunction with -F or -d, enables movement and deletion of 11914branch tags. Use with extreme caution. 11915 11916@item -D @var{date} 11917Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 11918 11919@item -d 11920Delete @var{tag}. See @ref{Modifying tags}. 11921 11922@item -F 11923Move @var{tag} if it already exists. See @ref{Modifying tags}. 11924 11925@item -f 11926Force a head revision match if tag/date not found. 11927See @ref{Tagging by date/tag}. 11928 11929@item -l 11930Local; run only in current working directory. See @ref{Recursive behavior}. 11931 11932@item -n 11933No execution of tag program. See @ref{Common options}. 11934 11935@item -R 11936Operate recursively (default). @xref{Recursive 11937behavior}. 11938 11939@item -r @var{rev} 11940Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 11941@end table 11942 11943@c ------------------------------------------------------------ 11944@item server 11945Rsh server. See @ref{Connecting via rsh}. 11946 11947@c ------------------------------------------------------------ 11948@item status [@var{options}] @var{files}@dots{} 11949Display status information in a working directory. See 11950@ref{File status}. 11951 11952@table @code 11953@item -l 11954Local; run only in current working directory. See @ref{Recursive behavior}. 11955 11956@item -R 11957Operate recursively (default). @xref{Recursive 11958behavior}. 11959 11960@item -v 11961Include tag information for file. See @ref{Tags}. 11962@end table 11963 11964@c ------------------------------------------------------------ 11965@item tag [@var{options}] @var{tag} [@var{files}@dots{}] 11966Add a symbolic tag to checked out version of files. 11967See @ref{Revisions} and @ref{Branching and merging}. 11968 11969@table @code 11970@item -b 11971Create a branch named @var{tag}. See @ref{Branching and merging}. 11972 11973@item -c 11974Check that working files are unmodified. See 11975@ref{Tagging the working directory}. 11976 11977@item -D @var{date} 11978Tag revisions as of @var{date}. See @ref{Tagging by date/tag}. 11979 11980@item -d 11981Delete @var{tag}. See @ref{Modifying tags}. 11982 11983@item -F 11984Move @var{tag} if it already exists. See @ref{Modifying tags}. 11985 11986@item -f 11987Force a head revision match if tag/date not found. 11988See @ref{Tagging by date/tag}. 11989 11990@item -l 11991Local; run only in current working directory. See @ref{Recursive behavior}. 11992 11993@item -R 11994Operate recursively (default). @xref{Recursive 11995behavior}. 11996 11997@item -r @var{rev} 11998Tag existing tag @var{rev}. See @ref{Tagging by date/tag}. 11999@end table 12000 12001@c ------------------------------------------------------------ 12002@item unedit [@var{options}] [@var{files}@dots{}] 12003Undo an edit command. See @ref{Editing files}. 12004 12005@table @code 12006@item -l 12007Local; run only in current working directory. See @ref{Recursive behavior}. 12008 12009@item -R 12010Operate recursively (default). @xref{Recursive behavior}. 12011@end table 12012 12013@c ------------------------------------------------------------ 12014@item update [@var{options}] [@var{files}@dots{}] 12015Bring work tree in sync with repository. See 12016@ref{update}. 12017 12018@table @code 12019@item -A 12020Reset any sticky tags/date/options. See @ref{Sticky 12021tags} and @ref{Keyword substitution}. 12022 12023@item -C 12024Overwrite locally modified files with clean copies from 12025the repository (the modified file is saved in 12026@file{.#@var{file}.@var{revision}}, however). 12027 12028@item -D @var{date} 12029Check out revisions as of @var{date} (is sticky). See 12030@ref{Common options}. 12031 12032@item -d 12033Create directories. See @ref{update options}. 12034 12035@item -f 12036Use head revision if tag/date not found. See 12037@ref{Common options}. 12038 12039@item -I @var{ign} 12040More files to ignore (! to reset). See 12041@ref{import options}. 12042 12043@c Probably want to use rev1/rev2 style like for diff 12044@c -r. Here and in on-line help. 12045@item -j @var{rev} 12046Merge in changes. See @ref{update options}. 12047 12048@item -k @var{kflag} 12049Use @var{kflag} keyword expansion. See 12050@ref{Substitution modes}. 12051 12052@item -l 12053Local; run only in current working directory. @xref{Recursive behavior}. 12054 12055@item -P 12056Prune empty directories. See @ref{Moving directories}. 12057 12058@item -p 12059Check out files to standard output (avoids 12060stickiness). See @ref{update options}. 12061 12062@item -R 12063Operate recursively (default). @xref{Recursive 12064behavior}. 12065 12066@item -r @var{tag} 12067Checkout revision @var{tag} (is sticky). See @ref{Common options}. 12068 12069@item -W @var{spec} 12070More wrappers. See @ref{import options}. 12071@end table 12072 12073@c ------------------------------------------------------------ 12074@item version 12075@cindex version (subcommand) 12076 12077Display the version of @sc{cvs} being used. If the repository 12078is remote, display both the client and server versions. 12079 12080@c ------------------------------------------------------------ 12081@item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}] 12082 12083on/off: turn on/off read-only checkouts of files. See 12084@ref{Setting a watch}. 12085 12086add/remove: add or remove notification on actions. See 12087@ref{Getting Notified}. 12088 12089@table @code 12090@item -a @var{actions} 12091Specify actions for temporary watch, where 12092@var{actions} is @code{edit}, @code{unedit}, 12093@code{commit}, @code{all}, or @code{none}. See 12094@ref{Editing files}. 12095 12096@item -l 12097Local; run only in current working directory. See @ref{Recursive behavior}. 12098 12099@item -R 12100Operate recursively (default). @xref{Recursive 12101behavior}. 12102@end table 12103 12104@c ------------------------------------------------------------ 12105@item watchers [@var{options}] [@var{files}@dots{}] 12106See who is watching a file. See @ref{Watch information}. 12107 12108@table @code 12109@item -l 12110Local; run only in current working directory. See @ref{Recursive behavior}. 12111 12112@item -R 12113Operate recursively (default). @xref{Recursive 12114behavior}. 12115@end table 12116 12117@end table 12118 12119@c --------------------------------------------------------------------- 12120@node Administrative files 12121@appendix Reference manual for Administrative files 12122@cindex Administrative files (reference) 12123@cindex Files, reference manual 12124@cindex Reference manual (files) 12125@cindex CVSROOT (file) 12126 12127@c FIXME? Somewhere there needs to be a more "how-to" 12128@c guide to writing these. I think the triggers 12129@c (commitinfo, loginfo, taginfo, &c) are perhaps a 12130@c different case than files like modules. One 12131@c particular issue that people sometimes are 12132@c (unnecessarily?) worried about is performance, and 12133@c the impact of writing in perl or sh or ____. 12134Inside the repository, in the directory 12135@file{$CVSROOT/CVSROOT}, there are a number of 12136supportive files for @sc{cvs}. You can use @sc{cvs} in a limited 12137fashion without any of them, but if they are set up 12138properly they can help make life easier. For a 12139discussion of how to edit them, see @ref{Intro 12140administrative files}. 12141 12142The most important of these files is the @file{modules} 12143file, which defines the modules inside the repository. 12144 12145@menu 12146* modules:: Defining modules 12147* Wrappers:: Specify binary-ness based on file name 12148* Trigger Scripts:: Some notes on the commit support files and 12149 taginfo, referenced below. 12150* commit files:: The commit support files (commitinfo, 12151 verifymsg, editinfo, loginfo) 12152* taginfo:: Verifying/Logging tags 12153* rcsinfo:: Templates for the log messages 12154* cvsignore:: Ignoring files via cvsignore 12155* checkoutlist:: Adding your own administrative files 12156* history file:: History information 12157* Variables:: Various variables are expanded 12158* config:: Miscellaneous CVS configuration 12159@end menu 12160 12161@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12162@node modules 12163@appendixsec The modules file 12164@cindex Modules (admin file) 12165@cindex Defining modules (reference manual) 12166 12167The @file{modules} file records your definitions of 12168names for collections of source code. @sc{cvs} will 12169use these definitions if you use @sc{cvs} to update the 12170modules file (use normal commands like @code{add}, 12171@code{commit}, etc). 12172 12173The @file{modules} file may contain blank lines and 12174comments (lines beginning with @samp{#}) as well as 12175module definitions. Long lines can be continued on the 12176next line by specifying a backslash (@samp{\}) as the 12177last character on the line. 12178 12179There are three basic types of modules: alias modules, 12180regular modules, and ampersand modules. The difference 12181between them is the way that they map files in the 12182repository to files in the working directory. In all 12183of the following examples, the top-level repository 12184contains a directory called @file{first-dir}, which 12185contains two files, @file{file1} and @file{file2}, and a 12186directory @file{sdir}. @file{first-dir/sdir} contains 12187a file @file{sfile}. 12188 12189@c FIXME: should test all the examples in this section. 12190 12191@menu 12192* Alias modules:: The simplest kind of module 12193* Regular modules:: 12194* Ampersand modules:: 12195* Excluding directories:: Excluding directories from a module 12196* Module options:: Regular and ampersand modules can take options 12197* Module program options:: How the modules ``program options'' programs 12198 are run. 12199@end menu 12200 12201@node Alias modules 12202@appendixsubsec Alias modules 12203@cindex Alias modules 12204@cindex -a, in modules file 12205 12206Alias modules are the simplest kind of module: 12207 12208@table @code 12209@item @var{mname} -a @var{aliases}@dots{} 12210This represents the simplest way of defining a module 12211@var{mname}. The @samp{-a} flags the definition as a 12212simple alias: @sc{cvs} will treat any use of @var{mname} (as 12213a command argument) as if the list of names 12214@var{aliases} had been specified instead. 12215@var{aliases} may contain either other module names or 12216paths. When you use paths in aliases, @code{checkout} 12217creates all intermediate directories in the working 12218directory, just as if the path had been specified 12219explicitly in the @sc{cvs} arguments. 12220@end table 12221 12222For example, if the modules file contains: 12223 12224@example 12225amodule -a first-dir 12226@end example 12227 12228@noindent 12229then the following two commands are equivalent: 12230 12231@example 12232$ cvs co amodule 12233$ cvs co first-dir 12234@end example 12235 12236@noindent 12237and they each would provide output such as: 12238 12239@example 12240cvs checkout: Updating first-dir 12241U first-dir/file1 12242U first-dir/file2 12243cvs checkout: Updating first-dir/sdir 12244U first-dir/sdir/sfile 12245@end example 12246 12247@node Regular modules 12248@appendixsubsec Regular modules 12249@cindex Regular modules 12250 12251@table @code 12252@item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ] 12253In the simplest case, this form of module definition 12254reduces to @samp{@var{mname} @var{dir}}. This defines 12255all the files in directory @var{dir} as module mname. 12256@var{dir} is a relative path (from @code{$CVSROOT}) to a 12257directory of source in the source repository. In this 12258case, on checkout, a single directory called 12259@var{mname} is created as a working directory; no 12260intermediate directory levels are used by default, even 12261if @var{dir} was a path involving several directory 12262levels. 12263@end table 12264 12265For example, if a module is defined by: 12266 12267@example 12268regmodule first-dir 12269@end example 12270 12271@noindent 12272then regmodule will contain the files from first-dir: 12273 12274@example 12275$ cvs co regmodule 12276cvs checkout: Updating regmodule 12277U regmodule/file1 12278U regmodule/file2 12279cvs checkout: Updating regmodule/sdir 12280U regmodule/sdir/sfile 12281$ 12282@end example 12283 12284By explicitly specifying files in the module definition 12285after @var{dir}, you can select particular files from 12286directory @var{dir}. Here is 12287an example: 12288 12289@example 12290regfiles first-dir/sdir sfile 12291@end example 12292 12293@noindent 12294With this definition, getting the regfiles module 12295will create a single working directory 12296@file{regfiles} containing the file listed, which 12297comes from a directory deeper 12298in the @sc{cvs} source repository: 12299 12300@example 12301$ cvs co regfiles 12302U regfiles/sfile 12303$ 12304@end example 12305 12306@node Ampersand modules 12307@appendixsubsec Ampersand modules 12308@cindex Ampersand modules 12309@cindex &, in modules file 12310 12311A module definition can refer to other modules by 12312including @samp{&@var{module}} in its definition. 12313@example 12314@var{mname} [ options ] @var{&module}@dots{} 12315@end example 12316 12317Then getting the module creates a subdirectory for each such 12318module, in the directory containing the module. For 12319example, if modules contains 12320 12321@example 12322ampermod &first-dir 12323@end example 12324 12325@noindent 12326then a checkout will create an @code{ampermod} directory 12327which contains a directory called @code{first-dir}, 12328which in turns contains all the directories and files 12329which live there. For example, the command 12330 12331@example 12332$ cvs co ampermod 12333@end example 12334 12335@noindent 12336will create the following files: 12337 12338@example 12339ampermod/first-dir/file1 12340ampermod/first-dir/file2 12341ampermod/first-dir/sdir/sfile 12342@end example 12343 12344There is one quirk/bug: the messages that @sc{cvs} 12345prints omit the @file{ampermod}, and thus do not 12346correctly display the location to which it is checking 12347out the files: 12348 12349@example 12350$ cvs co ampermod 12351cvs checkout: Updating first-dir 12352U first-dir/file1 12353U first-dir/file2 12354cvs checkout: Updating first-dir/sdir 12355U first-dir/sdir/sfile 12356$ 12357@end example 12358 12359Do not rely on this buggy behavior; it may get fixed in 12360a future release of @sc{cvs}. 12361 12362@c FIXCVS: What happens if regular and & modules are 12363@c combined, as in "ampermodule first-dir &second-dir"? 12364@c When I tried it, it seemed to just ignore the 12365@c "first-dir". I think perhaps it should be an error 12366@c (but this needs further investigation). 12367@c In addition to discussing what each one does, we 12368@c should put in a few words about why you would use one or 12369@c the other in various situations. 12370 12371@node Excluding directories 12372@appendixsubsec Excluding directories 12373@cindex Excluding directories, in modules file 12374@cindex !, in modules file 12375 12376An alias module may exclude particular directories from 12377other modules by using an exclamation mark (@samp{!}) 12378before the name of each directory to be excluded. 12379 12380For example, if the modules file contains: 12381 12382@example 12383exmodule -a !first-dir/sdir first-dir 12384@end example 12385 12386@noindent 12387then checking out the module @samp{exmodule} will check 12388out everything in @samp{first-dir} except any files in 12389the subdirectory @samp{first-dir/sdir}. 12390@c Note that the "!first-dir/sdir" sometimes must be listed 12391@c before "first-dir". That seems like a probable bug, in which 12392@c case perhaps it should be fixed (to allow either 12393@c order) rather than documented. See modules4 in testsuite. 12394 12395@node Module options 12396@appendixsubsec Module options 12397@cindex Options, in modules file 12398 12399Either regular modules or ampersand modules can contain 12400options, which supply additional information concerning 12401the module. 12402 12403@table @code 12404@cindex -d, in modules file 12405@item -d @var{name} 12406Name the working directory something other than the 12407module name. 12408@c FIXME: Needs a bunch of examples, analogous to the 12409@c examples for alias, regular, and ampersand modules 12410@c which show where the files go without -d. 12411 12412@cindex Export program 12413@cindex -e, in modules file 12414@item -e @var{prog} 12415Specify a program @var{prog} to run whenever files in a 12416module are exported. @var{prog} runs with a single 12417argument, the module name. 12418@c FIXME: Is it run on server? client? 12419 12420@cindex Checkout program 12421@cindex -o, in modules file 12422@item -o @var{prog} 12423Specify a program @var{prog} to run whenever files in a 12424module are checked out. @var{prog} runs with a single 12425argument, the module name. See @ref{Module program options} for 12426information on how @var{prog} is called. 12427@c FIXME: Is it run on server? client? 12428 12429@cindex Status of a module 12430@cindex Module status 12431@cindex -s, in modules file 12432@item -s @var{status} 12433Assign a status to the module. When the module file is 12434printed with @samp{cvs checkout -s} the modules are 12435sorted according to primarily module status, and 12436secondarily according to the module name. This option 12437has no other meaning. You can use this option for 12438several things besides status: for instance, list the 12439person that is responsible for this module. 12440 12441@cindex Tag program 12442@cindex -t, in modules file 12443@item -t @var{prog} 12444Specify a program @var{prog} to run whenever files in a 12445module are tagged with @code{rtag}. @var{prog} runs 12446with two arguments: the module name and the symbolic 12447tag specified to @code{rtag}. It is not run 12448when @code{tag} is executed. Generally you will find 12449that the @file{taginfo} file is a better solution (@pxref{taginfo}). 12450@c FIXME: Is it run on server? client? 12451@c Problems with -t include: 12452@c * It is run after the tag not before 12453@c * It doesn't get passed all the information that 12454@c taginfo does ("mov", &c). 12455@c * It only is run for rtag, not tag. 12456@end table 12457 12458You should also see @pxref{Module program options} about how the 12459``program options'' programs are run. 12460 12461@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12462 12463@node Module program options 12464@appendixsubsec How the modules file ``program options'' programs are run 12465@cindex Modules file program options 12466@cindex -t, in modules file 12467@cindex -o, in modules file 12468@cindex -e, in modules file 12469 12470@noindent 12471For checkout, rtag, and export, the program is server-based, and as such the 12472following applies:- 12473 12474If using remote access methods (pserver, ext, etc.), 12475@sc{cvs} will execute this program on the server from a temporary 12476directory. The path is searched for this program. 12477 12478If using ``local access'' (on a local or remote NFS file system, i.e., 12479repository set just to a path), 12480the program will be executed from the newly checked-out tree, if 12481found there, or alternatively searched for in the path if not. 12482 12483The programs are all run after the operation has effectively 12484completed. 12485 12486 12487@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12488@node Wrappers 12489@appendixsec The cvswrappers file 12490@cindex cvswrappers (admin file) 12491@cindex CVSWRAPPERS, environment variable 12492@cindex Wrappers 12493 12494@c FIXME: need some better way of separating this out 12495@c by functionality. -m is 12496@c one feature, and -k is a another. And this discussion 12497@c should be better motivated (e.g. start with the 12498@c problems, then explain how the feature solves it). 12499 12500Wrappers refers to a @sc{cvs} feature which lets you 12501control certain settings based on the name of the file 12502which is being operated on. The settings are @samp{-k} 12503for binary files, and @samp{-m} for nonmergeable text 12504files. 12505 12506The @samp{-m} option 12507specifies the merge methodology that should be used when 12508a non-binary file is updated. @code{MERGE} means the usual 12509@sc{cvs} behavior: try to merge the files. @code{COPY} 12510means that @code{cvs update} will refuse to merge 12511files, as it also does for files specified as binary 12512with @samp{-kb} (but if the file is specified as 12513binary, there is no need to specify @samp{-m 'COPY'}). 12514@sc{cvs} will provide the user with the 12515two versions of the files, and require the user using 12516mechanisms outside @sc{cvs}, to insert any necessary 12517changes. 12518 12519@strong{WARNING: Do not use @code{COPY} with 12520@sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will 12521copy one version of your file over the other, wiping 12522out the previous contents.} 12523@c Ordinarily we don't document the behavior of old 12524@c versions. But this one is so dangerous, I think we 12525@c must. I almost renamed it to -m 'NOMERGE' so we 12526@c could say "never use -m 'COPY'". 12527The @samp{-m} wrapper option only affects behavior when 12528merging is done on update; it does not affect how files 12529are stored. See @ref{Binary files}, for more on 12530binary files. 12531 12532The basic format of the file @file{cvswrappers} is: 12533 12534@c FIXME: @example is all wrong for this. Use @deffn or 12535@c something more sensible. 12536@example 12537wildcard [option value][option value]... 12538 12539where option is one of 12540-m update methodology value: MERGE or COPY 12541-k keyword expansion value: expansion mode 12542 12543and value is a single-quote delimited value. 12544@end example 12545 12546@ignore 12547@example 12548*.nib -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY' 12549*.c -t 'indent %s %s' 12550@end example 12551@c When does the filter need to be an absolute pathname 12552@c and when will something like the above work? I 12553@c suspect it relates to the PATH of the server (which 12554@c in turn depends on all kinds of stuff, e.g. inetd 12555@c for pserver). I'm not sure whether/where to discuss 12556@c this. 12557@c FIXME: What do the %s's stand for? 12558 12559@noindent 12560The above example of a @file{cvswrappers} file 12561states that all files/directories that end with a @code{.nib} 12562should be filtered with the @file{wrap} program before 12563checking the file into the repository. The file should 12564be filtered though the @file{unwrap} program when the 12565file is checked out of the repository. The 12566@file{cvswrappers} file also states that a @code{COPY} 12567methodology should be used when updating the files in 12568the repository (that is, no merging should be performed). 12569 12570@c What pitfalls arise when using indent this way? Is 12571@c it a winning thing to do? Would be nice to at least 12572@c hint at those issues; we want our examples to tell 12573@c how to solve problems, not just to say that cvs can 12574@c do certain things. 12575The last example line says that all files that end with 12576@code{.c} should be filtered with @file{indent} 12577before being checked into the repository. Unlike the previous 12578example, no filtering of the @code{.c} file is done when 12579it is checked out of the repository. 12580@noindent 12581The @code{-t} filter is called with two arguments, 12582the first is the name of the file/directory to filter 12583and the second is the pathname to where the resulting 12584filtered file should be placed. 12585 12586@noindent 12587The @code{-f} filter is called with one argument, 12588which is the name of the file to filter from. The end 12589result of this filter will be a file in the users directory 12590that they can work on as they normally would. 12591 12592Note that the @samp{-t}/@samp{-f} features do not 12593conveniently handle one portion of @sc{cvs}'s operation: 12594determining when files are modified. @sc{cvs} will still 12595want a file (or directory) to exist, and it will use 12596its modification time to determine whether a file is 12597modified. If @sc{cvs} erroneously thinks a file is 12598unmodified (for example, a directory is unchanged but 12599one of the files within it is changed), you can force 12600it to check in the file anyway by specifying the 12601@samp{-f} option to @code{cvs commit} (@pxref{commit 12602options}). 12603@c This is, of course, a serious design flaw in -t/-f. 12604@c Probably the whole functionality needs to be 12605@c redesigned (starting from requirements) to fix this. 12606@end ignore 12607 12608@c FIXME: We don't document -W or point to where it is 12609@c documented. Or .cvswrappers. 12610For example, the following command imports a 12611directory, treating files whose name ends in 12612@samp{.exe} as binary: 12613 12614@example 12615cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag 12616@end example 12617 12618@c Another good example, would be storing files 12619@c (e.g. binary files) compressed in the repository. 12620@c :::::::::::::::::: 12621@c cvswrappers 12622@c :::::::::::::::::: 12623@c *.t12 -m 'COPY' 12624@c *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY' 12625@c 12626@c :::::::::::::::::: 12627@c gunzipcp 12628@c :::::::::::::::::: 12629@c : 12630@c [ -f $1 ] || exit 1 12631@c zcat $1 > /tmp/.#$1.$$ 12632@c mv /tmp/.#$1.$$ $1 12633@c 12634@c :::::::::::::::::: 12635@c gzipcp 12636@c :::::::::::::::::: 12637@c : 12638@c DIRNAME=`echo $1 | sed -e "s|/.*/||g"` 12639@c if [ ! -d $DIRNAME ] ; then 12640@c DIRNAME=`echo $1 | sed -e "s|.*/||g"` 12641@c fi 12642@c gzip -c $DIRNAME > $2 12643@c One catch--"cvs diff" will not invoke the wrappers 12644@c (probably a CVS bug, although I haven't thought it out). 12645 12646@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12647@node Trigger Scripts 12648@appendixsec The Trigger Scripts 12649@cindex Info files 12650@cindex Trigger scripts 12651 12652Several of the administrative files support triggers, or the launching external 12653scripts or programs at specific times before or after particular events. The 12654individual files are discussed in the later sections, @ref{commit files} and 12655@ref{taginfo}, but some of the common elements are discussed here. 12656 12657All the trigger scripts are launched in a copy of the user sandbox being 12658committed, on the server, in client-server mode. In local mode, the scripts 12659are actually launched directly from the user sandbox directory being committed. 12660For most intents and purposes, the same scripts can be run in both locations 12661without alteration. 12662 12663@menu 12664* syntax:: The common syntax 12665* Trigger Script Security:: Trigger script security 12666@end menu 12667 12668@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12669@node syntax 12670@appendixsubsec The common syntax 12671@cindex Info files (syntax) 12672@cindex Syntax of info files 12673@cindex Common syntax of info files 12674 12675@c FIXME: having this so totally separate from the 12676@c Variables node is rather bogus. 12677 12678The administrative files such as @file{commitinfo}, 12679@file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc., 12680all have a common format. The purpose of the files are 12681described later on. The common syntax is described 12682here. 12683 12684@cindex Regular expression syntax 12685Each line contains the following: 12686@itemize @bullet 12687@item 12688@c Say anything about DEFAULT and ALL? Right now we 12689@c leave that to the description of each file (and in fact 12690@c the practice is inconsistent which is really annoying). 12691A regular expression. This is a basic regular 12692expression in the syntax used by GNU emacs. 12693@c FIXME: What we probably should be saying is "POSIX Basic 12694@c Regular Expression with the following extensions (`\(' 12695@c `\|' '+' etc)" 12696@c rather than define it with reference to emacs. 12697@c The reference to emacs is not strictly speaking 12698@c true, as we don't support \=, \s, or \S. Also it isn't 12699@c clear we should document and/or promise to continue to 12700@c support all the obscure emacs extensions like \<. 12701@c Also need to better cite (or include) full 12702@c documentation for the syntax. 12703@c Also see comment in configure.in about what happens to the 12704@c syntax if we pick up a system-supplied regexp matcher. 12705 12706@item 12707A whitespace separator---one or more spaces and/or tabs. 12708 12709@item 12710A file name or command-line template. 12711@end itemize 12712 12713@noindent 12714Blank lines are ignored. Lines that start with the 12715character @samp{#} are treated as comments. Long lines 12716unfortunately can @emph{not} be broken in two parts in 12717any way. 12718 12719The first regular expression that matches the current 12720directory name in the repository is used. The rest of the line 12721is used as a file name or command-line as appropriate. 12722 12723@c FIXME: need an example. In particular, show what 12724@c the regular expression is matched against (one 12725@c ordinarily clueful person got confused about whether it 12726@c includes the filename--"directory name" above should be 12727@c unambiguous but there is nothing like an example to 12728@c confirm people's understanding of this sort of thing). 12729 12730@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12731@node Trigger Script Security 12732@appendixsubsec Security and the Trigger Scripts 12733@cindex Info files, security 12734@cindex Trigger scripts, security 12735 12736Security is a huge subject, and implementing a secure system is a non-trivial 12737task. This section will barely touch on all the issues involved, but it is 12738well to note that, as with any script you will be allowing an untrusted 12739user to run on your server, there are measures you can take to help prevent 12740your trigger scripts from being abused. 12741 12742For instance, since the CVS trigger scripts all run in a copy of the user's 12743sandbox on the server, a naively coded Perl trigger script which attempts to 12744use a Perl module that is not installed on the system can be hijacked by any 12745user with commit access who is checking in a file with the correct name. Other 12746scripting languages may be vulnerable to similar hacks. 12747 12748One way to make a script more secure, at least with Perl, is to use scripts 12749which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line. 12750In the most basic terms, this causes Perl to avoid running code that may have 12751come from an external source. Please run the @code{perldoc perlsec} command 12752for more on Perl security. Again, other languages may implement other security 12753verification hooks which look more or less like Perl's "taint-check" mechanism. 12754 12755@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12756@node commit files 12757@appendixsec The commit support files 12758@cindex Committing, administrative support files 12759 12760There are three kinds of trigger scripts (@pxref{Trigger Scripts}) that can be 12761run at various times during a commit. They are specified in files in the 12762repository, as described below. The following table summarizes the 12763file names and the purpose of the corresponding programs. 12764 12765@table @file 12766@item commitinfo 12767The program is responsible for checking that the commit 12768is allowed. If it exits with a non-zero exit status 12769the commit will be aborted. 12770 12771@item verifymsg 12772The specified program is used to evaluate the log message, 12773and possibly verify that it contains all required 12774fields. This is most useful in combination with the 12775@file{rcsinfo} file, which can hold a log message 12776template (@pxref{rcsinfo}). 12777 12778@item editinfo 12779The specified program is used to edit the log message, 12780and possibly verify that it contains all required 12781fields. This is most useful in combination with the 12782@file{rcsinfo} file, which can hold a log message 12783template (@pxref{rcsinfo}). (obsolete) 12784 12785@item loginfo 12786The specified program is called when the commit is 12787complete. It receives the log message and some 12788additional information and can store the log message in 12789a file, or mail it to appropriate persons, or maybe 12790post it to a local newsgroup, or@dots{} Your 12791imagination is the limit! 12792@end table 12793 12794@menu 12795* commitinfo:: Pre-commit checking 12796* verifymsg:: How are log messages evaluated? 12797* editinfo:: Specifying how log messages are created 12798 (obsolete) 12799* loginfo:: Where should log messages be sent? 12800@end menu 12801 12802@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12803@node commitinfo 12804@appendixsubsec Commitinfo 12805@cindex @file{commitinfo} 12806@cindex Commits, precommit verification of 12807@cindex Precommit checking 12808 12809The @file{commitinfo} file defines programs to execute 12810whenever @samp{cvs commit} is about to execute. These 12811programs are used for pre-commit checking to verify 12812that the modified, added and removed files are really 12813ready to be committed. This could be used, for 12814instance, to verify that the changed files conform to 12815to your site's standards for coding practice. 12816 12817As mentioned earlier, each line in the 12818@file{commitinfo} file consists of a regular expression 12819and a command-line template. The template can include 12820a program name and any number of arguments you wish to 12821supply to it. The full path to the current source 12822repository is appended to the template, followed by the 12823file names of any files involved in the commit (added, 12824removed, and modified files). 12825 12826@cindex Exit status, of commitinfo 12827The first line with a regular expression matching the 12828directory within the repository will be used. If the 12829command returns a non-zero exit status the commit will 12830be aborted. 12831@c FIXME: need example(s) of what "directory within the 12832@c repository" means. 12833 12834@cindex DEFAULT in commitinfo 12835If the repository name does not match any of the 12836regular expressions in this file, the @samp{DEFAULT} 12837line is used, if it is specified. 12838 12839@cindex ALL in commitinfo 12840All occurrences of the name @samp{ALL} appearing as a 12841regular expression are used in addition to the first 12842matching regular expression or the name @samp{DEFAULT}. 12843 12844@cindex @file{commitinfo}, working directory 12845@cindex @file{commitinfo}, command environment 12846The command will be run in the root of the workspace 12847containing the new versions of any files the user would like 12848to modify (commit), @emph{or in a copy of the workspace on 12849the server (@pxref{Remote repositories})}. If a file is 12850being removed, there will be no copy of the file under the 12851current directory. If a file is being added, there will be 12852no corresponding archive file in the repository unless the 12853file is being resurrected. 12854 12855Note that both the repository directory and the corresponding 12856Attic (@pxref{Attic}) directory may need to be checked to 12857locate the archive file corresponding to any given file being 12858committed. Much of the information about the specific commit 12859request being made, including the destination branch, commit 12860message, and command line options specified, is not available 12861to the command. 12862 12863@c FIXME: should discuss using commitinfo to control 12864@c who has checkin access to what (e.g. Joe can check into 12865@c directories a, b, and c, and Mary can check into 12866@c directories b, c, and d--note this case cannot be 12867@c conveniently handled with unix groups). Of course, 12868@c adding a new set of features to CVS might be a more 12869@c natural way to fix this problem than telling people to 12870@c use commitinfo. 12871@c FIXME: Should make some reference, especially in 12872@c the context of controlling who has access, to the fact 12873@c that commitinfo can be circumvented. Perhaps 12874@c mention SETXID (but has it been carefully examined 12875@c for holes?). This fits in with the discussion of 12876@c general CVS security in "Password authentication 12877@c security" (the bit which is not pserver-specific). 12878 12879@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12880@node verifymsg 12881@appendixsubsec Verifying log messages 12882@cindex @file{verifymsg} (admin file) 12883@cindex Log message, verifying 12884 12885Once you have entered a log message, you can evaluate 12886that message to check for specific content, such as 12887a bug ID. Use the @file{verifymsg} file to 12888specify a program that is used to verify the log message. 12889This program could be a simple script that checks 12890that the entered message contains the required fields. 12891 12892The @file{verifymsg} file is often most useful together 12893with the @file{rcsinfo} file, which can be used to 12894specify a log message template. 12895 12896Each line in the @file{verifymsg} file consists of a 12897regular expression and a command-line template. The 12898template must include a program name, and can include 12899any number of arguments. The full path to the current 12900log message template file is appended to the template. 12901 12902One thing that should be noted is that the @samp{ALL} 12903keyword is not supported. If more than one matching 12904line is found, the first one is used. This can be 12905useful for specifying a default verification script in a 12906directory, and then overriding it in a subdirectory. 12907 12908@cindex DEFAULT in @file{verifymsg} 12909If the repository name does not match any of the 12910regular expressions in this file, the @samp{DEFAULT} 12911line is used, if it is specified. 12912 12913@cindex Exit status, of @file{verifymsg} 12914If the verification script exits with a non-zero exit status, 12915the commit is aborted. 12916 12917@cindex @file{verifymsg}, changing the log message 12918In the default configuration, CVS allows the 12919verification script to change the log message. This is 12920controlled via the RereadLogAfterVerify CVSROOT/config 12921option. 12922 12923When @samp{RereadLogAfterVerify=always} or 12924@samp{RereadLogAfterVerify=stat}, the log message will 12925either always be reread after the verification script 12926is run or reread only if the log message file status 12927has changed. 12928 12929@xref{config}, for more on CVSROOT/config options. 12930 12931It is NOT a good idea for a @file{verifymsg} script to 12932interact directly with the user in the various 12933client/server methods. For the @code{pserver} method, 12934there is no protocol support for communicating between 12935@file{verifymsg} and the client on the remote end. For the 12936@code{ext} and @code{server} methods, it is possible 12937for CVS to become confused by the characters going 12938along the same channel as the CVS protocol 12939messages. See @ref{Remote repositories}, for more 12940information on client/server setups. In addition, at the time 12941the @file{verifymsg} script runs, the CVS 12942server has locks in place in the repository. If control is 12943returned to the user here then other users may be stuck waiting 12944for access to the repository. 12945 12946This option can be useful if you find yourself using an 12947rcstemplate that needs to be modified to remove empty 12948elements or to fill in default values. It can also be 12949useful if the rcstemplate has changed in the repository 12950and the CVS/Template was not updated, but is able to be 12951adapted to the new format by the verification script 12952that is run by @file{verifymsg}. 12953 12954An example of an update might be to change all 12955occurrences of 'BugId:' to be 'DefectId:' (which can be 12956useful if the rcstemplate has recently been changed and 12957there are still checked-out user trees with cached 12958copies in the CVS/Template file of the older version). 12959 12960Another example of an update might be to delete a line 12961that contains 'BugID: none' from the log message after 12962validation of that value as being allowed is made. 12963 12964The following is a little silly example of a 12965@file{verifymsg} file, together with the corresponding 12966@file{rcsinfo} file, the log message template and an 12967verification script. We begin with the log message template. 12968We want to always record a bug-id number on the first 12969line of the log message. The rest of log message is 12970free text. The following template is found in the file 12971@file{/usr/cvssupport/tc.template}. 12972 12973@example 12974BugId: 12975@end example 12976 12977The script @file{/usr/cvssupport/bugid.verify} is used to 12978evaluate the log message. 12979 12980@example 12981#!/bin/sh 12982# 12983# bugid.verify filename 12984# 12985# Verify that the log message contains a valid bugid 12986# on the first line. 12987# 12988if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then 12989 exit 0 12990elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then 12991 # It is okay to allow commits with 'BugId: none', 12992 # but do not put that text into the real log message. 12993 grep -v '^BugId:[ ]*none$' > $1.rewrite 12994 mv $1.rewrite $1 12995 exit 0 12996else 12997 echo "No BugId found." 12998 exit 1 12999fi 13000@end example 13001 13002The @file{verifymsg} file contains this line: 13003 13004@example 13005^tc /usr/cvssupport/bugid.verify 13006@end example 13007 13008The @file{rcsinfo} file contains this line: 13009 13010@example 13011^tc /usr/cvssupport/tc.template 13012@end example 13013 13014The @file{config} file contains this line: 13015 13016@example 13017RereadLogAfterVerify=always 13018@end example 13019 13020 13021 13022@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13023@node editinfo 13024@appendixsubsec Editinfo 13025@cindex editinfo (admin file) 13026@cindex Editor, specifying per module 13027@cindex Per-module editor 13028@cindex Log messages, editing 13029 13030@strong{The @file{editinfo} feature has been 13031rendered obsolete. To set a default editor for log 13032messages use the @code{CVSEDITOR}, @code{EDITOR} environment variables 13033(@pxref{Environment variables}) or the @samp{-e} global 13034option (@pxref{Global options}). See @ref{verifymsg}, 13035for information on the use of the @file{verifymsg} 13036feature for evaluating log messages.} 13037 13038If you want to make sure that all log messages look the 13039same way, you can use the @file{editinfo} file to 13040specify a program that is used to edit the log message. 13041This program could be a custom-made editor that always 13042enforces a certain style of the log message, or maybe a 13043simple shell script that calls an editor, and checks 13044that the entered message contains the required fields. 13045 13046If no matching line is found in the @file{editinfo} 13047file, the editor specified in the environment variable 13048@code{$CVSEDITOR} is used instead. If that variable is 13049not set, then the environment variable @code{$EDITOR} 13050is used instead. If that variable is not 13051set a default will be used. See @ref{Committing your changes}. 13052 13053The @file{editinfo} file is often most useful together 13054with the @file{rcsinfo} file, which can be used to 13055specify a log message template. 13056 13057Each line in the @file{editinfo} file consists of a 13058regular expression and a command-line template. The 13059template must include a program name, and can include 13060any number of arguments. The full path to the current 13061log message template file is appended to the template. 13062 13063One thing that should be noted is that the @samp{ALL} 13064keyword is not supported. If more than one matching 13065line is found, the first one is used. This can be 13066useful for specifying a default edit script in a 13067module, and then overriding it in a subdirectory. 13068 13069@cindex DEFAULT in editinfo 13070If the repository name does not match any of the 13071regular expressions in this file, the @samp{DEFAULT} 13072line is used, if it is specified. 13073 13074If the edit script exits with a non-zero exit status, 13075the commit is aborted. 13076 13077Note: when @sc{cvs} is accessing a remote repository, 13078or when the @samp{-m} or @samp{-F} options to @code{cvs 13079commit} are used, @file{editinfo} will not be consulted. 13080There is no good workaround for this; use 13081@file{verifymsg} instead. 13082 13083@menu 13084* editinfo example:: Editinfo example 13085@end menu 13086 13087@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13088@node editinfo example 13089@appendixsubsubsec Editinfo example 13090 13091The following is a little silly example of a 13092@file{editinfo} file, together with the corresponding 13093@file{rcsinfo} file, the log message template and an 13094editor script. We begin with the log message template. 13095We want to always record a bug-id number on the first 13096line of the log message. The rest of log message is 13097free text. The following template is found in the file 13098@file{/usr/cvssupport/tc.template}. 13099 13100@example 13101BugId: 13102@end example 13103 13104The script @file{/usr/cvssupport/bugid.edit} is used to 13105edit the log message. 13106 13107@example 13108#!/bin/sh 13109# 13110# bugid.edit filename 13111# 13112# Call $EDITOR on FILENAME, and verify that the 13113# resulting file contains a valid bugid on the first 13114# line. 13115if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi 13116if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi 13117$CVSEDITOR $1 13118until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1 13119do echo -n "No BugId found. Edit again? ([y]/n)" 13120 read ans 13121 case $@{ans@} in 13122 n*) exit 1;; 13123 esac 13124 $CVSEDITOR $1 13125done 13126@end example 13127 13128The @file{editinfo} file contains this line: 13129 13130@example 13131^tc /usr/cvssupport/bugid.edit 13132@end example 13133 13134The @file{rcsinfo} file contains this line: 13135 13136@example 13137^tc /usr/cvssupport/tc.template 13138@end example 13139 13140@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13141@node loginfo 13142@appendixsubsec Loginfo 13143@cindex loginfo (admin file) 13144@cindex Storing log messages 13145@cindex Mailing log messages 13146@cindex Distributing log messages 13147@cindex Log messages 13148 13149@c "cvs commit" is not quite right. What we 13150@c mean is "when the repository gets changed" which 13151@c also includes "cvs import" and "cvs add" on a directory. 13152The @file{loginfo} file is used to control where 13153@samp{cvs commit} log information is sent. The first 13154entry on a line is a regular expression which is tested 13155against the directory that the change is being made to, 13156relative to the @code{$CVSROOT}. If a match is found, then 13157the remainder of the line is a filter program that 13158should expect log information on its standard input. 13159Note that the filter program @strong{must} read @strong{all} 13160of the log information or @sc{cvs} may fail with a broken pipe signal. 13161 13162If the repository name does not match any of the 13163regular expressions in this file, the @samp{DEFAULT} 13164line is used, if it is specified. 13165 13166All occurrences of the name @samp{ALL} appearing as a 13167regular expression are used in addition to the first 13168matching regular expression or @samp{DEFAULT}. 13169 13170The first matching regular expression is used. 13171 13172@xref{commit files}, for a description of the syntax of 13173the @file{loginfo} file. 13174 13175The user may specify a format string as 13176part of the filter. The string is composed of a 13177@samp{%} followed by a space, or followed by a single 13178format character, or followed by a set of format 13179characters surrounded by @samp{@{} and @samp{@}} as 13180separators. The format characters are: 13181 13182@table @t 13183@item s 13184file name 13185@item V 13186old version number (pre-checkin) 13187@item v 13188new version number (post-checkin) 13189@end table 13190 13191All other characters that appear in a format string 13192expand to an empty field (commas separating fields are 13193still provided). 13194 13195For example, some valid format strings are @samp{%}, 13196@samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}. 13197 13198The output will be a space separated string of tokens enclosed in 13199quotation marks (@t{"}). 13200Any embedded dollar signs (@t{$}), backticks (@t{`}), 13201backslashes (@t{\}), or quotation marks will be preceded 13202by a backslash (this allows the shell to correctly parse it 13203as a single string, reguardless of the characters it contains). 13204For backwards compatibility, the first 13205token will be the repository subdirectory. The rest of the 13206tokens will be comma-delimited lists of the information 13207requested in the format string. For example, if 13208@samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}} 13209is the format string, and three files (@t{ChangeLog}, 13210@t{Makefile}, @t{foo.c}) were modified, the output 13211might be: 13212 13213@example 13214"yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13" 13215@end example 13216 13217As another example, @samp{%@{@}} means that only the 13218name of the repository will be generated. 13219 13220Note: when @sc{cvs} is accessing a remote repository, 13221@file{loginfo} will be run on the @emph{remote} 13222(i.e., server) side, not the client side (@pxref{Remote 13223repositories}). 13224 13225@menu 13226* loginfo example:: Loginfo example 13227* Keeping a checked out copy:: Updating a tree on every checkin 13228@end menu 13229 13230@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13231@node loginfo example 13232@appendixsubsubsec Loginfo example 13233 13234The following @file{loginfo} file, together with the 13235tiny shell-script below, appends all log messages 13236to the file @file{$CVSROOT/CVSROOT/commitlog}, 13237and any commits to the administrative files (inside 13238the @file{CVSROOT} directory) are also logged in 13239@file{/usr/adm/cvsroot-log}. 13240Commits to the @file{prog1} directory are mailed to @t{ceder}. 13241 13242@c FIXME: is it a CVS feature or bug that only the 13243@c first matching line is used? It is documented 13244@c above, but is it useful? For example, if we wanted 13245@c to run both "cvs-log" and "Mail" for the CVSROOT 13246@c directory, it is kind of awkward if 13247@c only the first matching line is used. 13248@example 13249ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER 13250^CVSROOT /usr/local/bin/cvs-log /usr/adm/cvsroot-log 13251^prog1 Mail -s %s ceder 13252@end example 13253 13254The shell-script @file{/usr/local/bin/cvs-log} looks 13255like this: 13256 13257@example 13258#!/bin/sh 13259(echo "------------------------------------------------------"; 13260 echo -n $2" "; 13261 date; 13262 echo; 13263 cat) >> $1 13264@end example 13265 13266@node Keeping a checked out copy 13267@appendixsubsubsec Keeping a checked out copy 13268 13269@c What other index entries? It seems like 13270@c people might want to use a lot of different 13271@c words for this functionality. 13272@cindex Keeping a checked out copy 13273@cindex Checked out copy, keeping 13274@cindex Web pages, maintaining with CVS 13275 13276It is often useful to maintain a directory tree which 13277contains files which correspond to the latest version 13278in the repository. For example, other developers might 13279want to refer to the latest sources without having to 13280check them out, or you might be maintaining a web site 13281with @sc{cvs} and want every checkin to cause the files 13282used by the web server to be updated. 13283@c Can we offer more details on the web example? Or 13284@c point the user at how to figure it out? This text 13285@c strikes me as sufficient for someone who already has 13286@c some idea of what we mean but not enough for the naive 13287@c user/sysadmin to understand it and set it up. 13288 13289The way to do this is by having loginfo invoke 13290@code{cvs update}. Doing so in the naive way will 13291cause a problem with locks, so the @code{cvs update} 13292must be run in the background. 13293@c Should we try to describe the problem with locks? 13294@c It seems like a digression for someone who just 13295@c wants to know how to make it work. 13296@c Another choice which might work for a single file 13297@c is to use "cvs -n update -p" which doesn't take 13298@c out locks (I think) but I don't see many advantages 13299@c of that and we might as well document something which 13300@c works for multiple files. 13301Here is an example for unix (this should all be on one line): 13302 13303@example 13304^cyclic-pages (date; cat; (sleep 2; cd /u/www/local-docs; 13305 cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1 13306@end example 13307 13308This will cause checkins to repository directories 13309starting with @code{cyclic-pages} to update the checked 13310out tree in @file{/u/www/local-docs}. 13311@c More info on some of the details? The "sleep 2" is 13312@c so if we are lucky the lock will be gone by the time 13313@c we start and we can wait 2 seconds instead of 30. 13314 13315@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13316@node rcsinfo 13317@appendixsec Rcsinfo 13318@cindex rcsinfo (admin file) 13319@cindex Form for log message 13320@cindex Log message template 13321@cindex Template for log message 13322 13323The @file{rcsinfo} file can be used to specify a form to 13324edit when filling out the commit log. The 13325@file{rcsinfo} file has a syntax similar to the 13326@file{verifymsg}, @file{commitinfo} and @file{loginfo} 13327files. @xref{syntax}. Unlike the other files the second 13328part is @emph{not} a command-line template. Instead, 13329the part after the regular expression should be a full pathname to 13330a file containing the log message template. 13331 13332If the repository name does not match any of the 13333regular expressions in this file, the @samp{DEFAULT} 13334line is used, if it is specified. 13335 13336All occurrences of the name @samp{ALL} appearing as a 13337regular expression are used in addition to the first 13338matching regular expression or @samp{DEFAULT}. 13339 13340@c FIXME: should be offering advice, somewhere around 13341@c here, about where to put the template file. The 13342@c verifymsg example uses /usr/cvssupport but doesn't 13343@c say anything about what that directory is for or 13344@c whether it is hardwired into CVS or who creates 13345@c it or anything. In particular we should say 13346@c how to version control the template file. A 13347@c probably better answer than the /usr/cvssupport 13348@c stuff is to use checkoutlist (with xref to the 13349@c checkoutlist doc). 13350@c Also I am starting to see a connection between 13351@c this and the Keeping a checked out copy node. 13352@c Probably want to say something about that. 13353The log message template will be used as a default log 13354message. If you specify a log message with @samp{cvs 13355commit -m @var{message}} or @samp{cvs commit -f 13356@var{file}} that log message will override the 13357template. 13358 13359@xref{verifymsg}, for an example @file{rcsinfo} 13360file. 13361 13362When @sc{cvs} is accessing a remote repository, 13363the contents of @file{rcsinfo} at the time a directory 13364is first checked out will specify a template which does 13365not then change. If you edit @file{rcsinfo} or its 13366templates, you may need to check out a new working 13367directory. 13368@c Would be nice to fix CVS so this isn't needed. For 13369@c example, a mechanism analogous to CVS/Entries, where 13370@c the client keeps track of what version of the template 13371@c it has. 13372 13373@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13374@node taginfo 13375@appendixsec Taginfo 13376@cindex taginfo (admin file) 13377@cindex Tags, logging 13378@cindex Tags, verifying 13379The @file{taginfo} file defines programs to execute 13380when someone executes a @code{tag} or @code{rtag} 13381command. The @file{taginfo} file has the standard form 13382for trigger scripts (@pxref{Trigger Scripts}), 13383where each line is a regular expression 13384followed by a command to execute (@pxref{syntax}). The arguments passed 13385to the command are, in order, the @var{tagname}, 13386@var{operation} (@code{add} for @code{tag}, 13387@code{mov} for @code{tag -F}, and @code{del} for 13388@code{tag -d}), @var{repository}, and any remaining are 13389pairs of @var{filename} @var{revision}. A non-zero 13390exit of the filter program will cause the tag to be 13391aborted. 13392 13393Here is an example of using the @file{taginfo} file 13394to log @code{tag} and @code{rtag} 13395commands. In the @file{taginfo} file put: 13396 13397@example 13398ALL /usr/local/cvsroot/CVSROOT/loggit 13399@end example 13400 13401@noindent 13402Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the 13403following script: 13404 13405@example 13406#!/bin/sh 13407echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog 13408@end example 13409 13410@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13411@node cvsignore 13412@appendixsec Ignoring files via cvsignore 13413@cindex cvsignore (admin file), global 13414@cindex Global cvsignore 13415@cindex Ignoring files 13416@c -- This chapter should maybe be moved to the 13417@c tutorial part of the manual? 13418 13419There are certain file names that frequently occur 13420inside your working copy, but that you don't want to 13421put under @sc{cvs} control. Examples are all the object 13422files that you get while you compile your sources. 13423Normally, when you run @samp{cvs update}, it prints a 13424line for each file it encounters that it doesn't know 13425about (@pxref{update output}). 13426 13427@sc{cvs} has a list of files (or sh(1) file name patterns) 13428that it should ignore while running @code{update}, 13429@code{import} and @code{release}. 13430@c -- Are those the only three commands affected? 13431This list is constructed in the following way. 13432 13433@itemize @bullet 13434@item 13435The list is initialized to include certain file name 13436patterns: names associated with @sc{cvs} 13437administration, or with other common source control 13438systems; common names for patch files, object files, 13439archive files, and editor backup files; and other names 13440that are usually artifacts of assorted utilities. 13441Currently, the default list of ignored file name 13442patterns is: 13443 13444@cindex Ignored files 13445@cindex Automatically ignored files 13446@example 13447 RCS SCCS CVS CVS.adm 13448 RCSLOG cvslog.* 13449 tags TAGS 13450 .make.state .nse_depinfo 13451 *~ #* .#* ,* _$* *$ 13452 *.old *.bak *.BAK *.orig *.rej .del-* 13453 *.a *.olb *.o *.obj *.so *.exe 13454 *.Z *.elc *.ln 13455 core 13456@end example 13457 13458@item 13459The per-repository list in 13460@file{$CVSROOT/CVSROOT/cvsignore} is appended to 13461the list, if that file exists. 13462 13463@item 13464The per-user list in @file{.cvsignore} in your home 13465directory is appended to the list, if it exists. 13466 13467@item 13468Any entries in the environment variable 13469@code{$CVSIGNORE} is appended to the list. 13470 13471@item 13472Any @samp{-I} options given to @sc{cvs} is appended. 13473 13474@item 13475As @sc{cvs} traverses through your directories, the contents 13476of any @file{.cvsignore} will be appended to the list. 13477The patterns found in @file{.cvsignore} are only valid 13478for the directory that contains them, not for 13479any sub-directories. 13480@end itemize 13481 13482In any of the 5 places listed above, a single 13483exclamation mark (@samp{!}) clears the ignore list. 13484This can be used if you want to store any file which 13485normally is ignored by @sc{cvs}. 13486 13487Specifying @samp{-I !} to @code{cvs import} will import 13488everything, which is generally what you want to do if 13489you are importing files from a pristine distribution or 13490any other source which is known to not contain any 13491extraneous files. However, looking at the rules above 13492you will see there is a fly in the ointment; if the 13493distribution contains any @file{.cvsignore} files, then 13494the patterns from those files will be processed even if 13495@samp{-I !} is specified. The only workaround is to 13496remove the @file{.cvsignore} files in order to do the 13497import. Because this is awkward, in the future 13498@samp{-I !} might be modified to override 13499@file{.cvsignore} files in each directory. 13500 13501Note that the syntax of the ignore files consists of a 13502series of lines, each of which contains a space 13503separated list of filenames. This offers no clean way 13504to specify filenames which contain spaces, but you can 13505use a workaround like @file{foo?bar} to match a file 13506named @file{foo bar} (it also matches @file{fooxbar} 13507and the like). Also note that there is currently no 13508way to specify comments. 13509@c FIXCVS? I don't _like_ this syntax at all, but 13510@c changing it raises all the usual compatibility 13511@c issues and I'm also not sure what to change it to. 13512 13513@node checkoutlist 13514@appendixsec The checkoutlist file 13515@cindex checkoutlist 13516 13517It may be helpful to use @sc{cvs} to maintain your own 13518files in the @file{CVSROOT} directory. For example, 13519suppose that you have a script @file{logcommit.pl} 13520which you run by including the following line in the 13521@file{commitinfo} administrative file: 13522 13523@example 13524ALL $CVSROOT/CVSROOT/logcommit.pl 13525@end example 13526 13527To maintain @file{logcommit.pl} with @sc{cvs} you would 13528add the following line to the @file{checkoutlist} 13529administrative file: 13530 13531@example 13532logcommit.pl 13533@end example 13534 13535The format of @file{checkoutlist} is one line for each 13536file that you want to maintain using @sc{cvs}, giving 13537the name of the file, followed optionally by more whitespace 13538and any error message that should print if the file cannot be 13539checked out into CVSROOT after a commit: 13540 13541@example 13542logcommit.pl Could not update CVSROOT/logcommit.pl. 13543@end example 13544 13545After setting up @file{checkoutlist} in this fashion, 13546the files listed there will function just like 13547@sc{cvs}'s built-in administrative files. For example, 13548when checking in one of the files you should get a 13549message such as: 13550 13551@example 13552cvs commit: Rebuilding administrative file database 13553@end example 13554 13555@noindent 13556and the checked out copy in the @file{CVSROOT} 13557directory should be updated. 13558 13559Note that listing @file{passwd} (@pxref{Password 13560authentication server}) in @file{checkoutlist} is not 13561recommended for security reasons. 13562 13563For information about keeping a checkout out copy in a 13564more general context than the one provided by 13565@file{checkoutlist}, see @ref{Keeping a checked out 13566copy}. 13567 13568@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13569@node history file 13570@appendixsec The history file 13571@cindex History file 13572@cindex Log information, saving 13573 13574The file @file{$CVSROOT/CVSROOT/history} is used 13575to log information for the @code{history} command 13576(@pxref{history}). This file must be created to turn 13577on logging. This is done automatically if the 13578@code{cvs init} command is used to set up the 13579repository (@pxref{Creating a repository}). 13580 13581The file format of the @file{history} file is 13582documented only in comments in the @sc{cvs} source 13583code, but generally programs should use the @code{cvs 13584history} command to access it anyway, in case the 13585format changes with future releases of @sc{cvs}. 13586 13587@node Variables 13588@appendixsec Expansions in administrative files 13589@cindex Internal variables 13590@cindex Variables 13591 13592Sometimes in writing an administrative file, you might 13593want the file to be able to know various things based 13594on environment @sc{cvs} is running in. There are 13595several mechanisms to do that. 13596 13597To find the home directory of the user running @sc{cvs} 13598(from the @code{HOME} environment variable), use 13599@samp{~} followed by @samp{/} or the end of the line. 13600Likewise for the home directory of @var{user}, use 13601@samp{~@var{user}}. These variables are expanded on 13602the server machine, and don't get any reasonable 13603expansion if pserver (@pxref{Password authenticated}) 13604is in use; therefore user variables (see below) may be 13605a better choice to customize behavior based on the user 13606running @sc{cvs}. 13607@c Based on these limitations, should we deprecate ~? 13608@c What is it good for? Are people using it? 13609 13610One may want to know about various pieces of 13611information internal to @sc{cvs}. A @sc{cvs} internal 13612variable has the syntax @code{$@{@var{variable}@}}, 13613where @var{variable} starts with a letter and consists 13614of alphanumeric characters and @samp{_}. If the 13615character following @var{variable} is a 13616non-alphanumeric character other than @samp{_}, the 13617@samp{@{} and @samp{@}} can be omitted. The @sc{cvs} 13618internal variables are: 13619 13620@table @code 13621@item CVSROOT 13622@cindex CVSROOT, internal variable 13623This is the absolute path to the current @sc{cvs} root directory. 13624@xref{Repository}, for a description of the various 13625ways to specify this, but note that the internal 13626variable contains just the directory and not any 13627of the access method information. 13628 13629@item RCSBIN 13630@cindex RCSBIN, internal variable 13631In @sc{cvs} 1.9.18 and older, this specified the 13632directory where @sc{cvs} was looking for @sc{rcs} 13633programs. Because @sc{cvs} no longer runs @sc{rcs} 13634programs, specifying this internal variable is now an 13635error. 13636 13637@item CVSEDITOR 13638@cindex CVSEDITOR, internal variable 13639@itemx EDITOR 13640@cindex EDITOR, internal variable 13641@itemx VISUAL 13642@cindex VISUAL, internal variable 13643These all expand to the same value, which is the editor 13644that @sc{cvs} is using. @xref{Global options}, for how 13645to specify this. 13646 13647@item USER 13648@cindex USER, internal variable 13649Username of the user running @sc{cvs} (on the @sc{cvs} 13650server machine). 13651When using pserver, this is the user specified in the repository 13652specification which need not be the same as the username the 13653server is running as (@pxref{Password authentication server}). 13654Do not confuse this with the environment variable of the same name. 13655@end table 13656 13657If you want to pass a value to the administrative files 13658which the user who is running @sc{cvs} can specify, 13659use a user variable. 13660@cindex User variables 13661To expand a user variable, the 13662administrative file contains 13663@code{$@{=@var{variable}@}}. To set a user variable, 13664specify the global option @samp{-s} to @sc{cvs}, with 13665argument @code{@var{variable}=@var{value}}. It may be 13666particularly useful to specify this option via 13667@file{.cvsrc} (@pxref{~/.cvsrc}). 13668 13669For example, if you want the administrative file to 13670refer to a test directory you might create a user 13671variable @code{TESTDIR}. Then if @sc{cvs} is invoked 13672as 13673 13674@example 13675cvs -s TESTDIR=/work/local/tests 13676@end example 13677 13678@noindent 13679and the 13680administrative file contains @code{sh 13681$@{=TESTDIR@}/runtests}, then that string is expanded 13682to @code{sh /work/local/tests/runtests}. 13683 13684All other strings containing @samp{$} are reserved; 13685there is no way to quote a @samp{$} character so that 13686@samp{$} represents itself. 13687 13688Environment variables passed to administrative files are: 13689 13690@table @code 13691@cindex environment variables, passed to administrative files 13692 13693@item CVS_USER 13694@cindex CVS_USER, environment variable 13695The @sc{cvs}-specific username provided by the user, if it 13696can be provided (currently just for the pserver access 13697method), and to the empty string otherwise. (@code{CVS_USER} 13698and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd} 13699is used to map @sc{cvs} usernames to system usernames.) 13700 13701@item LOGNAME 13702@cindex LOGNAME, environment variable 13703The username of the system user. 13704 13705@item USER 13706@cindex USER, environment variable 13707Same as @code{LOGNAME}. 13708Do not confuse this with the internal variable of the same name. 13709@end table 13710 13711@node config 13712@appendixsec The CVSROOT/config configuration file 13713 13714@cindex config, in CVSROOT 13715@cindex CVSROOT/config 13716 13717The administrative file @file{config} contains various 13718miscellaneous settings which affect the behavior of 13719@sc{cvs}. The syntax is slightly different from the 13720other administrative files. Variables are not 13721expanded. Lines which start with @samp{#} are 13722considered comments. 13723@c FIXME: where do we define comments for the other 13724@c administrative files. 13725Other lines consist of a keyword, @samp{=}, and a 13726value. Note that this syntax is very strict. 13727Extraneous spaces or tabs are not permitted. 13728@c See comments in parseinfo.c:parse_config for more 13729@c discussion of this strictness. 13730 13731Currently defined keywords are: 13732 13733@table @code 13734@cindex RCSBIN, in CVSROOT/config 13735@item RCSBIN=@var{bindir} 13736For @sc{cvs} 1.9.12 through 1.9.18, this setting told 13737@sc{cvs} to look for @sc{rcs} programs in the 13738@var{bindir} directory. Current versions of @sc{cvs} 13739do not run @sc{rcs} programs; for compatibility this 13740setting is accepted, but it does nothing. 13741 13742@cindex SystemAuth, in CVSROOT/config 13743@item SystemAuth=@var{value} 13744If @var{value} is @samp{yes}, then pserver should check 13745for users in the system's user database if not found in 13746@file{CVSROOT/passwd}. If it is @samp{no}, then all 13747pserver users must exist in @file{CVSROOT/passwd}. 13748The default is @samp{yes}. For more on pserver, see 13749@ref{Password authenticated}. 13750 13751@ignore 13752@cindex PreservePermissions, in CVSROOT/config 13753@item PreservePermissions=@var{value} 13754Enable support for saving special device files, 13755symbolic links, file permissions and ownerships in the 13756repository. The default value is @samp{no}. 13757@xref{Special Files}, for the full implications of using 13758this keyword. 13759@end ignore 13760 13761@cindex TopLevelAdmin, in CVSROOT/config 13762@item TopLevelAdmin=@var{value} 13763Modify the @samp{checkout} command to create a 13764@samp{CVS} directory at the top level of the new 13765working directory, in addition to @samp{CVS} 13766directories created within checked-out directories. 13767The default value is @samp{no}. 13768 13769This option is useful if you find yourself performing 13770many commands at the top level of your working 13771directory, rather than in one of the checked out 13772subdirectories. The @file{CVS} directory created there 13773will mean you don't have to specify @code{CVSROOT} for 13774each command. It also provides a place for the 13775@file{CVS/Template} file (@pxref{Working directory 13776storage}). 13777 13778@cindex LockDir, in CVSROOT/config 13779@item LockDir=@var{directory} 13780Put @sc{cvs} lock files in @var{directory} rather than 13781directly in the repository. This is useful if you want 13782to let users read from the repository while giving them 13783write access only to @var{directory}, not to the 13784repository. 13785It can also be used to put the locks on a very fast 13786in-memory file system to speed up locking and unlocking 13787the repository. 13788You need to create @var{directory}, but 13789@sc{cvs} will create subdirectories of @var{directory} as it 13790needs them. For information on @sc{cvs} locks, see 13791@ref{Concurrency}. 13792 13793@c Mention this in Compatibility section? 13794Before enabling the LockDir option, make sure that you 13795have tracked down and removed any copies of @sc{cvs} 1.9 or 13796older. Such versions neither support LockDir, nor will 13797give an error indicating that they don't support it. 13798The result, if this is allowed to happen, is that some 13799@sc{cvs} users will put the locks one place, and others will 13800put them another place, and therefore the repository 13801could become corrupted. @sc{cvs} 1.10 does not support 13802LockDir but it will print a warning if run on a 13803repository with LockDir enabled. 13804 13805@cindex LogHistory, in CVSROOT/config 13806@item LogHistory=@var{value} 13807Control what is logged to the @file{CVSROOT/history} file (@pxref{history}). 13808Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log 13809all transactions. Any subset of the default is 13810legal. (For example, to only log transactions that modify the 13811@file{*,v} files, use @samp{LogHistory=TMAR}.) 13812 13813@cindex RereadLogAfterVerify, in CVSROOT/config 13814@cindex @file{verifymsg}, changing the log message 13815@item RereadLogAfterVerify=@var{value} 13816Modify the @samp{commit} command such that CVS will reread the 13817log message after running the program specified by @file{verifymsg}. 13818@var{value} may be one of @samp{yes} or @samp{always}, indicating that 13819the log message should always be reread; @samp{no} 13820or @samp{never}, indicating that it should never be 13821reread; or @var{value} may be @samp{stat}, indicating 13822that the file should be checked with the file system 13823@samp{stat()} function to see if it has changed (see warning below) 13824before rereading. The default value is @samp{always}. 13825 13826@strong{The `stat' mode can cause CVS to pause for up to 13827one extra second per directory committed. This can be less IO and 13828CPU intensive but is not recommended for use with large repositories} 13829 13830@xref{verifymsg}, for more information on how verifymsg 13831may be used. 13832 13833@cindex IgnoreUnknownConfigKeys, in CVSROOT/config 13834@item IgnoreUnknownConfigKeys=@var{value} 13835If @var{value} is @samp{yes}, then @sc{cvs} should 13836ignore any keywords in @file{CVSROOT/config} which it 13837does not recognize. This option is intended primarily 13838for transitions between versions of @sc{cvs} which 13839support more configuration options in an environment 13840where a read-only mirror of the current @sc{cvs} server 13841may be maintained by someone else who is not yet ready 13842to upgrade to the same version. It is recommended that 13843this option be used only for a short time so that 13844problems with the @file{CVSROOT/config} file will be 13845found quickly. The default is @samp{no}. 13846@end table 13847 13848@c --------------------------------------------------------------------- 13849@node Environment variables 13850@appendix All environment variables which affect CVS 13851@cindex Environment variables 13852@cindex Reference manual for variables 13853 13854This is a complete list of all environment variables 13855that affect @sc{cvs}. 13856 13857@table @code 13858@cindex CVSIGNORE, environment variable 13859@item $CVSIGNORE 13860A whitespace-separated list of file name patterns that 13861@sc{cvs} should ignore. @xref{cvsignore}. 13862 13863@cindex CVSWRAPPERS, environment variable 13864@item $CVSWRAPPERS 13865A whitespace-separated list of file name patterns that 13866@sc{cvs} should treat as wrappers. @xref{Wrappers}. 13867 13868@cindex CVSREAD, environment variable 13869@cindex Read-only files, and CVSREAD 13870@item $CVSREAD 13871If this is set, @code{checkout} and @code{update} will 13872try hard to make the files in your working directory 13873read-only. When this is not set, the default behavior 13874is to permit modification of your working files. 13875 13876@item $CVSUMASK 13877Controls permissions of files in the repository. See 13878@ref{File permissions}. 13879 13880@item $CVSROOT 13881Should contain the full pathname to the root of the @sc{cvs} 13882source repository (where the @sc{rcs} files are 13883kept). This information must be available to @sc{cvs} for 13884most commands to execute; if @code{$CVSROOT} is not set, 13885or if you wish to override it for one invocation, you 13886can supply it on the command line: @samp{cvs -d cvsroot 13887cvs_command@dots{}} Once you have checked out a working 13888directory, @sc{cvs} stores the appropriate root (in 13889the file @file{CVS/Root}), so normally you only need to 13890worry about this when initially checking out a working 13891directory. 13892 13893@item $CVSEDITOR 13894@cindex CVSEDITOR, environment variable 13895@itemx $EDITOR 13896@cindex EDITOR, environment variable 13897@itemx $VISUAL 13898@cindex VISUAL, environment variable 13899Specifies the program to use for recording log messages 13900during commit. @code{$CVSEDITOR} overrides 13901@code{$EDITOR}, which overrides @code{$VISUAL}. 13902See @ref{Committing your changes} for more or 13903@ref{Global options} for alternative ways of specifying a 13904log editor. 13905 13906@cindex PATH, environment variable 13907@item $PATH 13908If @code{$RCSBIN} is not set, and no path is compiled 13909into @sc{cvs}, it will use @code{$PATH} to try to find all 13910programs it uses. 13911 13912@cindex HOME, environment variable 13913@item $HOME 13914@cindex HOMEPATH, environment variable 13915@item $HOMEPATH 13916@cindex HOMEDRIVE, environment variable 13917@item $HOMEDRIVE 13918Used to locate the directory where the @file{.cvsrc} 13919file, and other such files, are searched. On Unix, @sc{cvs} 13920just checks for @code{HOME}. On Windows NT, the system will 13921set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH}, 13922for example to @file{\joe}. On Windows 95, you'll 13923probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself. 13924@c We are being vague about whether HOME works on 13925@c Windows; see long comment in windows-NT/filesubr.c. 13926 13927@cindex CVS_RSH, environment variable 13928@item $CVS_RSH 13929Specifies the external program which @sc{cvs} connects with, 13930when @code{:ext:} access method is specified. 13931@pxref{Connecting via rsh}. 13932 13933@cindex CVS_SSH, environment variable 13934@item $CVS_SSH 13935Specifies the external program which @sc{cvs} connects with, 13936when @code{:extssh:} access method is specified. 13937@pxref{Connecting via rsh}. 13938 13939@item $CVS_SERVER 13940Used in client-server mode when accessing a remote 13941repository using @sc{rsh}. It specifies the name of 13942the program to start on the server side (and any 13943necessary arguments) when accessing a remote repository 13944using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods. 13945The default value for @code{:ext:} and @code{:server:} is @code{cvs}; 13946the default value for @code{:fork:} is the name used to run the client. 13947@pxref{Connecting via rsh} 13948 13949@item $CVS_PASSFILE 13950Used in client-server mode when accessing the @code{cvs 13951login server}. Default value is @file{$HOME/.cvspass}. 13952@pxref{Password authentication client} 13953 13954@item $CVS_CLIENT_PORT 13955Used in client-server mode to set the port to use when accessing the server 13956via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol 13957if the port is not specified in the CVSROOT. 13958@pxref{Remote repositories} 13959 13960@cindex CVS_RCMD_PORT, environment variable 13961@item $CVS_RCMD_PORT 13962Used in client-server mode. If set, specifies the port 13963number to be used when accessing the @sc{rcmd} demon on 13964the server side. (Currently not used for Unix clients). 13965 13966@cindex CVS_CLIENT_LOG, environment variable 13967@item $CVS_CLIENT_LOG 13968Used for debugging only in client-server 13969mode. If set, everything sent to the server is logged 13970into @file{@code{$CVS_CLIENT_LOG}.in} and everything 13971sent from the server is logged into 13972@file{@code{$CVS_CLIENT_LOG}.out}. 13973 13974@cindex CVS_SERVER_SLEEP, environment variable 13975@item $CVS_SERVER_SLEEP 13976Used only for debugging the server side in 13977client-server mode. If set, delays the start of the 13978server child process the specified amount of 13979seconds so that you can attach to it with a debugger. 13980 13981@cindex CVS_IGNORE_REMOTE_ROOT, environment variable 13982@item $CVS_IGNORE_REMOTE_ROOT 13983For @sc{cvs} 1.10 and older, setting this variable 13984prevents @sc{cvs} from overwriting the @file{CVS/Root} 13985file when the @samp{-d} global option is specified. 13986Later versions of @sc{cvs} do not rewrite 13987@file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no 13988effect. 13989 13990@cindex COMSPEC, environment variable 13991@item $COMSPEC 13992Used under OS/2 only. It specifies the name of the 13993command interpreter and defaults to @sc{cmd.exe}. 13994 13995@cindex TMPDIR, environment variable 13996@item $TMPDIR 13997@cindex TMP, environment variable 13998@itemx $TMP 13999@cindex TEMP, environment variable 14000@itemx $TEMP 14001@cindex Temporary files, location of 14002@c This is quite nuts. We don't talk about tempnam 14003@c or mkstemp which we sometimes use. The discussion 14004@c of "Global options" is semi-incoherent. 14005@c I'm not even sure those are the only inaccuracies. 14006@c Furthermore, the conventions are 14007@c pretty crazy and they should be simplified. 14008Directory in which temporary files are located. 14009The @sc{cvs} server uses 14010@code{TMPDIR}. @xref{Global options}, for a 14011description of how to specify this. 14012Some parts of @sc{cvs} will always use @file{/tmp} (via 14013the @code{tmpnam} function provided by the system). 14014 14015On Windows NT, @code{TMP} is used (via the @code{_tempnam} 14016function provided by the system). 14017 14018The @code{patch} program which is used by the @sc{cvs} 14019client uses @code{TMPDIR}, and if it is not set, uses 14020@file{/tmp} (at least with GNU patch 2.1). Note that 14021if your server and client are both running @sc{cvs} 140221.9.10 or later, @sc{cvs} will not invoke an external 14023@code{patch} program. 14024@end table 14025 14026@node Compatibility 14027@appendix Compatibility between CVS Versions 14028 14029@cindex CVS, versions of 14030@cindex Versions, of CVS 14031@cindex Compatibility, between CVS versions 14032@c We don't mention versions older than CVS 1.3 14033@c on the theory that it would clutter it up for the vast 14034@c majority of people, who don't have anything that old. 14035@c 14036The repository format is compatible going back to 14037@sc{cvs} 1.3. But see @ref{Watches Compatibility}, if 14038you have copies of @sc{cvs} 1.6 or older and you want 14039to use the optional developer communication features. 14040@c If you "cvs rm" and commit using 1.3, then you'll 14041@c want to run "rcs -sdead <file,v>" on each of the 14042@c files in the Attic if you then want 1.5 and 14043@c later to recognize those files as dead (I think the 14044@c symptom if this is not done is that files reappear 14045@c in joins). (Wait: the above will work but really to 14046@c be strictly correct we should suggest checking 14047@c in a new revision rather than just changing the 14048@c state of the head revision, shouldn't we?). 14049@c The old convert.sh script was for this, but it never 14050@c did get updated to reflect use of the RCS "dead" 14051@c state. 14052@c Note: this is tricky to document without confusing 14053@c people--need to carefully say what CVS version we 14054@c are talking about and keep in mind the distinction 14055@c between a 14056@c repository created with 1.3 and on which one now 14057@c uses 1.5+, and a repository on which one wants to 14058@c use both versions side by side (e.g. during a 14059@c transition period). 14060@c Wait, can't CVS just detect the case in which a file 14061@c is in the Attic but the head revision is not dead? 14062@c Not sure whether this should produce a warning or 14063@c something, and probably needs further thought, but 14064@c it would appear that the situation can be detected. 14065@c 14066@c We might want to separate out the 1.3 compatibility 14067@c section (for repository & working directory) from the 14068@c rest--that might help avoid confusing people who 14069@c are upgrading (for example) from 1.6 to 1.8. 14070@c 14071@c A minor incompatibility is if a current version of CVS 14072@c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will 14073@c see this as if there is no tag. Seems to me this is 14074@c too obscure to mention. 14075 14076The working directory format is compatible going back 14077to @sc{cvs} 1.5. It did change between @sc{cvs} 1.3 14078and @sc{cvs} 1.5. If you run @sc{cvs} 1.5 or newer on 14079a working directory checked out with @sc{cvs} 1.3, 14080@sc{cvs} will convert it, but to go back to @sc{cvs} 140811.3 you need to check out a new working directory with 14082@sc{cvs} 1.3. 14083 14084The remote protocol is interoperable going back to @sc{cvs} 1.5, but no 14085further (1.5 was the first official release with the remote protocol, 14086but some older versions might still be floating around). In many 14087cases you need to upgrade both the client and the server to take 14088advantage of new features and bug fixes, however. 14089 14090@c Perhaps should be saying something here about the 14091@c "D" lines in Entries (written by CVS 1.9; 1.8 and 14092@c older don't use them). These are supposed to be 14093@c compatible in both directions, but I'm not sure 14094@c they quite are 100%. One common gripe is if you 14095@c "rm -r" a directory and 1.9 gets confused, as it 14096@c still sees it in Entries. That one is fixed in 14097@c (say) 1.9.6. Someone else reported problems with 14098@c starting with a directory which was checked out with 14099@c an old version, and then using a new version, and 14100@c some "D" lines appeared, but not for every 14101@c directory, causing some directories to be skipped. 14102@c They weren't sure how to reproduce this, though. 14103 14104@c --------------------------------------------------------------------- 14105@node Troubleshooting 14106@appendix Troubleshooting 14107 14108If you are having trouble with @sc{cvs}, this appendix 14109may help. If there is a particular error message which 14110you are seeing, then you can look up the message 14111alphabetically. If not, you can look through the 14112section on other problems to see if your problem is 14113mentioned there. 14114 14115@menu 14116* Error messages:: Partial list of CVS errors 14117* Connection:: Trouble making a connection to a CVS server 14118* Other problems:: Problems not readily listed by error message 14119@end menu 14120 14121@ignore 14122@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 14123@c @node Bad administrative files 14124@appendixsec Bad administrative files 14125 14126@c -- Give hints on how to fix them 14127@end ignore 14128 14129@node Error messages 14130@appendixsec Partial list of error messages 14131 14132Here is a partial list of error messages that you may 14133see from @sc{cvs}. It is not a complete list---@sc{cvs} 14134is capable of printing many, many error messages, often 14135with parts of them supplied by the operating system, 14136but the intention is to list the common and/or 14137potentially confusing error messages. 14138 14139The messages are alphabetical, but introductory text 14140such as @samp{cvs update: } is not considered in 14141ordering them. 14142 14143In some cases the list includes messages printed by old 14144versions of @sc{cvs} (partly because users may not be 14145sure which version of @sc{cvs} they are using at any 14146particular moment). 14147@c If we want to start retiring messages, perhaps we 14148@c should pick a cutoff version (for example, no more 14149@c messages which are specific to versions before 1.9) 14150@c and then move the old messages to an "old messages" 14151@c node rather than deleting them completely. 14152 14153@table @code 14154@c FIXME: What is the correct way to format a multiline 14155@c error message here? Maybe @table is the wrong 14156@c choice? Texinfo gurus? 14157@item @var{file}:@var{line}: Assertion '@var{text}' failed 14158The exact format of this message may vary depending on 14159your system. It indicates a bug in @sc{cvs}, which can 14160be handled as described in @ref{BUGS}. 14161 14162@item cvs @var{command}: authorization failed: server @var{host} rejected access 14163This is a generic response when trying to connect to a 14164pserver server which chooses not to provide a 14165specific reason for denying authorization. Check that 14166the username and password specified are correct and 14167that the @code{CVSROOT} specified is allowed by @samp{--allow-root} 14168in @file{inetd.conf}. See @ref{Password authenticated}. 14169 14170@item cvs @var{command}: conflict: removed @var{file} was modified by second party 14171This message indicates that you removed a file, and 14172someone else modified it. To resolve the conflict, 14173first run @samp{cvs add @var{file}}. If desired, look 14174at the other party's modification to decide whether you 14175still want to remove it. If you don't want to remove 14176it, stop here. If you do want to remove it, proceed 14177with @samp{cvs remove @var{file}} and commit your 14178removal. 14179@c Tests conflicts2-142b* in sanity.sh test for this. 14180 14181@item cannot change permissions on temporary directory 14182@example 14183Operation not permitted 14184@end example 14185This message has been happening in a non-reproducible, 14186occasional way when we run the client/server testsuite, 14187both on Red Hat Linux 3.0.3 and 4.1. We haven't been 14188able to figure out what causes it, nor is it known 14189whether it is specific to Linux (or even to this 14190particular machine!). If the problem does occur on 14191other unices, @samp{Operation not permitted} would be 14192likely to read @samp{Not owner} or whatever the system 14193in question uses for the unix @code{EPERM} error. If 14194you have any information to add, please let us know as 14195described in @ref{BUGS}. If you experience this error 14196while using @sc{cvs}, retrying the operation which 14197produced it should work fine. 14198@c This has been seen in a variety of tests, including 14199@c multibranch-2, multibranch-5, and basic1-24-rm-rm, 14200@c so it doesn't seem particularly specific to any one 14201@c test. 14202 14203@item cvs [server aborted]: Cannot check out files into the repository itself 14204The obvious cause for this message (especially for 14205non-client/server @sc{cvs}) is that the @sc{cvs} root 14206is, for example, @file{/usr/local/cvsroot} and you try 14207to check out files when you are in a subdirectory, such 14208as @file{/usr/local/cvsroot/test}. However, there is a 14209more subtle cause, which is that the temporary 14210directory on the server is set to a subdirectory of the 14211root (which is also not allowed). If this is the 14212problem, set the temporary directory to somewhere else, 14213for example @file{/var/tmp}; see @code{TMPDIR} in 14214@ref{Environment variables}, for how to set the 14215temporary directory. 14216 14217@item cannot commit files as 'root' 14218See @samp{'root' is not allowed to commit files}. 14219 14220@c For one example see basica-1a10 in the testsuite 14221@c For another example, "cvs co ." on NT; see comment 14222@c at windows-NT/filesubr.c (expand_wild). 14223@c For another example, "cvs co foo/bar" where foo exists. 14224@item cannot open CVS/Entries for reading: No such file or directory 14225This generally indicates a @sc{cvs} internal error, and 14226can be handled as with other @sc{cvs} bugs 14227(@pxref{BUGS}). Usually there is a workaround---the 14228exact nature of which would depend on the situation but 14229which hopefully could be figured out. 14230 14231@c This is more obscure than it might sound; it only 14232@c happens if you run "cvs init" from a directory which 14233@c contains a CVS/Root file at the start. 14234@item cvs [init aborted]: cannot open CVS/Root: No such file or directory 14235This message is harmless. Provided it is not 14236accompanied by other errors, the operation has 14237completed successfully. This message should not occur 14238with current versions of @sc{cvs}, but it is documented 14239here for the benefit of @sc{cvs} 1.9 and older. 14240 14241@item cvs server: cannot open /root/.cvsignore: Permission denied 14242@itemx cvs [server aborted]: can't chdir(/root): Permission denied 14243See @ref{Connection}. 14244 14245@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument 14246This message has been reported as intermittently 14247happening with @sc{cvs} 1.9 on Solaris 2.5. The cause is 14248unknown; if you know more about what causes it, let us 14249know as described in @ref{BUGS}. 14250 14251@item cvs [@var{command} aborted]: cannot start server via rcmd 14252This, unfortunately, is a rather nonspecific error 14253message which @sc{cvs} 1.9 will print if you are 14254running the @sc{cvs} client and it is having trouble 14255connecting to the server. Current versions of @sc{cvs} 14256should print a much more specific error message. If 14257you get this message when you didn't mean to run the 14258client at all, you probably forgot to specify 14259@code{:local:}, as described in @ref{Repository}. 14260 14261@item ci: @var{file},v: bad diff output line: Binary files - and /tmp/T2a22651 differ 14262@sc{cvs} 1.9 and older will print this message 14263when trying to check in a binary file if 14264@sc{rcs} is not correctly installed. Re-read the 14265instructions that came with your @sc{rcs} distribution 14266and the @sc{install} file in the @sc{cvs} 14267distribution. Alternately, upgrade to a current 14268version of @sc{cvs}, which checks in files itself 14269rather than via @sc{rcs}. 14270 14271@item cvs checkout: could not check out @var{file} 14272With @sc{cvs} 1.9, this can mean that the @code{co} program 14273(part of @sc{rcs}) returned a failure. It should be 14274preceded by another error message, however it has been 14275observed without another error message and the cause is 14276not well-understood. With the current version of @sc{cvs}, 14277which does not run @code{co}, if this message occurs 14278without another error message, it is definitely a @sc{cvs} 14279bug (@pxref{BUGS}). 14280@c My current suspicion is that the RCS in the rcs (not 14281@c cvs/winnt/rcs57nt.zip) directory on the _Practical_ 14282@c CD is bad (remains to be confirmed). 14283@c There is also a report of something which looks 14284@c very similar on SGI, Irix 5.2, so I dunno. 14285 14286@item cvs [login aborted]: could not find out home directory 14287This means that you need to set the environment 14288variables that @sc{cvs} uses to locate your home directory. 14289See the discussion of @code{HOME}, @code{HOMEDRIVE}, and @code{HOMEPATH} in 14290@ref{Environment variables}. 14291 14292@item cvs update: could not merge revision @var{rev} of @var{file}: No such file or directory 14293@sc{cvs} 1.9 and older will print this message if there was 14294a problem finding the @code{rcsmerge} program. Make 14295sure that it is in your @code{PATH}, or upgrade to a 14296current version of @sc{cvs}, which does not require 14297an external @code{rcsmerge} program. 14298 14299@item cvs [update aborted]: could not patch @var{file}: No such file or directory 14300This means that there was a problem finding the 14301@code{patch} program. Make sure that it is in your 14302@code{PATH}. Note that despite appearances the message 14303is @emph{not} referring to whether it can find @var{file}. 14304If both the client and the server are running a current 14305version of @sc{cvs}, then there is no need for an 14306external patch program and you should not see this 14307message. But if either client or server is running 14308@sc{cvs} 1.9, then you need @code{patch}. 14309 14310@item cvs update: could not patch @var{file}; will refetch 14311This means that for whatever reason the client was 14312unable to apply a patch that the server sent. The 14313message is nothing to be concerned about, because 14314inability to apply the patch only slows things down and 14315has no effect on what @sc{cvs} does. 14316@c xref to update output. Or File status? 14317@c Or some place else that 14318@c explains this whole "patch"/P/Needs Patch thing? 14319 14320@item dying gasps from @var{server} unexpected 14321There is a known bug in the server for @sc{cvs} 1.9.18 14322and older which can cause this. For me, this was 14323reproducible if I used the @samp{-t} global option. It 14324was fixed by Andy Piper's 14 Nov 1997 change to 14325src/filesubr.c, if anyone is curious. 14326If you see the message, 14327you probably can just retry the operation which failed, 14328or if you have discovered information concerning its 14329cause, please let us know as described in @ref{BUGS}. 14330 14331@item end of file from server (consult above messages if any) 14332The most common cause for this message is if you are 14333using an external @code{rsh} or @code{ssh} program and it exited with 14334an error. In this case the @code{rsh} program should 14335have printed a message, which will appear before the 14336above message. For more information on setting up a 14337@sc{cvs} client and server, see @ref{Remote repositories}. 14338 14339@item cvs [update aborted]: EOF in key in RCS file @var{file},v 14340@itemx cvs [checkout aborted]: EOF while looking for end of string in RCS file @var{file},v 14341This means that there is a syntax error in the given 14342@sc{rcs} file. Note that this might be true even if @sc{rcs} can 14343read the file OK; @sc{cvs} does more error checking of 14344errors in the RCS file. That is why you may see this 14345message when upgrading from @sc{cvs} 1.9 to @sc{cvs} 143461.10. The likely cause for the original corruption is 14347hardware, the operating system, or the like. Of 14348course, if you find a case in which @sc{cvs} seems to 14349corrupting the file, by all means report it, 14350(@pxref{BUGS}). 14351There are quite a few variations of this error message, 14352depending on exactly where in the @sc{rcs} file @sc{cvs} 14353finds the syntax error. 14354 14355@cindex mkmodules 14356@item cvs commit: Executing 'mkmodules' 14357This means that your repository is set up for a version 14358of @sc{cvs} prior to @sc{cvs} 1.8. When using @sc{cvs} 143591.8 or later, the above message will be preceded by 14360 14361@example 14362cvs commit: Rebuilding administrative file database 14363@end example 14364 14365If you see both messages, the database is being rebuilt 14366twice, which is unnecessary but harmless. If you wish 14367to avoid the duplication, and you have no versions of 14368@sc{cvs} 1.7 or earlier in use, remove @code{-i mkmodules} 14369every place it appears in your @code{modules} 14370file. For more information on the @code{modules} file, 14371see @ref{modules}. 14372 14373@c This message comes from "co", and I believe is 14374@c possible only with older versions of CVS which call 14375@c co. The problem with being able to create the bogus 14376@c RCS file still exists, though (and I think maybe 14377@c there is a different symptom(s) now). 14378@c FIXME: Would be nice to have a more exact wording 14379@c for this message. 14380@item missing author 14381Typically this can happen if you created an RCS file 14382with your username set to empty. @sc{cvs} will, bogusly, 14383create an illegal RCS file with no value for the author 14384field. The solution is to make sure your username is 14385set to a non-empty value and re-create the RCS file. 14386@c "make sure your username is set" is complicated in 14387@c and of itself, as there are the environment 14388@c variables the system login name, &c, and it depends 14389@c on the version of CVS. 14390 14391@item cvs [checkout aborted]: no such tag @var{tag} 14392This message means that @sc{cvs} isn't familiar with 14393the tag @var{tag}. Usually this means that you have 14394mistyped a tag name; however there are (relatively 14395obscure) cases in which @sc{cvs} will require you to 14396@c Search sanity.sh for "no such tag" to see some of 14397@c the relatively obscure cases. 14398try a few other @sc{cvs} commands involving that tag, 14399before you find one which will cause @sc{cvs} to update 14400@cindex CVSROOT/val-tags file, forcing tags into 14401@cindex val-tags file, forcing tags into 14402the @file{val-tags} file; see discussion of val-tags in 14403@ref{File permissions}. You only need to worry about 14404this once for a given tag; when a tag is listed in 14405@file{val-tags}, it stays there. Note that using 14406@samp{-f} to not require tag matches does not override 14407this check; see @ref{Common options}. 14408 14409@item *PANIC* administration files missing 14410This typically means that there is a directory named 14411@sc{cvs} but it does not contain the administrative files 14412which @sc{cvs} puts in a CVS directory. If the problem is 14413that you created a CVS directory via some mechanism 14414other than @sc{cvs}, then the answer is simple, use a name 14415other than @sc{cvs}. If not, it indicates a @sc{cvs} bug 14416(@pxref{BUGS}). 14417 14418@item rcs error: Unknown option: -x,v/ 14419This message will be followed by a usage message for 14420@sc{rcs}. It means that you have an old version of 14421@sc{rcs} (probably supplied with your operating 14422system), as well as an old version of @sc{cvs}. 14423@sc{cvs} 1.9.18 and earlier only work with @sc{rcs} version 5 and 14424later; current versions of @sc{cvs} do not run @sc{rcs} programs. 14425@c For more information on installing @sc{cvs}, see 14426@c (FIXME: where? it depends on whether you are 14427@c getting binaries or sources or what). 14428@c The message can also say "ci error" or something 14429@c instead of "rcs error", I suspect. 14430 14431@item cvs [server aborted]: received broken pipe signal 14432This message can be caused by a loginfo program that fails to 14433read all of the log information from its standard input. 14434If you find it happening in any other circumstances, 14435please let us know as described in @ref{BUGS}. 14436 14437@item 'root' is not allowed to commit files 14438When committing a permanent change, @sc{cvs} makes a log entry of 14439who committed the change. If you are committing the change logged 14440in as "root" (not under "su" or other root-priv giving program), 14441@sc{cvs} cannot determine who is actually making the change. 14442As such, by default, @sc{cvs} disallows changes to be committed by users 14443logged in as "root". (You can disable this option by passing the 14444@code{--enable-rootcommit} option to @file{configure} and recompiling @sc{cvs}. 14445On some systems this means editing the appropriate @file{config.h} file 14446before building @sc{cvs}.) 14447 14448@item Terminated with fatal signal 11 14449This message usually indicates that @sc{cvs} (the server, if you're 14450using client/server mode) has run out of (virtual) memory. 14451Although @sc{cvs} tries to catch the error and issue a more meaningful 14452message, there are many circumstances where that is not possible. 14453If you appear to have lots of memory available to the system, 14454the problem is most likely that you're running into a system-wide 14455limit on the amount of memory a single process can use or a 14456similar process-specific limit. 14457The mechanisms for displaying and setting such limits vary from 14458system to system, so you'll have to consult an expert for your 14459particular system if you don't know how to do that. 14460 14461@item Too many arguments! 14462This message is typically printed by the @file{log.pl} 14463script which is in the @file{contrib} directory in the 14464@sc{cvs} source distribution. In some versions of 14465@sc{cvs}, @file{log.pl} has been part of the default 14466@sc{cvs} installation. The @file{log.pl} script gets 14467called from the @file{loginfo} administrative file. 14468Check that the arguments passed in @file{loginfo} match 14469what your version of @file{log.pl} expects. In 14470particular, the @file{log.pl} from @sc{cvs} 1.3 and 14471older expects the log file as an argument whereas the 14472@file{log.pl} from @sc{cvs} 1.5 and newer expects the 14473log file to be specified with a @samp{-f} option. Of 14474course, if you don't need @file{log.pl} you can just 14475comment it out of @file{loginfo}. 14476 14477@item cvs [update aborted]: unexpected EOF reading @var{file},v 14478See @samp{EOF in key in RCS file}. 14479 14480@item cvs [login aborted]: unrecognized auth response from @var{server} 14481This message typically means that the server is not set 14482up properly. For example, if @file{inetd.conf} points 14483to a nonexistent cvs executable. To debug it further, 14484find the log file which inetd writes 14485(@file{/var/log/messages} or whatever inetd uses on 14486your system). For details, see @ref{Connection}, and 14487@ref{Password authentication server}. 14488 14489@item cvs commit: Up-to-date check failed for `@var{file}' 14490This means that someone else has committed a change to 14491that file since the last time that you did a @code{cvs 14492update}. So before proceeding with your @code{cvs 14493commit} you need to @code{cvs update}. @sc{cvs} will merge 14494the changes that you made and the changes that the 14495other person made. If it does not detect any conflicts 14496it will report @samp{M @var{file}} and you are ready 14497to @code{cvs commit}. If it detects conflicts it will 14498print a message saying so, will report @samp{C @var{file}}, 14499and you need to manually resolve the 14500conflict. For more details on this process see 14501@ref{Conflicts example}. 14502 14503@item Usage: diff3 [-exEX3 [-i | -m] [-L label1 -L label3]] file1 file2 file3 14504@example 14505Only one of [exEX3] allowed 14506@end example 14507This indicates a problem with the installation of 14508@code{diff3} and @code{rcsmerge}. Specifically 14509@code{rcsmerge} was compiled to look for GNU diff3, but 14510it is finding unix diff3 instead. The exact text of 14511the message will vary depending on the system. The 14512simplest solution is to upgrade to a current version of 14513@sc{cvs}, which does not rely on external 14514@code{rcsmerge} or @code{diff3} programs. 14515 14516@item warning: unrecognized response `@var{text}' from cvs server 14517If @var{text} contains a valid response (such as 14518@samp{ok}) followed by an extra carriage return 14519character (on many systems this will cause the second 14520part of the message to overwrite the first part), then 14521it probably means that you are using the @samp{:ext:} 14522access method with a version of rsh, such as most 14523non-unix rsh versions, which does not by default 14524provide a transparent data stream. In such cases you 14525probably want to try @samp{:server:} instead of 14526@samp{:ext:}. If @var{text} is something else, this 14527may signify a problem with your @sc{cvs} server. 14528Double-check your installation against the instructions 14529for setting up the @sc{cvs} server. 14530@c FIXCVS: should be printing CR as \r or \015 or some 14531@c such, probably. 14532 14533@item cvs commit: [@var{time}] waiting for @var{user}'s lock in @var{directory} 14534This is a normal message, not an error. See 14535@ref{Concurrency}, for more details. 14536 14537@item cvs commit: warning: editor session failed 14538@cindex Exit status, of editor 14539This means that the editor which @sc{cvs} is using exits with a nonzero 14540exit status. Some versions of vi will do this even when there was not 14541a problem editing the file. If so, point the 14542@code{CVSEDITOR} environment variable to a small script 14543such as: 14544 14545@example 14546#!/bin/sh 14547vi $* 14548exit 0 14549@end example 14550 14551@item cvs update: warning: @var{file} was lost 14552This means that the working copy of @var{file} has been deleted 14553but it has not been removed from @sc{cvs}. 14554This is nothing to be concerned about, 14555the update will just recreate the local file from the repository. 14556(This is a convenient way to discard local changes to a file: 14557just delete it and then run @code{cvs update}.) 14558 14559@item cvs update: warning: @var{file} is not (any longer) pertinent 14560This means that the working copy of @var{file} has been deleted, 14561it has not been removed from @sc{cvs} in the current working directory, 14562but it has been removed from @sc{cvs} in some other working directory. 14563This is nothing to be concerned about, 14564the update would have removed the local file anyway. 14565 14566@end table 14567 14568@node Connection 14569@appendixsec Trouble making a connection to a CVS server 14570 14571This section concerns what to do if you are having 14572trouble making a connection to a @sc{cvs} server. If 14573you are running the @sc{cvs} command line client 14574running on Windows, first upgrade the client to 14575@sc{cvs} 1.9.12 or later. The error reporting in 14576earlier versions provided much less information about 14577what the problem was. If the client is non-Windows, 14578@sc{cvs} 1.9 should be fine. 14579 14580If the error messages are not sufficient to track down 14581the problem, the next steps depend largely on which 14582access method you are using. 14583 14584@table @code 14585@cindex :ext:, troubleshooting 14586@item :ext: 14587Try running the rsh program from the command line. For 14588example: "rsh servername cvs -v" should print @sc{cvs} 14589version information. If this doesn't work, you need to 14590fix it before you can worry about @sc{cvs} problems. 14591 14592@cindex :server:, troubleshooting 14593@item :server: 14594You don't need a command line rsh program to use this 14595access method, but if you have an rsh program around, 14596it may be useful as a debugging tool. Follow the 14597directions given for :ext:. 14598 14599@cindex :pserver:, troubleshooting 14600@item :pserver: 14601Errors along the lines of "connection refused" typically indicate 14602that inetd isn't even listening for connections on port 2401 14603whereas errors like "connection reset by peer", 14604"received broken pipe signal", "recv() from server: EOF", 14605or "end of file from server" 14606typically indicate that inetd is listening for 14607connections but is unable to start @sc{cvs} (this is frequently 14608caused by having an incorrect path in @file{inetd.conf} 14609or by firewall software rejecting the connection). 14610"unrecognized auth response" errors are caused by a bad command 14611line in @file{inetd.conf}, typically an invalid option or forgetting 14612to put the @samp{pserver} command at the end of the line. 14613Another less common problem is invisible control characters that 14614your editor "helpfully" added without you noticing. 14615 14616One good debugging tool is to "telnet servername 146172401". After connecting, send any text (for example 14618"foo" followed by return). If @sc{cvs} is working 14619correctly, it will respond with 14620 14621@example 14622cvs [pserver aborted]: bad auth protocol start: foo 14623@end example 14624 14625If instead you get: 14626 14627@example 14628Usage: cvs [cvs-options] command [command-options-and-arguments] 14629... 14630@end example 14631 14632@noindent 14633then you're missing the @samp{pserver} command at the end of the 14634line in @file{inetd.conf}; check to make sure that the entire command 14635is on one line and that it's complete. 14636 14637Likewise, if you get something like: 14638 14639@example 14640Unknown command: `pserved' 14641 14642CVS commands are: 14643 add Add a new file/directory to the repository 14644... 14645@end example 14646 14647@noindent 14648then you've misspelled @samp{pserver} in some way. If it isn't 14649obvious, check for invisible control characters (particularly 14650carriage returns) in @file{inetd.conf}. 14651 14652If it fails to work at all, then make sure inetd is working 14653right. Change the invocation in @file{inetd.conf} to run the 14654echo program instead of cvs. For example: 14655 14656@example 146572401 stream tcp nowait root /bin/echo echo hello 14658@end example 14659 14660After making that change and instructing inetd to 14661re-read its configuration file, "telnet servername 146622401" should show you the text hello and then the 14663server should close the connection. If this doesn't 14664work, you need to fix it before you can worry about 14665@sc{cvs} problems. 14666 14667On AIX systems, the system will often have its own 14668program trying to use port 2401. This is AIX's problem 14669in the sense that port 2401 is registered for use with 14670@sc{cvs}. I hear that there is an AIX patch available 14671to address this problem. 14672 14673Another good debugging tool is the @samp{-d} 14674(debugging) option to inetd. Consult your system 14675documentation for more information. 14676 14677If you seem to be connecting but get errors like: 14678 14679@example 14680cvs server: cannot open /root/.cvsignore: Permission denied 14681cvs [server aborted]: can't chdir(/root): Permission denied 14682@end example 14683 14684@noindent 14685then you probably haven't specified @samp{-f} in @file{inetd.conf}. 14686(In releases prior to @sc{cvs} 1.11.1, this problem can be caused by 14687your system setting the @code{$HOME} environment variable 14688for programs being run by inetd. In this case, you can either 14689have inetd run a shell script that unsets @code{$HOME} and then runs 14690@sc{cvs}, or you can use @code{env} to run @sc{cvs} with a pristine 14691environment.) 14692 14693If you can connect successfully for a while but then can't, 14694you've probably hit inetd's rate limit. 14695(If inetd receives too many requests for the same service 14696in a short period of time, it assumes that something is wrong 14697and temporarily disables the service.) 14698Check your inetd documentation to find out how to adjust the 14699rate limit (some versions of inetd have a single rate limit, 14700others allow you to set the limit for each service separately.) 14701@end table 14702 14703@node Other problems 14704@appendixsec Other common problems 14705 14706Here is a list of problems which do not fit into the 14707above categories. They are in no particular order. 14708 14709@itemize @bullet 14710@item 14711On Windows, if there is a 30 second or so delay when 14712you run a @sc{cvs} command, it may mean that you have 14713your home directory set to @file{C:/}, for example (see 14714@code{HOMEDRIVE} and @code{HOMEPATH} in 14715@ref{Environment variables}). @sc{cvs} expects the home 14716directory to not end in a slash, for example @file{C:} 14717or @file{C:\cvs}. 14718@c FIXCVS: CVS should at least detect this and print an 14719@c error, presumably. 14720 14721@item 14722If you are running @sc{cvs} 1.9.18 or older, and 14723@code{cvs update} finds a conflict and tries to 14724merge, as described in @ref{Conflicts example}, but 14725doesn't tell you there were conflicts, then you may 14726have an old version of @sc{rcs}. The easiest solution 14727probably is to upgrade to a current version of 14728@sc{cvs}, which does not rely on external @sc{rcs} 14729programs. 14730@end itemize 14731 14732@c --------------------------------------------------------------------- 14733@node Credits 14734@appendix Credits 14735 14736@cindex Contributors (manual) 14737@cindex Credits (manual) 14738Roland Pesch, then of Cygnus Support <@t{roland@@wrs.com}> 14739wrote the manual pages which were distributed with 14740@sc{cvs} 1.3. Much of their text was copied into this 14741manual. He also read an early draft 14742of this manual and contributed many ideas and 14743corrections. 14744 14745The mailing-list @code{info-cvs} is sometimes 14746informative. I have included information from postings 14747made by the following persons: 14748David G. Grubbs <@t{dgg@@think.com}>. 14749 14750Some text has been extracted from the man pages for 14751@sc{rcs}. 14752 14753The @sc{cvs} @sc{faq} by David G. Grubbs has provided 14754useful material. The @sc{faq} is no longer maintained, 14755however, and this manual is about the closest thing there 14756is to a successor (with respect to documenting how to 14757use @sc{cvs}, at least). 14758 14759In addition, the following persons have helped by 14760telling me about mistakes I've made: 14761 14762@display 14763Roxanne Brunskill <@t{rbrunski@@datap.ca}>, 14764Kathy Dyer <@t{dyer@@phoenix.ocf.llnl.gov}>, 14765Karl Pingle <@t{pingle@@acuson.com}>, 14766Thomas A Peterson <@t{tap@@src.honeywell.com}>, 14767Inge Wallin <@t{ingwa@@signum.se}>, 14768Dirk Koschuetzki <@t{koschuet@@fmi.uni-passau.de}> 14769and Michael Brown <@t{brown@@wi.extrel.com}>. 14770@end display 14771 14772The list of contributors here is not comprehensive; for a more 14773complete list of who has contributed to this manual see 14774the file @file{doc/ChangeLog} in the @sc{cvs} source 14775distribution. 14776 14777@c --------------------------------------------------------------------- 14778@node BUGS 14779@appendix Dealing with bugs in CVS or this manual 14780 14781@cindex Bugs in this manual or CVS 14782Neither @sc{cvs} nor this manual is perfect, and they 14783probably never will be. If you are having trouble 14784using @sc{cvs}, or think you have found a bug, there 14785are a number of things you can do about it. Note that 14786if the manual is unclear, that can be considered a bug 14787in the manual, so these problems are often worth doing 14788something about as well as problems with @sc{cvs} itself. 14789 14790@cindex Reporting bugs 14791@cindex Bugs, reporting 14792@cindex Errors, reporting 14793@itemize @bullet 14794@item 14795If you want someone to help you and fix bugs that you 14796report, there are companies which will do that for a 14797fee. One such company is: 14798 14799@cindex Ximbiot 14800@cindex Support, getting CVS support 14801@example 14802Ximbiot LLC 14803Suite 230 14804200 Diversion St. 14805Rochester Hills, MI 48307-6636 14806USA 14807Email: info@@ximbiot.com 14808Phone: (248) 835-1260 14809Fax: (248) 835-1263 14810@url{http://ximbiot.com/} 14811 14812@end example 14813 14814@item 14815If you got @sc{cvs} through a distributor, such as an 14816operating system vendor or a vendor of freeware 14817@sc{cd-rom}s, you may wish to see whether the 14818distributor provides support. Often, they will provide 14819no support or minimal support, but this may vary from 14820distributor to distributor. 14821 14822@item 14823If you have the skills and time to do so, you may wish 14824to fix the bug yourself. If you wish to submit your 14825fix for inclusion in future releases of @sc{cvs}, see 14826the file @sc{hacking} in the @sc{cvs} source 14827distribution. It contains much more information on the 14828process of submitting fixes. 14829 14830@item 14831There may be resources on the net which can help. A 14832good place to start is: 14833 14834@example 14835@url{http://cvs.nongnu.org/} 14836@end example 14837 14838If you are so inspired, increasing the information 14839available on the net is likely to be appreciated. For 14840example, before the standard @sc{cvs} distribution 14841worked on Windows 95, there was a web page with some 14842explanation and patches for running @sc{cvs} on Windows 1484395, and various people helped out by mentioning this 14844page on mailing lists or newsgroups when the subject 14845came up. 14846 14847@item 14848It is also possible to report bugs to @email{bug-cvs@@nongnu.org}. 14849Note that someone may or may not want to do anything 14850with your bug report---if you need a solution consider 14851one of the options mentioned above. People probably do 14852want to hear about bugs which are particularly severe 14853in consequences and/or easy to fix, however. You can 14854also increase your odds by being as clear as possible 14855about the exact nature of the bug and any other 14856relevant information. The way to report bugs is to 14857send email to @email{bug-cvs@@nongnu.org}. Note 14858that submissions to @email{bug-cvs@@nongnu.org} may be distributed 14859under the terms of the @sc{gnu} Public License, so if 14860you don't like this, don't submit them. There is 14861usually no justification for sending mail directly to 14862one of the @sc{cvs} maintainers rather than to 14863@email{bug-cvs@@nongnu.org}; those maintainers who want to hear 14864about such bug reports read @email{bug-cvs@@nongnu.org}. Also note 14865that sending a bug report to other mailing lists or 14866newsgroups is @emph{not} a substitute for sending it to 14867@email{bug-cvs@@nongnu.org}. It is fine to discuss @sc{cvs} bugs on 14868whatever forum you prefer, but there are not 14869necessarily any maintainers reading bug reports sent 14870anywhere except @email{bug-cvs@@nongnu.org}. 14871@end itemize 14872 14873@cindex Known bugs in this manual or CVS 14874People often ask if there is a list of known bugs or 14875whether a particular bug is a known one. The file 14876@sc{bugs} in the @sc{cvs} source distribution is one 14877list of known bugs, but it doesn't necessarily try to 14878be comprehensive. Perhaps there will never be a 14879comprehensive, detailed list of known bugs. 14880 14881@c --------------------------------------------------------------------- 14882@node Index 14883@unnumbered Index 14884@cindex Index 14885 14886@printindex cp 14887 14888@bye 14889 14890Local Variables: 14891fill-column: 55 14892End: 14893