At work, I was developing a POC for search using Lucene. I kept working on it and it worked out pretty well. My manager asked me to check this into revision control as it looked really promising. Ok. I agree. I should have checked this into revision control from day one but I did not(Cursing myself). Now CVS does not allow me to check in files in bulk. I have to individually go and add each folder and then I have to commit the file individually. I did not have the patience nor the inclination to do this. So, I scripted this up as below.


my @files = map {
chomp;
$_;
} `find`;

@files = grep {
$_ ne "." and $_ ne "..";
} @files;

my @dirs = grep {
-d $_;
} @files;

system(qq{cvs add $_}) for (@dirs);

my @files = grep {
not -d $_;
}

for (@files) {
system(qq{cvs add $_});
system(qq{cvs commit -m"First version of lucene based search framework" $_});
}

Ps: This will also commit the script file. If you do not want this to happen just add a condition to remove the script file.

Advertisements