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/08 16:16:46 UTC

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

Author: danielsh
Date: Mon Jul  8 14:16:46 2013
New Revision: 1500746

URL: http://svn.apache.org/r1500746
Log:
backport.pl: Usability improvements: deny invalid input.

Suggested by: stefan2

* tools/dist/backport.pl
  (handle_entry): Re-prompt on invalid input.
    This adds a second instance of the 'while(1) as goto label' hack.

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=1500746&r1=1500745&r2=1500746&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Mon Jul  8 14:16:46 2013
@@ -497,7 +497,9 @@ sub handle_entry {
     say "";
     say "Vetoes found!" if @vetoes;
 
-    given (prompt 'Go ahead? [y,±1,±0,q,e,a, ,N] ',
+    # See above for why the while(1).
+    QUESTION: while (1) {
+    given (prompt 'Run a merge? [y,±1,±0,q,e,a, ,N] ',
                    verbose => 1, extra => qr/[+-]/) {
       when (/^y/i) {
         merge %entry;
@@ -538,12 +540,16 @@ sub handle_entry {
       when (/^N/i) {
         $state->{$entry{digest}}++;
       }
+      when (/^\x20/) {
+        last PROMPT; # Fall off the end of the given/when block.
+      }
       default {
-        # nothing
+        say "Please use one of the options in brackets (q to quit)!";
+        next QUESTION;
       }
     }
-    last;
-    }
+    last; } # QUESTION
+    last; } # PROMPT
   }
 
   # TODO: merge() changes ./STATUS, which we're reading below, but