1999-09-01 14:31:32 -07:00
|
|
|
#!/usr/bin/perl
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-09-01 17:05:33 -07:00
|
|
|
print "prepping files for cvs using indent.\n";
|
1999-09-01 14:31:32 -07:00
|
|
|
`indent -i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80 *.c *.h >& /dev/null`;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-09-01 14:31:32 -07:00
|
|
|
# username -> handle translations
|
|
|
|
$names{mandrake} = "Mandrake";
|
|
|
|
$names{raster} = "Raster";
|
|
|
|
$names{mej} = "KainX";
|
|
|
|
$names{cK} = "Christian";
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-09-01 14:31:32 -07:00
|
|
|
# username -> indentstyle translations
|
|
|
|
$indents{raster} = "indent -i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80";
|
|
|
|
$indents{kimball} = "indent -bad -bap -bli0 -cli0 -ss -di20 -nbc -lp -i4 -ts4 -ncs -nce -npcs";
|
|
|
|
$indents{mike} = "indent -i2 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80";
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-09-01 17:05:33 -07:00
|
|
|
if(($ARGV[0] =~ /com/) || ($ARGV[0] =~ /ci/)) {
|
|
|
|
print "We're doing a commit, time to edit the logfile.\n";
|
1999-09-01 14:31:32 -07:00
|
|
|
$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");
|
|
|
|
}
|
1999-09-01 17:05:33 -07:00
|
|
|
|
|
|
|
open COMMITLOG, "CommitLog";
|
|
|
|
@lines = <COMMITLOG>;
|
|
|
|
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";
|
|
|
|
unlink "ChangeLog";
|
|
|
|
system("cvs -z3 update ChangeLog");
|
|
|
|
unlink "timestamp.h";
|
|
|
|
|
|
|
|
print "Updating the files you are committing.\n";
|
|
|
|
system("cvs -z3 @ARGV2 2|tee errors");
|
|
|
|
|
|
|
|
open ERRORS, "errors";
|
|
|
|
while(<ERRORS>) {
|
|
|
|
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";
|
1999-09-01 14:31:32 -07:00
|
|
|
open CHANGELOG, ">>ChangeLog";
|
|
|
|
print CHANGELOG "\n-------------------------------------------------------------------------------\n\n";
|
|
|
|
close CHANGELOG;
|
|
|
|
`cat CommitLog >> ChangeLog`;
|
1999-09-01 17:05:33 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
1999-09-01 14:31:32 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-09-01 14:38:50 -07:00
|
|
|
system("cvs -z3 @ARGV");
|
|
|
|
|
|
|
|
unlink "CommitLog" if(-f "CommitLog");
|
1999-09-01 14:31:32 -07:00
|
|
|
|
|
|
|
if($indents{$ENV{USER}}) {
|
|
|
|
`$indents{$ENV{USER}} *.c *.h >& /dev/null`;
|
|
|
|
}
|
1999-09-01 17:05:33 -07:00
|
|
|
|
|
|
|
`rm -f *~`;
|