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

📄 log.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
}/* Return the next interesting revision in our list of HISTORIES. */static svn_revnum_tnext_history_rev(apr_array_header_t *histories){  svn_revnum_t next_rev = SVN_INVALID_REVNUM;  int i;  for (i = 0; i < histories->nelts; ++i)    {      struct path_info *info = APR_ARRAY_IDX(histories, i,                                             struct path_info *);      if (info->done)        continue;      if (info->history_rev > next_rev)        next_rev = info->history_rev;    }  return next_rev;}/* Pass history information about REV to RECEIVER with its RECEIVER_BATON. * * FS is used with REV to fetch the interesting history information, * such as author, date, etc. * * The detect_changed function is used if either AUTHZ_READ_FUNC is * not NULL, or if DISCOVER_CHANGED_PATHS is TRUE.  See it for details. */static svn_error_t *send_change_rev(svn_revnum_t rev,                svn_fs_t *fs,                svn_boolean_t discover_changed_paths,                svn_repos_authz_func_t authz_read_func,                void *authz_read_baton,                svn_log_message_receiver_t receiver,                void *receiver_baton,                apr_pool_t *pool){  svn_string_t *author, *date, *message;  apr_hash_t *r_props, *changed_paths = NULL;  SVN_ERR(svn_fs_revision_proplist(&r_props, fs, rev, pool));  author = apr_hash_get(r_props, SVN_PROP_REVISION_AUTHOR,                        APR_HASH_KEY_STRING);  date = apr_hash_get(r_props, SVN_PROP_REVISION_DATE,                      APR_HASH_KEY_STRING);  message = apr_hash_get(r_props, SVN_PROP_REVISION_LOG,                         APR_HASH_KEY_STRING);  /* Discover changed paths if the user requested them     or if we need to check that they are readable. */  if ((rev > 0)              && (authz_read_func || discover_changed_paths))    {      svn_fs_root_t *newroot;      svn_error_t *patherr;      SVN_ERR(svn_fs_revision_root(&newroot, fs, rev, pool));      patherr = detect_changed(&changed_paths,                               newroot, fs,                               authz_read_func, authz_read_baton,                               pool);      if (patherr          && patherr->apr_err == SVN_ERR_AUTHZ_UNREADABLE)        {          /* All changed-paths are unreadable, so clear all fields. */          svn_error_clear(patherr);                        changed_paths = NULL;          author = NULL;          date = NULL;          message = NULL;        }      else if (patherr               && patherr->apr_err == SVN_ERR_AUTHZ_PARTIALLY_READABLE)        {          /* At least one changed-path was unreadable, so omit the             log message.  (The unreadable paths are already             missing from the hash.) */          svn_error_clear(patherr);          message = NULL;        }      else if (patherr)        return patherr;      /* It may be the case that an authz func was passed in, but         the user still doesn't want to see any changed-paths. */      if (! discover_changed_paths)        changed_paths = NULL;    }  SVN_ERR((*receiver)(receiver_baton,                      changed_paths,                      rev,                      author ? author->data : NULL,                      date ? date->data : NULL,                      message ? message->data : NULL,                      pool));  return SVN_NO_ERROR;}/* This controls how many history objects we keep open.  For any targets   over this number we have to open and close their histories as needed,   which is CPU intensive, but keeps us from using an unbounded amount of   memory. */#define MAX_OPEN_HISTORIES 32svn_error_t *svn_repos_get_logs3(svn_repos_t *repos,                    const apr_array_header_t *paths,                    svn_revnum_t start,                    svn_revnum_t end,                    int limit,                    svn_boolean_t discover_changed_paths,                    svn_boolean_t strict_node_history,                    svn_repos_authz_func_t authz_read_func,                    void *authz_read_baton,                    svn_log_message_receiver_t receiver,                    void *receiver_baton,                    apr_pool_t *pool){  svn_revnum_t head = SVN_INVALID_REVNUM;  apr_pool_t *subpool = svn_pool_create(pool);  svn_fs_t *fs = repos->fs;  apr_array_header_t *revs = NULL;  svn_revnum_t hist_end = end;  svn_revnum_t hist_start = start;  svn_revnum_t current;  apr_array_header_t *histories;  svn_boolean_t any_histories_left = TRUE;  int send_count = 0;  svn_fs_root_t *root;  int i;  SVN_ERR(svn_fs_youngest_rev(&head, fs, pool));  if (! SVN_IS_VALID_REVNUM(start))    start = head;  if (! SVN_IS_VALID_REVNUM(end))    end = head;  /* Check that revisions are sane before ever invoking receiver. */  if (start > head)    return svn_error_createf      (SVN_ERR_FS_NO_SUCH_REVISION, 0,       _("No such revision %ld"), start);  if (end > head)    return svn_error_createf      (SVN_ERR_FS_NO_SUCH_REVISION, 0,       _("No such revision %ld"), end);  /* Get an ordered copy of the start and end. */  if (start > end)    {      hist_start = end;      hist_end = start;    }  /* If paths were specified, then we only really care about revisions     in which those paths were changed.  So we ask the filesystem for     all the revisions in which any of the paths was changed.     SPECIAL CASE: If we were given only path, and that path is empty,     then the results are the same as if we were passed no paths at     all.  Why?  Because the answer to the question "In which     revisions was the root of the filesystem changed?" is always     "Every single one of them."  And since this section of code is     only about answering that question, and we already know the     answer ... well, you get the picture.  */  if (! paths ||      (paths->nelts == 1 &&       svn_path_is_empty(APR_ARRAY_IDX(paths, 0, const char *))))    {      /* They want history for the root path, so every rev has a change. */      send_count = hist_end - hist_start + 1;      if (limit && send_count > limit)        send_count = limit;      for (i = 0; i < send_count; ++i)        {          svn_revnum_t rev = hist_start + i;          svn_pool_clear(subpool);          if (start > end)            rev = hist_end - i;          SVN_ERR(send_change_rev(rev, fs,                                  discover_changed_paths,                                  authz_read_func, authz_read_baton,                                  receiver, receiver_baton, subpool));        }      svn_pool_destroy(subpool);      return SVN_NO_ERROR;    }  /* Create a history object for each path so we can walk through     them all at the same time until we have all changes or LIMIT     is reached.     There is some pool fun going on due to the fact that we have     to hold on to the old pool with the history before we can     get the next history.  */  histories = apr_array_make(pool, paths->nelts,                             sizeof(struct path_info *));  SVN_ERR(svn_fs_revision_root(&root, fs, hist_end, pool));  for (i = 0; i < paths->nelts; i++)    {      const char *this_path = APR_ARRAY_IDX(paths, i, const char *);      struct path_info *info = apr_palloc(pool,                                          sizeof(struct path_info));      if (authz_read_func)        {          svn_boolean_t readable;          svn_pool_clear(subpool);          SVN_ERR(authz_read_func(&readable, root, this_path,                                  authz_read_baton, subpool));          if (! readable)            return svn_error_create(SVN_ERR_AUTHZ_UNREADABLE, NULL, NULL);        }      info->path = svn_stringbuf_create(this_path, pool);      info->done = FALSE;      info->history_rev = hist_end;      info->first_time = TRUE;      if (i < MAX_OPEN_HISTORIES)        {          SVN_ERR(svn_fs_node_history(&info->hist, root, this_path, pool));          info->newpool = svn_pool_create(pool);          info->oldpool = svn_pool_create(pool);        }      else        {          info->hist = NULL;          info->oldpool = NULL;          info->newpool = NULL;        }      SVN_ERR(get_history(info, fs,                          strict_node_history,                          authz_read_func, authz_read_baton,                          hist_start, pool));      *((struct path_info **) apr_array_push(histories)) = info;    }  /* Loop through all the revisions in the range and add any     where a path was changed to the array, or if they wanted     history in reverse order just send it to them right away.  */  for (current = hist_end;       current >= hist_start && any_histories_left;       current = next_history_rev(histories))    {      svn_boolean_t changed = FALSE;      any_histories_left = FALSE;      svn_pool_clear(subpool);      for (i = 0; i < histories->nelts; i++)        {          struct path_info *info = APR_ARRAY_IDX(histories, i,                                                 struct path_info *);          /* Check history for this path in current rev. */          SVN_ERR(check_history(&changed, info, fs, current,                                strict_node_history,                                authz_read_func, authz_read_baton,                                hist_start, pool));          if (! info->done)            any_histories_left = TRUE;        }      /* If any of the paths changed in this rev then add or send it. */      if (changed)        {          /* If they wanted it in reverse order we can send it completely             streamily right now. */          if (start > end)            {              SVN_ERR(send_change_rev(current, fs,                                      discover_changed_paths,                                      authz_read_func, authz_read_baton,                                      receiver, receiver_baton,                                      subpool));              if (limit && ++send_count >= limit)                break;            }          else            {              /* They wanted it in forward order, so we have to buffer up                 a list of revs and process it later. */              if (! revs)                revs = apr_array_make(pool, 64, sizeof(svn_revnum_t));              *(svn_revnum_t*) apr_array_push(revs) = current;            }        }    }  if (revs)    {      /* Work loop for processing the revisions we found since they wanted         history in forward order. */      for (i = 0; i < revs->nelts; ++i)        {          svn_pool_clear(subpool);          SVN_ERR(send_change_rev(APR_ARRAY_IDX(revs, revs->nelts - i - 1,                                                svn_revnum_t),                                  fs, discover_changed_paths,                                  authz_read_func, authz_read_baton,                                  receiver, receiver_baton, subpool));          if (limit && i + 1 >= limit)            break;        }    }  svn_pool_destroy(subpool);  return SVN_NO_ERROR;}svn_error_t *svn_repos_get_logs2(svn_repos_t *repos,                    const apr_array_header_t *paths,                    svn_revnum_t start,                    svn_revnum_t end,                    svn_boolean_t discover_changed_paths,                    svn_boolean_t strict_node_history,                    svn_repos_authz_func_t authz_read_func,                    void *authz_read_baton,                    svn_log_message_receiver_t receiver,                    void *receiver_baton,                    apr_pool_t *pool){  return svn_repos_get_logs3(repos, paths, start, end, 0,                             discover_changed_paths, strict_node_history,                             authz_read_func, authz_read_baton, receiver,                             receiver_baton, pool);}svn_error_t *svn_repos_get_logs(svn_repos_t *repos,                   const apr_array_header_t *paths,                   svn_revnum_t start,                   svn_revnum_t end,                   svn_boolean_t discover_changed_paths,                   svn_boolean_t strict_node_history,                   svn_log_message_receiver_t receiver,                   void *receiver_baton,                   apr_pool_t *pool){  return svn_repos_get_logs3(repos, paths, start, end, 0,                             discover_changed_paths, strict_node_history,                             NULL, NULL, /* no authz stuff */                             receiver, receiver_baton, pool);}

⌨️ 快捷键说明

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