CVSROOT: loginfo (HEAD)

Paweł Żurowski pzurowski w post.pl
Nie, 25 Sty 2004, 18:37:49 CET


W liście z nie, 25-01-2004, godz. 18:31, Jakub Bogusz pisze: 
> serek zaaplikował, ale nie od razu działało (też nie mogę zapamiętać,
> który znaczek jest pierwszy w =~ i man perlop jest w użyciu).
> No i trudno zmienić Subject już po przesłaniu go.
> Poprawione.

w zalaczniku tez (troszke inaczej niz Ty), + mozliwosc zmiany dlugosci
subjectu w konfiguracji (78 to nie za malo?)

BTW, myslalem, ze ten co psuje, ten poprawia ;)

pozdrawiam
-pawel

-- 
Pawel Zurowski
JID: <my_login>@jabber.org
-------------- następna część ---------
Index: cvslog.pl
===================================================================
RCS file: /cvsroot/CVSROOT/cvslog.pl,v
retrieving revision 1.15
diff -u -r1.15 cvslog.pl
--- cvslog.pl	25 Jan 2004 17:19:37 -0000	1.15
+++ cvslog.pl	25 Jan 2004 17:31:55 -0000
@@ -26,12 +26,12 @@
 # TODO: attach diffs (under some length, possibly a diffstat instead),
 #	non-agressively reformat log messages
 #
-# $Id: cvslog.pl,v 1.15 2004/01/25 17:19:37 qboosh Exp $
+# $Id: cvslog.pl,v 1.12 2004/01/25 16:52:40 qboosh Exp $
 
 use strict;
 use vars qw ($project $repository $from_email $dest_email $reply_email
 		$CVS $diffstat $cvsweb_url $help_msg $sync_delay $max_diff_lines
-		$show_diffstat $show_diff $login $subj_files);
+		$show_diffstat $show_diff $login $subj_files $subj_maxlength);
 
 
 
@@ -101,6 +101,8 @@
 # Whether you want the affected files list in subject
 $subj_files=1;
 
+# How long the subject can be
+$subj_maxlength=78;
 
 ### The code itself
 
@@ -267,41 +269,57 @@
 $date = scalar gmtime;
 
 
-# Fill in subj and possibly cut it
 
-my ($subj);
-$subj = "Subject: [$project] $module".($tag?" ($tag)":"").($subj_files?": ===FILES=== ":": ").$logmsg;
-$subj =~ s/\n/ /g; $subj =~ s/ *$//;
 
 # Compose the mail
 
 # TODO: Use CVSROOT/users to determine the committer's realname and email and
 # add it to the reply-to / mail-followup-to list. --pasky
 
-my ($VERSION) = '$Revision: 1.15 $' =~ / (\d+\.\d+) /;
+my ($VERSION) = '$Revision: 1.12 $' =~ / (\d+\.\d+) /;
+
+
+# Subject files and future "Files affected" part"
 
-# List of files for subject
+my $files_affected_part;
 my $subj_file_list="";
 for (my $i = 0; $i < @dirs; $i++) {
   my $dirs = $dirs[$i];
   my $dir = $dirs->{name};
   my $subdir = $dir;
   $subdir =~ s!^[^/]*/?!!;
-  $subdir .= '/' if $subdir ne '';
-  if ($dirs[$i]->{type} ne 'directory') {
+
+  $files_affected_part = "$dir:\n";
+
+  if ($dirs[$i]->{type} eq 'directory') {
+    $files_affected_part = "   New directory\n";
+
+  } else {
     my $commits = $dirs->{commits};
+
     for (my $j = 0; $j < @$commits; $j++) {
       my $commit = $commits->[$j];
-      my $name = $commit->{name};
-      $subj_file_list.="$subdir$name, ";
+      my ($name, $oldrev, $newrev, $op) = ($commit->{name}, $commit->{oldrev}, $commit->{newrev}, $commit->{op});
+      $files_affected_part = "   $name ($oldrev -> $newrev) ";
+      $files_affected_part = " (new)" if ($op eq 'add');
+      $files_affected_part = " (removed)" if ($op eq 'remove');
+      $files_affected_part = " (?! contact pasky)" if ($op eq '?');
+      $files_affected_part = "\n";
+      $files_affected_part = "    $cvsweb_url/$dir/$name?r1=$oldrev&r2=$newrev&f=u\n"
+        if defined $cvsweb_url and $op ne 'add' and $op ne 'remove';
+      $subj_file_list.="$subdir/$name, ";
     }
   }
 }
 
+# Fill in subj and possibly cut it
+
+my ($subj);
 $subj_file_list =~ s/, $//;
-$subj =~ s/===FILES===/$subj_file_list/;
+$subj = "Subject: [$project] $module".($tag?" ($tag)":"").": ".($subj_files?$subj_file_list:"").$logmsg;
+$subj =~ s/\n/ /g; $subj =~ s/ *$//;
+$subj = substr($subj, 0, $subj_maxlength-3) . '...' if (length($subj) > $subj_maxlength);
 
-$subj = substr($subj, 0, 75) . '...' if (length($subj) > 78);
 
 print MAIL <<EOM;
 From: $from_email
@@ -331,44 +349,18 @@
 
 ---- Files affected:
 
+$files_affected_part
 EOM
 
 
 # List the files being changed, plus the cvsweb URLs
 
-for (my $i = 0; $i < @dirs; $i++) {
-  my $dirs = $dirs[$i];
-  my $dir = $dirs->{name};
-
-  print MAIL "$dir:\n";
-
-  if ($dirs[$i]->{type} eq 'directory') {
-    print MAIL "   New directory\n";
-
-  } else {
-    my $commits = $dirs->{commits};
-
-    for (my $j = 0; $j < @$commits; $j++) {
-      my $commit = $commits->[$j];
-      my ($name, $oldrev, $newrev, $op) = ($commit->{name}, $commit->{oldrev}, $commit->{newrev}, $commit->{op});
-      print MAIL "   $name ($oldrev -> $newrev) ";
-      print MAIL " (new)" if ($op eq 'add');
-      print MAIL " (removed)" if ($op eq 'remove');
-      print MAIL " (?! contact pasky)" if ($op eq '?');
-      print MAIL "\n";
-      print MAIL "    $cvsweb_url/$dir/$name?r1=$oldrev&r2=$newrev&f=u\n"
-        if defined $cvsweb_url and $op ne 'add' and $op ne 'remove';
-    }
-  }
-}
-
 goto end_diff unless $show_diff or $show_diffstat;
 
 print MAIL <<EOM;
 
 
 ---- Diffs:
-
 EOM
 
 


Więcej informacji o liście dyskusyjnej pld-devel-pl