replace os.stat with os.lstat in some where.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Fri, 16 Jun 2006 12:58:24 -0700
changeset 2448 b77a2ef61b81
parent 2447 cd00531ecc16
child 2451 134227b82a96
replace os.stat with os.lstat in some where.
mercurial/dirstate.py
mercurial/localrepo.py
mercurial/util.py
mercurial/util_win32.py
--- a/mercurial/dirstate.py	Fri Jun 16 10:19:45 2006 -0700
+++ b/mercurial/dirstate.py	Fri Jun 16 12:58:24 2006 -0700
@@ -471,7 +471,7 @@
             # check the common case first
             if type_ == 'n':
                 if not st:
-                    st = os.stat(self.wjoin(fn))
+                    st = os.lstat(self.wjoin(fn))
                 if size >= 0 and (size != st.st_size
                                   or (mode ^ st.st_mode) & 0100):
                     modified.append(fn)
--- a/mercurial/localrepo.py	Fri Jun 16 10:19:45 2006 -0700
+++ b/mercurial/localrepo.py	Fri Jun 16 12:58:24 2006 -0700
@@ -242,7 +242,7 @@
                 raise repo.RepoError(_("unknown revision '%s'") % key)
 
     def dev(self):
-        return os.stat(self.path).st_dev
+        return os.lstat(self.path).st_dev
 
     def local(self):
         return True
--- a/mercurial/util.py	Fri Jun 16 10:19:45 2006 -0700
+++ b/mercurial/util.py	Fri Jun 16 12:58:24 2006 -0700
@@ -474,7 +474,7 @@
 
 def nlinks(pathname):
     """Return number of hardlinks for the given file."""
-    return os.stat(pathname).st_nlink
+    return os.lstat(pathname).st_nlink
 
 if hasattr(os, 'link'):
     os_link = os.link
@@ -625,10 +625,10 @@
 
     def is_exec(f, last):
         """check whether a file is executable"""
-        return (os.stat(f).st_mode & 0100 != 0)
+        return (os.lstat(f).st_mode & 0100 != 0)
 
     def set_exec(f, mode):
-        s = os.stat(f).st_mode
+        s = os.lstat(f).st_mode
         if (s & 0100 != 0) == mode:
             return
         if mode:
--- a/mercurial/util_win32.py	Fri Jun 16 10:19:45 2006 -0700
+++ b/mercurial/util_win32.py	Fri Jun 16 12:58:24 2006 -0700
@@ -162,7 +162,7 @@
         fh.Close()
         return res[7]
     except pywintypes.error:
-        return os.stat(pathname).st_nlink
+        return os.lstat(pathname).st_nlink
 
 def testpid(pid):
     '''return True if pid is still running or unable to