Patchwork match: catch attempts to create case-insenstive exact matchers

login
register
mail settings
Submitter via Mercurial-devel
Date May 22, 2017, 3:50 p.m.
Message ID <936afa945aea039ef4a1.1495468241@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20824/
State Accepted
Headers show

Comments

via Mercurial-devel - May 22, 2017, 3:50 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495468174 25200
#      Mon May 22 08:49:34 2017 -0700
# Node ID 936afa945aea039ef4a12517cdbf891a36af256f
# Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
match: catch attempts to create case-insenstive exact matchers

Exact matchers are only created internally (as opposed to from user
input) based on a set of files that the caller collected before, so
they should always match the list exactly (i.e. case-sensitively).
Augie Fackler - May 22, 2017, 7:32 p.m.
On Mon, May 22, 2017 at 08:50:41AM -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1495468174 25200
> #      Mon May 22 08:49:34 2017 -0700
> # Node ID 936afa945aea039ef4a12517cdbf891a36af256f
> # Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
> match: catch attempts to create case-insenstive exact matchers

queued, thanks
Yuya Nishihara - May 23, 2017, 2:18 p.m.
On Mon, 22 May 2017 08:50:41 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1495468174 25200
> #      Mon May 22 08:49:34 2017 -0700
> # Node ID 936afa945aea039ef4a12517cdbf891a36af256f
> # Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
> match: catch attempts to create case-insenstive exact matchers
> 
> Exact matchers are only created internally (as opposed to from user
> input) based on a set of files that the caller collected before, so
> they should always match the list exactly (i.e. case-sensitively).
> 
> diff --git a/mercurial/match.py b/mercurial/match.py
> --- a/mercurial/match.py
> +++ b/mercurial/match.py
> @@ -120,6 +120,9 @@
>      """
>      normalize = _donormalize
>      if icasefs:
> +        if exact:
> +            raise error.Abort(_("a case-insensitive exact matcher doesn't "
> +                                "make sense"))

Nit: ProgrammingError seems more appropriate.
via Mercurial-devel - May 23, 2017, 3:51 p.m.
On Tue, May 23, 2017 at 7:18 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> On Mon, 22 May 2017 08:50:41 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@google.com>
>> # Date 1495468174 25200
>> #      Mon May 22 08:49:34 2017 -0700
>> # Node ID 936afa945aea039ef4a12517cdbf891a36af256f
>> # Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
>> match: catch attempts to create case-insenstive exact matchers
>>
>> Exact matchers are only created internally (as opposed to from user
>> input) based on a set of files that the caller collected before, so
>> they should always match the list exactly (i.e. case-sensitively).
>>
>> diff --git a/mercurial/match.py b/mercurial/match.py
>> --- a/mercurial/match.py
>> +++ b/mercurial/match.py
>> @@ -120,6 +120,9 @@
>>      """
>>      normalize = _donormalize
>>      if icasefs:
>> +        if exact:
>> +            raise error.Abort(_("a case-insensitive exact matcher doesn't "
>> +                                "make sense"))
>
> Nit: ProgrammingError seems more appropriate.

True. Will send a patch fixing that another instance in match.py.

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -120,6 +120,9 @@ 
     """
     normalize = _donormalize
     if icasefs:
+        if exact:
+            raise error.Abort(_("a case-insensitive exact matcher doesn't "
+                                "make sense"))
         dirstate = ctx.repo().dirstate
         dsnormalize = dirstate.normalize