您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ svn_error_createf函数代码示例

51自学网 2021-06-03 08:34:16
  C++
这篇教程C++ svn_error_createf函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中svn_error_createf函数的典型用法代码示例。如果您正苦于以下问题:C++ svn_error_createf函数的具体用法?C++ svn_error_createf怎么用?C++ svn_error_createf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了svn_error_createf函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: substitute_and_verify

/* Set up, run, and verify the results of a substitution. * * Create a file TEST_NAME.src using global `lines' as the initial * data, with SRC_EOL as the line separator, then convert it to file * TEST_NAME.dst (using DST_EOL, REPAIR, EXPAND, REV, AUTHOR, DATE, * and URL as svn_subst_copy_and_translate() does), and verify that the * conversion worked.  Null SRC_EOL means create a mixed eol src * file. * * If the verification succeeds, remove both files and return * SVN_NO_ERROR. * * If the verification fails, leave the files for post-mortem.  If the * failure is due to non-eol data being wrong, return * SVN_ERR_MALFORMED_FILE.  If the problem is an incorrect eol marker, * return SVN_ERR_IO_UNKNOWN_EOL.  If the problem is that a mixed eol * style was repaired even though no repair flag was passed, return * SVN_ERR_TEST_FAILED. * * Use POOL for temporary allocation. * * Note: as with svn_subst_copy_and_translate(), if any of DST_EOL, REV, * AUTHOR, DATE, and/or URL is null, then that substitution is not * performed. */static svn_error_t *substitute_and_verify(const char *test_name,                      const char *src_eol,                      const char *dst_eol,                      svn_boolean_t repair,                      const char *rev,                      const char *date,                      const char *author,                      const char *url,                      svn_boolean_t expand,                      apr_pool_t *pool){  svn_error_t *err;  svn_stringbuf_t *contents;  apr_hash_t *keywords = apr_hash_make(pool);  apr_size_t idx = 0;  apr_size_t i;  const char *expect[(sizeof(lines) / sizeof(*lines))];  const char *src_fname = apr_pstrcat(pool, test_name, ".src", NULL);  const char *dst_fname = apr_pstrcat(pool, test_name, ".dst", NULL);  svn_string_t *val;  apr_pool_t *subpool = svn_pool_create(pool);  /** Clean up from previous tests, set up src data, and convert. **/  SVN_ERR(remove_file(src_fname, pool));  SVN_ERR(remove_file(dst_fname, pool));  SVN_ERR(create_file(src_fname, src_eol, pool));  if (rev)    {      val = svn_string_create(rev, pool);      apr_hash_set(keywords, SVN_KEYWORD_REVISION_LONG,                   APR_HASH_KEY_STRING, val);      apr_hash_set(keywords, SVN_KEYWORD_REVISION_MEDIUM,                   APR_HASH_KEY_STRING, val);      apr_hash_set(keywords, SVN_KEYWORD_REVISION_SHORT,                   APR_HASH_KEY_STRING, val);    }  if (date)    {      val = svn_string_create(date, pool);      apr_hash_set(keywords, SVN_KEYWORD_DATE_LONG,                   APR_HASH_KEY_STRING, val);      apr_hash_set(keywords, SVN_KEYWORD_DATE_SHORT,                   APR_HASH_KEY_STRING, val);    }  if (author)    {      val = svn_string_create(author, pool);      apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_LONG,                   APR_HASH_KEY_STRING, val);      apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_SHORT,                   APR_HASH_KEY_STRING, val);    }  if (url)    {      val = svn_string_create(url, pool);      apr_hash_set(keywords, SVN_KEYWORD_URL_LONG,                   APR_HASH_KEY_STRING, val);      apr_hash_set(keywords, SVN_KEYWORD_URL_SHORT,                   APR_HASH_KEY_STRING, val);    }  err = svn_subst_copy_and_translate3(src_fname, dst_fname, dst_eol, repair,                                      keywords, expand, FALSE, subpool);  svn_pool_destroy(subpool);  /* Conversion should have failed, if src has mixed eol, and the     repair flag was not set, and we requested eol translation. */  if ((! src_eol) && dst_eol && (! repair))    {      if (! err)        {          return svn_error_createf            (SVN_ERR_TEST_FAILED, NULL,//.........这里部分代码省略.........
开发者ID:aosm,项目名称:subversion,代码行数:101,


示例2: add

/* The main logic of the public svn_client_add4. * * EXISTING_PARENT_ABSPATH is the absolute path to the first existing * parent directory of local_abspath. If not NULL, all missing parents * of LOCAL_ABSPATH must be created before LOCAL_ABSPATH can be added. */static svn_error_t *add(const char *local_abspath,    svn_depth_t depth,    svn_boolean_t force,    svn_boolean_t no_ignore,    const char *existing_parent_abspath,    svn_client_ctx_t *ctx,    apr_pool_t *scratch_pool){  svn_node_kind_t kind;  svn_error_t *err;  svn_magic__cookie_t *magic_cookie;  svn_magic__init(&magic_cookie, scratch_pool);  if (existing_parent_abspath)    {      const char *parent_abspath;      const char *child_relpath;      apr_array_header_t *components;      int i;      apr_pool_t *iterpool;      parent_abspath = existing_parent_abspath;      child_relpath = svn_dirent_is_child(existing_parent_abspath,                                          local_abspath, NULL);      components = svn_path_decompose(child_relpath, scratch_pool);      iterpool = svn_pool_create(scratch_pool);      for (i = 0; i < components->nelts - 1; i++)        {          const char *component;          svn_node_kind_t disk_kind;          svn_pool_clear(iterpool);          if (ctx->cancel_func)            SVN_ERR(ctx->cancel_func(ctx->cancel_baton));          component = APR_ARRAY_IDX(components, i, const char *);          parent_abspath = svn_dirent_join(parent_abspath, component,                                           scratch_pool);          SVN_ERR(svn_io_check_path(parent_abspath, &disk_kind, iterpool));          if (disk_kind != svn_node_none && disk_kind != svn_node_dir)            return svn_error_createf(SVN_ERR_CLIENT_NO_VERSIONED_PARENT, NULL,                                     _("'%s' prevents creating parent of '%s'"),                                     parent_abspath, local_abspath);          SVN_ERR(svn_io_make_dir_recursively(parent_abspath, scratch_pool));          SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, parent_abspath,                                       ctx->notify_func2, ctx->notify_baton2,                                       scratch_pool));        }      svn_pool_destroy(iterpool);    }  SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));  if (kind == svn_node_dir)    {      /* We use add_dir_recursive for all directory targets         and pass depth along no matter what it is, so that the         target's depth will be set correctly. */      err = add_dir_recursive(local_abspath, depth, force, no_ignore,                              magic_cookie, ctx, scratch_pool);    }  else if (kind == svn_node_file)    err = add_file(local_abspath, magic_cookie, ctx, scratch_pool);  else if (kind == svn_node_none)    {      svn_boolean_t tree_conflicted;      /* Provide a meaningful error message if the node does not exist       * on disk but is a tree conflict victim. */      err = svn_wc_conflicted_p3(NULL, NULL, &tree_conflicted,                                 ctx->wc_ctx, local_abspath,                                 scratch_pool);      if (err)        svn_error_clear(err);      else if (tree_conflicted)        return svn_error_createf(SVN_ERR_WC_FOUND_CONFLICT, NULL,                                 _("'%s' is an existing item in conflict; "                                   "please mark the conflict as resolved "                                   "before adding a new item here"),                                 svn_dirent_local_style(local_abspath,                                                        scratch_pool));      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,                               _("'%s' not found"),                               svn_dirent_local_style(local_abspath,                                                      scratch_pool));    }  else    return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,                             _("Unsupported node kind for path '%s'"),                             svn_dirent_local_style(local_abspath,                                                    scratch_pool));//.........这里部分代码省略.........
开发者ID:dtrebbien,项目名称:subversion,代码行数:101,


示例3: svn_client_status6

svn_error_t *svn_client_status6(svn_revnum_t *result_rev,                   svn_client_ctx_t *ctx,                   const char *path,                   const svn_opt_revision_t *revision,                   svn_depth_t depth,                   svn_boolean_t get_all,                   svn_boolean_t check_out_of_date,                   svn_boolean_t check_working_copy,                   svn_boolean_t no_ignore,                   svn_boolean_t ignore_externals,                   svn_boolean_t depth_as_sticky,                   const apr_array_header_t *changelists,                   svn_client_status_func_t status_func,                   void *status_baton,                   apr_pool_t *pool)  /* ### aka scratch_pool */{    struct status_baton sb;    const char *dir, *dir_abspath;    const char *target_abspath;    const char *target_basename;    apr_array_header_t *ignores;    svn_error_t *err;    apr_hash_t *changelist_hash = NULL;    /* Override invalid combinations of the check_out_of_date and       check_working_copy flags. */    if (!check_out_of_date)        check_working_copy = TRUE;    if (svn_path_is_url(path))        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,                                 _("'%s' is not a local path"), path);    if (changelists && changelists->nelts)        SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));    if (result_rev)        *result_rev = SVN_INVALID_REVNUM;    sb.real_status_func = status_func;    sb.real_status_baton = status_baton;    sb.deleted_in_repos = FALSE;    sb.changelist_hash = changelist_hash;    sb.wc_ctx = ctx->wc_ctx;    SVN_ERR(svn_dirent_get_absolute(&target_abspath, path, pool));    if (check_out_of_date)    {        /* The status editor only works on directories, so get the ancestor           if necessary */        svn_node_kind_t kind;        SVN_ERR(svn_wc_read_kind2(&kind, ctx->wc_ctx, target_abspath,                                  TRUE, FALSE, pool));        /* Dir must be a working copy directory or the status editor fails */        if (kind == svn_node_dir)        {            dir_abspath = target_abspath;            target_basename = "";            dir = path;        }        else        {            dir_abspath = svn_dirent_dirname(target_abspath, pool);            target_basename = svn_dirent_basename(target_abspath, NULL);            dir = svn_dirent_dirname(path, pool);            if (kind == svn_node_file)            {                if (depth == svn_depth_empty)                    depth = svn_depth_files;            }            else            {                err = svn_wc_read_kind2(&kind, ctx->wc_ctx, dir_abspath,                                        FALSE, FALSE, pool);                svn_error_clear(err);                if (err || kind != svn_node_dir)                {                    return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,                                             _("'%s' is not a working copy"),                                             svn_dirent_local_style(path, pool));                }            }        }    }    else    {        dir = path;        dir_abspath = target_abspath;    }    if (svn_dirent_is_absolute(dir))    {//.........这里部分代码省略.........
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:101,


示例4: can_modify

/* The caller wants to modify REVISION of FSPATH. Is that allowed?  */static svn_error_t *can_modify(svn_fs_root_t *txn_root,           const char *fspath,           svn_revnum_t revision,           apr_pool_t *scratch_pool){    svn_revnum_t created_rev;    /* Out-of-dateness check:  compare the created-rev of the node       in the txn against the created-rev of FSPATH.  */    SVN_ERR(svn_fs_node_created_rev(&created_rev, txn_root, fspath,                                    scratch_pool));    /* Uncommitted nodes (eg. a descendent of a copy/move/rotate destination)       have no (committed) revision number. Let the caller go ahead and       modify these nodes.       Note: strictly speaking, they might be performing an "illegal" edit       in certain cases, but let's just assume they're Good Little Boys.       If CREATED_REV is invalid, that means it's already mutable in the       txn, which means it has already passed this out-of-dateness check.       (Usually, this happens when looking at a parent directory of an       already-modified node)  */    if (!SVN_IS_VALID_REVNUM(created_rev))        return SVN_NO_ERROR;    /* If the node is immutable (has a revision), then the caller should       have supplied a valid revision number [that they expect to change].       The checks further below will determine the out-of-dateness of the       specified revision.  */    /* ### ugh. descendents of copy/move/rotate destinations carry along       ### their original immutable state and (thus) a valid CREATED_REV.       ### but they are logically uncommitted, so the caller will pass       ### SVN_INVALID_REVNUM. (technically, the caller could provide       ### ORIGINAL_REV, but that is semantically incorrect for the Ev2       ### API).       ###       ### for now, we will assume the caller knows what they are doing       ### and an invalid revision implies such a descendent. in the       ### future, we could examine the ancestor chain looking for a       ### copy/move/rotate-here node and allow the modification (and the       ### converse: if no such ancestor, the caller must specify the       ### correct/intended revision to modify).    */#if 1    if (!SVN_IS_VALID_REVNUM(revision))        return SVN_NO_ERROR;#else    if (!SVN_IS_VALID_REVNUM(revision))        /* ### use a custom error code?  */        return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,                                 _("Revision for modifying '%s' is required"),                                 fspath);#endif    if (revision < created_rev)    {        /* We asked to change a node that is *older* than what we found           in the transaction. The client is out of date.  */        return svn_error_createf(SVN_ERR_FS_OUT_OF_DATE, NULL,                                 _("'%s' is out of date; try updating"),                                 fspath);    }    if (revision > created_rev)    {        /* We asked to change a node that is *newer* than what we found           in the transaction. Given that the transaction was based off           of 'youngest', then either:           - the caller asked to modify a future node           - the caller has committed more revisions since this txn           was constructed, and is asking to modify a node in one           of those new revisions.           In either case, the node may not have changed in those new           revisions; use the node's ID to determine this case.  */        const svn_fs_id_t *txn_noderev_id;        svn_fs_root_t *rev_root;        const svn_fs_id_t *new_noderev_id;        /* The ID of the node that we would be modifying in the txn  */        SVN_ERR(svn_fs_node_id(&txn_noderev_id, txn_root, fspath,                               scratch_pool));        /* Get the ID from the future/new revision.  */        SVN_ERR(svn_fs_revision_root(&rev_root, svn_fs_root_fs(txn_root),                                     revision, scratch_pool));        SVN_ERR(svn_fs_node_id(&new_noderev_id, rev_root, fspath,                               scratch_pool));        svn_fs_close_root(rev_root);        /* Has the target node changed in the future?  */        if (svn_fs_compare_ids(txn_noderev_id, new_noderev_id) != 0)        {            /* Restarting the commit will base the txn on the future/new               revision, allowing the modification at REVISION.  */            /* ### use a custom error code  */            return svn_error_createf(SVN_ERR_FS_CONFLICT, NULL,                                     _("'%s' has been modified since the "//.........这里部分代码省略.........
开发者ID:Ranga123,项目名称:test1,代码行数:101,


示例5: svn_client__get_normalized_stream

svn_error_t *svn_client__get_normalized_stream(svn_stream_t **normal_stream,                                  svn_wc_context_t *wc_ctx,                                  const char *local_abspath,                                  const svn_opt_revision_t *revision,                                  svn_boolean_t expand_keywords,                                  svn_boolean_t normalize_eols,                                  svn_cancel_func_t cancel_func,                                  void *cancel_baton,                                  apr_pool_t *result_pool,                                  apr_pool_t *scratch_pool){  apr_hash_t *kw = NULL;  svn_subst_eol_style_t style;  apr_hash_t *props;  svn_string_t *eol_style, *keywords, *special;  const char *eol = NULL;  svn_boolean_t local_mod = FALSE;  apr_time_t tm;  svn_stream_t *input;  svn_node_kind_t kind;  SVN_ERR_ASSERT(SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(revision->kind));  SVN_ERR(svn_wc_read_kind(&kind, wc_ctx, local_abspath, FALSE, scratch_pool));  if (kind == svn_node_unknown || kind == svn_node_none)    return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,                             _("'%s' is not under version control"),                             svn_dirent_local_style(local_abspath,                                                    scratch_pool));  if (kind != svn_node_file)    return svn_error_createf(SVN_ERR_CLIENT_IS_DIRECTORY, NULL,                             _("'%s' refers to a directory"),                             svn_dirent_local_style(local_abspath,                                                    scratch_pool));  if (revision->kind != svn_opt_revision_working)    {      SVN_ERR(svn_wc_get_pristine_contents2(&input, wc_ctx, local_abspath,                                            result_pool, scratch_pool));      if (input == NULL)        return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,                 _("'%s' has no base revision until it is committed"),                 svn_dirent_local_style(local_abspath, scratch_pool));      SVN_ERR(svn_wc_get_pristine_props(&props, wc_ctx, local_abspath,                                        scratch_pool, scratch_pool));    }  else    {      svn_wc_status3_t *status;      SVN_ERR(svn_stream_open_readonly(&input, local_abspath, scratch_pool,                                       result_pool));      SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, local_abspath, scratch_pool,                                scratch_pool));      SVN_ERR(svn_wc_status3(&status, wc_ctx, local_abspath, scratch_pool,                             scratch_pool));      if (status->text_status != svn_wc_status_normal)        local_mod = TRUE;    }  eol_style = apr_hash_get(props, SVN_PROP_EOL_STYLE,                           APR_HASH_KEY_STRING);  keywords = apr_hash_get(props, SVN_PROP_KEYWORDS,                          APR_HASH_KEY_STRING);  special = apr_hash_get(props, SVN_PROP_SPECIAL,                         APR_HASH_KEY_STRING);  if (eol_style)    svn_subst_eol_style_from_value(&style, &eol, eol_style->data);  if (local_mod && (! special))    {      /* Use the modified time from the working copy if         the file */      SVN_ERR(svn_io_file_affected_time(&tm, local_abspath, scratch_pool));    }  else    {      SVN_ERR(svn_wc__node_get_changed_info(NULL, &tm, NULL, wc_ctx,                                            local_abspath, scratch_pool,                                            scratch_pool));    }  if (keywords)    {      svn_revnum_t changed_rev;      const char *rev_str;      const char *author;      const char *url;      SVN_ERR(svn_wc__node_get_changed_info(&changed_rev, NULL, &author, wc_ctx,                                            local_abspath, scratch_pool,                                            scratch_pool));      SVN_ERR(svn_wc__node_get_url(&url, wc_ctx, local_abspath, scratch_pool,                                   scratch_pool));//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:101,


示例6: file

/* Parse the file at DIGEST_PATH, populating the lock LOCK_P in that   file (if it exists, and if *LOCK_P is non-NULL) and the hash of   CHILDREN_P (if any exist, and if *CHILDREN_P is non-NULL).  Use POOL   for all allocations.  */static svn_error_t *read_digest_file(apr_hash_t **children_p,                 svn_lock_t **lock_p,                 const char *fs_path,                 const char *digest_path,                 apr_pool_t *pool){  svn_error_t *err = SVN_NO_ERROR;  svn_lock_t *lock;  apr_hash_t *hash;  svn_stream_t *stream;  const char *val;  svn_node_kind_t kind;  if (lock_p)    *lock_p = NULL;  if (children_p)    *children_p = apr_hash_make(pool);  SVN_ERR(svn_io_check_path(digest_path, &kind, pool));  if (kind == svn_node_none)    return SVN_NO_ERROR;  /* If our caller doesn't care about anything but the presence of the     file... whatever. */  if (kind == svn_node_file && !lock_p && !children_p)    return SVN_NO_ERROR;  SVN_ERR(svn_stream_open_readonly(&stream, digest_path, pool, pool));  hash = apr_hash_make(pool);  if ((err = svn_hash_read2(hash, stream, SVN_HASH_TERMINATOR, pool)))    {      svn_error_clear(svn_stream_close(stream));      return svn_error_createf(err->apr_err,                               err,                               _("Can't parse lock/entries hashfile '%s'"),                               svn_dirent_local_style(digest_path, pool));    }  SVN_ERR(svn_stream_close(stream));  /* If our caller cares, see if we have a lock path in our hash. If     so, we'll assume we have a lock here. */  val = hash_fetch(hash, PATH_KEY);  if (val && lock_p)    {      const char *path = val;      /* Create our lock and load it up. */      lock = svn_lock_create(pool);      lock->path = path;      if (! ((lock->token = hash_fetch(hash, TOKEN_KEY))))        return svn_error_trace(err_corrupt_lockfile(fs_path, path));      if (! ((lock->owner = hash_fetch(hash, OWNER_KEY))))        return svn_error_trace(err_corrupt_lockfile(fs_path, path));      if (! ((val = hash_fetch(hash, IS_DAV_COMMENT_KEY))))        return svn_error_trace(err_corrupt_lockfile(fs_path, path));      lock->is_dav_comment = (val[0] == '1');      if (! ((val = hash_fetch(hash, CREATION_DATE_KEY))))        return svn_error_trace(err_corrupt_lockfile(fs_path, path));      SVN_ERR(svn_time_from_cstring(&(lock->creation_date), val, pool));      if ((val = hash_fetch(hash, EXPIRATION_DATE_KEY)))        SVN_ERR(svn_time_from_cstring(&(lock->expiration_date), val, pool));      lock->comment = hash_fetch(hash, COMMENT_KEY);      *lock_p = lock;    }  /* If our caller cares, see if we have any children for this path. */  val = hash_fetch(hash, CHILDREN_KEY);  if (val && children_p)    {      apr_array_header_t *kiddos = svn_cstring_split(val, "/n", FALSE, pool);      int i;      for (i = 0; i < kiddos->nelts; i++)        {          svn_hash_sets(*children_p, APR_ARRAY_IDX(kiddos, i, const char *),                        (void *)1);        }    }
开发者ID:2asoft,项目名称:freebsd,代码行数:91,


示例7: svn_ra_local__split_URL

svn_error_t *svn_ra_local__split_URL(svn_repos_t **repos,                        const char **repos_url,                        const char **fs_path,                        const char *URL,                        apr_pool_t *pool){  svn_error_t *err = SVN_NO_ERROR;  const char *repos_dirent;  const char *repos_root_dirent;  svn_stringbuf_t *urlbuf;  apr_size_t root_end;  SVN_ERR(svn_uri_get_dirent_from_file_url(&repos_dirent, URL, pool));  /* Search for a repository in the full path. */  repos_root_dirent = svn_repos_find_root_path(repos_dirent, pool);  if (!repos_root_dirent)    return svn_error_createf(SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, NULL,                             _("Unable to open repository '%s'"), URL);  /* Attempt to open a repository at URL. */  err = svn_repos_open2(repos, repos_root_dirent, NULL, pool);  if (err)    return svn_error_createf(SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, err,                             _("Unable to open repository '%s'"), URL);  /* Assert capabilities directly, since client == server. */  {    apr_array_header_t *caps = apr_array_make(pool, 1, sizeof(const char *));    APR_ARRAY_PUSH(caps, const char *) = SVN_RA_CAPABILITY_MERGEINFO;    SVN_ERR(svn_repos_remember_client_capabilities(*repos, caps));  }  /* = apr_pstrcat(pool,                   "/",                   svn_dirent_skip_ancestor(repos_root_dirent, repos_dirent),                   (const char *)NULL); */  root_end = strlen(repos_root_dirent);  if (! repos_dirent[root_end])    *fs_path = "/";  else if (repos_dirent[root_end] == '/')    *fs_path = &repos_dirent[root_end];  else    {      /* On Windows "C:/" is the parent directory of "C:/dir" */      *fs_path = &repos_dirent[root_end-1];      SVN_ERR_ASSERT((*fs_path)[0] == '/');    }  /* Remove the path components after the root dirent from the original URL,     to get a URL to the repository root.     We don't use svn_uri_get_file_url_from_dirent() here as that would     transform several uris to form a differently formed url than     svn_uri_canonicalize would.     E.g. file://localhost/C:/dir -> file:///C:/dir          (a transform that was originally supported directly by this function,           before the implementation moved)          On on Windows:          file:///dir -> file:///E:/dir  (When E: is the current disk)     */  urlbuf = svn_stringbuf_create(URL, pool);  svn_path_remove_components(urlbuf,                             svn_path_component_count(repos_dirent)                             - svn_path_component_count(repos_root_dirent));  *repos_url = urlbuf->data;  /* Configure hook script environment variables. */  SVN_ERR(svn_repos_hooks_setenv(*repos, NULL, pool));  return SVN_NO_ERROR;}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:75,


示例8: maybe_add_with_history

/* Perform a copy or a plain add. * * For a copy, also adjust the copy-from rev, check any copy-source checksum, * and send a notification. */static svn_error_t *maybe_add_with_history(struct node_baton *nb,                       struct revision_baton *rb,                       apr_pool_t *pool){  struct parse_baton *pb = rb->pb;  if ((nb->copyfrom_path == NULL) || (! pb->use_history))    {      /* Add empty file or dir, without history. */      if (nb->kind == svn_node_file)        SVN_ERR(svn_fs_make_file(rb->txn_root, nb->path, pool));      else if (nb->kind == svn_node_dir)        SVN_ERR(svn_fs_make_dir(rb->txn_root, nb->path, pool));    }  else    {      /* Hunt down the source revision in this fs. */      svn_fs_root_t *copy_root;      svn_revnum_t copyfrom_rev;      /* Try to find the copyfrom revision in the revision map;         failing that, fall back to the revision offset approach. */      copyfrom_rev = get_revision_mapping(rb->pb->rev_map, nb->copyfrom_rev);      if (! SVN_IS_VALID_REVNUM(copyfrom_rev))        copyfrom_rev = nb->copyfrom_rev - rb->rev_offset;      if (! SVN_IS_VALID_REVNUM(copyfrom_rev))        return svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,                                 _("Relative source revision %ld is not"                                   " available in current repository"),                                 copyfrom_rev);      SVN_ERR(svn_fs_revision_root(&copy_root, pb->fs, copyfrom_rev, pool));      if (nb->copy_source_checksum)        {          svn_checksum_t *checksum;          SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, copy_root,                                       nb->copyfrom_path, TRUE, pool));          if (!svn_checksum_match(nb->copy_source_checksum, checksum))            return svn_checksum_mismatch_err(nb->copy_source_checksum,                      checksum, pool,                      _("Copy source checksum mismatch on copy from '%s'@%ld/n"                        "to '%s' in rev based on r%ld"),                      nb->copyfrom_path, copyfrom_rev, nb->path, rb->rev);        }      SVN_ERR(svn_fs_copy(copy_root, nb->copyfrom_path,                          rb->txn_root, nb->path, pool));      if (pb->notify_func)        {          /* ### TODO: Use proper scratch pool instead of pb->notify_pool */          svn_repos_notify_t *notify = svn_repos_notify_create(                                            svn_repos_notify_load_copied_node,                                            pb->notify_pool);          pb->notify_func(pb->notify_baton, notify, pb->notify_pool);          svn_pool_clear(pb->notify_pool);        }    }  return SVN_NO_ERROR;}
开发者ID:2asoft,项目名称:freebsd,代码行数:71,


示例9: new_node_record

static svn_error_t *new_node_record(void **node_baton,                apr_hash_t *headers,                void *revision_baton,                apr_pool_t *pool){  struct revision_baton *rb = revision_baton;  struct parse_baton *pb = rb->pb;  struct node_baton *nb;  if (rb->rev == 0)    return svn_error_create(SVN_ERR_STREAM_MALFORMED_DATA, NULL,                            _("Malformed dumpstream: "                              "Revision 0 must not contain node records"));  SVN_ERR(make_node_baton(&nb, headers, rb, pool));  /* If we're skipping this revision, we're done here. */  if (rb->skipped)    {      *node_baton = nb;      return SVN_NO_ERROR;    }  /* Make sure we have an action we recognize. */  if (nb->action < svn_node_action_change        || nb->action > svn_node_action_replace)      return svn_error_createf(SVN_ERR_STREAM_UNRECOGNIZED_DATA, NULL,                               _("Unrecognized node-action on node '%s'"),                               nb->path);  if (pb->notify_func)    {      /* ### TODO: Use proper scratch pool instead of pb->notify_pool */      svn_repos_notify_t *notify = svn_repos_notify_create(                                        svn_repos_notify_load_node_start,                                        pb->notify_pool);      notify->path = nb->path;      pb->notify_func(pb->notify_baton, notify, pb->notify_pool);      svn_pool_clear(pb->notify_pool);    }  switch (nb->action)    {    case svn_node_action_change:      break;    case svn_node_action_delete:      SVN_ERR(svn_fs_delete(rb->txn_root, nb->path, pool));      break;    case svn_node_action_add:      SVN_ERR(maybe_add_with_history(nb, rb, pool));      break;    case svn_node_action_replace:      SVN_ERR(svn_fs_delete(rb->txn_root, nb->path, pool));      SVN_ERR(maybe_add_with_history(nb, rb, pool));      break;    }  *node_baton = nb;  return SVN_NO_ERROR;}
开发者ID:2asoft,项目名称:freebsd,代码行数:65,


示例10: notify

//.........这里部分代码省略.........    case svn_wc_notify_update_external:      /* Remember that we're now "inside" an externals definition. */      nb->in_external = TRUE;      /* Currently this is used for checkouts and switches too.  If we         want different output, we'll have to add new actions. */      if ((err = svn_cmdline_printf(pool,                                    _("/nFetching external item into '%s':/n"),                                    path_local)))        goto print_error;      break;    case svn_wc_notify_failed_external:      /* If we are currently inside the handling of an externals         definition, then we can simply present n->err as a warning         and feel confident that after this, we aren't handling that         externals definition any longer. */      if (nb->in_external)        {          svn_handle_warning2(stderr, n->err, "svn: ");          nb->in_external = FALSE;          if ((err = svn_cmdline_printf(pool, "/n")))            goto print_error;        }      /* Otherwise, we'll just print two warnings.  Why?  Because         svn_handle_warning2() only shows the single "best message",         but we have two pretty important ones: that the external at         '/some/path' didn't pan out, and then the more specific         reason why (from n->err). */      else        {          svn_error_t *warn_err =            svn_error_createf(SVN_ERR_BASE, NULL,                              _("Error handling externals definition for '%s':"),                              path_local);          svn_handle_warning2(stderr, warn_err, "svn: ");          svn_error_clear(warn_err);          svn_handle_warning2(stderr, n->err, "svn: ");        }      break;    case svn_wc_notify_update_started:      if (! (nb->in_external ||             nb->is_checkout ||             nb->is_export))        {          if ((err = svn_cmdline_printf(pool, _("Updating '%s':/n"),                                        path_local)))            goto print_error;        }      break;    case svn_wc_notify_update_completed:      {        if (SVN_IS_VALID_REVNUM(n->revision))          {            if (nb->is_export)              {                if ((err = svn_cmdline_printf                     (pool, nb->in_external                      ? _("Exported external at revision %ld./n")                      : _("Exported revision %ld./n"),                      n->revision)))                  goto print_error;              }
开发者ID:dtrebbien,项目名称:subversion,代码行数:67,


示例11: svn_client__get_revision_number

svn_error_t *svn_client__get_revision_number(svn_revnum_t *revnum,                                svn_revnum_t *youngest_rev,                                svn_wc_context_t *wc_ctx,                                const char *local_abspath,                                svn_ra_session_t *ra_session,                                const svn_opt_revision_t *revision,                                apr_pool_t *scratch_pool){  switch (revision->kind)    {    case svn_opt_revision_unspecified:      *revnum = SVN_INVALID_REVNUM;      break;    case svn_opt_revision_number:      *revnum = revision->value.number;      break;    case svn_opt_revision_head:      /* If our caller provided a value for HEAD that he wants us to         use, we'll use it.  Otherwise, we have to query the         repository (and possible return our fetched value in         *YOUNGEST_REV, too). */      if (youngest_rev && SVN_IS_VALID_REVNUM(*youngest_rev))        {          *revnum = *youngest_rev;        }      else        {          if (! ra_session)            return svn_error_create(SVN_ERR_CLIENT_RA_ACCESS_REQUIRED,                                    NULL, NULL);          SVN_ERR(svn_ra_get_latest_revnum(ra_session, revnum, scratch_pool));          if (youngest_rev)            *youngest_rev = *revnum;        }      break;    case svn_opt_revision_working:    case svn_opt_revision_base:      {        svn_error_t *err;        /* Sanity check. */        if (local_abspath == NULL)          return svn_error_create(SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED,                                  NULL, NULL);        /* The BASE, COMMITTED, and PREV revision keywords do not           apply to URLs. */        if (svn_path_is_url(local_abspath))          goto invalid_rev_arg;        err = svn_wc__node_get_origin(NULL, revnum, NULL, NULL, NULL, NULL,                                      wc_ctx, local_abspath, TRUE,                                      scratch_pool, scratch_pool);        /* Return the same error as older code did (before and at r935091).           At least svn_client_proplist4 promises SVN_ERR_ENTRY_NOT_FOUND. */        if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)          {            svn_error_clear(err);            return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,                                     _("'%s' is not under version control"),                                     svn_dirent_local_style(local_abspath,                                                            scratch_pool));          }        else          SVN_ERR(err);        if (! SVN_IS_VALID_REVNUM(*revnum))          return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,                                   _("Path '%s' has no committed "                                     "revision"),                                   svn_dirent_local_style(local_abspath,                                                          scratch_pool));      }      break;    case svn_opt_revision_committed:    case svn_opt_revision_previous:      {        /* Sanity check. */        if (local_abspath == NULL)          return svn_error_create(SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED,                                  NULL, NULL);        /* The BASE, COMMITTED, and PREV revision keywords do not           apply to URLs. */        if (svn_path_is_url(local_abspath))          goto invalid_rev_arg;        SVN_ERR(svn_wc__node_get_changed_info(revnum, NULL, NULL,                                              wc_ctx, local_abspath,                                              scratch_pool, scratch_pool));        if (! SVN_IS_VALID_REVNUM(*revnum))          return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,                                   _("Path '%s' has no committed "                                     "revision"),//.........这里部分代码省略.........
开发者ID:Alkzndr,项目名称:freebsd,代码行数:101,


示例12: svn_repos_dump_fs3

/* The main dumper. */svn_error_t *svn_repos_dump_fs3(svn_repos_t *repos,                   svn_stream_t *stream,                   svn_revnum_t start_rev,                   svn_revnum_t end_rev,                   svn_boolean_t incremental,                   svn_boolean_t use_deltas,                   svn_repos_notify_func_t notify_func,                   void *notify_baton,                   svn_cancel_func_t cancel_func,                   void *cancel_baton,                   apr_pool_t *pool){  const svn_delta_editor_t *dump_editor;  void *dump_edit_baton = NULL;  svn_revnum_t i;  svn_fs_t *fs = svn_repos_fs(repos);  apr_pool_t *subpool = svn_pool_create(pool);  svn_revnum_t youngest;  const char *uuid;  int version;  svn_boolean_t found_old_reference = FALSE;  svn_boolean_t found_old_mergeinfo = FALSE;  svn_repos_notify_t *notify;  /* Determine the current youngest revision of the filesystem. */  SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));  /* Use default vals if necessary. */  if (! SVN_IS_VALID_REVNUM(start_rev))    start_rev = 0;  if (! SVN_IS_VALID_REVNUM(end_rev))    end_rev = youngest;  if (! stream)    stream = svn_stream_empty(pool);  /* Validate the revisions. */  if (start_rev > end_rev)    return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,                             _("Start revision %ld"                               " is greater than end revision %ld"),                             start_rev, end_rev);  if (end_rev > youngest)    return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,                             _("End revision %ld is invalid "                               "(youngest revision is %ld)"),                             end_rev, youngest);  if ((start_rev == 0) && incremental)    incremental = FALSE; /* revision 0 looks the same regardless of                            whether or not this is an incremental                            dump, so just simplify things. */  /* Write out the UUID. */  SVN_ERR(svn_fs_get_uuid(fs, &uuid, pool));  /* If we're not using deltas, use the previous version, for     compatibility with svn 1.0.x. */  version = SVN_REPOS_DUMPFILE_FORMAT_VERSION;  if (!use_deltas)    version--;  /* Write out "general" metadata for the dumpfile.  In this case, a     magic header followed by a dumpfile format version. */  SVN_ERR(svn_stream_printf(stream, pool,                            SVN_REPOS_DUMPFILE_MAGIC_HEADER ": %d/n/n",                            version));  SVN_ERR(svn_stream_printf(stream, pool, SVN_REPOS_DUMPFILE_UUID                            ": %s/n/n", uuid));  /* Create a notify object that we can reuse in the loop. */  if (notify_func)    notify = svn_repos_notify_create(svn_repos_notify_dump_rev_end,                                     pool);  /* Main loop:  we're going to dump revision i.  */  for (i = start_rev; i <= end_rev; i++)    {      svn_revnum_t from_rev, to_rev;      svn_fs_root_t *to_root;      svn_boolean_t use_deltas_for_rev;      svn_pool_clear(subpool);      /* Check for cancellation. */      if (cancel_func)        SVN_ERR(cancel_func(cancel_baton));      /* Special-case the initial revision dump: it needs to contain         *all* nodes, because it's the foundation of all future         revisions in the dumpfile. */      if ((i == start_rev) && (! incremental))        {          /* Special-special-case a dump of revision 0. */          if (i == 0)            {              /* Just write out the one revision 0 record and move on.                 The parser might want to use its properties. */              SVN_ERR(write_revision_record(stream, fs, 0, subpool));              to_rev = 0;//.........这里部分代码省略.........
开发者ID:mommel,项目名称:alien-svn,代码行数:101,


示例13: svn_repos_verify_fs2

svn_error_t *svn_repos_verify_fs2(svn_repos_t *repos,                     svn_revnum_t start_rev,                     svn_revnum_t end_rev,                     svn_repos_notify_func_t notify_func,                     void *notify_baton,                     svn_cancel_func_t cancel_func,                     void *cancel_baton,                     apr_pool_t *pool){  svn_fs_t *fs = svn_repos_fs(repos);  svn_revnum_t youngest;  svn_revnum_t rev;  apr_pool_t *iterpool = svn_pool_create(pool);  svn_repos_notify_t *notify;  /* Determine the current youngest revision of the filesystem. */  SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));  /* Use default vals if necessary. */  if (! SVN_IS_VALID_REVNUM(start_rev))    start_rev = 0;  if (! SVN_IS_VALID_REVNUM(end_rev))    end_rev = youngest;  /* Validate the revisions. */  if (start_rev > end_rev)    return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,                             _("Start revision %ld"                               " is greater than end revision %ld"),                             start_rev, end_rev);  if (end_rev > youngest)    return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,                             _("End revision %ld is invalid "                               "(youngest revision is %ld)"),                             end_rev, youngest);  /* Create a notify object that we can reuse within the loop. */  if (notify_func)    notify = svn_repos_notify_create(svn_repos_notify_verify_rev_end,                                     pool);  for (rev = start_rev; rev <= end_rev; rev++)    {      svn_delta_editor_t *dump_editor;      void *dump_edit_baton;      const svn_delta_editor_t *cancel_editor;      void *cancel_edit_baton;      svn_fs_root_t *to_root;      apr_hash_t *props;      svn_pool_clear(iterpool);      /* Get cancellable dump editor, but with our close_directory handler. */      SVN_ERR(get_dump_editor((const svn_delta_editor_t **)&dump_editor,                              &dump_edit_baton, fs, rev, "",                              svn_stream_empty(pool),                              notify_func, notify_baton,                              start_rev,                              FALSE, TRUE, /* use_deltas, verify */                              iterpool));      dump_editor->close_directory = verify_close_directory;      SVN_ERR(svn_delta_get_cancellation_editor(cancel_func, cancel_baton,                                                dump_editor, dump_edit_baton,                                                &cancel_editor,                                                &cancel_edit_baton,                                                iterpool));      SVN_ERR(svn_fs_revision_root(&to_root, fs, rev, iterpool));      SVN_ERR(svn_repos_replay2(to_root, "", SVN_INVALID_REVNUM, FALSE,                                cancel_editor, cancel_edit_baton,                                NULL, NULL, iterpool));      SVN_ERR(svn_fs_revision_proplist(&props, fs, rev, iterpool));      if (notify_func)        {          notify->revision = rev;          notify_func(notify_baton, notify, iterpool);        }    }  /* We're done. */  if (notify_func)    {      notify = svn_repos_notify_create(svn_repos_notify_verify_end, iterpool);      notify_func(notify_baton, notify, iterpool);    }  svn_pool_destroy(iterpool);  return SVN_NO_ERROR;}
开发者ID:mommel,项目名称:alien-svn,代码行数:92,


示例14: SVN_ERR

static svn_error_t *try_auth(svn_ra_svn_conn_t *conn,                             sasl_conn_t *sasl_ctx,                             apr_pool_t *pool,                             server_baton_t *b,                             svn_boolean_t *success){  const char *out, *mech;  const svn_string_t *arg = NULL, *in;  unsigned int outlen;  int result;  svn_boolean_t use_base64;  *success = FALSE;  /* Read the client's chosen mech and the initial token. */  SVN_ERR(svn_ra_svn__read_tuple(conn, pool, "w(?s)", &mech, &in));  if (strcmp(mech, "EXTERNAL") == 0 && !in)    in = svn_string_create(b->client_info->tunnel_user, pool);  else if (in)    in = svn_base64_decode_string(in, pool);  /* For CRAM-MD5, we don't base64-encode stuff. */  use_base64 = (strcmp(mech, "CRAM-MD5") != 0);  /* sasl uses unsigned int for the length of strings, we use apr_size_t   * which may not be the same size.  Deal with potential integer overflow */  if (in && in->len > UINT_MAX)    return svn_error_createf(SVN_ERR_RA_NOT_AUTHORIZED, NULL,                             _("Initial token is too long"));  result = svn_sasl__server_start(sasl_ctx, mech,                                  in ? in->data : NULL,                                  in ? (unsigned int) in->len : 0,                                  &out, &outlen);  if (result != SASL_OK && result != SASL_CONTINUE)    return fail_auth(conn, pool, sasl_ctx);  while (result == SASL_CONTINUE)    {      svn_ra_svn__item_t *item;      arg = svn_string_ncreate(out, outlen, pool);      /* Encode what we send to the client. */      if (use_base64)        arg = svn_base64_encode_string2(arg, TRUE, pool);      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(s)", "step", arg));      /* Read and decode the client response. */      SVN_ERR(svn_ra_svn__read_item(conn, pool, &item));      if (item->kind != SVN_RA_SVN_STRING)        return SVN_NO_ERROR;      in = &item->u.string;      if (use_base64)        in = svn_base64_decode_string(in, pool);      if (in->len > UINT_MAX)        return svn_error_createf(SVN_ERR_RA_NOT_AUTHORIZED, NULL,                                 _("Step response is too long"));      result = svn_sasl__server_step(sasl_ctx, in->data,                                     (unsigned int) in->len,                                     &out, &outlen);    }  if (result != SASL_OK)    return fail_auth(conn, pool, sasl_ctx);  /* Send our last response, if necessary. */  if (outlen)    arg = svn_base64_encode_string2(svn_string_ncreate(out, outlen, pool), TRUE,                                    pool);  else    arg = NULL;  *success = TRUE;  SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(?s)", "success", arg));  return SVN_NO_ERROR;}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:83,


示例15: merge_closed

/* Conforms to svn_ra_serf__xml_closed_t  */static svn_error_t *merge_closed(svn_ra_serf__xml_estate_t *xes,             void *baton,             int leaving_state,             const svn_string_t *cdata,             apr_hash_t *attrs,             apr_pool_t *scratch_pool){  merge_context_t *merge_ctx = baton;  if (leaving_state == RESPONSE)    {      const char *rtype;      rtype = svn_hash_gets(attrs, "resourcetype");      /* rtype can only be "baseline" or "collection" (or NULL). We can         keep this check simple.  */      if (rtype && *rtype == 'b')        {          const char *rev_str;          rev_str = svn_hash_gets(attrs, "revision");          if (rev_str)            {              apr_int64_t rev;              SVN_ERR(svn_cstring_atoi64(&rev, rev_str));              merge_ctx->commit_info->revision = (svn_revnum_t)rev;            }          else            merge_ctx->commit_info->revision = SVN_INVALID_REVNUM;          merge_ctx->commit_info->date =              apr_pstrdup(merge_ctx->pool,                          svn_hash_gets(attrs, "date"));          merge_ctx->commit_info->author =              apr_pstrdup(merge_ctx->pool,                          svn_hash_gets(attrs, "author"));          merge_ctx->commit_info->post_commit_err =             apr_pstrdup(merge_ctx->pool,                         svn_hash_gets(attrs, "post-commit-err"));        }      else        {          const char *href;          href = svn_urlpath__skip_ancestor(                   merge_ctx->merge_url,                   svn_hash_gets(attrs, "href"));          if (href == NULL)            return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,                                     _("A MERGE response for '%s' is not "                                       "a child of the destination ('%s')"),                                     href, merge_ctx->merge_url);          /* We now need to dive all the way into the WC to update the             base VCC url.  */          if (!SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(merge_ctx->session)              && merge_ctx->session->wc_callbacks->push_wc_prop)            {              const char *checked_in;              svn_string_t checked_in_str;              checked_in = svn_hash_gets(attrs, "checked-in");              checked_in_str.data = checked_in;              checked_in_str.len = strlen(checked_in);              SVN_ERR(merge_ctx->session->wc_callbacks->push_wc_prop(                        merge_ctx->session->wc_callback_baton,                        href,                        SVN_RA_SERF__WC_CHECKED_IN_URL,                        &checked_in_str,                        scratch_pool));            }        }    }  else if (leaving_state == BASELINE)    {      svn_ra_serf__xml_note(xes, RESPONSE, "resourcetype", "baseline");    }  else if (leaving_state == COLLECTION)    {      svn_ra_serf__xml_note(xes, RESPONSE, "resourcetype", "collection");    }  else    {      const char *name;      const char *value = cdata->data;      if (leaving_state == HREF)        {          name = "href";          value = svn_urlpath__canonicalize(value, scratch_pool);        }      else if (leaving_state == CHECKED_IN)//.........这里部分代码省略.........
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:101,


示例16: svn_ra_neon__get_locations

svn_error_t *svn_ra_neon__get_locations(svn_ra_session_t *session,                           apr_hash_t **locations,                           const char *relative_path,                           svn_revnum_t peg_revision,                           const apr_array_header_t *location_revisions,                           apr_pool_t *pool){  svn_ra_neon__session_t *ras = session->priv;  svn_stringbuf_t *request_body;  svn_error_t *err;  get_locations_baton_t request_baton;  const char *relative_path_quoted;  const char *bc_url;  const char *bc_relative;  const char *final_bc_url;  int i;  int status_code = 0;  *locations = apr_hash_make(pool);  request_body = svn_stringbuf_create("", pool);  svn_stringbuf_appendcstr(request_body,                           "<?xml version=/"1.0/" encoding=/"utf-8/"?>" DEBUG_CR                           "<S:get-locations xmlns:S=/"" SVN_XML_NAMESPACE                           "/" xmlns:D=/"DAV:/">" DEBUG_CR);  svn_stringbuf_appendcstr(request_body, "<S:path>");  /* We need to escape the path XML-wise. */  relative_path_quoted = apr_xml_quote_string(pool, relative_path, 0);  svn_stringbuf_appendcstr(request_body, relative_path_quoted);  svn_stringbuf_appendcstr(request_body, "</S:path>" DEBUG_CR);  svn_stringbuf_appendcstr(request_body,                           apr_psprintf(pool,                                        "<S:peg-revision>%ld"                                        "</S:peg-revision>" DEBUG_CR,                                        peg_revision));  for (i = 0; i < location_revisions->nelts; ++i)    {      svn_revnum_t rev = APR_ARRAY_IDX(location_revisions, i, svn_revnum_t);      svn_stringbuf_appendcstr(request_body,                               apr_psprintf(pool,                                            "<S:location-revision>%ld"                                            "</S:location-revision>" DEBUG_CR,                                            rev));    }  svn_stringbuf_appendcstr(request_body, "</S:get-locations>");  request_baton.ras = ras;  request_baton.hash = *locations;  request_baton.pool = pool;  /* ras's URL may not exist in HEAD, and thus it's not safe to send     it as the main argument to the REPORT request; it might cause     dav_get_resource() to choke on the server.  So instead, we pass a     baseline-collection URL, which we get from the peg revision.  */  SVN_ERR(svn_ra_neon__get_baseline_info(&bc_url, &bc_relative, NULL, ras,                                         ras->url->data, peg_revision, pool));  final_bc_url = svn_path_url_add_component2(bc_url, bc_relative, pool);  err = svn_ra_neon__parsed_request(ras, "REPORT", final_bc_url,                                    request_body->data, NULL, NULL,                                    gloc_start_element, NULL, NULL,                                    &request_baton, NULL, &status_code,                                    FALSE, pool);  /* Map status 501: Method Not Implemented to our not implemented error.     1.0.x servers and older don't support this report. */  if (status_code == 501)    return svn_error_createf(SVN_ERR_RA_NOT_IMPLEMENTED, err,                             _("'%s' REPORT not implemented"), "get-locations");  return err;}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:76,


示例17: svn_nls_init

svn_error_t *svn_nls_init(void){    svn_error_t *err = SVN_NO_ERROR;#ifdef ENABLE_NLS#ifdef WIN32    {        WCHAR ucs2_path[MAX_PATH];        char* utf8_path;        const char* internal_path;        apr_pool_t* pool;        apr_status_t apr_err;        apr_size_t inwords, outbytes, outlength;        apr_pool_create(&pool, 0);        /* get exe name - our locale info will be in '../share/locale' */        inwords = GetModuleFileNameW(0, ucs2_path,                                     sizeof(ucs2_path) / sizeof(ucs2_path[0]));        if (! inwords)        {            /* We must be on a Win9x machine, so attempt to get an ANSI path,               and convert it to Unicode. */            CHAR ansi_path[MAX_PATH];            if (GetModuleFileNameA(0, ansi_path, sizeof(ansi_path)))            {                inwords =                    MultiByteToWideChar(CP_ACP, 0, ansi_path, -1, ucs2_path,                                        sizeof(ucs2_path) / sizeof(ucs2_path[0]));                if (! inwords) {                    err =                        svn_error_createf(APR_EINVAL, NULL,                                          _("Can't convert string to UCS-2: '%s'"),                                          ansi_path);                }            }            else            {                err = svn_error_create(APR_EINVAL, NULL,                                       _("Can't get module file name"));            }        }        if (! err)        {            outbytes = outlength = 3 * (inwords + 1);            utf8_path = apr_palloc(pool, outlength);            apr_err = apr_conv_ucs2_to_utf8(ucs2_path, &inwords,                                            utf8_path, &outbytes);            if (!apr_err && (inwords > 0 || outbytes == 0))                apr_err = APR_INCOMPLETE;            if (apr_err)            {                err = svn_error_createf(apr_err, NULL,                                        _("Can't convert module path "                                          "to UTF-8 from UCS-2: '%s'"),                                        ucs2_path);            }            else            {                utf8_path[outlength - outbytes] = '/0';                internal_path = svn_path_internal_style(utf8_path, pool);                /* get base path name */                internal_path = svn_path_dirname(internal_path, pool);                internal_path = svn_path_join(internal_path,                                              SVN_LOCALE_RELATIVE_PATH,                                              pool);                bindtextdomain(PACKAGE_NAME, internal_path);            }        }        svn_pool_destroy(pool);    }#else    bindtextdomain(PACKAGE_NAME, SVN_LOCALE_DIR);#ifdef HAVE_BIND_TEXTDOMAIN_CODESET    bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");#endif#endif#endif    return err;}
开发者ID:vocho,项目名称:openqnx,代码行数:83,


示例18: test_stream_seek_file

static svn_error_t *test_stream_seek_file(apr_pool_t *pool){  static const char *file_data[2] = {"One", "Two"};  svn_stream_t *stream;  svn_stringbuf_t *line;  svn_boolean_t eof;  apr_file_t *f;  static const char *fname = "test_stream_seek.txt";  int j;  apr_status_t status;  static const char *NL = APR_EOL_STR;  svn_stream_mark_t *mark;  status = apr_file_open(&f, fname, (APR_READ | APR_WRITE | APR_CREATE |                         APR_TRUNCATE | APR_DELONCLOSE), APR_OS_DEFAULT, pool);  if (status != APR_SUCCESS)    return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, "Cannot open '%s'",                             fname);  /* Create the file. */  for (j = 0; j < 2; j++)    {      apr_size_t len;      len = strlen(file_data[j]);      status = apr_file_write(f, file_data[j], &len);      if (status || len != strlen(file_data[j]))        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,                                 "Cannot write to '%s'", fname);      len = strlen(NL);      status = apr_file_write(f, NL, &len);      if (status || len != strlen(NL))        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,                                 "Cannot write to '%s'", fname);    }  /* Create a stream to read from the file. */  stream = svn_stream_from_aprfile2(f, FALSE, pool);  SVN_ERR(svn_stream_reset(stream));  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[0]) == 0);  /* Set a mark at the beginning of the second line of the file. */  SVN_ERR(svn_stream_mark(stream, &mark, pool));  /* Read the second line and then seek back to the mark. */  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);  SVN_ERR(svn_stream_seek(stream, mark));  /* The next read should return the second line again. */  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);  /* The next read should return EOF. */  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(eof);  /* Go back to the beginning of the last line and try to skip it   * NOT including the EOL. */  SVN_ERR(svn_stream_seek(stream, mark));  SVN_ERR(svn_stream_skip(stream, strlen(file_data[1])));  /* The remaining line should be empty */  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(! eof && strcmp(line->data, "") == 0);  /* The next read should return EOF. */  SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));  SVN_TEST_ASSERT(eof);  SVN_ERR(svn_stream_close(stream));  return SVN_NO_ERROR;}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:70,


示例19: main

intmain (int argc, const char * const *argv){  svn_error_t *err;  apr_status_t apr_err;  apr_allocator_t *allocator;  apr_pool_t *pool;  const svn_opt_subcommand_desc_t *subcommand = NULL;  struct svnindex_opt_state opt_state;  apr_getopt_t *os;    int opt_id;  apr_array_header_t *received_opts;  int i;  /* Initialize the app. */  if (svn_cmdline_init ("svnindex", stderr) != EXIT_SUCCESS)    return EXIT_FAILURE;  /* Create our top-level pool.  Use a seperate mutexless allocator,   * given this application is single threaded.   */  if (apr_allocator_create (&allocator))    return EXIT_FAILURE;  apr_allocator_max_free_set (allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);  pool = svn_pool_create_ex (NULL, allocator);  apr_allocator_owner_set (allocator, pool);  received_opts = apr_array_make (pool, SVN_OPT_MAX_OPTIONS, sizeof (int));  /* Check library versions */  err = check_lib_versions ();  if (err)    return svn_cmdline_handle_exit_error (err, pool, "svnindex: ");  /* Initialize the FS library. */  err = svn_fs_initialize (pool);  if (err)    return svn_cmdline_handle_exit_error (err, pool, "svnindex: ");  if (argc <= 1)    {      subcommand_help (NULL, NULL, pool);      svn_pool_destroy (pool);      return EXIT_FAILURE;    }  /* Initialize opt_state. */  memset (&opt_state, 0, sizeof (opt_state));  opt_state.start_revision.kind = svn_opt_revision_unspecified;  opt_state.end_revision.kind = svn_opt_revision_unspecified;  /* Parse options. */  apr_getopt_init (&os, pool, argc, argv);  os->interleave = 1;  while (1)    {      const char *opt_arg;      const char *utf8_opt_arg;      /* Parse the next option. */      apr_err = apr_getopt_long (os, options_table, &opt_id, &opt_arg);      if (APR_STATUS_IS_EOF (apr_err))        break;      else if (apr_err)        {          subcommand_help (NULL, NULL, pool);          svn_pool_destroy (pool);          return EXIT_FAILURE;        }      /* Stash the option code in an array before parsing it. */      APR_ARRAY_PUSH (received_opts, int) = opt_id;      switch (opt_id) {      case 'r':        {          if (opt_state.start_revision.kind != svn_opt_revision_unspecified)            {              err = svn_error_create                (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                 _("Multiple revision arguments encountered; "                   "try '-r M:N' instead of '-r M -r N'"));              return svn_cmdline_handle_exit_error (err, pool, "svnindex: ");            }          if (svn_opt_parse_revision (&(opt_state.start_revision),                                      &(opt_state.end_revision),                                      opt_arg, pool) != 0)            {              err = svn_utf_cstring_to_utf8 (&utf8_opt_arg, opt_arg,                                             pool);              if (! err)                err = svn_error_createf                  (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                   _("Syntax error in revision argument '%s'"),                   utf8_opt_arg);//.........这里部分代码省略.........
开发者ID:ejrh,项目名称:ejrh,代码行数:101,


示例20: svn_fs_bdb__changes_fetch

svn_error_t *svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,                          svn_fs_t *fs,                          const char *key,                          trail_t *trail,                          apr_pool_t *pool){  base_fs_data_t *bfd = fs->fsap_data;  DBC *cursor;  DBT query, result;  int db_err = 0, db_c_err = 0;  svn_error_t *err = SVN_NO_ERROR;  apr_hash_t *changes = apr_hash_make(pool);  apr_pool_t *subpool = svn_pool_create(pool);  /* Get a cursor on the first record matching KEY, and then loop over     the records, adding them to the return array. */  svn_fs_base__trail_debug(trail, "changes", "cursor");  SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),                   bfd->changes->cursor(bfd->changes, trail->db_txn,                                        &cursor, 0)));  /* Advance the cursor to the key that we're looking for. */  svn_fs_base__str_to_dbt(&query, key);  svn_fs_base__result_dbt(&result);  db_err = svn_bdb_dbc_get(cursor, &query, &result, DB_SET);  if (! db_err)    svn_fs_base__track_dbt(&result, pool);  while (! db_err)    {      change_t *change;      svn_skel_t *result_skel;      /* Clear the per-iteration subpool. */      svn_pool_clear(subpool);      /* RESULT now contains a change record associated with KEY.  We         need to parse that skel into an change_t structure ...  */      result_skel = svn_skel__parse(result.data, result.size, subpool);      if (! result_skel)        {          err = svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,                                  _("Error reading changes for key '%s'"),                                  key);          goto cleanup;        }      err = svn_fs_base__parse_change_skel(&change, result_skel, subpool);      if (err)        goto cleanup;      /* ... and merge it with our return hash.  */      err = fold_change(changes, change);      if (err)        goto cleanup;      /* Now, if our change was a deletion or replacement, we have to         blow away any changes thus far on paths that are (or, were)         children of this path.         ### i won't bother with another iteration pool here -- at             most we talking about a few extra dups of paths into what             is already a temporary subpool.      */      if ((change->kind == svn_fs_path_change_delete)          || (change->kind == svn_fs_path_change_replace))        {          apr_hash_index_t *hi;          for (hi = apr_hash_first(subpool, changes);               hi;               hi = apr_hash_next(hi))            {              /* KEY is the path. */              const void *hashkey;              apr_ssize_t klen;              const char *child_relpath;              apr_hash_this(hi, &hashkey, &klen, NULL);              /* If we come across our own path, ignore it.                 If we come across a child of our path, remove it. */              child_relpath = svn_fspath__skip_ancestor(change->path, hashkey);              if (child_relpath && *child_relpath)                apr_hash_set(changes, hashkey, klen, NULL);            }        }      /* Advance the cursor to the next record with this same KEY, and         fetch that record. */      svn_fs_base__result_dbt(&result);      db_err = svn_bdb_dbc_get(cursor, &query, &result, DB_NEXT_DUP);      if (! db_err)        svn_fs_base__track_dbt(&result, pool);    }  /* Destroy the per-iteration subpool. */  svn_pool_destroy(subpool);  /* If there are no (more) change records for this KEY, we're     finished.  Just return the (possibly empty) array.  Any other//.........这里部分代码省略.........
开发者ID:Alkzndr,项目名称:freebsd,代码行数:101,


示例21: svn_fs_fs__set_rep_reference

svn_error_t *svn_fs_fs__set_rep_reference(svn_fs_t *fs,                             representation_t *rep,                             svn_boolean_t reject_dup,                             apr_pool_t *pool){  fs_fs_data_t *ffd = fs->fsap_data;  svn_sqlite__stmt_t *stmt;  svn_error_t *err;  SVN_ERR_ASSERT(ffd->rep_sharing_allowed);  if (! ffd->rep_cache_db)    SVN_ERR(svn_fs_fs__open_rep_cache(fs, pool));  /* We only allow SHA1 checksums in this table. */  if (rep->sha1_checksum == NULL)    return svn_error_create(SVN_ERR_BAD_CHECKSUM_KIND, NULL,                            _("Only SHA1 checksums can be used as keys in the "                              "rep_cache table./n"));  SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db, STMT_SET_REP));  SVN_ERR(svn_sqlite__bindf(stmt, "siiii",                            svn_checksum_to_cstring(rep->sha1_checksum, pool),                            (apr_int64_t) rep->revision,                            (apr_int64_t) rep->offset,                            (apr_int64_t) rep->size,                            (apr_int64_t) rep->expanded_size));  err = svn_sqlite__insert(NULL, stmt);  if (err)    {      representation_t *old_rep;      if (err->apr_err != SVN_ERR_SQLITE_CONSTRAINT)        return svn_error_trace(err);      svn_error_clear(err);      /* Constraint failed so the mapping for SHA1_CHECKSUM->REP         should exist.  If so, and the value is the same one we were         about to write, that's cool -- just do nothing.  If, however,         the value is *different*, that's a red flag!  */      SVN_ERR(svn_fs_fs__get_rep_reference(&old_rep, fs, rep->sha1_checksum,                                           pool));      if (old_rep)        {          if (reject_dup && ((old_rep->revision != rep->revision)                             || (old_rep->offset != rep->offset)                             || (old_rep->size != rep->size)                             || (old_rep->expanded_size != rep->expanded_size)))            return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,                                     apr_psprintf(pool,                              _("Representation key for checksum '%%s' exists "                                "in filesystem '%%s' with a different value "                                "(%%ld,%%%s,%%%s,%%%s) than what we were about "                                "to store (%%ld,%%%s,%%%s,%%%s)"),                              APR_OFF_T_FMT, SVN_FILESIZE_T_FMT,                              SVN_FILESIZE_T_FMT, APR_OFF_T_FMT,                              SVN_FILESIZE_T_FMT, SVN_FILESIZE_T_FMT),                 svn_checksum_to_cstring_display(rep->sha1_checksum, pool),                 fs->path, old_rep->revision, old_rep->offset, old_rep->size,                 old_rep->expanded_size, rep->revision, rep->offset, rep->size,                 rep->expanded_size);          else            return SVN_NO_ERROR;        }      else        {          /* Something really odd at this point, we failed to insert the             checksum AND failed to read an existing checksum.  Do we need             to flag this? */        }    }  return SVN_NO_ERROR;}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:77,


示例22: svn_fs_bdb__changes_fetch_raw

svn_error_t *svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,                              svn_fs_t *fs,                              const char *key,                              trail_t *trail,                              apr_pool_t *pool){  base_fs_data_t *bfd = fs->fsap_data;  DBC *cursor;  DBT query, result;  int db_err = 0, db_c_err = 0;  svn_error_t *err = SVN_NO_ERROR;  change_t *change;  apr_array_header_t *changes = apr_array_make(pool, 4, sizeof(change));  /* Get a cursor on the first record matching KEY, and then loop over     the records, adding them to the return array. */  svn_fs_base__trail_debug(trail, "changes", "cursor");  SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),                   bfd->changes->cursor(bfd->changes, trail->db_txn,                                        &cursor, 0)));  /* Advance the cursor to the key that we're looking for. */  svn_fs_base__str_to_dbt(&query, key);  svn_fs_base__result_dbt(&result);  db_err = svn_bdb_dbc_get(cursor, &query, &result, DB_SET);  if (! db_err)    svn_fs_base__track_dbt(&result, pool);  while (! db_err)    {      svn_skel_t *result_skel;      /* RESULT now contains a change record associated with KEY.  We         need to parse that skel into an change_t structure ...  */      result_skel = svn_skel__parse(result.data, result.size, pool);      if (! result_skel)        {          err = svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,                                  _("Error reading changes for key '%s'"),                                  key);          goto cleanup;        }      err = svn_fs_base__parse_change_skel(&change, result_skel, pool);      if (err)        goto cleanup;      /* ... and add it to our return array.  */      APR_ARRAY_PUSH(changes, change_t *) = change;      /* Advance the cursor to the next record with this same KEY, and         fetch that record. */      svn_fs_base__result_dbt(&result);      db_err = svn_bdb_dbc_get(cursor, &query, &result, DB_NEXT_DUP);      if (! db_err)        svn_fs_base__track_dbt(&result, pool);    }  /* If there are no (more) change records for this KEY, we're     finished.  Just return the (possibly empty) array.  Any other     error, however, needs to get handled appropriately.  */  if (db_err && (db_err != DB_NOTFOUND))    err = BDB_WRAP(fs, N_("fetching changes"), db_err); cleanup:  /* Close the cursor. */  db_c_err = svn_bdb_dbc_close(cursor);  /* If we had an error prior to closing the cursor, return the error. */  if (err)    return svn_error_trace(err);  /* If our only error thus far was when we closed the cursor, return     that error. */  if (db_c_err)    SVN_ERR(BDB_WRAP(fs, N_("closing changes cursor"), db_c_err));  /* Finally, set our return variable and get outta here. */  *changes_p = changes;  return SVN_NO_ERROR;}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:81,


示例23: svn_client_cat2

svn_error_t *svn_client_cat2(svn_stream_t *out,                const char *path_or_url,                const svn_opt_revision_t *peg_revision,                const svn_opt_revision_t *revision,                svn_client_ctx_t *ctx,                apr_pool_t *pool){  svn_ra_session_t *ra_session;  svn_revnum_t rev;  svn_string_t *eol_style;  svn_string_t *keywords;  apr_hash_t *props;  const char *url;  svn_stream_t *output = out;  svn_error_t *err;  /* ### Inconsistent default revision logic in this command. */  if (peg_revision->kind == svn_opt_revision_unspecified)    {      peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision,                                                            path_or_url);      revision = svn_cl__rev_default_to_head_or_base(revision, path_or_url);    }  else    {      peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision,                                                            path_or_url);      revision = svn_cl__rev_default_to_peg(revision, peg_revision);    }  if (! svn_path_is_url(path_or_url)      && SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(peg_revision->kind)      && SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(revision->kind))    {      const char *local_abspath;      svn_stream_t *normal_stream;      SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url, pool));      SVN_ERR(svn_client__get_normalized_stream(&normal_stream, ctx->wc_ctx,                                            local_abspath, revision, TRUE, FALSE,                                            ctx->cancel_func, ctx->cancel_baton,                                            pool, pool));      /* We don't promise to close output, so disown it to ensure we don't. */      output = svn_stream_disown(output, pool);      return svn_error_trace(svn_stream_copy3(normal_stream, output,                                              ctx->cancel_func,                                              ctx->cancel_baton, pool));    }  /* Get an RA plugin for this filesystem object. */  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &rev,                                           &url, path_or_url, NULL,                                           peg_revision,                                           revision, ctx, pool));  /* Grab some properties we need to know in order to figure out if anything     special needs to be done with this file. */  err = svn_ra_get_file(ra_session, "", rev, NULL, NULL, &props, pool);  if (err)    {      if (err->apr_err == SVN_ERR_FS_NOT_FILE)        {          return svn_error_createf(SVN_ERR_CLIENT_IS_DIRECTORY, err,                                   _("URL '%s' refers to a directory"), url);        }      else        {          return svn_error_trace(err);        }    }  eol_style = apr_hash_get(props, SVN_PROP_EOL_STYLE, APR_HASH_KEY_STRING);  keywords = apr_hash_get(props, SVN_PROP_KEYWORDS, APR_HASH_KEY_STRING);  if (eol_style || keywords)    {      /* It's a file with no special eol style or keywords. */      svn_subst_eol_style_t eol;      const char *eol_str;      apr_hash_t *kw;      if (eol_style)        svn_subst_eol_style_from_value(&eol, &eol_str, eol_style->data);      else        {          eol = svn_subst_eol_style_none;          eol_str = NULL;        }      if (keywords)        {          svn_string_t *cmt_rev, *cmt_date, *cmt_author;          apr_time_t when = 0;          cmt_rev = apr_hash_get(props, SVN_PROP_ENTRY_COMMITTED_REV,                                 APR_HASH_KEY_STRING);//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:101,


示例24: svn_cl__log

//.........这里部分代码省略.........          if (svn_path_is_url(target))            return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,                                    _("Only relative paths can be specified "                                      "after a URL"));        }    }  lb.cancel_func = ctx->cancel_func;  lb.cancel_baton = ctx->cancel_baton;  lb.omit_log_message = opt_state->quiet;  lb.merge_stack = apr_array_make(pool, 0, sizeof(svn_revnum_t));  lb.pool = pool;  if (! opt_state->quiet)    svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE,                         FALSE, FALSE, pool);  if (opt_state->xml)    {      /* If output is not incremental, output the XML header and wrap         everything in a top-level element. This makes the output in         its entirety a well-formed XML document. */      if (! opt_state->incremental)        SVN_ERR(svn_cl__xml_print_header("log", pool));      if (opt_state->all_revprops)        revprops = NULL;      else if (opt_state->revprop_table != NULL)        {          apr_hash_index_t *hi;          revprops = apr_array_make(pool,                                    apr_hash_count(opt_state->revprop_table),                                    sizeof(char *));          for (hi = apr_hash_first(pool, opt_state->revprop_table);               hi != NULL;               hi = apr_hash_next(hi))            {              char *property;              svn_string_t *value;              apr_hash_this(hi, (void *)&property, NULL, (void *)&value);              if (value && value->data[0] != '/0')                return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                                         _("cannot assign with 'with-revprop'"                                           " option (drop the '=')"));              APR_ARRAY_PUSH(revprops, char *) = property;            }        }      else        {          revprops = apr_array_make(pool, 3, sizeof(char *));          APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_AUTHOR;          APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_DATE;          if (!opt_state->quiet)            APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_LOG;        }      SVN_ERR(svn_client_log4(targets,                              &peg_revision,                              &(opt_state->start_revision),                              &(opt_state->end_revision),                              opt_state->limit,                              opt_state->verbose,                              opt_state->stop_on_copy,                              opt_state->use_merge_history,                              revprops,                              log_entry_receiver_xml,                              &lb,                              ctx,                              pool));      if (! opt_state->incremental)        SVN_ERR(svn_cl__xml_print_footer("log", pool));    }  else  /* default output format */    {      revprops = apr_array_make(pool, 3, sizeof(char *));      APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_AUTHOR;      APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_DATE;      if (!opt_state->quiet)        APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_LOG;      SVN_ERR(svn_client_log4(targets,                              &peg_revision,                              &(opt_state->start_revision),                              &(opt_state->end_revision),                              opt_state->limit,                              opt_state->verbose,                              opt_state->stop_on_copy,                              opt_state->use_merge_history,                              revprops,                              log_entry_receiver,                              &lb,                              ctx,                              pool));      if (! opt_state->incremental)        SVN_ERR(svn_cmdline_printf(pool, SEP_STRING));    }  return SVN_NO_ERROR;}
开发者ID:niallo,项目名称:mwbuild,代码行数:101,


示例25: svn_atomic_namespace__create

svn_error_t *svn_atomic_namespace__create(svn_atomic_namespace__t **ns,                             const char *name,                             apr_pool_t *result_pool){  apr_status_t apr_err;  svn_error_t *err;  apr_file_t *file;  apr_mmap_t *mmap;  const char *shm_name, *lock_name;  apr_finfo_t finfo;  apr_pool_t *subpool = svn_pool_create(result_pool);  /* allocate the namespace data structure   */  svn_atomic_namespace__t *new_ns = apr_pcalloc(result_pool, sizeof(**ns));  /* construct the names of the system objects that we need   */  shm_name = apr_pstrcat(subpool, name, SHM_NAME_SUFFIX, NULL);  lock_name = apr_pstrcat(subpool, name, MUTEX_NAME_SUFFIX, NULL);  /* initialize the lock objects   */  SVN_ERR(svn_atomic__init_once(&mutex_initialized, init_thread_mutex, NULL,                                result_pool));  new_ns->mutex.pool = result_pool;  SVN_ERR(svn_io_file_open(&new_ns->mutex.lock_file, lock_name,                           APR_READ | APR_WRITE | APR_CREATE,                           APR_OS_DEFAULT,                           result_pool));  /* Make sure the last user of our lock file will actually remove it.   * Please note that only the last file handle begin closed will actually   * remove the underlying file (see docstring for apr_file_remove).   */  apr_pool_cleanup_register(result_pool, &new_ns->mutex,                            delete_lock_file,                            apr_pool_cleanup_null);  /* Prevent concurrent initialization.   */  SVN_ERR(lock(&new_ns->mutex));  /* First, make sure that the underlying file exists.  If it doesn't   * exist, create one and initialize its content.   */  err = svn_io_file_open(&file, shm_name,                          APR_READ | APR_WRITE | APR_CREATE,                          APR_OS_DEFAULT,                          result_pool);  if (!err)    {      err = svn_io_stat(&finfo, shm_name, APR_FINFO_SIZE, subpool);      if (!err && finfo.size < sizeof(struct shared_data_t))        {           /* Zero all counters, values and names.            */           struct shared_data_t initial_data;           memset(&initial_data, 0, sizeof(initial_data));           err = svn_io_file_write_full(file, &initial_data,                                        sizeof(initial_data), NULL,                                        subpool);        }    }  /* Now, map it into memory.   */  if (!err)    {      apr_err = apr_mmap_create(&mmap, file, 0, sizeof(*new_ns->data),                                APR_MMAP_READ | APR_MMAP_WRITE , result_pool);      if (!apr_err)        new_ns->data = mmap->mm;      else        err = svn_error_createf(apr_err, NULL,                                _("MMAP failed for file '%s'"), shm_name);    }  svn_pool_destroy(subpool);  if (!err && new_ns->data)    {      /* Detect severe cases of corruption (i.e. when some outsider messed       * with our data file)       */      if (new_ns->data->count > MAX_ATOMIC_COUNT)        return svn_error_create(SVN_ERR_CORRUPTED_ATOMIC_STORAGE, 0,                       _("Number of atomics in namespace is too large."));      /* Cache the number of existing, complete entries.  There can't be       * incomplete ones from other processes because we hold the mutex.       * Our process will also not access this information since we are       * either being called from within svn_atomic__init_once or by       * svn_atomic_namespace__create for a new object.       */      new_ns->min_used = new_ns->data->count;      *ns = new_ns;//.........这里部分代码省略.........
开发者ID:ceama,项目名称:freebsd,代码行数:101,


示例26: svn_opt_parse_path

svn_error_t *svn_opt_parse_path(svn_opt_revision_t *rev,                   const char **truepath,                   const char *path /* UTF-8! */,                   apr_pool_t *pool){  const char *peg_rev;  SVN_ERR(svn_opt__split_arg_at_peg_revision(truepath, &peg_rev, path, pool));  /* Parse the peg revision, if one was found */  if (strlen(peg_rev))    {      int ret;      svn_opt_revision_t start_revision, end_revision;      end_revision.kind = svn_opt_revision_unspecified;      if (peg_rev[1] == '/0')  /* looking at empty peg revision */        {          ret = 0;          start_revision.kind = svn_opt_revision_unspecified;          start_revision.value.number = 0;        }      else  /* looking at non-empty peg revision */        {          const char *rev_str = &peg_rev[1];          /* URLs get treated differently from wc paths. */          if (svn_path_is_url(path))            {              /* URLs are URI-encoded, so we look for dates with                 URI-encoded delimeters.  */              size_t rev_len = strlen(rev_str);              if (rev_len > 6                  && rev_str[0] == '%'                  && rev_str[1] == '7'                  && (rev_str[2] == 'B'                      || rev_str[2] == 'b')                  && rev_str[rev_len-3] == '%'                  && rev_str[rev_len-2] == '7'                  && (rev_str[rev_len-1] == 'D'                      || rev_str[rev_len-1] == 'd'))                {                  rev_str = svn_path_uri_decode(rev_str, pool);                }            }          ret = svn_opt_parse_revision(&start_revision,                                       &end_revision,                                       rev_str, pool);        }      if (ret || end_revision.kind != svn_opt_revision_unspecified)        {          /* If an svn+ssh URL was used and it contains only one @,           * provide an error message that presents a possible solution           * to the parsing error (issue #2349). */          if (strncmp(path, "svn+ssh://", 10) == 0)            {              const char *at;              at = strchr(path, '@');              if (at && strrchr(path, '@') == at)                return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,                                         _("Syntax error parsing peg revision "                                           "'%s'; did you mean '%[email
C++ svn_error_trace函数代码示例
C++ svn_error_create函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。