[PATCH] chgserver: update the umask cache before each run
Pulkit Goyal
7895pulkit at gmail.com
Tue Mar 31 09:50:52 UTC 2020
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1585647693 -19800
# Tue Mar 31 15:11:33 2020 +0530
# Node ID 74566de0d15595223b5e11e98f1535b5c9df736c
# Parent 588c91753fff6f10758a872b331b2f61e0413586
# EXP-Topic chg-test
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 --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -531,6 +531,8 @@ class chgcmdserver(commandserver.server)
os.umask(mask)
def runcommand(self):
+ # updates the umask cache in util.py and posix.py
+ util.updateumask()
# pager may be attached within the runcommand session, which should
# be detached at the end of the session. otherwise the pager wouldn't
# receive EOF.
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -130,6 +130,17 @@ umask = platform.umask
unlink = platform.unlink
username = platform.username
+
+def updateumask():
+ ''' updates the umask cache. used by chg server '''
+ val = os.umask(0)
+ os.umask(val)
+ global umask
+ umask = val
+ if not pycompat.iswindows:
+ platform.umask = val
+
+
# small compat layer
compengines = compression.compengines
SERVERROLE = compression.SERVERROLE
More information about the Mercurial-devel
mailing list