patchbomb: with --in-reply-to, still thread message under first in series
When specifying --in-reply-to for a message M, have
[M]
[0/2]
[1/2]
[2/2]
instead of
[M]
[0/2]
[1/2]
[2/2]
which is more consistent with the way messages are being threaded
when --in-reply-to is not used.
--- a/hgext/patchbomb.py Tue May 19 01:17:54 2009 +0200
+++ b/hgext/patchbomb.py Tue May 19 01:37:38 2009 +0200
@@ -397,6 +397,7 @@
ui.write('\n')
parent = opts.get('in_reply_to') or None
+ first = True
sender_addr = email.Utils.parseaddr(sender)[1]
sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
@@ -409,8 +410,10 @@
if parent:
m['In-Reply-To'] = parent
m['References'] = parent
- else:
+ if first:
parent = m['Message-Id']
+ first = False
+
m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
m['Date'] = util.datestr(start_time, "%a, %d %b %Y %H:%M:%S %1%2")
--- a/tests/test-patchbomb Tue May 19 01:17:54 2009 +0200
+++ b/tests/test-patchbomb Tue May 19 01:37:38 2009 +0200
@@ -148,3 +148,6 @@
echo "% test inreplyto"
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz \
-r tip | fixheaders
+
+hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz \
+ -r 0:1 | fixheaders
--- a/tests/test-patchbomb.out Tue May 19 01:17:54 2009 +0200
+++ b/tests/test-patchbomb.out Tue May 19 01:37:38 2009 +0200
@@ -1177,3 +1177,80 @@
+ff2c9fa2018b15fa74b33363bda9527323e2a99f two
+ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff
+This patch series consists of 2 patches.
+
+
+Write the introductory message for the patch series.
+
+
+Displaying [PATCH 0 of 2] None ...
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH 0 of 2] None
+Message-Id: <patchbomb.60@
+In-Reply-To: baz
+References: baz
+User-Agent: Mercurial-patchbomb
+Date: Thu, 01 Jan 1970 00:01:00 +0000
+From: quux
+To: foo
+Cc: bar
+
+
+Displaying [PATCH 1 of 2] a ...
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH 1 of 2] a
+X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
+Message-Id: <8580ff50825a50c8f716.61@
+In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
+User-Agent: Mercurial-patchbomb
+Date: Thu, 01 Jan 1970 00:01:01 +0000
+From: quux
+To: foo
+Cc: bar
+
+# HG changeset patch
+# User test
+# Date 1 0
+# Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
+# Parent 0000000000000000000000000000000000000000
+a
+
+diff -r 000000000000 -r 8580ff50825a a
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ b/a Thu Jan 01 00:00:01 1970 +0000
+@@ -0,0 +1,1 @@
++a
+
+Displaying [PATCH 2 of 2] b ...
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH 2 of 2] b
+X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
+Message-Id: <97d72e5f12c7e84f8506.62@
+In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
+User-Agent: Mercurial-patchbomb
+Date: Thu, 01 Jan 1970 00:01:02 +0000
+From: quux
+To: foo
+Cc: bar
+
+# HG changeset patch
+# User test
+# Date 2 0
+# Node ID 97d72e5f12c7e84f85064aa72e5a297142c36ed9
+# Parent 8580ff50825a50c8f716709acdf8de0deddcd6ab
+b
+
+diff -r 8580ff50825a -r 97d72e5f12c7 b
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ b/b Thu Jan 01 00:00:02 1970 +0000
+@@ -0,0 +1,1 @@
++b
+