forked from GitHub/gf-core
update checkoutBranch
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user