CEN4020: Software Engineering I | up↑ |
These are notes originally produced for the Linux kernel and device driver course, supplemented with some personal notes by student Mark Stanovich. A more polished introduction to CVS can be found at the SCS website http://sc.fsu.edu/computing/tech-docs/226-cvs-information.
By the way, support for CVS is built into the Eclipse IDE. See http://www.ibm.com/developerworks/library/os-ecshare/ for an article on this.
The following instructions mostly assume you are working from linprog.cs.fsu.edu with username your_id.
Log into linprog.cs.fsu.edu, or whatever other system you will be using to hold the working copies of your files.
Execute 'mkdir CVSROOT' in your home directory.
Assuming that you are using bash shell, open the .bashrc file and add the following line somewhere in the file:
export CVSROOT=/home/grads/<your_userid>/CVSROOTwhere <your_userid> is your userid in the computer science department servers. (If there already is another CVSROOT variable exported, the please comment it out by inserting the # symbol in front of it.)
Execute 'source ~/.bashrc'
Execute 'cvs init'
Now your cvs environment is initialized on department servers.
*BIG FAT WARNING*: Never ever modify the files inside the cvsroot directory manually. These files have version tags that only the CVS software understands. If you change it yourself, the repository gets corrupted.
Log into the machine where you have a copy of the source code that you want to check in. For example, if your source code is on device12.cs.fsu.edu then log into device12.cs.fsu.edu.
Assuming that you are using bash shell, open the .bashrc file and add the following two lines somewhere in the file.
export CVSROOT=:ext:<your_userid>@linprog:/home/grads/<your_userid>/CVSROOT export CVS_RSH=sshwhere <your_userid> is your userid in the computer science department servers. (If there already are other CVSROOT and CVS_RSH variables exported, then please comment them out by inserting the # symbol in front of them.)
Execute
source ~/.bashrc
cd my_projects/
(replace my_projects with the name of your working directory).
Execute
cvs import my_projects "init" "v1"
When prompted for password, please enter the CS department password.
This command will create a cvs repository named my_projects in the CS department server and import all the files in the current directory to the server.
You can replace my_projects with whatever other name you wish to choose.
Now your source code is imported into the CVS repository
Do this whenever you want to check out a local copy of the source code from scratch from the department servers.
Log into the machine where you want to work with your source code (e.g. device12.cs.fsu.edu)
Rename your original my_projects directory to something else. (don't delete it until you successfully check out another copy from the department servers).
Execute
cvs co my_projects
Enter your password when prompted. This command will check out a local copy of your source code repository from the department server.
You will notice that the checked out directory my_projects/ has a subdirectory named CVS/. So does every other subdirectory under my_projects. This is CVS specific information. *NEVER* change the contents of this directory manually yourself.
Whenever you want to work on your source code, make changes to the local copy you checked out using step C above. Local copy means the copy you checked out on your work machine (e.g. device12.cs.fsu.edu)
When you are done making changes, cd to the 'my_projects' directory.
Execute
cvs update
You will see a bunch of messages with different tags against different files you have modified as CVS tries to merge the files you changed. Watch the messages for any conflict warnings. Conflicts mean that the changes you made and the copy in the repository are no consistent. Open the local files that report a conflict. You will see CVS tags inside the files that indicates where CVS has found conflicts. Resolve these conflicts manually by deleting the parts that seem old or incorrect. (Hopefully you'll rarely have to resolve conflicts).
Execute
cvs commit -m ""
where
The following notes are from CS student, Mark Stanovich, explaining how he uses CVS.
cvs import project_directory_location vendor start
cvs commit
cvs add directory_or_filename
Take care to do cvs commit
after.
The following are useful for adding an entire directory to a CVS repository.
find . -type d -print | grep -v CVS | xargs -I{} cvs add {} find . -type f -print | grep -v CVS | xargs -I{} cvs add {}
This can be done as a single line, also:
find . -type d -print | grep -v CVS | xargs -I{} cvs add {}; find . -type f -print | grep -v CVS | xargs -I{} cvs add {}
find . -name "CVS" -exec rm -r {} \;
(cvs update -d 2>&1) | grep -v '^cvs update: Updating'
This only works with the bash shell.
cvs co -d new_dir project_name
cvsd-passwd /var/lib/cvsd/root USER_NAME
Then add the user to one of the following:
/var/lib/cvsd/root/CVSROOT/readers /var/lib/cvsd/root/CVSROOT/writers
If the user is in readers, then the user will only have read access even if the user is in the writers file.
cvs remove
cvs update -A
To change group ownership:
chgrp -R group_name /var/lib/cvsrepository
New directories will still have the default group ownership of the user that creates them. To give all directories the group owner use the setgid bit.
chmod g+s /var/lib/cvsrepository chmod g+s /var/lib/cvsrepository/CVSROOT
Create any directories that exist in the repository if they're missing from the working directory. Normally, update acts only on directories and files that were already enrolled in your working directory.
This is useful for updating directories that were created in the repository since the initial checkout; but it has an unfortunate side effect. If you deliberately avoided certain directories in the repository when you created your working directory (either through use of a module name or by listing explicitly the files and directo- ries you wanted on the command line), then updating with -d will cre- ate those directories, which may not be what you want.
You can find many other such reference using a search engine.
($Id) |