Libification update
From: Matthias Urlichs <hidden>
Date: 2016-06-15 22:42:11
I've merged my current library-ification effort with Junio's current HEAD. URL: http://netz.smurf.noris.de/git/git.git#libize There's a Python interface, written using Pyrex. You can now walk object trees natively, with Python:
quoted
quoted
import git e=git.env() db=e.objdb c=db.lookup("HEAD").parent[0] # "HEAD^" will work too t=c.tree t.entries[0].name
'.gitignore'
quoted
quoted
t["debian"].entries[0].name
'changelog'
quoted
quoted
t[".gitignore"].data[0:5]
'/git\n'
quoted
quoted
t[".gitignore"].data.readline()
'/git\n' # this will work tomorrow (I hope)
I have not implemented much beyond that; keeping the code in sync is
work, so doing more will have to wait until this gets merged.
I did play with SWIG a bit. It would have simplified interfacing
languages other than Python to git. Unfortunately, there were problems:
- refering to objects SWIG did not allocate itself is a nontrivial
exercise
- so is keeping the Python-visible namespace clean
(unless you're using C++ ... probably not something we'd want to subject
the git core to ...)
- SWIG's error reporting is *scary*.
In comparison, Pyrex mostly does the right thing.
If somebody wants to start working on a SWIG/perl/tcl/... interface
for the library, be my guest. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Ask the person next to you.