Mercurial > hg
diff mercurial/server.py @ 30510:a0878bc87379
server: add public function to select either cmdserver or hgweb
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Oct 2016 14:19:16 +0900 |
parents | add7bcad1d9c |
children | ff7df4bb75de |
line wrap: on
line diff
--- a/mercurial/server.py Sat Oct 15 14:09:36 2016 +0900 +++ b/mercurial/server.py Sat Oct 15 14:19:16 2016 +0900 @@ -113,14 +113,14 @@ 'unix': commandserver.unixforkingservice, } -def createcmdservice(ui, repo, opts): +def _createcmdservice(ui, repo, opts): mode = opts['cmdserver'] try: return _cmdservicemap[mode](ui, repo, opts) except KeyError: raise error.Abort(_('unknown mode %s') % mode) -def createhgwebservice(ui, repo, opts): +def _createhgwebservice(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')) @@ -152,3 +152,9 @@ app = hgweb.createapp(baseui, repo, webconf) return hgweb.httpservice(servui, app, opts) + +def createservice(ui, repo, opts): + if opts["cmdserver"]: + return _createcmdservice(ui, repo, opts) + else: + return _createhgwebservice(ui, repo, opts)