Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 15666:37a6e9765015 stable
pathauditor: switch normcase logic according to case sensitivity of filesystem
this patch applies 'util.normcase()' to audit path only on case
insensitive filesystem.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 16 Dec 2011 21:09:40 +0900 |
parents | 081e795c60e0 |
children | 7b7f03502b5a 4751d5133f15 |
comparison
equal
deleted
inserted
replaced
15665:081e795c60e0 | 15666:37a6e9765015 |
---|---|
74 def __init__(self, root, callback=None): | 74 def __init__(self, root, callback=None): |
75 self.audited = set() | 75 self.audited = set() |
76 self.auditeddir = set() | 76 self.auditeddir = set() |
77 self.root = root | 77 self.root = root |
78 self.callback = callback | 78 self.callback = callback |
79 if os.path.lexists(root) and not util.checkcase(root): | |
80 self.normcase = util.normcase | |
81 else: | |
82 self.normcase = lambda x: x | |
79 | 83 |
80 def __call__(self, path): | 84 def __call__(self, path): |
81 '''Check the relative path. | 85 '''Check the relative path. |
82 path may contain a pattern (e.g. foodir/**.txt)''' | 86 path may contain a pattern (e.g. foodir/**.txt)''' |
83 | 87 |
84 normpath = os.path.normcase(path) | 88 normpath = self.normcase(path) |
85 if normpath in self.audited: | 89 if normpath in self.audited: |
86 return | 90 return |
87 # AIX ignores "/" at end of path, others raise EISDIR. | 91 # AIX ignores "/" at end of path, others raise EISDIR. |
88 if util.endswithsep(path): | 92 if util.endswithsep(path): |
89 raise util.Abort(_("path ends in directory separator: %s") % path) | 93 raise util.Abort(_("path ends in directory separator: %s") % path) |