comparison hgext/patchbomb.py @ 2722:10e95059ffd7

patchbomb: fix generation of message-id when sending attachments node was set to bin(node) before message-id was created
author Christian Ebert <blacktrash@gmx.net>
date Fri, 28 Jul 2006 22:17:32 +0200
parents 084f07cacba0
children 0bcecf7d45b1
comparison
equal deleted inserted replaced
2721:d1fa79e7b07e 2722:10e95059ffd7
133 body += cdiffstat('\n'.join(desc), patch) + '\n\n' 133 body += cdiffstat('\n'.join(desc), patch) + '\n\n'
134 if opts['attach']: 134 if opts['attach']:
135 msg = email.MIMEMultipart.MIMEMultipart() 135 msg = email.MIMEMultipart.MIMEMultipart()
136 if body: msg.attach(email.MIMEText.MIMEText(body, 'plain')) 136 if body: msg.attach(email.MIMEText.MIMEText(body, 'plain'))
137 p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch') 137 p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')
138 node = bin(node) 138 binnode = bin(node)
139 # if node is mq patch, it will have patch file name as tag 139 # if node is mq patch, it will have patch file name as tag
140 patchname = [t for t in repo.nodetags(node) 140 patchname = [t for t in repo.nodetags(binnode)
141 if t.endswith('.patch') or t.endswith('.diff')] 141 if t.endswith('.patch') or t.endswith('.diff')]
142 if patchname: 142 if patchname:
143 patchname = patchname[0] 143 patchname = patchname[0]
144 elif total > 1: 144 elif total > 1:
145 patchname = commands.make_filename(repo, '%b-%n.patch', 145 patchname = commands.make_filename(repo, '%b-%n.patch',
146 node, idx, total) 146 binnode, idx, total)
147 else: 147 else:
148 patchname = commands.make_filename(repo, '%b.patch', node) 148 patchname = commands.make_filename(repo, '%b.patch', binnode)
149 p['Content-Disposition'] = 'inline; filename=' + patchname 149 p['Content-Disposition'] = 'inline; filename=' + patchname
150 msg.attach(p) 150 msg.attach(p)
151 else: 151 else:
152 body += '\n'.join(patch) 152 body += '\n'.join(patch)
153 msg = email.MIMEText.MIMEText(body) 153 msg = email.MIMEText.MIMEText(body)