Page MenuHomeFreeBSD

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

Authored by vangyzen on Mar 1 2019, 8:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 25, 8:20 AM
Unknown Object (File)
Mon, Mar 25, 8:20 AM
Unknown Object (File)
Mon, Mar 25, 8:19 AM
Unknown Object (File)
Mon, Mar 25, 5:16 AM
Unknown Object (File)
Feb 7 2024, 8:04 AM
Unknown Object (File)
Jan 12 2024, 10:47 AM
Unknown Object (File)
Dec 20 2023, 2:45 AM
Unknown Object (File)
Nov 21 2023, 5:49 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 - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 22884
Build 21970: arc lint + arc unit

Event Timeline

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? :)

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'

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)

This revision is now accepted and ready to land.Apr 12 2019, 8:43 PM

I put an updated (case insensitive URL, python3, etc.) version of extract_pr_numbers.py at https://bugs.freebsd.org/236229