|
|
Importing Projects into CVS
by Jeff Hunter, Sr. Database Administrator
Contents
Overview
After successfully creating a CVS repository, it is time to start creating (importing) projects into the repository. Under CVS, a project is simply a collection of related files under a single directory.Creating the Initial Project Directory StructureThis article describes how to import new projects into a CVS repository. For the purpose of this example, the following assumptions will be made:
- I will be using the UNIX version of CVS (Release 1.11.14) on a Sun Solaris platform. For complete instructions on installing CVS for this platform, see "Installing CVS".
- We have a CVS repository located at: "/var/lib/cvsroot". For complete instructions on creating a CVS repository for UNIX, see "Creating a CVS Repository".
- For this example, we will be creating a dummy project named "ProjectX". It will consist of several blank files (just by using the touch) command.
Now let's create the initial project directory structure for our project (ProjectX). Put some thought initially into how you want the directory structure before importing into CVS. If, for example, you decide to move a set of files after they have been stored in CVS, CVS will now consider two versions of each file: the original set of files in their original location, and the second set of files in their new location. The history of those files are then split into two parts.Importing the ProjectOnce we create and import our initial project into the CVS respository, the initial version can (and should) be removed. You would not typically want to use this directory for your workarea (also known as your sandbox) so there is no reason to retain it.
Once we have the initial directory structure complete, we will need to change into the root directory of the project. Then, from within that directory, you can import the project using the following syntax of the cvs command:
cvs [ -d repository_path_name ] import name_of_project vendor_tag release_tagLet's take some time to discuss the above parameters. If the CVS repository is on the local machine, then simply use the full path of the repository directory for the repository_path_name. That will be the case in this example. If the CVS repository is on a remote machine, see "Logging into CVS / Setting CVSROOT" for detailed instructions on setting the repository location. For the name of the project, we will be setting the parameter name_of_project to ProjectX. As for the vendor_tag and release_tag, I like to set vendor_tag = INITIAL and release_tag = start. These are the conventions used in JDeveloper from Oracle.
Now finally, let's create our initial directory structure for ProjectX and import it into the repository:% cd /tmp % mkdir ProjectX % touch ProjectX/File1.java % touch ProjectX/File2.java % touch ProjectX/File3.java % cd ProjectX % cvs import ProjectX INITIAL startAfter the running the cvs ... import ... (above), CVS will put you into an editor windows (probably vi). This is where you would enter any message to remind you of what the project is about.This is the initial import of ProjectX. If this were a real project, I would consider putting the project specification document here. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: ----------------------------------------------------------------------After exiting from the editor, CVS will complete the import process as show below:N ProjectX/File1.java N ProjectX/File2.java N ProjectX/File3.java No conflicts created by this importAfter importing a project, it is always a good idea to backup the repository (as well as your original directory structure for the project). After importing the project and backuping up the repository, you should remove the original directory structure that we imported since you cannot use it as a sandbox.% cd % rm -rf /tmp/ProjectXAs a final step, you should verify that the project is in the CVS repository by checking it out in your work area (or sandbox area):% cd ~ % mkdir myWorkArea % cd myWorkArea % cvs co ProjectX cvs checkout: Updating ProjectX U ProjectX/File1.java U ProjectX/File2.java U ProjectX/File3.javaYou can also perform a directory listing on the CVS repository:% ls -l /var/lib/cvsroot total 4 drwxrwsr-x 3 cvs cvsdev 1024 Jan 23 19:30 CVSROOT/ drwxrwsr-x 2 oracle cvsdev 512 Jan 24 19:29 ProjectX/ % ls -l /var/lib/cvsroot/ProjectX total 6 -r--r--r-- 1 oracle cvsdev 505 Jan 24 19:22 File1.java,v -r--r--r-- 1 oracle cvsdev 505 Jan 24 19:22 File2.java,v -r--r--r-- 1 oracle cvsdev 505 Jan 24 19:22 File3.java,v