# HG changeset patch # User FUJIWARA Katsunori # Date 2011-12-16 12:09:40 # Node ID f63e4004737202dd6757c8395dab00813b73885d # Parent a1f4bd47d18e7658495fd116baa5e0f31abb05ff 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()'. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -614,22 +614,13 @@ def checkcase(path): 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: