Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 21726:fae032549ca2
patchbomb: always use message-id of first patch for series-id
This currently has the side effect that the 0 of N message has no
series-id. This won't matter for Mercurial's own use, but may be
undesirable for other projects depending on their workflow.
The way the header is inserted is intentionally a little funny to make
the test expectation diff easier to review.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 07 Jun 2014 11:06:15 -0400 |
parents | 36b31f7867a7 |
children | 5f98ad8fb8d9 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Sat Jun 07 11:30:06 2014 -0400 +++ b/hgext/patchbomb.py Sat Jun 07 11:06:15 2014 -0400 @@ -509,9 +509,12 @@ sender_addr = email.Utils.parseaddr(sender)[1] sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) sendmail = None + firstpatch = None for i, (m, subj, ds) in enumerate(msgs): try: m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) + if not firstpatch: + firstpatch = m['Message-Id'] except TypeError: m['Message-Id'] = genmsgid('patchbomb') if parent: @@ -519,7 +522,10 @@ m['References'] = parent if not parent or 'X-Mercurial-Node' not in m: parent = m['Message-Id'] - m['X-Mercurial-Series-Id'] = parent + # For 0 of N messages, we won't have seen a patch yet, so + # don't try and produce an X-Mercurial-Series-Id. + if firstpatch: + m['X-Mercurial-Series-Id'] = firstpatch m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() m['Date'] = email.Utils.formatdate(start_time[0], localtime=True)