1
0
forked from GitHub/gf-core

update checkoutBranch

This commit is contained in:
Krasimir Angelov
2023-08-26 07:58:12 +02:00
parent d1e9454dfa
commit e0c820be17
2 changed files with 1 additions and 9 deletions

View File

@@ -1424,7 +1424,7 @@ static PyMethodDef PGF_methods[] = {
{"exprProbability", (PyCFunction)PGF_exprProbability, METH_VARARGS,
"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"
},
{"newTransaction", (PyCFunction)PGF_newTransaction, METH_VARARGS,

View File

@@ -10,20 +10,12 @@
PyObject *
PGF_checkoutBranch(PGFObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
PgfExn err;
PgfRevision rev = pgf_checkout_revision(self->db, &err);
if (handleError(err) != PGF_EXN_NONE) {
return NULL;
}
if (rev == 0) {
// is this possible?
PyErr_SetString(PyExc_KeyError, "unknown branch name");
return NULL;
}
pgf_free_revision(self->db, self->revision);
self->revision = rev;