Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and improve blame scripts #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ 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);
ko.statusBar.AddMessage("BLAME: " + lines[linenum], "editor", 10000, true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var linenum = scimoz.lineFromPosition(scimoz.currentPos);
var basename = ko.views.manager.currentView.koDoc.file.baseName;
var dirname = ko.views.manager.currentView.koDoc.file.dirName;

// Run the svn blame process.
// Run the git blame process.
var runSvc = Components.classes["@activestate.com/koRunService;1"].
createInstance(Components.interfaces.koIRunService);
var cmd = 'git blame ' + basename;
Expand All @@ -15,9 +15,15 @@ var retval = process.wait(-1);
if (retval == 0) {
var stdout = process.getStdout();
var lines = stdout.split("\n");
var re = new RegExp("[0-9a-f]* \\((.*? [12][09][0-9]{2}-[0-9]{2}-[0-9]{2}) ");
var re = new RegExp("([0-9a-f]*) \\((.*? [12][09][0-9]{2}-[0-9]{2}-[0-9]{2}) ");
var match = re.exec(lines[linenum]);
if (match) {
StatusBar_AddMessage("BLAME: " + match[1], "editor", 10000, true);
cmd = 'git log --format=%s -n 1 ' + match[1];
process = runSvc.RunAndNotify(cmd, dirname, '', '');
retval = process.wait(-1);
ko.statusBar.AddMessage("BLAME: " + match[2], "editor", 10000, true);
if (retval == 0) {
ko.statusBar.AddMessage( process.getStdout(), "editor", 10000, true);
}
}
}