Patchwork [1,of,2] chg: remove manual reload logic

login
register
mail settings
Submitter Jun Wu
Date March 10, 2016, 12:32 a.m.
Message ID <a0a69881240c389b0c5e.1457569950@x1c>
Download mbox | patch
Permalink /patch/13733/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - March 10, 2016, 12:32 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1457568753 0
#      Thu Mar 10 00:12:33 2016 +0000
# Node ID a0a69881240c389b0c5e84451474cde66025f6d8
# Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
chg: remove manual reload logic

chgserver now validates and reloads configs automatically. Manually reloading
is no longer necessary. Besides, we are deprecating pid files since the server
will periodically check its ownership of the socket file and exit if it does
not own the socket file any longer, which works more reliable than a pid file.
This patch removes the SIGHUP reload logic from both chg server and client.
Yuya Nishihara - March 11, 2016, 7:35 a.m.
On Thu, 10 Mar 2016 00:32:30 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1457568753 0
> #      Thu Mar 10 00:12:33 2016 +0000
> # Node ID a0a69881240c389b0c5e84451474cde66025f6d8
> # Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
> chg: remove manual reload logic

Updated docstring and chg.1 and pushed to the clowncopter, thanks.

>  class chgunixservice(commandserver.unixservice):
>      def init(self):
> -        signal.signal(signal.SIGHUP, self._reloadconfig)

test-check-pyflakes.t says hi.

Patch

diff --git a/contrib/chg/README b/contrib/chg/README
--- a/contrib/chg/README
+++ b/contrib/chg/README
@@ -13,7 +13,6 @@ 
  $ chg help                 # show help of Mercurial
  $ alias hg=chg             # replace hg command
  $ chg --kill-chg-daemon    # terminate background server
- $ chg --reload-chg-daemon  # reload configuration files
 
 Environment variables:
 
@@ -21,8 +20,7 @@ 
 changed after spawning the server. The following variables are specially
 handled:
 
- * configuration files are reloaded if HGPLAIN or HGPLAINEXCEPT changed, but
-   some behaviors won't change correctly.
+ * configuration files are reloaded automatically by default.
  * CHGHG or HG specifies the path to the hg executable spawned as the
    background command server.
 
diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -540,8 +540,6 @@ 
 		int sig = 0;
 		if (strcmp(argv[1], "--kill-chg-daemon") == 0)
 			sig = SIGTERM;
-		if (strcmp(argv[1], "--reload-chg-daemon") == 0)
-			sig = SIGHUP;
 		if (sig > 0) {
 			killcmdserver(&opts, sig);
 			return 0;
diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -616,7 +616,6 @@ 
 
 class chgunixservice(commandserver.unixservice):
     def init(self):
-        signal.signal(signal.SIGHUP, self._reloadconfig)
         self._inithashstate()
         class cls(AutoExitMixIn, SocketServer.ForkingMixIn,
                   SocketServer.UnixStreamServer):
@@ -647,9 +646,6 @@ 
         os.symlink(os.path.basename(self.address), tempaddress)
         util.rename(tempaddress, self.baseaddress)
 
-    def _reloadconfig(self, signum, frame):
-        self.ui = self.server.ui = _renewui(self.ui)
-
     def run(self):
         try:
             self.server.serve_forever()