Friday, October 22, 2010

CVS job interview questions - in Linux

1. What is CVS?
The Concurrent Versions System (CVS) is a tool for version control.
For CVS updates and additional information, see
the CVS home page at http://cvs.nongnu.org/



2. How to create a CVS project?

Suppose my project source code at /home/jiansen/project
1) mkdir /home/jiansen/cvs
2) export cvsroot=/home/jiansen/cvs
3) cvs init
4) cd /home/jiansen/project
4) cvs import -m "Initialising sources in CVS" project jiansen start

Now I am able to check out cvs project via
cvs co project

3. How to let other people join your project?
To allow all trusted CVS users access to the repository, we will create a cvsusers group. To do this, add

cvsusers:x:4901:jiansen,tom

to /etc/group to create a cvsusers group, and add jiansen and tom to it. Note, 4901 is not special, it's any number not already in use as a group id or user id - I used it because it's the default port for a CVS pserver, which creates a nice link between the two.
cd /home/jiansen
find cvs/ -exec chgrp cvsusers {} \;
find $CVSROOT -type d -exec chmod g+s {} \;


4. How to setup a cvs server?

CVS is not setup as a separate daemon that listens continuously for a connection, it uses Inetd (Internet Daemon) to bind a connection request to the port used for CVS (2401) to the CVS server. The following commands should be executed as root. The file that supplies the information about which ports map to which services is /etc/services, edit this file and add the line:

cvspserver 2401/tcp # CVS Pserver

It may already be listed, in which case, leave it alone. Edit the file /etc/inetd.conf, add the line:

cvspserver stream tcp nowait root /usr/local/bin/cvs cvs --allow-root=/home/jiansen/cvs  pserver


This causes inetd to start up a new cvs server and connect the server to the incoming connection request.

killall -HUP inetd

This restarts inetd. Logon to some other machine and test the access using the cvs login command.


5. How to access CVS server?
We can  set our CVSROOT on a remote machine to the following. For example, let tom access my cvs
export CVSROOT=:pserver:tom@mynode.ca:/home/jiansen/cvs 
cvs login 
Here password is the same as system password. We can setup specific password for 
cvs.

6. List main cvs commands.
CVSROOT environment variable, setenv CSVROOT (csh) or export CSVROOT= (bash)
If you've changed a file in CVS and want to commit your changes to the repository, type:
cvs commit filename
Checkout package or module:
cvs checkout module
To add a new file to the repository, first create the file in your checked out copy and then type:

cvs add -m'Brief description.' filename

Deleting a file involves similar steps. First delete the file out of your checked out copy, then use cvs remove to mark it as deleted, and then use cvs commit to commit the change:

rm filename
cvs remove filename
cvs commit filename

You can combine the first two steps by using:


cvs remove -f filename
If you want to get a report on what's changed between your copy and the repository, but don't want CVS do actually do anything, use the command:

cvs -n update

To see the differences (in diff format) between a file you've modified and the last committed revision in the repository, use:

cvs diff filename

(You can also give cvs diff multiple filenames or even whole directories and it will produce a series of diffs.) cvs diff takes the standard flags to specify what type of diff to produce, so:

cvs diff -u filename

will produce a unified context diff (the type that most people prefer).

7. Difference between cvs and svn?
Concurrent Versions System (also known as Concurrent Versioning System or CVS) is a free software revision control system –that is, it is a program that is open for use to the public that manages changes to documents, programs, and other information stored in computer files). It allows multiple developers to collaborate.

Subversion (also known as SVN) is a version control system used to maintain the current and preceding versions of files (like source code, web pages, and documentation). It is a direct upgrade of CVS and its most compatible successor. It is also an open source technology and has been widely used in multiple projects –such as Apache Software Foundation, Free Pascal, MediaWiki, and Google code.


1. CVS allows multiple users to collaborate on the same project; Subversion maintains the current and preceding versions of files.
2. CVS allows users to check in on the same project and modify it; Subversion commits as true atomic operations.
3. CVS can maintain different branches of a project; Subversion uses parsable output.


reference:
http://www.linux.ie/articles/tutorials/managingaccesswithcvs.php
http://www.differencebetween.net/technology/difference-between-cvs-and-subversion/

No comments:

Post a Comment