util: rename checkcase() to fscasesensitive() (API)
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 30 Aug 2016 09:22:53 -0700
changeset 29889 6f447b9ec263
parent 29888 8a84347b9907
child 29890 31a6d5e14508
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?
hgext/win32mbcs.py
mercurial/commands.py
mercurial/context.py
mercurial/dirstate.py
mercurial/merge.py
mercurial/pathutil.py
mercurial/util.py
--- a/hgext/win32mbcs.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/hgext/win32mbcs.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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'''
--- a/mercurial/commands.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/commands.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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')
 
--- a/mercurial/context.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/context.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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,
--- a/mercurial/dirstate.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/dirstate.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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()
--- a/mercurial/merge.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/merge.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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))):
--- a/mercurial/pathutil.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/pathutil.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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
--- a/mercurial/util.py	Mon Aug 29 17:48:14 2016 -0700
+++ b/mercurial/util.py	Tue Aug 30 09:22:53 2016 -0700
@@ -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