comparison hgext/patchbomb.py @ 3253:1e2941fda520

patchbomb: update --attach to use cmdutil.make_filename
author Brendan Cully <brendan@kublai.com>
date Wed, 04 Oct 2006 12:39:51 -0700
parents f422c8265ae5
children 0b5d626b354e
comparison
equal deleted inserted replaced
3246:27139167e615 3253:1e2941fda520
63 # 63 #
64 # That should be all. Now your patchbomb is on its way out. 64 # That should be all. Now your patchbomb is on its way out.
65 65
66 from mercurial.demandload import * 66 from mercurial.demandload import *
67 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils 67 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils
68 mercurial:commands,hg,mail,ui,patch 68 mercurial:cmdutil,commands,hg,mail,ui,patch
69 os errno popen2 socket sys tempfile time''') 69 os errno popen2 socket sys tempfile time''')
70 from mercurial.i18n import gettext as _ 70 from mercurial.i18n import gettext as _
71 from mercurial.node import * 71 from mercurial.node import *
72 72
73 try: 73 try:
144 patchname = [t for t in repo.nodetags(binnode) 144 patchname = [t for t in repo.nodetags(binnode)
145 if t.endswith('.patch') or t.endswith('.diff')] 145 if t.endswith('.patch') or t.endswith('.diff')]
146 if patchname: 146 if patchname:
147 patchname = patchname[0] 147 patchname = patchname[0]
148 elif total > 1: 148 elif total > 1:
149 patchname = commands.make_filename(repo, '%b-%n.patch', 149 patchname = cmdutil.make_filename(repo, '%b-%n.patch',
150 binnode, idx, total) 150 binnode, idx, total)
151 else: 151 else:
152 patchname = commands.make_filename(repo, '%b.patch', binnode) 152 patchname = cmdutil.make_filename(repo, '%b.patch', binnode)
153 p['Content-Disposition'] = 'inline; filename=' + patchname 153 p['Content-Disposition'] = 'inline; filename=' + patchname
154 msg.attach(p) 154 msg.attach(p)
155 else: 155 else:
156 body += '\n'.join(patch) 156 body += '\n'.join(patch)
157 msg = email.MIMEText.MIMEText(body) 157 msg = email.MIMEText.MIMEText(body)