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/02 15:19:39 UTC

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

Author: danielsh
Date: Thu Feb  2 14:19:39 2012
New Revision: 1239639

URL: http://svn.apache.org/viewvc?rev=1239639&view=rev
Log:
* tools/dist/backport.pl
  (feature): Use 'switch' and 'say'.  This requires Perl 5.10.
  (main): Rewrite using switch(). Don't print in batch mode.

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=1239639&r1=1239638&r2=1239639&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Thu Feb  2 14:19:39 2012
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -l
 use warnings;
 use strict;
+use feature qw/switch say/;
 
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -217,14 +218,22 @@ sub main {
   while (<>) {
     my @lines = split /\n/;
 
-    # Section header?
+    # Skip most of the file
     next unless $sawapproved ||= /^Approved changes/;
-    print "\n\n=== $lines[0]" and next if $lines[0] =~ /^[A-Z].*:$/i;
 
-    # Backport entry?
-    handle_entry @lines and next if $lines[0] =~ /^ \*/ and $sawapproved;
-
-    warn "Unknown entry '$lines[0]' at $ARGV:$.\n";
+    given ($lines[0]) {
+      # Section header
+      when (/^[A-Z].*:$/i) {
+        print "\n\n=== $lines[0]" unless $ENV{YES};
+      }
+      # Backport entry?
+      when (/^ \*/) {
+        handle_entry @lines if $sawapproved;
+      }
+      default {
+        warn "Unknown entry '$lines[0]' at $ARGV:$.\n";
+      }
+    }
   }
 }