Categories
Eclipse

Activate links to Eclipse bugzilla on git.eclipse.org

If you are running Chrome, or Firefox with the GreaseMonkey plug-in, then you may want to install this very simple extension that will detect when an Eclipse bug is mentioned in a commit message displayed in the git.eclipse.org web frontend.

You will end up with clickable links for every “bug XXXXXX” encountered in a commit message.
Enjoy! 🙂

// ==UserScript==
// @name          git.eclipse.org bug reference detector
// @version       0.1.0
// @licence       EPL v1.0 - http://www.eclipse.org/legal/epl-v10.html
// @namespace     http://www.github.com/kartben
// @description   Make references to Eclipse bugs clickable in git.eclipse.org Web UI
// @include       http://git.eclipse.org/*
// ==/UserScript==

var nodes = document.evaluate(
    "//div[@class='commit-subject'] | //div[@class='commit-msg'] | //a",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
    
if (!nodes) return;

for (var i = 0; i < nodes.snapshotLength; i++) {
    node = nodes.snapshotItem(i);
    node.innerHTML = node.innerHTML.replace( /.*(bug ([0-9]+))/ig,
        " <a style=\"border: dotted 1px #DAA520; background: #FAFAD2; font-size: inherit;\" " +
        "    href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=$2\">$1</a>");
}

By Benjamin Cabé

Benjamin Cabé is a technology enthusiast with a passion for empowering developers to build innovative solutions. He has invented an award-winning open source and open hardware artificial nose that he likes to use as an educational platform for people interested in diving into the world of embedded development.
He is currently a Developer Advocate for the Zephyr Project at the Linux Foundation and lives near Toulouse, France, where he enjoys baking sourdough bread with the help of his artificial nose.

Leave a Reply

Your email address will not be published. Required fields are marked *