Show More
@@ -60,6 +60,7 b' from mercurial import (' | |||||
60 | error, |
|
60 | error, | |
61 | extensions, |
|
61 | extensions, | |
62 | osutil, |
|
62 | osutil, | |
|
63 | server, | |||
63 | util, |
|
64 | util, | |
64 | ) |
|
65 | ) | |
65 |
|
66 | |||
@@ -635,7 +636,7 b' def chgunixservice(ui, repo, opts):' | |||||
635 | return commandserver.unixforkingservice(ui, repo=None, opts=opts, handler=h) |
|
636 | return commandserver.unixforkingservice(ui, repo=None, opts=opts, handler=h) | |
636 |
|
637 | |||
637 | def uisetup(ui): |
|
638 | def uisetup(ui): | |
638 |
|
|
639 | server._cmdservicemap['chgunix'] = chgunixservice | |
639 |
|
640 | |||
640 | # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
|
641 | # CHGINTERNALMARK is temporarily set by chg client to detect if chg will | |
641 | # start another chg. drop it to avoid possible side effects. |
|
642 | # start another chg. drop it to avoid possible side effects. |
@@ -35,7 +35,6 b' from . import (' | |||||
35 | bundle2, |
|
35 | bundle2, | |
36 | changegroup, |
|
36 | changegroup, | |
37 | cmdutil, |
|
37 | cmdutil, | |
38 | commandserver, |
|
|||
39 | copies, |
|
38 | copies, | |
40 | dagparser, |
|
39 | dagparser, | |
41 | dagutil, |
|
40 | dagutil, | |
@@ -6299,7 +6298,7 b' def serve(ui, repo, **opts):' | |||||
6299 | s.serve_forever() |
|
6298 | s.serve_forever() | |
6300 |
|
6299 | |||
6301 | if opts["cmdserver"]: |
|
6300 | if opts["cmdserver"]: | |
6302 |
service = |
|
6301 | service = server.createcmdservice(ui, repo, opts) | |
6303 | else: |
|
6302 | else: | |
6304 | service = hgweb.createservice(ui, repo, opts) |
|
6303 | service = hgweb.createservice(ui, repo, opts) | |
6305 | return server.runservice(opts, initfn=service.init, runfn=service.run) |
|
6304 | return server.runservice(opts, initfn=service.init, runfn=service.run) |
@@ -529,15 +529,3 b' class unixforkingservice(object):' | |||||
529 | _serverequest(self.ui, self.repo, conn, h.createcmdserver) |
|
529 | _serverequest(self.ui, self.repo, conn, h.createcmdserver) | |
530 | finally: |
|
530 | finally: | |
531 | gc.collect() # trigger __del__ since worker process uses os._exit |
|
531 | gc.collect() # trigger __del__ since worker process uses os._exit | |
532 |
|
||||
533 | _servicemap = { |
|
|||
534 | 'pipe': pipeservice, |
|
|||
535 | 'unix': unixforkingservice, |
|
|||
536 | } |
|
|||
537 |
|
||||
538 | def createservice(ui, repo, opts): |
|
|||
539 | mode = opts['cmdserver'] |
|
|||
540 | try: |
|
|||
541 | return _servicemap[mode](ui, repo, opts) |
|
|||
542 | except KeyError: |
|
|||
543 | raise error.Abort(_('unknown mode %s') % mode) |
|
@@ -15,6 +15,7 b' import tempfile' | |||||
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 | ) | |
@@ -105,3 +106,15 b' def runservice(opts, parentfn=None, init' | |||||
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) |
General Comments 0
You need to be logged in to leave comments.
Login now