[PATCH 3 of 4] match: inverse _anypats(), making it _prefix()

Yuya Nishihara yuya at tcha.org
Tue Jul 11 09:20:49 EDT 2017


On Mon, 10 Jul 2017 10:27:43 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1499665323 25200
> #      Sun Jul 09 22:42:03 2017 -0700
> # Node ID b90074c6fa4739ae6b817d853ebcffd931671933
> # Parent  25d89317826e99474cde4b97899903191ef1ba27
> match: inverse _anypats(), making it _prefix()

> +def _prefix(kindpats):
> +    '''Whether all the patterns match a prefix (i.e. recursively)'''
>      for kind, pat, source in kindpats:
> -        if kind in ('glob', 're', 'relglob', 'relre', 'set', 'rootfilesin'):
> -            return True
> +        assert kind not in ('listfile', 'listfile0', 'include', 'subinclude')

"subinclude" isn't expanded by normalize().

> +        if kind not in ('path', 'relpath'):
> +            return False
> +    return True

Other than that, this patch looks good to me.


More information about the Mercurial-devel mailing list