#include "svn_client.h"
#include "svn_cmdline.h"
#include "svn_pools.h"
#include "svn_config.h"
#include "svn_fs.h"
#include "svn_wc.h"
#include "svn_types.h"
/* Display a prompt and read a one-line response into the provided buffer,
removing a trailing newline if present. */
static svn_error_t *
prompt_and_read_line(const char *prompt,
char *buffer,
size_t max)
{
int len;
printf("%s: ", prompt);
if (fgets(buffer, max, stdin) == NULL)
return svn_error_create(0, NULL, "error reading stdin");
len = strlen(buffer);
if (len > 0 && buffer[len-1] == '\n')
buffer[len-1] = 0;
return SVN_NO_ERROR;
}
/* A tiny callback function of type 'svn_auth_simple_prompt_func_t'. For
a much better example, see svn_cl__auth_simple_prompt in the official
svn cmdline client. */
static svn_error_t *
my_simple_prompt_callback (svn_auth_cred_simple_t **cred,
void *baton,
const char *realm,
const char *username,
svn_boolean_t may_save,
apr_pool_t *pool)
{
svn_auth_cred_simple_t *ret = apr_pcalloc (pool, sizeof (*ret));
char answerbuf[100];
char my_usename[100] = "zhang";
char my_password[100] = "zhang";
if (realm)
{
printf ("Authentication realm: %s\n", realm);
}
#if 1
if (username)
ret->username = apr_pstrdup (pool, username);
else
{
SVN_ERR (prompt_and_read_line("Username", answerbuf, sizeof(answerbuf)));
ret->username = apr_pstrdup (pool, answerbuf);
}
#else
//ret->username = apr_pstrdup (pool, my_usename);
SVN_ERR (prompt_and_read_line("Username", answerbuf, sizeof(answerbuf)));
ret->username = apr_pstrdup (pool, answerbuf);
#endif
//Debug-DL
#if 0
SVN_ERR (prompt_and_read_line("Password", answerbuf, sizeof(answerbuf)));
ret->password = apr_pstrdup (pool, answerbuf);
#else
ret->password = apr_pstrdup (pool, my_password);
#endif
*cred = ret;
return SVN_NO_ERROR;
}
/* A tiny callback function of type 'svn_auth_username_prompt_func_t'. For
a much better example, see svn_cl__auth_username_prompt in the official
svn cmdline client. */
static svn_error_t *
my_username_prompt_callback (svn_auth_cred_username_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool)
{
svn_auth_cred_username_t *ret = apr_pcalloc (pool, sizeof (*ret));
char answerbuf[100];
if (realm)
{
printf ("Authentication realm: %s\n", realm);
}
SVN_ERR (prompt_and_read_line("Username", answerbuf, sizeof(answerbuf)));
ret->username = apr_pstrdup (pool, answerbuf);
*cred = ret;
return SVN_NO_ERROR;
}
svn_error_t * svn_get_node_status (const char *s_path,long int *s_version,int *s_node_kind,int *s_node_status,svn_client_ctx_t *ctx,apr_pool_t *pool)
{
svn_wc_status3_t *mystatus;
enum svn_wc_status_kind my_wc_status_kind;//
mystatus = apr_palloc(pool, sizeof(*mystatus));
SVN_ERR(svn_wc_status3(&mystatus, ctx->wc_ctx, s_path, pool,
pool));
*s_node_status = mystatus->node_status;
*s_version = mystatus->revision;
*s_node_kind = mystatus->kind;
//my_wc_status_kind = mystatus->node_status;
return SVN_NO_ERROR;
}
svn_error_t *
my_log_msg_receiver_func (const char **log_msg,
const char **tmp_file,
apr_array_header_t *commit_items,
void *baton,
apr_pool_t *pool)
{
//baton = "for test copy log_msg";
*tmp_file = NULL;
*log_msg = baton;
return SVN_NO_ERROR;
}
void my_commit (const char *loadpath,
svn_depth_t depth,
const char *log_entry,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
svn_error_t *err;
apr_array_header_t *targets;
apr_pool_t *iterpool;
ctx->log_msg_func = my_log_msg_receiver_func;
ctx->log_msg_baton = (void *) log_entry;
iterpool = svn_pool_create(pool);
targets = apr_array_make(pool, 1, sizeof(const char*));
APR_ARRAY_PUSH(targets, const char*) = loadpath;//loadpath;
svn_pool_clear(iterpool);
err = svn_client_commit5(targets, depth, FALSE, FALSE, TRUE,
NULL, NULL, NULL, NULL, ctx, iterpool);
}
int
main (int argc, const char **argv)
{
apr_pool_t *pool;
svn_error_t *err;
svn_opt_revision_t revision;
apr_hash_t *dirents;
apr_hash_index_t *hi;
svn_client_ctx_t *ctx;
const char *URL1;
const char *URL2;
const char *URL_https;
svn_opt_revision_t peg_rev;
//Debug-DL
const char *loadpath1;
const char *loadpath2;
const char *loadpath_https;
const char *delpath;
const char *delpath2;
svn_revnum_t *update_result_rev;
long int a;
int my_commandnum;
int my_subcommandnum;
long loc_version = 0;
int loc_status = 0;
int loc_kind = 0;
char my_answerbuf[100];
char my_answerbuf2[100];
char my_commandbuf[100];
apr_array_header_t *targets;
svn_commit_info_t *commit_info;
svn_client_commit_info_t client_commit_info = { 0 };
svn_client_commit_info_t *client_commit_info_p = &client_commit_info;
apr_pool_t *iterpool;
apr_status_t rv;
apr_file_t *outfile = NULL;
apr_file_t *errfile = NULL;
svn_opt_revision_t src_rvs = { 0 };
svn_opt_revision_t rev1 = { 0 }, rev2 = { 0 };
svn_wc_status3_t *mystatus;
//svn_wc_status_kind my_wc_status;
enum svn_wc_status_kind my_wc_status_kind;
//定义结束
loadpath1 = "D:\\SVN\\DaleyTest1"; // "D:/SVN/DaleyTest1";
loadpath2 = "D:\\SVN\\LocDown\\LocTest";
delpath = "D:\\SVN\\DaleyTest1\\Add-Commit-Test";
delpath2 = "D:/SVN/DaleyTest1/Add-Commit-Test2/Add-Test2-004.txt";//"D:\\SVN\\DaleyTest1\\Add-Commit-Test2";
loadpath_https = "D:\\SVN\\DaleyTestHttps";
a = 36;
update_result_rev = &a;
#if 0
if (argc <= 1)
{
printf ("Usage: %s URL\n", argv[0]);
return EXIT_FAILURE;
}
else
URL = argv[1];
#else
URL1 = "http://192.0.0.193/pm/trunk/test/others/t";
URL2 = "file:///D:/SVN/rpstr";//"file:///D:/SVN/LocRepository";
URL_https = "https://github.com/";
#endif
//debug-dl
printf ("svn client interface test \n");
/* Initialize the app. Send all error messages to 'stderr'. */
if (svn_cmdline_init ("minimal_client", stderr) != EXIT_SUCCESS)
return EXIT_FAILURE;
/* Create top-level memory pool. Be sure to read the HACKING file to
understand how to properly use/free subpools. */
pool = svn_pool_create (NULL);
/* Initialize the FS library. */
err = svn_fs_initialize (pool);
if (err)
{
/* For functions deeper in the stack, we usually use the
SVN_ERR() exception-throwing macro (see svn_error.h). At the
top level, we catch & print the error with svn_handle_error2(). */
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
/* Make sure the ~/.subversion run-time config files exist */
err = svn_config_ensure (NULL, pool);
if (err)
{
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
/* All clients need to fill out a client_ctx object. */
{
/* Initialize and allocate the client_ctx object. */
if ((err = svn_client_create_context (&ctx, pool)))
{
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
/* Load the run-time config file into a hash */
if ((err = svn_config_get_config (&(ctx->config), NULL, pool)))
{
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
#ifdef WIN32
/* Set the working copy administrative directory name. */
if (getenv ("SVN_ASP_DOT_NET_HACK"))
{
err = svn_wc_set_adm_dir ("_svn", pool);
if (err)
{
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
}
#endif
/* Depending on what your client does, you'll want to read about
(and implement) the various callback function types below. */
/* A func (& context) which receives event signals during
checkouts, updates, commits, etc. */
/* ctx->notify_func = my_notification_func;
ctx->notify_baton = NULL; */
/* A func (& context) which can receive log messages */
//ctx->log_msg_func = my_log_msg_receiver_func;
// ctx->log_msg_baton = NULL;
/* A func (& context) which checks whether the user cancelled */
/* ctx->cancel_func = my_cancel_checking_func;
ctx->cancel_baton = NULL; */
/* Make the client_ctx capable of authenticating users */
{
/* There are many different kinds of authentication back-end
"providers". See svn_auth.h for a full overview.
If you want to get the auth behavior of the 'svn' program,
you can use svn_cmdline_setup_auth_baton, which will give
you the exact set of auth providers it uses. This program
doesn't use it because it's only appropriate for a command
line program, and this is supposed to be a general purpose
example. */
svn_auth_provider_object_t *provider;
apr_array_header_t *providers
= apr_array_make (pool, 4, sizeof (svn_auth_provider_object_t *));
svn_auth_get_simple_prompt_provider (&provider,
my_simple_prompt_callback,
NULL, /* baton */
2, /* retry limit */ pool);
APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider;
svn_auth_get_username_prompt_provider (&provider,
my_username_prompt_callback,
NULL, /* baton */
2, /* retry limit */ pool);
APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider;
/* Register the auth-providers into the context's auth_baton. */
svn_auth_open (&ctx->auth_baton, providers, pool);
}
} /* end of client_ctx setup */
/* Now do the real work. */
/* Set revision to always be the HEAD revision. It could, however,
be set to a specific revision number, date, or other values. */
revision.kind = svn_opt_revision_head;
/* Main call into libsvn_client does all the work. */
//SVN_ERR (prompt_and_read_line("input URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf, sizeof(my_answerbuf)));
//err = svn_client_ls (&dirents,
// my_answerbuf, &revision,
// TRUE, /* no recursion */
// ctx, pool);
err = svn_client_ls (&dirents,
URL1, &revision,
TRUE, /* no recursion */
ctx, pool);
if (err)
{
svn_handle_error2 (err, stderr, FALSE, "minimal_client: ");
return EXIT_FAILURE;
}
/* Print the dir entries in the hash. */
for (hi = apr_hash_first (pool, dirents); hi; hi = apr_hash_next (hi))
{
const char *entryname;
svn_dirent_t *val;
apr_hash_this (hi, (void *) &entryname, NULL, (void *) &val);
//printf ("---------------------------------%s\n", entryname);
if (val->kind == svn_node_dir)
{
printf (" svn_node_kind_t::svn_node_dir %s\n", entryname);
}
else if (val->kind == svn_node_file)
{
printf (" svn_node_kind_t::svn_node_file %s\n", entryname);
}
/* 'val' is actually an svn_dirent_t structure; a more complex
program would mine it for extra printable information. */
}
//debug-dl test status
//mystatus = apr_palloc(pool, sizeof(*mystatus));
//SVN_ERR(svn_wc_status3(&mystatus, ctx->wc_ctx, delpath2, pool,
// pool));
//my_wc_status_kind = mystatus->node_status;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//功能测试
while (1)
{
SVN_ERR (prompt_and_read_line("Please input the command num:(0.status;1.checkout;2.update;3.add;4.delete;5.commit;6.revert;7.resolve;8.copy;9.move)", my_commandbuf, sizeof(my_commandbuf)));
my_commandnum = atoi(my_commandbuf);
switch (my_commandnum)
{
case 0:
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do get_status...\n");
svn_get_node_status(my_answerbuf2,&loc_version,&loc_kind,&loc_status,ctx,pool);
printf (" kind:0.svn_node_none, 1.svn_node_file, 2.svn_node_dir, 3.svn_node_unknown, 4.svn_node_symlink\n");
printf (" status:1=svn_wc_status_none,2=svn_wc_status_unversioned,3=svn_wc_status_normal,\n");
printf (" 4=svn_wc_status_added,5=svn_wc_status_missing,6=svn_wc_status_deleted,\n");
printf (" 7=svn_wc_status_replaced,8=svn_wc_status_modified,9=svn_wc_status_merged,\n");
printf (" 10=svn_wc_status_conflicted,11=svn_wc_status_ignored,12=svn_wc_status_obstructed,\n");
printf (" 13=svn_wc_status_external,14=svn_wc_status_incomplete\n\n");
printf ("kind:%d, status:%d, version:%d,\n",loc_kind,loc_status,loc_version);
break;
case 1:
SVN_ERR (prompt_and_read_line("input URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf, sizeof(my_answerbuf)));
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do checkout...\n");
err = svn_client_checkout(NULL,//lRev,//svn_revnum_t *result_rev,
my_answerbuf,//URL1,//const char *URL,
my_answerbuf2,//loadpath1,//const char *path,
&revision,//const svn_opt_revision_t *revision,
TRUE,//svn_boolean_t recurse,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool);
break;
case 2://2
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do update...\n");
err = svn_client_update(update_result_rev,//NULL,//svn_revnum_t *result_rev,
my_answerbuf2,//loadpath1,//const char *path,
&revision,//const svn_opt_revision_t *revision,
TRUE,//svn_boolean_t recurse,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool);
break;
case 3://3
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do add...\n");
err = svn_client_add2(my_answerbuf2,//loadpath1,//const char *path,//loc path
TRUE,//svn_boolean_t recursive,
TRUE,//svn_boolean_t force,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool);
break;
case 4://4
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do delete...\n");
targets = apr_array_make(pool, 1, sizeof(const char*));
APR_ARRAY_PUSH(targets, const char*) = my_answerbuf2;//delpath;
err = svn_client_delete4(targets, FALSE, FALSE, NULL, NULL, NULL,
ctx, pool);
break;
case 5://5
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
SVN_ERR (prompt_and_read_line("input log_message", my_answerbuf, sizeof(my_answerbuf)));
printf ("do commit...\n");
my_commit(my_answerbuf2,svn_depth_infinity,my_answerbuf,ctx,pool);//svn_depth_infinity,//svn_depth_files
//iterpool = svn_pool_create(pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = my_answerbuf2;//loadpath1;
//svn_pool_clear(iterpool);
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
//svn_pool_destroy(iterpool);
break;
case 6://6
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do revert...\n");
targets = apr_array_make(pool, 1, sizeof(const char*));
APR_ARRAY_PUSH(targets, const char*) = my_answerbuf2;//delpath;
err = svn_client_revert(targets,//const apr_array_header_t *paths,
TRUE,//svn_boolean_t recursive,
ctx,//svn_client_ctx_t *ctx,
pool); //apr_pool_t *pool);
break;
case 7://7
SVN_ERR (prompt_and_read_line("input loc_path(exmaple:D:/SVN/Test)", my_answerbuf2, sizeof(my_answerbuf2)));
SVN_ERR (prompt_and_read_line("input conflict choose:1.original;2.theirs_full;3.mine_full;4.theirs_conflict;5.mine_conflict;6.merged)", my_answerbuf, sizeof(my_answerbuf)));
my_subcommandnum = atoi(my_answerbuf);
printf ("do resolve...\n");
err = svn_client_resolve(my_answerbuf2,//delpath,//const char *path,
svn_depth_infinity,//svn_depth_t depth,
my_subcommandnum,//svn_wc_conflict_choose_base,//svn_wc_conflict_choice_t conflict_choice,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool);
break;
case 8:
SVN_ERR (prompt_and_read_line("input src URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf, sizeof(my_answerbuf)));
SVN_ERR (prompt_and_read_line("input dst URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do copy...\n");
//ctx->log_msg_func = my_log_msg_receiver_func;
err = svn_client_copy(&client_commit_info_p,//svn_client_commit_info_t **commit_info_p,
my_answerbuf,//const char *src_path,
&src_rvs,//const svn_opt_revision_t *src_revision,
my_answerbuf2,//const char *dst_path,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool)
case 9:
SVN_ERR (prompt_and_read_line("input src URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf, sizeof(my_answerbuf)));
SVN_ERR (prompt_and_read_line("input dst URL(exmaple:http://192.0.0.193/pm/trunk/test/others)", my_answerbuf2, sizeof(my_answerbuf2)));
printf ("do move...\n");
err = svn_client_move(&client_commit_info_p,//svn_client_commit_info_t **commit_info_p,
my_answerbuf,//const char *src_path,
&src_rvs,//const svn_opt_revision_t *src_revision,
my_answerbuf2,//const char *dst_path,
FALSE,//svn_boolean_t force,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool)
default:
break;
}
if (err)
{
printf (" error %d\n", err->apr_err);
}
}
------------------------------------------------------------
/*
//Debug-DL
err = svn_client_checkout2( NULL,//svn_revnum_t *result_rev,
URL,//const char *URL,
loadpath,//const char *path,
NULL,//const svn_opt_revision_t *peg_revision,
&revision,//const svn_opt_revision_t *revision,
FALSE,//svn_boolean_t recurse,
FALSE,//svn_boolean_t ignore_externals,
ctx,//svn_client_ctx_t *ctx,
pool);//apr_pool_t *pool);
*/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// checkout test ok
//err = svn_client_checkout(NULL,//lRev,//svn_revnum_t *result_rev,
// URL1,//const char *URL,
// loadpath1,//const char *path,
// &revision,//const svn_opt_revision_t *revision,
// TRUE,//svn_boolean_t recurse,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
---------------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//update test ok
//err = svn_client_update(update_result_rev,//NULL,//svn_revnum_t *result_rev,
// loadpath1,//const char *path,
// &revision,//const svn_opt_revision_t *revision,
// TRUE,//svn_boolean_t recurse,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
---------------------------------------------------------------------
///
//err = svn_client_add(loadpath2,//const char *path,//loc path
// FALSE,//svn_boolean_t recursive,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
//err = svn_client_add2(loadpath2,//const char *path,//loc path
// FALSE,//svn_boolean_t recursive,
// TRUE,//svn_boolean_t force,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
// targets = apr_array_make(pool, 1, sizeof(const char*));
// APR_ARRAY_PUSH(targets, const char*) = loadpath2;
// //svn_pool_clear(iterpool);
// err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, pool);
//iterpool = svn_pool_create(pool);
//err = svn_client_add5(loadpath2, svn_depth_unknown, FALSE, FALSE, FALSE,
//FALSE, ctx, pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = loadpath2;
//svn_pool_clear(iterpool);
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
//commit_info = svn_create_commit_info(pool);
//commit_info->revision = revision;
//commit_info->date = date ? date->data : NULL;
//commit_info->author = author ? author->data : NULL;
//commit_info->post_commit_err = post_commit_errstr;
//err = svn_client_commit();
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test add commit ok //按照路径来添加 //没有author,没有message
//err = svn_client_add2(loadpath1,//const char *path,//loc path
// TRUE,//svn_boolean_t recursive,
// TRUE,//svn_boolean_t force,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
//iterpool = svn_pool_create(pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = loadpath1;
//svn_pool_clear(iterpool);
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
//svn_pool_destroy(iterpool);
---------------------------------------------------------------------
//err = svn_client_add2(loadpath1,//const char *path,//loc path
// TRUE,//svn_boolean_t recursive,
// TRUE,//svn_boolean_t force,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
//iterpool = svn_pool_create(pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = loadpath1;
//svn_pool_clear(iterpool);
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
//client_commit_info.author = "zhang";
//client_commit_info.date = "add test";
//client_commit_info.revision = 38;
//client_commit_info_p = &client_commit_info;
//client_commit_info_pp = &client_commit_info_p;
//
// err = svn_client_commit(client_commit_info_pp,//svn_client_commit_info_t **commit_info_p,
// targets,//const apr_array_header_t *targets,
// TRUE,//svn_boolean_t nonrecursive,
// ctx,//svn_client_ctx_t *ctx,
// iterpool);//apr_pool_t *pool);
//svn_pool_destroy(iterpool);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//test Delete commit ok
// targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = delpath;
//err = svn_client_delete4(targets, FALSE, FALSE, NULL, NULL, NULL,
// ctx, pool);
//
//iterpool = svn_pool_create(pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = loadpath1;
//svn_pool_clear(iterpool);
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
//svn_pool_destroy(iterpool);
---------------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test revert test OK
// targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = delpath;
//
//err = svn_client_revert(targets,//const apr_array_header_t *paths,
// TRUE,//svn_boolean_t recursive,
// ctx,//svn_client_ctx_t *ctx,
// pool); //apr_pool_t *pool);
---------------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//test resolve
//err = svn_client_update(update_result_rev,//NULL,//svn_revnum_t *result_rev,
// delpath,//const char *path,
// &revision,//const svn_opt_revision_t *revision,
// TRUE,//svn_boolean_t recurse,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
//err = svn_client_resolve(delpath,//const char *path,
// svn_depth_infinity,//svn_depth_t depth,
// svn_wc_conflict_choose_base,//svn_wc_conflict_choice_t conflict_choice,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool);
---------------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//test diff
// rv = apr_initialize();//初始化
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = delpath;
//targets = apr_array_make(pool, 0, sizeof(const char*));
//
打开可读文件
apr_file_open(&outfile,"d:\\outfile.txt",APR_READ|APR_BUFFERED,APR_OS_DEFAULT,pool);
apr_file_open(&errfile,"d:\\errfile.txt",APR_READ|APR_BUFFERED,APR_OS_DEFAULT,pool);
//
打开可写文件
//rv = apr_file_open(&outfile,"d:\\outfile.txt",APR_WRITE|APR_BUFFERED|APR_CREATE|APR_TRUNCATE,APR_OS_DEFAULT,pool);
//if( rv != APR_SUCCESS ) return 0;
//rv = apr_file_open(&errfile,"d:\\errfile.txt",APR_WRITE|APR_BUFFERED|APR_CREATE|APR_TRUNCATE,APR_OS_DEFAULT,pool);
//if( rv != APR_SUCCESS ) return 0;
//
//err = svn_client_diff(targets,//const apr_array_header_t *options,
// delpath,//const char *path1,
// &revision,//const svn_opt_revision_t *revision1,
// delpath2,//const char *path2,
// &revision,//const svn_opt_revision_t *revision2,
// TRUE,//svn_boolean_t recurse,
// FALSE,//svn_boolean_t ignore_ancestry,
// FALSE,//svn_boolean_t no_diff_deleted,
// outfile,//outfile,//apr_file_t *outfile,
// errfile,//errfile,//apr_file_t *errfile,
// ctx,//svn_client_ctx_t *ctx,
// pool);//apr_pool_t *pool)
//
//rv = apr_file_close(outfile);
//if( rv != APR_SUCCESS ) return 0;
//rv = apr_file_close(errfile);
//if( rv != APR_SUCCESS ) return 0;
---------------------------------------------------------------------
/*
//++++++++++++++++++++++++++++++++++++++++++++
//test diff
rv = apr_initialize();//初始化
targets = apr_array_make(pool, 0, sizeof(const char*));
//the revision we started with.
rev1.kind = svn_opt_revision_head;
//to the revision we've got here.
rev2.kind = svn_opt_revision_working;
//for your client, you'd probably want to open temp files for this, but for
//our purposes we'll just use stdout and stderr.
//apr_file_open_stdout (&outfile, pool);
//apr_file_open_stderr (&errfile, pool);
rv = apr_file_open(&outfile,"d:\\outfile.txt",APR_WRITE|APR_BUFFERED|APR_CREATE|APR_TRUNCATE,APR_OS_DEFAULT,pool);
if( rv != APR_SUCCESS ) return 0;
rv = apr_file_open(&errfile,"d:\\errfile.txt",APR_WRITE|APR_BUFFERED|APR_CREATE|APR_TRUNCATE,APR_OS_DEFAULT,pool);
if( rv != APR_SUCCESS ) return 0;
err = svn_client_diff (targets,
//"D:\\SVN\DaleyTest\\Add-Commit-Test\\Add-Test-002.txt",
"http://192.0.0.193/pm/trunk/test/others/DaleyTest/Add-Commit-Test/Add-Test-002.txt",
&rev1,
//"D:\\SVN\\DaleyTest\\Add-Commit-Test\\Add-Test-002.txt",
"http://192.0.0.193/pm/trunk/test/others/DaleyTest/Add-Commit-Test/Add-Test-002.txt",
&rev2,
TRUE,
FALSE,
FALSE,
outfile,
errfile,
ctx,
pool);
rv = apr_file_close(outfile);
if( rv != APR_SUCCESS ) return 0;
rv = apr_file_close(errfile);
if( rv != APR_SUCCESS ) return 0;
//---------------------------------------------
*/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test commit2 //按照路径来添加 //添加message
//iterpool = svn_pool_create(pool);
//targets = apr_array_make(pool, 1, sizeof(const char*));
//APR_ARRAY_PUSH(targets, const char*) = loadpath1;
//svn_pool_clear(iterpool);
//
//err = svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE,
// NULL, NULL, NULL, NULL, ctx, iterpool);
err = svn_client_commit(&client_commit_info_p,
targets,
TRUE,
ctx,
pool);
svn_pool_destroy(iterpool);
//-------------------------------------------------------------------
/*if (err)
{
printf (" error %d\n", err->apr_err);
}*/
system("pause");
return EXIT_SUCCESS;
}
包含目录
../include;../../apr/include;../../apr-iconv/include;../../apr-util/include;../../src-trunk/subversion/include;../../db4-win32/include;../../svn-win32-libintl/inc;../../src-trunk/subversion/include/private;../../apr-util/xml/expat/lib
链接-附加库目录
../../apr/Debug;../.../apr-iconv/Debug;../../apr-util/Debug;../lib/neon;../lib;../../src-trunk/Debug/subversion;../../apr-util/xml/LibD
链接-输入kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;svn_client-1.lib;svn_delta-1.lib;svn_diff-1.lib;svn_fs-1.lib;svn_ra-1.lib;svn_repos-1.lib;svn_subr-1.lib;svn_wc-1.lib;libsvn_fs_fs-1.lib;libsvn_fs_util-1.lib;libsvn_fs_x-1.lib;libsvn_ra_local-1.lib;libsvn_ra_serf-1.lib;libsvn_ra_svn-1.lib;libneon.lib;intl3_svn.lib;libdb44s.lib;WS2_32.Lib;shfolder.lib;libexpat.lib;xml.lib;libapr-1.lib;libaprutil-1.lib;Crypt32.lib;Secur32.lib;Winmm.lib;wininet.lib;UxTheme.lib;comctl32.lib;mswsock.lib;rpcrt4.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies)