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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 11, 2013, 3:15 p.m.
Message ID <5cede77133f0b1311892.1384182957@juju>
Download mbox | patch
Permalink /patch/2907/
State Superseded
Headers show

Comments

Katsunori FUJIWARA - Nov. 11, 2013, 3:15 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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.
Matt Mackall - Nov. 13, 2013, 9:03 p.m.
On Tue, 2013-11-12 at 00:15 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@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

> -        allfiles = '\0'.join(dirstate._map)
> +        allfiles = '\0'.join(f for f, s in dirstate.iteritems() if s[0] != 'r')

I suspect this is significantly slower on large manifests.

You should instead keep the existing allfiles code, then if that hits,
check against removed files.

Patch

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