# HG changeset patch # User Yuya Nishihara # Date 1463890384 -32400 # Node ID a7513390a9db41895ad8451f2f767fefda232e4b # Parent 28aca3fafc2aaa07c03f64479007ba5050633fac chgserver: extract stub factory of service object The class inheritance will be replaced by composition. See the next patch for details. diff -r 28aca3fafc2a -r a7513390a9db hgext/chgserver.py --- 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