Page MenuHomePhabricator

Autolink to new Gerrit / Git changesets and SHA-1 commits
Closed, ResolvedPublic

Description

Author: sumanah

Description:
People will need to refer, in Bugzilla comments, to changeset "Change ID"s (SHA-1s) and to the changeset numbers in the Gerrit changeset URL for any given diff. So:

  • Convert the Bugzilla code to recognize the new SHA-1 commits
  • Come up with a shorthand to autolink from BZ to gerrit changeset

Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=40344

Details

Reference
bz35144

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:13 AM
bzimport set Reference to bz35144.
bzimport added a subscriber: Unknown Object (MLST).

Doing this should be reasonably trivial... Weve got to decide on the syntax for identifying it. In the simplest form a sha1 has is only really distinguishable from words byit having numbers in it. Even tjen on shorthand it may be letters, which could in theory bea word

The Gerrit UI seems to prefix Git ids with a capital "I", even offering a button for copying the full SHA-1 hash to the clipboard prefixed with the "I". It's not what I would have chosen, but I wonder if Gerrit is following some convention established elsewhere. Worth looking into, and may be a good default barring a better suggestion.

For Gerrit links, since we're not 100% convinced we want to stay with Gerrit for very long, it may be best to use something like "gerrit 12345" or "gerrit:12345" that will be relatively easy to search for in the distant future should we switch away from Gerrit in the near future.

sumanah wrote:

Not a blocker for the March 21st migration.

Testing a couple of accepted formats:

gerrit #1234
gerrit change #1234
gerrit changeset #1234
gerrit 1234
gerrit change 1234
gerrit changeset 1234

What other syntaxes do we want here?

Giving the rendering of comment 4 (all six lines are rendered as the same HTML), it is hard to tell which syntax are supported.

(In reply to comment #7)

Giving the rendering of comment 4 (all six lines are rendered as the same
HTML), it is hard to tell which syntax are supported.

Would it be possible to leave the original text so that we can see what works?

(In reply to comment #9)

(In reply to comment #7)

Giving the rendering of comment 4 (all six lines are rendered as the same
HTML), it is hard to tell which syntax are supported.

Would it be possible to leave the original text so that we can see what works?

I posted a link to the regex above, but here it is:

gerrit(\ change(set)?)?\ ?\#?(\d+)

(In reply to comment #10)

I posted a link to the regex above, but here it is:

I understood your link to the regex, but what I was asking is if we
made a link like "gerrit #1" to remain as is (i.e. no “change”)
instead of all of the links being displayed the same way. (I'm
assuming I understand what is going on and that the links will be
parsed and displayed a certain way.)

It would also be nice to have a shortened syntax, as we used to have r100000, unless we now think that it's very evil and confusing (maybe it is).
I don't know what letter(s) to use, maybe g for gerrit or c for change(set)? g4020, c4020.
(I suppose it would be better to imitate what other git users do out there.)

P.s.: I've added the syntax to https://www.mediawiki.org/wiki/Bugzilla#What_syntax_can_I_use.3F

gerrit 1234
gerrit 1234 patchset 2

:p

Change-Id: Ifdc79e9c5d95f978025b237a5eeb95fd75092f46

gerrit Ifdc79e9c5d95f978025b237a5eeb95fd75092f46

Can we make above text autolinked?

Thehelpfulonewiki wrote:

Resetting to default per bug 37789

It looks like auto-linking by SHA1 was done by Krinkle in r115448. Is this correct? If so, what needs to happen to push this change live?

(In reply to comment #18)

It looks like auto-linking by SHA1 was done by Krinkle in r115448. Is this
correct? If so, what needs to happen to push this change live?

I think it's live now?
Some people are using c12345 as a shortcut to the (boring) gerrit changeset 12345, maybe that could be the new r12345?

Note that "gerrit changeset 12345" in the previous comment is currently not autolinking, maybe for newlines?

Does Gerrit changeset #12345 work? (it should)

Closing, as this appears to have been implemented. There is a separate bug (Bug 40344) about the URL mangling which appears to affect some auto-links.