##// END OF EJS Templates
server: add public function to select either cmdserver or hgweb
Yuya Nishihara -
r30510:a0878bc8 default
parent child Browse files
Show More
@@ -6296,10 +6296,7 b' def serve(ui, repo, **opts):'
6296 6296 s = sshserver.sshserver(ui, repo)
6297 6297 s.serve_forever()
6298 6298
6299 if opts["cmdserver"]:
6300 service = server.createcmdservice(ui, repo, opts)
6301 else:
6302 service = server.createhgwebservice(ui, repo, opts)
6299 service = server.createservice(ui, repo, opts)
6303 6300 return server.runservice(opts, initfn=service.init, runfn=service.run)
6304 6301
6305 6302 @command('^status|st',
@@ -113,14 +113,14 b' def runservice(opts, parentfn=None, init'
113 113 'unix': commandserver.unixforkingservice,
114 114 }
115 115
116 def createcmdservice(ui, repo, opts):
116 def _createcmdservice(ui, repo, opts):
117 117 mode = opts['cmdserver']
118 118 try:
119 119 return _cmdservicemap[mode](ui, repo, opts)
120 120 except KeyError:
121 121 raise error.Abort(_('unknown mode %s') % mode)
122 122
123 def createhgwebservice(ui, repo, opts):
123 def _createhgwebservice(ui, repo, opts):
124 124 # this way we can check if something was given in the command-line
125 125 if opts.get('port'):
126 126 opts['port'] = util.getport(opts.get('port'))
@@ -152,3 +152,9 b' def createhgwebservice(ui, repo, opts):'
152 152
153 153 app = hgweb.createapp(baseui, repo, webconf)
154 154 return hgweb.httpservice(servui, app, opts)
155
156 def createservice(ui, repo, opts):
157 if opts["cmdserver"]:
158 return _createcmdservice(ui, repo, opts)
159 else:
160 return _createhgwebservice(ui, repo, opts)
General Comments 0
You need to be logged in to leave comments. Login now