comparison mercurial/util.py @ 9397:5b117c90f036

util: quicker fspath, do not lower names when the length is different
author Simon Heimberg <simohe@besonet.ch>
date Wed, 29 Jul 2009 14:21:18 +0200
parents eae98607b349
children 4c3fb45123e5
comparison
equal deleted inserted replaced
9396:5cd14e1e8385 9397:5b117c90f036
659 if dir not in _fspathcache: 659 if dir not in _fspathcache:
660 _fspathcache[dir] = os.listdir(dir) 660 _fspathcache[dir] = os.listdir(dir)
661 contents = _fspathcache[dir] 661 contents = _fspathcache[dir]
662 662
663 lpart = part.lower() 663 lpart = part.lower()
664 lenp = len(part)
664 for n in contents: 665 for n in contents:
665 if n.lower() == lpart: 666 if lenp == len(n) and n.lower() == lpart:
666 result.append(n) 667 result.append(n)
667 break 668 break
668 else: 669 else:
669 # Cannot happen, as the file exists! 670 # Cannot happen, as the file exists!
670 result.append(part) 671 result.append(part)