added missing remote header file and fixed instance creation
This commit is contained in:
38
include/pygit2/remote.h
Normal file
38
include/pygit2/remote.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2013 The pygit2 contributors
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License, version 2,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* In addition to the permissions in the GNU General Public License,
|
||||||
|
* the authors give you unlimited permission to link the compiled
|
||||||
|
* version of this file into combinations with other programs,
|
||||||
|
* and to distribute those combinations without any restriction
|
||||||
|
* coming from the use of this file. (The General Public License
|
||||||
|
* restrictions do apply in other respects; for example, they cover
|
||||||
|
* modification of the file, and distribution when not linked into
|
||||||
|
* a combined executable.)
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDE_pygit2_remote_h
|
||||||
|
#define INCLUDE_pygit2_remote_h
|
||||||
|
|
||||||
|
#define PY_SSIZE_T_CLEAN
|
||||||
|
#include <Python.h>
|
||||||
|
#include <git2.h>
|
||||||
|
|
||||||
|
PyObject* Remote_init(Remote *self, PyObject *args, PyObject *kwds);
|
||||||
|
PyObject* Remote_fetch(Remote *self, PyObject *args);
|
||||||
|
|
||||||
|
#endif
|
@@ -31,12 +31,13 @@
|
|||||||
#include <pygit2/error.h>
|
#include <pygit2/error.h>
|
||||||
#include <pygit2/utils.h>
|
#include <pygit2/utils.h>
|
||||||
#include <pygit2/types.h>
|
#include <pygit2/types.h>
|
||||||
|
#include <pygit2/remote.h>
|
||||||
|
|
||||||
extern PyObject *GitError;
|
extern PyObject *GitError;
|
||||||
extern PyTypeObject RepositoryType;
|
extern PyTypeObject RepositoryType;
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Remote_call(Remote *self, PyObject *args, PyObject *kwds)
|
Remote_init(Remote *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
Repository* py_repo = NULL;
|
Repository* py_repo = NULL;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
@@ -239,7 +240,7 @@ PyTypeObject RemoteType = {
|
|||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
0, /* tp_hash */
|
0, /* tp_hash */
|
||||||
(ternaryfunc) Remote_call, /* tp_call */
|
0, /* tp_call */
|
||||||
0, /* tp_str */
|
0, /* tp_str */
|
||||||
0, /* tp_getattro */
|
0, /* tp_getattro */
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
@@ -260,7 +261,7 @@ PyTypeObject RemoteType = {
|
|||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
0, /* tp_init */
|
(initproc)Remote_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <pygit2/object.h>
|
#include <pygit2/object.h>
|
||||||
#include <pygit2/oid.h>
|
#include <pygit2/oid.h>
|
||||||
#include <pygit2/repository.h>
|
#include <pygit2/repository.h>
|
||||||
|
#include <pygit2/remote.h>
|
||||||
|
|
||||||
extern PyObject *GitError;
|
extern PyObject *GitError;
|
||||||
|
|
||||||
@@ -1049,20 +1050,23 @@ PyObject *
|
|||||||
Repository_remotes__get__(Repository *self)
|
Repository_remotes__get__(Repository *self)
|
||||||
{
|
{
|
||||||
git_strarray remotes;
|
git_strarray remotes;
|
||||||
PyObject* py_list = NULL, *py_tmp;
|
PyObject* py_list = NULL, *py_args = NULL;
|
||||||
|
Remote *py_remote;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
git_remote_list(&remotes, self->repo);
|
git_remote_list(&remotes, self->repo);
|
||||||
|
|
||||||
py_list = PyList_New(remotes.count);
|
py_list = PyList_New(remotes.count);
|
||||||
for (i=0; i < remotes.count; ++i) {
|
for (i=0; i < remotes.count; ++i) {
|
||||||
py_tmp = INSTANCIATE_CLASS(RemoteType, Py_BuildValue("Os", self, remotes.strings[i]));
|
py_remote = PyObject_New(Remote, &RemoteType);
|
||||||
PyList_SetItem(py_list, i, py_tmp);
|
py_args = Py_BuildValue("Os", self, remotes.strings[i]);
|
||||||
|
Remote_init(py_remote, py_args, NULL);
|
||||||
|
PyList_SetItem(py_list, i, (PyObject*) py_remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
git_strarray_free(&remotes);
|
git_strarray_free(&remotes);
|
||||||
|
|
||||||
return py_list;
|
return (PyObject*) py_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user