Closed Bug 443989 Opened 16 years ago Closed 13 years ago

Auto-link "changeset foo" to hgweb

Categories

(bugzilla.mozilla.org :: Extensions, defect)

Production
x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Unassigned)

References

Details

(Keywords: student-project, Whiteboard: bmo4.0-resolved)

It would be cool if bugzilla auto-linked "changeset foo" to hgweb.

So, "changeset 6059b09ca278" would auto-link to http://hg.mozilla.org/index.cgi/mozilla-central/rev/6059b09ca278 .

As a note, some people might say "changeset 15693:6059b09ca278".
'changeset 15693' by itself is meaningless, right?
Pretty much, yeah. Especially once a merge happens all of the non-hash numbers can change.
It would be nice to support the format that 'hg log' and 'hg outgoing' gives you, since people sometimes paste that into bugs:

changeset:   18654:44fa0cbc64ac

(Note the colon after 'changeset' and the extra spaces)
What about changesets not in mozilla-central (e.g. tracemonkey branch or gecko 1.9.1 branch)?  Is there a way to give hg.mozilla.org a changeset ID and have it figure out which branch(es) it exists on?
No
That's what stalled this bug, AFAIK, nobody could agree on a color (way) for saying "mozilla-central changeset foo".
The problem there is that Bugzilla would need a list of branch names?
Can we use a hg hook to collect the data that bugzilla needs?
I'm not sure this is worthwhile: people have been pasting changeset links (from hg.mozilla.org) into bugzilla and it has worked out pretty well... can we just keep using that system?
It would be a lot easier to link to a changeset if I could just type "changeset" and paste the id from my terminal window.  Currently, I have to combine it with a long URL prefix, or load http://hg.mozilla.org/mozilla-central/pushloghtml and copy the entire link.
bz hooked his 'hg log' to automatically give him a link to the hg.mozilla.org revision that he can copy/paste into bugs.
(In reply to comment #6)
> That's what stalled this bug, AFAIK, nobody could agree on a color (way) for
> saying "mozilla-central changeset foo".

Well this is silly. If anyone wants to get this done, please, with my blessing, pick whatever color you want.  Here are two ways it could possibly work.

1. I'm ok with "<repo-name> changeset foo", as in "mozilla-central changeset foo", where foo is 12 or more hex digits. It seems reasonable to default to mozilla-central if the repo-name isn't recognized.

2. Or "changeset foo" and "changeset:     12345:foo" could auto-link to http://hg.mozilla.org/findrev?q=foo and when the user clicks the link, hg.mozilla.org figures out which repository contains the changeset and sends an HTTP redirect.

Or whatever. I'm not saying this needs to be a high priority. It really doesn't. I just don't see any significant obstacles to hacking together something useful.
I just had a quick look at implementing jorendorff's idea 1). Idea 2) is really the one which works best, but it requires Hg server-side support.

This is what you've got on the bmo-4.0 branch:

my $hgrepos = join('|', qw!(releases/)?comm-[\w.]+ 
                           (releases/)?mozilla-[\w.]+
                           (releases/)?mobile-[\w.]+
                           tracemonkey
                           tamarin-[\w.]+
                           camino!);

Then the regexp is: /\b(($hgrepos)\s+changeset:?\s+(\d+:)?([0-9a-fA-F]{12}))\b/

and it goes to a URL of the form:

https://hg.mozilla.org/$repo/rev/$id

So you have to put repo names in in full (e.g. releases/comm-1.9.1). And there's no default repo (to avoid false matches when someone is talking about a random repo). And it only knows a few repo name forms. But hopefully it covers the common cases.

Gerv
Assignee: nobody → gerv
Status: NEW → ASSIGNED
Whiteboard: bmo4.0-resolved
This is in place now on production. Please reopen or file new bug if this is not working in anyway.

dkl
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Assignee: gerv → nobody
Component: Bugzilla: Other b.m.o Issues → Extensions
Product: mozilla.org → bugzilla.mozilla.org
QA Contact: general → extensions
Version: other → Current
Component: Extensions: Other → Extensions
You need to log in before you can comment on or make changes to this bug.