Binary files -- CVS---Concurrent Versions System
Next: Revision management
Prev: Keyword substitution
Top: Top
16. Handling binary files
There are two issues with using cvs to store
binary files. The first is that cvs by default
convert line endings between the canonical form in
which they are stored in the repository (linefeed
only), and the form appropriate to the operating system
in use on the client (for example, carriage return
followed by line feed for Windows NT).
The second is that a binary file might happen to
contain data which looks like a keyword (see Keyword
substitution), so keyword expansion must be turned
off.
The `-kb' option available with some cvs
commands insures that neither line ending conversion
nor keyword expansion will be done. If you are using
an old version of rcs without this option, and you
are using an operating system, such as unix, which
terminates lines with linefeeds only, you can use
`-ko' instead; if you are on another operating
system, upgrade to a version of rcs, such as 5.7
or later, which supports `-kb'.
Here is an example of how you can create a new file
using the `-kb' flag:
$ echo '$Id$' > kotest
$ cvs add -kb -m"A test file" kotest
$ cvs ci -m"First checkin; contains a keyword" kotest
If a file accidentally gets added without `-kb',
one can use the cvs admin command to recover.
For example:
$ echo '$Id$' > kotest
$ cvs add -m"A test file" kotest
$ cvs ci -m"First checkin; contains a keyword" kotest
$ cvs admin -kb kotest
$ rm kotest
$ cvs update kotest
When you check in the file kotest the keywords
are expanded. (Try the above example, and do a
cat kotest after every command). The cvs
admin -kb command sets the default keyword
substitution method for this file, but it does not
alter the working copy of the file that you have. The
easiest way to get the unexpanded version of
kotest is to remove it and check it out again.
Next: Revision management
Prev: Keyword substitution
Top: Top