Discussion:
[chromium-discuss] chromium.googlesource.com feature request: link bug IDs to crbug
'Kayce Basques' via Chromium-discuss
2018-11-26 22:19:34 UTC
Permalink
Howdy,

Every 6 weeks, when Chromium branches, I collect topics for the "What's New
In DevTools" series by reviewing the commit log. I use this URL:

https://chromium.googlesource.com/chromium/src/+log/master/third_party/blink/renderer/devtools

After clicking a commit to view its details I see a view like this:

[image: Screen Shot 2018-11-26 at 2.12.56 PM.png]

https://chromium.googlesource.com/chromium/src/+/fde0e4e7498387fecebbccb1939a3ad3ece0d4ba

It'd be helpful to me if the bug ID linked to crbug.

I'm posting it here because I'm not sure where this request should go...
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
PhistucK
2018-11-29 17:59:54 UTC
Permalink
That view is a very generic tool - https://github.com/google/gitiles.

I think you will be better off creating an extension that transforms them
instead.

I created one once... it is very stupid, it did not work perfectly, but
mostly (public domain/MIT, enjoy) -
manifest.json -

{
"name": "Issue Autolinker For Gitiles",
"version": "0.0.0.1",
"manifest_version": 2,
"description": "Enhances Gitiles by autolinking bug numbers to the
Chromium issue tracker.",
"content_scripts":
[
{
"js": ["injector.js"],
"matches": ["*://chromium.googlesource.com/*"],
"run_at": "document_end"
}
]
}

injector.js -

let content = document.body.innerHTML;
const bugLines = content.match(/\sbug=[\d, ]+/ig),
links = content.match(/[^">=\/](https?:\/|crbug.com)\/[^\s"'\\<]+/g),
conversions = [];

if (bugLines)
{
for (let bugLine of bugLines)
{
let enhancedBugLine = bugLine;
let bugs = bugLine.match(/\b\d+\b/g);
for (let bug of bugs)
{
enhancedBugLine = enhancedBugLine.replace(bug, "<a
href=\"https://crbug.com/" + bug + "\">" + bug + "</a>");
}
conversions.push([bugLine, enhancedBugLine]);
}
}

if (links)
{
for (let link of links)
{
conversions.push([link, link.replace(/^([^>"=\/])(.+)$/g, "$1<a
href=\"$2\">$2</a>")]);
}
}

conversions.forEach(pair => {content = content.replace(pair[0], pair[1]);});
document.body.innerHTML = content;



Note - it is not as bad as it looks - Gitiles does not use a lot of
JavaScript/events/dynamism anyway, as far as I saw, so replacing using
innerHTML is not a hugely big deal.

☆*PhistucK*


On Tue, Nov 27, 2018 at 12:19 AM 'Kayce Basques' via Chromium-discuss <
Post by 'Kayce Basques' via Chromium-discuss
Howdy,
Every 6 weeks, when Chromium branches, I collect topics for the "What's
https://chromium.googlesource.com/chromium/src/+log/master/third_party/blink/renderer/devtools
[image: Screen Shot 2018-11-26 at 2.12.56 PM.png]
https://chromium.googlesource.com/chromium/src/+/fde0e4e7498387fecebbccb1939a3ad3ece0d4ba
It'd be helpful to me if the bug ID linked to crbug.
I'm posting it here because I'm not sure where this request should go...
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups
"Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Loading...