[PATCH STABLE] match: fix NameError 'pat' on overflow of regex pattern length

Augie Fackler raf at durin42.com
Tue Apr 29 10:10:45 CDT 2014


On Tue, Apr 29, 2014 at 01:54:59PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1398736960 -32400
> #      Tue Apr 29 11:02:40 2014 +0900
> # Branch stable
> # Node ID 920b654c7a16fc208fe62ca58609434ef34a0247
> # Parent  6a43c60ad9af8d7524740a9ae185970759235eab
> match: fix NameError 'pat' on overflow of regex pattern length

Queued, thanks.

>
> 'pat' was renamed to 'regex' in 9d28fd795215.
>
> diff --git a/mercurial/match.py b/mercurial/match.py
> --- a/mercurial/match.py
> +++ b/mercurial/match.py
> @@ -343,7 +343,7 @@ def _buildregexmatch(kindpats, globsuffi
>              raise
>          regexa, a = _buildregexmatch(kindpats[:l//2], globsuffix)
>          regexb, b = _buildregexmatch(kindpats[l//2:], globsuffix)
> -        return pat, lambda s: a(s) or b(s)
> +        return regex, lambda s: a(s) or b(s)
>      except re.error:
>          for k, p in kindpats:
>              try:
> diff --git a/tests/test-walk.t b/tests/test-walk.t
> --- a/tests/test-walk.t
> +++ b/tests/test-walk.t
> @@ -331,3 +331,14 @@ Test listfile and listfile0
>    f  mammals/skunk  mammals/skunk  exact
>
>    $ cd ..
> +
> +Test split patterns on overflow
> +
> +  $ cd t
> +  $ echo fennel > overflow.list
> +  $ python -c "for i in xrange(20000 / 100): print 'x' * 100" >> overflow.list
> +  $ echo fenugreek >> overflow.list
> +  $ hg debugwalk 'listfile:overflow.list' 2>&1 | grep -v '^xxx'
> +  f  fennel     fennel     exact
> +  f  fenugreek  fenugreek  exact
> +  $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list