comparison mercurial/hgweb/server.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 acd84c434896
comparison
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
25 from .. import ( 25 from .. import (
26 encoding, 26 encoding,
27 error, 27 error,
28 pycompat, 28 pycompat,
29 util, 29 util,
30 )
31 from ..utils import (
32 urlutil,
30 ) 33 )
31 34
32 httpservermod = util.httpserver 35 httpservermod = util.httpserver
33 socketserver = util.socketserver 36 socketserver = util.socketserver
34 urlerr = util.urlerr 37 urlerr = util.urlerr
429 sys.setdefaultencoding(b"latin1") # or any full 8-bit encoding 432 sys.setdefaultencoding(b"latin1") # or any full 8-bit encoding
430 mimetypes.init() 433 mimetypes.init()
431 sys.setdefaultencoding(oldenc) 434 sys.setdefaultencoding(oldenc)
432 435
433 address = ui.config(b'web', b'address') 436 address = ui.config(b'web', b'address')
434 port = util.getport(ui.config(b'web', b'port')) 437 port = urlutil.getport(ui.config(b'web', b'port'))
435 try: 438 try:
436 return cls(ui, app, (address, port), handler) 439 return cls(ui, app, (address, port), handler)
437 except socket.error as inst: 440 except socket.error as inst:
438 raise error.Abort( 441 raise error.Abort(
439 _(b"cannot start server at '%s:%d': %s") 442 _(b"cannot start server at '%s:%d': %s")