context: simplify call to icase matcher in 'match()'
The two function takes the very same arguments. We make this clearer and less
error prone by dispatching on the function only and having a single call point
in the code.
--- a/mercurial/context.py Thu Mar 16 09:13:13 2017 +0530
+++ b/mercurial/context.py Wed Mar 15 15:38:02 2017 -0700
@@ -1525,15 +1525,13 @@
# Only a case insensitive filesystem needs magic to translate user input
# to actual case in the filesystem.
+ matcherfunc = matchmod.match
if not util.fscasesensitive(r.root):
- return matchmod.icasefsmatcher(r.root, r.getcwd(), pats,
- include, exclude, default, r.auditor,
- self, listsubrepos=listsubrepos,
- badfn=badfn)
- return matchmod.match(r.root, r.getcwd(), pats,
- include, exclude, default,
- auditor=r.auditor, ctx=self,
- listsubrepos=listsubrepos, badfn=badfn)
+ matcherfunc = matchmod.icasefsmatcher
+ return matcherfunc(r.root, r.getcwd(), pats,
+ include, exclude, default,
+ auditor=r.auditor, ctx=self,
+ listsubrepos=listsubrepos, badfn=badfn)
def _filtersuspectsymlink(self, files):
if not files or self._repo.dirstate._checklink: