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

login
register
mail settings
Submitter Jun Wu
Date Nov. 13, 2016, 9:55 p.m.
Message ID <4660680374d24f7d4683.1479074152@x1c>
Download mbox | patch
Permalink /patch/17557/
State Changes Requested
Headers show

Comments

Jun Wu - Nov. 13, 2016, 9:55 p.m.
# HG changeset patch
# User Jun Wu <quark@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.

Patch

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: