OSSP CVS Repository

ossp - Check-in [3037]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3037
Date: 2002-Dec-23 12:50:09 (local)
2002-Dec-23 11:50:09 (UTC)
User:rse
Branch:
Comment: Make sure that the header in reports is not optically destroyed by too long columns (as it is the case all the time for PMOD commits in the OpenPKG project).
Tickets:
Inspections:
Files:
ossp-pkg/shiela/ChangeLog      1.28 -> 1.29     5 inserted, 0 deleted
ossp-pkg/shiela/shiela.pl      1.42 -> 1.43     32 inserted, 8 deleted

ossp-pkg/shiela/ChangeLog 1.28 -> 1.29

--- ChangeLog    2002/12/23 11:32:05     1.28
+++ ChangeLog    2002/12/23 11:50:09     1.29
@@ -11,6 +11,11 @@
 
   Changes between 1.0.2 and 1.0.3 (23-Dec-2002 to xx-Dec-2002):
 
+   *) Make sure that the header in reports is not optically destroyed by
+      too long columns (as it is the case all the time for PMOD commits
+      in the OpenPKG project).
+      [Ralf S. Engelschall]
+
    *) Correctly recognize and configure RSE CVS version in
       shiela-install program.
       [Ralf S. Engelschall]


ossp-pkg/shiela/shiela.pl 1.42 -> 1.43

--- shiela.pl    2002/12/23 11:32:05     1.42
+++ shiela.pl    2002/12/23 11:50:09     1.43
@@ -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
@@ -2074,8 +2091,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.
@@ -2104,13 +2121,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

CVSTrac 2.0.1