diff mercurial/util.py @ 15710:f63e40047372

icasefs: avoid path-absoluteness/existance check in util.fspath() for efficiency 'dirstate._normalize()', the only caller of 'util.fspath()', has already confirmed exsistance of specified file as relative to root. so, this patch omits path-absoluteness/existance check from 'util.fspath()'.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 16 Dec 2011 21:09:40 +0900
parents a1f4bd47d18e
children c604a3d1969d
line wrap: on
line diff
--- a/mercurial/util.py	Fri Dec 16 21:09:40 2011 +0900
+++ b/mercurial/util.py	Fri Dec 16 21:09:40 2011 +0900
@@ -614,22 +614,13 @@
 def fspath(name, root):
     '''Get name in the case stored in the filesystem
 
-    The name is either relative to root, or it is an absolute path starting
-    with root. Note that this function is unnecessary, and should not be
+    The name should be relative to root, and be normcase-ed for efficiency.
+
+    Note that this function is unnecessary, and should not be
     called, for case-sensitive filesystems (simply because it's expensive).
 
-    Both name and root should be normcase-ed.
+    The root should be normcase-ed, too.
     '''
-    # If name is absolute, make it relative
-    if name.startswith(root):
-        l = len(root)
-        if name[l] == os.sep or name[l] == os.altsep:
-            l = l + 1
-        name = name[l:]
-
-    if not os.path.lexists(os.path.join(root, name)):
-        return None
-
     def find(p, contents):
         lenp = len(p)
         for n in contents: