Show More
@@ -60,6 +60,7 b' from mercurial import (' | |||
|
60 | 60 | error, |
|
61 | 61 | extensions, |
|
62 | 62 | osutil, |
|
63 | server, | |
|
63 | 64 | util, |
|
64 | 65 | ) |
|
65 | 66 | |
@@ -635,7 +636,7 b' def chgunixservice(ui, repo, opts):' | |||
|
635 | 636 | return commandserver.unixforkingservice(ui, repo=None, opts=opts, handler=h) |
|
636 | 637 | |
|
637 | 638 | def uisetup(ui): |
|
638 |
|
|
|
639 | server._cmdservicemap['chgunix'] = chgunixservice | |
|
639 | 640 | |
|
640 | 641 | # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
|
641 | 642 | # start another chg. drop it to avoid possible side effects. |
@@ -35,7 +35,6 b' from . import (' | |||
|
35 | 35 | bundle2, |
|
36 | 36 | changegroup, |
|
37 | 37 | cmdutil, |
|
38 | commandserver, | |
|
39 | 38 | copies, |
|
40 | 39 | dagparser, |
|
41 | 40 | dagutil, |
@@ -6299,7 +6298,7 b' def serve(ui, repo, **opts):' | |||
|
6299 | 6298 | s.serve_forever() |
|
6300 | 6299 | |
|
6301 | 6300 | if opts["cmdserver"]: |
|
6302 |
service = |
|
|
6301 | service = server.createcmdservice(ui, repo, opts) | |
|
6303 | 6302 | else: |
|
6304 | 6303 | service = hgweb.createservice(ui, repo, opts) |
|
6305 | 6304 | return server.runservice(opts, initfn=service.init, runfn=service.run) |
@@ -529,15 +529,3 b' class unixforkingservice(object):' | |||
|
529 | 529 | _serverequest(self.ui, self.repo, conn, h.createcmdserver) |
|
530 | 530 | finally: |
|
531 | 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 | 15 | from .i18n import _ |
|
16 | 16 | |
|
17 | 17 | from . import ( |
|
18 | commandserver, | |
|
18 | 19 | error, |
|
19 | 20 | util, |
|
20 | 21 | ) |
@@ -105,3 +106,15 b' def runservice(opts, parentfn=None, init' | |||
|
105 | 106 | |
|
106 | 107 | if runfn: |
|
107 | 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