Index: CVSROOT/shiela RCS File: /v/ossp/cvs/CVSROOT/shiela,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/CVSROOT/shiela,v' 2>/dev/null --- shiela 2002/12/23 10:03:51 1.14 +++ shiela 2002/12/23 13:19:40 1.15 @@ -26,7 +26,7 @@ ## shiela.pl: control program (syntax: Perl) ## -my $version = '1.0.2'; +my $version = '1.0.3'; require 5.005; @@ -1014,6 +1014,23 @@ ## _________________________________________________________________ ## +## Fit text into particular columns. +## +## This makes sure a text fits into a particular columns by +## truncating (and extending with "$") if necessary. +## _________________________________________________________________ +## + +sub fit_columns { + my ($col, $txt) = @_; + if (length($txt) > $col) { + $txt = substr($txt, 0, $col-1) . '$'; + } + return $txt; +} + +## _________________________________________________________________ +## ## TAGINFO HOOK ## ## We hook into CVS via `taginfo' to check whether user is allowed to @@ -1293,12 +1310,12 @@ ## ## VERIFYMSG HOOK ## -## We hook into CVS via `commitinfo' to post-process log messages. -## The intention is to sanitise the results of what the user may have -## `done' while editing the commit log message. If CVS is a standard -## version, this check is advisory only. If CVS contains the RSE -## patches, the log message is changed and CVS reads back the contents -## so that this script can actually make changes. +## We hook into CVS via `verifymsg' to post-process log messages. The +## intention is to sanitise the results of what the user may have +## `done' while editing the commit log message. If CVS is an anchient +## version, this check is advisory only. If CVS is at least version +## 1.11.2, the log message can be changed and CVS actually reads back +## the contents so that this script can actually make changes. ## ## We are called by CVS with a single argument: the path to the log ## message file. @@ -1309,9 +1326,6 @@ my ($PA, $RT, $CF) = @_; my $rv = 0; - # we require the RSE patches for operation - return $rv if (not $RT->{cvsrse}); - # suck in the log message my $logfile = $PA->{ARG}->[0]; my $io = new IO::File "<$logfile" @@ -1512,7 +1526,10 @@ # if we are using a stock CVS version, we have to determine # extra information (which an RSE CVS version would provide). - if (not $RT->{cvsrse} and not $RT->{cvsop} eq 'import') { + if ( ( ( defined($cvsinfo[0]) + and $cvsinfo[0] =~ m|^([^,]+),([^,]+),([^,]+)$|) + or not $RT->{cvsrse} ) + and not $RT->{cvsop} eq 'import' ) { # parse CVS commit information my $tag = 'HEAD'; @@ -2071,8 +2088,8 @@ $cvsbranches{$e->{branch}} = 0 if (not defined($cvsbranches{$e->{branch}})); $cvsbranches{$e->{branch}}++; } - $IN->{cvsbranch} = join(', ', keys(%cvsbranches)); - $IN->{cvsmodule} = join(', ', keys(%cvsmodules)); + $IN->{cvsbranch} = join(' ', keys(%cvsbranches)); + $IN->{cvsmodule} = join(' ', keys(%cvsmodules)); # # Finally generate the logging message. @@ -2101,13 +2118,20 @@ my @moy = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time()); - my $date = sprintf("%02d-%s-%04d %02d:%02d:%02d", - $mday, $moy[$mon], 1900+$year, $hour, $min, $sec); + my $txt_date = sprintf("%02d-%s-%04d %02d:%02d:%02d", + $mday, $moy[$mon], 1900+$year, $hour, $min, $sec); + my $txt_server = &fit_columns(32, $CF->{Repository}->{Host}); + my $txt_root = &fit_columns(32, $CF->{Repository}->{Path}); + my $txt_module = &fit_columns(32, $IN->{cvsmodule}); + my $txt_branch = &fit_columns(32, $IN->{cvsbranch}); + my $txt_name = &fit_columns(32, $RT->{username}); + my $txt_email = &fit_columns(32, $RT->{usermail}); + my $txt_handle = &fit_columns(32, $IN->{handle}); $O .= "\n" . - $prefix . sprintf("%-40s %s\n", "Server: ".$CF->{Repository}->{Host}, "Name: ".$RT->{username}) . - $prefix . sprintf("%-40s %s\n", "Root: ".$CF->{Repository}->{Path}, "Email: ".$RT->{usermail}) . - $prefix . sprintf("%-40s %s\n", "Module: ".$IN->{cvsmodule}, "Date: ".$date) . - $prefix . sprintf("%-40s %s\n", "Branch: ".$IN->{cvsbranch}, "Handle: ".$IN->{handle}); + $prefix . sprintf("%-40s %s\n", "Server: ".$txt_server, "Name: ".$txt_name) . + $prefix . sprintf("%-40s %s\n", "Root: ".$txt_root, "Email: ".$txt_email) . + $prefix . sprintf("%-40s %s\n", "Module: ".$txt_module, "Date: ".$txt_date) . + $prefix . sprintf("%-40s %s\n", "Branch: ".$txt_branch, "Handle: ".$txt_handle); } # the file list