README 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. It is probably going to be implemented in pure python.
  4. Currently can read blobs, trees and commits from the files. It reads both
  5. legacy and new headers. However it is untested for anything but the simple
  6. case.
  7. Can also understand a little about the repository format.
  8. The testsuite uses the nosetests program from Turbogears, as I got annoyed
  9. trying to set up unittest.
  10. Open up a repo by passing it the path to the .git dir. You can then ask for
  11. HEAD with repo.head() or a ref with repo.ref(name). Both return the SHA id
  12. they currently point to. You can then grab this object with
  13. repo.get_object(sha).
  14. For the actual objects the ShaFile.from_file(filename) will return the object
  15. stored in the file whatever it is. To ensure you get the correct type then
  16. call {Blob,Tree,Commit}.from_file(filename). I will add repo methods to do
  17. this for you with file lookup soon.
  18. There is also support for creating blobs. Blob.from_string(string) will create
  19. a blob object from the string. You can then call blob.sha() to get the sha
  20. object for this blob, and hexdigest() on that will get its ID. There is
  21. currently no method that allows you to write it out though.
  22. Everything is currently done with assertions, where much of it should probably
  23. be exceptions. This was merely done for expediency. If you hit an assertion,
  24. it either means you have done something wrong, there is corruption, or
  25. you are trying an unsupported operation.
  26. If you have any comments or questions you can contact me at
  27. jw+debian@jameswestby.net
  28. James Westby