1This is cvs.info, produced by makeinfo version 4.0 from cvs.texinfo. 2 3START-INFO-DIR-ENTRY 4* CVS: (cvs). Concurrent Versions System 5END-INFO-DIR-ENTRY 6 7 Copyright (C) 1992, 1993 Signum Support AB Copyright (C) 1993, 1994 8Free Software Foundation, Inc. 9 10 Permission is granted to make and distribute verbatim copies of this 11manual provided the copyright notice and this permission notice are 12preserved on all copies. 13 14 Permission is granted to copy and distribute modified versions of 15this manual under the conditions for verbatim copying, provided also 16that the entire resulting derived work is distributed under the terms 17of a permission notice identical to this one. 18 19 Permission is granted to copy and distribute translations of this 20manual into another language, under the above conditions for modified 21versions, except that this permission notice may be stated in a 22translation approved by the Free Software Foundation. 23 24 25File: cvs.info, Node: Moving directories, Prev: Moving files, Up: Adding and removing 26 27Moving and renaming directories 28=============================== 29 30 The normal way to rename or move a directory is to rename or move 31each file within it as described in *Note Outside::. Then check out 32with the `-P' option, as described in *Note Removing directories::. 33 34 If you really want to hack the repository to rename or delete a 35directory in the repository, you can do it like this: 36 37 1. Inform everyone who has a checked out copy of the directory that 38 the directory will be renamed. They should commit all their 39 changes, and remove their working copies, before you take the 40 steps below. 41 42 2. Rename the directory inside the repository. 43 44 $ cd $CVSROOT/PARENT-DIR 45 $ mv OLD-DIR NEW-DIR 46 47 3. Fix the CVS administrative files, if necessary (for instance if 48 you renamed an entire module). 49 50 4. Tell everyone that they can check out again and continue working. 51 52 53 If someone had a working copy the CVS commands will cease to work 54for him, until he removes the directory that disappeared inside the 55repository. 56 57 It is almost always better to move the files in the directory 58instead of moving the directory. If you move the directory you are 59unlikely to be able to retrieve old releases correctly, since they 60probably depend on the name of the directories. 61 62 63File: cvs.info, Node: History browsing, Next: Binary files, Prev: Adding and removing, Up: Top 64 65History browsing 66**************** 67 68 Once you have used CVS to store a version control history--what 69files have changed when, how, and by whom, there are a variety of 70mechanisms for looking through the history. 71 72* Menu: 73 74* log messages:: Log messages 75* history database:: The history database 76* user-defined logging:: User-defined logging 77* annotate:: What revision modified each line of a file? 78 79 80File: cvs.info, Node: log messages, Next: history database, Up: History browsing 81 82Log messages 83============ 84 85 Whenever you commit a file you specify a log message. 86 87 To look through the log messages which have been specified for every 88revision which has been committed, use the `cvs log' command (*note 89log::). 90 91 92File: cvs.info, Node: history database, Next: user-defined logging, Prev: log messages, Up: History browsing 93 94The history database 95==================== 96 97 You can use the history file (*note history file::) to log various 98CVS actions. To retrieve the information from the history file, use 99the `cvs history' command (*note history::). 100 101 Note: you can control what is logged to this file by using the 102`LogHistory' keyword in the `CVSROOT/config' file (*note config::). 103 104 105File: cvs.info, Node: user-defined logging, Next: annotate, Prev: history database, Up: History browsing 106 107User-defined logging 108==================== 109 110 You can customize CVS to log various kinds of actions, in whatever 111manner you choose. These mechanisms operate by executing a script at 112various times. The script might append a message to a file listing the 113information and the programmer who created it, or send mail to a group 114of developers, or, perhaps, post a message to a particular newsgroup. 115To log commits, use the `loginfo' file (*note loginfo::). To log 116commits, checkouts, exports, and tags, respectively, you can also use 117the `-i', `-o', `-e', and `-t' options in the modules file. For a more 118flexible way of giving notifications to various users, which requires 119less in the way of keeping centralized scripts up to date, use the `cvs 120watch add' command (*note Getting Notified::); this command is useful 121even if you are not using `cvs watch on'. 122 123 The `taginfo' file defines programs to execute when someone executes 124a `tag' or `rtag' command. The `taginfo' file has the standard form 125for administrative files (*note Administrative files::), where each 126line is a regular expression followed by a command to execute. The 127arguments passed to the command are, in order, the TAGNAME, OPERATION 128(`add' for `tag', `mov' for `tag -F', and `del' for `tag -d'), 129REPOSITORY, and any remaining are pairs of FILENAME REVISION. A 130non-zero exit of the filter program will cause the tag to be aborted. 131 132 Here is an example of using taginfo to log tag and rtag commands. 133In the taginfo file put: 134 135 ALL /usr/local/cvsroot/CVSROOT/loggit 136 137 Where `/usr/local/cvsroot/CVSROOT/loggit' contains the following 138script: 139 140 #!/bin/sh 141 echo "$@" >>/home/kingdon/cvsroot/CVSROOT/taglog 142 143 144File: cvs.info, Node: annotate, Prev: user-defined logging, Up: History browsing 145 146Annotate command 147================ 148 149 - Command: cvs annotate [`-flR'] [`-r rev'|`-D date'] files ... 150 For each file in FILES, print the head revision of the trunk, 151 together with information on the last modification for each line. 152 For example: 153 154 $ cvs annotate ssfile 155 Annotations for ssfile 156 *************** 157 1.1 (mary 27-Mar-96): ssfile line 1 158 1.2 (joe 28-Mar-96): ssfile line 2 159 160 The file `ssfile' currently contains two lines. The `ssfile line 161 1' line was checked in by `mary' on March 27. Then, on March 28, 162 `joe' added a line `ssfile line 2', without modifying the `ssfile 163 line 1' line. This report doesn't tell you anything about lines 164 which have been deleted or replaced; you need to use `cvs diff' 165 for that (*note diff::). 166 167 168 The options to `cvs annotate' are listed in *Note Invoking CVS::, 169and can be used to select the files and revisions to annotate. The 170options are described in more detail in *Note Common options::. 171 172 173File: cvs.info, Node: Binary files, Next: Multiple developers, Prev: History browsing, Up: Top 174 175Handling binary files 176********************* 177 178 The most common use for CVS is to store text files. With text 179files, CVS can merge revisions, display the differences between 180revisions in a human-visible fashion, and other such operations. 181However, if you are willing to give up a few of these abilities, CVS 182can store binary files. For example, one might store a web site in CVS 183including both text files and binary images. 184 185* Menu: 186 187* Binary why:: More details on issues with binary files 188* Binary howto:: How to store them 189 190 191File: cvs.info, Node: Binary why, Next: Binary howto, Up: Binary files 192 193The issues with binary files 194============================ 195 196 While the need to manage binary files may seem obvious if the files 197that you customarily work with are binary, putting them into version 198control does present some additional issues. 199 200 One basic function of version control is to show the differences 201between two revisions. For example, if someone else checked in a new 202version of a file, you may wish to look at what they changed and 203determine whether their changes are good. For text files, CVS provides 204this functionality via the `cvs diff' command. For binary files, it 205may be possible to extract the two revisions and then compare them with 206a tool external to CVS (for example, word processing software often has 207such a feature). If there is no such tool, one must track changes via 208other mechanisms, such as urging people to write good log messages, and 209hoping that the changes they actually made were the changes that they 210intended to make. 211 212 Another ability of a version control system is the ability to merge 213two revisions. For CVS this happens in two contexts. The first is 214when users make changes in separate working directories (*note Multiple 215developers::). The second is when one merges explicitly with the 216`update -j' command (*note Branching and merging::). 217 218 In the case of text files, CVS can merge changes made independently, 219and signal a conflict if the changes conflict. With binary files, the 220best that CVS can do is present the two different copies of the file, 221and leave it to the user to resolve the conflict. The user may choose 222one copy or the other, or may run an external merge tool which knows 223about that particular file format, if one exists. Note that having the 224user merge relies primarily on the user to not accidentally omit some 225changes, and thus is potentially error prone. 226 227 If this process is thought to be undesirable, the best choice may be 228to avoid merging. To avoid the merges that result from separate 229working directories, see the discussion of reserved checkouts (file 230locking) in *Note Multiple developers::. To avoid the merges resulting 231from branches, restrict use of branches. 232 233 234File: cvs.info, Node: Binary howto, Prev: Binary why, Up: Binary files 235 236How to store binary files 237========================= 238 239 There are two issues with using CVS to store binary files. The 240first is that CVS by default converts line endings between the 241canonical form in which they are stored in the repository (linefeed 242only), and the form appropriate to the operating system in use on the 243client (for example, carriage return followed by line feed for Windows 244NT). 245 246 The second is that a binary file might happen to contain data which 247looks like a keyword (*note Keyword substitution::), so keyword 248expansion must be turned off. 249 250 The `-kb' option available with some CVS commands insures that 251neither line ending conversion nor keyword expansion will be done. 252 253 Here is an example of how you can create a new file using the `-kb' 254flag: 255 256 $ echo '$Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $' > kotest 257 $ cvs add -kb -m"A test file" kotest 258 $ cvs ci -m"First checkin; contains a keyword" kotest 259 260 If a file accidentally gets added without `-kb', one can use the 261`cvs admin' command to recover. For example: 262 263 $ echo '$Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $' > kotest 264 $ cvs add -m"A test file" kotest 265 $ cvs ci -m"First checkin; contains a keyword" kotest 266 $ cvs admin -kb kotest 267 $ cvs update -A kotest 268 # For non-unix systems: 269 # Copy in a good copy of the file from outside CVS 270 $ cvs commit -m "make it binary" kotest 271 272 When you check in the file `kotest' the file is not preserved as a 273binary file, because you did not check it in as a binary file. The `cvs 274admin -kb' command sets the default keyword substitution method for 275this file, but it does not alter the working copy of the file that you 276have. If you need to cope with line endings (that is, you are using 277CVS on a non-unix system), then you need to check in a new copy of the 278file, as shown by the `cvs commit' command above. On unix, the `cvs 279update -A' command suffices. 280 281 However, in using `cvs admin -k' to change the keyword expansion, be 282aware that the keyword expansion mode is not version controlled. This 283means that, for example, that if you have a text file in old releases, 284and a binary file with the same name in new releases, CVS provides no 285way to check out the file in text or binary mode depending on what 286version you are checking out. There is no good workaround for this 287problem. 288 289 You can also set a default for whether `cvs add' and `cvs import' 290treat a file as binary based on its name; for example you could say 291that files who names end in `.exe' are binary. *Note Wrappers::. 292There is currently no way to have CVS detect whether a file is binary 293based on its contents. The main difficulty with designing such a 294feature is that it is not clear how to distinguish between binary and 295non-binary files, and the rules to apply would vary considerably with 296the operating system. 297 298 299File: cvs.info, Node: Multiple developers, Next: Revision management, Prev: Binary files, Up: Top 300 301Multiple developers 302******************* 303 304 When more than one person works on a software project things often 305get complicated. Often, two people try to edit the same file 306simultaneously. One solution, known as "file locking" or "reserved 307checkouts", is to allow only one person to edit each file at a time. 308This is the only solution with some version control systems, including 309RCS and SCCS. Currently the usual way to get reserved checkouts with 310CVS is the `cvs admin -l' command (*note admin options::). This is not 311as nicely integrated into CVS as the watch features, described below, 312but it seems that most people with a need for reserved checkouts find 313it adequate. It also may be possible to use the watches features 314described below, together with suitable procedures (not enforced by 315software), to avoid having two people edit at the same time. 316 317 The default model with CVS is known as "unreserved checkouts". In 318this model, developers can edit their own "working copy" of a file 319simultaneously. The first person that commits his changes has no 320automatic way of knowing that another has started to edit it. Others 321will get an error message when they try to commit the file. They must 322then use CVS commands to bring their working copy up to date with the 323repository revision. This process is almost automatic. 324 325 CVS also supports mechanisms which facilitate various kinds of 326communication, without actually enforcing rules like reserved checkouts 327do. 328 329 The rest of this chapter describes how these various models work, 330and some of the issues involved in choosing between them. 331 332* Menu: 333 334* File status:: A file can be in several states 335* Updating a file:: Bringing a file up-to-date 336* Conflicts example:: An informative example 337* Informing others:: To cooperate you must inform 338* Concurrency:: Simultaneous repository access 339* Watches:: Mechanisms to track who is editing files 340* Choosing a model:: Reserved or unreserved checkouts? 341 342 343File: cvs.info, Node: File status, Next: Updating a file, Up: Multiple developers 344 345File status 346=========== 347 348 Based on what operations you have performed on a checked out file, 349and what operations others have performed to that file in the 350repository, one can classify a file in a number of states. The states, 351as reported by the `status' command, are: 352 353Up-to-date 354 The file is identical with the latest revision in the repository 355 for the branch in use. 356 357Locally Modified 358 You have edited the file, and not yet committed your changes. 359 360Locally Added 361 You have added the file with `add', and not yet committed your 362 changes. 363 364Locally Removed 365 You have removed the file with `remove', and not yet committed 366 your changes. 367 368Needs Checkout 369 Someone else has committed a newer revision to the repository. 370 The name is slightly misleading; you will ordinarily use `update' 371 rather than `checkout' to get that newer revision. 372 373Needs Patch 374 Like Needs Checkout, but the CVS server will send a patch rather 375 than the entire file. Sending a patch or sending an entire file 376 accomplishes the same thing. 377 378Needs Merge 379 Someone else has committed a newer revision to the repository, and 380 you have also made modifications to the file. 381 382File had conflicts on merge 383 This is like Locally Modified, except that a previous `update' 384 command gave a conflict. If you have not already done so, you 385 need to resolve the conflict as described in *Note Conflicts 386 example::. 387 388Unknown 389 CVS doesn't know anything about this file. For example, you have 390 created a new file and have not run `add'. 391 392 To help clarify the file status, `status' also reports the `Working 393revision' which is the revision that the file in the working directory 394derives from, and the `Repository revision' which is the latest 395revision in the repository for the branch in use. 396 397 The options to `status' are listed in *Note Invoking CVS::. For 398information on its `Sticky tag' and `Sticky date' output, see *Note 399Sticky tags::. For information on its `Sticky options' output, see the 400`-k' option in *Note update options::. 401 402 You can think of the `status' and `update' commands as somewhat 403complementary. You use `update' to bring your files up to date, and you 404can use `status' to give you some idea of what an `update' would do (of 405course, the state of the repository might change before you actually run 406`update'). In fact, if you want a command to display file status in a 407more brief format than is displayed by the `status' command, you can 408invoke 409 410 $ cvs -n -q update 411 412 The `-n' option means to not actually do the update, but merely to 413display statuses; the `-q' option avoids printing the name of each 414directory. For more information on the `update' command, and these 415options, see *Note Invoking CVS::. 416 417 418File: cvs.info, Node: Updating a file, Next: Conflicts example, Prev: File status, Up: Multiple developers 419 420Bringing a file up to date 421========================== 422 423 When you want to update or merge a file, use the `update' command. 424For files that are not up to date this is roughly equivalent to a 425`checkout' command: the newest revision of the file is extracted from 426the repository and put in your working directory. 427 428 Your modifications to a file are never lost when you use `update'. 429If no newer revision exists, running `update' has no effect. If you 430have edited the file, and a newer revision is available, CVS will merge 431all changes into your working copy. 432 433 For instance, imagine that you checked out revision 1.4 and started 434editing it. In the meantime someone else committed revision 1.5, and 435shortly after that revision 1.6. If you run `update' on the file now, 436CVS will incorporate all changes between revision 1.4 and 1.6 into your 437file. 438 439 If any of the changes between 1.4 and 1.6 were made too close to any 440of the changes you have made, an "overlap" occurs. In such cases a 441warning is printed, and the resulting file includes both versions of 442the lines that overlap, delimited by special markers. *Note update::, 443for a complete description of the `update' command. 444 445 446File: cvs.info, Node: Conflicts example, Next: Informing others, Prev: Updating a file, Up: Multiple developers 447 448Conflicts example 449================= 450 451 Suppose revision 1.4 of `driver.c' contains this: 452 453 #include <stdio.h> 454 455 void main() 456 { 457 parse(); 458 if (nerr == 0) 459 gencode(); 460 else 461 fprintf(stderr, "No code generated.\n"); 462 exit(nerr == 0 ? 0 : 1); 463 } 464 465Revision 1.6 of `driver.c' contains this: 466 467 #include <stdio.h> 468 469 int main(int argc, 470 char **argv) 471 { 472 parse(); 473 if (argc != 1) 474 { 475 fprintf(stderr, "tc: No args expected.\n"); 476 exit(1); 477 } 478 if (nerr == 0) 479 gencode(); 480 else 481 fprintf(stderr, "No code generated.\n"); 482 exit(!!nerr); 483 } 484 485Your working copy of `driver.c', based on revision 1.4, contains this 486before you run `cvs update': 487 488 #include <stdlib.h> 489 #include <stdio.h> 490 491 void main() 492 { 493 init_scanner(); 494 parse(); 495 if (nerr == 0) 496 gencode(); 497 else 498 fprintf(stderr, "No code generated.\n"); 499 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 500 } 501 502You run `cvs update': 503 504 $ cvs update driver.c 505 RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v 506 retrieving revision 1.4 507 retrieving revision 1.6 508 Merging differences between 1.4 and 1.6 into driver.c 509 rcsmerge warning: overlaps during merge 510 cvs update: conflicts found in driver.c 511 C driver.c 512 513CVS tells you that there were some conflicts. Your original working 514file is saved unmodified in `.#driver.c.1.4'. The new version of 515`driver.c' contains this: 516 517 #include <stdlib.h> 518 #include <stdio.h> 519 520 int main(int argc, 521 char **argv) 522 { 523 init_scanner(); 524 parse(); 525 if (argc != 1) 526 { 527 fprintf(stderr, "tc: No args expected.\n"); 528 exit(1); 529 } 530 if (nerr == 0) 531 gencode(); 532 else 533 fprintf(stderr, "No code generated.\n"); 534 <<<<<<< driver.c 535 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 536 ======= 537 exit(!!nerr); 538 >>>>>>> 1.6 539 } 540 541Note how all non-overlapping modifications are incorporated in your 542working copy, and that the overlapping section is clearly marked with 543`<<<<<<<', `=======' and `>>>>>>>'. 544 545 You resolve the conflict by editing the file, removing the markers 546and the erroneous line. Suppose you end up with this file: 547 #include <stdlib.h> 548 #include <stdio.h> 549 550 int main(int argc, 551 char **argv) 552 { 553 init_scanner(); 554 parse(); 555 if (argc != 1) 556 { 557 fprintf(stderr, "tc: No args expected.\n"); 558 exit(1); 559 } 560 if (nerr == 0) 561 gencode(); 562 else 563 fprintf(stderr, "No code generated.\n"); 564 exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 565 } 566 567You can now go ahead and commit this as revision 1.7. 568 569 $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c 570 Checking in driver.c; 571 /usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c 572 new revision: 1.7; previous revision: 1.6 573 done 574 575 For your protection, CVS will refuse to check in a file if a 576conflict occurred and you have not resolved the conflict. Currently to 577resolve a conflict, you must change the timestamp on the file. In 578previous versions of CVS, you also needed to insure that the file 579contains no conflict markers. Because your file may legitimately 580contain conflict markers (that is, occurrences of `>>>>>>> ' at the 581start of a line that don't mark a conflict), the current version of CVS 582will print a warning and proceed to check in the file. 583 584 If you use release 1.04 or later of pcl-cvs (a GNU Emacs front-end 585for CVS) you can use an Emacs package called emerge to help you resolve 586conflicts. See the documentation for pcl-cvs. 587 588 589File: cvs.info, Node: Informing others, Next: Concurrency, Prev: Conflicts example, Up: Multiple developers 590 591Informing others about commits 592============================== 593 594 It is often useful to inform others when you commit a new revision 595of a file. The `-i' option of the `modules' file, or the `loginfo' 596file, can be used to automate this process. *Note modules::. *Note 597loginfo::. You can use these features of CVS to, for instance, 598instruct CVS to mail a message to all developers, or post a message to 599a local newsgroup. 600 601 602File: cvs.info, Node: Concurrency, Next: Watches, Prev: Informing others, Up: Multiple developers 603 604Several developers simultaneously attempting to run CVS 605======================================================= 606 607 If several developers try to run CVS at the same time, one may get 608the following message: 609 610 [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo 611 612 CVS will try again every 30 seconds, and either continue with the 613operation or print the message again, if it still needs to wait. If a 614lock seems to stick around for an undue amount of time, find the person 615holding the lock and ask them about the cvs command they are running. 616If they aren't running a cvs command, look in the repository directory 617mentioned in the message and remove files which they own whose names 618start with `#cvs.rfl', `#cvs.wfl', or `#cvs.lock'. 619 620 Note that these locks are to protect CVS's internal data structures 621and have no relationship to the word "lock" in the sense used by 622RCS--which refers to reserved checkouts (*note Multiple developers::). 623 624 Any number of people can be reading from a given repository at a 625time; only when someone is writing do the locks prevent other people 626from reading or writing. 627 628 One might hope for the following property 629 630 If someone commits some changes in one cvs command, 631 then an update by someone else will either get all the 632 changes, or none of them. 633 634 but CVS does _not_ have this property. For example, given the files 635 636 a/one.c 637 a/two.c 638 b/three.c 639 b/four.c 640 641 if someone runs 642 643 cvs ci a/two.c b/three.c 644 645 and someone else runs `cvs update' at the same time, the person 646running `update' might get only the change to `b/three.c' and not the 647change to `a/two.c'. 648 649 650File: cvs.info, Node: Watches, Next: Choosing a model, Prev: Concurrency, Up: Multiple developers 651 652Mechanisms to track who is editing files 653======================================== 654 655 For many groups, use of CVS in its default mode is perfectly 656satisfactory. Users may sometimes go to check in a modification only 657to find that another modification has intervened, but they deal with it 658and proceed with their check in. Other groups prefer to be able to 659know who is editing what files, so that if two people try to edit the 660same file they can choose to talk about who is doing what when rather 661than be surprised at check in time. The features in this section allow 662such coordination, while retaining the ability of two developers to 663edit the same file at the same time. 664 665 For maximum benefit developers should use `cvs edit' (not `chmod') 666to make files read-write to edit them, and `cvs release' (not `rm') to 667discard a working directory which is no longer in use, but CVS is not 668able to enforce this behavior. 669 670* Menu: 671 672* Setting a watch:: Telling CVS to watch certain files 673* Getting Notified:: Telling CVS to notify you 674* Editing files:: How to edit a file which is being watched 675* Watch information:: Information about who is watching and editing 676* Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier 677 678 679File: cvs.info, Node: Setting a watch, Next: Getting Notified, Up: Watches 680 681Telling CVS to watch certain files 682---------------------------------- 683 684 To enable the watch features, you first specify that certain files 685are to be watched. 686 687 - Command: cvs watch on [`-lR'] files ... 688 Specify that developers should run `cvs edit' before editing 689 FILES. CVS will create working copies of FILES read-only, to 690 remind developers to run the `cvs edit' command before working on 691 them. 692 693 If FILES includes the name of a directory, CVS arranges to watch 694 all files added to the corresponding repository directory, and 695 sets a default for files added in the future; this allows the user 696 to set notification policies on a per-directory basis. The 697 contents of the directory are processed recursively, unless the 698 `-l' option is given. The `-R' option can be used to force 699 recursion if the `-l' option is set in `~/.cvsrc' (*note 700 ~/.cvsrc::). 701 702 If FILES is omitted, it defaults to the current directory. 703 704 705 - Command: cvs watch off [`-lR'] files ... 706 Do not create FILES read-only on checkout; thus, developers will 707 not be reminded to use `cvs edit' and `cvs unedit'. 708 709 The FILES and options are processed as for `cvs watch on'. 710 711 712 713File: cvs.info, Node: Getting Notified, Next: Editing files, Prev: Setting a watch, Up: Watches 714 715Telling CVS to notify you 716------------------------- 717 718 You can tell CVS that you want to receive notifications about 719various actions taken on a file. You can do this without using `cvs 720watch on' for the file, but generally you will want to use `cvs watch 721on', so that developers use the `cvs edit' command. 722 723 - Command: cvs watch add [`-a' action] [`-lR'] files ... 724 Add the current user to the list of people to receive notification 725 of work done on FILES. 726 727 The `-a' option specifies what kinds of events CVS should notify 728 the user about. ACTION is one of the following: 729 730 `edit' 731 Another user has applied the `cvs edit' command (described 732 below) to a file. 733 734 `unedit' 735 Another user has applied the `cvs unedit' command (described 736 below) or the `cvs release' command to a file, or has deleted 737 the file and allowed `cvs update' to recreate it. 738 739 `commit' 740 Another user has committed changes to a file. 741 742 `all' 743 All of the above. 744 745 `none' 746 None of the above. (This is useful with `cvs edit', 747 described below.) 748 749 The `-a' option may appear more than once, or not at all. If 750 omitted, the action defaults to `all'. 751 752 The FILES and options are processed as for the `cvs watch' 753 commands. 754 755 756 - Command: cvs watch remove [`-a' action] [`-lR'] files ... 757 Remove a notification request established using `cvs watch add'; 758 the arguments are the same. If the `-a' option is present, only 759 watches for the specified actions are removed. 760 761 762 When the conditions exist for notification, CVS calls the `notify' 763administrative file. Edit `notify' as one edits the other 764administrative files (*note Intro administrative files::). This file 765follows the usual conventions for administrative files (*note 766syntax::), where each line is a regular expression followed by a 767command to execute. The command should contain a single occurrence of 768`%s' which will be replaced by the user to notify; the rest of the 769information regarding the notification will be supplied to the command 770on standard input. The standard thing to put in the `notify' file is 771the single line: 772 773 ALL mail %s -s "CVS notification" 774 775 This causes users to be notified by electronic mail. 776 777 Note that if you set this up in the straightforward way, users 778receive notifications on the server machine. One could of course write 779a `notify' script which directed notifications elsewhere, but to make 780this easy, CVS allows you to associate a notification address for each 781user. To do so create a file `users' in `CVSROOT' with a line for each 782user in the format USER:VALUE. Then instead of passing the name of the 783user to be notified to `notify', CVS will pass the VALUE (normally an 784email address on some other machine). 785 786 CVS does not notify you for your own changes. Currently this check 787is done based on whether the user name of the person taking the action 788which triggers notification matches the user name of the person getting 789notification. In fact, in general, the watches features only track one 790edit by each user. It probably would be more useful if watches tracked 791each working directory separately, so this behavior might be worth 792changing. 793 794 795File: cvs.info, Node: Editing files, Next: Watch information, Prev: Getting Notified, Up: Watches 796 797How to edit a file which is being watched 798----------------------------------------- 799 800 Since a file which is being watched is checked out read-only, you 801cannot simply edit it. To make it read-write, and inform others that 802you are planning to edit it, use the `cvs edit' command. Some systems 803call this a "checkout", but CVS uses that term for obtaining a copy of 804the sources (*note Getting the source::), an operation which those 805systems call a "get" or a "fetch". 806 807 - Command: cvs edit [options] files ... 808 Prepare to edit the working files FILES. CVS makes the FILES 809 read-write, and notifies users who have requested `edit' 810 notification for any of FILES. 811 812 The `cvs edit' command accepts the same OPTIONS as the `cvs watch 813 add' command, and establishes a temporary watch for the user on 814 FILES; CVS will remove the watch when FILES are `unedit'ed or 815 `commit'ted. If the user does not wish to receive notifications, 816 she should specify `-a none'. 817 818 The FILES and options are processed as for the `cvs watch' 819 commands. 820 821 822 Normally when you are done with a set of changes, you use the `cvs 823commit' command, which checks in your changes and returns the watched 824files to their usual read-only state. But if you instead decide to 825abandon your changes, or not to make any changes, you can use the `cvs 826unedit' command. 827 828 - Command: cvs unedit [`-lR'] files ... 829 Abandon work on the working files FILES, and revert them to the 830 repository versions on which they are based. CVS makes those 831 FILES read-only for which users have requested notification using 832 `cvs watch on'. CVS notifies users who have requested `unedit' 833 notification for any of FILES. 834 835 The FILES and options are processed as for the `cvs watch' 836 commands. 837 838 If watches are not in use, the `unedit' command probably does not 839 work, and the way to revert to the repository version is to remove 840 the file and then use `cvs update' to get a new copy. The meaning 841 is not precisely the same; removing and updating may also bring in 842 some changes which have been made in the repository since the last 843 time you updated. 844 845 When using client/server CVS, you can use the `cvs edit' and `cvs 846unedit' commands even if CVS is unable to successfully communicate with 847the server; the notifications will be sent upon the next successful CVS 848command. 849 850 851File: cvs.info, Node: Watch information, Next: Watches Compatibility, Prev: Editing files, Up: Watches 852 853Information about who is watching and editing 854--------------------------------------------- 855 856 - Command: cvs watchers [`-lR'] files ... 857 List the users currently watching changes to FILES. The report 858 includes the files being watched, and the mail address of each 859 watcher. 860 861 The FILES and options are processed as for the `cvs watch' 862 commands. 863 864 865 - Command: cvs editors [`-lR'] files ... 866 List the users currently working on FILES. The report includes 867 the mail address of each user, the time when the user began 868 working with the file, and the host and path of the working 869 directory containing the file. 870 871 The FILES and options are processed as for the `cvs watch' 872 commands. 873 874 875 876File: cvs.info, Node: Watches Compatibility, Prev: Watch information, Up: Watches 877 878Using watches with old versions of CVS 879-------------------------------------- 880 881 If you use the watch features on a repository, it creates `CVS' 882directories in the repository and stores the information about watches 883in that directory. If you attempt to use CVS 1.6 or earlier with the 884repository, you get an error message such as the following (all on one 885line): 886 887 cvs update: cannot open CVS/Entries for reading: 888 No such file or directory 889 890 and your operation will likely be aborted. To use the watch 891features, you must upgrade all copies of CVS which use that repository 892in local or server mode. If you cannot upgrade, use the `watch off' and 893`watch remove' commands to remove all watches, and that will restore 894the repository to a state which CVS 1.6 can cope with. 895 896 897File: cvs.info, Node: Choosing a model, Prev: Watches, Up: Multiple developers 898 899Choosing between reserved or unreserved checkouts 900================================================= 901 902 Reserved and unreserved checkouts each have pros and cons. Let it 903be said that a lot of this is a matter of opinion or what works given 904different groups' working styles, but here is a brief description of 905some of the issues. There are many ways to organize a team of 906developers. CVS does not try to enforce a certain organization. It is 907a tool that can be used in several ways. 908 909 Reserved checkouts can be very counter-productive. If two persons 910want to edit different parts of a file, there may be no reason to 911prevent either of them from doing so. Also, it is common for someone 912to take out a lock on a file, because they are planning to edit it, but 913then forget to release the lock. 914 915 People, especially people who are familiar with reserved checkouts, 916often wonder how often conflicts occur if unreserved checkouts are 917used, and how difficult they are to resolve. The experience with many 918groups is that they occur rarely and usually are relatively 919straightforward to resolve. 920 921 The rarity of serious conflicts may be surprising, until one realizes 922that they occur only when two developers disagree on the proper design 923for a given section of code; such a disagreement suggests that the team 924has not been communicating properly in the first place. In order to 925collaborate under _any_ source management regimen, developers must 926agree on the general design of the system; given this agreement, 927overlapping changes are usually straightforward to merge. 928 929 In some cases unreserved checkouts are clearly inappropriate. If no 930merge tool exists for the kind of file you are managing (for example 931word processor files or files edited by Computer Aided Design 932programs), and it is not desirable to change to a program which uses a 933mergeable data format, then resolving conflicts is going to be 934unpleasant enough that you generally will be better off to simply avoid 935the conflicts instead, by using reserved checkouts. 936 937 The watches features described above in *Note Watches:: can be 938considered to be an intermediate model between reserved checkouts and 939unreserved checkouts. When you go to edit a file, it is possible to 940find out who else is editing it. And rather than having the system 941simply forbid both people editing the file, it can tell you what the 942situation is and let you figure out whether it is a problem in that 943particular case or not. Therefore, for some groups it can be 944considered the best of both the reserved checkout and unreserved 945checkout worlds. 946 947 948File: cvs.info, Node: Revision management, Next: Keyword substitution, Prev: Multiple developers, Up: Top 949 950Revision management 951******************* 952 953 If you have read this far, you probably have a pretty good grasp on 954what CVS can do for you. This chapter talks a little about things that 955you still have to decide. 956 957 If you are doing development on your own using CVS you could 958probably skip this chapter. The questions this chapter takes up become 959more important when more than one person is working in a repository. 960 961* Menu: 962 963* When to commit:: Some discussion on the subject 964 965 966File: cvs.info, Node: When to commit, Up: Revision management 967 968When to commit? 969=============== 970 971 Your group should decide which policy to use regarding commits. 972Several policies are possible, and as your experience with CVS grows 973you will probably find out what works for you. 974 975 If you commit files too quickly you might commit files that do not 976even compile. If your partner updates his working sources to include 977your buggy file, he will be unable to compile the code. On the other 978hand, other persons will not be able to benefit from the improvements 979you make to the code if you commit very seldom, and conflicts will 980probably be more common. 981 982 It is common to only commit files after making sure that they can be 983compiled. Some sites require that the files pass a test suite. 984Policies like this can be enforced using the commitinfo file (*note 985commitinfo::), but you should think twice before you enforce such a 986convention. By making the development environment too controlled it 987might become too regimented and thus counter-productive to the real 988goal, which is to get software written. 989 990 991File: cvs.info, Node: Keyword substitution, Next: Tracking sources, Prev: Revision management, Up: Top 992 993Keyword substitution 994******************** 995 996 As long as you edit source files inside a working directory you can 997always find out the state of your files via `cvs status' and `cvs log'. 998But as soon as you export the files from your development environment 999it becomes harder to identify which revisions they are. 1000 1001 CVS can use a mechanism known as "keyword substitution" (or "keyword 1002expansion") to help identifying the files. Embedded strings of the form 1003`$KEYWORD$' and `$KEYWORD:...$' in a file are replaced with strings of 1004the form `$KEYWORD:VALUE$' whenever you obtain a new revision of the 1005file. 1006 1007* Menu: 1008 1009* Keyword list:: Keywords 1010* Using keywords:: Using keywords 1011* Avoiding substitution:: Avoiding substitution 1012* Substitution modes:: Substitution modes 1013* Log keyword:: Problems with the $Log: cvs.info-4,v $ 1014* Log keyword:: Problems with the Revision 1.3 2001/09/30 19:44:54 tholo 1015* Log keyword:: Problems with the Revert to distributed version 1016* Log keyword:: Problems with the 1017* Log keyword:: Problems with the Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1018* Log keyword:: Problems with the Latest from Cyclic Software 1019* Log keyword:: Problems with the keyword. 1020 1021 1022File: cvs.info, Node: Keyword list, Next: Using keywords, Up: Keyword substitution 1023 1024Keyword List 1025============ 1026 1027 This is a list of the keywords: 1028 1029`$Author: tholo $' 1030 The login name of the user who checked in the revision. 1031 1032`$Date: 2001/09/30 19:44:54 $' 1033 The date and time (UTC) the revision was checked in. 1034 1035`$Header: /home/cvs/src/gnu/usr.bin/cvs/doc/cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $' 1036 A standard header containing the full pathname of the RCS file, 1037 the revision number, the date (UTC), the author, the state, and 1038 the locker (if locked). Files will normally never be locked when 1039 you use CVS. 1040 1041`$Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $' 1042 Same as `$Header: /home/cvs/src/gnu/usr.bin/cvs/doc/cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $', except that the RCS filename is without a path. 1043 1044`$Name: $' 1045 Tag name used to check out this file. The keyword is expanded 1046 only if one checks out with an explicit tag name. For example, 1047 when running the command `cvs co -r first', the keyword expands to 1048 `Name: first'. 1049 1050`$Locker: $' 1051 The login name of the user who locked the revision (empty if not 1052 locked, which is the normal case unless `cvs admin -l' is in use). 1053 1054`$Log: cvs.info-4,v $ 1055`Revision 1.3 2001/09/30 19:44:54 tholo 1056`Revert to distributed version 1057` 1058`Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1059`Latest from Cyclic Software 1060`' 1061 The log message supplied during commit, preceded by a header 1062 containing the RCS filename, the revision number, the author, and 1063 the date (UTC). Existing log messages are _not_ replaced. 1064 Instead, the new log message is inserted after `$Log: cvs.info-4,v $ 1065 Instead, the new log message is inserted after `Revision 1.3 2001/09/30 19:44:54 tholo 1066 Instead, the new log message is inserted after `Revert to distributed version 1067 Instead, the new log message is inserted after ` 1068 Instead, the new log message is inserted after `Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1069 Instead, the new log message is inserted after `Latest from Cyclic Software 1070 Instead, the new log message is inserted after `'. Each 1071 new line is prefixed with the same string which precedes the 1072 `$Log' keyword. For example, if the file contains 1073 1074 /* Here is what people have been up to: 1075 * 1076 * $Log: cvs.info-4,v $ 1077 * Revision 1.3 2001/09/30 19:44:54 tholo 1078 * Revert to distributed version 1079 * 1080 * Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1081 * Latest from Cyclic Software 1082 * 1083 * Revision 1.1 1997/01/03 14:23:51 joe 1084 * Add the superfrobnicate option 1085 * 1086 */ 1087 1088 then additional lines which are added when expanding the `$Log' 1089 keyword will be preceded by ` * '. Unlike previous versions of 1090 CVS and RCS, the "comment leader" from the RCS file is not used. 1091 The `$Log' keyword is useful for accumulating a complete change 1092 log in a source file, but for several reasons it can be 1093 problematic. *Note Log keyword::. 1094 1095`$RCSfile: cvs.info-4,v $' 1096 The name of the RCS file without a path. 1097 1098`$Revision: 1.3 $' 1099 The revision number assigned to the revision. 1100 1101`$Source: /home/cvs/src/gnu/usr.bin/cvs/doc/cvs.info-4,v $' 1102 The full pathname of the RCS file. 1103 1104`$State: Exp $' 1105 The state assigned to the revision. States can be assigned with 1106 `cvs admin -s'--see *Note admin options::. 1107 1108 1109File: cvs.info, Node: Using keywords, Next: Avoiding substitution, Prev: Keyword list, Up: Keyword substitution 1110 1111Using keywords 1112============== 1113 1114 To include a keyword string you simply include the relevant text 1115string, such as `$Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $', inside the file, and commit the file. CVS will 1116automatically expand the string as part of the commit operation. 1117 1118 It is common to embed the `$Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $' string in the source files so that 1119it gets passed through to generated files. For example, if you are 1120managing computer program source code, you might include a variable 1121which is initialized to contain that string. Or some C compilers may 1122provide a `#pragma ident' directive. Or a document management system 1123might provide a way to pass a string through to generated files. 1124 1125 The `ident' command (which is part of the RCS package) can be used 1126to extract keywords and their values from a file. This can be handy 1127for text files, but it is even more useful for extracting keywords from 1128binary files. 1129 1130 $ ident samp.c 1131 samp.c: 1132 $Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $ 1133 $ gcc samp.c 1134 $ ident a.out 1135 a.out: 1136 $Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $ 1137 1138 SCCS is another popular revision control system. It has a command, 1139`what', which is very similar to `ident' and used for the same purpose. 1140Many sites without RCS have SCCS. Since `what' looks for the 1141character sequence `@(#)' it is easy to include keywords that are 1142detected by either command. Simply prefix the keyword with the magic 1143SCCS phrase, like this: 1144 1145 static char *id="@(#) $Id: cvs.info-4,v 1.3 2001/09/30 19:44:54 tholo Exp $"; 1146 1147 1148File: cvs.info, Node: Avoiding substitution, Next: Substitution modes, Prev: Using keywords, Up: Keyword substitution 1149 1150Avoiding substitution 1151===================== 1152 1153 Keyword substitution has its disadvantages. Sometimes you might 1154want the literal text string `$Author: tholo $' to appear inside a file without 1155CVS interpreting it as a keyword and expanding it into something like 1156`$Author: tholo $'. 1157 1158 There is unfortunately no way to selectively turn off keyword 1159substitution. You can use `-ko' (*note Substitution modes::) to turn 1160off keyword substitution entirely. 1161 1162 In many cases you can avoid using keywords in the source, even 1163though they appear in the final product. For example, the source for 1164this manual contains `$@asis{}Author$' whenever the text `$Author: tholo $' 1165should appear. In `nroff' and `troff' you can embed the null-character 1166`\&' inside the keyword for a similar effect. 1167 1168 1169File: cvs.info, Node: Substitution modes, Next: Log keyword, Prev: Avoiding substitution, Up: Keyword substitution 1170 1171Substitution modes 1172================== 1173 1174 Each file has a stored default substitution mode, and each working 1175directory copy of a file also has a substitution mode. The former is 1176set by the `-k' option to `cvs add' and `cvs admin'; the latter is set 1177by the `-k' or `-A' options to `cvs checkout' or `cvs update'. `cvs 1178diff' also has a `-k' option. For some examples, see *Note Binary 1179files::, and *Note Merging and keywords::. 1180 1181 The modes available are: 1182 1183`-kkv' 1184 Generate keyword strings using the default form, e.g. `$Revision: 1185 5.7 $' for the `Revision' keyword. 1186 1187`-kkvl' 1188 Like `-kkv', except that a locker's name is always inserted if the 1189 given revision is currently locked. The locker's name is only 1190 relevant if `cvs admin -l' is in use. 1191 1192`-kk' 1193 Generate only keyword names in keyword strings; omit their values. 1194 For example, for the `Revision' keyword, generate the string 1195 `$Revision: 1.3 $' instead of `$Revision: 1.3 $'. This option is useful 1196 to ignore differences due to keyword substitution when comparing 1197 different revisions of a file (*note Merging and keywords::). 1198 1199`-ko' 1200 Generate the old keyword string, present in the working file just 1201 before it was checked in. For example, for the `Revision' 1202 keyword, generate the string `$Revision: 1.3 $' instead of 1203 `$Revision: 1.3 $' if that is how the string appeared when the 1204 file was checked in. 1205 1206`-kb' 1207 Like `-ko', but also inhibit conversion of line endings between 1208 the canonical form in which they are stored in the repository 1209 (linefeed only), and the form appropriate to the operating system 1210 in use on the client. For systems, like unix, which use linefeed 1211 only to terminate lines, this is the same as `-ko'. For more 1212 information on binary files, see *Note Binary files::. 1213 1214`-kv' 1215 Generate only keyword values for keyword strings. For example, 1216 for the `Revision' keyword, generate the string `5.7' instead of 1217 `$Revision: 1.3 $'. This can help generate files in programming 1218 languages where it is hard to strip keyword delimiters like 1219 `$Revision: 1.3 $' from a string. However, further keyword 1220 substitution cannot be performed once the keyword names are 1221 removed, so this option should be used with care. 1222 1223 One often would like to use `-kv' with `cvs export'--*note 1224 export::. But be aware that doesn't handle an export containing 1225 binary files correctly. 1226 1227 1228File: cvs.info, Node: Log keyword, Prev: Substitution modes, Up: Keyword substitution 1229 1230Problems with the $Log: cvs.info-4,v $ 1231Problems with the Revision 1.3 2001/09/30 19:44:54 tholo 1232Problems with the Revert to distributed version 1233Problems with the 1234Problems with the Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1235Problems with the Latest from Cyclic Software 1236Problems with the keyword. 1237================================ 1238 1239 The `$Log: cvs.info-4,v $ 1240 The `Revision 1.3 2001/09/30 19:44:54 tholo 1241 The `Revert to distributed version 1242 The ` 1243 The `Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1244 The `Latest from Cyclic Software 1245 The `' keyword is somewhat controversial. As long as you are 1246working on your development system the information is easily accessible 1247even if you do not use the `$Log: cvs.info-4,v $ 1248even if you do not use the `Revision 1.3 2001/09/30 19:44:54 tholo 1249even if you do not use the `Revert to distributed version 1250even if you do not use the ` 1251even if you do not use the `Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1252even if you do not use the `Latest from Cyclic Software 1253even if you do not use the `' keyword--just do a `cvs log'. Once 1254you export the file the history information might be useless anyhow. 1255 1256 A more serious concern is that CVS is not good at handling `$Log: cvs.info-4,v $ 1257 A more serious concern is that CVS is not good at handling `Revision 1.3 2001/09/30 19:44:54 tholo 1258 A more serious concern is that CVS is not good at handling `Revert to distributed version 1259 A more serious concern is that CVS is not good at handling ` 1260 A more serious concern is that CVS is not good at handling `Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1261 A more serious concern is that CVS is not good at handling `Latest from Cyclic Software 1262 A more serious concern is that CVS is not good at handling `' 1263entries when a branch is merged onto the main trunk. Conflicts often 1264result from the merging operation. 1265 1266 People also tend to "fix" the log entries in the file (correcting 1267spelling mistakes and maybe even factual errors). If that is done the 1268information from `cvs log' will not be consistent with the information 1269inside the file. This may or may not be a problem in real life. 1270 1271 It has been suggested that the `$Log: cvs.info-4,v $ 1272 It has been suggested that the `Revision 1.3 2001/09/30 19:44:54 tholo 1273 It has been suggested that the `Revert to distributed version 1274 It has been suggested that the ` 1275 It has been suggested that the `Revision 1.1.1.18 2001/09/28 22:48:51 tholo 1276 It has been suggested that the `Latest from Cyclic Software 1277 It has been suggested that the `' keyword should be inserted 1278_last_ in the file, and not in the files header, if it is to be used at 1279all. That way the long list of change messages will not interfere with 1280everyday source file browsing. 1281 1282 1283File: cvs.info, Node: Tracking sources, Next: Builds, Prev: Keyword substitution, Up: Top 1284 1285Tracking third-party sources 1286**************************** 1287 1288 If you modify a program to better fit your site, you probably want 1289to include your modifications when the next release of the program 1290arrives. CVS can help you with this task. 1291 1292 In the terminology used in CVS, the supplier of the program is 1293called a "vendor". The unmodified distribution from the vendor is 1294checked in on its own branch, the "vendor branch". CVS reserves branch 12951.1.1 for this use. 1296 1297 When you modify the source and commit it, your revision will end up 1298on the main trunk. When a new release is made by the vendor, you 1299commit it on the vendor branch and copy the modifications onto the main 1300trunk. 1301 1302 Use the `import' command to create and update the vendor branch. 1303When you import a new file, the vendor branch is made the `head' 1304revision, so anyone that checks out a copy of the file gets that 1305revision. When a local modification is committed it is placed on the 1306main trunk, and made the `head' revision. 1307 1308* Menu: 1309 1310* First import:: Importing for the first time 1311* Update imports:: Updating with the import command 1312* Reverting local changes:: Reverting to the latest vendor release 1313* Binary files in imports:: Binary files require special handling 1314* Keywords in imports:: Keyword substitution might be undesirable 1315* Multiple vendor branches:: What if you get sources from several places? 1316 1317