diff mercurial/util.py @ 44629:d37975386798

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.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 31 Mar 2020 15:11:33 +0530
parents 9d2b2df2c2ba
children 3aed7d262bdf 1bab6b61b62b
line wrap: on
line diff
--- 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