crowley code!

Previous: Comcast DVR != TiVo

Next: Cross platform XPCOM (a howto)

7/12 CVS oops fix (0)

cvs, php

Committing a new project to CVS is quite a chore. I have been slowing getting it together for the past couple of days, screwing up early and often. If you ever find yourself with a directory tree full of CVS directories and you would rather not, try this:

<?php

function scrub($path) {
    $dir = opendir($path);
    while (false !== $d = readdir($dir)) {
        if ('.' == $d{0}) continue;
        if ('CVS' == $d) `rm -rf $path/$d`;
        else if (is_dir("$path/$d")) scrub("$path/$d");
    }
}
scrub('.');

?>

I’ve discovered other nasty quirks, too. Like you can’t actually remove a directory, but you can suppress empty ones on cvs update using the -P option. Adding binary files and trusting CVS to play nicely is a terrible idea. Instead you need to think for it and do cvs add -k b file to let it know you’re adding a binary file.

Or, if you have decision-making power, you could just switch to Subversion.

Leave a reply