163 Commits

Author SHA1 Message Date
Bryan O'Sullivan
d35944cc7d Decode messages leniently if encoding is not known
This avoids throwing of a UnicodeDecodeError on some really old commits.

We also add undecoded attribute accessors, to get at the raw bytes.
2012-03-13 16:21:42 -07:00
J. David Ibáñez
a0810694ed Merge remote branch 'carlos/treebuilder' 2012-03-12 22:30:30 +01:00
J. David Ibáñez
a6a36ad803 Now TreeEntry points back to the repo
Instead of pointing back to the tree.
2012-03-11 22:50:55 +01:00
J. David Ibáñez
f11533a65a Revert "(issue #56) Remove TreeEntry.to_object"
This reverts commit 4cdb1a83b430fa27e2b0800ce17751631b036a78.
2012-03-11 22:40:37 +01:00
Carlos Martín Nieto
242f3c2ffa TreeBuilder: allow the source to be a Tree
If the user passes a tree, use it as the source for the
TreeBuilder. On the way, make sure we free the tree we looked up, and
fix a test to make sure the TreeBuilder starts empty.
2012-03-09 12:57:22 +01:00
Carlos Martín Nieto
3e73d3a2b8 Add remove() and clear() to TreeBuilder 2012-03-09 11:41:17 +01:00
Carlos Martín Nieto
eb522b0caa Make TreeBuilder grow out of the repository
A TreeBuilder is a lot more useful (and easy to use) when it belongs
to a repository.
2012-03-09 11:41:17 +01:00
J. David Ibáñez
8380c625c4 Check for error after call to py_str_to_c_str
Fixes segfaults in 'Repository.create_commit' and 'Signature(...)'
Error reported by Han-Wen Nienhuys in the mailing list.
2012-03-03 17:37:33 +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
8b84f90a81 (issue #56) Fix TreeBuilder deallocation
Also, add a comment to the TODO file about a memory management issue
found throught pygit2.
2012-02-26 19:57: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
7ad8f0a8f0 Add discover_repository.
pygit2.discover_repository(path, across_fs = False,
                           ceiling_paths = None)

Add support for git_discover_repository which
searches the given path for the git repository.
2012-02-25 17:33:59 -08:00
Carlos Martín Nieto
8b71a8045b Allow a 'source' arg to TreeBuilder() 2012-02-21 12:36:51 +01:00
Carlos Martín Nieto
2044699a53 Add TreeBuilder_write 2012-02-21 12:36:51 +01:00
Carlos Martín Nieto
5d327c7205 Add TreeBuilder_insert 2012-02-21 12:36:51 +01:00
Carlos Martín Nieto
d43577a464 Create the TreeBuilder type 2012-02-21 12:36:38 +01:00
J. David Ibáñez
b143c0ccde Fix compilation warnings 2012-02-19 09:20:58 +01:00
Yonggang Luo
5da739270a Arrange Tree and Index definition. 2012-02-18 17:10:08 +08:00
Yonggang Luo
5ece88300a Repository_create_tag return error when necessary. 2012-02-18 16:28:35 +08:00
J. David Ibáñez
3bf5b4c794 status: new method 'Repository.status_file'
Exposes libgit2 function 'git_status_file'.
2012-02-10 19:38:25 +01:00
Carlos Martín Nieto
bc7db4ba8a errors: don't segfault if the library didn't set an error
git_lasterror() can return NULL. Passing that to the error formatting
functions leads to a segmentation fault.

Add a wrapper with a generic "no more information" string for the
cases when the library didn't set one.
2012-02-03 18:33:48 +01:00
J. David Ibáñez
39bb5de7c5 Fixing compilation with MSVC (issue #53) 2012-01-25 19:04:16 +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
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 2011-11-28 23:33:16 +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
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