CVS is a robust and open source software for version control. Source file’s history can be recorded by this system. Why we need CVS? A small project that is handled by a single person may not need this. But in large projects more developers may concurrently work on the same project. At that time to avoid the conflicts we are using CVS.
CVS has a client-server model, in which the server holds the different versions of the project. The client can access the server and download the latest version of the complete project, is known as “check out”. By completing the necessary modification client can submit their modified files to the server, known as “check in”. Developers have to maintain up to date working copy because only the latest version of a file will be accepted by the server.
The Repository
The CVS Repository is located inside the CVS server and developers save the entire copy of all the directories, files and other documents to this. From here client can checkout the files to the clients working directory and after the modification client can check in(commit) the files back to the Repository. Administrative files are also saved inside the repository.
File States
Different states of checkout files are.
Up-to-date: If the check out file and file in the repository are same.
Locally Modified: If we have modified the check out file and the commit operation has not yet taken place.
Locally Added: If we have added the file using “add” and the commit operation has not yet taken place.
Locally Removed: If we have deleted the file using “remove” and the commit operation has not yet taken place.
Needs Checkout: If some other person has committed the file(newer version) to the ‘repository’.
Needs Merge: If some other person has committed the file(newer version) to ‘repository’, and if someone has also made changes to the same file.
Unknown: If CVS has no idea about the file. It may be a new file and the ‘add’ operation might not be performed yet.
Versions, Revisions and Releases
Each versions of a file is known as ‘revisions’.(eg: 1.1, 1.2 etc). Unique revision numbers are assigned for each versions. Period of the numbers may be more than one(eg: 1.2.3.2). Each version of a software product is know as ‘ releases’.
Features
CVS will automatically increment the file’s version numbers after the succeed commit operation. Also the author name, date, and descriptions are saved to the log files.
Version comparison, retrieval of change history and retrieval of the project of a particular revision number or date for a client can also be possible here.
To make ‘the particular file in working copy’ up-to-date, clients can use the ‘Update’ command instead of downloading the entire project.
A projects different ‘branches’ can also be maintained by CVS.
Delta compression technique(Instead of storing the entire file, storing the sequential data difference) is used by CVS to store same file’s different version.
Operations
checkout
For getting the files from the server to the current working directory.
Example:
cd workingDir/

cvs checkout temp

commit
To store the modified files to the repository, so that it can be accessed by everyone.
Example:
cd workingDir/
cvs commit temp
If Only a single file in a module need to commit then,
cd workingDir/temp

cvs commit one.html
update
If some other person has committed the file(newer version) to ‘repository’, and if another person has also made changes to the same file, then we have to update our copy before commit it. To merge these files we can use the ‘update’ command.
Example:
cd workingDir/
cvs update temp
If there are conflicts, then developers has to avoid the conflicts by hand and commit the files.
diff
To view the differences between the working copy and the file that we have checked out.
Example:
cd workingDir/temp
cvs diff one.html
release
The cleaning up operation is done by this command. To remove the working copy use ‘-d’ with this command.
cd workingDir
cvs release temp
add
This command is for adding files to ‘ repository’. Developers have to run the commit after the add command.
remove
This is for removing directories and files from ‘ repository’.
With this support programmers can definitely say that CVS is indeed really helpful.