[PATCH 1 of 2] opener: add new resetflags param to __call__
Adrian Buehlmann
adrian at cadifra.com
Sat Dec 4 06:39:58 CST 2010
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1291450283 -3600
# Node ID d117e5fec89474724361f2618eddbae350ba29d1
# Parent 6b8d2ee24ce2fb5d88dc201aa792ad878d06b92a
opener: add new resetflags param to __call__
If True, the flags of a preexisting normal file are reset on 'w'rite.
Defaults to False, which preserves the flags of normal files.
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -871,7 +871,8 @@ class opener(object):
return
os.chmod(name, self.createmode & 0666)
- def __call__(self, path, mode="r", text=False, atomictemp=False):
+ def __call__(self, path, mode="r", text=False, atomictemp=False,
+ resetflags=False):
self.auditor(path)
f = os.path.join(self.base, path)
@@ -890,7 +891,8 @@ class opener(object):
return atomictempfile(f, mode, self.createmode)
try:
if 'w' in mode:
- st_mode = os.lstat(f).st_mode & 0777
+ if not resetflags:
+ st_mode = os.lstat(f).st_mode & 0777
os.unlink(f)
nlink = 0
else:
More information about the Mercurial-devel
mailing list