Welcome, guest | Sign In | My Account | Store | Cart

A Komodo JavaScript macro that can show the SCC repository information for who last changed the current line in the Komodo editor - see the screenshot below.

svn blame image

JavaScript, 18 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// Get the editor, current line and path details.
var scimoz = ko.views.manager.currentView.scimoz;
var linenum = scimoz.lineFromPosition(scimoz.currentPos);
var path = ko.views.manager.currentView.koDoc.displayPath;

// Run the svn blame process.
var runSvc = Components.classes["@activestate.com/koRunService;1"].
                createInstance(Components.interfaces.koIRunService);
var cmd = 'svn blame ' + path;
var process = runSvc.RunAndNotify(cmd, '', '', '');

// Wait till the process is done (synchronously).
var retval = process.wait(-1);
if (retval == 0) {
    var stdout = process.getStdout();
    var lines = stdout.split("\n");
    StatusBar_AddMessage("BLAME: " + lines[linenum], "editor", 10000, true);
}

Note: This macro was based upon Sean Coates Komodo svn blame macro here: http://community.activestate.com/forum/korunrunencodedcommand#comment-7044

1 comment

Álvaro G. Vicario 11 years, 1 month ago  # | flag

For Komodo 8, replace this:

var path = ko.views.manager.currentView.document.displayPath;

... with this:

var path = ko.views.manager.currentView.koDoc.displayPath;

You'll also need to quote file names if they contain spaces. I don't know what's the proper way to escape file names in a cross-platform environment but this works for Windows:

var cmd = 'svn blame "' + path + '"';