changeset 8025:1280934dd2dd

patchbomb: Support initial in-reply-to header This allows follow-up/revised patches to appear properly threaded in mail readers and in the archives, reducing noise.
author Henrik Stuart <henrik.stuart at edlund.dk>
date Wed, 08 Apr 2009 19:32:16 +0200
parents 9a1b86cfd29e
children 683d8ebcf434
files hgext/patchbomb.py tests/test-patchbomb tests/test-patchbomb.out
diffstat 3 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Wed Apr 08 14:20:57 2009 +0200
+++ b/hgext/patchbomb.py	Wed Apr 08 19:32:16 2009 +0200
@@ -384,7 +384,7 @@
 
     ui.write('\n')
 
-    parent = None
+    parent = opts.get('in_reply_to') or None
 
     sender_addr = email.Utils.parseaddr(sender)[1]
     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
@@ -458,6 +458,8 @@
            _('write messages to mbox file instead of sending them')),
           ('s', 'subject', '',
            _('subject of first message (intro or single patch)')),
+          ('', 'in-reply-to', '',
+           _('"message identifier to reply to"')),
           ('t', 'to', [], _('email addresses of recipients')),
          ]
 
--- a/tests/test-patchbomb	Wed Apr 08 14:20:57 2009 +0200
+++ b/tests/test-patchbomb	Wed Apr 08 19:32:16 2009 +0200
@@ -117,3 +117,6 @@
 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -i 0:1 | \
   fixheaders
 
+echo "% test inreplyto"
+hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz tip | \
+  fixheaders
--- a/tests/test-patchbomb.out	Wed Apr 08 14:20:57 2009 +0200
+++ b/tests/test-patchbomb.out	Wed Apr 08 19:32:16 2009 +0200
@@ -837,3 +837,38 @@
 +b
 
 --===
+% test inreplyto
+This patch series consists of 1 patches.
+
+
+Displaying [PATCH] Added tag two, two.diff for changeset ff2c9fa2018b ...
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH] Added tag two, two.diff for changeset ff2c9fa2018b
+X-Mercurial-Node: 2c502b2db30e1ddd5e4ecabd68d9002f6c77a5a3
+Message-Id: <2c502b2db30e1ddd5e4e.60@
+In-Reply-To: baz
+References: baz
+Date: Thu, 01 Jan 1970 00:01:00 +0000
+From: quux
+To: foo
+Cc: bar
+
+# HG changeset patch
+# User test
+# Date 0 0
+# Node ID 2c502b2db30e1ddd5e4ecabd68d9002f6c77a5a3
+# Parent  91c0d1bdb4bc9cfd3b38a53a5ec53e9ae412a275
+Added tag two, two.diff for changeset ff2c9fa2018b
+
+diff -r 91c0d1bdb4bc -r 2c502b2db30e .hgtags
+--- a/.hgtags	Thu Jan 01 00:00:00 1970 +0000
++++ b/.hgtags	Thu Jan 01 00:00:00 1970 +0000
+@@ -2,3 +2,5 @@
+ 8580ff50825a50c8f716709acdf8de0deddcd6ab zero.foo
+ 97d72e5f12c7e84f85064aa72e5a297142c36ed9 one
+ 97d72e5f12c7e84f85064aa72e5a297142c36ed9 one.patch
++ff2c9fa2018b15fa74b33363bda9527323e2a99f two
++ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff
+