⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 4 页
字号:
  baton.callbacks = &callbacks;  baton.config = opt_baton->config;  baton.to_url = to_url;  SVN_ERR(svn_ra_open2(&to_session,                       to_url,                       baton.callbacks,                       &baton,                       baton.config,                       pool));  SVN_ERR(check_if_session_is_at_repos_root(to_session, to_url, pool));  SVN_ERR(with_locked(to_session, do_synchronize, &baton, pool));  return SVN_NO_ERROR;}/*** `svnsync copy-revprops' ***//* Baton for copying revision properties to the destination repository * while locked. */typedef struct {  apr_hash_t *config;  svn_ra_callbacks2_t *callbacks;  const char *to_url;  svn_revnum_t rev;} copy_revprops_baton_t;/* Copy revision properties to the repository associated with RA * session TO_SESSION, using information found in baton B, while the * repository is locked.  Implements `with_locked_func_t' interface. */static svn_error_t *do_copy_revprops(svn_ra_session_t *to_session, void *b, apr_pool_t *pool){  copy_revprops_baton_t *baton = b;  svn_ra_session_t *from_session;  svn_string_t *last_merged_rev;  SVN_ERR(open_source_session(&from_session, &last_merged_rev, to_session,                              baton->callbacks, baton->config, baton, pool));  if (baton->rev > SVN_STR_TO_REV(last_merged_rev->data))    return svn_error_create      (APR_EINVAL, NULL, _("Cannot copy revprops for a revision that has not "                           "been synchronized yet"));  SVN_ERR(copy_revprops(from_session, to_session, baton->rev, FALSE, pool));  return SVN_NO_ERROR;}/* SUBCOMMAND: copy-revprops */static svn_error_t *copy_revprops_cmd(apr_getopt_t *os, void *b, apr_pool_t *pool){  svn_ra_callbacks2_t callbacks = { 0 };  svn_ra_session_t *to_session;  opt_baton_t *opt_baton = b;  apr_array_header_t *args;  copy_revprops_baton_t baton;  const char *to_url;  svn_revnum_t revision = SVN_INVALID_REVNUM;  char *digits_end = NULL;  SVN_ERR(svn_opt_parse_num_args(&args, os, 2, pool));  to_url = svn_path_canonicalize(APR_ARRAY_IDX(args, 0, const char *), pool);  revision = strtol(APR_ARRAY_IDX(args, 1, const char *), &digits_end, 10);    if (! svn_path_is_url(to_url))    return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                              _("Path '%s' is not a URL"), to_url);  if ((! SVN_IS_VALID_REVNUM(revision)) || (! digits_end) || *digits_end)    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                            _("Invalid revision number"));  callbacks.open_tmp_file = open_tmp_file;  callbacks.auth_baton = opt_baton->auth_baton;  baton.callbacks = &callbacks;  baton.config = opt_baton->config;  baton.to_url = to_url;  baton.rev = revision;  SVN_ERR(svn_ra_open2(&to_session,                       to_url,                       baton.callbacks,                       &baton,                       baton.config,                       pool));  SVN_ERR(check_if_session_is_at_repos_root(to_session, to_url, pool));  SVN_ERR(with_locked(to_session, do_copy_revprops, &baton, pool));  return SVN_NO_ERROR;}/*** `svnsync help' ***//* SUBCOMMAND: help */static svn_error_t *help_cmd(apr_getopt_t *os, void *baton, apr_pool_t *pool){  opt_baton_t *opt_baton = baton;  const char *header =    _("general usage: svnsync SUBCOMMAND DEST_URL  [ARGS & OPTIONS ...]\n"      "Type 'svnsync help <subcommand>' for help on a specific subcommand.\n"      "Type 'svnsync --version' to see the program version and RA modules.\n"      "\n"      "Available subcommands:\n");  const char *ra_desc_start    = _("The following repository access (RA) modules are available:\n\n");  svn_stringbuf_t *version_footer = svn_stringbuf_create(ra_desc_start,                                                         pool);  SVN_ERR(svn_ra_print_modules(version_footer, pool));  SVN_ERR(svn_opt_print_help(os, "svnsync",                             opt_baton ? opt_baton->version : FALSE,                             FALSE, version_footer->data, header,                             svnsync_cmd_table, svnsync_options, NULL,                             pool));  return SVN_NO_ERROR;}/*** Main ***/intmain(int argc, const char *argv[]){  const svn_opt_subcommand_desc_t *subcommand = NULL;  apr_array_header_t *received_opts;  opt_baton_t opt_baton;  svn_config_t *config;  apr_status_t apr_err;  apr_getopt_t *os;  apr_pool_t *pool;  svn_error_t *err;  int opt_id, i;  if (svn_cmdline_init("svnsync", stderr) != EXIT_SUCCESS)    {      return EXIT_FAILURE;    }  err = check_lib_versions();  if (err)    {      svn_handle_error2(err, stderr, FALSE, "svnsync: ");      return EXIT_FAILURE;    }  pool = svn_pool_create(NULL);  err = svn_ra_initialize(pool);  if (err)    {      svn_handle_error2(err, stderr, FALSE, "svnsync: ");      return EXIT_FAILURE;    }  memset(&opt_baton, 0, sizeof(opt_baton));  received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));  if (argc <= 1)    {      help_cmd(NULL, NULL, pool);      svn_pool_destroy(pool);      return EXIT_FAILURE;    }  err = svn_cmdline__getopt_init(&os, argc, argv, pool);  if (err)    return svn_cmdline_handle_exit_error(err, pool, "svnsync: ");  os->interleave = 1;  for (;;)    {      const char *opt_arg;      apr_err = apr_getopt_long(os, svnsync_options, &opt_id, &opt_arg);      if (APR_STATUS_IS_EOF(apr_err))        break;      else if (apr_err)        {          help_cmd(NULL, NULL, pool);          svn_pool_destroy(pool);          return EXIT_FAILURE;        }      APR_ARRAY_PUSH(received_opts, int) = opt_id;      switch (opt_id)        {          case svnsync_opt_non_interactive:            opt_baton.non_interactive = TRUE;            break;          case svnsync_opt_no_auth_cache:            opt_baton.no_auth_cache = TRUE;            break;          case svnsync_opt_auth_username:            opt_baton.auth_username = opt_arg;            break;          case svnsync_opt_auth_password:            opt_baton.auth_password = opt_arg;            break;          case svnsync_opt_config_dir:            opt_baton.config_dir = opt_arg;            break;          case svnsync_opt_version:            opt_baton.version = TRUE;            break;          case '?':          case 'h':            opt_baton.help = TRUE;            break;          default:            {              help_cmd(NULL, NULL, pool);              svn_pool_destroy(pool);              return EXIT_FAILURE;            }        }    }  if (opt_baton.help)    subcommand = svn_opt_get_canonical_subcommand(svnsync_cmd_table, "help");  if (subcommand == NULL)    {      if (os->ind >= os->argc)        {          if (opt_baton.version)            {              /* Use the "help" subcommand to handle the "--version" option. */              static const svn_opt_subcommand_desc_t pseudo_cmd =                { "--version", help_cmd, {0}, "",                  {svnsync_opt_version,  /* must accept its own option */                  } };              subcommand = &pseudo_cmd;            }          else            {              help_cmd(NULL, NULL, pool);              svn_pool_destroy(pool);              return EXIT_FAILURE;            }        }      else        {          const char *first_arg = os->argv[os->ind++];          subcommand = svn_opt_get_canonical_subcommand(svnsync_cmd_table,                                                        first_arg);          if (subcommand == NULL)            {              help_cmd(NULL, NULL, pool);              svn_pool_destroy(pool);              return EXIT_FAILURE;            }        }    }  for (i = 0; i < received_opts->nelts; ++i)    {      opt_id = APR_ARRAY_IDX(received_opts, i, int);      if (opt_id == 'h' || opt_id == '?')        continue;      if (! svn_opt_subcommand_takes_option(subcommand, opt_id))        {          const char *optstr;          const apr_getopt_option_t *badopt =            svn_opt_get_option_from_code(opt_id, svnsync_options);          svn_opt_format_option(&optstr, badopt, FALSE, pool);          if (subcommand->name[0] == '-')            help_cmd(NULL, NULL, pool);          else            svn_error_clear              (svn_cmdline_fprintf               (stderr, pool, _("subcommand '%s' doesn't accept option '%s'\n"                                "Type 'svnsync help %s' for usage.\n"),                subcommand->name, optstr, subcommand->name));          svn_pool_destroy(pool);          return EXIT_FAILURE;        }    }  err = svn_config_get_config(&opt_baton.config, NULL, pool);  if (err)    return svn_cmdline_handle_exit_error(err, pool, "svnsync: ");  config = apr_hash_get(opt_baton.config, SVN_CONFIG_CATEGORY_CONFIG,                        APR_HASH_KEY_STRING);  apr_signal(SIGINT, signal_handler);#ifdef SIGBREAK  /* SIGBREAK is a Win32 specific signal generated by ctrl-break. */  apr_signal(SIGBREAK, signal_handler);#endif#ifdef SIGHUP  apr_signal(SIGHUP, signal_handler);#endif#ifdef SIGTERM  apr_signal(SIGTERM, signal_handler);#endif#ifdef SIGPIPE  /* Disable SIGPIPE generation for the platforms that have it. */  apr_signal(SIGPIPE, SIG_IGN);#endif#ifdef SIGXFSZ  /* Disable SIGXFSZ generation for the platforms that have it,     otherwise working with large files when compiled against an APR     that doesn't have large file support will crash the program,     which is uncool. */  apr_signal(SIGXFSZ, SIG_IGN);#endif  err = svn_cmdline_setup_auth_baton(&opt_baton.auth_baton,                                     opt_baton.non_interactive,                                     opt_baton.auth_username,                                     opt_baton.auth_password,                                     opt_baton.config_dir,                                     opt_baton.no_auth_cache,                                     config,                                     check_cancel, NULL,                                     pool);  err = (*subcommand->cmd_func)(os, &opt_baton, pool);  if (err)    {      /* Fix up stupid default error strings. */      if (err->apr_err == SVN_ERR_CL_INSUFFICIENT_ARGS)        {          svn_error_clear(err);          err = svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,                                 _("Not enough arguments provided; "                                   "try 'svnsync help' for more info"));        }      svn_handle_error2(err, stderr, FALSE, "svnsync: ");      svn_error_clear(err);      return EXIT_FAILURE;    }  svn_pool_destroy(pool);  return EXIT_SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -