[PATCH 2 of 5] scmutil: ignore removed files in case-folding collision check for efficiency

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Nov 11 15:15:57 UTC 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1384182480 -32400
#      Tue Nov 12 00:08:00 2013 +0900
# Node ID 5cede77133f0b1311892898965dfd52d12056d9b
# Parent  2558f01d2f7f2a118679f1ee68a743543039aff8
scmutil: ignore removed files in case-folding collision check for efficiency

"dirstate._map" contains also removed files, but they don't cause
case-folding collision against newly added ones.

This patch prevents removed files from being stored into
"self._loweredfiles", and this decreases number of "f not in
self._dirstate" examination in "__call__()".

In addition to it, succeeding patches to check case-folding collision
around directory part of files depends on this change, too.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -88,7 +88,7 @@
     def __init__(self, ui, abort, dirstate):
         self._ui = ui
         self._abort = abort
-        allfiles = '\0'.join(dirstate._map)
+        allfiles = '\0'.join(f for f, s in dirstate.iteritems() if s[0] != 'r')
         self._loweredfiles = set(encoding.lower(allfiles).split('\0'))
         self._dirstate = dirstate
         # The purpose of _newfiles is so that we don't complain about



More information about the Mercurial-devel mailing list