[patch] improved ignore pattern matching (#57637)

Kent Gibson warthog618 at gmail.com
Sun Nov 26 12:38:12 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Jari Aalto wrote:
>
> Just a comment
>
> - Standard shell patterns are fine (no extensions needed) - Regexp
> patterns would be great
>
> Being able to select between either of these a) globally) or b)
> line-by-line basis is all that I would need. Meaning, that bzr wold
>  default to shell style and only if 'magic' word appears in front
> of lines, then the line would be treated as regexp:
>
> *.o regexp::some.*silly.*path
>
The patch does almost exactly what you suggest (option b - line by line).
Except the 'magic'  word  is  'RE:', not 'regex::'.

> Whitespace should not be allowed in regexp lines, but the some
> regexp-shortcut to substitute it. Like Perl's well known \s.
>
Not supporting whitespace in regexes would be weird.  In regexes
whitespace is normally matched verbatim - if that's how you want to
use it.  Or you can use the special character groups as you suggest.
Leave it to the user.

The patch supports all Python regex formats, with the exclusion of
named/numbered grouping, so it will happily interpret \s as
whitespace, \S as non-whitespace, \d as digits etc.

Named/numbered grouping is excluded because it would conflict with the
aggregation of multiple patterns into a single regex.  The patch does
the aggregation for performance reasons, as did the previous fnmatch
based version.  It uses groups to identify the matching ignore pattern
within the aggregate, so other use of the groups would corrupt the
mapping.
While it is technically possible to support named/numbered grouping
and aggregation, it would make the implementation complicated. And who
wants to use named/numbered groupings in ignore patterns anyway?  That
can wait til someone asks for it.

Cheers,
Kent.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFaYq0goxTFTi1P8QRAiCwAKDJLsPfCTnVaYFN52qaiBETD2TE9gCfSFcg
oVUrg+h9LMpKsYek+r4GFJQ=
=SBwC
-----END PGP SIGNATURE-----




More information about the bazaar mailing list