comparison hgext/patchbomb.py @ 21727:5f98ad8fb8d9

patchbomb: reorder header insertions to clarify code This is done as its own change to make the changes to test-patchbomb.t easier to review.
author Augie Fackler <raf@durin42.com>
date Sat, 07 Jun 2014 11:32:37 -0400
parents fae032549ca2
children 122f5c3f3308
comparison
equal deleted inserted replaced
21726:fae032549ca2 21727:5f98ad8fb8d9
513 for i, (m, subj, ds) in enumerate(msgs): 513 for i, (m, subj, ds) in enumerate(msgs):
514 try: 514 try:
515 m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) 515 m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
516 if not firstpatch: 516 if not firstpatch:
517 firstpatch = m['Message-Id'] 517 firstpatch = m['Message-Id']
518 m['X-Mercurial-Series-Id'] = firstpatch
518 except TypeError: 519 except TypeError:
519 m['Message-Id'] = genmsgid('patchbomb') 520 m['Message-Id'] = genmsgid('patchbomb')
520 if parent: 521 if parent:
521 m['In-Reply-To'] = parent 522 m['In-Reply-To'] = parent
522 m['References'] = parent 523 m['References'] = parent
523 if not parent or 'X-Mercurial-Node' not in m: 524 if not parent or 'X-Mercurial-Node' not in m:
524 parent = m['Message-Id'] 525 parent = m['Message-Id']
525 # For 0 of N messages, we won't have seen a patch yet, so
526 # don't try and produce an X-Mercurial-Series-Id.
527 if firstpatch:
528 m['X-Mercurial-Series-Id'] = firstpatch
529 526
530 m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() 527 m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
531 m['Date'] = email.Utils.formatdate(start_time[0], localtime=True) 528 m['Date'] = email.Utils.formatdate(start_time[0], localtime=True)
532 529
533 start_time = (start_time[0] + 1, start_time[1]) 530 start_time = (start_time[0] + 1, start_time[1])