Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
octobus
mercurial-devel
Commits
23889160905a
Commit
96c108ac
authored
Sep 07, 2007
by
Christian Ebert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch smtp exceptions
parent
5b81c1cc6ebe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
hgext/patchbomb.py
hgext/patchbomb.py
+3
-6
mercurial/mail.py
mercurial/mail.py
+7
-1
No files found.
hgext/patchbomb.py
View file @
23889160
...
...
@@ -224,9 +224,8 @@ def patchbomb(ui, repo, *revs, **opts):
pass
os
.
rmdir
(
tmpdir
)
really_sending
=
not
(
opts
[
'test'
]
or
opts
[
'mbox'
])
if
really_sending
:
if
not
(
opts
[
'test'
]
or
opts
[
'mbox'
]):
# really sending
mail
.
validateconfig
(
ui
)
if
not
(
revs
or
opts
.
get
(
'rev'
)
or
opts
.
get
(
'outgoing'
)):
...
...
@@ -361,8 +360,6 @@ def patchbomb(ui, repo, *revs, **opts):
ui
.
write
(
'
\n
'
)
if
really_sending
:
mailer
=
mail
.
connect
(
ui
)
parent
=
None
sender_addr
=
email
.
Utils
.
parseaddr
(
sender
)[
1
]
...
...
@@ -411,7 +408,7 @@ def patchbomb(ui, repo, *revs, **opts):
ui
.
status
(
'Sending '
,
m
[
'Subject'
],
' ...
\n
'
)
# Exim does not remove the Bcc field
del
m
[
'Bcc'
]
mail
er
.
sendmail
(
sender
,
to
+
bcc
+
cc
,
m
.
as_string
(
0
))
mail
.
sendmail
(
ui
,
sender
,
to
+
bcc
+
cc
,
m
.
as_string
(
0
))
cmdtable
=
{
"email"
:
...
...
mercurial/mail.py
View file @
23889160
...
...
@@ -67,7 +67,13 @@ def connect(ui):
return
_sendmail
(
ui
,
method
)
def
sendmail
(
ui
,
sender
,
recipients
,
msg
):
return
connect
(
ui
).
sendmail
(
sender
,
recipients
,
msg
)
try
:
return
connect
(
ui
).
sendmail
(
sender
,
recipients
,
msg
)
except
smtplib
.
SMTPRecipientsRefused
,
inst
:
recipients
=
[
r
[
1
]
for
r
in
inst
.
recipients
.
values
()]
raise
util
.
Abort
(
'
\n
'
+
'
\n
'
.
join
(
recipients
))
except
smtplib
.
SMTPException
,
inst
:
raise
util
.
Abort
(
inst
)
def
validateconfig
(
ui
):
'''determine if we have enough config data to try sending email.'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment