--- a/mercurial/posix.py Wed Jan 01 17:57:48 2014 -0500
+++ b/mercurial/posix.py Sun Dec 29 13:54:04 2013 +0000
@@ -197,7 +197,6 @@
return path.lower()
if sys.platform == 'darwin':
- import fcntl # only needed on darwin, missing on jython
def normcase(path):
'''
@@ -265,51 +264,6 @@
# 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