Author: danielsh
Date: Mon Apr 15 17:48:49 2013
New Revision: 1468166

URL: http://svn.apache.org/r1468166
Log:
backport.pl: use automatic merge when $SVN ≥ 1.8.0.

* tools/dist/backport.pl
  ($SVNvsn): New global.
  (merge): Omit --reintegrate for 1.8.  Adjust messages accordingly.

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=1468166&r1=1468165&r2=1468166&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Mon Apr 15 17:48:49 2013
@@ -37,6 +37,10 @@ $DEBUG = 'true' if exists $ENV{DEBUG};
 
 # derived values
 my $SVNq;
+my $SVNvsn = do {
+  my ($major, $minor, $patch) = `$SVN --version -q` =~ /^(\d+)\.(\d+)\.(\d+)/;
+  1e6*$major + 1e3*$minor + $patch;
+};
 
 $SVN .= " --non-interactive" if $YES or not defined ctermid;
 $SVNq = "$SVN -q ";
@@ -81,8 +85,13 @@ sub merge {
   if ($entry{branch}) {
     # NOTE: This doesn't escape the branch into the pattern.
     $pattern = sprintf '\V\(%s branch(es)?\|branches\/%s\|Branch\(es\)\?: 
\*\n\? \*%s\)', $entry{branch}, $entry{branch}, $entry{branch};
-    $mergeargs = "--reintegrate $BRANCHES/$entry{branch}";
-    print $logmsg_fh "Reintegrate the $entry{header}:";
+    if ($SVNvsn >= 1_008_000) {
+      $mergeargs = "$BRANCHES/$entry{branch}";
+      print $logmsg_fh "Merge the $entry{header}:";
+    } else {
+      $mergeargs = "--reintegrate $BRANCHES/$entry{branch}";
+      print $logmsg_fh "Reintegrate the $entry{header}:";
+    }
     print $logmsg_fh "";
   } elsif (@{$entry{revisions}}) {
     $pattern = '^ [*] \V' . 'r' . $entry{revisions}->[0];
@@ -100,6 +109,7 @@ sub merge {
   print $logmsg_fh $_ for @{$entry{entry}};
   close $logmsg_fh or die "Can't close $logmsg_filename: $!";
 
+  my $reintegrated_word = ($SVNvsn >= 1_008_000) ? "merged" : "reintegrated";
   my $script = <<"EOF";
 #!/bin/sh
 set -e
@@ -125,10 +135,10 @@ reinteg_rev=\`$SVN info $STATUS | sed -n
 if $WET_RUN; then
   # Sleep to avoid out-of-order commit notifications
   if [ -n "\$YES" ]; then sleep 15; fi
-  $SVNq rm $BRANCHES/$entry{branch} -m "Remove the '$entry{branch}' branch, 
reintegrated in r\$reinteg_rev."
+  $SVNq rm $BRANCHES/$entry{branch} -m "Remove the '$entry{branch}' branch, 
$reintegrated_word in r\$reinteg_rev."
   if [ -n "\$YES" ]; then sleep 1; fi
 else
-  echo "Removing reintegrated '$entry{branch}' branch"
+  echo "Removing $reintegrated_word '$entry{branch}' branch"
 fi
 EOF
 


Reply via email to