Пример #1
0
static PyObject *py_editor_ctx_exit(PyObject *self, PyObject *args)
{
	EditorObject *editor = (EditorObject *)self;
	PyObject *exc_type, *exc_val, *exc_tb;

	if (!PyArg_ParseTuple(args, "OOO", &exc_type, &exc_val, &exc_tb))
		return NULL;

	if (editor->done) {
		PyErr_SetString(PyExc_RuntimeError, "Editor already closed/aborted");
		return NULL;
	}

	if (exc_type != Py_None) {
		RUN_SVN(editor->editor->abort_edit(editor->baton, editor->pool));
	} else {
		if (editor->active_child) {
			PyErr_SetString(PyExc_RuntimeError, "a child is still open");
			return NULL;
		}

		RUN_SVN(editor->editor->close_edit(editor->baton, editor->pool));
	}

	if (editor->done_cb != NULL)
		editor->done_cb(editor->done_baton);

	Py_RETURN_FALSE;
}
Пример #2
0
static PyObject *py_editor_close(PyObject *self)
{
	EditorObject *editor = (EditorObject *)self;

	if (editor->done) {
		PyErr_SetString(PyExc_RuntimeError, "Editor already closed/aborted");
		return NULL;
	}

	if (editor->active_child) {
		PyErr_SetString(PyExc_RuntimeError, "a child is still open");
		return NULL;
	}

	RUN_SVN(editor->editor->close_edit(editor->baton, editor->pool));

	editor->done = true;
	apr_pool_destroy(editor->pool);
	editor->pool = NULL;

	if (editor->done_cb != NULL)
		editor->done_cb(editor->done_baton);

	Py_RETURN_NONE;
}
Пример #3
0
static PyObject *py_editor_abort(PyObject *self)
{
	EditorObject *editor = (EditorObject *)self;

	if (editor->done) {
		PyErr_SetString(PyExc_RuntimeError, "Editor already closed/aborted");
		return NULL;
	}

	/* FIXME: Check for open active childs ? */

	RUN_SVN(editor->editor->abort_edit(editor->baton, editor->pool));

	editor->done = true;
	apr_pool_destroy(editor->pool);
	editor->pool = NULL;

	if (editor->done_cb != NULL)
		editor->done_cb(editor->done_baton);

	Py_RETURN_NONE;
}