You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/02/26 13:25:25 UTC

svn commit: r1293820 - /subversion/trunk/tools/dist/backport.pl

Author: danielsh
Date: Sun Feb 26 12:25:25 2012
New Revision: 1293820

URL: http://svn.apache.org/viewvc?rev=1293820&view=rev
Log:
Rework parsing with a focus on the approved changes.

(Yes, someday I'll rework the entire script so it's less of a
single-purpose hack and more of a clean, reuseable piece of code.
That day is not today.)

* tools/dist/backport.pl:
  ("", main): Read in line mode until the "Approved changes" header, and
    in paragraph mode thereafter.

Modified:
    subversion/trunk/tools/dist/backport.pl

Modified: subversion/trunk/tools/dist/backport.pl
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport.pl?rev=1293820&r1=1293819&r2=1293820&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Sun Feb 26 12:25:25 2012
@@ -24,8 +24,6 @@ use Term::ReadKey qw/ReadMode ReadKey/;
 use File::Temp qw/tempfile/;
 use POSIX qw/ctermid/;
 
-$/ = ""; # paragraph mode
-
 my $SVN = $ENV{SVN} || 'svn'; # passed unquoted to sh
 my $VIM = 'vim';
 my $STATUS = './STATUS';
@@ -230,22 +228,32 @@ sub main {
   usage, exit 0 if @ARGV;
   usage, exit 1 unless -r $STATUS;
 
-  my $sawapproved;
   @ARGV = $STATUS;
+
+  # Skip most of the file
   while (<>) {
-    my @lines = split /\n/;
+    last if /^Approved changes/;
+  }
+  while (<>) {
+    last unless /^=+$/;
+  }
+  $/ = ""; # paragraph mode
 
-    # Skip most of the file
-    next unless $sawapproved ||= /^Approved changes/;
+  while (<>) {
+    my @lines = split /\n/;
 
     given ($lines[0]) {
       # Section header
       when (/^[A-Z].*:$/i) {
         print "\n\n=== $lines[0]" unless $YES;
       }
+      # Separator after section header
+      when (/^=+$/i) {
+        break;
+      }
       # Backport entry?
       when (/^ \*/) {
-        handle_entry @lines if $sawapproved;
+        handle_entry @lines;
       }
       default {
         warn "Unknown entry '$lines[0]' at $ARGV:$.\n";



Re: svn commit: r1293820 - /subversion/trunk/tools/dist/backport.pl

Posted by Stefan Sperling <st...@elego.de>.
On Sun, Feb 26, 2012 at 12:25:25PM -0000, danielsh@apache.org wrote:
> Author: danielsh
> Date: Sun Feb 26 12:25:25 2012
> New Revision: 1293820

> (Yes, someday I'll rework the entire script so it's less of a
> single-purpose hack and more of a clean, reuseable piece of code.
> That day is not today.)

This is written in Perl, after all :)