changeset 20006:9276014db865

scmutil: skip checks in "casecollisionauditor" if filename is already checked Before this patch, almost all of check code in "casecollisionauditor.__call__()" is executed, even if specified filename is already checked, because "f in self._newfiles" is examined lastly. In addition to it, adding "fl" to "self._loweredfiles" and "f" to "self._newfiles" are also redundant in such case. This patch checks "f in self._newfiles" first, and returns immediately to avoid execution of check code for efficiency.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 12 Nov 2013 00:07:23 +0900
parents ce5d711475a3
children 23edc6673f0d
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Nov 05 09:43:36 2013 +0100
+++ b/mercurial/scmutil.py	Tue Nov 12 00:07:23 2013 +0900
@@ -97,9 +97,10 @@
         self._newfiles = set()
 
     def __call__(self, f):
+        if f in self._newfiles:
+            return
         fl = encoding.lower(f)
-        if (fl in self._loweredfiles and f not in self._dirstate and
-            f not in self._newfiles):
+        if fl in self._loweredfiles and f not in self._dirstate:
             msg = _('possible case-folding collision for %s') % f
             if self._abort:
                 raise util.Abort(msg)