Mercurial > public > mercurial-scm > hg-stable
diff mercurial/posix.py @ 9031:3b76321aa0de
compat: use open() instead of file() everywhere
author | Alejandro Santos <alejolp@alejolp.com> |
---|---|
date | Sun, 05 Jul 2009 11:01:30 +0200 |
parents | 0289f384e1e5 |
children | 40196d036a71 |
line wrap: on
line diff
--- a/mercurial/posix.py Sun Jul 05 11:01:01 2009 +0200 +++ b/mercurial/posix.py Sun Jul 05 11:01:30 2009 +0200 @@ -9,7 +9,7 @@ import osutil import os, sys, errno, stat, getpass, pwd, grp -posixfile = file +posixfile = open nulldev = '/dev/null' normpath = os.path.normpath samestat = os.path.samestat @@ -70,20 +70,20 @@ if l: if not stat.S_ISLNK(s): # switch file to link - data = file(f).read() + data = open(f).read() os.unlink(f) try: os.symlink(data, f) except: # failed to make a link, rewrite file - file(f, "w").write(data) + open(f, "w").write(data) # no chmod needed at this point return if stat.S_ISLNK(s): # switch link to file data = os.readlink(f) os.unlink(f) - file(f, "w").write(data) + open(f, "w").write(data) s = 0666 & ~umask # avoid restatting for chmod sx = s & 0100