--- a/mercurial/commands.py Sat Oct 15 14:09:36 2016 +0900
+++ b/mercurial/commands.py Sat Oct 15 14:19:16 2016 +0900
@@ -6296,10 +6296,7 @@
s = sshserver.sshserver(ui, repo)
s.serve_forever()
- if opts["cmdserver"]:
- service = server.createcmdservice(ui, repo, opts)
- else:
- service = server.createhgwebservice(ui, repo, opts)
+ service = server.createservice(ui, repo, opts)
return server.runservice(opts, initfn=service.init, runfn=service.run)
@command('^status|st',
--- 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)