OSSP CVS Repository

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

Check-in Number: 3012
Date: 2002-Dec-22 17:30:14 (local)
2002-Dec-22 16:30:14 (UTC)
User:rse
Branch:
Comment: Line-break single-line log messages into multi-line log messages to make the usual log messages produced by "cvs commit -m '...'" more readable in the report.
Tickets:
Inspections:
Files:
ossp-pkg/shiela/ChangeLog      1.19 -> 1.20     5 inserted, 0 deleted
ossp-pkg/shiela/shiela.pl      1.32 -> 1.33     39 inserted, 1 deleted

ossp-pkg/shiela/ChangeLog 1.19 -> 1.20

--- ChangeLog    2002/12/22 11:06:50     1.19
+++ ChangeLog    2002/12/22 16:30:14     1.20
@@ -11,6 +11,11 @@
 
   Changes between 0.9.2 and 0.9.3 (19-Aug-2002 to 21-Dec-2002):
 
+   *) Line-break single-line log messages into multi-line log messages
+      to make the usual log messages produced by "cvs commit -m '...'"
+      more readable in the report.
+      [Ralf S. Engelschall]
+
    *) Fully reimplemented the "Content" "details" (the change summary in
       reports). It now supports both textual (via diff(1)) and binary
       (via xdelta(1)) file changes. Additionally each change report part


ossp-pkg/shiela/shiela.pl 1.32 -> 1.33

--- shiela.pl    2002/12/22 15:04:00     1.32
+++ shiela.pl    2002/12/22 16:30:14     1.33
@@ -979,6 +979,41 @@
 
 ##  _________________________________________________________________
 ##
+##  Wrap a single-line log message.
+##
+##  This line-wraps a single-line log message into a multi-line log
+##  message.
+##  _________________________________________________________________
+##
+
+sub wrap_message {
+    my ($columns, $text) = @_;
+
+    my $r = "";
+    my $nl = "";
+    my $left = "";
+    pos($text) = 0;
+
+    while ($text !~ m/\G\s*\Z/gc) {
+        if ($text =~ /\G([^\n]{0,$columns})(\s|\z)/xmgc) {
+            $r .= $nl . $1;
+            $left = $2;
+        } elsif ($text =~ /\G([^\n]*?)(\s|\z)/xmgc) {
+            $r .= $nl . $1;
+            $left = $2;
+        }
+        $nl = "\n";
+    }
+
+    $r .= $left;
+    $r .= substr($text, pos($text), length($text)-pos($text))
+        if (pos($text) ne length($text));
+
+    return $r;
+}
+
+##  _________________________________________________________________
+##
 ##  TAGINFO HOOK
 ##
 ##  We hook into CVS via `taginfo' to check whether user is allowed to
@@ -2135,7 +2170,10 @@
             $O .= "\n";
             $O .= $prefix."Log:\n";
             my $log = $IN->{log};
-            $log =~ s|^|$prefix  |mg;
+            if ($log !~ m|\n.+|s and length($log) > 70) {
+                $log = &wrap_message(70, $log);
+            }
+            $log =~ s|^|${prefix}  |mg;
             $O .= $log;
         }
 

CVSTrac 2.0.1