Komodin ( Git to Places )

Posted by tito on 2010-10-24 16:48 |
Tito Bouzout
Thu, 2011-08-04 15:03
  • : 6.0 - 7.*
  • : 6.0 - 7.*


Adds Git commands and icons overlay to "Komodo Edit" and enhance Git commands on "Komodo IDE".



Right click on "multiple/single" "files/folders" of the "places" sidebar to apply commands on selected files which maybe are from different repositories.

To apply commands to focused document use the toolbarbutton, or there is also a git submenu on document and tab context menu.


To execute a Git command this add-on creates temporal shell scripts. On my fedora installation these are under /tmp/kGit/kGit-[1-n].sh

The add-on runs the scripts asynchronously /bin/sh "/tmp/kGit/kGit-[1-n].sh".

The output is redirected to "/tmp/kGit/kGit-[1-n].diff" and "on command complete" the file is opened in a new komodo tab, which shows the output with pretty colors.

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007


Todo & know bugs:


All versions Changes:

Changes From Latest Version:

nathan | Wed, 2010-10-27 10:21

Very nice! I just had to tweak it a little to get it to work.

First off you only added Komodo Edit compatibility in the install.rdf, please add:

<!-- Komodo IDE -->

Also, having installed git with MacPorts I had to make a symbolic link of my git binary to /bin/git to get the git commands working in your extension.

sudo ln -s /usr/local/git/bin/git /bin/git

Works like a charm now :) Though I would much prefer if it used the command output window in the bottom drawer, I'm pretty sure the Komodo API gives you access to that.

tito | Wed, 2010-10-27 10:24

Hi nathan,

Thanks for letting me know.

Outputs needs some tweaking.. Komodo has lots of features.. I'm investigating solving very basic things first, maybe I can add some preferences to allow customization. :)


nathan | Wed, 2010-10-27 12:35

Glad to hear you plan to continue developing on this :) It could turn into something really nice.

For the record, I managed to get it to output to the Command Output window by replacing the contents of this.run with:

var output = aScriptPath.replace('.sh','.diff');
var command = "/bin/sh " + aScriptPath + '\ncat "'+output+'"';


tito | Wed, 2010-10-27 13:23

Thanks for sharing :)

That's an elegant implementation, I'll test it and look into soon.. maybe with some preferences, in some situations I prefer to admire the output in a new tab.


durzagott | Thu, 2010-11-25 07:00

Thank you for taking the time to write this plugin. I'm using it at the moment and so far it looks great.

I read through your ToDo list and I look forward to some of the features you plan to add (such as Branching, Tagging and Windows integration). Just out of curiosity, have you got any plans to show the status of a file in the Places panel (eg, green tick mark for unchanged file, etc)? [EDIT: Sorry, I just noticed that you have "overlay icons" on your todo list].

Either way, fantastic work. Thank you very much!

tito | Sat, 2010-11-27 06:58

Hi, There is intentions to apply icons to show state of files, but I'm not really sure how to apply these styles :/, my knowledge of python is 0

I developed this add-on because I were using Linux, now I'm with Windows again.. then probably I will add windows support soon.


aikar | Tue, 2011-03-01 08:47

Can you add Git GUI to the menu? (command: git gui) and Git Commit Viewer (command: gitk)

Id prefer If I could open these tools from the GIT Menu instead of using the toolbox.

tito | Wed, 2011-03-02 12:01

Please report any issue, regards.

aikar | Wed, 2011-03-02 20:29

thanks, both commands work good. now i can hide the toolbox :)

dlaflam | Fri, 2011-07-22 11:54

When running with Komodo 7 on OSX Lion, the menu seems to be missing when I right click on a file name in the Places panel. If I access the menu from the GIT icon in the top toolbar panel or by right clicking on the tab when that file is open in the editor, the various options don't work. Appears that this might be related to the OSX Lion update.

tito | Thu, 2011-08-04 15:08

I missed notification of this post.
Can you test new version released today?


dlaflam | Thu, 2011-08-04 21:06

Updated to the new version, tried un-installing, disabling and re-installing but is not working. If you right click on the file in the Places panel there is no git menu item in the menu list. If the file is open and you right click on the tab, the git menu item appears but selecting any of the git menu items don't work. The git icon appears in the top toolbar, clicking the icon expands the menu, however, the menu items don't work after making a selection.
Not completely sure if this is related but found this Info from the Komodo log file:

ERROR:xpcom:Unhandled exception calling 'int8 KGit_hookFunction();'
Traceback (most recent call last):
File "/Applications/Komodo IDE.app/Contents/MacOS/python/xpcom/server/policy.py", line 303, in _CallMethod_
return 0, func(*params)
File "/Applications/Komodo IDE.app/Contents/MacOS/extensions/tito@kgit/components/kGit.py", line 19, in KGit_hookFunction
treebox = tree.boxObject.QueryInterface(components.interfaces.nsITreeBoxObject)
AttributeError: 'NoneType' object has no attribute 'boxObject'

tito | Fri, 2011-08-05 08:36

Hi dlaflam,
Thanks for reporting, are you using alpha komodo right?

I'll take a look to recent changes and try to build a compatible version,


dlaflam | Fri, 2011-08-05 11:32

Hello and no worries at all. I am using the latest Komodo IDE, version 7.0.0-alpha3, build 64548, platform macosx-x86. Built on Tue Jun 21 21:35:55 2011. I know this is in the alpha stage so I understand if it's something that may need to wait until the official version is released.

dlaflam | Sun, 2012-04-01 13:38

Wanted to check to see if there might be a fix or ETA for the Komodo7 IDE production release?

nasarafe | Thu, 2012-03-15 08:24

Hello, I'm not sure why but I tried to install the extension on both Komodo IDE and Edit 7.0.1 but seems to me that all functions from the GIT menu do nothing for me.

NOTE: When I used the main GIT functions from Komodo IDE, it works fine but I would like to use Push to server feature.

Please help...


dlaflam | Thu, 2012-03-15 13:51

Unfortunately, this hasn't worked since it was updated for the Komodo Alpha releases. Not sure why but the Komodo application doesn't complain that the extension doesn't work.

I created a request card here, http://bugs.activestate.com/show_bug.cgi?id=92241 , to see if ActiveState might be able to integrate git commands as a full feature to Komodo.

nasarafe | Thu, 2012-03-15 17:23

Hi, thanks for updating me. I think ActiveState will not add GIT to Komodo Edit (at least for a while) since it is already in the Komodo IDE. Hopefully we will get some progress on this extension.

cn01 | Mon, 2012-04-23 14:55


I consider this a very useful extension for may users, so I had a look. The error

ERROR:xpcom:Unhandled exception calling 'int8 KGit_hookFunction();'
Traceback (most recent call last):
File "/Applications/Komodo IDE.app/Contents/MacOS/python/xpcom/server/policy.py", line 303, in _CallMethod_
return 0, func(*params)
File "/Applications/Komodo IDE.app/Contents/MacOS/extensions/tito@kgit/components/kGit.py", line 19, in KGit_hookFunction
treebox = tree.boxObject.QueryInterface(components.interfaces.nsITreeBoxObject)
AttributeError: 'NoneType' object has no attribute 'boxObject'

is related to the interface change to iframes whihc happened with version 7. The file kgit.py tries to get the tree from the "places-file-tree" element:

 def KGit_hookFunction(self):
        wm = components.classes["@mozilla.org/appshell/window-mediator;1"].getService(components.interfaces.nsIWindowMediator)
        win = wm.getMostRecentWindow("Komodo")
        tree = win.document.getElementById('places-files-tree') # <--- this fails
        treebox = tree.boxObject.QueryInterface(components.interfaces.nsITreeBoxObject)

However, the places file tree has been moved to an iframe now, and needs to be accessed via the content-window from it's parent (the widget "placesViewbox") as the DOM viewer reveals. For that a rather longish collection of interfaces seem to help. Once we have the content-window (cw here) the look up via getElementById works again:

def KGit_hookFunction(self):
                wm = components.classes["@mozilla.org/appshell/window-mediator;1"].getService(components.interfaces.nsIWindowMediator)
                win = wm.getMostRecentWindow("Komodo")
                # look for iframe parent
                myFrame = win.document.getElementById('placesViewbox')
                # get the parent's content window
                cw = myFrame.boxObject.QueryInterface(components.interfaces.nsIContainerBoxObject).docShell.QueryInterface(components.interfaces.nsIInterfaceRequestor).getInterface(components.interfaces.nsIDOMWindow)
                # now we can get our file tree
                tree = cw.document.getElementById('places-files-tree')
                treebox = tree.boxObject.QueryInterface(components.interfaces.nsITreeBoxObject)

Unfortunately, this isn't the only issue I found. Under Windows the move function (which tries to move the extension from the Users's profile directory to the program's extension directory) does not seem to work. This seems to be needed for the python part.

Then function which should return the document path also seem to fail for me. The overlays for the places menu(s) also don't work.

After encountering so many issues I gave up looking further into it, but I hope this helps the author to come up with a solution for us soon.