CMPE 401 - Laboratory #2 CVS instructions
Software Management with Concurrent Version System - CVS
The CVS requirements for this lab are:
-
You must demonstrate a current source tree for your entire cmpe401 directory. Your source tree for lab2 can be solutions for exercise 2, 3, or 4 of lab2. You may wish to keep all three solutions in CVS. That is acceptable too.
- The tree must only include source files, Makefiles, and linker scripts in lab1, lab2, and lib. All other directories should be unchanged from the original import unless you modified these directories. Your checked-in tree must not contain any .o, .s19, .map, .lst, .swap, ~, or other backup type files for the lab2, lab1, and lib directories. For example, your CVS-managed lab2 directory should contain lab2.c, Makefile, and duart.s only unless you have added and committed seperate directories for each exercise. Your lib and lab1 directory checked into CVS should also be free of .o, .map, .s19, .lst and all other non-source files. You may wish to add separate directories for ex2, ex3, and ex4 to the repository for lab2, modify the Makefiles in each of those directories and commit the changes to the repository.
-
If you want to import a new project and wipe out your existing CVS repository, email me (nem@ece.ualberta.ca) stating what exactly you want blown away and I'll take care of it.
The operations to add, update, and remove files, and commit changes to those files will be sufficient to fulfill the requirements above.
To Add Files and Directories to an Existing Project
Once a project has been imported the developer must have the ability to add new files, remove old files, and commit the necessary changes. Without these operations, collaboration within large groups of developers can't be productive or practical.
Adding a new directory (for lab2):
-
Check out and cd into your checked out cmpe401 directory. Copy your lab2 directory into this checked out directory.
-
Type
cvs add lab2
You should see something like:
nem@e5-02-04:~/junk/cmpe401$ cvs add lab2
? lab2/Makefile
? lab2/duart.s
? lab2/lab2.c
Directory /opt/cvs/nem/cmpe401/lab2 added to the repository
At this point your directory has not really been added to the repository. You'll need to add each file individually and commit the files to really add them.
Adding a new file(lab2.c):
To add a new file you need to do two things. cvs add tells CVS that you want this file under source control, and cvs commit acutally places it into the
repository.
-
cd into your newly added lab2.
-
Type
cvs add lab2.c
You should see something like this:
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs add lab2.c
cvs add: scheduling file `lab2.c' for addition
cvs add: use 'cvs commit' to add this file permanently
-
Type
cvs commit lab2.c
After typing in a comment, you should see something like this:
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs commit lab2.c
RCS file: /opt/cvs/nem/cmpe401/lab2/lab2.c,v
done
Checking in lab2.c;
/opt/cvs/nem/cmpe401/lab2/lab2.c,v <-- lab2.c
initial revision: 1.1
done
-
Continue adding files so that you have all three lab2 (Makefile, duart.s, lab2.c) files checked in. If you want to maintain seperate directories for each exercise, follow the same instructions for each directory and add and commit each file within each directory.
Recovering or Replacing Files (but not directories)
To recover or replace a file already under source control execute a cvs update to get a new copy from the repository:
-
First remove a file that has been added and committed to the repository.
-
For example:
rm lab2.c
- To replace the file from the repository type:
cvs update lab2.c
You should see something like this:
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs update lab2.c
cvs update: warning: lab2.c was lost
U lab2.c
Commiting Changes
Committing changes to your source files ensures that the changes you put into the project can be transferred to the other developers in the group.
-
Type:
cvs update Makefile
to synchronize your Makefile with the cvs repository. If your local copy is different from that of the repository you should see something like this:
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs update Makefile
M Makefile
to indicate that the file has been modified.
Type:
cvs commit Makefile
to commit those changes to the repository. After typing in a comment you should see something like this:
Checking in Makefile;
/opt/cvs/nem/cmpe401/lab2/Makefile,v <-- Makefile
new revision: 1.2; previous revision: 1.1
done
Removing Files (but not projects or directories) from Source Control
Like adding files, removing files from cvs is a two step process.
-
First cd into the directory from which you wish to remove the file.
-
Type:
rm lab2.c
cvs remove lab2.c
You should see something like this
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs remove lab2.c
cvs remove: scheduling `lab2.c' for removal
cvs remove: use 'cvs commit' to remove this file permanently
-
You need to commit these changes to really remove the file.
Type:
cvs commit lab2.c
You should see something like this:
nem@e5-02-04:~/junk/cmpe401/lab2$ cvs commit lab2.c
Removing lab2.c;
/opt/cvs/nem/cmpe401/lab2/lab2.c,v <-- lab2.c
new revision: delete; previous revision: 1.1
done
Consult the many references on CVS on the web to learn more. In the next lab, we'll create a merge conflict and examine how to resolve it.
Last modified October 17, 2006