comparison mercurial/mail.py @ 46907:ffd3e823a7e5

urlutil: extract `url` related code from `util` into the new module The new module is well fitting for this new code. And this will be useful to make the gathered code collaborate more later. Differential Revision: https://phab.mercurial-scm.org/D10374
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Apr 2021 03:01:04 +0200
parents d4ba4d51f85f
children d467bae86b2d
comparison
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
32 util, 32 util,
33 ) 33 )
34 from .utils import ( 34 from .utils import (
35 procutil, 35 procutil,
36 stringutil, 36 stringutil,
37 urlutil,
37 ) 38 )
38 39
39 if pycompat.TYPE_CHECKING: 40 if pycompat.TYPE_CHECKING:
40 from typing import Any, List, Tuple, Union 41 from typing import Any, List, Tuple, Union
41 42
137 s = smtplib.SMTP(local_hostname=local_hostname) 138 s = smtplib.SMTP(local_hostname=local_hostname)
138 if smtps: 139 if smtps:
139 defaultport = 465 140 defaultport = 465
140 else: 141 else:
141 defaultport = 25 142 defaultport = 25
142 mailport = util.getport(ui.config(b'smtp', b'port', defaultport)) 143 mailport = urlutil.getport(ui.config(b'smtp', b'port', defaultport))
143 ui.note(_(b'sending mail: smtp host %s, port %d\n') % (mailhost, mailport)) 144 ui.note(_(b'sending mail: smtp host %s, port %d\n') % (mailhost, mailport))
144 s.connect(host=mailhost, port=mailport) 145 s.connect(host=mailhost, port=mailport)
145 if starttls: 146 if starttls:
146 ui.note(_(b'(using starttls)\n')) 147 ui.note(_(b'(using starttls)\n'))
147 s.ehlo() 148 s.ehlo()