[PATCH 3 of 4] chgserver: refactor initialization of real/base addresses

Yuya Nishihara yuya at tcha.org
Mon Jul 18 09:53:37 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1463893597 -32400
#      Sun May 22 14:06:37 2016 +0900
# Node ID 793c1bbd113d7cf862f17a91f6b6ccb8cbc9b15c
# Parent  d03c1efd598ff58a56830cfb2ca1015c5a96a49a
chgserver: refactor initialization of real/base addresses

Instead of overwriting self.address, calculate it from the address argument,
which is the base address.

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -546,19 +546,19 @@ class chgunixservicehandler(object):
         self.lastactive = time.time()
 
     def bindsocket(self, sock, address):
-        self.address = address
-        self._inithashstate()
+        self._inithashstate(address)
         self._checkextensions()
         self._bind(sock)
         self._createsymlink()
 
-    def _inithashstate(self):
-        self.baseaddress = self.address
+    def _inithashstate(self, address):
+        self.baseaddress = address
         if self.ui.configbool('chgserver', 'skiphash', False):
             self.hashstate = None
+            self.address = address
             return
         self.hashstate = hashstate.fromui(self.ui)
-        self.address = _hashaddress(self.address, self.hashstate.confighash)
+        self.address = _hashaddress(address, self.hashstate.confighash)
 
     def _checkextensions(self):
         if not self.hashstate:


More information about the Mercurial-devel mailing list