mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
update checkoutBranch
This commit is contained in:
@@ -1424,7 +1424,7 @@ static PyMethodDef PGF_methods[] = {
|
|||||||
{"exprProbability", (PyCFunction)PGF_exprProbability, METH_VARARGS,
|
{"exprProbability", (PyCFunction)PGF_exprProbability, METH_VARARGS,
|
||||||
"Returns the probability of an expression"
|
"Returns the probability of an expression"
|
||||||
},
|
},
|
||||||
{"checkoutBranch", (PyCFunction)PGF_checkoutBranch, METH_VARARGS,
|
{"checkoutBranch", (PyCFunction)PGF_checkoutBranch, METH_NOARGS,
|
||||||
"Checks out the latest branch of the repository"
|
"Checks out the latest branch of the repository"
|
||||||
},
|
},
|
||||||
{"newTransaction", (PyCFunction)PGF_newTransaction, METH_VARARGS,
|
{"newTransaction", (PyCFunction)PGF_newTransaction, METH_VARARGS,
|
||||||
|
|||||||
@@ -10,20 +10,12 @@
|
|||||||
PyObject *
|
PyObject *
|
||||||
PGF_checkoutBranch(PGFObject *self, PyObject *args)
|
PGF_checkoutBranch(PGFObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ""))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PgfExn err;
|
PgfExn err;
|
||||||
PgfRevision rev = pgf_checkout_revision(self->db, &err);
|
PgfRevision rev = pgf_checkout_revision(self->db, &err);
|
||||||
|
|
||||||
if (handleError(err) != PGF_EXN_NONE) {
|
if (handleError(err) != PGF_EXN_NONE) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (rev == 0) {
|
|
||||||
// is this possible?
|
|
||||||
PyErr_SetString(PyExc_KeyError, "unknown branch name");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgf_free_revision(self->db, self->revision);
|
pgf_free_revision(self->db, self->revision);
|
||||||
self->revision = rev;
|
self->revision = rev;
|
||||||
|
|||||||
Reference in New Issue
Block a user