Tuesday, December 14, 2010

How to tell CVS to ignore files?

*** CVS will ignore files if they are in:
1) CVS built-in patterns          : #tempfiles# and emacs backup~ files
2) Per-Repository based patterns  : 'CVSROOT/cvsignore' file
3) Per-User based patterns        : ${HOME}/.cvsignore
4) Per-Group based patterns       : ${CVSIGNORE}
5) Per-Command based patterns     : Patterns defined after cvs '-I' command

Config cvsignore or .cvsignore files if you don't want to .old or .bak files to be put into cvs repository.

*** Per-Repository Based Ignore List:

hsual@psgltpe014 $ 
hsual@psgltpe014 $ echo $CVS_RSH
/bin/ssh
hsual@psgltpe014 $ echo $CVSROOT
:ext:hsual@localhost:/opt/cvs
hsual@psgltpe014 $              
hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/Temp
hsual@psgltpe014 $ cvs checkout CVSROOT
U CVSROOT/checkoutlist
U CVSROOT/commitinfo
U CVSROOT/config
U CVSROOT/cvswrappers
U CVSROOT/editinfo
U CVSROOT/loginfo
U CVSROOT/modules
U CVSROOT/notify
U CVSROOT/rcsinfo
U CVSROOT/taginfo
U CVSROOT/verifymsg
hsual@psgltpe014 
hsual@psgltpe014 $ echo *.old > cvsignore
hsual@psgltpe014 
hsual@psgltpe014 $ chmod 770 cvsignore
hsual@psgltpe014  
hsual@psgltpe014 $ cvs add cvsignore
cvs server: use 'cvs commit' to add this file permanently
hsual@psgltpe014 
hsual@psgltpe014 $ cvs commit -m "added per-repository based ignore file list" cvsignore
RCS file: /opt/cvs/CVSROOT/cvsignore,v
done
Checking in cvsignore;
/opt/cvs/CVSROOT/cvsignore,v  <--  cvsignore
initial revision: 1.1
done
cvs server: Rebuilding administrative file database
hsual@psgltpe014 $ 
hsual@psgltpe014 $ cd /home/hsual/alhsu/AlHome/WebSite/HowTo
hsual@psgltpe014 $ ls
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.txt*
hsual@psgltpe014 $ 
hsual@psgltpe014 $ echo Testing > readme.old
hsual@psgltpe014 $ ls
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.old  readme.txt*
hsual@psgltpe014 $ 
hsual@psgltpe014 $ cvs -n update
? readme.AL
? CVSAdmin/HowToCVSIgnore.txt
? CVSAdmin/IgnoringFilesFromRelease.txt
hsual@psgltpe014 $ 

*** Per-User Based Ignore List:  create ~/.cvsignore file.
The readme.AL is a new file careted under the HowTo directory.  Because of the patten of *.AL is defined in ~/.cvsignore file, you won't see it when doing "cvs -n update".  Therefore, the new file, readme.AL, will not be handled by CVS.
hsual@psgltpe014 $ 
hsual@psgltpe014 $ more ~/.cvsignore
*.alhsu *.AL
*.bak *.BAK *.backup *.b
*~* .*~* 
build

hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/WebSite/HowTo
hsual@psgltpe014 $ ls      
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.old  readme.txt*
hsual@psgltpe014 $ cvs -n update
? CVSAdmin/HowToCVSIgnore.txt
? CVSAdmin/IgnoringFilesFromRelease.txt
hsual@psgltpe014 $ 

Creation of .cvsignore file

This is a typical sort of .cvsignore file for the directory ~/src/xyz, for instance.
.backup .bkp .????*
*.tar *.tar.Z *.tgz *.zip *.asc
*~* .*~*
0.1.0 0.1.1
doc tests1 tests2 xyz-0.1.2

In my case, I don't want the ``cvs'' commands to go looking for sources in directories such as ``doc'', ``test1'', ``tests2'' etc. I also don't want checks performed on editor-created backup files which follow patterns like ``*~*''.
Here's a typical example that I use for document directories like ~/tex/xyz.

.bkp .backup
*.akb *.dvi *.akc *.log *.xrf
*.ps *.eps *.pdf
*.zip
*~* ps/*~*

No comments: