92 Commits

Author SHA1 Message Date
J. David Ibáñez
f11533a65a Revert "(issue #56) Remove TreeEntry.to_object"
This reverts commit 4cdb1a83b430fa27e2b0800ce17751631b036a78.
2012-03-11 22:40:37 +01:00
J. David Ibáñez
c6ebc98930 Revert "Commit.parents now returns a list of oids"
This reverts commit 1fb34e7b96000d29c4633b66fabc0699ac74ce15.
2012-02-28 13:02:37 +01:00
J. David Ibáñez
1fb34e7b96 Commit.parents now returns a list of oids
Instead of returning the commit objects.
2012-02-27 00:25:57 +01:00
J. David Ibáñez
4b0f759cc0 Tag.target now returns the oid (not the object) 2012-02-27 00:13:43 +01:00
J. David Ibáñez
e9e902e024 tests: add utility function 'oid_to_hex' 2012-02-27 00:12:33 +01:00
J. David Ibáñez
4cdb1a83b4 (issue #56) Remove TreeEntry.to_object
This is one way to enable implementing 'TreeBuilder.get'. It also makes
pygit2 a little lower-level. And makes TreeEntry consistent with IndexEntry,
which lacks such a function.
2012-02-26 19:41:17 +01:00
Amit Bakshi
b1cb51c9d1 Test for pygit2.discover_repository 2012-02-25 18:15:45 -08:00
Carlos Martín Nieto
cf380cea2a Add tests for TreeBuilder 2012-02-21 12:36:51 +01:00
J. David Ibáñez
9d8d2ace64 index: implement Index.read_tree 2012-01-02 23:11:30 +01:00
J. David Ibáñez
550c966111 Rename Index.create_tree to Index.write_tree
Like Git command "git write-tree"
2012-01-02 20:10:28 +01:00
J. David Ibáñez
35ed84cf44 Update to latest changes in libgit2
Now Repository.index also works on bare repositories. Unit tests pass
again.

And fix a memory leak (add a call to git_index_free).
2012-01-02 19:42:49 +01:00
J. David Ibáñez
4a33c7f806 refs: implement reference reload 2011-12-25 10:46:38 +01:00
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
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
3037d26c9d Fix unit tests with Python 3.2 2011-11-27 10:05:58 +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
9064b8e038 Introduce the Signature object 2011-11-23 23:48:41 +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
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
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
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
585ce44c21 tests: fix last test for Python 2 2011-08-19 21:38:48 +02:00
J. David Ibáñez
500a148398 tests: fix syntax error on octal literals for Py 3 2011-08-19 00:44:48 +02:00
J. David Ibáñez
5cc4ba23d4 tests: replace xrange by range
This fixes one test with Python 3.
2011-08-16 22:54:05 +02:00
J. David Ibáñez
7f6568038a Fix blob unit tests 2011-08-15 22:26:53 +02:00
J. David Ibáñez
7950ee1116 Use Python 3 string literals for the unit tests
Now unit tests are broken.
2011-08-13 22:48:23 +02:00
J. David Ibáñez
aaa3d533a8 Drop support for Python 2.5
It still compiles and probably works fine. But unit tests do not run and
official support for Python 2.5 has been dropped.
2011-08-13 22:05:43 +02:00
J. David Ibáñez
b634a19bd4 Update to latest changes in libgit2
Commit.message_short removed, Commit.message_encoding added
2011-08-13 20:36:37 +02:00
J. David Ibáñez
7b8ae0e10c Python 3, now pygit2 builds
Tests do not yet pass.
2011-08-10 22:52:42 +02:00
Petr Viktorin
bfd20dc4b4 Somewhat better test coverage
- create_repository
- IndexEntry.path
- Correct SHAs in Index iteration
- Opening a bare index & attempting to add to it
- Walker.reset
- Walker.push
- Walker.sort
2011-08-08 23:42:01 +02:00
Julien Miotte
561a01d5fc New test for Repository.status(). 2011-07-27 18:39:12 +02:00
Julien Miotte
d313af21a0 Adding a DirtyRepoTestCase to be able to test Repository.status().
Also, adding a dirty repository in the data directory.
2011-07-27 18:39:12 +02:00
J. David Ibáñez
dafe4b11b2 Fix coding style
- do not use tabs
- remove trailing white spaces
- lines are 79 chars max.
2011-07-20 15:05:17 +02:00
J. David Ibáñez
cd83372230 Merge remote branch 'byron/repo_write_improved' into repo_write 2011-07-18 22:45:46 +02:00
Sebastian Thiel
d0bc776121 Repository.write implemented
Implemented Repository write function, using odb write streams
Added simple test
2011-07-18 17:02:26 +02:00
J. David Ibáñez
a139335098 Fix memory leak in 'wrap_index_entry' (issue #18) 2011-07-14 22:01:40 +02:00