although you are free to select any location you wish.
/usr/local/cvsroot
You should add this line to your startup scripts so that the $CVSROOT variable is set each time a user logs in to the system.
$ export CVSROOT=/usr/local/cvsroot
This will create the directory $CVSROOT/CVSROOT, which contains administrative information for the CVS system.
$ cvs init
In this case, it would be a good idea to have CVS track the entire "community" area of the site, since you expect to be doing quite a bit of work on it. You can import the entire section, together with all the files and sub-directories under it, into CVS with the "import" command.|-- public_html | |-- community | | |-- columns | | |-- downloads | | `-- images | |-- company | | `-- images | `-- customers
Note that you need to run this command from the directory containing the files you wish to import. The -m tag provides a description for the imported files; this is followed by the name of the directory in the repository, a "vendor tag" containing information about the software vendor ["mfre"] and a "release tag" containing information about the current release of the software ["base"].
$ cvs import -m "community" community mfre base N community/index.php3 N community/functions.php3 N community/post.php3 N community/read.php3 N community/search.php3 No conflicts created by this import
command, and ensure that the source tree directory has the appropriate group ownerships.
$ groupadd
The CVS "cvs checkout" command, sometimes abbreviated as "cvs co", allows you to "check out" a complete or partial copy of the current source tree to a working directory so that you can make changes to it. You'll see a directory called CVS/ in your working directory as well - don't worry about it.
$ cvs checkout community cvs checkout: Updating community U community/functions.php3 U community/index.php3 U community/post.php3 U community/read.php3 U community/search.php3
Again, problems checking out or committing code at this stage are typically the result of a glitch in system file permissions, and are usually simple to fix.
$ cvs commit Added date() function to display time and date CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS: ' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: index.php3 CVS: ---------------------------------------------------------------------- Checking in index.php3; /usr/local/cvsroot/community/index.php3,v <-- index.php3 new revision: 1.2; previous revision: 1.1 done
The "cvs update" command also works with single files - to get the latest version of the file "lib.php3", you could use:
$ cvs update
The "cvs update" command typically prints a one-letter indicator next to each file - this could be
$ cvs update lib.php3
Once you've got your initial project going, you may often find it necessary to create new files in your working directory and add these to the existing source tree in the repository. CVS allows you to do this with the "cvs add" command.
$ cvs status functions.php3 =================================================================== File: functions.php3 Status: Up-to-date Working revision: 1.1.1.1 Tue Nov 14 06:26:23 2000 Repository revision: 1.1.1.1 /usr/local/cvsroot/community/functions.php3,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)
The file "sql.php3" must exist prior to running this command. At this point, CVS knows about the file and will schedule it to be added to the source tree; however, to actually add it, you need to commit it with the "cvs commit" command.
$ cvs add sql.php3 cvs add: scheduling file `sql.php3' for addition cvs add: use 'cvs commit' to add this file permanently
$ rm index.php3 $ cvs remove index.php3 cvs remove: scheduling `index.php3' for removal cvs remove: use 'cvs commit' to remove this file permanently
Note, however, that the version number that you stamp on the files must be higher than the existing version number of the files in the directory.
$ cvs commit -r 2.0 cvs commit: Examining . cvs commit: Committing . Checking in functions.php3; /usr/local/cvsroot/community/functions.php3,v <-- functions.php3 new revision: 2.0; previous revision: 1.1 done Checking in index.php3; /usr/local/cvsroot/community/index.php3,v <-- index.php3 new revision: 2.0; previous revision: 1.5 done Checking in post.php3; /usr/local/cvsroot/community/post.php3,v <-- post.php3 new revision: 2.0; previous revision: 1.1 done Checking in read.php3; /usr/local/cvsroot/community/read.php3,v <-- read.php3 new revision: 2.0; previous revision: 1.1 done Checking in search.php3; /usr/local/cvsroot/community/search.php3,v <-- search.php3 new revision: 2.0; previous revision: 1.1 done Checking in sql.php3; /usr/local/cvsroot/community/sql.php3,v <-- sql.php3 new revision: 2.0; previous revision: 1.1 done
Or, if you're at release 3.8 of a piece of code, you could tag all the files at the point like this:
$ cvs co -r base community
And, if at some time in the future you need to extract an image of the files at the time of "release-38", you can use:
$ cvs tag release-38 cvs tag: Tagging . T functions.php3 T index.php3 T post.php3 T read.php3 T search.php3
You can use the "cvs update" command to accomplish the same thing:
$ cvs co -r release-38 community cvs checkout: Updating community U community/functions.php3 U community/index.php3 U community/post.php3 U community/read.php3 U community/search.php3 U community/sql.php3
$ cvs update -r release-38 community
Now that the branch is tagged, you can check it out with the tag name and begin work on it.
$ cvs rtag -b -r release-20 release-20-personalized community cvs rtag: Tagging community
Note that creating a branch does not affect the main code tree - you can still check out version 2.8 of your file whenever you're in the mood to work on the upcoming release.
$ cvs co -r release-20-personalized community
Note, however, that merging files in this manner can result in conflicts between the different versions of the merged file - CVS will warn you if this happens.
$ cvs update -j release-20-personalized index.php3
or
$ cvs status
for information on a specific file.
$ cvs status <filename>
provides a list of tags currently active.
$ cvs status -v index.php3 =================================================================== File: index.php3 Status: Up-to-date Working revision: 2.0.2.1 Tue Nov 14 07:52:58 2000 Repository revision: 2.0.2.1 /usr/local/cvsroot/community/Attic/index.php3,v Sticky Tag: release-20-personalized (branch: 2.0.2) Sticky Date: (none) Sticky Options: (none) Existing Tags: release-20-personalized (branch: 2.0.2) release-20 (revision: 2.0) base (revision: 1.1.1.1) mfre (branch: 1.1.1)