Enhanced --auto-cmd to take a REGEX instead of a STRING.
authorWayne Davison <wayned@samba.org>
Wed, 8 Feb 2006 01:48:38 +0000 (01:48 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 8 Feb 2006 01:48:38 +0000 (01:48 +0000)
verify-patches

index 2fafc9d..4ab2242 100755 (executable)
@@ -18,6 +18,8 @@ GetOptions(
     'auto-cmd=s' => \$auto_cmd,
 ) or &usage;
 
+$auto_cmd = qr/^($auto_cmd)$/;
+
 my $interesting_fuzz = $minor_updates ? '\d' : '[2-9]';
 
 chdir('patches') if -d 'patches';
@@ -110,7 +112,7 @@ foreach my $diff (@ARGV) {
            "\nFix rejects, Diff create, Edit both diffs, Update patch,\n",
            "Apply patch again, !(CMD), Build rsync, Next, Quit: [$default] ";
        my $ans = $default;
-       if ($default eq $auto_cmd) {
+       if ($default =~ /$auto_cmd/) {
            print $default, "\n";
        } else {
            my $input = <STDIN>;
@@ -287,7 +289,7 @@ sub usage
 {
     die <<EOT;
 Usage: $0 [OPTS] [DIFF-FILE...]
-     --auto-cmd=STR    If the suggested command is STR, enter it automatically
+     --auto-cmd=REGEX  If default_cmd =~ /^(REGEX)\$/, enter it automatically
  -f, --failures-only   Suggest skipping patches that don't have failing hunks
  -n, --no-cvs          Don't update tmp/cvsdir at the start of the run
  -p, --prepare-source  Run ./prepare-source and include generated files in diff