Author: adam-guest
Date: 2008-02-23 16:28:54 +0000 (Sat, 23 Feb 2008)
New Revision: 1044

Modified:
   trunk/conf.default.in
   trunk/debian/changelog
   trunk/debian/postinst
   trunk/scripts/bts.pl
Log:
bts:
  - Add a --force-interactive option which is similar to --interactive
    but spawns an editor for the message before prompting for sending
    confirmation (Closes: #467134)
  - Allow the use of --{force-,}interactive to be specified in the
    configuration file (Closes: #467131)

Modified: trunk/conf.default.in
===================================================================
--- trunk/conf.default.in       2008-02-23 10:16:33 UTC (rev 1043)
+++ trunk/conf.default.in       2008-02-23 16:28:54 UTC (rev 1044)
@@ -89,6 +89,13 @@
 #
 # Suppress BTS acknowledgment e-mails (ignored by the control bot)
 # BTS_SUPPRESS_ACKS=no
+#
+# Allow the generated message to be edited and, if necessary, abandoned
+# before sending it to the control bot?
+#
+# If set to yes, prompt for confirmation / edit / abandonment.
+# If set to force, spawn an editor and then proceed as if set to yes
+# BTS_INTERACTIVE=no
 
 ##### chdist
 #

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-02-23 10:16:33 UTC (rev 1043)
+++ trunk/debian/changelog      2008-02-23 16:28:54 UTC (rev 1044)
@@ -38,6 +38,12 @@
     - Use existing changelog data directly rather than re-using
       dpkg-parsechangelog's Changes: field and therefore don't apply any
       reformatting (Closes: #452806)
+  * bts:
+    - Add a --force-interactive option which is similar to --interactive
+      but spawns an editor for the message before prompting for sending
+      confirmation (Closes: #467134)
+    - Allow the use of --{force-,}interactive to be specified in the
+      configuration file (Closes: #467131)
 
   [ Christoph Berg ]
   * dget:

Modified: trunk/debian/postinst
===================================================================
--- trunk/debian/postinst       2008-02-23 10:16:33 UTC (rev 1043)
+++ trunk/debian/postinst       2008-02-23 16:28:54 UTC (rev 1044)
@@ -411,6 +411,16 @@
 # DGET_UNPACK=yes
 # Verify source package signatures using dscverify
 # DGET_VERIFY=yes
+#
+##### bts options added in version 2.10.17
+#
+# Allow the generated message to be edited and, if necessary, abandoned
+# before sending it to the control bot?
+#
+# If set to yes, prompt for confirmation / edit / abandonment.          
+# If set to force, spawn an editor and then proceed as if set to yes
+# BTS_INTERACTIVE=no 
+
 EOF
        fi
     fi

Modified: trunk/scripts/bts.pl
===================================================================
--- trunk/scripts/bts.pl        2008-02-23 10:16:33 UTC (rev 1043)
+++ trunk/scripts/bts.pl        2008-02-23 16:28:54 UTC (rev 1044)
@@ -310,6 +310,11 @@
 Before sending an e-mail to the control bot, display the content and
 allow it to be edited, or the sending cancelled.
 
+=item --force-interactive
+
+Similar to --interactive, with the exception that an editor is spawned 
+before prompting for confirmation of the message to be sent.
+
 =item --no-interactive
 
 Send control e-mails without confirmation.  This is the default behaviour.
@@ -344,6 +349,8 @@
 my $sendmail_t='^/usr/sbin/sendmail$|^/usr/sbin/exim';
 my $includeresolved=1;
 my $requestack=1;
+my $interactive=0;
+my $forceinteractive=0;
 
 # Next, read read configuration files and then command line
 # The next stuff is boilerplate
@@ -364,6 +371,7 @@
                       'BTS_INCLUDE_RESOLVED' => 'yes',
                       'BTS_SMTP_HOST' => '',
                       'BTS_SUPPRESS_ACKS' => 'no',
+                      'BTS_INTERACTIVE' => 'no',
                       );
     my %config_default = %config_vars;
     
@@ -398,6 +406,8 @@
        or $config_vars{'BTS_INCLUDE_RESOLVED'} = 'yes';
     $config_vars{'BTS_SUPPRESS_ACKS'} =~ /^(yes|no)$/
        or $config_vars{'BTS_SUPPRESS_ACKS'} = 'no';
+    $config_vars{'BTS_INTERACTIVE'} =~ /^(yes|no|force)$/
+       or $config_vars{'BTS_INTERACTIVE'} = 'no';
 
     if (!length $config_vars{'BTS_SMTP_HOST'}
         and $config_vars{'BTS_SENDMAIL_COMMAND'} ne '/usr/sbin/sendmail') {
@@ -429,6 +439,8 @@
     $smtphost = $config_vars{'BTS_SMTP_HOST'};
     $includeresolved = $config_vars{'BTS_INCLUDE_RESOLVED'} eq 'yes' ? 1 : 0;
     $requestack = $config_vars{'BTS_SUPPRESS_ACKS'} eq 'no' ? 1 : 0;
+    $interactive = $config_vars{'BTS_INTERACTIVE'} eq 'no' ? 0 : 1;
+    $forceinteractive = $config_vars{'BTS_INTERACTIVE'} eq 'force' ? 1 : 0;
 }
 
 if (exists $ENV{'BUGSOFFLINE'}) {
@@ -442,7 +454,6 @@
 my $quiet=0;
 my $ccemail="";
 my $ccsecurity="";
-my $interactive=0;
 
 Getopt::Long::Configure('require_order');
 GetOptions("help|h" => \$opt_help,
@@ -466,7 +477,9 @@
           "noconf|no-conf" => \$opt_noconf,
           "include-resolved!" => \$includeresolved,
           "ack!" => \$requestack,
-          "i|interactive!" => \$interactive,
+          "i|interactive" => \$interactive,
+          "no-interactive" => sub { $interactive = 0; $forceinteractive = 0; },
+          "force-interactive" => sub { $interactive = 1; $forceinteractive = 
1; },
           )
     or die "Usage: bts [options]\nRun $progname --help for more details\n";
 
@@ -1783,6 +1796,8 @@
    --no-ack               Suppress BTS acknowledgment mails
    --ack                  Do not do so (default)
    -i, --interactive      Prompt for confirmation before sending e-mail
+   --force-interactive    Same as --interactive, with the exception that an
+                          editor is spawned before confirmation is requested
    --no-interactive       Do not do so (default)
    -h, --help             Display this message
    -v, --version          Display version and copyright info
@@ -1896,6 +1911,7 @@
                .  "# Automatically generated email from bts,"
                   . " devscripts version $version\n";
 
+    $body = edit($body) if $forceinteractive;
     if ($interactive) {
        while(1) {
            print "\n", $message, "\n", $body, "\n---\n";       
@@ -3275,6 +3291,12 @@
 If this is set to I<yes>, then it is the same as the --no-acks command 
 line parameter being used.  The default is I<no>.
 
+=item BTS_INTERACTIVE
+
+If this is set to I<yes> or I<force>, then it is the same as the 
+--interactive or --force-interactive command line parameter being used.  
+The default is I<no>.
+
 =cut
 
 =head1 SEE ALSO



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to