README 1.2 KB

123456789101112131415161718192021222324
  1. This is the dulwich project.
  2. It aims to give an interface to git repos that doesn't call out to git
  3. directly but instead uses pure Python.
  4. Open up a repo by passing it the path to the .git dir. You can then ask for
  5. HEAD with repo.head() or a ref with repo.ref(name). Both return the SHA id
  6. they currently point to. You can then grab this object with
  7. repo.get_object(sha).
  8. For the actual objects the ShaFile.from_file(filename) will return the object
  9. stored in the file whatever it is. To ensure you get the correct type then
  10. call {Blob,Tree,Commit}.from_file(filename). I will add repo methods to do
  11. this for you with file lookup soon.
  12. There is also support for creating blobs. Blob.from_string(string) will create
  13. a blob object from the string. You can then call blob.sha() to get the sha
  14. object for this blob, and hexdigest() on that will get its ID. There is
  15. currently no method that allows you to write it out though.
  16. The project is named after the part of London that Mr. and Mrs. Git live in
  17. in the particular Monty Python sketch. It is based on the Python-Git module
  18. that James Westby <jw+debian@jameswestby.net> released in 2007 and now
  19. maintained by Jelmer Vernooij and John Carr.