From: Georgi Chorbadzhiyski <gf@unixsol.org>
To: git@vger.kernel.org
Subject: [PATCH] send-mail: Add option to sleep between sending each email.
Date: Wed, 7 Sep 2011 23:43:11 +0300 [thread overview]
Message-ID: <1315428191-9769-1-git-send-email-gf@unixsol.org> (raw)
Sometimes when sending lots of changes it is not nice
to send emails as fast as possible. Of course you can
confirm each email after waiting couple of seconds but
this is not optimal. This patch adds --sleep option
to git-send-mail and corresponding sendmail.sleep config
variable to control how much seconds to wait between
sending each email. The default is 0 (not wait at all).
Signed-off-by: Georgi Chorbadzhiyski <gf@unixsol.org>
---
Documentation/git-send-email.txt | 6 ++++++
git-send-email.perl | 13 ++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 327233c..2ceb69f 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -298,6 +298,9 @@ Default is the value of 'sendemail.confirm' configuration value; if that
is unspecified, default to 'auto' unless any of the suppress options
have been specified, in which case default to 'compose'.
+--sleep=<seconds>::
+ How many seconds to wait between sending each email.
+
--dry-run::
Do everything except actually send the emails.
@@ -349,6 +352,9 @@ sendemail.confirm::
one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'
in the previous section for the meaning of these values.
+sendemail.sleep::
+ Sets how many seconds to wait between sending each email.
+
EXAMPLE
-------
Use gmail as the smtp server
diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..7239fd4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -84,6 +84,7 @@ git send-email [options] <file | directory | rev-list options >
Administering:
--confirm <str> * Confirm recipients before sending;
auto, cc, compose, always, or never.
+ --sleep <int> * Sleep <int> seconds between sending mails.
--quiet * Output one line of info per email.
--dry-run * Don't actually send the emails.
--[no-]validate * Perform patch sanity checks. Default on.
@@ -195,7 +196,7 @@ my ($to_cmd, $cc_cmd);
my ($smtp_server, $smtp_server_port, @smtp_server_options);
my ($smtp_authuser, $smtp_encryption);
my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
-my ($validate, $confirm);
+my ($validate, $confirm, $sleep);
my (@suppress_cc);
my ($auto_8bit_encoding);
@@ -230,6 +231,7 @@ my %config_settings = (
"envelopesender" => \$envelope_sender,
"multiedit" => \$multiedit,
"confirm" => \$confirm,
+ "sleep" => \$sleep,
"from" => \$sender,
"assume8bitencoding" => \$auto_8bit_encoding,
);
@@ -304,6 +306,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"suppress-cc=s" => \@suppress_cc,
"signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
"confirm=s" => \$confirm,
+ "sleep:i" => \$sleep,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread,
@@ -405,6 +408,9 @@ if ($confirm_unconfigured) {
die "Unknown --confirm setting: '$confirm'\n"
unless $confirm =~ /^(?:auto|cc|compose|always|never)/;
+# Set sleep's default value
+$sleep = 0 if (!defined $sleep);
+
# Debugging, print out the suppressions.
if (0) {
print "suppressions:\n";
@@ -1143,6 +1149,11 @@ X-Mailer: git-send-email $gitversion
}
}
+ if (!$dry_run && $sleep) {
+ print "Sleeping: $sleep second(s).\n" if (!$quiet);
+ sleep($sleep);
+ };
+
return 1;
}
--
1.7.5.1
next reply other threads:[~2011-09-07 21:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 20:43 Georgi Chorbadzhiyski [this message]
2011-09-08 8:43 ` [PATCH] send-mail: Add option to sleep between sending each email Ramkumar Ramachandra
2011-09-08 9:03 ` Matthieu Moy
2011-09-08 9:28 ` Ramkumar Ramachandra
2011-09-08 9:35 ` Ramkumar Ramachandra
2011-09-08 10:44 ` Ramkumar Ramachandra
2011-09-08 10:57 ` Georgi Chorbadzhiyski
2011-09-08 11:15 ` Matthieu Moy
2011-09-08 13:58 ` Georgi Chorbadzhiyski
2011-09-08 14:07 ` Georgi Chorbadzhiyski
2011-10-03 20:17 ` Jakub Narebski
2011-09-08 17:14 ` Georgi Chorbadzhiyski
2011-09-08 17:12 ` Junio C Hamano
2011-09-08 20:50 ` Matthieu Moy
2011-09-09 2:12 ` mfwitten
2011-09-12 5:34 ` Ramkumar Ramachandra
2011-09-08 9:11 ` Georgi Chorbadzhiyski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315428191-9769-1-git-send-email-gf@unixsol.org \
--to=gf@unixsol.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).