changeset 29546:a7513390a9db

chgserver: extract stub factory of service object The class inheritance will be replaced by composition. See the next patch for details.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 22 May 2016 13:13:04 +0900
parents 28aca3fafc2a
children 300318b7d66d
files hgext/chgserver.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/chgserver.py	Sun May 22 13:08:30 2016 +0900
+++ b/hgext/chgserver.py	Sun May 22 13:13:04 2016 +0900
@@ -538,13 +538,7 @@
 def _hashaddress(address, hashstr):
     return '%s-%s' % (address, hashstr)
 
-class chgunixservice(commandserver.unixservice):
-    def __init__(self, ui, repo, opts):
-        super(chgunixservice, self).__init__(ui, repo=None, opts=opts)
-        if repo:
-            # one chgserver can serve multiple repos. drop repo infomation
-            self.ui.setconfig('bundle', 'mainreporoot', '', 'repo')
-
+class _chgunixservice(commandserver.unixservice):
     def init(self):
         self._inithashstate()
         self._checkextensions()
@@ -653,6 +647,12 @@
         return chgcmdserver(ui, repo, fin, fout, conn,
                             self.server.hashstate, self.server.baseaddress)
 
+def chgunixservice(ui, repo, opts):
+    if repo:
+        # one chgserver can serve multiple repos. drop repo infomation
+        ui.setconfig('bundle', 'mainreporoot', '', 'repo')
+    return _chgunixservice(ui, repo=None, opts=opts)
+
 def uisetup(ui):
     commandserver._servicemap['chgunix'] = chgunixservice