Limit bug links in Gerrit to recommended headers

Per https://wiki.openstack.org/wiki/GitCommitMessages the
recommended commit message headers for bug links are:

    Closes-Bug: #1234567
    Partial-Bug: #1234567
    Related-Bug: #1234567

This change limits the bug-specific Gerrit commentlink to only match
on the above three patterns, potentially all-lower-case, space and
pound sign optional. It should help to train developers to apply
these with greater consistency in their commits. Also support
"(start-of-word)bug:? #?\d+" separately, so that bugs mentioned
loosely in the commit message, reviews or inline code comments will
still get hyperlinked. This latter pattern does leave some ambiguity
in commit messages, however, as developers might think their bug
will get updated when they add old-style lines like "Fixes bug
1234567" instead of a .*-bug header, because both get the same
hyperlinks.

Change-Id: I57fa0ca901a7228dc0739fdd98ff12aa091f0dbe
This commit is contained in:
Jeremy Stanley 2013-09-24 17:45:08 +00:00
parent 43bad50bea
commit d1cdbd4aae

View File

@ -130,9 +130,14 @@ class openstack_project::gerrit (
link => '#q,$1,n,z',
},
{
name => 'launchpad',
match => '(\\b[Bb]ug\\b|\\b[Ll][Pp]\\b)[ \\t#:]*(\\d+)',
link => 'https://code.launchpad.net/bugs/$2',
name => 'bugheader',
match => '^([Cc]loses|[Pp]artial|[Rr]elated)-[Bb]ug:[\\s#]?(\\d+)$',
link => 'https://launchpad.net/bugs/$2',
},
{
name => 'bug',
match => '\\bbug:? #?(\\d+)',
link => 'https://launchpad.net/bugs/$1',
},
{
name => 'blueprint',