Page MenuHomeFreeBSD

post-commit hooks: Accept BZ URLs in PR lines
AcceptedPublic

Authored by vangyzen on Mar 1 2019, 8:31 PM.

Details

Reviewers
rgrimes
dab
Summary

Accept Bugzilla URLs in "PR" lines in commit logs.
Still accepted are multiple PRs per line, commas,
extra text, references, and mixed case "Pr/pR/pr" tags.
GNATS category tags, such as kern/1234, are no longer accepted.

Test Plan

A unit test is included.

Diff Detail

Repository
rS FreeBSD src repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 23645
Build 22627: arc lint + arc unit

Event Timeline

vangyzen created this revision.Mar 1 2019, 8:31 PM

Missing is the change to the commit message template to update it to say URL instead of PRxxxx

hooks/scripts/extract_pr_numbers.py
30

$FreeBSD$

Check out rP154065.
All of the PRs linked there were filed in GNATS but were mapped over in BUGZILLA so they had the same numbers.
Had they been GNATS urls they would be more annoying to deal with IMO as the links would all be dead now. I realize this is an objective opinion. I would be comfortable with simply "https://bugs.freebsd.org/12344" as that can likely work forever.

We would need the same changes over in ports and docs repos as well.
And phabricator matching.

You might want to discuss this on a mailing list to see what else is parsing the format.

Missing is the change to the commit message template to update it to say URL instead of PRxxxx

Thanks. See D19459 and D19460.

hooks/scripts/extract_pr_numbers.py
30

Old habits die hard? :)

vangyzen updated this revision to Diff 54706.Mar 4 2019, 8:02 PM

$Id$ -> $FreeBSD$

Check out rP154065.
All of the PRs linked there were filed in GNATS but were mapped over in BUGZILLA so they had the same numbers.
Had they been GNATS urls they would be more annoying to deal with IMO as the links would all be dead now. I realize this is an objective opinion.

I imagine we could write a URL redirector easily enough. As an example, I just wrote one to redirect a Bugzilla URL to whatever system we have next:

https://people.freebsd.org/~vangyzen/show_bug.cgi.txt

Of course, it just redirects to bugzilla for now. Also, CGI is not enabled in our public_html, so you just get to read the code, not test it. (I tested it locally.)

I would be comfortable with simply "https://bugs.freebsd.org/12344" as that can likely work forever.

I considered that, and I would prefer it very much. The problem is, Someone(TM) would need to modify Bugzilla to produce those URLs, because the address bar in the browser is the one place people will get the URL for copy-and-pasting into the commit log. I am not inclined to make that change. The URL redirector will be easy enough, when the time comes.

We would need the same changes over in ports and docs repos as well.

Will do. I think I'll get some more feedback before porting it over, but I'll commit to all three at the same time.

And phabricator matching.

I don't understand. If you're referring to the web UI, that already turns all URLs into links (as you probably knew). I'm not sure what else you could be referring to, though.

You might want to discuss this on a mailing list to see what else is parsing the format.

Good idea. Thanks.

To keep the whole record in one place, here is the CGI script I mentioned:

#!/bin/sh

# disable filename globbing
set -f

if id=$(expr "$QUERY_STRING" : '^id=\([0-9][0-9]*\)$')
then
	printf 'Refresh: 0;https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=%d\r\n' "$id"
fi
printf '\r\n'
emaste added a subscriber: emaste.Mar 8 2019, 9:04 PM

I would be comfortable with simply "https://bugs.freebsd.org/12344" as that can likely work forever.

Note that https://bugs.freebsd.org/12344 does work - we should accept either https://bugs.freebsd.org/bugzilla/show_bug.cgi?id= or https://bugs.freebsd.org/[0-9]+

I would be comfortable with simply "https://bugs.freebsd.org/12344" as that can likely work forever.

Note that https://bugs.freebsd.org/12344 does work - we should accept either https://bugs.freebsd.org/bugzilla/show_bug.cgi?id= or https://bugs.freebsd.org/[0-9]+

Good point. Yes, we should accept both. Thanks, @emaste.

There is more discussion on this topic in D19459. (Your point still stands, independent of that discussion.)

I would be comfortable with simply "https://bugs.freebsd.org/12344" as that can likely work forever.

Note that https://bugs.freebsd.org/12344 does work - we should accept either https://bugs.freebsd.org/bugzilla/show_bug.cgi?id= or https://bugs.freebsd.org/[0-9]+

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=[0-9]+ or https://bugs.freebsd.org/[0-9]+ (Added [0-9] to first)

vangyzen updated this revision to Diff 56137.Apr 12 2019, 2:57 PM
  • Accept short URLs, too.
dab accepted this revision.Apr 12 2019, 8:43 PM
This revision is now accepted and ready to land.Apr 12 2019, 8:43 PM