git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Witten <mfwitten@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH RFC 1/6] send-email: Add --delay for separating emails
Date: Tue,  7 Apr 2009 16:25:17 -0500	[thread overview]
Message-ID: <1239139522-24118-1-git-send-email-mfwitten@gmail.com> (raw)

When sending a patch series, the emails often arrive at the final
destination out of order; though these emails should be chained
via the In-Reply-To headers, some mail-viewing systems display
by order of arrival instead.

The --delay option provides a means for specifying that there
should be a certain number of seconds of delay between sending
emails, so that the arrival order can be controlled better.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 Documentation/git-send-email.txt |    5 +++++
 git-send-email.perl              |   17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 10dfd66..4b656ca 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -97,6 +97,11 @@ The --to option must be repeated for each user you want on the to list.
 Sending
 ~~~~~~~
 
+--delay::
+	Specify the minimum number of seconds of delay that should occur
+	between sending emails. This number should be an integer >= zero.
+	Default is the value of the 'sendemail.delay' configuration variable.
+
 --envelope-sender::
 	Specify the envelope sender used to send the emails.
 	This is useful if your default address is not the address that is
diff --git a/git-send-email.perl b/git-send-email.perl
index 172b53c..273c8c7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -56,6 +56,7 @@ git send-email [options] <file | directory | rev-list options >
     --compose                      * Open an editor for introduction.
 
   Sending:
+    --delay                 <int>  * Delay (seconds) between sending emails.
     --envelope-sender       <str>  * Email envelope sender.
     --smtp-server       <str:int>  * Outgoing SMTP server to use. The port
                                      is optional. Default 'localhost'.
@@ -180,7 +181,7 @@ sub do_edit {
 }
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
+my ($delay, $thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($validate, $confirm);
@@ -196,6 +197,7 @@ my %config_bool_settings = (
 );
 
 my %config_settings = (
+    "delay" => \$delay,
     "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
     "smtpuser" => \$smtp_authuser,
@@ -247,6 +249,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "cc=s" => \@initial_cc,
 		    "bcc=s" => \@bcclist,
 		    "chain-reply-to!" => \$chain_reply_to,
+		    "delay=i" => \$delay,
 		    "smtp-server=s" => \$smtp_server,
 		    "smtp-server-port=s" => \$smtp_server_port,
 		    "smtp-user=s" => \$smtp_authuser,
@@ -973,8 +976,9 @@ $references = $initial_reply_to || '';
 $subject = $initial_subject;
 $message_num = 0;
 
-foreach my $t (@files) {
-	open(F,"<",$t) or die "can't open file $t";
+for (my $index = 0; $index < @files; $index++) {
+	my $file = $files[$index];
+	open(F,"<",$file) or die "can't open file $file";
 
 	my $author = undef;
 	my $author_encoding;
@@ -1083,7 +1087,7 @@ foreach my $t (@files) {
 	close F;
 
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd $t |")
+		open(F, "$cc_cmd $file |")
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
 		while(<F>) {
 			my $c = $_;
@@ -1128,6 +1132,11 @@ foreach my $t (@files) {
 
 	send_message();
 
+	if ($delay && $index < $#files) {
+		my $this_long = $delay;
+		while (($this_long -= sleep $this_long) > 0) {}
+	}
+
 	# set up for the next message
 	if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
 		$reply_to = $message_id;
-- 
1.6.2.2.448.g61445.dirty

             reply	other threads:[~2009-04-07 21:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 21:25 Michael Witten [this message]
2009-04-07 21:25 ` [PATCH RFC 2/6] send-email: --smtp-server-port should take an integer Michael Witten
2009-04-07 21:25   ` [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: " during --compose Michael Witten
2009-04-07 21:25     ` [PATCH RFC 4/6] send-email: --compose takes optional argument to existing file Michael Witten
2009-04-07 21:25       ` [PATCH RFC 5/6] send-email: Cleanup the usage text a bit Michael Witten
2009-04-07 21:25         ` [PATCH RFC 6/6] send-email: Remove horrible mix of tabs and spaces Michael Witten
2009-04-07 21:35           ` demerphq
2009-04-07 21:42             ` Michael Witten
2009-04-07 21:44               ` demerphq
2009-04-07 21:57                 ` demerphq
2009-04-07 22:00               ` Jeff King
2009-04-07 22:10                 ` Andreas Ericsson
2009-04-07 23:33                   ` Tomas Carnecky
2009-04-08  2:02                   ` Jeff King
2009-04-11 19:22         ` [PATCH RFC 5/6] send-email: Cleanup the usage text a bit Junio C Hamano
2009-04-11 19:22       ` [PATCH RFC 4/6] send-email: --compose takes optional argument to existing file Junio C Hamano
2009-04-11 19:22     ` [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: " during --compose Junio C Hamano
2009-04-11 20:45       ` Michael Witten
2009-04-12  0:59         ` Junio C Hamano
2009-04-12  2:36           ` Michael Witten
2009-04-07 23:20   ` [PATCH RFC 2/6] send-email: --smtp-server-port should take an integer Junio C Hamano
2009-04-11 19:22   ` Junio C Hamano
2009-04-11 21:01     ` Wesley J. Landaker
2009-04-11 21:07       ` Michael Witten
2009-04-07 21:51 ` [PATCH RFC 1/6] send-email: Add --delay for separating emails Jeff King
2009-04-07 22:08   ` [PATCH RFC 1/6] " Nicolas Sebrecht
2009-04-07 22:17     ` Andreas Ericsson
2009-04-08  6:05       ` Jeff King
2009-04-08  6:03     ` Jeff King
2009-04-07 23:17 ` [PATCH RFC 1/6] " Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2009-04-08 14:25 Michael Witten
2009-04-08 14:35 ` Michael Witten
2009-04-09  8:14 ` Jeff King
2009-04-09  8:49   ` Junio C Hamano
2009-04-09 17:51     ` Nicolas Pitre
2009-04-09 17:48   ` Nicolas Pitre
2009-04-09 19:28     ` Junio C Hamano
2009-04-09 19:36       ` Nicolas Pitre
2009-04-09 20:59       ` Michael Witten
2009-04-09 21:02         ` Michael Witten

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239139522-24118-1-git-send-email-mfwitten@gmail.com \
    --to=mfwitten@gmail.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).