#!/usr/bin/perl print "prepping files for cvs using indent.\n"; `indent -i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80 src/*.[ch] >& /dev/null`; # username -> handle translations $names{mandrake} = "Mandrake"; $names{raster} = "Raster"; $names{mej} = "KainX"; $names{elwood} = "Christian"; $names{ljlane} = "ljlane"; $names{pkj} = "Saur"; $names{gilbertt} = "gilbertt"; $names{kw} = "Kim"; if(($ARGV[0] =~ /up/)) { print "force removing and updating timestamp.h\n"; unlink "timestamp.h"; system("cvs update timestamp.h"); } if(($ARGV[0] =~ /com/) || ($ARGV[0] =~ /ci/)) { print "We're doing a commit, time to edit the logfile.\n"; $ARGV[0] .= " -F CommitLog"; open COMMITLOG, ">CommitLog"; print COMMITLOG `date`; print COMMITLOG "($names{$ENV{USER}})\n"; print COMMITLOG "\n"; close COMMITLOG; if($ENV{EDITOR}) { system("$ENV{EDITOR} CommitLog"); } else { system("vi CommitLog"); } open COMMITLOG, "CommitLog"; @lines = ; close COMMITLOG; if($#lines < 3) { unlink "CommitLog"; print "Obviously this was supposed to be an aborted commit.\n"; exit(0); } @ARGV2 = @ARGV; $ARGV2[0] = "update"; print "Force updating ChangeLog and removing timestamp.h\n"; system("cvs update -C ChangeLog timestamp.h"); print "Updating the files you are committing.\n"; system("cvs @ARGV2 2>&1 |tee errors"); open ERRORS, "errors"; while() { if(/conflicts during merge/) { print "There's a conflict. Resolve and try again.\n"; unlink "errors" if (-f "errors"); exit(0); } } close ERRORS; unlink "errors" if (-f "errors"); print "Creating new timestamp.h\n"; open TS, ">timestamp.h"; print TS "#define E_CHECKOUT_DATE \"\$Date\$\"\n"; close TS; print "Updating the ChangeLog with your entry\n"; open CHANGELOG, ">>ChangeLog"; print CHANGELOG "\n-------------------------------------------------------------------------------\n\n"; close CHANGELOG; `cat CommitLog >> ChangeLog`; if($#ARGV >= 1) { $found = 0; foreach(@ARGV) { if(/ChangeLog$/) { $found = 1; } } push @ARGV, "ChangeLog" if(!$found); $found = 0; foreach(@ARGV) { if(/timestamp\.h$/) { $found = 1; } } push @ARGV, "timestamp.h" if(!$found); } } system("cvs @ARGV"); unlink "CommitLog" if(-f "CommitLog"); `rm -f *~`;