2
0

HACKING 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. All functionality should be available in pure Python. Optional C
  2. implementations may be written for performance reasons, but should never
  3. replace the Python implementation. The C implementations should follow the
  4. kernel/git coding style.
  5. Where possible include updates to NEWS along with your improvements.
  6. New functionality and bug fixes should be accompanied with matching unit tests.
  7. Coding style
  8. ------------
  9. Where possible, please follow PEP8 with regard to coding style.
  10. Furthermore, triple-quotes should always be """, single quotes are ' unless
  11. using " would result in less escaping within the string.
  12. Public methods, functions and classes should all have doc strings. Please use
  13. epydoc style docstrings to document parameters and return values.
  14. You can generate the documentation by running "make doc".
  15. Running the tests
  16. -----------------
  17. To run the testsuite, you should be able to simply run "make check". This
  18. will run the tests using unittest on Python 2.7 and higher, and using
  19. unittest2 (which you will need to have installed) on older versions of Python.
  20. $ make check
  21. String Types
  22. ------------
  23. Like Linux, Git treats filenames as arbitrary bytestrings. There is no prescribed
  24. encoding for these strings, and although it is fairly common to use UTF-8, anything
  25. can and is used as encoding with Git.
  26. For this reason, Dulwich internally treats git-based filenames as bytestrings. It is up
  27. to the Dulwich API user to encode and decode them if necessary.
  28. * git-repository related filenames: bytes
  29. * object sha1 digests (20 bytes long): bytes
  30. * object sha1 hexdigests (40 bytes long): str (bytestrings on python2, strings on python3)