cvs commit: www/scripts cvs2cl.pl

jeroen at linuxfromscratch.org jeroen at linuxfromscratch.org
Sat Nov 22 07:55:36 PST 2003


jeroen      03/11/22 08:55:36

  Modified:    scripts  cvs2cl.pl
  Log:
  Update cvs2cl.pl to latest version; make the logs silent
  
  Revision  Changes    Path
  1.2       +40 -16    www/scripts/cvs2cl.pl
  
  Index: cvs2cl.pl
  ===================================================================
  RCS file: /home/cvsroot/www/scripts/cvs2cl.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cvs2cl.pl	22 Nov 2003 14:27:57 -0000	1.1
  +++ cvs2cl.pl	22 Nov 2003 15:55:36 -0000	1.2
  @@ -9,8 +9,8 @@
   ###                                                        ###
   ##############################################################
   
  -## $Revision: 1.1 $
  -## $Date: 2003/11/22 14:27:57 $
  +## $Revision: 1.2 $
  +## $Date: 2003/11/22 15:55:36 $
   ## $Author: jeroen $
   ##
   ##   (C) 2001,2002,2003 Martyn J. Pearce <fluffy at cpan.org>, under the GNU GPL.
  @@ -79,10 +79,10 @@
   use constant MAILNAME => "/etc/mailname";
   
   # What we run to generate it:
  -my $Log_Source_Command = "cvs log";
  +my $Log_Source_Command = "cvs -Q log";
   
   # In case we have to print it out:
  -my $VERSION = '$Revision: 1.1 $';
  +my $VERSION = '$Revision: 1.2 $';
   $VERSION =~ s/\S+\s+(\S+)\s+\S+/$1/;
   
   ## Vars set by options:
  @@ -110,6 +110,9 @@
   # as it guarantees at least one entry in the update changelog, which means
   # that there will always be a date to extract for the next update.  The repeat
   # entry can be removed in postprocessing, if necessary.
  +
  +# MJP 2003-08-02
  +# I don't think this actually does anything useful
   my $Update = 0;
   
   # Expand usernames to email addresses based on a map file?
  @@ -154,6 +157,7 @@
   
   # Format more for programs than for humans.
   my $XML_Output = 0;
  +my $No_XML_Namespace = 0;
   
   # Do some special tweaks for log data that was written in FSF
   # ChangeLog style.
  @@ -323,10 +327,12 @@
     return $boundary_date;
   }
   
  -sub wrap {
  +# Don't call this wrap, because with 5.5.3, that clashes with the
  +# (unconditional :-( ) export of wrap() from Text::Wrap
  +sub mywrap {
     my ($indent1, $indent2, @text) = @_;
  -  my $text = Text::Wrap::wrap($indent1, $indent2, @text);
     # If incoming text looks preformatted, don't get clever
  +  my $text = Text::Wrap::wrap($indent1, $indent2, @text);
     if ( grep /^\s+/m, @text ) {
       return $text;
     }
  @@ -905,7 +911,9 @@
         my $declaration =
           sprintf '<?xml %s?>', join ' ', grep length, $version, $encoding;
         my $root        =
  -        '<changelog>';
  +        $No_XML_Namespace ?
  +        '<changelog>'     :
  +        '<changelog xmlns="http://www.red-bean.com/xmlns/cvs2cl/">';
         print LOG_OUT "$declaration\n\n$root\n\n";
       }
   
  @@ -952,7 +960,8 @@
               }
             }
           }
  -        foreach my $tag (keys %tags) {
  +        # Sort here for determinism to ease testing
  +        foreach my $tag (sort keys %tags) {
             if (!defined $tag_date_printed{$tag}) {
               $tag_date_printed{$tag} = $time;
               if ($XML_Output) {
  @@ -1036,7 +1045,7 @@
             elsif ($No_Wrap && !$Summary)
             {
               $msg = &preprocess_msg_text ($msg);
  -            $files = wrap ("\t", "\t", "* $files");
  +            $files = mywrap ("\t", "\t  ", "* $files");
               $msg =~ s/\n(.+)/\n\t$1/g;
               unless ($After_Header eq " ") {
                 $msg =~ s/^(.+)/\t$1/g;
  @@ -1124,7 +1133,7 @@
             {
               if ($FSF_Style)
               {
  -              $files = wrap ("\t", "\t", "* $files");
  +              $files = mywrap ("\t", "\t", "* $files");
   
                 my $files_last_line_len = 0;
                 if ($After_Header eq " ")
  @@ -1141,7 +1150,7 @@
               {
                 $msg = &preprocess_msg_text ($msg);
                 $body = $files . $After_Header . $msg;
  -              $body = wrap ("\t", "\t  ", "* $body");
  +              $body = mywrap ("\t", "\t  ", "* $body");
                 $body =~ s/[ \t]+\n/\n/g;
               }
             }
  @@ -1597,7 +1606,7 @@
     if ($XML_Output)
     {
       $text = &xml_escape ($text);
  -    $text =~ s/\n$//;
  +    chomp $text;
       $text = "<msg>${text}</msg>\n";
     }
     elsif (! $No_Wrap)
  @@ -1819,10 +1828,23 @@
   sub maybe_read_user_map_file ()
   {
     my %expansions;
  +  my $User_Map_Input;
   
     if ($User_Map_File)
     {
  -    open (MAPFILE, "<$User_Map_File")
  +    if ( $User_Map_File =~ m{^([-\w\@+=.,\/]+):([-\w\@+=.,\/:]+)} and
  +         !-f $User_Map_File )
  +    {
  +      my $rsh = (exists $ENV{'CVS_RSH'} ? $ENV{'CVS_RSH'} : 'ssh');
  +      $User_Map_Input = "$rsh $1 'cat $2' |";
  +      &debug ("(run \"${User_Map_Input}\")\n");
  +    }
  +    else
  +    {
  +      $User_Map_Input = "<$User_Map_File";
  +    }
  +
  +    open (MAPFILE, $User_Map_Input)
           or die ("Unable to open $User_Map_File ($!)");
   
       while (<MAPFILE>)
  @@ -2072,6 +2094,9 @@
       elsif ($arg =~ /^--xml$/) {
         $XML_Output = 1;
       }
  +    elsif ($arg =~ /^--noxmlns$/) {
  +      $No_XML_Namespace = 1;
  +    }
       elsif ($arg =~ /^--hide-filenames$/) {
         $Hide_Filenames = 1;
         $After_Header = "";
  @@ -2264,8 +2289,6 @@
     --no-wrap                    Don't auto-wrap log message (recommend -S also)
     --gmt, --utc                 Show times in GMT/UTC instead of local time
     --accum                      Add to an existing ChangeLog (incompat w/ --xml)
  -  --update                     As --accum, but lists only files changed since
  -                               last run
     -w, --day-of-week            Show day of week
     --no-times                   Don't show times in output
     --chrono                     Output log in chronological order
  @@ -2273,6 +2296,7 @@
     --header FILE                Get ChangeLog header from FILE ("-" means stdin)
     --xml                        Output XML instead of ChangeLog format
     --xml-encoding ENCODING      Insert encoding clause in XML header
  +  --noxmlns                    Don't include xmlns= attribute in root element
     --hide-filenames             Don't show filenames (ignored for XML output)
     --no-common-dir              Don't shorten directory names from filenames.
     --rcs CVSROOT                Handle filenames from raw RCS, for instance
  
  
  



More information about the website mailing list