Ejemplo n.º 1
0
Py_hash_t
Oid_hash(PyObject *oid)
{
    PyObject *py_oid = git_oid_to_py_str(&((Oid *)oid)->oid);
    Py_hash_t ret = PyObject_Hash(py_oid);
    Py_DECREF(py_oid);
    return ret;
}
Ejemplo n.º 2
0
Py_hash_t
Object_hash(Object *object)
{
    const git_oid *oid = git_object_id(object->obj);
    PyObject *py_oid = git_oid_to_py_str(oid);
    Py_hash_t ret = PyObject_Hash(py_oid);
    Py_DECREF(py_oid);
    return ret;
}
Ejemplo n.º 3
0
static int
Repository_build_as_iter(const git_oid *oid, void *accum)
{
    int err;
    PyObject *oid_str = git_oid_to_py_str(oid);

    err = PyList_Append((PyObject*)accum, oid_str);
    Py_DECREF(oid_str);
    return err;
}
Ejemplo n.º 4
0
PyObject *
Object_hex__get__(Object *self)
{
    const git_oid *oid;

    oid = git_object_id(self->obj);
    assert(oid);

    return git_oid_to_py_str(oid);
}
Ejemplo n.º 5
0
PyObject *
Reference_hex__get__(Reference *self)
{
    const git_oid *oid;

    CHECK_REFERENCE(self);

    /* Get the oid (only for "direct" references) */
    oid = git_reference_target(self->reference);
    if (oid == NULL) {
        PyErr_SetString(PyExc_ValueError,
                        "oid is only available if the reference is direct "
                        "(i.e. not symbolic)");
        return NULL;
    }

    /* Convert and return it */
    return git_oid_to_py_str(oid);
}
Ejemplo n.º 6
0
PyObject *
Reference_target__get__(Reference *self)
{
    const char * c_name;

    CHECK_REFERENCE(self);

    /* Get the target */
    if (GIT_REF_OID == git_reference_type(self->reference)) {
        return git_oid_to_py_str(git_reference_target(self->reference));
    } else {
        c_name = git_reference_symbolic_target(self->reference);
        if (c_name == NULL) {
            PyErr_SetString(PyExc_ValueError, "no target available");
            return NULL;
        }
    }

    /* Make a PyString and return it */
    return to_path(c_name);
}
Ejemplo n.º 7
0
PyObject *
TreeEntry_hex__get__(TreeEntry *self)
{
    return git_oid_to_py_str(git_tree_entry_id(self->entry));
}
Ejemplo n.º 8
0
PyObject *
IndexEntry_hex__get__(IndexEntry *self)
{
    return git_oid_to_py_str(&self->entry.oid);
}
Ejemplo n.º 9
0
Archivo: index.c Proyecto: guocb/pygit2
PyObject *
IndexEntry_get_hex(IndexEntry *self)
{
    return git_oid_to_py_str(&self->entry->oid);
}
Ejemplo n.º 10
0
PyObject *
Oid_hex__get__(Oid *self)
{
    return git_oid_to_py_str(&self->oid);
}
Ejemplo n.º 11
0
PyObject *
Oid__str__(Oid *self)
{
    return git_oid_to_py_str(&self->oid);
}