Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/__init__.py @ 30518:add7bcad1d9c
server: move service factory from hgweb
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Oct 2016 14:09:36 +0900 |
parents | 9195bc4cb816 |
children | c51380879054 |
line wrap: on
line diff
--- a/mercurial/hgweb/__init__.py Sat Oct 15 14:06:46 2016 +0900 +++ b/mercurial/hgweb/__init__.py Sat Oct 15 14:09:36 2016 +0900 @@ -85,39 +85,6 @@ def run(self): self.httpd.serve_forever() -def createservice(ui, repo, opts): - # this way we can check if something was given in the command-line - if opts.get('port'): - opts['port'] = util.getport(opts.get('port')) - - alluis = set([ui]) - if repo: - baseui = repo.baseui - alluis.update([repo.baseui, repo.ui]) - else: - baseui = ui - webconf = opts.get('web_conf') or opts.get('webdir_conf') - if webconf: - # load server settings (e.g. web.port) to "copied" ui, which allows - # hgwebdir to reload webconf cleanly - servui = ui.copy() - servui.readconfig(webconf, sections=['web']) - alluis.add(servui) - else: - servui = ui - - optlist = ("name templates style address port prefix ipv6" - " accesslog errorlog certificate encoding") - for o in optlist.split(): - val = opts.get(o, '') - if val in (None, ''): # should check against default options instead - continue - for u in alluis: - u.setconfig("web", o, val, 'serve') - - app = createapp(baseui, repo, webconf) - return httpservice(servui, app, opts) - def createapp(baseui, repo, webconf): if webconf: return hgwebdir_mod.hgwebdir(webconf, baseui=baseui)