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

View File

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

View File

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