-
Back to Home Page our Laboratory
INDEX:
-
Starting
- Directory tree
- Get a working copy"
- Save your work as a new version
- Ready to take-off"
Starting cvs
The sources maintained by cvs are kept within a single
directory hierarchy known as the "source repository".
Let call it "src_rep" for instance.
As cvs need to know where the "source repository" is
you can use an environment variable:
setenv CVSROOT /home/ifh/user_name/src_rep
(that you can set in the special section of your .login file)
or use the parameter "-d path_to_dir
" in the command line.
It is easy to put an alias in your ~/.alias file:
alias cvs 'cvs -d /home/ifh/user_name/src_rep \!*'
General structure of cvs commands:
cvs [ cvs_options ] cvs_command
[ command_options ] [ command_args ]
example of "cvs_options" is for instance
"-d path_to_dir"
example of commands:
init, import, add, checkout, commit, export, edit,
diff, remove, status, tag
Creating an empty directory tree
First build up an empty tree as you would like it and then use the import command
to let cvs generate a similar one under cvs control:
Example:
mkdir -p upper/lower_one
mkdir upper/lower_two
cd upper
cvs -d /home/ifh/user_name/src_rep
import
-m "new directory structure" upper my_tag my_version
After it delete the dummy directory structure and start filling in the cvs system.
Example:
deneb:ballisti:[ballisti]:360 % cvs
-d /home/ifh/ballisti/cvs_test init
deneb:ballisti:[ballisti]:361 % mkdir
-p upper/lower_one
deneb:ballisti:[ballisti]:362 % mkdir
upper/lower_two
deneb:ballisti:[ballisti]:363 % cd upper
New directory is : /home/sirius67/ballisti/upper
deneb:ballisti:[upper]:364 % cvs -d /home/ifh/ballisti/cvs_test
import -m "cvs demo"
upper demo start_version
cvs import: Importing /home/ifh/ballisti/cvs_test/upper/lower_one
cvs import: Importing /home/ifh/ballisti/cvs_test/upper/lower_two
No conflicts created by this import
deneb:ballisti:[upper]:365 % cd ..
New directory is : /home/sirius67/ballisti
deneb:ballisti:[ballisti]:366 % rm -r upper
It is important to remove the dummy directory. You will let cvs
re-create a new one to work on it.
The command "checkout" create or update a working directory containing copies
of the source files specified in the command line:
cvs -d /home/ifh/user_name/src_rep
checkout module_name
Example:
deneb:ballisti:[ballisti]:367 %
cvs -d /home/ifh/ballisti/cvs_test
checkout upper
cvs checkout: Updating upper
cvs checkout: Updating upper/lower_one
cvs checkout: Updating upper/lower_two
Use "commit" when you want to incorporate changes from your working source files
into the source repository
cvs -d /home/ifh/user_name/cvs_rep
commit
[ -m "log_message" ] [ -F file ] [files...]
Example:
deneb:ballisti:[ballisti]:368 % cd upper
New directory is : /home/sirius67/ballisti/upper
deneb:ballisti:[upper]:369 % cat >first_example
this could be a fortran or C program or whatever
you have to share with other people or
what you want to organize in many versions,
as for instance the chapter of your dissertation
^D
deneb:ballisti:[upper]:370 %
cvs -d /home/ifh/ballisti/cvs_test
commit
-F first_example
cvs commit: Examining .
cvs commit: Examining lower_one
cvs commit: Examining lower_two
deneb:ballisti:[upper]:371 %
Ready to work
With "checkout" and "commit" you can already start to use VCS.
But of course there are many more commands and utilities. If you really
would like to use it you should look at the proper
documentation.