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 2013/07/02 22:14:16 UTC

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

Author: danielsh
Date: Tue Jul  2 20:14:15 2013
New Revision: 1499093

URL: http://svn.apache.org/r1499093
Log:
backport.pl: handle SIGINT (^C).

* tools/dist/backport.pl
  (maybe_revert): New helper.
  (main): Break out the last part into the helper, and install it as a signal
    handler, too.

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=1499093&r1=1499092&r2=1499093&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Tue Jul  2 20:14:15 2013
@@ -273,6 +273,12 @@ sub handle_entry {
   1;
 }
 
+sub maybe_revert {
+  "This is both a SIGINT handler, and the tail end of main() in normal runs.";
+  system $SVN, qw/revert -R ./ if !$YES and prompt 'Revert? ';
+  exit if @_;
+}
+
 sub main {
   usage, exit 0 if @ARGV;
 
@@ -294,6 +300,8 @@ sub main {
   }
   $/ = ""; # paragraph mode
 
+  $SIG{INT} = \&maybe_revert;
+
   my $in_approved = 0;
   while (<STATUS>) {
     my @lines = split /\n/;
@@ -324,7 +332,7 @@ sub main {
     }
   }
 
-  system $SVN, qw/revert -R ./ if !$YES and prompt 'Revert? ';
+  maybe_revert;
 }
 
 &main