xref: /openbsd/gnu/usr.bin/cvs/doc/cvs.info-1 (revision 4cfece93)
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: Top,  Next: Overview,  Up: (dir)
26
27
28
29   This info manual describes how to use and administer CVS version
301.11.1p1.
31
32* Menu:
33
34* Overview::                    An introduction to CVS
35* Repository::                  Where all your sources are stored
36* Starting a new project::      Starting a project with CVS
37* Revisions::                   Numeric and symbolic names for revisions
38* Branching and merging::       Diverging/rejoining branches of development
39* Recursive behavior::          CVS descends directories
40* Adding and removing::         Adding/removing/renaming files/directories
41* History browsing::            Viewing the history of files in various ways
42
43CVS and the Real World.
44-----------------------
45* Binary files::                CVS can handle binary files
46* Multiple developers::         How CVS helps a group of developers
47* Revision management::         Policy questions for revision management
48* Keyword substitution::        CVS can include the revision inside the file
49* Tracking sources::            Tracking third-party sources
50* Builds::                      Issues related to CVS and builds
51* Special Files::		Devices, links and other non-regular files
52
53References.
54-----------
55* CVS commands::                CVS commands share some things
56* Invoking CVS::                Quick reference to CVS commands
57* Administrative files::        Reference manual for the Administrative files
58* Environment variables::       All environment variables which affect CVS
59* Compatibility::               Upgrading CVS versions
60* Troubleshooting::             Some tips when nothing works
61* Credits::                     Some of the contributors to this manual
62* BUGS::                        Dealing with bugs in CVS or this manual
63* Index::                       Index
64
65
66File: cvs.info,  Node: Overview,  Next: Repository,  Prev: Top,  Up: Top
67
68Overview
69********
70
71   This chapter is for people who have never used CVS, and perhaps have
72never used version control software before.
73
74   If you are already familiar with CVS and are just trying to learn a
75particular feature or remember a certain command, you can probably skip
76everything here.
77
78* Menu:
79
80* What is CVS?::                What you can do with CVS
81* What is CVS not?::            Problems CVS doesn't try to solve
82* A sample session::            A tour of basic CVS usage
83
84
85File: cvs.info,  Node: What is CVS?,  Next: What is CVS not?,  Up: Overview
86
87What is CVS?
88============
89
90   CVS is a version control system.  Using it, you can record the
91history of your source files.
92
93   For example, bugs sometimes creep in when software is modified, and
94you might not detect the bug until a long time after you make the
95modification.  With CVS, you can easily retrieve old versions to see
96exactly which change caused the bug.  This can sometimes be a big help.
97
98   You could of course save every version of every file you have ever
99created.  This would however waste an enormous amount of disk space.
100CVS stores all the versions of a file in a single file in a clever way
101that only stores the differences between versions.
102
103   CVS also helps you if you are part of a group of people working on
104the same project.  It is all too easy to overwrite each others' changes
105unless you are extremely careful.  Some editors, like GNU Emacs, try to
106make sure that the same file is never modified by two people at the
107same time.  Unfortunately, if someone is using another editor, that
108safeguard will not work.  CVS solves this problem by insulating the
109different developers from each other.  Every developer works in his own
110directory, and CVS merges the work when each developer is done.
111
112   CVS started out as a bunch of shell scripts written by Dick Grune,
113posted to the newsgroup `comp.sources.unix' in the volume 6 release of
114December, 1986.  While no actual code from these shell scripts is
115present in the current version of CVS much of the CVS conflict
116resolution algorithms come from them.
117
118   In April, 1989, Brian Berliner designed and coded CVS.  Jeff Polk
119later helped Brian with the design of the CVS module and vendor branch
120support.
121
122   You can get CVS in a variety of ways, including free download from
123the internet.  For more information on downloading CVS and other CVS
124topics, see:
125
126     http://www.cvshome.org/
127     http://www.loria.fr/~molli/cvs-index.html
128
129   There is a mailing list, known as `info-cvs', devoted to CVS.  To
130subscribe or unsubscribe write to `info-cvs-request@gnu.org'.  If you
131prefer a usenet group, the right group is `comp.software.config-mgmt'
132which is for CVS discussions (along with other configuration management
133systems).  In the future, it might be possible to create a
134`comp.software.config-mgmt.cvs', but probably only if there is
135sufficient CVS traffic on `comp.software.config-mgmt'.
136
137   You can also subscribe to the bug-cvs mailing list, described in
138more detail in *Note BUGS::.  To subscribe send mail to
139bug-cvs-request@gnu.org.
140
141
142File: cvs.info,  Node: What is CVS not?,  Next: A sample session,  Prev: What is CVS?,  Up: Overview
143
144What is CVS not?
145================
146
147   CVS can do a lot of things for you, but it does not try to be
148everything for everyone.
149
150CVS is not a build system.
151     Though the structure of your repository and modules file interact
152     with your build system (e.g. `Makefile's), they are essentially
153     independent.
154
155     CVS does not dictate how you build anything.  It merely stores
156     files for retrieval in a tree structure you devise.
157
158     CVS does not dictate how to use disk space in the checked out
159     working directories.  If you write your `Makefile's or scripts in
160     every directory so they have to know the relative positions of
161     everything else, you wind up requiring the entire repository to be
162     checked out.
163
164     If you modularize your work, and construct a build system that
165     will share files (via links, mounts, `VPATH' in `Makefile's,
166     etc.), you can arrange your disk usage however you like.
167
168     But you have to remember that _any_ such system is a lot of work
169     to construct and maintain.  CVS does not address the issues
170     involved.
171
172     Of course, you should place the tools created to support such a
173     build system (scripts, `Makefile's, etc) under CVS.
174
175     Figuring out what files need to be rebuilt when something changes
176     is, again, something to be handled outside the scope of CVS.  One
177     traditional approach is to use `make' for building, and use some
178     automated tool for generating the dependencies which `make' uses.
179
180     See *Note Builds::, for more information on doing builds in
181     conjunction with CVS.
182
183CVS is not a substitute for management.
184     Your managers and project leaders are expected to talk to you
185     frequently enough to make certain you are aware of schedules,
186     merge points, branch names and release dates.  If they don't, CVS
187     can't help.
188
189     CVS is an instrument for making sources dance to your tune.  But
190     you are the piper and the composer.  No instrument plays itself or
191     writes its own music.
192
193CVS is not a substitute for developer communication.
194     When faced with conflicts within a single file, most developers
195     manage to resolve them without too much effort.  But a more
196     general definition of "conflict" includes problems too difficult
197     to solve without communication between developers.
198
199     CVS cannot determine when simultaneous changes within a single
200     file, or across a whole collection of files, will logically
201     conflict with one another.  Its concept of a "conflict" is purely
202     textual, arising when two changes to the same base file are near
203     enough to spook the merge (i.e. `diff3') command.
204
205     CVS does not claim to help at all in figuring out non-textual or
206     distributed conflicts in program logic.
207
208     For example: Say you change the arguments to function `X' defined
209     in file `A'.  At the same time, someone edits file `B', adding new
210     calls to function `X' using the old arguments.  You are outside
211     the realm of CVS's competence.
212
213     Acquire the habit of reading specs and talking to your peers.
214
215CVS does not have change control
216     Change control refers to a number of things.  First of all it can
217     mean "bug-tracking", that is being able to keep a database of
218     reported bugs and the status of each one (is it fixed?  in what
219     release?  has the bug submitter agreed that it is fixed?).  For
220     interfacing CVS to an external bug-tracking system, see the
221     `rcsinfo' and `verifymsg' files (*note Administrative files::).
222
223     Another aspect of change control is keeping track of the fact that
224     changes to several files were in fact changed together as one
225     logical change.  If you check in several files in a single `cvs
226     commit' operation, CVS then forgets that those files were checked
227     in together, and the fact that they have the same log message is
228     the only thing tying them together.  Keeping a GNU style
229     `ChangeLog' can help somewhat.
230
231     Another aspect of change control, in some systems, is the ability
232     to keep track of the status of each change.  Some changes have
233     been written by a developer, others have been reviewed by a second
234     developer, and so on.  Generally, the way to do this with CVS is to
235     generate a diff (using `cvs diff' or `diff') and email it to
236     someone who can then apply it using the `patch' utility.  This is
237     very flexible, but depends on mechanisms outside CVS to make sure
238     nothing falls through the cracks.
239
240CVS is not an automated testing program
241     It should be possible to enforce mandatory use of a testsuite
242     using the `commitinfo' file.  I haven't heard a lot about projects
243     trying to do that or whether there are subtle gotchas, however.
244
245CVS does not have a builtin process model
246     Some systems provide ways to ensure that changes or releases go
247     through various steps, with various approvals as needed.
248     Generally, one can accomplish this with CVS but it might be a
249     little more work.  In some cases you'll want to use the
250     `commitinfo', `loginfo', `rcsinfo', or `verifymsg' files, to
251     require that certain steps be performed before cvs will allow a
252     checkin.  Also consider whether features such as branches and tags
253     can be used to perform tasks such as doing work in a development
254     tree and then merging certain changes over to a stable tree only
255     once they have been proven.
256
257
258File: cvs.info,  Node: A sample session,  Prev: What is CVS not?,  Up: Overview
259
260A sample session
261================
262
263   As a way of introducing CVS, we'll go through a typical work-session
264using CVS.  The first thing to understand is that CVS stores all files
265in a centralized "repository" (*note Repository::); this section
266assumes that a repository is set up.
267
268   Suppose you are working on a simple compiler.  The source consists
269of a handful of C files and a `Makefile'.  The compiler is called `tc'
270(Trivial Compiler), and the repository is set up so that there is a
271module called `tc'.
272
273* Menu:
274
275* Getting the source::          Creating a workspace
276* Committing your changes::     Making your work available to others
277* Cleaning up::                 Cleaning up
278* Viewing differences::         Viewing differences
279
280
281File: cvs.info,  Node: Getting the source,  Next: Committing your changes,  Up: A sample session
282
283Getting the source
284------------------
285
286   The first thing you must do is to get your own working copy of the
287source for `tc'.  For this, you use the `checkout' command:
288
289     $ cvs checkout tc
290
291This will create a new directory called `tc' and populate it with the
292source files.
293
294     $ cd tc
295     $ ls
296     CVS         Makefile    backend.c   driver.c    frontend.c  parser.c
297
298   The `CVS' directory is used internally by CVS.  Normally, you should
299not modify or remove any of the files in it.
300
301   You start your favorite editor, hack away at `backend.c', and a
302couple of hours later you have added an optimization pass to the
303compiler.  A note to RCS and SCCS users: There is no need to lock the
304files that you want to edit.  *Note Multiple developers::, for an
305explanation.
306
307
308File: cvs.info,  Node: Committing your changes,  Next: Cleaning up,  Prev: Getting the source,  Up: A sample session
309
310Committing your changes
311-----------------------
312
313   When you have checked that the compiler is still compilable you
314decide to make a new version of `backend.c'.  This will store your new
315`backend.c' in the repository and make it available to anyone else who
316is using that same repository.
317
318     $ cvs commit backend.c
319
320CVS starts an editor, to allow you to enter a log message.  You type in
321"Added an optimization pass.", save the temporary file, and exit the
322editor.
323
324   The environment variable `$CVSEDITOR' determines which editor is
325started.  If `$CVSEDITOR' is not set, then if the environment variable
326`$EDITOR' is set, it will be used. If both `$CVSEDITOR' and `$EDITOR'
327are not set then there is a default which will vary with your operating
328system, for example `vi' for unix or `notepad' for Windows NT/95.
329
330   In addition, CVS checks the `$VISUAL' environment variable.
331Opinions vary on whether this behavior is desirable and whether future
332releases of CVS should check `$VISUAL' or ignore it.  You will be OK
333either way if you make sure that `$VISUAL' is either unset or set to
334the same thing as `$EDITOR'.
335
336   When CVS starts the editor, it includes a list of files which are
337modified.  For the CVS client, this list is based on comparing the
338modification time of the file against the modification time that the
339file had when it was last gotten or updated.  Therefore, if a file's
340modification time has changed but its contents have not, it will show
341up as modified.  The simplest way to handle this is simply not to worry
342about it--if you proceed with the commit CVS will detect that the
343contents are not modified and treat it as an unmodified file.  The next
344`update' will clue CVS in to the fact that the file is unmodified, and
345it will reset its stored timestamp so that the file will not show up in
346future editor sessions.
347
348   If you want to avoid starting an editor you can specify the log
349message on the command line using the `-m' flag instead, like this:
350
351     $ cvs commit -m "Added an optimization pass" backend.c
352
353
354File: cvs.info,  Node: Cleaning up,  Next: Viewing differences,  Prev: Committing your changes,  Up: A sample session
355
356Cleaning up
357-----------
358
359   Before you turn to other tasks you decide to remove your working
360copy of tc.  One acceptable way to do that is of course
361
362     $ cd ..
363     $ rm -r tc
364
365but a better way is to use the `release' command (*note release::):
366
367     $ cd ..
368     $ cvs release -d tc
369     M driver.c
370     ? tc
371     You have [1] altered files in this repository.
372     Are you sure you want to release (and delete) directory `tc': n
373     ** `release' aborted by user choice.
374
375   The `release' command checks that all your modifications have been
376committed.  If history logging is enabled it also makes a note in the
377history file.  *Note history file::.
378
379   When you use the `-d' flag with `release', it also removes your
380working copy.
381
382   In the example above, the `release' command wrote a couple of lines
383of output.  `? tc' means that the file `tc' is unknown to CVS.  That is
384nothing to worry about: `tc' is the executable compiler, and it should
385not be stored in the repository.  *Note cvsignore::, for information
386about how to make that warning go away.  *Note release output::, for a
387complete explanation of all possible output from `release'.
388
389   `M driver.c' is more serious.  It means that the file `driver.c' has
390been modified since it was checked out.
391
392   The `release' command always finishes by telling you how many
393modified files you have in your working copy of the sources, and then
394asks you for confirmation before deleting any files or making any note
395in the history file.
396
397   You decide to play it safe and answer `n <RET>' when `release' asks
398for confirmation.
399
400
401File: cvs.info,  Node: Viewing differences,  Prev: Cleaning up,  Up: A sample session
402
403Viewing differences
404-------------------
405
406   You do not remember modifying `driver.c', so you want to see what
407has happened to that file.
408
409     $ cd tc
410     $ cvs diff driver.c
411
412   This command runs `diff' to compare the version of `driver.c' that
413you checked out with your working copy.  When you see the output you
414remember that you added a command line option that enabled the
415optimization pass.  You check it in, and release the module.
416
417     $ cvs commit -m "Added an optimization pass" driver.c
418     Checking in driver.c;
419     /usr/local/cvsroot/tc/driver.c,v  <--  driver.c
420     new revision: 1.2; previous revision: 1.1
421     done
422     $ cd ..
423     $ cvs release -d tc
424     ? tc
425     You have [0] altered files in this repository.
426     Are you sure you want to release (and delete) directory `tc': y
427
428
429File: cvs.info,  Node: Repository,  Next: Starting a new project,  Prev: Overview,  Up: Top
430
431The Repository
432**************
433
434   The CVS "repository" stores a complete copy of all the files and
435directories which are under version control.
436
437   Normally, you never access any of the files in the repository
438directly.  Instead, you use CVS commands to get your own copy of the
439files into a "working directory", and then work on that copy.  When
440you've finished a set of changes, you check (or "commit") them back
441into the repository.  The repository then contains the changes which
442you have made, as well as recording exactly what you changed, when you
443changed it, and other such information.  Note that the repository is
444not a subdirectory of the working directory, or vice versa; they should
445be in separate locations.
446
447   CVS can access a repository by a variety of means.  It might be on
448the local computer, or it might be on a computer across the room or
449across the world.  To distinguish various ways to access a repository,
450the repository name can start with an "access method".  For example,
451the access method `:local:' means to access a repository directory, so
452the repository `:local:/usr/local/cvsroot' means that the repository is
453in `/usr/local/cvsroot' on the computer running CVS.  For information
454on other access methods, see *Note Remote repositories::.
455
456   If the access method is omitted, then if the repository does not
457contain `:', then `:local:' is assumed.  If it does contain `:' then
458either `:ext:' or `:server:' is assumed.  For example, if you have a
459local repository in `/usr/local/cvsroot', you can use
460`/usr/local/cvsroot' instead of `:local:/usr/local/cvsroot'.  But if
461(under Windows NT, for example) your local repository is
462`c:\src\cvsroot', then you must specify the access method, as in
463`:local:c:\src\cvsroot'.
464
465   The repository is split in two parts.  `$CVSROOT/CVSROOT' contains
466administrative files for CVS.  The other directories contain the actual
467user-defined modules.
468
469* Menu:
470
471* Specifying a repository::     Telling CVS where your repository is
472* Repository storage::          The structure of the repository
473* Working directory storage::   The structure of working directories
474* Intro administrative files::  Defining modules
475* Multiple repositories::       Multiple repositories
476* Creating a repository::       Creating a repository
477* Backing up::                  Backing up a repository
478* Moving a repository::         Moving a repository
479* Remote repositories::         Accessing repositories on remote machines
480* Read-only access::            Granting read-only access to the repository
481* Server temporary directory::  The server creates temporary directories
482
483
484File: cvs.info,  Node: Specifying a repository,  Next: Repository storage,  Up: Repository
485
486Telling CVS where your repository is
487====================================
488
489   There are several ways to tell CVS where to find the repository.
490You can name the repository on the command line explicitly, with the
491`-d' (for "directory") option:
492
493     cvs -d /usr/local/cvsroot checkout yoyodyne/tc
494
495   Or you can set the `$CVSROOT' environment variable to an absolute
496path to the root of the repository, `/usr/local/cvsroot' in this
497example.  To set `$CVSROOT', `csh' and `tcsh' users should have this
498line in their `.cshrc' or `.tcshrc' files:
499
500     setenv CVSROOT /usr/local/cvsroot
501
502`sh' and `bash' users should instead have these lines in their
503`.profile' or `.bashrc':
504
505     CVSROOT=/usr/local/cvsroot
506     export CVSROOT
507
508   A repository specified with `-d' will override the `$CVSROOT'
509environment variable.  Once you've checked a working copy out from the
510repository, it will remember where its repository is (the information
511is recorded in the `CVS/Root' file in the working copy).
512
513   The `-d' option and the `CVS/Root' file both override the `$CVSROOT'
514environment variable.  If `-d' option differs from `CVS/Root', the
515former is used.  Of course, for proper operation they should be two
516ways of referring to the same repository.
517
518
519File: cvs.info,  Node: Repository storage,  Next: Working directory storage,  Prev: Specifying a repository,  Up: Repository
520
521How data is stored in the repository
522====================================
523
524   For most purposes it isn't important _how_ CVS stores information in
525the repository.  In fact, the format has changed in the past, and is
526likely to change in the future.  Since in almost all cases one accesses
527the repository via CVS commands, such changes need not be disruptive.
528
529   However, in some cases it may be necessary to understand how CVS
530stores data in the repository, for example you might need to track down
531CVS locks (*note Concurrency::) or you might need to deal with the file
532permissions appropriate for the repository.
533
534* Menu:
535
536* Repository files::            What files are stored in the repository
537* File permissions::            File permissions
538* Windows permissions::         Issues specific to Windows
539* Attic::                       Some files are stored in the Attic
540* CVS in repository::           Additional information in CVS directory
541* Locks::                       CVS locks control concurrent accesses
542* CVSROOT storage::             A few things about CVSROOT are different
543
544
545File: cvs.info,  Node: Repository files,  Next: File permissions,  Up: Repository storage
546
547Where files are stored within the repository
548--------------------------------------------
549
550   The overall structure of the repository is a directory tree
551corresponding to the directories in the working directory.  For
552example, supposing the repository is in
553
554     /usr/local/cvsroot
555
556here is a possible directory tree (showing only the directories):
557
558     /usr
559      |
560      +--local
561      |   |
562      |   +--cvsroot
563      |   |    |
564      |   |    +--CVSROOT
565               |      (administrative files)
566               |
567               +--gnu
568               |   |
569               |   +--diff
570               |   |   (source code to GNU diff)
571               |   |
572               |   +--rcs
573               |   |   (source code to RCS)
574               |   |
575               |   +--cvs
576               |       (source code to CVS)
577               |
578               +--yoyodyne
579                   |
580                   +--tc
581                   |    |
582                   |    +--man
583                   |    |
584                   |    +--testing
585                   |
586                   +--(other Yoyodyne software)
587
588   With the directories are "history files" for each file under version
589control.  The name of the history file is the name of the corresponding
590file with `,v' appended to the end.  Here is what the repository for
591the `yoyodyne/tc' directory might look like:
592       `$CVSROOT'
593         |
594         +--yoyodyne
595         |   |
596         |   +--tc
597         |   |   |
598                 +--Makefile,v
599                 +--backend.c,v
600                 +--driver.c,v
601                 +--frontend.c,v
602                 +--parser.c,v
603                 +--man
604                 |    |
605                 |    +--tc.1,v
606                 |
607                 +--testing
608                      |
609                      +--testpgm.t,v
610                      +--test2.t,v
611
612   The history files contain, among other things, enough information to
613recreate any revision of the file, a log of all commit messages and the
614user-name of the person who committed the revision.  The history files
615are known as "RCS files", because the first program to store files in
616that format was a version control system known as RCS.  For a full
617description of the file format, see the `man' page `rcsfile(5)',
618distributed with RCS, or the file `doc/RCSFILES' in the CVS source
619distribution.  This file format has become very common--many systems
620other than CVS or RCS can at least import history files in this format.
621
622   The RCS files used in CVS differ in a few ways from the standard
623format.  The biggest difference is magic branches; for more information
624see *Note Magic branch numbers::.  Also in CVS the valid tag names are
625a subset of what RCS accepts; for CVS's rules see *Note Tags::.
626
627
628File: cvs.info,  Node: File permissions,  Next: Windows permissions,  Prev: Repository files,  Up: Repository storage
629
630File permissions
631----------------
632
633   All `,v' files are created read-only, and you should not change the
634permission of those files.  The directories inside the repository
635should be writable by the persons that have permission to modify the
636files in each directory.  This normally means that you must create a
637UNIX group (see group(5)) consisting of the persons that are to edit
638the files in a project, and set up the repository so that it is that
639group that owns the directory.
640
641   This means that you can only control access to files on a
642per-directory basis.
643
644   Note that users must also have write access to check out files,
645because CVS needs to create lock files (*note Concurrency::).
646
647   Also note that users must have write access to the
648`CVSROOT/val-tags' file.  CVS uses it to keep track of what tags are
649valid tag names (it is sometimes updated when tags are used, as well as
650when they are created).
651
652   Each RCS file will be owned by the user who last checked it in.
653This has little significance; what really matters is who owns the
654directories.
655
656   CVS tries to set up reasonable file permissions for new directories
657that are added inside the tree, but you must fix the permissions
658manually when a new directory should have different permissions than its
659parent directory.  If you set the `CVSUMASK' environment variable that
660will control the file permissions which CVS uses in creating directories
661and/or files in the repository.  `CVSUMASK' does not affect the file
662permissions in the working directory; such files have the permissions
663which are typical for newly created files, except that sometimes CVS
664creates them read-only (see the sections on watches, *Note Setting a
665watch::; -r, *Note Global options::; or `CVSREAD', *Note Environment
666variables::).
667
668   Note that using the client/server CVS (*note Remote repositories::),
669there is no good way to set `CVSUMASK'; the setting on the client
670machine has no effect.  If you are connecting with `rsh', you can set
671`CVSUMASK' in `.bashrc' or `.cshrc', as described in the documentation
672for your operating system.  This behavior might change in future
673versions of CVS; do not rely on the setting of `CVSUMASK' on the client
674having no effect.
675
676   Using pserver, you will generally need stricter permissions on the
677CVSROOT directory and directories above it in the tree; see *Note
678Password authentication security::.
679
680   Some operating systems have features which allow a particular
681program to run with the ability to perform operations which the caller
682of the program could not.  For example, the set user ID (setuid) or set
683group ID (setgid) features of unix or the installed image feature of
684VMS.  CVS was not written to use such features and therefore attempting
685to install CVS in this fashion will provide protection against only
686accidental lapses; anyone who is trying to circumvent the measure will
687be able to do so, and depending on how you have set it up may gain
688access to more than just CVS.  You may wish to instead consider
689pserver.  It shares some of the same attributes, in terms of possibly
690providing a false sense of security or opening security holes wider
691than the ones you are trying to fix, so read the documentation on
692pserver security carefully if you are considering this option (*Note
693Password authentication security::).
694
695
696File: cvs.info,  Node: Windows permissions,  Next: Attic,  Prev: File permissions,  Up: Repository storage
697
698File Permission issues specific to Windows
699------------------------------------------
700
701   Some file permission issues are specific to Windows operating
702systems (Windows 95, Windows NT, and presumably future operating
703systems in this family.  Some of the following might apply to OS/2 but
704I'm not sure).
705
706   If you are using local CVS and the repository is on a networked file
707system which is served by the Samba SMB server, some people have
708reported problems with permissions.  Enabling WRITE=YES in the samba
709configuration is said to fix/workaround it.  Disclaimer: I haven't
710investigated enough to know the implications of enabling that option,
711nor do I know whether there is something which CVS could be doing
712differently in order to avoid the problem.  If you find something out,
713please let us know as described in *Note BUGS::.
714
715
716File: cvs.info,  Node: Attic,  Next: CVS in repository,  Prev: Windows permissions,  Up: Repository storage
717
718The attic
719---------
720
721   You will notice that sometimes CVS stores an RCS file in the
722`Attic'.  For example, if the CVSROOT is `/usr/local/cvsroot' and we are
723talking about the file `backend.c' in the directory `yoyodyne/tc', then
724the file normally would be in
725
726     /usr/local/cvsroot/yoyodyne/tc/backend.c,v
727
728   but if it goes in the attic, it would be in
729
730     /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
731
732   instead.  It should not matter from a user point of view whether a
733file is in the attic; CVS keeps track of this and looks in the attic
734when it needs to.  But in case you want to know, the rule is that the
735RCS file is stored in the attic if and only if the head revision on the
736trunk has state `dead'.  A `dead' state means that file has been
737removed, or never added, for that revision.  For example, if you add a
738file on a branch, it will have a trunk revision in `dead' state, and a
739branch revision in a non-`dead' state.
740
741
742File: cvs.info,  Node: CVS in repository,  Next: Locks,  Prev: Attic,  Up: Repository storage
743
744The CVS directory in the repository
745-----------------------------------
746
747   The `CVS' directory in each repository directory contains
748information such as file attributes (in a file called `CVS/fileattr'.
749In the future additional files may be added to this directory, so
750implementations should silently ignore additional files.
751
752   This behavior is implemented only by CVS 1.7 and later; for details
753see *Note Watches Compatibility::.
754
755   The format of the fileattr file is a series of entries of the
756following form (where `{' and `}' means the text between the braces can
757be repeated zero or more times):
758
759   ENT-TYPE FILENAME <tab> ATTRNAME = ATTRVAL   {; ATTRNAME = ATTRVAL}
760<linefeed>
761
762   ENT-TYPE is `F' for a file, in which case the entry specifies the
763attributes for that file.
764
765   ENT-TYPE is `D', and FILENAME empty, to specify default attributes
766to be used for newly added files.
767
768   Other ENT-TYPE are reserved for future expansion.  CVS 1.9 and older
769will delete them any time it writes file attributes.  CVS 1.10 and
770later will preserve them.
771
772   Note that the order of the lines is not significant; a program
773writing the fileattr file may rearrange them at its convenience.
774
775   There is currently no way of quoting tabs or linefeeds in the
776filename, `=' in ATTRNAME, `;' in ATTRVAL, etc.  Note: some
777implementations also don't handle a NUL character in any of the fields,
778but implementations are encouraged to allow it.
779
780   By convention, ATTRNAME starting with `_' is for an attribute given
781special meaning by CVS; other ATTRNAMEs are for user-defined attributes
782(or will be, once implementations start supporting user-defined
783attributes).
784
785   Builtin attributes:
786
787`_watched'
788     Present means the file is watched and should be checked out
789     read-only.
790
791`_watchers'
792     Users with watches for this file.  Value is WATCHER > TYPE { ,
793     WATCHER > TYPE } where WATCHER is a username, and TYPE is zero or
794     more of edit,unedit,commit separated by `+' (that is, nothing if
795     none; there is no "none" or "all" keyword).
796
797`_editors'
798     Users editing this file.  Value is EDITOR > VAL { , EDITOR > VAL }
799     where EDITOR is a username, and VAL is TIME+HOSTNAME+PATHNAME,
800     where TIME is when the `cvs edit' command (or equivalent) happened,
801     and HOSTNAME and PATHNAME are for the working directory.
802
803   Example:
804
805     Ffile1 _watched=;_watchers=joe>edit,mary>commit
806     Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
807     D _watched=
808
809   means that the file `file1' should be checked out read-only.
810Furthermore, joe is watching for edits and mary is watching for
811commits.  The file `file2' should be checked out read-only; sue started
812editing it on 8 Jan 1975 in the directory `/home/sue/cvs' on the
813machine `workstn1'.  Future files which are added should be checked out
814read-only.  To represent this example here, we have shown a space after
815`D', `Ffile1', and `Ffile2', but in fact there must be a single tab
816character there and no spaces.
817
818
819File: cvs.info,  Node: Locks,  Next: CVSROOT storage,  Prev: CVS in repository,  Up: Repository storage
820
821CVS locks in the repository
822---------------------------
823
824   For an introduction to CVS locks focusing on user-visible behavior,
825see *Note Concurrency::.  The following section is aimed at people who
826are writing tools which want to access a CVS repository without
827interfering with other tools acessing the same repository.  If you find
828yourself confused by concepts described here, like "read lock", "write
829lock", and "deadlock", you might consult the literature on operating
830systems or databases.
831
832   Any file in the repository with a name starting with `#cvs.rfl.' is
833a read lock.  Any file in the repository with a name starting with
834`#cvs.wfl' is a write lock.  Old versions of CVS (before CVS 1.5) also
835created files with names starting with `#cvs.tfl', but they are not
836discussed here.  The directory `#cvs.lock' serves as a master lock.
837That is, one must obtain this lock first before creating any of the
838other locks.
839
840   To obtain a readlock, first create the `#cvs.lock' directory.  This
841operation must be atomic (which should be true for creating a directory
842under most operating systems).  If it fails because the directory
843already existed, wait for a while and try again.  After obtaining the
844`#cvs.lock' lock, create a file whose name is `#cvs.rfl.' followed by
845information of your choice (for example, hostname and process
846identification number).  Then remove the `#cvs.lock' directory to
847release the master lock.  Then proceed with reading the repository.
848When you are done, remove the `#cvs.rfl' file to release the read lock.
849
850   To obtain a writelock, first create the `#cvs.lock' directory, as
851with a readlock.  Then check that there are no files whose names start
852with `#cvs.rfl.'.  If there are, remove `#cvs.lock', wait for a while,
853and try again.  If there are no readers, then create a file whose name
854is `#cvs.wfl' followed by information of your choice (for example,
855hostname and process identification number).  Hang on to the
856`#cvs.lock' lock.  Proceed with writing the repository.  When you are
857done, first remove the `#cvs.wfl' file and then the `#cvs.lock'
858directory. Note that unlike the `#cvs.rfl' file, the `#cvs.wfl' file is
859just informational; it has no effect on the locking operation beyond
860what is provided by holding on to the `#cvs.lock' lock itself.
861
862   Note that each lock (writelock or readlock) only locks a single
863directory in the repository, including `Attic' and `CVS' but not
864including subdirectories which represent other directories under
865version control.  To lock an entire tree, you need to lock each
866directory (note that if you fail to obtain any lock you need, you must
867release the whole tree before waiting and trying again, to avoid
868deadlocks).
869
870   Note also that CVS expects writelocks to control access to
871individual `foo,v' files.  RCS has a scheme where the `,foo,' file
872serves as a lock, but CVS does not implement it and so taking out a CVS
873writelock is recommended.  See the comments at rcs_internal_lockfile in
874the CVS source code for further discussion/rationale.
875
876
877File: cvs.info,  Node: CVSROOT storage,  Prev: Locks,  Up: Repository storage
878
879How files are stored in the CVSROOT directory
880---------------------------------------------
881
882   The `$CVSROOT/CVSROOT' directory contains the various administrative
883files.  In some ways this directory is just like any other directory in
884the repository; it contains RCS files whose names end in `,v', and many
885of the CVS commands operate on it the same way.  However, there are a
886few differences.
887
888   For each administrative file, in addition to the RCS file, there is
889also a checked out copy of the file.  For example, there is an RCS file
890`loginfo,v' and a file `loginfo' which contains the latest revision
891contained in `loginfo,v'.  When you check in an administrative file,
892CVS should print
893
894     cvs commit: Rebuilding administrative file database
895
896and update the checked out copy in `$CVSROOT/CVSROOT'.  If it does not,
897there is something wrong (*note BUGS::).  To add your own files to the
898files to be updated in this fashion, you can add them to the
899`checkoutlist' administrative file (*note checkoutlist::).
900
901   By default, the `modules' file behaves as described above.  If the
902modules file is very large, storing it as a flat text file may make
903looking up modules slow (I'm not sure whether this is as much of a
904concern now as when CVS first evolved this feature; I haven't seen
905benchmarks).  Therefore, by making appropriate edits to the CVS source
906code one can store the modules file in a database which implements the
907`ndbm' interface, such as Berkeley db or GDBM.  If this option is in
908use, then the modules database will be stored in the files `modules.db',
909`modules.pag', and/or `modules.dir'.
910
911   For information on the meaning of the various administrative files,
912see *Note Administrative files::.
913
914
915File: cvs.info,  Node: Working directory storage,  Next: Intro administrative files,  Prev: Repository storage,  Up: Repository
916
917How data is stored in the working directory
918===========================================
919
920   While we are discussing CVS internals which may become visible from
921time to time, we might as well talk about what CVS puts in the `CVS'
922directories in the working directories.  As with the repository, CVS
923handles this information and one can usually access it via CVS
924commands.  But in some cases it may be useful to look at it, and other
925programs, such as the `jCVS' graphical user interface or the `VC'
926package for emacs, may need to look at it.  Such programs should follow
927the recommendations in this section if they hope to be able to work
928with other programs which use those files, including future versions of
929the programs just mentioned and the command-line CVS client.
930
931   The `CVS' directory contains several files.  Programs which are
932reading this directory should silently ignore files which are in the
933directory but which are not documented here, to allow for future
934expansion.
935
936   The files are stored according to the text file convention for the
937system in question.  This means that working directories are not
938portable between systems with differing conventions for storing text
939files.  This is intentional, on the theory that the files being managed
940by CVS probably will not be portable between such systems either.
941
942`Root'
943     This file contains the current CVS root, as described in *Note
944     Specifying a repository::.
945
946`Repository'
947     This file contains the directory within the repository which the
948     current directory corresponds with.  It can be either an absolute
949     pathname or a relative pathname; CVS has had the ability to read
950     either format since at least version 1.3 or so.  The relative
951     pathname is relative to the root, and is the more sensible
952     approach, but the absolute pathname is quite common and
953     implementations should accept either.  For example, after the
954     command
955
956          cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
957
958     `Root' will contain
959
960          :local:/usr/local/cvsroot
961
962     and `Repository' will contain either
963
964          /usr/local/cvsroot/yoyodyne/tc
965
966     or
967
968          yoyodyne/tc
969
970     If the particular working directory does not correspond to a
971     directory in the repository, then `Repository' should contain
972     `CVSROOT/Emptydir'.
973
974`Entries'
975     This file lists the files and directories in the working directory.
976     The first character of each line indicates what sort of line it
977     is.  If the character is unrecognized, programs reading the file
978     should silently skip that line, to allow for future expansion.
979
980     If the first character is `/', then the format is:
981
982          /NAME/REVISION/TIMESTAMP[+CONFLICT]/OPTIONS/TAGDATE
983
984     where `[' and `]' are not part of the entry, but instead indicate
985     that the `+' and conflict marker are optional.  NAME is the name
986     of the file within the directory.  REVISION is the revision that
987     the file in the working derives from, or `0' for an added file, or
988     `-' followed by a revision for a removed file.  TIMESTAMP is the
989     timestamp of the file at the time that CVS created it; if the
990     timestamp differs with the actual modification time of the file it
991     means the file has been modified.  It is stored in the format used
992     by the ISO C asctime() function (for example, `Sun Apr  7 01:29:26
993     1996').  One may write a string which is not in that format, for
994     example, `Result of merge', to indicate that the file should
995     always be considered to be modified.  This is not a special case;
996     to see whether a file is modified a program should take the
997     timestamp of the file and simply do a string compare with
998     TIMESTAMP.  If there was a conflict, CONFLICT can be set to the
999     modification time of the file after the file has been written with
1000     conflict markers (*note Conflicts example::).  Thus if CONFLICT is
1001     subsequently the same as the actual modification time of the file
1002     it means that the user has obviously not resolved the conflict.
1003     OPTIONS contains sticky options (for example `-kb' for a binary
1004     file).  TAGDATE contains `T' followed by a tag name, or `D' for a
1005     date, followed by a sticky tag or date.  Note that if TIMESTAMP
1006     contains a pair of timestamps separated by a space, rather than a
1007     single timestamp, you are dealing with a version of CVS earlier
1008     than CVS 1.5 (not documented here).
1009
1010     The timezone on the timestamp in CVS/Entries (local or universal)
1011     should be the same as the operating system stores for the
1012     timestamp of the file itself.  For example, on Unix the file's
1013     timestamp is in universal time (UT), so the timestamp in
1014     CVS/Entries should be too.  On VMS, the file's timestamp is in
1015     local time, so CVS on VMS should use local time.  This rule is so
1016     that files do not appear to be modified merely because the
1017     timezone changed (for example, to or from summer time).
1018
1019     If the first character of a line in `Entries' is `D', then it
1020     indicates a subdirectory.  `D' on a line all by itself indicates
1021     that the program which wrote the `Entries' file does record
1022     subdirectories (therefore, if there is such a line and no other
1023     lines beginning with `D', one knows there are no subdirectories).
1024     Otherwise, the line looks like:
1025
1026          D/NAME/FILLER1/FILLER2/FILLER3/FILLER4
1027
1028     where NAME is the name of the subdirectory, and all the FILLER
1029     fields should be silently ignored, for future expansion.  Programs
1030     which modify `Entries' files should preserve these fields.
1031
1032     The lines in the `Entries' file can be in any order.
1033
1034`Entries.Log'
1035     This file does not record any information beyond that in
1036     `Entries', but it does provide a way to update the information
1037     without having to rewrite the entire `Entries' file, including the
1038     ability to preserve the information even if the program writing
1039     `Entries' and `Entries.Log' abruptly aborts.  Programs which are
1040     reading the `Entries' file should also check for `Entries.Log'.
1041     If the latter exists, they should read `Entries' and then apply
1042     the changes mentioned in `Entries.Log'.  After applying the
1043     changes, the recommended practice is to rewrite `Entries' and then
1044     delete `Entries.Log'.  The format of a line in `Entries.Log' is a
1045     single character command followed by a space followed by a line in
1046     the format specified for a line in `Entries'.  The single
1047     character command is `A' to indicate that the entry is being added,
1048     `R' to indicate that the entry is being removed, or any other
1049     character to indicate that the entire line in `Entries.Log' should
1050     be silently ignored (for future expansion).  If the second
1051     character of the line in `Entries.Log' is not a space, then it was
1052     written by an older version of CVS (not documented here).
1053
1054     Programs which are writing rather than reading can safely ignore
1055     `Entries.Log' if they so choose.
1056
1057`Entries.Backup'
1058     This is a temporary file.  Recommended usage is to write a new
1059     entries file to `Entries.Backup', and then to rename it
1060     (atomically, where possible) to `Entries'.
1061
1062`Entries.Static'
1063     The only relevant thing about this file is whether it exists or
1064     not.  If it exists, then it means that only part of a directory
1065     was gotten and CVS will not create additional files in that
1066     directory.  To clear it, use the `update' command with the `-d'
1067     option, which will get the additional files and remove
1068     `Entries.Static'.
1069
1070`Tag'
1071     This file contains per-directory sticky tags or dates.  The first
1072     character is `T' for a branch tag, `N' for a non-branch tag, or
1073     `D' for a date, or another character to mean the file should be
1074     silently ignored, for future expansion.  This character is
1075     followed by the tag or date.  Note that per-directory sticky tags
1076     or dates are used for things like applying to files which are
1077     newly added; they might not be the same as the sticky tags or
1078     dates on individual files.  For general information on sticky tags
1079     and dates, see *Note Sticky tags::.
1080
1081`Checkin.prog'
1082`Update.prog'
1083     These files store the programs specified by the `-i' and `-u'
1084     options in the modules file, respectively.
1085
1086`Notify'
1087     This file stores notifications (for example, for `edit' or
1088     `unedit') which have not yet been sent to the server.  Its format
1089     is not yet documented here.
1090
1091`Notify.tmp'
1092     This file is to `Notify' as `Entries.Backup' is to `Entries'.
1093     That is, to write `Notify', first write the new contents to
1094     `Notify.tmp' and then (atomically where possible), rename it to
1095     `Notify'.
1096
1097`Base'
1098     If watches are in use, then an `edit' command stores the original
1099     copy of the file in the `Base' directory.  This allows the
1100     `unedit' command to operate even if it is unable to communicate
1101     with the server.
1102
1103`Baserev'
1104     The file lists the revision for each of the files in the `Base'
1105     directory.  The format is:
1106
1107          BNAME/REV/EXPANSION
1108
1109     where EXPANSION should be ignored, to allow for future expansion.
1110
1111`Baserev.tmp'
1112     This file is to `Baserev' as `Entries.Backup' is to `Entries'.
1113     That is, to write `Baserev', first write the new contents to
1114     `Baserev.tmp' and then (atomically where possible), rename it to
1115     `Baserev'.
1116
1117`Template'
1118     This file contains the template specified by the `rcsinfo' file
1119     (*note rcsinfo::).  It is only used by the client; the
1120     non-client/server CVS consults `rcsinfo' directly.
1121
1122