• Share this article:

Activate links to Eclipse bugzilla on git.eclipse.org

Friday, June 10, 2011 - 17:42 by Benjamin Cabé

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>");
}

The post Activate links to Eclipse bugzilla on git.eclipse.org appeared first on Benjamin Cabé.

Tags