diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -197,7 +197,6 @@ def normcase(path): return path.lower() if sys.platform == 'darwin': - import fcntl # only needed on darwin, missing on jython def normcase(path): ''' @@ -265,51 +264,6 @@ if sys.platform == 'darwin': # Decompose then lowercase (HFS+ technote specifies lower) return unicodedata.normalize('NFD', u).lower().encode('utf-8') - def realpath(path): - ''' - Returns the true, canonical file system path equivalent to the given - path. - - Equivalent means, in this case, resulting in the same, unique - file system link to the path. Every file system entry, whether a file, - directory, hard link or symbolic link or special, will have a single - path preferred by the system, but may allow multiple, differing path - lookups to point to it. - - Most regular UNIX file systems only allow a file system entry to be - looked up by its distinct path. Obviously, this does not apply to case - insensitive file systems, whether case preserving or not. The most - complex issue to deal with is file systems transparently reencoding the - path, such as the non-standard Unicode normalisation required for HFS+ - and HFSX. - ''' - # Constants copied from /usr/include/sys/fcntl.h - F_GETPATH = 50 - O_SYMLINK = 0x200000 - - try: - fd = os.open(path, O_SYMLINK) - except OSError, err: - if err.errno == errno.ENOENT: - return path - raise - - try: - return fcntl.fcntl(fd, F_GETPATH, '\0' * 1024).rstrip('\0') - finally: - os.close(fd) -elif sys.version_info < (2, 4, 2, 'final'): - # Workaround for http://bugs.python.org/issue1213894 (os.path.realpath - # didn't resolve symlinks that were the first component of the path.) - def realpath(path): - if os.path.isabs(path): - return os.path.realpath(path) - else: - return os.path.realpath('./' + path) -else: - # Fallback to the likely inadequate Python builtin function. - realpath = os.path.realpath - if sys.platform == 'cygwin': # workaround for cygwin, in which mount point part of path is # treated as case sensitive, even though underlying NTFS is case diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -52,7 +52,6 @@ pconvert = platform.pconvert popen = platform.popen posixfile = platform.posixfile quotecommand = platform.quotecommand -realpath = platform.realpath rename = platform.rename samedevice = platform.samedevice samefile = platform.samefile diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -133,15 +133,6 @@ def normpath(path): def normcase(path): return encoding.upper(path) -def realpath(path): - ''' - Returns the true, canonical file system path equivalent to the given - path. - ''' - # TODO: There may be a more clever way to do this that also handles other, - # less common file systems. - return os.path.normpath(normcase(os.path.realpath(path))) - def samestat(s1, s2): return False