Crowley Code! 
 (Take 12)

CVS oops fix 2007/07/12

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.

Comments (0)

Richard Crowley?  Kentuckian engineer who cooks and eats in between bicycling and beering.

I blog mostly about programming and databases.  Browse by month or tag.

To blame for...


© 2009 Richard Crowley.  Managed by Bashpress.