At 16:19 15.05.2002 -0700, Mel Hatzis wrote:
Thinking about this some more, it would be *really* useful to
allow this regular expression to be overriden in the dbconfig
file. Allowing user's to define their own would provide them the
flexibility to get as fancy as they want with some of the corner
cases where the default regex behaviour is not desirable...such
as "Re: PR 50 (was PR 33)" which matches PR 33.
Thoughts?
Then Milan Zamazal wrote:
Me too. If someone sends appropriate patches, I'll be happy to
incorporate them. (If anyone wants to do it before the 4.0 release,
please test it carefully and include documentation patches as well.)
OK, I've attached a patchfile for this.
You can now (optionally) include the following in the database-info
section of the dbconfig file:
# The regular expression used to determine whether a PR is referenced
# on an email subject line
subject-matching {
"\\<((PR[ \t/])\\|([-a-z0-9_+.]+/))([0-9]+)"
capture-group "4"
}
(The above example is exactly analogous to the built-in default)
Regarding documentation, I've updated the man page for dbconfig. One thing
I didn't mention is that if you include a regex which doesn't compile, GNATS
will revert to using the default - and will also email the gnats-admin via
punt.
Invalid values for the capture-group similarly generate email to gnats-admin,
though in this case, GNATS does not revert to the default - it simply assumes
no PR's are referenced on the subject line. I'm not clear on whether this
too should revert to using the default, but decided against it since the
associated regex would be valid in this case.
A possible enhancement would be to allow multiple regular expressions to
be specified, each with their own capture group. Alternatively, it might
be nice to allow multiple capture groups, making it possible to update
multiple PR's using a single submission.