[PATCH 2 of 3] fix_bytes: loosen blacklist matching requirements

Augie Fackler raf at durin42.com
Mon May 12 19:58:32 CDT 2014


On Sat, May 10, 2014 at 04:39:56PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1399758879 25200
> #      Sat May 10 14:54:39 2014 -0700
> # Node ID 8a49e0cb7f14a69662da24d71ec2d4ab3f536df3
> # Parent  c59dd2bd4a28c4ce6438f15c9cfa612bb1e74162
> fix_bytes: loosen blacklist matching requirements
>
> diff --git a/contrib/hgfixes/fix_bytes.py b/contrib/hgfixes/fix_bytes.py
> --- a/contrib/hgfixes/fix_bytes.py
> +++ b/contrib/hgfixes/fix_bytes.py
> @@ -11,12 +11,12 @@ from lib2to3.pygram import python_symbol
>
>  # XXX: Implementing a blacklist in 2to3 turned out to be more troublesome than
>  # blacklisting some modules inside the fixers. So, this is what I came with.
>
> -blacklist = ['mercurial/demandimport.py',
> +blacklist = ('mercurial/demandimport.py',
>               'mercurial/py3kcompat.py', # valid python 3 already
>               'mercurial/i18n.py',
> -            ]
> +            )

Why does this list change into a tuple? Could stand to be mentioned in
the subject.

>
>  def isdocstring(node):
>      def isclassorfunction(ancestor):
>          symbols = (syms.funcdef, syms.classdef)
> @@ -82,9 +82,10 @@ class FixBytes(fixer_base.BaseFix):
>
>      PATTERN = 'STRING'
>
>      def transform(self, node, results):
> -        if self.filename in blacklist:
> +        # The filename may be prefixed with a build directory.
> +        if self.filename.endswith(blacklist):
>              return
>          if node.type == token.STRING:
>              if _re.match(node.value):
>                  if isdocstring(node):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list