Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 15670:d6c19cfa03ce stable
icasefs: avoid normcase()-ing in util.fspath() for efficiency
'dirstate._normalize()', the only caller of 'util.fspath()', has
already normcase()-ed path before invocation of it.
normcase()-ed root can be cached on dirstate side, too.
so, this patch changes 'util.fspath()' API specification to avoid
normcase()-ing in it.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 16 Dec 2011 21:09:40 +0900 |
parents | 390bcd01775a |
children | 2ebe3d0ce91d |
comparison
equal
deleted
inserted
replaced
15669:390bcd01775a | 15670:d6c19cfa03ce |
---|---|
614 '''Get name in the case stored in the filesystem | 614 '''Get name in the case stored in the filesystem |
615 | 615 |
616 The name is either relative to root, or it is an absolute path starting | 616 The name is either relative to root, or it is an absolute path starting |
617 with root. Note that this function is unnecessary, and should not be | 617 with root. Note that this function is unnecessary, and should not be |
618 called, for case-sensitive filesystems (simply because it's expensive). | 618 called, for case-sensitive filesystems (simply because it's expensive). |
619 | |
620 Both name and root should be normcase-ed. | |
619 ''' | 621 ''' |
620 # If name is absolute, make it relative | 622 # If name is absolute, make it relative |
621 name = normcase(name) | |
622 root = normcase(root) | |
623 if name.startswith(root): | 623 if name.startswith(root): |
624 l = len(root) | 624 l = len(root) |
625 if name[l] == os.sep or name[l] == os.altsep: | 625 if name[l] == os.sep or name[l] == os.altsep: |
626 l = l + 1 | 626 l = l + 1 |
627 name = name[l:] | 627 name = name[l:] |