diff mercurial/mail.py @ 12076:49463314c24f

mail/hgweb: support service names for ports (issue2350) This adds util.getport(port) which tries to parse port as an int, and failing that, looks it up using socket.getservbyname(). Thus, the following will work: [smtp] port = submission [web] port = http This does not apply to ports in URLs used in clone, pull, etc.
author Brodie Rao <brodie@bitheap.org>
date Sat, 28 Aug 2010 12:31:07 -0400
parents 594b98846ce1
children 339bd18c772f
line wrap: on
line diff
--- a/mercurial/mail.py	Fri Aug 27 16:25:47 2010 +0200
+++ b/mercurial/mail.py	Sat Aug 28 12:31:07 2010 -0400
@@ -37,7 +37,7 @@
     mailhost = ui.config('smtp', 'host')
     if not mailhost:
         raise util.Abort(_('no [smtp]host in hgrc - cannot send mail'))
-    mailport = int(ui.config('smtp', 'port', 25))
+    mailport = util.getport(ui.config('smtp', 'port', 25))
     ui.note(_('sending mail: smtp host %s, port %s\n') %
             (mailhost, mailport))
     s.connect(host=mailhost, port=mailport)