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.
--- 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):