patchbomb: respect --in-reply-to for all mails if no intro message is sent stable
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 24 Oct 2012 09:53:10 +0200
branchstable
changeset 17859 d38d90ad5bbf
parent 17858 acd4577a568d
child 17860 a45b33f12627
patchbomb: respect --in-reply-to for all mails if no intro message is sent Before this change, the thread hierarchy looked like this: PARENT PATCH1/x PATCH2/x PATCH3/x ... Now it is: PARENT PATCH1/x PATCH2/x PATCH3/x ... With an introductory message the behaviour is unchanged: PARENT INTRO PATCH1/x PATCH2/x PATCH3/x ...
hgext/patchbomb.py
tests/test-patchbomb.t
--- a/hgext/patchbomb.py	Tue Oct 23 17:06:31 2012 +0900
+++ b/hgext/patchbomb.py	Wed Oct 24 09:53:10 2012 +0200
@@ -496,8 +496,6 @@
         if not parent.endswith('>'):
             parent += '>'
 
-    first = True
-
     sender_addr = email.Utils.parseaddr(sender)[1]
     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
     sendmail = None
@@ -509,9 +507,8 @@
         if parent:
             m['In-Reply-To'] = parent
             m['References'] = parent
-        if first:
+        if not parent or 'X-Mercurial-Node' not in m:
             parent = m['Message-Id']
-            first = False
 
         m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
         m['Date'] = email.Utils.formatdate(start_time[0], localtime=True)
--- a/tests/test-patchbomb.t	Tue Oct 23 17:06:31 2012 +0900
+++ b/tests/test-patchbomb.t	Wed Oct 24 09:53:10 2012 +0200
@@ -1663,8 +1663,8 @@
   Subject: [PATCH 2 of 2] b
   X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
   Message-Id: <97d72e5f12c7e84f8506.61@*> (glob)
-  In-Reply-To: <8580ff50825a50c8f716.60@*> (glob)
-  References: <8580ff50825a50c8f716.60@*> (glob)
+  In-Reply-To: <baz>
+  References: <baz>
   User-Agent: Mercurial-patchbomb/* (glob)
   Date: Thu, 01 Jan 1970 00:01:01 +0000
   From: quux