Categories
Technology

CVS bulk conversion to binary

I try not to use CVS anymore since I’ve become used to Subversion, but recently I needed to restore an old project from CVS. I made a tar of the CVS backup and uploaded to the server and placed it in the CVSROOT folder. When I checked out the project I realized the binary files were not binary at all, but rather ascii text. This happened even though I have a cvswrappers file in the CVSROOT folder with a line entry for each of the binary file types. Maybe something with the cvswrappers file was incorrect, I’m not sure but I came up with this shell script which fixes the problem. Did I mention that Subversion doesn’t have these issues?

Here is a shell script that will convert the list of file extensions into binary types. To use it, first check out the project to repair. Next run the script and pass the path to the project as a parameter.


#!/bin/sh
#
# This script modifies existing files in cvs and converts to binary
#
# www.europheus.com
#

extensions=( *.jpg *.gif *.png *.psd *.ico *.icns *.zip *.jar *.exe )

for ext in ${extensions[@]}
do
	find $1 -name $ext -exec cvs admin -kb {} \;
	find $1 -name $ext -exec cvs update -A {} \;
done

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.