subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1499647 - /subversion/trunk/tools/dist/backport.pl
Date Thu, 04 Jul 2013 04:33:44 GMT
Author: danielsh
Date: Thu Jul  4 04:33:44 2013
New Revision: 1499647

URL: http://svn.apache.org/r1499647
Log:
backport.pl: Record all errors during merges (in particular, errors that
manifest as $? != 0 in merge(), with no conflict in 'svn status'), and print
a warning summary at the end (for conflict batch mode).

* tools/dist/backport.pl
  (%ERRORS): New global.
  (merge): Record an error if $? != 0
  (handle_entry): Record an error if conflict found after merge.
  (warning_summary): New subroutine
  (exit_stage_left): Use it, communicate number of warnings via our exit code.

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=1499647&r1=1499646&r2=1499647&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Thu Jul  4 04:33:44 2013
@@ -29,6 +29,7 @@ my $SVN = $ENV{SVN} || 'svn'; # passed u
 my $VIM = 'vim';
 my $STATUS = './STATUS';
 my $BRANCHES = '^/subversion/branches';
+my %ERRORS = ();
 
 my $YES = ($ENV{YES} // 0) ? 1 : 0; # batch mode: eliminate prompts, add sleeps
 my $MAY_COMMIT = qw[false true][0];
@@ -209,6 +210,7 @@ EOF
   open SHELL, '|-', qw#/bin/sh# or die "$! (in '$entry{header}')";
   print SHELL $script;
   close SHELL or warn "$0: sh($?): $! (in '$entry{header}')";
+  $ERRORS{$entry{header}} = "sh($?): $!" if $?;
 
   if (-z $backupfile) {
     unlink $backupfile;
@@ -349,10 +351,24 @@ sub maybe_revert {
   exit if @_;
 }
 
+sub warning_summary {
+  return unless %ERRORS;
+
+  warn "Warning summary\n";
+  warn "===============\n";
+  warn "\n";
+  for my $entry_header (keys %ERRORS) {
+    my $header;
+    ($header = $entry_header) =~ s/ (group|branch)$//;
+    warn "$header: $ERRORS{$entry_header}\n";
+  }
+}
+
 sub exit_stage_left {
   maybe_revert;
+  warning_summary if $YES;
   vote shift;
-  exit;
+  exit scalar keys %ERRORS;
 }
 
 sub handle_entry {
@@ -374,6 +390,7 @@ sub handle_entry {
 
         my $output;
         if (($output = `$SVN status`) =~ /^(C|.C|...C)/m) {
+          $ERRORS{$entry{header}} //= "Conflicts merging the $entry{header}!";
           say STDERR "Conflicts merging the $entry{header}!";
           say STDERR "";
           say STDERR $output;



Mime
View raw message