[PATCH STABLE] match: fix a caseonly rename + explicit path commit on icasefs (issue4768)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Aug 7 02:03:09 UTC 2015
On 08/06/2015 06:56 PM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1438909216 14400
> # Thu Aug 06 21:00:16 2015 -0400
> # Branch stable
> # Node ID c54ca3f987fd1eaaba3a26d62806270fff535346
> # Parent 79f0cb97d7537a7c2948f8f9b0a89148825a3a1d
> match: fix a caseonly rename + explicit path commit on icasefs (issue4768)
>
> The problem was that the former name and the new name are both normalized to the
> case in dirstate, so matcher._files would be ['ABC.txt', 'ABC.txt'].
> localrepo.commit() calls localrepo.status(), passing along the matcher. Inside
> dirstate.status(), _walkexplicit() simply grabs matcher.files() and processes
> those items. Since the old name isn't present, it is silently dropped. There's
> a fundamental tension here, because the status command should also accept files
> that don't match the filesystem, so we can't drop the normalization in status.
> The problem originated in baa11dde8c0e.
>
> Unfortunately with this change, the case of the old file must still be specified
> exactly, or the old file is again silently excluded. I went back to
> baa11dde8c0e^, and that had the same behavior, so we are no worse off. I'm open
> to ideas from a matcher or dirstate expert on how to fix that half.
The code looks good to me with a small question. I will wait for a
distate wizard to double review this before pushing it.
>
> diff --git a/mercurial/match.py b/mercurial/match.py
> --- a/mercurial/match.py
> +++ b/mercurial/match.py
> @@ -386,7 +386,8 @@
> def __init__(self, root, cwd, patterns, include, exclude, default, auditor,
> ctx, listsubrepos=False, badfn=None):
> init = super(icasefsmatcher, self).__init__
> - self._dsnormalize = ctx.repo().dirstate.normalize
> + self._dirstate = ctx.repo().dirstate
Can we keep a dirstate reference in the matcher without trouble?
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list