X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=utils%2FTerraSync%2Fterrasync.cxx;h=70ebf87aa6c5ce9862704a714630060821953b6a;hb=12009ea6882d9eb8eb90a6fdabd2b59b2cfdeb9e;hp=1545aa7b81b050a91dabdb8c748daefacfcaec24;hpb=2710564c7d3c3e95361a366441d3b96a6049ee05;p=flightgear.git diff --git a/utils/TerraSync/terrasync.cxx b/utils/TerraSync/terrasync.cxx index 1545aa7b8..70ebf87aa 100644 --- a/utils/TerraSync/terrasync.cxx +++ b/utils/TerraSync/terrasync.cxx @@ -79,152 +79,6 @@ static void usage( const string& prog ) { << prog << " -p " << "-R [ -s ] -d " << endl << prog << " -p " -<<<<<<< terrasync.cxx - << "-S [ -s ] -d " << endl; -#ifdef HAVE_SVN_CLIENT_H - cout << " (defaults to the built in subversion)" << endl; -#else - cout << " (defaults to rsync, using external commands)" << endl; -#endif -} - -#ifdef HAVE_SVN_CLIENT_H - -// Things we need for doing subversion checkout - often -apr_pool_t *mysvn_pool = NULL; -svn_client_ctx_t *mysvn_ctx = NULL; -svn_opt_revision_t *mysvn_rev = NULL; - -static const svn_version_checklist_t mysvn_checklist[] = { - { "svn_subr", svn_subr_version }, - { "svn_client", svn_client_version }, - { "svn_wc", svn_wc_version }, - { "svn_ra", svn_ra_version }, - { "svn_delta", svn_delta_version }, - { "svn_diff", svn_diff_version }, - { NULL, NULL } -}; - -// Configure our subversion session -int mysvn_setup(void) { - // Are we already prepared? - if (mysvn_pool) return EXIT_SUCCESS; - // No, so initialize svn internals generally - if (svn_cmdline_init("terrasync", stderr) != EXIT_SUCCESS) - return EXIT_FAILURE; - apr_pool_t *pool; - apr_pool_create(&pool, NULL); - svn_error_t *err = NULL; - SVN_VERSION_DEFINE(mysvn_version); - err = svn_ver_check_list(&mysvn_version, mysvn_checklist); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - err = svn_ra_initialize(pool); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - char *config_dir = NULL; - err = svn_config_ensure(config_dir, pool); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - err = svn_client_create_context(&mysvn_ctx, pool); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - err = svn_config_get_config(&(mysvn_ctx->config), - config_dir, pool); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - svn_config_t *cfg; - cfg = ( svn_config_t*) apr_hash_get( - mysvn_ctx->config, - SVN_CONFIG_CATEGORY_CONFIG, - APR_HASH_KEY_STRING); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - svn_auth_baton_t *ab; - err = svn_cmdline_setup_auth_baton(&ab, - TRUE, NULL, NULL, config_dir, TRUE, cfg, - mysvn_ctx->cancel_func, mysvn_ctx->cancel_baton, pool); - if (err) - return svn_cmdline_handle_exit_error(err, pool, "terrasync: "); - mysvn_ctx->auth_baton = ab; - mysvn_ctx->conflict_func = NULL; - mysvn_ctx->conflict_baton = NULL; - mysvn_rev = (svn_opt_revision_t*) apr_palloc(pool, - sizeof(svn_opt_revision_t)); - if (!mysvn_rev) - return EXIT_FAILURE; - mysvn_rev->kind = svn_opt_revision_head; - // Success if we got this far - mysvn_pool = pool; - return EXIT_SUCCESS; -} - -#endif - -// sync one directory tree -void sync_tree(char* dir) { - int rc; - char command[512]; - SGPath path( dest_base ); - - path.append( dir ); - rc = path.create_dir( 0755 ); - if (rc) { - cout << "Return code = " << rc << endl; - exit(1); - } - - if (use_svn) { -#ifdef HAVE_SVN_CLIENT_H - cout << dir << " ... "; - cout.flush(); - char dest_base_dir[512]; - snprintf( command, 512, - "%s/%s", source_base, dir); - snprintf( dest_base_dir, 512, - "%s/%s", dest_base, dir); - svn_error_t *err = NULL; - if (mysvn_setup() != EXIT_SUCCESS) - exit(1); - apr_pool_t *subpool = svn_pool_create(mysvn_pool); - err = svn_client_checkout(NULL, - command, - dest_base_dir, - mysvn_rev, - 1, - mysvn_ctx, - subpool); - if (err) { - // Report errors from the checkout attempt - cout << "failed: " << endl - << err->message << endl; - svn_error_clear(err); - return; - } else { - cout << "done" << endl; - } - svn_pool_destroy(subpool); - return; -#else - - snprintf( command, 512, - "%s %s/%s %s/%s", svn_cmd, - source_base, dir, - dest_base, dir ); -#endif - } else { - snprintf( command, 512, - "%s %s/%s/ %s/%s/", rsync_cmd, - source_base, dir, - dest_base, dir ); - } - cout << command << endl; - rc = system( command ); - if (rc) { - cout << "Return code = " << rc << endl; - if (rc == 5120) exit(1); - } -======= << "-S [ -s ] -d " << endl; #ifdef HAVE_SVN_CLIENT_H cout << " (defaults to the built in subversion)" << endl; @@ -374,7 +228,6 @@ void sync_tree(char* dir) { cout << "Return code = " << rc << endl; if (rc == 5120) exit(1); } ->>>>>>> 1.15 }