Use PyDoc_STRVAR in tree.c
This commit is contained in:
@@ -47,20 +47,29 @@ TreeEntry_dealloc(TreeEntry *self)
|
|||||||
PyObject_Del(self);
|
PyObject_Del(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry_filemode__doc__, "Filemode.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
TreeEntry_get_filemode(TreeEntry *self)
|
TreeEntry_filemode__get__(TreeEntry *self)
|
||||||
{
|
{
|
||||||
return PyInt_FromLong(git_tree_entry_filemode(self->entry));
|
return PyInt_FromLong(git_tree_entry_filemode(self->entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry_name__doc__, "Name.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
TreeEntry_get_name(TreeEntry *self)
|
TreeEntry_name__get__(TreeEntry *self)
|
||||||
{
|
{
|
||||||
return to_path(git_tree_entry_name(self->entry));
|
return to_path(git_tree_entry_name(self->entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry_oid__doc__, "Object id.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
TreeEntry_get_oid(TreeEntry *self)
|
TreeEntry_oid__get__(TreeEntry *self)
|
||||||
{
|
{
|
||||||
const git_oid *oid;
|
const git_oid *oid;
|
||||||
|
|
||||||
@@ -68,12 +77,20 @@ TreeEntry_get_oid(TreeEntry *self)
|
|||||||
return git_oid_to_python(oid->id);
|
return git_oid_to_python(oid->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry_hex__doc__, "Hex oid.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
TreeEntry_get_hex(TreeEntry *self)
|
TreeEntry_hex__get__(TreeEntry *self)
|
||||||
{
|
{
|
||||||
return git_oid_to_py_str(git_tree_entry_id(self->entry));
|
return git_oid_to_py_str(git_tree_entry_id(self->entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry_to_object__doc__,
|
||||||
|
"to_object() -> Object\n\n"
|
||||||
|
"Look up the corresponding object in the repo.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
TreeEntry_to_object(TreeEntry *self)
|
TreeEntry_to_object(TreeEntry *self)
|
||||||
{
|
{
|
||||||
@@ -86,19 +103,21 @@ TreeEntry_to_object(TreeEntry *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyGetSetDef TreeEntry_getseters[] = {
|
PyGetSetDef TreeEntry_getseters[] = {
|
||||||
{"filemode", (getter)TreeEntry_get_filemode, NULL, "filemode", NULL},
|
GETTER(TreeEntry, filemode),
|
||||||
{"name", (getter)TreeEntry_get_name, NULL, "name", NULL},
|
GETTER(TreeEntry, name),
|
||||||
{"oid", (getter)TreeEntry_get_oid, NULL, "object id", NULL},
|
GETTER(TreeEntry, oid),
|
||||||
{"hex", (getter)TreeEntry_get_hex, NULL, "hex oid", NULL},
|
GETTER(TreeEntry, hex),
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMethodDef TreeEntry_methods[] = {
|
PyMethodDef TreeEntry_methods[] = {
|
||||||
{"to_object", (PyCFunction)TreeEntry_to_object, METH_NOARGS,
|
METHOD(TreeEntry, to_object, METH_NOARGS),
|
||||||
"Look up the corresponding object in the repo."},
|
{NULL}
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TreeEntry__doc__, "TreeEntry objects.");
|
||||||
|
|
||||||
PyTypeObject TreeEntryType = {
|
PyTypeObject TreeEntryType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"_pygit2.TreeEntry", /* tp_name */
|
"_pygit2.TreeEntry", /* tp_name */
|
||||||
@@ -120,7 +139,7 @@ PyTypeObject TreeEntryType = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"TreeEntry objects", /* tp_doc */
|
TreeEntry__doc__, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -266,8 +285,21 @@ Tree_getitem(Tree *self, PyObject *value)
|
|||||||
return wrap_tree_entry(entry, self);
|
return wrap_tree_entry(entry, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Tree_diff__doc__,
|
||||||
|
"diff([obj, flags]) -> Diff\n\n"
|
||||||
|
"Get changes between current tree instance with another tree, an index "
|
||||||
|
"or the working dir.\n"
|
||||||
|
"\n"
|
||||||
|
"Arguments:\n"
|
||||||
|
"\n"
|
||||||
|
"obj -- if not given compare diff against working dir. "
|
||||||
|
" Possible valid arguments are instances of Tree or Index.\n"
|
||||||
|
"\n"
|
||||||
|
"flags -- ");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Tree_diff_tree(Tree *self, PyObject *args)
|
Tree_diff(Tree *self, PyObject *args)
|
||||||
{
|
{
|
||||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_list *diff;
|
git_diff_list *diff;
|
||||||
@@ -335,17 +367,13 @@ PyMappingMethods Tree_as_mapping = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyMethodDef Tree_methods[] = {
|
PyMethodDef Tree_methods[] = {
|
||||||
{
|
METHOD(Tree, diff, METH_VARARGS),
|
||||||
"diff", (PyCFunction)Tree_diff_tree, METH_VARARGS,
|
|
||||||
"Get changes between current tree instance with another tree, an "
|
|
||||||
"index or the working dir.\n\n"
|
|
||||||
"@param obj : if not given compare diff against working dir. "
|
|
||||||
"Possible valid arguments are instances of Tree or Index.\n"
|
|
||||||
"@returns Diff instance"
|
|
||||||
},
|
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Tree__doc__, "Tree objects.");
|
||||||
|
|
||||||
PyTypeObject TreeType = {
|
PyTypeObject TreeType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"_pygit2.Tree", /* tp_name */
|
"_pygit2.Tree", /* tp_name */
|
||||||
@@ -367,7 +395,7 @@ PyTypeObject TreeType = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"Tree objects", /* tp_doc */
|
Tree__doc__, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
Reference in New Issue
Block a user