tulrich.com
☰ Menu+  instagram  tuffy  ringing ear  rentals 

geekstuff | gameswf | Textweb | Chunked LOD | dumbuild

Cheat sheets: CVS | cygwin | Debian | Emacs | MythTV

CVS Cheat Sheet

So I don't forget, here are a couple handy recipes for using CVS. For some reason the official manual never fails to confuse me.


Assumptions

Assume you want to work on a project named "myproject". All the working sources for the project are in ~/src/myproject . You have a server somewhere on the Internet, called some.server.net, where you want to keep your CVS repository. You need login access to some.server.net, where your username is "username".

pserver vs. ssh

Don't bother with pserver; it's insecure and a PITA. Use ssh. Do this to enable usage of ssh:

# export CVS_RSH=ssh

Now you're pretty much good to go. Commands which need to specify a CVSROOT will look like this:

# cd ~/src

# cvs -d:ext:username@some.server.net:/home/username/cvsroot checkout myproject

Putting A Project Into CVS

Let's say you want to get myproject into cvs for the first time. From the project root dir:

# cvs -d ... import -m "Imported" repository_dir_under_cvsroot vendor_tag start_tag

e.g.

# cd ~/src/myproject

# cvs -d:ext:username@some.server.net:/home/username/cvsroot import -m "Imported" myproject tulrich start

At this point you'll want to move the original myproject to a different name (for backup), and checkout the sources from the cvs repository. Once everything is working you'll want to delete (or archive) the old myproject directory, so you don't work in it by mistake.

CVSROOT

Don't bother setting the environment variable -- it's not necessary. The key things to know are:

cvswrappers

To automatically turn on the -kb option based on file extension (to handle binary files without munging them), you can use the admin file "CVSROOT/cvswrappers". First do this to get the admin files:

# cd myproject

# cvs co CVSROOT

Now edit or add CVSROOT/cvswrappers , and commit your changes. Here's an example:

---- example taken from http://www.kryptonians.net/cvs/server_setup.html ----

# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
*.gif -k 'b'
*.tga -k 'b'
*.bmp -k 'b'
*.psd -k 'b'
*.tif -k 'b'
*.png -k 'b'
*.iff -k 'b'
*.aiff -k 'b'
*.obj -k 'b'
*.dat -k 'b'
*.exe -k 'b'
*.com -k 'b'
*.dll -k 'b'
*.dsw -k 'b'
*.dsp -k 'b'
*.lwo -k 'b'
*.lws -k 'b'
*.p -k 'b'
*.ico -k 'b'
*.frx -k 'b'
*.class -k 'b'
*.jar -k 'b'
*.zip -k 'b'
*.lzh -k 'b'
*.lha -k 'b'
*.rar -k 'b'
*.arj -k 'b'
*.arc -k 'b'
*.avi -k 'b'
*.mov -k 'b'
*.asf -k 'b'
*.smk -k 'b'
*.jpg -k 'b'
*.mpg -k 'b'
*.swf -k 'b'
*.frx -k 'b'
*.fli -k 'b'
*.flc -k 'b'
*.tiff -k 'b'
*.bin -k 'b'
*.dat -k 'b'
*.wad -k 'b'
*.ppt -k 'b'
*.pdf -k 'b'
*.3ds -k 'b'
*.max -k 'b'
*.srt -k 'b'
*.srm -k 'b'
*.srp -k 'b'
---- end example ----
tu@tulrich.com |