192 Commits

Author SHA1 Message Date
J. David Ibáñez
73a4a3a649 refs: resolving a direct ref returns the same object
When resolving a direct reference the same Python object is returned,
with the refcount incremented by one. The reference is reloaded.
2011-12-24 17:04:24 +01:00
J. David Ibáñez
584a8b1473 refs: implement reference dealloc 2011-12-20 22:19:15 +01:00
J. David Ibáñez
5986688197 refs: fix segfault when using a deleted reference
Before this patch the code below produced a segfault:

  >>> reference.delete()
  >>> reference.name

Now an exception is raised.
2011-12-19 23:40:27 +01:00
J. David Ibáñez
01cb80b4c8 errors: pass through git_lasterror in several places
And clean up related code a little bit.
2011-12-06 23:36:20 +01:00
J. David Ibáñez
2dee35d1be Update to latest changes in libgit2 2011-12-04 23:38:15 +01:00
J. David Ibáñez
3073a7c3da Return bytes for paths (and encodings) on Python 2 v0.15.1 2011-11-28 23:33:16 +01:00
J. David Ibáñez
1a34bc3b60 Update .gitignore, add test/__pycache__
The __pycache__ folder is genarated by Python 3.2
2011-11-28 22:47:35 +01:00
J. David Ibáñez
3037d26c9d Fix unit tests with Python 3.2 2011-11-27 10:05:58 +01:00
J. David Ibáñez
ee9429217b Start using inline functions
Actually, the Py_LOCAL_INLINE macro only works with Python 3.2, we
should fix this.
2011-11-26 23:57:22 +01:00
J. David Ibáñez
dd33369fba signature: minor test addition 2011-11-26 13:21:40 +01:00
J. David Ibáñez
a50c886cbb signature: add bytes accessors for name/email
Now Signature.email returns unicode. The name and email are available as
byte strings through the Signature._name and Signature._email accessors
respectively. Signature._encoding returns the encoding used in the
signature.
2011-11-25 00:08:39 +01:00
J. David Ibáñez
eafcef38f6 Do not pretend Python 2.5 is supported 2011-11-24 22:26:29 +01:00
J. David Ibáñez
9064b8e038 Introduce the Signature object 2011-11-23 23:48:41 +01:00
J. David Ibáñez
63ab0f3b26 Minor coding style fixes 2011-11-23 23:13:19 +01:00
J. David Ibáñez
cb00e7a6b9 Break reference cycle with repositoy/index 2011-11-22 00:23:54 +01:00
J. David Ibáñez
46ab810636 Use PyObject_New/PyObject_Del 2011-11-20 12:43:28 +01:00
J. David Ibáñez
38f1884b29 tp_alloc already sets no memory error 2011-11-19 19:04:31 +01:00
J. David Ibáñez
fb1ca247f8 Commit.tree, check for no memory error 2011-11-19 17:43:52 +01:00
J. David Ibáñez
ce41de9417 Repository.create_commit, make encoding optional 2011-11-19 09:37:45 +01:00
J. David Ibáñez
1eb0c6a9f0 Fix memory leak in 'Repository.create_tag'
Free the signature.
2011-11-15 23:18:04 +01:00
J. David Ibáñez
3851f725f9 Fix memory leak in 'Repository.create_commit'
Free the signatures.
2011-11-15 00:45:20 +01:00
J. David Ibáñez
8d4c8415da Use file system encoding to decode/encode paths
Instead of UTF-8. This is done for better interoperability with Git.
2011-11-13 12:47:08 +01:00
J. David Ibáñez
4f5298d6b7 Repository.create_commit supports message encoding
Now the 'Repository.create_commit' method expects one more argument,
the message encoding. If 'None', it defaults to UTF-8.
2011-11-12 20:13:28 +01:00
J. David Ibáñez
9fadd57445 Fix typo in error string 2011-11-12 00:13:31 +01:00
J. David Ibáñez
81c0ed3281 Python 3: fix 'Error_set_py_obj' 2011-10-23 15:09:55 +02:00
Hugh Cole-Baker
160cf64abc Add support for using short hex string prefixes
Allows Repository_getitem, Repository_read(_raw), Repository_create_commit,
Repository_create_tag and Object_read_raw to use short hex strings to
lookup objects.
Also test getting objects from Repository using prefixes, looking up commit
trees and parents by hex prefix, and looking up tag targets by prefix.
Also stop raising TypeError if passing a too-short hex prefix to the
lookup functions, instead use ValueError.
2011-10-22 22:01:16 +01:00
J. David Ibáñez
73af642b8f tags: properly dealloc tags
There were two memory leaks: we were not closing the git_tag object,
and we were not decreasing the refcount on the repo.

This finishes fixing issue #20
2011-10-18 11:27:32 +02:00
J. David Ibáñez
af983b989a tests: fixing issue #20
There were two problems:

- Windows refuses to remove a file that is in use. Solution, close
  the repo before cleaning the temporary directory.

- Windows refuses to remove a read-only file. Solution, change mode
  to writable.
2011-10-17 20:44:54 +02:00
J. David Ibáñez
a91bc9fa19 Fix compilation on Windows 2011-10-14 18:43:19 +02:00
J. David Ibáñez
5e72746a7a Fix warning on Windows, don't use strnlen
strnlen is a GNU extension
2011-10-14 17:57:55 +02:00
J. David Ibáñez
1b14bf15bc Fix warnings 2011-10-14 17:00:41 +02:00
J. David Ibáñez
ab96646e91 py_str_to_git_oid now supports short prefixes
py_str_to_git_oid now returns the length of the oid on success.

We don't yet do anything useful with the length, but every call to
py_str_to_git_oid has been properly updated.

This is half the work needed to fix issue #50. The changes made to
py_str_to_git_oid are based on a patch by Hugh Cole-Baker.
2011-10-10 19:25:13 +02:00
J. David Ibáñez
1dde68691b Update setup file v0.15.0 2011-10-05 23:11:59 +02:00
J. David Ibáñez
5b52f8421b docs: talk about the repository first 2011-09-04 00:40:25 +02:00
J. David Ibáñez
f9b57d5eb9 py_str_to_git_oid: don't decrease refcount too early
Error handling still broken in py_str_to_git_oid, can be verified by
typing repo['toto']
2011-09-04 00:28:55 +02:00
J. David Ibáñez
7b3685aaea git_object_id cannot return NULL 2011-09-03 23:58:34 +02:00
J. David Ibáñez
d36ad6fd7a Working on the docs, talk more about objects 2011-09-03 16:35:50 +02:00
J. David Ibáñez
78deb5578d Update readme file 2011-09-03 01:13:18 +02:00
J. David Ibáñez
83642a6954 Rename '.sha' to '.hex' 2011-09-02 16:53:17 +02:00
J. David Ibáñez
9f2e61cd8f Add TreeEntry.oid, IndexEntry.oid, Reference.oid 2011-09-02 16:48:35 +02:00
J. David Ibáñez
11ff1842b7 Add Object.oid to get the raw object id 2011-09-02 16:12:05 +02:00
J. David Ibáñez
54dd6714f2 Methods to create objects return raw oid
Now methods that create new objects return the raw oid instead of the
hexadecimal form.
2011-09-02 15:43:44 +02:00
Josh Bleecher Snyder
0b23ea3fea Use realpath instead of abspath to properly handle symlinked temp dirs
Fixes issue #47
2011-08-31 15:51:42 -07:00
J. David Ibáñez
05058d8167 Commit messages with non-ascii chars now work
And so do author & committers names
2011-08-24 08:52:41 +02:00
J. David Ibáñez
f09a02a2ee Use UTF-8 encoding in all Python files 2011-08-24 07:42:05 +02:00
J. David Ibáñez
fd5aab4e56 tests: minor coding style fix, use 4 spaces indent 2011-08-24 07:32:21 +02:00
J. David Ibáñez
d863a8ea17 Remove broken test with Python 3
Now all tests pass with Python 3.
2011-08-24 07:30:09 +02:00
J. David Ibáñez
b84b79acd8 Fix running the tests with Python 3
Now "python3 setup.py test" works.
2011-08-24 00:07:20 +02:00
J. David Ibáñez
ae1d178d7a Fix most unit tests with Python 3 2011-08-21 00:54:57 +02:00
J. David Ibáñez
ef9a5f6e55 Merge branch 'python3' 2011-08-19 21:59:31 +02:00