Patchwork [3,of,4] chgserver: drop repo at chgunixservice.__init__()

login
register
mail settings
Submitter Yuya Nishihara
Date July 13, 2016, 12:09 p.m.
Message ID <5bd15cd2fed4991214c4.1468411774@mimosa>
Download mbox | patch
Permalink /patch/15826/
State Accepted
Headers show

Comments

Yuya Nishihara - July 13, 2016, 12:09 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1463817999 -32400
#      Sat May 21 17:06:39 2016 +0900
# Node ID 5bd15cd2fed4991214c460875d41a88c8919a829
# Parent  5897fd557178c4b39349a0abd52a1ef5ade1702b
chgserver: drop repo at chgunixservice.__init__()

Since it isn't expensive operation, we don't have to delay it to init().

Patch

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -606,11 +606,13 @@  class AutoExitMixIn:  # use old-style to
                 raise
 
 class chgunixservice(commandserver.unixservice):
-    def init(self):
-        if self.repo:
+    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')
-            self.repo = None
+
+    def init(self):
         self._inithashstate()
         self._checkextensions()
         class cls(AutoExitMixIn, socketserver.ForkingMixIn,