[PATCH 03 of 17] match: handle excludes using new differencematcher

Yuya Nishihara yuya at tcha.org
Fri May 26 11:10:02 EDT 2017


On Thu, 25 May 2017 11:24:44 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1494977808 25200
> #      Tue May 16 16:36:48 2017 -0700
> # Node ID dc1a97dee1b5de53dda25285ffd7ebcc16105549
> # Parent  8446a121f00de0575739e5285af58d564119a052
> match: handle excludes using new differencematcher

> +class differencematcher(basematcher):
> +    '''Composes two matchers by matching if the first matches and the second
> +    does not. Well, almost... If the user provides a pattern like "-X foo foo",
> +    Mercurial actually does match "foo" against that. That's because exact
> +    matches are treated specially. So, since this differencematcher is used for
> +    excludes, it needs to special-case exact matching.

Uh.

> +    def isexact(self):
> +        return self._m1.isexact()

I don't know if new behavior is correct, but before, isexact() would be False
if exclude patterns were specified. match.isexact is defined as follows:

    def isexact(self):
        return self.matchfn == self.exact

and matchfn would be a composition of matchfns[].

That said, the overall change looks great and no tests fail, so queued the
first 4 patches. Thanks.


More information about the Mercurial-devel mailing list