subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1569242 - /subversion/trunk/tools/dist/backport.pl
Date Tue, 18 Feb 2014 09:23:52 GMT
Author: danielsh
Date: Tue Feb 18 09:23:51 2014
New Revision: 1569242

URL: http://svn.apache.org/r1569242
Log:
backport.pl: Clean up revert-before-merge logic.  No functional change.

* tools/dist/backport.pl
  (merge): Concentrate all the logic governing revert in one place.
  (revert): Grow optional discard_STATUS argument.

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=1569242&r1=1569241&r2=1569242&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Tue Feb 18 09:23:51 2014
@@ -220,7 +220,6 @@ sub prompt {
 
 sub merge {
   my %entry = @_;
-  $MERGED_SOMETHING++;
 
   my ($logmsg_fh, $logmsg_filename) = tempfile();
   my ($mergeargs);
@@ -258,13 +257,6 @@ set -e
 if $sh[$DEBUG]; then
   set -x
 fi
-if ! $sh[$MAY_COMMIT] ; then
-  cp STATUS STATUS.$$
-fi
-$SVNq revert -R .
-if ! $sh[$MAY_COMMIT] ; then
-  mv STATUS.$$ STATUS
-fi
 $SVNq up
 $SVNq merge $mergeargs
 if [ "`$SVN status -q | wc -l`" -eq 1 ]; then
@@ -317,6 +309,10 @@ EOF
     warn "Local mods saved to '$backupfile'\n";
   }
 
+  # If $MAY_COMMIT, then $script will edit STATUS anyway.
+  revert(verbose => 0, discard_STATUS => $MAY_COMMIT);
+
+  $MERGED_SOMETHING++;
   open SHELL, '|-', qw#/bin/sh# or die "$! (in '$entry{header}')";
   print SHELL $script;
   close SHELL or warn "$0: sh($?): $! (in '$entry{header}')";
@@ -623,12 +619,14 @@ EOVIM
 sub revert {
   my %args = @_;
   die "Bug: \$args{verbose} undefined" unless exists $args{verbose};
-  copy $STATUS, "$STATUS.$$.tmp";
+  die "Bug: unknown argument" if grep !/^(?:verbose|discard_STATUS)$/, keys %args;
+
+  copy $STATUS, "$STATUS.$$.tmp"        unless $args{discard_STATUS};
   system("$SVN revert -q $STATUS") == 0
     or die "revert failed ($?): $!";
   system("$SVN revert -R ./" . (" -q" x !$args{verbose})) == 0
     or die "revert failed ($?): $!";
-  move "$STATUS.$$.tmp", $STATUS;
+  move "$STATUS.$$.tmp", $STATUS        unless $args{discard_STATUS};
   $MERGED_SOMETHING = 0;
 }
 



Mime
View raw message