docs: working on the repository chapter (continue)

This commit is contained in:
J. David Ibáñez 2013-01-28 22:39:19 +01:00
parent 93b8c633c3
commit 8cdb8c06be
2 changed files with 27 additions and 8 deletions

@ -339,6 +339,11 @@ Repository_read_raw(git_repository *repo, const git_oid *oid, size_t len)
return obj;
}
PyDoc_STRVAR(Repository_read__doc__,
"read(oid) -> type, data, size\n\n"
"Read raw object data from the repository.");
PyObject *
Repository_read(Repository *self, PyObject *py_hex)
{
@ -365,6 +370,13 @@ Repository_read(Repository *self, PyObject *py_hex)
return tuple;
}
PyDoc_STRVAR(Repository_write__doc__,
"write(type, data) -> oid\n\n"
"Write raw object data into the repository. First arg is the object "
"type, the second one a buffer with data. Return the object id (sha) "
"of the created object.");
PyObject *
Repository_write(Repository *self, PyObject *args)
{
@ -498,6 +510,11 @@ Repository_get_config(Repository *self, void *closure)
return self->config;
}
PyDoc_STRVAR(Repository_walk__doc__,
"walk(oid, sort_mode) -> iterator\n\n"
"Generator that traverses the history starting from the given commit.");
PyObject *
Repository_walk(Repository *self, PyObject *args)
{
@ -666,6 +683,11 @@ out:
return py_result;
}
PyDoc_STRVAR(Repository_create_tag__doc__,
"create_tag(name, oid, type, tagger, message) -> bytes\n\n"
"Create a new tag object, return its SHA.");
PyObject *
Repository_create_tag(Repository *self, PyObject *args)
{
@ -929,15 +951,12 @@ PyMethodDef Repository_methods[] = {
{"create_commit", (PyCFunction)Repository_create_commit, METH_VARARGS,
Repository_create_commit__doc__},
{"create_tag", (PyCFunction)Repository_create_tag, METH_VARARGS,
"Create a new tag object, return its SHA."},
Repository_create_tag__doc__},
{"walk", (PyCFunction)Repository_walk, METH_VARARGS,
"Generator that traverses the history starting from the given commit."},
{"read", (PyCFunction)Repository_read, METH_O,
"Read raw object data from the repository."},
Repository_walk__doc__},
{"read", (PyCFunction)Repository_read, METH_O, Repository_read__doc__},
{"write", (PyCFunction)Repository_write, METH_VARARGS,
"Write raw object data into the repository. First arg is the object\n"
"type, the second one a buffer with data. Return the object id (sha)\n"
"of the created object."},
Repository_write__doc__},
{"listall_references", (PyCFunction)Repository_listall_references,
METH_VARARGS,
"Return a list with all the references in the repository."},

@ -145,7 +145,7 @@ PyMethodDef Walker_methods[] = {
PyTypeObject WalkerType = {
PyVarObject_HEAD_INIT(NULL, 0)
"_pygit2.Walker", /* tp_name */
"_pygit2.Walker", /* tp_name */
sizeof(Walker), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Walker_dealloc, /* tp_dealloc */