[PATCH 8 of 9] chgserver: do not re-load configs in "validate"

Jun Wu quark at fb.com
Sun Nov 13 16:55:52 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1479073939 0
#      Sun Nov 13 21:52:19 2016 +0000
# Node ID 4660680374d24f7d46834b54de2fbbeec164e906
# Parent  27827ad1ff25161b919f46eb3e370d21172a9285
chgserver: do not re-load configs in "validate"

With the current design, it's not needed to re-load config and test if
sensitive configs are changed or not.

Actually this is the most fragile part of the old chg design - with anything
unexpected like bundle, or shared repos. chg could end up with an
understanding of what "ui.config" is, different from "dispatch". That will
make chg unusable.

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -391,5 +391,5 @@ class chgcmdserver(commandserver.server)
 
     def validate(self):
-        """Reload the config and check if the server is up to date
+        """Check if the server is up to date and can serve correctly
 
         Read a list of '\0' separated arguments.
@@ -410,13 +410,6 @@ class chgcmdserver(commandserver.server)
         the instructions.
         """
-        args = self._readlist()
-        try:
-            self.ui, lui = _loadnewui(self.ui, args)
-        except error.ParseError as inst:
-            dispatch._formatparse(self.ui.warn, inst)
-            self.ui.flush()
-            self.cresult.write('exit 255')
-            return
-        newhash = hashstate(ui=lui, mtimepaths=self.hashstate.mtimepaths)
+        self._readlist() # for compatibility
+        newhash = hashstate(ui=self.ui, mtimepaths=self.hashstate.mtimepaths)
         insts = []
         if newhash.mtimehash != self.hashstate.mtimehash:


More information about the Mercurial-devel mailing list