changeset 4281:384672d8080f

add util.lexists
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 26 Mar 2007 21:36:26 -0300
parents a9336520a4ee
children a1406a50ca83
files mercurial/util.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -585,6 +585,15 @@ def system(cmd, environ={}, cwd=None, on
         if cwd is not None and oldcwd != cwd:
             os.chdir(oldcwd)
 
+# os.path.lexists is not available on python2.3
+def lexists(filename):
+    "test whether a file with this name exists. does not follow symlinks"
+    try:
+        os.lstat(filename)
+    except:
+        return False
+    return True
+
 def rename(src, dst):
     """forcibly rename a file"""
     try: