Commits

Yuya Nishihara committed 9827b80

hgext: drop unused code for per-repository service

Comments (0)

Files changed (1)

 
 class service(object):
     """Prefork server for handling connection from cHg client"""
-    def __init__(self, ui, repo, sockpath):
+    def __init__(self, ui, sockpath):
         self._ui = ui
-        self._repo = repo
         self._sockpath = sockpath
         self._maxworkers = self._ui.configint('chg', 'maxworkers', 2)
 
         conn, _addr = self._sock.accept()
         self._ui.note('accepted connection (pid=%d)\n' % os.getpid())
 
-        if self._repo:
-            # retain ui settings for per-repository service, but recreate them
-            # so that they won't keep deprecated states
-            ui = self._repo.baseui.copy()
-            repo = hg.repository(ui, self._repo.root)
-        else:
-            # don't retain settings of the master service
-            ui = self._ui.__class__()
-            repo = nullrepo(ui)
-
+        ui = self._ui.__class__()  # don't retain settings of the service
         fin = conn.makefile('rb')
         fout = conn.makefile('wb')
-        sv = chgcmdserver(ui, repo, fin, fout)
+        sv = chgcmdserver(ui, nullrepo(ui), fin, fout)
         _wrapui(ui, sv)
 
         origcwd = os.getcwd()
 
     # it might be confusing to reuse --port option
     sockpath = opts['port']
-    if sockpath:
-        repo = None  # global service
-    else:
-        if repo is None:
-            raise error.RepoError(_('There is no Mercurial repository here'
-                                    ' (.hg not found)'))
-        sockpath = repo.join('cmdserver.sock')
+    if not sockpath:
+        raise util.Abort(_('no socket path specified with --port'))
 
-    svc = service(ui, repo, sockpath)
+    svc = service(ui, sockpath)
     cmdutil.service(opts, initfn=svc.init, runfn=svc.run)
 
 def uisetup(ui):