changeset 17763:13070de77c86

vfs: backout fchmod change from 76b73ce0ffac Only works on Unix with Python >= 2.6, need a different fix.
author Matt Mackall <mpm@selenic.com>
date Sat, 13 Oct 2012 15:03:00 -0500
parents 57f27cbfc5bb
children c1b661ee29ff
files mercurial/scmutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Oct 12 21:41:08 2012 +0200
+++ b/mercurial/scmutil.py	Sat Oct 13 15:03:00 2012 -0500
@@ -255,10 +255,10 @@
     def _cansymlink(self):
         return util.checklink(self.base)
 
-    def _fixfilemode(self, fp):
+    def _fixfilemode(self, name):
         if self.createmode is None:
             return
-        os.fchmod(fp.fileno(), self.createmode & 0666)
+        os.chmod(name, self.createmode & 0666)
 
     def __call__(self, path, mode="r", text=False, atomictemp=False):
         if self._audit:
@@ -305,7 +305,7 @@
                     util.rename(util.mktempcopy(f), f)
         fp = util.posixfile(f, mode)
         if nlink == 0:
-            self._fixfilemode(fp)
+            self._fixfilemode(f)
         return fp
 
     def symlink(self, src, dst):
@@ -329,8 +329,8 @@
         else:
             f = self(dst, "w")
             f.write(src)
-            self._fixfilemode(f)
             f.close()
+            self._fixfilemode(dst)
 
     def audit(self, path):
         self.auditor(path)