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 2014/02/18 10:18:50 UTC

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

Author: danielsh
Date: Tue Feb 18 09:18:50 2014
New Revision: 1569239

URL: http://svn.apache.org/r1569239
Log:
backport.pl: Sanitify backup-diff generation.  No functional change.

* tools/dist/backport.pl
  (merge): Concentrate all the logic governing the backup diff in one place.

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=1569239&r1=1569238&r2=1569239&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Tue Feb 18 09:18:50 2014
@@ -225,10 +225,6 @@ sub merge {
   my ($logmsg_fh, $logmsg_filename) = tempfile();
   my ($mergeargs);
 
-  # Include the time so it's easier to find the interesting backups.
-  my $backupfile = strftime "backport_pl.%Y%m%d-%H%M%S.$$.tmp", localtime;
-  die if -s $backupfile;
-
   if ($entry{branch}) {
     if ($SVNvsn >= 1_008_000) {
       $mergeargs = "$BRANCHES/$entry{branch}";
@@ -262,7 +258,6 @@ set -e
 if $sh[$DEBUG]; then
   set -x
 fi
-$SVN diff > $backupfile
 if ! $sh[$MAY_COMMIT] ; then
   cp STATUS STATUS.$$
 fi
@@ -311,17 +306,22 @@ elif ! $sh[$YES]; then
 fi
 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{id}} = [\%entry, "sh($?): $!"] if $?;
-
+  # Include the time so it's easier to find the interesting backups.
+  my $backupfile = strftime "backport_pl.%Y%m%d-%H%M%S.$$.tmp", localtime;
+  die if -s $backupfile;
+  system("$SVN diff > $backupfile") == 0
+    or die "Saving a backup diff ($backupfile) failed ($?): $!";
   if (-z $backupfile) {
     unlink $backupfile;
   } else {
     warn "Local mods saved to '$backupfile'\n";
   }
 
+  open SHELL, '|-', qw#/bin/sh# or die "$! (in '$entry{header}')";
+  print SHELL $script;
+  close SHELL or warn "$0: sh($?): $! (in '$entry{header}')";
+  $ERRORS{$entry{id}} = [\%entry, "sh($?): $!"] if $?;
+
   unlink $logmsg_filename unless $? or $!;
 }