static int l_move (lua_State *L) { const char *src_path = luaL_checkstring (L, 1); const char *dest_path = luaL_checkstring (L, 2); const char *message = (lua_gettop (L) < 3 || lua_isnil (L, 3)) ? "" : luaL_checkstring (L, 3); apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); src_path = svn_path_canonicalize (src_path, pool); dest_path = svn_path_canonicalize (dest_path, pool); svn_commit_info_t *commit_info = NULL; if (svn_path_is_url (dest_path)) { make_log_msg_baton (&(ctx->log_msg_baton2), message, NULL, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; } err = svn_client_move4 (&commit_info, src_path, dest_path, FALSE, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }
static int l_commit (lua_State *L) { const char *path = (lua_gettop (L) < 1 || lua_isnil (L, 1)) ? "" : luaL_checkstring (L, 1); const char *message = (lua_gettop (L) < 2 || lua_isnil (L, 2)) ? "" : luaL_checkstring (L, 2); svn_boolean_t recursive = TRUE; svn_boolean_t keep_locks = FALSE; int itable = 3; if (lua_gettop (L) >= itable && lua_istable (L, itable)) { lua_getfield (L, itable, "recursive"); if (lua_isboolean (L, -1)) { recursive = lua_toboolean (L, -1); } lua_getfield (L, itable, "keep_locks"); if (lua_isboolean (L, -1)) { keep_locks = lua_toboolean (L, -1); } } apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); path = svn_path_canonicalize (path, pool); apr_array_header_t *array; svn_commit_info_t *commit_info = NULL; array = apr_array_make (pool, 1, sizeof (const char *)); (*((const char **) apr_array_push (array))) = path; make_log_msg_baton (&(ctx->log_msg_baton2), message, path, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; err = svn_client_commit3 (&commit_info, array, recursive, keep_locks, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }
static int l_import (lua_State *L) { const char *path = lua_isnil (L, 1) ? "" : luaL_checkstring (L, 1); const char *url = luaL_checkstring (L, 2); const char *message = (lua_gettop (L) < 3 || lua_isnil (L, 3)) ? "" : luaL_checkstring (L, 3); svn_boolean_t recursive = TRUE; svn_boolean_t no_ignore = FALSE; int itable = 4; if (lua_gettop (L) >= itable && lua_istable (L, itable)) { lua_getfield (L, itable, "recursive"); if (lua_isboolean (L, -1)) { recursive = lua_toboolean (L, -1); } lua_getfield (L, itable, "no_ignore"); if (lua_isboolean (L, -1)) { no_ignore = lua_toboolean (L, -1); } } apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); path = svn_path_canonicalize (path, pool); url = svn_path_canonicalize (url, pool); svn_commit_info_t *commit_info = NULL; make_log_msg_baton (&(ctx->log_msg_baton2), message, NULL, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; err = svn_client_import2 (&commit_info, path, url, !recursive, no_ignore, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }
static int l_delete (lua_State *L) { apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; apr_array_header_t *array; const char *path = luaL_checkstring (L, 1); const char *message = (lua_gettop (L) < 2 || lua_isnil (L, 2)) ? "" : luaL_checkstring (L, 2); int itable = 3; svn_boolean_t force = FALSE; svn_commit_info_t *commit_info = NULL; if (lua_gettop (L) >= itable && lua_istable (L, itable)) { lua_getfield (L, itable, "force"); if (lua_isboolean (L, -1)) { force = lua_toboolean (L, -1); } } init_function (&ctx, &pool, L); path = svn_path_canonicalize (path, pool); array = apr_array_make (pool, 1, sizeof (const char *)); (*((const char **) apr_array_push (array))) = path; lua_newtable (L); if (svn_path_is_url (path)) { make_log_msg_baton (&(ctx->log_msg_baton2), message, NULL, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; } err = svn_client_delete2 (&commit_info, array, force, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }
static int l_copy (lua_State *L) { const char *src_path = luaL_checkstring (L, 1); const char *dest_path = luaL_checkstring (L, 2); svn_opt_revision_t revision; if (lua_gettop (L) < 3 || lua_isnil (L, 3)) { revision.kind = svn_opt_revision_unspecified; } else { revision.kind = svn_opt_revision_number; revision.value.number = lua_tointeger (L, 3); } const char *message = (lua_gettop (L) < 4 || lua_isnil (L, 4)) ? "" : luaL_checkstring (L, 4); apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); src_path = svn_path_canonicalize (src_path, pool); dest_path = svn_path_canonicalize (dest_path, pool); svn_commit_info_t *commit_info = NULL; if (svn_path_is_url (dest_path)) { make_log_msg_baton (&(ctx->log_msg_baton2), message, NULL, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; } err = svn_client_copy3 (&commit_info, src_path, &revision, dest_path, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }
static int l_mkdir (lua_State *L) { const char *path = luaL_checkstring (L, 1); const char *message = (lua_gettop (L) < 2 || lua_isnil (L, 2)) ? "" : luaL_checkstring (L, 2); apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); path = svn_path_canonicalize (path, pool); svn_commit_info_t *commit_info = NULL; apr_array_header_t *array; array = apr_array_make (pool, 1, sizeof (const char *)); (*((const char **) apr_array_push (array))) = path; if (svn_path_is_url (path)) { make_log_msg_baton (&(ctx->log_msg_baton2), message, NULL, ctx->config, pool, L); ctx->log_msg_func2 = log_msg_func2; } err = svn_client_mkdir2 (&commit_info, array, ctx, pool); IF_ERROR_RETURN (err, pool, L); if (commit_info == NULL) { lua_pushnil (L); } else { lua_pushinteger (L, commit_info->revision); } svn_pool_destroy (pool); return 1; }