[PATCH 4 of 4] dirstate: speed up case collision checking
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Sat Jun 23 01:26:54 CDT 2012
At Fri, 22 Jun 2012 13:49:49 -0700,
Joshua Redstone wrote:
>
> # HG changeset patch
> # User Joshua Redstone <joshua.redstone at fb.com>
> # Date 1340048916 25200
> # Node ID 4bdb6a9bb7ce10f78a8aa1d2b4d69b00e2949839
> # Parent a97598a0ca30329ad513f8e9fe443ec3b0fc1baa
> dirstate: speed up case collision checking
>
> scmutil.casecollisionauditor is slow for large repos. Switch to a faster
> implementation based on reducing the fraction of all files that are scanned
> and caching the results of case conversion lazily rather than precomputing.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1202,12 +1202,15 @@
> cca = None
> abort, warn = scmutil.checkportabilityalert(ui)
> if abort or warn:
> - cca = scmutil.casecollisionauditor(ui, abort, wctx)
> + cca = scmutil.casecollisionauditor(repo.dirstate.sortedfiles())
> for f in repo.walk(match):
> exact = match.exact(f)
> if exact or not explicitonly and f not in repo.dirstate:
> - if cca:
> - cca(f)
> + if cca and cca.collides(f):
> + msg = _('possible case-folding collision for %s') % f
> + if abort:
> + raise util.Abort(msg)
> + ui.warn(_("warning: %s\n") % msg)
> names.append(f)
> if ui.verbose or not exact:
> ui.status(_('adding %s\n') % match.rel(join(f)))
IMHO, to encapsulate initialization/aborting process of the auditor,
arguments for the constructor of casecollisionauditor should be kept
as same as they are: the auditor can get "repo.dirstate.sortedfiles()"
via "wctx._repo".
In fact, I'm just working to add the new auditor to restrict filename
normalization form (e.g. NFC/NFD). It'll prevent users from adding
files of which names are normalized in unexpected normalization form
especially on Mac OS HFS+ environments.
For such feature:
- auditor needs at least "ui" to get configurations in each
repositories
- abort message should be encapsulated in each auditors
----------------------------------------------------------------------
[FUJIWARA Katsunori] foozy at lares.dti.ne.jp
More information about the Mercurial-devel
mailing list