Re: Git Library?
- From
David Aguilar <davvid@gmail.com>
- Date
- Apr 29, 2008, 06:58 UTC
- Message-ID
- <402731c90804282358i205334b8me56f4390456873b4@mail.gmail.com>
- In-Reply-To
- <5FCF765E-F3FF-438C-B4C1-FFB3262831A0@gmail.com>
On Mon, Apr 28, 2008 at 11:55 AM, Patrick Altman <paltman@gmail.com> wrote:
> I want to write a Mac OSX UI for git. >
git gui works on OSX. Aside from that, someone's already written one* :-)
http://repo.or.cz/ugit.git
http://ugit.sf.net/> Is there a documented/undocumented API for interacting with git in process? > Or would I be better off "shelling out" to the git command line?
Fork/exec.
If you grabbed the ugit modules you could say:
from ugit import git
revisions = git.rev_list(all=True).splitlines()
file = open('msg', 'w')
file.write("commit message." )
file.close()git.commit(F='msg', s=True)
etc, etc.
It's pretty much 90%+ of git wrapped in Python. If a libgit.so did appear one day it would be trivial to swap out the meta-functions in git.py and replace them with e.g. swig replacements. Until then, forking out works just fine.
stg also has Python wrapped around git so you could look there too.
-- David * - okay, I lied. It's PyQt4. But it does run on OSX and looks just like any other cocoa app.