# HG changeset patch # User Martin von Zweigbergk <martinvonz@google.com> # Date 1472574173 25200 # Tue Aug 30 09:22:53 2016 -0700 # Node ID 6f447b9ec2634873a60c871a2067325745553af2 # Parent 8a84347b9907ada91f9f3a21aca1fb62cac0fed5 util: rename checkcase() to fscasesensitive() (API) I always read the name "checkcase(path)" as "do we need to check for case folding at this path", but it's actually (I think) meant to be read "check if the file system cares about case at this path". I'm clearly not the only one confused by this as the dirstate has this property: def _checkcase(self): return not util.checkcase(self._join('.hg')) Maybe we should even inverse the function and call it fscasefolding() since that's what all callers care about? diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -148,8 +148,8 @@ # NOTE: os.path.dirname() and os.path.basename() are safe because # they use result of os.path.split() funcs = '''os.path.join os.path.split os.path.splitext - os.path.normpath os.makedirs - mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase + os.path.normpath os.makedirs mercurial.util.endswithsep + mercurial.util.splitpath mercurial.util.fscasesensitive mercurial.util.fspath mercurial.util.pconvert mercurial.util.normpath mercurial.util.checkwinfilename mercurial.util.checkosfilename mercurial.util.split''' diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2449,7 +2449,7 @@ ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) - ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') + ui.write(('case-sensitive: %s\n') % (util.fscasesensitive('.debugfsinfo') and 'yes' or 'no')) os.unlink('.debugfsinfo') diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1501,7 +1501,7 @@ # Only a case insensitive filesystem needs magic to translate user input # to actual case in the filesystem. - if not util.checkcase(r.root): + if not util.fscasesensitive(r.root): return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, exclude, default, r.auditor, self, listsubrepos=listsubrepos, diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -227,7 +227,7 @@ @propertycache def _checkcase(self): - return not util.checkcase(self._join('.hg')) + return not util.fscasesensitive(self._join('.hg')) def _join(self, f): # much faster than os.path.join() diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1586,7 +1586,7 @@ actions[m] = [] actions[m].append((f, args, msg)) - if not util.checkcase(repo.path): + if not util.fscasesensitive(repo.path): # check collision between files only in p2 for clean update if (not branchmerge and (force or not wc.dirty(missing=True, branch=False))): diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py --- a/mercurial/pathutil.py +++ b/mercurial/pathutil.py @@ -40,7 +40,7 @@ self.root = root self._realfs = realfs self.callback = callback - if os.path.lexists(root) and not util.checkcase(root): + if os.path.lexists(root) and not util.fscasesensitive(root): self.normcase = util.normcase else: self.normcase = lambda x: x diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1213,7 +1213,7 @@ # File system features -def checkcase(path): +def fscasesensitive(path): """ Return true if the given path is on a case-sensitive filesystem