Show More
@@ -40,7 +40,6 b' Config' | |||||
40 |
|
40 | |||
41 | from __future__ import absolute_import |
|
41 | from __future__ import absolute_import | |
42 |
|
42 | |||
43 | import SocketServer |
|
|||
44 | import errno |
|
43 | import errno | |
45 | import gc |
|
44 | import gc | |
46 | import hashlib |
|
45 | import hashlib | |
@@ -68,6 +67,8 b' from mercurial import (' | |||||
68 | util, |
|
67 | util, | |
69 | ) |
|
68 | ) | |
70 |
|
69 | |||
|
70 | socketserver = util.socketserver | |||
|
71 | ||||
71 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
72 | # Note for extension authors: ONLY specify testedwith = 'internal' for | |
72 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
73 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
73 | # be specifying the version(s) of Mercurial they are tested with, or |
|
74 | # be specifying the version(s) of Mercurial they are tested with, or | |
@@ -530,7 +531,7 b' class chgcmdserver(commandserver.server)' | |||||
530 | 'setumask': setumask}) |
|
531 | 'setumask': setumask}) | |
531 |
|
532 | |||
532 | # copied from mercurial/commandserver.py |
|
533 | # copied from mercurial/commandserver.py | |
533 |
class _requesthandler( |
|
534 | class _requesthandler(socketserver.StreamRequestHandler): | |
534 | def handle(self): |
|
535 | def handle(self): | |
535 | # use a different process group from the master process, making this |
|
536 | # use a different process group from the master process, making this | |
536 | # process pass kernel "is_current_pgrp_orphaned" check so signals like |
|
537 | # process pass kernel "is_current_pgrp_orphaned" check so signals like | |
@@ -603,7 +604,7 b' class AutoExitMixIn: # use old-style to' | |||||
603 |
|
604 | |||
604 | def process_request(self, request, address): |
|
605 | def process_request(self, request, address): | |
605 | self.lastactive = time.time() |
|
606 | self.lastactive = time.time() | |
606 |
return |
|
607 | return socketserver.ForkingMixIn.process_request( | |
607 | self, request, address) |
|
608 | self, request, address) | |
608 |
|
609 | |||
609 | def server_bind(self): |
|
610 | def server_bind(self): | |
@@ -656,8 +657,8 b' class chgunixservice(commandserver.unixs' | |||||
656 | self.repo = None |
|
657 | self.repo = None | |
657 | self._inithashstate() |
|
658 | self._inithashstate() | |
658 | self._checkextensions() |
|
659 | self._checkextensions() | |
659 |
class cls(AutoExitMixIn, |
|
660 | class cls(AutoExitMixIn, socketserver.ForkingMixIn, | |
660 |
|
|
661 | socketserver.UnixStreamServer): | |
661 | ui = self.ui |
|
662 | ui = self.ui | |
662 | repo = self.repo |
|
663 | repo = self.repo | |
663 | hashstate = self.hashstate |
|
664 | hashstate = self.hashstate |
@@ -7,7 +7,6 b'' | |||||
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import SocketServer |
|
|||
11 | import errno |
|
10 | import errno | |
12 | import os |
|
11 | import os | |
13 | import struct |
|
12 | import struct | |
@@ -21,6 +20,8 b' from . import (' | |||||
21 | util, |
|
20 | util, | |
22 | ) |
|
21 | ) | |
23 |
|
22 | |||
|
23 | socketserver = util.socketserver | |||
|
24 | ||||
24 | logfile = None |
|
25 | logfile = None | |
25 |
|
26 | |||
26 | def log(*args): |
|
27 | def log(*args): | |
@@ -330,7 +331,7 b' class pipeservice(object):' | |||||
330 | finally: |
|
331 | finally: | |
331 | _restoreio(ui, fin, fout) |
|
332 | _restoreio(ui, fin, fout) | |
332 |
|
333 | |||
333 |
class _requesthandler( |
|
334 | class _requesthandler(socketserver.StreamRequestHandler): | |
334 | def handle(self): |
|
335 | def handle(self): | |
335 | ui = self.server.ui |
|
336 | ui = self.server.ui | |
336 | repo = self.server.repo |
|
337 | repo = self.server.repo | |
@@ -366,13 +367,13 b' class unixservice(object):' | |||||
366 | self.ui = ui |
|
367 | self.ui = ui | |
367 | self.repo = repo |
|
368 | self.repo = repo | |
368 | self.address = opts['address'] |
|
369 | self.address = opts['address'] | |
369 |
if not util.safehasattr( |
|
370 | if not util.safehasattr(socketserver, 'UnixStreamServer'): | |
370 | raise error.Abort(_('unsupported platform')) |
|
371 | raise error.Abort(_('unsupported platform')) | |
371 | if not self.address: |
|
372 | if not self.address: | |
372 | raise error.Abort(_('no socket path specified with --address')) |
|
373 | raise error.Abort(_('no socket path specified with --address')) | |
373 |
|
374 | |||
374 | def init(self): |
|
375 | def init(self): | |
375 |
class cls( |
|
376 | class cls(socketserver.ForkingMixIn, socketserver.UnixStreamServer): | |
376 | ui = self.ui |
|
377 | ui = self.ui | |
377 | repo = self.repo |
|
378 | repo = self.repo | |
378 | self.server = cls(self.address, _requesthandler) |
|
379 | self.server = cls(self.address, _requesthandler) |
@@ -9,7 +9,6 b'' | |||||
9 | from __future__ import absolute_import |
|
9 | from __future__ import absolute_import | |
10 |
|
10 | |||
11 | import BaseHTTPServer |
|
11 | import BaseHTTPServer | |
12 | import SocketServer |
|
|||
13 | import errno |
|
12 | import errno | |
14 | import os |
|
13 | import os | |
15 | import socket |
|
14 | import socket | |
@@ -23,6 +22,7 b' from .. import (' | |||||
23 | util, |
|
22 | util, | |
24 | ) |
|
23 | ) | |
25 |
|
24 | |||
|
25 | socketserver = util.socketserver | |||
26 | urlerr = util.urlerr |
|
26 | urlerr = util.urlerr | |
27 | urlreq = util.urlreq |
|
27 | urlreq = util.urlreq | |
28 |
|
28 | |||
@@ -147,9 +147,9 b' class _httprequesthandler(BaseHTTPServer' | |||||
147 | env['wsgi.input'] = self.rfile |
|
147 | env['wsgi.input'] = self.rfile | |
148 | env['wsgi.errors'] = _error_logger(self) |
|
148 | env['wsgi.errors'] = _error_logger(self) | |
149 | env['wsgi.multithread'] = isinstance(self.server, |
|
149 | env['wsgi.multithread'] = isinstance(self.server, | |
150 |
|
|
150 | socketserver.ThreadingMixIn) | |
151 | env['wsgi.multiprocess'] = isinstance(self.server, |
|
151 | env['wsgi.multiprocess'] = isinstance(self.server, | |
152 |
|
|
152 | socketserver.ForkingMixIn) | |
153 | env['wsgi.run_once'] = 0 |
|
153 | env['wsgi.run_once'] = 0 | |
154 |
|
154 | |||
155 | self.saved_status = None |
|
155 | self.saved_status = None | |
@@ -240,10 +240,10 b' class _httprequesthandlerssl(_httpreques' | |||||
240 | try: |
|
240 | try: | |
241 | import threading |
|
241 | import threading | |
242 | threading.activeCount() # silence pyflakes and bypass demandimport |
|
242 | threading.activeCount() # silence pyflakes and bypass demandimport | |
243 |
_mixin = |
|
243 | _mixin = socketserver.ThreadingMixIn | |
244 | except ImportError: |
|
244 | except ImportError: | |
245 | if util.safehasattr(os, "fork"): |
|
245 | if util.safehasattr(os, "fork"): | |
246 |
_mixin = |
|
246 | _mixin = socketserver.ForkingMixIn | |
247 | else: |
|
247 | else: | |
248 | class _mixin(object): |
|
248 | class _mixin(object): | |
249 | pass |
|
249 | pass |
@@ -18,6 +18,13 b' except ImportError:' | |||||
18 | pickle.dumps # silence pyflakes |
|
18 | pickle.dumps # silence pyflakes | |
19 |
|
19 | |||
20 | try: |
|
20 | try: | |
|
21 | import SocketServer as socketserver | |||
|
22 | socketserver.ThreadingMixIn | |||
|
23 | except ImportError: | |||
|
24 | import socketserver | |||
|
25 | socketserver.ThreadingMixIn | |||
|
26 | ||||
|
27 | try: | |||
21 | import xmlrpclib |
|
28 | import xmlrpclib | |
22 | xmlrpclib.Transport |
|
29 | xmlrpclib.Transport | |
23 | except ImportError: |
|
30 | except ImportError: |
@@ -54,6 +54,7 b' for attr in (' | |||||
54 | # we do import urlreq, but we do it outside the loop |
|
54 | # we do import urlreq, but we do it outside the loop | |
55 | #'urlreq', |
|
55 | #'urlreq', | |
56 | 'stringio', |
|
56 | 'stringio', | |
|
57 | 'socketserver', | |||
57 | 'xmlrpclib', |
|
58 | 'xmlrpclib', | |
58 | ): |
|
59 | ): | |
59 | globals()[attr] = getattr(pycompat, attr) |
|
60 | globals()[attr] = getattr(pycompat, attr) |
@@ -28,7 +28,7 b'' | |||||
28 | hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
28 | hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
29 | hgext/bugzilla.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
29 | hgext/bugzilla.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
30 | hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
30 | hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
31 |
hgext/chgserver.py: error importing |
|
31 | hgext/chgserver.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
32 | hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
32 | hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
33 | hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
33 | hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
34 | hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
34 | hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
@@ -88,7 +88,6 b'' | |||||
88 | mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
88 | mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
89 | mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
89 | mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
90 | mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
90 | mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
91 | mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob) |
|
|||
92 | mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
91 | mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
93 | mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
92 | mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) | |
94 | mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
93 | mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
@@ -15,7 +15,6 b' Any help will be greatly appreciated. ' | |||||
15 | __version__ = "0.2.1" |
|
15 | __version__ = "0.2.1" | |
16 |
|
16 | |||
17 | import BaseHTTPServer |
|
17 | import BaseHTTPServer | |
18 | import SocketServer |
|
|||
19 | import os |
|
18 | import os | |
20 | import select |
|
19 | import select | |
21 | import socket |
|
20 | import socket | |
@@ -24,6 +23,7 b' import sys' | |||||
24 | from mercurial import util |
|
23 | from mercurial import util | |
25 |
|
24 | |||
26 | urlparse = util.urlparse |
|
25 | urlparse = util.urlparse | |
|
26 | socketserver = util.socketserver | |||
27 |
|
27 | |||
28 | class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): |
|
28 | class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): | |
29 | __base = BaseHTTPServer.BaseHTTPRequestHandler |
|
29 | __base = BaseHTTPServer.BaseHTTPRequestHandler | |
@@ -135,7 +135,7 b' class ProxyHandler (BaseHTTPServer.BaseH' | |||||
135 | do_PUT = do_GET |
|
135 | do_PUT = do_GET | |
136 | do_DELETE = do_GET |
|
136 | do_DELETE = do_GET | |
137 |
|
137 | |||
138 |
class ThreadingHTTPServer ( |
|
138 | class ThreadingHTTPServer (socketserver.ThreadingMixIn, | |
139 | BaseHTTPServer.HTTPServer): |
|
139 | BaseHTTPServer.HTTPServer): | |
140 | def __init__(self, *args, **kwargs): |
|
140 | def __init__(self, *args, **kwargs): | |
141 | BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs) |
|
141 | BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs) |
General Comments 0
You need to be logged in to leave comments.
Login now