changeset 28159:d2d04d1d2f92

chgserver: add setumask method Before this patch, the server won't inherit umask from the client, which will fail test-inherit-mode.t. This patch provides a way for the client to change umask of the server, similar to chdir and setenv.
author Jun Wu <quark@fb.com>
date Mon, 15 Feb 2016 14:28:17 +0000
parents 7cc57a531f0c
children 098cb7bd46a7
files hgext/chgserver.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/chgserver.py	Tue Feb 16 19:21:05 2016 +0000
+++ b/hgext/chgserver.py	Mon Feb 15 14:28:17 2016 +0000
@@ -289,6 +289,12 @@
         _log('chdir to %r\n' % path)
         os.chdir(path)
 
+    def setumask(self):
+        """Change umask"""
+        mask = struct.unpack('>I', self._read(4))[0]
+        _log('setumask %r\n' % mask)
+        os.umask(mask)
+
     def getpager(self):
         """Read cmdargs and write pager command to r-channel if enabled
 
@@ -341,7 +347,8 @@
     capabilities.update({'attachio': attachio,
                          'chdir': chdir,
                          'getpager': getpager,
-                         'setenv': setenv})
+                         'setenv': setenv,
+                         'setumask': setumask})
 
 # copied from mercurial/commandserver.py
 class _requesthandler(SocketServer.StreamRequestHandler):