[PATCH 5 of 7] chgserver: extract stub factory of service object

Yuya Nishihara yuya at tcha.org
Thu Jul 14 11:20:43 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1463890384 -32400
#      Sun May 22 13:13:04 2016 +0900
# Node ID 1c47f0361d40b86ec4e6b1aca6d7b7a980ba78fd
# Parent  35585295685ad2c8478f8cb59a3d4cada5d224be
chgserver: extract stub factory of service object

The class inheritance will be replaced by composition. See the next patch
for details.

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -538,13 +538,7 @@ def _tempaddress(address):
 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 @@ class _requesthandler(commandserver._req
         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
 


More information about the Mercurial-devel mailing list