[PATCH V2] fix: change the default fix pattern (issue6077)

Yuya Nishihara yuya at tcha.org
Thu Feb 14 09:45:42 EST 2019


On Wed, 13 Feb 2019 17:54:18 -0500, Jordi GutiƩrrez Hermoso wrote:
> # HG changeset patch
> # User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
> # Date 1550096863 18000
> #      Wed Feb 13 17:27:43 2019 -0500
> # Node ID d8ba3b6466b220a5e04d07a5eccd3c1d45a2f501
> # Parent  5d383d9636d0b81b416398913b32b8c715e98db5
> fix: change the default fix pattern (issue6077)
> 
> The matchutils functions don't know what to do with an empty pattern.
> When a fixer doesn't have a pattern at all, a default of None will
> make match functions unhappy and stack trace.
> 
> Change this default instead to a pattern that matches everything.
> 
> diff --git a/hgext/fix.py b/hgext/fix.py
> --- a/hgext/fix.py
> +++ b/hgext/fix.py
> @@ -38,7 +38,8 @@ substituted into the command::
>  
>  The :pattern suboption determines which files will be passed through each
>  configured tool. See :hg:`help patterns` for possible values. If there are file
> -arguments to :hg:`fix`, the intersection of these patterns is used.
> +arguments to :hg:`fix`, the intersection of these patterns is used. If no patterns
> +are specified, the default is to apply the tool to all files.
>  
>  There is also a configurable limit for the maximum size of file that will be
>  processed by :hg:`fix`::
> @@ -122,7 +123,7 @@ FIXER_ATTRS = {
>      'command': None,
>      'linerange': None,
>      'fileset': None,
> -    'pattern': None,
> +    'pattern': '.',

Perhaps it would mean 'relpath:.' (any files under the current directory, not
under the repository root.)

I think it's better to either pass in an empty list to scmutil.match() or use
scmutil.matchall() if _pattern is None.


More information about the Mercurial-devel mailing list