Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Cvs_notes_1-41

***********************

**starting cvs:

Login as a user not root

Copy cvs software in home directory and install it in a subdirectory by using –prefix
option. [ set PATH to the bin directory of installed place .

Create a repository directory having prefix /usr/local/..

Cd to that directory and run following command from there:

#cvs -d /path/to/repository init

Create .bashrc in home directory having following lines:

#CVS Environment variables

export CVSRO OT=/usr/local/repos5 [ ur path to repository ]

export CVSEDITOR=vi

For adding a files and directories to cvs , cd and go to the top level directory of that
tree and run following command, and the corresponding tree structure will
automatically go to the repository . check it by cd and ls:

#pwd

/…/…myproject [ output of pwd ]

#cvs import –m “hiii” myproject username start [use –d option if required. ]

When you want to work on any repository’s directory just go in a directory other
than repository itself and run following commna dthe tree structure will
automatically get copied in ur `pwd` directory :

#cvs checkout myproject


**detecting and resolving conflicts:

#cvs status hellow.c

#cvs update -p hellow.c [ with –p option it shows the current updated file’s
content on standard output ]

#vi hellow.c

#cvs commit hellow.c

**if we have an old checkout file and we want to work on that first run #cvs status
filename [ see it ] then run #cvs update filename [it will update repossitori’s
change in our file . ] then we will work on it and after completion when we will
commit it and get conflict then we will have to take steps given in previous point .

** we cant checkout in repository .

**browsing log messages :

#cvs log hellow.c

->check date/time, log messages, revisions for tracing changes .

**if you want to find deiference between two versions , u can use :

#cvs diff –c -r 1.3 -r 1.4 hellow.c

[ if we give only one revision it compares it against current version . ]

** If we want to revert any change, we can do it by two methods :

1.slow method of reverting:

Step1: update you to the fepository as:

#cvs update

Step2: view repository’s content as:


#cat hellow.c [ note after updation, the content of repository s the content of local
file . ]

Step3: now save the content of desired version by overwriting the local hellow.c as:

#cvs -Q update -p -r 1.3 hellow.c > hellow.c

Step4:now before committing we check it as :

#cvs update [ it shows hellow.c modified as compared to repository .]

#cvs –Q diff -c

Step5:commit the changes with a log message as:

#cvs commit - m “reverted to an old version”

2.fast method of reverting :

Step1:cvs update -j 1.4 -j 1.3 hellow.c

[ -j for join . it merges the change of older version 1.3 to 1.4 as patch. ]

Step2: cvs update

[ it shows the file modified. ]

Step3:cvs commit -m “reverted 1.4 to 1.3” hellow.c

[hellow.c is optional ]

**other useful cvs commands :

ADDING FILES:

Copy or create a file in the current working directory [ where want to add ] and
run :

#vi myfile.c [ or cat or copy ]

#cvs add myfile.c

#cvs commit myfile.c

Error : cvs [commit aborted]: cannot commit files as 'root'


> There is no right answer. cvs was designed to not allow the root user
> to do cvs commands. This has to do with the philosophy about why you
> shouldn't run as root unless you have to. It also goes into the level
> of trust that you are willing to let one 'root' user have on another
> machine. If you are so set on running as root go into the source and
> remove the check to see who you are running as, because obviously you
> know best.... In any event you will be running a unsupportable version
> of the cvs source base

I may be wrong, but I believe there are other reasons that 'root' is not
allowed to use cvs. I believe that they involve locking and such.
“My opinion”……..so install and use cvs as a user……….

ADDING DIRECTORY:

To add a directory first go to the desired place in workout. And then

#mkdir newdir

#cvs add newdir

[ now cd to newdir , u’ll see CVS directory in it ]

REMOVING FILE

To remove a file from any directory in workout , go to the directory containing that
file and then:

#rm filename

#cvs remove filename

#cvs commit filename [ or simply cvs commit ]

REMOVING DIRECTORY:

If you want to delete a directory newdir then first cd to that directory and delete all
files from there except system file CVS and then :

#cd ..

#cvs update -P [ actually it deletes all empty files. If u want to delete only
specific empty file then you can use its name at the end ]
RENAMING FILES:

For renaming a file :

#mv oldfilename newfilename [ does two jobs- vi of file creation and rm of file
remove ]

#cvs remove oldfilename

#cvs add newfilename

#cvs commit -m “moved[optional]” oldfilename newfilename

RENAMING DIRECTORIES:

#mkdir newdir

#cvs add newdir

#mv olddir/* newdir

Everything except CVS gets copied .

#cd olddir

#cvs remove file1 file2 [ file1 and file2 are contents of olddir ]

#cd ../newdir

#cvs add file1 file2

#cd ..

#cvs commit

#cvs update -P

**rm is short form of remove and ci is short form of commit .

**avoding option fatigue:


Something like abbreviation in vi and alias in unix ,here in cvs if we wanna use an
global option or parameter option always with cvs and command respectively we
can do so by making an entry in .cvsrc file in home directory [ vi $HOME/.cvsrc ]
as:

cvs -Q

diff -c

so that evry time we invoke cvs it will take global option automatically and
similarly parameter option with command .

**anatomy of a cvs distribution :

thr is more information in cvs distribution than code . [ for practical extracte the tar
directory in a directory and ls ]

NEWS- this file contains the changes from one release to another in reverse
chronological order .

BUGS- this contains known bugs in cvs .

DEVEL-CVS-this file is cvs constitution and describes steps through which changes
are acceptable in cvs and how someone can become a member of developer
group .

HACKING-It helps someone to write atch for cvs and contains information about
coding .

FAQ- It contains the most frequent query about cvs .

SUBDIRECTORIES: other subdirectories present here are:

/emx,/os2,/vmx,/windowsNT are os specific directories and help in code level


debugging.

/diff contains internal implementation of diff program .

/contrib,/tools contains free third party softwares supported by cvs .

/src,/lib contains bulk of cvs source code .

/man – cvs manual

/doc contaisn the caderqvist manual written in taxinfo mode so tht it can be
easily presented online and printed easily . its files work as input for info cvs .
**info-> /usr/sfw/bin/info /usr/sfw/man . if not working set PATH and MANPATH
[ for man ]. The documentation for info command is stored in the directory having
bin and man in texinfo mode . if info is not giving out \put we’ll have to add related
documents in this info directory . every souece code should have pdf in possibly
/doc directory .

**when we remove a file:

-it goes to a directory named Attic in repository . we can retrieve it by:

#cvs update -p –r 1.4 filename>filename then #cvs add filename and


#cvs commit filename .

After retrival the entry is deleted frm Attic directory but this whole cycle’s log is
stored by repository .

**who can use the repository : on page 72 of coriolis’s book . from once to 21 lines
onwards .

**

You might also like