Added Repository.create_blob_fromfile
This commit is contained in:
parent
6e06863722
commit
7e3b21ba55
@ -50,6 +50,7 @@ PyObject* Repository_get_workdir(Repository *self, void *closure);
|
|||||||
PyObject* Repository_get_config(Repository *self, void *closure);
|
PyObject* Repository_get_config(Repository *self, void *closure);
|
||||||
PyObject* Repository_walk(Repository *self, PyObject *args);
|
PyObject* Repository_walk(Repository *self, PyObject *args);
|
||||||
PyObject* Repository_create_blob(Repository *self, PyObject *args);
|
PyObject* Repository_create_blob(Repository *self, PyObject *args);
|
||||||
|
PyObject* Repository_create_blob_fromfile(Repository *self, PyObject *args);
|
||||||
PyObject* Repository_create_commit(Repository *self, PyObject *args);
|
PyObject* Repository_create_commit(Repository *self, PyObject *args);
|
||||||
PyObject* Repository_create_tag(Repository *self, PyObject *args);
|
PyObject* Repository_create_tag(Repository *self, PyObject *args);
|
||||||
PyObject* Repository_listall_references(Repository *self, PyObject *args);
|
PyObject* Repository_listall_references(Repository *self, PyObject *args);
|
||||||
|
@ -452,6 +452,24 @@ Repository_create_blob(Repository *self, PyObject *args)
|
|||||||
return git_oid_to_python(oid.id);
|
return git_oid_to_python(oid.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
Repository_create_blob_fromfile(Repository *self, PyObject *args)
|
||||||
|
{
|
||||||
|
git_oid oid;
|
||||||
|
const char* path;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "s", &path))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
err = git_blob_create_fromfile(&oid, self->repo, path);
|
||||||
|
|
||||||
|
if (err < 0)
|
||||||
|
return Error_set(err);
|
||||||
|
|
||||||
|
return git_oid_to_python(oid.id);
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Repository_create_commit(Repository *self, PyObject *args)
|
Repository_create_commit(Repository *self, PyObject *args)
|
||||||
{
|
{
|
||||||
@ -801,6 +819,9 @@ PyMethodDef Repository_methods[] = {
|
|||||||
{"create_blob", (PyCFunction)Repository_create_blob,
|
{"create_blob", (PyCFunction)Repository_create_blob,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"Create a new blob from memory"},
|
"Create a new blob from memory"},
|
||||||
|
{"create_blob_fromfile", (PyCFunction)Repository_create_blob_fromfile,
|
||||||
|
METH_VARARGS,
|
||||||
|
"Create a new blob from file"},
|
||||||
{"create_reference", (PyCFunction)Repository_create_reference,
|
{"create_reference", (PyCFunction)Repository_create_reference,
|
||||||
METH_VARARGS,
|
METH_VARARGS,
|
||||||
"Create a new reference \"name\" that points to the object given by its "
|
"Create a new reference \"name\" that points to the object given by its "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user