Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 4281:384672d8080f
add util.lexists
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 26 Mar 2007 21:36:26 -0300 |
parents | 81402b2b294d |
children | d4f0405fadac |
comparison
equal
deleted
inserted
replaced
4280:a9336520a4ee | 4281:384672d8080f |
---|---|
583 else: | 583 else: |
584 os.environ[k] = v | 584 os.environ[k] = v |
585 if cwd is not None and oldcwd != cwd: | 585 if cwd is not None and oldcwd != cwd: |
586 os.chdir(oldcwd) | 586 os.chdir(oldcwd) |
587 | 587 |
588 # os.path.lexists is not available on python2.3 | |
589 def lexists(filename): | |
590 "test whether a file with this name exists. does not follow symlinks" | |
591 try: | |
592 os.lstat(filename) | |
593 except: | |
594 return False | |
595 return True | |
596 | |
588 def rename(src, dst): | 597 def rename(src, dst): |
589 """forcibly rename a file""" | 598 """forcibly rename a file""" |
590 try: | 599 try: |
591 os.rename(src, dst) | 600 os.rename(src, dst) |
592 except OSError, err: | 601 except OSError, err: |