[PATCH] mail: fix regression introduced in dc6ed2736c81 (issue #943)
Christian Ebert
blacktrash at gmx.net
Fri Jan 25 16:05:52 CST 2008
* Matt Mackall on Friday, January 25, 2008 at 15:18:27 -0600
> On Fri, 2008-01-25 at 20:57 +0000, Christian Ebert wrote:
>> external sendmail method has no connection parameter
>> smtplib methos has additional connection parameter
>>
>> Here's a proposal with adding ui._mailer
>
> Mystified. Why isn't this sufficient:
>
> diff -r 5d81251dedae mercurial/mail.py
> --- a/mercurial/mail.py Tue Jan 22 23:07:23 2008 +0100
> +++ b/mercurial/mail.py Fri Jan 25 15:11:14 2008 -0600
> @@ -56,7 +56,7 @@
> '''make a mail connection. return a function to send mail.
> call as sendmail(sender, list-of-recipients, msg).'''
>
> - func = _sendmail
> + func = lambda s, r, m: _sendmail(ui, s, r, m)
> if ui.config('email', 'method', 'smtp') == 'smtp':
> func = _smtp(ui)
works for email.method=smtp.
but email.method=/usr/sbin/sendmail gives:
Sending [PATCH 0 of 4] test ...
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial at selenic.com
** Mercurial Distributed SCM (version b710296c904a+20080125)
Traceback (most recent call last):
File "/usr/local/bin/hg", line 20, in <module>
mercurial.dispatch.run()
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 20, in run
sys.exit(dispatch(sys.argv[1:]))
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 29, in dispatch
return _runcatch(u, args)
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 45, in _runcatch
return _dispatch(ui, args)
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 360, in _dispatch
ret = _runcommand(ui, options, cmd, d)
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 413, in _runcommand
return checkargs()
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 369, in checkargs
return cmdfunc()
File "/usr/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 352, in <lambda>
d = lambda: func(ui, repo, *args, **cmdoptions)
File "/usr/local/lib/python2.5/site-packages/hgext/patchbomb.py", line 434, in patchbomb
sendmail(ui, sender, to + bcc + cc, m.as_string(0))
File "/usr/local/lib/python2.5/site-packages/mercurial/mail.py", line 65, in send
return func.sendmail(sender, recipients, msg)
AttributeError: 'function' object has no attribute 'sendmail'
_smtp(ui) returns an object with a sendmail attribute.
_sendmail is a function w/o sendmail attribute, it just executes
an external program.
c
--
Too poor to paint and too proud to whitewash
More information about the Mercurial-devel
mailing list