Exemplo n.º 1
0
static PyObject *repos_create(PyObject *self, PyObject *args)
{
	const char *path;
	PyObject *config=Py_None, *fs_config=Py_None, *py_path;
	svn_repos_t *repos = NULL;
	apr_pool_t *pool;
	apr_hash_t *hash_config, *hash_fs_config;
	RepositoryObject *ret;

	if (!PyArg_ParseTuple(args, "O|OO:create", &py_path, &config, &fs_config))
		return NULL;

    pool = Pool(NULL);
	if (pool == NULL)
		return NULL;
    hash_config = config_hash_from_object(config, pool);
	if (hash_config == NULL) {
		apr_pool_destroy(pool);
		return NULL;
	}
	hash_fs_config = apr_hash_make(pool); /* TODO(jelmer): Allow config hash */
	if (hash_fs_config == NULL) {
		apr_pool_destroy(pool);
		PyErr_SetString(PyExc_RuntimeError, "Unable to create fs config hash");
		return NULL;
	}

	path = py_object_to_svn_dirent(py_path, pool);
	if (path == NULL) {
		apr_pool_destroy(pool);
		return NULL;
	}

	RUN_SVN_WITH_POOL(pool, svn_repos_create(&repos,
											 path, NULL, NULL,
											 hash_config, hash_fs_config, pool));

	ret = PyObject_New(RepositoryObject, &Repository_Type);
	if (ret == NULL)
		return NULL;

	ret->pool = pool;
	ret->repos = repos;

    return (PyObject *)ret;
}
Exemplo n.º 2
0
Arquivo: luasvn.c Projeto: ifzz/luasvn
static int
l_repos_create (lua_State *L) {
	apr_pool_t *pool;
	svn_error_t *err;
	svn_repos_t *repos_p;
	
	const char *path = luaL_checkstring (L, 1);

	if (init_pool (&pool) != 0) {
		return init_pool_error (L);
	}

	path = svn_path_canonicalize (path, pool);

	err = svn_repos_create (&repos_p, path, NULL, NULL, NULL, NULL, pool);
	IF_ERROR_RETURN (err, pool, L);

	return 0;
}