Example #1
0
void PyMultiTag::do_export() {

    PyEntityWithSources<base::IMultiTag>::do_export("MultiTag");

    class_<MultiTag, bases<base::EntityWithSources<base::IMultiTag>>>("MultiTag")

        .add_property("positions",
                      GETTER(DataArray, MultiTag, positions),
                      REF_SETTER(DataArray, MultiTag, positions),
                      doc::multi_tag_positions)
        .add_property("extents",
                      getExtents,
                      setExtents,
                      doc::multi_tag_extents)
        .add_property("units",
                      GETTER(std::vector<std::string>, MultiTag, units),
                      setUnits,
                      doc::multi_tag_units)

        // References
        .def("_add_reference_by_id", REF_SETTER(std::string, MultiTag, addReference))
        .def("_has_reference_by_id", CHECKER(std::string, MultiTag, hasReference))
        .def("_reference_count", &MultiTag::referenceCount)
        .def("_get_reference_by_id", &getReferenceById)
        .def("_get_reference_by_pos", &getReferenceByPos)
        .def("_delete_reference_by_id", REMOVER(std::string, MultiTag, removeReference))

        // Features
        .def("create_feature", &createNewFeature, doc::multi_tag_create_feature)
        .def("_has_feature_by_id", CHECKER(std::string, MultiTag, hasFeature))
        .def("_feature_count", &MultiTag::featureCount)
        .def("_get_feature_by_id", &getFeatureById)
        .def("_get_feature_by_pos", &getFeatureByPos)
        .def("_delete_feature_by_id", REMOVER(std::string, MultiTag, deleteFeature))

        // Other
        .def("__str__", &toStr<MultiTag>)
        .def("__repr__", &toStr<MultiTag>)
        ;

    to_python_converter<std::vector<MultiTag>, vector_transmogrify<MultiTag>>();
    to_python_converter<boost::optional<MultiTag>, option_transmogrify<MultiTag>>();
}
Example #2
0
void PyFeature::do_export() {

    PyEntity<base::IFeature>::do_export("Feature");

    enum_<LinkType>("LinkType")
        .value("Tagged",  LinkType::Tagged)
        .value("Untagged", LinkType::Untagged)
        .value("Indexed", LinkType::Indexed)
        ;

    class_<Feature, bases<base::Entity<base::IFeature>>>("Feature")
        .add_property("link_type",
                      GETTER(LinkType, Feature, linkType),
                      SETTER(LinkType, Feature, linkType))
        .add_property("data",
                      GETTER(DataArray, Feature, data),
                      REF_SETTER(DataArray, Feature, data))
        ;

    to_python_converter<std::vector<Feature>, vector_transmogrify<Feature>>();
    to_python_converter<boost::optional<Feature>, option_transmogrify<Feature>>();
}
Example #3
0
Signature_time__get__(Signature *self)
{
    return PyLong_FromLongLong(self->signature->when.time);
}


PyDoc_STRVAR(Signature_offset__doc__, "Offset from UTC in minutes.");

PyObject *
Signature_offset__get__(Signature *self)
{
    return PyLong_FromLong(self->signature->when.offset);
}

PyGetSetDef Signature_getseters[] = {
    GETTER(Signature, _encoding),
    GETTER(Signature, raw_name),
    GETTER(Signature, raw_email),
    GETTER(Signature, name),
    GETTER(Signature, email),
    GETTER(Signature, time),
    GETTER(Signature, offset),
    GETTER(Signature, _pointer),
    {NULL}
};


PyDoc_STRVAR(Signature__doc__, "Signature.");

PyTypeObject SignatureType = {
    PyVarObject_HEAD_INIT(NULL, 0)
Example #4
0
    return git_oid_to_py_str(git_tree_entry_id(self->entry));
}

PyObject *
TreeEntry_repr(TreeEntry *self)
{
    char str[GIT_OID_HEXSZ + 1] = { 0 };
    const char *typename;

    typename = git_object_type2string(git_tree_entry_type(self->entry));
    git_oid_fmt(str, git_tree_entry_id(self->entry));
    return PyString_FromFormat("pygit2.TreeEntry('%s', %s, %s)", git_tree_entry_name(self->entry), typename, str);
}

PyGetSetDef TreeEntry_getseters[] = {
    GETTER(TreeEntry, filemode),
    GETTER(TreeEntry, name),
    GETTER(TreeEntry, oid),
    GETTER(TreeEntry, id),
    GETTER(TreeEntry, hex),
    {NULL}
};

PyDoc_STRVAR(TreeEntry__doc__, "TreeEntry objects.");

PyTypeObject TreeEntryType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.TreeEntry",                       /* tp_name           */
    sizeof(TreeEntry),                         /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)TreeEntry_dealloc,             /* tp_dealloc        */
Example #5
0
    PyObject_Del(self);
}

PyMemberDef BlameHunk_members[] = {
    MEMBER(BlameHunk, lines_in_hunk, T_UINT, "Number of lines."),
    MEMBER(BlameHunk, final_commit_id, T_STRING, "Last changed oid."),
    MEMBER(BlameHunk, final_start_line_number, T_UINT, "final start line no."),
    MEMBER(BlameHunk, orig_commit_id, T_STRING, "oid where hunk was found."),
    MEMBER(BlameHunk, orig_path, T_STRING, "Origin path."),
    MEMBER(BlameHunk, orig_start_line_number, T_UINT, "Origin start line no."),
    MEMBER(BlameHunk, boundary, T_BOOL, "Tracked to a boundary commit."),
    {NULL}
};

PyGetSetDef BlameHunk_getseters[] = {
    GETTER(BlameHunk, final_committer),
    GETTER(BlameHunk, orig_committer),
    {NULL}
};

PyDoc_STRVAR(BlameHunk__doc__, "Blame Hunk object.");

PyTypeObject BlameHunkType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.BlameHunk",                       /* tp_name           */
    sizeof(BlameHunk),                         /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)BlameHunk_dealloc,             /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
Example #6
0
    py_name = to_unicode(c_name, NULL, NULL);
    free(c_name);

    return py_name;
}


PyMethodDef Branch_methods[] = {
    METHOD(Branch, delete, METH_NOARGS),
    METHOD(Branch, is_head, METH_NOARGS),
    METHOD(Branch, rename, METH_VARARGS),
    {NULL}
};

PyGetSetDef Branch_getseters[] = {
    GETTER(Branch, branch_name),
    GETTER(Branch, remote_name),
    GETSET(Branch, upstream),
    GETTER(Branch, upstream_name),
    {NULL}
};

PyDoc_STRVAR(Branch__doc__, "Branch.");

PyTypeObject BranchType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Branch",                          /* tp_name           */
    sizeof(Branch),                            /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    0,                                         /* tp_dealloc        */
    0,                                         /* tp_print          */
Example #7
0
File: tag.c Project: cboos/pygit2
    if (!message)
        Py_RETURN_NONE;
    return to_unicode(message, "utf-8", "strict");
}


PyDoc_STRVAR(Tag__message__doc__, "Tag message (bytes).");

PyObject *
Tag__message__get__(Tag *self)
{
    return PyString_FromString(git_tag_message(self->tag));
}

PyGetSetDef Tag_getseters[] = {
    GETTER(Tag, target),
    GETTER(Tag, name),
    GETTER(Tag, tagger),
    GETTER(Tag, message),
    GETTER(Tag, _message),
    {NULL}
};


PyDoc_STRVAR(Tag__doc__, "Tag objects.");

PyTypeObject TagType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Tag",                             /* tp_name           */
    sizeof(Tag),                               /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
Example #8
0
    {NULL}
};

PyDoc_STRVAR(Patch_is_binary__doc__, "True if binary data, False if not.");

PyObject *
Patch_is_binary__get__(Patch *self)
{
    if (!(self->flags & GIT_DIFF_FLAG_NOT_BINARY) &&
            (self->flags & GIT_DIFF_FLAG_BINARY))
        Py_RETURN_TRUE;
    Py_RETURN_FALSE;
}

PyGetSetDef Patch_getseters[] = {
    GETTER(Patch, is_binary),
    {NULL}
};

PyDoc_STRVAR(Patch__doc__, "Diff patch object.");

PyTypeObject PatchType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Patch",                           /* tp_name           */
    sizeof(Patch),                             /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)Patch_dealloc,                 /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
    0,                                         /* tp_compare        */
Example #9
0
    assert(oid);

    obj = Repository_read_raw(self->repo->repo, oid, GIT_OID_HEXSZ);
    if (obj == NULL)
        return NULL;

    aux = PyBytes_FromStringAndSize(
        git_odb_object_data(obj),
        git_odb_object_size(obj));

    git_odb_object_free(obj);
    return aux;
}

PyGetSetDef Object_getseters[] = {
    GETTER(Object, oid),
    GETTER(Object, hex),
    GETTER(Object, type),
    {NULL}
};

PyMethodDef Object_methods[] = {
    METHOD(Object, read_raw, METH_NOARGS),
    {NULL}
};


PyDoc_STRVAR(Object__doc__, "Base class for Git objects.");

PyTypeObject ObjectType = {
    PyVarObject_HEAD_INIT(NULL, 0)
Example #10
0
    return 0;
}

PyDoc_STRVAR(IndexEntry_hex__doc__, "Hex id.");

PyObject *
IndexEntry_hex__get__(IndexEntry *self)
{
    return git_oid_to_py_str(&self->entry.oid);
}

PyGetSetDef IndexEntry_getseters[] = {
    GETSET(IndexEntry, mode),
    GETSET(IndexEntry, path),
    GETSET(IndexEntry, oid),
    GETTER(IndexEntry, hex),
    {NULL},
};

PyDoc_STRVAR(IndexEntry__doc__, "Index entry.");

PyTypeObject IndexEntryType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.IndexEntry",                       /* tp_name           */
    sizeof(IndexEntry),                        /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)IndexEntry_dealloc,            /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
    0,                                         /* tp_compare        */
Example #11
0
    parent_count = git_commit_parentcount(self->commit);
    list = PyList_New(parent_count);
    if (!list)
        return NULL;

    for (i=0; i < parent_count; i++) {
        id = git_commit_parent_id(self->commit, i);
        PyList_SET_ITEM(list, i, git_oid_to_python(id));
    }

    return list;
}

PyGetSetDef Commit_getseters[] = {
    GETTER(Commit, message_encoding),
    GETTER(Commit, message),
    GETTER(Commit, raw_message),
    GETTER(Commit, commit_time),
    GETTER(Commit, commit_time_offset),
    GETTER(Commit, committer),
    GETTER(Commit, author),
    GETTER(Commit, tree),
    GETTER(Commit, tree_id),
    GETTER(Commit, parents),
    GETTER(Commit, parent_ids),
    {NULL}
};


PyDoc_STRVAR(Commit__doc__, "Commit objects.");
Example #12
0
static void
Worktree_dealloc(Worktree *self)
{
    Py_CLEAR(self->repo);
    git_worktree_free(self->worktree);
    PyObject_Del(self);
}


PyMethodDef Worktree_methods[] = {
    METHOD(Worktree, prune, METH_VARARGS),
    {NULL}
};

PyGetSetDef Worktree_getseters[] = {
    GETTER(Worktree, path),
    GETTER(Worktree, name),
    GETTER(Worktree, is_prunable),
    {NULL}
};

PyDoc_STRVAR(Worktree__doc__, "Worktree object.");

PyTypeObject WorktreeType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Worktree",                        /* tp_name           */
    sizeof(Worktree),                          /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)Worktree_dealloc,              /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
Example #13
0
File: blob.c Project: ipmcc/pygit2
PyObject *
Blob_is_binary__get__(Blob *self)
{
    if (git_blob_is_binary(self->blob))
        Py_RETURN_TRUE;
    Py_RETURN_FALSE;
}


PyDoc_STRVAR(Blob_data__doc__,
  "The contents of the blob, a bytes string. This is the same as\n"
  "Blob.read_raw()");

PyGetSetDef Blob_getseters[] = {
    GETTER(Blob, size),
    GETTER(Blob, is_binary),
    {"data", (getter)Object_read_raw, NULL, Blob_data__doc__, NULL},
    {NULL}
};

static int
Blob_getbuffer(Blob *self, Py_buffer *view, int flags)
{
    return PyBuffer_FillInfo(view, (PyObject *) self,
                             (void *) git_blob_rawcontent(self->blob),
                             git_blob_rawsize(self->blob), 1, flags);
}

#if PY_MAJOR_VERSION == 2
Example #14
0
Oid_raw__get__(Oid *self)
{
    return PyBytes_FromStringAndSize((const char*)self->oid.id, GIT_OID_RAWSZ);
}


PyDoc_STRVAR(Oid_hex__doc__, "Hex oid, a 40 chars long string (type str).");

PyObject *
Oid_hex__get__(Oid *self)
{
    return git_oid_to_py_str(&self->oid);
}

PyGetSetDef Oid_getseters[] = {
    GETTER(Oid, raw),
    GETTER(Oid, hex),
    {NULL},
};

PyDoc_STRVAR(Oid__doc__, "Object id.");

PyTypeObject OidType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Oid",                             /* tp_name           */
    sizeof(Oid),                               /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    0,                                         /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
Example #15
0
IndexEntry_oid__get__(IndexEntry *self)
{
    return git_oid_to_python(self->entry->oid.id);
}


PyDoc_STRVAR(IndexEntry_hex__doc__, "Hex id.");

PyObject *
IndexEntry_hex__get__(IndexEntry *self)
{
    return git_oid_to_py_str(&self->entry->oid);
}

PyGetSetDef IndexEntry_getseters[] = {
    GETTER(IndexEntry, mode),
    GETTER(IndexEntry, path),
    GETTER(IndexEntry, oid),
    GETTER(IndexEntry, hex),
    {NULL},
};

PyDoc_STRVAR(IndexEntry__doc__, "Index entry.");

PyTypeObject IndexEntryType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.IndexEntry",                       /* tp_name           */
    sizeof(IndexEntry),                        /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)IndexEntry_dealloc,            /* tp_dealloc        */
    0,                                         /* tp_print          */
Example #16
0
    METHOD(Repository, checkout_index, METH_VARARGS),
    METHOD(Repository, checkout_tree, METH_VARARGS),
    METHOD(Repository, notes, METH_VARARGS),
    METHOD(Repository, create_note, METH_VARARGS),
    METHOD(Repository, lookup_note, METH_VARARGS),
    METHOD(Repository, git_object_lookup_prefix, METH_O),
    METHOD(Repository, lookup_branch, METH_VARARGS),
    METHOD(Repository, listall_branches, METH_VARARGS),
    METHOD(Repository, create_branch, METH_VARARGS),
    METHOD(Repository, blame, METH_VARARGS | METH_KEYWORDS),
    METHOD(Repository, reset, METH_VARARGS),
    {NULL}
};

PyGetSetDef Repository_getseters[] = {
    GETTER(Repository, index),
    GETTER(Repository, path),
    GETSET(Repository, head),
    GETTER(Repository, head_is_detached),
    GETTER(Repository, head_is_unborn),
    GETTER(Repository, is_empty),
    GETTER(Repository, is_bare),
    GETTER(Repository, config),
    GETTER(Repository, workdir),
    GETTER(Repository, remotes),
    {NULL}
};


PyDoc_STRVAR(Repository__doc__,
  "Repository(path) -> Repository\n"
Example #17
0
    i = PyLong_AsUnsignedLong(value);

    return diff_get_patch_byindex(self->list, i);
}


static void
Diff_dealloc(Diff *self)
{
    git_diff_list_free(self->list);
    Py_CLEAR(self->repo);
    PyObject_Del(self);
}

PyGetSetDef Diff_getseters[] = {
    GETTER(Diff, patch),
    {NULL}
};

PyMappingMethods Diff_as_mapping = {
    0,                               /* mp_length */
    (binaryfunc)Diff_getitem,        /* mp_subscript */
    0,                               /* mp_ass_subscript */
};

static PyMethodDef Diff_methods[] = {
    METHOD(Diff, merge, METH_VARARGS),
    METHOD(Diff, find_similar, METH_VARARGS),
    {NULL}
};
Example #18
0
    PyObject_Del(self);
}


PyMethodDef Note_methods[] = {
    METHOD(Note, remove, METH_VARARGS),
    {NULL}
};

PyMemberDef Note_members[] = {
    MEMBER(Note, annotated_id, T_STRING, "id of the annotated object."),
    {NULL}
};

PyGetSetDef Note_getseters[] = {
    GETTER(Note, message),
    GETTER(Note, oid),
    {NULL}
};

PyDoc_STRVAR(Note__doc__, "Note object.");

PyTypeObject NoteType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Note",                            /* tp_name           */
    sizeof(Note),                              /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)Note_dealloc,                  /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
Example #19
0
    free(trans);

    return py_trans;
}

PyMethodDef Refspec_methods[] = {
    METHOD(Refspec, src_matches, METH_O),
    METHOD(Refspec, dst_matches, METH_O),
    METHOD(Refspec, transform, METH_O),
    METHOD(Refspec, rtransform, METH_O),
    {NULL}
};

PyGetSetDef Refspec_getseters[] = {
    GETTER(Refspec, direction),
    GETTER(Refspec, src),
    GETTER(Refspec, dst),
    GETTER(Refspec, string),
    GETTER(Refspec, force),
    {NULL}
};

static void
Refspec_dealloc(Refspec *self)
{
    Py_CLEAR(self->owner);
    PyObject_Del(self);
}

PyDoc_STRVAR(Refspec__doc__, "Refspec object.");
Example #20
0
    Py_CLEAR(self->oid_old);
    Py_CLEAR(self->oid_new);
    free(self->message);
    git_signature_free(self->signature);
    PyObject_Del(self);
}

PyMemberDef RefLogEntry_members[] = {
    MEMBER(RefLogEntry, oid_new, T_STRING, "New oid."),
    MEMBER(RefLogEntry, oid_old, T_STRING, "Old oid."),
    MEMBER(RefLogEntry, message, T_STRING, "Message."),
    {NULL}
};

PyGetSetDef RefLogEntry_getseters[] = {
    GETTER(RefLogEntry, committer),
    {NULL}
};


PyDoc_STRVAR(RefLogEntry__doc__, "Reference log object.");

PyTypeObject RefLogEntryType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.RefLogEntry",                     /* tp_name           */
    sizeof(RefLogEntry),                       /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)RefLogEntry_dealloc,           /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
Example #21
0

PyDoc_STRVAR(Blob_size__doc__, "Size.");

PyObject *
Blob_size__get__(Blob *self)
{
    return PyLong_FromLong(git_blob_rawsize(self->blob));
}


PyDoc_STRVAR(Blob_data__doc__,
  "Raw data. This is the same as Blob.read_raw()");

PyGetSetDef Blob_getseters[] = {
    GETTER(Blob, size),
    {"data", (getter)Object_read_raw, NULL, Blob_data__doc__, NULL},
    {NULL}
};


PyDoc_STRVAR(Blob__doc__, "Blob objects.");

PyTypeObject BlobType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.Blob",                            /* tp_name           */
    sizeof(Blob),                              /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    0,                                         /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
Example #22
0
PyDoc_STRVAR(MergeResult_fastforward_oid__doc__, "Fastforward Oid");

PyObject *
MergeResult_fastforward_oid__get__(MergeResult *self)
{
    if (git_merge_result_is_fastforward(self->result)) {
        git_oid fastforward_oid;
        git_merge_result_fastforward_oid(&fastforward_oid, self->result);
        return git_oid_to_python((const git_oid *)&fastforward_oid);
    }
    else Py_RETURN_NONE;
}

PyGetSetDef MergeResult_getseters[] = {
    GETTER(MergeResult, is_uptodate),
    GETTER(MergeResult, is_fastforward),
    GETTER(MergeResult, fastforward_oid),
    {NULL},
};

PyDoc_STRVAR(MergeResult__doc__, "MergeResult object.");

PyTypeObject MergeResultType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.MergeResult",                     /* tp_name           */
    sizeof(MergeResult),                       /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    0,                                         /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
Example #23
0
    METHOD(Repository, notes, METH_VARARGS),
    METHOD(Repository, create_note, METH_VARARGS),
    METHOD(Repository, lookup_note, METH_VARARGS),
    METHOD(Repository, git_object_lookup_prefix, METH_O),
    METHOD(Repository, lookup_branch, METH_VARARGS),
    METHOD(Repository, listall_branches, METH_VARARGS),
    METHOD(Repository, create_branch, METH_VARARGS),
    METHOD(Repository, reset, METH_VARARGS),
    METHOD(Repository, expand_id, METH_O),
    METHOD(Repository, _from_c, METH_VARARGS),
    METHOD(Repository, _disown, METH_NOARGS),
    {NULL}
};

PyGetSetDef Repository_getseters[] = {
    GETTER(Repository, path),
    GETTER(Repository, head),
    GETTER(Repository, head_is_detached),
    GETTER(Repository, head_is_unborn),
    GETTER(Repository, is_empty),
    GETTER(Repository, is_bare),
    GETSET(Repository, workdir),
    GETTER(Repository, default_signature),
    GETTER(Repository, _pointer),
    {NULL}
};


PyDoc_STRVAR(Repository__doc__,
  "Repository(path) -> Repository\n"
  "\n"
Example #24
0
        case Py_LE:
        case Py_GT:
        case Py_GE:
            Py_INCREF(Py_NotImplemented);
            return Py_NotImplemented;
        default:
            PyErr_Format(PyExc_RuntimeError, "Unexpected '%d' op", op);
            return NULL;
    }

    Py_INCREF(res);
    return res;
}

PyGetSetDef Object_getseters[] = {
    GETTER(Object, oid),
    GETTER(Object, id),
    GETTER(Object, hex),
    GETTER(Object, short_id),
    GETTER(Object, type),
    GETTER(Object, _pointer),
    {NULL}
};

PyMethodDef Object_methods[] = {
    METHOD(Object, read_raw, METH_NOARGS),
    METHOD(Object, peel, METH_O),
    {NULL}
};

Example #25
0
    free(self->oid_old);
    free(self->oid_new);
    free(self->message);
    git_signature_free(self->signature);
    PyObject_Del(self);
}

PyMemberDef RefLogEntry_members[] = {
    MEMBER(RefLogEntry, oid_new, T_STRING, "New oid."),
    MEMBER(RefLogEntry, oid_old, T_STRING, "Old oid."),
    MEMBER(RefLogEntry, message, T_STRING, "Message."),
    {NULL}
};

PyGetSetDef RefLogEntry_getseters[] = {
    GETTER(RefLogEntry, committer),
    {NULL}
};


PyDoc_STRVAR(RefLogEntry__doc__, "Reference log object.");

PyTypeObject RefLogEntryType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.RefLogEntry",                     /* tp_name           */
    sizeof(RefLogEntry),                       /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)RefLogEntry_dealloc,           /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
Example #26
0
    METHOD(DiffDelta, status_char, METH_NOARGS),
    {NULL}
};

PyMemberDef DiffDelta_members[] = {
    MEMBER(DiffDelta, status, T_UINT, "A GIT_DELTA_* constant."),
    MEMBER(DiffDelta, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
    MEMBER(DiffDelta, similarity, T_USHORT, "For renamed and copied."),
    MEMBER(DiffDelta, nfiles, T_USHORT, "Number of files in the delta."),
    MEMBER(DiffDelta, old_file, T_OBJECT, "\"from\" side of the diff."),
    MEMBER(DiffDelta, new_file, T_OBJECT, "\"to\" side of the diff."),
    {NULL}
};

PyGetSetDef DiffDelta_getseters[] = {
    GETTER(DiffDelta, is_binary),
    {NULL}
};

PyDoc_STRVAR(DiffDelta__doc__, "DiffDelta object.");

PyTypeObject DiffDeltaType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_pygit2.DiffDelta",                       /* tp_name           */
    sizeof(DiffDelta),                         /* tp_basicsize      */
    0,                                         /* tp_itemsize       */
    (destructor)DiffDelta_dealloc,             /* tp_dealloc        */
    0,                                         /* tp_print          */
    0,                                         /* tp_getattr        */
    0,                                         /* tp_setattr        */
    0,                                         /* tp_compare        */