context: simplify call to icase matcher in 'match()'
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 15 Mar 2017 15:38:02 -0700
changeset 31464 0e7a6279ff6e
parent 31463 55df8fa15b09
child 31465 da83f12d7a88
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.
mercurial/context.py
--- 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: