changeset 20202:a6014018ec28

util: remove unused realpath (issue4063) util.realpath was in use for only 5 days from dbdb777502dc until it was backed out in c519cd8f0169 because it caused issue3077 and issue3071.
author Christian Ebert <blacktrash@gmx.net>
date Sun, 29 Dec 2013 13:54:04 +0000
parents bc3b48b0f5c8
children 509768fc7542
files mercurial/posix.py mercurial/util.py mercurial/windows.py
diffstat 3 files changed, 0 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/mercurial/util.py	Wed Jan 01 17:57:48 2014 -0500
+++ b/mercurial/util.py	Sun Dec 29 13:54:04 2013 +0000
@@ -52,7 +52,6 @@
 popen = platform.popen
 posixfile = platform.posixfile
 quotecommand = platform.quotecommand
-realpath = platform.realpath
 rename = platform.rename
 samedevice = platform.samedevice
 samefile = platform.samefile
--- a/mercurial/windows.py	Wed Jan 01 17:57:48 2014 -0500
+++ b/mercurial/windows.py	Sun Dec 29 13:54:04 2013 +0000
@@ -133,15 +133,6 @@
 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