Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/server.py @ 30516:dd539e2d89aa
server: move service table and factory from commandserver
This is necessary to solve future dependency cycle between commandserver.py
and chgserver.py.
'cmd' prefix is added to table and function names to avoid conflicts with
hgweb.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Oct 2016 13:57:17 +0900 |
parents | d9d8d78e6bc9 |
children | add7bcad1d9c |
comparison
equal
deleted
inserted
replaced
30515:d9d8d78e6bc9 | 30516:dd539e2d89aa |
---|---|
13 import tempfile | 13 import tempfile |
14 | 14 |
15 from .i18n import _ | 15 from .i18n import _ |
16 | 16 |
17 from . import ( | 17 from . import ( |
18 commandserver, | |
18 error, | 19 error, |
19 util, | 20 util, |
20 ) | 21 ) |
21 | 22 |
22 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None, | 23 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None, |
103 if logfile and logfilefd not in (0, 1, 2): | 104 if logfile and logfilefd not in (0, 1, 2): |
104 os.close(logfilefd) | 105 os.close(logfilefd) |
105 | 106 |
106 if runfn: | 107 if runfn: |
107 return runfn() | 108 return runfn() |
109 | |
110 _cmdservicemap = { | |
111 'pipe': commandserver.pipeservice, | |
112 'unix': commandserver.unixforkingservice, | |
113 } | |
114 | |
115 def createcmdservice(ui, repo, opts): | |
116 mode = opts['cmdserver'] | |
117 try: | |
118 return _cmdservicemap[mode](ui, repo, opts) | |
119 except KeyError: | |
120 raise error.Abort(_('unknown mode %s') % mode) |