# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1585647693 -19800 # Node ID d37975386798a69e3f0e0b14d32bc52aba805bdb # Parent 4dacd0cef146b15b72ccac4aed5758e7268ea334 chgserver: update the umask cache before each run posix.py uses a global variable to store the umask value resulting in caching of it when using chg. We need to update it before each command run as the umask can change between commands. This fixes test-inherit-mode.t with chg. diff -r 4dacd0cef146 -r d37975386798 mercurial/chgserver.py --- a/mercurial/chgserver.py Thu Mar 26 10:09:17 2020 -0400 +++ b/mercurial/chgserver.py Tue Mar 31 15:11:33 2020 +0530 @@ -528,7 +528,7 @@ def _setumask(self, data): mask = struct.unpack(b'>I', data)[0] self.ui.log(b'chgserver', b'setumask %r\n', mask) - os.umask(mask) + util.setumask(mask) def runcommand(self): # pager may be attached within the runcommand session, which should diff -r 4dacd0cef146 -r d37975386798 mercurial/util.py --- a/mercurial/util.py Thu Mar 26 10:09:17 2020 -0400 +++ b/mercurial/util.py Tue Mar 31 15:11:33 2020 +0530 @@ -130,6 +130,16 @@ unlink = platform.unlink username = platform.username + +def setumask(val): + ''' updates the umask. used by chg server ''' + if pycompat.iswindows: + return + os.umask(val) + global umask + platform.umask = umask = val & 0o777 + + # small compat layer compengines = compression.compengines SERVERROLE = compression.SERVERROLE