Mercurial > public > mercurial-scm > hg-stable
comparison hgext/chgserver.py @ 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 | 0a853dc9b306 |
comparison
equal
deleted
inserted
replaced
28158:7cc57a531f0c | 28159:d2d04d1d2f92 |
---|---|
287 if not path: | 287 if not path: |
288 return | 288 return |
289 _log('chdir to %r\n' % path) | 289 _log('chdir to %r\n' % path) |
290 os.chdir(path) | 290 os.chdir(path) |
291 | 291 |
292 def setumask(self): | |
293 """Change umask""" | |
294 mask = struct.unpack('>I', self._read(4))[0] | |
295 _log('setumask %r\n' % mask) | |
296 os.umask(mask) | |
297 | |
292 def getpager(self): | 298 def getpager(self): |
293 """Read cmdargs and write pager command to r-channel if enabled | 299 """Read cmdargs and write pager command to r-channel if enabled |
294 | 300 |
295 If pager isn't enabled, this writes '\0' because channeledoutput | 301 If pager isn't enabled, this writes '\0' because channeledoutput |
296 does not allow to write empty data. | 302 does not allow to write empty data. |
339 | 345 |
340 capabilities = commandserver.server.capabilities.copy() | 346 capabilities = commandserver.server.capabilities.copy() |
341 capabilities.update({'attachio': attachio, | 347 capabilities.update({'attachio': attachio, |
342 'chdir': chdir, | 348 'chdir': chdir, |
343 'getpager': getpager, | 349 'getpager': getpager, |
344 'setenv': setenv}) | 350 'setenv': setenv, |
351 'setumask': setumask}) | |
345 | 352 |
346 # copied from mercurial/commandserver.py | 353 # copied from mercurial/commandserver.py |
347 class _requesthandler(SocketServer.StreamRequestHandler): | 354 class _requesthandler(SocketServer.StreamRequestHandler): |
348 def handle(self): | 355 def handle(self): |
349 # use a different process group from the master process, making this | 356 # use a different process group from the master process, making this |