[PATCH] patchbomb: Support initial in-reply-to header

Henrik Stuart hg at hstuart.dk
Tue Apr 7 11:17:04 CDT 2009


# HG changeset patch
# User Henrik Stuart <henrik.stuart at edlund.dk>
# Date 1239120941 -7200
# Node ID 68e0c7039352e2dd177058312d91b4324993f6e0
# Parent  777a9efdae2d291b446c5abb4c95c0f0e73462a6
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.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -384,7 +384,7 @@
 
     ui.write('\n')
 
-    parent = None
+    parent = opts.get('inreplyto') 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)')),
+          ('', 'inreplyto', '',
+           _('unique email identifier the messages are in reply to')),
           ('t', 'to', [], _('email addresses of recipients')),
          ]
 
diff --git a/tests/test-patchbomb b/tests/test-patchbomb
--- a/tests/test-patchbomb
+++ b/tests/test-patchbomb
@@ -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 --inreplyto baz tip | \
+  fixheaders
diff --git a/tests/test-patchbomb.out b/tests/test-patchbomb.out
--- a/tests/test-patchbomb.out
+++ b/tests/test-patchbomb.out
@@ -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
+


More information about the Mercurial-devel mailing list