mercurial/commandserver.py
changeset 29511 540c01a18bb7
parent 29433 33770d2b6cf9
child 29512 538d0003c9e0
equal deleted inserted replaced
29510:19205a0e2bf1 29511:540c01a18bb7
   332             _restoreio(ui, fin, fout)
   332             _restoreio(ui, fin, fout)
   333 
   333 
   334 class _requesthandler(socketserver.StreamRequestHandler):
   334 class _requesthandler(socketserver.StreamRequestHandler):
   335     def handle(self):
   335     def handle(self):
   336         ui = self.server.ui
   336         ui = self.server.ui
   337         repo = self.server.repo
       
   338         sv = None
   337         sv = None
   339         try:
   338         try:
   340             sv = server(ui, repo, self.rfile, self.wfile)
   339             sv = self._createcmdserver()
   341             try:
   340             try:
   342                 sv.serve()
   341                 sv.serve()
   343             # handle exceptions that may be raised by command server. most of
   342             # handle exceptions that may be raised by command server. most of
   344             # known exceptions are caught by dispatch.
   343             # known exceptions are caught by dispatch.
   345             except error.Abort as inst:
   344             except error.Abort as inst:
   357             else:
   356             else:
   358                 cerr = channeledoutput(self.wfile, 'e')
   357                 cerr = channeledoutput(self.wfile, 'e')
   359             traceback.print_exc(file=cerr)
   358             traceback.print_exc(file=cerr)
   360             raise
   359             raise
   361 
   360 
       
   361     def _createcmdserver(self):
       
   362         ui = self.server.ui
       
   363         repo = self.server.repo
       
   364         return server(ui, repo, self.rfile, self.wfile)
       
   365 
   362 class unixservice(object):
   366 class unixservice(object):
   363     """
   367     """
   364     Listens on unix domain socket and forks server per connection
   368     Listens on unix domain socket and forks server per connection
   365     """
   369     """
   366     def __init__(self, ui, repo, opts):
   370     def __init__(self, ui, repo, opts):